Open
Conversation
fixes 999 bug
Author
|
Open to any / all feedback or edits from you! I love this module and use it heavily in my projects, so I appreciate your consideration. |
added 2 commits
July 8, 2021 10:26
n < 1000 was skipping While block and showing many decimals, if input had many decimals.
|
@azaitsev, could you please consider merging this PR and deploying a new version of |
Owner
|
@MitchAngenent sorry, missed this PR. I think we need to add some tests before merging. |
|
Hi @azaitsev, I created unit tests that test @weefatboi's work, and the existing functionalities. See PR #3. Could you please look into this PR, and if agreed, merge it and publish a new version of |
|
@azaitsev Any news about this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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