bug-classpath
[Top][All Lists]
Advanced

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

[Bug classpath/30543] Cross-compile: wrong long -> jlong conversion


From: jredman at ergotech dot com
Subject: [Bug classpath/30543] Cross-compile: wrong long -> jlong conversion
Date: 16 Apr 2008 18:39:23 -0000


------- Comment #1 from jredman at ergotech dot com  2008-04-16 18:39 -------
There are some ugly bugs in long and double conversions on ARM (version 0.97).  

This:

   timebase = ((double)((long)(timebase*1000)))/1000;

where timebase is a double, returns zero for all values of timebase that I've
tried (say 0.1-2).

This works correctly:
  timebase = ((double)((int)(timebase*1000)))/1000;


This:
Double.toString(currentValue);

where currentValue is a double also returns very strange strings on ARM. 
Strings including non-numeric characters and just fundamentally wrong.  A work
around is to use a DecimalFormatter, eg:

     format = DecimalFormat.getNumberInstance(locale);
     return format.format(currentValue);

returns the correct string.

I assume that these just represent test cases for a deeper problem.

The behavior has been true since at least 0.95 (haven't tested anything prior
to this) and shows up with a number of JVMs (eg Sable and IKVM).  Tested on the
NSLU2 with a variety of distributions (Debian, OpenSlug, Angstrom(?)).


-- 


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





reply via email to

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