mirror of https://github.com/mkerrisk/man-pages
172 lines
4.4 KiB
Groff
172 lines
4.4 KiB
Groff
.\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
|
|
.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
|
|
.\" <mtk.manpages@gmail.com>
|
|
.\"
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
.\" preserved on all copies.
|
|
.\"
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
.\" permission notice identical to this one.
|
|
.\"
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
.\" have taken the same level of care in the production of this manual,
|
|
.\" which is licensed free of charge, as they might when working
|
|
.\" professionally.
|
|
.\"
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
.\" %%%LICENSE_END
|
|
.\"
|
|
.\" Inspired by a page by Walter Harms created 2002-08-10
|
|
.\"
|
|
.TH ILOGB 3 2015-03-02 "" "Linux Programmer's Manual"
|
|
.SH NAME
|
|
ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
|
|
.SH SYNOPSIS
|
|
.B #include <math.h>
|
|
.sp
|
|
.BI "int ilogb(double " x );
|
|
.br
|
|
.BI "int ilogbf(float " x );
|
|
.br
|
|
.BI "int ilogbl(long double " x );
|
|
.sp
|
|
Link with \fI\-lm\fP.
|
|
.sp
|
|
.in -4n
|
|
Feature Test Macro Requirements for glibc (see
|
|
.BR feature_test_macros (7)):
|
|
.in
|
|
.sp
|
|
.ad l
|
|
.BR ilogb ():
|
|
.RS 4
|
|
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
|
|
_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
|
|
_ISOC99_SOURCE ||
|
|
_POSIX_C_SOURCE\ >=\ 200112L;
|
|
.br
|
|
or
|
|
.I cc\ -std=c99
|
|
.RE
|
|
.br
|
|
.BR ilogbf (),
|
|
.BR ilogbl ():
|
|
.RS 4
|
|
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
|
|
_POSIX_C_SOURCE\ >=\ 200112L;
|
|
.br
|
|
or
|
|
.I cc\ -std=c99
|
|
.RE
|
|
.ad b
|
|
.SH DESCRIPTION
|
|
These functions return the exponent part of their argument
|
|
as a signed integer.
|
|
When no error occurs, these functions
|
|
are equivalent to the corresponding
|
|
.BR logb (3)
|
|
functions, cast to
|
|
.IR int .
|
|
.SH RETURN VALUE
|
|
On success, these functions return the exponent of
|
|
.IR x ,
|
|
as a signed integer.
|
|
|
|
If
|
|
.I x
|
|
is zero, then a domain error occurs, and the functions return
|
|
.\" the POSIX.1 spec for logb() says logb() gives pole error for this
|
|
.\" case, but for ilogb() it says domain error.
|
|
.BR FP_ILOGB0 .
|
|
.\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
|
|
|
|
If
|
|
.I x
|
|
is a NaN, then a domain error occurs, and the functions return
|
|
.BR FP_ILOGBNAN .
|
|
.\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
|
|
.\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
|
|
|
|
If
|
|
.I x
|
|
is negative infinity or positive infinity, then
|
|
a domain error occurs, and the functions return
|
|
.BR INT_MAX .
|
|
.\"
|
|
.\" POSIX.1-2001 also says:
|
|
.\" If the correct value is greater than {INT_MAX}, {INT_MAX}
|
|
.\" shall be returned and a domain error shall occur.
|
|
.\"
|
|
.\" If the correct value is less than {INT_MIN}, {INT_MIN}
|
|
.\" shall be returned and a domain error shall occur.
|
|
.SH ERRORS
|
|
See
|
|
.BR math_error (7)
|
|
for information on how to determine whether an error has occurred
|
|
when calling these functions.
|
|
.PP
|
|
The following errors can occur:
|
|
.TP
|
|
Domain error: \fIx\fP is 0 or a NaN
|
|
An invalid floating-point exception
|
|
.RB ( FE_INVALID )
|
|
is raised, and
|
|
.I errno
|
|
is set to
|
|
.BR EDOM
|
|
(but see BUGS).
|
|
.IP
|
|
.TP
|
|
Domain error: \fIx\fP is an infinity
|
|
An invalid floating-point exception
|
|
.RB ( FE_INVALID )
|
|
is raised, and
|
|
.I errno
|
|
is set to
|
|
.BR EDOM
|
|
(but see BUGS).
|
|
.SH ATTRIBUTES
|
|
For an explanation of the terms used in this section, see
|
|
.BR attributes (7).
|
|
.TS
|
|
allbox;
|
|
lbw27 lb lb
|
|
l l l.
|
|
Interface Attribute Value
|
|
T{
|
|
.BR ilogb (),
|
|
.BR ilogbf (),
|
|
.BR ilogbl ()
|
|
T} Thread safety MT-Safe
|
|
.TE
|
|
.SH CONFORMING TO
|
|
C99, POSIX.1-2001.
|
|
.SH BUGS
|
|
.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6794
|
|
Before version 2.16, the following bugs existed in the
|
|
glibc implementation of these functions:
|
|
.IP * 3
|
|
The domain error case where
|
|
.I x
|
|
is 0 or a NaN did not cause
|
|
.I errno
|
|
to be set or (on some architectures) raise a floating-point exception.
|
|
.IP * 3
|
|
The domain error case where
|
|
.I x
|
|
is an infinity did not cause
|
|
.I errno
|
|
to be set or raise a floating-point exception.
|
|
.SH SEE ALSO
|
|
.BR log (3),
|
|
.BR logb (3),
|
|
.BR significand (3)
|