react-compound-slider icon indicating copy to clipboard operation
react-compound-slider copied to clipboard

Rounding error with domain that contain decimals

Open theronpatrick opened this issue 4 years ago • 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

theronpatrick avatar Aug 07 '20 18:08 theronpatrick

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

ralphking avatar Apr 19 '21 12:04 ralphking