From 4a25fb14a7cedb426e201984b219831ee14436ef Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Sat, 22 Feb 2025 20:52:50 +0530 Subject: [PATCH 1/5] bench: random value generatio --- 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: na - 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 --- --- .../special/bernoulli/benchmark/benchmark.js | 4 ++-- .../bernoulli/benchmark/benchmark.native.js | 4 ++-- .../special/betainc/benchmark/benchmark.js | 11 ++++++----- .../betainc/benchmark/c/cephes/benchmark.c | 17 ++++++++++------- .../special/betaincinv/benchmark/benchmark.js | 11 ++++++----- .../betaincinv/benchmark/c/cephes/benchmark.c | 18 +++++++++++------- .../base/special/betaln/benchmark/benchmark.js | 9 +++++---- .../betaln/benchmark/benchmark.native.js | 9 +++++---- .../betaln/benchmark/c/native/benchmark.c | 13 ++++++++----- .../special/binomcoefln/benchmark/benchmark.js | 10 +++++----- .../binomcoefln/benchmark/benchmark.native.js | 10 +++++----- .../binomcoefln/benchmark/c/native/benchmark.c | 13 ++++++++----- 12 files changed, 73 insertions(+), 56 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js index 8f609f4d53fe..a59090ddad8e 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var bernoulli = require( './../lib' ); @@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = randu( 100, 0, 500 ); + x = discreteUniform( 100, 0, 500 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js index 0f6b8df52bee..4b50860c56f2 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/array/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-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, 500 ); + x = discreteUniform( 100, 0, 500 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js index cb8be4d186c2..105edd62d979 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betainc/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 EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -37,12 +37,13 @@ bench( pkg, function benchmark( assert ) { var b; var i; + x = uniform( 100, 0.0, 1.0 ); + a = uniform( 100, EPS, 1000.0 ); + b = uniform( 100, EPS, 1000.0 ); + assert.tic(); for ( i = 0; i < assert.iterations; i++ ) { - x = randu(); - a = ( randu()*1000.0 ) + EPS; - b = ( randu()*1000.0 ) + EPS; - y = betainc( x, a, b ); + y = betainc( x[ i % x.length ], a[ i % a.length ], b[ i % b.length ] ); if ( isnan( y ) ) { assert.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c index 095065d6948e..38a0db8fac92 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c @@ -95,19 +95,22 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double a; - double b; + double x[ 100 ]; + double a[ 100 ]; + double b[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double(); + a[ i ] = ( 1000.0*rand_double() ) + 0.1; + b[ i ] = ( 1000.0*rand_double() ) + 0.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - a = ( 1000.0*rand_double() ) + 0.1; - b = ( 1000.0*rand_double() ) + 0.1; - y = incbet( a, b, x ); + y = incbet( a[ i%100 ], b[ i%100 ], x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js index 70f47888d694..64317059e8be 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/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 EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -37,12 +37,13 @@ bench( pkg, function benchmark( assert ) { var b; var i; + x = uniform( 100, 0.0, 1.0 ); + a = uniform( 100, EPS, 1000.0 ); + b = uniform( 100, EPS, 1000.0 ); + assert.tic(); for ( i = 0; i < assert.iterations; i++ ) { - x = randu(); - a = ( randu()*1000.0 ) + EPS; - b = ( randu()*1000.0 ) + EPS; - y = betaincinv( x, a, b ); + y = betaincinv( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ] ); if ( isnan( y ) ) { assert.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c index b62eec565485..46380a89ff76 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c @@ -95,19 +95,23 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double a; - double b; + double x[ 100 ]; + double a[ 100 ]; + double b[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double(); + a[ i ] = ( 1000.0*rand_double() ) + 0.1; + b[ i ] = ( 1000.0*rand_double() ) + 0.1; + } + + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double(); - a = ( 1000.0*rand_double() ) + 0.1; - b = ( 1000.0*rand_double() ) + 0.1; - y = incbi( a, b, x ); + y = incbi( a[ i%100 ], b[ i%100 ], x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js index 3d1d65b268f9..eb90b736671d 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/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 betaln = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, 0.0, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) - 0.0; - z = betaln( x, y ); + z = betaln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js index 6f7e5ff5af46..7b5bd471da77 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/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; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, 0.0, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 1000.0 ) - 0.0; - y = ( randu() * 1000.0 ) - 0.0; - z = betaln( x, y ); + z = betaln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c index a35f36466b01..a384728e84b2 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c @@ -91,17 +91,20 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = 1000.0 * rand_double() - 0.0; + y[ i ] = 1000.0 * rand_double() - 0.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = 1000.0 * rand_double() - 0.0; - y = 1000.0 * rand_double() - 0.0; - z = stdlib_base_betaln( x, y ); + z = stdlib_base_betaln( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js index 62ec4a6852f7..df074ea5bff0 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var binomcoefln = require( './../lib' ); @@ -36,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = discreteUniform( 100, 20, 70 ); + y = discreteUniform( 100, 0, 20 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = round( (randu()*50.0) + 20.0 ); - y = round( randu()*20.0 ); - z = binomcoefln( x, y ); + z = binomcoefln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js index 3a1a1639fd0a..bb623538760a 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/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 round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -45,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var z; var i; + x = discreteUniform( 100, 20, 70 ); + y = discreteUniform( 100, 0, 20 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = round( ( randu() * 50.0 ) + 20.0 ); - y = round( randu() * 20.0 ); - z = binomcoefln( x, y ); + z = binomcoefln( x[ i % x.length ], y[ i % y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c index 1fb3cd0480e7..c3da51b4be2f 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c @@ -91,17 +91,20 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - int64_t n; - int64_t k; + int64_t n[ 100 ]; + int64_t k[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + n[ i ] = (int64_t)round( 500.0 * rand_double() ); + k[ i ] = (int64_t)round( 500.0 * rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - n = (int64_t)round( 500.0 * rand_double() ); - k = (int64_t)round( 500.0 * rand_double() ); - y = stdlib_base_binomcoefln( n, k ); + y = stdlib_base_binomcoefln( n[ i%100 ], k[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; From c10c44ee0a19b945f8b82e7563a03f5a0451d0a0 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Sat, 22 Feb 2025 23:38:21 +0530 Subject: [PATCH 2/5] chore: refactor file and test file --- 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: na - 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: failed --- --- 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: failed --- --- .../bernoulli/benchmark/c/native/benchmark.c | 2 +- .../betainc/benchmark/c/cephes/benchmark.c | 2 +- .../math/base/special/betainc/test/test.js | 10 ++--- .../betaincinv/benchmark/c/cephes/benchmark.c | 3 +- .../math/base/special/betaincinv/test/test.js | 38 +++++++++---------- .../betaln/benchmark/c/native/benchmark.c | 2 +- .../base/special/betaln/test/test.dceval.js | 8 ++-- .../math/base/special/betaln/test/test.js | 8 ++-- .../benchmark/c/native/benchmark.c | 2 +- .../base/special/binomcoefln/test/test.js | 4 +- 10 files changed, 39 insertions(+), 40 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c index 7e84c857608a..075794f585dc 100644 --- a/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/bernoulli/benchmark/c/native/benchmark.c @@ -90,8 +90,8 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; double x[ 100 ]; + double elapsed; double y; double t; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c index 38a0db8fac92..f805033e383d 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betainc/benchmark/c/cephes/benchmark.c @@ -94,10 +94,10 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; double x[ 100 ]; double a[ 100 ]; double b[ 100 ]; + double elapsed; double y; double t; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js b/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js index da1d7ef985de..c91a679caf26 100644 --- a/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betainc/test/test.js @@ -49,23 +49,23 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if `x` is outside `[0,1]`', function test( t ) { var val = betainc( -0.2, 1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 1.1, 1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` negative `a` or `b`', function test( t ) { var val = betainc( 0.5, -1.0, 1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 0.5, 1.0, -1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); val = betainc( 0.5, -1.0, -1.0 ); - t.equal( isnan( val ), true, 'returns NaN' ); + t.equal( isnan( val ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c index 46380a89ff76..9a46ddae5ef0 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/benchmark/c/cephes/benchmark.c @@ -94,10 +94,10 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; double x[ 100 ]; double a[ 100 ]; double b[ 100 ]; + double elapsed; double y; double t; int i; @@ -108,7 +108,6 @@ static double benchmark( void ) { b[ i ] = ( 1000.0*rand_double() ) + 0.1; } - t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { y = incbi( a[ i%100 ], b[ i%100 ], x[ i%100 ] ); diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js index a7c9dc3556c9..3a33711ac869 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js @@ -49,22 +49,22 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = betaincinv( NaN, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.2, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.2, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if `p` is outside the interval `[0,1]`', function test( t ) { var y = betaincinv( 1.5, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( -0.5, 1.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -72,25 +72,25 @@ tape( 'if provided a nonpositive `a`, the function returns `NaN`', function test var y; y = betaincinv( 0.5, 0.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, -1.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, -1.0, 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, PINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -99,25 +99,25 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test var y; y = betaincinv( 0.5, 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 2.0, -1/0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = betaincinv( 0.5, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c index a384728e84b2..594592bee225 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c @@ -90,9 +90,9 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; double x[ 100 ]; double y[ 100 ]; + double elapsed; double z; double t; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js index cecfe35cd480..92226c95e726 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.dceval.js @@ -35,16 +35,16 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided `x` outside `[-1.1,1.1]`', function test( t ) { var y = dceval( 1.5, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( 1.11, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( -1.11, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = dceval( -1.5, [1, 2, 3] ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js index d7c4c57f479f..7514b3d59151 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaln/test/test.js @@ -57,17 +57,17 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var val = betaln( NaN, 2.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); val = betaln( 2.0, NaN ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided negative values', function test( t ) { var val = betaln( -2.0, 5.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); val = betaln( 4.0, -3.0 ); - t.ok( isnan( val ), 'returns NaN' ); + t.ok( isnan( val ), 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c index c3da51b4be2f..63f885e29267 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c @@ -90,9 +90,9 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; int64_t n[ 100 ]; int64_t k[ 100 ]; + double elapsed; double y; double t; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js b/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js index 9e3668763609..7a1f6009f33a 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/test/test.js @@ -99,7 +99,7 @@ tape( 'the function returns `NaN` if the `n` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.equal( isnan( binomcoefln( values[i], 2 ) ), true, 'returns NaN when provided '+values[i] ); + t.equal( isnan( binomcoefln( values[i], 2 ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); }); @@ -120,7 +120,7 @@ tape( 'the function returns `NaN` if the `k` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.equal( isnan( binomcoefln( 2, values[i] ) ), true, 'returns NaN when provided '+values[i] ); + t.equal( isnan( binomcoefln( 2, values[i] ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); }); From 6de0ca4c4a36370f84c785dcfb7546d14c4b1f94 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Sun, 23 Feb 2025 03:04:45 +0530 Subject: [PATCH 3/5] chore: improve order in binomcoefln/benchmark --- 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: na - task: lint_javascript_benchmarks status: na - 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 --- --- .../base/special/binomcoefln/benchmark/c/native/benchmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c index 63f885e29267..147cc86e02af 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c @@ -90,11 +90,11 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - int64_t n[ 100 ]; - int64_t k[ 100 ]; double elapsed; double y; double t; + int64_t n[ 100 ]; + int64_t k[ 100 ]; int i; for ( i = 0; i < 100; i++ ) { From d3b7613ed9732e379bdaeb1a6dbd9fbb0bec960f Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 25 Feb 2025 14:21:20 -0800 Subject: [PATCH 4/5] refactor: remove noops Signed-off-by: Athan --- .../math/base/special/betaln/benchmark/c/native/benchmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c index 594592bee225..00111e64f84e 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/betaln/benchmark/c/native/benchmark.c @@ -98,8 +98,8 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - x[ i ] = 1000.0 * rand_double() - 0.0; - y[ i ] = 1000.0 * rand_double() - 0.0; + x[ i ] = 1000.0 * rand_double(); + y[ i ] = 1000.0 * rand_double(); } t = tic(); From da5f6b74202bf03090a8594f03085240f066d2ca Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 25 Feb 2025 14:22:38 -0800 Subject: [PATCH 5/5] bench: reorder declarations Signed-off-by: Athan --- .../base/special/binomcoefln/benchmark/c/native/benchmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c index 147cc86e02af..63f885e29267 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoefln/benchmark/c/native/benchmark.c @@ -90,11 +90,11 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + int64_t n[ 100 ]; + int64_t k[ 100 ]; double elapsed; double y; double t; - int64_t n[ 100 ]; - int64_t k[ 100 ]; int i; for ( i = 0; i < 100; i++ ) {