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
92 changes: 10 additions & 82 deletions lib/node_modules/@stdlib/math/base/special/fast/asinh/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
// 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 EPS = require( '@stdlib/constants/float64/eps' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var abs = require( '@stdlib/math/base/special/abs' );
var asinh = require( './../lib' );


Expand Down Expand Up @@ -61,8 +61,6 @@ tape( 'the function underflows if provided a number which is negligible compared

tape( 'the function computes the hyperbolic arcsine on the interval `[-0.8,0.8]` (tests whether `asinh` behaves as an odd function)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -72,21 +70,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-0.8,0.8]`

for ( i = 0; i < x.length; i++ ) {
y = asinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 50.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 79 ), true, 'returns expected value' );
}
t.end();
});

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

for ( i = 0; i < x.length; i++ ) {
y = asinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.5 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

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

for ( i = 0; i < x.length; i++ ) {
y = asinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.5 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

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

for ( i = 0; i < x.length; i++ ) {
y = asinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

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

for ( i = 0; i < x.length; i++ ) {
y = asinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tolerance: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the hyperbolic arcsine on the interval `[3.0,28.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -192,21 +150,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[3.0,28.0]`

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

tape( 'the function computes the hyperbolic arcsine on the interval `[-28.0,-3.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -216,21 +166,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-28.0,-3.0

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

tape( 'the function computes the hyperbolic arcsine on the interval `[28.0,100.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -240,21 +182,13 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[28.0,100.0

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

tape( 'the function computes the hyperbolic arcsine on the interval `[-100.0,-28.0]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -264,13 +198,7 @@ tape( 'the function computes the hyperbolic arcsine on the interval `[-100.0,-28

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