1ilogb(3)                   Library Functions Manual                   ilogb(3)
2
3
4

NAME

6       ilogb, ilogbf, ilogbl - get integer exponent of a floating-point value
7

LIBRARY

9       Math library (libm, -lm)
10

SYNOPSIS

12       #include <math.h>
13
14       int ilogb(double x);
15       int ilogbf(float x);
16       int ilogbl(long double x);
17
18   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20       ilogb():
21           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22               || _XOPEN_SOURCE >= 500
23               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
24               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
25
26       ilogbf(), ilogbl():
27           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
28               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
29               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
30

DESCRIPTION

32       These  functions return the exponent part of their argument as a signed
33       integer.  When no error occurs, these functions are equivalent  to  the
34       corresponding logb(3) functions, cast to int.
35

RETURN VALUE

37       On success, these functions return the exponent of x, as a signed inte‐
38       ger.
39
40       If x is zero, then a domain error  occurs,  and  the  functions  return
41       FP_ILOGB0.
42
43       If  x  is  a  NaN, then a domain error occurs, and the functions return
44       FP_ILOGBNAN.
45
46       If x is negative infinity or positive infinity, then a domain error oc‐
47       curs, and the functions return INT_MAX.
48

ERRORS

50       See  math_error(7) for information on how to determine whether an error
51       has occurred when calling these functions.
52
53       The following errors can occur:
54
55       Domain error: x is 0 or a NaN
56              An invalid floating-point exception (FE_INVALID) is raised,  and
57              errno is set to EDOM (but see BUGS).
58
59       Domain error: x is an infinity
60              An  invalid floating-point exception (FE_INVALID) is raised, and
61              errno is set to EDOM (but see BUGS).
62

ATTRIBUTES

64       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
65       tributes(7).
66
67       ┌────────────────────────────────────────────┬───────────────┬─────────┐
68Interface                                   Attribute     Value   
69       ├────────────────────────────────────────────┼───────────────┼─────────┤
70ilogb(), ilogbf(), ilogbl()                 │ Thread safety │ MT-Safe │
71       └────────────────────────────────────────────┴───────────────┴─────────┘
72

STANDARDS

74       C11, POSIX.1-2008.
75

HISTORY

77       C99, POSIX.1-2001.
78

BUGS

80       Before   glibc   2.16,   the   following  bugs  existed  in  the  glibc
81       implementation of these functions:
82
83       •  The domain error case where x is 0 or a NaN did not cause  errno  to
84          be set or (on some architectures) raise a floating-point exception.
85
86       •  The  domain error case where x is an infinity did not cause errno to
87          be set or raise a floating-point exception.
88

SEE ALSO

90       log(3), logb(3), significand(3)
91
92
93
94Linux man-pages 6.05              2023-07-20                          ilogb(3)
Impressum