Debian Codegraph @

upstream/debian-unstable/man3/abs.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH abs 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 abs, labs, llabs, imaxabs,
10 uabs, ulabs, ullabs, umaxabs
11 \-
12 compute the absolute value of an integer
13 .SH LIBRARY
14 Standard C library
15 .RI ( libc ,\~ \-lc )
16 .SH SYNOPSIS
17 .nf
18 .B #include <stdlib.h>
19 .P
20 .BI "int abs(int " j );
21 .BI "long labs(long " j );
22 .BI "long long llabs(long long " j );
23 .P
24 .BI "unsigned int uabs(int " j );
25 .BI "unsigned long ulabs(long " j );
26 .BI "unsigned long long ullabs(long long " j );
27 .P
28 .B #include <inttypes.h>
29 .P
30 .BI "intmax_t imaxabs(intmax_t " j );
31 .BI "uintmax_t umaxabs(intmax_t " j );
32 .fi
33 .P
34 .RS -4
35 Feature Test Macro Requirements for glibc (see
36 .BR feature_test_macros (7)):
37 .RE
38 .P
39 .BR llabs ():
40 .nf
41 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
42 .fi
43 .P
44 .BR uabs (),
45 .BR ulabs (),
46 .BR ullabs (),
47 .BR umaxabs ():
48 .nf
49 _ISOC2Y_SOURCE
50 .fi
51 .SH DESCRIPTION
52 These functions
53 compute the absolute value of the argument
54 .I j
55 of the
56 appropriate integer type for the function.
57 .SH RETURN VALUE
58 Returns the absolute value of the integer argument,
59 of the appropriate integer type for the function.
60 .SH ATTRIBUTES
61 For an explanation of the terms used in this section, see
62 .BR attributes (7).
63 .TS
64 allbox;
65 lbx lb lb
66 l l l.
67 Interface Attribute Value
68 T{
69 .na
70 .nh
71 .BR abs (),
72 .BR labs (),
73 .BR llabs (),
74 .BR imaxabs (),
75 .BR uabs (),
76 .BR ulabs (),
77 .BR \%ullabs (),
78 .BR \%umaxabs ()
79 T} Thread safety MT-Safe
80 .TE
81 .SH STANDARDS
82 .TP
83 .BR abs ()
84 .TQ
85 .BR labs ()
86 .TQ
87 .BR llabs ()
88 .TQ
89 .BR imaxabs ()
90 C23, POSIX.1-2024
91 .SH HISTORY
92 .TP
93 .BR abs ()
94 C89, POSIX.1-1996, SVr4, 4.3BSD.
95 .TP
96 .BR labs ()
97 C89, POSIX.1-2001.
98 .TP
99 .BR llabs ()
100 C99, POSIX.1-2001;
101 glibc 2.0.
102 .TP
103 .BR imaxabs ()
104 C99, POSIX.1-2001;
105 glibc 2.1.1.
106 .TP
107 .BR uabs ()
108 .TQ
109 .BR ulabs ()
110 .TQ
111 .BR \%ullabs ()
112 C2y;
113 glibc 2.42.
114 .TP
115 .BR \%umaxabs ()
116 C2y;
117 glibc 2.43.
118 .SH BUGS
119 For
120 .BR abs (),
121 .BR labs (),
122 .BR llabs (),
123 and
124 .BR imaxabs (),
125 trying to take the absolute value of the most negative integer
126 is not defined.
127 .SH SEE ALSO
128 .BR cabs (3),
129 .BR ceil (3),
130 .BR fabs (3),
131 .BR floor (3),
132 .BR rint (3)