Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084363 | emb-9 | Brian Burkhalter | P4 | Resolved | Fixed | team |
FULL PRODUCT VERSION :
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When a small number followed by a large exponent, >= 326 Double.parseDouble outputs Infinity whereas new BigDecimal(text).doubleValue() doesn't.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
String text325 = "0.00000000000000001e325";
System.out.println(Double.parseDouble(text325));
System.out.println(new BigDecimal(text325).doubleValue());
String text326 = "0.000000000000000001e326";
System.out.println(Double.parseDouble(text326));
System.out.println(new BigDecimal(text326).doubleValue());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1.0E308
1.0E308
1.0E308
1.0E308
ACTUAL -
1.0E308
1.0E308
Infinity
1.0E308
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Use BigDecimal
Don't use such obtuse format for numbers.
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When a small number followed by a large exponent, >= 326 Double.parseDouble outputs Infinity whereas new BigDecimal(text).doubleValue() doesn't.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
String text325 = "0.00000000000000001e325";
System.out.println(Double.parseDouble(text325));
System.out.println(new BigDecimal(text325).doubleValue());
String text326 = "0.000000000000000001e326";
System.out.println(Double.parseDouble(text326));
System.out.println(new BigDecimal(text326).doubleValue());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1.0E308
1.0E308
1.0E308
1.0E308
ACTUAL -
1.0E308
1.0E308
Infinity
1.0E308
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Use BigDecimal
Don't use such obtuse format for numbers.
- backported by
-
JDK-8084363 Doubles with large exponents overflow to Infinity incorrectly
- Resolved