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
35 const DOUBLE err_bound =
36 (sizeof (DOUBLE) > sizeof (double) ?
37 #if defined __i386__ && defined __FreeBSD__
38
39
40
41
42
43 L_(1350.0)
44 #else
45 L_(4.0)
46 #endif
47 : L_(2.0));
48
49 for (i = 0; i < SIZEOF (RANDOM); i++)
50 {
51 DOUBLE x = L_(16.0) * RANDOM[i];
52 DOUBLE y = EXP (x);
53 DOUBLE z = EXP (- x);
54 DOUBLE err = y * z - L_(1.0);
55 ASSERT (y > L_(0.0));
56 ASSERT (z > L_(0.0));
57 ASSERT (err > - err_bound / TWO_MANT_DIG
58 && err < err_bound / TWO_MANT_DIG);
59 }
60 }
61
62 {
63
64 const DOUBLE err_bound =
65 (sizeof (DOUBLE) > sizeof (double) ?
66 #if defined __i386__ && defined __FreeBSD__
67 L_(2400.0)
68 #else
69 L_(24.0)
70 #endif
71 : L_(24.0));
72
73 for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
74 for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
75 {
76 DOUBLE x = L_(32.0) * RANDOM[i] - L_(16.0);
77 DOUBLE y = L_(32.0) * RANDOM[j] - L_(16.0);
78 DOUBLE z = - x - y;
79
80 DOUBLE err = EXP (x) * EXP (y) * EXP (z) - L_(1.0);
81 ASSERT (err > - err_bound / TWO_MANT_DIG
82 && err < err_bound / TWO_MANT_DIG);
83 }
84 }
85 }
86
87 volatile DOUBLE x;
88 DOUBLE y;