1ILOGB(3)                   Linux Programmer's Manual                  ILOGB(3)
2
3
4

NAME

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

SYNOPSIS

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
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       ilogb():
20           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || _XOPEN_SOURCE >= 500
22               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23               || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
25       ilogbf(), ilogbl():
26           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
27               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
28               || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
29

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

CONFORMING TO

73       C99, POSIX.1-2001, POSIX.1-2008.
74

BUGS

76       Before  version 2.16, the following bugs existed in the glibc implemen‐
77       tation of these functions:
78
79       *  The domain error case where x is 0 or a NaN did not cause  errno  to
80          be set or (on some architectures) raise a floating-point exception.
81
82       *  The  domain error case where x is an infinity did not cause errno to
83          be set or raise a floating-point exception.
84

SEE ALSO

86       log(3), logb(3), significand(3)
87

COLOPHON

89       This page is part of release 5.12 of the Linux  man-pages  project.   A
90       description  of  the project, information about reporting bugs, and the
91       latest    version    of    this    page,    can     be     found     at
92       https://www.kernel.org/doc/man-pages/.
93
94
95
96                                  2021-03-22                          ILOGB(3)
Impressum