This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: Don't optimize by hand (Was Re: Lack of fabsf on Solaris(patch included))
Kazuyuki Shudo writes:
> Andrew Haley wrote:
>
> > > And we probably don't really implement strict fp
> > > semantics anyway
> >
> > The last time that I ran any tests we were 100% strict fp perfect.
Actually, this was a mistake. Sorry.
> > That's better than the other Java implementation I tried!
>
> Here is a test program.
> If the Java runtime is compliant with the strictfp specification,
> you will see the following:
>
> % java StrictfpTest
> shuJIT for Sun Classic VM/x86 by Kazuyuki Shudo
> 1.112808544714844E-308 (0x0008008000000000)
> * 1.0000000000000002 (0x3ff0000000000001)
> default : 1.112808544714844E-308 (0x8008000000000)
> strictfp: 1.1128085447148447E-308 (0x8008000000001)
>
> 2.225073858507201E-308 (0x000fffffffffffff)
> / 0.9999999999999999 (0x3fefffffffffffff)
> default : 2.2250738585072014E-308 (0x10000000000000)
> strictfp: 2.225073858507201E-308 (0xfffffffffffff)
Not necessarily: non-strict FP can be exactly the same as strict FP at
the implementor's discretion. In this case the question is, are the
values GCJ returns incorrect? If so, we have a bug in GCJ or in the
FPU itself.
I know I should do this calculation by hand to make sure, but...
Andrew.