commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1061603 - /commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
Date Fri, 21 Jan 2011 02:46:14 GMT
Author: sebb
Date: Fri Jan 21 02:46:14 2011
New Revision: 1061603

URL: http://svn.apache.org/viewvc?rev=1061603&view=rev
Log:
Fix up double nextAfter special cases; add float test

Modified:
    commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java?rev=1061603&r1=1061602&r2=1061603&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
Fri Jan 21 02:46:14 2011
@@ -1020,16 +1020,28 @@ public final class MathUtilsTest extends
 
     }
 
-    public void testNextAfterSpecialCases() {
-        assertTrue(Double.isInfinite(FastMath.nextAfter(Double.NEGATIVE_INFINITY, 0)));
-        assertTrue(Double.isInfinite(FastMath.nextAfter(Double.POSITIVE_INFINITY, 0)));
-        assertTrue(Double.isNaN(FastMath.nextAfter(Double.NaN, 0)));
-        assertTrue(Double.isInfinite(FastMath.nextAfter(Double.MAX_VALUE, Double.POSITIVE_INFINITY)));
-        assertTrue(Double.isInfinite(FastMath.nextAfter(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY)));
-        assertEquals(Double.MIN_VALUE, FastMath.nextAfter(0, 1), 0);
-        assertEquals(-Double.MIN_VALUE, FastMath.nextAfter(0, -1), 0);
-        assertEquals(0, FastMath.nextAfter(Double.MIN_VALUE, -1), 0);
-        assertEquals(0, FastMath.nextAfter(-Double.MIN_VALUE, 1), 0);
+    public void testDoubleNextAfterSpecialCases() {
+        assertEquals(-Double.MAX_VALUE,FastMath.nextAfter(Double.NEGATIVE_INFINITY, 0D));
+        assertEquals(Double.MAX_VALUE,FastMath.nextAfter(Double.POSITIVE_INFINITY, 0D));
+        assertEquals(Double.NaN,FastMath.nextAfter(Double.NaN, 0D));
+        assertEquals(Double.POSITIVE_INFINITY,FastMath.nextAfter(Double.MAX_VALUE, Double.POSITIVE_INFINITY));
+        assertEquals(Double.NEGATIVE_INFINITY,FastMath.nextAfter(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY));
+        assertEquals(Double.MIN_VALUE, FastMath.nextAfter(0D, 1D), 0D);
+        assertEquals(-Double.MIN_VALUE, FastMath.nextAfter(0D, -1D), 0D);
+        assertEquals(0D, FastMath.nextAfter(Double.MIN_VALUE, -1), 0D);
+        assertEquals(0D, FastMath.nextAfter(-Double.MIN_VALUE, 1), 0D);
+    }
+
+    public void testFloatNextAfterSpecialCases() {
+        assertEquals(-Float.MAX_VALUE,FastMath.nextAfter(Float.NEGATIVE_INFINITY, 0F));
+        assertEquals(Float.MAX_VALUE,FastMath.nextAfter(Float.POSITIVE_INFINITY, 0F));
+        assertEquals(Float.NaN,FastMath.nextAfter(Float.NaN, 0F));
+        assertEquals(Float.POSITIVE_INFINITY,FastMath.nextAfter(Float.MAX_VALUE, Float.POSITIVE_INFINITY));
+        assertEquals(Float.NEGATIVE_INFINITY,FastMath.nextAfter(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY));
+        assertEquals(Float.MIN_VALUE, FastMath.nextAfter(0F, 1F), 0F);
+        assertEquals(-Float.MIN_VALUE, FastMath.nextAfter(0F, -1F), 0F);
+        assertEquals(0F, FastMath.nextAfter(Float.MIN_VALUE, -1F), 0F);
+        assertEquals(0F, FastMath.nextAfter(-Float.MIN_VALUE, 1F), 0F);
     }
 
     public void testScalb() {



Mime
View raw message