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/05/08 07:19:15 UTC

[lucenenet] branch master updated: BUG: Changed all references that were float.MinValue and double.MinValue to float.Epsilon and double.Epsilon because those are the .NET equivalent constants to Float.MIN_VALUE and Double.MIN_VALUE in Java

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


The following commit(s) were added to refs/heads/master by this push:
     new 07f9e29  BUG: Changed all references that were float.MinValue and double.MinValue to float.Epsilon and double.Epsilon because those are the .NET equivalent constants to Float.MIN_VALUE and Double.MIN_VALUE in Java
07f9e29 is described below

commit 07f9e29a8cb1d9f178e6bded1e5afdfcc850e65b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri May 7 21:26:04 2021 +0700

    BUG: Changed all references that were float.MinValue and double.MinValue to float.Epsilon and double.Epsilon because those are the .NET equivalent constants to Float.MIN_VALUE and Double.MIN_VALUE in Java
---
 .../AbstractSecondPassGroupingCollector.cs                   |  2 +-
 src/Lucene.Net.Grouping/BlockGroupingCollector.cs            |  2 +-
 src/Lucene.Net.Grouping/TopGroups.cs                         |  4 ++--
 src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs    |  2 +-
 src/Lucene.Net.Join/ToParentBlockJoinCollector.cs            |  2 +-
 .../Codecs/Compressing/TestCompressingStoredFieldsFormat.cs  | 12 ++++++------
 src/Lucene.Net/Search/TopDocs.cs                             |  4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
index d571c77..d498795 100644
--- a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
+++ b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
@@ -126,7 +126,7 @@ namespace Lucene.Net.Search.Grouping
             GroupDocs<TGroupValue>[] groupDocsResult = new GroupDocs<TGroupValue>[groups.Count()];
 
             int groupIDX = 0;
-            float maxScore = float.MinValue;
+            float maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
             foreach (var group in groups)
             {
                 AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue> groupDocs = m_groupMap[group.GroupValue];
diff --git a/src/Lucene.Net.Grouping/BlockGroupingCollector.cs b/src/Lucene.Net.Grouping/BlockGroupingCollector.cs
index 12bbdf6..93c907d 100644
--- a/src/Lucene.Net.Grouping/BlockGroupingCollector.cs
+++ b/src/Lucene.Net.Grouping/BlockGroupingCollector.cs
@@ -394,7 +394,7 @@ namespace Lucene.Net.Search.Grouping
 
             FakeScorer fakeScorer = new FakeScorer();
 
-            float maxScore = float.MinValue;
+            float maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
 
             GroupDocs<TGroupValue>[] groups = new GroupDocs<TGroupValue>[groupQueue.Count - groupOffset];
             for (int downTo = groupQueue.Count - groupOffset - 1; downTo >= 0; downTo--)
diff --git a/src/Lucene.Net.Grouping/TopGroups.cs b/src/Lucene.Net.Grouping/TopGroups.cs
index ff2c592..2a49669 100644
--- a/src/Lucene.Net.Grouping/TopGroups.cs
+++ b/src/Lucene.Net.Grouping/TopGroups.cs
@@ -173,13 +173,13 @@ namespace Lucene.Net.Search.Grouping
             var mergedGroupDocs = new GroupDocs<T>[numGroups];
 
             TopDocs[] shardTopDocs = new TopDocs[shardGroups.Length];
-            float totalMaxScore = float.MinValue;
+            float totalMaxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
 
             for (int groupIDX = 0; groupIDX < numGroups; groupIDX++)
             {
                 T groupValue = shardGroups[0].Groups[groupIDX].GroupValue;
                 //System.out.println("  merge groupValue=" + groupValue + " sortValues=" + Arrays.toString(shardGroups[0].groups[groupIDX].groupSortValues));
-                float maxScore = float.MinValue;
+                float maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
                 int totalHits = 0;
                 double scoreSum = 0.0;
                 for (int shardIdx = 0; shardIdx < shardGroups.Length; shardIdx++)
diff --git a/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs b/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs
index 0b70aeb..1551d6c 100644
--- a/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs
+++ b/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs
@@ -115,7 +115,7 @@ namespace Lucene.Net.Join
             this.trackMaxScore = trackMaxScore;
             if (trackMaxScore)
             {
-                maxScore = float.MinValue;
+                maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
             }
             //System.out.println("numParentHits=" + numParentHits);
             this.trackScores = trackScores;
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
index d5002c2..6f89ad9 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
@@ -113,7 +113,7 @@ namespace Lucene.Net.Search.Join
             this.trackMaxScore = trackMaxScore;
             if (trackMaxScore)
             {
-                maxScore = float.MinValue;
+                maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
             }
             //System.out.println("numParentHits=" + numParentHits);
             this.trackScores = trackScores;
diff --git a/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs b/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
index 2fbdc22..765ef22 100644
--- a/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
@@ -122,7 +122,7 @@
 //        +0.0f,
 //        float.NegativeInfinity,
 //        float.PositiveInfinity,
-//        float.MinValue,
+//        float.Epsilon, // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
 //        float.MaxValue,
 //        float.NaN,
 //    };
@@ -180,11 +180,11 @@
 //            double[] special = {
 //        -0.0d,
 //        +0.0d,
-//        Double.NegativeInfinity,
-//        Double.PositiveInfinity,
-//        Double.MinValue,
-//        Double.MaxValue,
-//        Double.NaN
+//        double.NegativeInfinity,
+//        double.PositiveInfinity,
+//        double.Epsilon, // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
+//        double.MaxValue,
+//        double.NaN
 //    };
 
 //            foreach (double x in special)
diff --git a/src/Lucene.Net/Search/TopDocs.cs b/src/Lucene.Net/Search/TopDocs.cs
index c9e9937..c142bad 100644
--- a/src/Lucene.Net/Search/TopDocs.cs
+++ b/src/Lucene.Net/Search/TopDocs.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
 using System.Diagnostics.CodeAnalysis;
@@ -271,7 +271,7 @@ namespace Lucene.Net.Search
 
             int totalHitCount = 0;
             int availHitCount = 0;
-            float maxScore = float.MinValue;
+            float maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java
             for (int shardIDX = 0; shardIDX < shardHits.Length; shardIDX++)
             {
                 TopDocs shard = shardHits[shardIDX];