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

Is there a way to multiply out (undo) exponential notation for floats? #779

Open
petertorelli opened this issue Nov 5, 2022 · 0 comments

Comments

@petertorelli
Copy link

Consider this:

a = 1234.56;
a.toPrecision(3);
// 1.23e+3

How do I force this back to 1230 using .format()? I know I can do it with logs/mods, etc, but I was hoping there's a way to do it with this library. I basically want it to always print significant figures, like toPrecision but without switching to exponents if the significant figures are fewer than or equal to the log10 of the value.

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

1 participant