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
53 changes: 6 additions & 47 deletions lib/node_modules/@stdlib/math/base/special/coth/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,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 coth = require( './../lib' );


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

tape( 'the function computes the hyperbolic cotangent', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -64,21 +61,13 @@ tape( 'the function computes the hyperbolic cotangent', function test( t ) {
continue;
}
y = coth( 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.75 * 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 ], 2 ), true, 'returns expected value' );
}
t.end();
});

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

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (tiny positive)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -112,21 +93,13 @@ tape( 'the function computes the hyperbolic cotangent (tiny positive)', function

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (large negative)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -136,21 +109,13 @@ tape( 'the function computes the hyperbolic cotangent (large negative)', functio

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (large positive)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -160,13 +125,7 @@ tape( 'the function computes the hyperbolic cotangent (large positive)', functio

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var tryRequire = require( '@stdlib/utils/try-require' );
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' );


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

tape( 'the function computes the hyperbolic cotangent', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -73,21 +70,13 @@ tape( 'the function computes the hyperbolic cotangent', opts, function test( t )
continue;
}
y = coth( 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.75 * 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 ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the hyperbolic cotangent (tiny negative)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -97,21 +86,13 @@ tape( 'the function computes the hyperbolic cotangent (tiny negative)', opts, fu

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (tiny positive)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -121,21 +102,13 @@ tape( 'the function computes the hyperbolic cotangent (tiny positive)', opts, fu

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (large negative)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -145,21 +118,13 @@ tape( 'the function computes the hyperbolic cotangent (large negative)', opts, f

for ( i = 0; i < x.length; i++ ) {
y = coth( 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 cotangent (large positive)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -169,13 +134,7 @@ tape( 'the function computes the hyperbolic cotangent (large positive)', opts, f

for ( i = 0; i < x.length; i++ ) {
y = coth( 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