1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 Part of testsuite for libm.
24 This file has to be included by a master file that defines:
27 FUNC(function): converts general function name (like cos) to
28 name with correct suffix (e.g. cosl or cosf)
29 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
30 MATHTYPE: floating point type to test
31 TEST_MSG: informal message to be displayed
32 CHOOSE(Clongdouble,Cdouble,Cfloat):
33 chooses one of the parameters as epsilon for testing
35 PRINTF_EXPR Floating point conversion specification to print a variable
36 of type MATHTYPE with printf. PRINTF_EXPR just contains
37 the specifier, not the percent and width arguments,
41 /* This program isn't finished yet.
43 acos, acosh, asin, asinh, atan, atan2, atanh,
44 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
45 fabs, fdim, floor, fmin, fmax, fmod, fpclassify,
47 ilogb, isfinite, isinf, isnan, isnormal,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, lrint, llrint,
51 round, lround, llround,
52 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
54 and for the following complex math functions:
55 cacos, cacosh, casin, casinh, catan, catanh,
56 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctanh.
58 At the moment the following functions aren't tested:
59 cabs, carg, conj, cproj, cimag, creal, ctan, drem,
60 j0, j1, jn, y0, y1, yn,
62 nan, comparison macros (isless,isgreater,...).
64 The routines using random variables are still under construction. I don't
65 like it the way it's working now and will change it.
67 Parameter handling is primitive in the moment:
68 --verbose=[0..4] for different levels of output:
70 1: basic report on failed tests (default)
71 2: full report on failed tests
72 3: full report on failed and passed tests
73 4: additional report on exceptions
74 -v for full output (equals --verbose=4)
75 -s,--silent outputs only the error count (equals --verbose=0)
80 This suite tests the correct implementation of mathematical
81 functions in libm. Some simple, specific parameters are tested for
82 correctness. Handling of specific inputs (e.g. infinity,
83 not-a-number) is also tested. Correct handling of exceptions is
84 checked against. These implemented tests should check all cases
85 that are specified in ISO C 9X.
87 Exception testing: At the moment only divide-by-zero and invalid
88 exceptions are tested. Overflow/underflow and inexact exceptions
89 aren't checked at the moment.
91 NaN values: There exist signalling and quiet NaNs. This implementation
92 only uses signalling NaN as parameter but does not differenciate
93 between the two kinds of NaNs as result.
95 Inline functions: Inlining functions should give an improvement in
96 speed - but not in precission. The inlined functions return
97 reasonable values for a reasonable range of input values. The
98 result is not necessarily correct for all values and exceptions are
99 not correctly raised in all cases. Problematic input and return
100 values are infinity, not-a-number and minus zero. This suite
101 therefore does not check these specific inputs and the exception
102 handling for inlined mathematical functions - just the "reasonable"
105 Beware: The tests might fail for any of the following reasons:
107 - Functions are wrong
108 - Floating Point Unit not working properly
109 - Compiler has errors
111 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
129 /* Possible exceptions */
130 #define NO_EXCEPTION 0x0
131 #define INVALID_EXCEPTION 0x1
132 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
137 /* Various constants (we must supply them precalculated for accuracy). */
138 #define M_PI_6 .52359877559829887308L
142 static int verbose = 3;
143 static MATHTYPE minus_zero, plus_zero;
144 static MATHTYPE plus_infty, minus_infty, nan_value;
146 typedef MATHTYPE (*mathfunc) (MATHTYPE);
148 #define BUILD_COMPLEX(real, imag) \
149 ({ __complex__ MATHTYPE __retval; \
150 __real__ __retval = (real); \
151 __imag__ __retval = (imag); \
156 (sizeof (x) == sizeof (float) ? \
158 : sizeof (x) == sizeof (double) ? \
159 isinf (x) : isinfl (x))
163 Test if Floating-Point stack hasn't changed
166 fpstack_test (const char *test_name)
169 static int old_stack;
171 asm ("fnstsw":"=a" (sw));
176 printf ("FP-Stack wrong after test %s\n", test_name);
178 printf ("=======> stack = %d\n", sw);
187 Get a random value x with min_value < x < max_value
188 and min_value, max_value finite,
189 max_value and min_value shouldn't be too close together
192 random_value (MATHTYPE min_value, MATHTYPE max_value)
199 x = (max_value - min_value) / RAND_MAX * (MATHTYPE) r + min_value;
201 if ((x <= min_value) || (x >= max_value) || !isfinite (x))
202 x = (max_value - min_value) / 2 + min_value;
204 /* Make sure the RNG has no influence on the exceptions. */
205 feclearexcept (FE_ALL_EXCEPT);
210 /* Get a random value x with x > min_value. */
212 random_greater (MATHTYPE min_value)
214 return random_value (min_value, 1e6); /* CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX) */
217 /* Get a random value x with x < max_value. */
219 random_less (MATHTYPE max_value)
221 return random_value (-1e6, max_value);
226 output_new_test (const char *test_name)
229 printf ("\nTesting: %s\n", test_name);
234 output_pass_value (void)
237 printf ("Pass: Value Ok.\n");
242 output_fail_value (const char * test_name)
244 if (verbose > 0 && verbose < 3)
245 printf ("Fail: %s\n", test_name);
251 /* Test whether a given exception was raised. */
253 test_single_exception (const char *test_name,
257 const char *flag_name)
260 if (exception & exc_flag)
262 if (fetestexcept (fe_flag))
265 printf ("Pass: Exception \"%s\" set\n", flag_name);
269 if (verbose && verbose < 3)
270 printf ("Fail: %s: Exception \"%s\" not set\n",
271 test_name, flag_name);
273 printf ("Fail: Exception \"%s\" not set\n",
280 if (fetestexcept (fe_flag))
282 if (verbose && verbose < 3)
283 printf ("Fail: %s: Exception \"%s\" set\n",
284 test_name, flag_name);
286 printf ("Fail: Exception \"%s\" set\n",
293 printf ("Pass: Exception \"%s\" not set\n",
301 /* Test whether exception given by EXCEPTION are raised. */
303 test_not_exception (const char *test_name, short int exception)
306 if ((exception & DIVIDE_BY_ZERO_EXCEPTION) == 0)
307 test_single_exception (test_name, exception,
308 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
312 if ((exception & INVALID_EXCEPTION) == 0)
313 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
314 "Invalid operation");
316 feclearexcept (FE_ALL_EXCEPT);
320 /* Test whether exceptions given by EXCEPTION are raised. */
322 test_exceptions (const char *test_name, short int exception)
325 test_single_exception (test_name, exception,
326 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
330 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
331 "Invalid operation");
333 feclearexcept (FE_ALL_EXCEPT);
337 /* Test if two floating point numbers are equal. */
339 check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff)
343 /* Both plus Infinity or both minus infinity. */
344 if (ISINF (computed) && (ISINF (computed) == ISINF (supplied)))
347 if (isnan (computed) && isnan (supplied)) /* isnan works for all types */
350 *diff = FUNC(fabs) (computed - supplied);
353 ret_value = (*diff <= eps &&
354 (signbit (computed) == signbit (supplied) || eps != 0.0));
356 /* Make sure the subtraction/comparsion have no influence on the exceptions. */
357 feclearexcept (FE_ALL_EXCEPT);
365 output_result_bool (const char *test_name, int result)
369 output_pass_value ();
373 output_fail_value (test_name);
375 printf (" Value: %d\n", result);
379 fpstack_test (test_name);
384 output_isvalue (const char *test_name, int result,
389 output_pass_value ();
393 output_fail_value (test_name);
395 printf (" Value: %.20" PRINTF_EXPR "\n", value);
399 fpstack_test (test_name);
404 output_isvalue_ext (const char *test_name, int result,
405 MATHTYPE value, MATHTYPE parameter)
409 output_pass_value ();
413 output_fail_value (test_name);
416 printf (" Value: %.20" PRINTF_EXPR "\n", value);
417 printf (" Parameter: %.20" PRINTF_EXPR "\n", parameter);
422 fpstack_test (test_name);
427 output_result (const char *test_name, int result,
428 MATHTYPE computed, MATHTYPE expected,
430 int print_values, int print_diff)
434 output_pass_value ();
438 output_fail_value (test_name);
439 if (verbose > 1 && print_values)
441 printf ("Result:\n");
442 printf (" is: %.20" PRINTF_EXPR "\n", computed);
443 printf (" should be: %.20" PRINTF_EXPR "\n", expected);
445 printf (" difference: %.20" PRINTF_EXPR "\n", difference);
450 fpstack_test (test_name);
455 output_result_ext (const char *test_name, int result,
456 MATHTYPE computed, MATHTYPE expected,
459 int print_values, int print_diff)
463 output_pass_value ();
467 output_fail_value (test_name);
468 if (verbose > 1 && print_values)
470 printf ("Result:\n");
471 printf (" is: %.20" PRINTF_EXPR "\n", computed);
472 printf (" should be: %.20" PRINTF_EXPR "\n", expected);
474 printf (" difference: %.20" PRINTF_EXPR "\n", difference);
475 printf ("Parameter: %.20" PRINTF_EXPR "\n", parameter);
480 fpstack_test (test_name);
484 check that computed and expected values are the same
487 check (const char *test_name, MATHTYPE computed, MATHTYPE expected)
492 output_new_test (test_name);
493 test_exceptions (test_name, NO_EXCEPTION);
494 result = check_equal (computed, expected, 0, &diff);
495 output_result (test_name, result,
496 computed, expected, diff, PRINT, PRINT);
501 check that computed and expected values are the same,
502 outputs the parameter to the function
505 check_ext (const char *test_name, MATHTYPE computed, MATHTYPE expected,
511 output_new_test (test_name);
512 test_exceptions (test_name, NO_EXCEPTION);
513 result = check_equal (computed, expected, 0, &diff);
514 output_result_ext (test_name, result,
515 computed, expected, diff, parameter, PRINT, PRINT);
520 check that computed and expected values are the same and
521 checks also for exception flags
524 check_exc (const char *test_name, MATHTYPE computed, MATHTYPE expected,
530 output_new_test (test_name);
531 test_exceptions (test_name, exception);
532 result = check_equal (computed, expected, 0, &diff);
533 output_result (test_name, result,
534 computed, expected, diff, PRINT, PRINT);
538 check that computed and expected values are close enough
541 check_eps (const char *test_name, MATHTYPE computed, MATHTYPE expected,
547 output_new_test (test_name);
548 test_exceptions (test_name, NO_EXCEPTION);
549 result = check_equal (computed, expected, epsilon, &diff);
550 output_result (test_name, result,
551 computed, expected, diff, PRINT, PRINT);
555 check a boolean condition
558 check_bool (const char *test_name, int computed)
560 output_new_test (test_name);
561 test_exceptions (test_name, NO_EXCEPTION);
562 output_result_bool (test_name, computed);
568 check that computed and expected values are equal (int values)
571 check_int (const char *test_name, int computed, int expected)
573 int diff = computed - expected;
574 int result = diff == 0;
576 output_new_test (test_name);
577 test_exceptions (test_name, NO_EXCEPTION);
581 output_pass_value ();
585 output_fail_value (test_name);
588 printf ("Result:\n");
589 printf (" is: %d\n", computed);
590 printf (" should be: %d\n", expected);
595 fpstack_test (test_name);
599 check_int_exc (const char *test_name, int computed, int expected,
602 int diff = computed - expected;
603 int result = diff == 0;
605 output_new_test (test_name);
606 test_exceptions (test_name, exception);
610 output_pass_value ();
614 output_fail_value (test_name);
617 printf ("Result:\n");
618 printf (" is: %d\n", computed);
619 printf (" should be: %d\n", expected);
624 fpstack_test (test_name);
629 check that computed and expected values are equal (long int values)
632 check_long (const char *test_name, long int computed, long int expected)
634 long int diff = computed - expected;
635 int result = diff == 0;
637 output_new_test (test_name);
638 test_exceptions (test_name, NO_EXCEPTION);
642 output_pass_value ();
646 output_fail_value (test_name);
649 printf ("Result:\n");
650 printf (" is: %ld\n", computed);
651 printf (" should be: %ld\n", expected);
656 fpstack_test (test_name);
660 check that computed and expected values are equal (long long int values)
663 check_longlong (const char *test_name, long long int computed,
664 long long int expected)
666 long long int diff = computed - expected;
667 int result = diff == 0;
669 output_new_test (test_name);
670 test_exceptions (test_name, NO_EXCEPTION);
674 output_pass_value ();
678 output_fail_value (test_name);
681 printf ("Result:\n");
682 printf (" is: %lld\n", computed);
683 printf (" should be: %lld\n", expected);
688 fpstack_test (test_name);
692 check that computed value is not-a-number
695 check_isnan (const char *test_name, MATHTYPE computed)
697 output_new_test (test_name);
698 test_exceptions (test_name, NO_EXCEPTION);
699 output_isvalue (test_name, isnan (computed), computed);
704 check that computed value is not-a-number and test for exceptions
707 check_isnan_exc (const char *test_name, MATHTYPE computed,
710 output_new_test (test_name);
711 test_exceptions (test_name, exception);
712 output_isvalue (test_name, isnan (computed), computed);
717 check that computed value is not-a-number and test for exceptions
720 check_isnan_maybe_exc (const char *test_name, MATHTYPE computed,
723 output_new_test (test_name);
724 test_not_exception (test_name, exception);
725 output_isvalue (test_name, isnan (computed), computed);
729 check that computed value is not-a-number and supply parameter
733 check_isnan_ext (const char *test_name, MATHTYPE computed,
736 output_new_test (test_name);
737 test_exceptions (test_name, NO_EXCEPTION);
738 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
743 check that computed value is not-a-number, test for exceptions
747 check_isnan_exc_ext (const char *test_name, MATHTYPE computed,
748 short exception, MATHTYPE parameter)
750 output_new_test (test_name);
751 test_exceptions (test_name,exception);
752 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
756 /* Tests if computed is +Inf */
758 check_isinfp (const char *test_name, MATHTYPE computed)
760 output_new_test (test_name);
761 test_exceptions (test_name, NO_EXCEPTION);
762 output_isvalue (test_name, (ISINF (computed) == +1), computed);
767 check_isinfp_ext (const char *test_name, MATHTYPE computed,
770 output_new_test (test_name);
771 test_exceptions (test_name, NO_EXCEPTION);
772 output_isvalue_ext (test_name, (ISINF (computed) == +1), computed, parameter);
776 /* Tests if computed is +Inf */
778 check_isinfp_exc (const char *test_name, MATHTYPE computed,
781 output_new_test (test_name);
782 test_exceptions (test_name, exception);
783 output_isvalue (test_name, (ISINF (computed) == +1), computed);
786 /* Tests if computed is -Inf */
788 check_isinfn (const char *test_name, MATHTYPE computed)
790 output_new_test (test_name);
791 test_exceptions (test_name, NO_EXCEPTION);
792 output_isvalue (test_name, (ISINF (computed) == -1), computed);
798 check_isinfn_ext (const char *test_name, MATHTYPE computed,
801 output_new_test (test_name);
802 test_exceptions (test_name, NO_EXCEPTION);
803 output_isvalue_ext (test_name, (ISINF (computed) == -1), computed, parameter);
808 /* Tests if computed is -Inf */
810 check_isinfn_exc (const char *test_name, MATHTYPE computed,
813 output_new_test (test_name);
814 test_exceptions (test_name, exception);
815 output_isvalue (test_name, (ISINF (computed) == -1), computed);
819 /* This is to prevent messages from the SVID libm emulation. */
821 matherr (struct exception *x __attribute__ ((unused)))
827 /****************************************************************************
828 Test for single functions of libm
829 ****************************************************************************/
837 x = random_greater (1);
838 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
843 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
848 check ("acos (1) == 0", FUNC(acos) (1), 0);
849 check ("acos (-1) == pi", FUNC(acos) (-1), M_PI);
859 check_isinfp ("acosh(+inf) == +inf", FUNC(acosh) (plus_infty));
862 check_isnan_exc ("acosh(x) == NaN plus invalid exception if x < 1",
863 FUNC(acosh) (x), INVALID_EXCEPTION);
866 check ("acosh(1) == 0", FUNC(acosh) (1), 0);
876 x = random_greater (1);
877 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
882 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
887 check ("asin (0) == 0", FUNC(asin) (0), 0);
895 check ("asinh(+0) == +0", FUNC(asinh) (0), 0);
897 check ("asinh(-0) == -0", FUNC(asinh) (minus_zero), minus_zero);
898 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh) (plus_infty));
899 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh) (minus_infty));
908 check ("atan (0) == 0", FUNC(atan) (0), 0);
909 check ("atan (-0) == -0", FUNC(atan) (minus_zero), minus_zero);
911 check ("atan (+inf) == pi/2", FUNC(atan) (plus_infty), M_PI_2);
912 check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2);
921 x = random_greater (0);
922 check ("atan2 (0,x) == 0 for x > 0",
923 FUNC(atan2) (0, x), 0);
924 x = random_greater (0);
925 check ("atan2 (-0,x) == -0 for x > 0",
926 FUNC(atan2) (minus_zero, x), minus_zero);
928 check ("atan2 (+0,+0) == +0", FUNC(atan2) (0, 0), 0);
929 check ("atan2 (-0,+0) == -0", FUNC(atan2) (minus_zero, 0), minus_zero);
931 x = -random_greater (0);
932 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2) (0, x), M_PI);
934 x = -random_greater (0);
935 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2) (minus_zero, x), -M_PI);
937 check ("atan2 (+0,-0) == +pi", FUNC(atan2) (0, minus_zero), M_PI);
938 check ("atan2 (-0,-0) == -pi", FUNC(atan2) (minus_zero, minus_zero), -M_PI);
940 x = random_greater (0);
941 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2) (x, 0), M_PI_2);
943 x = random_greater (0);
944 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2) (x, minus_zero), M_PI_2);
947 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2) (x, 0), -M_PI_2);
950 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2) (x, minus_zero), -M_PI_2);
952 x = random_greater (0);
953 check ("atan2 (y,inf) == +0 for finite y > 0",
954 FUNC(atan2) (x, plus_infty), 0);
956 x = -random_greater (0);
957 check ("atan2 (y,inf) == -0 for finite y < 0",
958 FUNC(atan2) (x, plus_infty), minus_zero);
960 x = random_value (-1e4, 1e4);
961 check ("atan2(+inf, x) == pi/2 for finite x",
962 FUNC(atan2) (plus_infty, x), M_PI_2);
964 x = random_value (-1e4, 1e4);
965 check ("atan2(-inf, x) == -pi/2 for finite x",
966 FUNC(atan2) (minus_infty, x), -M_PI_2);
968 x = random_greater (0);
969 check ("atan2 (y,-inf) == +pi for finite y > 0",
970 FUNC(atan2) (x, minus_infty), M_PI);
972 x = -random_greater (0);
973 check ("atan2 (y,-inf) == -pi for finite y < 0",
974 FUNC(atan2) (x, minus_infty), -M_PI);
976 check ("atan2 (+inf,+inf) == +pi/4",
977 FUNC(atan2) (plus_infty, plus_infty), M_PI_4);
979 check ("atan2 (-inf,+inf) == -pi/4",
980 FUNC(atan2) (minus_infty, plus_infty), -M_PI_4);
982 check ("atan2 (+inf,-inf) == +3*pi/4",
983 FUNC(atan2) (plus_infty, minus_infty), 3 * M_PI_4);
985 check ("atan2 (-inf,-inf) == -3*pi/4",
986 FUNC(atan2) (minus_infty, minus_infty), -3 * M_PI_4);
988 /* FIXME: Add some specific tests */
999 check ("atanh(+0) == +0", FUNC(atanh) (0), 0);
1001 check ("atanh(-0) == -0", FUNC(atanh) (minus_zero), minus_zero);
1003 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
1004 FUNC(atanh) (1), DIVIDE_BY_ZERO_EXCEPTION);
1005 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
1006 FUNC(atanh) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1008 x = random_greater (1.0);
1009 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1010 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1012 x = random_less (1.0);
1013 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1014 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1023 check ("cbrt (+0) == +0", FUNC(cbrt) (0.0), 0.0);
1024 check ("cbrt (-0) == -0", FUNC(cbrt) (minus_zero), minus_zero);
1027 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt) (plus_infty));
1028 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty));
1029 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value));
1031 check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0));
1032 check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0,
1033 CHOOSE (3e-16L, 0, 0));
1040 check ("ceil (+0) == +0", FUNC(ceil) (0.0), 0.0);
1041 check ("ceil (-0) == -0", FUNC(ceil) (minus_zero), minus_zero);
1042 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil) (plus_infty));
1043 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil) (minus_infty));
1045 check ("ceil (pi) == 4", FUNC(ceil) (M_PI), 4.0);
1046 check ("ceil (-pi) == -3", FUNC(ceil) (-M_PI), -3.0);
1054 check ("cos (+0) == 1", FUNC(cos) (0), 1);
1055 check ("cos (-0) == 1", FUNC(cos) (minus_zero), 1);
1056 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1057 FUNC(cos) (plus_infty),
1059 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1060 FUNC(cos) (minus_infty),
1063 check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6 * 2.0),
1064 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1065 check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
1066 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1073 check ("cosh (+0) == 1", FUNC(cosh) (0), 1);
1074 check ("cosh (-0) == 1", FUNC(cosh) (minus_zero), 1);
1077 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh) (plus_infty));
1078 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh) (minus_infty));
1088 if (errno == ENOSYS)
1089 /* Function not implemented. */
1092 check ("erf (+0) == +0", FUNC(erf) (0), 0);
1093 check ("erf (-0) == -0", FUNC(erf) (minus_zero), minus_zero);
1094 check ("erf (+inf) == +1", FUNC(erf) (plus_infty), 1);
1095 check ("erf (-inf) == -1", FUNC(erf) (minus_infty), -1);
1104 if (errno == ENOSYS)
1105 /* Function not implemented. */
1108 check ("erfc (+inf) == 0", FUNC(erfc) (plus_infty), 0.0);
1109 check ("erfc (-inf) == 2", FUNC(erfc) (minus_infty), 2.0);
1110 check ("erfc (+0) == 1", FUNC(erfc) (0.0), 1.0);
1111 check ("erfc (-0) == 1", FUNC(erfc) (minus_zero), 1.0);
1118 check ("exp (+0) == 1", FUNC(exp) (0), 1);
1119 check ("exp (-0) == 1", FUNC(exp) (minus_zero), 1);
1122 check_isinfp ("exp (+inf) == +inf", FUNC(exp) (plus_infty));
1123 check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0);
1125 check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 0, 0));
1134 if (errno == ENOSYS)
1135 /* Function not implemented. */
1138 check ("exp2 (+0) == 1", FUNC(exp2) (0), 1);
1139 check ("exp2 (-0) == 1", FUNC(exp2) (minus_zero), 1);
1141 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2) (plus_infty));
1142 check ("exp2 (-inf) == 0", FUNC(exp2) (minus_infty), 0);
1143 check ("exp2 (10) == 1024", FUNC(exp2) (10), 1024);
1150 check ("expm1 (+0) == 0", FUNC(expm1) (0), 0);
1151 check ("expm1 (-0) == -0", FUNC(expm1) (minus_zero), minus_zero);
1153 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1) (plus_infty));
1154 check ("expm1 (-inf) == -1", FUNC(expm1) (minus_infty), -1);
1156 check_eps ("expm1 (1) == e-1", FUNC(expm1) (1), M_E - 1.0,
1157 CHOOSE (4e-18L, 0, 0));
1164 check_frexp (const char *test_name, MATHTYPE computed, MATHTYPE expected,
1165 int comp_int, int exp_int)
1170 result = (check_equal (computed, expected, 0, &diff)
1171 && (comp_int == exp_int));
1176 printf ("Pass: %s\n", test_name);
1181 printf ("Fail: %s\n", test_name);
1184 printf ("Result:\n");
1185 printf (" is: %.20" PRINTF_EXPR " *2^%d\n", computed, comp_int);
1186 printf (" should be: %.20" PRINTF_EXPR " *2^%d\n", expected, exp_int);
1187 printf (" difference: %.20" PRINTF_EXPR "\n", diff);
1191 fpstack_test (test_name);
1192 output_result (test_name, result,
1193 computed, expected, diff, PRINT, PRINT);
1203 result = FUNC(frexp) (plus_infty, &x_int);
1204 check_isinfp ("frexp (+inf, expr) == +inf", result);
1206 result = FUNC(frexp) (minus_infty, &x_int);
1207 check_isinfn ("frexp (-inf, expr) == -inf", result);
1209 result = FUNC(frexp) (nan_value, &x_int);
1210 check_isnan ("frexp (Nan, expr) == NaN", result);
1212 result = FUNC(frexp) (0, &x_int);
1213 check_frexp ("frexp: +0 == 0 * 2^0", result, 0, x_int, 0);
1215 result = FUNC(frexp) (minus_zero, &x_int);
1216 check_frexp ("frexp: -0 == -0 * 2^0", result, minus_zero, x_int, 0);
1218 result = FUNC(frexp) (12.8L, &x_int);
1219 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result, 0.8L, x_int, 4);
1221 result = FUNC(frexp) (-27.34L, &x_int);
1222 check_frexp ("frexp: -27.34 == -0.854375 * 2^5", result, -0.854375L, x_int, 5);
1227 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
1228 /* All floating-point numbers can be put in one of these categories. */
1232 #define FP_NAN FP_NAN
1234 #define FP_INFINITE FP_INFINITE
1236 #define FP_ZERO FP_ZERO
1238 #define FP_SUBNORMAL FP_SUBNORMAL
1240 #define FP_NORMAL FP_NORMAL
1246 fpclassify_test (void)
1250 /* fpclassify is a macro, don't give it constants as parameter */
1251 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value) == FP_NAN);
1252 check_bool ("fpclassify (+inf) == FP_INFINITE",
1253 fpclassify (plus_infty) == FP_INFINITE);
1254 check_bool ("fpclassify (-inf) == FP_INFINITE",
1255 fpclassify (minus_infty) == FP_INFINITE);
1256 check_bool ("fpclassify (+0) == FP_ZERO",
1257 fpclassify (plus_zero) == FP_ZERO);
1258 check_bool ("fpclassify (-0) == FP_ZERO",
1259 fpclassify (minus_zero) == FP_ZERO);
1262 check_bool ("fpclassify (1000) == FP_NORMAL",
1263 fpclassify (x) == FP_NORMAL);
1268 isfinite_test (void)
1270 check_bool ("isfinite (0) != 0", isfinite (0));
1271 check_bool ("isfinite (-0) != 0", isfinite (minus_zero));
1272 check_bool ("isfinite (10) != 0", isfinite (10));
1273 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty) == 0);
1274 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty) == 0);
1275 check_bool ("isfinite (NaN) == 0", isfinite (nan_value) == 0);
1280 isnormal_test (void)
1282 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1283 check_bool ("isnormal (-0) == 0", isnormal (minus_zero) == 0);
1284 check_bool ("isnormal (10) != 0", isnormal (10));
1285 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty) == 0);
1286 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty) == 0);
1287 check_bool ("isnormal (NaN) == 0", isnormal (nan_value) == 0);
1297 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1298 check_bool ("signbit (-0) != 0", signbit (minus_zero));
1299 check_bool ("signbit (+inf) == 0", signbit (plus_infty) == 0);
1300 check_bool ("signbit (-inf) != 0", signbit (minus_infty));
1302 x = random_less (0);
1303 check_bool ("signbit (x) != 0 for x < 0", signbit (x));
1305 x = random_greater (0);
1306 check_bool ("signbit (x) == 0 for x > 0", signbit (x) == 0);
1312 gamma has different semantics depending on _LIB_VERSION:
1313 if _LIB_VERSION is _SVID, gamma is just an alias for lgamma,
1314 otherwise gamma is the real gamma function as definied in ISO C 9X.
1319 int save_lib_version = _LIB_VERSION;
1322 if (errno == ENOSYS)
1323 /* Function not implemented. */
1325 feclearexcept (FE_ALL_EXCEPT);
1328 _LIB_VERSION = _SVID_;
1330 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
1331 check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
1332 FUNC(gamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1334 check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
1335 FUNC(gamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1336 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1337 FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
1340 check ("gamma (1) == 0", FUNC(gamma) (1), 0);
1341 check_int ("gamma (0) sets signgam to 1", signgam, 1);
1344 check ("gamma (3) == M_LN2", FUNC(gamma) (3), M_LN2);
1345 check_int ("gamma (3) sets signgam to 1", signgam, 1);
1348 check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma) (0.5),
1349 FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
1350 check_int ("gamma (0.5) sets signgam to 1", signgam, 1);
1353 check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma) (-0.5),
1354 FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
1356 check_int ("gamma (-0.5) sets signgam to -1", signgam, -1);
1359 _LIB_VERSION = _IEEE_;
1361 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
1362 check_isnan_exc ("gamma (0) == NaN plus invalid exception",
1363 FUNC(gamma) (0), INVALID_EXCEPTION);
1365 check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for integer x <= 0",
1366 FUNC(gamma) (-2), INVALID_EXCEPTION, -2);
1367 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1368 FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
1370 check_eps ("gamma (0.5) == sqrt(pi)", FUNC(gamma) (0.5), FUNC(sqrt) (M_PI),
1371 CHOOSE (0, 5e-16, 2e-7));
1372 check_eps ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma) (-0.5),
1373 -2*FUNC(sqrt) (M_PI), CHOOSE (0, 5e-16, 3e-7));
1375 check ("gamma (1) == 1", FUNC(gamma) (1), 1);
1376 check ("gamma (4) == 6", FUNC(gamma) (4), 6);
1378 _LIB_VERSION = save_lib_version;
1387 if (errno == ENOSYS)
1388 /* Function not implemented. */
1390 feclearexcept (FE_ALL_EXCEPT);
1392 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma) (plus_infty));
1393 check_isinfp_exc ("lgamma (0) == +inf plus divide by zero exception",
1394 FUNC(lgamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1396 check_isinfp_exc ("lgamma (x) == +inf plus divide by zero exception for integer x <= 0",
1397 FUNC(lgamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1398 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1399 FUNC(lgamma) (minus_infty), INVALID_EXCEPTION);
1402 check ("lgamma (1) == 0", FUNC(lgamma) (1), 0);
1403 check_int ("lgamma (0) sets signgam to 1", signgam, 1);
1406 check ("lgamma (3) == M_LN2", FUNC(lgamma) (3), M_LN2);
1407 check_int ("lgamma (3) sets signgam to 1", signgam, 1);
1410 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma) (0.5),
1411 FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
1412 check_int ("lgamma (0.5) sets signgam to 1", signgam, 1);
1415 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma) (-0.5),
1416 FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
1418 check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1);
1428 check_int ("ilogb (1) == 0", FUNC(ilogb) (1), 0);
1429 check_int ("ilogb (e) == 1", FUNC(ilogb) (M_E), 1);
1430 check_int ("ilogb (1024) == 10", FUNC(ilogb) (1024), 10);
1431 check_int ("ilogb (-2000) == 10", FUNC(ilogb) (-2000), 10);
1433 /* XXX We have a problem here: the standard does not tell us whether
1434 exceptions are allowed/required. ignore them for now. */
1435 i = FUNC (ilogb) (0.0);
1436 feclearexcept (FE_ALL_EXCEPT);
1437 check_int ("ilogb (0) == FP_ILOGB0", i, FP_ILOGB0);
1438 i = FUNC(ilogb) (nan_value);
1439 feclearexcept (FE_ALL_EXCEPT);
1440 check_int ("ilogb (NaN) == FP_ILOGBNAN", i, FP_ILOGBNAN);
1450 check ("ldexp (0, 0) == 0", FUNC(ldexp) (0, 0), 0);
1452 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp) (plus_infty, 1));
1453 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp) (minus_infty, 1));
1454 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp) (nan_value, 1));
1456 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp) (0.8L, 4), 12.8L);
1457 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp) (-0.854375L, 5), -27.34L);
1459 x = random_greater (0.0);
1460 check_ext ("ldexp (x, 0) == x", FUNC(ldexp) (x, 0L), x, x);
1468 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1469 FUNC(log) (0), DIVIDE_BY_ZERO_EXCEPTION);
1470 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1471 FUNC(log) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1473 check ("log (1) == 0", FUNC(log) (1), 0);
1475 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1476 FUNC(log) (-1), INVALID_EXCEPTION);
1477 check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty));
1479 check_eps ("log (e) == 1", FUNC(log) (M_E), 1, CHOOSE (1e-18L, 0, 9e-8L));
1480 check_eps ("log (1/e) == -1", FUNC(log) (1.0 / M_E), -1,
1481 CHOOSE (2e-18L, 0, 0));
1482 check ("log (2) == M_LN2", FUNC(log) (2), M_LN2);
1483 check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10,
1484 CHOOSE (1e-18L, 0, 0));
1491 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1492 FUNC(log10) (0), DIVIDE_BY_ZERO_EXCEPTION);
1493 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1494 FUNC(log10) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1496 check ("log10 (1) == +0", FUNC(log10) (1), 0);
1498 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1499 FUNC(log10) (-1), INVALID_EXCEPTION);
1501 check_isinfp ("log10 (+inf) == +inf", FUNC(log10) (plus_infty));
1503 check_eps ("log10 (0.1) == -1", FUNC(log10) (0.1L), -1,
1504 CHOOSE (1e-18L, 0, 0));
1505 check_eps ("log10 (10) == 1", FUNC(log10) (10.0), 1,
1506 CHOOSE (1e-18L, 0, 0));
1507 check_eps ("log10 (100) == 2", FUNC(log10) (100.0), 2,
1508 CHOOSE (1e-18L, 0, 0));
1509 check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
1510 check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_E), M_LOG10E,
1511 CHOOSE (1e-18, 0, 9e-8));
1518 check ("log1p (+0) == +0", FUNC(log1p) (0), 0);
1519 check ("log1p (-0) == -0", FUNC(log1p) (minus_zero), minus_zero);
1521 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1522 FUNC(log1p) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1523 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1524 FUNC(log1p) (-2), INVALID_EXCEPTION);
1526 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p) (plus_infty));
1528 check_eps ("log1p (e-1) == 1", FUNC(log1p) (M_E - 1.0), 1,
1529 CHOOSE (1e-18L, 0, 0));
1537 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1538 FUNC(log2) (0), DIVIDE_BY_ZERO_EXCEPTION);
1539 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1540 FUNC(log2) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1542 check ("log2 (1) == +0", FUNC(log2) (1), 0);
1544 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1545 FUNC(log2) (-1), INVALID_EXCEPTION);
1547 check_isinfp ("log2 (+inf) == +inf", FUNC(log2) (plus_infty));
1549 check_eps ("log2 (e) == M_LOG2E", FUNC(log2) (M_E), M_LOG2E,
1550 CHOOSE (1e-18L, 0, 0));
1551 check ("log2 (2) == 1", FUNC(log2) (2.0), 1);
1552 check_eps ("log2 (16) == 4", FUNC(log2) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1553 check ("log2 (256) == 8", FUNC(log2) (256.0), 8);
1561 check_isinfp ("logb (+inf) == +inf", FUNC(logb) (plus_infty));
1562 check_isinfp ("logb (-inf) == +inf", FUNC(logb) (minus_infty));
1564 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1565 FUNC(logb) (0), DIVIDE_BY_ZERO_EXCEPTION);
1567 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1568 FUNC(logb) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1570 check ("logb (1) == 0", FUNC(logb) (1), 0);
1571 check ("logb (e) == 1", FUNC(logb) (M_E), 1);
1572 check ("logb (1024) == 10", FUNC(logb) (1024), 10);
1573 check ("logb (-2000) == 10", FUNC(logb) (-2000), 10);
1581 MATHTYPE result, intpart;
1583 result = FUNC(modf) (plus_infty, &intpart);
1584 check ("modf (+inf, &x) returns +0", result, 0);
1585 check_isinfp ("modf (+inf, &x) set x to +inf", intpart);
1587 result = FUNC(modf) (minus_infty, &intpart);
1588 check ("modf (-inf, &x) returns -0", result, minus_zero);
1589 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart);
1591 result = FUNC(modf) (nan_value, &intpart);
1592 check_isnan ("modf (NaN, &x) returns NaN", result);
1593 check_isnan ("modf (NaN, &x) sets x to NaN", intpart);
1595 result = FUNC(modf) (0, &intpart);
1596 check ("modf (0, &x) returns 0", result, 0);
1597 check ("modf (0, &x) sets x to 0", intpart, 0);
1599 result = FUNC(modf) (minus_zero, &intpart);
1600 check ("modf (-0, &x) returns -0", result, minus_zero);
1601 check ("modf (-0, &x) sets x to -0", intpart, minus_zero);
1603 result = FUNC(modf) (2.5, &intpart);
1604 check ("modf (2.5, &x) returns 0.5", result, 0.5);
1605 check ("modf (2.5, &x) sets x to 2", intpart, 2);
1607 result = FUNC(modf) (-2.5, &intpart);
1608 check ("modf (-2.5, &x) returns -0.5", result, -0.5);
1609 check ("modf (-2.5, &x) sets x to -2", intpart, -2);
1619 check_isnan ("scalb (2, 0.5) == NaN", FUNC(scalb) (2, 0.5));
1620 check_isnan ("scalb (3, -2.5) == NaN", FUNC(scalb) (3, -2.5));
1622 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1623 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1625 x = random_greater (0.0);
1626 check ("scalb (x, 0) == 0", FUNC(scalb) (x, 0), x);
1627 x = random_greater (0.0);
1628 check ("scalb (-x, 0) == 0", FUNC(scalb) (-x, 0), -x);
1630 check_isnan_exc ("scalb (+0, +inf) == NaN plus invalid exception",
1631 FUNC(scalb) (0, plus_infty), INVALID_EXCEPTION);
1632 check_isnan_exc ("scalb (-0, +inf) == NaN plus invalid exception",
1633 FUNC(scalb) (minus_zero, plus_infty), INVALID_EXCEPTION);
1635 check ("scalb (+0, 2) == +0", FUNC(scalb) (0, 2), 0);
1636 check ("scalb (-0, 4) == -0", FUNC(scalb) (minus_zero, -4), minus_zero);
1637 check ("scalb (+0, 0) == +0", FUNC(scalb) (0, 0), 0);
1638 check ("scalb (-0, 0) == -0", FUNC(scalb) (minus_zero, 0), minus_zero);
1639 check ("scalb (+0, -1) == +0", FUNC(scalb) (0, -1), 0);
1640 check ("scalb (-0, -10) == -0", FUNC(scalb) (minus_zero, -10), minus_zero);
1641 check ("scalb (+0, -inf) == +0", FUNC(scalb) (0, minus_infty), 0);
1642 check ("scalb (-0, -inf) == -0", FUNC(scalb) (minus_zero, minus_infty),
1645 check_isinfp ("scalb (+inf, -1) == +inf", FUNC(scalb) (plus_infty, -1));
1646 check_isinfn ("scalb (-inf, -10) == -inf", FUNC(scalb) (minus_infty, -10));
1647 check_isinfp ("scalb (+inf, 0) == +inf", FUNC(scalb) (plus_infty, 0));
1648 check_isinfn ("scalb (-inf, 0) == -inf", FUNC(scalb) (minus_infty, 0));
1649 check_isinfp ("scalb (+inf, 2) == +inf", FUNC(scalb) (plus_infty, 2));
1650 check_isinfn ("scalb (-inf, 100) == -inf", FUNC(scalb) (minus_infty, 100));
1652 x = random_greater (0.0);
1653 check ("scalb (x, -inf) == 0", FUNC(scalb) (x, minus_infty), 0.0);
1654 check ("scalb (-x, -inf) == -0", FUNC(scalb) (-x, minus_infty), minus_zero);
1656 x = random_greater (0.0);
1657 check_isinfp ("scalb (x, +inf) == +inf", FUNC(scalb) (x, plus_infty));
1658 x = random_greater (0.0);
1659 check_isinfn ("scalb (-x, +inf) == -inf", FUNC(scalb) (-x, plus_infty));
1660 check_isinfp ("scalb (+inf, +inf) == +inf",
1661 FUNC(scalb) (plus_infty, plus_infty));
1662 check_isinfn ("scalb (-inf, +inf) == -inf",
1663 FUNC(scalb) (minus_infty, plus_infty));
1665 check_isnan ("scalb (+inf, -inf) == NaN",
1666 FUNC(scalb) (plus_infty, minus_infty));
1667 check_isnan ("scalb (-inf, -inf) == NaN",
1668 FUNC(scalb) (minus_infty, minus_infty));
1670 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb) (nan_value, 1));
1671 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1672 check_isnan ("scalb (NaN, 0) == NaN", FUNC(scalb) (nan_value, 0));
1673 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1674 check_isnan ("scalb (NaN, +inf) == NaN",
1675 FUNC(scalb) (nan_value, plus_infty));
1676 check_isnan ("scalb (+inf, NaN) == NaN",
1677 FUNC(scalb) (plus_infty, nan_value));
1678 check_isnan ("scalb (NaN, NaN) == NaN", FUNC(scalb) (nan_value, nan_value));
1680 check ("scalb (0.8, 4) == 12.8", FUNC(scalb) (0.8L, 4), 12.8L);
1681 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb) (-0.854375L, 5), -27.34L);
1690 check ("scalbn (0, 0) == 0", FUNC(scalbn) (0, 0), 0);
1692 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn) (plus_infty, 1));
1693 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn) (minus_infty, 1));
1694 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn) (nan_value, 1));
1696 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn) (0.8L, 4), 12.8L);
1697 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn) (-0.854375L, 5), -27.34L);
1699 x = random_greater (0.0);
1700 check_ext ("scalbn (x, 0) == x", FUNC(scalbn) (x, 0L), x, x);
1707 check ("sin (+0) == +0", FUNC(sin) (0), 0);
1708 check ("sin (-0) == -0", FUNC(sin) (minus_zero), minus_zero);
1709 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1710 FUNC(sin) (plus_infty),
1712 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1713 FUNC(sin) (minus_infty),
1716 check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6),
1717 0.5,CHOOSE (4e-18L, 0, 0));
1718 check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
1725 check ("sinh (+0) == +0", FUNC(sinh) (0), 0);
1728 check ("sinh (-0) == -0", FUNC(sinh) (minus_zero), minus_zero);
1730 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh) (plus_infty));
1731 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh) (minus_infty));
1739 MATHTYPE sin_res, cos_res;
1742 FUNC(sincos) (0, &sin_res, &cos_res);
1744 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res, 0);
1746 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res, 1);
1748 FUNC(sincos) (minus_zero, &sin_res, &cos_res);
1750 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res, minus_zero);
1752 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res, 1);
1754 FUNC(sincos) (plus_infty, &sin_res, &cos_res);
1756 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1757 sin_res, INVALID_EXCEPTION);
1759 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1760 cos_res, INVALID_EXCEPTION);
1762 FUNC(sincos) (minus_infty, &sin_res, &cos_res);
1764 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1765 sin_res, INVALID_EXCEPTION);
1767 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1768 cos_res, INVALID_EXCEPTION);
1770 FUNC(sincos) (M_PI_2, &sin_res, &cos_res);
1772 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res, 1);
1774 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
1775 CHOOSE (1e-18L, 1e-16, 1e-7));
1777 FUNC(sincos) (M_PI_6, &sin_res, &cos_res);
1778 check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5,
1779 CHOOSE (5e-18L, 0, 0));
1781 FUNC(sincos) (M_PI_6*2.0, &sin_res, &cos_res);
1782 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
1783 CHOOSE (5e-18L, 1e-15, 1e-7));
1792 check ("tan (+0) == +0", FUNC(tan) (0), 0);
1793 check ("tan (-0) == -0", FUNC(tan) (minus_zero), minus_zero);
1794 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1795 FUNC(tan) (plus_infty), INVALID_EXCEPTION);
1796 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1797 FUNC(tan) (minus_infty), INVALID_EXCEPTION);
1799 check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4), 1,
1800 CHOOSE (2e-18L, 1e-15L, 0));
1807 check ("tanh (+0) == +0", FUNC(tanh) (0), 0);
1809 check ("tanh (-0) == -0", FUNC(tanh) (minus_zero), minus_zero);
1811 check ("tanh (+inf) == +1", FUNC(tanh) (plus_infty), 1);
1812 check ("tanh (-inf) == -1", FUNC(tanh) (minus_infty), -1);
1820 check ("fabs (+0) == +0", FUNC(fabs) (0), 0);
1821 check ("fabs (-0) == +0", FUNC(fabs) (minus_zero), 0);
1823 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs) (plus_infty));
1824 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs) (minus_infty));
1826 check ("fabs (+38) == 38", FUNC(fabs) (38.0), 38.0);
1827 check ("fabs (-e) == e", FUNC(fabs) (-M_E), M_E);
1834 check ("floor (+0) == +0", FUNC(floor) (0.0), 0.0);
1835 check ("floor (-0) == -0", FUNC(floor) (minus_zero), minus_zero);
1836 check_isinfp ("floor (+inf) == +inf", FUNC(floor) (plus_infty));
1837 check_isinfn ("floor (-inf) == -inf", FUNC(floor) (minus_infty));
1839 check ("floor (pi) == 3", FUNC(floor) (M_PI), 3.0);
1840 check ("floor (-pi) == -4", FUNC(floor) (-M_PI), -4.0);
1849 a = random_greater (0);
1850 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot) (plus_infty, a), a);
1851 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot) (minus_infty, a), a);
1854 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
1855 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
1858 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot) (nan_value, nan_value));
1860 a = FUNC(hypot) (12.4L, 0.7L);
1861 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot) (0.7L, 12.4L), a);
1862 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot) (-12.4L, 0.7L), a);
1863 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot) (-0.7L, 12.4L), a);
1864 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot) (-12.4L, -0.7L), a);
1865 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot) (-0.7L, -12.4L), a);
1866 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-0.7L, 0), 0.7L);
1867 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (0.7L, 0), 0.7L);
1868 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-1.0L, 0), 1.0L);
1869 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (1.0L, 0), 1.0L);
1870 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
1871 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (5.7e7L, 0), 5.7e7L);
1880 check ("pow (+0, +0) == 1", FUNC(pow) (0, 0), 1);
1881 check ("pow (+0, -0) == 1", FUNC(pow) (0, minus_zero), 1);
1882 check ("pow (-0, +0) == 1", FUNC(pow) (minus_zero, 0), 1);
1883 check ("pow (-0, -0) == 1", FUNC(pow) (minus_zero, minus_zero), 1);
1885 check ("pow (+10, +0) == 1", FUNC(pow) (10, 0), 1);
1886 check ("pow (+10, -0) == 1", FUNC(pow) (10, minus_zero), 1);
1887 check ("pow (-10, +0) == 1", FUNC(pow) (-10, 0), 1);
1888 check ("pow (-10, -0) == 1", FUNC(pow) (-10, minus_zero), 1);
1890 check ("pow (NaN, +0) == 1", FUNC(pow) (nan_value, 0), 1);
1891 check ("pow (NaN, -0) == 1", FUNC(pow) (nan_value, minus_zero), 1);
1894 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow) (1.1, plus_infty));
1895 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow) (plus_infty, plus_infty));
1896 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow) (-1.1, plus_infty));
1897 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow) (minus_infty, plus_infty));
1899 check ("pow (0.9, +inf) == +0", FUNC(pow) (0.9L, plus_infty), 0);
1900 check ("pow (1e-7, +inf) == +0", FUNC(pow) (1e-7L, plus_infty), 0);
1901 check ("pow (-0.9, +inf) == +0", FUNC(pow) (-0.9L, plus_infty), 0);
1902 check ("pow (-1e-7, +inf) == +0", FUNC(pow) (-1e-7L, plus_infty), 0);
1904 check ("pow (+1.1, -inf) == 0", FUNC(pow) (1.1, minus_infty), 0);
1905 check ("pow (+inf, -inf) == 0", FUNC(pow) (plus_infty, minus_infty), 0);
1906 check ("pow (-1.1, -inf) == 0", FUNC(pow) (-1.1, minus_infty), 0);
1907 check ("pow (-inf, -inf) == 0", FUNC(pow) (minus_infty, minus_infty), 0);
1909 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow) (0.9L, minus_infty));
1910 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow) (1e-7L, minus_infty));
1911 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow) (-0.9L, minus_infty));
1912 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow) (-1e-7L, minus_infty));
1914 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow) (plus_infty, 1e-7L));
1915 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow) (plus_infty, 1));
1916 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow) (plus_infty, 1e7L));
1918 check ("pow (+inf, -1e-7) == 0", FUNC(pow) (plus_infty, -1e-7L), 0);
1919 check ("pow (+inf, -1) == 0", FUNC(pow) (plus_infty, -1), 0);
1920 check ("pow (+inf, -1e7) == 0", FUNC(pow) (plus_infty, -1e7L), 0);
1922 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow) (minus_infty, 1));
1923 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow) (minus_infty, 11));
1924 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow) (minus_infty, 1001));
1926 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow) (minus_infty, 2));
1927 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow) (minus_infty, 12));
1928 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow) (minus_infty, 1002));
1929 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow) (minus_infty, 0.1));
1930 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow) (minus_infty, 1.1));
1931 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow) (minus_infty, 11.1));
1932 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow) (minus_infty, 1001.1));
1934 check ("pow (-inf, -1) == -0", FUNC(pow) (minus_infty, -1), minus_zero);
1935 check ("pow (-inf, -11) == -0", FUNC(pow) (minus_infty, -11), minus_zero);
1936 check ("pow (-inf, -1001) == -0", FUNC(pow) (minus_infty, -1001), minus_zero);
1938 check ("pow (-inf, -2) == +0", FUNC(pow) (minus_infty, -2), 0);
1939 check ("pow (-inf, -12) == +0", FUNC(pow) (minus_infty, -12), 0);
1940 check ("pow (-inf, -1002) == +0", FUNC(pow) (minus_infty, -1002), 0);
1941 check ("pow (-inf, -0.1) == +0", FUNC(pow) (minus_infty, -0.1), 0);
1942 check ("pow (-inf, -1.1) == +0", FUNC(pow) (minus_infty, -1.1), 0);
1943 check ("pow (-inf, -11.1) == +0", FUNC(pow) (minus_infty, -11.1), 0);
1944 check ("pow (-inf, -1001.1) == +0", FUNC(pow) (minus_infty, -1001.1), 0);
1946 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow) (nan_value, nan_value));
1947 check_isnan ("pow (0, NaN) == NaN", FUNC(pow) (0, nan_value));
1948 check_isnan ("pow (1, NaN) == NaN", FUNC(pow) (1, nan_value));
1949 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow) (-1, nan_value));
1950 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow) (nan_value, 1));
1951 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow) (nan_value, -1));
1953 x = random_greater (0.0);
1954 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow) (x, nan_value), x);
1956 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
1957 FUNC(pow) (1, plus_infty), INVALID_EXCEPTION);
1958 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
1959 FUNC(pow) (-1, plus_infty), INVALID_EXCEPTION);
1960 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
1961 FUNC(pow) (1, minus_infty), INVALID_EXCEPTION);
1962 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
1963 FUNC(pow) (-1, minus_infty), INVALID_EXCEPTION);
1965 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
1966 FUNC(pow) (-0.1, 1.1), INVALID_EXCEPTION);
1967 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
1968 FUNC(pow) (-0.1, -1.1), INVALID_EXCEPTION);
1969 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
1970 FUNC(pow) (-10.1, 1.1), INVALID_EXCEPTION);
1971 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
1972 FUNC(pow) (-10.1, -1.1), INVALID_EXCEPTION);
1974 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
1975 FUNC(pow) (0, -1), DIVIDE_BY_ZERO_EXCEPTION);
1976 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
1977 FUNC(pow) (0, -11), DIVIDE_BY_ZERO_EXCEPTION);
1978 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
1979 FUNC(pow) (minus_zero, -1), DIVIDE_BY_ZERO_EXCEPTION);
1980 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
1981 FUNC(pow) (minus_zero, -11), DIVIDE_BY_ZERO_EXCEPTION);
1983 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
1984 FUNC(pow) (0, -2), DIVIDE_BY_ZERO_EXCEPTION);
1985 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
1986 FUNC(pow) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
1987 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
1988 FUNC(pow) (minus_zero, -2), DIVIDE_BY_ZERO_EXCEPTION);
1989 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
1990 FUNC(pow) (minus_zero, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
1993 check ("pow (+0, 1) == +0", FUNC(pow) (0, 1), 0);
1994 check ("pow (+0, 11) == +0", FUNC(pow) (0, 11), 0);
1996 check ("pow (-0, 1) == -0", FUNC(pow) (minus_zero, 1), minus_zero);
1997 check ("pow (-0, 11) == -0", FUNC(pow) (minus_zero, 11), minus_zero);
2000 check ("pow (+0, 2) == +0", FUNC(pow) (0, 2), 0);
2001 check ("pow (+0, 11.1) == +0", FUNC(pow) (0, 11.1), 0);
2004 check ("pow (-0, 2) == +0", FUNC(pow) (minus_zero, 2), 0);
2005 check ("pow (-0, 11.1) == +0", FUNC(pow) (minus_zero, 11.1), 0);
2007 x = random_greater (1.0);
2008 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
2009 FUNC(pow) (x, plus_infty), x);
2011 x = random_value (-1.0, 1.0);
2012 check_ext ("pow (x, +inf) == +0 for |x| < 1",
2013 FUNC(pow) (x, plus_infty), 0.0, x);
2015 x = random_greater (1.0);
2016 check_ext ("pow (x, -inf) == +0 for |x| > 1",
2017 FUNC(pow) (x, minus_infty), 0.0, x);
2019 x = random_value (-1.0, 1.0);
2020 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
2021 FUNC(pow) (x, minus_infty), x);
2023 x = random_greater (0.0);
2024 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
2025 FUNC(pow) (plus_infty, x), x);
2027 x = random_less (0.0);
2028 check_ext ("pow (+inf, y) == +0 for y < 0",
2029 FUNC(pow) (plus_infty, x), 0.0, x);
2031 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2032 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
2033 FUNC(pow) (minus_infty, x), x);
2035 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2036 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
2037 FUNC(pow) (minus_infty, x), x);
2039 x = -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
2040 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
2041 FUNC(pow) (minus_infty, x), minus_zero, x);
2043 x = ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
2044 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
2045 FUNC(pow) (minus_infty, x), 0.0, x);
2048 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2049 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
2050 FUNC(pow) (0.0, x), 0.0, x);
2052 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2053 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
2054 FUNC(pow) (minus_zero, x), minus_zero, x);
2057 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2058 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
2059 FUNC(pow) (0.0, x), 0.0, x);
2061 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2062 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
2063 FUNC(pow) (minus_zero, x), 0.0, x);
2070 check ("fdim (+0, +0) = +0", FUNC(fdim) (0, 0), 0);
2071 check ("fdim (9, 0) = 9", FUNC(fdim) (9, 0), 9);
2072 check ("fdim (0, 9) = 0", FUNC(fdim) (0, 9), 0);
2073 check ("fdim (-9, 0) = 9", FUNC(fdim) (-9, 0), 0);
2074 check ("fdim (0, -9) = 9", FUNC(fdim) (0, -9), 9);
2076 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim) (plus_infty, 9));
2077 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim) (plus_infty, -9));
2078 check ("fdim (-inf, 9) = 0", FUNC(fdim) (minus_infty, 9), 0);
2079 check ("fdim (-inf, -9) = 0", FUNC(fdim) (minus_infty, -9), 0);
2080 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim) (9, minus_infty));
2081 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim) (-9, minus_infty));
2082 check ("fdim (9, inf) = 0", FUNC(fdim) (9, plus_infty), 0);
2083 check ("fdim (-9, inf) = 0", FUNC(fdim) (-9, plus_infty), 0);
2085 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim) (0, nan_value));
2086 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim) (9, nan_value));
2087 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim) (-9, nan_value));
2088 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim) (nan_value, 9));
2089 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim) (nan_value, -9));
2090 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim) (plus_infty, nan_value));
2091 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim) (minus_infty, nan_value));
2092 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim) (nan_value, plus_infty));
2093 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim) (nan_value, minus_infty));
2094 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim) (nan_value, nan_value));
2101 check ("fmin (+0, +0) = +0", FUNC(fmin) (0, 0), 0);
2102 check ("fmin (9, 0) = 0", FUNC(fmin) (9, 0), 0);
2103 check ("fmin (0, 9) = 0", FUNC(fmin) (0, 9), 0);
2104 check ("fmin (-9, 0) = -9", FUNC(fmin) (-9, 0), -9);
2105 check ("fmin (0, -9) = -9", FUNC(fmin) (0, -9), -9);
2107 check ("fmin (+inf, 9) = 9", FUNC(fmin) (plus_infty, 9), 9);
2108 check ("fmin (9, +inf) = 9", FUNC(fmin) (9, plus_infty), 9);
2109 check ("fmin (+inf, -9) = -9", FUNC(fmin) (plus_infty, -9), -9);
2110 check ("fmin (-9, +inf) = -9", FUNC(fmin) (-9, plus_infty), -9);
2111 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin) (minus_infty, 9));
2112 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin) (minus_infty, -9));
2113 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin) (9, minus_infty));
2114 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin) (-9, minus_infty));
2116 check ("fmin (0, NaN) = 0", FUNC(fmin) (0, nan_value), 0);
2117 check ("fmin (9, NaN) = 9", FUNC(fmin) (9, nan_value), 9);
2118 check ("fmin (-9, NaN) = 9", FUNC(fmin) (-9, nan_value), -9);
2119 check ("fmin (NaN, 0) = 0", FUNC(fmin) (nan_value, 0), 0);
2120 check ("fmin (NaN, 9) = NaN", FUNC(fmin) (nan_value, 9), 9);
2121 check ("fmin (NaN, -9) = NaN", FUNC(fmin) (nan_value, -9), -9);
2122 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin) (plus_infty, nan_value));
2123 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin) (minus_infty, nan_value));
2124 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin) (nan_value, plus_infty));
2125 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin) (nan_value, minus_infty));
2126 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin) (nan_value, nan_value));
2133 check ("fmax (+0, +0) = +0", FUNC(fmax) (0, 0), 0);
2134 check ("fmax (9, 0) = 9", FUNC(fmax) (9, 0), 9);
2135 check ("fmax (0, 9) = 9", FUNC(fmax) (0, 9), 9);
2136 check ("fmax (-9, 0) = 0", FUNC(fmax) (-9, 0), 0);
2137 check ("fmax (0, -9) = 0", FUNC(fmax) (0, -9), 0);
2139 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax) (plus_infty, 9));
2140 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax) (0, plus_infty));
2141 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax) (-9, plus_infty));
2142 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax) (plus_infty, -9));
2143 check ("fmax (-inf, 9) = 9", FUNC(fmax) (minus_infty, 9), 9);
2144 check ("fmax (-inf, -9) = -9", FUNC(fmax) (minus_infty, -9), -9);
2145 check ("fmax (+9, -inf) = 9", FUNC(fmax) (9, minus_infty), 9);
2146 check ("fmax (-9, -inf) = -9", FUNC(fmax) (-9, minus_infty), -9);
2148 check ("fmax (0, NaN) = 0", FUNC(fmax) (0, nan_value), 0);
2149 check ("fmax (9, NaN) = 9", FUNC(fmax) (9, nan_value), 9);
2150 check ("fmax (-9, NaN) = 9", FUNC(fmax) (-9, nan_value), -9);
2151 check ("fmax (NaN, 0) = 0", FUNC(fmax) (nan_value, 0), 0);
2152 check ("fmax (NaN, 9) = NaN", FUNC(fmax) (nan_value, 9), 9);
2153 check ("fmax (NaN, -9) = NaN", FUNC(fmax) (nan_value, -9), -9);
2154 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax) (plus_infty, nan_value));
2155 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax) (minus_infty, nan_value));
2156 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax) (nan_value, plus_infty));
2157 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax) (nan_value, minus_infty));
2158 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax) (nan_value, nan_value));
2167 x = random_greater (0);
2168 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod) (0, x), 0, x);
2170 x = random_greater (0);
2171 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod) (minus_zero, x),
2174 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2175 FUNC(fmod) (plus_infty, x), INVALID_EXCEPTION, x);
2176 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2177 FUNC(fmod) (minus_infty, x), INVALID_EXCEPTION, x);
2178 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2179 FUNC(fmod) (x, 0), INVALID_EXCEPTION, x);
2180 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2181 FUNC(fmod) (x, minus_zero), INVALID_EXCEPTION, x);
2183 x = random_greater (0);
2184 check_ext ("fmod (x, +inf) == x for x not infinite",
2185 FUNC(fmod) (x, plus_infty), x, x);
2186 x = random_greater (0);
2187 check_ext ("fmod (x, -inf) == x for x not infinite",
2188 FUNC(fmod) (x, minus_infty), x, x);
2190 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod) (6.5, 2.3), 1.9,
2191 CHOOSE(5e-16, 1e-15, 2e-7));
2192 check_eps ("fmod (-6.5, 2.3) == -1.9", FUNC(fmod) (-6.5, 2.3), -1.9,
2193 CHOOSE(5e-16, 1e-15, 2e-7));
2194 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod) (6.5, -2.3), 1.9,
2195 CHOOSE(5e-16, 1e-15, 2e-7));
2196 check_eps ("fmod (-6.5, -2.3) == -1.9", FUNC(fmod) (-6.5, -2.3), -1.9,
2197 CHOOSE(5e-16, 1e-15, 2e-7));
2204 nextafter_test (void)
2208 check ("nextafter (+0, +0) = +0", FUNC(nextafter) (0, 0), 0);
2209 check ("nextafter (-0, +0) = +0", FUNC(nextafter) (minus_zero, 0), 0);
2210 check ("nextafter (+0, -0) = -0", FUNC(nextafter) (0, minus_zero),
2212 check ("nextafter (-0, -0) = -0", FUNC(nextafter) (minus_zero, minus_zero),
2215 check ("nextafter (9, 9) = 9", FUNC(nextafter) (9, 9), 9);
2216 check ("nextafter (-9, -9) = -9", FUNC(nextafter) (-9, -9), -9);
2217 check_isinfp ("nextafter (+inf, +inf) = +inf",
2218 FUNC(nextafter) (plus_infty, plus_infty));
2219 check_isinfn ("nextafter (-inf, -inf) = -inf",
2220 FUNC(nextafter) (minus_infty, minus_infty));
2223 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter) (nan_value, x));
2224 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter) (x, nan_value));
2225 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter) (nan_value,
2228 /* XXX We need the hexadecimal FP number representation here for further
2234 copysign_test (void)
2236 check ("copysign (0, 4) = 0", FUNC(copysign) (0, 4), 0);
2237 check ("copysign (0, -4) = -0", FUNC(copysign) (0, -4), minus_zero);
2238 check ("copysign (-0, 4) = 0", FUNC(copysign) (minus_zero, 4), 0);
2239 check ("copysign (-0, -4) = -0", FUNC(copysign) (minus_zero, -4),
2242 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign) (plus_infty, 0));
2243 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign) (plus_infty,
2245 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign) (minus_infty, 0));
2246 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign) (minus_infty,
2249 check ("copysign (0, +inf) = 0", FUNC(copysign) (0, plus_infty), 0);
2250 check ("copysign (0, -inf) = -0", FUNC(copysign) (0, minus_zero),
2252 check ("copysign (-0, +inf) = 0", FUNC(copysign) (minus_zero, plus_infty),
2254 check ("copysign (-0, -inf) = -0", FUNC(copysign) (minus_zero, minus_zero),
2257 /* XXX More correctly we would have to check the sign of the NaN. */
2258 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign) (nan_value, 0));
2259 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign) (nan_value,
2261 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign) (-nan_value, 0));
2262 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign) (-nan_value,
2270 check ("trunc(0) = 0", FUNC(trunc) (0), 0);
2271 check ("trunc(-0) = -0", FUNC(trunc) (minus_zero), minus_zero);
2272 check ("trunc(0.625) = 0", FUNC(trunc) (0.625), 0);
2273 check ("trunc(-0.625) = -0", FUNC(trunc) (-0.625), minus_zero);
2274 check ("trunc(1) = 1", FUNC(trunc) (1), 1);
2275 check ("trunc(-1) = -1", FUNC(trunc) (-1), -1);
2276 check ("trunc(1.625) = 1", FUNC(trunc) (1.625), 1);
2277 check ("trunc(-1.625) = -1", FUNC(trunc) (-1.625), -1);
2279 check ("trunc(1048580.625) = 1048580", FUNC(trunc) (1048580.625L),
2281 check ("trunc(-1048580.625) = -1048580", FUNC(trunc) (-1048580.625L),
2284 check ("trunc(8388610.125) = 8388610", FUNC(trunc) (8388610.125L),
2286 check ("trunc(-8388610.125) = -8388610", FUNC(trunc) (-8388610.125L),
2289 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc) (4294967296.625L),
2291 check ("trunc(-4294967296.625) = -4294967296",
2292 FUNC(trunc) (-4294967296.625L), -4294967296.0L);
2294 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc) (plus_infty));
2295 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc) (minus_infty));
2296 check_isnan ("trunc(NaN) = NaN", FUNC(trunc) (nan_value));
2306 /* XXX Tests fuer negative x are missing */
2307 check ("sqrt (0) == 0", FUNC(sqrt) (0), 0);
2308 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt) (nan_value));
2309 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt) (plus_infty));
2311 check ("sqrt (-0) == -0", FUNC(sqrt) (0), 0);
2313 x = random_less (0.0);
2314 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2315 FUNC(sqrt) (x), INVALID_EXCEPTION, x);
2317 x = random_value (0, 10000);
2318 check_ext ("sqrt (x*x) == x", FUNC(sqrt) (x*x), x, x);
2319 check ("sqrt (4) == 2", FUNC(sqrt) (4), 2);
2324 remainder_test (void)
2328 result = FUNC(remainder) (1, 0);
2329 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2330 result, INVALID_EXCEPTION);
2332 result = FUNC(remainder) (1, minus_zero);
2333 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2334 result, INVALID_EXCEPTION);
2336 result = FUNC(remainder) (plus_infty, 1);
2337 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2338 result, INVALID_EXCEPTION);
2340 result = FUNC(remainder) (minus_infty, 1);
2341 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2342 result, INVALID_EXCEPTION);
2344 result = FUNC(remainder) (1.625, 1.0);
2345 check ("remainder(1.625, 1.0) == -0.375", result, -0.375);
2347 result = FUNC(remainder) (-1.625, 1.0);
2348 check ("remainder(-1.625, 1.0) == 0.375", result, 0.375);
2350 result = FUNC(remainder) (1.625, -1.0);
2351 check ("remainder(1.625, -1.0) == -0.375", result, -0.375);
2353 result = FUNC(remainder) (-1.625, -1.0);
2354 check ("remainder(-1.625, -1.0) == 0.375", result, 0.375);
2356 result = FUNC(remainder) (5.0, 2.0);
2357 check ("remainder(5.0, 2.0) == 1.0", result, 1.0);
2359 result = FUNC(remainder) (3.0, 2.0);
2360 check ("remainder(3.0, 2.0) == -1.0", result, -1.0);
2370 result = FUNC(remquo) (1, 0, &quo);
2371 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2372 result, INVALID_EXCEPTION);
2374 result = FUNC(remquo) (1, minus_zero, &quo);
2375 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2376 result, INVALID_EXCEPTION);
2378 result = FUNC(remquo) (plus_infty, 1, &quo);
2379 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2380 result, INVALID_EXCEPTION);
2382 result = FUNC(remquo) (minus_infty, 1, &quo);
2383 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2384 result, INVALID_EXCEPTION);
2386 result = FUNC(remquo) (1.625, 1.0, &quo);
2387 check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
2388 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo, 2);
2390 result = FUNC(remquo) (-1.625, 1.0, &quo);
2391 check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
2392 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo, -2);
2394 result = FUNC(remquo) (1.625, -1.0, &quo);
2395 check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
2396 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo, -2);
2398 result = FUNC(remquo) (-1.625, -1.0, &quo);
2399 check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
2400 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo, 2);
2402 result = FUNC(remquo) (5.0, 2.0, &quo);
2403 check ("remquo(5.0, 2.0, &x) == 1.0", result, 1.0);
2404 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo, 2);
2406 result = FUNC(remquo) (3.0, 2.0, &quo);
2407 check ("remquo(3.0, 2.0, &x) == -1.0", result, -1.0);
2408 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo, 2);
2415 __complex__ MATHTYPE result;
2417 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, plus_zero));
2418 check ("real(cexp(0 + 0i)) = 1", __real__ result, 1);
2419 check ("imag(cexp(0 + 0i)) = 0", __imag__ result, 0);
2420 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_zero));
2421 check ("real(cexp(-0 + 0i)) = 1", __real__ result, 1);
2422 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result, 0);
2423 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, minus_zero));
2424 check ("real(cexp(0 - 0i)) = 1", __real__ result, 1);
2425 check ("imag(cexp(0 - 0i)) = -0", __imag__ result, minus_zero);
2426 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_zero));
2427 check ("real(cexp(-0 - 0i)) = 1", __real__ result, 1);
2428 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result, minus_zero);
2430 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_zero));
2431 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result);
2432 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result, 0);
2433 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_zero));
2434 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result);
2435 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result, minus_zero);
2437 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_zero));
2438 check ("real(cexp(-inf + 0i)) = 0", __real__ result, 0);
2439 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result, 0);
2440 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_zero));
2441 check ("real(cexp(-inf - 0i)) = 0", __real__ result, 0);
2442 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result, minus_zero);
2445 result = FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty));
2446 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2447 __real__ result, INVALID_EXCEPTION);
2448 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2451 #if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR <= 7
2453 printf ("The following test for cexp might fail due to a gcc compiler error!\n");
2456 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty));
2457 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2458 __real__ result, INVALID_EXCEPTION);
2459 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2461 result = FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty));
2462 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2463 __real__ result, INVALID_EXCEPTION);
2464 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2466 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty));
2467 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2468 __real__ result, INVALID_EXCEPTION);
2469 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2472 result = FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty));
2473 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2474 __real__ result, INVALID_EXCEPTION);
2475 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2477 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty));
2478 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2479 __real__ result, INVALID_EXCEPTION);
2480 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2482 result = FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty));
2483 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2484 __real__ result, INVALID_EXCEPTION);
2485 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2487 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty));
2488 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2489 __real__ result, INVALID_EXCEPTION);
2490 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result);
2492 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 2.0));
2493 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result, minus_zero);
2494 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result, 0);
2495 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 4.0));
2496 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result, minus_zero);
2497 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result, minus_zero);
2499 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 2.0));
2500 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result);
2501 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result);
2502 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 4.0));
2503 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result);
2504 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result);
2506 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty));
2507 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2508 __real__ result, INVALID_EXCEPTION);
2509 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2511 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_infty));
2512 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2513 __real__ result, INVALID_EXCEPTION);
2514 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2517 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_infty));
2518 check ("real(cexp(-inf + i inf)) = 0", __real__ result, 0);
2519 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result, 0);
2520 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_infty));
2521 check ("real(cexp(-inf - i inf)) = 0", __real__ result, 0);
2522 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result, minus_zero);
2524 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, nan_value));
2525 check ("real(cexp(-inf + i NaN)) = 0", __real__ result, 0);
2526 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result), 0);
2528 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, nan_value));
2529 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result);
2530 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result);
2532 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 0.0));
2533 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2534 __real__ result, INVALID_EXCEPTION);
2535 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2537 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
2538 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2539 __real__ result, INVALID_EXCEPTION);
2540 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2542 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
2543 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2544 __real__ result, INVALID_EXCEPTION);
2545 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2548 result = FUNC(cexp) (BUILD_COMPLEX (0, nan_value));
2549 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2550 __real__ result, INVALID_EXCEPTION);
2551 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2553 result = FUNC(cexp) (BUILD_COMPLEX (1, nan_value));
2554 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2555 __real__ result, INVALID_EXCEPTION);
2556 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2559 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
2560 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
2561 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
2568 __complex__ MATHTYPE result;
2570 result = FUNC(csin) (BUILD_COMPLEX (0.0, 0.0));
2571 check ("real(csin(0 + 0i)) = 0", __real__ result, 0);
2572 check ("imag(csin(0 + 0i)) = 0", __imag__ result, 0);
2573 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, 0.0));
2574 check ("real(csin(-0 + 0i)) = -0", __real__ result, minus_zero);
2575 check ("imag(csin(-0 + 0i)) = 0", __imag__ result, 0);
2576 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_zero));
2577 check ("real(csin(0 - 0i)) = 0", __real__ result, 0);
2578 check ("imag(csin(0 - 0i)) = -0", __imag__ result, minus_zero);
2579 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_zero));
2580 check ("real(csin(-0 - 0i)) = -0", __real__ result, minus_zero);
2581 check ("imag(csin(-0 - 0i)) = -0", __imag__ result, minus_zero);
2583 result = FUNC(csin) (BUILD_COMPLEX (0.0, plus_infty));
2584 check ("real(csin(0 + i Inf)) = 0", __real__ result, 0);
2585 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result);
2586 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, plus_infty));
2587 check ("real(csin(-0 + i Inf)) = -0", __real__ result, minus_zero);
2588 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result);
2589 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_infty));
2590 check ("real(csin(0 - i Inf)) = 0", __real__ result, 0);
2591 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result);
2592 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_infty));
2593 check ("real(csin(-0 - i Inf)) = -0", __real__ result, minus_zero);
2594 check_isinfn("imag(csin(-0 - i Inf)) = -Inf", __imag__ result);
2596 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 0.0));
2597 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2598 __real__ result, INVALID_EXCEPTION);
2599 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2600 FUNC(fabs) (__imag__ result), 0);
2601 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 0.0));
2602 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2603 __real__ result, INVALID_EXCEPTION);
2604 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2605 FUNC(fabs) (__imag__ result), 0);
2606 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_zero));
2607 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2608 __real__ result, INVALID_EXCEPTION);
2609 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2610 FUNC(fabs) (__imag__ result), 0.0);
2611 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_zero));
2612 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2613 __real__ result, INVALID_EXCEPTION);
2614 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2615 FUNC(fabs) (__imag__ result), 0.0);
2617 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, plus_infty));
2618 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2619 __real__ result, INVALID_EXCEPTION);
2620 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2621 FUNC(fabs) (__imag__ result));
2622 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, plus_infty));
2623 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2624 __real__ result, INVALID_EXCEPTION);
2625 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2626 FUNC(fabs) (__imag__ result));
2627 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_infty));
2628 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2629 __real__ result, INVALID_EXCEPTION);
2630 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2631 FUNC(fabs) (__imag__ result));
2632 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_infty));
2633 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2634 __real__ result, INVALID_EXCEPTION);
2635 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2636 FUNC(fabs) (__imag__ result));
2638 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 6.75));
2639 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2640 __real__ result, INVALID_EXCEPTION);
2641 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2643 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, -6.75));
2644 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2645 __real__ result, INVALID_EXCEPTION);
2646 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2648 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 6.75));
2649 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2650 __real__ result, INVALID_EXCEPTION);
2651 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2653 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, -6.75));
2654 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2655 __real__ result, INVALID_EXCEPTION);
2656 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2659 result = FUNC(csin) (BUILD_COMPLEX (4.625, plus_infty));
2660 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result);
2661 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result);
2662 result = FUNC(csin) (BUILD_COMPLEX (4.625, minus_infty));
2663 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result);
2664 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result);
2665 result = FUNC(csin) (BUILD_COMPLEX (-4.625, plus_infty));
2666 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result);
2667 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result);
2668 result = FUNC(csin) (BUILD_COMPLEX (-4.625, minus_infty));
2669 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result);
2670 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result);
2672 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 0.0));
2673 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result);
2674 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2675 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_zero));
2676 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result);
2677 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2679 result = FUNC(csin) (BUILD_COMPLEX (nan_value, plus_infty));
2680 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result);
2681 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2682 FUNC(fabs) (__imag__ result));
2683 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_infty));
2684 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result);
2685 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2686 FUNC(fabs) (__imag__ result));
2688 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 9.0));
2689 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2690 __real__ result, INVALID_EXCEPTION);
2691 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2693 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -9.0));
2694 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2695 __real__ result, INVALID_EXCEPTION);
2696 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2699 result = FUNC(csin) (BUILD_COMPLEX (0.0, nan_value));
2700 check ("real(csin(0 + i NaN))", __real__ result, 0.0);
2701 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result);
2702 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, nan_value));
2703 check ("real(csin(-0 + i NaN)) = -0", __real__ result, minus_zero);
2704 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result);
2706 result = FUNC(csin) (BUILD_COMPLEX (10.0, nan_value));
2707 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2708 __real__ result, INVALID_EXCEPTION);
2709 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2711 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -10.0));
2712 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2713 __real__ result, INVALID_EXCEPTION);
2714 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2717 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, nan_value));
2718 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2719 __real__ result, INVALID_EXCEPTION);
2720 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2722 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, nan_value));
2723 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2724 __real__ result, INVALID_EXCEPTION);
2725 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2728 result = FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value));
2729 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result);
2730 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result);
2737 __complex__ MATHTYPE result;
2739 result = FUNC(csinh) (BUILD_COMPLEX (0.0, 0.0));
2740 check ("real(csinh(0 + 0i)) = 0", __real__ result, 0);
2741 check ("imag(csinh(0 + 0i)) = 0", __imag__ result, 0);
2742 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, 0.0));
2743 check ("real(csinh(-0 + 0i)) = -0", __real__ result, minus_zero);
2744 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result, 0);
2745 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_zero));
2746 check ("real(csinh(0 - 0i)) = 0", __real__ result, 0);
2747 check ("imag(csinh(0 - 0i)) = -0", __imag__ result, minus_zero);
2748 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_zero));
2749 check ("real(csinh(-0 - 0i)) = -0", __real__ result, minus_zero);
2750 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero);
2752 result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
2753 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2754 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2755 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2757 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
2758 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2759 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2760 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2762 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
2763 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2764 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2765 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2767 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
2768 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2769 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2770 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2773 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0));
2774 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result);
2775 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result, 0);
2776 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 0.0));
2777 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result);
2778 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result, 0);
2779 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_zero));
2780 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result);
2781 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
2782 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_zero));
2783 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result);
2784 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result, minus_zero);
2786 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty));
2787 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2788 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2789 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2791 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty));
2792 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2793 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2794 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2796 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty));
2797 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2798 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2799 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2801 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
2802 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2803 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2804 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2807 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 4.625));
2808 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result);
2809 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result);
2810 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 4.625));
2811 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result);
2812 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result);
2813 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, -4.625));
2814 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result);
2815 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result);
2816 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, -4.625));
2817 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result);
2818 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result);
2820 result = FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty));
2821 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2822 __real__ result, INVALID_EXCEPTION);
2823 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2825 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty));
2826 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2827 __real__ result, INVALID_EXCEPTION);
2828 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2830 result = FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty));
2831 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2832 __real__ result, INVALID_EXCEPTION);
2833 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2835 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty));
2836 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2837 __real__ result, INVALID_EXCEPTION);
2838 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2841 result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value));
2842 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2843 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result);
2844 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value));
2845 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2846 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
2848 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value));
2849 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
2850 FUNC(fabs) (__real__ result));
2851 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result);
2852 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value));
2853 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
2854 FUNC(fabs) (__real__ result));
2855 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result);
2857 result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
2858 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2859 __real__ result, INVALID_EXCEPTION);
2860 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2862 result = FUNC(csinh) (BUILD_COMPLEX (-9.0, nan_value));
2863 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2864 __real__ result, INVALID_EXCEPTION);
2865 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2868 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0));
2869 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result);
2870 check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0);
2871 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero));
2872 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result);
2873 check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero);
2875 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
2876 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2877 __real__ result, INVALID_EXCEPTION);
2878 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2880 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0));
2881 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2882 __real__ result, INVALID_EXCEPTION);
2883 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2886 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty));
2887 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2888 __real__ result, INVALID_EXCEPTION);
2889 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2891 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty));
2892 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2893 __real__ result, INVALID_EXCEPTION);
2894 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2897 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value));
2898 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result);
2899 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result);
2906 __complex__ MATHTYPE result;
2908 result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0));
2909 check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0);
2910 check ("imag(ccos(0 + 0i)) = -0", __imag__ result, minus_zero);
2911 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0));
2912 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0);
2913 check ("imag(ccos(-0 + 0i)) = 0", __imag__ result, 0.0);
2914 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero));
2915 check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0);
2916 check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0);
2917 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero));
2918 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0);
2919 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero);
2921 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
2922 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
2923 __real__ result, INVALID_EXCEPTION);
2924 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
2925 FUNC(fabs) (__imag__ result), 0);
2926 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
2927 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
2928 __real__ result, INVALID_EXCEPTION);
2929 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
2930 FUNC(fabs) (__imag__ result), 0);
2931 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
2932 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
2933 __real__ result, INVALID_EXCEPTION);
2934 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
2935 FUNC(fabs) (__imag__ result), 0);
2936 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
2937 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
2938 __real__ result, INVALID_EXCEPTION);
2939 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
2940 FUNC(fabs) (__imag__ result), 0);
2942 result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty));
2943 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result);
2944 check ("imag(ccos(0 + i Inf)) = -0", __imag__ result, minus_zero);
2945 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty));
2946 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result);
2947 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0);
2948 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty));
2949 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result);
2950 check ("imag(ccos(-0 + i Inf)) = 0", __imag__ result, 0.0);
2951 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty));
2952 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result);
2953 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero);
2955 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
2956 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
2957 __real__ result, INVALID_EXCEPTION);
2958 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
2960 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
2961 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
2962 __real__ result, INVALID_EXCEPTION);
2963 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
2965 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
2966 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
2967 __real__ result, INVALID_EXCEPTION);
2968 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
2970 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
2971 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
2972 __real__ result, INVALID_EXCEPTION);
2973 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
2976 result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty));
2977 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result);
2978 check_isinfp ("imag(ccos(4.625 + i Inf)) = +Inf", __imag__ result);
2979 result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty));
2980 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result);
2981 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result);
2982 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty));
2983 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result);
2984 check_isinfn ("imag(ccos(-4.625 + i Inf)) = -Inf", __imag__ result);
2985 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty));
2986 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result);
2987 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result);
2989 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
2990 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2991 __real__ result, INVALID_EXCEPTION);
2992 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2994 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
2995 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2996 __real__ result, INVALID_EXCEPTION);
2997 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2999 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
3000 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3001 __real__ result, INVALID_EXCEPTION);
3002 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3004 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
3005 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3006 __real__ result, INVALID_EXCEPTION);
3007 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3010 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0));
3011 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result);
3012 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3013 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero));
3014 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result);
3015 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3017 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty));
3018 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result);
3019 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result);
3020 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty));
3021 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result);
3022 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result);
3024 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
3025 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3026 __real__ result, INVALID_EXCEPTION);
3027 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3029 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
3030 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3031 __real__ result, INVALID_EXCEPTION);
3032 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3035 result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value));
3036 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result);
3037 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3038 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value));
3039 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result);
3040 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3042 result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
3043 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3044 __real__ result, INVALID_EXCEPTION);
3045 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3047 result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
3048 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3049 __real__ result, INVALID_EXCEPTION);
3050 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3053 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
3054 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3055 __real__ result, INVALID_EXCEPTION);
3056 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3058 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
3059 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3060 __real__ result, INVALID_EXCEPTION);
3061 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3064 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
3065 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
3066 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
3073 __complex__ MATHTYPE result;
3075 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0));
3076 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0);
3077 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0);
3078 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0));
3079 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0);
3080 check ("imag(ccosh(-0 + 0i)) = -0", __imag__ result, minus_zero);
3081 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero));
3082 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0);
3083 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero);
3084 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero));
3085 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0);
3086 check ("imag(ccosh(-0 - 0i)) = 0", __imag__ result, 0.0);
3088 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
3089 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
3090 __real__ result, INVALID_EXCEPTION);
3091 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
3092 FUNC(fabs) (__imag__ result), 0);
3093 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
3094 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
3095 __real__ result, INVALID_EXCEPTION);
3096 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
3097 FUNC(fabs) (__imag__ result), 0);
3098 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
3099 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
3100 __real__ result, INVALID_EXCEPTION);
3101 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
3102 FUNC(fabs) (__imag__ result), 0);
3103 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
3104 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
3105 __real__ result, INVALID_EXCEPTION);
3106 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
3107 FUNC(fabs) (__imag__ result), 0);
3109 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0));
3110 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result);
3111 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result, 0);
3112 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 0.0));
3113 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result);
3114 check ("imag(ccosh(-Inf + 0i)) = -0", __imag__ result, minus_zero);
3115 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_zero));
3116 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result);
3117 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
3118 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_zero));
3119 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result);
3120 check ("imag(ccosh(-Inf - 0i)) = 0", __imag__ result, 0.0);
3122 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty));
3123 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
3124 __real__ result, INVALID_EXCEPTION);
3125 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
3127 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty));
3128 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
3129 __real__ result, INVALID_EXCEPTION);
3130 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
3132 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty));
3133 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
3134 __real__ result, INVALID_EXCEPTION);
3135 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
3137 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty));
3138 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
3139 __real__ result, INVALID_EXCEPTION);
3140 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3143 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 4.625));
3144 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result);
3145 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result);
3146 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 4.625));
3147 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result);
3148 check_isinfp ("imag(ccosh(-Inf + i4.625)) = Inf", __imag__ result);
3149 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, -4.625));
3150 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result);
3151 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result);
3152 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, -4.625));
3153 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result);
3154 check_isinfn ("imag(ccosh(-Inf - i4.625)) = -Inf", __imag__ result);
3156 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty));
3157 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3158 __real__ result, INVALID_EXCEPTION);
3159 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3161 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty));
3162 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3163 __real__ result, INVALID_EXCEPTION);
3164 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3166 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty));
3167 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3168 __real__ result, INVALID_EXCEPTION);
3169 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3171 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty));
3172 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3173 __real__ result, INVALID_EXCEPTION);
3174 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3177 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, nan_value));
3178 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result);
3179 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3180 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, nan_value));
3181 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result);
3182 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3184 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, nan_value));
3185 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result);
3186 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result);
3187 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value));
3188 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result);
3189 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result);
3191 result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
3192 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3193 __real__ result, INVALID_EXCEPTION);
3194 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3196 result = FUNC(ccosh) (BUILD_COMPLEX (-9.0, nan_value));
3197 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3198 __real__ result, INVALID_EXCEPTION);
3199 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3202 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0));
3203 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result);
3204 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3205 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero));
3206 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result);
3207 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3209 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
3210 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3211 __real__ result, INVALID_EXCEPTION);
3212 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3214 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0));
3215 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3216 __real__ result, INVALID_EXCEPTION);
3217 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3220 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty));
3221 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3222 __real__ result, INVALID_EXCEPTION);
3223 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3225 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty));
3226 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3227 __real__ result, INVALID_EXCEPTION);
3228 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3231 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value));
3232 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result);
3233 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result);
3240 __complex__ MATHTYPE result;
3242 result = FUNC(cacos) (BUILD_COMPLEX (0, 0));
3243 check ("real(cacos(0 + i0)) = pi/2", __real__ result, M_PI_2);
3244 check ("imag(cacos(0 + i0)) = -0", __imag__ result, minus_zero);
3245 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, 0));
3246 check ("real(cacos(-0 + i0)) = pi/2", __real__ result, M_PI_2);
3247 check ("imag(cacos(-0 + i0)) = -0", __imag__ result, minus_zero);
3248 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_zero));
3249 check ("real(cacos(0 - i0)) = pi/2", __real__ result, M_PI_2);
3250 check ("imag(cacos(0 - i0)) = 0", __imag__ result, 0);
3251 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, minus_zero));
3252 check ("real(cacos(-0 - i0)) = pi/2", __real__ result, M_PI_2);
3253 check ("imag(cacos(-0 - i0)) = 0", __imag__ result, 0);
3255 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, plus_infty));
3256 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4);
3257 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result);
3258 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_infty));
3259 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4);
3260 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result);
3262 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, plus_infty));
3263 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
3264 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result);
3265 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_infty));
3266 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
3267 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result);
3269 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, plus_infty));
3270 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3271 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result);
3272 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, minus_infty));
3273 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3274 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result);
3275 result = FUNC(cacos) (BUILD_COMPLEX (0, plus_infty));
3276 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3277 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result);
3278 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_infty));
3279 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3280 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result);
3281 result = FUNC(cacos) (BUILD_COMPLEX (0.1, plus_infty));
3282 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result, M_PI_2);
3283 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result);
3284 result = FUNC(cacos) (BUILD_COMPLEX (0.1, minus_infty));
3285 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result, M_PI_2);
3286 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result);
3288 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 0));
3289 check ("real(cacos(-Inf + i0)) = pi", __real__ result, M_PI);
3290 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result);
3291 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_zero));
3292 check ("real(cacos(-Inf - i0)) = pi", __real__ result, M_PI);
3293 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result);
3294 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 100));
3295 check ("real(cacos(-Inf + i100)) = pi", __real__ result, M_PI);
3296 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result);
3297 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, -100));
3298 check ("real(cacos(-Inf - i100)) = pi", __real__ result, M_PI);
3299 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result);
3301 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0));
3302 check ("real(cacos(+Inf + i0)) = 0", __real__ result, 0);
3303 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result);
3304 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_zero));
3305 check ("real(cacos(+Inf - i0)) = 0", __real__ result, 0);
3306 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result);
3307 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0.5));
3308 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result, 0);
3309 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result);
3310 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, -0.5));
3311 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result, 0);
3312 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result);
3314 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, nan_value));
3315 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result);
3316 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3317 FUNC(fabs) (__imag__ result));
3318 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, nan_value));
3319 check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result);
3320 check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf",
3321 FUNC(fabs) (__imag__ result));
3323 result = FUNC(cacos) (BUILD_COMPLEX (0, nan_value));
3324 check ("real(cacos(0 + i NaN)) = pi/2", __real__ result, M_PI_2);
3325 check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result);
3326 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, nan_value));
3327 check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result, M_PI_2);
3328 check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result);
3330 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, plus_infty));
3331 check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result);
3332 check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result);
3333 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, minus_infty));
3334 check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result);
3335 check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result);
3337 result = FUNC(cacos) (BUILD_COMPLEX (10.5, nan_value));
3338 check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3339 __real__ result, INVALID_EXCEPTION);
3340 check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3342 result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
3343 check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3344 __real__ result, INVALID_EXCEPTION);
3345 check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3348 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, 0.75));
3349 check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3350 __real__ result, INVALID_EXCEPTION);
3351 check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3353 result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
3354 check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3355 __real__ result, INVALID_EXCEPTION);
3356 check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3359 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, nan_value));
3360 check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result);
3361 check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result);
3368 __complex__ MATHTYPE result;
3370 result = FUNC(cacosh) (BUILD_COMPLEX (0, 0));
3371 check ("real(cacosh(0 + i0)) = 0", __real__ result, 0);
3372 check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result, M_PI_2);
3373 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, 0));
3374 check ("real(cacosh(-0 + i0)) = 0", __real__ result, 0);
3375 check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result, M_PI_2);
3376 result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_zero));
3377 check ("real(cacosh(0 - i0)) = 0", __real__ result, 0);
3378 check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result, -M_PI_2);
3379 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, minus_zero));
3380 check ("real(cacosh(-0 - i0)) = 0", __real__ result, 0);
3381 check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result, -M_PI_2);
3383 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, plus_infty));
3384 check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result);
3385 check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result,
3387 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_infty));
3388 check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result);
3389 check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result,
3392 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, plus_infty));
3393 check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result);
3394 check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3395 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_infty));
3396 check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result);
3397 check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3399 result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, plus_infty));
3400 check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result);
3401 check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3402 result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, minus_infty));
3403 check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result);
3404 check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3405 result = FUNC(cacosh) (BUILD_COMPLEX (0, plus_infty));
3406 check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result);
3407 check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3408 result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_infty));
3409 check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result);
3410 check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3411 result = FUNC(cacosh) (BUILD_COMPLEX (0.1, plus_infty));
3412 check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result);
3413 check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3414 result = FUNC(cacosh) (BUILD_COMPLEX (0.1, minus_infty));
3415 check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result);
3416 check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3418 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 0));
3419 check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result);
3420 check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result, M_PI);
3421 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_zero));
3422 check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result);
3423 check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result, -M_PI);
3424 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 100));
3425 check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result);
3426 check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result, M_PI);
3427 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, -100));
3428 check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result);
3429 check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result, -M_PI);
3431 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0));
3432 check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result);
3433 check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result, 0);
3434 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_zero));
3435 check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result);
3436 check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result, minus_zero);
3437 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0.5));
3438 check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result);
3439 check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result, 0);
3440 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, -0.5));
3441 check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result);
3442 check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result, minus_zero);
3444 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, nan_value));
3445 check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result);
3446 check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result);
3447 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, nan_value));
3448 check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result);
3449 check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result);
3451 result = FUNC(cacosh) (BUILD_COMPLEX (0, nan_value));
3452 check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result);
3453 check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result);
3454 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, nan_value));
3455 check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result);
3456 check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result);
3458 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, plus_infty));
3459 check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result);
3460 check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result);
3461 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, minus_infty));
3462 check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result);
3463 check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result);
3465 result = FUNC(cacosh) (BUILD_COMPLEX (10.5, nan_value));
3466 check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3467 __real__ result, INVALID_EXCEPTION);
3468 check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3470 result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
3471 check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3472 __real__ result, INVALID_EXCEPTION);
3473 check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3476 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, 0.75));
3477 check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3478 __real__ result, INVALID_EXCEPTION);
3479 check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3481 result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
3482 check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3483 __real__ result, INVALID_EXCEPTION);
3484 check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3487 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, nan_value));
3488 check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result);
3489 check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result);
3496 __complex__ MATHTYPE result;
3498 result = FUNC(casin) (BUILD_COMPLEX (0, 0));
3499 check ("real(casin(0 + i0)) = 0", __real__ result, 0);
3500 check ("imag(casin(0 + i0)) = 0", __imag__ result, 0);
3501 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, 0));
3502 check ("real(casin(-0 + i0)) = -0", __real__ result, minus_zero);
3503 check ("imag(casin(-0 + i0)) = 0", __imag__ result, 0);
3504 result = FUNC(casin) (BUILD_COMPLEX (0, minus_zero));
3505 check ("real(casin(0 - i0)) = 0", __real__ result, 0);
3506 check ("imag(casin(0 - i0)) = -0", __imag__ result, minus_zero);
3507 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero));
3508 check ("real(casin(-0 - i0)) = -0", __real__ result, minus_zero);
3509 check ("imag(casin(-0 - i0)) = -0", __imag__ result, minus_zero);
3511 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty));
3512 check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
3513 check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result);
3514 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty));
3515 check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
3516 check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result);
3517 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty));
3518 check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result, -M_PI_4);
3519 check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result);
3520 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty));
3521 check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result, -M_PI_4);
3522 check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result);
3524 result = FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty));
3525 check ("real(casin(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
3526 check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result);
3527 result = FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty));
3528 check ("real(casin(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
3529 check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result);
3530 result = FUNC(casin) (BUILD_COMPLEX (0, plus_infty));
3531 check ("real(casin(0 + i Inf)) = 0", __real__ result, 0.0);
3532 check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result);
3533 result = FUNC(casin) (BUILD_COMPLEX (0, minus_infty));
3534 check ("real(casin(0 - i Inf)) = 0", __real__ result, 0.0);
3535 check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result);
3536 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty));
3537 check ("real(casin(-0 + i Inf)) = -0", __real__ result, minus_zero);
3538 check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result);
3539 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty));
3540 check ("real(casin(-0 - i Inf)) = -0", __real__ result, minus_zero);
3541 check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result);
3542 result = FUNC(casin) (BUILD_COMPLEX (0.1, plus_infty));
3543 check ("real(casin(0.1 + i Inf)) = 0", __real__ result, 0);
3544 check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result);
3545 result = FUNC(casin) (BUILD_COMPLEX (0.1, minus_infty));
3546 check ("real(casin(0.1 - i Inf)) = 0", __real__ result, 0);
3547 check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result);
3549 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 0));
3550 check ("real(casin(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
3551 check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result);
3552 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero));
3553 check ("real(casin(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
3554 check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result);
3555 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 100));
3556 check ("real(casin(-Inf + i100)) = -pi/2", __real__ result, -M_PI_2);
3557 check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result);
3558 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, -100));
3559 check ("real(casin(-Inf - i100)) = -pi/2", __real__ result, -M_PI_2);
3560 check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result);
3562 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0));
3563 check ("real(casin(+Inf + i0)) = pi/2", __real__ result, M_PI_2);
3564 check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result);
3565 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero));
3566 check ("real(casin(+Inf - i0)) = pi/2", __real__ result, M_PI_2);
3567 check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result);
3568 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5));
3569 check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result, M_PI_2);
3570 check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result);
3571 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5));
3572 check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result, M_PI_2);
3573 check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result);
3575 result = FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty));
3576 check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result);
3577 check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result);
3578 result = FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty));
3579 check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result);
3580 check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result);
3582 result = FUNC(casin) (BUILD_COMPLEX (0.0, nan_value));
3583 check ("real(casin(0 + i NaN)) = 0", __real__ result, 0.0);
3584 check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result);
3585 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value));
3586 check ("real(casin(-0 + i NaN)) = -0", __real__ result, minus_zero);
3587 check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result);
3589 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value));
3590 check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result);
3591 check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
3592 FUNC(fabs) (__imag__ result));
3593 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value));
3594 check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result);
3595 check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
3596 FUNC(fabs) (__imag__ result));
3598 result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5));
3599 check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3600 __real__ result, INVALID_EXCEPTION);
3601 check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3603 result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5));
3604 check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3605 __real__ result, INVALID_EXCEPTION);
3606 check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3609 result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value));
3610 check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3611 __real__ result, INVALID_EXCEPTION);
3612 check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3614 result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value));
3615 check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3616 __real__ result, INVALID_EXCEPTION);
3617 check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3620 result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value));
3621 check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result);
3622 check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result);
3629 __complex__ MATHTYPE result;
3631 result = FUNC(casinh) (BUILD_COMPLEX (0, 0));
3632 check ("real(casinh(0 + i0)) = 0", __real__ result, 0);
3633 check ("imag(casinh(0 + i0)) = 0", __imag__ result, 0);
3634 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, 0));
3635 check ("real(casinh(-0 + i0)) = -0", __real__ result, minus_zero);
3636 check ("imag(casinh(-0 + i0)) = 0", __imag__ result, 0);
3637 result = FUNC(casinh) (BUILD_COMPLEX (0, minus_zero));
3638 check ("real(casinh(0 - i0)) = 0", __real__ result, 0);
3639 check ("imag(casinh(0 - i0)) = -0", __imag__ result, minus_zero);
3640 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_zero));
3641 check ("real(casinh(-0 - i0)) = -0", __real__ result, minus_zero);
3642 check ("imag(casinh(-0 - i0)) = -0", __imag__ result, minus_zero);
3644 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, plus_infty));
3645 check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result);
3646 check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3647 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_infty));
3648 check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result);
3649 check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3650 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, plus_infty));
3651 check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result);
3652 check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3653 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_infty));
3654 check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result);
3655 check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3657 result = FUNC(casinh) (BUILD_COMPLEX (-10.0, plus_infty));
3658 check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result);
3659 check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3660 result = FUNC(casinh) (BUILD_COMPLEX (-10.0, minus_infty));
3661 check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result);
3662 check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3663 result = FUNC(casinh) (BUILD_COMPLEX (0, plus_infty));
3664 check_isinfp ("real(casinh(0 + i Inf)) = +Inf", __real__ result);
3665 check ("imag(casinh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3666 result = FUNC(casinh) (BUILD_COMPLEX (0, minus_infty));
3667 check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result);
3668 check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3669 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty));
3670 check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result);
3671 check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3672 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty));
3673 check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result);
3674 check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3675 result = FUNC(casinh) (BUILD_COMPLEX (0.1, plus_infty));
3676 check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result);
3677 check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3678 result = FUNC(casinh) (BUILD_COMPLEX (0.1, minus_infty));
3679 check_isinfp ("real(casinh(0.1 - i Inf)) = +Inf", __real__ result);
3680 check ("imag(casinh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3682 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 0));
3683 check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result);
3684 check ("imag(casinh(-Inf + i0)) = 0", __imag__ result, 0);
3685 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_zero));
3686 check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result);
3687 check ("imag(casinh(-Inf - i0)) = -0", __imag__ result, minus_zero);
3688 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 100));
3689 check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result);
3690 check ("imag(casinh(-Inf + i100)) = 0", __imag__ result, 0);
3691 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, -100));
3692 check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result);
3693 check ("imag(casinh(-Inf - i100)) = -0", __imag__ result, minus_zero);
3695 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0));
3696 check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result);
3697 check ("imag(casinh(+Inf + i0)) = 0", __imag__ result, 0);
3698 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_zero));
3699 check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result);
3700 check ("imag(casinh(+Inf - i0)) = -0", __imag__ result, minus_zero);
3701 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0.5));
3702 check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result);
3703 check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result, 0);
3704 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, -0.5));
3705 check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result);
3706 check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result, minus_zero);
3708 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, nan_value));
3709 check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result);
3710 check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result);
3711 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, nan_value));
3712 check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result);
3713 check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result);
3715 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0));
3716 check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result);
3717 check ("imag(casinh(NaN + i0)) = 0", __imag__ result, 0);
3718 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero));
3719 check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result);
3720 check ("imag(casinh(NaN - i0)) = -0", __imag__ result, minus_zero);
3722 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty));
3723 check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
3724 FUNC(fabs) (__real__ result));
3725 check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result);
3726 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty));
3727 check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
3728 FUNC(fabs) (__real__ result));
3729 check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result);
3731 result = FUNC(casinh) (BUILD_COMPLEX (10.5, nan_value));
3732 check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3733 __real__ result, INVALID_EXCEPTION);
3734 check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3736 result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value));
3737 check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3738 __real__ result, INVALID_EXCEPTION);
3739 check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3742 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75));
3743 check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3744 __real__ result, INVALID_EXCEPTION);
3745 check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3747 result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value));
3748 check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3749 __real__ result, INVALID_EXCEPTION);
3750 check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3753 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, nan_value));
3754 check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result);
3755 check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result);
3762 __complex__ MATHTYPE result;
3764 result = FUNC(catan) (BUILD_COMPLEX (0, 0));
3765 check ("real(catan(0 + i0)) = 0", __real__ result, 0);
3766 check ("imag(catan(0 + i0)) = 0", __imag__ result, 0);
3767 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, 0));
3768 check ("real(catan(-0 + i0)) = -0", __real__ result, minus_zero);
3769 check ("imag(catan(-0 + i0)) = 0", __imag__ result, 0);
3770 result = FUNC(catan) (BUILD_COMPLEX (0, minus_zero));
3771 check ("real(catan(0 - i0)) = 0", __real__ result, 0);
3772 check ("imag(catan(0 - i0)) = -0", __imag__ result, minus_zero);
3773 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero));
3774 check ("real(catan(-0 - i0)) = -0", __real__ result, minus_zero);
3775 check ("imag(catan(-0 - i0)) = -0", __imag__ result, minus_zero);
3777 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty));
3778 check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result, M_PI_2);
3779 check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result, 0);
3780 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty));
3781 check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result, M_PI_2);
3782 check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result, minus_zero);
3783 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty));
3784 check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3785 check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result, 0.0);
3786 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty));
3787 check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3788 check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result, minus_zero);
3790 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0));
3791 check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result, M_PI_2);
3792 check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result, minus_zero);
3793 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, -10.0));
3794 check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result, -M_PI_2);
3795 check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result, minus_zero);
3796 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_zero));
3797 check ("real(catan(Inf - i0)) = pi/2", __real__ result, M_PI_2);
3798 check ("imag(catan(Inf - i0)) = -0", __imag__ result, minus_zero);
3799 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_zero));
3800 check ("real(catan(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
3801 check ("imag(catan(-Inf - i0)) = -0", __imag__ result, minus_zero);
3802 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.0));
3803 check ("real(catan(Inf + i0)) = pi/2", __real__ result, M_PI_2);
3804 check ("imag(catan(Inf + i0)) = 0", __imag__ result, 0.0);
3805 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.0));
3806 check ("real(catan(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
3807 check ("imag(catan(-Inf + i0)) = 0", __imag__ result, 0.0);
3808 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.1));
3809 check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result, M_PI_2);
3810 check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result, 0);
3811 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.1));
3812 check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result, -M_PI_2);
3813 check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result, 0);
3815 result = FUNC(catan) (BUILD_COMPLEX (0.0, minus_infty));
3816 check ("real(catan(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3817 check ("imag(catan(0 - i Inf)) = -0", __imag__ result, minus_zero);
3818 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_infty));
3819 check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3820 check ("imag(catan(-0 - i Inf)) = -0", __imag__ result, minus_zero);
3821 result = FUNC(catan) (BUILD_COMPLEX (100.0, minus_infty));
3822 check ("real(catan(100 - i Inf)) = pi/2", __real__ result, M_PI_2);
3823 check ("imag(catan(100 - i Inf)) = -0", __imag__ result, minus_zero);
3824 result = FUNC(catan) (BUILD_COMPLEX (-100.0, minus_infty));
3825 check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3826 check ("imag(catan(-100 - i Inf)) = -0", __imag__ result, minus_zero);
3828 result = FUNC(catan) (BUILD_COMPLEX (0.0, plus_infty));
3829 check ("real(catan(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3830 check ("imag(catan(0 + i Inf)) = 0", __imag__ result, 0);
3831 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, plus_infty));
3832 check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3833 check ("imag(catan(-0 + i Inf)) = 0", __imag__ result, 0);
3834 result = FUNC(catan) (BUILD_COMPLEX (0.5, plus_infty));
3835 check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result, M_PI_2);
3836 check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result, 0);
3837 result = FUNC(catan) (BUILD_COMPLEX (-0.5, plus_infty));
3838 check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3839 check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result, 0);
3841 result = FUNC(catan) (BUILD_COMPLEX (nan_value, 0.0));
3842 check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result);
3843 check ("imag(catan(NaN + i0)) = 0", __imag__ result, 0.0);
3844 result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_zero));
3845 check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result);
3846 check ("imag(catan(NaN - i0)) = -0", __imag__ result, minus_zero);
3848 result = FUNC(catan) (BUILD_COMPLEX (nan_value, plus_infty));
3849 check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result);
3850 check ("imag(catan(NaN + i Inf)) = 0", __imag__ result, 0);
3851 result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_infty));
3852 check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result);
3853 check ("imag(catan(NaN - i Inf)) = -0", __imag__ result, minus_zero);
3855 result = FUNC(catan) (BUILD_COMPLEX (0.0, nan_value));
3856 check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result);
3857 check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result);
3858 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, nan_value));
3859 check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result);
3860 check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result);
3862 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, nan_value));
3863 check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result, M_PI_2);
3864 check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3865 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, nan_value));
3866 check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result, -M_PI_2);
3867 check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3869 result = FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5));
3870 check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3871 __real__ result, INVALID_EXCEPTION);
3872 check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3874 result = FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5));
3875 check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3876 __real__ result, INVALID_EXCEPTION);
3877 check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3880 result = FUNC(catan) (BUILD_COMPLEX (0.75, nan_value));
3881 check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3882 __real__ result, INVALID_EXCEPTION);
3883 check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3885 result = FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value));
3886 check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3887 __real__ result, INVALID_EXCEPTION);
3888 check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3891 result = FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value));
3892 check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result);
3893 check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result);
3900 __complex__ MATHTYPE result;
3902 result = FUNC(catanh) (BUILD_COMPLEX (0, 0));
3903 check ("real(catanh(0 + i0)) = 0", __real__ result, 0);
3904 check ("imag(catanh(0 + i0)) = 0", __imag__ result, 0);
3905 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, 0));
3906 check ("real(catanh(-0 + i0)) = -0", __real__ result, minus_zero);
3907 check ("imag(catanh(-0 + i0)) = 0", __imag__ result, 0);
3908 result = FUNC(catanh) (BUILD_COMPLEX (0, minus_zero));
3909 check ("real(catanh(0 - i0)) = 0", __real__ result, 0);
3910 check ("imag(catanh(0 - i0)) = -0", __imag__ result, minus_zero);
3911 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_zero));
3912 check ("real(catanh(-0 - i0)) = -0", __real__ result, minus_zero);
3913 check ("imag(catanh(-0 - i0)) = -0", __imag__ result, minus_zero);
3915 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, plus_infty));
3916 check ("real(catanh(+Inf + i Inf)) = 0", __real__ result, 0);
3917 check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result, M_PI_2);
3918 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_infty));
3919 check ("real(catanh(+Inf - i Inf)) = 0", __real__ result, 0);
3920 check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3921 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, plus_infty));
3922 check ("real(catanh(-Inf + i Inf)) = -0", __real__ result, minus_zero);
3923 check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result, M_PI_2);
3924 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_infty));
3925 check ("real(catanh(-Inf - i Inf)) = -0", __real__ result, minus_zero);
3926 check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3928 result = FUNC(catanh) (BUILD_COMPLEX (-10.0, plus_infty));
3929 check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
3930 check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3931 result = FUNC(catanh) (BUILD_COMPLEX (-10.0, minus_infty));
3932 check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
3933 check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3934 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, plus_infty));
3935 check ("real(catanh(-0 + i Inf)) = -0", __real__ result, minus_zero);
3936 check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3937 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_infty));
3938 check ("real(catanh(-0 - i Inf)) = -0", __real__ result, minus_zero);
3939 check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3940 result = FUNC(catanh) (BUILD_COMPLEX (0, plus_infty));
3941 check ("real(catanh(0 + i Inf)) = 0", __real__ result, 0);
3942 check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3943 result = FUNC(catanh) (BUILD_COMPLEX (0, minus_infty));
3944 check ("real(catanh(0 - i Inf)) = 0", __real__ result, 0);
3945 check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3946 result = FUNC(catanh) (BUILD_COMPLEX (0.1, plus_infty));
3947 check ("real(catanh(0.1 + i Inf)) = 0", __real__ result, 0);
3948 check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3949 result = FUNC(catanh) (BUILD_COMPLEX (0.1, minus_infty));
3950 check ("real(catanh(0.1 - i Inf)) = 0", __real__ result, 0);
3951 check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3953 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 0));
3954 check ("real(catanh(-Inf + i0)) = -0", __real__ result, minus_zero);
3955 check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result, M_PI_2);
3956 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_zero));
3957 check ("real(catanh(-Inf - i0)) = -0", __real__ result, minus_zero);
3958 check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result, -M_PI_2);
3959 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 100));
3960 check ("real(catanh(-Inf + i100)) = -0", __real__ result, minus_zero);
3961 check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result, M_PI_2);
3962 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, -100));
3963 check ("real(catanh(-Inf - i100)) = -0", __real__ result, minus_zero);
3964 check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result, -M_PI_2);
3966 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0));
3967 check ("real(catanh(+Inf + i0)) = 0", __real__ result, 0);
3968 check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result, M_PI_2);
3969 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_zero));
3970 check ("real(catanh(+Inf - i0)) = 0", __real__ result, 0);
3971 check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result, -M_PI_2);
3972 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0.5));
3973 check ("real(catanh(+Inf + i0.5)) = 0", __real__ result, 0);
3974 check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result, M_PI_2);
3975 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, -0.5));
3976 check ("real(catanh(+Inf - i0.5)) = 0", __real__ result, 0);
3977 check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result, -M_PI_2);
3979 result = FUNC(catanh) (BUILD_COMPLEX (0, nan_value));
3980 check ("real(catanh(0 + i NaN)) = 0", __real__ result, 0);
3981 check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result);
3982 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
3983 check ("real(catanh(-0 + i NaN)) = -0", __real__ result, minus_zero);
3984 check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result);
3986 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value));
3987 check ("real(catanh(+Inf + i NaN)) = 0", __real__ result, 0);
3988 check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result);
3989 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, nan_value));
3990 check ("real(catanh(-Inf + i NaN)) = -0", __real__ result, minus_zero);
3991 check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result);
3993 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0));
3994 check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result);
3995 check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result);
3996 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_zero));
3997 check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result);
3998 check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result);
4000 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, plus_infty));
4001 check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4002 check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result, M_PI_2);
4003 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_infty));
4004 check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4005 check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4007 result = FUNC(catanh) (BUILD_COMPLEX (10.5, nan_value));
4008 check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4009 __real__ result, INVALID_EXCEPTION);
4010 check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4012 result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value));
4013 check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4014 __real__ result, INVALID_EXCEPTION);
4015 check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4018 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75));
4019 check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4020 __real__ result, INVALID_EXCEPTION);
4021 check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4023 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75));
4024 check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4025 __real__ result, INVALID_EXCEPTION);
4026 check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4029 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, nan_value));
4030 check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result);
4031 check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result);
4038 __complex__ MATHTYPE result;
4040 result = FUNC(ctanh) (BUILD_COMPLEX (0, 0));
4041 check ("real(ctanh(0 + i0)) = 0", __real__ result, 0);
4042 check ("imag(ctanh(0 + i0)) = 0", __imag__ result, 0);
4043 result = FUNC(ctanh) (BUILD_COMPLEX (0, minus_zero));
4044 check ("real(ctanh(0 - i0)) = 0", __real__ result, 0);
4045 check ("imag(ctanh(0 - i0)) = -0", __imag__ result, minus_zero);
4046 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, 0));
4047 check ("real(ctanh(-0 + i0)) = -0", __real__ result, minus_zero);
4048 check ("imag(ctanh(-0 + i0)) = 0", __imag__ result, 0);
4049 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_zero));
4050 check ("real(ctanh(-0 - i0)) = -0", __real__ result, minus_zero);
4051 check ("imag(ctanh(-0 - i0)) = -0", __imag__ result, minus_zero);
4053 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 0));
4054 check ("real(ctanh(+Inf + i0)) = 1", __real__ result, 1);
4055 check ("imag(ctanh(+Inf + i0)) = 0", __imag__ result, 0);
4056 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 1));
4057 check ("real(ctanh(+Inf + i1)) = 1", __real__ result, 1);
4058 check ("imag(ctanh(+Inf + i1)) = 0", __imag__ result, 0);
4059 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, minus_zero));
4060 check ("real(ctanh(+Inf - i0)) = 1", __real__ result, 1);
4061 check ("imag(ctanh(+Inf - i0)) = -0", __imag__ result, minus_zero);
4062 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, -1));
4063 check ("real(ctanh(+Inf - i1)) = 1", __real__ result, 1);
4064 check ("imag(ctanh(+Inf - i1)) = -0", __imag__ result, minus_zero);
4065 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 0));
4066 check ("real(ctanh(-Inf + i0)) = -1", __real__ result, -1);
4067 check ("imag(ctanh(-Inf + i0)) = 0", __imag__ result, 0);
4068 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 1));
4069 check ("real(ctanh(-Inf + i1)) = -1", __real__ result, -1);
4070 check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result, 0);
4071 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, minus_zero));
4072 check ("real(ctanh(-Inf - i0)) = -1", __real__ result, -1);
4073 check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result, minus_zero);
4074 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, -1));
4075 check ("real(ctanh(-Inf - i1)) = -1", __real__ result, -1);
4076 check ("imag(ctanh(-Inf - i1)) = -0", __imag__ result, minus_zero);
4078 result = FUNC(ctanh) (BUILD_COMPLEX (0, plus_infty));
4079 check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
4080 __real__ result, INVALID_EXCEPTION);
4081 check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
4083 result = FUNC(ctanh) (BUILD_COMPLEX (2, plus_infty));
4084 check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
4085 __real__ result, INVALID_EXCEPTION);
4086 check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
4088 result = FUNC(ctanh) (BUILD_COMPLEX (0, minus_infty));
4089 check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
4090 __real__ result, INVALID_EXCEPTION);
4091 check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
4093 result = FUNC(ctanh) (BUILD_COMPLEX (2, minus_infty));
4094 check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
4095 __real__ result, INVALID_EXCEPTION);
4096 check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
4098 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, plus_infty));
4099 check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4100 __real__ result, INVALID_EXCEPTION);
4101 check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4103 result = FUNC(ctanh) (BUILD_COMPLEX (-2, plus_infty));
4104 check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4105 __real__ result, INVALID_EXCEPTION);
4106 check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4108 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_infty));
4109 check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4110 __real__ result, INVALID_EXCEPTION);
4111 check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4113 result = FUNC(ctanh) (BUILD_COMPLEX (-2, minus_infty));
4114 check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4115 __real__ result, INVALID_EXCEPTION);
4116 check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4119 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, nan_value));
4120 check ("real(ctanh(+Inf + i NaN)) = 1", __real__ result, 1);
4121 check ("imag(ctanh(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
4122 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, nan_value));
4123 check ("real(ctanh(-Inf + i NaN)) = -1", __real__ result, -1);
4124 check ("imag(ctanh(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
4126 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0));
4127 check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result);
4128 check ("imag(ctanh(NaN + i0)) = 0", __imag__ result, 0);
4129 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_zero));
4130 check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result);
4131 check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_zero);
4133 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5));
4134 check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4135 __real__ result, INVALID_EXCEPTION);
4136 check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4138 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, -4.5));
4139 check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4140 __real__ result, INVALID_EXCEPTION);
4141 check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4144 result = FUNC(ctanh) (BUILD_COMPLEX (0, nan_value));
4145 check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4146 __real__ result, INVALID_EXCEPTION);
4147 check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4149 result = FUNC(ctanh) (BUILD_COMPLEX (5, nan_value));
4150 check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4151 __real__ result, INVALID_EXCEPTION);
4152 check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4154 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, nan_value));
4155 check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4156 __real__ result, INVALID_EXCEPTION);
4157 check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4159 result = FUNC(ctanh) (BUILD_COMPLEX (-0.25, nan_value));
4160 check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4161 __real__ result, INVALID_EXCEPTION);
4162 check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4165 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, nan_value));
4166 check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result);
4167 check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result);
4174 __complex__ MATHTYPE result;
4176 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, 0));
4177 check_isinfn_exc ("real(clog(-0 + i0)) = -Inf plus divide-by-zero exception",
4178 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4179 check ("imag(clog(-0 + i0)) = pi plus divide-by-zero exception",
4180 __imag__ result, M_PI);
4181 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_zero));
4182 check_isinfn_exc ("real(clog(-0 - i0)) = -Inf plus divide-by-zero exception",
4183 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4184 check ("imag(clog(-0 - i0)) = -pi plus divide-by-zero exception",
4185 __imag__ result, -M_PI);
4187 result = FUNC(clog) (BUILD_COMPLEX (0, 0));
4188 check_isinfn_exc ("real(clog(0 + i0)) = -Inf plus divide-by-zero exception",
4189 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4190 check ("imag(clog(0 + i0)) = 0 plus divide-by-zero exception",
4191 __imag__ result, 0);
4192 result = FUNC(clog) (BUILD_COMPLEX (0, minus_zero));
4193 check_isinfn_exc ("real(clog(0 - i0)) = -Inf plus divide-by-zero exception",
4194 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4195 check ("imag(clog(0 - i0)) = -0 plus divide-by-zero exception",
4196 __imag__ result, minus_zero);
4198 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, plus_infty));
4199 check_isinfp ("real(clog(-Inf + i Inf)) = +Inf", __real__ result);
4200 check ("imag(clog(-Inf + i Inf)) = 3*pi/4", __imag__ result, M_PI - M_PI_4);
4201 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_infty));
4202 check_isinfp ("real(clog(-Inf - i Inf)) = +Inf", __real__ result);
4203 check ("imag(clog(-Inf - i Inf)) = -3*pi/4", __imag__ result, M_PI_4 - M_PI);
4205 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, plus_infty));
4206 check_isinfp ("real(clog(+Inf + i Inf)) = +Inf", __real__ result);
4207 check ("imag(clog(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
4208 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_infty));
4209 check_isinfp ("real(clog(+Inf - i Inf)) = +Inf", __real__ result);
4210 check ("imag(clog(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
4212 result = FUNC(clog) (BUILD_COMPLEX (0, plus_infty));
4213 check_isinfp ("real(clog(0 + i Inf)) = +Inf", __real__ result);
4214 check ("imag(clog(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4215 result = FUNC(clog) (BUILD_COMPLEX (3, plus_infty));
4216 check_isinfp ("real(clog(3 + i Inf)) = +Inf", __real__ result);
4217 check ("imag(clog(3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4218 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, plus_infty));
4219 check_isinfp ("real(clog(-0 + i Inf)) = +Inf", __real__ result);
4220 check ("imag(clog(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4221 result = FUNC(clog) (BUILD_COMPLEX (-3, plus_infty));
4222 check_isinfp ("real(clog(-3 + i Inf)) = +Inf", __real__ result);
4223 check ("imag(clog(-3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4224 result = FUNC(clog) (BUILD_COMPLEX (0, minus_infty));
4225 check_isinfp ("real(clog(0 - i Inf)) = +Inf", __real__ result);
4226 check ("imag(clog(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4227 result = FUNC(clog) (BUILD_COMPLEX (3, minus_infty));
4228 check_isinfp ("real(clog(3 - i Inf)) = +Inf", __real__ result);
4229 check ("imag(clog(3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4230 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_infty));
4231 check_isinfp ("real(clog(-0 - i Inf)) = +Inf", __real__ result);
4232 check ("imag(clog(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4233 result = FUNC(clog) (BUILD_COMPLEX (-3, minus_infty));
4234 check_isinfp ("real(clog(-3 - i Inf)) = +Inf", __real__ result);
4235 check ("imag(clog(-3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4237 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, 0));
4238 check_isinfp ("real(clog(-Inf + i0)) = +Inf", __real__ result);
4239 check ("imag(clog(-Inf + i0)) = pi", __imag__ result, M_PI);
4240 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, 1));
4241 check_isinfp ("real(clog(-Inf + i1)) = +Inf", __real__ result);
4242 check ("imag(clog(-Inf + i1)) = pi", __imag__ result, M_PI);
4243 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_zero));
4244 check_isinfp ("real(clog(-Inf - i0)) = +Inf", __real__ result);
4245 check ("imag(clog(-Inf - i0)) = -pi", __imag__ result, -M_PI);
4246 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, -1));
4247 check_isinfp ("real(clog(-Inf - i1)) = +Inf", __real__ result);
4248 check ("imag(clog(-Inf - i1)) = -pi", __imag__ result, -M_PI);
4250 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, 0));
4251 check_isinfp ("real(clog(+Inf + i0)) = +Inf", __real__ result);
4252 check ("imag(clog(+Inf + i0)) = 0", __imag__ result, 0);
4253 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, 1));
4254 check_isinfp ("real(clog(+Inf + i1)) = +Inf", __real__ result);
4255 check ("imag(clog(+Inf + i1)) = 0", __imag__ result, 0);
4256 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_zero));
4257 check_isinfp ("real(clog(+Inf - i0)) = +Inf", __real__ result);
4258 check ("imag(clog(+Inf - i0)) = -0", __imag__ result, minus_zero);
4259 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, -1));
4260 check_isinfp ("real(clog(+Inf - i1)) = +Inf", __real__ result);
4261 check ("imag(clog(+Inf - i1)) = -0", __imag__ result, minus_zero);
4263 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, nan_value));
4264 check_isinfp ("real(clog(+Inf + i NaN)) = +Inf", __real__ result);
4265 check_isnan ("imag(clog(+Inf + i NaN)) = NaN", __imag__ result);
4266 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, nan_value));
4267 check_isinfp ("real(clog(-Inf + i NaN)) = +Inf", __real__ result);
4268 check_isnan ("imag(clog(-Inf + i NaN)) = NaN", __imag__ result);
4270 result = FUNC(clog) (BUILD_COMPLEX (nan_value, plus_infty));
4271 check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result);
4272 check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result);
4273 result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_infty));
4274 check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result);
4275 check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result);
4277 result = FUNC(clog) (BUILD_COMPLEX (0, nan_value));
4278 check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4279 __real__ result, INVALID_EXCEPTION);
4280 check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4282 result = FUNC(clog) (BUILD_COMPLEX (3, nan_value));
4283 check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4284 __real__ result, INVALID_EXCEPTION);
4285 check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4287 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, nan_value));
4288 check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4289 __real__ result, INVALID_EXCEPTION);
4290 check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4292 result = FUNC(clog) (BUILD_COMPLEX (-3, nan_value));
4293 check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4294 __real__ result, INVALID_EXCEPTION);
4295 check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4298 result = FUNC(clog) (BUILD_COMPLEX (nan_value, 0));
4299 check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
4300 __real__ result, INVALID_EXCEPTION);
4301 check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
4303 result = FUNC(clog) (BUILD_COMPLEX (nan_value, 5));
4304 check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
4305 __real__ result, INVALID_EXCEPTION);
4306 check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
4308 result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_zero));
4309 check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
4310 __real__ result, INVALID_EXCEPTION);
4311 check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
4313 result = FUNC(clog) (BUILD_COMPLEX (nan_value, -5));
4314 check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
4315 __real__ result, INVALID_EXCEPTION);
4316 check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
4319 result = FUNC(clog) (BUILD_COMPLEX (nan_value, nan_value));
4320 check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result);
4321 check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result);
4328 __complex__ MATHTYPE result;
4330 result = FUNC(csqrt) (BUILD_COMPLEX (0, 0));
4331 check ("real(csqrt(0 + i0)) = 0", __real__ result, 0);
4332 check ("imag(csqrt(0 + i0)) = 0", __imag__ result, 0);
4333 result = FUNC(csqrt) (BUILD_COMPLEX (0, minus_zero));
4334 check ("real(csqrt(0 - i0)) = 0", __real__ result, 0);
4335 check ("imag(csqrt(0 - i0)) = -0", __imag__ result, minus_zero);
4336 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, 0));
4337 check ("real(csqrt(-0 + i0)) = 0", __real__ result, 0);
4338 check ("imag(csqrt(-0 + i0)) = 0", __imag__ result, 0);
4339 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_zero));
4340 check ("real(csqrt(-0 - i0)) = 0", __real__ result, 0);
4341 check ("imag(csqrt(-0 - i0)) = -0", __imag__ result, minus_zero);
4343 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 0));
4344 check ("real(csqrt(-Inf + i0)) = 0", __real__ result, 0);
4345 check_isinfp ("imag(csqrt(-Inf + i0)) = +Inf", __imag__ result);
4346 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 6));
4347 check ("real(csqrt(-Inf + i6)) = 0", __real__ result, 0);
4348 check_isinfp ("imag(csqrt(-Inf + i6)) = +Inf", __imag__ result);
4349 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_zero));
4350 check ("real(csqrt(-Inf - i0)) = 0", __real__ result, 0);
4351 check_isinfn ("imag(csqrt(-Inf - i0)) = -Inf", __imag__ result);
4352 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, -6));
4353 check ("real(csqrt(-Inf - i6)) = 0", __real__ result, 0);
4354 check_isinfn ("imag(csqrt(-Inf - i6)) = -Inf", __imag__ result);
4356 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 0));
4357 check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result);
4358 check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result, 0);
4359 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 6));
4360 check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result);
4361 check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result, 0);
4362 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_zero));
4363 check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result);
4364 check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result, minus_zero);
4365 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, -6));
4366 check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result);
4367 check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result, minus_zero);
4369 result = FUNC(csqrt) (BUILD_COMPLEX (0, plus_infty));
4370 check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result);
4371 check_isinfp ("imag(csqrt(0 + i Inf)) = +Inf", __imag__ result);
4372 result = FUNC(csqrt) (BUILD_COMPLEX (4, plus_infty));
4373 check_isinfp ("real(csqrt(4 + i Inf)) = +Inf", __real__ result);
4374 check_isinfp ("imag(csqrt(4 + i Inf)) = +Inf", __imag__ result);
4375 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, plus_infty));
4376 check_isinfp ("real(csqrt(+Inf + i Inf)) = +Inf", __real__ result);
4377 check_isinfp ("imag(csqrt(+Inf + i Inf)) = +Inf", __imag__ result);
4378 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, plus_infty));
4379 check_isinfp ("real(csqrt(-0 + i Inf)) = +Inf", __real__ result);
4380 check_isinfp ("imag(csqrt(-0 + i Inf)) = +Inf", __imag__ result);
4381 result = FUNC(csqrt) (BUILD_COMPLEX (-4, plus_infty));
4382 check_isinfp ("real(csqrt(-4 + i Inf)) = +Inf", __real__ result);
4383 check_isinfp ("imag(csqrt(-4 + i Inf)) = +Inf", __imag__ result);
4384 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, plus_infty));
4385 check_isinfp ("real(csqrt(-Inf + i Inf)) = +Inf", __real__ result);
4386 check_isinfp ("imag(csqrt(-Inf + i Inf)) = +Inf", __imag__ result);
4387 result = FUNC(csqrt) (BUILD_COMPLEX (0, minus_infty));
4388 check_isinfp ("real(csqrt(0 - i Inf)) = +Inf", __real__ result);
4389 check_isinfn ("imag(csqrt(0 - i Inf)) = -Inf", __imag__ result);
4390 result = FUNC(csqrt) (BUILD_COMPLEX (4, minus_infty));
4391 check_isinfp ("real(csqrt(4 - i Inf)) = +Inf", __real__ result);
4392 check_isinfn ("imag(csqrt(4 - i Inf)) = -Inf", __imag__ result);
4393 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_infty));
4394 check_isinfp ("real(csqrt(+Inf - i Inf)) = +Inf", __real__ result);
4395 check_isinfn ("imag(csqrt(+Inf - i Inf)) = -Inf", __imag__ result);
4396 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_infty));
4397 check_isinfp ("real(csqrt(-0 - i Inf)) = +Inf", __real__ result);
4398 check_isinfn ("imag(csqrt(-0 - i Inf)) = -Inf", __imag__ result);
4399 result = FUNC(csqrt) (BUILD_COMPLEX (-4, minus_infty));
4400 check_isinfp ("real(csqrt(-4 - i Inf)) = +Inf", __real__ result);
4401 check_isinfn ("imag(csqrt(-4 - i Inf)) = -Inf", __imag__ result);
4402 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_infty));
4403 check_isinfp ("real(csqrt(-Inf - i Inf)) = +Inf", __real__ result);
4404 check_isinfn ("imag(csqrt(-Inf - i Inf)) = -Inf", __imag__ result);
4406 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, nan_value));
4407 check_isnan ("real(csqrt(-Inf + i NaN)) = NaN", __real__ result);
4408 check_isinfp ("imag(csqrt(-Inf + i NaN)) = +-Inf",
4409 FUNC(fabs) (__imag__ result));
4411 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, nan_value));
4412 check_isinfp ("real(csqrt(+Inf + i NaN)) = +Inf", __real__ result);
4413 check_isnan ("imag(csqrt(+Inf + i NaN)) = NaN", __imag__ result);
4415 result = FUNC(csqrt) (BUILD_COMPLEX (0, nan_value));
4416 check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4417 __real__ result, INVALID_EXCEPTION);
4418 check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4420 result = FUNC(csqrt) (BUILD_COMPLEX (1, nan_value));
4421 check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4422 __real__ result, INVALID_EXCEPTION);
4423 check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4425 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, nan_value));
4426 check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4427 __real__ result, INVALID_EXCEPTION);
4428 check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4430 result = FUNC(csqrt) (BUILD_COMPLEX (-1, nan_value));
4431 check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4432 __real__ result, INVALID_EXCEPTION);
4433 check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4436 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 0));
4437 check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4438 __real__ result, INVALID_EXCEPTION);
4439 check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4441 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 8));
4442 check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4443 __real__ result, INVALID_EXCEPTION);
4444 check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4446 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, minus_zero));
4447 check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4448 __real__ result, INVALID_EXCEPTION);
4449 check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4451 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, -8));
4452 check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4453 __real__ result, INVALID_EXCEPTION);
4454 check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4457 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, nan_value));
4458 check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result);
4459 check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result);
4466 __complex__ MATHTYPE result;
4468 result = FUNC (cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
4469 check ("real(cpow (1 + i0), (0 + i0)) = 0", __real__ result, 1);
4470 check ("imag(cpow (1 + i0), (0 + i0)) = 0", __imag__ result, 0);
4472 result = FUNC (cpow) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
4473 check_eps ("real(cpow (2 + i0), (10 + i0)) = 1024", __real__ result, 1024,
4474 CHOOSE (2e-16L, 0, 0));
4475 check ("imag(cpow (2 + i0), (10 + i0)) = 0", __imag__ result, 0);
4481 nearbyint_test (void)
4483 check ("nearbyint(+0) = 0", FUNC(nearbyint) (0.0), 0.0);
4484 check ("nearbyint(-0) = -0", FUNC(nearbyint) (minus_zero), minus_zero);
4485 check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint) (plus_infty));
4486 check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint) (minus_infty));
4493 check ("rint(0) = 0", FUNC(rint) (0.0), 0.0);
4494 check ("rint(-0) = -0", FUNC(rint) (minus_zero), minus_zero);
4495 check_isinfp ("rint(+Inf) = +Inf", FUNC(rint) (plus_infty));
4496 check_isinfn ("rint(-Inf) = -Inf", FUNC(rint) (minus_infty));
4503 /* XXX this test is incomplete. We need to have a way to specifiy
4504 the rounding method and test the critical cases. So far, only
4505 unproblematic numbers are tested. */
4507 check_long ("lrint(0) = 0", lrint (0.0), 0);
4508 check_long ("lrint(-0) = 0", lrint (minus_zero), 0);
4509 check_long ("lrint(0.2) = 0", lrint (0.2), 0);
4510 check_long ("lrint(-0.2) = 0", lrint (-0.2), 0);
4512 check_long ("lrint(1.4) = 1", lrint (1.4), 1);
4513 check_long ("lrint(-1.4) = -1", lrint (-1.4), -1);
4515 check_long ("lrint(8388600.3) = 8388600", lrint (8388600.3), 8388600);
4516 check_long ("lrint(-8388600.3) = -8388600", lrint (-8388600.3),
4524 /* XXX this test is incomplete. We need to have a way to specifiy
4525 the rounding method and test the critical cases. So far, only
4526 unproblematic numbers are tested. */
4528 check_longlong ("llrint(0) = 0", llrint (0.0), 0);
4529 check_longlong ("llrint(-0) = 0", llrint (minus_zero), 0);
4530 check_longlong ("llrint(0.2) = 0", llrint (0.2), 0);
4531 check_longlong ("llrint(-0.2) = 0", llrint (-0.2), 0);
4533 check_longlong ("llrint(1.4) = 1", llrint (1.4), 1);
4534 check_longlong ("llrint(-1.4) = -1", llrint (-1.4), -1);
4536 check_longlong ("llrint(8388600.3) = 8388600", llrint (8388600.3),
4538 check_longlong ("llrint(-8388600.3) = -8388600", llrint (-8388600.3),
4546 check ("round(0) = 0", FUNC(round) (0), 0);
4547 check ("round(-0) = -0", FUNC(round) (minus_zero), minus_zero);
4548 check ("round(0.2) = 0", FUNC(round) (0.2), 0.0);
4549 check ("round(-0.2) = -0", FUNC(round) (-0.2), minus_zero);
4550 check ("round(0.5) = 1", FUNC(round) (0.5), 1.0);
4551 check ("round(-0.5) = -1", FUNC(round) (-0.5), -1.0);
4552 check ("round(0.8) = 1", FUNC(round) (0.8), 1.0);
4553 check ("round(-0.8) = -1", FUNC(round) (-0.8), -1.0);
4554 check ("round(1.5) = 2", FUNC(round) (1.5), 2.0);
4555 check ("round(-1.5) = -2", FUNC(round) (-1.5), -2.0);
4556 check ("round(2097152.5) = 2097153", FUNC(round) (2097152.5), 2097153);
4557 check ("round(-2097152.5) = -2097153", FUNC(round) (-2097152.5), -2097153);
4564 check_long ("lround(0) = 0", lround (0), 0);
4565 check_long ("lround(-0) = 0", lround (minus_zero), 0);
4566 check_long ("lround(0.2) = 0", lround (0.2), 0.0);
4567 check_long ("lround(-0.2) = 0", lround (-0.2), 0);
4568 check_long ("lround(0.5) = 1", lround (0.5), 1);
4569 check_long ("lround(-0.5) = -1", lround (-0.5), -1);
4570 check_long ("lround(0.8) = 1", lround (0.8), 1);
4571 check_long ("lround(-0.8) = -1", lround (-0.8), -1);
4572 check_long ("lround(1.5) = 2", lround (1.5), 2);
4573 check_long ("lround(-1.5) = -2", lround (-1.5), -2);
4574 check_long ("lround(2097152.5) = 2097153", lround (2097152.5), 2097153);
4575 check_long ("lround(-2097152.5) = -2097153", lround (-2097152.5),
4583 check_longlong ("llround(0) = 0", llround (0), 0);
4584 check_longlong ("llround(-0) = 0", llround (minus_zero), 0);
4585 check_longlong ("llround(0.2) = 0", llround (0.2), 0.0);
4586 check_longlong ("llround(-0.2) = 0", llround (-0.2), 0);
4587 check_longlong ("llround(0.5) = 1", llround (0.5), 1);
4588 check_longlong ("llround(-0.5) = -1", llround (-0.5), -1);
4589 check_longlong ("llround(0.8) = 1", llround (0.8), 1);
4590 check_longlong ("llround(-0.8) = -1", llround (-0.8), -1);
4591 check_longlong ("llround(1.5) = 2", llround (1.5), 2);
4592 check_longlong ("llround(-1.5) = -2", llround (-1.5), -2);
4593 check_longlong ("llround(2097152.5) = 2097153",
4594 llround (2097152.5), 2097153);
4595 check_longlong ("llround(-2097152.5) = -2097153",
4596 llround (-2097152.5), -2097153);
4597 check_longlong ("llround(34359738368.5) = 34359738369",
4598 llround (34359738368.5), 34359738369ll);
4599 check_longlong ("llround(-34359738368.5) = -34359738369",
4600 llround (-34359738368.5), -34359738369ll);
4605 inverse_func_pair_test (const char *test_name,
4606 mathfunc f1, mathfunc inverse,
4607 MATHTYPE x, MATHTYPE epsilon)
4609 MATHTYPE a, b, difference;
4617 output_new_test (test_name);
4618 result = check_equal (b, x, epsilon, &difference);
4619 output_result (test_name, result,
4620 b, x, difference, PRINT, PRINT);
4625 inverse_functions (void)
4627 inverse_func_pair_test ("asin(sin(x)) == x",
4628 FUNC(sin), FUNC(asin), 1.0, CHOOSE (2e-18L, 0, 1e-7L));
4629 inverse_func_pair_test ("sin(asin(x)) == x",
4630 FUNC(asin), FUNC(sin), 1.0, 0.0);
4632 inverse_func_pair_test ("acos(cos(x)) == x",
4633 FUNC(cos), FUNC(acos), 1.0, CHOOSE (4e-18L, 1e-15L, 0));
4634 inverse_func_pair_test ("cos(acos(x)) == x",
4635 FUNC(acos), FUNC(cos), 1.0, 0.0);
4636 inverse_func_pair_test ("atan(tan(x)) == x",
4637 FUNC(tan), FUNC(atan), 1.0, CHOOSE (2e-18L, 0, 0));
4638 inverse_func_pair_test ("tan(atan(x)) == x",
4639 FUNC(atan), FUNC(tan), 1.0, CHOOSE (2e-18L, 1e-15L, 0));
4641 inverse_func_pair_test ("asinh(sinh(x)) == x",
4642 FUNC(sinh), FUNC(asinh), 1.0, CHOOSE (1e-18L, 0, 1e-7));
4643 inverse_func_pair_test ("sinh(asinh(x)) == x",
4644 FUNC(asinh), FUNC(sinh), 1.0, CHOOSE (2e-18L, 0, 0));
4646 inverse_func_pair_test ("acosh(cosh(x)) == x",
4647 FUNC(cosh), FUNC(acosh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4648 inverse_func_pair_test ("cosh(acosh(x)) == x",
4649 FUNC(acosh), FUNC(cosh), 1.0, 0.0);
4651 inverse_func_pair_test ("atanh(tanh(x)) == x",
4652 FUNC(tanh), FUNC(atanh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4653 inverse_func_pair_test ("tanh(atanh(x)) == x",
4654 FUNC(atanh), FUNC(tanh), 1.0, 0.0);
4658 /* Test sin and cos with the identity: sin(x)^2 + cos(x)^2 = 1. */
4660 identities1_test (MATHTYPE x, MATHTYPE epsilon)
4662 MATHTYPE res1, res2, res3, diff;
4665 res1 = FUNC(sin) (x);
4667 res2 = FUNC(cos) (x);
4669 res3 = res1 * res1 + res2 * res2;
4672 output_new_test ("sin^2 + cos^2 == 1");
4673 result = check_equal (res3, 1.0, epsilon, &diff);
4674 output_result_ext ("sin^2 + cos^2 == 1", result,
4675 res3, 1.0, diff, x, PRINT, PRINT);
4679 /* Test sin, cos, tan with the following relation: tan = sin/cos. */
4681 identities2_test (MATHTYPE x, MATHTYPE epsilon)
4683 MATHTYPE res1, res2, res3, res4, diff;
4686 res1 = FUNC(sin) (x);
4688 res2 = FUNC(cos) (x);
4690 res3 = FUNC(tan) (x);
4695 output_new_test ("sin/cos == tan");
4696 result = check_equal (res4, res3, epsilon, &diff);
4697 output_result_ext ("sin/cos == tan", result,
4698 res4, res3, diff, x, PRINT, PRINT);
4702 /* Test cosh and sinh with the identity cosh^2 - sinh^2 = 1. */
4704 identities3_test (MATHTYPE x, MATHTYPE epsilon)
4706 MATHTYPE res1, res2, res3, diff;
4709 res1 = FUNC(sinh) (x);
4711 res2 = FUNC(cosh) (x);
4713 res3 = res2 * res2 - res1 * res1;
4716 output_new_test ("cosh^2 - sinh^2 == 1");
4717 result = check_equal (res3, 1.0, epsilon, &diff);
4718 output_result_ext ("cosh^2 - sinh^2 == 1", result,
4719 res3, 1.0, diff, x, PRINT, PRINT);
4726 identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
4727 identities1_test (0.9L, CHOOSE (1e-18L, 0, 1e-7));
4728 identities1_test (0, 0);
4729 identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
4731 identities2_test (0.2L, CHOOSE (0, 1e-16, 0));
4732 identities2_test (0.9L, CHOOSE (0, 1e-15, 0));
4733 identities2_test (0, 0);
4734 identities2_test (-1, CHOOSE (1e-18L, 1e-15, 0));
4736 identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
4737 identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
4738 identities3_test (0, CHOOSE (0, 0, 1e-6));
4739 identities3_test (-1, CHOOSE (1e-18L, 0, 1e-6));
4744 Let's test that basic arithmetic is working
4745 tests: Infinity and NaN
4750 /* variables are declared volatile to forbid some compiler
4752 volatile MATHTYPE Inf_var, NaN_var, zero_var, one_var;
4757 NaN_var = nan_value;
4758 Inf_var = one_var / zero_var;
4765 /* Clear all exceptions. The previous computations raised exceptions. */
4766 feclearexcept (FE_ALL_EXCEPT);
4768 check_isinfp ("isinf (inf) == +1", Inf_var);
4769 check_isinfn ("isinf (-inf) == -1", -Inf_var);
4770 check_bool ("!isinf (1)", !(FUNC(isinf) (one_var)));
4771 check_bool ("!isinf (NaN)", !(FUNC(isinf) (NaN_var)));
4773 check_isnan ("isnan (NaN)", NaN_var);
4774 check_isnan ("isnan (-NaN)", -NaN_var);
4775 check_bool ("!isnan (1)", !(FUNC(isnan) (one_var)));
4776 check_bool ("!isnan (inf)", !(FUNC(isnan) (Inf_var)));
4778 check_bool ("inf == inf", Inf_var == Inf_var);
4779 check_bool ("-inf == -inf", -Inf_var == -Inf_var);
4780 check_bool ("inf != -inf", Inf_var != -Inf_var);
4781 check_bool ("NaN != NaN", NaN_var != NaN_var);
4784 the same tests but this time with NAN from <bits/nan.h>
4785 NAN is a double const
4787 check_bool ("isnan (NAN)", isnan (NAN));
4788 check_bool ("isnan (-NAN)", isnan (-NAN));
4789 check_bool ("!isinf (NAN)", !(isinf (NAN)));
4790 check_bool ("!isinf (-NAN)", !(isinf (-NAN)));
4791 check_bool ("NAN != NAN", NAN != NAN);
4794 And again with the value returned by the `nan' function.
4796 check_bool ("isnan (NAN)", FUNC(isnan) (FUNC(nan) ("")));
4797 check_bool ("isnan (-NAN)", FUNC(isnan) (-FUNC(nan) ("")));
4798 check_bool ("!isinf (NAN)", !(FUNC(isinf) (FUNC(nan) (""))));
4799 check_bool ("!isinf (-NAN)", !(FUNC(isinf) (-FUNC(nan) (""))));
4800 check_bool ("NAN != NAN", FUNC(nan) ("") != FUNC(nan) (""));
4802 /* test if EPSILON is ok */
4803 x1 = MATHCONST (1.0);
4804 x2 = x1 + CHOOSE (LDBL_EPSILON, DBL_EPSILON, FLT_EPSILON);
4805 check_bool ("1 != 1+EPSILON", x1 != x2);
4807 x1 = MATHCONST (1.0);
4808 x2 = x1 - CHOOSE (LDBL_EPSILON, DBL_EPSILON, FLT_EPSILON);
4809 check_bool ("1 != 1-EPSILON", x1 != x2);
4811 /* test if HUGE_VALx is ok */
4812 x1 = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
4813 check_bool ("isinf (HUGE_VALx) == +1", ISINF (x1) == +1);
4814 x1 = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
4815 check_bool ("isinf (-HUGE_VALx) == -1", ISINF (x1) == -1);
4823 fpstack_test ("start *init*");
4825 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
4827 minus_zero = FUNC (copysign) (0.0, -1.0);
4828 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
4829 minus_infty = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
4835 (void) &minus_infty;
4837 /* Clear all exceptions. From now on we must not get random exceptions. */
4838 feclearexcept (FE_ALL_EXCEPT);
4840 /* Test to make sure we start correctly. */
4841 fpstack_test ("end *init*");
4845 static struct option long_options[] =
4847 {"verbose", optional_argument, NULL, 'v'},
4848 {"silent", no_argument, NULL, 's'},
4854 parse_options (int argc, char *argv[])
4863 c = getopt_long (argc, argv, "v::s",
4864 long_options, &option_index);
4866 /* Detect the end of the options. */
4874 verbose = (unsigned int) strtoul (optarg, NULL, 0);
4888 main (int argc, char *argv[])
4891 parse_options (argc, argv);
4898 /* keep the tests a wee bit ordered (according to ISO 9X) */
4899 /* classification functions */
4905 /* trigonometric functions */
4915 /* hyperbolic functions */
4923 /* exponential and logarithmic functions */
4939 /* power and absolute value functions */
4946 /* error and gamma functions */
4952 /* nearest integer functions */
4964 /* remainder functions */
4969 /* manipulation functions */
4973 /* maximum, minimum and positive difference functions */
4978 /* complex functions */
4997 inverse_functions ();
5001 printf ("\n%d errors occured.\n", noErrors);
5004 printf ("\n All tests passed successfully.\n");