Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow multipleOf and divisibleBy to accept decimal values (up to 3 after comma) #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

unity
Copy link

@unity unity commented Aug 11, 2015

Fixes the case when multipleOf or divisibleBy are set to decimal values such as 0.3.
Those are valid use cases, for instance when setting a slider with Opacity, where you want to stick to increments of 0.1

Updated Tests attached

Fixes the case when multipleOf or divisibleBy are set to decimal values such as 0.3.
Those are valid use cases, for instance when setting a slider with Opacity, where you want to stick to increments of 0.1

Updated Tests attached
@unity unity changed the title Allow multipleOf and divisibleBy to accept decimal values (up to 3) Allow multipleOf and divisibleBy to accept decimal values (up to 3 after comma) Aug 11, 2015
@jdorn
Copy link
Owner

jdorn commented Feb 11, 2016

This doesn't get at the core problem of floating point numbers in javascript. For example, in javascript 1.14 / 0.01 is equal to 113.9999999999. Multiplying by 1000 just pushes the problem out a little further. I think PR #436 is more on the right track of adding math.js as an optional dependency and using that if available.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants