1ILOGB(3) Linux Programmer's Manual ILOGB(3)
2
3
4
6 ilogb, ilogbf, ilogbl - get integer exponent of a floating point value
7
9 #include <math.h>
10
11 int ilogb(double x);
12 int ilogbf(float x);
13 int ilogbl(long double x);
14
15 Link with -lm.
16
18 These functions return the exponent part of their argument as a signed
19 integer. When no error occurs, these functions are equivalent to the
20 corresponding logb() functions, cast to (int). An error will occur for
21 zero and infinity and NaN, and possibly for overflow.
22
24 In order to check for errors, set errno to zero and call feclearex‐
25 cept(FE_ALL_EXCEPT) before calling these functions. On return, if errno
26 is non-zero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW |
27 FE_UNDERFLOW) is non-zero, an error has occurred.
28
29 If an error occurs and (math_errhandling & MATH_ERRNO) is non-zero,
30 then errno is set to EDOM. If an error occurs and (math_errhandling &
31 MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception
32 is raised.
33
34 A domain error occurs when x is zero or infinite (or too large, or too
35 small) or NaN. If x is zero, the constant FP_ILOGB0 is returned. If x
36 is NaN, the constant FP_ILOGBNAN is returned. If x is infinite (or too
37 large), INT_MAX is returned. If x is too small, INT_MIN is returned.
38
40 C99
41
43 log(3), logb(3)
44
45
46
47 2004-10-31 ILOGB(3)