NAME

sgn - signum function

SYNOPSIS

v = sgn(NumExpr)

DESCRIPTION

Sgn returns a 1 if the argument is positive, a -1 if the argument is negative, and a 0 if the argument is zero.  The argument may be any numeric expression. 

EXAMPLE

The program
	on sgn(x) + 2 goto 1, 2, 3
branches to 1 if x is negative, 2 if x is zero, and 3 if x is positive. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber