2 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .\" Inspired by a page by Walter Harms created 2002-08-10
10 .TH ilogb 3 (date) "Linux man-pages (unreleased)"
12 ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
15 .RI ( libm ", " \-lm )
20 .BI "int ilogb(double " x );
21 .BI "int ilogbf(float " x );
22 .BI "int ilogbl(long double " x );
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
32 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
33 || _XOPEN_SOURCE >= 500
34 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
35 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
36 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
42 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
43 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
44 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
47 These functions return the exponent part of their argument
49 When no error occurs, these functions
50 are equivalent to the corresponding
55 On success, these functions return the exponent of
61 is zero, then a domain error occurs, and the functions return
62 .\" the POSIX.1 spec for logb() says logb() gives pole error for this
63 .\" case, but for ilogb() it says domain error.
65 .\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
69 is a NaN, then a domain error occurs, and the functions return
71 .\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
72 .\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
76 is negative infinity or positive infinity, then
77 a domain error occurs, and the functions return
80 .\" POSIX.1-2001 also says:
81 .\" If the correct value is greater than {INT_MAX}, {INT_MAX}
82 .\" shall be returned and a domain error shall occur.
84 .\" If the correct value is less than {INT_MIN}, {INT_MIN}
85 .\" shall be returned and a domain error shall occur.
89 for information on how to determine whether an error has occurred
90 when calling these functions.
92 The following errors can occur:
94 Domain error: \fIx\fP is 0 or a NaN
95 An invalid floating-point exception
103 Domain error: \fIx\fP is an infinity
104 An invalid floating-point exception
112 For an explanation of the terms used in this section, see
120 Interface Attribute Value
125 T} Thread safety MT-Safe
135 .\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6794
136 Before glibc 2.16, the following bugs existed in the
137 glibc implementation of these functions:
139 The domain error case where
141 is 0 or a NaN did not cause
143 to be set or (on some architectures) raise a floating-point exception.
145 The domain error case where
147 is an infinity did not cause
149 to be set or raise a floating-point exception.