sign(var x)
Calculates the sign of x .
Parameters:
x - any number.
Returns:
-1 |
if x < 0 |
0 |
if x == 0 |
1 |
if x > 0 |
Speed:
Fast
Example:
x = sign(2); // x is now 1
x = sign(-599); // x is now -1
x = sign(0); // x is now 0
See also:
abs ► latest version online