Skip to content
Open
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 cdf = require( './../lib' );


Expand Down Expand Up @@ -135,8 +134,7 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test
tape( 'the function evaluates the cdf for `x` given large `alpha`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 1;
var s;
var x;
var y;
Expand All @@ -148,22 +146,15 @@ tape( 'the function evaluates the cdf for `x` given large `alpha`', function tes
s = largeShape.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the cdf for `x` given large `s`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 16;
var s;
var x;
var y;
Expand All @@ -175,22 +166,15 @@ tape( 'the function evaluates the cdf for `x` given large `s`', function test( t
s = largeScale.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the cdf for `x` given large `alpha` and `s`', function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 5950;
var s;
var x;
var y;
Expand All @@ -202,13 +186,7 @@ tape( 'the function evaluates the cdf for `x` given large `alpha` and `s`', func
s = bothLarge.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', m: 0, y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 4100.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. m: 0. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});
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 factory = require( './../lib/factory.js' );


Expand Down Expand Up @@ -153,9 +152,8 @@ tape( 'if provided a nonpositive `s`, the created function always returns `NaN`'
tape( 'the created function evaluates the cdf for `x` given large `alpha`', function test( t ) {
var expected;
var alpha;
var delta;
var ULP = 1;
var cdf;
var tol;
var s;
var x;
var y;
Expand All @@ -168,23 +166,16 @@ tape( 'the created function evaluates the cdf for `x` given large `alpha`', func
for ( i = 0; i < x.length; i++ ) {
cdf = factory( alpha[i], s[i], 0.0 );
y = cdf( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', m: 0, y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. m: 0. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the created function evaluates the cdf for `x` given large `s`', function test( t ) {
var expected;
var alpha;
var delta;
var ULP = 16;
var cdf;
var tol;
var s;
var x;
var y;
Expand All @@ -197,23 +188,16 @@ tape( 'the created function evaluates the cdf for `x` given large `s`', function
for ( i = 0; i < x.length; i++ ) {
cdf = factory( alpha[i], s[i], 0.0 );
y = cdf( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha:'+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the created function evaluates the cdf for `x` given large `alpha` and `s`', function test( t ) {
var expected;
var alpha;
var delta;
var ULP = 5950;
var cdf;
var tol;
var s;
var x;
var y;
Expand All @@ -226,13 +210,7 @@ tape( 'the created function evaluates the cdf for `x` given large `alpha` and `s
for ( i = 0; i < x.length; i++ ) {
cdf = factory( alpha[i], s[i], 0.0 );
y = cdf( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), 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 @@ -144,8 +143,7 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio
tape( 'the function evaluates the cdf for `x` given large `alpha`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 1;
var s;
var x;
var y;
Expand All @@ -157,22 +155,15 @@ tape( 'the function evaluates the cdf for `x` given large `alpha`', opts, functi
s = largeShape.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the cdf for `x` given large `s`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 16;
var s;
var x;
var y;
Expand All @@ -184,22 +175,15 @@ tape( 'the function evaluates the cdf for `x` given large `s`', opts, function t
s = largeScale.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 10.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the cdf for `x` given large `alpha` and `s`', opts, function test( t ) {
var expected;
var alpha;
var delta;
var tol;
var ULP = 5950;
var s;
var x;
var y;
Expand All @@ -211,13 +195,7 @@ tape( 'the function evaluates the cdf for `x` given large `alpha` and `s`', opts
s = bothLarge.s;
for ( i = 0; i < x.length; i++ ) {
y = cdf( x[i], alpha[i], s[i], 0.0 );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', alpha: '+alpha[i]+', s: '+s[i]+', m: 0, y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 4100.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. alpha: '+alpha[i]+'. s: '+s[i]+'. y: '+y+'. m: 0. E: '+expected[ i ]+'. 螖: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP ), true, 'returns expected value' );
}
t.end();
});
Loading