Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Petr Viktorin <encukou@gmail.com>
  • Loading branch information
skirpichev and encukou authored May 1, 2025
commit f1fa51bab386a2323aefc9e82570866361c6ce4a
9 changes: 4 additions & 5 deletions Doc/library/struct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,10 @@ Notes:
For the ``'E'`` and ``'C'`` format characters, the packed representation uses
Comment thread
skirpichev marked this conversation as resolved.
Outdated
the IEEE 754 binary32 and binary64 format for components of the complex
number, regardless of the floating-point format used by the platform.
Note that support for complex types is available unconditionally,
regardless on support IEC 60559 compatible complex arithmetic (Annex G of
the C11 standard) by the compiler. Each complex type is interpreted as an
array type containing exactly two elements of the corresponding real type
(real and imaginary parts, respectively).
Note that complex types (``F`` and ``D``) are available unconditionally,
despite complex types being an optional feature in C.
As specified in the C11 standard, each complex type is represented by a
two-element C array containing, respectively, the real and imaginary parts.


A format character may be preceded by an integral repeat count. For example,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_ctypes/cfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ d_get(void *ptr, Py_ssize_t size)

#if defined(Py_FFI_SUPPORT_C_COMPLEX)

/* We don't use Annex G complex types here, using arrays instead, as the C17+
/* We don't use _Complex types here, using arrays instead, as the C11+
standard says: "Each complex type has the same representation and alignment
requirements as an array type containing exactly two elements of the
corresponding real type; the first element is equal to the real part, and
Expand Down