Skip to content
Merged
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 @@ -23,8 +23,7 @@
var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float64/eps' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var rempio2 = require( '@stdlib/math/base/special/rempio2' );
var tryRequire = require( '@stdlib/utils/try-require' );

Expand Down Expand Up @@ -84,8 +83,6 @@ tape( 'the function evaluates the cosine for input values on the interval `[-pi/
tape( 'the function can be used to compute the cosine for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (positive)', opts, function test( t ) {
var expected;
var values;
var delta;
var tol;
var out;
var x;
var y;
Expand All @@ -105,15 +102,9 @@ tape( 'the function can be used to compute the cosine for input values outside o
break;
case 2:
out = -kernelCos( y[ 0 ], y[ 1 ] );
if ( out === expected[ i ] ) {
t.strictEqual( out, expected[ i ], 'returns expected value' );
} else {
delta = abs( out - expected[ i ] );

// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. out: '+out+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}

// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
t.strictEqual( isAlmostSameValue( out, expected[ i ], 1 ), true, 'returns expected value' );
break;
default:
break;
Expand All @@ -125,8 +116,6 @@ tape( 'the function can be used to compute the cosine for input values outside o
tape( 'the function can be used to compute the cosine for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (negative)', opts, function test( t ) {
var expected;
var values;
var delta;
var tol;
var out;
var x;
var y;
Expand All @@ -146,15 +135,9 @@ tape( 'the function can be used to compute the cosine for input values outside o
break;
case 2:
out = -kernelCos( y[ 0 ], y[ 1 ] );
if ( out === expected[ i ] ) {
t.strictEqual( out, expected[ i ], 'returns expected value' );
} else {
delta = abs( out - expected[ i ] );

// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. out: '+out+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}

// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
t.strictEqual( isAlmostSameValue( out, expected[ i ], 1 ), true, 'returns expected value' );
break;
default:
break;
Expand Down