feat: add util calculate with precision
This commit is contained in:
parent
fa0e65a8df
commit
2ce41bf9af
1 changed files with 4 additions and 0 deletions
4
src/utils/arithmetic.ts
Normal file
4
src/utils/arithmetic.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export function precisionRound(number: number, precision = 2) {
|
||||
var factor = Math.pow(10, precision);
|
||||
return Math.round(number * factor) / factor;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue