]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-99880: document rounding mode for new-style formatting (GH-121481)
authorSergey B Kirpichev <skirpichev@gmail.com>
Sat, 2 Nov 2024 17:11:12 +0000 (20:11 +0300)
committerGitHub <noreply@github.com>
Sat, 2 Nov 2024 17:11:12 +0000 (10:11 -0700)
commit7d7d56d8b1147a6b85e1c09d01b164df7c5c4942
tree25dd02e4285b6a7a41b307c3ed7aed654f52155f
parent868bfcc02ed42a1042851830b79c6877b7f1c7a8
gh-99880: document rounding mode for new-style formatting (GH-121481)

* gh-99880: document rounding mode for new-style formatting

The CPython uses _Py_dg_dtoa(), which does rounding to nearest with half
to even tie-breaking rule.

If that functions is unavailable, PyOS_double_to_string() fallbacks to
system snprintf().  Since CPython 3.12, build requirements include C11
compiler *and* support for IEEE 754 floating point numbers (Annex F).
This means that FE_TONEAREST macro is available and, per default,
printf-like functions should use same rounding mode as _Py_dg_dtoa().

* Update Doc/library/string.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/library/string.rst