From bb86200e8cb773e2112c083bc487a052ef3f47a6 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 22 Feb 2025 22:18:50 -0800 Subject: [PATCH] refactor: benchmarks and test messages --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../math/base/special/ahavercos/benchmark/benchmark.js | 7 ++++--- .../base/special/ahavercos/benchmark/benchmark.native.js | 7 ++++--- .../math/base/special/ahavercos/benchmark/c/benchmark.c | 9 ++++++--- .../special/ahavercos/benchmark/c/native/benchmark.c | 9 ++++++--- .../@stdlib/math/base/special/ahavercos/test/test.js | 6 +++--- .../math/base/special/ahavercos/test/test.native.js | 6 +++--- .../math/base/special/ahavercosf/benchmark/benchmark.js | 6 ++++-- .../special/ahavercosf/benchmark/benchmark.native.js | 6 ++++-- .../math/base/special/ahavercosf/benchmark/c/benchmark.c | 4 ++-- .../special/ahavercosf/benchmark/c/native/benchmark.c | 4 ++-- .../math/base/special/ahaversin/benchmark/benchmark.js | 7 ++++--- .../base/special/ahaversin/benchmark/benchmark.native.js | 7 ++++--- .../math/base/special/ahaversin/benchmark/c/benchmark.c | 9 ++++++--- .../special/ahaversin/benchmark/c/native/benchmark.c | 9 ++++++--- .../@stdlib/math/base/special/ahaversin/test/test.js | 6 +++--- .../math/base/special/ahaversin/test/test.native.js | 6 +++--- .../math/base/special/ahaversinf/benchmark/benchmark.js | 6 ++++-- .../special/ahaversinf/benchmark/benchmark.native.js | 6 ++++-- .../math/base/special/ahaversinf/benchmark/c/benchmark.c | 4 ++-- .../special/ahaversinf/benchmark/c/native/benchmark.c | 4 ++-- 20 files changed, 76 insertions(+), 52 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.js index 1443a58a3316..f6e1c3177b2f 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/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 ahavercos = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, 1.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = ahavercos( x ); + y = ahavercos( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.native.js index 4bfb6aa615db..5d66dfb02f03 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/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, 0.0, 1.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = ahavercos( x ); + y = ahavercos( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/benchmark.c index 6fecacec9264..5e3ea85a6500 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/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 ] = rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - y = 2.0 * acos( sqrt( x ) ); + y = 2.0 * acos( sqrt( x[ i%100 ] ) ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/native/benchmark.c index af90531d9588..b3457a2b552b 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/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 ] = rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - y = stdlib_base_ahavercos( x ); + y = stdlib_base_ahavercos( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.js b/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.js index 08fd45123eea..1479faacdf64 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.js @@ -92,7 +92,7 @@ tape( 'the function computes the inverse half-value versed cosine (small positiv tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = ahavercos( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -101,7 +101,7 @@ tape( 'the function returns `NaN` if provided a value less than `0`', function t var i; for ( i = 0; i < 1e4; i++ ) { v = -(randu()*1.0e6) - EPS; - t.strictEqual( isnan( ahavercos( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahavercos( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); @@ -111,7 +111,7 @@ tape( 'the function returns `NaN` if provided a value greater than `1`', functio var i; for ( i = 0; i < 1e4; i++ ) { v = (randu()*1.0e6) + 1.0 + EPS; - t.strictEqual( isnan( ahavercos( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahavercos( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.native.js index a220db6154bb..e477c4394b24 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercos/test/test.native.js @@ -101,7 +101,7 @@ tape( 'the function computes the inverse half-value versed cosine (small positiv tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = ahavercos( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -110,7 +110,7 @@ tape( 'the function returns `NaN` if provided a value less than `0`', opts, func var i; for ( i = 0; i < 1e4; i++ ) { v = -(randu()*1.0e6) - EPS; - t.strictEqual( isnan( ahavercos( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahavercos( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); @@ -120,7 +120,7 @@ tape( 'the function returns `NaN` if provided a value greater than `1`', opts, f var i; for ( i = 0; i < 1e4; i++ ) { v = (randu()*1.0e6) + 1.0 + EPS; - t.strictEqual( isnan( ahavercos( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahavercos( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.js index fa4c5c33aa89..22bda78cd2e1 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercosf/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 ahavercosf = require( './../lib' ); @@ -34,7 +34,9 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 1.0 ); + x = uniform( 100, 0.0, 1.0, { + 'dtype': 'float32' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.native.js index 96b013d3e45f..d1520b249bbb 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahavercosf/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,9 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 1.0 ); + x = uniform( 100, 0.0, 1.0, { + 'dtype': 'float32' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/benchmark.c index f5972a2f1366..fffafb56b37f 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/benchmark.c @@ -90,8 +90,8 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x[ 100 ]; double t; + float x[ 100 ]; float y; int i; @@ -101,7 +101,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = 2.0f * acosf( sqrtf( x[ i % 100 ] ) ); + y = 2.0f * acosf( sqrtf( x[ i%100 ] ) ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/native/benchmark.c index 86cccb757a58..ff664149b451 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahavercosf/benchmark/c/native/benchmark.c @@ -91,8 +91,8 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x[ 100 ]; double t; + float x[ 100 ]; float y; int i; @@ -102,7 +102,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_ahavercosf( x[ i % 100 ] ); + y = stdlib_base_ahavercosf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.js index 3264ae4504ab..5f5fe7760c16 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/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 ahaversin = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, 0.0, 1.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = ahaversin( x ); + y = ahaversin( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.native.js index ef64cff36b71..b4a09bfd38af 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/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, 0.0, 1.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = ahaversin( x ); + y = ahaversin( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/benchmark.c index 0f35759af789..d36e4cf45265 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/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 ] = rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - y = 2.0 * asin( sqrt( x ) ); + y = 2.0 * asin( sqrt( x[ i%100 ] ) ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/native/benchmark.c index 0b0604415eb6..ef877333e1c7 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/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 ] = rand_double(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - y = stdlib_base_ahaversin( x ); + y = stdlib_base_ahaversin( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.js b/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.js index 813943057824..9a9c40d19147 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.js @@ -92,7 +92,7 @@ tape( 'the function computes the inverse half-value versed sine (small positive tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = ahaversin( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -101,7 +101,7 @@ tape( 'the function returns `NaN` if provided a value less than `0`', function t var i; for ( i = 0; i < 1e4; i++ ) { v = -(randu()*1.0e6) - EPS; - t.strictEqual( isnan( ahaversin( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahaversin( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); @@ -111,7 +111,7 @@ tape( 'the function returns `NaN` if provided a value greater than `1`', functio var i; for ( i = 0; i < 1e4; i++ ) { v = (randu()*1.0e6) + 1.0 + EPS; - t.strictEqual( isnan( ahaversin( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahaversin( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.native.js index 2707a33529a2..14f6d85edacb 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversin/test/test.native.js @@ -101,7 +101,7 @@ tape( 'the function computes the inverse half-value versed sine (small positive tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = ahaversin( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -110,7 +110,7 @@ tape( 'the function returns `NaN` if provided a value less than `0`', opts, func var i; for ( i = 0; i < 1e4; i++ ) { v = -(randu()*1.0e6) - EPS; - t.strictEqual( isnan( ahaversin( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahaversin( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); @@ -120,7 +120,7 @@ tape( 'the function returns `NaN` if provided a value greater than `1`', opts, f var i; for ( i = 0; i < 1e4; i++ ) { v = (randu()*1.0e6) + 1.0 + EPS; - t.strictEqual( isnan( ahaversin( v ) ), true, 'returns NaN when provided '+v ); + t.strictEqual( isnan( ahaversin( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.js index 00fb0b443552..05045283e371 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversinf/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 ahaversinf = require( './../lib' ); @@ -34,7 +34,9 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 1.0 ); + x = uniform( 100, 0.0, 1.0, { + 'dtype': 'float32' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.native.js index 10a479caffca..c98398cb2290 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ahaversinf/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,9 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = randu( 100, 0.0, 1.0 ); + x = uniform( 100, 0.0, 1.0, { + 'dtype': 'float32' + }); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/benchmark.c index 31d4e0703445..1a325305cc76 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/benchmark.c @@ -90,8 +90,8 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x[ 100 ]; double t; + float x[ 100 ]; float y; int i; @@ -101,7 +101,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = 2.0f * asinf( sqrtf( x[ i % 100 ] ) ); + y = 2.0f * asinf( sqrtf( x[ i%100 ] ) ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/native/benchmark.c index bd5ff2f1786e..55eebfcc587b 100644 --- a/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ahaversinf/benchmark/c/native/benchmark.c @@ -91,8 +91,8 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x[ 100 ]; double t; + float x[ 100 ]; float y; int i; @@ -102,7 +102,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_ahaversinf( x[ i % 100 ] ); + y = stdlib_base_ahaversinf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break;