Next: Access Intrinsic, Previous: Abort Intrinsic, Up: Table of Intrinsic Functions

Abs(A)

Abs: `INTEGER`

or `REAL`

function.
The exact type depends on that of argument `A`—if `A` is
`COMPLEX`

, this function's type is `REAL`

with the same ``KIND=`' value as the type of `A`.
Otherwise, this function's type is the same as that of `A`.

`A`: `INTEGER`

, `REAL`

, or `COMPLEX`

; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the absolute value of `A`.

If `A` is type `COMPLEX`

, the absolute
value is computed as:

SQRT(REALPART(A)**2+IMAGPART(A)**2)

Otherwise, it is computed by negating `A` if
it is negative, or returning `A`.

See Sign Intrinsic, for how to explicitly compute the positive or negative form of the absolute value of an expression.