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

[Bug] math.format precision 0 #1337

Closed
dkenul opened this issue Nov 28, 2018 · 4 comments
Closed

[Bug] math.format precision 0 #1337

dkenul opened this issue Nov 28, 2018 · 4 comments
Labels

Comments

@dkenul
Copy link
Contributor

dkenul commented Nov 28, 2018

Credit to @jmm for this find.

Example:

math.format(16.01, {
  notation: 'fixed',
  precision: 0
})
// actual output: "16.01"
// expected output: "16"

Live Example

Source:
A falsey check here:

} else if (options.precision) {

Solution:
typeof precision === 'number' as seen elsewhere in the file.

I can submit a pull request for this if verified as a bug.

@jmm
Copy link

jmm commented Nov 28, 2018

I ran into the issue, but thanks to @dkenul for spotting the likely culprit!

@harrysarson
Copy link
Collaborator

Looks like a bug to me 👍 nice catch, thanks

@dkenul
Copy link
Contributor Author

dkenul commented Nov 28, 2018

Thanks for the confirmation @harrysarson . Created a PR.

@josdejong
Copy link
Owner

This issue should be fixed now in v5.3.0. Thanks again @dkenul.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants