Sorry, the actual output was:
 
op1: 12.0
op2: 1.0E-9
res: 1.2000000000000002E-8
----- Original Message -----
To: JDJList
Sent: Thursday, September 19, 2002 4:31 PM
Subject: [jdjlist] Double multiplication

Hi
 
I have written a sample test program:
.........
 
public static void main (String args[]) 
    {
        Double
            op1 = new Double(12.0),
            op2 = new Double(1E-9),
            res = new Double ( op1.doubleValue()*op2.doubleValue() );
       
        System.out.println("op1: " + op1);
        System.out.println("op2: " + op2);
        System.out.println("res: " + res);
    }
The output is:
 
op1: 12.0000000001
op2: 1.0E-9
res: 1.2000000000100001E-8
What the @!# is going on?
 
How can I fix this?
 
Any help appreciated.
 
Thanks
 
Ivan
To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm
To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to