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