You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/10/23 23:49:08 UTC

[lucenenet] branch master updated (dd7ed62 -> 6632a68)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.


    from dd7ed62  BUG: Lucene.Net.Tests.Suggest.Suggest.Analyzing.TestFreeTextSuggester::TestRandom(): LookupResult calculation in the test was using different order of parentheses than the production code. This bug existed in Java, but apparently the order makes no difference on that platform. This test was getting a false positive because it was using List<T>.ToString() to make the result comparison, which J2N's List<T> corrects.
     new b02fb28  BUG: Lucene.Net.Search.TestBooleanQuery::TestBS2DisjunctionNextVsAdvance(): Use Assert.AreEqual instead of Asssert.IsTrue with == to fix floating point comparison on x86 .NET Framework with optimizations enabled.
     new 8e5ecaf  BUG: Lucene.Net.Search.FuzzyTermsEnum: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestBooleanQuery.TestBS2DisjunctionNextVsAdvance(), Lucene.Net.Search.TestFuzzyQuery.TestTieBreaker(), and Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTieBreaker(). See #269.
     new 266afb3  BUG: Lucene.Net.Search.TopScoreDocCollector: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestTopDocsMerge::TestSort_1(), Lucene.Net.Search.TestTopDocsMerge::TestSort_2(), and Lucene.Net.Search.TestSearchAfter.TestQueries(). See #269.
     new f6c668d  BUG: Lucene.Net.Sandbox.Queries.SlowFuzzyTermsEnum::Accept(): Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTokenLengthOpt(). See #269.
     new 96403bc  Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: Compare using NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. See #269.
     new cb4bc0c  SWEEP: Lucene.Net: Use NumericUtils.SingleToSortableInt32() to compare floating point numbers (except in cases where we are testing for whole numbers).
     new bfa4c68  BUG: Lucene.Net.Expressions.ScoreFunctionValues::DoubleVal(): Assigning float to double loses precision in x86 .NET Framework. Do an intermediate cast to decimal to fix Lucene.Net.Expressions.TestExpressionSorts::TestQueries(). See #269.
     new d89d02a  Lucene.Net.Expressions.ExpressionComparer: Use J2N.Collections.Generic.Comparer<double> to ensure we use the same comparison logic as in Java.
     new 6632a68  azure-pipelines.yml: Decreased maximum allowed failures to 2 on all test jobs

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 azure-pipelines.yml                                | 40 ++++++++++----------
 src/Lucene.Net.Expressions/ExpressionComparator.cs | 10 +++--
 src/Lucene.Net.Expressions/ScoreFunctionValues.cs  |  6 +++
 .../Queries/FuzzyLikeThisQuery.cs                  |  9 ++---
 .../Queries/SlowFuzzyTermsEnum.cs                  |  6 +--
 .../TestExpressionSorts.cs                         |  3 --
 .../Queries/TestSlowFuzzyQuery.cs                  |  3 --
 src/Lucene.Net.Tests/Search/TestBooleanQuery.cs    |  7 ++--
 src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs      |  3 --
 src/Lucene.Net/Search/BooleanQuery.cs              |  4 +-
 src/Lucene.Net/Search/DisjunctionMaxQuery.cs       |  5 ++-
 src/Lucene.Net/Search/FieldCache.cs                |  3 +-
 src/Lucene.Net/Search/FuzzyTermsEnum.cs            | 14 ++++---
 src/Lucene.Net/Search/HitQueue.cs                  |  7 ++--
 src/Lucene.Net/Search/IndexSearcher.cs             |  4 +-
 src/Lucene.Net/Search/MatchAllDocsQuery.cs         |  4 +-
 src/Lucene.Net/Search/MultiPhraseQuery.cs          |  8 ++--
 src/Lucene.Net/Search/PhraseQuery.cs               |  4 +-
 src/Lucene.Net/Search/QueryRescorer.cs             |  8 ++--
 src/Lucene.Net/Search/ScoringRewrite.cs            |  6 ++-
 .../Search/Spans/FieldMaskingSpanQuery.cs          |  6 ++-
 src/Lucene.Net/Search/Spans/SpanFirstQuery.cs      |  6 ++-
 .../Search/Spans/SpanNearPayloadCheckQuery.cs      |  8 ++--
 src/Lucene.Net/Search/Spans/SpanNearQuery.cs       |  4 +-
 src/Lucene.Net/Search/Spans/SpanOrQuery.cs         |  4 +-
 .../Search/Spans/SpanPayloadCheckQuery.cs          |  8 ++--
 .../Search/Spans/SpanPositionRangeQuery.cs         |  6 ++-
 src/Lucene.Net/Search/TermQuery.cs                 |  5 ++-
 src/Lucene.Net/Search/TopDocs.cs                   |  6 ++-
 src/Lucene.Net/Search/TopFieldCollector.cs         | 15 +++++---
 src/Lucene.Net/Search/TopScoreDocCollector.cs      | 43 +++++++++++-----------
 src/Lucene.Net/Search/TopTermsRewrite.cs           | 15 +++++---
 src/Lucene.Net/Util/Mutable/MutableValueDouble.cs  |  4 +-
 src/Lucene.Net/Util/Mutable/MutableValueFloat.cs   |  6 ++-
 src/Lucene.Net/Util/Packed/PackedInts.cs           |  3 +-
 35 files changed, 175 insertions(+), 118 deletions(-)

[lucenenet] 03/09: BUG: Lucene.Net.Search.TopScoreDocCollector: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestTopDocsMerge::TestSort_1(), Lucene.Net.Search.TestTopDocsMerge::TestSort_2(), and Lucene.Net.Search.TestSearchAfter.TestQueries(). See #269.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 266afb355c30d6d977e3908c2c5226ed38a2bb18
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Oct 23 20:31:02 2021 +0700

    BUG: Lucene.Net.Search.TopScoreDocCollector: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestTopDocsMerge::TestSort_1(), Lucene.Net.Search.TestTopDocsMerge::TestSort_2(), and Lucene.Net.Search.TestSearchAfter.TestQueries(). See #269.
---
 src/Lucene.Net/Search/TopScoreDocCollector.cs | 43 ++++++++++++++-------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/src/Lucene.Net/Search/TopScoreDocCollector.cs b/src/Lucene.Net/Search/TopScoreDocCollector.cs
index 0b24902..d1f87ad 100644
--- a/src/Lucene.Net/Search/TopScoreDocCollector.cs
+++ b/src/Lucene.Net/Search/TopScoreDocCollector.cs
@@ -1,7 +1,7 @@
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 using System;
-using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Search
 {
@@ -47,9 +47,6 @@ namespace Lucene.Net.Search
             {
             }
 
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled
-#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -62,7 +59,8 @@ namespace Lucene.Net.Search
                 }
 
                 m_totalHits++;
-                if (score <= pqTop.Score)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(score) <= NumericUtils.SingleToSortableInt32(pqTop.Score))
                 {
                     // Since docs are returned in-order (i.e., increasing doc Id), a document
                     // with equal score to pqTop.score cannot compete since HitQueue favors
@@ -93,9 +91,6 @@ namespace Lucene.Net.Search
                 this.after = after;
             }
 
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled
-#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -109,13 +104,17 @@ namespace Lucene.Net.Search
 
                 m_totalHits++;
 
-                if (score > after.Score || (score == after.Score && doc <= afterDoc))
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                int scoreBits = NumericUtils.SingleToSortableInt32(score);
+                int afterBits = NumericUtils.SingleToSortableInt32(after.Score);
+
+                if (scoreBits > afterBits || (scoreBits == afterBits && doc <= afterDoc))
                 {
                     // hit was collected on a previous page
                     return;
                 }
 
-                if (score <= pqTop.Score)
+                if (scoreBits <= NumericUtils.SingleToSortableInt32(pqTop.Score))
                 {
                     // Since docs are returned in-order (i.e., increasing doc Id), a document
                     // with equal score to pqTop.score cannot compete since HitQueue favors
@@ -153,9 +152,6 @@ namespace Lucene.Net.Search
             {
             }
 
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled
-#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -164,13 +160,17 @@ namespace Lucene.Net.Search
                 if (Debugging.AssertsEnabled) Debugging.Assert(!float.IsNaN(score));
 
                 m_totalHits++;
-                if (score < pqTop.Score)
+
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                int scoreBits = NumericUtils.SingleToSortableInt32(score);
+                int pqTopBits = NumericUtils.SingleToSortableInt32(pqTop.Score);
+                if (scoreBits < pqTopBits)
                 {
                     // Doesn't compete w/ bottom entry in queue
                     return;
                 }
                 doc += docBase;
-                if (score == pqTop.Score && doc > pqTop.Doc)
+                if (scoreBits == pqTopBits && doc > pqTop.Doc)
                 {
                     // Break tie in score by doc ID:
                     return;
@@ -199,9 +199,6 @@ namespace Lucene.Net.Search
                 this.after = after;
             }
 
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled
-#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -210,18 +207,22 @@ namespace Lucene.Net.Search
                 if (Debugging.AssertsEnabled) Debugging.Assert(!float.IsNaN(score));
 
                 m_totalHits++;
-                if (score > after.Score || (score == after.Score && doc <= afterDoc))
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                int scoreBits = NumericUtils.SingleToSortableInt32(score);
+                int afterBits = NumericUtils.SingleToSortableInt32(after.Score);
+                if (scoreBits > afterBits || (scoreBits == afterBits && doc <= afterDoc))
                 {
                     // hit was collected on a previous page
                     return;
                 }
-                if (score < pqTop.Score)
+                int pqTopBits = NumericUtils.SingleToSortableInt32(pqTop.Score);
+                if (scoreBits < pqTopBits)
                 {
                     // Doesn't compete w/ bottom entry in queue
                     return;
                 }
                 doc += docBase;
-                if (score == pqTop.Score && doc > pqTop.Doc)
+                if (scoreBits == pqTopBits && doc > pqTop.Doc)
                 {
                     // Break tie in score by doc ID:
                     return;

[lucenenet] 08/09: Lucene.Net.Expressions.ExpressionComparer: Use J2N.Collections.Generic.Comparer to ensure we use the same comparison logic as in Java.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit d89d02af6cd9837bd58440dc32fba277e0b2df5b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 24 04:03:38 2021 +0700

    Lucene.Net.Expressions.ExpressionComparer: Use J2N.Collections.Generic.Comparer<double> to ensure we use the same comparison logic as in Java.
---
 src/Lucene.Net.Expressions/ExpressionComparator.cs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Expressions/ExpressionComparator.cs b/src/Lucene.Net.Expressions/ExpressionComparator.cs
index 184d4aa..410b8a7 100644
--- a/src/Lucene.Net.Expressions/ExpressionComparator.cs
+++ b/src/Lucene.Net.Expressions/ExpressionComparator.cs
@@ -6,6 +6,7 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
+using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Expressions
 {
@@ -65,7 +66,8 @@ namespace Lucene.Net.Expressions
 
         public override int Compare(int slot1, int slot2)
         {
-            return values[slot1].CompareTo(values[slot2]);
+            // LUCENENET specific - use JCG comparer to get the same logic as Java
+            return JCG.Comparer<double>.Default.Compare(values[slot1], values[slot2]);
         }
 
         public override void SetBottom(int slot)
@@ -80,7 +82,8 @@ namespace Lucene.Net.Expressions
 
         public override int CompareBottom(int doc)
         {
-            return bottom.CompareTo(scores.DoubleVal(doc));
+            // LUCENENET specific - use JCG comparer to get the same logic as Java
+            return JCG.Comparer<double>.Default.Compare(bottom, scores.DoubleVal(doc));
         }
 
         public override void Copy(int slot, int doc)
@@ -99,7 +102,8 @@ namespace Lucene.Net.Expressions
 
         public override int CompareTop(int doc)
         {
-            return topValue.CompareTo(scores.DoubleVal(doc));
+            // LUCENENET specific - use JCG comparer to get the same logic as Java
+            return JCG.Comparer<double>.Default.Compare(topValue, scores.DoubleVal(doc));
         }
     }
 }

[lucenenet] 09/09: azure-pipelines.yml: Decreased maximum allowed failures to 2 on all test jobs

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 6632a68d2e5bec9224d128d1de9dd7f1385afbfa
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 24 05:37:45 2021 +0700

    azure-pipelines.yml: Decreased maximum allowed failures to 2 on all test jobs
---
 azure-pipelines.yml | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 16468f6..fd101c1 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -334,17 +334,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test net6.0,x64 on'
     pool:
       vmImage: $(imageName)
@@ -368,17 +368,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test net6.0,x86 on'
     pool:
       vmImage: $(imageName)
@@ -402,17 +402,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test net5.0,x64 on'
     pool:
       vmImage: $(imageName)
@@ -436,17 +436,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test net5.0,x86 on'
     pool:
       vmImage: $(imageName)
@@ -470,17 +470,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test netcoreapp3.1,x64 on'
     pool:
       vmImage: $(imageName)
@@ -504,17 +504,17 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-latest'
           maximumParallelJobs: 7
-          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test netcoreapp3.1,x86 on'
     pool:
       vmImage: $(imageName)
@@ -562,7 +562,7 @@ stages:
           osName: 'Windows'
           imageName: 'windows-2019'
           maximumParallelJobs: 8
-          maximumAllowedFailures: 9 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
     displayName: 'Test net461,x86 on'
     pool:
       vmImage: $(imageName)
@@ -610,7 +610,7 @@ stages:
         nugetArtifactName: '$(NuGetArtifactName)'
         testResultsArtifactName: '$(TestResultsArtifactName)'
         maximumParallelJobs: 8
-        maximumAllowedFailures: 5 # Maximum allowed failures for a successful build
+        maximumAllowedFailures: 2 # Maximum allowed failures for a successful build
 
 
 - stage: Publish_Stage

[lucenenet] 06/09: SWEEP: Lucene.Net: Use NumericUtils.SingleToSortableInt32() to compare floating point numbers (except in cases where we are testing for whole numbers).

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit cb4bc0c5abeecbb747c7bff264c01a896188f1a7
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 24 04:42:45 2021 +0700

    SWEEP: Lucene.Net: Use NumericUtils.SingleToSortableInt32() to compare floating point numbers (except in cases where we are testing for whole numbers).
---
 src/Lucene.Net/Search/BooleanQuery.cs                    |  4 +++-
 src/Lucene.Net/Search/DisjunctionMaxQuery.cs             |  5 +++--
 src/Lucene.Net/Search/FieldCache.cs                      |  3 ++-
 src/Lucene.Net/Search/HitQueue.cs                        |  7 ++++---
 src/Lucene.Net/Search/IndexSearcher.cs                   |  4 +++-
 src/Lucene.Net/Search/MatchAllDocsQuery.cs               |  4 +++-
 src/Lucene.Net/Search/MultiPhraseQuery.cs                |  8 +++++---
 src/Lucene.Net/Search/PhraseQuery.cs                     |  4 +++-
 src/Lucene.Net/Search/QueryRescorer.cs                   |  8 +++++---
 src/Lucene.Net/Search/ScoringRewrite.cs                  |  6 ++++--
 src/Lucene.Net/Search/Spans/FieldMaskingSpanQuery.cs     |  6 +++++-
 src/Lucene.Net/Search/Spans/SpanFirstQuery.cs            |  6 +++++-
 src/Lucene.Net/Search/Spans/SpanNearPayloadCheckQuery.cs |  8 +++++---
 src/Lucene.Net/Search/Spans/SpanNearQuery.cs             |  4 +++-
 src/Lucene.Net/Search/Spans/SpanOrQuery.cs               |  4 +++-
 src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs     |  8 +++++---
 src/Lucene.Net/Search/Spans/SpanPositionRangeQuery.cs    |  6 +++++-
 src/Lucene.Net/Search/TermQuery.cs                       |  5 ++++-
 src/Lucene.Net/Search/TopDocs.cs                         |  6 ++++--
 src/Lucene.Net/Search/TopFieldCollector.cs               | 15 ++++++++++-----
 src/Lucene.Net/Search/TopTermsRewrite.cs                 | 15 ++++++++++-----
 src/Lucene.Net/Util/Mutable/MutableValueDouble.cs        |  4 +++-
 src/Lucene.Net/Util/Mutable/MutableValueFloat.cs         |  6 ++++--
 src/Lucene.Net/Util/Packed/PackedInts.cs                 |  3 ++-
 24 files changed, 103 insertions(+), 46 deletions(-)

diff --git a/src/Lucene.Net/Search/BooleanQuery.cs b/src/Lucene.Net/Search/BooleanQuery.cs
index bd1c529..13c412e 100644
--- a/src/Lucene.Net/Search/BooleanQuery.cs
+++ b/src/Lucene.Net/Search/BooleanQuery.cs
@@ -1,5 +1,6 @@
 using J2N;
 using J2N.Collections.Generic.Extensions;
+using Lucene.Net.Util;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -681,7 +682,8 @@ namespace Lucene.Net.Search
                 return false;
             }
             BooleanQuery other = (BooleanQuery)o;
-            return this.Boost == other.Boost
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost)
                 && this.clauses.Equals(other.clauses)
                 && this.MinimumNumberShouldMatch == other.MinimumNumberShouldMatch
                 && this.disableCoord == other.disableCoord;
diff --git a/src/Lucene.Net/Search/DisjunctionMaxQuery.cs b/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
index 35c8a4a..1d3358d 100644
--- a/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
+++ b/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
@@ -357,8 +357,9 @@ namespace Lucene.Net.Search
                 return false;
             }
             DisjunctionMaxQuery other = (DisjunctionMaxQuery)o;
-            return this.Boost == other.Boost 
-                && this.tieBreakerMultiplier == other.tieBreakerMultiplier 
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost)
+                && NumericUtils.SingleToSortableInt32(this.tieBreakerMultiplier) == NumericUtils.SingleToSortableInt32(other.tieBreakerMultiplier)
                 && this.disjuncts.Equals(other.disjuncts);
         }
 
diff --git a/src/Lucene.Net/Search/FieldCache.cs b/src/Lucene.Net/Search/FieldCache.cs
index daf1447..63812bc 100644
--- a/src/Lucene.Net/Search/FieldCache.cs
+++ b/src/Lucene.Net/Search/FieldCache.cs
@@ -1127,7 +1127,8 @@ namespace Lucene.Net.Search
             {
                 if (obj is AcceptableOverheadRatio other)
                 {
-                    return Value.Equals(other.Value);
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    return NumericUtils.SingleToSortableInt32(Value) == NumericUtils.SingleToSortableInt32(other.Value);
                 }
                 return false;
             }
diff --git a/src/Lucene.Net/Search/HitQueue.cs b/src/Lucene.Net/Search/HitQueue.cs
index 44d481a..0bc01eb 100644
--- a/src/Lucene.Net/Search/HitQueue.cs
+++ b/src/Lucene.Net/Search/HitQueue.cs
@@ -1,4 +1,4 @@
-namespace Lucene.Net.Search
+namespace Lucene.Net.Search
 {
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -76,13 +76,14 @@ namespace Lucene.Net.Search
 
         protected internal override sealed bool LessThan(ScoreDoc hitA, ScoreDoc hitB)
         {
-            if (hitA.Score == hitB.Score)
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            if (NumericUtils.SingleToSortableInt32(hitA.Score) == NumericUtils.SingleToSortableInt32(hitB.Score))
             {
                 return hitA.Doc > hitB.Doc;
             }
             else
             {
-                return hitA.Score < hitB.Score;
+                return NumericUtils.SingleToSortableInt32(hitA.Score) < NumericUtils.SingleToSortableInt32(hitB.Score);
             }
         }
     }
diff --git a/src/Lucene.Net/Search/IndexSearcher.cs b/src/Lucene.Net/Search/IndexSearcher.cs
index f76d991..712de33 100644
--- a/src/Lucene.Net/Search/IndexSearcher.cs
+++ b/src/Lucene.Net/Search/IndexSearcher.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using Lucene.Net.Support.Threading;
+using Lucene.Net.Util;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -818,7 +819,8 @@ namespace Lucene.Net.Search
                     }
 
                     // Carry over maxScore from sub:
-                    if (doMaxScore && docs.MaxScore > hq.maxScore)
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (doMaxScore && NumericUtils.SingleToSortableInt32(docs.MaxScore) > NumericUtils.SingleToSortableInt32(hq.maxScore))
                     {
                         hq.maxScore = docs.MaxScore;
                     }
diff --git a/src/Lucene.Net/Search/MatchAllDocsQuery.cs b/src/Lucene.Net/Search/MatchAllDocsQuery.cs
index f76beed..eda5d3e 100644
--- a/src/Lucene.Net/Search/MatchAllDocsQuery.cs
+++ b/src/Lucene.Net/Search/MatchAllDocsQuery.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Util;
 using System.Collections.Generic;
 using System.Text;
 
@@ -155,7 +156,8 @@ namespace Lucene.Net.Search
                 return false;
             }
             MatchAllDocsQuery other = (MatchAllDocsQuery)o;
-            return this.Boost == other.Boost;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/MultiPhraseQuery.cs b/src/Lucene.Net/Search/MultiPhraseQuery.cs
index 69f34d3..06e6048 100644
--- a/src/Lucene.Net/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net/Search/MultiPhraseQuery.cs
@@ -26,6 +26,7 @@ namespace Lucene.Net.Search
      */
 
     using J2N.Collections.Generic.Extensions;
+    using Lucene.Net.Util;
     using System.Collections;
     using ArrayUtil = Lucene.Net.Util.ArrayUtil;
     using AtomicReader = Lucene.Net.Index.AtomicReader;
@@ -444,9 +445,10 @@ namespace Lucene.Net.Search
                 return false;
             }
             MultiPhraseQuery other = (MultiPhraseQuery)o;
-            return this.Boost == other.Boost 
-                && this.slop == other.slop 
-                && TermArraysEquals(this.termArrays, other.termArrays) 
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost)
+                && this.slop == other.slop
+                && TermArraysEquals(this.termArrays, other.termArrays)
                 && this.positions.Equals(other.positions);
         }
 
diff --git a/src/Lucene.Net/Search/PhraseQuery.cs b/src/Lucene.Net/Search/PhraseQuery.cs
index 4160b07..b598099 100644
--- a/src/Lucene.Net/Search/PhraseQuery.cs
+++ b/src/Lucene.Net/Search/PhraseQuery.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -504,7 +505,8 @@ namespace Lucene.Net.Search
                 return false;
             }
             PhraseQuery other = (PhraseQuery)o;
-            return (this.Boost == other.Boost) 
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return (NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost)) 
                 && (this.slop == other.slop) 
                 && this.terms.Equals(other.terms) 
                 && this.positions.Equals(other.positions);
diff --git a/src/Lucene.Net/Search/QueryRescorer.cs b/src/Lucene.Net/Search/QueryRescorer.cs
index 9dd70d0..df53424 100644
--- a/src/Lucene.Net/Search/QueryRescorer.cs
+++ b/src/Lucene.Net/Search/QueryRescorer.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 
@@ -114,11 +115,12 @@ namespace Lucene.Net.Search
             Array.Sort(hits, Comparer<ScoreDoc>.Create((a, b) =>
             {
                 // Sort by score descending, then docID ascending:
-                if (a.Score > b.Score)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(a.Score) > NumericUtils.SingleToSortableInt32(b.Score))
                 {
                     return -1;
                 }
-                else if (a.Score < b.Score)
+                else if (NumericUtils.SingleToSortableInt32(a.Score) < NumericUtils.SingleToSortableInt32(b.Score))
                 {
                     return 1;
                 }
diff --git a/src/Lucene.Net/Search/ScoringRewrite.cs b/src/Lucene.Net/Search/ScoringRewrite.cs
index 67de649..1ed03ff 100644
--- a/src/Lucene.Net/Search/ScoringRewrite.cs
+++ b/src/Lucene.Net/Search/ScoringRewrite.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System;
 
 namespace Lucene.Net.Search
@@ -174,7 +175,8 @@ namespace Lucene.Net.Search
                     // duplicate term: update docFreq
                     int pos = (-e) - 1;
                     array.termState[pos].Register(state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq);
-                    if (Debugging.AssertsEnabled) Debugging.Assert(array.boost[pos] == boostAtt.Boost, "boost should be equal in all segment TermsEnums");
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (Debugging.AssertsEnabled) Debugging.Assert(NumericUtils.SingleToSortableInt32(array.boost[pos]) == NumericUtils.SingleToSortableInt32(boostAtt.Boost), "boost should be equal in all segment TermsEnums");
                 }
                 else
                 {
diff --git a/src/Lucene.Net/Search/Spans/FieldMaskingSpanQuery.cs b/src/Lucene.Net/Search/Spans/FieldMaskingSpanQuery.cs
index 8a16895..5a1782a 100644
--- a/src/Lucene.Net/Search/Spans/FieldMaskingSpanQuery.cs
+++ b/src/Lucene.Net/Search/Spans/FieldMaskingSpanQuery.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -144,7 +145,10 @@ namespace Lucene.Net.Search.Spans
                 return false;
             }
             FieldMaskingSpanQuery other = (FieldMaskingSpanQuery)o;
-            return (this.Field.Equals(other.Field, StringComparison.Ordinal) && (this.Boost == other.Boost) && this.MaskedQuery.Equals(other.MaskedQuery));
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return (this.Field.Equals(other.Field, StringComparison.Ordinal)
+                && (NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost))
+                && this.MaskedQuery.Equals(other.MaskedQuery));
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanFirstQuery.cs b/src/Lucene.Net/Search/Spans/SpanFirstQuery.cs
index 57d6964..fd393f5 100644
--- a/src/Lucene.Net/Search/Spans/SpanFirstQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanFirstQuery.cs
@@ -1,5 +1,6 @@
 using J2N.Numerics;
 using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System.Text;
 
 namespace Lucene.Net.Search.Spans
@@ -88,7 +89,10 @@ namespace Lucene.Net.Search.Spans
             }
 
             SpanFirstQuery other = (SpanFirstQuery)o;
-            return this.m_end == other.m_end && this.m_match.Equals(other.m_match) && this.Boost == other.Boost;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return this.m_end == other.m_end
+                && this.m_match.Equals(other.m_match)
+                && NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanNearPayloadCheckQuery.cs b/src/Lucene.Net/Search/Spans/SpanNearPayloadCheckQuery.cs
index 73a8f49..0839c6c 100644
--- a/src/Lucene.Net/Search/Spans/SpanNearPayloadCheckQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanNearPayloadCheckQuery.cs
@@ -1,5 +1,6 @@
 using J2N.Numerics;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
@@ -130,9 +131,10 @@ namespace Lucene.Net.Search.Spans
             }
 
             // LUCENENET NOTE: Need to use the structural equality comparer to compare equality of all contained values
-            return payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch) 
-                && this.m_match.Equals(other.m_match) 
-                && this.Boost == other.Boost;
+            return payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch)
+                && this.m_match.Equals(other.m_match)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                && NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
index 4d419f8..21a058e 100644
--- a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
@@ -1,5 +1,6 @@
 using J2N.Collections.Generic.Extensions;
 using J2N.Numerics;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -209,7 +210,8 @@ namespace Lucene.Net.Search.Spans
                 return false;
             }
 
-            return Boost == spanNearQuery.Boost;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(Boost) == NumericUtils.SingleToSortableInt32(spanNearQuery.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanOrQuery.cs b/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
index 484e4cf..2d9e297 100644
--- a/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
@@ -1,5 +1,6 @@
 using J2N.Collections.Generic.Extensions;
 using J2N.Numerics;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -163,7 +164,8 @@ namespace Lucene.Net.Search.Spans
                 return false;
             }
 
-            return Boost == that.Boost;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(Boost) == NumericUtils.SingleToSortableInt32(that.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs b/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
index 9fb0dc2..7bd4b45 100644
--- a/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
@@ -4,6 +4,7 @@ using System;
 using System.Text;
 using System.Collections;
 using J2N.Numerics;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Search.Spans
 {
@@ -134,9 +135,10 @@ namespace Lucene.Net.Search.Spans
 
             SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o;
             // LUCENENET NOTE: Need to use the structural equality comparer to compare equality of all contained values
-            return payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch) 
-                && this.m_match.Equals(other.m_match) 
-                && this.Boost == other.Boost;
+            return payloadEqualityComparer.Equals(this.m_payloadToMatch, other.m_payloadToMatch)
+                && this.m_match.Equals(other.m_match)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                && NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/Spans/SpanPositionRangeQuery.cs b/src/Lucene.Net/Search/Spans/SpanPositionRangeQuery.cs
index b37b948..1ae24c2 100644
--- a/src/Lucene.Net/Search/Spans/SpanPositionRangeQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanPositionRangeQuery.cs
@@ -1,5 +1,6 @@
 using J2N.Numerics;
 using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System.Text;
 
 namespace Lucene.Net.Search.Spans
@@ -93,7 +94,10 @@ namespace Lucene.Net.Search.Spans
             }
 
             SpanPositionRangeQuery other = (SpanPositionRangeQuery)o;
-            return this.m_end == other.m_end && this.m_start == other.m_start && this.m_match.Equals(other.m_match) && this.Boost == other.Boost;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return this.m_end == other.m_end
+                && this.m_start == other.m_start
+                && this.m_match.Equals(other.m_match) && NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net/Search/TermQuery.cs b/src/Lucene.Net/Search/TermQuery.cs
index e9bb646..f3469d4 100644
--- a/src/Lucene.Net/Search/TermQuery.cs
+++ b/src/Lucene.Net/Search/TermQuery.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -233,7 +234,9 @@ namespace Lucene.Net.Search
                 return false;
             }
             TermQuery other = (TermQuery)o;
-            return (this.Boost == other.Boost) && this.term.Equals(other.term);
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return (NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost))
+                && this.term.Equals(other.term);
         }
 
         /// <summary>
diff --git a/src/Lucene.Net/Search/TopDocs.cs b/src/Lucene.Net/Search/TopDocs.cs
index c142bad..38a5e76 100644
--- a/src/Lucene.Net/Search/TopDocs.cs
+++ b/src/Lucene.Net/Search/TopDocs.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 using System;
 using System.Diagnostics.CodeAnalysis;
 using System.Runtime.CompilerServices;
@@ -111,11 +112,12 @@ namespace Lucene.Net.Search
                 float firstScore = shardHits[first.ShardIndex][first.HitIndex].Score;
                 float secondScore = shardHits[second.ShardIndex][second.HitIndex].Score;
 
-                if (firstScore < secondScore)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(firstScore) < NumericUtils.SingleToSortableInt32(secondScore))
                 {
                     return false;
                 }
-                else if (firstScore > secondScore)
+                else if (NumericUtils.SingleToSortableInt32(firstScore) > NumericUtils.SingleToSortableInt32(secondScore))
                 {
                     return true;
                 }
diff --git a/src/Lucene.Net/Search/TopFieldCollector.cs b/src/Lucene.Net/Search/TopFieldCollector.cs
index df83744..8e94e0e 100644
--- a/src/Lucene.Net/Search/TopFieldCollector.cs
+++ b/src/Lucene.Net/Search/TopFieldCollector.cs
@@ -299,7 +299,8 @@ namespace Lucene.Net.Search
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
-                if (score > maxScore)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(score) > NumericUtils.SingleToSortableInt32(maxScore))
                 {
                     maxScore = score;
                 }
@@ -355,7 +356,8 @@ namespace Lucene.Net.Search
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
-                if (score > maxScore)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(score) > NumericUtils.SingleToSortableInt32(maxScore))
                 {
                     maxScore = score;
                 }
@@ -600,7 +602,8 @@ namespace Lucene.Net.Search
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
-                if (score > maxScore)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(score) > NumericUtils.SingleToSortableInt32(maxScore))
                 {
                     maxScore = score;
                 }
@@ -685,7 +688,8 @@ namespace Lucene.Net.Search
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
-                if (score > maxScore)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(score) > NumericUtils.SingleToSortableInt32(maxScore))
                 {
                     maxScore = score;
                 }
@@ -990,7 +994,8 @@ namespace Lucene.Net.Search
                 if (trackMaxScore)
                 {
                     score = scorer.GetScore();
-                    if (score > maxScore)
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (NumericUtils.SingleToSortableInt32(score) > NumericUtils.SingleToSortableInt32(maxScore))
                     {
                         maxScore = score;
                     }
diff --git a/src/Lucene.Net/Search/TopTermsRewrite.cs b/src/Lucene.Net/Search/TopTermsRewrite.cs
index 08e4a50..7d489db 100644
--- a/src/Lucene.Net/Search/TopTermsRewrite.cs
+++ b/src/Lucene.Net/Search/TopTermsRewrite.cs
@@ -1,5 +1,6 @@
-using J2N.Collections.Generic.Extensions;
+using J2N.Collections.Generic.Extensions;
 using Lucene.Net.Diagnostics;
+using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using JCG = J2N.Collections.Generic;
@@ -161,11 +162,13 @@ namespace Lucene.Net.Search
                 if (stQueue.Count == maxSize)
                 {
                     ScoreTerm t = stQueue.Peek();
-                    if (boost < t.Boost)
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (NumericUtils.SingleToSortableInt32(boost) < NumericUtils.SingleToSortableInt32(t.Boost))
                     {
                         return true;
                     }
-                    if (boost == t.Boost && termComp.Compare(bytes, t.Bytes) > 0)
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (NumericUtils.SingleToSortableInt32(boost) == NumericUtils.SingleToSortableInt32(t.Boost) && termComp.Compare(bytes, t.Bytes) > 0)
                     {
                         return true;
                     }
@@ -175,7 +178,8 @@ namespace Lucene.Net.Search
                 if (visitedTerms.TryGetValue(bytes, out ScoreTerm t2))
                 {
                     // if the term is already in the PQ, only update docFreq of term in PQ
-                    if (Debugging.AssertsEnabled) Debugging.Assert(t2.Boost == boost, "boost should be equal in all segment TermsEnums");
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (Debugging.AssertsEnabled) Debugging.Assert(NumericUtils.SingleToSortableInt32(t2.Boost) == NumericUtils.SingleToSortableInt32(boost), "boost should be equal in all segment TermsEnums");
                     t2.TermState.Register(state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq);
                 }
                 else
@@ -264,7 +268,8 @@ namespace Lucene.Net.Search
 
             public int CompareTo(ScoreTerm other)
             {
-                if (this.Boost == other.Boost)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(this.Boost) == NumericUtils.SingleToSortableInt32(other.Boost))
                 {
                     return TermComp.Compare(other.Bytes, this.Bytes);
                 }
diff --git a/src/Lucene.Net/Util/Mutable/MutableValueDouble.cs b/src/Lucene.Net/Util/Mutable/MutableValueDouble.cs
index 2490cc8..c846f1d 100644
--- a/src/Lucene.Net/Util/Mutable/MutableValueDouble.cs
+++ b/src/Lucene.Net/Util/Mutable/MutableValueDouble.cs
@@ -56,7 +56,9 @@ namespace Lucene.Net.Util.Mutable
         public override bool EqualsSameType(object other)
         {
             MutableValueDouble b = (MutableValueDouble)other;
-            return Value == b.Value && Exists == b.Exists;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.DoubleToSortableInt64(Value) == NumericUtils.DoubleToSortableInt64(b.Value)
+                && Exists == b.Exists;
         }
 
         public override int CompareSameType(object other)
diff --git a/src/Lucene.Net/Util/Mutable/MutableValueFloat.cs b/src/Lucene.Net/Util/Mutable/MutableValueFloat.cs
index 59ff786..de6d8cd 100644
--- a/src/Lucene.Net/Util/Mutable/MutableValueFloat.cs
+++ b/src/Lucene.Net/Util/Mutable/MutableValueFloat.cs
@@ -1,4 +1,4 @@
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Util.Mutable
 {
@@ -56,7 +56,9 @@ namespace Lucene.Net.Util.Mutable
         public override bool EqualsSameType(object other)
         {
             MutableValueSingle b = (MutableValueSingle)other;
-            return Value == b.Value && Exists == b.Exists;
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            return NumericUtils.SingleToSortableInt32(Value) == NumericUtils.SingleToSortableInt32(b.Value)
+                && Exists == b.Exists;
         }
 
         public override int CompareSameType(object other)
diff --git a/src/Lucene.Net/Util/Packed/PackedInts.cs b/src/Lucene.Net/Util/Packed/PackedInts.cs
index 800c599..903d255 100644
--- a/src/Lucene.Net/Util/Packed/PackedInts.cs
+++ b/src/Lucene.Net/Util/Packed/PackedInts.cs
@@ -343,7 +343,8 @@ namespace Lucene.Net.Util.Packed
                     {
                         float overhead = Format.PACKED_SINGLE_BLOCK.OverheadPerValue(bpv);
                         float acceptableOverhead = acceptableOverheadPerValue + bitsPerValue - bpv;
-                        if (overhead <= acceptableOverhead)
+                        // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                        if (NumericUtils.SingleToSortableInt32(overhead) <= NumericUtils.SingleToSortableInt32(acceptableOverhead))
                         {
                             actualBitsPerValue = bpv;
                             format = Format.PACKED_SINGLE_BLOCK;

[lucenenet] 04/09: BUG: Lucene.Net.Sandbox.Queries.SlowFuzzyTermsEnum::Accept(): Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTokenLengthOpt(). See #269.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit f6c668d56aec5cdc27e4f1f51ebe85a0e0a1cf11
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Oct 23 20:46:12 2021 +0700

    BUG: Lucene.Net.Sandbox.Queries.SlowFuzzyTermsEnum::Accept(): Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTokenLengthOpt(). See #269.
---
 src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs
index 12a16a0..9ce8bc9 100644
--- a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs
+++ b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs
@@ -3,7 +3,6 @@ using Lucene.Net.Search;
 using Lucene.Net.Util;
 using System;
 using System.IO;
-using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Sandbox.Queries
 {
@@ -121,9 +120,6 @@ namespace Lucene.Net.Sandbox.Queries
             /// where distance is the Levenshtein distance for the two words.
             /// </para>
             /// </summary>
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled. Fixes TestTokenLengthOpt.
-#endif
             protected override sealed AcceptStatus Accept(BytesRef term)
             {
                 if (StringHelper.StartsWith(term, prefixBytesRef))
@@ -146,7 +142,7 @@ namespace Lucene.Net.Sandbox.Queries
                     //if raw is true, then distance must also be <= maxEdits by now
                     //given the previous if statement
                     if (outerInstance.m_raw == true ||
-                          (outerInstance.m_raw == false && similarity > outerInstance.MinSimilarity))
+                          (outerInstance.m_raw == false && NumericUtils.SingleToSortableInt32(similarity) > NumericUtils.SingleToSortableInt32(outerInstance.MinSimilarity)))
                     {
                         boostAtt.Boost = (similarity - outerInstance.MinSimilarity) * outerInstance.m_scaleFactor;
                         return AcceptStatus.YES;

[lucenenet] 05/09: Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: Compare using NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. See #269.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 96403bc70766e11e6e35c6c08b0cb398e4fb34bc
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Oct 23 21:00:42 2021 +0700

    Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: Compare using NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. See #269.
---
 src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
index 4607c43..84e858f 100644
--- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
+++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Search.Similarities;
+using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
@@ -362,15 +363,13 @@ namespace Lucene.Net.Sandbox.Queries
             /// (non-Javadoc)
             /// <see cref="Util.PriorityQueue{T}.LessThan(T, T)"/>
             /// </summary>
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing score equality fails in x86 on .NET Framework with optimizations enabled
-#endif
             protected internal override bool LessThan(ScoreTerm termA, ScoreTerm termB)
             {
-                if (termA.Score == termB.Score)
+                // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                if (NumericUtils.SingleToSortableInt32(termA.Score) == NumericUtils.SingleToSortableInt32(termB.Score))
                     return termA.Term.CompareTo(termB.Term) > 0;
                 else
-                    return termA.Score < termB.Score;
+                    return NumericUtils.SingleToSortableInt32(termA.Score) < NumericUtils.SingleToSortableInt32(termB.Score);
             }
 
         }

[lucenenet] 02/09: BUG: Lucene.Net.Search.FuzzyTermsEnum: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestBooleanQuery.TestBS2DisjunctionNextVsAdvance(), Lucene.Net.Search.TestFuzzyQuery.TestTieBreaker(), and Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTieBreaker(). See #269.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 8e5ecafa44738765ca04004b8bf96e03e4e94e56
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Oct 23 16:36:58 2021 +0700

    BUG: Lucene.Net.Search.FuzzyTermsEnum: Compare using Lucene.Net.Util.NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. This fixes Lucene.Net.Search.TestBooleanQuery.TestBS2DisjunctionNextVsAdvance(), Lucene.Net.Search.TestFuzzyQuery.TestTieBreaker(), and Lucene.Net.Sandbox.Queries.TestSlowFuzzyQuery.TestTieBreaker(). See #269.
---
 src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery.cs |  3 ---
 src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs              |  3 ---
 src/Lucene.Net/Search/FuzzyTermsEnum.cs                    | 14 +++++++++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery.cs b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery.cs
index 087c9d5..cec1ccd 100644
--- a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery.cs
+++ b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery.cs
@@ -334,9 +334,6 @@ namespace Lucene.Net.Sandbox.Queries
          * is not implemented correctly, there will be problems!
          */
         [Test]
-#if NETFRAMEWORK
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/269")] // LUCENENET TODO: this test fails on x86 on .NET Framework in Release mode only
-#endif
         public void TestTieBreaker()
         {
             Directory directory = NewDirectory();
diff --git a/src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs b/src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs
index 069c8e0..b9fc338 100644
--- a/src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestFuzzyQuery.cs
@@ -249,9 +249,6 @@ namespace Lucene.Net.Search
         /// is not implemented correctly, there will be problems!
         /// </summary>
         [Test]
-#if NETFRAMEWORK
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/269")] // LUCENENET TODO: this test fails on x86 on .NET Framework in Release mode only
-#endif
         public virtual void TestTieBreaker()
         {
             Directory directory = NewDirectory();
diff --git a/src/Lucene.Net/Search/FuzzyTermsEnum.cs b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
index f0f3ee1..58db0c1 100644
--- a/src/Lucene.Net/Search/FuzzyTermsEnum.cs
+++ b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
@@ -220,6 +220,7 @@ namespace Lucene.Net.Search
         /// Fired when the max non-competitive boost has changed. This is the hook to
         /// swap in a smarter actualEnum
         /// </summary>
+
         private void BottomChanged(BytesRef lastTerm, bool init)
         {
             int oldMaxEdits = m_maxEdits;
@@ -229,7 +230,11 @@ namespace Lucene.Net.Search
 
             // as long as the max non-competitive boost is >= the max boost
             // for some edit distance, keep dropping the max edit distance.
-            while (m_maxEdits > 0 && (termAfter ? bottom >= CalculateMaxBoost(m_maxEdits) : bottom > CalculateMaxBoost(m_maxEdits)))
+
+            // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+            while (m_maxEdits > 0 && (termAfter ?
+                NumericUtils.SingleToSortableInt32(bottom) >= NumericUtils.SingleToSortableInt32(CalculateMaxBoost(m_maxEdits)) :
+                NumericUtils.SingleToSortableInt32(bottom) > NumericUtils.SingleToSortableInt32(CalculateMaxBoost(m_maxEdits))))
             {
                 m_maxEdits--;
             }
@@ -380,9 +385,6 @@ namespace Lucene.Net.Search
 
             /// <summary>
             /// Finds the smallest Lev(n) DFA that accepts the term. </summary>
-#if NETFRAMEWORK
-            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing float equality fails in x86 on .NET Framework with optimizations enabled, and is causing the TestTokenLengthOpt test to fail
-#endif
             protected override AcceptStatus Accept(BytesRef term)
             {
                 //System.out.println("AFTE.accept term=" + term);
@@ -415,7 +417,9 @@ namespace Lucene.Net.Search
                 {
                     int codePointCount = UnicodeUtil.CodePointCount(term);
                     float similarity = 1.0f - ((float)ed / (float)(Math.Min(codePointCount, outerInstance.m_termLength)));
-                    if (similarity > outerInstance.m_minSimilarity)
+
+                    // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled
+                    if (NumericUtils.SingleToSortableInt32(similarity) > NumericUtils.SingleToSortableInt32(outerInstance.m_minSimilarity))
                     {
                         boostAtt.Boost = (similarity - outerInstance.m_minSimilarity) * outerInstance.m_scaleFactor;
                         //System.out.println("  yes");

[lucenenet] 01/09: BUG: Lucene.Net.Search.TestBooleanQuery::TestBS2DisjunctionNextVsAdvance(): Use Assert.AreEqual instead of Asssert.IsTrue with == to fix floating point comparison on x86 .NET Framework with optimizations enabled.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit b02fb28d3b025afc8d9a4dcd51dd321c06db2951
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Oct 23 02:27:53 2021 +0700

    BUG: Lucene.Net.Search.TestBooleanQuery::TestBS2DisjunctionNextVsAdvance(): Use Assert.AreEqual instead of Asssert.IsTrue with == to fix floating point comparison on x86 .NET Framework with optimizations enabled.
---
 src/Lucene.Net.Tests/Search/TestBooleanQuery.cs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
index a511922..5d6cef3 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
@@ -213,9 +213,6 @@ namespace Lucene.Net.Search
         }
 
         [Test]
-#if NETFRAMEWORK
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/269")] // LUCENENET TODO: this test fails on x86 on .NET Framework in Release mode only
-#endif
         public virtual void TestBS2DisjunctionNextVsAdvance()
         {
             Directory d = NewDirectory();
@@ -337,8 +334,10 @@ namespace Lucene.Net.Search
                         {
                             ScoreDoc hit = hits[nextUpto];
                             Assert.AreEqual(hit.Doc, nextDoc);
+
+                            // LUCENENET: For some weird reason, on x86 in .NET Framework (optimizations enabled), using == (as they did in Lucene) doesn't work with optimizations enabled, but using AreEqual with epsilon of 0f does.
                             // Test for precise float equality:
-                            Assert.IsTrue(hit.Score == scorer.GetScore(), "doc " + hit.Doc + " has wrong score: expected=" + hit.Score + " actual=" + scorer.GetScore());
+                            Assert.AreEqual(hit.Score, scorer.GetScore(), 0f, "doc " + hit.Doc + " has wrong score: expected=" + hit.Score + " actual=" + scorer.GetScore());
                         }
                         upto = nextUpto;
                     }

[lucenenet] 07/09: BUG: Lucene.Net.Expressions.ScoreFunctionValues::DoubleVal(): Assigning float to double loses precision in x86 .NET Framework. Do an intermediate cast to decimal to fix Lucene.Net.Expressions.TestExpressionSorts::TestQueries(). See #269.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit bfa4c6856df04f8d5881ab07ebb24c9ecff53d37
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 24 04:02:11 2021 +0700

    BUG: Lucene.Net.Expressions.ScoreFunctionValues::DoubleVal(): Assigning float to double loses precision in x86 .NET Framework. Do an intermediate cast to decimal to fix Lucene.Net.Expressions.TestExpressionSorts::TestQueries(). See #269.
---
 src/Lucene.Net.Expressions/ScoreFunctionValues.cs       | 6 ++++++
 src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index c6eb9c1..942b550 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -44,7 +44,13 @@ namespace Lucene.Net.Expressions
             try
             {
                 if (Debugging.AssertsEnabled) Debugging.Assert(document == scorer.DocID);
+
+#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
                 return scorer.GetScore();
+#else
+                // LUCENENET specific: The intermediate cast to decimal is required here to prevent us from losing precision on x86 .NET Framework with optimizations enabled
+                return (double)(decimal)scorer.GetScore();
+#endif
             }
             catch (Exception exception) when (exception.IsIOException())
             {
diff --git a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
index 1a9e22b..6b64263 100644
--- a/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
+++ b/src/Lucene.Net.Tests.Expressions/TestExpressionSorts.cs
@@ -86,9 +86,6 @@ namespace Lucene.Net.Expressions
         }
 
         [Test]
-#if NETFRAMEWORK
-        [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/269")] // LUCENENET TODO: this test fails on x86 on .NET Framework in Release mode only
-#endif
         public virtual void TestQueries()
         {
             int n = AtLeast(4);