RFR: 8326227: Fix a rare rounding error affecting RandomSupport::computeNextGaussian

Chris Hennick duke at openjdk.org
Tue Feb 20 20:11:07 UTC 2024


This provides a slightly more accurate bounding limit for `computeNextExponentialSoftCapped` when the computed bound is greater than `(1.0p53 - 1.0) * DoubleZigguratTables.exponentialX0`. This could cause the `while (computeNextExponentialSoftCapped(rng, limit) < limit)` check in `computeNextGaussian` on line 1402 to always be true, making the `nextGaussian` runtime unbounded in the worst case.

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

Commit messages:
 - Bug fix: Math is in java.lang, not java.util
 - Fix a possible rounding error in RandomSupport::computeNextExponential

Changes: https://git.openjdk.org/jdk/pull/17703/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17703&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8326227
  Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/17703.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17703/head:pull/17703

PR: https://git.openjdk.org/jdk/pull/17703


More information about the core-libs-dev mailing list