"Nines" bug fix #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What bug does this PR fix?
999,999999,999999999, etc) should round up to the nextmillname(999999should become1M, but displays1000k).math.floor()when determining which prefix to append to inputted numbers. Floor rounds down to the nearest whole integer, forcing numbers that should be rounded up have one lessmillidxthan they should at the time of string formatting. This has been replaced with python's nativeround()function, and has maintained the ability to useprecisionas an input parameter.drop_nullslogic has also been preserved in such a way that it happens during string formatting, thus the removal ofremove_exponents()function which is unneeded with the current changes.prettify()logic remains untouchedHow was this PR tested?
millify()calls on numbers with known bugged outputs, and verified they now round up as intended.millify()calls on non-bugged numbers to verify they still work as intended, toggling the various outputs and testing those as wellprecision=value of 3 or higher still produces1000.000kinstead of1.000M. However, it's in my personal opinion that, when using this module, users shouldn't need/want more than two decimal places showing in their string output anyway. If these changes are accepted, this note should probably go in the README / patch notes. Further, if anyone can figure out how to preserve the correctmillnamewhile using a precision value of 3 or higher, I haven't been able to yet but am open to all ideas!Related Ticket
version = 0.1.1as-is in this PR. Should these changes be accepted, you can determine if this needed versioned up to0.1.2or left alone! Thanks for reading, and kind regards!Screenshots