]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ilogb.3
dlinfo.3: ATTRIBUTES: Note function that is thread-safe
[thirdparty/man-pages.git] / man3 / ilogb.3
CommitLineData
fea681da 1.\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
d33cd73d
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
fea681da 4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
fea681da
MK
26.\"
27.\" Inspired by a page by Walter Harms created 2002-08-10
28.\"
c73595c2 29.TH ILOGB 3 2015-04-19 "" "Linux Programmer's Manual"
fea681da 30.SH NAME
d33cd73d 31ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
fea681da
MK
32.SH SYNOPSIS
33.B #include <math.h>
34.sp
35.BI "int ilogb(double " x );
36.br
37.BI "int ilogbf(float " x );
38.br
39.BI "int ilogbl(long double " x );
40.sp
20c58d70 41Link with \fI\-lm\fP.
d33cd73d
MK
42.sp
43.in -4n
44Feature Test Macro Requirements for glibc (see
45.BR feature_test_macros (7)):
46.in
47.sp
48.ad l
49.BR ilogb ():
70cb8d5e 50.RS 4
f6b326eb 51_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
81e090c5
MK
52_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
53_ISOC99_SOURCE ||
54_POSIX_C_SOURCE\ >=\ 200112L;
70cb8d5e
MK
55.br
56or
d33cd73d 57.I cc\ -std=c99
70cb8d5e 58.RE
d33cd73d
MK
59.br
60.BR ilogbf (),
61.BR ilogbl ():
70cb8d5e 62.RS 4
81e090c5
MK
63_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
64_POSIX_C_SOURCE\ >=\ 200112L;
70cb8d5e
MK
65.br
66or
d33cd73d 67.I cc\ -std=c99
70cb8d5e 68.RE
d33cd73d 69.ad b
fea681da
MK
70.SH DESCRIPTION
71These functions return the exponent part of their argument
c13182ef
MK
72as a signed integer.
73When no error occurs, these functions
fea681da 74are equivalent to the corresponding
fb186734 75.BR logb (3)
7d2cb9d5 76functions, cast to
d33cd73d
MK
77.IR int .
78.SH RETURN VALUE
79On success, these functions return the exponent of
80.IR x ,
81as a signed integer.
82
fea681da
MK
83If
84.I x
efe294cb
MK
85is zero, then a domain error occurs, and the functions return
86.\" the POSIX.1 spec for logb() says logb() gives pole error for this
87.\" case, but for ilogb() it says domain error.
d33cd73d 88.BR FP_ILOGB0 .
fea681da 89.\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
d33cd73d 90
fea681da
MK
91If
92.I x
efe294cb 93is a NaN, then a domain error occurs, and the functions return
d33cd73d 94.BR FP_ILOGBNAN .
fea681da 95.\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
d33cd73d
MK
96.\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
97
fea681da
MK
98If
99.I x
d33cd73d 100is negative infinity or positive infinity, then
efe294cb 101a domain error occurs, and the functions return
d33cd73d
MK
102.BR INT_MAX .
103.\"
104.\" POSIX.1-2001 also says:
4e836144 105.\" If the correct value is greater than {INT_MAX}, {INT_MAX}
d33cd73d
MK
106.\" shall be returned and a domain error shall occur.
107.\"
108.\" If the correct value is less than {INT_MIN}, {INT_MIN}
4e836144 109.\" shall be returned and a domain error shall occur.
d33cd73d
MK
110.SH ERRORS
111See
112.BR math_error (7)
113for information on how to determine whether an error has occurred
114when calling these functions.
115.PP
116The following errors can occur:
117.TP
118Domain error: \fIx\fP is 0 or a NaN
d33cd73d
MK
119An invalid floating-point exception
120.RB ( FE_INVALID )
8ee4373d
MK
121is raised, and
122.I errno
123is set to
124.BR EDOM
125(but see BUGS).
d33cd73d 126.IP
d33cd73d
MK
127.TP
128Domain error: \fIx\fP is an infinity
8ee4373d
MK
129An invalid floating-point exception
130.RB ( FE_INVALID )
131is raised, and
132.I errno
133is set to
134.BR EDOM
135(but see BUGS).
ea00bcb3 136.SH ATTRIBUTES
5b0d5aef
MK
137For an explanation of the terms used in this section, see
138.BR attributes (7).
139.TS
140allbox;
141lbw27 lb lb
142l l l.
143Interface Attribute Value
144T{
ea00bcb3
PH
145.BR ilogb (),
146.BR ilogbf (),
ea00bcb3 147.BR ilogbl ()
5b0d5aef
MK
148T} Thread safety MT-Safe
149.TE
47297adb 150.SH CONFORMING TO
9a74e018 151C99, POSIX.1-2001, POSIX.1-2008.
8ee4373d
MK
152.SH BUGS
153.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6794
b5fafa0b 154Before version 2.16, the following bugs existed in the
8ee4373d
MK
155glibc implementation of these functions:
156.IP * 3
157The domain error case where
158.I x
159is 0 or a NaN did not cause
160.I errno
18e93ab8 161to be set or (on some architectures) raise a floating-point exception.
8ee4373d
MK
162.IP * 3
163The domain error case where
164.I x
165is an infinity did not cause
166.I errno
167to be set or raise a floating-point exception.
47297adb 168.SH SEE ALSO
fea681da 169.BR log (3),
55975b54
MK
170.BR logb (3),
171.BR significand (3)