Skip to content
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 @@ -21,11 +21,10 @@
// MODULES //

var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var stdev = require( './../lib' );


Expand Down Expand Up @@ -68,8 +67,6 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re

tape( 'the function returns the standard deviation of a geometric distribution', function test( t ) {
var expected;
var delta;
var tol;
var i;
var p;
var y;
Expand All @@ -78,13 +75,7 @@ tape( 'the function returns the standard deviation of a geometric distribution',
p = data.p;
for ( i = 0; i < expected.length; i++ ) {
y = stdev( p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[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. p: '+p[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@

var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
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 PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );


// VARIABLES //
Expand Down Expand Up @@ -77,8 +76,6 @@ tape( 'if provided a success probability `p` outside of `[0,1]`, the function re

tape( 'the function returns the standard deviation of a geometric distribution', opts, function test( t ) {
var expected;
var delta;
var tol;
var i;
var p;
var y;
Expand All @@ -87,13 +84,7 @@ tape( 'the function returns the standard deviation of a geometric distribution',
p = data.p;
for ( i = 0; i < expected.length; i++ ) {
y = stdev( p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[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. p: '+p[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});