sghall/react-compound-slider

Rounding error with domain that contain decimals

theronpatrick opened this issue · 1 comments

Problem or feature description:

When setting up a slider using values that have decimals, rounding errors can occur.

Steps to reproduce (for problems):

See this fork of codesandbox example: https://codesandbox.io/s/react-compound-slider-svg-decimal-bug-ggr33?file=/index.js

If you set the domain from 1.4 - 1.6, with a step of 0.1, the initial max value will be 1.5999999999999999 instead of 1.6.

Versions (for problems):

React-Compound-Slider:
2.5.0

React:
16.12.0

Browser:
Chrome

Operating System:
MacOS 10.14.6

Hi @theronpatrick , did you find an elegant way to mitigate this? Having the same issue!