-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-142019: Add description about the exponent of result formatted with presentation type 'e'. #142084
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
Conversation
1nftf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The float.__format__ method internally calls PyOS_double_to_string.
The default PyOS_double_to_string implementation will pad the exponent to 2 digits and use a zero exponent for a zero value.
Line 1204 in 469f191
| exp_len = sprintf(p, "%+.02d", exp); |
The fallback PyOS_double_to_string implementation will internally call PyOS_snprintf.
This also pad the exponent to 2 digits and use a zero exponent for a zero value.
Line 729 in 469f191
| PyOS_snprintf(buffer, buf_size, format, d); |
…ed with presentation type 'e' (pythonGH-142084) (cherry picked from commit e27f76b) Co-authored-by: 1nftf <QfxZ11@proton.me>
…ed with presentation type 'e' (pythonGH-142084) (cherry picked from commit e27f76b) Co-authored-by: 1nftf <QfxZ11@proton.me>
|
GH-142813 is a backport of this pull request to the 3.14 branch. |
|
GH-142814 is a backport of this pull request to the 3.13 branch. |
📚 Documentation preview 📚: https://cpython-previews--142084.org.readthedocs.build/