diff --git a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.js index ee93da26d3e6..e2477e23e220 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/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 acot = 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 = acot( x ); + y = acot( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.native.js index d05624f90744..1bf546ccd853 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/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 = acot( x ); + y = acot( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/benchmark.c index f2b00c9b7577..d6e025ad079c 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/acot/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 ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = atan( 1.0/x ); + y = atan( 1.0/x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/native/benchmark.c index d4bc00e89167..2910654b6aaf 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/acot/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 ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 50.0; - y = stdlib_base_acot( x ); + y = stdlib_base_acot( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/acot/test/test.js b/lib/node_modules/@stdlib/math/base/special/acot/test/test.js index 26add8731c0e..688ed0a67a9a 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/test/test.js @@ -237,7 +237,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', fu tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = acot( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js index 7695fd281220..53b29ff39ec7 100644 --- a/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acot/test/test.native.js @@ -246,7 +246,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', op tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = acot( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); });