This source file includes following definitions.
- LOGB
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 #ifdef USE_LONG_DOUBLE
25 # define LOGB logbl
26 # define DOUBLE long double
27 # define L_(literal) literal##L
28 # define HUGEVAL HUGE_VALL
29 # define FREXP frexpl
30 # define ISNAN isnanl
31 #elif ! defined USE_FLOAT
32 # define LOGB logb
33 # define DOUBLE double
34 # define L_(literal) literal
35 # define HUGEVAL HUGE_VAL
36 # define FREXP frexp
37 # define ISNAN isnand
38 #else
39 # define LOGB logbf
40 # define DOUBLE float
41 # define L_(literal) literal##f
42 # define HUGEVAL HUGE_VALF
43 # define FREXP frexpf
44 # define ISNAN isnanf
45 #endif
46
47 DOUBLE
48 LOGB (DOUBLE x)
49 {
50 if (isfinite (x))
51 {
52 if (x == L_(0.0))
53
54 return - HUGEVAL;
55 else
56 {
57 int e;
58
59 (void) FREXP (x, &e);
60 return (DOUBLE) (e - 1);
61 }
62 }
63 else
64 {
65 if (ISNAN (x))
66 return x;
67 else
68
69 return HUGEVAL;
70 }
71 }