abs, labs, llabs, imaxbs - vrátí absolutní hodnotu čísla typu integer
Standardní knihovna C (libc, -lc)
#include <stdlib.h>
int abs(int j);
long labs(long j);
long long llabs(long long j);
#include <inttypes.h>
intmax_t imaxabs(intmax_t j);
llabs():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
Funkce abs() počítá absolutní hodnotu čísla j typu integer. Funkce labs(), llabs() a imaxabs()počítají absolutní hodnotu argumentu j typu odpovídajícímu hlavičce funkce.
Returns the absolute value of the integer argument, of the appropriate integer type for the function.
Vysvětlení pojmů použitých v této části viz attributes(7)EN.
| Rozhraní | Atribut | Hodnota |
| abs(), labs(), llabs(), imaxabs() | Thread safety | MT-Safe |
POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD.
Absolutní hodnota nejmenšího čísla typu integer není definována.
The llabs() function is included since glibc 2.0. The imaxabs() function is included since glibc 2.1.1.
Aby byla funkce llabs() dostupná, může být nezbytné definovat _ISO99_SOURCE nebo _ISOC9X_SOURCE (v závislosti na verzi glibc) dříve, než budou vloženy jakékoli hlavičkové soubory.
By default, GCC handles abs(), labs(), and (since GCC 3.0) llabs() and imaxabs() as built-in functions.