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

Float number calculation loses accuracy #5596

Closed
Alanscut opened this issue Jun 14, 2020 · 0 comments
Closed

Float number calculation loses accuracy #5596

Alanscut opened this issue Jun 14, 2020 · 0 comments

Comments

@Alanscut
Copy link
Contributor

Describe the bug
float number calculation loses accuracy.

To Reproduce
Steps to reproduce the behavior:
duration sometimes can't get accurate results, e.g.
the result should be 240, not 239.99999999906868

var duration = moment.duration(1.1234, 'hours');
console.log(duration.milliseconds()); // 239.99999999906868

Expected behavior
when there are float numbers, we could get the accurate result.

Environment

  • moment version: 2.26.0
  • OS: win10, 64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants