diff --git a/lib/node_modules/@stdlib/stats/base/dists/gamma/logcdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/gamma/logcdf/test/test.native.js index ae3798841625..156df5657625 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gamma/logcdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gamma/logcdf/test/test.native.js @@ -22,12 +22,12 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var uniform = require( '@stdlib/random/base/uniform' ); var ln = require( '@stdlib/math/base/special/ln' ); var cdf = require( '@stdlib/stats/base/dists/gamma/cdf' ); @@ -153,10 +153,8 @@ tape( 'if provided an `alpha` equal to `0` and `beta` is positive, the function tape( 'the function evaluates the logarithm of the CDF', opts, function test( t ) { var expected; - var delta; var alpha; var beta; - var tol; var i; var x; var y; @@ -167,14 +165,9 @@ tape( 'the function evaluates the logarithm of the CDF', opts, function test( t beta = uniform( EPS, 10.0 ); y = logcdf( x, alpha, beta ); expected = ln( cdf( x, alpha, beta ) ); - if ( y === expected ) { - t.strictEqual( y, expected, 'x: '+x+', alpha: '+alpha+', beta: '+beta+', y: '+y+', expected: '+expected ); - } else { - // NOTE: increased test tolerance due to differences in accumulated error between JavaScript and C, especially as we are wrapping `cdf` which relies on `gammainc`, where compiler optimizations can result in different error propagation - delta = abs( y - expected ); - tol = 100.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. alpha: '+alpha+'. beta: '+beta+'. y: '+y+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + + // NOTE: increased ULP tolerance due to differences in accumulated error between JavaScript and C, especially as we are wrapping `cdf` which relies on `gammainc`, where compiler optimizations can result in different error propagation + t.strictEqual( isAlmostSameValue( y, expected, 100 ), true, 'returns expected value' ); } t.end(); });