diff --git a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.js index dd8130d7648b..b60252af2d14 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/exp/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 exp = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -50.0, 50.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = exp( x ); + y = exp( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -55,10 +56,11 @@ bench( pkg+'::built-in', function benchmark( b ) { var y; var i; + x = uniform( 100, -50.0, 50.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = Math.exp( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.exp( x[ i%x.length ] ); // eslint-disable-line stdlib/no-builtin-math if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.native.js index 5b3b97550fb9..a0a239d3f49f 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/exp/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; @@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = ( uniform()*100.0 ) - 50.0; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = exp( x ); + y = exp( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/benchmark.c index 56208fa32532..49fbf43addc8 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/benchmark.c @@ -90,15 +90,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = exp( x ); + y = exp( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/cephes/benchmark.c index 1ca9bff3e244..9c60678df2c9 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/cephes/benchmark.c @@ -95,15 +95,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = exp( x ); + y = exp( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/native/benchmark.c index dec6ac1ea2a8..13d7fc54cffc 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/exp/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = stdlib_base_exp( x ); + y = stdlib_base_exp( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/exp/test/test.js b/lib/node_modules/@stdlib/math/base/special/exp/test/test.js index e2f244c55d54..be499b13e9a2 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/exp/test/test.js @@ -148,18 +148,18 @@ tape( 'the function accurately computes the natural exponential function for ver tape( 'the function returns `0` if provided a `-infinity`', function test( t ) { var val = exp( NINF ); - t.equal( val, 0.0, 'returns 0' ); + t.equal( val, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `+infinity`', function test( t ) { var val = exp( PINF ); - t.equal( val, PINF, 'returns +infinity' ); + t.equal( val, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var val = exp( NaN ); - 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/exp/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/exp/test/test.native.js index d7231c3e21d7..6c744a0c4620 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/exp/test/test.native.js @@ -157,18 +157,18 @@ tape( 'the function accurately computes the natural exponential function for ver tape( 'the function returns `0` if provided a `-infinity`', opts, function test( t ) { var val = exp( NINF ); - t.equal( val, 0.0, 'returns 0' ); + t.equal( val, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `+infinity`', opts, function test( t ) { var val = exp( PINF ); - t.equal( val, PINF, 'returns +infinity' ); + t.equal( val, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { var val = exp( NaN ); - 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/exp10/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/benchmark.js index 7bdf574bc49b..22e5afa18957 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/exp10/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 exp10 = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -50.0, 50.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = exp10( x ); + y = exp10( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/benchmark.native.js index 8743108f7598..2bd405912574 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/exp10/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; @@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, -50.0, 50.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = exp10( x ); + y = exp10( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/cephes/benchmark.c index 6a4111f5a3e7..76029f9df699 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/cephes/benchmark.c @@ -95,15 +95,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_double()*100.0 ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( rand_double()*100.0 ) - 50.0; - y = exp10( x ); + y = exp10( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/native/benchmark.c index baa6d93c1bd1..e5d4a229c146 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/exp10/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = stdlib_base_exp10( x ); + y = stdlib_base_exp10( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/exp10/test/test.js b/lib/node_modules/@stdlib/math/base/special/exp10/test/test.js index b36345052fa3..b1ef4df15764 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/exp10/test/test.js @@ -147,37 +147,37 @@ tape( 'the function accurately computes `10**x` for very small `x`', function te }); tape( 'the function returns `+infinity` for very large `x`', function test( t ) { - t.equal( exp10( 400.0 ), PINF, 'equals +infinity' ); - t.equal( exp10( 500.0 ), PINF, 'equals +infinity' ); - t.equal( exp10( 600.0 ), PINF, 'equals +infinity' ); + t.equal( exp10( 400.0 ), PINF, 'returns expected value' ); + t.equal( exp10( 500.0 ), PINF, 'returns expected value' ); + t.equal( exp10( 600.0 ), PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` for negative large `x`', function test( t ) { - t.equal( exp10( -400.0 ), 0.0, 'equals 0' ); - t.equal( exp10( -500.0 ), 0.0, 'equals 0' ); - t.equal( exp10( -600.0 ), 0.0, 'equals 0' ); + t.equal( exp10( -400.0 ), 0.0, 'returns expected value' ); + t.equal( exp10( -500.0 ), 0.0, 'returns expected value' ); + t.equal( exp10( -600.0 ), 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `-infinity`', function test( t ) { - t.equal( exp10( NINF ), 0.0, 'equals 0' ); + t.equal( exp10( NINF ), 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) { - t.equal( exp10( PINF ), PINF, 'equals +infinity' ); + t.equal( exp10( PINF ), PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `1` if provided `0`', function test( t ) { var v = exp10( 0.0 ); - t.equal( v, 1.0, 'equals 1' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var val = exp10( NaN ); - t.equal( isnan( val ), true, 'equals NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/exp10/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/exp10/test/test.native.js index 67a2ed7514ce..b1df6dff46f7 100644 --- a/lib/node_modules/@stdlib/math/base/special/exp10/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/exp10/test/test.native.js @@ -156,37 +156,37 @@ tape( 'the function accurately computes `10**x` for very small `x`', opts, funct }); tape( 'the function returns `+infinity` for very large `x`', opts, function test( t ) { - t.equal( exp10( 400.0 ), PINF, 'equals +infinity' ); - t.equal( exp10( 500.0 ), PINF, 'equals +infinity' ); - t.equal( exp10( 600.0 ), PINF, 'equals +infinity' ); + t.equal( exp10( 400.0 ), PINF, 'returns expected value' ); + t.equal( exp10( 500.0 ), PINF, 'returns expected value' ); + t.equal( exp10( 600.0 ), PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` for negative large `x`', opts, function test( t ) { - t.equal( exp10( -400.0 ), 0.0, 'equals 0' ); - t.equal( exp10( -500.0 ), 0.0, 'equals 0' ); - t.equal( exp10( -600.0 ), 0.0, 'equals 0' ); + t.equal( exp10( -400.0 ), 0.0, 'returns expected value' ); + t.equal( exp10( -500.0 ), 0.0, 'returns expected value' ); + t.equal( exp10( -600.0 ), 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `-infinity`', opts, function test( t ) { - t.equal( exp10( NINF ), 0.0, 'equals 0' ); + t.equal( exp10( NINF ), 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', opts, function test( t ) { - t.equal( exp10( PINF ), PINF, 'equals +infinity' ); + t.equal( exp10( PINF ), PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `1` if provided `0`', opts, function test( t ) { var v = exp10( 0.0 ); - t.equal( v, 1.0, 'equals 1' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var val = exp10( NaN ); - t.equal( isnan( val ), true, 'equals NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.js index 2b7bb596eabc..3a1feeb21ce9 100644 --- a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/expit/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 expit = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, 1.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = expit( x ); + y = expit( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.native.js index 847962e72933..845091676af7 100644 --- a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/expit/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; @@ -42,11 +42,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var x; var y; var i; + + x = uniform( 100, 0.0, 1.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = expit( x ); + y = expit( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/expit/benchmark/c/benchmark.c index 9c0a843344bf..e1ccd1f57c6a 100644 --- a/lib/node_modules/@stdlib/math/base/special/expit/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/expit/benchmark/c/benchmark.c @@ -106,7 +106,6 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = expit( rand_double() ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/expit/test/test.js b/lib/node_modules/@stdlib/math/base/special/expit/test/test.js index 643bf0c6e099..b698d647d28a 100644 --- a/lib/node_modules/@stdlib/math/base/special/expit/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/expit/test/test.js @@ -45,25 +45,25 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` when provided `NaN`', function test( t ) { var y = expit( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.5` when provided `0`', function test( t ) { var y = expit( 0.0 ); - t.equal( y, 0.5, 'returns 0.5' ); + t.equal( y, 0.5, 'returns expected value' ); t.end(); }); tape( 'the function returns `1.0` when provided `+Infinity`', function test( t ) { var y = expit( PINF ); - t.equal( y, 1.0, 'returns 1.0' ); + t.equal( y, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` when provided `-Infinity`', function test( t ) { var y = expit( NINF ); - t.equal( y, 0.0, 'returns 0.0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/expit/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/expit/test/test.native.js index 3219d5852e43..fe15453cf4a7 100644 --- a/lib/node_modules/@stdlib/math/base/special/expit/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/expit/test/test.native.js @@ -54,25 +54,25 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `NaN` when provided `NaN`', opts, function test( t ) { var y = expit( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.5` when provided `0`', opts, function test( t ) { var y = expit( 0.0 ); - t.equal( y, 0.5, 'returns 0.5' ); + t.equal( y, 0.5, 'returns expected value' ); t.end(); }); tape( 'the function returns `1.0` when provided `+Infinity`', opts, function test( t ) { var y = expit( PINF ); - t.equal( y, 1.0, 'returns 1.0' ); + t.equal( y, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` when provided `-Infinity`', opts, function test( t ) { var y = expit( NINF ); - t.equal( y, 0.0, 'returns 0.0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); });