public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/16132] New: Invalid double calculations on ARM
@ 2004-06-22 10:15 jari dot korva at iki dot fi
  2004-06-22 12:25 ` [Bug java/16132] Invalid double calculations on ARM (FPA) rearnsha at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: jari dot korva at iki dot fi @ 2004-06-22 10:15 UTC (permalink / raw)
  To: java-prs

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
Math.log(10)=2.302585
StrictMath.log(10)=-745.826366
Math.exp(10)=22,026.465795
StrictMath.exp(10)=1.344389
0.1+0.1=0.000003058474:0258
0.1+0.1=0.200000

# cat floattest.java
import java.text.*;
 
public class floattest {
    public static void print(String s, double d) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMinimumFractionDigits(6);
        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
http://lists.arm.linux.org.uk/pipermail/linux-arm/2004-June/007983.html)?

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
/tmp/cross/lib/gcc/arm-unknown-linux-gnu/3.4.0/../../../../arm-unknown-linux-gnu/lib/libgcj.spec
rename spec lib to liborig
Configured with:
/wrk2/jko/nobackup/arm-linux/crosstool-0.27/build/arm-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/gcc-3.4.0/configure
--target=arm-unknown-linux-gnu --host=i686-host_pc-linux-gnu
--prefix=/tmp/cross
--with-headers=/tmp/cross/arm-unknown-linux-gnu/include
--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
--enable-long-long
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


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/16132] Invalid double calculations on ARM (FPA)
  2004-06-22 10:15 [Bug java/16132] New: Invalid double calculations on ARM jari dot korva at iki dot fi
@ 2004-06-22 12:25 ` rearnsha at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-06-22 12:25 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-06-22 11:48 -------
Confirmed: doubleToLongBits, doubleToRawLongBits and longBitsToDouble are
assuming that the word endianness of a double matches the word endianness of a
jlong.  This is an incorrect assumption on ARM's using FPA-format IEEE
arithmetic.  (ARM's using VFP float format are fine).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   GCC host triplet|i386-linux-gnu              |
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-22 11:48:59
               date|                            |
            Summary|Invalid double calculations |Invalid double calculations
                   |on ARM                      |on ARM (FPA)


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/16132] Invalid double calculations on ARM (FPA)
       [not found] <bug-16132-8172@http.gcc.gnu.org/bugzilla/>
@ 2012-07-10  8:59 ` rearnsha at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2012-07-10  8:59 UTC (permalink / raw)
  To: java-prs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.8.0

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2012-07-10 08:59:10 UTC ---
FPA support has now been dropped in GCC.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/16132] Invalid double calculations on ARM (FPA)
       [not found] <bug-16132-8781@http.gcc.gnu.org/bugzilla/>
@ 2010-01-10  0:00 ` ramana at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-01-10  0:00 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from ramana at gcc dot gnu dot org  2010-01-10 00:00 -------
arm-linux only problems from Comment #3 . EABI targets should not have a
problem .


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-10  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 10:15 [Bug java/16132] New: Invalid double calculations on ARM jari dot korva at iki dot fi
2004-06-22 12:25 ` [Bug java/16132] Invalid double calculations on ARM (FPA) rearnsha at gcc dot gnu dot org
     [not found] <bug-16132-8781@http.gcc.gnu.org/bugzilla/>
2010-01-10  0:00 ` ramana at gcc dot gnu dot org
     [not found] <bug-16132-8172@http.gcc.gnu.org/bugzilla/>
2012-07-10  8:59 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).