Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

@kennethcachia
Copy link
Contributor

Closes #2015

@ajoslin ajoslin added the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label May 1, 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use return Math.round(formattedValue * 1000) / 1000. It's faster.
JSperf: http://jsperf.com/math-round-vs-tofixed2/5

@ThomasBurleson ThomasBurleson added this to the 0.10.0 milestone May 1, 2015
@ThomasBurleson ThomasBurleson self-assigned this May 1, 2015
@kennethcachia
Copy link
Contributor Author

Thanks @Kiougar! Pushed an update.

@mprentic-harris
Copy link
Contributor

It's not clear to me that this resolves the issue. Previously Math.round(value / step) * step was returning 14.700000000000001 or some such value. With this fix it will now return 14.700 or 14.7? Is this really addressing the cause of Math.round(0.15 / 0.05) * 0.05 equalling 0.15000000000000002? What if I have step="0.0001"?

@kennethcachia
Copy link
Contributor Author

Hey @mprentic-harris!
It should return 14.7 and addresses #2015.

@ThomasBurleson ThomasBurleson removed the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label Jan 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mdSlider if set step="0.1", when slide the slider it's value will be a long float number

5 participants