diff --git a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.js index 31e64fce2cef..0261f5290616 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/hacovercos/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 hacovercos = 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 = hacovercos( x ); + y = hacovercos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.native.js index 0ecfe8b66a66..001a6f603318 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/hacovercos/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 = hacovercos( x ); + y = hacovercos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/benchmark.c index e49cea6d0565..19b9df568e7f 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/hacovercos/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 = ( 1.0 + sin( x ) ) / 2.0; + y = ( 1.0 + sin( x[ i%100 ] ) ) / 2.0; if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/native/benchmark.c index 1d94470a188d..d2856fcb624c 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacovercos/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/hacovercos/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_hacovercos( x ); + y = stdlib_base_hacovercos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/hacovercos/test/test.js b/lib/node_modules/@stdlib/math/base/special/hacovercos/test/test.js index f07003971dfb..af9b9ece1183 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacovercos/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/hacovercos/test/test.js @@ -193,18 +193,18 @@ tape( 'the function computes the half-value coversed cosine (for x >= 2**60 (PI/ tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = hacovercos( 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 = hacovercos( 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 = hacovercos( 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/hacoversin/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/benchmark.js index cdf59223d291..1f70b21a5f9a 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/hacoversin/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 hacoversin = 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 = hacoversin( x ); + y = hacoversin( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/benchmark.native.js index 2038fe9b50e9..7d39c4f35b07 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/hacoversin/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 = hacoversin( x ); + y = hacoversin( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/benchmark.c index 8759bda8ffad..bdcc3e9f41af 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/hacoversin/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 = ( 1.0 - sin( x ) ) / 2.0; + y = ( 1.0 - sin( x[ i%100 ] ) ) / 2.0; if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/native/benchmark.c index 61b4c6958b82..d6cfdf15577b 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacoversin/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/hacoversin/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_hacoversin( x ); + y = stdlib_base_hacoversin( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/hacoversin/test/test.js b/lib/node_modules/@stdlib/math/base/special/hacoversin/test/test.js index 9888430bfaa0..b692d6c04e4a 100644 --- a/lib/node_modules/@stdlib/math/base/special/hacoversin/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/hacoversin/test/test.js @@ -193,18 +193,18 @@ tape( 'the function computes the half-value coversed sine (for x >= 2**60 (PI/2) tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = hacoversin( 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 = hacoversin( 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 = hacoversin( 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/havercos/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/benchmark.js index b709ace6c7f5..37e676185191 100644 --- a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/havercos/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 havercos = 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 = havercos( x ); + y = havercos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/benchmark.native.js index 15f7cf47af06..6954d35a9734 100644 --- a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/havercos/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 = havercos( x ); + y = havercos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/benchmark.c index 3517ce3bd00c..c402cfaa5d22 100644 --- a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/havercos/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 = ( 1.0 + cos( x ) ) / 2.0; + y = ( 1.0 + cos( x[ i%100 ] ) ) / 2.0; if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/native/benchmark.c index 23ebd3768079..b4ba8939edda 100644 --- a/lib/node_modules/@stdlib/math/base/special/havercos/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/havercos/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_havercos( x ); + y = stdlib_base_havercos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/havercos/test/test.js b/lib/node_modules/@stdlib/math/base/special/havercos/test/test.js index d4fc702bdc98..942ea803d7bd 100644 --- a/lib/node_modules/@stdlib/math/base/special/havercos/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/havercos/test/test.js @@ -199,18 +199,18 @@ tape( 'the function computes the half-value versed cosine (for x >= 2**60 (PI/2) tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = havercos( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `+infinity`', function test( t ) { var v = havercos( PINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) { var v = havercos( NINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); });