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
133 changes: 14 additions & 119 deletions lib/node_modules/@stdlib/math/base/special/atan/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

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 PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var PI = require( '@stdlib/constants/float64/pi' );
Expand Down Expand Up @@ -59,8 +58,6 @@ tape( 'main export is a function', function test( t ) {

tape( 'the function computes the arctangent on the interval `[-1e-308,-1e-300]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -70,21 +67,13 @@ tape( 'the function computes the arctangent on the interval `[-1e-308,-1e-300]`'

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[1e-300,1e-308]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -94,21 +83,13 @@ tape( 'the function computes the arctangent on the interval `[1e-300,1e-308]`',

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-0.8,0.8]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -118,21 +99,13 @@ tape( 'the function computes the arctangent on the interval `[-0.8,0.8]`', funct

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-1.0,-0.8]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -142,21 +115,13 @@ tape( 'the function computes the arctangent on the interval `[-1.0,-0.8]`', func

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[0.8,1.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -166,21 +131,13 @@ tape( 'the function computes the arctangent on the interval `[0.8,1.0]`', functi

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-3.0,-1.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -190,21 +147,13 @@ tape( 'the function computes the arctangent on the interval `[-3.0,-1.0]`', func

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[1.0,3.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -214,21 +163,13 @@ tape( 'the function computes the arctangent on the interval `[1.0,3.0]`', functi

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[3.0,100.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -238,21 +179,13 @@ tape( 'the function computes the arctangent on the interval `[3.0,100.0]`', func

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-100.0,-3.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -262,21 +195,13 @@ tape( 'the function computes the arctangent on the interval `[-100.0,-3.0]`', fu

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[100.0,1000.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -286,21 +211,13 @@ tape( 'the function computes the arctangent on the interval `[100.0,1000.0]`', f

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-1000.0,-100.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -310,21 +227,13 @@ tape( 'the function computes the arctangent on the interval `[-1000.0,-100.0]`',

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[-1e200,-1e208]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -334,21 +243,13 @@ tape( 'the function computes the arctangent on the interval `[-1e200,-1e208]`',

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the arctangent on the interval `[1e300,1e308]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -358,13 +259,7 @@ tape( 'the function computes the arctangent on the interval `[1e300,1e308]`', fu

for ( i = 0; i < x.length; i++ ) {
y = atan( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down