diff options
author | Victor Stinner <vstinner@python.org> | 2022-03-14 15:51:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 15:51:51 (GMT) |
commit | 11c25b87aeed162d422bc18530fe9699f311e586 (patch) | |
tree | d786d1e51e6b88217d99d6b2360708acb48cf307 /Doc/c-api/float.rst | |
parent | f00ced8396f2d7683e58b9d5ebbf5797992bf477 (diff) | |
download | cpython-11c25b87aeed162d422bc18530fe9699f311e586.zip cpython-11c25b87aeed162d422bc18530fe9699f311e586.tar.gz cpython-11c25b87aeed162d422bc18530fe9699f311e586.tar.bz2 |
bpo-46906: Mention native endian in PyFloat_Pack8() doc (GH-31866)
Diffstat (limited to 'Doc/c-api/float.rst')
-rw-r--r-- | Doc/c-api/float.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst index fd81683..b306caf 100644 --- a/Doc/c-api/float.rst +++ b/Doc/c-api/float.rst @@ -109,7 +109,9 @@ Pack functions The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:type:`int` argument, non-zero if you want the bytes string in little-endian format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero if you -want big-endian format (exponent first, at *p*). +want big-endian format (exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN` +constant can be used to use the native endian: it is equal to ``1`` on big +endian processor, or ``0`` on little endian processor. Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, most likely :exc:`OverflowError`). @@ -138,7 +140,9 @@ Unpack functions The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:type:`int` argument, non-zero if the bytes string is in little-endian format (exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian -(exponent first, at *p*). +(exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN` constant can be used to +use the native endian: it is equal to ``1`` on big endian processor, or ``0`` +on little endian processor. Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:`PyErr_Occurred` is true (and an exception is set, most likely |