•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileABS(x)
SGN(x)

x: aexp

The function ABS() returns the absolute value of a numerical expression. The
returned value is the same as the given value, except that its sign is ignored.
The sign of the returned value is always made positive.

With the function SGN() one can determine the sign of a numerical expression
thus:

    x           SGN(x)
    Negative    -1
    Equal to 0  0
    Positive    1

Example:

    x=-2
    y=ABS(x)
    PRINT SGN(x),ABS(5-3),SGN(ABS(x*3))

--> Displays the numbers -1, 2, and 1.