diff --git a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.js index 2874e663cf90..2791d070537d 100644 --- a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rad2degf/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 TWO_PI = require( '@stdlib/constants/float32/two-pi' ); var pkg = require( './../package.json' ).name; @@ -35,10 +35,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, TWO_PI, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * TWO_PI ) - 0.0; - y = rad2degf( x ); + y = rad2degf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.native.js index 0819301db298..d31034511fa1 100644 --- a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rad2degf/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 TWO_PI = require( '@stdlib/constants/float32/two-pi' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -44,10 +44,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, TWO_PI, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * TWO_PI ) - 0.0; - y = rad2degf( x ); + y = rad2degf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/c/native/benchmark.c index 599b26c3b2ad..c65d6b461b38 100644 --- a/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rad2degf/benchmark/c/native/benchmark.c @@ -92,14 +92,17 @@ static float rand_float( void ) { static double benchmark( void ) { double elapsed; double t; - float x; + float x[ 100 ]; float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 2.0f * rand_float() * 3.14f ) - 0.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2.0f * rand_float() * 3.14f ) - 0.0f; - y = stdlib_base_rad2degf( x ); + y = stdlib_base_rad2degf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.js b/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.js index e70a3cd7f56a..2f11769bb805 100644 --- a/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.js @@ -46,13 +46,13 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `+infinity`, the function returns `+infinity`', function test( t ) { var r = rad2degf( PINF ); - t.equal( r, PINF, 'returns +infinity' ); + t.equal( r, PINF, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `-infinity`', function test( t ) { var r = rad2degf( NINF ); - t.equal( r, NINF, 'returns -infinity' ); + t.equal( r, NINF, 'returns expected value' ); t.end(); }); @@ -160,6 +160,6 @@ tape( 'the function converts an angle from radians to degrees (canonical values) tape( 'if provided a value greater than `~6e+36`, the function will underflow', function test( t ) { var r = rad2degf( 6.0e+36 ); - t.equal( r, PINF, 'returns +infinity' ); + t.equal( r, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.native.js index bfe43abc804f..43283ae2113c 100644 --- a/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rad2degf/test/test.native.js @@ -55,13 +55,13 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided `+infinity`, the function returns `+infinity`', opts, function test( t ) { var r = rad2degf( PINF ); - t.equal( r, PINF, 'returns +infinity' ); + t.equal( r, PINF, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `-infinity`', opts, function test( t ) { var r = rad2degf( NINF ); - t.equal( r, NINF, 'returns -infinity' ); + t.equal( r, NINF, 'returns expected value' ); t.end(); }); @@ -169,6 +169,6 @@ tape( 'the function converts an angle from radians to degrees (canonical values) tape( 'if provided a value greater than `~6e+36`, the function will underflow', opts, function test( t ) { var r = rad2degf( 6.0e+36 ); - t.equal( r, PINF, 'returns +infinity' ); + t.equal( r, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.js index a497fb8a90f4..c633cc84f446 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ramp/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 ramp = require( './../lib' ); @@ -34,10 +34,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 = ramp( x ); + y = ramp( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.native.js index de80cdb31034..5ac5a3d585da 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ramp/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, -50.0, 50.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = ramp( x ); + y = ramp( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/benchmark.c index 6bb74304307c..520663bbd886 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/benchmark.c @@ -103,15 +103,18 @@ double ramp( double x ) { */ 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 ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = ramp( x ); + y = ramp( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/native/benchmark.c index 1b8ea33557c8..977fc6048b9d 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ramp/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 ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = stdlib_base_ramp( x ); + y = stdlib_base_ramp( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/test/test.js b/lib/node_modules/@stdlib/math/base/special/ramp/test/test.js index 53159cc47390..465a51f93d97 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/ramp/test/test.js @@ -46,7 +46,7 @@ tape( 'the function returns `0` if `x` is less than `0`', function test( t ) { for ( i = 0; i < 1e3; i++ ) { x = -( randu()*100.0 ) - EPS; v = ramp( x ); - t.equal( isPositiveZero( v ), true, 'returns 0 when provided '+x ); + t.equal( isPositiveZero( v ), true, 'returns expected value when provided '+x ); } t.end(); }); @@ -66,24 +66,24 @@ tape( 'the function returns `x` if `x` is nonnegative', function test( t ) { tape( 'the function returns `0` if provided `-0`', function test( t ) { var v = ramp( -0.0 ); - t.equal( isPositiveZero( v ), true, 'returns +0' ); + t.equal( isPositiveZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = ramp( 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 `-infinity`', function test( t ) { var v = ramp( NINF ); - t.equal( v, 0.0, 'returns 0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) { var v = ramp( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ramp/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/ramp/test/test.native.js index b2082cbf0de2..066409296ab5 100644 --- a/lib/node_modules/@stdlib/math/base/special/ramp/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ramp/test/test.native.js @@ -68,31 +68,31 @@ tape( 'the function returns `x` if `x` is nonnegative', opts, function test( t ) for ( i = 0; i < 1e3; i++ ) { x = randu() * 100.0; v = ramp( x ); - t.equal( v, x, 'returns x when provided '+x ); + t.equal( v, x, 'returns expected value when provided '+x ); } t.end(); }); tape( 'the function returns `0` if provided `-0`', opts, function test( t ) { var v = ramp( -0.0 ); - t.equal( isPositiveZero( v ), true, 'returns +0' ); + t.equal( isPositiveZero( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = ramp( 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 `-infinity`', opts, function test( t ) { var v = ramp( NINF ); - t.equal( v, 0.0, 'returns 0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', opts, function test( t ) { var v = ramp( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.js index 2d2f419d62a2..9b1699d08e06 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rampf/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 rampf = require( './../lib' ); @@ -34,10 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -50.0, 50.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = rampf( x ); + y = rampf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.native.js index 0a180cfcb2be..7b3ba9995d44 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rampf/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, -50.0, 50.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = rampf( x ); + y = rampf( x[ i%x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/benchmark.c index 4c5362b3cc81..b291aa67c7d2 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/benchmark.c @@ -103,15 +103,18 @@ float rampf( float x ) { */ static double benchmark( void ) { double elapsed; - float x; + float x[ 100 ]; float y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0f*rand_float() ) - 50.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0f*rand_float() ) - 50.0f; - y = rampf( x ); + y = rampf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/native/benchmark.c index 0f5c05f4d756..7aecdcadd8c4 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rampf/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x; + float x[ 100 ]; float y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0f*rand_float() ) - 50.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0f*rand_float() ) - 50.0f; - y = stdlib_base_rampf( x ); + y = stdlib_base_rampf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/test/test.js b/lib/node_modules/@stdlib/math/base/special/rampf/test/test.js index fdf60feb9c17..a5f684544562 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rampf/test/test.js @@ -46,7 +46,7 @@ tape( 'the function returns `0` if `x` is less than `0`', function test( t ) { for ( i = 0; i < 1e3; i++ ) { x = -( randu()*100.0 ) - EPS; v = rampf( x ); - t.equal( isPositiveZerof( v ), true, 'returns 0 when provided '+x ); + t.equal( isPositiveZerof( v ), true, 'returns expected value when provided '+x ); } t.end(); }); @@ -64,24 +64,24 @@ tape( 'the function returns `x` if `x` is nonnegative', function test( t ) { tape( 'the function returns `0` if provided `-0`', function test( t ) { var v = rampf( -0.0 ); - t.equal( isPositiveZerof( v ), true, 'returns +0' ); + t.equal( isPositiveZerof( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = rampf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0` if provided `-infinity`', function test( t ) { var v = rampf( NINF ); - t.equal( v, 0.0, 'returns 0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) { var v = rampf( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rampf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rampf/test/test.native.js index f913c6a20e4a..f62cd03f8aef 100644 --- a/lib/node_modules/@stdlib/math/base/special/rampf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rampf/test/test.native.js @@ -55,7 +55,7 @@ tape( 'the function returns `0` if `x` is less than `0`', opts, function test( t for ( i = 0; i < 1e3; i++ ) { x = -( randu()*100.0 ) - EPS; v = rampf( x ); - t.equal( isPositiveZerof( v ), true, 'returns 0 when provided '+x ); + t.equal( isPositiveZerof( v ), true, 'returns expected value when provided '+x ); } t.end(); }); @@ -73,24 +73,24 @@ tape( 'the function returns `x` if `x` is nonnegative', opts, function test( t ) tape( 'the function returns `0` if provided `-0`', opts, function test( t ) { var v = rampf( -0.0 ); - t.equal( isPositiveZerof( v ), true, 'returns +0' ); + t.equal( isPositiveZerof( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = rampf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0` if provided `-infinity`', opts, function test( t ) { var v = rampf( NINF ); - t.equal( v, 0.0, 'returns 0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', opts, function test( t ) { var v = rampf( PINF ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/benchmark.js index 1ca42841b98a..5aacb56e6a5f 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/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 rcbrt = require( './../lib' ); @@ -41,10 +41,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, 100000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 100000.0 ) - 0.0; - y = rcbrt( x ); + y = rcbrt( 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, 0.0, 100000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 100000.0 ) - 0.0; - y = 1.0 / Math.cbrt( x ); // eslint-disable-line stdlib/no-builtin-math + y = 1.0 / Math.cbrt( 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/rcbrt/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/benchmark.native.js index 92173482056b..c62a56baa9c3 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/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, 0.0, 100000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 100000.0 ) - 0.0; - y = rcbrt( x ); + y = rcbrt( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/benchmark.c index 7d1f4857bc31..1185665a07b5 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/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 ] = rand_double() * 100000.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double() * 100000.0; - y = 1.0 / cbrt( x ); + y = 1.0 / cbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/cephes/benchmark.c index 4306d0757ca2..77801f4cf4b5 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/cephes/benchmark.c @@ -95,15 +95,19 @@ 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 ] = rand_double() * 100000.0; + } + + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double() * 100000.0; - y = 1.0 / cbrt( x ); + y = 1.0 / cbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/native/benchmark.c index d58a4dd23cee..daed314f2eaf 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/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 ] = rand_double() * 100000.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double() * 100000.0; - y = stdlib_base_rcbrt( x ); + y = stdlib_base_rcbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.js b/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.js index b55fc6e14cb7..e2d6c0dab573 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.js @@ -403,30 +403,30 @@ tape( 'the function evaluates the reciprocal cube root of `x` on the interval `[ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = rcbrt( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `+infinity`', function test( t ) { var v = rcbrt( PINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+0`', function test( t ) { var v = rcbrt( +0.0 ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-infinity` if provided `-0`', function test( t ) { var v = rcbrt( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `-infinity`', function test( t ) { var v = rcbrt( 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/rcbrt/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.native.js index f4befe4a5fd1..231dbcdff0a1 100644 --- a/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rcbrt/test/test.native.js @@ -389,30 +389,30 @@ tape( 'the function evaluates the reciprocal cube root of `x` on the interval `[ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = rcbrt( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `+infinity`', opts, function test( t ) { var v = rcbrt( PINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+0`', opts, function test( t ) { var v = rcbrt( +0.0 ); - t.equal( v, PINF, 'returns +infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-infinity` if provided `-0`', opts, function test( t ) { var v = rcbrt( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `-infinity`', opts, function test( t ) { var v = rcbrt( NINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); });