diff --git a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cos/benchmark/benchmark.js index c276c46530a1..e801a5e40f54 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cos/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 cos = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*20.0 ) - 10.0; - y = cos( x ); + y = cos( 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, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*20.0 ) - 10.0; - y = Math.cos( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.cos( 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/cos/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cos/benchmark/benchmark.native.js index 503050881050..a8468f712e7f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cos/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, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 20.0 ) - 10.0; - y = cos( x ); + y = cos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/benchmark.c index 2cecf3a6c513..f29514467e0c 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cos/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 ] = ( 20.0*rand_double() ) - 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 20.0*rand_double() ) - 10.0; - y = cos( x ); + y = cos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/cephes/benchmark.c index 092e8fcd14e8..18bd8ca252eb 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cos/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 ] = ( 20.0*rand_double() ) - 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 20.0*rand_double() ) - 10.0; - y = cos( x ); + y = cos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/native/benchmark.c index 688de7b79409..29375fcf3e3b 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cos/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 ] = ( 20.0 * rand_double() ) - 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 20.0 * rand_double() ) - 10.0; - y = stdlib_base_cos( x ); + y = stdlib_base_cos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cos/test/test.js b/lib/node_modules/@stdlib/math/base/special/cos/test/test.js index b738f5862ebf..ec6d32c3fddd 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cos/test/test.js @@ -199,18 +199,18 @@ tape( 'the function computes the cosine (huge positive values)', function test( tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = cos( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `+infinity`', function test( t ) { var v = cos( PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `-infinity`', function test( t ) { var v = cos( NINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cos/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cos/test/test.native.js index 7ef93c4c7f8e..3645cb552be1 100644 --- a/lib/node_modules/@stdlib/math/base/special/cos/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cos/test/test.native.js @@ -208,18 +208,18 @@ tape( 'the function computes the cosine (huge positive values)', opts, function tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { var v = cos( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `+infinity`', opts, function test( t ) { var v = cos( PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a `-infinity`', opts, function test( t ) { var v = cos( NINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.js index add5c2b55e67..9b48f6ae4e7a 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cosd/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 cosd = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) - 5.0; - y = cosd( x ); + y = cosd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.native.js index 0c71c31b0d38..b6fc81e88cdc 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosd/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, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 10.0 ) - 5.0; - y = cosd( x ); + y = cosd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/c/native/benchmark.c index d3f287a90765..54ecef32cb16 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosd/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosd/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 ] = ( 10.0 * rand_double() ) - 5.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10.0 * rand_double() ) - 5.0; - y = stdlib_base_cosd( x ); + y = stdlib_base_cosd( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cosd/test/test.js b/lib/node_modules/@stdlib/math/base/special/cosd/test/test.js index b7dcb1db5021..65b39a030a3e 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosd/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cosd/test/test.js @@ -45,7 +45,7 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided a `NaN`, the function returns `NaN`', function test( t ) { var v = cosd( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -99,13 +99,13 @@ tape( 'the function computes the cosine of an angle measured in degrees (positiv tape( 'if provided `+infinity`, the function returns `NaN`', function test( t ) { var v = cosd( PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `NaN`', function test( t ) { var v = cosd( NINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/benchmark.js index 3c7331bedcd5..64c7052a90aa 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/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 cosh = require( './../lib' ); @@ -41,10 +41,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) - 5.0; - y = cosh( x ); + y = cosh( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -62,10 +63,11 @@ bench( pkg+'::built-in', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) - 5.0; - y = Math.cosh( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.cosh( 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/cosh/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/benchmark.native.js index a1252e30b87f..19dbb8f69e38 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/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, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) - 5.0; - y = cosh( x ); + y = cosh( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/benchmark.c index be20fa8d6abe..593d384fe91d 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosh/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 ] = ( 10.0*rand_double() ) - 5.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10.0*rand_double() ) - 5.0; - y = cosh( x ); + y = cosh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/cephes/benchmark.c index 8e70f3daaf7b..4c73346f3617 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosh/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 ] = ( 10.0*rand_double() ) - 5.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10.0*rand_double() ) - 5.0; - y = cosh( x ); + y = cosh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/native/benchmark.c index 2654a356bb96..dd92efc36eda 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosh/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 ] = ( 10.0*rand_double() ) - 5.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10.0*rand_double() ) - 5.0; - y = stdlib_base_cosh( x ); + y = stdlib_base_cosh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js index 4d979644b442..36c24d82955a 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js @@ -118,24 +118,24 @@ tape( 'the function computes the hyperbolic cosine (large values)', function tes tape( 'the function returns `1` if provided `0`', function test( t ) { var v = cosh( 0 ); - t.equal( v, 1.0, 'returns 1' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = cosh( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `+infinity`', function test( t ) { var v = cosh( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `-infinity`', function test( t ) { var v = cosh( NINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js index c738b32fb236..2b7bde73f193 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js @@ -127,24 +127,24 @@ tape( 'the function computes the hyperbolic cosine (large values)', opts, functi tape( 'the function returns `1` if provided `0`', opts, function test( t ) { var v = cosh( 0 ); - t.equal( v, 1.0, 'returns 1' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = cosh( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `+infinity`', opts, function test( t ) { var v = cosh( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided a `-infinity`', opts, function test( t ) { var v = cosh( NINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); });