feat: add util calculate with precision

This commit is contained in:
Methapon Metanipat 2024-10-04 11:53:55 +07:00
parent fa0e65a8df
commit 2ce41bf9af

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;
}