Changed the Complex.equals() method so that it considers +0 and -0 are equal,
as required by IEEE-754 standard. JIRA: MATH-221 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_0@690308 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a48a97b37f
commit
94cf29c4e3
|
@ -255,10 +255,7 @@ public class Complex implements Serializable {
|
||||||
if (rhs.isNaN()) {
|
if (rhs.isNaN()) {
|
||||||
ret = this.isNaN();
|
ret = this.isNaN();
|
||||||
} else {
|
} else {
|
||||||
ret = (Double.doubleToRawLongBits(real) ==
|
ret = (real == rhs.real) && (imaginary == rhs.imaginary);
|
||||||
Double.doubleToRawLongBits(rhs.getReal())) &&
|
|
||||||
(Double.doubleToRawLongBits(imaginary) ==
|
|
||||||
Double.doubleToRawLongBits(rhs.getImaginary()));
|
|
||||||
}
|
}
|
||||||
} catch (ClassCastException ex) {
|
} catch (ClassCastException ex) {
|
||||||
// ignore exception
|
// ignore exception
|
||||||
|
|
|
@ -39,6 +39,10 @@ The <action> type attribute can be add,update,fix,remove.
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="2.0" date="TBD" description="TBD">
|
<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" >
|
<action dev="luc" type="add" issue="MATH-220" >
|
||||||
Added JAMA-like interfaces for decomposition algorithms. These interfaces
|
Added JAMA-like interfaces for decomposition algorithms. These interfaces
|
||||||
decompose a matrix as a product of several other matrices with predefined
|
decompose a matrix as a product of several other matrices with predefined
|
||||||
|
|
|
@ -690,4 +690,10 @@ public class ComplexTest extends TestCase {
|
||||||
public void testTanhCritical() {
|
public void testTanhCritical() {
|
||||||
TestUtils.assertSame(nanInf, new Complex(0, pi/2).tanh());
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue