Skip to content

Commit 4777194

Browse files
skirpichevmiss-islington
authored andcommitted
Mention _Float16 (type from Annex H of the C23) in the struct docs (GH-146243)
(cherry picked from commit f89fafe) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
1 parent 8fde8fa commit 4777194

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
('c:type', '__int64'),
177177
('c:type', 'unsigned __int64'),
178178
('c:type', 'double'),
179+
('c:type', '_Float16'),
179180
# Standard C structures
180181
('c:struct', 'in6_addr'),
181182
('c:struct', 'in_addr'),

Doc/library/struct.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ platform-dependent.
254254
+--------+--------------------------+--------------------+----------------+------------+
255255
| ``N`` | :c:type:`size_t` | integer | | \(3) |
256256
+--------+--------------------------+--------------------+----------------+------------+
257-
| ``e`` | \(6) | float | 2 | \(4) |
257+
| ``e`` | :c:expr:`_Float16` | float | 2 | \(4), \(6) |
258258
+--------+--------------------------+--------------------+----------------+------------+
259259
| ``f`` | :c:expr:`float` | float | 4 | \(4) |
260260
+--------+--------------------------+--------------------+----------------+------------+
@@ -328,7 +328,9 @@ Notes:
328328
revision of the `IEEE 754 standard <ieee 754 standard_>`_. It has a sign
329329
bit, a 5-bit exponent and 11-bit precision (with 10 bits explicitly stored),
330330
and can represent numbers between approximately ``6.1e-05`` and ``6.5e+04``
331-
at full precision. This type is not widely supported by C compilers: on a
331+
at full precision. This type is not widely supported by C compilers:
332+
it's available as :c:expr:`_Float16` type, if the compiler supports the Annex H
333+
of the C23 standard. On a
332334
typical machine, an unsigned short can be used for storage, but not for math
333335
operations. See the Wikipedia page on the `half-precision floating-point
334336
format <half precision format_>`_ for more information.

0 commit comments

Comments
 (0)