These functions are provided for obtaining the *absolute value* (or
*magnitude*) of a number. The absolute value of a real number
`x` is `x` is `x` is positive, -`x` if `x` is
negative. For a complex number `z`, whose real part is `x` and
whose imaginary part is `y`, the absolute value is ```
sqrt
(
```

.
`x`*`x` + `y`*`y`)

Prototypes for `abs`

and `labs`

are in ``stdlib.h'`;
`fabs`

and `cabs`

are declared in ``math.h'`.

__Function:__int**abs***(int*`number`)-
This function returns the absolute value of
`number`.Most computers use a two's complement integer representation, in which the absolute value of

`INT_MIN`

(the smallest possible`int`

) cannot be represented; thus,`abs (INT_MIN)`

is not defined.

__Function:__long int**labs***(long int*`number`)-
This is similar to
`abs`

, except that both the argument and result are of type`long int`

rather than`int`

.

__Function:__double**fabs***(double*`number`)-
This function returns the absolute value of the floating-point number
`number`.

__Function:__double**cabs***(struct { double real, imag; }*`z`)-
The
`cabs`

function returns the absolute value of the complex number`z`, whose real part is

and whose imaginary part is`z`.real

. (See also the function`z`.imag`hypot`

in section Exponentiation and Logarithms.) The value is:sqrt (

`z`.real*`z`.real +`z`.imag*`z`.imag)

Go to the first, previous, next, last section, table of contents.