commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] [bugs #9895] double to int conversion problem


From: David Gilbert
Subject: [commit-cp] [bugs #9895] double to int conversion problem
Date: Wed, 04 Aug 2004 19:29:56 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114 Epiphany/1.0.7

This mail is an automated notification from the bugs tracker
 of the project: classpath.




/**************************************************************************/
[bugs #9895] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9895>
Project: classpath
Submitted by: David Gilbert
On: Wed 08/04/2004 at 23:26

Category:  None
Severity:  5 - Average
Resolution:  None
Assigned to:  None
Status:  Open
Platform Version:  None


Summary:  double to int conversion problem

Original Submission:  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











For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=9895>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

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