Contents|Index|Previous|Next

abs
[integer absolute value (magnitude)]

SYNOPSIS
#include <stdlib.h>
int abs(int I);

DESCRIPTION
abs returns |x|, the absolute value of I (also called the magnitude of I). That is, if I is negative, the result is the opposite of I, but if I is nonnegative the result is i.

The similar function, labs, uses and returns long rather than int values.

RETURNS
The result is a nonnegative integer.

COMPLIANCE
abs is ANSI.

No supporting OS subroutines are required.