https://github.com/python/cpython/commit/f89fafed25e2a942cf5713dc7e806f223f859c28
commit: f89fafed25e2a942cf5713dc7e806f223f859c28
branch: main
author: Sergey B Kirpichev <[email protected]>
committer: hugovk <[email protected]>
date: 2026-03-27T19:38:28+02:00
summary:
Mention _Float16 (type from Annex H of the C23) in the struct docs (#146243)
files:
M Doc/conf.py
M Doc/library/struct.rst
diff --git a/Doc/conf.py b/Doc/conf.py
index 4ac6f6192a0806..07e0d113a24c10 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -177,6 +177,7 @@
('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 644598d69d6ec4..fa0fb19d852f86 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 <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 <half precision format_>`_ for more information.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]