New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement string formatting for elements in RR and CC #30515
Comments
Commit: |
Author: Markus Wageringel |
Replying to @mwageringel:
As those differences are small, I would suggest to leave that for a follow-up ticket and merge this ticket as is. New commits:
|
Branch: u/gh-mwageringel/30515 |
Changed keywords from none to format |
Reviewer: Dima Pasechnik |
comment:2
lgtm |
comment:3
Thanks. |
Changed branch from u/gh-mwageringel/30515 to |
comment:5
I'm getting two test failures on my distro package, using system python 3.8.5
|
Changed commit from |
comment:6
#30689 should fix this. It is nice to see that the format specification seems to be more fully implemented in your Python version. On my end, I cannot reproduce it with 3.8.5 though. |
Following #29514 (see also #27788 and #29212), this ticket implements
__format__
for real and complex numbers.The complex case is implemented by reusing the code from
CDF
.The real case is implemented by delegating to Python's arbitrary precision
Decimal
numbers. This works quite well, but has the caveat that the output is not completely the same as for therepr
of real numbers. Compare for example:It looks like this can only be avoided by a custom implementation of the format specification, rather than delegating to
Decimal
, which is quite a complex task.CC: @slel @jcamp0x2a
Component: misc
Keywords: format
Author: Markus Wageringel
Branch:
c118bf2
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/30515
The text was updated successfully, but these errors were encountered: