Contents | Prev | Next

7.2.2 The abs function

Description

The abs function returns the absolute value (i.e. the magnitude) of the parameter passed to it. The type of the value returned by this function is always the same as the type of it's parameter.

Parameter

The abs function's only parameter is the numeric expression (i.e. an expression of integral type or of real type) whose absolute value is to be returned.

Example

   abs(-10)  returns  10
   abs(10)   returns  10
   abs(-6.7) returns  6.7
   abs(6.7)  returns  6.7

Portability

Operating Systems: All
Standard Pascal: Yes

Contents | Prev | Next