Name: rmT116609 Date: 03/12/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
For certain input values, Math.rint(double) returns results which are off by 1. For example, the values 262144.75, 262146.75, 262148.75, ... 499998.75 are all rounded down instead of up.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class RintBugCheck {
public static void main(String[] args) {
double test = 300000.75;
double expected = 300001.0;
double actual = Math.rint(test);
if (actual != expected) {
System.err.println("BUG: " + actual + " != " + expected);
}
}
}
---------- END SOURCE ----------
(Review ID: 182547)
======================================================================