public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86
@ 2004-06-21 20:24 debian-gcc at lists dot debian dot org
  2004-06-22  6:04 ` [Bug libgcj/16122] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2004-06-21 20:24 UTC (permalink / raw)
  To: java-prs

[forwarded from http://bugs.debian.org/255525]

3.3.4 release and 3.4.1 branch, bug submitter writes:

Concerning the following Java source: 
 
------------------------------------------------------------------ 
// $Id: test.java 3734 2004-06-21 15:36:52Z lefevre $ 
 
public class test { 
    public static void main(String[] args) throws Exception { 
        test t = new test(); 
        t.doTest(); 
    } 
 
    volatile double x, y, z, d; 
 
    public void doTest() { 
        x = 9007199254740994.0; /* 2^53 + 2 */ 
        y = 1.0 - 1/65536.0; 
        z = x + y; 
        d = z - x; 
        System.out.println("z = " + z); 
        System.out.println("d = " + d); 
    } 
} 
------------------------------------------------------------------ 
I've compiled it with "gcj -C test.java" (GCC 3.3.4). 
 
Both IBM's and Sun's JVM give the correct result: 
 
greux:~/wd/src/fp> /global/greux/lefevre/IBMJava2-131/jre/bin/java test 
z = 9.007199254740994E15 
d = 0.0 
 
greux:~/wd/src/fp> /usr/local/j2re1.4.1/bin/java test 
z = 9.007199254740994E15 
d = 0.0 
 
but not gij: 
 
greux:~/wd/src/fp> /usr/bin/gij test 
z = 9.007199254740996E15 
d = 2.0 
 
gij should switch the FPU of the x86 processor 
(Pentium III in my case) to rounding in double precision to avoid the 
effect of the "double rounding" (you may find some information about 
this effect here: <http://www.srware.com/linux_numerics.txt>).

-- 
           Summary: gij - Incorrect result due to computations in extended
                    precision on x86
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
  GCC host triplet: i486-linux


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


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

* [Bug libgcj/16122] gij - Incorrect result due to computations in extended precision on x86
  2004-06-21 20:24 [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86 debian-gcc at lists dot debian dot org
@ 2004-06-22  6:04 ` pinskia at gcc dot gnu dot org
  2004-06-22  6:05 ` vincent at vinc17 dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-22  6:04 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-21 20:24 -------
Actually this is not a bug unless you use strictfp but IIRC strictfp does nothing to the problem anyways.

-- 


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


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

* [Bug libgcj/16122] gij - Incorrect result due to computations in extended precision on x86
  2004-06-21 20:24 [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86 debian-gcc at lists dot debian dot org
  2004-06-22  6:04 ` [Bug libgcj/16122] " pinskia at gcc dot gnu dot org
@ 2004-06-22  6:05 ` vincent at vinc17 dot org
  2004-06-22  9:58 ` vincent at vinc17 dot org
  2004-06-22 16:56 ` mckinlay at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: vincent at vinc17 dot org @ 2004-06-22  6:05 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From vincent at vinc17 dot org  2004-06-22 06:04 -------
I don't know very much about Java, but I've talked with someone who has some
knowledge in Java and floating point, and according to him, Java FP arithmetic
operations must round exactly in double precision (this is also confirmed by the
documentation I could see). strictfp concerns the exponent range of the double
precision vs extended precision, but this is not the problem here.

-- 


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


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

* [Bug libgcj/16122] gij - Incorrect result due to computations in extended precision on x86
  2004-06-21 20:24 [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86 debian-gcc at lists dot debian dot org
  2004-06-22  6:04 ` [Bug libgcj/16122] " pinskia at gcc dot gnu dot org
  2004-06-22  6:05 ` vincent at vinc17 dot org
@ 2004-06-22  9:58 ` vincent at vinc17 dot org
  2004-06-22 16:56 ` mckinlay at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: vincent at vinc17 dot org @ 2004-06-22  9:58 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent at vinc17 dot org


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


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

* [Bug libgcj/16122] gij - Incorrect result due to computations in extended precision on x86
  2004-06-21 20:24 [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86 debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2004-06-22  9:58 ` vincent at vinc17 dot org
@ 2004-06-22 16:56 ` mckinlay at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mckinlay at redhat dot com @ 2004-06-22 16:56 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-06-22 16:51 -------
Confirmed with HEAD. The problem doesn't occur with native compilation, it is a
gij issue only.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-22 16:51:42
               date|                            |


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


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

end of thread, other threads:[~2004-06-22 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-21 20:24 [Bug libgcj/16122] New: gij - Incorrect result due to computations in extended precision on x86 debian-gcc at lists dot debian dot org
2004-06-22  6:04 ` [Bug libgcj/16122] " pinskia at gcc dot gnu dot org
2004-06-22  6:05 ` vincent at vinc17 dot org
2004-06-22  9:58 ` vincent at vinc17 dot org
2004-06-22 16:56 ` mckinlay at redhat dot com

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).