...
This noncompliant example does not enforce the strictfp
constraints. Double.MAX_VALUE
is being multiplied by 1.1 and reduced back by dividing by 1.1 according to the evaluation order. JVM implementations are not required to report an overflow resulting from the initial multiplication, although they can chose to treat this case as strictfp
. The ability to use extended exponent ranges to represent intermediate values is thus as a result implementation defined.
Code Block | ||
---|---|---|
| ||
class Strictfp { public static void main(String[] args) { double d = Double.MAX_VALUE; System.out.println("This value \"" + ((d * 1.1) / 1.1) + "\" cannot be represented as double."); } } |
...