Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #95 from andreruffert/fix-floating-point-rounding-…
Browse files Browse the repository at this point in the history
…issue

fix: floation point rounding issue
  • Loading branch information
andreruffert committed Sep 28, 2014
2 parents 8df30fb + 94c5f74 commit 165d52d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
Plugin.prototype.getValueFromPosition = function(pos) {
var percentage, value;
percentage = ((pos) / (this.maxHandleX || 1));
value = this.step * Math.ceil((((percentage) * (this.max - this.min)) + this.min) / this.step);
value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min;
return Number((value).toFixed(2));
};

Expand Down
2 changes: 1 addition & 1 deletion dist/rangeslider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
Plugin.prototype.getValueFromPosition = function(pos) {
var percentage, value;
percentage = ((pos) / (this.maxHandleX || 1));
value = this.step * Math.ceil((((percentage) * (this.max - this.min)) + this.min) / this.step);
value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min;
return Number((value).toFixed(2));
};

Expand Down

0 comments on commit 165d52d

Please sign in to comment.