diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.js index 95fb0c5a9756..cb7f1d5aa877 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/copysign/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 copysign = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, -5.0e6, 5.0e6 ); + y = uniform( 100, -5.0e6, 5.0e6 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = ( randu()*1.0e7 ) - 5.0e6; - z = copysign( x, y ); + z = copysign( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.native.js index 3941d928d0a8..c82cf54904f9 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/copysign/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; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = uniform( 100, -5.0e6, 5.0e6 ); + y = uniform( 100, -5.0e6, 5.0e6 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = ( randu()*1.0e7 ) - 5.0e6; - z = copysign( x, y ); + z = copysign( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/benchmark.c index 644f610fff62..3cddef52ac5e 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/benchmark.c @@ -90,17 +90,20 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1.0e7*rand_double() ) - 5.0e6; + y[ i ] = ( 1.0e7*rand_double() ) - 5.0e6; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1.0e7*rand_double() ) - 5.0e6; - y = ( 1.0e7*rand_double() ) - 5.0e6; - z = copysign( x, y ); + z = copysign( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/native/benchmark.c index c6ed79dcebd1..ae52ddc5148e 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/copysign/benchmark/c/native/benchmark.c @@ -91,17 +91,20 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1.0e7*rand_double() ) - 5.0e6; + y[ i ] = ( 1.0e7*rand_double() ) - 5.0e6; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1.0e7*rand_double() ) - 5.0e6; - y = ( 1.0e7*rand_double() ) - 5.0e6; - z = stdlib_base_copysign( x, y ); + z = stdlib_base_copysign( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/test/test.js b/lib/node_modules/@stdlib/math/base/special/copysign/test/test.js index 39e28212e7c7..bb0fa1c6f667 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/copysign/test/test.js @@ -63,10 +63,10 @@ tape( 'if `x` is `NaN`, the function returns `NaN`', function test( t ) { var z; z = copysign( NaN, -1.0 ); - t.equal( isnan( z ), true, 'returns NaN' ); + t.equal( isnan( z ), true, 'returns expected value' ); z = copysign( NaN, 1.0 ); - t.equal( isnan( z ), true, 'returns NaN' ); + t.equal( isnan( z ), true, 'returns expected value' ); t.end(); }); @@ -87,10 +87,10 @@ tape( 'if `x` is `+infinity`, the function returns an infinite number', function var z; z = copysign( PINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysign( PINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -99,10 +99,10 @@ tape( 'if `y` is `+infinity`, the function returns a positive number', function var z; z = copysign( -1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); z = copysign( 1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); t.end(); }); @@ -111,10 +111,10 @@ tape( 'if `x` is `-infinity`, the function returns an infinite number', function var z; z = copysign( NINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysign( NINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -123,10 +123,10 @@ tape( 'if `y` is `-infinity`, the function returns a negative number', function var z; z = copysign( -1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); z = copysign( 1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); t.end(); }); @@ -138,10 +138,10 @@ tape( 'the function supports copying a sign from `0`', function test( t ) { x = 3.14; z = copysign( x, 0.0 ); - t.equal( z, 3.14, 'returns +3.14' ); + t.equal( z, 3.14, 'returns expected value' ); z = copysign( x, -0.0 ); - t.equal( z, -3.14, 'returns -3.14' ); + t.equal( z, -3.14, 'returns expected value' ); t.end(); }); @@ -150,10 +150,10 @@ tape( 'the function supports copying a sign to `0`', function test( t ) { var z; z = copysign( -0.0, 1.0 ); - t.equal( isPositiveZero( z ), true, 'returns +0' ); + t.equal( isPositiveZero( z ), true, 'returns expected value' ); z = copysign( 0.0, -1.0 ); - t.equal( isNegativeZero( z ), true, 'returns -0' ); + t.equal( isNegativeZero( z ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/copysign/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/copysign/test/test.native.js index dd507c50a705..84d0a92983d9 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysign/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/copysign/test/test.native.js @@ -72,10 +72,10 @@ tape( 'if `x` is `NaN`, the function returns `NaN`', opts, function test( t ) { var z; z = copysign( NaN, -1.0 ); - t.equal( isnan( z ), true, 'returns NaN' ); + t.equal( isnan( z ), true, 'returns expected value' ); z = copysign( NaN, 1.0 ); - t.equal( isnan( z ), true, 'returns NaN' ); + t.equal( isnan( z ), true, 'returns expected value' ); t.end(); }); @@ -96,10 +96,10 @@ tape( 'if `x` is `+infinity`, the function returns an infinite number', opts, fu var z; z = copysign( PINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysign( PINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -108,10 +108,10 @@ tape( 'if `y` is `+infinity`, the function returns a positive number', opts, fun var z; z = copysign( -1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); z = copysign( 1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); t.end(); }); @@ -120,10 +120,10 @@ tape( 'if `x` is `-infinity`, the function returns an infinite number', opts, fu var z; z = copysign( NINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysign( NINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -132,10 +132,10 @@ tape( 'if `y` is `-infinity`, the function returns a negative number', opts, fun var z; z = copysign( -1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); z = copysign( 1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); t.end(); }); @@ -147,10 +147,10 @@ tape( 'the function supports copying a sign from `0`', opts, function test( t ) x = 3.14; z = copysign( x, 0.0 ); - t.equal( z, 3.14, 'returns +3.14' ); + t.equal( z, 3.14, 'returns expected value' ); z = copysign( x, -0.0 ); - t.equal( z, -3.14, 'returns -3.14' ); + t.equal( z, -3.14, 'returns expected value' ); t.end(); }); @@ -159,10 +159,10 @@ tape( 'the function supports copying a sign to `0`', opts, function test( t ) { var z; z = copysign( -0.0, 1.0 ); - t.equal( isPositiveZero( z ), true, 'returns +0' ); + t.equal( isPositiveZero( z ), true, 'returns expected value' ); z = copysign( 0.0, -1.0 ); - t.equal( isNegativeZero( z ), true, 'returns -0' ); + t.equal( isNegativeZero( z ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.js index c5cdf0cc2272..d6569b77d955 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/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 copysignf = require( './../lib' ); @@ -35,11 +35,16 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, -5.0e6, 5.0e6, { + 'dtype': 'float32' + }); + y = uniform( 100, -5.0e6, 5.0e6, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = ( randu()*1.0e7 ) - 5.0e6; - z = copysignf( x, y ); + z = copysignf( x[ i%x.length ], y[ i%y.length ] ); if ( isnanf( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.native.js index f8dc407cba8a..d172fc9f4d92 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/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; @@ -44,11 +44,16 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = uniform( 100, -5.0e6, 5.0e6, { + 'dtype': 'float32' + }); + y = uniform( 100, -5.0e6, 5.0e6, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = ( randu()*1.0e7 ) - 5.0e6; - z = copysignf( x, y ); + z = copysignf( x[ i%x.length ], y[ i%y.length ] ); if ( isnanf( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/benchmark.c index e95d57e73afc..89ca488007b6 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/benchmark.c @@ -91,16 +91,19 @@ static float rand_float( void ) { static double benchmark( void ) { double elapsed; double t; - float x; - float y; + float x[ 100 ]; + float y[ 100 ]; float z; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + y[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0f*rand_float() ) - 500.0f; - y = ( 1000.0f*rand_float() ) - 500.0f; - z = copysignf( x, y ); + z = copysignf( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/native/benchmark.c index bd8aeebc8521..1383599d73cd 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/benchmark/c/native/benchmark.c @@ -92,16 +92,19 @@ static float rand_float( void ) { static double benchmark( void ) { double elapsed; double t; - float x; - float y; + float x[ 100 ]; + float y[ 100 ]; float z; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + y[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0f*rand_float() ) - 500.0f; - y = ( 1000.0f*rand_float() ) - 500.0f; - z = stdlib_base_copysignf( x, y ); + z = stdlib_base_copysignf( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.js b/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.js index b37bb847df0b..f75eee030a0c 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.js @@ -63,10 +63,10 @@ tape( 'if `x` is `NaN`, the function returns `NaN`', function test( t ) { var z; z = copysignf( NaN, -1.0 ); - t.equal( isnanf( z ), true, 'returns NaN' ); + t.equal( isnanf( z ), true, 'returns expected value' ); z = copysignf( NaN, 1.0 ); - t.equal( isnanf( z ), true, 'returns NaN' ); + t.equal( isnanf( z ), true, 'returns expected value' ); t.end(); }); @@ -87,10 +87,10 @@ tape( 'if `x` is `+infinity`, the function returns an infinite number', function var z; z = copysignf( PINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysignf( PINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -99,10 +99,10 @@ tape( 'if `y` is `+infinity`, the function returns a positive number', function var z; z = copysignf( -1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); z = copysignf( 1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); t.end(); }); @@ -111,10 +111,10 @@ tape( 'if `x` is `-infinity`, the function returns an infinite number', function var z; z = copysignf( NINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysignf( NINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -123,10 +123,10 @@ tape( 'if `y` is `-infinity`, the function returns a negative number', function var z; z = copysignf( -1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); z = copysignf( 1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); t.end(); }); @@ -138,10 +138,10 @@ tape( 'the function supports copying a sign from `0`', function test( t ) { x = 3.0; z = copysignf( x, 0.0 ); - t.equal( z, 3.0, 'returns +3.0' ); + t.equal( z, 3.0, 'returns expected value' ); z = copysignf( x, -0.0 ); - t.equal( z, -3.0, 'returns -3.0' ); + t.equal( z, -3.0, 'returns expected value' ); t.end(); }); @@ -150,10 +150,10 @@ tape( 'the function supports copying a sign to `0`', function test( t ) { var z; z = copysignf( -0.0, 1.0 ); - t.equal( isPositiveZerof( z ), true, 'returns +0' ); + t.equal( isPositiveZerof( z ), true, 'returns expected value' ); z = copysignf( 0.0, -1.0 ); - t.equal( isNegativeZerof( z ), true, 'returns -0' ); + t.equal( isNegativeZerof( z ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.native.js index a91ed972be38..00f7e2b152d4 100644 --- a/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/copysignf/test/test.native.js @@ -72,10 +72,10 @@ tape( 'if `x` is `NaN`, the function returns `NaN`', opts, function test( t ) { var z; z = copysignf( NaN, -1.0 ); - t.equal( isnanf( z ), true, 'returns NaN' ); + t.equal( isnanf( z ), true, 'returns expected value' ); z = copysignf( NaN, 1.0 ); - t.equal( isnanf( z ), true, 'returns NaN' ); + t.equal( isnanf( z ), true, 'returns expected value' ); t.end(); }); @@ -96,10 +96,10 @@ tape( 'if `x` is `+infinity`, the function returns an infinite number', opts, fu var z; z = copysignf( PINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysignf( PINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -108,10 +108,10 @@ tape( 'if `y` is `+infinity`, the function returns a positive number', opts, fun var z; z = copysignf( -1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); z = copysignf( 1.0, PINF ); - t.equal( z, 1.0, 'returns +1' ); + t.equal( z, 1.0, 'returns expected value' ); t.end(); }); @@ -120,10 +120,10 @@ tape( 'if `x` is `-infinity`, the function returns an infinite number', opts, fu var z; z = copysignf( NINF, -1.0 ); - t.equal( z, NINF, 'returns -infinity' ); + t.equal( z, NINF, 'returns expected value' ); z = copysignf( NINF, 1.0 ); - t.equal( z, PINF, 'returns +infinity' ); + t.equal( z, PINF, 'returns expected value' ); t.end(); }); @@ -132,10 +132,10 @@ tape( 'if `y` is `-infinity`, the function returns a negative number', opts, fun var z; z = copysignf( -1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); z = copysignf( 1.0, NINF ); - t.equal( z, -1.0, 'returns -1' ); + t.equal( z, -1.0, 'returns expected value' ); t.end(); }); @@ -147,10 +147,10 @@ tape( 'the function supports copying a sign from `0`', opts, function test( t ) x = 3.0; z = copysignf( x, 0.0 ); - t.equal( z, 3.0, 'returns +3.0' ); + t.equal( z, 3.0, 'returns expected value' ); z = copysignf( x, -0.0 ); - t.equal( z, -3.0, 'returns -3.0' ); + t.equal( z, -3.0, 'returns expected value' ); t.end(); }); @@ -159,10 +159,10 @@ tape( 'the function supports copying a sign to `0`', opts, function test( t ) { var z; z = copysignf( -0.0, 1.0 ); - t.equal( isPositiveZerof( z ), true, 'returns +0' ); + t.equal( isPositiveZerof( z ), true, 'returns expected value' ); z = copysignf( 0.0, -1.0 ); - t.equal( isNegativeZerof( z ), true, 'returns -0' ); + t.equal( isNegativeZerof( z ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.js index 560d39d2e7f8..2fc43a12c227 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cosm1/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 cosm1 = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -2.0, 2.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*4.0 ) - 2.0; - y = cosm1( x ); + y = cosm1( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.native.js index b17b0de20fa8..574b1b69c91f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosm1/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, 2.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 4.0 ) - 2.0; - y = cosm1( x ); + y = cosm1( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/cephes/benchmark.c index 15457c32ac2f..92941279db68 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosm1/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 ] = ( 4.0*rand_double() ) - 2.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 4.0*rand_double() ) - 2.0; - y = cosm1( x ); + y = cosm1( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/native/benchmark.c index fa41bfc72a7c..2b427f8aaf1c 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosm1/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cosm1/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 ] = ( 4.0 * rand_double() ) - 2.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 4.0 * rand_double() ) - 2.0; - y = stdlib_base_cosm1( x ); + y = stdlib_base_cosm1( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.js index 56c4d94e9b34..dcd8a3202b82 100644 --- a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cospi/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 cospi = 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 = cospi( x ); + y = cospi( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.native.js index dfcb65b76ceb..a57366eb9deb 100644 --- a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cospi/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 = cospi( x ); + y = cospi( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/c/native/benchmark.c index d82b12d30dcf..f56dc02520db 100644 --- a/lib/node_modules/@stdlib/math/base/special/cospi/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cospi/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 ] = ( 1.0e7 * rand_double() ) - 5.0e6; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1.0e7 * rand_double() ) - 5.0e6; - y = stdlib_base_cospi( x ); + y = stdlib_base_cospi( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cospi/test/test.js b/lib/node_modules/@stdlib/math/base/special/cospi/test/test.js index 2073e134dc0c..417fcfe65306 100644 --- a/lib/node_modules/@stdlib/math/base/special/cospi/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cospi/test/test.js @@ -49,17 +49,17 @@ tape( 'the function returns `NaN` if provided either positive or negative infini var y; y = cospi( PINF ); - t.equal( isnan( y ), true, 'returns NaN when provided +infinity' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cospi( NINF ); - t.equal( isnan( y ), true, 'returns NaN when provided -infinity' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { var y = cospi( NaN ); - t.equal( isnan( y ), true, 'returns NaN when provided NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -86,7 +86,7 @@ tape( 'if provided a value exceeding `2**53` (max (unsafe) float64 integer), the x = pow( 2.0, 53 ) + 1.0; for ( i = 0; i < 100; i++ ) { y = cospi( x+i ); - t.equal( y, 1.0, 'returns 1.0' ); + t.equal( y, 1.0, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cospi/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cospi/test/test.native.js index 39ec3ce602cb..14800ccdee64 100644 --- a/lib/node_modules/@stdlib/math/base/special/cospi/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cospi/test/test.native.js @@ -58,17 +58,17 @@ tape( 'the function returns `NaN` if provided either positive or negative infini var y; y = cospi( PINF ); - t.equal( isnan( y ), true, 'returns expected value when provided +infinity' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cospi( NINF ); - t.equal( isnan( y ), true, 'returns expected value when provided -infinity' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { var y = cospi( NaN ); - t.equal( isnan( y ), true, 'returns expected value when provided NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -95,7 +95,7 @@ tape( 'if provided a value exceeding `2**53` (max (unsafe) float64 integer), the x = pow( 2.0, 53 ) + 1.0; for ( i = 0; i < 100; i++ ) { y = cospi( x+i ); - t.equal( y, 1.0, 'returns 1.0' ); + t.equal( y, 1.0, 'returns expected value' ); } t.end(); });