1//===-- Unittests for fma ------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "FmaTest.h"
10
11#include "src/math/fma.h"
12
13struct Inputs {
14 double a, b, c;
15};
16
17struct LlvmLibcFmaTest : public FmaTestTemplate<double> {
18 void test_more_values() {
19 constexpr int N = 236;
20 constexpr Inputs INPUTS[N] = {
21 {.a: 0x1p+0, .b: 0x2p+0, .c: 0x3p+0},
22 {.a: 0x1.4p+0, .b: 0xcp-4, .c: 0x1p-4},
23 {.a: 0x0p+0, .b: 0x0p+0, .c: 0x0p+0},
24 {.a: 0x1p+0, .b: 0x0p+0, .c: 0x0p+0},
25 {.a: 0x0p+0, .b: 0x1p+0, .c: 0x0p+0},
26 {.a: 0x1p+0, .b: 0x1p+0, .c: 0x1p+0},
27 {.a: 0x0p+0, .b: 0x0p+0, .c: 0x1p+0},
28 {.a: 0x0p+0, .b: 0x0p+0, .c: 0x2p+0},
29 {.a: 0x0p+0, .b: 0x0p+0, .c: 0xf.fffffp+124},
30 {.a: 0x0p+0, .b: 0x0p+0, .c: 0xf.ffffffffffff8p+1020},
31 {.a: 0x0p+0, .b: 0x1p+0, .c: 0x1p+0},
32 {.a: 0x1p+0, .b: 0x0p+0, .c: 0x1p+0},
33 {.a: 0x0p+0, .b: 0x1p+0, .c: 0x2p+0},
34 {.a: 0x1p+0, .b: 0x0p+0, .c: 0x2p+0},
35 {.a: 0x0p+0, .b: 0x1p+0, .c: 0xf.fffffp+124},
36 {.a: 0x0p+0, .b: 0x1p+0, .c: 0xf.ffffffffffff8p+1020},
37 {.a: 0x1p+0, .b: 0x0p+0, .c: 0xf.fffffp+124},
38 {.a: 0x1p+0, .b: 0x0p+0, .c: 0xf.ffffffffffff8p+1020},
39 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
40 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
41 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
42 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
43 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
44 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
45 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
46 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
47 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
48 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
49 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
50 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
51 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
52 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
53 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
54 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
55 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
56 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
57 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
58 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
59 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
60 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
61 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
62 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
63 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
64 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
65 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
66 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
67 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
68 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
69 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
70 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
71 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
72 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
73 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
74 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
75 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
76 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
77 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
78 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
79 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
80 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
81 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
82 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
83 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
84 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
85 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
86 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
87 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
88 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
89 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
90 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
91 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
92 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
93 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
94 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
95 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
96 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
97 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
98 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
99 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
100 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
101 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
102 {.a: 0x4p-128, .b: 0x4p-128, .c: 0x0p+0},
103 {.a: 0x4p-128, .b: 0x4p-1024, .c: 0x0p+0},
104 {.a: 0x4p-128, .b: 0x8p-972, .c: 0x0p+0},
105 {.a: 0x4p-1024, .b: 0x4p-128, .c: 0x0p+0},
106 {.a: 0x4p-1024, .b: 0x4p-1024, .c: 0x0p+0},
107 {.a: 0x4p-1024, .b: 0x8p-972, .c: 0x0p+0},
108 {.a: 0x8p-972, .b: 0x4p-128, .c: 0x0p+0},
109 {.a: 0x8p-972, .b: 0x4p-1024, .c: 0x0p+0},
110 {.a: 0x8p-972, .b: 0x8p-972, .c: 0x0p+0},
111 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
112 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
113 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
114 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
115 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
116 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
117 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
118 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
119 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
120 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
121 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
122 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
123 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
124 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
125 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
126 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
127 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
128 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
129 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
130 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
131 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
132 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
133 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
134 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
135 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
136 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
137 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
138 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
139 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
140 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
141 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
142 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
143 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
144 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
145 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
146 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
147 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
148 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
149 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
150 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
151 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
152 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
153 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
154 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
155 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
156 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
157 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
158 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
159 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
160 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
161 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
162 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
163 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
164 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
165 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
166 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
167 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
168 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
169 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
170 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
171 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
172 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
173 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
174 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
175 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
176 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
177 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
178 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
179 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
180 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
181 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
182 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
183 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
184 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
185 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
186 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
187 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
188 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
189 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
190 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
191 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
192 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
193 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
194 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
195 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-128},
196 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x4p-1024},
197 {.a: 0xf.fffffp+124, .b: 0xf.fffffp+124, .c: 0x8p-972},
198 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
199 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
200 {.a: 0xf.fffffp+124, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
201 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-128},
202 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x4p-1024},
203 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.fffffp+124, .c: 0x8p-972},
204 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-128},
205 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x4p-1024},
206 {.a: 0xf.ffffffffffff8p+1020, .b: 0xf.ffffffffffff8p+1020, .c: 0x8p-972},
207 {.a: 0x2.fffp+12, .b: 0x1.000002p+0, .c: 0x1.ffffp-24},
208 {.a: 0x1.fffp+0, .b: 0x1.00001p+0, .c: 0x1.fffp+0},
209 {.a: 0xc.d5e6fp+124, .b: 0x2.6af378p-128, .c: 0x1.f08948p+0},
210 {.a: 0x1.9abcdep+100, .b: 0x2.6af378p-128, .c: 0x3.e1129p-28},
211 {.a: 0xf.fffffp+124, .b: 0x1.001p+0, .c: 0xf.fffffp+124},
212 {.a: 0xf.fffffp+124, .b: 0x1.fffffep+0, .c: 0xf.fffffp+124},
213 {.a: 0xf.fffffp+124, .b: 0x2p+0, .c: 0xf.fffffp+124},
214 {.a: 0x5p-128, .b: 0x8.00002p-4, .c: 0x1p-128},
215 {.a: 0x7.ffffep-128, .b: 0x8.00001p-4, .c: 0x8p-152},
216 {.a: 0x8p-152, .b: 0x8p-4, .c: 0x3.fffff8p-128},
217 {.a: 0x8p-152, .b: 0x8.8p-4, .c: 0x3.fffff8p-128},
218 {.a: 0x8p-152, .b: 0x8p-152, .c: 0x8p+124},
219 {.a: 0x8p-152, .b: 0x8p-152, .c: 0x4p-128},
220 {.a: 0x8p-152, .b: 0x8p-152, .c: 0x3.fffff8p-128},
221 {.a: 0x8p-152, .b: 0x8p-152, .c: 0x8p-152},
222 {.a: 0xf.ffp-4, .b: 0xf.ffp-4, .c: 0xf.fep-4},
223 {.a: 0x4.000008p-128, .b: 0x4.000008p-28, .c: 0x8p+124},
224 {.a: 0x4.000008p-128, .b: 0x4.000008p-28, .c: 0x8p+100},
225 {.a: 0x2.fep+12, .b: 0x1.0000000000001p+0, .c: 0x1.ffep-48},
226 {.a: 0x1.fffp+0, .b: 0x1.0000000000001p+0, .c: 0x1.fffp+0},
227 {.a: 0x1.0000002p+0, .b: 0xf.fffffep-4, .c: 0x1p-300},
228 {.a: 0xe.f56df7797f768p+1020, .b: 0x3.7ab6fbbcbfbb4p-1024,
229 .c: 0x3.40bf1803497f6p+0},
230 {.a: 0x1.deadbeef2feedp+900, .b: 0x3.7ab6fbbcbfbb4p-1024,
231 .c: 0x6.817e300692fecp-124},
232 {.a: 0xf.ffffffffffff8p+1020, .b: 0x1.001p+0, .c: 0xf.ffffffffffff8p+1020},
233 {.a: 0xf.ffffffffffff8p+1020, .b: 0x1.fffffffffffffp+0,
234 .c: 0xf.ffffffffffff8p+1020},
235 {.a: 0xf.ffffffffffff8p+1020, .b: 0x2p+0, .c: 0xf.ffffffffffff8p+1020},
236 {.a: 0x5.a827999fcef3p-540, .b: 0x5.a827999fcef3p-540, .c: 0x0p+0},
237 {.a: 0x3.bd5b7dde5fddap-496, .b: 0x3.bd5b7dde5fddap-496, .c: 0xd.fc352bc352bap-992},
238 {.a: 0x3.bd5b7dde5fddap-504, .b: 0x3.bd5b7dde5fddap-504,
239 .c: 0xd.fc352bc352bap-1008},
240 {.a: 0x8p-540, .b: 0x4p-540, .c: 0x4p-1076},
241 {.a: 0x1.7fffff8p-968, .b: 0x4p-108, .c: 0x4p-1048},
242 {.a: 0x2.8000008p-968, .b: 0x4p-108, .c: 0x4p-1048},
243 {.a: 0x2.8p-968, .b: 0x4p-108, .c: 0x4p-1048},
244 {.a: 0x2.33956cdae7c2ep-960, .b: 0x3.8e211518bfea2p-108,
245 .c: 0x2.02c2b59766d9p-1024},
246 {.a: 0x3.a5d5dadd1d3a6p-980, .b: 0x2.9c0cd8c5593bap-64, .c: 0x2.49179ac00d15p-1024},
247 {.a: 0x2.2a7aca1773e0cp-908, .b: 0x9.6809186a42038p-128, .c: 0x2.c9e356b3f0fp-1024},
248 {.a: 0x3.ffffffffffffep-712, .b: 0x3.ffffffffffffep-276,
249 .c: 0x3.fffffc0000ffep-984},
250 {.a: 0x5p-1024, .b: 0x8.000000000001p-4, .c: 0x1p-1024},
251 {.a: 0x7.ffffffffffffp-1024, .b: 0x8.0000000000008p-4, .c: 0x4p-1076},
252 {.a: 0x4p-1076, .b: 0x8p-4, .c: 0x3.ffffffffffffcp-1024},
253 {.a: 0x4p-1076, .b: 0x8.8p-4, .c: 0x3.ffffffffffffcp-1024},
254 {.a: 0x4p-1076, .b: 0x4p-1076, .c: 0x8p+1020},
255 {.a: 0x4p-1076, .b: 0x4p-1076, .c: 0x4p-1024},
256 {.a: 0x4p-1076, .b: 0x4p-1076, .c: 0x3.ffffffffffffcp-1024},
257 {.a: 0x4p-1076, .b: 0x4p-1076, .c: 0x4p-1076},
258 {.a: 0xf.ffffffffffff8p-4, .b: 0xf.ffffffffffff8p-4, .c: 0xf.ffffffffffffp-4},
259 {.a: 0x4.0000000000004p-1024, .b: 0x2.0000000000002p-56, .c: 0x8p+1020},
260 {.a: 0x4.0000000000004p-1024, .b: 0x2.0000000000002p-56, .c: 0x4p+968},
261 {.a: 0x7.fffff8p-128, .b: 0x3.fffffcp+24, .c: 0xf.fffffp+124},
262 {.a: 0x7.ffffffffffffcp-1024, .b: 0x7.ffffffffffffcp+52,
263 .c: 0xf.ffffffffffff8p+1020},
264 };
265
266 for (int i = 0; i < N; ++i) {
267 for (int signs = 0; signs < 7; ++signs) {
268 double a = (signs & 4) ? -INPUTS[i].a : INPUTS[i].a;
269 double b = (signs & 2) ? -INPUTS[i].b : INPUTS[i].b;
270 double c = (signs & 1) ? -INPUTS[i].c : INPUTS[i].c;
271 mpfr::TernaryInput<double> input{.x: a, .y: b, .z: c};
272 ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fma, input,
273 LIBC_NAMESPACE::fma(a, b, c), 0.5);
274 }
275 }
276 }
277};
278
279TEST_F(LlvmLibcFmaTest, SpecialNumbers) {
280 test_special_numbers(func: &LIBC_NAMESPACE::fma);
281}
282
283TEST_F(LlvmLibcFmaTest, SubnormalRange) {
284 test_subnormal_range(func: &LIBC_NAMESPACE::fma);
285}
286
287TEST_F(LlvmLibcFmaTest, NormalRange) {
288 test_normal_range(func: &LIBC_NAMESPACE::fma);
289}
290
291TEST_F(LlvmLibcFmaTest, ExtraValues) { test_more_values(); }
292

source code of libc/test/src/math/fma_test.cpp