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

Floating point math errors in duration as method output #1883

Closed
wants to merge 4 commits into
base: develop
from

Conversation

Projects
None yet
2 participants
@jsmreese

jsmreese commented Aug 25, 2014

The duration object refactor in moment version 2.8.0 introduced floating point math errors in the output of the duration as method.

The errors appeared for small units output: milliseconds, seconds, and minutes.

This fixes #1867 and fixes jsmreese/moment-duration-format#13.

@jsmreese jsmreese changed the title from Floating point math errors in duration as method output (fixes #1867 and fixes jsmreese/moment-duration-format#13) to Floating point math errors in duration as method output Aug 25, 2014

@ichernev

This comment has been minimized.

Contributor

ichernev commented Aug 29, 2014

OK, that looks good. The constants you use to divide _milliseconds are compressed (864e5), but the ones used to multiply days are composed (24 * 60 * ...). I guess we should use one or the other :)

The minifier doesn't touch the constant expressions, so I guess we can use the compressed ones.

@ichernev

This comment has been minimized.

Contributor

ichernev commented Sep 5, 2014

Merged in 5e6ae35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment