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

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


Expand Down Expand Up @@ -61,8 +60,6 @@ tape( 'if provided a degrees of freedom `k` that is not a nonnegative number, th

tape( 'the function returns the median of chi-squared distribution', function test( t ) {
var expected;
var delta;
var tol;
var k;
var i;
var y;
Expand All @@ -71,13 +68,7 @@ tape( 'the function returns the median of chi-squared distribution', function te
k = data.k;
for ( i = 0; i < expected.length; i++ ) {
y = median( k[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'k: '+k[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 25.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. k: '+k[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 39 ), true, 'returns expected value' );
}
t.end();
});