Add documentation for mpf.__format__#850
Merged
skirpichev merged 51 commits intompmath:masterfrom Aug 28, 2024
Merged
Conversation
The method is only implemented for the _mpf type, and it follows the same conventions as in https://docs.python.org/3/library/string.html#formatstrings, but extended to mpf floats. Also added tests to this function.
…haracters after type specification
… test case for when both 0-padding and fill char are selected.
The 'z' feature was included in Python 3.11, so it makes no sense to test for it if we are using an older Python version.
* change imports * move helper up * spaces
* unident some code * kill some comments * move up _FLOAT_FORMAT_SPECIFICATION_MATCHER
* Added this functionality to format_scientific and format_fixed functions * Added random tests for very small numbers to test_format.py
* Added 10 digits to the calls to to_digits_exp, this fixes wrong formatting for some subnormal floats. * Also removed code for no_neg_0 checking in format_scientific, since it was never called.
Co-authored-by: Sergey B Kirpichev <[email protected]>
skirpichev
approved these changes
Aug 27, 2024
Collaborator
skirpichev
left a comment
There was a problem hiding this comment.
I did few edits, now LGTM
Are you ok with changes or want to add something?
Contributor
Author
I think it's better with your changes. I can't think of anything I'd like to add right now. |
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.
Adds a bit of documentation in the Utility Functions section.
Closes #337