Skip to content

Commit 73f07b2

Browse files
committed
Reduce floating point inaccuracies
1 parent 496b018 commit 73f07b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/InputSpinner.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class InputSpinner extends Component {
580580
num = Math.round(num / this.state.longStep) * this.state.longStep;
581581
}
582582
if (this.isTypeDecimal()) {
583-
num = num.toFixed(this.props.precision) * 1
583+
num = Number(num.toFixed(this.props.precision));
584584
}
585585

586586
if (
@@ -636,9 +636,9 @@ class InputSpinner extends Component {
636636
num = Math.round(num / this.state.longStep) * this.state.longStep;
637637
}
638638
if (this.isTypeDecimal()) {
639-
num = num.toFixed(this.props.precision) * 1
639+
num = Number(num.toFixed(this.props.precision));
640640
}
641-
641+
642642
if (
643643
this.isMinReached(currentValue) &&
644644
!this.isEmptied() &&

0 commit comments

Comments
 (0)