Skip to content

Commit 9b06b21

Browse files
committed
DOC: update notes on sign for complex numbers
Update the notes section to reflect the changed definition for complex numbers.
1 parent 128d1ae commit 9b06b21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

numpy/_core/code_generators/ufunc_docstrings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,8 +3619,10 @@ def add_newdoc(place, name, doc):
36193619
Notes
36203620
-----
36213621
There is more than one definition of sign in common use for complex
3622-
numbers. The definition used here is equivalent to :math:`x/\\sqrt{x*x}`
3623-
which is different from a common alternative, :math:`x/|x|`.
3622+
numbers. The definition used here, :math:`x/|x|`, is the more common
3623+
and useful one, but is different from the one used in numpy prior to
3624+
version 2.0, :math:`x/\\sqrt{x*x}`, which is equivalent to
3625+
``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``.
36243626
36253627
Examples
36263628
--------

0 commit comments

Comments
 (0)