sign¶
- sign(x: array, /) array ¶
Returns an indication of the sign of a number for each element
x_i
of the input arrayx
.Special cases
If
x_i
is less than0
, the result is-1
.If
x_i
is either-0
or+0
, the result is0
.If
x_i
is greater than0
, the result is+1
.
- Parameters:
x (array) – input array. Should have a numeric data type.
- Returns:
out (array) – an array containing the evaluated result for each element in
x
. The returned array must have the same data type asx
.