fix rounding to 0 decimal places
This commit is contained in:
parent
12052b90e7
commit
8c83e1d482
3 changed files with 6 additions and 4 deletions
|
|
@ -134,7 +134,9 @@ function inRange(value, min, max) {
|
|||
}
|
||||
|
||||
function round(v, zeros) {
|
||||
let pow = Math.pow(10, zeros || round_decimal_precision);
|
||||
const prec = zeros !== undefined ? zeros : round_decimal_precision;
|
||||
if (prec === 0) return v | 0;
|
||||
let pow = Math.pow(10, prec);
|
||||
return Math.round(v * pow) / pow;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue