Locale dependency of JMH, div by 0 in ListStatistics
Aleksey Shipilev
aleksey.shipilev at oracle.com
Mon Dec 22 14:48:32 UTC 2014
On 12/22/2014 05:20 PM, Aleksey Shipilev wrote:
>>> 2. org.openjdk.jmh.util.ListStatistics#getVariance
>>>
>>> This will yield a division by 0 if getN() == 1. In order to compute
>>> variance, you need n > 1.
>>> The code is also inconsistent in the sense that it uses getN() in one
>>> place, and count in the other.
>>
>> https://bugs.openjdk.java.net/browse/CODETOOLS-7901227
Ah, the hilarity of this "bug" is that current code does the
floating-point division of 0.0/0.0 when N=1, which yields NaN, as
expected. Fixed this anyway:
http://hg.openjdk.java.net/code-tools/jmh/rev/df151f9c0071
Thanks,
-Aleksey.
More information about the jmh-dev
mailing list