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
21 changes: 4 additions & 17 deletions lib/node_modules/@stdlib/math/base/special/sech/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
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 sech = require( './../lib' );


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

tape( 'the function computes the hyperbolic secant', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -60,18 +57,14 @@ tape( 'the function computes the hyperbolic secant', function test( t ) {
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.4 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function computes the hyperbolic secant (tiny values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -84,18 +77,14 @@ tape( 'the function computes the hyperbolic secant (tiny values)', function test
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+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 hyperbolic secant (large values)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -108,9 +97,7 @@ tape( 'the function computes the hyperbolic secant (large values)', function tes
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.4 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
}
t.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
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 @@ -55,8 +54,6 @@ tape( 'main export is a function', opts, function test( t ) {

tape( 'the function computes the hyperbolic secant', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -69,18 +66,14 @@ tape( 'the function computes the hyperbolic secant', opts, function test( t ) {
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.4 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
}
t.end();
});

tape( 'the function computes the hyperbolic secant (tiny values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -93,18 +86,14 @@ tape( 'the function computes the hyperbolic secant (tiny values)', opts, functio
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+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 hyperbolic secant (large values)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -117,9 +106,7 @@ tape( 'the function computes the hyperbolic secant (large values)', opts, functi
if ( y === expected[ i ] ) {
t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = 1.4 * EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
}
}
t.end();
Expand Down