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
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@

var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var abs = require( '@stdlib/math/base/special/abs' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var randu = require( '@stdlib/random/base/randu' );
var logaddexp = require( './../lib' );

Expand Down Expand Up @@ -103,8 +101,6 @@ tape( 'the function returns `-infinity` if both arguments are `-infinity`', func

tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var v;
Expand All @@ -115,13 +111,7 @@ tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)
expected = data.expected;
for ( i = 0; i < expected.length; i++ ) {
v = logaddexp( x[ i ], y[ i ] );
if ( v === expected[ i ] ) {
t.strictEqual( v, expected[ i ], 'returns expected value when provided '+x[ i ]+' and '+y[ i ] );
} else {
delta = abs( expected[ i ] - v );
tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. actual: '+v+'. expected: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( v, expected[ i ], 'returns expected value' );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var randu = require( '@stdlib/random/base/randu' );
var tryRequire = require( '@stdlib/utils/try-require' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );


// FIXTURES //
Expand Down Expand Up @@ -112,8 +110,6 @@ tape( 'the function returns `-infinity` if both arguments are `-infinity`', opts

tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var v;
Expand All @@ -124,13 +120,7 @@ tape( 'the function accurately computes the natural logarithm of exp(x) + exp(y)
expected = data.expected;
for ( i = 0; i < expected.length; i++ ) {
v = logaddexp( x[ i ], y[ i ] );
if ( v === expected[ i ] ) {
t.strictEqual( v, expected[ i ], 'returns expected value when provided '+x[ i ]+' and '+y[ i ] );
} else {
delta = abs( expected[ i ] - v );
tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y[ i ]+'. actual: '+v+'. expected: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( v, expected[ i ], 'returns expected value' );
}
t.end();
});