This source file includes following definitions.
- test_function
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 static void
18 test_function (void)
19 {
20 int i;
21 int j;
22 const DOUBLE TWO_MANT_DIG =
23
24
25
26 (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
27 * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
28 * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
29 * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
30 * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
31
32
33 {
34 DOUBLE z = LOG (L_(0.0));
35 ASSERT (z == - HUGEVAL);
36 }
37 {
38 DOUBLE z = LOG (MINUS_ZERO);
39 ASSERT (z == - HUGEVAL);
40 }
41
42
43 {
44
45 const DOUBLE err_bound =
46 (sizeof (DOUBLE) > sizeof (double) ?
47 #if defined __i386__ && defined __FreeBSD__
48
49
50
51
52
53 L_(40.0)
54 #else
55 L_(3.0)
56 #endif
57 : L_(3.0));
58
59 for (i = 0; i < SIZEOF (RANDOM); i++)
60 {
61 DOUBLE x = L_(16.0) * RANDOM[i] + L_(1.0);
62 DOUBLE y = LOG (x);
63 DOUBLE z = LOG (L_(1.0) / x);
64 DOUBLE err = y + z;
65 ASSERT (y >= L_(0.0));
66 ASSERT (z <= L_(0.0));
67 ASSERT (err > - err_bound / TWO_MANT_DIG
68 && err < err_bound / TWO_MANT_DIG);
69 }
70 }
71
72 {
73
74 const DOUBLE err_bound =
75 (sizeof (DOUBLE) > sizeof (double) ?
76 #if defined __i386__ && defined __FreeBSD__
77
78
79
80
81
82 L_(85.0)
83 #else
84 L_(7.0)
85 #endif
86 : L_(7.0));
87
88 for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
89 for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
90 {
91 DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(1.0);
92 DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(1.0);
93
94 DOUBLE z = L_(1.0) / (x * y);
95
96 DOUBLE err = LOG (x) + LOG (y) + LOG (z);
97 ASSERT (err > - err_bound / TWO_MANT_DIG
98 && err < err_bound / TWO_MANT_DIG);
99 }
100 }
101 }
102
103 volatile DOUBLE x;
104 DOUBLE y;