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

Roland Mesde duke at openjdk.org
Tue Nov 18 23:05:14 UTC 2025


On Mon, 17 Nov 2025 18:21:06 GMT, Roland Mesde <duke at openjdk.org> wrote:

> 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).

Removed LenientParseTest.java. Tests already available in "LargeExponentsTest.java".

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

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2481#issuecomment-3549780728


More information about the jdk-updates-dev mailing list