classpath
[Top][All Lists]
Advanced

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

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


From: Sascha Brawer
Subject: FP-strict methods (was: Quadratic and cubic equations)
Date: Fri, 9 Jan 2004 08:15:36 +0100

> "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. According to the Java VM
specification, 2nd edition, 'dastore' must perform a value set
conversion, even in a method that is not FP-strict [1].

[1] <http://java.sun.com/docs/books/vmspec/2nd-edition/html/
Instructions2.doc3.html#dastore>

All other ways for passing a double value between methods (such as
dreturn, putfield, putstatic, invoke* etc.) require value set conversion, too.

Thus, I don't understand why the test case would need to be declared FP-
strict. Of course, this would be different if the test did some
calculations with the checked value, e.g. by converting the double value
to a float; the 'd2f' instruction may behave differently depending on
whether the method is FP-strict. But since it merely compares the value
with a constant, the test case should come to the same outcome everywhere
if the tested code is FP-strict.

I certainly would not mind declaring test code fpstrict, but I'd really
like to understand the reason. Can you enlighten me?

-- Sascha

Sascha Brawer, address@hidden, http://www.dandelis.ch/people/brawer/ 






reply via email to

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