]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man3/abs.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / abs.3
... / ...
CommitLineData
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
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.
7.\"
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.
12.\"
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
19.\" professionally.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
23.\" %%%LICENSE_END
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
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
33.\"
34.TH ABS 3 2016-03-15 "GNU" "Linux Programmer's Manual"
35.SH NAME
36abs, labs, llabs, imaxabs \- compute the absolute value of an integer
37.SH SYNOPSIS
38.nf
39.B #include <stdlib.h>
40.PP
41.BI "int abs(int " j );
42.BI "long int labs(long int " j );
43.BI "long long int llabs(long long int " j );
44
45.B #include <inttypes.h>
46.PP
47.BI "intmax_t imaxabs(intmax_t " j );
48.fi
49.PP
50.in -4n
51Feature Test Macro Requirements for glibc (see
52.BR feature_test_macros (7)):
53.in
54.PP
55.ad l
56.BR llabs ():
57.RS 4
58_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
59.RE
60.ad
61.SH DESCRIPTION
62The
63.BR abs ()
64function computes the absolute value of the integer
65argument \fIj\fP.
66The
67.BR labs (),
68.BR llabs ()
69and
70.BR imaxabs ()
71functions compute the absolute value of the argument \fIj\fP of the
72appropriate integer type for the function.
73.SH RETURN VALUE
74Returns the absolute value of the integer argument, of the appropriate
75integer type for the function.
76.SH ATTRIBUTES
77For an explanation of the terms used in this section, see
78.BR attributes (7).
79.ad l
80.TS
81allbox;
82lb lb lb
83l l l.
84Interface Attribute Value
85T{
86.BR abs (),
87.BR labs (),
88.BR llabs (),
89.BR imaxabs ()
90T} Thread safety MT-Safe
91.TE
92.ad
93.SH CONFORMING TO
94POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD.
95.\" POSIX.1 (1996 edition) requires only the
96.\" .BR abs ()
97.\" function.
98C89 only
99includes the
100.BR abs ()
101and
102.BR labs ()
103functions; the functions
104.BR llabs ()
105and
106.BR imaxabs ()
107were added in C99.
108.SH NOTES
109Trying to take the absolute value of the most negative integer
110is not defined.
111.PP
112The
113.BR llabs ()
114function is included in glibc since version 2.0.
115The
116.BR imaxabs ()
117function is included in
118glibc since version 2.1.1.
119.PP
120For
121.BR llabs ()
122to be declared, it may be necessary to define
123\fB_ISOC99_SOURCE\fP or \fB_ISOC9X_SOURCE\fP (depending on the
124version of glibc) before including any standard headers.
125.PP
126By default,
127GCC handles
128.BR abs (),
129.BR labs (),
130and (since GCC 3.0)
131.BR llabs ()
132and
133.BR imaxabs ()
134as built-in functions.
135.SH SEE ALSO
136.BR cabs (3),
137.BR ceil (3),
138.BR fabs (3),
139.BR floor (3),
140.BR rint (3)