Skip to content

Commit b0fab92

Browse files
[3.13] Mention _Float16 (type from Annex H of the C23) in the struct docs (GH-146243) (#146530)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
1 parent 04fe383 commit b0fab92

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
@@ -167,6 +167,7 @@
167167
('c:type', '__int64'),
168168
('c:type', 'unsigned __int64'),
169169
('c:type', 'double'),
170+
('c:type', '_Float16'),
170171
# Standard C structures
171172
('c:struct', 'in6_addr'),
172173
('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
+--------+--------------------------+--------------------+----------------+------------+
@@ -315,7 +315,9 @@ Notes:
315315
revision of the `IEEE 754 standard <ieee 754 standard_>`_. It has a sign
316316
bit, a 5-bit exponent and 11-bit precision (with 10 bits explicitly stored),
317317
and can represent numbers between approximately ``6.1e-05`` and ``6.5e+04``
318-
at full precision. This type is not widely supported by C compilers: on a
318+
at full precision. This type is not widely supported by C compilers:
319+
it's available as :c:expr:`_Float16` type, if the compiler supports the Annex H
320+
of the C23 standard. On a
319321
typical machine, an unsigned short can be used for storage, but not for math
320322
operations. See the Wikipedia page on the `half-precision floating-point
321323
format <half precision format_>`_ for more information.

0 commit comments

Comments
 (0)