1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Mon Mar 29 22:31:13 1993, David Metcalfe
28 .\" Modified Sun Jun 6 23:27:50 1993, David Metcalfe
29 .\" Modified Sat Jul 24 21:45:37 1993, Rik Faith (faith@cs.unc.edu)
30 .\" Modified Sat Dec 16 15:02:59 2000, Joseph S. Myers
32 .TH ABS 3 2010-09-20 "GNU" "Linux Programmer's Manual"
34 abs, labs, llabs, imaxabs \- compute the absolute value of an integer
37 .B #include <stdlib.h>
39 .BI "int abs(int " j );
41 .BI "long int labs(long int " j );
43 .BI "long long int llabs(long long int " j );
45 .B #include <inttypes.h>
47 .BI "intmax_t imaxabs(intmax_t " j );
51 Feature Test Macro Requirements for glibc (see
52 .BR feature_test_macros (7)):
58 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
59 _POSIX_C_SOURCE\ >=\ 200112L;
68 function computes the absolute value of the integer
75 functions compute the absolute value of the argument \fIj\fP of the
76 appropriate integer type for the function.
78 Returns the absolute value of the integer argument, of the appropriate
79 integer type for the function.
81 SVr4, POSIX.1-2001, 4.3BSD, C99.
82 .\" POSIX.1 (1996 edition) only requires the
90 functions; the functions
96 Trying to take the absolute value of the most negative integer
101 function is included in glibc since version 2.0, but
102 is not in libc5 or libc4.
105 function is included in
106 glibc since version 2.1.1.
110 to be declared, it may be necessary to define
111 \fB_ISOC99_SOURCE\fP or \fB_ISOC9X_SOURCE\fP (depending on the
112 version of glibc) before including any standard headers.
118 as built-in functions.