Skip to content

gh-85417: remove misleaning remarks about branch cuts for platforms without signed zero #102047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
46 changes: 23 additions & 23 deletions Doc/library/cmath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ the function is then applied to the result of the conversion.

.. note::

On platforms with hardware and system-level support for signed
zeros, functions involving branch cuts are continuous on *both*
sides of the branch cut: the sign of the zero distinguishes one
side of the branch cut from the other. On platforms that do not
support signed zeros the continuity is as specified below.
The functions of this module are continuous onto both sides of their
branch cuts, taking into account the sign of zero. For example::

>>> sqrt(complex(-1, +0.0))
1j
>>> sqrt(complex(-1, -0.0))
-1j
>>> atan(complex(+0.0, 2))
(1.5707963267948966+0.5493061443340549j)
>>> atan(complex(-0.0, 2))
(-1.5707963267948966+0.5493061443340549j)


Conversions to and from polar coordinates
Expand Down Expand Up @@ -47,11 +53,9 @@ rectangular coordinates to polar coordinates and back.
Return the phase of *x* (also known as the *argument* of *x*), as a
float. ``phase(x)`` is equivalent to ``math.atan2(x.imag,
x.real)``. The result lies in the range [-\ *π*, *π*], and the branch
cut for this operation lies along the negative real axis,
continuous from above. On systems with support for signed zeros
(which includes most systems in current use), this means that the
sign of the result is the same as the sign of ``x.imag``, even when
``x.imag`` is zero::
cut for this operation lies along the negative real axis.
continuous from above. This means that the sign of the result is
the same as the sign of ``x.imag``, even when ``x.imag`` is zero::

>>> phase(complex(-1.0, 0.0))
3.141592653589793
Expand Down Expand Up @@ -93,7 +97,7 @@ Power and logarithmic functions

Returns the logarithm of *x* to the given *base*. If the *base* is not
specified, returns the natural logarithm of *x*. There is one branch cut, from 0
along the negative real axis to -∞, continuous from above.
along the negative real axis to -∞.


.. function:: log10(x)
Expand All @@ -113,8 +117,7 @@ Trigonometric functions
.. function:: acos(x)

Return the arc cosine of *x*. There are two branch cuts: One extends right from
1 along the real axis to ∞, continuous from below. The other extends left from
-1 along the real axis to -∞, continuous from above.
1 along the real axis to ∞. The other extends left from -1 along the real axis to -∞.


.. function:: asin(x)
Expand All @@ -125,9 +128,8 @@ Trigonometric functions
.. function:: atan(x)

Return the arc tangent of *x*. There are two branch cuts: One extends from
``1j`` along the imaginary axis to ``∞j``, continuous from the right. The
other extends from ``-1j`` along the imaginary axis to ``-∞j``, continuous
from the left.
``1j`` along the imaginary axis to ``∞j``. The other extends from
``-1j`` along the imaginary axis to ``-∞j``.


.. function:: cos(x)
Expand All @@ -151,23 +153,21 @@ Hyperbolic functions
.. function:: acosh(x)

Return the inverse hyperbolic cosine of *x*. There is one branch cut,
extending left from 1 along the real axis to -∞, continuous from above.
extending left from 1 along the real axis to -∞.


.. function:: asinh(x)

Return the inverse hyperbolic sine of *x*. There are two branch cuts:
One extends from ``1j`` along the imaginary axis to ``∞j``,
continuous from the right. The other extends from ``-1j`` along
the imaginary axis to ``-∞j``, continuous from the left.
One extends from ``1j`` along the imaginary axis to ``∞j``.
The other extends from ``-1j`` along the imaginary axis to ``-∞j``.


.. function:: atanh(x)

Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One
extends from ``1`` along the real axis to ``∞``, continuous from below. The
other extends from ``-1`` along the real axis to ``-∞``, continuous from
above.
extends from ``1`` along the real axis to ``∞``. The
other extends from ``-1`` along the real axis to ``-∞``.


.. function:: cosh(x)
Expand Down