bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22765] double to int conversion problem


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22765] double to int conversion problem
Date: 16 Oct 2005 01:27:05 -0000

While writing some testing code for the java.awt.Dimension class, I noticed a
strange behaviour in the conversion of double values to int values.  The
problem is reproduced by the following code:

public class DoubleToIntTest {
    public static void main(String args[]) {
        double v = Integer.MAX_VALUE + 100000.0;
        System.out.println((int) v);
        Double d = new Double(v);
        System.out.println(d.intValue());
    }
}

With Classpath (fairly recent CVS) running on JamVM 1.1.4 (on SuSE 9.1), I see
the following output:

-2147483648
-2147483648

Using Sun's JDK 1.4, the output is:

2147483647
2147483647


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-08-17 
03:16 -------
I'm closing this bug as it is almost certainly a
bug in the VM and not in Classpath.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22765





reply via email to

[Prev in Thread] Current Thread [Next in Thread]