On Wed, 6 Apr 2022 17:47:53 GMT, Chris Hennick <d...@openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: f975be44
Author:    Chris Hennick <4961925+pr0meth...@users.noreply.github.com>
Committer: Joe Darcy <da...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/f975be44a86879e1079a0066203b49d59b7a1167
Stats:     144 lines in 4 files changed: 128 ins; 0 del; 16 mod

8284493: Improve computeNextExponential tail performance and accuracy

Reviewed-by: darcy

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

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

Reply via email to