diff options
Diffstat (limited to 'Doc/library/struct.rst')
-rw-r--r-- | Doc/library/struct.rst | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 071b90b9359..17fc479fd0c 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -260,6 +260,10 @@ platform-dependent. +--------+--------------------------+--------------------+----------------+------------+ | ``d`` | :c:expr:`double` | float | 8 | \(4) | +--------+--------------------------+--------------------+----------------+------------+ +| ``F`` | :c:expr:`float complex` | complex | 8 | \(10) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) | ++--------+--------------------------+--------------------+----------------+------------+ | ``s`` | :c:expr:`char[]` | bytes | | \(9) | +--------+--------------------------+--------------------+----------------+------------+ | ``p`` | :c:expr:`char[]` | bytes | | \(8) | @@ -267,17 +271,6 @@ platform-dependent. | ``P`` | :c:expr:`void \*` | integer | | \(5) | +--------+--------------------------+--------------------+----------------+------------+ -Additionally, if IEC 60559 compatible complex arithmetic (Annex G of the -C11 standard) is supported, the following format characters are available: - -+--------+--------------------------+--------------------+----------------+------------+ -| Format | C Type | Python type | Standard size | Notes | -+========+==========================+====================+================+============+ -| ``F`` | :c:expr:`float complex` | complex | 8 | \(10) | -+--------+--------------------------+--------------------+----------------+------------+ -| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) | -+--------+--------------------------+--------------------+----------------+------------+ - .. versionchanged:: 3.3 Added support for the ``'n'`` and ``'N'`` formats. @@ -364,9 +357,14 @@ Notes: ``'0c'`` means 0 characters). (10) - For the ``'E'`` and ``'C'`` format characters, the packed representation uses + For the ``'F'`` and ``'D'`` format characters, the packed representation uses 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 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, the format string ``'4h'`` means exactly the same as ``'hhhh'``. |