SGN
Determine Sign of Numeric Value
This numeric function returns +1, 0, or -1 indicating the sign of the specified numeric-value:
-1 if the value is negative. 0 if the value is 0.
+1 if the value is positive.
Syntax
Section titled “Syntax”SGN (numeric-value [,ERR=line-ref|,ERC=error-code])numeric-value- is any number.
line-ref- is the program line number or label to branch to if an error is produced by this function.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Examples
Section titled “Examples”SGN (23)returns the value 1 for positive.
SGN (-.34)returns the value -1 for negative.
SGN (X*4)If X = -3, returns the value -1 for negative.
LET Z = SGN (INT (.76) )assigns Z the value 0.
From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF