mootools/mootools-more — Issue #1073: Slider: toStep(position) result in floating point errors on modulo operation
Author: hummal
Created: 2011-11-23 09:45:35+00:00
State: open

Because JavaScript uses floating point math which always leads to rounding errors.

If you need an exact result with two decimal places, multiply your numbers with 100 or more before the operation and then divide again afterwards:

Example:
Math: 8067 % 80.67 = 0
JavaScript: 8067 % 80.67 = 80.66999999999983

Try on your own:
http://jsfiddle.net/QM7cL/

Get this on my page with a lage scrolling area. The higher the size, the higher the missing scroll.