Skip to content

Conversation

javierelpianista
Copy link
Contributor

Adds support for rounding types, following the gmpy2 library.

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>
@javierelpianista javierelpianista marked this pull request as ready for review July 26, 2024 21:03
@skirpichev skirpichev self-requested a review July 27, 2024 05:51
@skirpichev skirpichev self-requested a review July 31, 2024 13:50
@skirpichev skirpichev merged commit aa6690b into mpmath:master Aug 2, 2024
10 checks passed
@javierelpianista javierelpianista deleted the rounding_types branch August 2, 2024 13:35
@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.

2 participants