Tr : double a%b returns NaN for some (a,b) (|a| < inf, |b|>0)
Joe Darcy
joe.darcy at oracle.com
Fri Feb 15 11:11:20 PST 2013
Hello,
On 2/12/2013 2:52 PM, Jeff Hain wrote:
>
> Joe Darcy wrote:
> >For the non-NaN floating-point values, I recommend using hexadecimal
> >floating-point syntax rather than calling Double.longBitsToDouble on a
> >hex string value; see Double.toHexString for details.
>
>
> It should be more readable for humans indeed, but I guess my
> transformation
> into a processor is now irreversible ;)
>
>
>
> >you can add the "strictfp" modifier to remove one source of possible
> variance.
>
>
> Still happens with strictfp.
> (about strictfp, off-topic but I removed it from all my code after
> someone pointed out it added some overhead (like 20ms+ on
> 10_000_000 calls micro-benchmarks, so about 2ns+), when
> having strictfp code call non-strictfp code or the opposite)
>
On non-x86 systems, the presence or absence of strictfp should be a no-op.
When an x86 implementation is only using SSE registers, such as when it
is not calling into intrinsified java.lang.Math methods using the x87
instructions, there needed be additional overhead, but I haven't done
measurements of what overhead may exist.
-Joe
More information about the hotspot-dev
mailing list