diff --git a/lib/node_modules/@stdlib/math/base/special/roundsd/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/roundsd/benchmark/benchmark.js index 1fbc6a844eb0..ce09da35b1d3 100644 --- a/lib/node_modules/@stdlib/math/base/special/roundsd/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/roundsd/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 roundsd = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -5.0e6, 5.0e6 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = roundsd( x, 2, 2 ); + y = roundsd( x[ i%x.length ], 2, 2 ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/roundsd/test/test.js b/lib/node_modules/@stdlib/math/base/special/roundsd/test/test.js index 46970ae3de7e..c4555d2b73eb 100644 --- a/lib/node_modules/@stdlib/math/base/special/roundsd/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/roundsd/test/test.js @@ -48,25 +48,25 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v; v = roundsd( NaN, 2 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( 12368.0, NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( NaN, NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( NaN, NaN, 10 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( NaN, 2, 10 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( 3.14, NaN, 10 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( 3.14, 2, NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -75,10 +75,10 @@ tape( 'the function returns `NaN` if provided `n = +-infinity`', function test( var v; v = roundsd( PI, PINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( PI, NINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -87,10 +87,10 @@ tape( 'the function returns `NaN` if provided `n < 1`', function test( t ) { var v; v = roundsd( PI, 0 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( PI, -1 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -99,10 +99,10 @@ tape( 'the function returns `NaN` if provided `b = +-infinity`', function test( var v; v = roundsd( PI, 2, PINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( PI, 2, NINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -111,23 +111,23 @@ tape( 'the function returns `NaN` if provided `b <= 0`', function test( t ) { var v; v = roundsd( PI, 2, 0 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = roundsd( PI, 2, -1 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) { var v = roundsd( PINF, 5 ); - t.strictEqual( v, PINF, 'returns +infinity' ); + t.strictEqual( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-infinity` if provided `-infinity`', function test( t ) { var v = roundsd( NINF, 3 ); - t.strictEqual( v, NINF, 'returns -infinity' ); + t.strictEqual( v, NINF, 'returns expected value' ); t.end(); }); @@ -135,10 +135,10 @@ tape( 'the function returns `-0` if provided `-0`', function test( t ) { var v; v = roundsd( -0.0, 1 ); - t.strictEqual( isNegativeZero( v ), true, 'returns -0' ); + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); v = roundsd( -0.0, 2 ); - t.strictEqual( isNegativeZero( v ), true, 'returns -0' ); + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); t.end(); }); @@ -147,10 +147,10 @@ tape( 'the function returns `+0` if provided `+0`', function test( t ) { var v; v = roundsd( 0.0, 1 ); - t.strictEqual( isPositiveZero( v ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v ), true, 'returns expected value' ); v = roundsd( +0.0, 2 ); - t.strictEqual( isPositiveZero( v ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.js index 457d89d4cc6c..219882f8515c 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var rsqrt = require( './../lib' ); @@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0 ); + x = uniform( 100, 0.0, 100000.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { @@ -56,7 +56,7 @@ bench( pkg+'::built-in', function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0 ); + x = uniform( 100, 0.0, 100000.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.native.js index 41195ec9adaf..e96732bba8d5 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrt/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/uniform' ); +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,7 +43,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0 ); + x = uniform( 100, 0.0, 100000.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.js b/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.js index ddedd0acf1b8..df23ced19133 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.js @@ -235,36 +235,36 @@ tape( 'the function evaluates the reciprocal square root of `x` (huge positive)' tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = rsqrt( 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 = rsqrt( 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 = rsqrt( +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 = rsqrt( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a negative number', function test( t ) { var v = rsqrt( -4.0 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) { var v = rsqrt( NINF ); - 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/rsqrt/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.native.js index 9b9a8555e19b..ec4b5e2c6638 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrt/test/test.native.js @@ -244,36 +244,36 @@ tape( 'the function evaluates the reciprocal square root of `x` (huge positive)' tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = rsqrt( 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 = rsqrt( 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 = rsqrt( +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 = rsqrt( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a negative number', opts, function test( t ) { var v = rsqrt( -4.0 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', opts, function test( t ) { var v = rsqrt( NINF ); - 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/rsqrtf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js index eccb66df9704..3cd42f9b7f67 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pkg = require( './../package.json' ).name; var rsqrtf = require( './../lib' ); @@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0, { + x = uniform( 100, 0.0, 100000.0, { 'dtype': 'float32' }); @@ -58,7 +58,7 @@ bench( pkg+'::built-in', function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0, { + x = uniform( 100, 0.0, 100000.0, { 'dtype': 'float32' }); diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js index 0d97b2484bf4..07521f3eab2f 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/uniform' ); +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,7 +43,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 100000.0, { + x = uniform( 100, 0.0, 100000.0, { 'dtype': 'float32' }); diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.js index 8a1acb217c5e..9f1f4b4c1fab 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.js @@ -235,36 +235,36 @@ tape( 'the function evaluates the reciprocal square root of `x` (huge positive)' tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = rsqrtf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `+infinity`', function test( t ) { var v = rsqrtf( 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 = rsqrtf( +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 = rsqrtf( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a negative number', function test( t ) { var v = rsqrtf( -4.0 ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) { var v = rsqrtf( NINF ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.native.js index 15a41cdb2f83..44c2796d2d55 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/test/test.native.js @@ -244,36 +244,36 @@ tape( 'the function evaluates the reciprocal square root of `x` (huge positive)' tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = rsqrtf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `+infinity`', opts, function test( t ) { var v = rsqrtf( 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 = rsqrtf( +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 = rsqrtf( -0.0 ); - t.equal( v, NINF, 'returns -infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided a negative number', opts, function test( t ) { var v = rsqrtf( -4.0 ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', opts, function test( t ) { var v = rsqrtf( NINF ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.js index 5a4075112384..2a17490a4493 100644 --- a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/sec/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 cos = require( '@stdlib/math/base/special/cos' ); var pkg = require( './../package.json' ).name; @@ -35,10 +35,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = (randu() * 20.0) - 10.0; - y = sec( x ); + y = sec( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -56,10 +57,11 @@ bench( pkg + '::built-in', function benchmark( b ) { var y; var i; + x = uniform( 100, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = (randu() * 20.0) - 10.0; - y = 1.0 / cos( x ); + y = 1.0 / cos( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.native.js index b8f0d0236f62..b41cf2a201a6 100644 --- a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sec/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, -10.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = (randu() * 20.0) - 10.0; - y = sec( x ); + y = sec( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/sec/benchmark/c/native/benchmark.c index b1842520f75b..77d994082fe7 100644 --- a/lib/node_modules/@stdlib/math/base/special/sec/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/sec/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 ] = ( 20.0 * rand_double() ) - 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 20.0 * rand_double() ) - 10.0; - y = stdlib_base_sec( x ); + y = stdlib_base_sec( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/sec/test/test.js b/lib/node_modules/@stdlib/math/base/special/sec/test/test.js index f4ed5336cb04..e473b3c8cc5b 100644 --- a/lib/node_modules/@stdlib/math/base/special/sec/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sec/test/test.js @@ -379,18 +379,18 @@ tape( 'if provided a multiple of `pi/2`, the function does not return `~+infinit tape( 'if provided a `NaN`, the function returns `NaN`', function test( t ) { var v = sec( NaN ); - t.equal(isnan(v), true, 'returns NaN'); + t.equal(isnan(v), true, 'returns expected value'); t.end(); }); tape( 'if provided `+infinity`, the function returns `NaN`', function test( t ) { var v = sec( PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `NaN`', function test( t ) { var v = sec( NINF ); - 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/sec/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sec/test/test.native.js index 9dc6eee2a689..e912859b1a83 100644 --- a/lib/node_modules/@stdlib/math/base/special/sec/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sec/test/test.native.js @@ -388,18 +388,18 @@ tape( 'if provided a multiple of `pi/2`, the function does not return `~+infinit tape( 'if provided a `NaN`, the function returns `expected value`', opts, function test( t ) { var v = sec( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity`, the function returns `expected value`', opts, function test( t ) { var v = sec( PINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `expected value`', opts, function test( t ) { var v = sec( NINF ); - 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/secd/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/secd/benchmark/benchmark.js index 05747a1ab8b1..2d53ada578e4 100644 --- a/lib/node_modules/@stdlib/math/base/special/secd/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/secd/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 secd = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 1.0, 3.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*2.0 ) + 1.0; - y = secd( x ); + y = secd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/secd/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/secd/benchmark/benchmark.native.js index a67e0a9bca00..7a0121bef38a 100644 --- a/lib/node_modules/@stdlib/math/base/special/secd/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/secd/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.0, 3.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2.0 ) + 1.0; - y = secd( x ); + y = secd( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/secd/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/secd/benchmark/c/native/benchmark.c index cc52ace099fd..793edc53e9f9 100644 --- a/lib/node_modules/@stdlib/math/base/special/secd/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/secd/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 ] = ( 2.0 * rand_double() ) + 1.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2.0 * rand_double() ) + 1.0; - y = stdlib_base_secd( x ); + y = stdlib_base_secd( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break;