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 = LOG1P (L_(-1.0));
35 ASSERT (z == - HUGEVAL);
36 }
37
38
39 {
40
41 const DOUBLE err_bound =
42 (sizeof (DOUBLE) > sizeof (double) ?
43 #if defined __i386__ && defined __FreeBSD__
44
45
46
47
48
49 L_(900.0)
50 #else
51 L_(26.0)
52 #endif
53 : L_(13.0));
54
55 for (i = 0; i < SIZEOF (RANDOM); i++)
56 {
57 DOUBLE x = L_(16.0) * RANDOM[i];
58 DOUBLE y = LOG1P (x);
59 DOUBLE z = LOG1P (- x / (L_(1.0) + x));
60 DOUBLE err = y + z;
61 ASSERT (y >= L_(0.0));
62 ASSERT (z <= L_(0.0));
63 ASSERT (err > - err_bound / TWO_MANT_DIG
64 && err < err_bound / TWO_MANT_DIG);
65 }
66 }
67
68 {
69
70 const DOUBLE err_bound =
71 (sizeof (DOUBLE) > sizeof (double) ?
72 #if defined __i386__ && defined __FreeBSD__
73
74
75
76
77
78 L_(1020.0)
79 #else
80 L_(65.0)
81 #endif
82 : L_(61.0));
83
84 for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
85 for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
86 {
87 DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(2.0);
88 DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(2.0);
89
90 DOUBLE z = L_(1.0) / ((L_(1.0) + x) * (L_(1.0) + y)) - L_(1.0);
91
92 DOUBLE err = LOG1P (x) + LOG1P (y) + LOG1P (z);
93 ASSERT (err > - err_bound / TWO_MANT_DIG
94 && err < err_bound / TWO_MANT_DIG);
95 }
96 }
97 }
98
99 volatile DOUBLE x;
100 DOUBLE y;