RFR: 8284493: Improve computeNextExponential tail performance and accuracy [v17]

Chris Hennick duke at openjdk.org
Wed Mar 22 21:17:52 UTC 2023


> This PR improves both the worst-case 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 prevent `nextGaussian` from going into the `nextExponential` tail twice.

Chris Hennick has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:

 - Merge branch 'master' into patch-1
 - Update copyright date in RandomNext.java
 - Update copyright date in RandomGeneratorNext.java
 - Update copyright date in RandomGeneratorExponentialGaussian.java
 - Update copyright date in RandomSupport.java
 - Add parameter to enable/disable fixed PRNG seed
 - Rewrite Javadoc
 - Simplify Javadoc description
 - Weaken contract of computeWinsorizedNextExponential to save max/min calls
 - Revert "Bugfix: need a thread-local instance for throughput test"
   
   This reverts commit d903efe57225e916a5450ac31437123050e3377c.
 - ... and 5 more: https://git.openjdk.org/jdk/compare/daddeb12...cc7c425a

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/8131/files
  - new: https://git.openjdk.org/jdk/pull/8131/files/b75139c9..cc7c425a

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

  Stats: 887558 lines in 10300 files changed: 477121 ins; 285236 del; 125201 mod
  Patch: https://git.openjdk.org/jdk/pull/8131.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/8131/head:pull/8131

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


More information about the core-libs-dev mailing list