lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [06/13] git commit: Fixed TestSmallFloat.TestFloatToByte
Date Mon, 15 Sep 2014 22:52:57 GMT
Fixed TestSmallFloat.TestFloatToByte

Java's Float.MIN_VALUE (smallest positive float) isn't C#'s
Float.MinValue (negative float with highest absolute value).


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/28e2750e
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/28e2750e
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/28e2750e

Branch: refs/heads/master
Commit: 28e2750e9cbc068ef673dadc3f3186ac2b5f74f6
Parents: be80c4e
Author: Prad Nelluru <prnell@microsoft.com>
Authored: Fri Sep 12 11:07:34 2014 -0700
Committer: Prad Nelluru <prnell@microsoft.com>
Committed: Fri Sep 12 11:07:34 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/28e2750e/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs b/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs
index f6969ec..ce38493 100644
--- a/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs
@@ -126,12 +126,13 @@ namespace Lucene.Net.Util
 
             // test some constants
             Assert.AreEqual(0, SmallFloat.FloatToByte315(0));
-            Assert.AreEqual(1, SmallFloat.FloatToByte315(float.MinValue)); // underflow rounds
up to smallest positive
+            //Java's Float.MIN_VALUE equals C#'s float.Epsilon
+            Assert.AreEqual(1, SmallFloat.FloatToByte315(float.Epsilon)); // underflow rounds
up to smallest positive
             Assert.AreEqual(255, SmallFloat.FloatToByte315(float.MaxValue) & 0xff); //
overflow rounds down to largest positive
             Assert.AreEqual(255, SmallFloat.FloatToByte315(float.PositiveInfinity) &
0xff);
 
             // all negatives map to 0
-            Assert.AreEqual(0, SmallFloat.FloatToByte315(-float.MinValue));
+            Assert.AreEqual(0, SmallFloat.FloatToByte315(-float.Epsilon));
             Assert.AreEqual(0, SmallFloat.FloatToByte315(-float.MaxValue));
             Assert.AreEqual(0, SmallFloat.FloatToByte315(float.NegativeInfinity));
 


Mime
View raw message