Skip to content

chore: address commit comments #5219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var bench = require( '@stdlib/bench' );
var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var tryRequire = require( '@stdlib/utils/try-require' );
var ceil = require( '@stdlib/math/base/special/ceil' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/base/uniform' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;

Expand All @@ -52,8 +52,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
n = new Int32Array( len );
p = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
n[ i ] = ceil( randu() * 100.0 );
p[ i ] = randu();
n[ i ] = discreteUniform( 1, 100 );
p[ i ] = uniform( 0.0, 1.0 );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var tryRequire = require( '@stdlib/utils/try-require' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float64/eps' );


// FIXTURES //
Expand Down Expand Up @@ -75,8 +73,6 @@ tape( 'if provided `n < 0` or success probability `p` outside of `[0,1]`, the fu

tape( 'the function returns the mean of a binomial distribution', opts, function test( t ) {
var expected;
var delta;
var tol;
var i;
var n;
var p;
Expand All @@ -87,13 +83,7 @@ tape( 'the function returns the mean of a binomial distribution', opts, function
p = data.p;
for ( i = 0; i < expected.length; i++ ) {
y = mean( n[i], p[i] );
if ( y === expected[i] ) {
t.equal( y, expected[i], 'n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. n: '+n[i]+'. p: '+p[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.equal( y, expected[i], 'n: '+n[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] );
}
t.end();
});