fix rounding to 0 decimal places
This commit is contained in:
parent
12052b90e7
commit
8c83e1d482
3 changed files with 6 additions and 4 deletions
|
|
@ -253,6 +253,7 @@ Math.bound = function(val, min, max) {
|
|||
};
|
||||
|
||||
Number.prototype.round = function(digits) {
|
||||
if (digits === 0) return this.valueOf() | 0;
|
||||
const pow = Math.pow(10, digits || 3);
|
||||
return Math.round(this.valueOf() * pow) / pow;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue