Skip to content
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

gh-99880: document rounding mode for new-style formatting #121481

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/library/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ The available presentation types for :class:`float` and
| | as altered by the other format modifiers. |
+---------+----------------------------------------------------------+

The result should be correctly rounded to a given precision ``p`` of digits
after the decimal point. The rounding mode for :class:`float` matches that
of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding
mode of the current :ref:`context <decimal-context>` will be used.

The available presentation types for :class:`complex` are the same as those for
:class:`float` (``'%'`` is not allowed). Both the real and imaginary components
of a complex number are formatted as floating-point numbers, according to the
Expand Down
Loading