diff --git a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.js index c98f1313378f..8f199059674f 100644 --- a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/spence/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 spence = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 1000.0; - y = spence( x ); + y = spence( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.native.js index 7a788d894715..9f021760bfff 100644 --- a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spence/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, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 1000.0; - y = spence( x ); + y = spence( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/cephes/benchmark.c index 5534023c0846..2021db737d92 100644 --- a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/cephes/benchmark.c @@ -94,16 +94,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = 1000.0 * rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 0.0; - y = spence( x ); + y = spence( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/native/benchmark.c index 1ae2467c228f..479657623dc6 100644 --- a/lib/node_modules/@stdlib/math/base/special/spence/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/spence/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 ] = 1000.0 * rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0 * rand_double() ) - 0.0; - y = stdlib_base_spence( x ); + y = stdlib_base_spence( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break;