refactor: calculate utility

This commit is contained in:
Methapon Metanipat 2024-10-04 13:01:30 +07:00
parent 9535774a30
commit 3b1e84b6d8
2 changed files with 12 additions and 7 deletions

4
src/utils/arithmetic.ts Normal file
View file

@ -0,0 +1,4 @@
export function precisionRound(number: number, precision = 2) {
var factor = Math.pow(10, precision);
return Math.round(number * factor) / factor;
}