commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1164917 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/complex/Complex.java test/java/org/apache/commons/math/complex/ComplexTest.java
Date Sat, 03 Sep 2011 19:22:42 GMT
Author: erans
Date: Sat Sep  3 19:22:42 2011
New Revision: 1164917

URL: http://svn.apache.org/viewvc?rev=1164917&view=rev
Log:
MATH-657
Reverting to previous behaviour, as requested by P. Steitz.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java?rev=1164917&r1=1164916&r2=1164917&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java Sat
Sep  3 19:22:42 2011
@@ -256,7 +256,8 @@ public class Complex implements FieldEle
         }
 
         if (divisor.isZero) {
-            return isZero ? NaN : INF;
+            // return isZero ? NaN : INF; // See MATH-657
+            return NaN;
         }
 
         if (divisor.isInfinite() && !isInfinite()) {
@@ -292,7 +293,8 @@ public class Complex implements FieldEle
             return NaN;
         }
         if (divisor == 0d) {
-            return isZero ? NaN : INF;
+            // return isZero ? NaN : INF; // See MATH-657
+            return NaN;
         }
         if (Double.isInfinite(divisor)) {
             return !isInfinite() ? ZERO : NaN;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java?rev=1164917&r1=1164916&r2=1164917&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
Sat Sep  3 19:22:42 2011
@@ -229,7 +229,8 @@ public class ComplexTest {
     public void testDivideZero() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.divide(Complex.ZERO);
-        Assert.assertEquals(z, Complex.INF);
+        // Assert.assertEquals(z, Complex.INF); // See MATH-657
+        Assert.assertEquals(z, Complex.NaN);
     }
 
     @Test
@@ -573,10 +574,7 @@ public class ComplexTest {
 
     @Test
     public void testAtanI() {
-        for (int i = -10; i < 10; i++) {
-            System.out.println(new Complex(0, 1 - 0.1 * i).atan());
-        }
-        Assert.assertTrue(Complex.I.atan().isInfinite());
+        Assert.assertTrue(Complex.I.atan().isNaN());
     }
 
     @Test



Mime
View raw message