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

toPrecision is broken #385

Closed
efergus opened this issue Jan 11, 2024 · 1 comment · Fixed by #384
Closed

toPrecision is broken #385

efergus opened this issue Jan 11, 2024 · 1 comment · Fixed by #384

Comments

@efergus
Copy link
Contributor

efergus commented Jan 11, 2024

toPrecision outputs the wrong values for some inputs. The function considers the leading "0" in a decimal number to be a significant digit, which it is not.

For example: The toPrecision function is wrong for decimal inputs like 0.222:

Ex:

toPrecision(0.222, 2) // 0.2

Instead, it should be

toPrecision(0.222, 2) // 0.22
@svgeesus
Copy link
Member

Hmm, I have noticed this myself on occasion. Thanks for the PR!

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

Successfully merging a pull request may close this issue.

2 participants