Fix rounding in toBeCloseTo
This commit is contained in:
@@ -21,8 +21,9 @@ getJasmineRequireObj().toBeCloseTo = function() {
|
||||
);
|
||||
}
|
||||
|
||||
var pow = Math.pow(10, precision + 1);
|
||||
return {
|
||||
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
|
||||
pass: +(Math.round(Math.abs(expected - actual) * pow) / pow).toFixed(precision + 1) <= (Math.pow(10, -precision) / 2)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user