Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.2
-
None
-
None
-
None
-
OS: Debian lenny
IDE: Eclipse; Version: 3.4.0; Build id: I20080617-2000
java.runtime.version=1.6.0_04-b12
java.vendor.url=http://java.sun.com/
Description
Hi.
The bug relates on complex numbers.
The methods "multiply" and "equals" of the class Complex are involved.
mathematic background: (0,i) * (-1,0i) = (0,-i).
little java program + output that shows the bug:
-----------------------------------------------------------------------
import org.apache.commons.math.complex.*; public class TestProg { public static void main(String[] args) { ComplexFormat f = new ComplexFormat(); Complex c1 = new Complex(0,1); Complex c2 = new Complex(-1,0); Complex res = c1.multiply(c2); Complex comp = new Complex(0,-1); System.out.println("res: "+f.format(res)); System.out.println("comp: "+f.format(comp)); System.out.println("res=comp: "+res.equals(comp)); } }
-----------------------------------------------------------------------
res: -0 - 1i
comp: 0 - 1i
res=comp: false
-----------------------------------------------------------------------
I think the "equals" should return "true".
The problem could either be the "multiply" method that gives (-0,-1i) instead of (0,-1i),
or if you think thats right, the equals method has to be modified.
Good Luck
Dieter