System Functions

SGN( )

Return Sign of Value

Format

SGN(num[,ERR=stmtref])
 
Where:

num

Value whose sign is to be returned. Numeric expression.

stmtref

Program line number or statement label to which to transfer control.

Returns

Status code, 0 (zero), 1 or -1.

Description

The SGN( ) function returns a numeric status code for the sign of a value:

 1

If num is greater than zero

 0

If num equals zero

-1

If num is less than zero

Example

?sgn(23.492) ! yields 1
?sgn(4-4) ! yields 0
?sgn(4-7.34) ! yields -1