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
47 changes: 9 additions & 38 deletions lib/node_modules/@stdlib/math/base/special/ellipk/test/test.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 PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var HALF_PI = require( '@stdlib/constants/float64/half-pi' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var ellipk = require( './../lib' );


Expand All @@ -48,92 +47,64 @@

tape( 'the function evaluates the complete elliptic integral of the first kind (medium positive values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = mediumPositive.expected;
x = mediumPositive.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 25.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 ], 25 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (values close to positive unity)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = closeToUnity.expected;
x = closeToUnity.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 8000.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 ], 12065 ), true, 'returns expected value' ); // FIXME: investigate the reason for this large discrepancy

Check warning on line 75 in lib/node_modules/@stdlib/math/base/special/ellipk/test/test.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: investigate the reason for this...'
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (medium negative values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = mediumNegative.expected;
x = mediumNegative.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 1.5 * 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 ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (large negative values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = largeNegative.expected;
x = largeNegative.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 1e9 * 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 ], 204773163 ), true, 'returns expected value' ); // FIXME: investigate the reason for this large discrepancy

Check warning on line 107 in lib/node_modules/@stdlib/math/base/special/ellipk/test/test.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: investigate the reason for this...'
}
t.end();
});
Expand Down
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 isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var HALF_PI = require( '@stdlib/constants/float64/half-pi' );
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 @@ -57,92 +56,64 @@

tape( 'the function evaluates the complete elliptic integral of the first kind (medium positive values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = mediumPositive.expected;
x = mediumPositive.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 25.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 ], 25 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (values close to positive unity)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = closeToUnity.expected;
x = closeToUnity.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 8000.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 ], 12065 ), true, 'returns expected value' ); // FIXME: investigate the reason for this large discrepancy

Check warning on line 84 in lib/node_modules/@stdlib/math/base/special/ellipk/test/test.native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: investigate the reason for this...'
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (medium negative values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = mediumNegative.expected;
x = mediumNegative.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 1.5 * 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 ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the complete elliptic integral of the first kind (large negative values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;

expected = largeNegative.expected;
x = largeNegative.x;

for ( i = 0; i < x.length; i++ ) {
y = ellipk( 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 = 1e9 * 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 ], 204773163 ), true, 'returns expected value' ); // FIXME: investigate the reason for this large discrepancy

Check warning on line 116 in lib/node_modules/@stdlib/math/base/special/ellipk/test/test.native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: investigate the reason for this...'
}
t.end();
});
Expand Down