diff --git a/lib/node_modules/@stdlib/math/base/special/sici/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sici/benchmark/benchmark.js index 42e900e25caa..b7e0358b6e33 100644 --- a/lib/node_modules/@stdlib/math/base/special/sici/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sici/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 isArray = require( '@stdlib/assert/is-array' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; @@ -35,10 +35,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 = sici( x ); + y = sici( x[ i%x.length ] ); if ( isnan( y[ 0 ] ) ) { b.fail( 'should not return NaN' ); } @@ -61,11 +62,11 @@ bench( pkg+':assign', function benchmark( b ) { var i; out = [ 0.0, 0.0 ]; + x = uniform( 100, -50.0, 50.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 100.0 ) - 50.0; - y = sici.assign( x, out, 1, 0 ); + y = sici.assign( x[ i%x.length ], out, 1, 0 ); if ( isnan( y[ 0 ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sici/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sici/benchmark/c/cephes/benchmark.c index 9b570aff1938..4f8e29437823 100644 --- a/lib/node_modules/@stdlib/math/base/special/sici/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sici/benchmark/c/cephes/benchmark.c @@ -94,17 +94,20 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double y; double z; 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; - sici( x, &y, &z ); + sici( x[ i%100 ], &y, &z ); if ( y != y || z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sici/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/sici/test/test.assign.js index 14328ef448a4..139206e8abad 100644 --- a/lib/node_modules/@stdlib/math/base/special/sici/test/test.assign.js +++ b/lib/node_modules/@stdlib/math/base/special/sici/test/test.assign.js @@ -267,8 +267,8 @@ tape( 'the function returns `[0,-Infinity]` if provided `0`', function test( t ) out = [ 0.0, 0.0 ]; val = sici( 0.0, out, 1, 0 ); t.equal( val, out, 'returns output array' ); - t.strictEqual( val[ 0 ], 0.0, 'first element equals NaN' ); - t.strictEqual( val[ 1 ], NINF, 'second element equals -Infinity' ); + t.strictEqual( val[ 0 ], 0.0, 'returns expected value' ); + t.strictEqual( val[ 1 ], NINF, 'returns expected value' ); t.end(); }); @@ -279,8 +279,8 @@ tape( 'the function returns `[-PI/2,NaN]` if provided `-Infinity`', function tes out = [ 0.0, 0.0 ]; val = sici( NINF, out, 1, 0 ); t.equal( val, out, 'returns output array' ); - t.strictEqual( val[ 0 ], -HALF_PI, 'first element equals -PI/2' ); - t.strictEqual( isnan( val[ 1 ] ), true, 'second element equals NaN' ); + t.strictEqual( val[ 0 ], -HALF_PI, 'returns expected value' ); + t.strictEqual( isnan( val[ 1 ] ), true, 'returns expected value' ); t.end(); }); @@ -291,8 +291,8 @@ tape( 'the function returns `[PI/2,0]` if provided `+Infinity`', function test( out = [ 0.0, 0.0 ]; val = sici( PINF, out, 1, 0 ); t.equal( val, out, 'returns output array' ); - t.strictEqual( val[ 0 ], HALF_PI, 'first element equals PI/2' ); - t.strictEqual( val[ 1 ], 0, 'second element equals 0' ); + t.strictEqual( val[ 0 ], HALF_PI, 'returns expected value' ); + t.strictEqual( val[ 1 ], 0, 'returns expected value' ); t.end(); }); @@ -303,8 +303,8 @@ tape( 'the function returns `[NaN,NaN]` if provided `NaN`', function test( t ) { out = [ 0.0, 0.0 ]; val = sici( NaN, out, 1, 0 ); t.equal( val, out, 'returns output array' ); - t.strictEqual( isnan( val[ 0 ] ), true, 'first element equals NaN' ); - t.strictEqual( isnan( val[ 1 ] ), true, 'second element equals NaN' ); + t.strictEqual( isnan( val[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( val[ 1 ] ), true, 'returns expected value' ); t.end(); }); @@ -316,8 +316,8 @@ tape( 'the function supports providing an output object (array)', function test( val = sici( 3.0, out, 1, 0 ); t.strictEqual( val, out, 'returns output object' ); - t.strictEqual( val[ 0 ], 1.848652527999468, 'has expected first element' ); - t.strictEqual( val[ 1 ], 0.11962978600800023, 'has expected second element' ); + t.strictEqual( val[ 0 ], 1.848652527999468, 'returns expected value' ); + t.strictEqual( val[ 1 ], 0.11962978600800023, 'returns expected value' ); t.end(); }); @@ -330,8 +330,8 @@ tape( 'the function supports providing an output object (typed array)', function val = sici( 3.0, out, 1, 0 ); t.strictEqual( val, out, 'returns output object' ); - t.strictEqual( val[ 0 ], 1.848652527999468, 'has expected first element' ); - t.strictEqual( val[ 1 ], 0.11962978600800023, 'has expected second element' ); + t.strictEqual( val[ 0 ], 1.848652527999468, 'returns expected value' ); + t.strictEqual( val[ 1 ], 0.11962978600800023, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sici/test/test.main.js b/lib/node_modules/@stdlib/math/base/special/sici/test/test.main.js index 6823bd24701b..99080aae05d8 100644 --- a/lib/node_modules/@stdlib/math/base/special/sici/test/test.main.js +++ b/lib/node_modules/@stdlib/math/base/special/sici/test/test.main.js @@ -242,31 +242,31 @@ tape( 'the function computes the sine and cosine integrals for very large positi tape( 'the function returns `[0,-Infinity]` if provided `0`', function test( t ) { var val = sici( 0.0 ); t.strictEqual( isArray( val ), true, 'returns an array' ); - t.strictEqual( val[ 0 ], 0.0, 'first element equals NaN' ); - t.strictEqual( val[ 1 ], NINF, 'second element equals -Infinity' ); + t.strictEqual( val[ 0 ], 0.0, 'returns expected value' ); + t.strictEqual( val[ 1 ], NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `[-PI/2,NaN]` if provided `-Infinity`', function test( t ) { var val = sici( NINF ); t.strictEqual( isArray( val ), true, 'returns an array' ); - t.strictEqual( val[ 0 ], -HALF_PI, 'first element equals -PI/2' ); - t.strictEqual( isnan( val[ 1 ] ), true, 'second element equals NaN' ); + t.strictEqual( val[ 0 ], -HALF_PI, 'returns expected value' ); + t.strictEqual( isnan( val[ 1 ] ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `[PI/2,0]` if provided `+Infinity`', function test( t ) { var val = sici( PINF ); t.strictEqual( isArray( val ), true, 'returns an array' ); - t.strictEqual( val[ 0 ], HALF_PI, 'first element equals PI/2' ); - t.strictEqual( val[ 1 ], 0, 'second element equals 0' ); + t.strictEqual( val[ 0 ], HALF_PI, 'returns expected value' ); + t.strictEqual( val[ 1 ], 0, 'returns expected value' ); t.end(); }); tape( 'the function returns `[NaN,NaN]` if provided `NaN`', function test( t ) { var val = sici( NaN ); t.strictEqual( isArray( val ), true, 'returns an array' ); - t.strictEqual( isnan( val[ 0 ] ), true, 'first element equals NaN' ); - t.strictEqual( isnan( val[ 1 ] ), true, 'second element equals NaN' ); + t.strictEqual( isnan( val[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( val[ 1 ] ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/benchmark.js index ad3aae601f80..c31bde194f22 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/signum/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 signum = require( './../lib' ); @@ -41,10 +41,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = signum( x ); + y = signum( 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, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = Math.sign( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.sign( 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/signum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/benchmark.native.js index e56f18a46246..407a2c398094 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/signum/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, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = signum( x ); + y = signum( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/benchmark.c index f83f27256792..2259a85bdf22 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/signum/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 ] = ( 1000.0 * rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0 * rand_double() ) - 500.0; - y = signbit( x ); + y = signbit( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/cephes/benchmark.c index c715d1836781..f8c41269fc80 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/cephes/benchmark.c @@ -96,16 +96,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double t; int y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = signbit( x ); + y = signbit( x[ i%100 ] ); if ( y > 1 || y < -1 ) { printf( "should not return a number greater than 1\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/native/benchmark.c index ab2a5d9067ea..569b01cbe000 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/signum/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 ] = ( rand_double()*1000.0 ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( rand_double()*1000.0 ) - 500.0; - y = stdlib_base_signum( x ); + y = stdlib_base_signum( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/signum/test/test.js b/lib/node_modules/@stdlib/math/base/special/signum/test/test.js index 35914a26b2d5..cf81722c91a8 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/signum/test/test.js @@ -40,13 +40,13 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var sign = signum( NaN ); - t.equal( isnan( sign ), true, 'returns NaN' ); + t.equal( isnan( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', function test( t ) { var sign = signum( -0.0 ); - t.equal( isNegativeZero( sign ), true, 'returns -0' ); + t.equal( isNegativeZero( sign ), true, 'returns expected value' ); t.end(); }); @@ -54,24 +54,24 @@ tape( 'the function returns `0` if provided +0', function test( t ) { var sign; sign = signum( 0.0 ); - t.equal( isPositiveZero( sign ), true, 'returns +0' ); + t.equal( isPositiveZero( sign ), true, 'returns expected value' ); sign = signum( +0.0 ); - t.equal( isPositiveZero( sign ), true, 'returns +0' ); + t.equal( isPositiveZero( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1` if provided a negative number', function test( t ) { - t.equal( signum( -10.0 ), -1.0, 'signum(-10) => -1' ); - t.equal( signum( -PI ), -1.0, 'signum(-π) => -1' ); - t.equal( signum( NINF ), -1.0, 'signum(-infinity) => -1' ); + t.equal( signum( -10.0 ), -1.0, 'returns expected value' ); + t.equal( signum( -PI ), -1.0, 'returns expected value' ); + t.equal( signum( NINF ), -1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+1` if provided a positive number', function test( t ) { - t.equal( signum( 10.0 ), 1.0, 'signum(10) => 1' ); - t.equal( signum( PI ), 1.0, 'signum(π) => 1' ); - t.equal( signum( PINF ), 1.0, 'signum(infinity) => 1' ); + t.equal( signum( 10.0 ), 1.0, 'returns expected value' ); + t.equal( signum( PI ), 1.0, 'returns expected value' ); + t.equal( signum( PINF ), 1.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/signum/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/signum/test/test.native.js index c14c7b91ee73..a83327969b0e 100644 --- a/lib/node_modules/@stdlib/math/base/special/signum/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/signum/test/test.native.js @@ -49,13 +49,13 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var sign = signum( NaN ); - t.equal( isnan( sign ), true, 'returns NaN' ); + t.equal( isnan( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) { var sign = signum( -0.0 ); - t.equal( isNegativeZero( sign ), true, 'returns -0' ); + t.equal( isNegativeZero( sign ), true, 'returns expected value' ); t.end(); }); @@ -63,24 +63,24 @@ tape( 'the function returns `0` if provided +0', opts, function test( t ) { var sign; sign = signum( 0.0 ); - t.equal( isPositiveZero( sign ), true, 'returns +0' ); + t.equal( isPositiveZero( sign ), true, 'returns expected value' ); sign = signum( +0.0 ); - t.equal( isPositiveZero( sign ), true, 'returns +0' ); + t.equal( isPositiveZero( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1` if provided a negative number', opts, function test( t ) { - t.equal( signum( -10.0 ), -1.0, 'signum(-10) => -1' ); - t.equal( signum( -PI ), -1.0, 'signum(-π) => -1' ); - t.equal( signum( NINF ), -1.0, 'signum(-infinity) => -1' ); + t.equal( signum( -10.0 ), -1.0, 'returns expected value' ); + t.equal( signum( -PI ), -1.0, 'returns expected value' ); + t.equal( signum( NINF ), -1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+1` if provided a positive number', opts, function test( t ) { - t.equal( signum( 10.0 ), 1.0, 'signum(10) => 1' ); - t.equal( signum( PI ), 1.0, 'signum(π) => 1' ); - t.equal( signum( PINF ), 1.0, 'signum(infinity) => 1' ); + t.equal( signum( 10.0 ), 1.0, 'returns expected value' ); + t.equal( signum( PI ), 1.0, 'returns expected value' ); + t.equal( signum( PINF ), 1.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.js index 49617537b940..3a97c86c3a01 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/signumf/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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pkg = require( './../package.json' ).name; var signumf = require( './../lib' ); @@ -41,10 +41,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = signumf( x ); + y = signumf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } @@ -62,10 +65,13 @@ bench( pkg+'::built-in', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = Math.sign( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.sign( x[ i%x.length ] ); // eslint-disable-line stdlib/no-builtin-math if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.native.js index 67c4aa3db1c2..f9be29164a7a 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/signumf/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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = signumf( x ); + y = signumf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/benchmark.c index 6f1f4247244a..be006aec17df 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/benchmark.c @@ -90,15 +90,18 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x; - float y; double t; + float x[ 100 ]; + float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_float()*1000.0f ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0f * rand_float() ) - 500.0f; - y = signbit( x ); + y = signbit( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/native/benchmark.c index a82ece622801..a876566b4940 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/signumf/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x; - float y; double t; + float x[ 100 ]; + float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_float()*1000.0f ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( rand_float()*1000.0f ) - 500.0f; - y = stdlib_base_signumf( x ); + y = stdlib_base_signumf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/test/test.js b/lib/node_modules/@stdlib/math/base/special/signumf/test/test.js index 0a322cd1cb6f..429d2000ec0a 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/signumf/test/test.js @@ -39,13 +39,13 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var sign = signumf( NaN ); - t.equal( isnanf( sign ), true, 'returns NaN' ); + t.equal( isnanf( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', function test( t ) { var sign = signumf( -0.0 ); - t.equal( isNegativeZerof( sign ), true, 'returns -0' ); + t.equal( isNegativeZerof( sign ), true, 'returns expected value' ); t.end(); }); @@ -53,22 +53,22 @@ tape( 'the function returns `0` if provided +0', function test( t ) { var sign; sign = signumf( 0.0 ); - t.equal( isPositiveZerof( sign ), true, 'returns +0' ); + t.equal( isPositiveZerof( sign ), true, 'returns expected value' ); sign = signumf( +0.0 ); - t.equal( isPositiveZerof( sign ), true, 'returns +0' ); + t.equal( isPositiveZerof( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1` if provided a negative number', function test( t ) { - t.equal( signumf( -10.0 ), -1.0, 'signum(-10) => -1' ); - t.equal( signumf( NINF ), -1.0, 'signum(-infinity) => -1' ); + t.equal( signumf( -10.0 ), -1.0, 'returns expected value' ); + t.equal( signumf( NINF ), -1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+1` if provided a positive number', function test( t ) { - t.equal( signumf( 10.0 ), 1.0, 'signum(10) => 1' ); - t.equal( signumf( PINF ), 1.0, 'signum(infinity) => 1' ); + t.equal( signumf( 10.0 ), 1.0, 'returns expected value' ); + t.equal( signumf( PINF ), 1.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/signumf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/signumf/test/test.native.js index d62af73a3e89..5ea06e76b9dc 100644 --- a/lib/node_modules/@stdlib/math/base/special/signumf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/signumf/test/test.native.js @@ -48,13 +48,13 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var sign = signumf( NaN ); - t.equal( isnanf( sign ), true, 'returns NaN' ); + t.equal( isnanf( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) { var sign = signumf( -0.0 ); - t.equal( isNegativeZerof( sign ), true, 'returns -0' ); + t.equal( isNegativeZerof( sign ), true, 'returns expected value' ); t.end(); }); @@ -62,22 +62,22 @@ tape( 'the function returns `0` if provided +0', opts, function test( t ) { var sign; sign = signumf( 0.0 ); - t.equal( isPositiveZerof( sign ), true, 'returns +0' ); + t.equal( isPositiveZerof( sign ), true, 'returns expected value' ); sign = signumf( +0.0 ); - t.equal( isPositiveZerof( sign ), true, 'returns +0' ); + t.equal( isPositiveZerof( sign ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-1` if provided a negative number', opts, function test( t ) { - t.equal( signumf( -10.0 ), -1.0, 'signum(-10) => -1' ); - t.equal( signumf( NINF ), -1.0, 'signum(-infinity) => -1' ); + t.equal( signumf( -10.0 ), -1.0, 'returns expected value' ); + t.equal( signumf( NINF ), -1.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+1` if provided a positive number', opts, function test( t ) { - t.equal( signumf( 10.0 ), 1.0, 'signum(10) => 1' ); - t.equal( signumf( PINF ), 1.0, 'signum(infinity) => 1' ); + t.equal( signumf( 10.0 ), 1.0, 'returns expected value' ); + t.equal( signumf( PINF ), 1.0, 'returns expected value' ); t.end(); });