1ABS(3)                     Linux Programmer's Manual                    ABS(3)
2
3
4

NAME

6       abs, labs, llabs, imaxabs - compute the absolute value of an integer
7

SYNOPSIS

9       #include <stdlib.h>
10
11       int abs(int j);
12       long int labs(long int j);
13       long long int llabs(long long int j);
14
15       #include <inttypes.h>
16
17       intmax_t imaxabs(intmax_t j);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       llabs():
22           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
23

DESCRIPTION

25       The  abs() function computes the absolute value of the integer argument
26       j.  The labs(), llabs() and imaxabs() functions  compute  the  absolute
27       value  of  the argument j of the appropriate integer type for the func‐
28       tion.
29

RETURN VALUE

31       Returns the absolute value of the integer argument, of the  appropriate
32       integer type for the function.
33

ATTRIBUTES

35       For   an   explanation   of   the  terms  used  in  this  section,  see
36       attributes(7).
37
38       ┌───────────────────┬───────────────┬─────────┐
39Interface          Attribute     Value   
40       ├───────────────────┼───────────────┼─────────┤
41abs(), labs(),     │ Thread safety │ MT-Safe │
42llabs(), imaxabs() │               │         │
43       └───────────────────┴───────────────┴─────────┘

CONFORMING TO

45       POSIX.1-2001,  POSIX.1-2008,  C99, SVr4, 4.3BSD.  C89 only includes the
46       abs() and labs() functions; the functions llabs()  and  imaxabs()  were
47       added in C99.
48

NOTES

50       Trying  to  take the absolute value of the most negative integer is not
51       defined.
52
53       The llabs() function is included in glibc since version 2.0.  The imax‐
54       abs() function is included in glibc since version 2.1.1.
55
56       For   llabs()   to   be   declared,  it  may  be  necessary  to  define
57       _ISOC99_SOURCE or _ISOC9X_SOURCE (depending on the  version  of  glibc)
58       before including any standard headers.
59
60       By  default, GCC handles abs(), labs(), and (since GCC 3.0) llabs() and
61       imaxabs() as built-in functions.
62

SEE ALSO

64       cabs(3), ceil(3), fabs(3), floor(3), rint(3)
65

COLOPHON

67       This page is part of release 5.04 of the Linux  man-pages  project.   A
68       description  of  the project, information about reporting bugs, and the
69       latest    version    of    this    page,    can     be     found     at
70       https://www.kernel.org/doc/man-pages/.
71
72
73
74GNU                               2016-03-15                            ABS(3)
Impressum