Skip to content

Conversation

@rm-gh-8
Copy link
Contributor

@rm-gh-8 rm-gh-8 commented Nov 17, 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).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8331485 needs maintainer approval
  • JDK-8331680 needs maintainer approval

Issues

  • JDK-8331485: Odd Results when Parsing Scientific Notation with Large Exponent (Bug - P4)
  • JDK-8331680: NumberFormat is missing some bad exponent strict parse cases (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2481/head:pull/2481
$ git checkout pull/2481

Update a local copy of the PR:
$ git checkout pull/2481
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2481/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2481

View PR using the GUI difftool:
$ git pr show -t 2481

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2481.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 17, 2025

👋 Welcome back rm-gh-8! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 17, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport ffb0867e2c07b41cb7124e11fe6cf63d9471f0d2 8331485: Odd Results when Parsing Scientific Notation with Large Exponent Nov 17, 2025
@openjdk
Copy link

openjdk bot commented Nov 17, 2025

This backport pull request has now been updated with issues from the original commit.

@openjdk openjdk bot added the backport Port of a pull request already in a different code base label Nov 17, 2025
@rm-gh-8 rm-gh-8 marked this pull request as ready for review November 17, 2025 20:24
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 17, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 17, 2025

Webrevs

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the same problem with LenientParseTest.java as #2468. StrictParseTest.java has the same issue.

@rm-gh-8
Copy link
Contributor Author

rm-gh-8 commented Nov 18, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants