man-pages/man3/ilogb.3

103 lines
2.8 KiB
Groff

.\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
.\"
.\" 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.
.\"
.\" Inspired by a page by Walter Harms created 2002-08-10
.\"
.TH ILOGB 3 2004-10-31 "" "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.
.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) .
An error will occur for zero and infinity and NaN,
and possibly for overflow.
.\" .SH "RETURN VALUE"
.\" These functions return the exponent part of their argument
.\" as a signed integer.
.SH ERRORS
In order to check for errors, set
.I errno
to zero and call
.I feclearexcept(FE_ALL_EXCEPT)
before calling these functions.
On return, if
.I errno
is nonzero or
.I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
is nonzero, an error has occurred.
.LP
If an error occurs and
.I "(math_errhandling & MATH_ERRNO)"
is nonzero, then
.I errno
is set to
.BR EDOM .
If an error occurs and
.I "(math_errhandling & MATH_ERREXCEPT)"
is nonzero, then the invalid floating-point exception is raised.
.LP
A domain error occurs when
.I x
is zero or infinite (or too large, or too small) or NaN.
If
.I x
is zero, the constant
.B FP_ILOGB0
is returned.
.\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
If
.I x
is NaN, the constant
.B FP_ILOGBNAN
is returned.
.\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
If
.I x
is infinite (or too large),
.B INT_MAX
is returned.
If
.I x
is too small,
.B INT_MIN
is returned.
.SH "CONFORMING TO"
C99
.SH "SEE ALSO"
.BR log (3),
.BR logb (3)