double a%b returns NaN for some (a,b) (|a| < inf, |b|>0)

David Chase david.r.chase at oracle.com
Tue Feb 12 11:30:27 PST 2013


On 2013-02-12, at 1:34 PM, Jeff Hain <jeffhain at rocketmail.com> wrote:

> Vladimir wrote:
>> First, could you show what java versions you tried (java -version)? And what OS you are using?
> 
> 
> On Windows 7/Core i7 980X, it happens with the following 64 bits versions of Java:
> - 1.5.0_22-b03
> - 1.6.0_21-ea-b05
> - 1.6.0_29-ea-b08 (and also crashes at some point but this version seems to crash a lot, so might be unrelated)
> - 1.6.0_38-b05 ("Java HotSpot(TM) 64-Bit Server VM")
> but not with:
> - 1.7.0_11-b21
> - 1.8.0-ea-b73
> 
> 
> On Windows XP/T2300, it does not happen with:
> - 1.6.0_38
> - 1.6.0_39
> - 1.7.0_10

I have some more non-results, MacOS 10.8.2, Core i5, does not happen with:

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

openjdk version "1.8.0-internal-fastdebug" (near-current jdk8/tl)
OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-dr2chase_2013_02_08_16_15-b00)
OpenJDK 64-Bit Server VM (build 25.0-b17-fastdebug, mixed mode)

Each above used corresponding javac to compiler ModNaN.java, and plain "java" to test.

Also tried 7 and 8, class files from 1.6 javac, running java with flags:

-XX:+TieredCompilation -XX:TieredStopAtLevel=1
-XX:+TieredCompilation -XX:TieredStopAtLevel=2

Also tried on MacOS 10.8.2, Core i7, does not happen there with:

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

And thanks for the test code.

David



More information about the hotspot-dev mailing list