Skip to content

Commit af0dc35

Browse files
susiwen8iamkun
authored andcommitted
Input-Number: Fix precision problem (#15292) (#15295)
1 parent d8002cc commit af0dc35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/input-number/src/input-number.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
methods: {
196196
toPrecision(num, precision) {
197197
if (precision === undefined) precision = this.numPrecision;
198-
return parseFloat(Number(num).toFixed(precision));
198+
return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
199199
},
200200
getPrecision(value) {
201201
if (value === undefined) return 0;

0 commit comments

Comments
 (0)