diff --git a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.factory.js index e059a69e929f..d819e193c84e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.factory.js @@ -22,10 +22,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var factory = require( './../lib/factory.js' ); @@ -221,9 +220,7 @@ tape( 'if provided `d1 <= 0`, the created function always returns `NaN`', functi tape( 'the created function evaluates the pdf for `x` given large `d1` and `d2` (tested against Julia)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -237,22 +234,14 @@ tape( 'the created function evaluates the pdf for `x` given large `d1` and `d2` for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2300.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 4003 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the pdf for `x` given a large parameter `d1` (tested against Julia)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -266,22 +255,14 @@ tape( 'the created function evaluates the pdf for `x` given a large parameter `d for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 95 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the pdf for `x` given a large parameter `d2` (tested against Julia)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -295,22 +276,14 @@ tape( 'the created function evaluates the pdf for `x` given a large parameter `d for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1800.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 103 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the pdf for `x` given large `d1` and `d2` (tested against the Boost C++ library)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -324,22 +297,14 @@ tape( 'the created function evaluates the pdf for `x` given large `d1` and `d2` for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 148 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the pdf for `x` given a large parameter `d1` (tested against the Boost C++ library)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -353,22 +318,14 @@ tape( 'the created function evaluates the pdf for `x` given a large parameter `d for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 100.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 105 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the pdf for `x` given a large parameter `d2` (tested against the Boost C++ library)', function test( t ) { var expected; - var delta; var pdf; - var tol; var d1; var d2; var x; @@ -382,13 +339,7 @@ tape( 'the created function evaluates the pdf for `x` given a large parameter `d for ( i = 0; i < x.length; i++ ) { pdf = factory( d1[i], d2[i] ); y = pdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1285 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.native.js index 7809a3a9c48e..7ae4ac43867e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.native.js @@ -181,11 +181,7 @@ tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested d2 = bothLarge.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 5000 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 4003 ), true, 'returns expected value' ); } t.end(); }); @@ -204,11 +200,7 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested d2 = largeD1.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 2500 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 95 ), true, 'returns expected value' ); } t.end(); }); @@ -227,11 +219,7 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested d2 = largeD2.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 4000 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 103 ), true, 'returns expected value' ); } t.end(); }); @@ -250,11 +238,7 @@ tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested d2 = cppBothLarge.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 3000 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 148 ), true, 'returns expected value' ); } t.end(); }); @@ -273,11 +257,7 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested d2 = cppLargeD1.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 2500 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 105 ), true, 'returns expected value' ); } t.end(); }); @@ -296,11 +276,7 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested d2 = cppLargeD2.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - t.ok( isAlmostSameValue( y, expected[i], 4000 ), 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1285 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.pdf.js b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.pdf.js index 638a50e197f7..dd252671dd29 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.pdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/f/pdf/test/test.pdf.js @@ -22,10 +22,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var pdf = require( './../lib' ); @@ -155,8 +154,6 @@ tape( 'if provided `d1 > 2.0`, the function returns `0.0` when provided `0.0` fo tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested against Julia)', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -169,21 +166,13 @@ tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested d2 = bothLarge.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2300.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 4003 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested against Julia)', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -196,21 +185,13 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested d2 = largeD1.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 95 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested against Julia)', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -223,21 +204,13 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested d2 = largeD2.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1800.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 103 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested against the Boost C++ library', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -250,21 +223,13 @@ tape( 'the function evaluates the pdf for `x` given large `d1` and `d2` (tested d2 = cppBothLarge.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 148 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested against the Boost C++ library)', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -277,21 +242,13 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d1` (tested d2 = cppLargeD1.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 100.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 105 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested against the Boost C++ library)', function test( t ) { var expected; - var delta; - var tol; var d1; var d2; var x; @@ -304,13 +261,7 @@ tape( 'the function evaluates the pdf for `x` given large parameter `d2` (tested d2 = cppLargeD2.d2; for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], d1[i], d2[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', d1: '+d1[i]+', d2: '+d2[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1150.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. d1: '+d1[i]+'. d2: '+d2[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1285 ), true, 'returns expected value' ); } t.end(); });