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

formatNum doesn't round correctly #6990

Closed
5 tasks done
jscheffner opened this issue Feb 10, 2020 · 1 comment
Closed
5 tasks done

formatNum doesn't round correctly #6990

jscheffner opened this issue Feb 10, 2020 · 1 comment

Comments

@jscheffner
Copy link

jscheffner commented Feb 10, 2020

  • I've looked at the documentation to make sure the behavior is documented and expected
  • I'm sure this is a Leaflet code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

Steps to reproduce
run L.Util.formatNum(13.714814633131029, 15)

Expected behavior
Since the number already has 15 decimal points I would expect it to stay the same.

Current behavior
It returns 13.714814633131027

Environment

  • Leaflet version: 1.6.0
  • Browser (with version): Chrome but verified it in Karma
  • OS/Platform (with version): OSX Mojave

Additional context

Minimal example reproducing the issue

https://next.plnkr.co/edit/p8zxeYBVQiz0v0FH

  • this example is as simple as possible
  • this example does not rely on any third party code
@IvanSanchez
Copy link
Member

Errors from the 15th decimal on are within the expected precision of IEEE 64-bit floating point numbers. Won't fix.

See also #6668 and related.

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

No branches or pull requests

2 participants