Skip to content
Draft
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
89 changes: 21 additions & 68 deletions lib/node_modules/@stdlib/math/base/special/pow/test/test.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -221,8 +222,6 @@ tape( 'the function evaluates the exponential function (`x ~ 1`, `y` large)', op
tape( 'the function evaluates the exponential function (`x ~ 1`, `y` huge)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -232,14 +231,9 @@ tape( 'the function evaluates the exponential function (`x ~ 1`, `y` huge)', opt
expected = baseNearUnityHuge.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down Expand Up @@ -420,8 +414,6 @@ tape( 'the function evaluates the exponential function (near underflow)', opts,
tape( 'the function evaluates the exponential function (small `x`, large `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -433,13 +425,9 @@ tape( 'the function evaluates the exponential function (small `x`, large `y`)',
actual = pow( x[i], y[i] );
if ( expected[i] === 5.0e-324 ) {
t.strictEqual( actual === expected[i] || actual === 0.0, true, 'pow('+x[i]+','+y[i]+') returns 5e-324 or 0' );
} else if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
}
t.end();
Expand All @@ -465,8 +453,6 @@ tape( 'the function evaluates the exponential function (large `x`, small `y`)',
tape( 'the function evaluates the exponential function (small `x`, small `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -476,23 +462,16 @@ tape( 'the function evaluates the exponential function (small `x`, small `y`)',
expected = smallSmall.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the exponential function (decimal `x`, decimal `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -502,23 +481,16 @@ tape( 'the function evaluates the exponential function (decimal `x`, decimal `y`
expected = decimalDecimal.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the exponential function (decimal `x`, integer `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -528,23 +500,16 @@ tape( 'the function evaluates the exponential function (decimal `x`, integer `y`
expected = decimalInteger.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the exponential function (integer `x`, decimal `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -554,23 +519,16 @@ tape( 'the function evaluates the exponential function (integer `x`, decimal `y`
expected = integerDecimal.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the exponential function (integer `x`, integer `y`)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -580,14 +538,9 @@ tape( 'the function evaluates the exponential function (integer `x`, integer `y`
expected = integerInteger.expected;
for ( i = 0; i < x.length; i++ ) {
actual = pow( x[i], y[i] );
if ( actual === expected[i] ) {
t.strictEqual( actual, expected[i], 'pow('+x[i]+','+y[i]+') returns '+expected[i] );
} else {
// NOTE: the results may differ slightly from the reference and JavaScript implementations 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
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. pow('+x[i]+','+y[i]+'). Expected: '+expected[i]+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
}

// 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( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
Loading