This source file includes following definitions.
- ILOGB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #if ! (defined USE_LONG_DOUBLE || defined USE_FLOAT)
18 # include <config.h>
19 #endif
20
21
22 #include <math.h>
23
24 #include <limits.h>
25
26 #ifdef USE_LONG_DOUBLE
27 # define ILOGB ilogbl
28 # define DOUBLE long double
29 # define L_(literal) literal##L
30 # define FREXP frexpl
31 # define ISNAN isnanl
32 #elif ! defined USE_FLOAT
33 # define ILOGB ilogb
34 # define DOUBLE double
35 # define L_(literal) literal
36 # define FREXP frexp
37 # define ISNAN isnand
38 #else
39 # define ILOGB ilogbf
40 # define DOUBLE float
41 # define L_(literal) literal##f
42 # define FREXP frexpf
43 # define ISNAN isnanf
44 #endif
45
46 int
47 ILOGB (DOUBLE x)
48 {
49 if (isfinite (x))
50 {
51 if (x == L_(0.0))
52 return FP_ILOGB0;
53 else
54 {
55 int e;
56
57 (void) FREXP (x, &e);
58 return e - 1;
59 }
60 }
61 else
62 {
63 if (ISNAN (x))
64 return FP_ILOGBNAN;
65 else
66 return INT_MAX;
67 }
68 }