Skip to content
Draft
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
53 changes: 6 additions & 47 deletions lib/node_modules/@stdlib/math/base/special/sinh/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ 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 isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var sinh = require( './../lib' );


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

tape( 'the function computes the hyperbolic sine', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -62,21 +59,13 @@ tape( 'the function computes the hyperbolic sine', function test( t ) {

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

tape( 'the function computes the hyperbolic sine (large negative)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -86,21 +75,13 @@ tape( 'the function computes the hyperbolic sine (large negative)', function tes

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

tape( 'the function computes the hyperbolic sine (large positive)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -110,21 +91,13 @@ tape( 'the function computes the hyperbolic sine (large positive)', function tes

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

tape( 'the function computes the hyperbolic sine (tiny negative)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -134,21 +107,13 @@ tape( 'the function computes the hyperbolic sine (tiny negative)', function test

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

tape( 'the function computes the hyperbolic sine (tiny positive)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -158,13 +123,7 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', function test

for ( i = 0; i < x.length; i++ ) {
y = sinh( x[i] );
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' );
}
t.strictEqual( y, expected[ i ], 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ 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 isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -60,8 +59,6 @@ tape( 'main export is a function', opts, function test( t ) {

tape( 'the function computes the hyperbolic sine', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -71,21 +68,13 @@ tape( 'the function computes the hyperbolic sine', opts, function test( t ) {

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

tape( 'the function computes the hyperbolic sine (large negative)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -95,21 +84,13 @@ tape( 'the function computes the hyperbolic sine (large negative)', opts, functi

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

tape( 'the function computes the hyperbolic sine (large positive)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -119,21 +100,13 @@ tape( 'the function computes the hyperbolic sine (large positive)', opts, functi

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

tape( 'the function computes the hyperbolic sine (tiny negative)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -143,21 +116,13 @@ tape( 'the function computes the hyperbolic sine (tiny negative)', opts, functio

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

tape( 'the function computes the hyperbolic sine (tiny positive)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -167,13 +132,7 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', opts, functio

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