diff --git a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/benchmark.js index c656e66b577e..11e760361098 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sin/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 sin = 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 = sin( x ); + y = sin( 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.sin( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.sin( 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/sin/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/benchmark.native.js index 57d351e134a8..0d6dbb519e64 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sin/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 = sin( x ); + y = sin( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/benchmark.c index 1bf964f6c89f..7aadeeab31b4 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/benchmark.c @@ -89,16 +89,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = sin( x ); + y = sin( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/cephes/benchmark.c index 6572ce75712e..dba37ff4120f 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/cephes/benchmark.c @@ -94,16 +94,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = sin( x ); + y = sin( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/native/benchmark.c index e07928e2e6d4..6fe0df098079 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sin/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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_sin( x ); + y = stdlib_base_sin( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sin/test/test.js b/lib/node_modules/@stdlib/math/base/special/sin/test/test.js index 614d412b9242..382a814e5863 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sin/test/test.js @@ -193,18 +193,18 @@ tape( 'the function computes the sine (huge positive values)', function test( t tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = sin( 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 `+infinity`', function test( t ) { var v = sin( 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 `-infinity`', function test( t ) { var v = sin( 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/sin/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sin/test/test.native.js index 1e7061ed3094..2a7188362898 100644 --- a/lib/node_modules/@stdlib/math/base/special/sin/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sin/test/test.native.js @@ -202,18 +202,18 @@ tape( 'the function computes the sine (huge positive values)', opts, function te tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = sin( 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 `+infinity`', opts, function test( t ) { var v = sin( 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 `-infinity`', opts, function test( t ) { var v = sin( 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/sinc/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/benchmark.js index e2f60e710a17..dc1242de2bd4 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sinc/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 sinc = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -2.0, 0.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2.0 ) - 2.0; - y = sinc( x ); + y = sinc( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/benchmark.native.js index ac50a20074bb..c584dea4cc2e 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinc/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, -2.0, 0.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2.0 ) - 2.0; - y = sinc( x ); + y = sinc( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/c/native/benchmark.c index 8d65b9dbcc46..87eafd1a6d49 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sinc/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 2.0 * rand_double() ) - 2.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2.0 * rand_double() ) - 2.0; - y = stdlib_base_sinc( x ); + y = stdlib_base_sinc( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sinc/test/test.js b/lib/node_modules/@stdlib/math/base/special/sinc/test/test.js index 94231fb1455f..1b9b5420a440 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinc/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sinc/test/test.js @@ -168,21 +168,21 @@ tape( 'the function computes the cardinal sine (tiny positive)', function test( tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = sinc( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `1.0` if provided `0.0`', function test( t ) { var v = sinc( 0.0 ); - t.equal( v, 1.0, 'returns 1.0' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided positive or negative infinity', function test( t ) { var v = sinc( PINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); v = sinc( NINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinc/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sinc/test/test.native.js index 883cbfb52a64..36d05ab82664 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinc/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinc/test/test.native.js @@ -183,15 +183,15 @@ tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) tape( 'the function returns `1.0` if provided `0.0`', opts, function test( t ) { var v = sinc( 0.0 ); - t.equal( v, 1.0, 'returns 1.0' ); + t.equal( v, 1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided positive or negative infinity', opts, function test( t ) { var v = sinc( PINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); v = sinc( NINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/benchmark.js index f6b4998a2e0a..0b6ffaaa8146 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/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 sinh = 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 = sinh( x ); + y = sinh( 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.sinh( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.sinh( 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/sinh/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/benchmark.native.js index ee36c8fba687..db3647261579 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/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 = sinh( x ); + y = sinh( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/benchmark.c index af52aff161de..8deed3fdb1e8 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/benchmark.c @@ -89,16 +89,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = sinh( x ); + y = sinh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/cephes/benchmark.c index cda1d9b832f2..6e6a29b403aa 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/cephes/benchmark.c @@ -94,16 +94,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = sinh( x ); + y = sinh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/native/benchmark.c index 4dee8f8b3ac6..f753b170afdd 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sinh/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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_sinh( x ); + y = stdlib_base_sinh( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js index 9ccf84fb0934..4b47c33e529e 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js @@ -171,31 +171,31 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', function test tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = sinh( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', function test( t ) { var v = sinh( -0.0 ); - t.equal( isNegativeZero( v ), true, 'returns -0' ); + t.equal( isNegativeZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0` if provided `0`', function test( t ) { var v = sinh( 0.0 ); - t.equal( isPositiveZero( v ), true, 'returns 0' ); + t.equal( isPositiveZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) { var v = sinh( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-infinity` if provided `-infinity`', function test( t ) { var v = sinh( NINF ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); @@ -207,7 +207,7 @@ tape( 'the function returns `+infinity` if provided a value greater than `~710.4 for ( i = 0; i < 500; i++ ) { v = ( randu()*1e6 ) + 710.476; y = sinh( v ); - t.equal( y, PINF, 'returns +infinity' ); + t.equal( y, PINF, 'returns expected value' ); } t.end(); }); @@ -220,7 +220,7 @@ tape( 'the function returns `-infinity` if provided a value less than `~-709.089 for ( i = 0; i < 500; i++ ) { v = ( -randu()*1e6 ) - 709.0896; y = sinh( v ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js index 7adb720591f1..d458d41e4cd2 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js @@ -180,31 +180,31 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', opts, functio tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { var v = sinh( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) { var v = sinh( -0.0 ); - t.equal( isNegativeZero( v ), true, 'returns -0' ); + t.equal( isNegativeZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0` if provided `0`', opts, function test( t ) { var v = sinh( 0.0 ); - t.equal( isPositiveZero( v ), true, 'returns 0' ); + t.equal( isPositiveZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', opts, function test( t ) { var v = sinh( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-infinity` if provided `-infinity`', opts, function test( t ) { var v = sinh( NINF ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); @@ -216,7 +216,7 @@ tape( 'the function returns `+infinity` if provided a value greater than `~710.4 for ( i = 0; i < 500; i++ ) { v = ( randu()*1e6 ) + 710.476; y = sinh( v ); - t.equal( y, PINF, 'returns +infinity' ); + t.equal( y, PINF, 'returns expected value' ); } t.end(); }); @@ -229,7 +229,7 @@ tape( 'the function returns `-infinity` if provided a value less than `~-709.089 for ( i = 0; i < 500; i++ ) { v = ( -randu()*1e6 ) - 709.0896; y = sinh( v ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.js index 5863656d1d7a..78e6705216c8 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sinpi/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 sinpi = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -5.0e6, 5.0e6 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = sinpi( x ); + y = sinpi( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.native.js index f0c284cfa352..3a4060ec1b4f 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinpi/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.0e6, 5.0e6 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 1.0e7 ) - 5.0e6; - y = sinpi( x ); + y = sinpi( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/c/native/benchmark.c index a1c1e20b3442..8e45fdf0a742 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sinpi/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1.0e7 * rand_double() ) - 5.0e6; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1.0e7 * rand_double() ) - 5.0e6; - y = stdlib_base_sinpi( x ); + y = stdlib_base_sinpi( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.js b/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.js index 0d83228ac95e..ba10b2c4607d 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.js @@ -45,15 +45,15 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided either positive or negative infinity', function test( t ) { var v = sinpi( PINF ); - t.equal( isnan( v ), true, 'returns NaN if provided +Infinity' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = sinpi( NINF ); - t.equal( isnan( v ), true, 'returns NaN if provided -Infinity' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { var y = sinpi( NaN ); - t.equal( isnan( y ), true, 'returns NaN when provided NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.native.js index 446f206ec396..b7bfc40023ad 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinpi/test/test.native.js @@ -54,15 +54,15 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `NaN` if provided either positive or negative infinity', opts, function test( t ) { var v = sinpi( PINF ); - t.equal( isnan( v ), true, 'returns expected value if provided +Infinity' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = sinpi( NINF ); - t.equal( isnan( v ), true, 'returns expected value if provided -Infinity' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { var y = sinpi( NaN ); - t.equal( isnan( y ), true, 'returns expected value when provided NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); });