Skip to content

Commit

Permalink
fix(slider): operation sometimes returns not rounded value
Browse files Browse the repository at this point in the history
I changed the return result, beacause of this https://floating-point-gui.de/
variables values where rounded when they arrive thanks to rounded difference, but the result of difference and module.get.min whas not rounded
  • Loading branch information
TheJltres authored Jun 30, 2020
1 parent 76a2637 commit b385330
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/definitions/modules/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,8 @@ $.fn.slider = function(parameters) {
}
// Use precision to avoid ugly Javascript floating point rounding issues
// (like 35 * .01 = 0.35000000000000003)
difference = Math.round(difference * precision) / precision;
module.verbose('Cutting off additional decimal places');
return difference + module.get.min();
return Math.round((difference + module.get.min()) * precision) / precision;
},
keyMovement: function(event) {
var
Expand Down

0 comments on commit b385330

Please sign in to comment.