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,
39 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
42 /* This program isn't finished yet.
44 acos, acosh, asin, asinh, atan, atan2, atanh,
45 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
46 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
48 ilogb, isfinite, isinf, isnan, isnormal,
49 ldexp, lgamma, log, log10, log1p, log2, logb,
50 modf, nearbyint, nextafter,
51 pow, remainder, remquo, rint, lrint, llrint,
52 round, lround, llround,
53 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
55 and for the following complex math functions:
56 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
57 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan, ctanh.
59 At the moment the following functions aren't tested:
60 conj, cproj, cimag, creal, drem,
61 j0, j1, jn, y0, y1, yn,
63 nan, comparison macros (isless,isgreater,...).
65 The routines using random variables are still under construction. I don't
66 like it the way it's working now and will change it.
68 Parameter handling is primitive in the moment:
69 --verbose=[0..4] for different levels of output:
71 1: basic report on failed tests (default)
72 2: full report on failed tests
73 3: full report on failed and passed tests
74 4: additional report on exceptions
75 -v for full output (equals --verbose=4)
76 -s,--silent outputs only the error count (equals --verbose=0)
81 This suite tests some aspects of the correct implementation of
82 mathematical functions in libm. Some simple, specific parameters
83 are tested for correctness but there's no exhaustive
84 testing. Handling of specific inputs (e.g. infinity, not-a-number)
85 is also tested. Correct handling of exceptions is checked
86 against. These implemented tests should check all cases that are
87 specified in ISO C 9X.
89 Exception testing: At the moment only divide-by-zero and invalid
90 exceptions are tested. Overflow/underflow and inexact exceptions
91 aren't checked at the moment.
93 NaN values: There exist signalling and quiet NaNs. This implementation
94 only uses signalling NaN as parameter but does not differenciate
95 between the two kinds of NaNs as result.
97 Inline functions: Inlining functions should give an improvement in
98 speed - but not in precission. The inlined functions return
99 reasonable values for a reasonable range of input values. The
100 result is not necessarily correct for all values and exceptions are
101 not correctly raised in all cases. Problematic input and return
102 values are infinity, not-a-number and minus zero. This suite
103 therefore does not check these specific inputs and the exception
104 handling for inlined mathematical functions - just the "reasonable"
107 Beware: The tests might fail for any of the following reasons:
109 - Functions are wrong
110 - Floating Point Unit not working properly
111 - Compiler has errors
113 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
131 /* Possible exceptions */
132 #define NO_EXCEPTION 0x0
133 #define INVALID_EXCEPTION 0x1
134 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
139 /* Various constants (we must supply them precalculated for accuracy). */
140 #define M_PI_6 .52359877559829887308L
142 static int noErrors; /* number of errors */
143 static int noTests; /* number of tests (without testing exceptions) */
144 static int noExcTests; /* number of tests for exception flags */
146 static int verbose = 3;
147 static MATHTYPE minus_zero, plus_zero;
148 static MATHTYPE plus_infty, minus_infty, nan_value;
150 typedef MATHTYPE (*mathfunc) (MATHTYPE);
152 #define BUILD_COMPLEX(real, imag) \
153 ({ __complex__ MATHTYPE __retval; \
154 __real__ __retval = (real); \
155 __imag__ __retval = (imag); \
160 (sizeof (x) == sizeof (float) ? \
162 : sizeof (x) == sizeof (double) ? \
163 isinf (x) : isinfl (x))
167 Test if Floating-Point stack hasn't changed
170 fpstack_test (const char *test_name)
173 static int old_stack;
175 asm ("fnstsw":"=a" (sw));
180 printf ("FP-Stack wrong after test %s\n", test_name);
182 printf ("=======> stack = %d\n", sw);
191 Get a random value x with min_value < x < max_value
192 and min_value, max_value finite,
193 max_value and min_value shouldn't be too close together
196 random_value (MATHTYPE min_value, MATHTYPE max_value)
203 x = (max_value - min_value) / RAND_MAX * (MATHTYPE) r + min_value;
205 if ((x <= min_value) || (x >= max_value) || !isfinite (x))
206 x = (max_value - min_value) / 2 + min_value;
208 /* Make sure the RNG has no influence on the exceptions. */
209 feclearexcept (FE_ALL_EXCEPT);
214 /* Get a random value x with x > min_value. */
216 random_greater (MATHTYPE min_value)
218 return random_value (min_value, 1e6); /* CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX) */
221 /* Get a random value x with x < max_value. */
223 random_less (MATHTYPE max_value)
225 return random_value (-1e6, max_value);
230 output_new_test (const char *test_name)
233 printf ("\nTesting: %s\n", test_name);
238 output_pass_value (void)
241 printf ("Pass: Value Ok.\n");
246 output_fail_value (const char * test_name)
248 if (verbose > 0 && verbose < 3)
249 printf ("Fail: %s\n", test_name);
255 /* Test whether a given exception was raised. */
257 test_single_exception (const char *test_name,
261 const char *flag_name)
264 if (exception & exc_flag)
266 if (fetestexcept (fe_flag))
269 printf ("Pass: Exception \"%s\" set\n", flag_name);
273 if (verbose && verbose < 3)
274 printf ("Fail: %s: Exception \"%s\" not set\n",
275 test_name, flag_name);
277 printf ("Fail: Exception \"%s\" not set\n",
284 if (fetestexcept (fe_flag))
286 if (verbose && verbose < 3)
287 printf ("Fail: %s: Exception \"%s\" set\n",
288 test_name, flag_name);
290 printf ("Fail: Exception \"%s\" set\n",
297 printf ("Pass: Exception \"%s\" not set\n",
305 /* Test whether exception given by EXCEPTION are raised. */
307 test_not_exception (const char *test_name, short int exception)
311 if ((exception & DIVIDE_BY_ZERO_EXCEPTION) == 0)
312 test_single_exception (test_name, exception,
313 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
317 if ((exception & INVALID_EXCEPTION) == 0)
318 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
319 "Invalid operation");
321 feclearexcept (FE_ALL_EXCEPT);
325 /* Test whether exceptions given by EXCEPTION are raised. */
327 test_exceptions (const char *test_name, short int exception)
331 test_single_exception (test_name, exception,
332 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
336 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
337 "Invalid operation");
339 feclearexcept (FE_ALL_EXCEPT);
343 /* Test if two floating point numbers are equal. */
345 check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff)
349 /* Both plus Infinity or both minus infinity. */
350 if (ISINF (computed) && (ISINF (computed) == ISINF (supplied)))
353 if (isnan (computed) && isnan (supplied)) /* isnan works for all types */
356 *diff = FUNC(fabs) (computed - supplied);
359 ret_value = (*diff <= eps &&
360 (signbit (computed) == signbit (supplied) || eps != 0.0));
362 /* Make sure the subtraction/comparsion have no influence on the exceptions. */
363 feclearexcept (FE_ALL_EXCEPT);
371 output_result_bool (const char *test_name, int result)
376 output_pass_value ();
380 output_fail_value (test_name);
382 printf (" Value: %d\n", result);
386 fpstack_test (test_name);
391 output_isvalue (const char *test_name, int result,
397 output_pass_value ();
401 output_fail_value (test_name);
403 printf (" Value: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
408 fpstack_test (test_name);
413 output_isvalue_ext (const char *test_name, int result,
414 MATHTYPE value, MATHTYPE parameter)
419 output_pass_value ();
423 output_fail_value (test_name);
426 printf (" Value: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
428 printf (" Parameter: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
429 parameter, parameter);
434 fpstack_test (test_name);
439 output_result (const char *test_name, int result,
440 MATHTYPE computed, MATHTYPE expected,
442 int print_values, int print_diff)
447 output_pass_value ();
451 output_fail_value (test_name);
452 if (verbose > 1 && print_values)
454 printf ("Result:\n");
455 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
457 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
460 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
461 "\n", difference, difference);
466 fpstack_test (test_name);
471 output_result_ext (const char *test_name, int result,
472 MATHTYPE computed, MATHTYPE expected,
475 int print_values, int print_diff)
480 output_pass_value ();
484 output_fail_value (test_name);
485 if (verbose > 1 && print_values)
487 printf ("Result:\n");
488 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
490 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
493 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
494 "\n", difference, difference);
495 printf ("Parameter: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
496 parameter, parameter);
501 fpstack_test (test_name);
505 check that computed and expected values are the same
508 check (const char *test_name, MATHTYPE computed, MATHTYPE expected)
513 output_new_test (test_name);
514 test_exceptions (test_name, NO_EXCEPTION);
515 result = check_equal (computed, expected, 0, &diff);
516 output_result (test_name, result,
517 computed, expected, diff, PRINT, PRINT);
522 check that computed and expected values are the same,
523 outputs the parameter to the function
526 check_ext (const char *test_name, MATHTYPE computed, MATHTYPE expected,
532 output_new_test (test_name);
533 test_exceptions (test_name, NO_EXCEPTION);
534 result = check_equal (computed, expected, 0, &diff);
535 output_result_ext (test_name, result,
536 computed, expected, diff, parameter, PRINT, PRINT);
541 check that computed and expected values are the same and
542 checks also for exception flags
545 check_exc (const char *test_name, MATHTYPE computed, MATHTYPE expected,
551 output_new_test (test_name);
552 test_exceptions (test_name, exception);
553 result = check_equal (computed, expected, 0, &diff);
554 output_result (test_name, result,
555 computed, expected, diff, PRINT, PRINT);
559 check that computed and expected values are close enough
562 check_eps (const char *test_name, MATHTYPE computed, MATHTYPE expected,
568 output_new_test (test_name);
569 test_exceptions (test_name, NO_EXCEPTION);
570 result = check_equal (computed, expected, epsilon, &diff);
571 output_result (test_name, result,
572 computed, expected, diff, PRINT, PRINT);
576 check a boolean condition
579 check_bool (const char *test_name, int computed)
581 output_new_test (test_name);
582 test_exceptions (test_name, NO_EXCEPTION);
583 output_result_bool (test_name, computed);
589 check that computed and expected values are equal (int values)
592 check_int (const char *test_name, int computed, int expected)
594 int diff = computed - expected;
595 int result = diff == 0;
597 output_new_test (test_name);
598 test_exceptions (test_name, NO_EXCEPTION);
602 output_pass_value ();
606 output_fail_value (test_name);
609 printf ("Result:\n");
610 printf (" is: %d\n", computed);
611 printf (" should be: %d\n", expected);
616 fpstack_test (test_name);
621 check that computed and expected values are equal (long int values)
624 check_long (const char *test_name, long int computed, long int expected)
626 long int diff = computed - expected;
627 int result = diff == 0;
630 output_new_test (test_name);
631 test_exceptions (test_name, NO_EXCEPTION);
635 output_pass_value ();
639 output_fail_value (test_name);
642 printf ("Result:\n");
643 printf (" is: %ld\n", computed);
644 printf (" should be: %ld\n", expected);
649 fpstack_test (test_name);
653 check that computed and expected values are equal (long long int values)
656 check_longlong (const char *test_name, long long int computed,
657 long long int expected)
659 long long int diff = computed - expected;
660 int result = diff == 0;
663 output_new_test (test_name);
664 test_exceptions (test_name, NO_EXCEPTION);
668 output_pass_value ();
672 output_fail_value (test_name);
675 printf ("Result:\n");
676 printf (" is: %lld\n", computed);
677 printf (" should be: %lld\n", expected);
682 fpstack_test (test_name);
686 check that computed value is not-a-number
689 check_isnan (const char *test_name, MATHTYPE computed)
691 output_new_test (test_name);
692 test_exceptions (test_name, NO_EXCEPTION);
693 output_isvalue (test_name, isnan (computed), computed);
698 check that computed value is not-a-number and test for exceptions
701 check_isnan_exc (const char *test_name, MATHTYPE computed,
704 output_new_test (test_name);
705 test_exceptions (test_name, exception);
706 output_isvalue (test_name, isnan (computed), computed);
711 check that computed value is not-a-number and test for exceptions
714 check_isnan_maybe_exc (const char *test_name, MATHTYPE computed,
717 output_new_test (test_name);
718 test_not_exception (test_name, exception);
719 output_isvalue (test_name, isnan (computed), computed);
723 check that computed value is not-a-number and supply parameter
727 check_isnan_ext (const char *test_name, MATHTYPE computed,
730 output_new_test (test_name);
731 test_exceptions (test_name, NO_EXCEPTION);
732 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
737 check that computed value is not-a-number, test for exceptions
741 check_isnan_exc_ext (const char *test_name, MATHTYPE computed,
742 short exception, MATHTYPE parameter)
744 output_new_test (test_name);
745 test_exceptions (test_name,exception);
746 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
750 /* Tests if computed is +Inf */
752 check_isinfp (const char *test_name, MATHTYPE computed)
754 output_new_test (test_name);
755 test_exceptions (test_name, NO_EXCEPTION);
756 output_isvalue (test_name, (ISINF (computed) == +1), computed);
761 check_isinfp_ext (const char *test_name, MATHTYPE computed,
764 output_new_test (test_name);
765 test_exceptions (test_name, NO_EXCEPTION);
766 output_isvalue_ext (test_name, (ISINF (computed) == +1), computed, parameter);
770 /* Tests if computed is +Inf */
772 check_isinfp_exc (const char *test_name, MATHTYPE computed,
775 output_new_test (test_name);
776 test_exceptions (test_name, exception);
777 output_isvalue (test_name, (ISINF (computed) == +1), computed);
780 /* Tests if computed is -Inf */
782 check_isinfn (const char *test_name, MATHTYPE computed)
784 output_new_test (test_name);
785 test_exceptions (test_name, NO_EXCEPTION);
786 output_isvalue (test_name, (ISINF (computed) == -1), computed);
792 check_isinfn_ext (const char *test_name, MATHTYPE computed,
795 output_new_test (test_name);
796 test_exceptions (test_name, NO_EXCEPTION);
797 output_isvalue_ext (test_name, (ISINF (computed) == -1), computed, parameter);
802 /* Tests if computed is -Inf */
804 check_isinfn_exc (const char *test_name, MATHTYPE computed,
807 output_new_test (test_name);
808 test_exceptions (test_name, exception);
809 output_isvalue (test_name, (ISINF (computed) == -1), computed);
813 /* This is to prevent messages from the SVID libm emulation. */
815 matherr (struct exception *x __attribute__ ((unused)))
821 /****************************************************************************
822 Test for single functions of libm
823 ****************************************************************************/
831 x = random_greater (1);
832 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
837 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
841 check ("acos (0) == pi/2", FUNC(acos) (0), M_PI_2);
842 check ("acos (-0) == pi/2", FUNC(acos) (minus_zero), M_PI_2);
844 check ("acos (1) == 0", FUNC(acos) (1), 0);
845 check ("acos (-1) == pi", FUNC(acos) (-1), M_PI);
847 check ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6 * 2.0);
848 check ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6 * 4.0);
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);
888 check ("asin (-0) == -0", FUNC(asin) (minus_zero), minus_zero);
889 check_eps ("asin (0.5) == pi/6", FUNC(asin) (0.5), M_PI_6,
890 CHOOSE(3.5e-18, 0, 2e-7));
891 check_eps ("asin (-0.5) == -pi/6", FUNC(asin) (-0.5), -M_PI_6,
892 CHOOSE(3.5e-18, 0, 2e-7));
893 check ("asin (1.0) == pi/2", FUNC(asin) (1.0), M_PI_2);
894 check ("asin (-1.0) == -pi/2", FUNC(asin) (-1.0), -M_PI_2);
903 check ("asinh(+0) == +0", FUNC(asinh) (0), 0);
905 check ("asinh(-0) == -0", FUNC(asinh) (minus_zero), minus_zero);
906 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh) (plus_infty));
907 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh) (minus_infty));
916 check ("atan (0) == 0", FUNC(atan) (0), 0);
917 check ("atan (-0) == -0", FUNC(atan) (minus_zero), minus_zero);
919 check ("atan (+inf) == pi/2", FUNC(atan) (plus_infty), M_PI_2);
920 check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2);
922 check ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4);
923 check ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4);
933 x = random_greater (0);
934 check ("atan2 (0,x) == 0 for x > 0",
935 FUNC(atan2) (0, x), 0);
936 x = random_greater (0);
937 check ("atan2 (-0,x) == -0 for x > 0",
938 FUNC(atan2) (minus_zero, x), minus_zero);
940 check ("atan2 (+0,+0) == +0", FUNC(atan2) (0, 0), 0);
941 check ("atan2 (-0,+0) == -0", FUNC(atan2) (minus_zero, 0), minus_zero);
943 x = -random_greater (0);
944 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2) (0, x), M_PI);
946 x = -random_greater (0);
947 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2) (minus_zero, x), -M_PI);
949 check ("atan2 (+0,-0) == +pi", FUNC(atan2) (0, minus_zero), M_PI);
950 check ("atan2 (-0,-0) == -pi", FUNC(atan2) (minus_zero, minus_zero), -M_PI);
952 x = random_greater (0);
953 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2) (x, 0), M_PI_2);
955 x = random_greater (0);
956 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2) (x, minus_zero), M_PI_2);
959 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2) (x, 0), -M_PI_2);
962 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2) (x, minus_zero), -M_PI_2);
964 x = random_greater (0);
965 check ("atan2 (y,inf) == +0 for finite y > 0",
966 FUNC(atan2) (x, plus_infty), 0);
968 x = -random_greater (0);
969 check ("atan2 (y,inf) == -0 for finite y < 0",
970 FUNC(atan2) (x, plus_infty), minus_zero);
972 x = random_value (-1e4, 1e4);
973 check ("atan2(+inf, x) == pi/2 for finite x",
974 FUNC(atan2) (plus_infty, x), M_PI_2);
976 x = random_value (-1e4, 1e4);
977 check ("atan2(-inf, x) == -pi/2 for finite x",
978 FUNC(atan2) (minus_infty, x), -M_PI_2);
980 x = random_greater (0);
981 check ("atan2 (y,-inf) == +pi for finite y > 0",
982 FUNC(atan2) (x, minus_infty), M_PI);
984 x = -random_greater (0);
985 check ("atan2 (y,-inf) == -pi for finite y < 0",
986 FUNC(atan2) (x, minus_infty), -M_PI);
988 check ("atan2 (+inf,+inf) == +pi/4",
989 FUNC(atan2) (plus_infty, plus_infty), M_PI_4);
991 check ("atan2 (-inf,+inf) == -pi/4",
992 FUNC(atan2) (minus_infty, plus_infty), -M_PI_4);
994 check ("atan2 (+inf,-inf) == +3*pi/4",
995 FUNC(atan2) (plus_infty, minus_infty), 3 * M_PI_4);
997 check ("atan2 (-inf,-inf) == -3*pi/4",
998 FUNC(atan2) (minus_infty, minus_infty), -3 * M_PI_4);
1000 /* FIXME: Add some specific tests */
1011 check ("atanh(+0) == +0", FUNC(atanh) (0), 0);
1013 check ("atanh(-0) == -0", FUNC(atanh) (minus_zero), minus_zero);
1015 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
1016 FUNC(atanh) (1), DIVIDE_BY_ZERO_EXCEPTION);
1017 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
1018 FUNC(atanh) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1020 x = random_greater (1.0);
1021 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1022 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1024 x = random_less (1.0);
1025 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1026 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1035 check ("cbrt (+0) == +0", FUNC(cbrt) (0.0), 0.0);
1036 check ("cbrt (-0) == -0", FUNC(cbrt) (minus_zero), minus_zero);
1039 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt) (plus_infty));
1040 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty));
1041 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value));
1043 check_eps ("cbrt (-0.001) == -0.1", FUNC(cbrt) (-0.001), -0.1,
1044 CHOOSE (5e-18L, 0, 0));
1045 check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0));
1046 check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0,
1047 CHOOSE (3e-16L, 5e-16, 0));
1048 check_eps ("cbrt (0.970299) == 0.99", FUNC(cbrt) (0.970299), 0.99,
1049 CHOOSE (2e-17L, 0, 0));
1056 check ("ceil (+0) == +0", FUNC(ceil) (0.0), 0.0);
1057 check ("ceil (-0) == -0", FUNC(ceil) (minus_zero), minus_zero);
1058 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil) (plus_infty));
1059 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil) (minus_infty));
1061 check ("ceil (pi) == 4", FUNC(ceil) (M_PI), 4.0);
1062 check ("ceil (-pi) == -3", FUNC(ceil) (-M_PI), -3.0);
1070 check ("cos (+0) == 1", FUNC(cos) (0), 1);
1071 check ("cos (-0) == 1", FUNC(cos) (minus_zero), 1);
1072 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1073 FUNC(cos) (plus_infty),
1075 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1076 FUNC(cos) (minus_infty),
1079 check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6 * 2.0),
1080 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1081 check_eps ("cos (2*pi/3) == -0.5", FUNC(cos) (M_PI_6 * 4.0),
1082 -0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1083 check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
1084 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1091 check ("cosh (+0) == 1", FUNC(cosh) (0), 1);
1092 check ("cosh (-0) == 1", FUNC(cosh) (minus_zero), 1);
1095 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh) (plus_infty));
1096 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh) (minus_infty));
1106 if (errno == ENOSYS)
1107 /* Function not implemented. */
1110 check ("erf (+0) == +0", FUNC(erf) (0), 0);
1111 check ("erf (-0) == -0", FUNC(erf) (minus_zero), minus_zero);
1112 check ("erf (+inf) == +1", FUNC(erf) (plus_infty), 1);
1113 check ("erf (-inf) == -1", FUNC(erf) (minus_infty), -1);
1122 if (errno == ENOSYS)
1123 /* Function not implemented. */
1126 check ("erfc (+inf) == 0", FUNC(erfc) (plus_infty), 0.0);
1127 check ("erfc (-inf) == 2", FUNC(erfc) (minus_infty), 2.0);
1128 check ("erfc (+0) == 1", FUNC(erfc) (0.0), 1.0);
1129 check ("erfc (-0) == 1", FUNC(erfc) (minus_zero), 1.0);
1136 check ("exp (+0) == 1", FUNC(exp) (0), 1);
1137 check ("exp (-0) == 1", FUNC(exp) (minus_zero), 1);
1140 check_isinfp ("exp (+inf) == +inf", FUNC(exp) (plus_infty));
1141 check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0);
1143 check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 5e-16, 0));
1145 check ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E);
1146 check ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E);
1155 if (errno == ENOSYS)
1156 /* Function not implemented. */
1159 check ("exp2 (+0) == 1", FUNC(exp2) (0), 1);
1160 check ("exp2 (-0) == 1", FUNC(exp2) (minus_zero), 1);
1162 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2) (plus_infty));
1163 check ("exp2 (-inf) == 0", FUNC(exp2) (minus_infty), 0);
1164 check ("exp2 (10) == 1024", FUNC(exp2) (10), 1024);
1165 check ("exp2 (-1) == 0.5", FUNC(exp2) (-1), 0.5);
1166 check_isinfp ("exp2 (1e6) == +inf", FUNC(exp2) (1e6));
1167 check ("exp2 (-1e6) == 0", FUNC(exp2) (-1e6), 0);
1174 check ("expm1 (+0) == 0", FUNC(expm1) (0), 0);
1176 check ("expm1 (-0) == -0", FUNC(expm1) (minus_zero), minus_zero);
1178 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1) (plus_infty));
1179 check ("expm1 (-inf) == -1", FUNC(expm1) (minus_infty), -1);
1182 check_eps ("expm1 (1) == e-1", FUNC(expm1) (1), M_E - 1.0,
1183 CHOOSE (4e-18L, 0, 2e-7));
1190 check_frexp (const char *test_name, MATHTYPE computed, MATHTYPE expected,
1191 int comp_int, int exp_int)
1196 result = (check_equal (computed, expected, 0, &diff)
1197 && (comp_int == exp_int));
1202 printf ("Pass: %s\n", test_name);
1207 printf ("Fail: %s\n", test_name);
1210 printf ("Result:\n");
1211 printf (" is: %.20" PRINTF_EXPR " *2^%d %.20"
1212 PRINTF_XEXPR "*2^%d\n",
1213 computed, comp_int, computed, comp_int);
1214 printf (" should be: %.20" PRINTF_EXPR " *2^%d %.20"
1215 PRINTF_XEXPR "*2^%d\n",
1216 expected, exp_int, expected, exp_int);
1217 printf (" difference: %.20" PRINTF_EXPR " %.20" PRINTF_XEXPR "\n",
1222 fpstack_test (test_name);
1223 output_result (test_name, result,
1224 computed, expected, diff, PRINT, PRINT);
1234 result = FUNC(frexp) (plus_infty, &x_int);
1235 check_isinfp ("frexp (+inf, expr) == +inf", result);
1237 result = FUNC(frexp) (minus_infty, &x_int);
1238 check_isinfn ("frexp (-inf, expr) == -inf", result);
1240 result = FUNC(frexp) (nan_value, &x_int);
1241 check_isnan ("frexp (Nan, expr) == NaN", result);
1243 result = FUNC(frexp) (0, &x_int);
1244 check_frexp ("frexp: +0 == 0 * 2^0", result, 0, x_int, 0);
1246 result = FUNC(frexp) (minus_zero, &x_int);
1247 check_frexp ("frexp: -0 == -0 * 2^0", result, minus_zero, x_int, 0);
1249 result = FUNC(frexp) (12.8L, &x_int);
1250 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result, 0.8L, x_int, 4);
1252 result = FUNC(frexp) (-27.34L, &x_int);
1253 check_frexp ("frexp: -27.34 == -0.854375 * 2^5", result, -0.854375L, x_int, 5);
1258 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
1259 /* All floating-point numbers can be put in one of these categories. */
1263 #define FP_NAN FP_NAN
1265 #define FP_INFINITE FP_INFINITE
1267 #define FP_ZERO FP_ZERO
1269 #define FP_SUBNORMAL FP_SUBNORMAL
1271 #define FP_NORMAL FP_NORMAL
1277 fpclassify_test (void)
1281 /* fpclassify is a macro, don't give it constants as parameter */
1282 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value) == FP_NAN);
1283 check_bool ("fpclassify (+inf) == FP_INFINITE",
1284 fpclassify (plus_infty) == FP_INFINITE);
1285 check_bool ("fpclassify (-inf) == FP_INFINITE",
1286 fpclassify (minus_infty) == FP_INFINITE);
1287 check_bool ("fpclassify (+0) == FP_ZERO",
1288 fpclassify (plus_zero) == FP_ZERO);
1289 check_bool ("fpclassify (-0) == FP_ZERO",
1290 fpclassify (minus_zero) == FP_ZERO);
1293 check_bool ("fpclassify (1000) == FP_NORMAL",
1294 fpclassify (x) == FP_NORMAL);
1299 isfinite_test (void)
1301 check_bool ("isfinite (0) != 0", isfinite (0));
1302 check_bool ("isfinite (-0) != 0", isfinite (minus_zero));
1303 check_bool ("isfinite (10) != 0", isfinite (10));
1304 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty) == 0);
1305 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty) == 0);
1306 check_bool ("isfinite (NaN) == 0", isfinite (nan_value) == 0);
1311 isnormal_test (void)
1313 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1314 check_bool ("isnormal (-0) == 0", isnormal (minus_zero) == 0);
1315 check_bool ("isnormal (10) != 0", isnormal (10));
1316 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty) == 0);
1317 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty) == 0);
1318 check_bool ("isnormal (NaN) == 0", isnormal (nan_value) == 0);
1328 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1329 check_bool ("signbit (-0) != 0", signbit (minus_zero));
1330 check_bool ("signbit (+inf) == 0", signbit (plus_infty) == 0);
1331 check_bool ("signbit (-inf) != 0", signbit (minus_infty));
1333 x = random_less (0);
1334 check_bool ("signbit (x) != 0 for x < 0", signbit (x));
1336 x = random_greater (0);
1337 check_bool ("signbit (x) == 0 for x > 0", signbit (x) == 0);
1343 gamma has different semantics depending on _LIB_VERSION:
1344 if _LIB_VERSION is _SVID, gamma is just an alias for lgamma,
1345 otherwise gamma is the real gamma function as definied in ISO C 9X.
1350 int save_lib_version = _LIB_VERSION;
1353 if (errno == ENOSYS)
1354 /* Function not implemented. */
1356 feclearexcept (FE_ALL_EXCEPT);
1359 _LIB_VERSION = _SVID_;
1361 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
1362 check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
1363 FUNC(gamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1365 check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
1366 FUNC(gamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1367 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1368 FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
1371 check ("gamma (1) == 0", FUNC(gamma) (1), 0);
1372 check_int ("gamma (0) sets signgam to 1", signgam, 1);
1375 check ("gamma (3) == M_LN2", FUNC(gamma) (3), M_LN2);
1376 check_int ("gamma (3) sets signgam to 1", signgam, 1);
1379 check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma) (0.5),
1380 FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
1381 check_int ("gamma (0.5) sets signgam to 1", signgam, 1);
1384 check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma) (-0.5),
1385 FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
1387 check_int ("gamma (-0.5) sets signgam to -1", signgam, -1);
1390 _LIB_VERSION = _IEEE_;
1392 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
1393 check_isnan_exc ("gamma (0) == NaN plus invalid exception",
1394 FUNC(gamma) (0), INVALID_EXCEPTION);
1396 check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for integer x <= 0",
1397 FUNC(gamma) (-2), INVALID_EXCEPTION, -2);
1398 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1399 FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
1401 check_eps ("gamma (0.5) == sqrt(pi)", FUNC(gamma) (0.5), FUNC(sqrt) (M_PI),
1402 CHOOSE (0, 5e-16, 2e-7));
1403 check_eps ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma) (-0.5),
1404 -2*FUNC(sqrt) (M_PI), CHOOSE (0, 5e-16, 3e-7));
1406 check ("gamma (1) == 1", FUNC(gamma) (1), 1);
1407 check ("gamma (4) == 6", FUNC(gamma) (4), 6);
1409 _LIB_VERSION = save_lib_version;
1418 if (errno == ENOSYS)
1419 /* Function not implemented. */
1421 feclearexcept (FE_ALL_EXCEPT);
1423 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma) (plus_infty));
1424 check_isinfp_exc ("lgamma (0) == +inf plus divide by zero exception",
1425 FUNC(lgamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1427 check_isinfp_exc ("lgamma (x) == +inf plus divide by zero exception for integer x <= 0",
1428 FUNC(lgamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1429 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1430 FUNC(lgamma) (minus_infty), INVALID_EXCEPTION);
1433 check ("lgamma (1) == 0", FUNC(lgamma) (1), 0);
1434 check_int ("lgamma (0) sets signgam to 1", signgam, 1);
1437 check ("lgamma (3) == M_LN2", FUNC(lgamma) (3), M_LN2);
1438 check_int ("lgamma (3) sets signgam to 1", signgam, 1);
1441 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma) (0.5),
1442 FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
1443 check_int ("lgamma (0.5) sets signgam to 1", signgam, 1);
1446 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma) (-0.5),
1447 FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
1449 check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1);
1459 check_int ("ilogb (1) == 0", FUNC(ilogb) (1), 0);
1460 check_int ("ilogb (e) == 1", FUNC(ilogb) (M_E), 1);
1461 check_int ("ilogb (1024) == 10", FUNC(ilogb) (1024), 10);
1462 check_int ("ilogb (-2000) == 10", FUNC(ilogb) (-2000), 10);
1464 /* XXX We have a problem here: the standard does not tell us whether
1465 exceptions are allowed/required. ignore them for now. */
1466 i = FUNC (ilogb) (0.0);
1467 feclearexcept (FE_ALL_EXCEPT);
1468 check_int ("ilogb (0) == FP_ILOGB0", i, FP_ILOGB0);
1469 i = FUNC(ilogb) (nan_value);
1470 feclearexcept (FE_ALL_EXCEPT);
1471 check_int ("ilogb (NaN) == FP_ILOGBNAN", i, FP_ILOGBNAN);
1481 check ("ldexp (0, 0) == 0", FUNC(ldexp) (0, 0), 0);
1483 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp) (plus_infty, 1));
1484 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp) (minus_infty, 1));
1485 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp) (nan_value, 1));
1487 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp) (0.8L, 4), 12.8L);
1488 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp) (-0.854375L, 5), -27.34L);
1490 x = random_greater (0.0);
1491 check_ext ("ldexp (x, 0) == x", FUNC(ldexp) (x, 0L), x, x);
1499 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1500 FUNC(log) (0), DIVIDE_BY_ZERO_EXCEPTION);
1501 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1502 FUNC(log) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1504 check ("log (1) == 0", FUNC(log) (1), 0);
1506 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1507 FUNC(log) (-1), INVALID_EXCEPTION);
1508 check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty));
1510 check_eps ("log (e) == 1", FUNC(log) (M_E), 1, CHOOSE (1e-18L, 0, 9e-8L));
1511 check_eps ("log (1/e) == -1", FUNC(log) (1.0 / M_E), -1,
1512 CHOOSE (2e-18L, 0, 0));
1513 check ("log (2) == M_LN2", FUNC(log) (2), M_LN2);
1514 check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10,
1515 CHOOSE (1e-18L, 0, 0));
1522 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1523 FUNC(log10) (0), DIVIDE_BY_ZERO_EXCEPTION);
1524 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1525 FUNC(log10) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1527 check ("log10 (1) == +0", FUNC(log10) (1), 0);
1529 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1530 FUNC(log10) (-1), INVALID_EXCEPTION);
1532 check_isinfp ("log10 (+inf) == +inf", FUNC(log10) (plus_infty));
1534 check_eps ("log10 (0.1) == -1", FUNC(log10) (0.1L), -1,
1535 CHOOSE (1e-18L, 0, 0));
1536 check_eps ("log10 (10) == 1", FUNC(log10) (10.0), 1,
1537 CHOOSE (1e-18L, 0, 0));
1538 check_eps ("log10 (100) == 2", FUNC(log10) (100.0), 2,
1539 CHOOSE (1e-18L, 0, 0));
1540 check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
1541 check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_E), M_LOG10E,
1542 CHOOSE (1e-18, 0, 9e-8));
1549 check ("log1p (+0) == +0", FUNC(log1p) (0), 0);
1550 check ("log1p (-0) == -0", FUNC(log1p) (minus_zero), minus_zero);
1552 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1553 FUNC(log1p) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1554 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1555 FUNC(log1p) (-2), INVALID_EXCEPTION);
1557 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p) (plus_infty));
1559 check_eps ("log1p (e-1) == 1", FUNC(log1p) (M_E - 1.0), 1,
1560 CHOOSE (1e-18L, 0, 6e-8));
1568 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1569 FUNC(log2) (0), DIVIDE_BY_ZERO_EXCEPTION);
1570 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1571 FUNC(log2) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1573 check ("log2 (1) == +0", FUNC(log2) (1), 0);
1575 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1576 FUNC(log2) (-1), INVALID_EXCEPTION);
1578 check_isinfp ("log2 (+inf) == +inf", FUNC(log2) (plus_infty));
1580 check_eps ("log2 (e) == M_LOG2E", FUNC(log2) (M_E), M_LOG2E,
1581 CHOOSE (1e-18L, 0, 0));
1582 check ("log2 (2) == 1", FUNC(log2) (2.0), 1);
1583 check_eps ("log2 (16) == 4", FUNC(log2) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1584 check ("log2 (256) == 8", FUNC(log2) (256.0), 8);
1592 check_isinfp ("logb (+inf) == +inf", FUNC(logb) (plus_infty));
1593 check_isinfp ("logb (-inf) == +inf", FUNC(logb) (minus_infty));
1595 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1596 FUNC(logb) (0), DIVIDE_BY_ZERO_EXCEPTION);
1598 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1599 FUNC(logb) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1601 check ("logb (1) == 0", FUNC(logb) (1), 0);
1602 check ("logb (e) == 1", FUNC(logb) (M_E), 1);
1603 check ("logb (1024) == 10", FUNC(logb) (1024), 10);
1604 check ("logb (-2000) == 10", FUNC(logb) (-2000), 10);
1612 MATHTYPE result, intpart;
1614 result = FUNC(modf) (plus_infty, &intpart);
1615 check ("modf (+inf, &x) returns +0", result, 0);
1616 check_isinfp ("modf (+inf, &x) set x to +inf", intpart);
1618 result = FUNC(modf) (minus_infty, &intpart);
1619 check ("modf (-inf, &x) returns -0", result, minus_zero);
1620 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart);
1622 result = FUNC(modf) (nan_value, &intpart);
1623 check_isnan ("modf (NaN, &x) returns NaN", result);
1624 check_isnan ("modf (NaN, &x) sets x to NaN", intpart);
1626 result = FUNC(modf) (0, &intpart);
1627 check ("modf (0, &x) returns 0", result, 0);
1628 check ("modf (0, &x) sets x to 0", intpart, 0);
1630 result = FUNC(modf) (minus_zero, &intpart);
1631 check ("modf (-0, &x) returns -0", result, minus_zero);
1632 check ("modf (-0, &x) sets x to -0", intpart, minus_zero);
1634 result = FUNC(modf) (2.5, &intpart);
1635 check ("modf (2.5, &x) returns 0.5", result, 0.5);
1636 check ("modf (2.5, &x) sets x to 2", intpart, 2);
1638 result = FUNC(modf) (-2.5, &intpart);
1639 check ("modf (-2.5, &x) returns -0.5", result, -0.5);
1640 check ("modf (-2.5, &x) sets x to -2", intpart, -2);
1650 check_isnan ("scalb (2, 0.5) == NaN", FUNC(scalb) (2, 0.5));
1651 check_isnan ("scalb (3, -2.5) == NaN", FUNC(scalb) (3, -2.5));
1653 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1654 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1656 x = random_greater (0.0);
1657 check ("scalb (x, 0) == 0", FUNC(scalb) (x, 0), x);
1658 x = random_greater (0.0);
1659 check ("scalb (-x, 0) == 0", FUNC(scalb) (-x, 0), -x);
1661 check_isnan_exc ("scalb (+0, +inf) == NaN plus invalid exception",
1662 FUNC(scalb) (0, plus_infty), INVALID_EXCEPTION);
1663 check_isnan_exc ("scalb (-0, +inf) == NaN plus invalid exception",
1664 FUNC(scalb) (minus_zero, plus_infty), INVALID_EXCEPTION);
1666 check ("scalb (+0, 2) == +0", FUNC(scalb) (0, 2), 0);
1667 check ("scalb (-0, 4) == -0", FUNC(scalb) (minus_zero, -4), minus_zero);
1668 check ("scalb (+0, 0) == +0", FUNC(scalb) (0, 0), 0);
1669 check ("scalb (-0, 0) == -0", FUNC(scalb) (minus_zero, 0), minus_zero);
1670 check ("scalb (+0, -1) == +0", FUNC(scalb) (0, -1), 0);
1671 check ("scalb (-0, -10) == -0", FUNC(scalb) (minus_zero, -10), minus_zero);
1672 check ("scalb (+0, -inf) == +0", FUNC(scalb) (0, minus_infty), 0);
1673 check ("scalb (-0, -inf) == -0", FUNC(scalb) (minus_zero, minus_infty),
1676 check_isinfp ("scalb (+inf, -1) == +inf", FUNC(scalb) (plus_infty, -1));
1677 check_isinfn ("scalb (-inf, -10) == -inf", FUNC(scalb) (minus_infty, -10));
1678 check_isinfp ("scalb (+inf, 0) == +inf", FUNC(scalb) (plus_infty, 0));
1679 check_isinfn ("scalb (-inf, 0) == -inf", FUNC(scalb) (minus_infty, 0));
1680 check_isinfp ("scalb (+inf, 2) == +inf", FUNC(scalb) (plus_infty, 2));
1681 check_isinfn ("scalb (-inf, 100) == -inf", FUNC(scalb) (minus_infty, 100));
1683 x = random_greater (0.0);
1684 check ("scalb (x, -inf) == 0", FUNC(scalb) (x, minus_infty), 0.0);
1685 check ("scalb (-x, -inf) == -0", FUNC(scalb) (-x, minus_infty), minus_zero);
1687 x = random_greater (0.0);
1688 check_isinfp ("scalb (x, +inf) == +inf", FUNC(scalb) (x, plus_infty));
1689 x = random_greater (0.0);
1690 check_isinfn ("scalb (-x, +inf) == -inf", FUNC(scalb) (-x, plus_infty));
1691 check_isinfp ("scalb (+inf, +inf) == +inf",
1692 FUNC(scalb) (plus_infty, plus_infty));
1693 check_isinfn ("scalb (-inf, +inf) == -inf",
1694 FUNC(scalb) (minus_infty, plus_infty));
1696 check_isnan ("scalb (+inf, -inf) == NaN",
1697 FUNC(scalb) (plus_infty, minus_infty));
1698 check_isnan ("scalb (-inf, -inf) == NaN",
1699 FUNC(scalb) (minus_infty, minus_infty));
1701 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb) (nan_value, 1));
1702 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1703 check_isnan ("scalb (NaN, 0) == NaN", FUNC(scalb) (nan_value, 0));
1704 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1705 check_isnan ("scalb (NaN, +inf) == NaN",
1706 FUNC(scalb) (nan_value, plus_infty));
1707 check_isnan ("scalb (+inf, NaN) == NaN",
1708 FUNC(scalb) (plus_infty, nan_value));
1709 check_isnan ("scalb (NaN, NaN) == NaN", FUNC(scalb) (nan_value, nan_value));
1711 check ("scalb (0.8, 4) == 12.8", FUNC(scalb) (0.8L, 4), 12.8L);
1712 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb) (-0.854375L, 5), -27.34L);
1721 check ("scalbn (0, 0) == 0", FUNC(scalbn) (0, 0), 0);
1723 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn) (plus_infty, 1));
1724 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn) (minus_infty, 1));
1725 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn) (nan_value, 1));
1727 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn) (0.8L, 4), 12.8L);
1728 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn) (-0.854375L, 5), -27.34L);
1730 x = random_greater (0.0);
1731 check_ext ("scalbn (x, 0) == x", FUNC(scalbn) (x, 0L), x, x);
1738 check ("sin (+0) == +0", FUNC(sin) (0), 0);
1739 check ("sin (-0) == -0", FUNC(sin) (minus_zero), minus_zero);
1740 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1741 FUNC(sin) (plus_infty),
1743 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1744 FUNC(sin) (minus_infty),
1747 check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6),
1748 0.5, CHOOSE (4e-18L, 0, 0));
1749 check_eps ("sin (-pi/6) == -0.5", FUNC(sin) (-M_PI_6),
1750 -0.5, CHOOSE (4e-18L, 0, 0));
1751 check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
1752 check ("sin (-pi/2) == -1", FUNC(sin) (-M_PI_2), -1);
1759 check ("sinh (+0) == +0", FUNC(sinh) (0), 0);
1762 check ("sinh (-0) == -0", FUNC(sinh) (minus_zero), minus_zero);
1764 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh) (plus_infty));
1765 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh) (minus_infty));
1773 MATHTYPE sin_res, cos_res;
1776 FUNC(sincos) (0, &sin_res, &cos_res);
1778 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res, 0);
1780 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res, 1);
1782 FUNC(sincos) (minus_zero, &sin_res, &cos_res);
1784 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res, minus_zero);
1786 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res, 1);
1788 FUNC(sincos) (plus_infty, &sin_res, &cos_res);
1790 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1791 sin_res, INVALID_EXCEPTION);
1793 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1794 cos_res, INVALID_EXCEPTION);
1796 FUNC(sincos) (minus_infty, &sin_res, &cos_res);
1798 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1799 sin_res, INVALID_EXCEPTION);
1801 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1802 cos_res, INVALID_EXCEPTION);
1804 FUNC(sincos) (M_PI_2, &sin_res, &cos_res);
1806 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res, 1);
1808 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
1809 CHOOSE (1e-18L, 1e-16, 1e-7));
1811 FUNC(sincos) (M_PI_6, &sin_res, &cos_res);
1812 check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5,
1813 CHOOSE (5e-18L, 0, 0));
1815 FUNC(sincos) (M_PI_6*2.0, &sin_res, &cos_res);
1816 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
1817 CHOOSE (5e-18L, 1e-15, 1e-7));
1826 check ("tan (+0) == +0", FUNC(tan) (0), 0);
1827 check ("tan (-0) == -0", FUNC(tan) (minus_zero), minus_zero);
1828 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1829 FUNC(tan) (plus_infty), INVALID_EXCEPTION);
1830 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1831 FUNC(tan) (minus_infty), INVALID_EXCEPTION);
1833 check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4), 1,
1834 CHOOSE (2e-18L, 1e-15L, 2e-7));
1841 check ("tanh (+0) == +0", FUNC(tanh) (0), 0);
1843 check ("tanh (-0) == -0", FUNC(tanh) (minus_zero), minus_zero);
1845 check ("tanh (+inf) == +1", FUNC(tanh) (plus_infty), 1);
1846 check ("tanh (-inf) == -1", FUNC(tanh) (minus_infty), -1);
1854 check ("fabs (+0) == +0", FUNC(fabs) (0), 0);
1855 check ("fabs (-0) == +0", FUNC(fabs) (minus_zero), 0);
1857 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs) (plus_infty));
1858 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs) (minus_infty));
1860 check ("fabs (+38) == 38", FUNC(fabs) (38.0), 38.0);
1861 check ("fabs (-e) == e", FUNC(fabs) (-M_E), M_E);
1868 check ("floor (+0) == +0", FUNC(floor) (0.0), 0.0);
1869 check ("floor (-0) == -0", FUNC(floor) (minus_zero), minus_zero);
1870 check_isinfp ("floor (+inf) == +inf", FUNC(floor) (plus_infty));
1871 check_isinfn ("floor (-inf) == -inf", FUNC(floor) (minus_infty));
1873 check ("floor (pi) == 3", FUNC(floor) (M_PI), 3.0);
1874 check ("floor (-pi) == -4", FUNC(floor) (-M_PI), -4.0);
1883 a = random_greater (0);
1884 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot) (plus_infty, a), a);
1885 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot) (minus_infty, a), a);
1888 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
1889 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
1892 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot) (nan_value, nan_value));
1894 a = FUNC(hypot) (12.4L, 0.7L);
1895 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot) (0.7L, 12.4L), a);
1896 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot) (-12.4L, 0.7L), a);
1897 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot) (-0.7L, 12.4L), a);
1898 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot) (-12.4L, -0.7L), a);
1899 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot) (-0.7L, -12.4L), a);
1900 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-0.7L, 0), 0.7L);
1901 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (0.7L, 0), 0.7L);
1902 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-1.0L, 0), 1.0L);
1903 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (1.0L, 0), 1.0L);
1904 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
1905 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (5.7e7L, 0), 5.7e7L);
1914 check ("pow (+0, +0) == 1", FUNC(pow) (0, 0), 1);
1915 check ("pow (+0, -0) == 1", FUNC(pow) (0, minus_zero), 1);
1916 check ("pow (-0, +0) == 1", FUNC(pow) (minus_zero, 0), 1);
1917 check ("pow (-0, -0) == 1", FUNC(pow) (minus_zero, minus_zero), 1);
1919 check ("pow (+10, +0) == 1", FUNC(pow) (10, 0), 1);
1920 check ("pow (+10, -0) == 1", FUNC(pow) (10, minus_zero), 1);
1921 check ("pow (-10, +0) == 1", FUNC(pow) (-10, 0), 1);
1922 check ("pow (-10, -0) == 1", FUNC(pow) (-10, minus_zero), 1);
1924 check ("pow (NaN, +0) == 1", FUNC(pow) (nan_value, 0), 1);
1925 check ("pow (NaN, -0) == 1", FUNC(pow) (nan_value, minus_zero), 1);
1928 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow) (1.1, plus_infty));
1929 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow) (plus_infty, plus_infty));
1930 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow) (-1.1, plus_infty));
1931 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow) (minus_infty, plus_infty));
1933 check ("pow (0.9, +inf) == +0", FUNC(pow) (0.9L, plus_infty), 0);
1934 check ("pow (1e-7, +inf) == +0", FUNC(pow) (1e-7L, plus_infty), 0);
1935 check ("pow (-0.9, +inf) == +0", FUNC(pow) (-0.9L, plus_infty), 0);
1936 check ("pow (-1e-7, +inf) == +0", FUNC(pow) (-1e-7L, plus_infty), 0);
1938 check ("pow (+1.1, -inf) == 0", FUNC(pow) (1.1, minus_infty), 0);
1939 check ("pow (+inf, -inf) == 0", FUNC(pow) (plus_infty, minus_infty), 0);
1940 check ("pow (-1.1, -inf) == 0", FUNC(pow) (-1.1, minus_infty), 0);
1941 check ("pow (-inf, -inf) == 0", FUNC(pow) (minus_infty, minus_infty), 0);
1943 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow) (0.9L, minus_infty));
1944 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow) (1e-7L, minus_infty));
1945 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow) (-0.9L, minus_infty));
1946 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow) (-1e-7L, minus_infty));
1948 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow) (plus_infty, 1e-7L));
1949 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow) (plus_infty, 1));
1950 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow) (plus_infty, 1e7L));
1952 check ("pow (+inf, -1e-7) == 0", FUNC(pow) (plus_infty, -1e-7L), 0);
1953 check ("pow (+inf, -1) == 0", FUNC(pow) (plus_infty, -1), 0);
1954 check ("pow (+inf, -1e7) == 0", FUNC(pow) (plus_infty, -1e7L), 0);
1956 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow) (minus_infty, 1));
1957 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow) (minus_infty, 11));
1958 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow) (minus_infty, 1001));
1960 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow) (minus_infty, 2));
1961 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow) (minus_infty, 12));
1962 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow) (minus_infty, 1002));
1963 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow) (minus_infty, 0.1));
1964 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow) (minus_infty, 1.1));
1965 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow) (minus_infty, 11.1));
1966 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow) (minus_infty, 1001.1));
1968 check ("pow (-inf, -1) == -0", FUNC(pow) (minus_infty, -1), minus_zero);
1969 check ("pow (-inf, -11) == -0", FUNC(pow) (minus_infty, -11), minus_zero);
1970 check ("pow (-inf, -1001) == -0", FUNC(pow) (minus_infty, -1001), minus_zero);
1972 check ("pow (-inf, -2) == +0", FUNC(pow) (minus_infty, -2), 0);
1973 check ("pow (-inf, -12) == +0", FUNC(pow) (minus_infty, -12), 0);
1974 check ("pow (-inf, -1002) == +0", FUNC(pow) (minus_infty, -1002), 0);
1975 check ("pow (-inf, -0.1) == +0", FUNC(pow) (minus_infty, -0.1), 0);
1976 check ("pow (-inf, -1.1) == +0", FUNC(pow) (minus_infty, -1.1), 0);
1977 check ("pow (-inf, -11.1) == +0", FUNC(pow) (minus_infty, -11.1), 0);
1978 check ("pow (-inf, -1001.1) == +0", FUNC(pow) (minus_infty, -1001.1), 0);
1980 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow) (nan_value, nan_value));
1981 check_isnan ("pow (0, NaN) == NaN", FUNC(pow) (0, nan_value));
1982 check_isnan ("pow (1, NaN) == NaN", FUNC(pow) (1, nan_value));
1983 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow) (-1, nan_value));
1984 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow) (nan_value, 1));
1985 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow) (nan_value, -1));
1987 x = random_greater (0.0);
1988 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow) (x, nan_value), x);
1990 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
1991 FUNC(pow) (1, plus_infty), INVALID_EXCEPTION);
1992 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
1993 FUNC(pow) (-1, plus_infty), INVALID_EXCEPTION);
1994 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
1995 FUNC(pow) (1, minus_infty), INVALID_EXCEPTION);
1996 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
1997 FUNC(pow) (-1, minus_infty), INVALID_EXCEPTION);
1999 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
2000 FUNC(pow) (-0.1, 1.1), INVALID_EXCEPTION);
2001 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
2002 FUNC(pow) (-0.1, -1.1), INVALID_EXCEPTION);
2003 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
2004 FUNC(pow) (-10.1, 1.1), INVALID_EXCEPTION);
2005 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
2006 FUNC(pow) (-10.1, -1.1), INVALID_EXCEPTION);
2008 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
2009 FUNC(pow) (0, -1), DIVIDE_BY_ZERO_EXCEPTION);
2010 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
2011 FUNC(pow) (0, -11), DIVIDE_BY_ZERO_EXCEPTION);
2012 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
2013 FUNC(pow) (minus_zero, -1), DIVIDE_BY_ZERO_EXCEPTION);
2014 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
2015 FUNC(pow) (minus_zero, -11), DIVIDE_BY_ZERO_EXCEPTION);
2017 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
2018 FUNC(pow) (0, -2), DIVIDE_BY_ZERO_EXCEPTION);
2019 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
2020 FUNC(pow) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
2021 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
2022 FUNC(pow) (minus_zero, -2), DIVIDE_BY_ZERO_EXCEPTION);
2023 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
2024 FUNC(pow) (minus_zero, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
2027 check ("pow (+0, 1) == +0", FUNC(pow) (0, 1), 0);
2028 check ("pow (+0, 11) == +0", FUNC(pow) (0, 11), 0);
2030 check ("pow (-0, 1) == -0", FUNC(pow) (minus_zero, 1), minus_zero);
2031 check ("pow (-0, 11) == -0", FUNC(pow) (minus_zero, 11), minus_zero);
2034 check ("pow (+0, 2) == +0", FUNC(pow) (0, 2), 0);
2035 check ("pow (+0, 11.1) == +0", FUNC(pow) (0, 11.1), 0);
2038 check ("pow (-0, 2) == +0", FUNC(pow) (minus_zero, 2), 0);
2039 check ("pow (-0, 11.1) == +0", FUNC(pow) (minus_zero, 11.1), 0);
2041 x = random_greater (1.0);
2042 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
2043 FUNC(pow) (x, plus_infty), x);
2045 x = random_value (-1.0, 1.0);
2046 check_ext ("pow (x, +inf) == +0 for |x| < 1",
2047 FUNC(pow) (x, plus_infty), 0.0, x);
2049 x = random_greater (1.0);
2050 check_ext ("pow (x, -inf) == +0 for |x| > 1",
2051 FUNC(pow) (x, minus_infty), 0.0, x);
2053 x = random_value (-1.0, 1.0);
2054 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
2055 FUNC(pow) (x, minus_infty), x);
2057 x = random_greater (0.0);
2058 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
2059 FUNC(pow) (plus_infty, x), x);
2061 x = random_less (0.0);
2062 check_ext ("pow (+inf, y) == +0 for y < 0",
2063 FUNC(pow) (plus_infty, x), 0.0, x);
2065 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2066 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
2067 FUNC(pow) (minus_infty, x), x);
2069 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2070 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
2071 FUNC(pow) (minus_infty, x), x);
2073 x = -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
2074 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
2075 FUNC(pow) (minus_infty, x), minus_zero, x);
2077 x = ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
2078 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
2079 FUNC(pow) (minus_infty, x), 0.0, x);
2082 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2083 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
2084 FUNC(pow) (0.0, x), 0.0, x);
2086 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2087 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
2088 FUNC(pow) (minus_zero, x), minus_zero, x);
2091 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2092 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
2093 FUNC(pow) (0.0, x), 0.0, x);
2095 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2096 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
2097 FUNC(pow) (minus_zero, x), 0.0, x);
2104 check ("fdim (+0, +0) = +0", FUNC(fdim) (0, 0), 0);
2105 check ("fdim (9, 0) = 9", FUNC(fdim) (9, 0), 9);
2106 check ("fdim (0, 9) = 0", FUNC(fdim) (0, 9), 0);
2107 check ("fdim (-9, 0) = 9", FUNC(fdim) (-9, 0), 0);
2108 check ("fdim (0, -9) = 9", FUNC(fdim) (0, -9), 9);
2110 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim) (plus_infty, 9));
2111 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim) (plus_infty, -9));
2112 check ("fdim (-inf, 9) = 0", FUNC(fdim) (minus_infty, 9), 0);
2113 check ("fdim (-inf, -9) = 0", FUNC(fdim) (minus_infty, -9), 0);
2114 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim) (9, minus_infty));
2115 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim) (-9, minus_infty));
2116 check ("fdim (9, inf) = 0", FUNC(fdim) (9, plus_infty), 0);
2117 check ("fdim (-9, inf) = 0", FUNC(fdim) (-9, plus_infty), 0);
2119 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim) (0, nan_value));
2120 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim) (9, nan_value));
2121 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim) (-9, nan_value));
2122 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim) (nan_value, 9));
2123 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim) (nan_value, -9));
2124 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim) (plus_infty, nan_value));
2125 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim) (minus_infty, nan_value));
2126 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim) (nan_value, plus_infty));
2127 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim) (nan_value, minus_infty));
2128 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim) (nan_value, nan_value));
2135 check ("fmin (+0, +0) = +0", FUNC(fmin) (0, 0), 0);
2136 check ("fmin (9, 0) = 0", FUNC(fmin) (9, 0), 0);
2137 check ("fmin (0, 9) = 0", FUNC(fmin) (0, 9), 0);
2138 check ("fmin (-9, 0) = -9", FUNC(fmin) (-9, 0), -9);
2139 check ("fmin (0, -9) = -9", FUNC(fmin) (0, -9), -9);
2141 check ("fmin (+inf, 9) = 9", FUNC(fmin) (plus_infty, 9), 9);
2142 check ("fmin (9, +inf) = 9", FUNC(fmin) (9, plus_infty), 9);
2143 check ("fmin (+inf, -9) = -9", FUNC(fmin) (plus_infty, -9), -9);
2144 check ("fmin (-9, +inf) = -9", FUNC(fmin) (-9, plus_infty), -9);
2145 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin) (minus_infty, 9));
2146 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin) (minus_infty, -9));
2147 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin) (9, minus_infty));
2148 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin) (-9, minus_infty));
2150 check ("fmin (0, NaN) = 0", FUNC(fmin) (0, nan_value), 0);
2151 check ("fmin (9, NaN) = 9", FUNC(fmin) (9, nan_value), 9);
2152 check ("fmin (-9, NaN) = 9", FUNC(fmin) (-9, nan_value), -9);
2153 check ("fmin (NaN, 0) = 0", FUNC(fmin) (nan_value, 0), 0);
2154 check ("fmin (NaN, 9) = NaN", FUNC(fmin) (nan_value, 9), 9);
2155 check ("fmin (NaN, -9) = NaN", FUNC(fmin) (nan_value, -9), -9);
2156 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin) (plus_infty, nan_value));
2157 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin) (minus_infty, nan_value));
2158 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin) (nan_value, plus_infty));
2159 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin) (nan_value, minus_infty));
2160 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin) (nan_value, nan_value));
2167 check ("fmax (+0, +0) = +0", FUNC(fmax) (0, 0), 0);
2168 check ("fmax (9, 0) = 9", FUNC(fmax) (9, 0), 9);
2169 check ("fmax (0, 9) = 9", FUNC(fmax) (0, 9), 9);
2170 check ("fmax (-9, 0) = 0", FUNC(fmax) (-9, 0), 0);
2171 check ("fmax (0, -9) = 0", FUNC(fmax) (0, -9), 0);
2173 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax) (plus_infty, 9));
2174 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax) (0, plus_infty));
2175 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax) (-9, plus_infty));
2176 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax) (plus_infty, -9));
2177 check ("fmax (-inf, 9) = 9", FUNC(fmax) (minus_infty, 9), 9);
2178 check ("fmax (-inf, -9) = -9", FUNC(fmax) (minus_infty, -9), -9);
2179 check ("fmax (+9, -inf) = 9", FUNC(fmax) (9, minus_infty), 9);
2180 check ("fmax (-9, -inf) = -9", FUNC(fmax) (-9, minus_infty), -9);
2182 check ("fmax (0, NaN) = 0", FUNC(fmax) (0, nan_value), 0);
2183 check ("fmax (9, NaN) = 9", FUNC(fmax) (9, nan_value), 9);
2184 check ("fmax (-9, NaN) = 9", FUNC(fmax) (-9, nan_value), -9);
2185 check ("fmax (NaN, 0) = 0", FUNC(fmax) (nan_value, 0), 0);
2186 check ("fmax (NaN, 9) = NaN", FUNC(fmax) (nan_value, 9), 9);
2187 check ("fmax (NaN, -9) = NaN", FUNC(fmax) (nan_value, -9), -9);
2188 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax) (plus_infty, nan_value));
2189 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax) (minus_infty, nan_value));
2190 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax) (nan_value, plus_infty));
2191 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax) (nan_value, minus_infty));
2192 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax) (nan_value, nan_value));
2201 x = random_greater (0);
2202 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod) (0, x), 0, x);
2204 x = random_greater (0);
2205 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod) (minus_zero, x),
2208 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2209 FUNC(fmod) (plus_infty, x), INVALID_EXCEPTION, x);
2210 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2211 FUNC(fmod) (minus_infty, x), INVALID_EXCEPTION, x);
2212 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2213 FUNC(fmod) (x, 0), INVALID_EXCEPTION, x);
2214 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2215 FUNC(fmod) (x, minus_zero), INVALID_EXCEPTION, x);
2217 x = random_greater (0);
2218 check_ext ("fmod (x, +inf) == x for x not infinite",
2219 FUNC(fmod) (x, plus_infty), x, x);
2220 x = random_greater (0);
2221 check_ext ("fmod (x, -inf) == x for x not infinite",
2222 FUNC(fmod) (x, minus_infty), x, x);
2224 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod) (6.5, 2.3), 1.9,
2225 CHOOSE(5e-16, 1e-15, 2e-7));
2226 check_eps ("fmod (-6.5, 2.3) == -1.9", FUNC(fmod) (-6.5, 2.3), -1.9,
2227 CHOOSE(5e-16, 1e-15, 2e-7));
2228 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod) (6.5, -2.3), 1.9,
2229 CHOOSE(5e-16, 1e-15, 2e-7));
2230 check_eps ("fmod (-6.5, -2.3) == -1.9", FUNC(fmod) (-6.5, -2.3), -1.9,
2231 CHOOSE(5e-16, 1e-15, 2e-7));
2238 nextafter_test (void)
2242 check ("nextafter (+0, +0) = +0", FUNC(nextafter) (0, 0), 0);
2243 check ("nextafter (-0, +0) = +0", FUNC(nextafter) (minus_zero, 0), 0);
2244 check ("nextafter (+0, -0) = -0", FUNC(nextafter) (0, minus_zero),
2246 check ("nextafter (-0, -0) = -0", FUNC(nextafter) (minus_zero, minus_zero),
2249 check ("nextafter (9, 9) = 9", FUNC(nextafter) (9, 9), 9);
2250 check ("nextafter (-9, -9) = -9", FUNC(nextafter) (-9, -9), -9);
2251 check_isinfp ("nextafter (+inf, +inf) = +inf",
2252 FUNC(nextafter) (plus_infty, plus_infty));
2253 check_isinfn ("nextafter (-inf, -inf) = -inf",
2254 FUNC(nextafter) (minus_infty, minus_infty));
2257 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter) (nan_value, x));
2258 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter) (x, nan_value));
2259 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter) (nan_value,
2262 /* XXX We need the hexadecimal FP number representation here for further
2268 copysign_test (void)
2270 check ("copysign (0, 4) = 0", FUNC(copysign) (0, 4), 0);
2271 check ("copysign (0, -4) = -0", FUNC(copysign) (0, -4), minus_zero);
2272 check ("copysign (-0, 4) = 0", FUNC(copysign) (minus_zero, 4), 0);
2273 check ("copysign (-0, -4) = -0", FUNC(copysign) (minus_zero, -4),
2276 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign) (plus_infty, 0));
2277 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign) (plus_infty,
2279 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign) (minus_infty, 0));
2280 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign) (minus_infty,
2283 check ("copysign (0, +inf) = 0", FUNC(copysign) (0, plus_infty), 0);
2284 check ("copysign (0, -inf) = -0", FUNC(copysign) (0, minus_zero),
2286 check ("copysign (-0, +inf) = 0", FUNC(copysign) (minus_zero, plus_infty),
2288 check ("copysign (-0, -inf) = -0", FUNC(copysign) (minus_zero, minus_zero),
2291 /* XXX More correctly we would have to check the sign of the NaN. */
2292 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign) (nan_value, 0));
2293 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign) (nan_value,
2295 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign) (-nan_value, 0));
2296 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign) (-nan_value,
2304 check ("trunc(0) = 0", FUNC(trunc) (0), 0);
2305 check ("trunc(-0) = -0", FUNC(trunc) (minus_zero), minus_zero);
2306 check ("trunc(0.625) = 0", FUNC(trunc) (0.625), 0);
2307 check ("trunc(-0.625) = -0", FUNC(trunc) (-0.625), minus_zero);
2308 check ("trunc(1) = 1", FUNC(trunc) (1), 1);
2309 check ("trunc(-1) = -1", FUNC(trunc) (-1), -1);
2310 check ("trunc(1.625) = 1", FUNC(trunc) (1.625), 1);
2311 check ("trunc(-1.625) = -1", FUNC(trunc) (-1.625), -1);
2313 check ("trunc(1048580.625) = 1048580", FUNC(trunc) (1048580.625L),
2315 check ("trunc(-1048580.625) = -1048580", FUNC(trunc) (-1048580.625L),
2318 check ("trunc(8388610.125) = 8388610", FUNC(trunc) (8388610.125L),
2320 check ("trunc(-8388610.125) = -8388610", FUNC(trunc) (-8388610.125L),
2323 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc) (4294967296.625L),
2325 check ("trunc(-4294967296.625) = -4294967296",
2326 FUNC(trunc) (-4294967296.625L), -4294967296.0L);
2328 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc) (plus_infty));
2329 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc) (minus_infty));
2330 check_isnan ("trunc(NaN) = NaN", FUNC(trunc) (nan_value));
2340 /* XXX Tests fuer negative x are missing */
2341 check ("sqrt (0) == 0", FUNC(sqrt) (0), 0);
2342 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt) (nan_value));
2343 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt) (plus_infty));
2345 check ("sqrt (-0) == -0", FUNC(sqrt) (0), 0);
2347 x = random_less (0.0);
2348 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2349 FUNC(sqrt) (x), INVALID_EXCEPTION, x);
2351 x = random_value (0, 10000);
2352 check_ext ("sqrt (x*x) == x", FUNC(sqrt) (x*x), x, x);
2353 check ("sqrt (4) == 2", FUNC(sqrt) (4), 2);
2354 check ("sqrt (0.25) == 0.5", FUNC(sqrt) (0.25), 0.5);
2355 check ("sqrt (6642.25) == 81.5", FUNC(sqrt) (6642.25), 81.5);
2356 check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt) (15239.903), 123.45,
2357 CHOOSE (3e-6L, 3e-6, 8e-6));
2362 remainder_test (void)
2366 result = FUNC(remainder) (1, 0);
2367 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2368 result, INVALID_EXCEPTION);
2370 result = FUNC(remainder) (1, minus_zero);
2371 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2372 result, INVALID_EXCEPTION);
2374 result = FUNC(remainder) (plus_infty, 1);
2375 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2376 result, INVALID_EXCEPTION);
2378 result = FUNC(remainder) (minus_infty, 1);
2379 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2380 result, INVALID_EXCEPTION);
2382 result = FUNC(remainder) (1.625, 1.0);
2383 check ("remainder(1.625, 1.0) == -0.375", result, -0.375);
2385 result = FUNC(remainder) (-1.625, 1.0);
2386 check ("remainder(-1.625, 1.0) == 0.375", result, 0.375);
2388 result = FUNC(remainder) (1.625, -1.0);
2389 check ("remainder(1.625, -1.0) == -0.375", result, -0.375);
2391 result = FUNC(remainder) (-1.625, -1.0);
2392 check ("remainder(-1.625, -1.0) == 0.375", result, 0.375);
2394 result = FUNC(remainder) (5.0, 2.0);
2395 check ("remainder(5.0, 2.0) == 1.0", result, 1.0);
2397 result = FUNC(remainder) (3.0, 2.0);
2398 check ("remainder(3.0, 2.0) == -1.0", result, -1.0);
2408 result = FUNC(remquo) (1, 0, &quo);
2409 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2410 result, INVALID_EXCEPTION);
2412 result = FUNC(remquo) (1, minus_zero, &quo);
2413 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2414 result, INVALID_EXCEPTION);
2416 result = FUNC(remquo) (plus_infty, 1, &quo);
2417 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2418 result, INVALID_EXCEPTION);
2420 result = FUNC(remquo) (minus_infty, 1, &quo);
2421 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2422 result, INVALID_EXCEPTION);
2424 result = FUNC(remquo) (1.625, 1.0, &quo);
2425 check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
2426 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo, 2);
2428 result = FUNC(remquo) (-1.625, 1.0, &quo);
2429 check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
2430 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo, -2);
2432 result = FUNC(remquo) (1.625, -1.0, &quo);
2433 check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
2434 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo, -2);
2436 result = FUNC(remquo) (-1.625, -1.0, &quo);
2437 check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
2438 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo, 2);
2440 result = FUNC(remquo) (5.0, 2.0, &quo);
2441 check ("remquo(5.0, 2.0, &x) == 1.0", result, 1.0);
2442 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo, 2);
2444 result = FUNC(remquo) (3.0, 2.0, &quo);
2445 check ("remquo(3.0, 2.0, &x) == -1.0", result, -1.0);
2446 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo, 2);
2453 __complex__ MATHTYPE result;
2455 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, plus_zero));
2456 check ("real(cexp(0 + 0i)) = 1", __real__ result, 1);
2457 check ("imag(cexp(0 + 0i)) = 0", __imag__ result, 0);
2458 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_zero));
2459 check ("real(cexp(-0 + 0i)) = 1", __real__ result, 1);
2460 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result, 0);
2461 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, minus_zero));
2462 check ("real(cexp(0 - 0i)) = 1", __real__ result, 1);
2463 check ("imag(cexp(0 - 0i)) = -0", __imag__ result, minus_zero);
2464 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_zero));
2465 check ("real(cexp(-0 - 0i)) = 1", __real__ result, 1);
2466 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result, minus_zero);
2468 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_zero));
2469 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result);
2470 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result, 0);
2471 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_zero));
2472 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result);
2473 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result, minus_zero);
2475 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_zero));
2476 check ("real(cexp(-inf + 0i)) = 0", __real__ result, 0);
2477 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result, 0);
2478 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_zero));
2479 check ("real(cexp(-inf - 0i)) = 0", __real__ result, 0);
2480 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result, minus_zero);
2483 result = FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty));
2484 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2485 __real__ result, INVALID_EXCEPTION);
2486 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2489 #if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR__ <= 7
2491 printf ("The following test for cexp might fail due to a gcc compiler error!\n");
2494 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty));
2495 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2496 __real__ result, INVALID_EXCEPTION);
2497 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2499 result = FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty));
2500 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2501 __real__ result, INVALID_EXCEPTION);
2502 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2504 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty));
2505 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2506 __real__ result, INVALID_EXCEPTION);
2507 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2510 result = FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty));
2511 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2512 __real__ result, INVALID_EXCEPTION);
2513 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2515 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty));
2516 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2517 __real__ result, INVALID_EXCEPTION);
2518 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2520 result = FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty));
2521 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2522 __real__ result, INVALID_EXCEPTION);
2523 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2525 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty));
2526 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2527 __real__ result, INVALID_EXCEPTION);
2528 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result);
2530 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 2.0));
2531 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result, minus_zero);
2532 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result, 0);
2533 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 4.0));
2534 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result, minus_zero);
2535 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result, minus_zero);
2537 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 2.0));
2538 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result);
2539 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result);
2540 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 4.0));
2541 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result);
2542 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result);
2544 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty));
2545 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2546 __real__ result, INVALID_EXCEPTION);
2547 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2549 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_infty));
2550 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2551 __real__ result, INVALID_EXCEPTION);
2552 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2555 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_infty));
2556 check ("real(cexp(-inf + i inf)) = 0", __real__ result, 0);
2557 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result, 0);
2558 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_infty));
2559 check ("real(cexp(-inf - i inf)) = 0", __real__ result, 0);
2560 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result, minus_zero);
2562 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, nan_value));
2563 check ("real(cexp(-inf + i NaN)) = 0", __real__ result, 0);
2564 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result), 0);
2566 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, nan_value));
2567 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result);
2568 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result);
2570 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 0.0));
2571 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2572 __real__ result, INVALID_EXCEPTION);
2573 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2575 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
2576 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2577 __real__ result, INVALID_EXCEPTION);
2578 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2580 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
2581 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2582 __real__ result, INVALID_EXCEPTION);
2583 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2586 result = FUNC(cexp) (BUILD_COMPLEX (0, nan_value));
2587 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2588 __real__ result, INVALID_EXCEPTION);
2589 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2591 result = FUNC(cexp) (BUILD_COMPLEX (1, nan_value));
2592 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2593 __real__ result, INVALID_EXCEPTION);
2594 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2597 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
2598 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
2599 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
2606 __complex__ MATHTYPE result;
2608 result = FUNC(csin) (BUILD_COMPLEX (0.0, 0.0));
2609 check ("real(csin(0 + 0i)) = 0", __real__ result, 0);
2610 check ("imag(csin(0 + 0i)) = 0", __imag__ result, 0);
2611 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, 0.0));
2612 check ("real(csin(-0 + 0i)) = -0", __real__ result, minus_zero);
2613 check ("imag(csin(-0 + 0i)) = 0", __imag__ result, 0);
2614 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_zero));
2615 check ("real(csin(0 - 0i)) = 0", __real__ result, 0);
2616 check ("imag(csin(0 - 0i)) = -0", __imag__ result, minus_zero);
2617 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_zero));
2618 check ("real(csin(-0 - 0i)) = -0", __real__ result, minus_zero);
2619 check ("imag(csin(-0 - 0i)) = -0", __imag__ result, minus_zero);
2621 result = FUNC(csin) (BUILD_COMPLEX (0.0, plus_infty));
2622 check ("real(csin(0 + i Inf)) = 0", __real__ result, 0);
2623 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result);
2624 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, plus_infty));
2625 check ("real(csin(-0 + i Inf)) = -0", __real__ result, minus_zero);
2626 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result);
2627 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_infty));
2628 check ("real(csin(0 - i Inf)) = 0", __real__ result, 0);
2629 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result);
2630 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_infty));
2631 check ("real(csin(-0 - i Inf)) = -0", __real__ result, minus_zero);
2632 check_isinfn("imag(csin(-0 - i Inf)) = -Inf", __imag__ result);
2634 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 0.0));
2635 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2636 __real__ result, INVALID_EXCEPTION);
2637 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2638 FUNC(fabs) (__imag__ result), 0);
2639 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 0.0));
2640 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2641 __real__ result, INVALID_EXCEPTION);
2642 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2643 FUNC(fabs) (__imag__ result), 0);
2644 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_zero));
2645 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2646 __real__ result, INVALID_EXCEPTION);
2647 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2648 FUNC(fabs) (__imag__ result), 0.0);
2649 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_zero));
2650 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2651 __real__ result, INVALID_EXCEPTION);
2652 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2653 FUNC(fabs) (__imag__ result), 0.0);
2655 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, plus_infty));
2656 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2657 __real__ result, INVALID_EXCEPTION);
2658 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2659 FUNC(fabs) (__imag__ result));
2660 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, plus_infty));
2661 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2662 __real__ result, INVALID_EXCEPTION);
2663 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2664 FUNC(fabs) (__imag__ result));
2665 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_infty));
2666 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2667 __real__ result, INVALID_EXCEPTION);
2668 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2669 FUNC(fabs) (__imag__ result));
2670 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_infty));
2671 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2672 __real__ result, INVALID_EXCEPTION);
2673 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2674 FUNC(fabs) (__imag__ result));
2676 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 6.75));
2677 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2678 __real__ result, INVALID_EXCEPTION);
2679 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2681 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, -6.75));
2682 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2683 __real__ result, INVALID_EXCEPTION);
2684 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2686 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 6.75));
2687 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2688 __real__ result, INVALID_EXCEPTION);
2689 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2691 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, -6.75));
2692 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2693 __real__ result, INVALID_EXCEPTION);
2694 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2697 result = FUNC(csin) (BUILD_COMPLEX (4.625, plus_infty));
2698 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result);
2699 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result);
2700 result = FUNC(csin) (BUILD_COMPLEX (4.625, minus_infty));
2701 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result);
2702 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result);
2703 result = FUNC(csin) (BUILD_COMPLEX (-4.625, plus_infty));
2704 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result);
2705 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result);
2706 result = FUNC(csin) (BUILD_COMPLEX (-4.625, minus_infty));
2707 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result);
2708 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result);
2710 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 0.0));
2711 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result);
2712 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2713 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_zero));
2714 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result);
2715 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2717 result = FUNC(csin) (BUILD_COMPLEX (nan_value, plus_infty));
2718 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result);
2719 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2720 FUNC(fabs) (__imag__ result));
2721 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_infty));
2722 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result);
2723 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2724 FUNC(fabs) (__imag__ result));
2726 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 9.0));
2727 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2728 __real__ result, INVALID_EXCEPTION);
2729 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2731 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -9.0));
2732 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2733 __real__ result, INVALID_EXCEPTION);
2734 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2737 result = FUNC(csin) (BUILD_COMPLEX (0.0, nan_value));
2738 check ("real(csin(0 + i NaN))", __real__ result, 0.0);
2739 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result);
2740 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, nan_value));
2741 check ("real(csin(-0 + i NaN)) = -0", __real__ result, minus_zero);
2742 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result);
2744 result = FUNC(csin) (BUILD_COMPLEX (10.0, nan_value));
2745 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2746 __real__ result, INVALID_EXCEPTION);
2747 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2749 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -10.0));
2750 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2751 __real__ result, INVALID_EXCEPTION);
2752 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2755 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, nan_value));
2756 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2757 __real__ result, INVALID_EXCEPTION);
2758 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2760 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, nan_value));
2761 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2762 __real__ result, INVALID_EXCEPTION);
2763 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2766 result = FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value));
2767 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result);
2768 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result);
2775 __complex__ MATHTYPE result;
2777 result = FUNC(csinh) (BUILD_COMPLEX (0.0, 0.0));
2778 check ("real(csinh(0 + 0i)) = 0", __real__ result, 0);
2779 check ("imag(csinh(0 + 0i)) = 0", __imag__ result, 0);
2780 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, 0.0));
2781 check ("real(csinh(-0 + 0i)) = -0", __real__ result, minus_zero);
2782 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result, 0);
2783 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_zero));
2784 check ("real(csinh(0 - 0i)) = 0", __real__ result, 0);
2785 check ("imag(csinh(0 - 0i)) = -0", __imag__ result, minus_zero);
2786 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_zero));
2787 check ("real(csinh(-0 - 0i)) = -0", __real__ result, minus_zero);
2788 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero);
2790 result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
2791 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2792 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2793 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2795 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
2796 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2797 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2798 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2800 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
2801 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2802 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2803 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2805 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
2806 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2807 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2808 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2811 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0));
2812 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result);
2813 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result, 0);
2814 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 0.0));
2815 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result);
2816 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result, 0);
2817 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_zero));
2818 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result);
2819 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
2820 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_zero));
2821 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result);
2822 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result, minus_zero);
2824 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty));
2825 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2826 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2827 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2829 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty));
2830 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2831 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2832 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2834 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty));
2835 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2836 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2837 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2839 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
2840 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2841 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2842 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2845 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 4.625));
2846 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result);
2847 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result);
2848 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 4.625));
2849 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result);
2850 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result);
2851 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, -4.625));
2852 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result);
2853 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result);
2854 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, -4.625));
2855 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result);
2856 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result);
2858 result = FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty));
2859 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2860 __real__ result, INVALID_EXCEPTION);
2861 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2863 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty));
2864 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2865 __real__ result, INVALID_EXCEPTION);
2866 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2868 result = FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty));
2869 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2870 __real__ result, INVALID_EXCEPTION);
2871 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2873 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty));
2874 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2875 __real__ result, INVALID_EXCEPTION);
2876 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2879 result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value));
2880 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2881 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result);
2882 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value));
2883 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2884 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
2886 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value));
2887 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
2888 FUNC(fabs) (__real__ result));
2889 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result);
2890 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value));
2891 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
2892 FUNC(fabs) (__real__ result));
2893 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result);
2895 result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
2896 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2897 __real__ result, INVALID_EXCEPTION);
2898 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2900 result = FUNC(csinh) (BUILD_COMPLEX (-9.0, nan_value));
2901 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2902 __real__ result, INVALID_EXCEPTION);
2903 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2906 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0));
2907 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result);
2908 check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0);
2909 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero));
2910 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result);
2911 check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero);
2913 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
2914 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2915 __real__ result, INVALID_EXCEPTION);
2916 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2918 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0));
2919 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2920 __real__ result, INVALID_EXCEPTION);
2921 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2924 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty));
2925 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2926 __real__ result, INVALID_EXCEPTION);
2927 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2929 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty));
2930 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2931 __real__ result, INVALID_EXCEPTION);
2932 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2935 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value));
2936 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result);
2937 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result);
2944 __complex__ MATHTYPE result;
2946 result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0));
2947 check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0);
2948 check ("imag(ccos(0 + 0i)) = -0", __imag__ result, minus_zero);
2949 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0));
2950 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0);
2951 check ("imag(ccos(-0 + 0i)) = 0", __imag__ result, 0.0);
2952 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero));
2953 check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0);
2954 check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0);
2955 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero));
2956 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0);
2957 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero);
2959 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
2960 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
2961 __real__ result, INVALID_EXCEPTION);
2962 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
2963 FUNC(fabs) (__imag__ result), 0);
2964 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
2965 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
2966 __real__ result, INVALID_EXCEPTION);
2967 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
2968 FUNC(fabs) (__imag__ result), 0);
2969 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
2970 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
2971 __real__ result, INVALID_EXCEPTION);
2972 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
2973 FUNC(fabs) (__imag__ result), 0);
2974 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
2975 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
2976 __real__ result, INVALID_EXCEPTION);
2977 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
2978 FUNC(fabs) (__imag__ result), 0);
2980 result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty));
2981 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result);
2982 check ("imag(ccos(0 + i Inf)) = -0", __imag__ result, minus_zero);
2983 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty));
2984 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result);
2985 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0);
2986 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty));
2987 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result);
2988 check ("imag(ccos(-0 + i Inf)) = 0", __imag__ result, 0.0);
2989 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty));
2990 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result);
2991 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero);
2993 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
2994 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
2995 __real__ result, INVALID_EXCEPTION);
2996 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
2998 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
2999 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
3000 __real__ result, INVALID_EXCEPTION);
3001 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
3003 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
3004 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
3005 __real__ result, INVALID_EXCEPTION);
3006 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
3008 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
3009 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
3010 __real__ result, INVALID_EXCEPTION);
3011 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
3014 result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty));
3015 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result);
3016 check_isinfp ("imag(ccos(4.625 + i Inf)) = +Inf", __imag__ result);
3017 result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty));
3018 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result);
3019 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result);
3020 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty));
3021 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result);
3022 check_isinfn ("imag(ccos(-4.625 + i Inf)) = -Inf", __imag__ result);
3023 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty));
3024 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result);
3025 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result);
3027 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
3028 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3029 __real__ result, INVALID_EXCEPTION);
3030 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3032 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
3033 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3034 __real__ result, INVALID_EXCEPTION);
3035 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3037 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
3038 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3039 __real__ result, INVALID_EXCEPTION);
3040 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3042 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
3043 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3044 __real__ result, INVALID_EXCEPTION);
3045 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3048 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0));
3049 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result);
3050 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3051 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero));
3052 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result);
3053 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3055 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty));
3056 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result);
3057 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result);
3058 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty));
3059 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result);
3060 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result);
3062 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
3063 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3064 __real__ result, INVALID_EXCEPTION);
3065 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3067 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
3068 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3069 __real__ result, INVALID_EXCEPTION);
3070 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3073 result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value));
3074 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result);
3075 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3076 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value));
3077 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result);
3078 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3080 result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
3081 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3082 __real__ result, INVALID_EXCEPTION);
3083 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3085 result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
3086 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3087 __real__ result, INVALID_EXCEPTION);
3088 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3091 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
3092 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3093 __real__ result, INVALID_EXCEPTION);
3094 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3096 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
3097 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3098 __real__ result, INVALID_EXCEPTION);
3099 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3102 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
3103 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
3104 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
3111 __complex__ MATHTYPE result;
3113 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0));
3114 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0);
3115 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0);
3116 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0));
3117 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0);
3118 check ("imag(ccosh(-0 + 0i)) = -0", __imag__ result, minus_zero);
3119 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero));
3120 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0);
3121 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero);
3122 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero));
3123 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0);
3124 check ("imag(ccosh(-0 - 0i)) = 0", __imag__ result, 0.0);
3126 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
3127 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
3128 __real__ result, INVALID_EXCEPTION);
3129 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
3130 FUNC(fabs) (__imag__ result), 0);
3131 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
3132 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
3133 __real__ result, INVALID_EXCEPTION);
3134 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
3135 FUNC(fabs) (__imag__ result), 0);
3136 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
3137 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
3138 __real__ result, INVALID_EXCEPTION);
3139 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
3140 FUNC(fabs) (__imag__ result), 0);
3141 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
3142 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
3143 __real__ result, INVALID_EXCEPTION);
3144 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
3145 FUNC(fabs) (__imag__ result), 0);
3147 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0));
3148 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result);
3149 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result, 0);
3150 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 0.0));
3151 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result);
3152 check ("imag(ccosh(-Inf + 0i)) = -0", __imag__ result, minus_zero);
3153 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_zero));
3154 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result);
3155 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
3156 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_zero));
3157 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result);
3158 check ("imag(ccosh(-Inf - 0i)) = 0", __imag__ result, 0.0);
3160 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty));
3161 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
3162 __real__ result, INVALID_EXCEPTION);
3163 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
3165 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty));
3166 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
3167 __real__ result, INVALID_EXCEPTION);
3168 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
3170 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty));
3171 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
3172 __real__ result, INVALID_EXCEPTION);
3173 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
3175 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty));
3176 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
3177 __real__ result, INVALID_EXCEPTION);
3178 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3181 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 4.625));
3182 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result);
3183 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result);
3184 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 4.625));
3185 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result);
3186 check_isinfp ("imag(ccosh(-Inf + i4.625)) = Inf", __imag__ result);
3187 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, -4.625));
3188 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result);
3189 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result);
3190 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, -4.625));
3191 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result);
3192 check_isinfn ("imag(ccosh(-Inf - i4.625)) = -Inf", __imag__ result);
3194 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty));
3195 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3196 __real__ result, INVALID_EXCEPTION);
3197 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3199 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty));
3200 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3201 __real__ result, INVALID_EXCEPTION);
3202 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3204 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty));
3205 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3206 __real__ result, INVALID_EXCEPTION);
3207 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3209 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty));
3210 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3211 __real__ result, INVALID_EXCEPTION);
3212 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3215 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, nan_value));
3216 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result);
3217 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3218 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, nan_value));
3219 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result);
3220 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3222 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, nan_value));
3223 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result);
3224 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result);
3225 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value));
3226 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result);
3227 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result);
3229 result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
3230 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3231 __real__ result, INVALID_EXCEPTION);
3232 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3234 result = FUNC(ccosh) (BUILD_COMPLEX (-9.0, nan_value));
3235 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3236 __real__ result, INVALID_EXCEPTION);
3237 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3240 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0));
3241 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result);
3242 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3243 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero));
3244 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result);
3245 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3247 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
3248 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3249 __real__ result, INVALID_EXCEPTION);
3250 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3252 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0));
3253 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3254 __real__ result, INVALID_EXCEPTION);
3255 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3258 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty));
3259 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3260 __real__ result, INVALID_EXCEPTION);
3261 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3263 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty));
3264 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3265 __real__ result, INVALID_EXCEPTION);
3266 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3269 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value));
3270 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result);
3271 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result);
3278 __complex__ MATHTYPE result;
3280 result = FUNC(cacos) (BUILD_COMPLEX (0, 0));
3281 check ("real(cacos(0 + i0)) = pi/2", __real__ result, M_PI_2);
3282 check ("imag(cacos(0 + i0)) = -0", __imag__ result, minus_zero);
3283 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, 0));
3284 check ("real(cacos(-0 + i0)) = pi/2", __real__ result, M_PI_2);
3285 check ("imag(cacos(-0 + i0)) = -0", __imag__ result, minus_zero);
3286 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_zero));
3287 check ("real(cacos(0 - i0)) = pi/2", __real__ result, M_PI_2);
3288 check ("imag(cacos(0 - i0)) = 0", __imag__ result, 0);
3289 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, minus_zero));
3290 check ("real(cacos(-0 - i0)) = pi/2", __real__ result, M_PI_2);
3291 check ("imag(cacos(-0 - i0)) = 0", __imag__ result, 0);
3293 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, plus_infty));
3294 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4);
3295 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result);
3296 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_infty));
3297 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4);
3298 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result);
3300 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, plus_infty));
3301 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
3302 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result);
3303 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_infty));
3304 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
3305 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result);
3307 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, plus_infty));
3308 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3309 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result);
3310 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, minus_infty));
3311 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3312 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result);
3313 result = FUNC(cacos) (BUILD_COMPLEX (0, plus_infty));
3314 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3315 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result);
3316 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_infty));
3317 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3318 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result);
3319 result = FUNC(cacos) (BUILD_COMPLEX (0.1, plus_infty));
3320 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result, M_PI_2);
3321 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result);
3322 result = FUNC(cacos) (BUILD_COMPLEX (0.1, minus_infty));
3323 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result, M_PI_2);
3324 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result);
3326 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 0));
3327 check ("real(cacos(-Inf + i0)) = pi", __real__ result, M_PI);
3328 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result);
3329 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_zero));
3330 check ("real(cacos(-Inf - i0)) = pi", __real__ result, M_PI);
3331 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result);
3332 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 100));
3333 check ("real(cacos(-Inf + i100)) = pi", __real__ result, M_PI);
3334 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result);
3335 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, -100));
3336 check ("real(cacos(-Inf - i100)) = pi", __real__ result, M_PI);
3337 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result);
3339 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0));
3340 check ("real(cacos(+Inf + i0)) = 0", __real__ result, 0);
3341 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result);
3342 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_zero));
3343 check ("real(cacos(+Inf - i0)) = 0", __real__ result, 0);
3344 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result);
3345 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0.5));
3346 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result, 0);
3347 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result);
3348 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, -0.5));
3349 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result, 0);
3350 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result);
3352 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, nan_value));
3353 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result);
3354 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3355 FUNC(fabs) (__imag__ result));
3356 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, nan_value));
3357 check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result);
3358 check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf",
3359 FUNC(fabs) (__imag__ result));
3361 result = FUNC(cacos) (BUILD_COMPLEX (0, nan_value));
3362 check ("real(cacos(0 + i NaN)) = pi/2", __real__ result, M_PI_2);
3363 check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result);
3364 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, nan_value));
3365 check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result, M_PI_2);
3366 check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result);
3368 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, plus_infty));
3369 check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result);
3370 check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result);
3371 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, minus_infty));
3372 check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result);
3373 check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result);
3375 result = FUNC(cacos) (BUILD_COMPLEX (10.5, nan_value));
3376 check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3377 __real__ result, INVALID_EXCEPTION);
3378 check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3380 result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
3381 check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3382 __real__ result, INVALID_EXCEPTION);
3383 check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3386 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, 0.75));
3387 check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3388 __real__ result, INVALID_EXCEPTION);
3389 check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3391 result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
3392 check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3393 __real__ result, INVALID_EXCEPTION);
3394 check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3397 result = FUNC(cacos) (BUILD_COMPLEX (nan_value, nan_value));
3398 check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result);
3399 check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result);
3406 __complex__ MATHTYPE result;
3408 result = FUNC(cacosh) (BUILD_COMPLEX (0, 0));
3409 check ("real(cacosh(0 + i0)) = 0", __real__ result, 0);
3410 check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result, M_PI_2);
3411 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, 0));
3412 check ("real(cacosh(-0 + i0)) = 0", __real__ result, 0);
3413 check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result, M_PI_2);
3414 result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_zero));
3415 check ("real(cacosh(0 - i0)) = 0", __real__ result, 0);
3416 check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result, -M_PI_2);
3417 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, minus_zero));
3418 check ("real(cacosh(-0 - i0)) = 0", __real__ result, 0);
3419 check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result, -M_PI_2);
3421 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, plus_infty));
3422 check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result);
3423 check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result,
3425 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_infty));
3426 check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result);
3427 check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result,
3430 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, plus_infty));
3431 check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result);
3432 check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3433 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_infty));
3434 check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result);
3435 check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3437 result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, plus_infty));
3438 check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result);
3439 check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3440 result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, minus_infty));
3441 check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result);
3442 check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3443 result = FUNC(cacosh) (BUILD_COMPLEX (0, plus_infty));
3444 check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result);
3445 check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3446 result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_infty));
3447 check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result);
3448 check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3449 result = FUNC(cacosh) (BUILD_COMPLEX (0.1, plus_infty));
3450 check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result);
3451 check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3452 result = FUNC(cacosh) (BUILD_COMPLEX (0.1, minus_infty));
3453 check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result);
3454 check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3456 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 0));
3457 check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result);
3458 check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result, M_PI);
3459 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_zero));
3460 check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result);
3461 check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result, -M_PI);
3462 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 100));
3463 check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result);
3464 check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result, M_PI);
3465 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, -100));
3466 check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result);
3467 check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result, -M_PI);
3469 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0));
3470 check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result);
3471 check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result, 0);
3472 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_zero));
3473 check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result);
3474 check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result, minus_zero);
3475 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0.5));
3476 check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result);
3477 check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result, 0);
3478 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, -0.5));
3479 check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result);
3480 check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result, minus_zero);
3482 result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, nan_value));
3483 check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result);
3484 check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result);
3485 result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, nan_value));
3486 check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result);
3487 check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result);
3489 result = FUNC(cacosh) (BUILD_COMPLEX (0, nan_value));
3490 check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result);
3491 check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result);
3492 result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, nan_value));
3493 check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result);
3494 check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result);
3496 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, plus_infty));
3497 check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result);
3498 check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result);
3499 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, minus_infty));
3500 check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result);
3501 check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result);
3503 result = FUNC(cacosh) (BUILD_COMPLEX (10.5, nan_value));
3504 check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3505 __real__ result, INVALID_EXCEPTION);
3506 check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3508 result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
3509 check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3510 __real__ result, INVALID_EXCEPTION);
3511 check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3514 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, 0.75));
3515 check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3516 __real__ result, INVALID_EXCEPTION);
3517 check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3519 result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
3520 check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3521 __real__ result, INVALID_EXCEPTION);
3522 check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3525 result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, nan_value));
3526 check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result);
3527 check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result);
3534 __complex__ MATHTYPE result;
3536 result = FUNC(casin) (BUILD_COMPLEX (0, 0));
3537 check ("real(casin(0 + i0)) = 0", __real__ result, 0);
3538 check ("imag(casin(0 + i0)) = 0", __imag__ result, 0);
3539 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, 0));
3540 check ("real(casin(-0 + i0)) = -0", __real__ result, minus_zero);
3541 check ("imag(casin(-0 + i0)) = 0", __imag__ result, 0);
3542 result = FUNC(casin) (BUILD_COMPLEX (0, minus_zero));
3543 check ("real(casin(0 - i0)) = 0", __real__ result, 0);
3544 check ("imag(casin(0 - i0)) = -0", __imag__ result, minus_zero);
3545 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero));
3546 check ("real(casin(-0 - i0)) = -0", __real__ result, minus_zero);
3547 check ("imag(casin(-0 - i0)) = -0", __imag__ result, minus_zero);
3549 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty));
3550 check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
3551 check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result);
3552 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty));
3553 check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
3554 check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result);
3555 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty));
3556 check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result, -M_PI_4);
3557 check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result);
3558 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty));
3559 check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result, -M_PI_4);
3560 check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result);
3562 result = FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty));
3563 check ("real(casin(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
3564 check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result);
3565 result = FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty));
3566 check ("real(casin(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
3567 check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result);
3568 result = FUNC(casin) (BUILD_COMPLEX (0, plus_infty));
3569 check ("real(casin(0 + i Inf)) = 0", __real__ result, 0.0);
3570 check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result);
3571 result = FUNC(casin) (BUILD_COMPLEX (0, minus_infty));
3572 check ("real(casin(0 - i Inf)) = 0", __real__ result, 0.0);
3573 check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result);
3574 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty));
3575 check ("real(casin(-0 + i Inf)) = -0", __real__ result, minus_zero);
3576 check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result);
3577 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty));
3578 check ("real(casin(-0 - i Inf)) = -0", __real__ result, minus_zero);
3579 check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result);
3580 result = FUNC(casin) (BUILD_COMPLEX (0.1, plus_infty));
3581 check ("real(casin(0.1 + i Inf)) = 0", __real__ result, 0);
3582 check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result);
3583 result = FUNC(casin) (BUILD_COMPLEX (0.1, minus_infty));
3584 check ("real(casin(0.1 - i Inf)) = 0", __real__ result, 0);
3585 check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result);
3587 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 0));
3588 check ("real(casin(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
3589 check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result);
3590 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero));
3591 check ("real(casin(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
3592 check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result);
3593 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 100));
3594 check ("real(casin(-Inf + i100)) = -pi/2", __real__ result, -M_PI_2);
3595 check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result);
3596 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, -100));
3597 check ("real(casin(-Inf - i100)) = -pi/2", __real__ result, -M_PI_2);
3598 check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result);
3600 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0));
3601 check ("real(casin(+Inf + i0)) = pi/2", __real__ result, M_PI_2);
3602 check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result);
3603 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero));
3604 check ("real(casin(+Inf - i0)) = pi/2", __real__ result, M_PI_2);
3605 check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result);
3606 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5));
3607 check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result, M_PI_2);
3608 check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result);
3609 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5));
3610 check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result, M_PI_2);
3611 check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result);
3613 result = FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty));
3614 check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result);
3615 check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result);
3616 result = FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty));
3617 check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result);
3618 check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result);
3620 result = FUNC(casin) (BUILD_COMPLEX (0.0, nan_value));
3621 check ("real(casin(0 + i NaN)) = 0", __real__ result, 0.0);
3622 check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result);
3623 result = FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value));
3624 check ("real(casin(-0 + i NaN)) = -0", __real__ result, minus_zero);
3625 check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result);
3627 result = FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value));
3628 check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result);
3629 check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
3630 FUNC(fabs) (__imag__ result));
3631 result = FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value));
3632 check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result);
3633 check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
3634 FUNC(fabs) (__imag__ result));
3636 result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5));
3637 check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3638 __real__ result, INVALID_EXCEPTION);
3639 check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3641 result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5));
3642 check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3643 __real__ result, INVALID_EXCEPTION);
3644 check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3647 result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value));
3648 check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3649 __real__ result, INVALID_EXCEPTION);
3650 check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3652 result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value));
3653 check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3654 __real__ result, INVALID_EXCEPTION);
3655 check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3658 result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value));
3659 check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result);
3660 check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result);
3667 __complex__ MATHTYPE result;
3669 result = FUNC(casinh) (BUILD_COMPLEX (0, 0));
3670 check ("real(casinh(0 + i0)) = 0", __real__ result, 0);
3671 check ("imag(casinh(0 + i0)) = 0", __imag__ result, 0);
3672 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, 0));
3673 check ("real(casinh(-0 + i0)) = -0", __real__ result, minus_zero);
3674 check ("imag(casinh(-0 + i0)) = 0", __imag__ result, 0);
3675 result = FUNC(casinh) (BUILD_COMPLEX (0, minus_zero));
3676 check ("real(casinh(0 - i0)) = 0", __real__ result, 0);
3677 check ("imag(casinh(0 - i0)) = -0", __imag__ result, minus_zero);
3678 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_zero));
3679 check ("real(casinh(-0 - i0)) = -0", __real__ result, minus_zero);
3680 check ("imag(casinh(-0 - i0)) = -0", __imag__ result, minus_zero);
3682 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, plus_infty));
3683 check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result);
3684 check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3685 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_infty));
3686 check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result);
3687 check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3688 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, plus_infty));
3689 check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result);
3690 check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
3691 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_infty));
3692 check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result);
3693 check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
3695 result = FUNC(casinh) (BUILD_COMPLEX (-10.0, plus_infty));
3696 check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result);
3697 check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3698 result = FUNC(casinh) (BUILD_COMPLEX (-10.0, minus_infty));
3699 check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result);
3700 check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3701 result = FUNC(casinh) (BUILD_COMPLEX (0, plus_infty));
3702 check_isinfp ("real(casinh(0 + i Inf)) = +Inf", __real__ result);
3703 check ("imag(casinh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3704 result = FUNC(casinh) (BUILD_COMPLEX (0, minus_infty));
3705 check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result);
3706 check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3707 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty));
3708 check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result);
3709 check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3710 result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty));
3711 check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result);
3712 check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3713 result = FUNC(casinh) (BUILD_COMPLEX (0.1, plus_infty));
3714 check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result);
3715 check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3716 result = FUNC(casinh) (BUILD_COMPLEX (0.1, minus_infty));
3717 check_isinfp ("real(casinh(0.1 - i Inf)) = +Inf", __real__ result);
3718 check ("imag(casinh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3720 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 0));
3721 check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result);
3722 check ("imag(casinh(-Inf + i0)) = 0", __imag__ result, 0);
3723 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_zero));
3724 check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result);
3725 check ("imag(casinh(-Inf - i0)) = -0", __imag__ result, minus_zero);
3726 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 100));
3727 check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result);
3728 check ("imag(casinh(-Inf + i100)) = 0", __imag__ result, 0);
3729 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, -100));
3730 check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result);
3731 check ("imag(casinh(-Inf - i100)) = -0", __imag__ result, minus_zero);
3733 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0));
3734 check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result);
3735 check ("imag(casinh(+Inf + i0)) = 0", __imag__ result, 0);
3736 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_zero));
3737 check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result);
3738 check ("imag(casinh(+Inf - i0)) = -0", __imag__ result, minus_zero);
3739 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0.5));
3740 check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result);
3741 check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result, 0);
3742 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, -0.5));
3743 check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result);
3744 check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result, minus_zero);
3746 result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, nan_value));
3747 check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result);
3748 check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result);
3749 result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, nan_value));
3750 check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result);
3751 check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result);
3753 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0));
3754 check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result);
3755 check ("imag(casinh(NaN + i0)) = 0", __imag__ result, 0);
3756 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero));
3757 check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result);
3758 check ("imag(casinh(NaN - i0)) = -0", __imag__ result, minus_zero);
3760 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty));
3761 check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
3762 FUNC(fabs) (__real__ result));
3763 check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result);
3764 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty));
3765 check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
3766 FUNC(fabs) (__real__ result));
3767 check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result);
3769 result = FUNC(casinh) (BUILD_COMPLEX (10.5, nan_value));
3770 check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3771 __real__ result, INVALID_EXCEPTION);
3772 check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3774 result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value));
3775 check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3776 __real__ result, INVALID_EXCEPTION);
3777 check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3780 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75));
3781 check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3782 __real__ result, INVALID_EXCEPTION);
3783 check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3785 result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value));
3786 check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3787 __real__ result, INVALID_EXCEPTION);
3788 check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3791 result = FUNC(casinh) (BUILD_COMPLEX (nan_value, nan_value));
3792 check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result);
3793 check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result);
3800 __complex__ MATHTYPE result;
3802 result = FUNC(catan) (BUILD_COMPLEX (0, 0));
3803 check ("real(catan(0 + i0)) = 0", __real__ result, 0);
3804 check ("imag(catan(0 + i0)) = 0", __imag__ result, 0);
3805 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, 0));
3806 check ("real(catan(-0 + i0)) = -0", __real__ result, minus_zero);
3807 check ("imag(catan(-0 + i0)) = 0", __imag__ result, 0);
3808 result = FUNC(catan) (BUILD_COMPLEX (0, minus_zero));
3809 check ("real(catan(0 - i0)) = 0", __real__ result, 0);
3810 check ("imag(catan(0 - i0)) = -0", __imag__ result, minus_zero);
3811 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero));
3812 check ("real(catan(-0 - i0)) = -0", __real__ result, minus_zero);
3813 check ("imag(catan(-0 - i0)) = -0", __imag__ result, minus_zero);
3815 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty));
3816 check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result, M_PI_2);
3817 check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result, 0);
3818 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty));
3819 check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result, M_PI_2);
3820 check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result, minus_zero);
3821 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty));
3822 check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3823 check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result, 0.0);
3824 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty));
3825 check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3826 check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result, minus_zero);
3828 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0));
3829 check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result, M_PI_2);
3830 check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result, minus_zero);
3831 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, -10.0));
3832 check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result, -M_PI_2);
3833 check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result, minus_zero);
3834 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_zero));
3835 check ("real(catan(Inf - i0)) = pi/2", __real__ result, M_PI_2);
3836 check ("imag(catan(Inf - i0)) = -0", __imag__ result, minus_zero);
3837 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_zero));
3838 check ("real(catan(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
3839 check ("imag(catan(-Inf - i0)) = -0", __imag__ result, minus_zero);
3840 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.0));
3841 check ("real(catan(Inf + i0)) = pi/2", __real__ result, M_PI_2);
3842 check ("imag(catan(Inf + i0)) = 0", __imag__ result, 0.0);
3843 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.0));
3844 check ("real(catan(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
3845 check ("imag(catan(-Inf + i0)) = 0", __imag__ result, 0.0);
3846 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.1));
3847 check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result, M_PI_2);
3848 check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result, 0);
3849 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.1));
3850 check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result, -M_PI_2);
3851 check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result, 0);
3853 result = FUNC(catan) (BUILD_COMPLEX (0.0, minus_infty));
3854 check ("real(catan(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
3855 check ("imag(catan(0 - i Inf)) = -0", __imag__ result, minus_zero);
3856 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_infty));
3857 check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3858 check ("imag(catan(-0 - i Inf)) = -0", __imag__ result, minus_zero);
3859 result = FUNC(catan) (BUILD_COMPLEX (100.0, minus_infty));
3860 check ("real(catan(100 - i Inf)) = pi/2", __real__ result, M_PI_2);
3861 check ("imag(catan(100 - i Inf)) = -0", __imag__ result, minus_zero);
3862 result = FUNC(catan) (BUILD_COMPLEX (-100.0, minus_infty));
3863 check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
3864 check ("imag(catan(-100 - i Inf)) = -0", __imag__ result, minus_zero);
3866 result = FUNC(catan) (BUILD_COMPLEX (0.0, plus_infty));
3867 check ("real(catan(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
3868 check ("imag(catan(0 + i Inf)) = 0", __imag__ result, 0);
3869 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, plus_infty));
3870 check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3871 check ("imag(catan(-0 + i Inf)) = 0", __imag__ result, 0);
3872 result = FUNC(catan) (BUILD_COMPLEX (0.5, plus_infty));
3873 check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result, M_PI_2);
3874 check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result, 0);
3875 result = FUNC(catan) (BUILD_COMPLEX (-0.5, plus_infty));
3876 check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
3877 check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result, 0);
3879 result = FUNC(catan) (BUILD_COMPLEX (nan_value, 0.0));
3880 check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result);
3881 check ("imag(catan(NaN + i0)) = 0", __imag__ result, 0.0);
3882 result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_zero));
3883 check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result);
3884 check ("imag(catan(NaN - i0)) = -0", __imag__ result, minus_zero);
3886 result = FUNC(catan) (BUILD_COMPLEX (nan_value, plus_infty));
3887 check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result);
3888 check ("imag(catan(NaN + i Inf)) = 0", __imag__ result, 0);
3889 result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_infty));
3890 check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result);
3891 check ("imag(catan(NaN - i Inf)) = -0", __imag__ result, minus_zero);
3893 result = FUNC(catan) (BUILD_COMPLEX (0.0, nan_value));
3894 check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result);
3895 check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result);
3896 result = FUNC(catan) (BUILD_COMPLEX (minus_zero, nan_value));
3897 check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result);
3898 check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result);
3900 result = FUNC(catan) (BUILD_COMPLEX (plus_infty, nan_value));
3901 check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result, M_PI_2);
3902 check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3903 result = FUNC(catan) (BUILD_COMPLEX (minus_infty, nan_value));
3904 check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result, -M_PI_2);
3905 check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3907 result = FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5));
3908 check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3909 __real__ result, INVALID_EXCEPTION);
3910 check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3912 result = FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5));
3913 check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3914 __real__ result, INVALID_EXCEPTION);
3915 check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3918 result = FUNC(catan) (BUILD_COMPLEX (0.75, nan_value));
3919 check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3920 __real__ result, INVALID_EXCEPTION);
3921 check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3923 result = FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value));
3924 check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3925 __real__ result, INVALID_EXCEPTION);
3926 check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3929 result = FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value));
3930 check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result);
3931 check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result);
3938 __complex__ MATHTYPE result;
3940 result = FUNC(catanh) (BUILD_COMPLEX (0, 0));
3941 check ("real(catanh(0 + i0)) = 0", __real__ result, 0);
3942 check ("imag(catanh(0 + i0)) = 0", __imag__ result, 0);
3943 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, 0));
3944 check ("real(catanh(-0 + i0)) = -0", __real__ result, minus_zero);
3945 check ("imag(catanh(-0 + i0)) = 0", __imag__ result, 0);
3946 result = FUNC(catanh) (BUILD_COMPLEX (0, minus_zero));
3947 check ("real(catanh(0 - i0)) = 0", __real__ result, 0);
3948 check ("imag(catanh(0 - i0)) = -0", __imag__ result, minus_zero);
3949 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_zero));
3950 check ("real(catanh(-0 - i0)) = -0", __real__ result, minus_zero);
3951 check ("imag(catanh(-0 - i0)) = -0", __imag__ result, minus_zero);
3953 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, plus_infty));
3954 check ("real(catanh(+Inf + i Inf)) = 0", __real__ result, 0);
3955 check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result, M_PI_2);
3956 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_infty));
3957 check ("real(catanh(+Inf - i Inf)) = 0", __real__ result, 0);
3958 check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3959 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, plus_infty));
3960 check ("real(catanh(-Inf + i Inf)) = -0", __real__ result, minus_zero);
3961 check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result, M_PI_2);
3962 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_infty));
3963 check ("real(catanh(-Inf - i Inf)) = -0", __real__ result, minus_zero);
3964 check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3966 result = FUNC(catanh) (BUILD_COMPLEX (-10.0, plus_infty));
3967 check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
3968 check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3969 result = FUNC(catanh) (BUILD_COMPLEX (-10.0, minus_infty));
3970 check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
3971 check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3972 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, plus_infty));
3973 check ("real(catanh(-0 + i Inf)) = -0", __real__ result, minus_zero);
3974 check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3975 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_infty));
3976 check ("real(catanh(-0 - i Inf)) = -0", __real__ result, minus_zero);
3977 check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3978 result = FUNC(catanh) (BUILD_COMPLEX (0, plus_infty));
3979 check ("real(catanh(0 + i Inf)) = 0", __real__ result, 0);
3980 check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3981 result = FUNC(catanh) (BUILD_COMPLEX (0, minus_infty));
3982 check ("real(catanh(0 - i Inf)) = 0", __real__ result, 0);
3983 check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3984 result = FUNC(catanh) (BUILD_COMPLEX (0.1, plus_infty));
3985 check ("real(catanh(0.1 + i Inf)) = 0", __real__ result, 0);
3986 check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
3987 result = FUNC(catanh) (BUILD_COMPLEX (0.1, minus_infty));
3988 check ("real(catanh(0.1 - i Inf)) = 0", __real__ result, 0);
3989 check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
3991 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 0));
3992 check ("real(catanh(-Inf + i0)) = -0", __real__ result, minus_zero);
3993 check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result, M_PI_2);
3994 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_zero));
3995 check ("real(catanh(-Inf - i0)) = -0", __real__ result, minus_zero);
3996 check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result, -M_PI_2);
3997 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 100));
3998 check ("real(catanh(-Inf + i100)) = -0", __real__ result, minus_zero);
3999 check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result, M_PI_2);
4000 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, -100));
4001 check ("real(catanh(-Inf - i100)) = -0", __real__ result, minus_zero);
4002 check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result, -M_PI_2);
4004 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0));
4005 check ("real(catanh(+Inf + i0)) = 0", __real__ result, 0);
4006 check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result, M_PI_2);
4007 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_zero));
4008 check ("real(catanh(+Inf - i0)) = 0", __real__ result, 0);
4009 check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result, -M_PI_2);
4010 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0.5));
4011 check ("real(catanh(+Inf + i0.5)) = 0", __real__ result, 0);
4012 check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result, M_PI_2);
4013 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, -0.5));
4014 check ("real(catanh(+Inf - i0.5)) = 0", __real__ result, 0);
4015 check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result, -M_PI_2);
4017 result = FUNC(catanh) (BUILD_COMPLEX (0, nan_value));
4018 check ("real(catanh(0 + i NaN)) = 0", __real__ result, 0);
4019 check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result);
4020 result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
4021 check ("real(catanh(-0 + i NaN)) = -0", __real__ result, minus_zero);
4022 check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result);
4024 result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value));
4025 check ("real(catanh(+Inf + i NaN)) = 0", __real__ result, 0);
4026 check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result);
4027 result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, nan_value));
4028 check ("real(catanh(-Inf + i NaN)) = -0", __real__ result, minus_zero);
4029 check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result);
4031 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0));
4032 check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result);
4033 check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result);
4034 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_zero));
4035 check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result);
4036 check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result);
4038 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, plus_infty));
4039 check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4040 check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result, M_PI_2);
4041 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_infty));
4042 check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4043 check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4045 result = FUNC(catanh) (BUILD_COMPLEX (10.5, nan_value));
4046 check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4047 __real__ result, INVALID_EXCEPTION);
4048 check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4050 result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value));
4051 check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4052 __real__ result, INVALID_EXCEPTION);
4053 check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4056 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75));
4057 check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4058 __real__ result, INVALID_EXCEPTION);
4059 check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4061 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75));
4062 check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4063 __real__ result, INVALID_EXCEPTION);
4064 check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4067 result = FUNC(catanh) (BUILD_COMPLEX (nan_value, nan_value));
4068 check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result);
4069 check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result);
4076 __complex__ MATHTYPE result;
4078 result = FUNC(ctan) (BUILD_COMPLEX (0, 0));
4079 check ("real(ctan(0 + i0)) = 0", __real__ result, 0);
4080 check ("imag(ctan(0 + i0)) = 0", __imag__ result, 0);
4081 result = FUNC(ctan) (BUILD_COMPLEX (0, minus_zero));
4082 check ("real(ctan(0 - i0)) = 0", __real__ result, 0);
4083 check ("imag(ctan(0 - i0)) = -0", __imag__ result, minus_zero);
4084 result = FUNC(ctan) (BUILD_COMPLEX (minus_zero, 0));
4085 check ("real(ctan(-0 + i0)) = -0", __real__ result, minus_zero);
4086 check ("imag(ctan(-0 + i0)) = 0", __imag__ result, 0);
4087 result = FUNC(ctan) (BUILD_COMPLEX (minus_zero, minus_zero));
4088 check ("real(ctan(-0 - i0)) = -0", __real__ result, minus_zero);
4089 check ("imag(ctan(-0 - i0)) = -0", __imag__ result, minus_zero);
4092 result = FUNC(ctan) (BUILD_COMPLEX (0, plus_infty));
4093 check ("real(ctan(0 + i Inf)) = 0", __real__ result, 0);
4094 check ("imag(ctan(0 + i Inf)) = 1", __imag__ result, 1);
4095 result = FUNC(ctan) (BUILD_COMPLEX (1, plus_infty));
4096 check ("real(ctan(1 + i Inf)) = 0", __real__ result, 0);
4097 check ("imag(ctan(1 + i Inf)) = 1", __imag__ result, 1);
4098 result = FUNC(ctan) (BUILD_COMPLEX (minus_zero, plus_infty));
4099 check ("real(ctan(-0 + i Inf)) = -0", __real__ result, minus_zero);
4100 check ("imag(ctan(-0 + i Inf)) = 1", __imag__ result, 1);
4101 result = FUNC(ctan) (BUILD_COMPLEX (-1, plus_infty));
4102 check ("real(ctan(-1 + i Inf)) = -0", __real__ result, minus_zero);
4103 check ("imag(ctan(-1 + i Inf)) = 1", __imag__ result, 1);
4105 result = FUNC(ctan) (BUILD_COMPLEX (0, minus_infty));
4106 check ("real(ctan(0 - i Inf)) = 0", __real__ result, 0);
4107 check ("imag(ctan(0 - i Inf)) = -1", __imag__ result, -1);
4108 result = FUNC(ctan) (BUILD_COMPLEX (1, minus_infty));
4109 check ("real(ctan(1 - i Inf)) = 0", __real__ result, 0);
4110 check ("imag(ctan(1 - i Inf)) = -1", __imag__ result, -1);
4111 result = FUNC(ctan) (BUILD_COMPLEX (minus_zero, minus_infty));
4112 check ("real(ctan(-0 - i Inf)) = -0", __real__ result, minus_zero);
4113 check ("imag(ctan(-0 - i Inf)) = -1", __imag__ result, -1);
4114 result = FUNC(ctan) (BUILD_COMPLEX (-1, minus_infty));
4115 check ("real(ctan(-1 - i Inf)) = -0", __real__ result, minus_zero);
4116 check ("imag(ctan(-1 - i Inf)) = -1", __imag__ result, -1);
4118 result = FUNC(ctan) (BUILD_COMPLEX (plus_infty, 0));
4119 check_isnan_exc ("real(ctan(Inf + i 0)) = NaN plus invalid exception",
4120 __real__ result, INVALID_EXCEPTION);
4121 check_isnan ("imag(ctan(Inf + i 0)) = NaN plus invalid exception",
4123 result = FUNC(ctan) (BUILD_COMPLEX (plus_infty, 2));
4124 check_isnan_exc ("real(ctan(Inf + i 2)) = NaN plus invalid exception",
4125 __real__ result, INVALID_EXCEPTION);
4126 check_isnan ("imag(ctan(Inf + i 2)) = NaN plus invalid exception",
4128 result = FUNC(ctan) (BUILD_COMPLEX (minus_infty, 0));
4129 check_isnan_exc ("real(ctan(-Inf + i 0)) = NaN plus invalid exception",
4130 __real__ result, INVALID_EXCEPTION);
4131 check_isnan ("imag(ctan(-Inf + i 0)) = NaN plus invalid exception",
4133 result = FUNC(ctan) (BUILD_COMPLEX (minus_infty, 2));
4134 check_isnan_exc ("real(ctan(- Inf + i 2)) = NaN plus invalid exception",
4135 __real__ result, INVALID_EXCEPTION);
4136 check_isnan ("imag(ctan(- Inf + i 2)) = NaN plus invalid exception",
4138 result = FUNC(ctan) (BUILD_COMPLEX (plus_infty, minus_zero));
4139 check_isnan_exc ("real(ctan(Inf - i 0)) = NaN plus invalid exception",
4140 __real__ result, INVALID_EXCEPTION);
4141 check_isnan ("imag(ctan(Inf - i 0)) = NaN plus invalid exception",
4143 result = FUNC(ctan) (BUILD_COMPLEX (plus_infty, -2));
4144 check_isnan_exc ("real(ctan(Inf - i 2)) = NaN plus invalid exception",
4145 __real__ result, INVALID_EXCEPTION);
4146 check_isnan ("imag(ctan(Inf - i 2)) = NaN plus invalid exception",
4148 result = FUNC(ctan) (BUILD_COMPLEX (minus_infty, minus_zero));
4149 check_isnan_exc ("real(ctan(-Inf - i 0)) = NaN plus invalid exception",
4150 __real__ result, INVALID_EXCEPTION);
4151 check_isnan ("imag(ctan(-Inf - i 0)) = NaN plus invalid exception",
4153 result = FUNC(ctan) (BUILD_COMPLEX (minus_infty, -2));
4154 check_isnan_exc ("real(ctan(-Inf - i 2)) = NaN plus invalid exception",
4155 __real__ result, INVALID_EXCEPTION);
4156 check_isnan ("imag(ctan(-Inf - i 2)) = NaN plus invalid exception",
4159 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, plus_infty));
4160 check ("real(ctan(NaN + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4161 check ("imag(ctan(NaN + i Inf)) = 1", __imag__ result, 1);
4162 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, minus_infty));
4163 check ("real(ctan(NaN - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
4164 check ("imag(ctan(NaN - i Inf)) = -1", __imag__ result, -1);
4166 result = FUNC(ctan) (BUILD_COMPLEX (0, nan_value));
4167 check ("real(ctan(0 + i NaN)) = 0", __real__ result, 0);
4168 check_isnan ("imag(ctan(0 + i NaN)) = NaN", __imag__ result);
4169 result = FUNC(ctan) (BUILD_COMPLEX (minus_zero, nan_value));
4170 check ("real(ctan(-0 + i NaN)) = -0", __real__ result, minus_zero);
4171 check_isnan ("imag(ctan(-0 + i NaN)) = NaN", __imag__ result);
4173 result = FUNC(ctan) (BUILD_COMPLEX (0.5, nan_value));
4174 check_isnan_maybe_exc ("real(ctan(0.5 + i NaN)) = NaN plus maybe invalid exception",
4175 __real__ result, INVALID_EXCEPTION);
4176 check_isnan ("imag(ctan(0.5 + i NaN)) = NaN plus maybe invalid exception",
4178 result = FUNC(ctan) (BUILD_COMPLEX (-4.5, nan_value));
4179 check_isnan_maybe_exc ("real(ctan(-4.5 + i NaN)) = NaN plus maybe invalid exception",
4180 __real__ result, INVALID_EXCEPTION);
4181 check_isnan ("imag(ctan(-4.5 + i NaN)) = NaN plus maybe invalid exception",
4184 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, 0));
4185 check_isnan_maybe_exc ("real(ctan(NaN + i 0)) = NaN plus maybe invalid exception",
4186 __real__ result, INVALID_EXCEPTION);
4187 check_isnan ("imag(ctan(NaN + i 0)) = NaN plus maybe invalid exception",
4189 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, 5));
4190 check_isnan_maybe_exc ("real(ctan(NaN + i 5)) = NaN plus maybe invalid exception",
4191 __real__ result, INVALID_EXCEPTION);
4192 check_isnan ("imag(ctan(NaN + i 5)) = NaN plus maybe invalid exception",
4194 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, minus_zero));
4195 check_isnan_maybe_exc ("real(ctan(NaN - i 0)) = NaN plus maybe invalid exception",
4196 __real__ result, INVALID_EXCEPTION);
4197 check_isnan ("imag(ctan(NaN - i 0)) = NaN plus maybe invalid exception",
4199 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, -0.25));
4200 check_isnan_maybe_exc ("real(ctan(NaN -i 0.25)) = NaN plus maybe invalid exception",
4201 __real__ result, INVALID_EXCEPTION);
4202 check_isnan ("imag(ctanh(NaN -i 0.25)) = NaN plus maybe invalid exception",
4205 result = FUNC(ctan) (BUILD_COMPLEX (nan_value, nan_value));
4206 check_isnan ("real(ctan(NaN + i NaN)) = NaN", __real__ result);
4207 check_isnan ("imag(ctan(NaN + i NaN)) = NaN", __imag__ result);
4215 __complex__ MATHTYPE result;
4217 result = FUNC(ctanh) (BUILD_COMPLEX (0, 0));
4218 check ("real(ctanh(0 + i0)) = 0", __real__ result, 0);
4219 check ("imag(ctanh(0 + i0)) = 0", __imag__ result, 0);
4220 result = FUNC(ctanh) (BUILD_COMPLEX (0, minus_zero));
4221 check ("real(ctanh(0 - i0)) = 0", __real__ result, 0);
4222 check ("imag(ctanh(0 - i0)) = -0", __imag__ result, minus_zero);
4223 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, 0));
4224 check ("real(ctanh(-0 + i0)) = -0", __real__ result, minus_zero);
4225 check ("imag(ctanh(-0 + i0)) = 0", __imag__ result, 0);
4226 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_zero));
4227 check ("real(ctanh(-0 - i0)) = -0", __real__ result, minus_zero);
4228 check ("imag(ctanh(-0 - i0)) = -0", __imag__ result, minus_zero);
4230 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 0));
4231 check ("real(ctanh(+Inf + i0)) = 1", __real__ result, 1);
4232 check ("imag(ctanh(+Inf + i0)) = 0", __imag__ result, 0);
4233 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 1));
4234 check ("real(ctanh(+Inf + i1)) = 1", __real__ result, 1);
4235 check ("imag(ctanh(+Inf + i1)) = 0", __imag__ result, 0);
4236 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, minus_zero));
4237 check ("real(ctanh(+Inf - i0)) = 1", __real__ result, 1);
4238 check ("imag(ctanh(+Inf - i0)) = -0", __imag__ result, minus_zero);
4239 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, -1));
4240 check ("real(ctanh(+Inf - i1)) = 1", __real__ result, 1);
4241 check ("imag(ctanh(+Inf - i1)) = -0", __imag__ result, minus_zero);
4242 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 0));
4243 check ("real(ctanh(-Inf + i0)) = -1", __real__ result, -1);
4244 check ("imag(ctanh(-Inf + i0)) = 0", __imag__ result, 0);
4245 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 1));
4246 check ("real(ctanh(-Inf + i1)) = -1", __real__ result, -1);
4247 check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result, 0);
4248 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, minus_zero));
4249 check ("real(ctanh(-Inf - i0)) = -1", __real__ result, -1);
4250 check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result, minus_zero);
4251 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, -1));
4252 check ("real(ctanh(-Inf - i1)) = -1", __real__ result, -1);
4253 check ("imag(ctanh(-Inf - i1)) = -0", __imag__ result, minus_zero);
4255 result = FUNC(ctanh) (BUILD_COMPLEX (0, plus_infty));
4256 check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
4257 __real__ result, INVALID_EXCEPTION);
4258 check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
4260 result = FUNC(ctanh) (BUILD_COMPLEX (2, plus_infty));
4261 check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
4262 __real__ result, INVALID_EXCEPTION);
4263 check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
4265 result = FUNC(ctanh) (BUILD_COMPLEX (0, minus_infty));
4266 check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
4267 __real__ result, INVALID_EXCEPTION);
4268 check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
4270 result = FUNC(ctanh) (BUILD_COMPLEX (2, minus_infty));
4271 check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
4272 __real__ result, INVALID_EXCEPTION);
4273 check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
4275 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, plus_infty));
4276 check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4277 __real__ result, INVALID_EXCEPTION);
4278 check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4280 result = FUNC(ctanh) (BUILD_COMPLEX (-2, plus_infty));
4281 check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4282 __real__ result, INVALID_EXCEPTION);
4283 check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4285 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_infty));
4286 check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4287 __real__ result, INVALID_EXCEPTION);
4288 check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4290 result = FUNC(ctanh) (BUILD_COMPLEX (-2, minus_infty));
4291 check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4292 __real__ result, INVALID_EXCEPTION);
4293 check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4296 result = FUNC(ctanh) (BUILD_COMPLEX (plus_infty, nan_value));
4297 check ("real(ctanh(+Inf + i NaN)) = 1", __real__ result, 1);
4298 check ("imag(ctanh(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
4299 result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, nan_value));
4300 check ("real(ctanh(-Inf + i NaN)) = -1", __real__ result, -1);
4301 check ("imag(ctanh(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
4303 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0));
4304 check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result);
4305 check ("imag(ctanh(NaN + i0)) = 0", __imag__ result, 0);
4306 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_zero));
4307 check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result);
4308 check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_zero);
4310 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5));
4311 check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4312 __real__ result, INVALID_EXCEPTION);
4313 check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4315 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, -4.5));
4316 check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4317 __real__ result, INVALID_EXCEPTION);
4318 check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4321 result = FUNC(ctanh) (BUILD_COMPLEX (0, nan_value));
4322 check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4323 __real__ result, INVALID_EXCEPTION);
4324 check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4326 result = FUNC(ctanh) (BUILD_COMPLEX (5, nan_value));
4327 check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4328 __real__ result, INVALID_EXCEPTION);
4329 check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4331 result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, nan_value));
4332 check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4333 __real__ result, INVALID_EXCEPTION);
4334 check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4336 result = FUNC(ctanh) (BUILD_COMPLEX (-0.25, nan_value));
4337 check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4338 __real__ result, INVALID_EXCEPTION);
4339 check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4342 result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, nan_value));
4343 check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result);
4344 check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result);
4346 result = FUNC(ctanh) (BUILD_COMPLEX (0, M_PI_4));
4347 check ("real(ctanh (0 + i pi/4)) == 0", __real__ result, 0);
4348 check_eps ("imag(ctanh (0 + i pi/4)) == 1", __imag__ result, 1,
4349 CHOOSE (0, 0, 2e-7));
4356 __complex__ MATHTYPE result;
4358 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, 0));
4359 check_isinfn_exc ("real(clog(-0 + i0)) = -Inf plus divide-by-zero exception",
4360 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4361 check ("imag(clog(-0 + i0)) = pi plus divide-by-zero exception",
4362 __imag__ result, M_PI);
4363 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_zero));
4364 check_isinfn_exc ("real(clog(-0 - i0)) = -Inf plus divide-by-zero exception",
4365 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4366 check ("imag(clog(-0 - i0)) = -pi plus divide-by-zero exception",
4367 __imag__ result, -M_PI);
4369 result = FUNC(clog) (BUILD_COMPLEX (0, 0));
4370 check_isinfn_exc ("real(clog(0 + i0)) = -Inf plus divide-by-zero exception",
4371 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4372 check ("imag(clog(0 + i0)) = 0 plus divide-by-zero exception",
4373 __imag__ result, 0);
4374 result = FUNC(clog) (BUILD_COMPLEX (0, minus_zero));
4375 check_isinfn_exc ("real(clog(0 - i0)) = -Inf plus divide-by-zero exception",
4376 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4377 check ("imag(clog(0 - i0)) = -0 plus divide-by-zero exception",
4378 __imag__ result, minus_zero);
4380 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, plus_infty));
4381 check_isinfp ("real(clog(-Inf + i Inf)) = +Inf", __real__ result);
4382 check ("imag(clog(-Inf + i Inf)) = 3*pi/4", __imag__ result, M_PI - M_PI_4);
4383 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_infty));
4384 check_isinfp ("real(clog(-Inf - i Inf)) = +Inf", __real__ result);
4385 check ("imag(clog(-Inf - i Inf)) = -3*pi/4", __imag__ result, M_PI_4 - M_PI);
4387 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, plus_infty));
4388 check_isinfp ("real(clog(+Inf + i Inf)) = +Inf", __real__ result);
4389 check ("imag(clog(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
4390 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_infty));
4391 check_isinfp ("real(clog(+Inf - i Inf)) = +Inf", __real__ result);
4392 check ("imag(clog(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
4394 result = FUNC(clog) (BUILD_COMPLEX (0, plus_infty));
4395 check_isinfp ("real(clog(0 + i Inf)) = +Inf", __real__ result);
4396 check ("imag(clog(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4397 result = FUNC(clog) (BUILD_COMPLEX (3, plus_infty));
4398 check_isinfp ("real(clog(3 + i Inf)) = +Inf", __real__ result);
4399 check ("imag(clog(3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4400 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, plus_infty));
4401 check_isinfp ("real(clog(-0 + i Inf)) = +Inf", __real__ result);
4402 check ("imag(clog(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4403 result = FUNC(clog) (BUILD_COMPLEX (-3, plus_infty));
4404 check_isinfp ("real(clog(-3 + i Inf)) = +Inf", __real__ result);
4405 check ("imag(clog(-3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4406 result = FUNC(clog) (BUILD_COMPLEX (0, minus_infty));
4407 check_isinfp ("real(clog(0 - i Inf)) = +Inf", __real__ result);
4408 check ("imag(clog(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4409 result = FUNC(clog) (BUILD_COMPLEX (3, minus_infty));
4410 check_isinfp ("real(clog(3 - i Inf)) = +Inf", __real__ result);
4411 check ("imag(clog(3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4412 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_infty));
4413 check_isinfp ("real(clog(-0 - i Inf)) = +Inf", __real__ result);
4414 check ("imag(clog(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4415 result = FUNC(clog) (BUILD_COMPLEX (-3, minus_infty));
4416 check_isinfp ("real(clog(-3 - i Inf)) = +Inf", __real__ result);
4417 check ("imag(clog(-3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4419 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, 0));
4420 check_isinfp ("real(clog(-Inf + i0)) = +Inf", __real__ result);
4421 check ("imag(clog(-Inf + i0)) = pi", __imag__ result, M_PI);
4422 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, 1));
4423 check_isinfp ("real(clog(-Inf + i1)) = +Inf", __real__ result);
4424 check ("imag(clog(-Inf + i1)) = pi", __imag__ result, M_PI);
4425 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_zero));
4426 check_isinfp ("real(clog(-Inf - i0)) = +Inf", __real__ result);
4427 check ("imag(clog(-Inf - i0)) = -pi", __imag__ result, -M_PI);
4428 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, -1));
4429 check_isinfp ("real(clog(-Inf - i1)) = +Inf", __real__ result);
4430 check ("imag(clog(-Inf - i1)) = -pi", __imag__ result, -M_PI);
4432 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, 0));
4433 check_isinfp ("real(clog(+Inf + i0)) = +Inf", __real__ result);
4434 check ("imag(clog(+Inf + i0)) = 0", __imag__ result, 0);
4435 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, 1));
4436 check_isinfp ("real(clog(+Inf + i1)) = +Inf", __real__ result);
4437 check ("imag(clog(+Inf + i1)) = 0", __imag__ result, 0);
4438 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_zero));
4439 check_isinfp ("real(clog(+Inf - i0)) = +Inf", __real__ result);
4440 check ("imag(clog(+Inf - i0)) = -0", __imag__ result, minus_zero);
4441 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, -1));
4442 check_isinfp ("real(clog(+Inf - i1)) = +Inf", __real__ result);
4443 check ("imag(clog(+Inf - i1)) = -0", __imag__ result, minus_zero);
4445 result = FUNC(clog) (BUILD_COMPLEX (plus_infty, nan_value));
4446 check_isinfp ("real(clog(+Inf + i NaN)) = +Inf", __real__ result);
4447 check_isnan ("imag(clog(+Inf + i NaN)) = NaN", __imag__ result);
4448 result = FUNC(clog) (BUILD_COMPLEX (minus_infty, nan_value));
4449 check_isinfp ("real(clog(-Inf + i NaN)) = +Inf", __real__ result);
4450 check_isnan ("imag(clog(-Inf + i NaN)) = NaN", __imag__ result);
4452 result = FUNC(clog) (BUILD_COMPLEX (nan_value, plus_infty));
4453 check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result);
4454 check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result);
4455 result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_infty));
4456 check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result);
4457 check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result);
4459 result = FUNC(clog) (BUILD_COMPLEX (0, nan_value));
4460 check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4461 __real__ result, INVALID_EXCEPTION);
4462 check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4464 result = FUNC(clog) (BUILD_COMPLEX (3, nan_value));
4465 check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4466 __real__ result, INVALID_EXCEPTION);
4467 check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4469 result = FUNC(clog) (BUILD_COMPLEX (minus_zero, nan_value));
4470 check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4471 __real__ result, INVALID_EXCEPTION);
4472 check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4474 result = FUNC(clog) (BUILD_COMPLEX (-3, nan_value));
4475 check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4476 __real__ result, INVALID_EXCEPTION);
4477 check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4480 result = FUNC(clog) (BUILD_COMPLEX (nan_value, 0));
4481 check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
4482 __real__ result, INVALID_EXCEPTION);
4483 check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
4485 result = FUNC(clog) (BUILD_COMPLEX (nan_value, 5));
4486 check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
4487 __real__ result, INVALID_EXCEPTION);
4488 check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
4490 result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_zero));
4491 check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
4492 __real__ result, INVALID_EXCEPTION);
4493 check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
4495 result = FUNC(clog) (BUILD_COMPLEX (nan_value, -5));
4496 check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
4497 __real__ result, INVALID_EXCEPTION);
4498 check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
4501 result = FUNC(clog) (BUILD_COMPLEX (nan_value, nan_value));
4502 check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result);
4503 check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result);
4510 __complex__ MATHTYPE result;
4512 result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, 0));
4513 check_isinfn_exc ("real(clog10(-0 + i0)) = -Inf plus divide-by-zero exception",
4514 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4515 check ("imag(clog10(-0 + i0)) = pi plus divide-by-zero exception",
4516 __imag__ result, M_PI);
4517 result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_zero));
4518 check_isinfn_exc ("real(clog10(-0 - i0)) = -Inf plus divide-by-zero exception",
4519 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4520 check ("imag(clog10(-0 - i0)) = -pi plus divide-by-zero exception",
4521 __imag__ result, -M_PI);
4523 result = FUNC(clog10) (BUILD_COMPLEX (0, 0));
4524 check_isinfn_exc ("real(clog10(0 + i0)) = -Inf plus divide-by-zero exception",
4525 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4526 check ("imag(clog10(0 + i0)) = 0 plus divide-by-zero exception",
4527 __imag__ result, 0);
4528 result = FUNC(clog10) (BUILD_COMPLEX (0, minus_zero));
4529 check_isinfn_exc ("real(clog10(0 - i0)) = -Inf plus divide-by-zero exception",
4530 __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
4531 check ("imag(clog10(0 - i0)) = -0 plus divide-by-zero exception",
4532 __imag__ result, minus_zero);
4534 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, plus_infty));
4535 check_isinfp ("real(clog10(-Inf + i Inf)) = +Inf", __real__ result);
4536 check ("imag(clog10(-Inf + i Inf)) = 3*pi/4", __imag__ result, M_PI - M_PI_4);
4537 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_infty));
4538 check_isinfp ("real(clog10(-Inf - i Inf)) = +Inf", __real__ result);
4539 check ("imag(clog10(-Inf - i Inf)) = -3*pi/4", __imag__ result, M_PI_4 - M_PI);
4541 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, plus_infty));
4542 check_isinfp ("real(clog10(+Inf + i Inf)) = +Inf", __real__ result);
4543 check ("imag(clog10(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
4544 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_infty));
4545 check_isinfp ("real(clog10(+Inf - i Inf)) = +Inf", __real__ result);
4546 check ("imag(clog10(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
4548 result = FUNC(clog10) (BUILD_COMPLEX (0, plus_infty));
4549 check_isinfp ("real(clog10(0 + i Inf)) = +Inf", __real__ result);
4550 check ("imag(clog10(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4551 result = FUNC(clog10) (BUILD_COMPLEX (3, plus_infty));
4552 check_isinfp ("real(clog10(3 + i Inf)) = +Inf", __real__ result);
4553 check ("imag(clog10(3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4554 result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, plus_infty));
4555 check_isinfp ("real(clog10(-0 + i Inf)) = +Inf", __real__ result);
4556 check ("imag(clog10(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4557 result = FUNC(clog10) (BUILD_COMPLEX (-3, plus_infty));
4558 check_isinfp ("real(clog10(-3 + i Inf)) = +Inf", __real__ result);
4559 check ("imag(clog10(-3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
4560 result = FUNC(clog10) (BUILD_COMPLEX (0, minus_infty));
4561 check_isinfp ("real(clog10(0 - i Inf)) = +Inf", __real__ result);
4562 check ("imag(clog10(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4563 result = FUNC(clog10) (BUILD_COMPLEX (3, minus_infty));
4564 check_isinfp ("real(clog10(3 - i Inf)) = +Inf", __real__ result);
4565 check ("imag(clog10(3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4566 result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_infty));
4567 check_isinfp ("real(clog10(-0 - i Inf)) = +Inf", __real__ result);
4568 check ("imag(clog10(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4569 result = FUNC(clog10) (BUILD_COMPLEX (-3, minus_infty));
4570 check_isinfp ("real(clog10(-3 - i Inf)) = +Inf", __real__ result);
4571 check ("imag(clog10(-3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
4573 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 0));
4574 check_isinfp ("real(clog10(-Inf + i0)) = +Inf", __real__ result);
4575 check ("imag(clog10(-Inf + i0)) = pi", __imag__ result, M_PI);
4576 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 1));
4577 check_isinfp ("real(clog10(-Inf + i1)) = +Inf", __real__ result);
4578 check ("imag(clog10(-Inf + i1)) = pi", __imag__ result, M_PI);
4579 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_zero));
4580 check_isinfp ("real(clog10(-Inf - i0)) = +Inf", __real__ result);
4581 check ("imag(clog10(-Inf - i0)) = -pi", __imag__ result, -M_PI);
4582 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, -1));
4583 check_isinfp ("real(clog10(-Inf - i1)) = +Inf", __real__ result);
4584 check ("imag(clog10(-Inf - i1)) = -pi", __imag__ result, -M_PI);
4586 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, 0));
4587 check_isinfp ("real(clog10(+Inf + i0)) = +Inf", __real__ result);
4588 check ("imag(clog10(+Inf + i0)) = 0", __imag__ result, 0);
4589 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, 1));
4590 check_isinfp ("real(clog10(+Inf + i1)) = +Inf", __real__ result);
4591 check ("imag(clog10(+Inf + i1)) = 0", __imag__ result, 0);
4592 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_zero));
4593 check_isinfp ("real(clog10(+Inf - i0)) = +Inf", __real__ result);
4594 check ("imag(clog10(+Inf - i0)) = -0", __imag__ result, minus_zero);
4595 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, -1));
4596 check_isinfp ("real(clog10(+Inf - i1)) = +Inf", __real__ result);
4597 check ("imag(clog10(+Inf - i1)) = -0", __imag__ result, minus_zero);
4599 result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, nan_value));
4600 check_isinfp ("real(clog10(+Inf + i NaN)) = +Inf", __real__ result);
4601 check_isnan ("imag(clog10(+Inf + i NaN)) = NaN", __imag__ result);
4602 result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, nan_value));
4603 check_isinfp ("real(clog10(-Inf + i NaN)) = +Inf", __real__ result);
4604 check_isnan ("imag(clog10(-Inf + i NaN)) = NaN", __imag__ result);
4606 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, plus_infty));
4607 check_isinfp ("real(clog10(NaN + i Inf)) = +Inf", __real__ result);
4608 check_isnan ("imag(clog10(NaN + i Inf)) = NaN", __imag__ result);
4609 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_infty));
4610 check_isinfp ("real(clog10(NaN - i Inf)) = +Inf", __real__ result);
4611 check_isnan ("imag(clog10(NaN - i Inf)) = NaN", __imag__ result);
4613 result = FUNC(clog10) (BUILD_COMPLEX (0, nan_value));
4614 check_isnan_maybe_exc ("real(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
4615 __real__ result, INVALID_EXCEPTION);
4616 check_isnan ("imag(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
4618 result = FUNC(clog10) (BUILD_COMPLEX (3, nan_value));
4619 check_isnan_maybe_exc ("real(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
4620 __real__ result, INVALID_EXCEPTION);
4621 check_isnan ("imag(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
4623 result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, nan_value));
4624 check_isnan_maybe_exc ("real(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
4625 __real__ result, INVALID_EXCEPTION);
4626 check_isnan ("imag(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
4628 result = FUNC(clog10) (BUILD_COMPLEX (-3, nan_value));
4629 check_isnan_maybe_exc ("real(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
4630 __real__ result, INVALID_EXCEPTION);
4631 check_isnan ("imag(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
4634 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, 0));
4635 check_isnan_maybe_exc ("real(clog10(NaN + i0)) = NaN plus maybe invalid exception",
4636 __real__ result, INVALID_EXCEPTION);
4637 check_isnan ("imag(clog10(NaN + i0)) = NaN plus maybe invalid exception",
4639 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, 5));
4640 check_isnan_maybe_exc ("real(clog10(NaN + i5)) = NaN plus maybe invalid exception",
4641 __real__ result, INVALID_EXCEPTION);
4642 check_isnan ("imag(clog10(NaN + i5)) = NaN plus maybe invalid exception",
4644 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_zero));
4645 check_isnan_maybe_exc ("real(clog10(NaN - i0)) = NaN plus maybe invalid exception",
4646 __real__ result, INVALID_EXCEPTION);
4647 check_isnan ("imag(clog10(NaN - i0)) = NaN plus maybe invalid exception",
4649 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, -5));
4650 check_isnan_maybe_exc ("real(clog10(NaN - i5)) = NaN plus maybe invalid exception",
4651 __real__ result, INVALID_EXCEPTION);
4652 check_isnan ("imag(clog10(NaN - i5)) = NaN plus maybe invalid exception",
4655 result = FUNC(clog10) (BUILD_COMPLEX (nan_value, nan_value));
4656 check_isnan ("real(clog10(NaN + i NaN)) = NaN", __real__ result);
4657 check_isnan ("imag(clog10(NaN + i NaN)) = NaN", __imag__ result);
4664 __complex__ MATHTYPE result;
4666 result = FUNC(csqrt) (BUILD_COMPLEX (0, 0));
4667 check ("real(csqrt(0 + i0)) = 0", __real__ result, 0);
4668 check ("imag(csqrt(0 + i0)) = 0", __imag__ result, 0);
4669 result = FUNC(csqrt) (BUILD_COMPLEX (0, minus_zero));
4670 check ("real(csqrt(0 - i0)) = 0", __real__ result, 0);
4671 check ("imag(csqrt(0 - i0)) = -0", __imag__ result, minus_zero);
4672 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, 0));
4673 check ("real(csqrt(-0 + i0)) = 0", __real__ result, 0);
4674 check ("imag(csqrt(-0 + i0)) = 0", __imag__ result, 0);
4675 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_zero));
4676 check ("real(csqrt(-0 - i0)) = 0", __real__ result, 0);
4677 check ("imag(csqrt(-0 - i0)) = -0", __imag__ result, minus_zero);
4679 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 0));
4680 check ("real(csqrt(-Inf + i0)) = 0", __real__ result, 0);
4681 check_isinfp ("imag(csqrt(-Inf + i0)) = +Inf", __imag__ result);
4682 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 6));
4683 check ("real(csqrt(-Inf + i6)) = 0", __real__ result, 0);
4684 check_isinfp ("imag(csqrt(-Inf + i6)) = +Inf", __imag__ result);
4685 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_zero));
4686 check ("real(csqrt(-Inf - i0)) = 0", __real__ result, 0);
4687 check_isinfn ("imag(csqrt(-Inf - i0)) = -Inf", __imag__ result);
4688 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, -6));
4689 check ("real(csqrt(-Inf - i6)) = 0", __real__ result, 0);
4690 check_isinfn ("imag(csqrt(-Inf - i6)) = -Inf", __imag__ result);
4692 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 0));
4693 check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result);
4694 check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result, 0);
4695 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 6));
4696 check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result);
4697 check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result, 0);
4698 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_zero));
4699 check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result);
4700 check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result, minus_zero);
4701 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, -6));
4702 check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result);
4703 check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result, minus_zero);
4705 result = FUNC(csqrt) (BUILD_COMPLEX (0, plus_infty));
4706 check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result);
4707 check_isinfp ("imag(csqrt(0 + i Inf)) = +Inf", __imag__ result);
4708 result = FUNC(csqrt) (BUILD_COMPLEX (4, plus_infty));
4709 check_isinfp ("real(csqrt(4 + i Inf)) = +Inf", __real__ result);
4710 check_isinfp ("imag(csqrt(4 + i Inf)) = +Inf", __imag__ result);
4711 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, plus_infty));
4712 check_isinfp ("real(csqrt(+Inf + i Inf)) = +Inf", __real__ result);
4713 check_isinfp ("imag(csqrt(+Inf + i Inf)) = +Inf", __imag__ result);
4714 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, plus_infty));
4715 check_isinfp ("real(csqrt(-0 + i Inf)) = +Inf", __real__ result);
4716 check_isinfp ("imag(csqrt(-0 + i Inf)) = +Inf", __imag__ result);
4717 result = FUNC(csqrt) (BUILD_COMPLEX (-4, plus_infty));
4718 check_isinfp ("real(csqrt(-4 + i Inf)) = +Inf", __real__ result);
4719 check_isinfp ("imag(csqrt(-4 + i Inf)) = +Inf", __imag__ result);
4720 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, plus_infty));
4721 check_isinfp ("real(csqrt(-Inf + i Inf)) = +Inf", __real__ result);
4722 check_isinfp ("imag(csqrt(-Inf + i Inf)) = +Inf", __imag__ result);
4723 result = FUNC(csqrt) (BUILD_COMPLEX (0, minus_infty));
4724 check_isinfp ("real(csqrt(0 - i Inf)) = +Inf", __real__ result);
4725 check_isinfn ("imag(csqrt(0 - i Inf)) = -Inf", __imag__ result);
4726 result = FUNC(csqrt) (BUILD_COMPLEX (4, minus_infty));
4727 check_isinfp ("real(csqrt(4 - i Inf)) = +Inf", __real__ result);
4728 check_isinfn ("imag(csqrt(4 - i Inf)) = -Inf", __imag__ result);
4729 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_infty));
4730 check_isinfp ("real(csqrt(+Inf - i Inf)) = +Inf", __real__ result);
4731 check_isinfn ("imag(csqrt(+Inf - i Inf)) = -Inf", __imag__ result);
4732 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_infty));
4733 check_isinfp ("real(csqrt(-0 - i Inf)) = +Inf", __real__ result);
4734 check_isinfn ("imag(csqrt(-0 - i Inf)) = -Inf", __imag__ result);
4735 result = FUNC(csqrt) (BUILD_COMPLEX (-4, minus_infty));
4736 check_isinfp ("real(csqrt(-4 - i Inf)) = +Inf", __real__ result);
4737 check_isinfn ("imag(csqrt(-4 - i Inf)) = -Inf", __imag__ result);
4738 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_infty));
4739 check_isinfp ("real(csqrt(-Inf - i Inf)) = +Inf", __real__ result);
4740 check_isinfn ("imag(csqrt(-Inf - i Inf)) = -Inf", __imag__ result);
4742 result = FUNC(csqrt) (BUILD_COMPLEX (minus_infty, nan_value));
4743 check_isnan ("real(csqrt(-Inf + i NaN)) = NaN", __real__ result);
4744 check_isinfp ("imag(csqrt(-Inf + i NaN)) = +-Inf",
4745 FUNC(fabs) (__imag__ result));
4747 result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, nan_value));
4748 check_isinfp ("real(csqrt(+Inf + i NaN)) = +Inf", __real__ result);
4749 check_isnan ("imag(csqrt(+Inf + i NaN)) = NaN", __imag__ result);
4751 result = FUNC(csqrt) (BUILD_COMPLEX (0, nan_value));
4752 check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4753 __real__ result, INVALID_EXCEPTION);
4754 check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4756 result = FUNC(csqrt) (BUILD_COMPLEX (1, nan_value));
4757 check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4758 __real__ result, INVALID_EXCEPTION);
4759 check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4761 result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, nan_value));
4762 check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4763 __real__ result, INVALID_EXCEPTION);
4764 check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4766 result = FUNC(csqrt) (BUILD_COMPLEX (-1, nan_value));
4767 check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4768 __real__ result, INVALID_EXCEPTION);
4769 check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4772 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 0));
4773 check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4774 __real__ result, INVALID_EXCEPTION);
4775 check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4777 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 8));
4778 check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4779 __real__ result, INVALID_EXCEPTION);
4780 check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4782 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, minus_zero));
4783 check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4784 __real__ result, INVALID_EXCEPTION);
4785 check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4787 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, -8));
4788 check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4789 __real__ result, INVALID_EXCEPTION);
4790 check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4793 result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, nan_value));
4794 check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result);
4795 check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result);
4797 result = FUNC(csqrt) (BUILD_COMPLEX (16.0, -30.0));
4798 check ("real(csqrt(16 - 30i)) = 5", __real__ result, 5.0);
4799 check ("imag(csqrt(16 - 30i)) = -3", __imag__ result, -3.0);
4801 result = FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
4802 check ("real(csqrt(1 + i0) = 0", __real__ result, 0);
4803 check ("imag(csqrt(1 + i0) = 1", __imag__ result, 1);
4805 result = FUNC(csqrt) (BUILD_COMPLEX (0, 2));
4806 check ("real(csqrt(0 + i 2) = 1", __real__ result, 1);
4807 check ("imag(csqrt(0 + i 2) = 1", __imag__ result, 1);
4809 result = FUNC(csqrt) (BUILD_COMPLEX (119, 120));
4810 check ("real(csqrt(119 + i 120) = 12", __real__ result, 12);
4811 check ("imag(csqrt(119 + i 120) = 5", __imag__ result, 5);
4818 __complex__ MATHTYPE result;
4820 result = FUNC (cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
4821 check ("real(cpow (1 + i0), (0 + i0)) == 0", __real__ result, 1);
4822 check ("imag(cpow (1 + i0), (0 + i0)) == 0", __imag__ result, 0);
4824 result = FUNC (cpow) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
4825 check_eps ("real(cpow (2 + i0), (10 + i0)) == 1024", __real__ result, 1024,
4826 CHOOSE (2e-16L, 0, 0));
4827 check ("imag(cpow (2 + i0), (10 + i0)) == 0", __imag__ result, 0);
4829 result = FUNC (cpow) (BUILD_COMPLEX (M_E, 0), BUILD_COMPLEX (0, 2*M_PI));
4830 check ("real(cpow (e + i0), (0 + i 2*PI)) == 1", __real__ result, 1);
4831 check_eps ("imag(cpow (e + i0), (0 + i 2*PI)) == 0", __imag__ result, 0,
4832 CHOOSE (1e-18L, 3e-16, 4e-7));
4834 result = FUNC (cpow) (BUILD_COMPLEX (2, 3), BUILD_COMPLEX (4, 0));
4835 check_eps ("real(cpow (2 + i3), (4 + i0)) == -119", __real__ result, -119,
4836 CHOOSE (2e-17L, 2e-14, 4e-5));
4837 check_eps ("imag(cpow (2 + i3), (4 + i0)) == -120", __imag__ result, -120,
4838 CHOOSE (4e-17L, 0, 8e-6));
4845 /* cabs (x + iy) is specified as hypot (x,y) */
4847 a = random_greater (0);
4848 check_isinfp_ext ("cabs (+inf + i x) == +inf",
4849 FUNC(cabs) (BUILD_COMPLEX (plus_infty, a)), a);
4850 check_isinfp_ext ("cabs (-inf + i x) == +inf",
4851 FUNC(cabs) (BUILD_COMPLEX (minus_infty, a)), a);
4853 check_isinfp ("cabs (+inf+ iNaN) == +inf",
4854 FUNC(cabs) (BUILD_COMPLEX(minus_infty, nan_value)));
4855 check_isinfp ("cabs (-inf+ iNaN) == +inf",
4856 FUNC(cabs) (BUILD_COMPLEX(minus_infty, nan_value)));
4858 check_isnan ("cabs (NaN+ iNaN) == NaN",
4859 FUNC(cabs) (BUILD_COMPLEX(nan_value, nan_value)));
4861 a = FUNC(cabs) (BUILD_COMPLEX (12.4L, 0.7L));
4862 check ("cabs (x,y) == cabs (y,x)",
4863 FUNC(cabs) (BUILD_COMPLEX(0.7L, 12.4L)), a);
4864 check ("cabs (x,y) == cabs (-x,y)",
4865 FUNC(cabs) (BUILD_COMPLEX(-12.4L, 0.7L)), a);
4866 check ("cabs (x,y) == cabs (-y,x)",
4867 FUNC(cabs) (BUILD_COMPLEX(-0.7L, 12.4L)), a);
4868 check ("cabs (x,y) == cabs (-x,-y)",
4869 FUNC(cabs) (BUILD_COMPLEX(-12.4L, -0.7L)), a);
4870 check ("cabs (x,y) == cabs (-y,-x)",
4871 FUNC(cabs) (BUILD_COMPLEX(-0.7L, -12.4L)), a);
4872 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(-0.7L, 0)), 0.7L);
4873 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(0.7L, 0)), 0.7L);
4874 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(-1.0L, 0)), 1.0L);
4875 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(1.0L, 0)), 1.0L);
4876 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(-5.7e7L, 0)),
4878 check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(5.7e7L, 0)),
4887 /* carg (x + iy) is specified as atan2 (y, x) */
4890 x = random_greater (0);
4891 check ("carg (x + i 0) == 0 for x > 0",
4892 FUNC(carg) (BUILD_COMPLEX(x, 0)), 0);
4893 x = random_greater (0);
4894 check ("carg (x - i 0) == -0 for x > 0",
4895 FUNC(carg) (BUILD_COMPLEX(x, minus_zero)), minus_zero);
4897 check ("carg (+0 + i 0) == +0", FUNC(carg) (BUILD_COMPLEX(0, 0)), 0);
4898 check ("carg (+0 - i 0) == -0", FUNC(carg) (BUILD_COMPLEX(0, minus_zero)),
4901 x = -random_greater (0);
4902 check ("carg (x + i 0) == +pi for x < 0", FUNC(carg) (BUILD_COMPLEX(x, 0)),
4905 x = -random_greater (0);
4906 check ("carg (x - i 0) == -pi for x < 0",
4907 FUNC(carg) (BUILD_COMPLEX(x, minus_zero)), -M_PI);
4909 check ("carg (-0 + i 0) == +pi", FUNC(carg) (BUILD_COMPLEX(minus_zero, 0)),
4911 check ("carg (-0 - i 0) == -pi",
4912 FUNC(carg) (BUILD_COMPLEX(minus_zero, minus_zero)), -M_PI);
4914 x = random_greater (0);
4915 check ("carg (+0 + i y) == pi/2 for y > 0", FUNC(carg) (BUILD_COMPLEX(0, x)),
4918 x = random_greater (0);
4919 check ("carg (-0 + i y) == pi/2 for y > 0",
4920 FUNC(carg) (BUILD_COMPLEX(minus_zero, x)), M_PI_2);
4922 x = random_less (0);
4923 check ("carg (+0 + i y) == -pi/2 for y < 0", FUNC(carg) (BUILD_COMPLEX(0, x)),
4926 x = random_less (0);
4927 check ("carg (-0 + i y) == -pi/2 for y < 0",
4928 FUNC(carg) (BUILD_COMPLEX(minus_zero, x)), -M_PI_2);
4930 x = random_greater (0);
4931 check ("carg (inf + i y) == +0 for finite y > 0",
4932 FUNC(carg) (BUILD_COMPLEX(plus_infty, x)), 0);
4934 x = -random_greater (0);
4935 check ("carg (inf + i y) == -0 for finite y < 0",
4936 FUNC(carg) (BUILD_COMPLEX(plus_infty, x)), minus_zero);
4938 x = random_value (-1e4, 1e4);
4939 check ("carg(x + i inf) == pi/2 for finite x",
4940 FUNC(carg) (BUILD_COMPLEX(x, plus_infty)), M_PI_2);
4942 x = random_value (-1e4, 1e4);
4943 check ("carg(x - i inf) == -pi/2 for finite x",
4944 FUNC(carg) (BUILD_COMPLEX(x, minus_infty)), -M_PI_2);
4946 x = random_greater (0);
4947 check ("carg (-inf + i y) == +pi for finite y > 0",
4948 FUNC(carg) (BUILD_COMPLEX(minus_infty, x)), M_PI);
4950 x = -random_greater (0);
4951 check ("carg (-inf + i y) == -pi for finite y < 0",
4952 FUNC(carg) (BUILD_COMPLEX(minus_infty, x)), -M_PI);
4954 check ("carg (+inf + i inf) == +pi/4",
4955 FUNC(carg) (BUILD_COMPLEX(plus_infty, plus_infty)), M_PI_4);
4957 check ("carg (+inf -i inf) == -pi/4",
4958 FUNC(carg) (BUILD_COMPLEX(plus_infty, minus_infty)), -M_PI_4);
4960 check ("carg (-inf +i inf) == +3*pi/4",
4961 FUNC(carg) (BUILD_COMPLEX(minus_infty, plus_infty)), 3 * M_PI_4);
4963 check ("carg (-inf -i inf) == -3*pi/4",
4964 FUNC(carg) (BUILD_COMPLEX(minus_infty, minus_infty)), -3 * M_PI_4);
4970 nearbyint_test (void)
4972 check ("nearbyint(+0) = 0", FUNC(nearbyint) (0.0), 0.0);
4973 check ("nearbyint(-0) = -0", FUNC(nearbyint) (minus_zero), minus_zero);
4974 check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint) (plus_infty));
4975 check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint) (minus_infty));
4982 check ("rint(0) = 0", FUNC(rint) (0.0), 0.0);
4983 check ("rint(-0) = -0", FUNC(rint) (minus_zero), minus_zero);
4984 check_isinfp ("rint(+Inf) = +Inf", FUNC(rint) (plus_infty));
4985 check_isinfn ("rint(-Inf) = -Inf", FUNC(rint) (minus_infty));
4992 /* XXX this test is incomplete. We need to have a way to specifiy
4993 the rounding method and test the critical cases. So far, only
4994 unproblematic numbers are tested. */
4996 check_long ("lrint(0) = 0", FUNC(lrint) (0.0), 0);
4997 check_long ("lrint(-0) = 0", FUNC(lrint) (minus_zero), 0);
4998 check_long ("lrint(0.2) = 0", FUNC(lrint) (0.2), 0);
4999 check_long ("lrint(-0.2) = 0", FUNC(lrint) (-0.2), 0);
5001 check_long ("lrint(1.4) = 1", FUNC(lrint) (1.4), 1);
5002 check_long ("lrint(-1.4) = -1", FUNC(lrint) (-1.4), -1);
5004 check_long ("lrint(8388600.3) = 8388600", FUNC(lrint) (8388600.3), 8388600);
5005 check_long ("lrint(-8388600.3) = -8388600", FUNC(lrint) (-8388600.3),
5013 /* XXX this test is incomplete. We need to have a way to specifiy
5014 the rounding method and test the critical cases. So far, only
5015 unproblematic numbers are tested. */
5017 check_longlong ("llrint(0) = 0", FUNC(llrint) (0.0), 0);
5018 check_longlong ("llrint(-0) = 0", FUNC(llrint) (minus_zero), 0);
5019 check_longlong ("llrint(0.2) = 0", FUNC(llrint) (0.2), 0);
5020 check_longlong ("llrint(-0.2) = 0", FUNC(llrint) (-0.2), 0);
5022 check_longlong ("llrint(1.4) = 1", FUNC(llrint) (1.4), 1);
5023 check_longlong ("llrint(-1.4) = -1", FUNC(llrint) (-1.4), -1);
5025 check_longlong ("llrint(8388600.3) = 8388600", FUNC(llrint) (8388600.3),
5027 check_longlong ("llrint(-8388600.3) = -8388600", FUNC(llrint) (-8388600.3),
5030 /* Test boundary conditions. */
5032 check_longlong ("llrint(2097151.0) = 2097151", FUNC(llrint) (2097151.0),
5035 check_longlong ("llrint(8388608.0) = 8388608", FUNC(llrint) (8388608.0),
5038 check_longlong ("llrint(16777216.0) = 16777216",
5039 FUNC(llrint) (16777216.0), 16777216LL);
5041 check_longlong ("llrint(2199023255552.0) = 2199023255552",
5042 FUNC(llrint) (2199023255552.0), 2199023255552LL);
5044 check_longlong ("llrint(4398046511104.0) = 4398046511104",
5045 FUNC(llrint) (4398046511104.0), 4398046511104LL);
5046 /* 0x10000000000000 */
5047 check_longlong ("llrint(4503599627370496.0) = 4503599627370496",
5048 FUNC(llrint) (4503599627370496.0), 4503599627370496LL);
5049 /* 0x10000080000000 */
5050 check_longlong ("llrint(4503601774854144.0) = 4503601774854144",
5051 FUNC(llrint) (4503601774854144.0), 4503601774854144LL);
5052 /* 0x20000000000000 */
5053 check_longlong ("llrint(9007199254740992.0) = 9007199254740992",
5054 FUNC(llrint) (9007199254740992.0), 9007199254740992LL);
5055 /* 0x80000000000000 */
5056 check_longlong ("llrint(36028797018963968.0) = 36028797018963968",
5057 FUNC(llrint) (36028797018963968.0), 36028797018963968LL);
5058 /* 0x100000000000000 */
5059 check_longlong ("llrint(72057594037927936.0) = 72057594037927936",
5060 FUNC(llrint) (72057594037927936.0), 72057594037927936LL);
5067 check ("round(0) = 0", FUNC(round) (0), 0);
5068 check ("round(-0) = -0", FUNC(round) (minus_zero), minus_zero);
5069 check ("round(0.2) = 0", FUNC(round) (0.2), 0.0);
5070 check ("round(-0.2) = -0", FUNC(round) (-0.2), minus_zero);
5071 check ("round(0.5) = 1", FUNC(round) (0.5), 1.0);
5072 check ("round(-0.5) = -1", FUNC(round) (-0.5), -1.0);
5073 check ("round(0.8) = 1", FUNC(round) (0.8), 1.0);
5074 check ("round(-0.8) = -1", FUNC(round) (-0.8), -1.0);
5075 check ("round(1.5) = 2", FUNC(round) (1.5), 2.0);
5076 check ("round(-1.5) = -2", FUNC(round) (-1.5), -2.0);
5077 check ("round(2097152.5) = 2097153", FUNC(round) (2097152.5), 2097153);
5078 check ("round(-2097152.5) = -2097153", FUNC(round) (-2097152.5), -2097153);
5085 check_long ("lround(0) = 0", FUNC(lround) (0), 0);
5086 check_long ("lround(-0) = 0", FUNC(lround) (minus_zero), 0);
5087 check_long ("lround(0.2) = 0", FUNC(lround) (0.2), 0.0);
5088 check_long ("lround(-0.2) = 0", FUNC(lround) (-0.2), 0);
5089 check_long ("lround(0.5) = 1", FUNC(lround) (0.5), 1);
5090 check_long ("lround(-0.5) = -1", FUNC(lround) (-0.5), -1);
5091 check_long ("lround(0.8) = 1", FUNC(lround) (0.8), 1);
5092 check_long ("lround(-0.8) = -1", FUNC(lround) (-0.8), -1);
5093 check_long ("lround(1.5) = 2", FUNC(lround) (1.5), 2);
5094 check_long ("lround(-1.5) = -2", FUNC(lround) (-1.5), -2);
5095 check_long ("lround(22514.5) = 22515", FUNC(lround) (22514.5), 22515);
5096 check_long ("lround(-22514.5) = -22515", FUNC(lround) (-22514.5), -22515);
5098 check_long ("lround(2097152.5) = 2097153", FUNC(lround) (2097152.5),
5100 check_long ("lround(-2097152.5) = -2097153", FUNC(lround) (-2097152.5),
5109 check_longlong ("llround(0) = 0", FUNC(llround) (0), 0);
5110 check_longlong ("llround(-0) = 0", FUNC(llround) (minus_zero), 0);
5111 check_longlong ("llround(0.2) = 0", FUNC(llround) (0.2), 0.0);
5112 check_longlong ("llround(-0.2) = 0", FUNC(llround) (-0.2), 0);
5113 check_longlong ("llround(0.5) = 1", FUNC(llround) (0.5), 1);
5114 check_longlong ("llround(-0.5) = -1", FUNC(llround) (-0.5), -1);
5115 check_longlong ("llround(0.8) = 1", FUNC(llround) (0.8), 1);
5116 check_longlong ("llround(-0.8) = -1", FUNC(llround) (-0.8), -1);
5117 check_longlong ("llround(1.5) = 2", FUNC(llround) (1.5), 2);
5118 check_longlong ("llround(-1.5) = -2", FUNC(llround) (-1.5), -2);
5119 check_longlong ("llround(22514.5) = 22515", FUNC(llround) (22514.5), 22515);
5120 check_longlong ("llround(-22514.5) = -22515", FUNC(llround) (-22514.5),
5123 check_longlong ("llround(2097152.5) = 2097153",
5124 FUNC(llround) (2097152.5), 2097153);
5125 check_longlong ("llround(-2097152.5) = -2097153",
5126 FUNC(llround) (-2097152.5), -2097153);
5127 check_longlong ("llround(34359738368.5) = 34359738369",
5128 FUNC(llround) (34359738368.5), 34359738369ll);
5129 check_longlong ("llround(-34359738368.5) = -34359738369",
5130 FUNC(llround) (-34359738368.5), -34359738369ll);
5133 /* Test boundary conditions. */
5135 check_longlong ("llround(2097151.0) = 2097151", FUNC(llround) (2097151.0),
5138 check_longlong ("llround(8388608.0) = 8388608", FUNC(llround) (8388608.0),
5141 check_longlong ("llround(16777216.0) = 16777216",
5142 FUNC(llround) (16777216.0), 16777216LL);
5144 check_longlong ("llround(2199023255552.0) = 2199023255552",
5145 FUNC(llround) (2199023255552.0), 2199023255552LL);
5147 check_longlong ("llround(4398046511104.0) = 4398046511104",
5148 FUNC(llround) (4398046511104.0), 4398046511104LL);
5149 /* 0x10000000000000 */
5150 check_longlong ("llround(4503599627370496.0) = 4503599627370496",
5151 FUNC(llround) (4503599627370496.0), 4503599627370496LL);
5152 /* 0x10000080000000 */
5153 check_longlong ("llrint(4503601774854144.0) = 4503601774854144",
5154 FUNC(llrint) (4503601774854144.0), 4503601774854144LL);
5155 /* 0x20000000000000 */
5156 check_longlong ("llround(9007199254740992.0) = 9007199254740992",
5157 FUNC(llround) (9007199254740992.0), 9007199254740992LL);
5158 /* 0x80000000000000 */
5159 check_longlong ("llround(36028797018963968.0) = 36028797018963968",
5160 FUNC(llround) (36028797018963968.0), 36028797018963968LL);
5161 /* 0x100000000000000 */
5162 check_longlong ("llround(72057594037927936.0) = 72057594037927936",
5163 FUNC(llround) (72057594037927936.0), 72057594037927936LL);
5170 check ("fma(1.0, 2.0, 3.0) = 5.0", FUNC(fma) (1.0, 2.0, 3.0), 5.0);
5171 check_isnan ("fma(NaN, 2.0, 3.0) = NaN", FUNC(fma) (nan_value, 2.0, 3.0));
5172 check_isnan ("fma(1.0, NaN, 3.0) = NaN", FUNC(fma) (1.0, nan_value, 3.0));
5173 check_isnan_maybe_exc ("fma(1.0, 2.0, NaN) = NaN",
5174 FUNC(fma) (1.0, 2.0, nan_value), INVALID_EXCEPTION);
5175 check_isnan_maybe_exc ("fma(+Inf, 0.0, NaN) = NaN",
5176 FUNC(fma) (plus_infty, 0.0, nan_value),
5178 check_isnan_maybe_exc ("fma(-Inf, 0.0, NaN) = NaN",
5179 FUNC(fma) (minus_infty, 0.0, nan_value),
5181 check_isnan_maybe_exc ("fma(0.0, +Inf, NaN) = NaN",
5182 FUNC(fma) (0.0, plus_infty, nan_value),
5184 check_isnan_maybe_exc ("fma(0.0, -Inf, NaN) = NaN",
5185 FUNC(fma) (0.0, minus_infty, nan_value),
5187 check_isnan_exc ("fma(+Inf, 0.0, 1.0) = NaN",
5188 FUNC(fma) (plus_infty, 0.0, 1.0), INVALID_EXCEPTION);
5189 check_isnan_exc ("fma(-Inf, 0.0, 1.0) = NaN",
5190 FUNC(fma) (minus_infty, 0.0, 1.0), INVALID_EXCEPTION);
5191 check_isnan_exc ("fma(0.0, +Inf, 1.0) = NaN",
5192 FUNC(fma) (0.0, plus_infty, 1.0), INVALID_EXCEPTION);
5193 check_isnan_exc ("fma(0.0, -Inf, 1.0) = NaN",
5194 FUNC(fma) (0.0, minus_infty, 1.0), INVALID_EXCEPTION);
5196 check_isnan_exc ("fma(+Inf, +Inf, -Inf) = NaN",
5197 FUNC(fma) (plus_infty, plus_infty, minus_infty),
5199 check_isnan_exc ("fma(-Inf, +Inf, +Inf) = NaN",
5200 FUNC(fma) (minus_infty, plus_infty, plus_infty),
5202 check_isnan_exc ("fma(+Inf, -Inf, +Inf) = NaN",
5203 FUNC(fma) (plus_infty, minus_infty, plus_infty),
5205 check_isnan_exc ("fma(-Inf, -Inf, -Inf) = NaN",
5206 FUNC(fma) (minus_infty, minus_infty, minus_infty),
5212 inverse_func_pair_test (const char *test_name,
5213 mathfunc f1, mathfunc inverse,
5214 MATHTYPE x, MATHTYPE epsilon)
5216 MATHTYPE a, b, difference;
5224 output_new_test (test_name);
5225 result = check_equal (b, x, epsilon, &difference);
5226 output_result (test_name, result,
5227 b, x, difference, PRINT, PRINT);
5232 inverse_functions (void)
5234 inverse_func_pair_test ("asin(sin(x)) == x",
5235 FUNC(sin), FUNC(asin), 1.0,
5236 CHOOSE (2e-18L, 0, 3e-7L));
5237 inverse_func_pair_test ("sin(asin(x)) == x",
5238 FUNC(asin), FUNC(sin), 1.0, 0.0);
5240 inverse_func_pair_test ("acos(cos(x)) == x",
5241 FUNC(cos), FUNC(acos), 1.0,
5242 CHOOSE (4e-18L, 1e-15L, 0));
5243 inverse_func_pair_test ("cos(acos(x)) == x",
5244 FUNC(acos), FUNC(cos), 1.0, 0.0);
5245 inverse_func_pair_test ("atan(tan(x)) == x",
5246 FUNC(tan), FUNC(atan), 1.0, CHOOSE (2e-18L, 0, 0));
5247 inverse_func_pair_test ("tan(atan(x)) == x",
5248 FUNC(atan), FUNC(tan), 1.0,
5249 CHOOSE (2e-18L, 1e-15L, 2e-7));
5251 inverse_func_pair_test ("asinh(sinh(x)) == x",
5252 FUNC(sinh), FUNC(asinh), 1.0, CHOOSE (1e-18L, 0, 1e-7));
5253 inverse_func_pair_test ("sinh(asinh(x)) == x",
5254 FUNC(asinh), FUNC(sinh), 1.0,
5255 CHOOSE (2e-18L, 2e-16L, 2e-7));
5257 inverse_func_pair_test ("acosh(cosh(x)) == x",
5258 FUNC(cosh), FUNC(acosh), 1.0,
5259 CHOOSE (1e-18L, 1e-15L, 6e-8));
5260 inverse_func_pair_test ("cosh(acosh(x)) == x",
5261 FUNC(acosh), FUNC(cosh), 1.0, 0.0);
5263 inverse_func_pair_test ("atanh(tanh(x)) == x",
5264 FUNC(tanh), FUNC(atanh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
5265 inverse_func_pair_test ("tanh(atanh(x)) == x",
5266 FUNC(atanh), FUNC(tanh), 1.0, 0.0);
5270 /* Test sin and cos with the identity: sin(x)^2 + cos(x)^2 = 1. */
5272 identities1_test (MATHTYPE x, MATHTYPE epsilon)
5274 MATHTYPE res1, res2, res3, diff;
5277 res1 = FUNC(sin) (x);
5279 res2 = FUNC(cos) (x);
5281 res3 = res1 * res1 + res2 * res2;
5284 output_new_test ("sin^2 + cos^2 == 1");
5285 result = check_equal (res3, 1.0, epsilon, &diff);
5286 output_result_ext ("sin^2 + cos^2 == 1", result,
5287 res3, 1.0, diff, x, PRINT, PRINT);
5291 /* Test sin, cos, tan with the following relation: tan = sin/cos. */
5293 identities2_test (MATHTYPE x, MATHTYPE epsilon)
5296 MATHTYPE res1, res2, res3, res4, diff;
5299 res1 = FUNC(sin) (x);
5301 res2 = FUNC(cos) (x);
5303 res3 = FUNC(tan) (x);
5308 output_new_test ("sin/cos == tan");
5309 result = check_equal (res4, res3, epsilon, &diff);
5310 output_result_ext ("sin/cos == tan", result,
5311 res4, res3, diff, x, PRINT, PRINT);
5316 /* Test cosh and sinh with the identity cosh^2 - sinh^2 = 1. */
5318 identities3_test (MATHTYPE x, MATHTYPE epsilon)
5320 MATHTYPE res1, res2, res3, diff;
5323 res1 = FUNC(sinh) (x);
5325 res2 = FUNC(cosh) (x);
5327 res3 = res2 * res2 - res1 * res1;
5330 output_new_test ("cosh^2 - sinh^2 == 1");
5331 result = check_equal (res3, 1.0, epsilon, &diff);
5332 output_result_ext ("cosh^2 - sinh^2 == 1", result,
5333 res3, 1.0, diff, x, PRINT, PRINT);
5340 identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
5341 identities1_test (0.9L, CHOOSE (1e-18L, 0, 1e-7));
5342 identities1_test (0, 0);
5343 identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
5345 identities2_test (0.2L, CHOOSE (1e-19L, 1e-16, 0));
5346 identities2_test (0.9L, CHOOSE (0, 1e-15, 2e-7));
5347 identities2_test (0, 0);
5348 identities2_test (-1, CHOOSE (1e-18L, 1e-15, 2e-7));
5350 identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
5351 identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
5352 identities3_test (0, CHOOSE (0, 0, 1e-6));
5353 identities3_test (-1, CHOOSE (1e-18L, 7e-16, 1e-6));
5358 Let's test that basic arithmetic is working
5359 tests: Infinity and NaN
5364 /* variables are declared volatile to forbid some compiler
5366 volatile MATHTYPE Inf_var, NaN_var, zero_var, one_var;
5371 NaN_var = nan_value;
5372 Inf_var = one_var / zero_var;
5379 /* Clear all exceptions. The previous computations raised exceptions. */
5380 feclearexcept (FE_ALL_EXCEPT);
5382 check_isinfp ("isinf (inf) == +1", Inf_var);
5383 check_isinfn ("isinf (-inf) == -1", -Inf_var);
5384 check_bool ("!isinf (1)", !(FUNC(isinf) (one_var)));
5385 check_bool ("!isinf (NaN)", !(FUNC(isinf) (NaN_var)));
5387 check_isnan ("isnan (NaN)", NaN_var);
5388 check_isnan ("isnan (-NaN)", -NaN_var);
5389 check_bool ("!isnan (1)", !(FUNC(isnan) (one_var)));
5390 check_bool ("!isnan (inf)", !(FUNC(isnan) (Inf_var)));
5392 check_bool ("inf == inf", Inf_var == Inf_var);
5393 check_bool ("-inf == -inf", -Inf_var == -Inf_var);
5394 check_bool ("inf != -inf", Inf_var != -Inf_var);
5395 check_bool ("NaN != NaN", NaN_var != NaN_var);
5398 the same tests but this time with NAN from <bits/nan.h>
5399 NAN is a double const
5401 check_bool ("isnan (NAN)", isnan (NAN));
5402 check_bool ("isnan (-NAN)", isnan (-NAN));
5403 check_bool ("!isinf (NAN)", !(isinf (NAN)));
5404 check_bool ("!isinf (-NAN)", !(isinf (-NAN)));
5405 check_bool ("NAN != NAN", NAN != NAN);
5408 And again with the value returned by the `nan' function.
5410 check_bool ("isnan (NAN)", FUNC(isnan) (FUNC(nan) ("")));
5411 check_bool ("isnan (-NAN)", FUNC(isnan) (-FUNC(nan) ("")));
5412 check_bool ("!isinf (NAN)", !(FUNC(isinf) (FUNC(nan) (""))));
5413 check_bool ("!isinf (-NAN)", !(FUNC(isinf) (-FUNC(nan) (""))));
5414 check_bool ("NAN != NAN", FUNC(nan) ("") != FUNC(nan) (""));
5416 /* test if EPSILON is ok */
5417 x1 = MATHCONST (1.0);
5418 x2 = x1 + CHOOSE (LDBL_EPSILON, DBL_EPSILON, FLT_EPSILON);
5419 check_bool ("1 != 1+EPSILON", x1 != x2);
5421 x1 = MATHCONST (1.0);
5422 x2 = x1 - CHOOSE (LDBL_EPSILON, DBL_EPSILON, FLT_EPSILON);
5423 check_bool ("1 != 1-EPSILON", x1 != x2);
5425 /* test if HUGE_VALx is ok */
5426 x1 = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
5427 check_bool ("isinf (HUGE_VALx) == +1", ISINF (x1) == +1);
5428 x1 = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
5429 check_bool ("isinf (-HUGE_VALx) == -1", ISINF (x1) == -1);
5437 fpstack_test ("start *init*");
5439 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
5441 minus_zero = FUNC (copysign) (0.0, -1.0);
5442 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
5443 minus_infty = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
5449 (void) &minus_infty;
5451 /* Clear all exceptions. From now on we must not get random exceptions. */
5452 feclearexcept (FE_ALL_EXCEPT);
5454 /* Test to make sure we start correctly. */
5455 fpstack_test ("end *init*");
5459 static struct option long_options[] =
5461 {"verbose", optional_argument, NULL, 'v'},
5462 {"silent", no_argument, NULL, 's'},
5468 parse_options (int argc, char *argv[])
5477 c = getopt_long (argc, argv, "v::s",
5478 long_options, &option_index);
5480 /* Detect the end of the options. */
5488 verbose = (unsigned int) strtoul (optarg, NULL, 0);
5502 main (int argc, char *argv[])
5505 parse_options (argc, argv);
5512 /* keep the tests a wee bit ordered (according to ISO 9X) */
5513 /* classification functions */
5519 /* trigonometric functions */
5529 /* hyperbolic functions */
5537 /* exponential and logarithmic functions */
5553 /* power and absolute value functions */
5560 /* error and gamma functions */
5566 /* nearest integer functions */
5578 /* remainder functions */
5583 /* manipulation functions */
5587 /* maximum, minimum and positive difference functions */
5592 /* complex functions */
5613 /* multiply and add */
5618 inverse_functions ();
5620 printf ("\nTest suite completed:\n");
5621 printf (" %d test cases plus %d tests for exception flags executed.\n",
5622 noTests, noExcTests);
5625 printf (" %d errors occured.\n", noErrors);
5628 printf (" All tests passed successfully.\n");