> 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 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 ten additional 
commits since the last revision:

 - 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.
 - More sensible benchmark-mode settings
 - Bugfix: need a thread-local instance for throughput test
 - Split out PRNG benchmarks into org.openjdk.bench.java.util.random
 - Add JMH
 - Fix rounding error in computeNextExponential; use FMA
   
   Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a 
rounding error to accumulate at the tail of the distribution; this fixes that 
by tracking the multiple of exponentialX0 as a long.
   
   Add computeWinsorizedNextExponential for testability

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/8131/files
  - new: https://git.openjdk.org/jdk/pull/8131/files/d1c9bafd..c94a09e5

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

  Stats: 381291 lines in 6418 files changed: 204420 ins; 125420 del; 51451 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

Reply via email to