Skip to content
Open
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
23 changes: 3 additions & 20 deletions lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@

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


Expand Down Expand Up @@ -121,42 +120,26 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test

tape( 'the function evaluates the inverse of the lower regularized incomplete beta function', function test( t ) {
var expected;
var delta;
var tol;
var i;
var y;

expected = lowerRegularized;
for ( i = 0; i < x.length; i++ ) {
y = betaincinv( x[i], a[i], b[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+'. a: '+a[i]+'. b: '+b[i]+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 15.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
}
t.strictEqual(isAlmostSameValue( y, expected[ i ], 24 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the inverse of the upper regularized incomplete beta function', function test( t ) {
var expected;
var delta;
var tol;
var i;
var y;

expected = upperRegularized;
for ( i = 0; i < x.length; i++ ) {
y = betaincinv( x[i], a[i], b[i], true );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+'. a: '+a[i]+'. b: '+b[i]+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 15.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
}
t.strictEqual(isAlmostSameValue( y, expected[ i ], 16 ), true, 'returns expected value' );
}
t.end();
});