Sgn


Function Sgn( numeric expression )


Returns an integer that reflects the sign of numeric expression.


Syntax a = Sgn( b )


Remarks

If numeric expression is positive, SGN returns 1.

If numeric expression is zero, SGN returns 0.

If numeric expression is negative, SGN returns -1.


See Also:

Abs Math Functions


Example Script


NUMBER i

FOR i = -2 TO 2

PRINT SGN(i)

NEXT i


Script Output


-1

-1

0

1

1