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
44 changes: 7 additions & 37 deletions lib/node_modules/@stdlib/math/base/special/fmodf/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
var tape = require( 'tape' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var absf = require( '@stdlib/math/base/special/absf' );
var EPS = require( '@stdlib/constants/float32/eps' );
var fmodf = require( './../lib' );


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

tape( 'the function evaluates the modulus function (subnormal results)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -63,17 +59,13 @@ tape( 'the function evaluates the modulus function (subnormal results)', functio
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (small `x`, large `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -86,17 +78,13 @@ tape( 'the function evaluates the modulus function (small `x`, large `y`)', func
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (large `x`, small `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -109,17 +97,13 @@ tape( 'the function evaluates the modulus function (large `x`, small `y`)', func
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (small `x`, small `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -132,17 +116,13 @@ tape( 'the function evaluates the modulus function (small `x`, small `y`)', func
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (positive `x`, negative `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -155,17 +135,13 @@ tape( 'the function evaluates the modulus function (positive `x`, negative `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (negative `x`, positive `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -178,17 +154,13 @@ tape( 'the function evaluates the modulus function (negative `x`, positive `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (negative `x`, negative `y`)', function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -201,9 +173,7 @@ tape( 'the function evaluates the modulus function (negative `x`, negative `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var absf = require( '@stdlib/math/base/special/absf' );
var EPS = require( '@stdlib/constants/float32/eps' );
var tryRequire = require( '@stdlib/utils/try-require' );


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

tape( 'the function evaluates the modulus function (subnormal results)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -72,17 +68,13 @@ tape( 'the function evaluates the modulus function (subnormal results)', opts, f
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (small `x`, large `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -95,17 +87,13 @@ tape( 'the function evaluates the modulus function (small `x`, large `y`)', opts
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (large `x`, small `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -118,17 +106,13 @@ tape( 'the function evaluates the modulus function (large `x`, small `y`)', opts
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (small `x`, small `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -141,17 +125,13 @@ tape( 'the function evaluates the modulus function (small `x`, small `y`)', opts
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (positive `x`, negative `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -164,17 +144,13 @@ tape( 'the function evaluates the modulus function (positive `x`, negative `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (negative `x`, positive `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -187,17 +163,13 @@ tape( 'the function evaluates the modulus function (negative `x`, positive `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the modulus function (negative `x`, negative `y`)', opts, function test( t ) {
var expected;
var delta;
var tol;
var v;
var x;
var y;
Expand All @@ -210,9 +182,7 @@ tape( 'the function evaluates the modulus function (negative `x`, negative `y`)'
for ( i = 0; i < x.length; i++ ) {
e = float64ToFloat32( expected[ i ] );
v = fmodf( float64ToFloat32( x[ i ] ), float64ToFloat32( y[ i ] ) );
delta = absf( v - e );
tol = EPS * absf( e );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. v: '+v+'. E: '+e+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( v, e, 'returns expected value' );
}
t.end();
});
Expand Down