Skip to content

Conversation

javierelpianista
Copy link
Contributor

@javierelpianista javierelpianista commented Aug 26, 2024

Adds a bit of documentation in the Utility Functions section.

Closes #337

javierelpianista and others added 30 commits July 19, 2024 17:56
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.
… 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 <skirpichev@gmail.com>
@skirpichev skirpichev self-requested a review August 27, 2024 01:39
@skirpichev skirpichev marked this pull request as ready for review August 27, 2024 04:45
Copy link
Collaborator

@skirpichev skirpichev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did few edits, now LGTM

Are you ok with changes or want to add something?

@javierelpianista
Copy link
Contributor Author

I did few edits, now LGTM

Are you ok with changes or want to add something?

I think it's better with your changes. I can't think of anything I'd like to add right now.

@skirpichev skirpichev merged commit 9b99f41 into mpmath:master Aug 28, 2024
10 checks passed
@javierelpianista javierelpianista deleted the format_doc branch August 28, 2024 11:04
@skirpichev skirpichev added this to the 1.4 milestone May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mpf.__format__() dunder methods
2 participants