Sign of a number.
sign([2,0,-3, 2+3j])
num | The input number, complex number, quantity, or matrix. |
return value | The sign of the input. |
The input can be any real number, complex number, matrix, or quantity. In case of real numbers and
quantites, the result is determined by the sign of the number:
- If num $ <0 $, the result is -1.
- If num $ ==0 $, the result is 0.
- If num $ >0 $, the result is 1.
In case of complex numbers, the result is the normalized complex number numabs(num).
In case of matrices, the operation is done elementwise.