RFR: 8284493: Fix rounding error in computeNextExponential [v7]

Chris Hennick duke at openjdk.org
Sun Jun 19 00:33:30 UTC 2022


> This PR improves both the performance of `nextExponential` and `nextGaussian` and the distribution of output at the tails. It fixes the following imperfections:
> 
> * Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a rounding error to accumulate at the tail of the distribution (probably starting around `2*exponentialX0 == 0x1.e46eff20739afp3 ~ 15.1`); this PR fixes that by tracking the multiple of exponentialX0 as a long. (This distortion is worst when `x > 0x1.0p56` since in that case, a rounding error means `extra + x == extra`.
> * Reduces several equations using `Math.fma`. (This will almost certainly improve performance, and may or may not improve output distribution.)
> * Uses the newly-extracted `computeWinsorizedNextExponential` function to greatly reduce the probability that `nextGaussian` suffers from *two* tail cases of `nextExponential`.

Chris Hennick has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:

  Split out PRNG benchmarks into org.openjdk.bench.java.util.random

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/8131/files
  - new: https://git.openjdk.org/jdk/pull/8131/files/13c6d22c..f84e0e03

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=8131&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=8131&range=05-06

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/8131.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/8131/head:pull/8131

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


More information about the core-libs-dev mailing list