diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/benchmark/benchmark.js index bec1226cc0dc..9797bd8fac18 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/benchmark/benchmark.js @@ -21,9 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var mgf = require( './../lib' ); @@ -32,26 +31,23 @@ var mgf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var n; var p; var t; var y; var i; - len = 100; - t = new Float64Array( len ); - n = new Float64Array( len ); - p = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - t[ i ] = uniform( 0.0, 5.0 ); - n[ i ] = discreteUniform( 1, 100 ); - p[ i ] = uniform( 0.0, 1.0 ); - } + opts = { + 'dtype': 'float64' + }; + t = uniform( 100, 0.0, 5.0, opts ); + n = discreteUniform( 100, 1, 100, opts ); + p = uniform( 100, 0.0, 1.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mgf( t[ i % len ], n[ i % len ], p[ i % len ] ); + y = mgf( t[ i % t.length ], n[ i % n.length ], p[ i % p.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mymgf; - var len; + var opts; var n; var p; var t; var y; var i; + opts = { + 'dtype': 'float64' + }; + t = uniform( 100, 0.0, 5.0, opts ); + n = 80; p = 0.4; mymgf = mgf.factory( n, p ); - len = 100; - t = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - t[ i ] = uniform( 0.0, 5.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mymgf( t[ i % len ] ); + y = mymgf( t[ i % t.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.factory.js index c4e8c20f30de..f739a1ca435d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.factory.js @@ -57,23 +57,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', mgf = factory( 20, 0.5 ); y = mgf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( NaN, 0.5 ); y = mgf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( 20, NaN ); y = mgf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( NaN, NaN ); y = mgf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( NaN, NaN ); y = mgf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -85,22 +85,22 @@ tape( 'if provided an `n` which is not a nonnegative integer, the created functi mgf = factory( 20.5, 0.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( -10, 0.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( PINF, 0.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( NINF, 0.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -112,22 +112,22 @@ tape( 'if provided a success probability `p` outside `[0,1]`, the created functi mgf = factory( 20, 1.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( 20, -0.5 ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( 20, PINF ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); mgf = factory( 20, NINF ); y = mgf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.mgf.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.mgf.js index c1db8cfcd5e6..663f4d49caef 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.mgf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mgf/test/test.mgf.js @@ -47,11 +47,11 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = mgf( NaN, 10, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 4.0, NaN, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 4.0, 10, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -59,19 +59,19 @@ tape( 'if provided an `n` which is not a nonnegative integer, the function retur var y; y = mgf( 2.0, 1.5, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 2.0, -2, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 2.0, -1, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 0.0, 2.5, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 0.0, PINF, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -80,16 +80,16 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re var y; y = mgf( 2.0, 20, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 0.0, 20, 1.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 2.0, 20, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mgf( 2.0, 20, PINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.js index 5c653beb0725..ad690f0cd52f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.js @@ -21,10 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Int32Array = require( '@stdlib/array/int32' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var mode = require( './../lib' ); @@ -33,23 +31,21 @@ var mode = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; var n; var p; var y; var i; - len = 100; - n = new Int32Array( len ); - p = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - n[ i ] = discreteUniform( 1, 100 ); - p[ i ] = uniform( 0.0, 1.0 ); - } + n = discreteUniform( 100, 1, 100, { + 'dtype': 'int32' + }); + p = uniform( 100, 0.0, 1.0, { + 'dtype': 'float64' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mode( n[ i % len ], p[ i % len ] ); + y = mode( n[ i % n.length ], p[ i % p.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.native.js index 9138324b4981..bdd59193fe7a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/benchmark/benchmark.native.js @@ -22,11 +22,9 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var Int32Array = require( '@stdlib/array/int32' ); -var Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; @@ -42,23 +40,21 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; var n; var p; var y; var i; - len = 100; - n = new Int32Array( len ); - p = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - n[ i ] = discreteUniform( 1, 100 ); - p[ i ] = uniform( 0.0, 1.0 ); - } + n = discreteUniform( 100, 1, 100, { + 'dtype': 'int32' + }); + p = uniform( 100, 0.0, 1.0, { + 'dtype': 'float64' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mode( n[ i % len ], p[ i % len ] ); + y = mode( n[ i % n.length ], p[ i % p.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.js index 5c05e2d5a415..74cfe695336e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.js @@ -39,13 +39,13 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var v = mode( NaN, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 10, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( NaN, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -54,19 +54,19 @@ tape( 'if provided an `n` which is not a nonnegative integer, the function retur var v; v = mode( 1.5, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( -2, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( -1, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 2.5, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( PINF, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -75,16 +75,16 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re var v; v = mode( 20, -1.0 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 20, 1.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 20, NINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 20, PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.native.js index 3ec23aa8fb48..16306640eb09 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/mode/test/test.native.js @@ -48,7 +48,7 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f var v; v = mode( 10, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -57,10 +57,10 @@ tape( 'if provided an `n` which is not a nonnegative integer, the function retur var v; v = mode( -2, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( -1, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -69,10 +69,10 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re var v; v = mode( 20, -1.0 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mode( 20, 1.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/benchmark/benchmark.js index edc89b9eddb4..7e1d4a6e599c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/benchmark/benchmark.js @@ -21,9 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var pmf = require( './../lib' ); @@ -32,26 +31,23 @@ var pmf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var n; var p; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - n = new Float64Array( len ); - p = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = discreteUniform( 0, 50 ); - n[ i ] = discreteUniform( 1, 100 ); - p[ i ] = uniform( 0.0, 1.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = discreteUniform( 100, 1, 50, opts ); + n = discreteUniform( 100, 1, 100, opts ); + p = uniform( 100, 0.0, 1.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = pmf( x[ i % len ], n[ i % len ], p[ i % len ] ); + y = pmf( x[ i % x.length ], n[ i % n.length ], p[ i % p.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mypmf; - var len; + var opts; var n; var p; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = discreteUniform( 100, 1, 80, opts ); + n = 80; p = 0.4; mypmf = pmf.factory( n, p ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = discreteUniform( 0, 80 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mypmf( x[ i % len ] ); + y = mypmf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.factory.js index e47cb1a6fbbb..600b03f8d9b4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.factory.js @@ -57,23 +57,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', pmf = factory( 20, 0.5 ); y = pmf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( NaN, 0.5 ); y = pmf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 20, NaN ); y = pmf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( NaN, NaN ); y = pmf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( NaN, NaN ); y = pmf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -84,16 +84,16 @@ tape( 'if provided a valid `n` and `p`, the function returns a function which re pmf = factory( 20, 0.5 ); y = pmf( NINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -20.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -10.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -104,16 +104,16 @@ tape( 'if provided a valid `n` and `p`, the function returns a function which re pmf = factory( 20, 0.5 ); y = pmf( -2.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -1.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 1.2 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -124,16 +124,16 @@ tape( 'if provided a valid `n` and `p`, the function returns a function which re pmf = factory( 20, 0.5 ); y = pmf( 21.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 22.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 50.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -145,22 +145,22 @@ tape( 'if provided a success probability `p` outside `[0,1]`, the created functi pmf = factory( 20, 1.2 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 20, -0.1 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 20, NINF ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 20, PINF ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -172,22 +172,22 @@ tape( 'if provided a `n` which is not a nonnegative integer, the created functio pmf = factory( -1.0, 0.5 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 1.5, 0.5 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( NINF, 0.5 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( PINF, 0.5 ); y = pmf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -202,33 +202,33 @@ tape( 'if `p` or `n` equals `0`, the created function evaluates a degenerate dis t.equal( y, 1.0, 'returns 1 for x equal to 0' ); y = pmf( 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); pmf = factory( 0.0, 0.5 ); y = pmf( 0.0 ); - t.equal( y, 1.0, 'returns 1 for x equal to 0' ); + t.equal( y, 1.0, 'returns expected value' ); y = pmf( 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -240,19 +240,19 @@ tape( 'if `p` equals `1.0`, the created function evaluates a degenerate distribu pmf = factory( 8, 1.0 ); y = pmf( 8.0 ); - t.equal( y, 1.0, 'returns 1 for x equal to 8' ); + t.equal( y, 1.0, 'returns expected value' ); y = pmf( 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.pmf.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.pmf.js index 9441e5f264f3..8bb27440e2bb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.pmf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/pmf/test/test.pmf.js @@ -47,42 +47,42 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = pmf( NaN, 20, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0, NaN, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0, 20, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided a negative integer for `x` and a valid `n` and `p`, the function returns `0`', function test( t ) { var y = pmf( NINF, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -20.0, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -100.0, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -1.0, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); tape( 'if provided a non-integer for `x` and a valid `n` and `p`, the function returns `0`', function test( t ) { var y = pmf( -1.5, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( -0.5, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 1.5, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( 2.5, 20, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -91,16 +91,16 @@ tape( 'if provided `n` which is not a nonnegative integer, the function returns var y; y = pmf( 2.0, 1.5, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0, -1.0, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 2.0, NINF, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 2.0, PINF, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -109,16 +109,16 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re var y; y = pmf( 2.0, 20, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 0.0, 20, 1.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 2.0, 20, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = pmf( 2.0, 20, PINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -131,32 +131,32 @@ tape( 'if `p` or `n` equals `0`, the function evaluates a degenerate distributio t.equal( y, 1.0, 'returns 1 for x equal to 0' ); y = pmf( 1.0, 8, 0.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF, 8, 0.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF, 8, 0.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN, 8, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); // Case: n = 0, p = 0.5 y = pmf( 0.0, 0, 0.5 ); t.equal( y, 1.0, 'returns 1 for x equal to 0' ); y = pmf( 1.0, 0, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF, 0, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF, 0, 0.5 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN, 0, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -168,16 +168,16 @@ tape( 'if `p` equals `1.0`, the function evaluates a degenerate distribution cen t.equal( y, 1.0, 'returns 1 for x equal to 8' ); y = pmf( 1.0, 8, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( PINF, 8, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NINF, 8, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); y = pmf( NaN, 8, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/benchmark/benchmark.js index 2975cef275d9..84a60c8596b3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/benchmark/benchmark.js @@ -21,9 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var quantile = require( './../lib' ); @@ -32,26 +31,23 @@ var quantile = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var n; var p; var r; var y; var i; - len = 100; - r = new Float64Array( len ); - n = new Float64Array( len ); - p = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - r[ i ] = uniform( 0.0, 1.0 ); - n[ i ] = discreteUniform( 1, 100 ); - p[ i ] = uniform( 0.0, 1.0 ); - } + opts = { + 'dtype': 'float64' + }; + r = uniform( 100, 0.0, 1.0, opts ); + n = discreteUniform( 100, 1, 100, opts ); + p = uniform( 100, 0.0, 1.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = quantile( r[ i % len ], n[ i % len ], p[ i % len ] ); + y = quantile( r[ i % r.length ], n[ i % n.length ], p[ i % p.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var myQuantile; - var len; + var opts; var n; var p; var r; var y; var i; + opts = { + 'dtype': 'float64' + }; + r = uniform( 100, 0.0, 1.0, opts ); + n = 80; p = 0.4; myQuantile = quantile.factory( n, p ); - len = 100; - r = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - r[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = myQuantile( r[ i % len ] ); + y = myQuantile( r[ i % r.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.factory.js index 8584abaf45a5..a6127858a795 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.factory.js @@ -55,23 +55,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', quantile = factory( 20, 0.5 ); y = quantile( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( NaN, 0.5 ); y = quantile( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( 20, NaN ); y = quantile( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( NaN, NaN ); y = quantile( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( NaN, NaN ); y = quantile( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -82,10 +82,10 @@ tape( 'if provided a valid `n` and `p`, the function returns a function which re quantile = factory( 20, 0.5 ); y = quantile( -0.1 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 1.1 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -97,22 +97,22 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the created fun quantile = factory( 20, -1.0 ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.1 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( 20, NINF ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( 20, PINF ); y = quantile( 0.3 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( 20, 1.5 ); y = quantile( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -124,23 +124,23 @@ tape( 'if provided a `n` which is not a nonnegative integer, the created functio quantile = factory( 20.5, 0.5 ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( -1.0, 0.5 ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( NINF, 0.5 ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( PINF, 0.5 ); y = quantile( 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -152,30 +152,30 @@ tape( 'if `p` or `n` equals `0`, the created function evaluates a degenerate dis quantile = factory( 0, 0.5 ); y = quantile( 0.3 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 0.9 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 1.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); quantile = factory( 8, 0.0 ); y = quantile( 0.3 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 0.9 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 1.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -193,10 +193,10 @@ tape( 'if `p` equals `1.0`, the created function evaluates a degenerate distribu t.equal( y, 8, 'returns 8 for r inside [0,1]' ); y = quantile( 1.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.quantile.js b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.quantile.js index dda0c0dced19..14bf2d154792 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.quantile.js +++ b/lib/node_modules/@stdlib/stats/base/dists/binomial/quantile/test/test.quantile.js @@ -45,19 +45,19 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = quantile( NaN, 20, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.0, NaN, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.0, 20, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided a number outside `[0,1]` for `r` and a valid `n` and `p`, the function returns `NaN`', function test( t ) { var y = quantile( 1.1, 20, 0.5 ); - t.equal( isnan( y ), true, 'returns true' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1, 20, 0.5 ); - t.equal( isnan( y ), true, 'returns true' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -65,22 +65,22 @@ tape( 'if provided a `n` which is not a nonnegative integer, the function return var y; y = quantile( 0.5, 10.5, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, 1.5, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, PINF, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, NINF, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, -2.0, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, -0.5, 0.8 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -89,16 +89,16 @@ tape( 'if provided a success probability `p` outside `[0,1]`, the function retur var y; y = quantile( 0.5, 20, 1.5 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, 20, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, 20, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.5, 20, PINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -107,29 +107,29 @@ tape( 'if `p` equals `1.0`, the function evaluates a degenerate distribution cen var y; y = quantile( 0.3, 8, 1.0 ); - t.equal( y, 8, 'returns 8 for r inside [0,1]' ); + t.equal( y, 8, 'returns expected value' ); y = quantile( 0.9, 8, 1.0 ); - t.equal( y, 8, 'returns 8 for r inside [0,1]' ); + t.equal( y, 8, 'returns expected value' ); y = quantile( 1.1, 8, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1, 8, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'given valid parameters, the function returns 0 as the 0% quantile', function test( t ) { var y = quantile( 0.0, 8, 0.5 ); - t.equal( y, 0, 'returns 0' ); + t.equal( y, 0, 'returns expected value' ); t.end(); }); tape( 'given valid parameters, the function returns n as the 100% quantile', function test( t ) { var y = quantile( 1.0, 8, 0.5 ); - t.equal( y, 8, 'returns 8' ); + t.equal( y, 8, 'returns expected value' ); t.end(); }); @@ -137,28 +137,28 @@ tape( 'if `p` or `n` equals `0`, the function evaluates a degenerate distributio var y; y = quantile( 0.3, 8, 0.0 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 0.9, 8, 0.0 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 1.1, 8, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1, 8, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( 0.3, 0, 0.5 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 0.9, 0, 0.5 ); - t.equal( y, 0, 'returns 0 for r inside [0,1]' ); + t.equal( y, 0, 'returns expected value' ); y = quantile( 1.1, 0, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = quantile( -0.1, 0, 0.5 ); - t.equal( isnan( y ), true, 'returns NaN for r outside [0,1]' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); });