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,8 +21,7 @@
// MODULES //

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


Expand All @@ -41,8 +40,6 @@ tape( 'main export is a function', function test( t ) {

tape( 'the function evaluates the inverse of the lower regularized incomplete beta function', function test( t ) {
var expected;
var delta;
var tol;
var y;
var i;
var a;
Expand All @@ -55,13 +52,7 @@ tape( 'the function evaluates the inverse of the lower regularized incomplete be
expected = data.y;
for ( i = 0; i < p.length; i++ ) {
y = kernelBetaincinv( a[i], b[i], p[i], 1.0-p[i] )[ 0 ];
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'a: '+a[i]+'. b: '+b[i]+'. p: '+p[i]+', y: '+y+'. expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 15.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. a: '+a[i]+'. b: '+b[i]+'. p: '+p[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 20 ), true, 'returns expected value' );
}
t.end();
});
Loading