[jdk21u-dev] RFR: 8331485: Odd Results when Parsing Scientific Notation with Large Exponent
Paul Hohensee
phh at openjdk.org
Tue Nov 18 21:51:30 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).
This has the same problem with LenientParseTest.java as https://github.com/openjdk/jdk21u-dev/pull/2468. StrictParseTest.java has the same issue.
-------------
PR Review: https://git.openjdk.org/jdk21u-dev/pull/2481#pullrequestreview-3479800358
More information about the jdk-updates-dev
mailing list