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
82 changes: 9 additions & 73 deletions lib/node_modules/@stdlib/math/base/special/bessely1/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
// MODULES //

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


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

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -63,21 +61,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = veryLargePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 300.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 254 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -86,21 +76,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = largePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 600.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 689 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -109,21 +91,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = mediumPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 300.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 395 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -132,21 +106,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = smallPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1800.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2338 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -155,21 +121,13 @@ tape( 'the function evaluates Bessel function of the second kind of one order (Y
x = smaller.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 4.5 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 5 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -178,13 +136,7 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = tinyPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 8.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand All @@ -204,8 +156,6 @@ tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal valu

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -214,21 +164,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = hugePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 4500.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1200 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -237,13 +179,7 @@ tape( 'the function evaluates the Bessel function of the second kind of order on
x = positiveGamut.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 16.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 27 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var randu = require( '@stdlib/random/base/randu' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -62,8 +62,6 @@ tape( 'main export is a function', opts, function test( t ) {

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -72,21 +70,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = veryLargePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 300.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 254 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -95,21 +85,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = largePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 600.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 689 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -118,21 +100,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = mediumPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 300.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 395 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -141,21 +115,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = smallPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1800.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2338 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -164,21 +130,13 @@ tape( 'the function evaluates Bessel function of the second kind of one order (Y
x = smaller.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 4.5 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 5 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -187,13 +145,7 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = tinyPositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 8.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand All @@ -213,8 +165,6 @@ tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal valu

tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -223,21 +173,13 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
x = hugePositive.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 4500.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1200 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -246,13 +188,7 @@ tape( 'the function evaluates the Bessel function of the second kind of order on
x = positiveGamut.x;
for ( i = 0; i < x.length; i++ ) {
y = y1( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 16.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 27 ), true, 'returns expected value' );
}
t.end();
});
Expand Down