qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ABS, SGN Functions
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
ABS returns the absolute value of a number.
SGN returns a value indicating the sign of a numeric expression (1 if the
expression is positive, 0 if it is zero, or -1 if it is negative).
 
ABS(numeric-expression)
SGN(numeric-expression)
 
    ■ numeric-expression    Any numeric expression.
 
Example:
    PRINT ABS(45.5 - 100!)           'Output is:  54.5
    PRINT SGN(1), SGN(-1), SGN(0)    'Output is:  1  -1  0