> See
> http://java.sun.com/docs/books/jls/clarify.html
> for the discussion of the strictfp keyword.
As far as I know, There is neither JVM nor JIT for x86
support strictfp modifier, even Sun's.
I've tried to support strictfp with shuJIT
(http://www.shudo.net/jit/) and the trial seems to succeed.
This feature also works with JDK 1.1.7 not only JDK 1.2.
Now, with strictfp modifiers, shuJIT produces the same
results as what SPARC processor derives. An attached
test code shows:
% java StrictfpTest
shuJIT for Sun JVM/IA-32 Copyright 1998,1999 by SHUDO Kazuyuki
1.112808544714844E-308 (0x0008008000000000)
* 1.0000000000000002 (0x3ff0000000000001)
default : 1.112808544714844E-308 (0x8008000000000)
strictfp: 1.112808544714845E-308 (0x8008000000001)
2.225073858507201E-308 (0x000fffffffffffff)
/ 0.9999999999999999 (0x3fefffffffffffff)
default : 2.2250738585072014E-308 (0x10000000000000)
strictfp: 2.225073858507201E-308 (0xfffffffffffff)
Kazuyuki SHUDO Happy Hacking!
Muraoka Lab., Grad. School of Sci. & Eng., Waseda Univ.
==========
class StrictfpTest {
private static double defaultDmul(double a, double b) {
return a * b;
}
private static strictfp double strictDmul(double a, double b) {
return a * b;
}
private static double defaultDdiv(double a, double b) {
return a / b;
}
private static strictfp double strictDdiv(double a, double b) {
return a / b;
}
public static strictfp void main(String[] args) {
double a, b, c;
/* multiplication */
a = Double.longBitsToDouble(0x0008008000000000L);
b = Double.longBitsToDouble(0x3ff0000000000001L);
System.out.println(a + " (0x0008008000000000)");
System.out.println(" * " + b + " (0x3ff0000000000001)");
c = defaultDmul(a, b);
System.out.println("default : " + c +
" (0x" + Long.toHexString(Double.doubleToLongBits(c)) + ")");
c = strictDmul(a, b);
System.out.println("strictfp: " + c +
" (0x" + Long.toHexString(Double.doubleToLongBits(c)) + ")");
System.out.println();
/* division */
a = Double.longBitsToDouble(0x000fffffffffffffL);
b = Double.longBitsToDouble(0x3fefffffffffffffL);
System.out.println(a + " (0x000fffffffffffff)");
System.out.println(" / " + b + " (0x3fefffffffffffff)");
c = defaultDdiv(a, b);
System.out.println("default : " + c +
" (0x" + Long.toHexString(Double.doubleToLongBits(c)) + ")");
c = strictDdiv(a, b);
System.out.println("strictfp: " + c +
" (0x" + Long.toHexString(Double.doubleToLongBits(c)) + ")");
}
}
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]