Skip to content

Commit f89fafe

Browse files
authored
Mention _Float16 (type from Annex H of the C23) in the struct docs (#146243)
1 parent a492d9f commit f89fafe

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
@@ -177,6 +177,7 @@
177177
('c:type', '__int64'),
178178
('c:type', 'unsigned __int64'),
179179
('c:type', 'double'),
180+
('c:type', '_Float16'),
180181
# Standard C structures
181182
('c:struct', 'in6_addr'),
182183
('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)