diff --git a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.js index f5dda57ebaf8..550d71073648 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/acoth/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 acoth = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 1.1, 100.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) + 1.1; - y = acoth( x ); + y = acoth( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.native.js index 5b3f8ef06b52..ef0fbfa697e0 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acoth/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, 1.1, 100.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) + 1.1; - y = acoth( x ); + y = acoth( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/c/benchmark.c index 11c7380d1807..1cc88e6f4bdd 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/acoth/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() ) + 1.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) + 1.1; - y = atanh( 1.0/x ); + y = atanh( 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/acoth/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/c/native/benchmark.c index 787f26b315a1..b8b116282649 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/acoth/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() ) + 1.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) + 1.1; - y = stdlib_base_acoth( x ); + y = stdlib_base_acoth( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/acoth/test/test.js b/lib/node_modules/@stdlib/math/base/special/acoth/test/test.js index 78827543cd08..5e76fd13f2dc 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/acoth/test/test.js @@ -234,7 +234,7 @@ tape( 'the function computes the inverse hyperbolic cotangent for huge negative tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = acoth( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -244,7 +244,7 @@ tape( 'the function returns `NaN` if provided a value on the open interval (-1,1 for ( i = 0; i < 1e3; i++ ) { v = ( randu()*2.0 ) - 1.0; - t.equal( isnan( acoth( v ) ), true, 'returns NaN when provided '+v ); + t.equal( isnan( acoth( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/acoth/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acoth/test/test.native.js index d346fcb27506..640a68a6a300 100644 --- a/lib/node_modules/@stdlib/math/base/special/acoth/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/acoth/test/test.native.js @@ -243,7 +243,7 @@ tape( 'the function computes the inverse hyperbolic cotangent for huge negative tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = acoth( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -253,7 +253,7 @@ tape( 'the function returns `NaN` if provided a value on the open interval (-1,1 for ( i = 0; i < 1e3; i++ ) { v = ( randu()*2.0 ) - 1.0; - t.equal( isnan( acoth( v ) ), true, 'returns NaN when provided '+v ); + t.equal( isnan( acoth( v ) ), true, 'returns expected value when provided '+v ); } t.end(); });