[Top][All Lists]

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

FP-strict methods (was: Quadratic and cubic equations)

From: Andrew Haley
Subject: FP-strict methods (was: Quadratic and cubic equations)
Date: Fri, 9 Jan 2004 10:39:02 +0000

Sascha Brawer writes:
 > > "TT" == Tom Tromey <address@hidden> writes:
 > > "AH" == Andrew Haley <address@hidden> writes:
 > AH> It looks to me like this is a test of exact java strictfp
 > AH> compliance.  gcj fails, because it isn't strictfp compliant.
 > TT> On top of that, to guarantee the same results everywhere we would need
 > TT> to declare both the test case and the code in Classpath `strictfp'.
 > AH> Yes.
 > I agree for the code in Classpath. But why the test case?
 > The tested method stores its results in a double[], which means that a
 > 'dastore' instruction gets executed.

No, not necessarily -- there's no requirement that the Java
programming language be implemented on a Java VM.  But I think you're
right in that IEEE doubles must be used for the argument.  Of course
gcj does that already.

The place gcj falls is in solveQuadratic when c (which actually has
the value 0.10000000000000001) is read from the argument array and
preserved in high precision through the calculation.  gcj is
performing a more accurate calculation than Java specifies.

 > Thus, I don't understand why the test case would need to be declared FP-
 > strict.

You're right.  It wouldn't make any difference in this case.


reply via email to

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