diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index bfa3ad221..068644132 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -2801,6 +2801,11 @@ add_newdoc('numpy.core.umath', 'sign', The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. + For complex inputs, the `sign` function returns: + ``-1+0j if x.real < 0, + 1+0j if x.real > 0, + sign(x.imag)+0j if x.real == 0.`` + Parameters ---------- x : array_like @@ -2811,12 +2816,20 @@ add_newdoc('numpy.core.umath', 'sign', y : ndarray The sign of `x`. + Notes + ----- + There is more than one definition of sign in common use for complex + numbers. The definition used here is equivalent to :math:`x/\\sqrt{x*x}` + which is different from a common alternative, :math:`x/|x|`. + Examples -------- >>> np.sign([-5., 4.5]) array([-1., 1.]) >>> np.sign(0) 0 + >>> np.sign(5-2j) + (1+0j) """) |