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

Using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors #2995

Closed
wants to merge 2 commits into
base: develop
from

Conversation

Projects
None yet
3 participants
@afanasy
Contributor

afanasy commented Mar 1, 2016

@mj1856

This comment has been minimized.

Member

mj1856 commented Mar 8, 2016

Thanks! Could you also include a unit test so we can be sure this doesn't revert with some future change? The example code from the original issue should do fine.

Also, Were you able to find any other cases of this besides just the one reported? Thanks.

@mj1856 mj1856 added the Bug-fix label Mar 8, 2016

@afanasy

This comment has been minimized.

Contributor

afanasy commented Mar 8, 2016

I think there are lots of cases, but I don't know how to summarise the problem in a more analytical way. This is another one I've found by picking numbers manually:

//moment.js 2.11.2
moment.duration(0.1, 'h').minutes()
//6, as expected
moment.duration(4.1, 'h').minutes()
//5
//?!?

but this PR fixes it

@mj1856 mj1856 added this to the 2.13.0 milestone Mar 8, 2016

@mj1856

This comment has been minimized.

Member

mj1856 commented Mar 8, 2016

Thanks. We'll merge this in the next release. I suppose we'll have to tackle this one report at a time.

@ichernev

This comment has been minimized.

Contributor

ichernev commented Apr 16, 2016

Merged in 544a059

@ichernev ichernev closed this Apr 16, 2016

ichernev added a commit that referenced this pull request Apr 16, 2016

Merge pull request #2995 from akura-co:develop
Using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment