You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: stats/base/dists/pareto-type1/quantile loses accuracy for small p #17008
In @stdlib/stats/base/dists/pareto-type1/quantile, the quantile function is currently computed as:
beta/pow(1.0-p,1.0/alpha);
(and beta / pow( 1.0 - p, alphaInv ) in lib/factory.js, and beta / stdlib_base_pow( 1.0 - p, 1.0/alpha ) in src/main.c).
For small probabilities p, evaluating 1.0 - p suffers from floating-point cancellation and rounds to 1.0 when p < 1.11e-16. As a result, pow( 1.0 - p, ... ) evaluates to 1.0, causing the function to return beta instead of the true quantile. When alpha is also small, this produces large relative errors.
Replacing beta / pow( 1.0 - p, 1.0 / alpha ) with beta * exp( -log1p( -p ) / alpha ) (and handling p === 1.0 explicitly by returning +Infinity) avoids cancellation in 1.0 - p.
Related Issues
None. (Related to similar log1p/expm1 tail accuracy fixes such as #15762, #15763, #15769, and #16565.)
Activity
fix: resolve quantile accuracy for small `p` in `stats/base/dists/par…
Fix stdlib-js#17008: declare exp/log1p add-on dependencies in manifest
Fix stdlib-js#17008: address lint in quantile tests (vars-on-top, sin…