diff --git a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.js index a0dd23d4d982..c8b8c26033bd 100644 --- a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cot/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 cot = 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 = cot( x ); + y = cot( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.native.js index ec79afeb73c3..99eb6abfaeab 100644 --- a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cot/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 = cot( x ); + y = cot( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cot/benchmark/c/native/benchmark.c index fa3c0af99f63..a6869bfeecb0 100644 --- a/lib/node_modules/@stdlib/math/base/special/cot/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cot/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_cot( x ); + y = stdlib_base_cot( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cot/test/test.js b/lib/node_modules/@stdlib/math/base/special/cot/test/test.js index e4f5e5bc8d87..794f415022b9 100644 --- a/lib/node_modules/@stdlib/math/base/special/cot/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cot/test/test.js @@ -379,18 +379,18 @@ tape( 'if provided a multiple of `pi`, the function does not return `~-infinity` tape( 'if provided a `NaN`, the function returns `NaN`', function test( t ) { var v = cot( NaN ); - 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 = cot( 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 = cot( 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/cotd/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/benchmark.js index f52407f425d2..e27bb4318814 100644 --- a/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cotd/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 cotd = 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 = cotd( x ); + y = cotd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/benchmark.native.js index 6274f3b7ed3b..e30f768f2ec4 100644 --- a/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cotd/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 = cotd( x ); + y = cotd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/c/native/benchmark.c index 2090c551bff3..e7c28534c893 100644 --- a/lib/node_modules/@stdlib/math/base/special/cotd/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cotd/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_cotd( x ); + y = stdlib_base_cotd( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cotd/test/test.js b/lib/node_modules/@stdlib/math/base/special/cotd/test/test.js index bb62aaaaca5a..644f6a1d6ba7 100644 --- a/lib/node_modules/@stdlib/math/base/special/cotd/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cotd/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 = cotd( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -107,13 +107,13 @@ tape( 'the function computes the cotangent of an angle measured in degrees (posi tape( 'if provided `+Infinity`, the function returns `NaN`', function test( t ) { var v = cotd( 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 = cotd( 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/cotd/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cotd/test/test.native.js index 0db1b1268d92..75dc662ec30e 100644 --- a/lib/node_modules/@stdlib/math/base/special/cotd/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cotd/test/test.native.js @@ -54,7 +54,7 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided a `NaN`, the function returns `NaN`', opts, function test( t ) { var v = cotd( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -116,13 +116,13 @@ tape( 'the function computes the cotangent of an angle measured in degrees (posi tape( 'if provided `+Infinity`, the function returns `NaN`', opts, function test( t ) { var v = cotd( 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`', opts, function test( t ) { var v = cotd( 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/coth/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/coth/benchmark/benchmark.js index d2f0e681635d..b03bb6a35e8f 100644 --- a/lib/node_modules/@stdlib/math/base/special/coth/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/coth/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 coth = 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 = coth( x ); + y = coth( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/coth/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/coth/benchmark/benchmark.native.js index 69079af476fd..8dab4f65b73f 100644 --- a/lib/node_modules/@stdlib/math/base/special/coth/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/coth/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 = coth( x ); + y = coth( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/coth/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/coth/benchmark/c/native/benchmark.c index 1deca171caf6..84012e33af20 100644 --- a/lib/node_modules/@stdlib/math/base/special/coth/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/coth/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_coth( x ); + y = stdlib_base_coth( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/coth/test/test.js b/lib/node_modules/@stdlib/math/base/special/coth/test/test.js index d5ac25f4f9ac..395592981692 100644 --- a/lib/node_modules/@stdlib/math/base/special/coth/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/coth/test/test.js @@ -173,30 +173,30 @@ tape( 'the function computes the hyperbolic cotangent (large positive)', functio tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = coth( 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 `-0`', function test( t ) { var v = coth( -0.0 ); - t.equal( v, NINF, 'returns -Infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+Infinity` if provided `+0`', function test( t ) { var v = coth( +0.0 ); - t.equal( v, PINF, 'returns +Infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `1.0` if provided `+Infinity`', function test( t ) { var v = coth( PINF ); - t.equal( v, 1.0, 'returns 1.0' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1.0` if provided `-Infinity`', function test( t ) { var v = coth( NINF ); - t.equal( v, -1.0, 'returns -1.0' ); + t.equal( v, -1.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/coth/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/coth/test/test.native.js index 51a72b1dde3e..10b19a4d343c 100644 --- a/lib/node_modules/@stdlib/math/base/special/coth/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/coth/test/test.native.js @@ -182,30 +182,30 @@ tape( 'the function computes the hyperbolic cotangent (large positive)', opts, f tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { var v = coth( 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 `-0`', opts, function test( t ) { var v = coth( -0.0 ); - t.equal( v, NINF, 'returns -Infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+Infinity` if provided `+0`', opts, function test( t ) { var v = coth( +0.0 ); - t.equal( v, PINF, 'returns +Infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `1.0` if provided `+Infinity`', opts, function test( t ) { var v = coth( PINF ); - t.equal( v, 1.0, 'returns 1.0' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1.0` if provided `-Infinity`', opts, function test( t ) { var v = coth( NINF ); - t.equal( v, -1.0, 'returns -1.0' ); + t.equal( v, -1.0, 'returns expected value' ); t.end(); });