]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man/man3/ilogb.3
man/, share/mk/: Move man*/ to man/
[thirdparty/man-pages.git] / man / man3 / ilogb.3
CommitLineData
a1eaacb1 1'\" t
fea681da 2.\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
d33cd73d
MK
3.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4.\" <mtk.manpages@gmail.com>
fea681da 5.\"
5fbde956 6.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
7.\"
8.\" Inspired by a page by Walter Harms created 2002-08-10
9.\"
4c1c5274 10.TH ilogb 3 (date) "Linux man-pages (unreleased)"
fea681da 11.SH NAME
d33cd73d 12ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
2af19291
AC
13.SH LIBRARY
14Math library
8fc3b2cf 15.RI ( libm ", " \-lm )
fea681da 16.SH SYNOPSIS
c7db92b9 17.nf
fea681da 18.B #include <math.h>
c6d039a3 19.P
fea681da 20.BI "int ilogb(double " x );
fea681da 21.BI "int ilogbf(float " x );
fea681da 22.BI "int ilogbl(long double " x );
c7db92b9 23.fi
c6d039a3 24.P
d39ad78f 25.RS -4
d33cd73d
MK
26Feature Test Macro Requirements for glibc (see
27.BR feature_test_macros (7)):
d39ad78f 28.RE
c6d039a3 29.P
d33cd73d 30.BR ilogb ():
9d2adbae 31.nf
5c10d2c5
MK
32 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
33 || _XOPEN_SOURCE >= 500
34.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
9d2adbae 35 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
75c018a1 36 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
9d2adbae 37.fi
c6d039a3 38.P
d33cd73d
MK
39.BR ilogbf (),
40.BR ilogbl ():
9d2adbae 41.nf
5c10d2c5 42 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 43 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
75c018a1 44 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
9d2adbae 45.fi
fea681da
MK
46.SH DESCRIPTION
47These functions return the exponent part of their argument
c13182ef
MK
48as a signed integer.
49When no error occurs, these functions
fea681da 50are equivalent to the corresponding
fb186734 51.BR logb (3)
7d2cb9d5 52functions, cast to
d33cd73d
MK
53.IR int .
54.SH RETURN VALUE
55On success, these functions return the exponent of
56.IR x ,
57as a signed integer.
c6d039a3 58.P
fea681da
MK
59If
60.I x
efe294cb
MK
61is 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.
d33cd73d 64.BR FP_ILOGB0 .
fea681da 65.\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
c6d039a3 66.P
fea681da
MK
67If
68.I x
efe294cb 69is a NaN, then a domain error occurs, and the functions return
d33cd73d 70.BR FP_ILOGBNAN .
fea681da 71.\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
d33cd73d 72.\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
c6d039a3 73.P
fea681da
MK
74If
75.I x
d33cd73d 76is negative infinity or positive infinity, then
efe294cb 77a domain error occurs, and the functions return
d33cd73d
MK
78.BR INT_MAX .
79.\"
80.\" POSIX.1-2001 also says:
4e836144 81.\" If the correct value is greater than {INT_MAX}, {INT_MAX}
d33cd73d
MK
82.\" shall be returned and a domain error shall occur.
83.\"
84.\" If the correct value is less than {INT_MIN}, {INT_MIN}
4e836144 85.\" shall be returned and a domain error shall occur.
d33cd73d
MK
86.SH ERRORS
87See
88.BR math_error (7)
89for information on how to determine whether an error has occurred
90when calling these functions.
c6d039a3 91.P
d33cd73d
MK
92The following errors can occur:
93.TP
94Domain error: \fIx\fP is 0 or a NaN
d33cd73d
MK
95An invalid floating-point exception
96.RB ( FE_INVALID )
8ee4373d
MK
97is raised, and
98.I errno
99is set to
1ae6b2c7 100.B EDOM
8ee4373d 101(but see BUGS).
d33cd73d
MK
102.TP
103Domain error: \fIx\fP is an infinity
8ee4373d
MK
104An invalid floating-point exception
105.RB ( FE_INVALID )
106is raised, and
107.I errno
108is set to
1ae6b2c7 109.B EDOM
8ee4373d 110(but see BUGS).
ea00bcb3 111.SH ATTRIBUTES
5b0d5aef
MK
112For an explanation of the terms used in this section, see
113.BR attributes (7).
114.TS
115allbox;
c466875e 116lbx lb lb
5b0d5aef
MK
117l l l.
118Interface Attribute Value
119T{
9e54434e
BR
120.na
121.nh
ea00bcb3
PH
122.BR ilogb (),
123.BR ilogbf (),
ea00bcb3 124.BR ilogbl ()
5b0d5aef
MK
125T} Thread safety MT-Safe
126.TE
3113c7f3 127.SH STANDARDS
4131356c
AC
128C11, POSIX.1-2008.
129.SH HISTORY
130C99, POSIX.1-2001.
8ee4373d 131.SH BUGS
fd00f831 132.\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6794
b324e17d 133Before glibc 2.16, the following bugs existed in the
8ee4373d 134glibc implementation of these functions:
cdede5cd 135.IP \[bu] 3
8ee4373d
MK
136The domain error case where
137.I x
138is 0 or a NaN did not cause
139.I errno
18e93ab8 140to be set or (on some architectures) raise a floating-point exception.
cdede5cd 141.IP \[bu]
8ee4373d
MK
142The domain error case where
143.I x
144is an infinity did not cause
145.I errno
146to be set or raise a floating-point exception.
47297adb 147.SH SEE ALSO
fea681da 148.BR log (3),
55975b54
MK
149.BR logb (3),
150.BR significand (3)