taway.c revision 1.1.1.6 1 1.1 mrg /* Test file for round away.
2 1.1 mrg
3 1.1.1.6 mrg Copyright 2000-2023 Free Software Foundation, Inc.
4 1.1.1.3 mrg Contributed by the AriC and Caramba projects, INRIA.
5 1.1 mrg
6 1.1 mrg This file is part of the GNU MPFR Library.
7 1.1 mrg
8 1.1 mrg The GNU MPFR Library is free software; you can redistribute it and/or modify
9 1.1 mrg it under the terms of the GNU Lesser General Public License as published by
10 1.1 mrg the Free Software Foundation; either version 3 of the License, or (at your
11 1.1 mrg option) any later version.
12 1.1 mrg
13 1.1 mrg The GNU MPFR Library is distributed in the hope that it will be useful, but
14 1.1 mrg WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 1.1 mrg or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 1.1 mrg License for more details.
17 1.1 mrg
18 1.1 mrg You should have received a copy of the GNU Lesser General Public License
19 1.1 mrg along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
20 1.1.1.5 mrg https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
21 1.1 mrg 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
22 1.1 mrg
23 1.1 mrg #include "mpfr-test.h"
24 1.1 mrg
25 1.1.1.4 mrg #define DISP(s,t) \
26 1.1.1.4 mrg do \
27 1.1.1.4 mrg { \
28 1.1.1.4 mrg printf (s); \
29 1.1.1.4 mrg mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); \
30 1.1.1.4 mrg } \
31 1.1.1.4 mrg while (0)
32 1.1.1.4 mrg
33 1.1.1.4 mrg #define DISP2(s,t) do { DISP(s,t); putchar ('\n'); } while (0)
34 1.1 mrg
35 1.1 mrg #define SPECIAL_MAX 12
36 1.1 mrg
37 1.1 mrg static void
38 1.1 mrg set_special (mpfr_ptr x, unsigned int select)
39 1.1 mrg {
40 1.1 mrg MPFR_ASSERTN (select < SPECIAL_MAX);
41 1.1 mrg switch (select)
42 1.1 mrg {
43 1.1 mrg case 0:
44 1.1 mrg MPFR_SET_NAN (x);
45 1.1 mrg break;
46 1.1 mrg case 1:
47 1.1 mrg MPFR_SET_INF (x);
48 1.1 mrg MPFR_SET_POS (x);
49 1.1 mrg break;
50 1.1 mrg case 2:
51 1.1 mrg MPFR_SET_INF (x);
52 1.1 mrg MPFR_SET_NEG (x);
53 1.1 mrg break;
54 1.1 mrg case 3:
55 1.1 mrg MPFR_SET_ZERO (x);
56 1.1 mrg MPFR_SET_POS (x);
57 1.1 mrg break;
58 1.1 mrg case 4:
59 1.1 mrg MPFR_SET_ZERO (x);
60 1.1 mrg MPFR_SET_NEG (x);
61 1.1 mrg break;
62 1.1 mrg case 5:
63 1.1 mrg mpfr_set_str_binary (x, "1");
64 1.1 mrg break;
65 1.1 mrg case 6:
66 1.1 mrg mpfr_set_str_binary (x, "-1");
67 1.1 mrg break;
68 1.1 mrg case 7:
69 1.1 mrg mpfr_set_str_binary (x, "1e-1");
70 1.1 mrg break;
71 1.1 mrg case 8:
72 1.1 mrg mpfr_set_str_binary (x, "1e+1");
73 1.1 mrg break;
74 1.1 mrg case 9:
75 1.1 mrg mpfr_const_pi (x, MPFR_RNDN);
76 1.1 mrg break;
77 1.1 mrg case 10:
78 1.1 mrg mpfr_const_pi (x, MPFR_RNDN);
79 1.1 mrg MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1);
80 1.1 mrg break;
81 1.1 mrg default:
82 1.1 mrg mpfr_urandomb (x, RANDS);
83 1.1 mrg break;
84 1.1 mrg }
85 1.1 mrg }
86 1.1.1.6 mrg
87 1.1.1.6 mrg /* same as mpfr_cmp, but returns 0 for both NaN's */
88 1.1 mrg static int
89 1.1 mrg mpfr_compare (mpfr_srcptr a, mpfr_srcptr b)
90 1.1 mrg {
91 1.1 mrg return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) :
92 1.1 mrg (MPFR_IS_NAN(b) || mpfr_cmp(a, b));
93 1.1 mrg }
94 1.1 mrg
95 1.1 mrg static void
96 1.1 mrg test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t),
97 1.1.1.2 mrg const char *foo)
98 1.1 mrg {
99 1.1 mrg mpfr_t ref1, ref2, ref3;
100 1.1 mrg mpfr_t res1;
101 1.1 mrg mpfr_prec_t p1, p2, p3;
102 1.1 mrg int i, inexa, inexd;
103 1.1 mrg mpfr_rnd_t r;
104 1.1 mrg
105 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
106 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
107 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
108 1.1 mrg
109 1.1 mrg mpfr_init2 (ref1, p1);
110 1.1 mrg mpfr_init2 (ref2, p2);
111 1.1 mrg mpfr_init2 (ref3, p3);
112 1.1 mrg mpfr_init2 (res1, p1);
113 1.1 mrg
114 1.1 mrg /* for each variable, consider each of the following 6 possibilities:
115 1.1 mrg NaN, +Infinity, -Infinity, +0, -0 or a random number */
116 1.1 mrg for (i = 0; i < SPECIAL_MAX * SPECIAL_MAX; i++)
117 1.1 mrg {
118 1.1 mrg set_special (ref2, i%SPECIAL_MAX);
119 1.1 mrg set_special (ref3, i/SPECIAL_MAX);
120 1.1 mrg
121 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
122 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
123 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
124 1.1 mrg
125 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
126 1.1 mrg {
127 1.1 mrg printf ("Error with RNDA for %s with ", foo);
128 1.1 mrg DISP("x=",ref2); DISP2(", y=",ref3);
129 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
130 1.1.1.4 mrg printf ("expected "); mpfr_dump (ref1);
131 1.1.1.4 mrg printf ("got "); mpfr_dump (res1);
132 1.1 mrg exit (1);
133 1.1 mrg }
134 1.1 mrg }
135 1.1 mrg
136 1.1 mrg mpfr_clear (ref1);
137 1.1 mrg mpfr_clear (ref2);
138 1.1 mrg mpfr_clear (ref3);
139 1.1 mrg mpfr_clear (res1);
140 1.1 mrg }
141 1.1 mrg
142 1.1 mrg static void
143 1.1 mrg test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
144 1.1.1.2 mrg mpfr_rnd_t), const char *foo)
145 1.1 mrg {
146 1.1 mrg mpfr_t ref, op1, op2, op3;
147 1.1 mrg mpfr_prec_t pout, p1, p2, p3;
148 1.1 mrg mpfr_t res;
149 1.1 mrg int i, j, k, inexa, inexd;
150 1.1 mrg mpfr_rnd_t r;
151 1.1 mrg
152 1.1 mrg pout = (randlimb () % 200) + MPFR_PREC_MIN;
153 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
154 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
155 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
156 1.1 mrg
157 1.1 mrg mpfr_init2 (ref, pout);
158 1.1 mrg mpfr_init2 (res, pout);
159 1.1 mrg mpfr_init2 (op1, p1);
160 1.1 mrg mpfr_init2 (op2, p2);
161 1.1 mrg mpfr_init2 (op3, p3);
162 1.1 mrg
163 1.1 mrg /* for each variable, consider each of the following 6 possibilities:
164 1.1 mrg NaN, +Infinity, -Infinity, +0, -0 or a random number */
165 1.1 mrg
166 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
167 1.1 mrg {
168 1.1 mrg set_special (op1, i);
169 1.1 mrg for (j = 0; j < SPECIAL_MAX; j++)
170 1.1 mrg {
171 1.1 mrg set_special (op2, j);
172 1.1 mrg for (k = 0; k < SPECIAL_MAX; k++)
173 1.1 mrg {
174 1.1 mrg set_special (op3, k);
175 1.1 mrg
176 1.1 mrg inexa = testfunc (res, op1, op2, op3, MPFR_RNDA);
177 1.1.1.4 mrg r = MPFR_IS_POS (res) ? MPFR_RNDU : MPFR_RNDD;
178 1.1 mrg inexd = testfunc (ref, op1, op2, op3, r);
179 1.1 mrg
180 1.1 mrg if (mpfr_compare (res, ref) || inexa != inexd)
181 1.1 mrg {
182 1.1 mrg printf ("Error with RNDA for %s with ", foo);
183 1.1 mrg DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
184 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
185 1.1 mrg DISP("expected ", ref); DISP2(", got ", res);
186 1.1 mrg exit (1);
187 1.1 mrg }
188 1.1 mrg }
189 1.1 mrg }
190 1.1 mrg }
191 1.1 mrg
192 1.1 mrg mpfr_clear (ref);
193 1.1 mrg mpfr_clear (op1);
194 1.1 mrg mpfr_clear (op2);
195 1.1 mrg mpfr_clear (op3);
196 1.1 mrg mpfr_clear (res);
197 1.1 mrg }
198 1.1 mrg
199 1.1 mrg static void
200 1.1 mrg test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t),
201 1.1.1.2 mrg const char *foo)
202 1.1 mrg {
203 1.1 mrg mpfr_t ref1, ref2;
204 1.1 mrg unsigned int ref3;
205 1.1 mrg mpfr_t res1;
206 1.1 mrg mpfr_prec_t p1, p2;
207 1.1 mrg int i, inexa, inexd;
208 1.1 mrg mpfr_rnd_t r;
209 1.1 mrg
210 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
211 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
212 1.1 mrg
213 1.1 mrg mpfr_init2 (ref1, p1);
214 1.1 mrg mpfr_init2 (ref2, p2);
215 1.1 mrg mpfr_init2 (res1, p1);
216 1.1 mrg
217 1.1 mrg /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number
218 1.1 mrg ref3 can be 0 or any number */
219 1.1 mrg for (i = 0; i < SPECIAL_MAX * 2; i++)
220 1.1 mrg {
221 1.1 mrg set_special (ref2, i % SPECIAL_MAX);
222 1.1 mrg ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
223 1.1 mrg
224 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
225 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
226 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
227 1.1 mrg
228 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
229 1.1 mrg {
230 1.1 mrg printf ("Error with RNDA for %s for c=%u\n", foo, ref3);
231 1.1 mrg DISP2("a=",ref2);
232 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
233 1.1.1.4 mrg printf ("expected "); mpfr_dump (ref1);
234 1.1.1.4 mrg printf ("got "); mpfr_dump (res1);
235 1.1 mrg exit (1);
236 1.1 mrg }
237 1.1 mrg }
238 1.1 mrg
239 1.1 mrg mpfr_clear (ref1);
240 1.1 mrg mpfr_clear (ref2);
241 1.1 mrg mpfr_clear (res1);
242 1.1 mrg }
243 1.1 mrg
244 1.1 mrg static void
245 1.1 mrg testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t),
246 1.1.1.2 mrg const char *foo)
247 1.1 mrg {
248 1.1 mrg mpfr_t ref1, ref3;
249 1.1 mrg unsigned int ref2;
250 1.1 mrg mpfr_t res1;
251 1.1 mrg mpfr_prec_t p1, p3;
252 1.1 mrg int i, inexa, inexd;
253 1.1 mrg mpfr_rnd_t r;
254 1.1 mrg
255 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
256 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
257 1.1 mrg
258 1.1 mrg mpfr_init2 (ref1, p1);
259 1.1 mrg mpfr_init2 (ref3, p3);
260 1.1 mrg mpfr_init2 (res1, p1);
261 1.1 mrg
262 1.1 mrg for (i = 0; i < SPECIAL_MAX * 2; i++)
263 1.1 mrg {
264 1.1 mrg set_special (ref3, i % SPECIAL_MAX);
265 1.1 mrg ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
266 1.1 mrg
267 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
268 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
269 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
270 1.1 mrg
271 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
272 1.1 mrg {
273 1.1 mrg printf ("Error with RNDA for %s for b=%u\n", foo, ref2);
274 1.1 mrg DISP2("a=", ref3);
275 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
276 1.1 mrg DISP("expected ", ref1); DISP2(", got ", res1);
277 1.1 mrg exit (1);
278 1.1 mrg }
279 1.1 mrg }
280 1.1 mrg
281 1.1 mrg mpfr_clear (ref1);
282 1.1 mrg mpfr_clear (ref3);
283 1.1 mrg mpfr_clear (res1);
284 1.1 mrg }
285 1.1 mrg
286 1.1 mrg /* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */
287 1.1 mrg static void
288 1.1.1.2 mrg test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), const char *foo)
289 1.1 mrg {
290 1.1 mrg mpfr_t ref1, ref2;
291 1.1 mrg mpfr_t res1;
292 1.1 mrg mpfr_prec_t p1, p2;
293 1.1 mrg int i, inexa, inexd;
294 1.1 mrg mpfr_rnd_t r;
295 1.1 mrg
296 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
297 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
298 1.1 mrg
299 1.1 mrg mpfr_init2 (ref1, p1);
300 1.1 mrg mpfr_init2 (ref2, p2);
301 1.1 mrg mpfr_init2 (res1, p1);
302 1.1 mrg
303 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
304 1.1 mrg {
305 1.1 mrg set_special (ref2, i);
306 1.1 mrg
307 1.1 mrg /* first round to away */
308 1.1 mrg inexa = testfunc (res1, ref2, MPFR_RNDA);
309 1.1 mrg
310 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
311 1.1 mrg inexd = testfunc (ref1, ref2, r);
312 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
313 1.1 mrg {
314 1.1 mrg printf ("Error with RNDA for %s with ", foo);
315 1.1 mrg DISP2("x=", ref2);
316 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
317 1.1 mrg DISP("expected ", ref1); DISP2(", got ", res1);
318 1.1 mrg exit (1);
319 1.1 mrg }
320 1.1 mrg }
321 1.1 mrg
322 1.1 mrg mpfr_clear (ref1);
323 1.1 mrg mpfr_clear (ref2);
324 1.1 mrg mpfr_clear (res1);
325 1.1 mrg }
326 1.1 mrg
327 1.1 mrg /* one operand, two results, like mpfr_sin_cos */
328 1.1 mrg static void
329 1.1.1.2 mrg test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
330 1.1.1.2 mrg const char *foo)
331 1.1 mrg {
332 1.1 mrg mpfr_t ref1, ref2, ref3;
333 1.1 mrg mpfr_t res1, res2;
334 1.1 mrg mpfr_prec_t p1, p2, p3;
335 1.1 mrg int i, inexa, inexd;
336 1.1 mrg mpfr_rnd_t r;
337 1.1 mrg
338 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
339 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
340 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
341 1.1 mrg
342 1.1 mrg mpfr_init2 (ref1, p1);
343 1.1 mrg mpfr_init2 (ref2, p2);
344 1.1 mrg mpfr_init2 (ref3, p3);
345 1.1 mrg mpfr_init2 (res1, p1);
346 1.1 mrg mpfr_init2 (res2, p2);
347 1.1 mrg
348 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
349 1.1 mrg {
350 1.1 mrg set_special (ref3, i);
351 1.1 mrg
352 1.1 mrg inexa = testfunc (res1, res2, ref3, MPFR_RNDA);
353 1.1 mrg
354 1.1 mrg /* first check wrt the first operand */
355 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
356 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
357 1.1 mrg /* the low 2 bits of the inexact flag concern the 1st operand */
358 1.1 mrg if (mpfr_compare (res1, ref1) || (inexa & 3) != (inexd & 3))
359 1.1 mrg {
360 1.1 mrg printf ("Error with RNDA for %s (1st operand)\n", foo);
361 1.1 mrg DISP2("a=",ref3);
362 1.1 mrg DISP("expected ", ref1); printf ("\n");
363 1.1 mrg DISP("got ", res1); printf ("\n");
364 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa & 3, inexd & 3);
365 1.1 mrg exit (1);
366 1.1 mrg }
367 1.1 mrg
368 1.1 mrg /* now check wrt the second operand */
369 1.1.1.4 mrg r = MPFR_IS_POS (res2) ? MPFR_RNDU : MPFR_RNDD;
370 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
371 1.1 mrg /* bits 2..3 of the inexact flag concern the 2nd operand */
372 1.1 mrg if (mpfr_compare (res2, ref2) || (inexa >> 2) != (inexd >> 2))
373 1.1 mrg {
374 1.1 mrg printf ("Error with RNDA for %s (2nd operand)\n", foo);
375 1.1 mrg DISP2("a=",ref3);
376 1.1 mrg DISP("expected ", ref2); printf ("\n");
377 1.1 mrg DISP("got ", res2); printf ("\n");
378 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa >> 2, inexd >> 2);
379 1.1 mrg exit (1);
380 1.1 mrg }
381 1.1 mrg
382 1.1 mrg }
383 1.1 mrg
384 1.1 mrg mpfr_clear (ref1);
385 1.1 mrg mpfr_clear (ref2);
386 1.1 mrg mpfr_clear (ref3);
387 1.1 mrg mpfr_clear (res1);
388 1.1 mrg mpfr_clear (res2);
389 1.1 mrg }
390 1.1 mrg
391 1.1 mrg int
392 1.1 mrg main (void)
393 1.1 mrg {
394 1.1.1.2 mrg int N = 20;
395 1.1 mrg
396 1.1 mrg tests_start_mpfr ();
397 1.1 mrg
398 1.1 mrg while (N--)
399 1.1 mrg {
400 1.1 mrg /* no need to test mpfr_round, mpfr_ceil, mpfr_floor, mpfr_trunc since
401 1.1 mrg they take no rounding mode */
402 1.1 mrg
403 1.1 mrg test2ui (mpfr_add_ui, "mpfr_add_ui");
404 1.1 mrg test2ui (mpfr_div_2exp, "mpfr_div_2exp");
405 1.1.1.5 mrg test2ui (mpfr_div_2ui, "mpfr_div_2ui");
406 1.1 mrg test2ui (mpfr_div_ui, "mpfr_div_ui");
407 1.1 mrg test2ui (mpfr_mul_2exp, "mpfr_mul_2exp");
408 1.1.1.5 mrg test2ui (mpfr_mul_2ui, "mpfr_mul_2ui");
409 1.1 mrg test2ui (mpfr_mul_ui, "mpfr_mul_ui");
410 1.1 mrg test2ui (mpfr_pow_ui, "mpfr_pow_ui");
411 1.1 mrg test2ui (mpfr_sub_ui, "mpfr_sub_ui");
412 1.1 mrg
413 1.1 mrg testui2 (mpfr_ui_div, "mpfr_ui_div");
414 1.1 mrg testui2 (mpfr_ui_sub, "mpfr_ui_sub");
415 1.1 mrg testui2 (mpfr_ui_pow, "mpfr_ui_pow");
416 1.1 mrg
417 1.1 mrg test2 (mpfr_sqr, "mpfr_sqr");
418 1.1 mrg test2 (mpfr_sqrt, "mpfr_sqrt");
419 1.1 mrg test2 (mpfr_abs, "mpfr_abs");
420 1.1 mrg test2 (mpfr_neg, "mpfr_neg");
421 1.1 mrg
422 1.1 mrg test2 (mpfr_log, "mpfr_log");
423 1.1 mrg test2 (mpfr_log2, "mpfr_log2");
424 1.1 mrg test2 (mpfr_log10, "mpfr_log10");
425 1.1 mrg test2 (mpfr_log1p, "mpfr_log1p");
426 1.1 mrg
427 1.1 mrg test2 (mpfr_exp, "mpfr_exp");
428 1.1 mrg test2 (mpfr_exp2, "mpfr_exp2");
429 1.1 mrg test2 (mpfr_exp10, "mpfr_exp10");
430 1.1 mrg test2 (mpfr_expm1, "mpfr_expm1");
431 1.1 mrg test2 (mpfr_eint, "mpfr_eint");
432 1.1 mrg
433 1.1 mrg test2 (mpfr_sinh, "mpfr_sinh");
434 1.1 mrg test2 (mpfr_cosh, "mpfr_cosh");
435 1.1 mrg test2 (mpfr_tanh, "mpfr_tanh");
436 1.1 mrg test2 (mpfr_asinh, "mpfr_asinh");
437 1.1 mrg test2 (mpfr_acosh, "mpfr_acosh");
438 1.1 mrg test2 (mpfr_atanh, "mpfr_atanh");
439 1.1 mrg test2 (mpfr_sech, "mpfr_sech");
440 1.1 mrg test2 (mpfr_csch, "mpfr_csch");
441 1.1 mrg test2 (mpfr_coth, "mpfr_coth");
442 1.1 mrg
443 1.1 mrg test2 (mpfr_asin, "mpfr_asin");
444 1.1 mrg test2 (mpfr_acos, "mpfr_acos");
445 1.1 mrg test2 (mpfr_atan, "mpfr_atan");
446 1.1 mrg test2 (mpfr_cos, "mpfr_cos");
447 1.1 mrg test2 (mpfr_sin, "mpfr_sin");
448 1.1 mrg test2 (mpfr_tan, "mpfr_tan");
449 1.1 mrg test2 (mpfr_sec, "mpfr_sec");
450 1.1 mrg test2 (mpfr_csc, "mpfr_csc");
451 1.1 mrg test2 (mpfr_cot, "mpfr_cot");
452 1.1 mrg
453 1.1 mrg test2 (mpfr_erf, "mpfr_erf");
454 1.1 mrg test2 (mpfr_erfc, "mpfr_erfc");
455 1.1 mrg test2 (mpfr_j0, "mpfr_j0");
456 1.1 mrg test2 (mpfr_j1, "mpfr_j1");
457 1.1 mrg test2 (mpfr_y0, "mpfr_y0");
458 1.1 mrg test2 (mpfr_y1, "mpfr_y1");
459 1.1 mrg test2 (mpfr_zeta, "mpfr_zeta");
460 1.1 mrg test2 (mpfr_gamma, "mpfr_gamma");
461 1.1 mrg test2 (mpfr_lngamma, "mpfr_lngamma");
462 1.1 mrg
463 1.1 mrg test2 (mpfr_rint, "mpfr_rint");
464 1.1 mrg test2 (mpfr_rint_ceil, "mpfr_rint_ceil");
465 1.1 mrg test2 (mpfr_rint_floor, "mpfr_rint_floor");
466 1.1 mrg test2 (mpfr_rint_round, "mpfr_rint_round");
467 1.1 mrg test2 (mpfr_rint_trunc, "mpfr_rint_trunc");
468 1.1 mrg test2 (mpfr_frac, "mpfr_frac");
469 1.1 mrg
470 1.1 mrg test3 (mpfr_add, "mpfr_add");
471 1.1 mrg test3 (mpfr_sub, "mpfr_sub");
472 1.1 mrg test3 (mpfr_mul, "mpfr_mul");
473 1.1 mrg test3 (mpfr_div, "mpfr_div");
474 1.1 mrg
475 1.1 mrg test3 (mpfr_agm, "mpfr_agm");
476 1.1 mrg test3 (mpfr_min, "mpfr_min");
477 1.1 mrg test3 (mpfr_max, "mpfr_max");
478 1.1 mrg
479 1.1 mrg /* we don't test reldiff since it does not guarantee correct rounding,
480 1.1 mrg thus we can get different results with RNDA and RNDU or RNDD. */
481 1.1 mrg test3 (mpfr_dim, "mpfr_dim");
482 1.1 mrg
483 1.1 mrg test3 (mpfr_remainder, "mpfr_remainder");
484 1.1 mrg test3 (mpfr_pow, "mpfr_pow");
485 1.1 mrg test3 (mpfr_atan2, "mpfr_atan2");
486 1.1 mrg test3 (mpfr_hypot, "mpfr_hypot");
487 1.1 mrg
488 1.1 mrg test3a (mpfr_sin_cos, "mpfr_sin_cos");
489 1.1 mrg
490 1.1 mrg test4 (mpfr_fma, "mpfr_fma");
491 1.1 mrg test4 (mpfr_fms, "mpfr_fms");
492 1.1 mrg
493 1.1 mrg test2 (mpfr_li2, "mpfr_li2");
494 1.1 mrg test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt");
495 1.1 mrg test3 (mpfr_fmod, "mpfr_fmod");
496 1.1 mrg test3a (mpfr_modf, "mpfr_modf");
497 1.1 mrg test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh");
498 1.1.1.4 mrg
499 1.1.1.4 mrg #if MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0)
500 1.1.1.4 mrg test2 (mpfr_ai, "mpfr_ai");
501 1.1.1.4 mrg test2 (mpfr_digamma, "mpfr_digamma");
502 1.1 mrg #endif
503 1.1 mrg }
504 1.1 mrg
505 1.1 mrg tests_end_mpfr ();
506 1.1 mrg return 0;
507 1.1 mrg }
508