Add --enable-static-pie configure option to build static PIE [BZ #19574]
[glibc.git] / math / libm-test-driver.c
blob161419837dbbe9cf6b35e9ab2e0483e83a96e674
1 /* Support code for testing libm functions (driver).
2 Copyright (C) 1997-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include "libm-test-support.h"
21 #include <math-tests-arch.h>
23 /* Flags set by the including file. */
24 const int flag_test_errno = TEST_ERRNO;
25 const int flag_test_exceptions = TEST_EXCEPTIONS;
26 const int flag_test_finite = TEST_FINITE;
27 const int flag_test_inline = TEST_INLINE;
28 const int flag_test_mathvec = TEST_MATHVEC;
30 #define STRX(x) #x
31 #define STR(x) STRX (x)
32 #define STR_FLOAT STR (FLOAT)
33 #define STR_VEC_LEN STR (VEC_LEN)
35 /* Informal description of the functions being tested. */
36 #if TEST_MATHVEC
37 # define TEST_MSG "testing " STR_FLOAT " (vector length " STR_VEC_LEN ")\n"
38 #elif TEST_INLINE
39 # define TEST_MSG "testing " STR_FLOAT " (inline functions)\n"
40 #elif TEST_FINITE
41 # define TEST_MSG "testing " STR_FLOAT " (finite-math-only)\n"
42 #else
43 # define TEST_MSG "testing " STR_FLOAT " (without inline functions)\n"
44 #endif
45 const char test_msg[] = TEST_MSG;
47 /* Allow platforms without all rounding modes to test properly,
48 assuming they provide an __FE_UNDEFINED in <bits/fenv.h> which
49 causes fesetround() to return failure. */
50 #ifndef FE_TONEAREST
51 # define FE_TONEAREST __FE_UNDEFINED
52 #endif
53 #ifndef FE_TOWARDZERO
54 # define FE_TOWARDZERO __FE_UNDEFINED
55 #endif
56 #ifndef FE_UPWARD
57 # define FE_UPWARD __FE_UNDEFINED
58 #endif
59 #ifndef FE_DOWNWARD
60 # define FE_DOWNWARD __FE_UNDEFINED
61 #endif
63 #define TEST_NAN_PAYLOAD_CANONICALIZE (SNAN_TESTS_PRESERVE_PAYLOAD \
64 ? TEST_NAN_PAYLOAD \
65 : 0)
67 #if TEST_INLINE
68 const char qtype_str[] = "i" TYPE_STR;
69 #else
70 const char qtype_str[] = TYPE_STR;
71 #endif
73 /* Various constants derived from pi. We must supply them precalculated for
74 accuracy. They are written as a series of postfix operations to keep
75 them concise yet somewhat readable. */
77 /* (pi * 3) / 4 */
78 #define lit_pi_3_m_4_d LIT (2.356194490192344928846982537459627163)
79 /* pi * 3 / (4 * ln(10)) */
80 #define lit_pi_3_m_4_ln10_m_d LIT (1.023282265381381010614337719073516828)
81 /* pi / (2 * ln(10)) */
82 #define lit_pi_2_ln10_m_d LIT (0.682188176920920673742891812715677885)
83 /* pi / (4 * ln(10)) */
84 #define lit_pi_4_ln10_m_d LIT (0.341094088460460336871445906357838943)
85 /* pi / ln(10) */
86 #define lit_pi_ln10_d LIT (1.364376353841841347485783625431355770)
87 /* pi / 2 */
88 #define lit_pi_2_d LITM (M_PI_2)
89 /* pi / 4 */
90 #define lit_pi_4_d LITM (M_PI_4)
91 /* pi */
92 #define lit_pi LITM (M_PI)
94 /* Other useful constants. */
96 /* e */
97 #define lit_e LITM (M_E)
99 #define plus_zero LIT (0.0)
100 #define minus_zero LIT (-0.0)
101 #define plus_infty FUNC (__builtin_inf) ()
102 #define minus_infty -(FUNC (__builtin_inf) ())
103 #define qnan_value_pl(S) FUNC (__builtin_nan) (S)
104 #define qnan_value qnan_value_pl ("")
105 #define snan_value_pl(S) FUNC (__builtin_nans) (S)
106 #define snan_value snan_value_pl ("")
107 #define max_value TYPE_MAX
108 #define min_value TYPE_MIN
109 #define min_subnorm_value TYPE_TRUE_MIN
111 /* For nexttoward tests. */
112 #define snan_value_ld __builtin_nansl ("")
114 /* Structures for each kind of test. */
115 /* Used for both RUN_TEST_LOOP_f_f and RUN_TEST_LOOP_fp_f. */
116 struct test_f_f_data
118 const char *arg_str;
119 FLOAT arg;
120 struct
122 FLOAT expected;
123 int exceptions;
124 } rd, rn, rz, ru;
126 struct test_ff_f_data
128 const char *arg_str;
129 FLOAT arg1, arg2;
130 struct
132 FLOAT expected;
133 int exceptions;
134 } rd, rn, rz, ru;
136 /* Strictly speaking, a j type argument is one gen-libm-test.pl will not
137 attempt to muck with. For now, it is only used to prevent it from
138 mucking up an explicitly long double argument. */
139 struct test_fj_f_data
141 const char *arg_str;
142 FLOAT arg1;
143 long double arg2;
144 struct
146 FLOAT expected;
147 int exceptions;
148 } rd, rn, rz, ru;
150 struct test_fi_f_data
152 const char *arg_str;
153 FLOAT arg1;
154 int arg2;
155 struct
157 FLOAT expected;
158 int exceptions;
159 } rd, rn, rz, ru;
161 struct test_fl_f_data
163 const char *arg_str;
164 FLOAT arg1;
165 long int arg2;
166 struct
168 FLOAT expected;
169 int exceptions;
170 } rd, rn, rz, ru;
172 struct test_if_f_data
174 const char *arg_str;
175 int arg1;
176 FLOAT arg2;
177 struct
179 FLOAT expected;
180 int exceptions;
181 } rd, rn, rz, ru;
183 struct test_fff_f_data
185 const char *arg_str;
186 FLOAT arg1, arg2, arg3;
187 struct
189 FLOAT expected;
190 int exceptions;
191 } rd, rn, rz, ru;
193 struct test_fiu_M_data
195 const char *arg_str;
196 FLOAT arg1;
197 int arg2;
198 unsigned int arg3;
199 struct
201 intmax_t expected;
202 int exceptions;
203 } rd, rn, rz, ru;
205 struct test_fiu_U_data
207 const char *arg_str;
208 FLOAT arg1;
209 int arg2;
210 unsigned int arg3;
211 struct
213 uintmax_t expected;
214 int exceptions;
215 } rd, rn, rz, ru;
217 struct test_c_f_data
219 const char *arg_str;
220 FLOAT argr, argc;
221 struct
223 FLOAT expected;
224 int exceptions;
225 } rd, rn, rz, ru;
227 /* Used for both RUN_TEST_LOOP_f_f1 and RUN_TEST_LOOP_fI_f1. */
228 struct test_f_f1_data
230 const char *arg_str;
231 FLOAT arg;
232 struct
234 FLOAT expected;
235 int exceptions;
236 int extra_test;
237 int extra_expected;
238 } rd, rn, rz, ru;
240 struct test_fF_f1_data
242 const char *arg_str;
243 FLOAT arg;
244 struct
246 FLOAT expected;
247 int exceptions;
248 int extra_test;
249 FLOAT extra_expected;
250 } rd, rn, rz, ru;
252 struct test_ffI_f1_data
254 const char *arg_str;
255 FLOAT arg1, arg2;
256 struct
258 FLOAT expected;
259 int exceptions;
260 int extra_test;
261 int extra_expected;
262 } rd, rn, rz, ru;
264 struct test_c_c_data
266 const char *arg_str;
267 FLOAT argr, argc;
268 struct
270 FLOAT expr, expc;
271 int exceptions;
272 } rd, rn, rz, ru;
274 struct test_cc_c_data
276 const char *arg_str;
277 FLOAT arg1r, arg1c, arg2r, arg2c;
278 struct
280 FLOAT expr, expc;
281 int exceptions;
282 } rd, rn, rz, ru;
284 /* Used for all of RUN_TEST_LOOP_f_i, RUN_TEST_LOOP_f_i_tg,
285 RUN_TEST_LOOP_f_b and RUN_TEST_LOOP_f_b_tg. */
286 struct test_f_i_data
288 const char *arg_str;
289 FLOAT arg;
290 struct
292 int expected;
293 int exceptions;
294 } rd, rn, rz, ru;
296 /* Used for both RUN_TEST_LOOP_ff_b and RUN_TEST_LOOP_ff_i_tg. */
297 struct test_ff_i_data
299 const char *arg_str;
300 FLOAT arg1, arg2;
301 struct
303 int expected;
304 int exceptions;
305 } rd, rn, rz, ru;
307 struct test_f_l_data
309 const char *arg_str;
310 FLOAT arg;
311 struct
313 long int expected;
314 int exceptions;
315 } rd, rn, rz, ru;
317 struct test_f_L_data
319 const char *arg_str;
320 FLOAT arg;
321 struct
323 long long int expected;
324 int exceptions;
325 } rd, rn, rz, ru;
327 struct test_fFF_11_data
329 const char *arg_str;
330 FLOAT arg;
331 struct
333 int exceptions;
334 int extra1_test;
335 FLOAT extra1_expected;
336 int extra2_test;
337 FLOAT extra2_expected;
338 } rd, rn, rz, ru;
340 /* Used for both RUN_TEST_LOOP_Ff_b1 and RUN_TEST_LOOP_Ffp_b1. */
341 struct test_Ff_b1_data
343 const char *arg_str;
344 FLOAT arg;
345 struct
347 int expected;
348 int exceptions;
349 int extra_test;
350 FLOAT extra_expected;
351 } rd, rn, rz, ru;
354 /* Set the rounding mode, or restore the saved value. */
355 #define IF_ROUND_INIT_ /* Empty. */
356 #define IF_ROUND_INIT_FE_DOWNWARD \
357 int save_round_mode = fegetround (); \
358 if (ROUNDING_TESTS (FLOAT, FE_DOWNWARD) \
359 && fesetround (FE_DOWNWARD) == 0)
360 #define IF_ROUND_INIT_FE_TONEAREST \
361 int save_round_mode = fegetround (); \
362 if (ROUNDING_TESTS (FLOAT, FE_TONEAREST) \
363 && fesetround (FE_TONEAREST) == 0)
364 #define IF_ROUND_INIT_FE_TOWARDZERO \
365 int save_round_mode = fegetround (); \
366 if (ROUNDING_TESTS (FLOAT, FE_TOWARDZERO) \
367 && fesetround (FE_TOWARDZERO) == 0)
368 #define IF_ROUND_INIT_FE_UPWARD \
369 int save_round_mode = fegetround (); \
370 if (ROUNDING_TESTS (FLOAT, FE_UPWARD) \
371 && fesetround (FE_UPWARD) == 0)
372 #define ROUND_RESTORE_ /* Empty. */
373 #define ROUND_RESTORE_FE_DOWNWARD \
374 fesetround (save_round_mode)
375 #define ROUND_RESTORE_FE_TONEAREST \
376 fesetround (save_round_mode)
377 #define ROUND_RESTORE_FE_TOWARDZERO \
378 fesetround (save_round_mode)
379 #define ROUND_RESTORE_FE_UPWARD \
380 fesetround (save_round_mode)
382 /* Field name to use for a given rounding mode. */
383 #define RM_ rn
384 #define RM_FE_DOWNWARD rd
385 #define RM_FE_TONEAREST rn
386 #define RM_FE_TOWARDZERO rz
387 #define RM_FE_UPWARD ru
389 /* Common setup for an individual test. */
390 #define COMMON_TEST_SETUP(ARG_STR) \
391 char *test_name; \
392 if (asprintf (&test_name, "%s (%s)", this_func, (ARG_STR)) == -1) \
393 abort ()
395 /* Setup for a test with an extra output. */
396 #define EXTRA_OUTPUT_TEST_SETUP(ARG_STR, N) \
397 char *extra##N##_name; \
398 if (asprintf (&extra##N##_name, "%s (%s) extra output " #N, \
399 this_func, (ARG_STR)) == -1) \
400 abort ()
402 /* Common cleanup after an individual test. */
403 #define COMMON_TEST_CLEANUP \
404 free (test_name)
406 /* Cleanup for a test with an extra output. */
407 #define EXTRA_OUTPUT_TEST_CLEANUP(N) \
408 free (extra##N##_name)
410 /* Run an individual test, including any required setup and checking
411 of results, or loop over all tests in an array. */
412 #define RUN_TEST_f_f(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
413 EXCEPTIONS) \
414 do \
415 if (enable_test (EXCEPTIONS)) \
417 COMMON_TEST_SETUP (ARG_STR); \
418 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG), \
419 EXPECTED, EXCEPTIONS); \
420 COMMON_TEST_CLEANUP; \
422 while (0)
423 #define RUN_TEST_LOOP_f_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \
424 IF_ROUND_INIT_ ## ROUNDING_MODE \
425 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
426 RUN_TEST_f_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
427 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
428 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
429 ROUND_RESTORE_ ## ROUNDING_MODE
430 #define RUN_TEST_fp_f(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
431 EXCEPTIONS) \
432 do \
433 if (enable_test (EXCEPTIONS)) \
435 COMMON_TEST_SETUP (ARG_STR); \
436 check_float (test_name, FUNC_TEST (FUNC_NAME) (&(ARG)), \
437 EXPECTED, EXCEPTIONS); \
438 COMMON_TEST_CLEANUP; \
440 while (0)
441 #define RUN_TEST_LOOP_fp_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \
442 IF_ROUND_INIT_ ## ROUNDING_MODE \
443 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
444 RUN_TEST_fp_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
445 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
446 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
447 ROUND_RESTORE_ ## ROUNDING_MODE
448 #define RUN_TEST_2_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \
449 EXCEPTIONS) \
450 do \
451 if (enable_test (EXCEPTIONS)) \
453 COMMON_TEST_SETUP (ARG_STR); \
454 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG1, ARG2), \
455 EXPECTED, EXCEPTIONS); \
456 COMMON_TEST_CLEANUP; \
458 while (0)
459 #define RUN_TEST_LOOP_2_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \
460 IF_ROUND_INIT_ ## ROUNDING_MODE \
461 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
462 RUN_TEST_2_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \
463 (ARRAY)[i].arg2, \
464 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
465 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
466 ROUND_RESTORE_ ## ROUNDING_MODE
467 #define RUN_TEST_ff_f RUN_TEST_2_f
468 #define RUN_TEST_LOOP_ff_f RUN_TEST_LOOP_2_f
469 #define RUN_TEST_LOOP_fj_f RUN_TEST_LOOP_2_f
470 #define RUN_TEST_fi_f RUN_TEST_2_f
471 #define RUN_TEST_LOOP_fi_f RUN_TEST_LOOP_2_f
472 #define RUN_TEST_fl_f RUN_TEST_2_f
473 #define RUN_TEST_LOOP_fl_f RUN_TEST_LOOP_2_f
474 #define RUN_TEST_if_f RUN_TEST_2_f
475 #define RUN_TEST_LOOP_if_f RUN_TEST_LOOP_2_f
476 #define RUN_TEST_fff_f(ARG_STR, FUNC_NAME, ARG1, ARG2, ARG3, \
477 EXPECTED, EXCEPTIONS) \
478 do \
479 if (enable_test (EXCEPTIONS)) \
481 COMMON_TEST_SETUP (ARG_STR); \
482 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG1, ARG2, ARG3), \
483 EXPECTED, EXCEPTIONS); \
484 COMMON_TEST_CLEANUP; \
486 while (0)
487 #define RUN_TEST_LOOP_fff_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \
488 IF_ROUND_INIT_ ## ROUNDING_MODE \
489 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
490 RUN_TEST_fff_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \
491 (ARRAY)[i].arg2, (ARRAY)[i].arg3, \
492 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
493 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
494 ROUND_RESTORE_ ## ROUNDING_MODE
495 #define RUN_TEST_fiu_M(ARG_STR, FUNC_NAME, ARG1, ARG2, ARG3, \
496 EXPECTED, EXCEPTIONS) \
497 do \
498 if (enable_test (EXCEPTIONS)) \
500 COMMON_TEST_SETUP (ARG_STR); \
501 check_intmax_t (test_name, \
502 FUNC_TEST (FUNC_NAME) (ARG1, ARG2, ARG3), \
503 EXPECTED, EXCEPTIONS); \
504 COMMON_TEST_CLEANUP; \
506 while (0)
507 #define RUN_TEST_LOOP_fiu_M(FUNC_NAME, ARRAY, ROUNDING_MODE) \
508 IF_ROUND_INIT_ ## ROUNDING_MODE \
509 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
510 RUN_TEST_fiu_M ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \
511 (ARRAY)[i].arg2, (ARRAY)[i].arg3, \
512 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
513 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
514 ROUND_RESTORE_ ## ROUNDING_MODE
515 #define RUN_TEST_fiu_U(ARG_STR, FUNC_NAME, ARG1, ARG2, ARG3, \
516 EXPECTED, EXCEPTIONS) \
517 do \
518 if (enable_test (EXCEPTIONS)) \
520 COMMON_TEST_SETUP (ARG_STR); \
521 check_uintmax_t (test_name, \
522 FUNC_TEST (FUNC_NAME) (ARG1, ARG2, ARG3), \
523 EXPECTED, EXCEPTIONS); \
524 COMMON_TEST_CLEANUP; \
526 while (0)
527 #define RUN_TEST_LOOP_fiu_U(FUNC_NAME, ARRAY, ROUNDING_MODE) \
528 IF_ROUND_INIT_ ## ROUNDING_MODE \
529 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
530 RUN_TEST_fiu_U ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \
531 (ARRAY)[i].arg2, (ARRAY)[i].arg3, \
532 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
533 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
534 ROUND_RESTORE_ ## ROUNDING_MODE
535 #define RUN_TEST_c_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \
536 EXCEPTIONS) \
537 do \
538 if (enable_test (EXCEPTIONS)) \
540 COMMON_TEST_SETUP (ARG_STR); \
541 check_float (test_name, \
542 FUNC_TEST (FUNC_NAME) (BUILD_COMPLEX (ARG1, ARG2)),\
543 EXPECTED, EXCEPTIONS); \
544 COMMON_TEST_CLEANUP; \
546 while (0)
547 #define RUN_TEST_LOOP_c_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \
548 IF_ROUND_INIT_ ## ROUNDING_MODE \
549 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
550 RUN_TEST_c_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr, \
551 (ARRAY)[i].argc, \
552 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
553 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
554 ROUND_RESTORE_ ## ROUNDING_MODE
555 #define RUN_TEST_f_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
556 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
557 EXTRA_EXPECTED) \
558 do \
559 if (enable_test (EXCEPTIONS)) \
561 COMMON_TEST_SETUP (ARG_STR); \
562 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
563 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG), EXPECTED, \
564 EXCEPTIONS); \
565 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
566 if (EXTRA_TEST) \
567 check_int (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \
568 EXTRA_OUTPUT_TEST_CLEANUP (1); \
569 COMMON_TEST_CLEANUP; \
571 while (0)
572 #define RUN_TEST_LOOP_f_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \
573 IF_ROUND_INIT_ ## ROUNDING_MODE \
574 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
575 RUN_TEST_f_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
576 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
577 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
578 EXTRA_VAR, \
579 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
580 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
581 ROUND_RESTORE_ ## ROUNDING_MODE
582 #define RUN_TEST_fF_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
583 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
584 EXTRA_EXPECTED) \
585 do \
586 if (enable_test (EXCEPTIONS)) \
588 COMMON_TEST_SETUP (ARG_STR); \
589 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
590 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG, &(EXTRA_VAR)), \
591 EXPECTED, EXCEPTIONS); \
592 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
593 if (EXTRA_TEST) \
594 check_float (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \
595 EXTRA_OUTPUT_TEST_CLEANUP (1); \
596 COMMON_TEST_CLEANUP; \
598 while (0)
599 #define RUN_TEST_LOOP_fF_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \
600 IF_ROUND_INIT_ ## ROUNDING_MODE \
601 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
602 RUN_TEST_fF_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
603 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
604 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
605 EXTRA_VAR, \
606 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
607 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
608 ROUND_RESTORE_ ## ROUNDING_MODE
609 #define RUN_TEST_fI_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
610 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
611 EXTRA_EXPECTED) \
612 do \
613 if (enable_test (EXCEPTIONS)) \
615 COMMON_TEST_SETUP (ARG_STR); \
616 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
617 check_float (test_name, FUNC_TEST (FUNC_NAME) (ARG, &(EXTRA_VAR)), \
618 EXPECTED, EXCEPTIONS); \
619 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
620 if (EXTRA_TEST) \
621 check_int (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \
622 EXTRA_OUTPUT_TEST_CLEANUP (1); \
623 COMMON_TEST_CLEANUP; \
625 while (0)
626 #define RUN_TEST_LOOP_fI_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \
627 IF_ROUND_INIT_ ## ROUNDING_MODE \
628 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
629 RUN_TEST_fI_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
630 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
631 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
632 EXTRA_VAR, \
633 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
634 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
635 ROUND_RESTORE_ ## ROUNDING_MODE
636 #define RUN_TEST_ffI_f1_mod8(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \
637 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
638 EXTRA_EXPECTED) \
639 do \
640 if (enable_test (EXCEPTIONS)) \
642 COMMON_TEST_SETUP (ARG_STR); \
643 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
644 check_float (test_name, \
645 FUNC_TEST (FUNC_NAME) (ARG1, ARG2, &(EXTRA_VAR)), \
646 EXPECTED, EXCEPTIONS); \
647 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
648 if (EXTRA_TEST) \
649 check_int (extra1_name, (EXTRA_VAR) % 8, EXTRA_EXPECTED, 0); \
650 EXTRA_OUTPUT_TEST_CLEANUP (1); \
651 COMMON_TEST_CLEANUP; \
653 while (0)
654 #define RUN_TEST_LOOP_ffI_f1_mod8(FUNC_NAME, ARRAY, ROUNDING_MODE, \
655 EXTRA_VAR) \
656 IF_ROUND_INIT_ ## ROUNDING_MODE \
657 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
658 RUN_TEST_ffI_f1_mod8 ((ARRAY)[i].arg_str, FUNC_NAME, \
659 (ARRAY)[i].arg1, (ARRAY)[i].arg2, \
660 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
661 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
662 EXTRA_VAR, \
663 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
664 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
665 ROUND_RESTORE_ ## ROUNDING_MODE
666 #define RUN_TEST_Ff_b1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
667 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
668 EXTRA_EXPECTED) \
669 do \
670 if (enable_test (EXCEPTIONS)) \
672 COMMON_TEST_SETUP (ARG_STR); \
673 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
674 /* Clear any exceptions from comparison involving sNaN \
675 EXTRA_EXPECTED. */ \
676 feclearexcept (FE_ALL_EXCEPT); \
677 check_bool (test_name, FUNC_TEST (FUNC_NAME) (&(EXTRA_VAR), \
678 (ARG)), \
679 EXPECTED, EXCEPTIONS); \
680 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
681 if (EXTRA_TEST) \
682 check_float (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, \
683 (EXCEPTIONS) & TEST_NAN_PAYLOAD); \
684 EXTRA_OUTPUT_TEST_CLEANUP (1); \
685 COMMON_TEST_CLEANUP; \
687 while (0)
688 #define RUN_TEST_LOOP_Ff_b1(FUNC_NAME, ARRAY, ROUNDING_MODE, \
689 EXTRA_VAR) \
690 IF_ROUND_INIT_ ## ROUNDING_MODE \
691 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
692 RUN_TEST_Ff_b1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
693 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
694 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
695 EXTRA_VAR, \
696 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
697 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
698 ROUND_RESTORE_ ## ROUNDING_MODE
699 #define RUN_TEST_Ffp_b1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
700 EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \
701 EXTRA_EXPECTED) \
702 do \
703 if (enable_test (EXCEPTIONS)) \
705 COMMON_TEST_SETUP (ARG_STR); \
706 (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \
707 check_bool (test_name, FUNC_TEST (FUNC_NAME) (&(EXTRA_VAR), \
708 &(ARG)), \
709 EXPECTED, EXCEPTIONS); \
710 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
711 if (EXTRA_TEST) \
712 check_float (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, \
713 (EXCEPTIONS) & TEST_NAN_PAYLOAD); \
714 EXTRA_OUTPUT_TEST_CLEANUP (1); \
715 COMMON_TEST_CLEANUP; \
717 while (0)
718 #define RUN_TEST_LOOP_Ffp_b1(FUNC_NAME, ARRAY, ROUNDING_MODE, \
719 EXTRA_VAR) \
720 IF_ROUND_INIT_ ## ROUNDING_MODE \
721 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
722 RUN_TEST_Ffp_b1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
723 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
724 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
725 EXTRA_VAR, \
726 (ARRAY)[i].RM_##ROUNDING_MODE.extra_test, \
727 (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
728 ROUND_RESTORE_ ## ROUNDING_MODE
729 #define RUN_TEST_c_c(ARG_STR, FUNC_NAME, ARGR, ARGC, EXPR, EXPC, \
730 EXCEPTIONS) \
731 do \
732 if (enable_test (EXCEPTIONS)) \
734 COMMON_TEST_SETUP (ARG_STR); \
735 check_complex (test_name, \
736 FUNC_TEST (FUNC_NAME) (BUILD_COMPLEX (ARGR, ARGC)), \
737 BUILD_COMPLEX (EXPR, EXPC), EXCEPTIONS); \
738 COMMON_TEST_CLEANUP; \
740 while (0)
741 #define RUN_TEST_LOOP_c_c(FUNC_NAME, ARRAY, ROUNDING_MODE) \
742 IF_ROUND_INIT_ ## ROUNDING_MODE \
743 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
744 RUN_TEST_c_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr, \
745 (ARRAY)[i].argc, \
746 (ARRAY)[i].RM_##ROUNDING_MODE.expr, \
747 (ARRAY)[i].RM_##ROUNDING_MODE.expc, \
748 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
749 ROUND_RESTORE_ ## ROUNDING_MODE
750 #define RUN_TEST_cc_c(ARG_STR, FUNC_NAME, ARG1R, ARG1C, ARG2R, ARG2C, \
751 EXPR, EXPC, EXCEPTIONS) \
752 do \
753 if (enable_test (EXCEPTIONS)) \
755 COMMON_TEST_SETUP (ARG_STR); \
756 check_complex (test_name, \
757 FUNC_TEST (FUNC_NAME) (BUILD_COMPLEX (ARG1R, ARG1C), \
758 BUILD_COMPLEX (ARG2R, ARG2C)), \
759 BUILD_COMPLEX (EXPR, EXPC), EXCEPTIONS); \
760 COMMON_TEST_CLEANUP; \
762 while (0)
763 #define RUN_TEST_LOOP_cc_c(FUNC_NAME, ARRAY, ROUNDING_MODE) \
764 IF_ROUND_INIT_ ## ROUNDING_MODE \
765 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
766 RUN_TEST_cc_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1r, \
767 (ARRAY)[i].arg1c, (ARRAY)[i].arg2r, \
768 (ARRAY)[i].arg2c, \
769 (ARRAY)[i].RM_##ROUNDING_MODE.expr, \
770 (ARRAY)[i].RM_##ROUNDING_MODE.expc, \
771 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
772 ROUND_RESTORE_ ## ROUNDING_MODE
773 #define RUN_TEST_f_i(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \
774 do \
775 if (enable_test (EXCEPTIONS)) \
777 COMMON_TEST_SETUP (ARG_STR); \
778 check_int (test_name, FUNC_TEST (FUNC_NAME) (ARG), EXPECTED, \
779 EXCEPTIONS); \
780 COMMON_TEST_CLEANUP; \
782 while (0)
783 #define RUN_TEST_LOOP_f_i(FUNC_NAME, ARRAY, ROUNDING_MODE) \
784 IF_ROUND_INIT_ ## ROUNDING_MODE \
785 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
786 RUN_TEST_f_i ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
787 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
788 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
789 ROUND_RESTORE_ ## ROUNDING_MODE
790 #define RUN_TEST_f_i_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
791 EXCEPTIONS) \
792 do \
793 if (enable_test (EXCEPTIONS)) \
795 COMMON_TEST_SETUP (ARG_STR); \
796 check_int (test_name, FUNC_NAME (ARG), EXPECTED, EXCEPTIONS); \
797 COMMON_TEST_CLEANUP; \
799 while (0)
800 #define RUN_TEST_LOOP_f_i_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \
801 IF_ROUND_INIT_ ## ROUNDING_MODE \
802 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
803 RUN_TEST_f_i_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
804 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
805 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
806 ROUND_RESTORE_ ## ROUNDING_MODE
807 #define RUN_TEST_ff_b(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \
808 EXCEPTIONS) \
809 do \
810 if (enable_test (EXCEPTIONS)) \
812 COMMON_TEST_SETUP (ARG_STR); \
813 check_bool (test_name, FUNC_TEST (FUNC_NAME) (ARG1, ARG2), \
814 EXPECTED, EXCEPTIONS); \
815 COMMON_TEST_CLEANUP; \
817 while (0)
818 #define RUN_TEST_LOOP_ff_b(FUNC_NAME, ARRAY, ROUNDING_MODE) \
819 IF_ROUND_INIT_ ## ROUNDING_MODE \
820 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
821 RUN_TEST_ff_b ((ARRAY)[i].arg_str, FUNC_NAME, \
822 (ARRAY)[i].arg1, (ARRAY)[i].arg2, \
823 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
824 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
825 ROUND_RESTORE_ ## ROUNDING_MODE
826 #define RUN_TEST_ff_i_tg(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \
827 EXCEPTIONS) \
828 do \
829 if (enable_test (EXCEPTIONS)) \
831 COMMON_TEST_SETUP (ARG_STR); \
832 check_int (test_name, FUNC_NAME (ARG1, ARG2), EXPECTED, \
833 EXCEPTIONS); \
834 COMMON_TEST_CLEANUP; \
836 while (0)
837 #define RUN_TEST_LOOP_ff_i_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \
838 IF_ROUND_INIT_ ## ROUNDING_MODE \
839 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
840 RUN_TEST_ff_i_tg ((ARRAY)[i].arg_str, FUNC_NAME, \
841 (ARRAY)[i].arg1, (ARRAY)[i].arg2, \
842 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
843 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
844 ROUND_RESTORE_ ## ROUNDING_MODE
845 #define RUN_TEST_f_b(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \
846 do \
847 if (enable_test (EXCEPTIONS)) \
849 COMMON_TEST_SETUP (ARG_STR); \
850 check_bool (test_name, FUNC_TEST (FUNC_NAME) (ARG), EXPECTED, \
851 EXCEPTIONS); \
852 COMMON_TEST_CLEANUP; \
854 while (0)
855 #define RUN_TEST_LOOP_f_b(FUNC_NAME, ARRAY, ROUNDING_MODE) \
856 IF_ROUND_INIT_ ## ROUNDING_MODE \
857 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
858 RUN_TEST_f_b ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
859 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
860 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
861 ROUND_RESTORE_ ## ROUNDING_MODE
862 #define RUN_TEST_f_b_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED, \
863 EXCEPTIONS) \
864 do \
865 if (enable_test (EXCEPTIONS)) \
867 COMMON_TEST_SETUP (ARG_STR); \
868 check_bool (test_name, FUNC_NAME (ARG), EXPECTED, EXCEPTIONS); \
869 COMMON_TEST_CLEANUP; \
871 while (0)
872 #define RUN_TEST_LOOP_f_b_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \
873 IF_ROUND_INIT_ ## ROUNDING_MODE \
874 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
875 RUN_TEST_f_b_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
876 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
877 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
878 ROUND_RESTORE_ ## ROUNDING_MODE
879 #define RUN_TEST_f_l(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \
880 do \
881 if (enable_test (EXCEPTIONS)) \
883 COMMON_TEST_SETUP (ARG_STR); \
884 check_long (test_name, FUNC_TEST (FUNC_NAME) (ARG), EXPECTED, \
885 EXCEPTIONS); \
886 COMMON_TEST_CLEANUP; \
888 while (0)
889 #define RUN_TEST_LOOP_f_l(FUNC_NAME, ARRAY, ROUNDING_MODE) \
890 IF_ROUND_INIT_ ## ROUNDING_MODE \
891 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
892 RUN_TEST_f_l ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
893 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
894 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
895 ROUND_RESTORE_ ## ROUNDING_MODE
896 #define RUN_TEST_f_L(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \
897 do \
898 if (enable_test (EXCEPTIONS)) \
900 COMMON_TEST_SETUP (ARG_STR); \
901 check_longlong (test_name, FUNC_TEST (FUNC_NAME) (ARG), \
902 EXPECTED, EXCEPTIONS); \
903 COMMON_TEST_CLEANUP; \
905 while (0)
906 #define RUN_TEST_LOOP_f_L(FUNC_NAME, ARRAY, ROUNDING_MODE) \
907 IF_ROUND_INIT_ ## ROUNDING_MODE \
908 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
909 RUN_TEST_f_L ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
910 (ARRAY)[i].RM_##ROUNDING_MODE.expected, \
911 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions); \
912 ROUND_RESTORE_ ## ROUNDING_MODE
913 #define RUN_TEST_fFF_11(ARG_STR, FUNC_NAME, ARG, EXCEPTIONS, \
914 EXTRA1_VAR, EXTRA1_TEST, \
915 EXTRA1_EXPECTED, EXTRA2_VAR, \
916 EXTRA2_TEST, EXTRA2_EXPECTED) \
917 do \
918 if (enable_test (EXCEPTIONS)) \
920 COMMON_TEST_SETUP (ARG_STR); \
921 FUNC_TEST (FUNC_NAME) (ARG, &(EXTRA1_VAR), &(EXTRA2_VAR)); \
922 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \
923 if (EXTRA1_TEST) \
924 check_float (extra1_name, EXTRA1_VAR, EXTRA1_EXPECTED, \
925 EXCEPTIONS); \
926 EXTRA_OUTPUT_TEST_CLEANUP (1); \
927 EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 2); \
928 if (EXTRA2_TEST) \
929 check_float (extra2_name, EXTRA2_VAR, EXTRA2_EXPECTED, 0); \
930 EXTRA_OUTPUT_TEST_CLEANUP (2); \
931 COMMON_TEST_CLEANUP; \
933 while (0)
934 #define RUN_TEST_LOOP_fFF_11(FUNC_NAME, ARRAY, ROUNDING_MODE, \
935 EXTRA1_VAR, EXTRA2_VAR) \
936 IF_ROUND_INIT_ ## ROUNDING_MODE \
937 for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
938 RUN_TEST_fFF_11 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \
939 (ARRAY)[i].RM_##ROUNDING_MODE.exceptions, \
940 EXTRA1_VAR, \
941 (ARRAY)[i].RM_##ROUNDING_MODE.extra1_test, \
942 (ARRAY)[i].RM_##ROUNDING_MODE.extra1_expected, \
943 EXTRA2_VAR, \
944 (ARRAY)[i].RM_##ROUNDING_MODE.extra2_test, \
945 (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected); \
946 ROUND_RESTORE_ ## ROUNDING_MODE
948 #if !TEST_MATHVEC
949 # define VEC_SUFF
950 #endif
952 #define STR_CONCAT(a, b, c) __STRING (a##b##c)
953 #define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
955 /* Start and end the tests for a given function. */
956 #define START(FUN, SUFF, EXACT) \
957 CHECK_ARCH_EXT; \
958 const char *this_func = STR_CON3 (FUN, SUFF, VEC_SUFF); \
959 init_max_error (this_func, EXACT)
960 #define END \
961 print_max_error (this_func)
962 #define END_COMPLEX \
963 print_complex_max_error (this_func)
965 /* Run tests for a given function in all rounding modes. */
966 #define ALL_RM_TEST(FUNC, EXACT, ARRAY, LOOP_MACRO, END_MACRO, ...) \
967 do \
969 do \
971 START (FUNC,, EXACT); \
972 LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__); \
973 END_MACRO; \
975 while (0); \
976 do \
978 START (FUNC, _downward, EXACT); \
979 LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__); \
980 END_MACRO; \
982 while (0); \
983 do \
985 START (FUNC, _towardzero, EXACT); \
986 LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__); \
987 END_MACRO; \
989 while (0); \
990 do \
992 START (FUNC, _upward, EXACT); \
993 LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__); \
994 END_MACRO; \
996 while (0); \
998 while (0);
1000 /* Short description of program. */
1001 const char doc[] = "Math test suite: " TEST_MSG ;
1003 static void do_test (void);
1006 main (int argc, char **argv)
1008 libm_test_init (argc, argv);
1009 INIT_ARCH_EXT;
1010 do_test ();
1011 return libm_test_finish ();