Add humanize.metric() for converting big/small numbers to SI units#22
Add humanize.metric() for converting big/small numbers to SI units#22hugovk merged 2 commits intopython-humanize:mainfrom
Conversation
Checking a number is negative using `'-' in string_value` leads to confusion because 1e-30 and -1e30 both contain a '-' but only one of them is negative. This bug had found its way into the tests and the docstring. Additionally, the removal of redundant leading '0's and '+'s from the exponent would only kick in if both were present so that 1e20 would become 10⁺²⁰ instead of just 10²⁰ and the insertion of negative exponents could lead to outputs such as 3.00 x 10⁻⁺²⁰.
|
Uhm, why did precommit do that? |
|
Haha! That's autoflake fixing: The real fix is to add |
746aafb to
3bb8a45
Compare
Codecov Report
@@ Coverage Diff @@
## main #22 +/- ##
==========================================
+ Coverage 99.08% 99.09% +0.01%
==========================================
Files 9 9
Lines 658 666 +8
==========================================
+ Hits 652 660 +8
Misses 6 6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Thanks for this! For https://en.wikipedia.org/wiki/International_System_of_Units#General_rules I guess we should do this also when there's no SI unit but we end up with a metric I think this will replace PR #1 as well. |
|
Thank you! |
Fixes nothing!
Changes proposed in this pull request: