commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r690308 - in /commons/proper/math/branches/MATH_2_0/src: java/org/apache/commons/math/complex/Complex.java site/xdoc/changes.xml test/org/apache/commons/math/complex/ComplexTest.java
Date Fri, 29 Aug 2008 15:46:23 GMT
Author: luc
Date: Fri Aug 29 08:46:22 2008
New Revision: 690308

URL: http://svn.apache.org/viewvc?rev=690308&view=rev
Log:
Changed the Complex.equals() method so that it considers +0 and -0 are equal,
as required by IEEE-754 standard.
JIRA: MATH-221

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/complex/Complex.java
    commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/complex/ComplexTest.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/complex/Complex.java?rev=690308&r1=690307&r2=690308&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/complex/Complex.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/complex/Complex.java
Fri Aug 29 08:46:22 2008
@@ -255,10 +255,7 @@
                 if (rhs.isNaN()) {
                     ret = this.isNaN();
                 } else {
-                ret = (Double.doubleToRawLongBits(real) ==
-                        Double.doubleToRawLongBits(rhs.getReal())) &&
-                    (Double.doubleToRawLongBits(imaginary) ==
-                        Double.doubleToRawLongBits(rhs.getImaginary())); 
+                    ret = (real == rhs.real) && (imaginary == rhs.imaginary); 
                 }
             } catch (ClassCastException ex) {
                 // ignore exception

Modified: commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml?rev=690308&r1=690307&r2=690308&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml Fri Aug 29 08:46:22 2008
@@ -39,6 +39,10 @@
   </properties>
   <body>
     <release version="2.0" date="TBD" description="TBD">
+      <action dev="luc" type="fix" issue="MATH-221" due-to="Dieter Roth">
+        Changed the Complex.equals() method so that it considers +0 and -0 are equal,
+        as required by IEEE-754 standard.
+      </action>
       <action dev="luc" type="add" issue="MATH-220" >
         Added JAMA-like interfaces for decomposition algorithms. These interfaces
         decompose a matrix as a product of several other matrices with predefined

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/complex/ComplexTest.java?rev=690308&r1=690307&r2=690308&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/complex/ComplexTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/complex/ComplexTest.java
Fri Aug 29 08:46:22 2008
@@ -690,4 +690,10 @@
     public void testTanhCritical() {
         TestUtils.assertSame(nanInf, new Complex(0, pi/2).tanh());
     }
+
+    /** test issue MATH-221 */
+    public void testMath221() {
+        assertEquals(new Complex(0,-1), new Complex(0,1).multiply(new Complex(-1,0)));
+    }
+
 }



Mime
View raw message