You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
288 B
11 lines
288 B
2 years ago
|
var isNum = require('./isNum');
|
||
|
exports = function(a, b, relTol, absTol) {
|
||
|
if (!isNum(relTol)) relTol = 1e-9;
|
||
|
if (!isNum(absTol)) absTol = 0;
|
||
|
return abs(a - b) <= max(relTol * max(abs(a), abs(b)), absTol);
|
||
|
};
|
||
|
var abs = Math.abs;
|
||
|
var max = Math.max;
|
||
|
|
||
|
module.exports = exports;
|