Name: gm110360 Date: 11/07/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)
A DESCRIPTION OF THE PROBLEM :
look the source and result.
while() and probably do...while()
produces same results.
EXPECTED VERSUS ACTUAL BEHAVIOR :
----------------------------------------
result:
0.70
0.80
0.90
1.00
but, if the initial value becomes 0.8 ,
0.80
0.90
---------------------------------------
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.text.* ;
class Test
{
static NumberFormat f = NumberFormat.getNumberInstance() ;
static
{
( (DecimalFormat)f ).applyPattern( " #0.00;-" ) ;
}
public static void main( String[] param )
{
for( double a=0.7 ; a < 1 ; a += 0.1 )
{
System.out.println( f.format(a) ) ;
}
}
}
---------- END SOURCE ----------
(Incident Review ID: 178890)
======================================================================
- relates to
-
JDK-4421899 Multiplication of any integer multiple of 5 with 0.000001 faulty!
-
- Closed
-
-
JDK-4430070 double and float not calculating correctly
-
- Closed
-
-
JDK-4497156 double (primitive) arithmetic precision error
-
- Closed
-