Skip to content
Permalink
Browse files

slider: limit the returned floats to 5 digits after the decimal point…

…, corrects JS float errors (fixes #4124 - Value should always be constrained to valid step values)
  • Loading branch information...
Paul Bakaus
Paul Bakaus committed Feb 17, 2009
1 parent 9c4b8a9 commit 2ffcf02de361262e9496719016619c520745e90d
Showing with 3 additions and 1 deletion.
  1. +3 −1 ui/ui.slider.js
@@ -287,7 +287,9 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
if (valueMouseModStep > (this.options.step / 2))
normValue += this.options.step;

return normValue;
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat(normValue.toFixed(5));

},

0 comments on commit 2ffcf02

Please sign in to comment.
You can’t perform that action at this time.