-
Bug
-
Resolution: Fixed
-
P2
-
1.2.0
-
1.2fcs
-
x86
-
other
-
Verified
Name: dkC59003 Date: 09/23/98
Sample program below divides double values in strictfp method. Rounded quotient is known
and program compares it to the result of division. Exact result of division has mantissa
with rounded part near ulp.
On sol/x86 sample fails also with JIT JDK-1.2fcs-K and runs correctly under
JDK 1.2fcsJ and K with interpreter. It also works correctly on Sun SPARC (jit/nojit).
This bug affects the test in JCK 1.2beta4:
lang/FP/fpl038/fpl03802m2/fpl03802m2.html
========================================= fpl03802m2.java
import java.io.PrintStream;
public class fpl03802m2 {
public static void main(String argv[]) {
if (! failedDiv(0x33b8897c0b8de74L, 0x43110a98868d957cL, 0x19d9db7170e4b1L, System.out))
System.out.println(" Pass 1.");
if (! failedDiv(0x35bd9955b05112fL, 0x433bd57312e928c7L, 0x10026057f77385L, System.out))
System.out.println(" Pass 2.");
if (! failedDiv(0x3445cfb2d8a649cL, 0x94ec210fc614bL, 0x433180998ecb9031L, System.out))
System.out.println(" Pass 3.");
}
static strictfp boolean failedDiv(long iX0, long iY0, long iQ0, PrintStream out) {
double Y,X,Q;
X = Double.longBitsToDouble(iX0);
Y = Double.longBitsToDouble(iY0);
Q = Double.longBitsToDouble(iQ0);
if ( (X / Y) != Q ) {
final long twoM = ((long)1)<<53;
double diff2m = ((X / Y) * twoM) - (Q * twoM);
out.println(" Diff*2^m is " +diff2m +" for " +X +" / " +Y +" from waited " +Q);
out.println(" diff2m=" +show(diff2m) +" , X=" +show(X) +" , Y=" +show(Y)
+" , Q=" +show(Q) );
return true;
}
return false;
}
static String show( double r ) {
return ("0x"+Long.toHexString(Double.doubleToLongBits(r))+"L");
}
}
========================================= log
___ jax86 J NOne
Warning: JIT compiler "NOne" not found. Will use interpreter.
java version "1.2fcs"
Classic VM (build JDK-1.2fcs-J, green threads, nojit)
Warning: JIT compiler "NOne" not found. Will use interpreter.
Pass 1.
Pass 2.
Pass 3.
___ jax86 J
java version "1.2fcs"
Classic VM (build JDK-1.2fcs-J, green threads, sunwjit)
Diff*2^m is -4.450147717014403E-308 for 4.3110860111069824E-293 / 1.199181203203423E15 from waited 3.5950246714930137E-308
diff2m=0x8020000000000000L , X=0x33b8897c0b8de74L , Y=0x43110a98868d957cL , Q=0x19d9db7170e4b1L
Diff*2^m is -4.450147717014403E-308 for 1.7442487195572077E-292 / 7.834514586413255E15 from waited 2.2263647611073606E-308
diff2m=0x8020000000000000L , X=0x35bd9955b05112fL , Y=0x433bd57312e928c7L , Q=0x10026057f77385L
Diff*2^m is 9.007199254740992E15 for 6.376765081481208E-293 / 1.294387865344315E-308 from waited 4.926471618138161E15
diff2m=0x4340000000000000L , X=0x3445cfb2d8a649cL , Y=0x94ec210fc614bL , Q=0x433180998ecb9031L
___ uname -a
SunOS novo91 5.6 Generic i86pc i386 i86pc
=========================================
======================================================================
- duplicates
-
JDK-4175714 JIT/x86 suffers more than one rounding error in FP-strict addition
- Closed
-
JDK-4175715 javac/x86/JIT incorrectly treats some double constant-expressions
- Closed