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
87 changes: 15 additions & 72 deletions lib/node_modules/@stdlib/math/base/special/sici/test/test.assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
// 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 HALF_PI = require( '@stdlib/constants/float64/half-pi' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var Float64Array = require( '@stdlib/array/float64' );
var sici = require( './../lib/assign.js' );

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

tape( 'the function computes the sine and cosine integrals for small positive numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -68,21 +65,13 @@ tape( 'the function computes the sine and cosine integrals for small positive nu
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for medium positive numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -98,21 +87,13 @@ tape( 'the function computes the sine and cosine integrals for medium positive n
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 60.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 60.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 64 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for large positive numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -128,21 +109,13 @@ tape( 'the function computes the sine and cosine integrals for large positive nu
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 1 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for small negative numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -158,21 +131,13 @@ tape( 'the function computes the sine and cosine integrals for small negative nu
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for medium negative numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -188,21 +153,13 @@ tape( 'the function computes the sine and cosine integrals for medium negative n
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 60.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 60.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 64 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for large negative numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -218,21 +175,13 @@ tape( 'the function computes the sine and cosine integrals for large negative nu
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 1 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for very large positive numbers', function test( t ) {
var delta;
var tol;
var out;
var si;
var ci;
Expand All @@ -248,14 +197,8 @@ tape( 'the function computes the sine and cosine integrals for very large positi
out = [ 0.0, 0.0 ];
v = sici( x[ i ], out, 1, 0 );
t.strictEqual( v, out, 'returns output array' );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
87 changes: 15 additions & 72 deletions lib/node_modules/@stdlib/math/base/special/sici/test/test.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
// MODULES //

var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isArray = require( '@stdlib/assert/is-array' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var HALF_PI = require( '@stdlib/constants/float64/half-pi' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var sici = require( './../lib/main.js' );


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

tape( 'the function computes the sine and cosine integrals for small positive numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -65,21 +62,13 @@ tape( 'the function computes the sine and cosine integrals for small positive nu

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for medium positive numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -92,21 +81,13 @@ tape( 'the function computes the sine and cosine integrals for medium positive n

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 60.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 60.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 64 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for large positive numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -119,21 +100,13 @@ tape( 'the function computes the sine and cosine integrals for large positive nu

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 1 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for small negative numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -146,21 +119,13 @@ tape( 'the function computes the sine and cosine integrals for small negative nu

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for medium negative numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -173,21 +138,13 @@ tape( 'the function computes the sine and cosine integrals for medium negative n

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 60.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 60.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 64 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for large negative numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -200,21 +157,13 @@ tape( 'the function computes the sine and cosine integrals for large negative nu

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 1 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the sine and cosine integrals for very large positive numbers', function test( t ) {
var delta;
var tol;
var si;
var ci;
var x;
Expand All @@ -227,14 +176,8 @@ tape( 'the function computes the sine and cosine integrals for very large positi

for ( i = 0; i < x.length; i++ ) {
v = sici( x[ i ] );

delta = abs( v[ 0 ] - si[ i ] );
tol = 2.0 * EPS * abs( si[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. SI: ' + v[ 0 ] + '. Expected: ' + si[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );

delta = abs( v[ 1 ] - ci[ i ] );
tol = 2.0 * EPS * abs( ci[ i ] );
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. CI: ' + v[ 1 ] + '. Expected: ' + ci[ i ] + '. tol: ' + tol + '. delta: ' + delta + '.' );
t.strictEqual( isAlmostSameValue( v[ 0 ], si[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( v[ 1 ], ci[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});
Expand Down