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 @@ -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 factory = require( './../lib/factory.js' );


Expand Down Expand Up @@ -129,8 +128,6 @@ tape( 'the created function evaluates the quantile function for `p` given large
var quantile;
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -143,13 +140,7 @@ tape( 'the created function evaluates the quantile function for `p` given large
for ( i = 0; i < p.length; i++ ) {
quantile = factory( alpha[i], s[i], 0.0 );
y = quantile( p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[i]+', m: 0, 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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. m: 0. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
Expand All @@ -158,8 +149,6 @@ tape( 'the created function evaluates the quantile function for `p` given large
var quantile;
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -172,13 +161,7 @@ tape( 'the created function evaluates the quantile function for `p` given large
for ( i = 0; i < p.length; i++ ) {
quantile = factory( alpha[i], s[i], 0.0 );
y = quantile( p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha:'+alpha[i]+', s: '+s[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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
Expand All @@ -187,8 +170,6 @@ tape( 'the created function evaluates the quantile function for `p` given large
var quantile;
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -201,13 +182,7 @@ tape( 'the created function evaluates the quantile function for `p` given large
for ( i = 0; i < p.length; i++ ) {
quantile = factory( alpha[i], s[i], 0.0 );
y = quantile( p[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha:'+alpha[i]+', s: '+s[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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), 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 abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var tryRequire = require( '@stdlib/utils/try-require' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );


// FIXTURES //
Expand Down Expand Up @@ -134,8 +133,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio
tape( 'the function evaluates the quantile for `p` given large `alpha`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var p;
var s;
var y;
Expand All @@ -147,22 +144,14 @@ tape( 'the function evaluates the quantile for `p` given large `alpha`', opts, f
s = largeShape.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 300.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the quantile for `p` given large `s`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var p;
var s;
var y;
Expand All @@ -174,22 +163,14 @@ tape( 'the function evaluates the quantile for `p` given large `s`', opts, funct
s = largeScale.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 1500.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the quantile for `p` given large `alpha` and `s`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var p;
var s;
var y;
Expand All @@ -201,13 +182,7 @@ tape( 'the function evaluates the quantile for `p` given large `alpha` and `s`',
s = bothLarge.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 4100.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
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 quantile = require( './../lib' );


Expand Down Expand Up @@ -121,8 +120,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test
tape( 'the function evaluates the quantile function for `p` given large `alpha`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -134,22 +131,14 @@ tape( 'the function evaluates the quantile function for `p` given large `alpha`'
s = largeShape.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the quantile function for `p` given large `s`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -161,22 +150,14 @@ tape( 'the function evaluates the quantile function for `p` given large `s`', fu
s = largeScale.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the quantile function for `p` given large `alpha` and `s`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var s;
var p;
var y;
Expand All @@ -188,13 +169,7 @@ tape( 'the function evaluates the quantile function for `p` given large `alpha`
s = bothLarge.s;
for ( i = 0; i < p.length; i++ ) {
y = quantile( p[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'p: '+p[i]+', alpha: '+alpha[i]+', s: '+s[i]+', m: 0, 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 ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. m: 0. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
Loading