From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:44:27 +0000 (+0100) Subject: [3.14] Mention _Float16 (type from Annex H of the C23) in the struct docs (GH-146243... X-Git-Tag: v3.14.4~56 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc8497b77a24d0b2ae963dae8eca70e153b8f600;p=thirdparty%2FPython%2Fcpython.git [3.14] Mention _Float16 (type from Annex H of the C23) in the struct docs (GH-146243) (#146529) Co-authored-by: Sergey B Kirpichev --- diff --git a/Doc/conf.py b/Doc/conf.py index f4427819eda8..f24a4d1fa1a3 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -176,6 +176,7 @@ nitpick_ignore = [ ('c:type', '__int64'), ('c:type', 'unsigned __int64'), ('c:type', 'double'), + ('c:type', '_Float16'), # Standard C structures ('c:struct', 'in6_addr'), ('c:struct', 'in_addr'), diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 644598d69d6e..fa0fb19d852f 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -254,7 +254,7 @@ platform-dependent. +--------+--------------------------+--------------------+----------------+------------+ | ``N`` | :c:type:`size_t` | integer | | \(3) | +--------+--------------------------+--------------------+----------------+------------+ -| ``e`` | \(6) | float | 2 | \(4) | +| ``e`` | :c:expr:`_Float16` | float | 2 | \(4), \(6) | +--------+--------------------------+--------------------+----------------+------------+ | ``f`` | :c:expr:`float` | float | 4 | \(4) | +--------+--------------------------+--------------------+----------------+------------+ @@ -328,7 +328,9 @@ Notes: revision of the `IEEE 754 standard `_. It has a sign bit, a 5-bit exponent and 11-bit precision (with 10 bits explicitly stored), and can represent numbers between approximately ``6.1e-05`` and ``6.5e+04`` - at full precision. This type is not widely supported by C compilers: on a + at full precision. This type is not widely supported by C compilers: + it's available as :c:expr:`_Float16` type, if the compiler supports the Annex H + of the C23 standard. On a typical machine, an unsigned short can be used for storage, but not for math operations. See the Wikipedia page on the `half-precision floating-point format `_ for more information.