Skip to content
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
  • Loading branch information
skirpichev and StanFromIreland authored Mar 13, 2026
commit 83b7adb1307c2b302fbabeb6335cb72d7ae0149b
9 changes: 4 additions & 5 deletions Doc/c-api/float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,15 @@ is the IEEE 754 binary64 double precision format, although the NaN type may
not be preserved on some platforms while unpacking (signaling NaNs become quiet
NaNs), for example on x86 systems in 32-bit mode.

It's assumed, that the :c:expr:`double` type has the IEEE 754 binary64 double
It's assumed that the :c:expr:`double` type has the IEEE 754 binary64 double
precision format. What happens if it's not true is partly accidental (alas).
On non-IEEE platforms with more precision, or larger dynamic range, than IEEE
754 supports, not all values can be packed; on non-IEEE platforms with less
precision, or smaller dynamic range, not all values can be unpacked. The
packing of special numbers like INFs and NaNs (if such things exist on the
platform) may be not handled correctly, and attempting to unpack a bytes string
platform) may not be handled correctly, and attempting to unpack a bytes string
containing an IEEE INF or NaN may raise an exception.

Comment thread
skirpichev marked this conversation as resolved.

.. versionadded:: 3.11

Pack functions
Expand All @@ -224,7 +223,7 @@ Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
most likely :exc:`OverflowError`).

.. impl-detail::
Comment thread
skirpichev marked this conversation as resolved.
Outdated
The :c:func:`PyFloat_Pack8` function always succeeds in the CPython.
The :c:func:`PyFloat_Pack8` function always succeeds in CPython.

.. c:function:: int PyFloat_Pack2(double x, char *p, int le)

Expand Down Expand Up @@ -254,7 +253,7 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
:exc:`OverflowError`).

.. impl-detail::
These functions always succeed in the CPython.
These functions always succeed in CPython.

.. c:function:: double PyFloat_Unpack2(const char *p, int le)

Expand Down
Loading