1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\" Modified Mon Mar 29 22:31:13 1993, David Metcalfe
30 .\" Modified Sun Jun 6 23:27:50 1993, David Metcalfe
31 .\" Modified Sat Jul 24 21:45:37 1993, Rik Faith (faith@cs.unc.edu)
32 .\" Modified Sat Dec 16 15:02:59 2000, Joseph S. Myers
34 .TH ABS 3 2016-03-15 "GNU" "Linux Programmer's Manual"
36 abs, labs, llabs, imaxabs \- compute the absolute value of an integer
39 .B #include <stdlib.h>
41 .BI "int abs(int " j );
43 .BI "long int labs(long int " j );
45 .BI "long long int llabs(long long int " j );
47 .B #include <inttypes.h>
49 .BI "intmax_t imaxabs(intmax_t " j );
53 Feature Test Macro Requirements for glibc (see
54 .BR feature_test_macros (7)):
60 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
66 function computes the absolute value of the integer
73 functions compute the absolute value of the argument \fIj\fP of the
74 appropriate integer type for the function.
76 Returns the absolute value of the integer argument, of the appropriate
77 integer type for the function.
79 For an explanation of the terms used in this section, see
86 Interface Attribute Value
92 T} Thread safety MT-Safe
96 POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD.
97 .\" POSIX.1 (1996 edition) requires only the
105 functions; the functions
111 Trying to take the absolute value of the most negative integer
116 function is included in glibc since version 2.0.
119 function is included in
120 glibc since version 2.1.1.
124 to be declared, it may be necessary to define
125 \fB_ISOC99_SOURCE\fP or \fB_ISOC9X_SOURCE\fP (depending on the
126 version of glibc) before including any standard headers.
136 as built-in functions.