[jdk21u-dev] RFR: 8331485: Odd Results when Parsing Scientific Notation with Large Exponent

Roland Mesde duke at openjdk.org
Mon Nov 17 20:30:13 UTC 2025


Backporting JDK-8331485: Odd Results when Parsing Scientific Notation with Large Exponent.

Problem: DecimalFormat incorrectly parses strings with very large exponents:

- Exponents > Integer.MAX_VALUE return 0.0
- Exponents > Long.MAX_VALUE return the mantissa value

Fix: DecimalFormat.parse() now returns Double.POSITIVE_INFINITY for very large exponents, matching Double.parseDouble() behavior.

Impact: Eliminates edge case bug and provides consistent parsing behavior across Java's number parsing APIs.

Ran GHA Sanity Checks (passed) and related test (passed).

-------------

Commit messages:
 - Backport ffb0867e2c07b41cb7124e11fe6cf63d9471f0d2

Changes: https://git.openjdk.org/jdk21u-dev/pull/2481/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=2481&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8331485
  Stats: 695 lines in 3 files changed: 681 ins; 3 del; 11 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/2481.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/2481/head:pull/2481

PR: https://git.openjdk.org/jdk21u-dev/pull/2481


More information about the jdk-updates-dev mailing list