Skip to content

Misc fixes#936

Merged
skirpichev merged 8 commits intompmath:masterfrom
skirpichev:misc
Apr 8, 2025
Merged

Misc fixes#936
skirpichev merged 8 commits intompmath:masterfrom
skirpichev:misc

Conversation

@skirpichev
Copy link
Copy Markdown
Collaborator

@skirpichev skirpichev commented Apr 2, 2025

  • use itertools.product() in calculus
  • CLI fixes for multi-line input
  • revert 849e185 and (partially) f4cef9c (same for with field)
  • test formatting with digit separators in the fractional part
  • revert rest of f4cef9c
  • amend 950d654 (support '._f'-like cases, i.e. with default precision)
  • move source transformations up in runsource()
  • fix wrap_float_literals() to detect all float/complex literals

@skirpichev skirpichev marked this pull request as ready for review April 6, 2025 07:21
Processing in wrap_float_literals() can't work line-by-line, as the
tokenize.unparse() doesn't preserve indentation in this case.  E.g.:

$ python -m mpmath --no-ipython
>>> def f():
...     return 1.2
...
Traceback (most recent call last):
  ...
  File "<unknown>", line 2
    return mpf('1.2')
    ^^^^^^
IndentationError: expected an indented block after function definition on line 1
While python/cpython#130662 being discussed, lets keep previous (more
strict) formatting specification.
Python docs doesn't specify 0-padding behavior, when alignment is
specified.  Lets be more strict here as Fraction/Decimal's: just reject
0 flag in this case.

float's behavior is just odd:
>>> format(1.123, '<020f')
'1.123000000000000000'
@skirpichev skirpichev merged commit 609d09b into mpmath:master Apr 8, 2025
11 checks passed
@skirpichev skirpichev deleted the misc branch April 8, 2025 04:50
@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.

1 participant