commit-classpath
[Top][All Lists]
Advanced

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

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


From: Mark Wielaard
Subject: Re: [commit-cp] [bugs #9895] double to int conversion problem
Date: Thu, 05 Aug 2004 18:42:21 +0200

Hi,

On Thu, 2004-08-05 at 17:05, Archie Cobbs wrote:
> David Gilbert wrote:
> > 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
> 
> I think this is a VM bug rather than a Classpath bug (JC has the same
> bug). It results from doing the jdouble -> jint conversion in C via
> a `(jint)d' cast.
> 
> JC generates this code (edited)...
> 
>     jdouble d2;
>     jint i1;
> 
>     d2 = _JC_DCONST(0x41, 0xe0, 0x0, 0x30, 0xd3, 0xe0, 0x0, 0x0);
>     ...
>     i1 = (jint)d2;
>     ...
> 
> I'm still curious what the solution is though :-)

I reported a similar issue against jamvm and Robert created a patch for
it. But I see there is no new jamvm (1.1.5) yet.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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