initial commit
This commit is contained in:
24
node_modules/almost-equal/almost_equal.js
generated
vendored
Normal file
24
node_modules/almost-equal/almost_equal.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict"
|
||||
|
||||
var abs = Math.abs
|
||||
, min = Math.min
|
||||
|
||||
function almostEqual(a, b, absoluteError, relativeError) {
|
||||
var d = abs(a - b)
|
||||
|
||||
if (absoluteError == null) absoluteError = almostEqual.DBL_EPSILON;
|
||||
if (relativeError == null) relativeError = absoluteError;
|
||||
|
||||
if(d <= absoluteError) {
|
||||
return true
|
||||
}
|
||||
if(d <= relativeError * min(abs(a), abs(b))) {
|
||||
return true
|
||||
}
|
||||
return a === b
|
||||
}
|
||||
|
||||
almostEqual.FLT_EPSILON = 1.19209290e-7
|
||||
almostEqual.DBL_EPSILON = 2.2204460492503131e-16
|
||||
|
||||
module.exports = almostEqual
|
||||
Reference in New Issue
Block a user