Test if two arguments are both generic arrays and contain respective elements which are approximately the same value within a specified number of ULPs (units in the last place).
var isAlmostSameValueArray = require( '@stdlib/assert/is-almost-same-value-array' );Tests if two arguments are both generic arrays and contain respective elements which are approximately the same value within a specified number of ULPs (units in the last place).
var EPS = require( '@stdlib/constants/float64/eps' );
var x = [ 1.0, 2.0 ];
var y = [ 1.0+EPS, 2.0 ];
var bool = isAlmostSameValueArray( x, y, 0 );
// returns false
bool = isAlmostSameValueArray( x, y, 1 );
// returns true
bool = isAlmostSameValueArray( x, [ -1.0, 2.0 ], 1 );
// returns falsevar isAlmostSameValueArray = require( '@stdlib/assert/is-almost-same-value-array' );
var x = [ 1.0, 2.0, 3.0 ];
var y = [ 1.0, 2.0, 3.0 ];
var out = isAlmostSameValueArray( x, y, 0 );
// returns true
x = [ -0.0, 0.0, -0.0 ];
y = [ 0.0, -0.0, 0.0 ];
out = isAlmostSameValueArray( x, y, 0 );
// returns false
x = [ NaN, NaN, NaN ];
y = [ NaN, NaN, NaN ];
out = isAlmostSameValueArray( x, y, 0 );
// returns true