Get the sign of a number
sign expression
Returns +1 if the expression has a positive value, 0 if the expression is equal to 0, and -1
if the expression has a negative value.
Example:
print sign 5
print sign 0
print sign -5
Output:
1
0
-1
See also:
Table of Content