Sgn Function

Determines the sign of the operand.

Syntax
Sgn(Operand )

Parameters

operand
Specify a numeric value.

Return Values

  • 1: If the operand is a positive value.
  • 0: If the operand is a 0
  • -1: If the operand is a negative value.

Description
The Sgn function determines the sign of the numeric value of the operand.

See Also
Abs, And, Atan, Atan2, Cos, Int, Mod, Or, Not, Sin, Sqr, Str$, Tan, Val, Xor

Sgn Function Example
This is a simple command window example on the usage of the Sgn function.

>print sgn(123)
 1
>print sgn(-123)
 -1
>