-
Notifications
You must be signed in to change notification settings - Fork 10
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
uses scientific notation when not necessary #1
Comments
Yes you're right 130 is better there. Maybe for anything less than 1000 (or 10000? 9300 vs 9.3e3) displaying the trailing zeros is better. |
The string formatting using the letter 'g' seems to have a default to not use exponential notation if the exponent is between -4 and some number 'p', which I could see also being around 4. If the significant figures can be used correctly (no significant trailing zeros), checking whether the value of the exponent is between 0 and 4 (or 3), and then displaying that using regular notation might be a way to do this. |
Yes, I agree following the |
@goldmanm You can check it out at: |
When inputting
to_precision(132,2)
, I would expect it to return'130'
, but it actually gives'1.3e+2'
. To my knowledge, both have the valid amount of significant figures, and the first one is easier to read. We might want to add a trailing zeros check.I tried it on python 2.7 and 3.4 and got the same result.
Thanks so much for sharing this. I really like the code.
The text was updated successfully, but these errors were encountered: