taway.c revision 1.1.1.4 1 1.1 mrg /* Test file for round away.
2 1.1 mrg
3 1.1.1.4 mrg Copyright 2000-2018 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 mrg http://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 mrg /* same than mpfr_cmp, but returns 0 for both NaN's */
87 1.1 mrg static int
88 1.1 mrg mpfr_compare (mpfr_srcptr a, mpfr_srcptr b)
89 1.1 mrg {
90 1.1 mrg return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) :
91 1.1 mrg (MPFR_IS_NAN(b) || mpfr_cmp(a, b));
92 1.1 mrg }
93 1.1 mrg
94 1.1 mrg static void
95 1.1 mrg test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t),
96 1.1.1.2 mrg const char *foo)
97 1.1 mrg {
98 1.1 mrg mpfr_t ref1, ref2, ref3;
99 1.1 mrg mpfr_t res1;
100 1.1 mrg mpfr_prec_t p1, p2, p3;
101 1.1 mrg int i, inexa, inexd;
102 1.1 mrg mpfr_rnd_t r;
103 1.1 mrg
104 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
105 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
106 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
107 1.1 mrg
108 1.1 mrg mpfr_init2 (ref1, p1);
109 1.1 mrg mpfr_init2 (ref2, p2);
110 1.1 mrg mpfr_init2 (ref3, p3);
111 1.1 mrg mpfr_init2 (res1, p1);
112 1.1 mrg
113 1.1 mrg /* for each variable, consider each of the following 6 possibilities:
114 1.1 mrg NaN, +Infinity, -Infinity, +0, -0 or a random number */
115 1.1 mrg for (i = 0; i < SPECIAL_MAX * SPECIAL_MAX; i++)
116 1.1 mrg {
117 1.1 mrg set_special (ref2, i%SPECIAL_MAX);
118 1.1 mrg set_special (ref3, i/SPECIAL_MAX);
119 1.1 mrg
120 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
121 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
122 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
123 1.1 mrg
124 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
125 1.1 mrg {
126 1.1 mrg printf ("Error with RNDA for %s with ", foo);
127 1.1 mrg DISP("x=",ref2); DISP2(", y=",ref3);
128 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
129 1.1.1.4 mrg printf ("expected "); mpfr_dump (ref1);
130 1.1.1.4 mrg printf ("got "); mpfr_dump (res1);
131 1.1 mrg exit (1);
132 1.1 mrg }
133 1.1 mrg }
134 1.1 mrg
135 1.1 mrg mpfr_clear (ref1);
136 1.1 mrg mpfr_clear (ref2);
137 1.1 mrg mpfr_clear (ref3);
138 1.1 mrg mpfr_clear (res1);
139 1.1 mrg }
140 1.1 mrg
141 1.1 mrg static void
142 1.1 mrg test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
143 1.1.1.2 mrg mpfr_rnd_t), const char *foo)
144 1.1 mrg {
145 1.1 mrg mpfr_t ref, op1, op2, op3;
146 1.1 mrg mpfr_prec_t pout, p1, p2, p3;
147 1.1 mrg mpfr_t res;
148 1.1 mrg int i, j, k, inexa, inexd;
149 1.1 mrg mpfr_rnd_t r;
150 1.1 mrg
151 1.1 mrg pout = (randlimb () % 200) + MPFR_PREC_MIN;
152 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
153 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
154 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
155 1.1 mrg
156 1.1 mrg mpfr_init2 (ref, pout);
157 1.1 mrg mpfr_init2 (res, pout);
158 1.1 mrg mpfr_init2 (op1, p1);
159 1.1 mrg mpfr_init2 (op2, p2);
160 1.1 mrg mpfr_init2 (op3, p3);
161 1.1 mrg
162 1.1 mrg /* for each variable, consider each of the following 6 possibilities:
163 1.1 mrg NaN, +Infinity, -Infinity, +0, -0 or a random number */
164 1.1 mrg
165 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
166 1.1 mrg {
167 1.1 mrg set_special (op1, i);
168 1.1 mrg for (j = 0; j < SPECIAL_MAX; j++)
169 1.1 mrg {
170 1.1 mrg set_special (op2, j);
171 1.1 mrg for (k = 0; k < SPECIAL_MAX; k++)
172 1.1 mrg {
173 1.1 mrg set_special (op3, k);
174 1.1 mrg
175 1.1 mrg inexa = testfunc (res, op1, op2, op3, MPFR_RNDA);
176 1.1.1.4 mrg r = MPFR_IS_POS (res) ? MPFR_RNDU : MPFR_RNDD;
177 1.1 mrg inexd = testfunc (ref, op1, op2, op3, r);
178 1.1 mrg
179 1.1 mrg if (mpfr_compare (res, ref) || inexa != inexd)
180 1.1 mrg {
181 1.1 mrg printf ("Error with RNDA for %s with ", foo);
182 1.1 mrg DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
183 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
184 1.1 mrg DISP("expected ", ref); DISP2(", got ", res);
185 1.1 mrg exit (1);
186 1.1 mrg }
187 1.1 mrg }
188 1.1 mrg }
189 1.1 mrg }
190 1.1 mrg
191 1.1 mrg mpfr_clear (ref);
192 1.1 mrg mpfr_clear (op1);
193 1.1 mrg mpfr_clear (op2);
194 1.1 mrg mpfr_clear (op3);
195 1.1 mrg mpfr_clear (res);
196 1.1 mrg }
197 1.1 mrg
198 1.1 mrg static void
199 1.1 mrg test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t),
200 1.1.1.2 mrg const char *foo)
201 1.1 mrg {
202 1.1 mrg mpfr_t ref1, ref2;
203 1.1 mrg unsigned int ref3;
204 1.1 mrg mpfr_t res1;
205 1.1 mrg mpfr_prec_t p1, p2;
206 1.1 mrg int i, inexa, inexd;
207 1.1 mrg mpfr_rnd_t r;
208 1.1 mrg
209 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
210 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
211 1.1 mrg
212 1.1 mrg mpfr_init2 (ref1, p1);
213 1.1 mrg mpfr_init2 (ref2, p2);
214 1.1 mrg mpfr_init2 (res1, p1);
215 1.1 mrg
216 1.1 mrg /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number
217 1.1 mrg ref3 can be 0 or any number */
218 1.1 mrg for (i = 0; i < SPECIAL_MAX * 2; i++)
219 1.1 mrg {
220 1.1 mrg set_special (ref2, i % SPECIAL_MAX);
221 1.1 mrg ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
222 1.1 mrg
223 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
224 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
225 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
226 1.1 mrg
227 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
228 1.1 mrg {
229 1.1 mrg printf ("Error with RNDA for %s for c=%u\n", foo, ref3);
230 1.1 mrg DISP2("a=",ref2);
231 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
232 1.1.1.4 mrg printf ("expected "); mpfr_dump (ref1);
233 1.1.1.4 mrg printf ("got "); mpfr_dump (res1);
234 1.1 mrg exit (1);
235 1.1 mrg }
236 1.1 mrg }
237 1.1 mrg
238 1.1 mrg mpfr_clear (ref1);
239 1.1 mrg mpfr_clear (ref2);
240 1.1 mrg mpfr_clear (res1);
241 1.1 mrg }
242 1.1 mrg
243 1.1 mrg static void
244 1.1 mrg testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t),
245 1.1.1.2 mrg const char *foo)
246 1.1 mrg {
247 1.1 mrg mpfr_t ref1, ref3;
248 1.1 mrg unsigned int ref2;
249 1.1 mrg mpfr_t res1;
250 1.1 mrg mpfr_prec_t p1, p3;
251 1.1 mrg int i, inexa, inexd;
252 1.1 mrg mpfr_rnd_t r;
253 1.1 mrg
254 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
255 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
256 1.1 mrg
257 1.1 mrg mpfr_init2 (ref1, p1);
258 1.1 mrg mpfr_init2 (ref3, p3);
259 1.1 mrg mpfr_init2 (res1, p1);
260 1.1 mrg
261 1.1 mrg for (i = 0; i < SPECIAL_MAX * 2; i++)
262 1.1 mrg {
263 1.1 mrg set_special (ref3, i % SPECIAL_MAX);
264 1.1 mrg ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
265 1.1 mrg
266 1.1 mrg inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
267 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
268 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
269 1.1 mrg
270 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
271 1.1 mrg {
272 1.1 mrg printf ("Error with RNDA for %s for b=%u\n", foo, ref2);
273 1.1 mrg DISP2("a=", ref3);
274 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
275 1.1 mrg DISP("expected ", ref1); DISP2(", got ", res1);
276 1.1 mrg exit (1);
277 1.1 mrg }
278 1.1 mrg }
279 1.1 mrg
280 1.1 mrg mpfr_clear (ref1);
281 1.1 mrg mpfr_clear (ref3);
282 1.1 mrg mpfr_clear (res1);
283 1.1 mrg }
284 1.1 mrg
285 1.1 mrg /* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */
286 1.1 mrg static void
287 1.1.1.2 mrg test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), const char *foo)
288 1.1 mrg {
289 1.1 mrg mpfr_t ref1, ref2;
290 1.1 mrg mpfr_t res1;
291 1.1 mrg mpfr_prec_t p1, p2;
292 1.1 mrg int i, inexa, inexd;
293 1.1 mrg mpfr_rnd_t r;
294 1.1 mrg
295 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
296 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
297 1.1 mrg
298 1.1 mrg mpfr_init2 (ref1, p1);
299 1.1 mrg mpfr_init2 (ref2, p2);
300 1.1 mrg mpfr_init2 (res1, p1);
301 1.1 mrg
302 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
303 1.1 mrg {
304 1.1 mrg set_special (ref2, i);
305 1.1 mrg
306 1.1 mrg /* first round to away */
307 1.1 mrg inexa = testfunc (res1, ref2, MPFR_RNDA);
308 1.1 mrg
309 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
310 1.1 mrg inexd = testfunc (ref1, ref2, r);
311 1.1 mrg if (mpfr_compare (res1, ref1) || inexa != inexd)
312 1.1 mrg {
313 1.1 mrg printf ("Error with RNDA for %s with ", foo);
314 1.1 mrg DISP2("x=", ref2);
315 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa, inexd);
316 1.1 mrg DISP("expected ", ref1); DISP2(", got ", res1);
317 1.1 mrg exit (1);
318 1.1 mrg }
319 1.1 mrg }
320 1.1 mrg
321 1.1 mrg mpfr_clear (ref1);
322 1.1 mrg mpfr_clear (ref2);
323 1.1 mrg mpfr_clear (res1);
324 1.1 mrg }
325 1.1 mrg
326 1.1 mrg /* one operand, two results, like mpfr_sin_cos */
327 1.1 mrg static void
328 1.1.1.2 mrg test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
329 1.1.1.2 mrg const char *foo)
330 1.1 mrg {
331 1.1 mrg mpfr_t ref1, ref2, ref3;
332 1.1 mrg mpfr_t res1, res2;
333 1.1 mrg mpfr_prec_t p1, p2, p3;
334 1.1 mrg int i, inexa, inexd;
335 1.1 mrg mpfr_rnd_t r;
336 1.1 mrg
337 1.1 mrg p1 = (randlimb () % 200) + MPFR_PREC_MIN;
338 1.1 mrg p2 = (randlimb () % 200) + MPFR_PREC_MIN;
339 1.1 mrg p3 = (randlimb () % 200) + MPFR_PREC_MIN;
340 1.1 mrg
341 1.1 mrg mpfr_init2 (ref1, p1);
342 1.1 mrg mpfr_init2 (ref2, p2);
343 1.1 mrg mpfr_init2 (ref3, p3);
344 1.1 mrg mpfr_init2 (res1, p1);
345 1.1 mrg mpfr_init2 (res2, p2);
346 1.1 mrg
347 1.1 mrg for (i = 0; i < SPECIAL_MAX; i++)
348 1.1 mrg {
349 1.1 mrg set_special (ref3, i);
350 1.1 mrg
351 1.1 mrg inexa = testfunc (res1, res2, ref3, MPFR_RNDA);
352 1.1 mrg
353 1.1 mrg /* first check wrt the first operand */
354 1.1.1.4 mrg r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD;
355 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
356 1.1 mrg /* the low 2 bits of the inexact flag concern the 1st operand */
357 1.1 mrg if (mpfr_compare (res1, ref1) || (inexa & 3) != (inexd & 3))
358 1.1 mrg {
359 1.1 mrg printf ("Error with RNDA for %s (1st operand)\n", foo);
360 1.1 mrg DISP2("a=",ref3);
361 1.1 mrg DISP("expected ", ref1); printf ("\n");
362 1.1 mrg DISP("got ", res1); printf ("\n");
363 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa & 3, inexd & 3);
364 1.1 mrg exit (1);
365 1.1 mrg }
366 1.1 mrg
367 1.1 mrg /* now check wrt the second operand */
368 1.1.1.4 mrg r = MPFR_IS_POS (res2) ? MPFR_RNDU : MPFR_RNDD;
369 1.1 mrg inexd = testfunc (ref1, ref2, ref3, r);
370 1.1 mrg /* bits 2..3 of the inexact flag concern the 2nd operand */
371 1.1 mrg if (mpfr_compare (res2, ref2) || (inexa >> 2) != (inexd >> 2))
372 1.1 mrg {
373 1.1 mrg printf ("Error with RNDA for %s (2nd operand)\n", foo);
374 1.1 mrg DISP2("a=",ref3);
375 1.1 mrg DISP("expected ", ref2); printf ("\n");
376 1.1 mrg DISP("got ", res2); printf ("\n");
377 1.1 mrg printf ("inexa=%d inexd=%d\n", inexa >> 2, inexd >> 2);
378 1.1 mrg exit (1);
379 1.1 mrg }
380 1.1 mrg
381 1.1 mrg }
382 1.1 mrg
383 1.1 mrg mpfr_clear (ref1);
384 1.1 mrg mpfr_clear (ref2);
385 1.1 mrg mpfr_clear (ref3);
386 1.1 mrg mpfr_clear (res1);
387 1.1 mrg mpfr_clear (res2);
388 1.1 mrg }
389 1.1 mrg
390 1.1 mrg int
391 1.1 mrg main (void)
392 1.1 mrg {
393 1.1.1.2 mrg int N = 20;
394 1.1 mrg
395 1.1 mrg tests_start_mpfr ();
396 1.1 mrg
397 1.1 mrg while (N--)
398 1.1 mrg {
399 1.1 mrg /* no need to test mpfr_round, mpfr_ceil, mpfr_floor, mpfr_trunc since
400 1.1 mrg they take no rounding mode */
401 1.1 mrg
402 1.1 mrg test2ui (mpfr_add_ui, "mpfr_add_ui");
403 1.1 mrg test2ui (mpfr_div_2exp, "mpfr_div_2exp");
404 1.1 mrg test2ui (mpfr_div_ui, "mpfr_div_ui");
405 1.1 mrg test2ui (mpfr_mul_2exp, "mpfr_mul_2exp");
406 1.1 mrg test2ui (mpfr_mul_ui, "mpfr_mul_ui");
407 1.1 mrg test2ui (mpfr_pow_ui, "mpfr_pow_ui");
408 1.1 mrg test2ui (mpfr_sub_ui, "mpfr_sub_ui");
409 1.1 mrg
410 1.1 mrg testui2 (mpfr_ui_div, "mpfr_ui_div");
411 1.1 mrg testui2 (mpfr_ui_sub, "mpfr_ui_sub");
412 1.1 mrg testui2 (mpfr_ui_pow, "mpfr_ui_pow");
413 1.1 mrg
414 1.1 mrg test2 (mpfr_sqr, "mpfr_sqr");
415 1.1 mrg test2 (mpfr_sqrt, "mpfr_sqrt");
416 1.1 mrg test2 (mpfr_abs, "mpfr_abs");
417 1.1 mrg test2 (mpfr_neg, "mpfr_neg");
418 1.1 mrg
419 1.1 mrg test2 (mpfr_log, "mpfr_log");
420 1.1 mrg test2 (mpfr_log2, "mpfr_log2");
421 1.1 mrg test2 (mpfr_log10, "mpfr_log10");
422 1.1 mrg test2 (mpfr_log1p, "mpfr_log1p");
423 1.1 mrg
424 1.1 mrg test2 (mpfr_exp, "mpfr_exp");
425 1.1 mrg test2 (mpfr_exp2, "mpfr_exp2");
426 1.1 mrg test2 (mpfr_exp10, "mpfr_exp10");
427 1.1 mrg test2 (mpfr_expm1, "mpfr_expm1");
428 1.1 mrg test2 (mpfr_eint, "mpfr_eint");
429 1.1 mrg
430 1.1 mrg test2 (mpfr_sinh, "mpfr_sinh");
431 1.1 mrg test2 (mpfr_cosh, "mpfr_cosh");
432 1.1 mrg test2 (mpfr_tanh, "mpfr_tanh");
433 1.1 mrg test2 (mpfr_asinh, "mpfr_asinh");
434 1.1 mrg test2 (mpfr_acosh, "mpfr_acosh");
435 1.1 mrg test2 (mpfr_atanh, "mpfr_atanh");
436 1.1 mrg test2 (mpfr_sech, "mpfr_sech");
437 1.1 mrg test2 (mpfr_csch, "mpfr_csch");
438 1.1 mrg test2 (mpfr_coth, "mpfr_coth");
439 1.1 mrg
440 1.1 mrg test2 (mpfr_asin, "mpfr_asin");
441 1.1 mrg test2 (mpfr_acos, "mpfr_acos");
442 1.1 mrg test2 (mpfr_atan, "mpfr_atan");
443 1.1 mrg test2 (mpfr_cos, "mpfr_cos");
444 1.1 mrg test2 (mpfr_sin, "mpfr_sin");
445 1.1 mrg test2 (mpfr_tan, "mpfr_tan");
446 1.1 mrg test2 (mpfr_sec, "mpfr_sec");
447 1.1 mrg test2 (mpfr_csc, "mpfr_csc");
448 1.1 mrg test2 (mpfr_cot, "mpfr_cot");
449 1.1 mrg
450 1.1 mrg test2 (mpfr_erf, "mpfr_erf");
451 1.1 mrg test2 (mpfr_erfc, "mpfr_erfc");
452 1.1 mrg test2 (mpfr_j0, "mpfr_j0");
453 1.1 mrg test2 (mpfr_j1, "mpfr_j1");
454 1.1 mrg test2 (mpfr_y0, "mpfr_y0");
455 1.1 mrg test2 (mpfr_y1, "mpfr_y1");
456 1.1 mrg test2 (mpfr_zeta, "mpfr_zeta");
457 1.1 mrg test2 (mpfr_gamma, "mpfr_gamma");
458 1.1 mrg test2 (mpfr_lngamma, "mpfr_lngamma");
459 1.1 mrg
460 1.1 mrg test2 (mpfr_rint, "mpfr_rint");
461 1.1 mrg test2 (mpfr_rint_ceil, "mpfr_rint_ceil");
462 1.1 mrg test2 (mpfr_rint_floor, "mpfr_rint_floor");
463 1.1 mrg test2 (mpfr_rint_round, "mpfr_rint_round");
464 1.1 mrg test2 (mpfr_rint_trunc, "mpfr_rint_trunc");
465 1.1 mrg test2 (mpfr_frac, "mpfr_frac");
466 1.1 mrg
467 1.1 mrg test3 (mpfr_add, "mpfr_add");
468 1.1 mrg test3 (mpfr_sub, "mpfr_sub");
469 1.1 mrg test3 (mpfr_mul, "mpfr_mul");
470 1.1 mrg test3 (mpfr_div, "mpfr_div");
471 1.1 mrg
472 1.1 mrg test3 (mpfr_agm, "mpfr_agm");
473 1.1 mrg test3 (mpfr_min, "mpfr_min");
474 1.1 mrg test3 (mpfr_max, "mpfr_max");
475 1.1 mrg
476 1.1 mrg /* we don't test reldiff since it does not guarantee correct rounding,
477 1.1 mrg thus we can get different results with RNDA and RNDU or RNDD. */
478 1.1 mrg test3 (mpfr_dim, "mpfr_dim");
479 1.1 mrg
480 1.1 mrg test3 (mpfr_remainder, "mpfr_remainder");
481 1.1 mrg test3 (mpfr_pow, "mpfr_pow");
482 1.1 mrg test3 (mpfr_atan2, "mpfr_atan2");
483 1.1 mrg test3 (mpfr_hypot, "mpfr_hypot");
484 1.1 mrg
485 1.1 mrg test3a (mpfr_sin_cos, "mpfr_sin_cos");
486 1.1 mrg
487 1.1 mrg test4 (mpfr_fma, "mpfr_fma");
488 1.1 mrg test4 (mpfr_fms, "mpfr_fms");
489 1.1 mrg
490 1.1 mrg test2 (mpfr_li2, "mpfr_li2");
491 1.1 mrg test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt");
492 1.1 mrg test3 (mpfr_fmod, "mpfr_fmod");
493 1.1 mrg test3a (mpfr_modf, "mpfr_modf");
494 1.1 mrg test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh");
495 1.1.1.4 mrg
496 1.1.1.4 mrg #if MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0)
497 1.1.1.4 mrg test2 (mpfr_ai, "mpfr_ai");
498 1.1.1.4 mrg test2 (mpfr_digamma, "mpfr_digamma");
499 1.1 mrg #endif
500 1.1 mrg }
501 1.1 mrg
502 1.1 mrg tests_end_mpfr ();
503 1.1 mrg return 0;
504 1.1 mrg }
505