diff --git a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.js index 676d3e13dd46..bf11347fa3c0 100644 --- a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/acosf/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 acosf = require( './../lib' ); @@ -34,10 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -1.0, 1.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2.0 ) - 1.0; - y = acosf( x ); + y = acosf( x[ i % x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.native.js index ea657c5cf9d1..b7405875dbac 100644 --- a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acosf/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, -1.0, 1.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2.0 ) - 1.0; - y = acosf( x ); + y = acosf( x[ i % x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/c/native/benchmark.c index 50e20841602b..01cd1d134568 100644 --- a/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/acosf/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static float rand_float( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + float x[ 100 ]; double elapsed; double t; - float x; float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 2.0f * rand_float() ) - 1.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2.0f * rand_float() ) - 1.0f; - y = stdlib_base_acosf( x ); + y = stdlib_base_acosf( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break;