[Bug java/16132] New: Invalid double calculations on ARM

jari dot korva at iki dot fi gcc-bugzilla@gcc.gnu.org
Tue Jun 22 10:15:00 GMT 2004

Some StrictMath functions, including exp() and log(), return incorrect values on
StrongARM processor. Some others, including sin() and tan(), work just fine. In
addition, System.out.println() fails to print floating point numbers correctly:

# ./floattest

# cat floattest.java
import java.text.*;
public class floattest {
    public static void print(String s, double d) {
        NumberFormat nf = NumberFormat.getInstance();
        System.out.println(s + nf.format(d));
    public static void main(String args[]) {
        print("Math.log(10)=", Math.log(10.0));
        print("StrictMath.log(10)=", StrictMath.log(10.0));
        print("Math.exp(10)=", Math.exp(10.0));
        print("StrictMath.exp(10)=", StrictMath.exp(10.0));
        double x = 0.1 + 0.1;
        System.out.println("0.1+0.1=" + x);
        print("0.1+0.1=", x);

Is this possibly due to a bug in Double.doubleToLongBits() (see

The test application has been compiled with:

arm-unknown-linux-gnu-gcj -c floattest.java
arm-unknown-linux-gnu-gcj --main=floattest -o floattest floattest.o

... using:

Reading specs from /tmp/cross/lib/gcc/arm-unknown-linux-gnu/3.4.0/specs
Reading specs from
rename spec lib to liborig
Configured with:
--target=arm-unknown-linux-gnu --host=i686-host_pc-linux-gnu
--with-local-prefix=/tmp/cross/arm-unknown-linux-gnu --disable-nls
--enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c,c++,java --enable-shared --enable-c99
Thread model: posix
gcc version 3.4.0

... and executed on a:

# uname -a
Linux familiar 2.4.19-rmk6-pxa1-hh30 #3 Wed Nov 12 11:07:41 EST 2003 armv4l unknown

           Summary: Invalid double calculations on ARM
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jari dot korva at iki dot fi
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
  GCC host triplet: i386-linux-gnu
GCC target triplet: arm-linux-gnu


More information about the Java-prs mailing list