diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js index 30cbb6a374a3..870236bbfe80 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js @@ -26,8 +26,7 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var cbrtf = require( './../lib' ); @@ -59,8 +58,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -72,9 +69,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -82,8 +77,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]' tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -95,9 +88,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -105,8 +96,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -118,9 +107,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -128,8 +115,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`' tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -141,9 +126,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -151,8 +134,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -164,9 +145,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -174,8 +153,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -187,9 +164,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', f if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -197,8 +172,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', f tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -210,9 +183,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -220,8 +191,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`' tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -233,9 +202,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -243,8 +210,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -256,9 +221,7 @@ tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', f if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -266,8 +229,6 @@ tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', f tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1e-308]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -279,9 +240,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1 if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -289,8 +248,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1 tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e-308]`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -302,9 +259,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e- if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -312,8 +267,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e- tape( 'the function evaluates the cubic root of subnormal `x`', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -325,9 +278,7 @@ tape( 'the function evaluates the cubic root of subnormal `x`', function test( t if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -335,8 +286,6 @@ tape( 'the function evaluates the cubic root of subnormal `x`', function test( t tape( 'the function evaluates the cubic root of `x` (huge negative)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -349,9 +298,7 @@ tape( 'the function evaluates the cubic root of `x` (huge negative)', function t if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -359,8 +306,6 @@ tape( 'the function evaluates the cubic root of `x` (huge negative)', function t tape( 'the function evaluates the cubic root of `x` (huge positive)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -373,9 +318,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', function t if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js index 6fe4957785ca..6f8a373d350c 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js @@ -27,8 +27,7 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); var PINF = require( '@stdlib/constants/float32/pinf' ); var NINF = require( '@stdlib/constants/float32/ninf' ); -var EPS = require( '@stdlib/constants/float32/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValuef = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -68,8 +67,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -81,9 +78,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -91,8 +86,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]' tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -104,9 +97,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -114,8 +105,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -127,9 +116,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -137,8 +124,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`' tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -150,9 +135,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -160,8 +143,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -173,9 +154,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -183,8 +162,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -196,9 +173,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', o if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -206,8 +181,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', o tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -219,9 +192,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`' if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -229,8 +200,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`' tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -242,9 +211,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -252,8 +219,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -265,9 +230,7 @@ tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', o if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -275,8 +238,6 @@ tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', o tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1e-308]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -288,9 +249,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1 if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -298,8 +257,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1 tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e-308]`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -311,9 +268,7 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e- if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -321,8 +276,6 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e- tape( 'the function evaluates the cubic root of subnormal `x`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -334,9 +287,7 @@ tape( 'the function evaluates the cubic root of subnormal `x`', opts, function t if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -344,8 +295,6 @@ tape( 'the function evaluates the cubic root of subnormal `x`', opts, function t tape( 'the function evaluates the cubic root of `x` (huge negative)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -358,9 +307,7 @@ tape( 'the function evaluates the cubic root of `x` (huge negative)', opts, func if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end(); @@ -368,8 +315,6 @@ tape( 'the function evaluates the cubic root of `x` (huge negative)', opts, func tape( 'the function evaluates the cubic root of `x` (huge positive)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -382,9 +327,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', opts, func if ( y === expected[i] ) { t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { - delta = abs( y - expected[ i ] ); - tol = EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValuef( y, expected[i], 1 ), true, 'returns expected value' ); } } t.end();