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
51 changes: 9 additions & 42 deletions lib/node_modules/@stdlib/math/base/special/sqrtpi/test/test.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 isnan = require( '@stdlib/math/base/assert/is-nan' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var sqrtpi = require( './../lib' );


Expand All @@ -53,8 +52,6 @@ tape( 'main export is a function', function test( t ) {

tape( 'the function evaluates the principal square root when `x` is on the interval `[50,500]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -66,18 +63,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[20,50]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -89,18 +82,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[3,20]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -112,18 +101,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[0.8,3]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -135,18 +120,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates principal square root when `x` is on the interval `[0.0,0.8]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -158,18 +139,14 @@ tape( 'the function evaluates principal square root when `x` is on the interval
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[1e-300,1e-308]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -181,18 +158,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is subnormal', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -204,18 +177,14 @@ tape( 'the function evaluates the principal square root when `x` is subnormal',
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root for huge positive numbers', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -227,9 +196,7 @@ tape( 'the function evaluates the principal square root for huge positive number
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@

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 isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var tryRequire = require( '@stdlib/utils/try-require' );
var abs = require( '@stdlib/math/base/special/abs' );


// FIXTURES //
Expand Down Expand Up @@ -62,8 +61,6 @@ tape( 'main export is a function', opts, function test( t ) {

tape( 'the function evaluates the principal square root when `x` is on the interval `[50,500]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -75,18 +72,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[20,50]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -98,18 +91,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[3,20]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -121,18 +110,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[0.8,3]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -144,18 +129,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates principal square root when `x` is on the interval `[0.0,0.8]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -167,18 +148,14 @@ tape( 'the function evaluates principal square root when `x` is on the interval
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is on the interval `[1e-300,1e-308]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -190,18 +167,14 @@ tape( 'the function evaluates the principal square root when `x` is on the inter
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root when `x` is subnormal', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -213,18 +186,14 @@ tape( 'the function evaluates the principal square root when `x` is subnormal',
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function evaluates the principal square root for huge positive numbers', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -236,9 +205,7 @@ tape( 'the function evaluates the principal square root for huge positive number
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.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' );
}
}
t.end();
Expand Down