diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.js index 46ca8dff3d55..0c674e0d7425 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var float64ToInt32 = require( '@stdlib/number/float64/base/to-float32' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pkg = require( './../package.json' ).name; var isEven = require( './../lib' ); @@ -31,14 +30,19 @@ var isEven = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { + var opts; var x; var y; var i; + opts = { + 'dtype': 'int32' + }; + x = discreteUniform( 100, -5.0e6, 5.0e6, opts ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = isEven( float64ToInt32( x ) ); + y = isEven( x[ i%x.length ] ); if ( typeof y !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.native.js index ad824966af8f..e04d42dcf19b 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var float64ToInt32 = require( '@stdlib/number/float64/base/to-float32' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -40,14 +39,19 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { + var opts; var x; var y; var i; + opts = { + 'dtype': 'int32' + }; + x = discreteUniform( 100, -5.0e6, 5.0e6, opts ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = iseven( float64ToInt32( x ) ); + y = iseven( x[ i%x.length ] ); if ( typeof y !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/c/native/benchmark.c index 57b13bb7ab57..d6127d3099d6 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/benchmark/c/native/benchmark.c @@ -93,15 +93,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double t; bool b; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_double() * 200.0 ) - 100.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( rand_double() * 200.0 ) - 100.0; - b = stdlib_base_int32_is_even( (int32_t)x ); + b = stdlib_base_int32_is_even( (int32_t)x[ i%100 ] ); if ( b != true && b != false ) { printf( "should return either true or false\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.js index 584f6a5e1a94..79296145503a 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.js @@ -43,7 +43,7 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `true` if provided `0`', function test( t ) { var bool = isEven( 0 ); - t.strictEqual( bool, true, 'returns true when provided 0' ); + t.strictEqual( bool, true, 'returns expected value' ); t.end(); }); @@ -55,7 +55,7 @@ tape( 'the function returns `true` if provided an even integer', function test( x = round( randu()*MAX_INT32 ) - HALF_MAX_INT32 - 1; x *= 2; // always even bool = isEven( x ); - t.strictEqual( bool, true, 'returns true when provided '+x ); + t.strictEqual( bool, true, 'returns expected value when provided '+x ); } t.end(); }); @@ -73,7 +73,7 @@ tape( 'the function returns `false` if provided an odd integer', function test( x += 1; } bool = isEven( x ); - t.strictEqual( bool, false, 'returns false when provided '+x ); + t.strictEqual( bool, false, 'returns expected value when provided '+x ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.native.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.native.js index 465099c38177..8be87589e2e4 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-even/test/test.native.js @@ -48,7 +48,7 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `true` if provided `0`', opts, function test( t ) { var bool = iseven( 0 ); - t.strictEqual( bool, true, 'returns true when provided 0' ); + t.strictEqual( bool, true, 'returns expected value' ); t.end(); }); @@ -60,7 +60,7 @@ tape( 'the function returns `true` if provided an even integer', opts, function x = round( randu()*MAX_INT32 ) - HALF_MAX_INT32 - 1; x *= 2; // always even bool = iseven( x ); - t.strictEqual( bool, true, 'returns true when provided '+x ); + t.strictEqual( bool, true, 'returns expected value when provided '+x ); } t.end(); }); @@ -78,7 +78,7 @@ tape( 'the function returns `false` if provided an odd integer', opts, function x += 1; } bool = iseven( x ); - t.strictEqual( bool, false, 'returns false when provided '+x ); + t.strictEqual( bool, false, 'returns expected value when provided '+x ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.js index 0e811185ff79..2a87ca5fc5f4 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var float64ToInt32 = require( '@stdlib/number/float64/base/to-float32' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pkg = require( './../package.json' ).name; var isOdd = require( './../lib' ); @@ -31,14 +30,19 @@ var isOdd = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { + var opts; var x; var y; var i; + opts = { + 'dtype': 'int32' + }; + x = discreteUniform( 100, -5.0e6, 5.0e6, opts ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = isOdd( float64ToInt32( x ) ); + y = isOdd( x[ i%x.length ] ); if ( typeof y !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.native.js index 14dada1ed32a..eb92eceeb30c 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var float64ToInt32 = require( '@stdlib/number/float64/base/to-float32' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -40,14 +39,19 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { + var opts; var x; var y; var i; + opts = { + 'dtype': 'int32' + }; + x = discreteUniform( 100, -5.0e6, 5.0e6, opts ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1.0e7 ) - 5.0e6; - y = isOdd( float64ToInt32( x ) ); + y = isOdd( x[ i%x.length ] ); if ( typeof y !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/c/native/benchmark.c index 271c00e88975..de03611cb6ac 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/benchmark/c/native/benchmark.c @@ -93,15 +93,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double t; bool b; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_double() * 200.0 ) - 100.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( rand_double() * 200.0 ) - 100.0; - b = stdlib_base_int32_is_odd( (int32_t)x ); + b = stdlib_base_int32_is_odd( (int32_t)x[ i%100 ] ); if ( b != true && b != false ) { printf( "should return either true or false\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.js index a4f7b9571875..d13446348646 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.js @@ -43,7 +43,7 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `false` if provided `0`', function test( t ) { var bool = isOdd( 0 ); - t.strictEqual( bool, false, 'returns false when provided 0' ); + t.strictEqual( bool, false, 'returns expected value' ); t.end(); }); @@ -55,7 +55,7 @@ tape( 'the function returns `false` if provided an even integer', function test( x = round( randu()*MAX_INT32 ) - HALF_MAX_INT32 - 1; x *= 2; // always even bool = isOdd( x ); - t.strictEqual( bool, false, 'returns false when provided '+x ); + t.strictEqual( bool, false, 'returns expected value when provided '+x ); } t.end(); }); @@ -73,7 +73,7 @@ tape( 'the function returns `true` if provided an odd integer', function test( t x += 1; } bool = isOdd( x ); - t.strictEqual( bool, true, 'returns true when provided '+x ); + t.strictEqual( bool, true, 'returns expected value when provided '+x ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.native.js b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.native.js index d6564f23c2e4..1d50b0961cfa 100644 --- a/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/assert/int32-is-odd/test/test.native.js @@ -48,7 +48,7 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function returns `false` if provided `0`', opts, function test( t ) { var bool = isOdd( 0 ); - t.strictEqual( bool, false, 'returns false when provided 0' ); + t.strictEqual( bool, false, 'returns expected value' ); t.end(); }); @@ -60,7 +60,7 @@ tape( 'the function returns `false` if provided an even integer', opts, function x = round( randu()*MAX_INT32 ) - HALF_MAX_INT32 - 1; x *= 2; // always even bool = isOdd( x ); - t.strictEqual( bool, false, 'returns false when provided '+x ); + t.strictEqual( bool, false, 'returns expected value when provided '+x ); } t.end(); }); @@ -78,7 +78,7 @@ tape( 'the function returns `true` if provided an odd integer', opts, function t x += 1; } bool = isOdd( x ); - t.strictEqual( bool, true, 'returns true when provided '+x ); + t.strictEqual( bool, true, 'returns expected value when provided '+x ); } t.end(); });