In the course of writing tests for the hyperbolic transcendental functions (4851625), I noticed some anomolies in the test output. Namely a value returned from a Java method and a native floating-point method did not compare as equal but had the same represention when printed out as a long bit pattern (i.e. same result from Double.longBitsToDouble). The values are no where near the overflow or underflow threshold so strictfp vs non-strictfp is not an issue. The problem persists even when the method is declared strictfp. Moreover, the results are written to local variables (which javac correctly preserves with dstore instructions) so both values must be members of the double value set.
I suspect C1 does not always clamp a long-double return value from a native method to double in some situations. The problem does not occur when Java is invoked with -Xint, -server, -Xcomp -client, or -Xcomp -server. The problem does not occur under Linux x86, at least not with the test program in question.
Tar ball of relevant files attached; run the HyperbolicsDiffFinderBug program.
The failure occured when the coding idiom
if( (local1=nativeSinh(d)) != (fdlibm1=StrictMath.sinh(d)) )
is used but not when
local1=nativeSinh(d);
fdlibm1=StrictMath.sinh(d);
if(loca1 != fdlibm1)
is used.
I suspect C1 does not always clamp a long-double return value from a native method to double in some situations. The problem does not occur when Java is invoked with -Xint, -server, -Xcomp -client, or -Xcomp -server. The problem does not occur under Linux x86, at least not with the test program in question.
Tar ball of relevant files attached; run the HyperbolicsDiffFinderBug program.
The failure occured when the coding idiom
if( (local1=nativeSinh(d)) != (fdlibm1=StrictMath.sinh(d)) )
is used but not when
local1=nativeSinh(d);
fdlibm1=StrictMath.sinh(d);
if(loca1 != fdlibm1)
is used.
- relates to
-
JDK-4851625 Add hyperbolic transcendental functions (sinh, cosh, tanh) to Java math library
- Resolved
-
JDK-6213988 Change in behavior of Math.log() with intrinsified version
- Resolved