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
83 changes: 9 additions & 74 deletions lib/node_modules/@stdlib/math/base/special/acotf/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
var PINF = require( '@stdlib/constants/float32/pinf' );
var NINF = require( '@stdlib/constants/float32/ninf' );
var EPS = require( '@stdlib/constants/float32/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' );
var acotf = require( './../lib' );


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

tape( 'the function computes the inverse cotangent for medium positive values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -66,21 +63,13 @@ tape( 'the function computes the inverse cotangent for medium positive values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.9 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 3 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for medium negative values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -91,21 +80,13 @@ tape( 'the function computes the inverse cotangent for medium negative values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.9 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 3 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for large positive values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -116,21 +97,13 @@ tape( 'the function computes the inverse cotangent for large positive values', f
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for large negative values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -141,21 +114,13 @@ tape( 'the function computes the inverse cotangent for large negative values', f
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for larger positive values', 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 inverse cotangent for larger positive values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for larger negative values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -191,21 +148,13 @@ tape( 'the function computes the inverse cotangent for larger negative values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for huge positive values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -216,21 +165,13 @@ tape( 'the function computes the inverse cotangent for huge positive values', fu
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for huge negative values', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -241,13 +182,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', fu
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
var PINF = require( '@stdlib/constants/float32/pinf' );
var NINF = require( '@stdlib/constants/float32/ninf' );
var EPS = require( '@stdlib/constants/float32/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' );
var tryRequire = require( '@stdlib/utils/try-require' );


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

tape( 'the function computes the inverse cotangent for medium positive values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -75,21 +72,13 @@ tape( 'the function computes the inverse cotangent for medium positive values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.9 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 3 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for medium negative values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -100,21 +89,13 @@ tape( 'the function computes the inverse cotangent for medium negative values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.9 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 3 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for large positive values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -125,21 +106,13 @@ tape( 'the function computes the inverse cotangent for large positive values', o
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for large negative values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -150,21 +123,13 @@ tape( 'the function computes the inverse cotangent for large negative values', o
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for larger positive values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -175,21 +140,13 @@ tape( 'the function computes the inverse cotangent for larger positive values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for larger negative values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -200,21 +157,13 @@ tape( 'the function computes the inverse cotangent for larger negative values',
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for huge positive values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -225,21 +174,13 @@ tape( 'the function computes the inverse cotangent for huge positive values', op
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the inverse cotangent for huge negative values', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -250,13 +191,7 @@ tape( 'the function computes the inverse cotangent for huge negative values', op
for ( i = 0; i < x.length; i++ ) {
y = acotf( x[ i ] );
e = float64ToFloat32( expected[ i ] );
if ( y === e ) {
t.strictEqual( y, e, 'x: '+x[ i ]+'. E: '+e+'.' );
} else {
delta = abs( y - e );
tol = 1.2 * EPS * abs( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, e, 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down