Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix odd rounding errors #19

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

Fix odd rounding errors #19

wants to merge 1 commit into from

Conversation

makenai
Copy link

@makenai makenai commented Jun 4, 2016

I know you're not maintaining this, but thought I'd send this just in case someone else finds it useful. I was finding that the background was jumping around on me in Chrome. It turned out that for very long decimals, it was rendering the numbers as scientific numbers and then concatenating them to 'px' and treating 0.00000000000005 px the same as 5px. This rounds up to a whole pixel value.

Prevent this behavior:

(450 - 449.99999999999994) + 'px' 
"5.684341886080802e-14px"

Prevent this behavior: 
```javascript
(450 - 449.99999999999994) + 'px' 
"5.684341886080802e-14px"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant