diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js index 8f609f4d53fe..a59090ddad8e 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/discrete-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 bernoulli = require( './../lib' ); @@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0, 500 ); + x = discreteUniform( 100, 0, 500 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js index 0f6b8df52bee..4b50860c56f2 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,7 +43,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = randu( 100, 0, 500 ); + x = discreteUniform( 100, 0, 500 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c index 7e84c857608a..075794f585dc 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c @@ -90,8 +90,8 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; double x[ 100 ]; + double elapsed; double y; double t; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js index cb8be4d186c2..105edd62d979 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -37,12 +37,13 @@ bench( pkg, function benchmark( assert ) { var b; var i; + x = uniform( 100, 0.0, 1.0 ); + a = uniform( 100, EPS, 1000.0 ); + b = uniform( 100, EPS, 1000.0 ); + assert.tic(); for ( i = 0; i < assert.iterations; i++ ) { - x = randu(); - a = ( randu()*1000.0 ) + EPS; - b = ( randu()*1000.0 ) + EPS; - y = betainc( x, a, b ); + y = betainc( x[ i % x.length ], a[ i % a.length ], b[ i % b.length ] ); if ( isnan( y ) ) { assert.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c index 095065d6948e..f805033e383d 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c @@ -94,20 +94,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double a[ 100 ]; + double b[ 100 ]; double elapsed; - double x; - double a; - double b; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double(); + a[ i ] = ( 1000.0*rand_double() ) + 0.1; + b[ i ] = ( 1000.0*rand_double() ) + 0.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - a = ( 1000.0*rand_double() ) + 0.1; - b = ( 1000.0*rand_double() ) + 0.1; - y = incbet( a, b, x ); + y = incbet( a[ i%100 ], b[ i%100 ], x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js b/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js index da1d7ef985de..c91a679caf26 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js @@ -49,23 +49,23 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if `x` is outside `[0,1]`', function test( t ) { var val = betainc( -0.2, 1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 1.1, 1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` negative `a` or `b`', function test( t ) { var val = betainc( 0.5, -1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 0.5, 1.0, -1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 0.5, -1.0, -1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js index 70f47888d694..64317059e8be 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -37,12 +37,13 @@ bench( pkg, function benchmark( assert ) { var b; var i; + x = uniform( 100, 0.0, 1.0 ); + a = uniform( 100, EPS, 1000.0 ); + b = uniform( 100, EPS, 1000.0 ); + assert.tic(); for ( i = 0; i < assert.iterations; i++ ) { - x = randu(); - a = ( randu()*1000.0 ) + EPS; - b = ( randu()*1000.0 ) + EPS; - y = betaincinv( x, a, b ); + y = betaincinv( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ] ); if ( isnan( y ) ) { assert.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c index b62eec565485..9a46ddae5ef0 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c @@ -94,20 +94,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double a[ 100 ]; + double b[ 100 ]; double elapsed; - double x; - double a; - double b; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double(); + a[ i ] = ( 1000.0*rand_double() ) + 0.1; + b[ i ] = ( 1000.0*rand_double() ) + 0.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - a = ( 1000.0*rand_double() ) + 0.1; - b = ( 1000.0*rand_double() ) + 0.1; - y = incbi( a, b, x ); + y = incbi( a[ i%100 ], b[ i%100 ], x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js index a7c9dc3556c9..3a33711ac869 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js @@ -49,22 +49,22 @@ 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 = betaincinv( NaN, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.2, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.2, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if `p` is outside the interval `[0,1]`', function test( t ) { var y = betaincinv( 1.5, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( -0.5, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -72,25 +72,25 @@ tape( 'if provided a nonpositive `a`, the function returns `NaN`', function test var y; y = betaincinv( 0.5, 0.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, -1.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, -1.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, PINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -99,25 +99,25 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test var y; y = betaincinv( 0.5, 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 2.0, -1/0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js index 3d1d65b268f9..eb90b736671d 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var betaln = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, 0.0, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) - 0.0; - z = betaln( x, y ); + z = betaln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js index 6f7e5ff5af46..7b5bd471da77 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, 0.0, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 1000.0 ) - 0.0; - y = ( randu() * 1000.0 ) - 0.0; - z = betaln( x, y ); + z = betaln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c index a35f36466b01..00111e64f84e 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double y[ 100 ]; double elapsed; - double x; - double y; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = 1000.0 * rand_double(); + y[ i ] = 1000.0 * rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = 1000.0 * rand_double() - 0.0; - y = 1000.0 * rand_double() - 0.0; - z = stdlib_base_betaln( x, y ); + z = stdlib_base_betaln( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js index cecfe35cd480..92226c95e726 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js @@ -35,16 +35,16 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided `x` outside `[-1.1,1.1]`', function test( t ) { var y = dceval( 1.5, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( 1.11, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( -1.11, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( -1.5, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js index d7c4c57f479f..7514b3d59151 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js @@ -57,17 +57,17 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var val = betaln( NaN, 2.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); val = betaln( 2.0, NaN ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided negative values', function test( t ) { var val = betaln( -2.0, 5.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); val = betaln( 4.0, -3.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js index 62ec4a6852f7..df074ea5bff0 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var binomcoefln = require( './../lib' ); @@ -36,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = discreteUniform( 100, 20, 70 ); + y = discreteUniform( 100, 0, 20 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = round( (randu()*50.0) + 20.0 ); - y = round( randu()*20.0 ); - z = binomcoefln( x, y ); + z = binomcoefln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js index 3a1a1639fd0a..bb623538760a 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -45,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = discreteUniform( 100, 20, 70 ); + y = discreteUniform( 100, 0, 20 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = round( ( randu() * 50.0 ) + 20.0 ); - y = round( randu() * 20.0 ); - z = binomcoefln( x, y ); + z = binomcoefln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c index 1fb3cd0480e7..63f885e29267 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + int64_t n[ 100 ]; + int64_t k[ 100 ]; double elapsed; - int64_t n; - int64_t k; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + n[ i ] = (int64_t)round( 500.0 * rand_double() ); + k[ i ] = (int64_t)round( 500.0 * rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - n = (int64_t)round( 500.0 * rand_double() ); - k = (int64_t)round( 500.0 * rand_double() ); - y = stdlib_base_binomcoefln( n, k ); + y = stdlib_base_binomcoefln( n[ i%100 ], k[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js index 9e3668763609..7a1f6009f33a 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js @@ -99,7 +99,7 @@ tape( 'the function returns `NaN` if the `n` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.equal( isnan( binomcoefln( values[i], 2 ) ), true, 'returns NaN when provided '+values[i] ); + t.equal( isnan( binomcoefln( values[i], 2 ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); }); @@ -120,7 +120,7 @@ tape( 'the function returns `NaN` if the `k` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.equal( isnan( binomcoefln( 2, values[i] ) ), true, 'returns NaN when provided '+values[i] ); + t.equal( isnan( binomcoefln( 2, values[i] ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); });