sghall / react-compound-slider

:black_medium_small_square: React Compound Slider | A small React slider with no opinion on markup or styles
https://react-compound-slider.netlify.com
MIT License
626 stars 80 forks source link

Rounding error with domain that contain decimals #122

Open theronpatrick opened 4 years ago

theronpatrick commented 4 years ago

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

ralphking commented 3 years ago

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