This source file includes following definitions.
- ldexpl
- ldexpl
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include <config.h>
22
23
24 #include <math.h>
25
26 #if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
27
28 long double
29 ldexpl (long double x, int exp)
30 {
31 return ldexp (x, exp);
32 }
33
34 #else
35
36 # include <float.h>
37 # include "fpucw.h"
38
39 long double
40 ldexpl (long double x, int exp)
41 {
42 long double factor;
43 int bit;
44 DECL_LONG_DOUBLE_ROUNDING
45
46 BEGIN_LONG_DOUBLE_ROUNDING ();
47
48
49 if (!(isnanl (x) || x + x == x))
50 {
51 if (exp < 0)
52 {
53 exp = -exp;
54 factor = 0.5L;
55 }
56 else
57 factor = 2.0L;
58
59 if (exp > 0)
60 for (bit = 1;;)
61 {
62
63
64 if (exp & bit)
65 x *= factor;
66 bit <<= 1;
67 if (bit > exp)
68 break;
69 factor = factor * factor;
70 }
71 }
72
73 END_LONG_DOUBLE_ROUNDING ();
74
75 return x;
76 }
77
78 #endif
79
80 #if 0
81 int
82 main (void)
83 {
84 long double x;
85 int y;
86 for (y = 0; y < 29; y++)
87 printf ("%5d %.16Lg %.16Lg\n", y, ldexpl (0.8L, y), ldexpl (0.8L, -y) * ldexpl (0.8L, y));
88 }
89 #endif