1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 Part of testsuite for libm.
24 This file has to be included by a master file that defines:
27 FUNC(function): converts general function name (like cos) to
28 name with correct suffix (e.g. cosl or cosf)
29 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
30 MATHTYPE: floating point type to test
31 TEST_MSG: informal message to be displayed
32 CHOOSE(Clongdouble,Cdouble,Cfloat):
33 chooses one of the parameters as epsilon for testing
35 PRINTF_EXPR Floating point conversion specification to print a variable
36 of type MATHTYPE with printf. PRINTF_EXPR just contains
37 the specifier, not the percent and width arguments,
41 /* This program isn't finished yet.
43 acos, acosh, asin, asinh, atan, atan2, atanh,
44 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
45 fabs, fdim, floor, fmin, fmax, fmod, fpclassify,
47 ilogb, isfinite, isinf, isnan, isnormal,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, rinttol, rinttoll,
51 round, roundtol, roundtoll,
52 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
54 and for the following complex math functions:
55 cacos, cacosh, casin, casinh, catan, catanh,
56 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctanh.
58 At the moment the following functions aren't tested:
59 cabs, carg, conj, cproj, cimag, creal, drem,
60 j0, j1, jn, y0, y1, yn,
62 nan, comparison macros (isless,isgreater,...).
64 The routines using random variables are still under construction. I don't
65 like it the way it's working now and will change it.
67 Parameter handling is primitive in the moment:
68 --verbose=[0..4] for different levels of output:
70 1: basic report on failed tests (default)
71 2: full report on failed tests
72 3: full report on failed and passed tests
73 4: additional report on exceptions
74 -v for full output (equals --verbose=4)
75 -s,--silent outputs only the error count (equals --verbose=0)
80 This suite tests the correct implementation of mathematical
81 functions in libm. Some simple, specific parameters are tested for
82 correctness. Handling of specific inputs (e.g. infinity,
83 not-a-number) is also tested. Correct handling of exceptions is
84 checked against. These implemented tests should check all cases
85 that are specified in ISO C 9X.
87 Exception testing: At the moment only divide-by-zero and invalid
88 exceptions are tested. Overflow/underflow and inexact exceptions
89 aren't checked at the moment.
91 NaN values: There exist signalling and quiet NaNs. This implementation
92 only uses signalling NaN as parameter but does not differenciate
93 between the two kinds of NaNs as result.
95 Inline functions: Inlining functions should give an improvement in
96 speed - but not in precission. The inlined functions return
97 reasonable values for a reasonable range of input values. The
98 result is not necessarily correct for all values and exceptions are
99 not correctly raised in all cases. Problematic input and return
100 values are infinity, not-a-number and minus zero. This suite
101 therefore does not check these specific inputs and the exception
102 handling for inlined mathematical functions - just the "reasonable"
105 Beware: The tests might fail for any of the following reasons:
107 - Functions are wrong
108 - Floating Point Unit not working properly
109 - Compiler has errors
111 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
129 /* Possible exceptions */
130 #define NO_EXCEPTION 0x0
131 #define INVALID_EXCEPTION 0x1
132 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
140 static int verbose
= 3;
141 static MATHTYPE minus_zero
, plus_zero
;
142 static MATHTYPE plus_infty
, minus_infty
, nan_value
;
144 typedef MATHTYPE (*mathfunc
) (MATHTYPE
);
146 #define BUILD_COMPLEX(real, imag) \
147 ({ __complex__ MATHTYPE __retval; \
148 __real__ __retval = (real); \
149 __imag__ __retval = (imag); \
154 (sizeof (x) == sizeof (float) ? \
156 : sizeof (x) == sizeof (double) ? \
157 isinf (x) : isinfl (x))
161 Test if Floating-Point stack hasn't changed
164 fpstack_test (const char *test_name
)
167 static int old_stack
;
169 asm ("fnstsw":"=a" (sw
));
174 printf ("FP-Stack wrong after test %s\n", test_name
);
176 printf ("=======> stack = %d\n", sw
);
185 Get a random value x with min_value < x < max_value
186 and min_value, max_value finite,
187 max_value and min_value shouldn't be too close together
190 random_value (MATHTYPE min_value
, MATHTYPE max_value
)
197 x
= (max_value
- min_value
) / RAND_MAX
* (MATHTYPE
) r
+ min_value
;
199 if ((x
<= min_value
) || (x
>= max_value
) || !isfinite (x
))
200 x
= (max_value
- min_value
) / 2 + min_value
;
202 /* Make sure the RNG has no influence on the exceptions. */
203 feclearexcept (FE_ALL_EXCEPT
);
208 /* Get a random value x with x > min_value. */
210 random_greater (MATHTYPE min_value
)
212 return random_value (min_value
, 1e6
); /* CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX) */
215 /* Get a random value x with x < max_value. */
217 random_less (MATHTYPE max_value
)
219 return random_value (-1e6
, max_value
);
224 output_new_test (const char *test_name
)
227 printf ("\nTesting: %s\n", test_name
);
232 output_pass_value (void)
235 printf ("Pass: Value Ok.\n");
240 output_fail_value (const char * test_name
)
242 if (verbose
> 0 && verbose
< 3)
243 printf ("Fail: %s\n", test_name
);
249 /* Test whether a given exception was raised. */
251 test_single_exception (const char *test_name
,
255 const char *flag_name
)
258 if (exception
& exc_flag
)
260 if (fetestexcept (fe_flag
))
263 printf ("Pass: Exception \"%s\" set\n", flag_name
);
267 if (verbose
&& verbose
< 3)
268 printf ("Fail: %s: Exception \"%s\" not set\n",
269 test_name
, flag_name
);
271 printf ("Fail: Exception \"%s\" not set\n",
278 if (fetestexcept (fe_flag
))
280 if (verbose
&& verbose
< 3)
281 printf ("Fail: %s: Exception \"%s\" set\n",
282 test_name
, flag_name
);
284 printf ("Fail: Exception \"%s\" set\n",
291 printf ("Pass: Exception \"%s\" not set\n",
299 /* Test whether exception given by EXCEPTION are raised. */
301 test_not_exception (const char *test_name
, short int exception
)
304 if ((exception
& DIVIDE_BY_ZERO_EXCEPTION
) == 0)
305 test_single_exception (test_name
, exception
,
306 DIVIDE_BY_ZERO_EXCEPTION
, FE_DIVBYZERO
,
310 if ((exception
& INVALID_EXCEPTION
) == 0)
311 test_single_exception (test_name
, exception
, INVALID_EXCEPTION
, FE_INVALID
,
312 "Invalid operation");
314 feclearexcept (FE_ALL_EXCEPT
);
318 /* Test whether exceptions given by EXCEPTION are raised. */
320 test_exceptions (const char *test_name
, short int exception
)
323 test_single_exception (test_name
, exception
,
324 DIVIDE_BY_ZERO_EXCEPTION
, FE_DIVBYZERO
,
328 test_single_exception (test_name
, exception
, INVALID_EXCEPTION
, FE_INVALID
,
329 "Invalid operation");
331 feclearexcept (FE_ALL_EXCEPT
);
335 /* Test if two floating point numbers are equal. */
337 check_equal (MATHTYPE computed
, MATHTYPE supplied
, MATHTYPE eps
, MATHTYPE
* diff
)
341 /* Both plus Infinity or both minus infinity. */
342 if (ISINF (computed
) && (ISINF (computed
) == ISINF (supplied
)))
345 if (isnan (computed
) && isnan (supplied
)) /* isnan works for all types */
348 *diff
= FUNC(fabs
) (computed
- supplied
);
351 ret_value
= (*diff
<= eps
&&
352 (signbit (computed
) == signbit (supplied
) || eps
!= 0.0));
354 /* Make sure the subtraction/comparsion have no influence on the exceptions. */
355 feclearexcept (FE_ALL_EXCEPT
);
363 output_result_bool (const char *test_name
, int result
)
367 output_pass_value ();
371 output_fail_value (test_name
);
373 printf (" Value: %d\n", result
);
377 fpstack_test (test_name
);
382 output_isvalue (const char *test_name
, int result
,
387 output_pass_value ();
391 output_fail_value (test_name
);
393 printf (" Value: %.20" PRINTF_EXPR
"\n", value
);
397 fpstack_test (test_name
);
402 output_isvalue_ext (const char *test_name
, int result
,
403 MATHTYPE value
, MATHTYPE parameter
)
407 output_pass_value ();
411 output_fail_value (test_name
);
414 printf (" Value: %.20" PRINTF_EXPR
"\n", value
);
415 printf (" Parameter: %.20" PRINTF_EXPR
"\n", parameter
);
420 fpstack_test (test_name
);
425 output_result (const char *test_name
, int result
,
426 MATHTYPE computed
, MATHTYPE expected
,
428 int print_values
, int print_diff
)
432 output_pass_value ();
436 output_fail_value (test_name
);
437 if (verbose
> 1 && print_values
)
439 printf ("Result:\n");
440 printf (" is: %.20" PRINTF_EXPR
"\n", computed
);
441 printf (" should be: %.20" PRINTF_EXPR
"\n", expected
);
443 printf (" difference: %.20" PRINTF_EXPR
"\n", difference
);
448 fpstack_test (test_name
);
453 output_result_ext (const char *test_name
, int result
,
454 MATHTYPE computed
, MATHTYPE expected
,
457 int print_values
, int print_diff
)
461 output_pass_value ();
465 output_fail_value (test_name
);
466 if (verbose
> 1 && print_values
)
468 printf ("Result:\n");
469 printf (" is: %.20" PRINTF_EXPR
"\n", computed
);
470 printf (" should be: %.20" PRINTF_EXPR
"\n", expected
);
472 printf (" difference: %.20" PRINTF_EXPR
"\n", difference
);
473 printf ("Parameter: %.20" PRINTF_EXPR
"\n", parameter
);
478 fpstack_test (test_name
);
482 check that computed and expected values are the same
485 check (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
)
490 output_new_test (test_name
);
491 test_exceptions (test_name
, NO_EXCEPTION
);
492 result
= check_equal (computed
, expected
, 0, &diff
);
493 output_result (test_name
, result
,
494 computed
, expected
, diff
, PRINT
, PRINT
);
499 check that computed and expected values are the same,
500 outputs the parameter to the function
503 check_ext (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
509 output_new_test (test_name
);
510 test_exceptions (test_name
, NO_EXCEPTION
);
511 result
= check_equal (computed
, expected
, 0, &diff
);
512 output_result_ext (test_name
, result
,
513 computed
, expected
, diff
, parameter
, PRINT
, PRINT
);
518 check that computed and expected values are the same and
519 checks also for exception flags
522 check_exc (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
528 output_new_test (test_name
);
529 test_exceptions (test_name
, exception
);
530 result
= check_equal (computed
, expected
, 0, &diff
);
531 output_result (test_name
, result
,
532 computed
, expected
, diff
, PRINT
, PRINT
);
536 check that computed and expected values are close enough
539 check_eps (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
545 output_new_test (test_name
);
546 test_exceptions (test_name
, NO_EXCEPTION
);
547 result
= check_equal (computed
, expected
, epsilon
, &diff
);
548 output_result (test_name
, result
,
549 computed
, expected
, diff
, PRINT
, PRINT
);
553 check a boolean condition
556 check_bool (const char *test_name
, int computed
)
558 output_new_test (test_name
);
559 test_exceptions (test_name
, NO_EXCEPTION
);
560 output_result_bool (test_name
, computed
);
566 check that computed and expected values are equal (int values)
569 check_int (const char *test_name
, int computed
, int expected
)
571 int diff
= computed
- expected
;
572 int result
= diff
== 0;
574 output_new_test (test_name
);
575 test_exceptions (test_name
, NO_EXCEPTION
);
579 output_pass_value ();
583 output_fail_value (test_name
);
586 printf ("Result:\n");
587 printf (" is: %d\n", computed
);
588 printf (" should be: %d\n", expected
);
593 fpstack_test (test_name
);
598 check that computed and expected values are equal (long int values)
601 check_long (const char *test_name
, long int computed
, long int expected
)
603 long int diff
= computed
- expected
;
604 int result
= diff
== 0;
606 output_new_test (test_name
);
607 test_exceptions (test_name
, NO_EXCEPTION
);
611 output_pass_value ();
615 output_fail_value (test_name
);
618 printf ("Result:\n");
619 printf (" is: %ld\n", computed
);
620 printf (" should be: %ld\n", expected
);
625 fpstack_test (test_name
);
629 check that computed and expected values are equal (long long int values)
632 check_longlong (const char *test_name
, long long int computed
,
633 long long int expected
)
635 long long int diff
= computed
- expected
;
636 int result
= diff
== 0;
638 output_new_test (test_name
);
639 test_exceptions (test_name
, NO_EXCEPTION
);
643 output_pass_value ();
647 output_fail_value (test_name
);
650 printf ("Result:\n");
651 printf (" is: %lld\n", computed
);
652 printf (" should be: %lld\n", expected
);
657 fpstack_test (test_name
);
661 check that computed value is not-a-number
664 check_isnan (const char *test_name
, MATHTYPE computed
)
666 output_new_test (test_name
);
667 test_exceptions (test_name
, NO_EXCEPTION
);
668 output_isvalue (test_name
, isnan (computed
), computed
);
673 check that computed value is not-a-number and test for exceptions
676 check_isnan_exc (const char *test_name
, MATHTYPE computed
,
679 output_new_test (test_name
);
680 test_exceptions (test_name
, exception
);
681 output_isvalue (test_name
, isnan (computed
), computed
);
686 check that computed value is not-a-number and test for exceptions
689 check_isnan_maybe_exc (const char *test_name
, MATHTYPE computed
,
692 output_new_test (test_name
);
693 test_not_exception (test_name
, exception
);
694 output_isvalue (test_name
, isnan (computed
), computed
);
698 check that computed value is not-a-number and supply parameter
702 check_isnan_ext (const char *test_name
, MATHTYPE computed
,
705 output_new_test (test_name
);
706 test_exceptions (test_name
, NO_EXCEPTION
);
707 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
712 check that computed value is not-a-number, test for exceptions
716 check_isnan_exc_ext (const char *test_name
, MATHTYPE computed
,
717 short exception
, MATHTYPE parameter
)
719 output_new_test (test_name
);
720 test_exceptions (test_name
,exception
);
721 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
725 /* Tests if computed is +Inf */
727 check_isinfp (const char *test_name
, MATHTYPE computed
)
729 output_new_test (test_name
);
730 test_exceptions (test_name
, NO_EXCEPTION
);
731 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
736 check_isinfp_ext (const char *test_name
, MATHTYPE computed
,
739 output_new_test (test_name
);
740 test_exceptions (test_name
, NO_EXCEPTION
);
741 output_isvalue_ext (test_name
, (ISINF (computed
) == +1), computed
, parameter
);
745 /* Tests if computed is +Inf */
747 check_isinfp_exc (const char *test_name
, MATHTYPE computed
,
750 output_new_test (test_name
);
751 test_exceptions (test_name
, exception
);
752 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
755 /* Tests if computed is -Inf */
757 check_isinfn (const char *test_name
, MATHTYPE computed
)
759 output_new_test (test_name
);
760 test_exceptions (test_name
, NO_EXCEPTION
);
761 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
767 check_isinfn_ext (const char *test_name
, MATHTYPE computed
,
770 output_new_test (test_name
);
771 test_exceptions (test_name
, NO_EXCEPTION
);
772 output_isvalue_ext (test_name
, (ISINF (computed
) == -1), computed
, parameter
);
777 /* Tests if computed is -Inf */
779 check_isinfn_exc (const char *test_name
, MATHTYPE computed
,
782 output_new_test (test_name
);
783 test_exceptions (test_name
, exception
);
784 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
788 /****************************************************************************
789 Test for single functions of libm
790 ****************************************************************************/
798 x
= random_greater (1);
799 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
804 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
809 check ("acos (1) == 0", FUNC(acos
) (1), 0);
810 check ("acos (-1) == pi", FUNC(acos
) (-1), M_PI
);
820 check_isinfp ("acosh(+inf) == +inf", FUNC(acosh
) (plus_infty
));
823 check_isnan_exc ("acosh(x) == NaN plus invalid exception if x < 1",
824 FUNC(acosh
) (x
), INVALID_EXCEPTION
);
827 check ("acosh(1) == 0", FUNC(acosh
) (1), 0);
837 x
= random_greater (1);
838 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
843 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
848 check ("asin (0) == 0", FUNC(asin
) (0), 0);
856 check ("asinh(+0) == +0", FUNC(asinh
) (0), 0);
858 check ("asinh(-0) == -0", FUNC(asinh
) (minus_zero
), minus_zero
);
859 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh
) (plus_infty
));
860 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh
) (minus_infty
));
869 check ("atan (0) == 0", FUNC(atan
) (0), 0);
870 check ("atan (-0) == -0", FUNC(atan
) (minus_zero
), minus_zero
);
872 check ("atan (+inf) == pi/2", FUNC(atan
) (plus_infty
), M_PI_2
);
873 check ("atan (-inf) == -pi/2", FUNC(atan
) (minus_infty
), -M_PI_2
);
882 x
= random_greater (0);
883 check ("atan2 (0,x) == 0 for x > 0",
884 FUNC(atan2
) (0, x
), 0);
885 x
= random_greater (0);
886 check ("atan2 (-0,x) == -0 for x > 0",
887 FUNC(atan2
) (minus_zero
, x
), minus_zero
);
889 check ("atan2 (+0,+0) == +0", FUNC(atan2
) (0, 0), 0);
890 check ("atan2 (-0,+0) == -0", FUNC(atan2
) (minus_zero
, 0), minus_zero
);
892 x
= -random_greater (0);
893 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2
) (0, x
), M_PI
);
895 x
= -random_greater (0);
896 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2
) (minus_zero
, x
), -M_PI
);
898 check ("atan2 (+0,-0) == +pi", FUNC(atan2
) (0, minus_zero
), M_PI
);
899 check ("atan2 (-0,-0) == -pi", FUNC(atan2
) (minus_zero
, minus_zero
), -M_PI
);
901 x
= random_greater (0);
902 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2
) (x
, 0), M_PI_2
);
904 x
= random_greater (0);
905 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2
) (x
, minus_zero
), M_PI_2
);
908 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2
) (x
, 0), -M_PI_2
);
911 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2
) (x
, minus_zero
), -M_PI_2
);
913 x
= random_greater (0);
914 check ("atan2 (y,inf) == +0 for finite y > 0",
915 FUNC(atan2
) (x
, plus_infty
), 0);
917 x
= -random_greater (0);
918 check ("atan2 (y,inf) == -0 for finite y < 0",
919 FUNC(atan2
) (x
, plus_infty
), minus_zero
);
921 x
= random_value (-1e4
, 1e4
);
922 check ("atan2(+inf, x) == pi/2 for finite x",
923 FUNC(atan2
) (plus_infty
, x
), M_PI_2
);
925 x
= random_value (-1e4
, 1e4
);
926 check ("atan2(-inf, x) == -pi/2 for finite x",
927 FUNC(atan2
) (minus_infty
, x
), -M_PI_2
);
929 x
= random_greater (0);
930 check ("atan2 (y,-inf) == +pi for finite y > 0",
931 FUNC(atan2
) (x
, minus_infty
), M_PI
);
933 x
= -random_greater (0);
934 check ("atan2 (y,-inf) == -pi for finite y < 0",
935 FUNC(atan2
) (x
, minus_infty
), -M_PI
);
937 check ("atan2 (+inf,+inf) == +pi/4",
938 FUNC(atan2
) (plus_infty
, plus_infty
), M_PI_4
);
940 check ("atan2 (-inf,+inf) == -pi/4",
941 FUNC(atan2
) (minus_infty
, plus_infty
), -M_PI_4
);
943 check ("atan2 (+inf,-inf) == +3*pi/4",
944 FUNC(atan2
) (plus_infty
, minus_infty
), 3 * M_PI_4
);
946 check ("atan2 (-inf,-inf) == -3*pi/4",
947 FUNC(atan2
) (minus_infty
, minus_infty
), -3 * M_PI_4
);
949 /* FIXME: Add some specific tests */
958 check ("atanh(+0) == +0", FUNC(atanh
) (0), 0);
960 check ("atanh(-0) == -0", FUNC(atanh
) (minus_zero
), minus_zero
);
962 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
963 FUNC(atanh
) (1), DIVIDE_BY_ZERO_EXCEPTION
);
964 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
965 FUNC(atanh
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
967 x
= random_greater (1.0);
968 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
969 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
971 x
= random_less (1.0);
972 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
973 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
982 check ("cbrt (+0) == +0", FUNC(cbrt
) (0.0), 0.0);
983 check ("cbrt (-0) == -0", FUNC(cbrt
) (minus_zero
), minus_zero
);
986 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt
) (plus_infty
));
987 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt
) (minus_infty
));
988 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt
) (nan_value
));
990 check_eps ("cbrt (8) == 2", FUNC(cbrt
) (8), 2, CHOOSE (5e-17L, 0, 0));
991 check_eps ("cbrt (-27) == -3", FUNC(cbrt
) (-27.0), -3.0,
992 CHOOSE (3e-16L, 0, 0));
999 check ("ceil (+0) == +0", FUNC(ceil
) (0.0), 0.0);
1000 check ("ceil (-0) == -0", FUNC(ceil
) (minus_zero
), minus_zero
);
1001 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil
) (plus_infty
));
1002 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil
) (minus_infty
));
1004 check ("ceil (pi) == 4", FUNC(ceil
) (M_PI
), 4.0);
1005 check ("ceil (-pi) == -3", FUNC(ceil
) (-M_PI
), -3.0);
1013 check ("cos (+0) == 1", FUNC(cos
) (0), 1);
1014 check ("cos (-0) == 1", FUNC(cos
) (minus_zero
), 1);
1015 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1016 FUNC(cos
) (plus_infty
),
1018 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1019 FUNC(cos
) (minus_infty
),
1022 check_eps ("cos (pi/3) == 0.5", FUNC(cos
) (M_PI
/ 3.0),
1023 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1024 check_eps ("cos (pi/2) == 0", FUNC(cos
) (M_PI_2
),
1025 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1032 check ("cosh (+0) == 1", FUNC(cosh
) (0), 1);
1033 check ("cosh (-0) == 1", FUNC(cosh
) (minus_zero
), 1);
1036 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh
) (plus_infty
));
1037 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh
) (minus_infty
));
1047 if (errno
== ENOSYS
)
1048 /* Function not implemented. */
1051 check ("erf (+0) == +0", FUNC(erf
) (0), 0);
1052 check ("erf (-0) == -0", FUNC(erf
) (minus_zero
), minus_zero
);
1053 check ("erf (+inf) == +1", FUNC(erf
) (plus_infty
), 1);
1054 check ("erf (-inf) == -1", FUNC(erf
) (minus_infty
), -1);
1063 if (errno
== ENOSYS
)
1064 /* Function not implemented. */
1067 check ("erfc (+inf) == 0", FUNC(erfc
) (plus_infty
), 0.0);
1068 check ("erfc (-inf) == 2", FUNC(erfc
) (minus_infty
), 2.0);
1069 check ("erfc (+0) == 1", FUNC(erfc
) (0.0), 1.0);
1070 check ("erfc (-0) == 1", FUNC(erfc
) (minus_zero
), 1.0);
1077 check ("exp (+0) == 1", FUNC(exp
) (0), 1);
1078 check ("exp (-0) == 1", FUNC(exp
) (minus_zero
), 1);
1081 check_isinfp ("exp (+inf) == +inf", FUNC(exp
) (plus_infty
));
1082 check ("exp (-inf) == 0", FUNC(exp
) (minus_infty
), 0);
1084 check_eps ("exp (1) == e", FUNC(exp
) (1), M_E
, CHOOSE (4e-18L, 0, 0));
1093 if (errno
== ENOSYS
)
1094 /* Function not implemented. */
1097 check ("exp2 (+0) == 1", FUNC(exp2
) (0), 1);
1098 check ("exp2 (-0) == 1", FUNC(exp2
) (minus_zero
), 1);
1100 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2
) (plus_infty
));
1101 check ("exp2 (-inf) == 0", FUNC(exp2
) (minus_infty
), 0);
1102 check ("exp2 (10) == 1024", FUNC(exp2
) (10), 1024);
1109 check ("expm1 (+0) == 0", FUNC(expm1
) (0), 0);
1110 check ("expm1 (-0) == -0", FUNC(expm1
) (minus_zero
), minus_zero
);
1112 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1
) (plus_infty
));
1113 check ("expm1 (-inf) == -1", FUNC(expm1
) (minus_infty
), -1);
1115 check_eps ("expm1 (1) == e-1", FUNC(expm1
) (1), M_E
- 1.0,
1116 CHOOSE (4e-18L, 0, 0));
1123 check_frexp (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
1124 int comp_int
, int exp_int
)
1129 result
= (check_equal (computed
, expected
, 0, &diff
)
1130 && (comp_int
== exp_int
));
1135 printf ("Pass: %s\n", test_name
);
1140 printf ("Fail: %s\n", test_name
);
1143 printf ("Result:\n");
1144 printf (" is: %.20" PRINTF_EXPR
" *2^%d\n", computed
, comp_int
);
1145 printf (" should be: %.20" PRINTF_EXPR
" *2^%d\n", expected
, exp_int
);
1146 printf (" difference: %.20" PRINTF_EXPR
"\n", diff
);
1150 fpstack_test (test_name
);
1151 output_result (test_name
, result
,
1152 computed
, expected
, diff
, PRINT
, PRINT
);
1162 result
= FUNC(frexp
) (plus_infty
, &x_int
);
1163 check_isinfp ("frexp (+inf, expr) == +inf", result
);
1165 result
= FUNC(frexp
) (minus_infty
, &x_int
);
1166 check_isinfn ("frexp (-inf, expr) == -inf", result
);
1168 result
= FUNC(frexp
) (nan_value
, &x_int
);
1169 check_isnan ("frexp (Nan, expr) == NaN", result
);
1171 result
= FUNC(frexp
) (0, &x_int
);
1172 check_frexp ("frexp: +0 == 0 * 2^0", result
, 0, x_int
, 0);
1174 result
= FUNC(frexp
) (minus_zero
, &x_int
);
1175 check_frexp ("frexp: -0 == -0 * 2^0", result
, minus_zero
, x_int
, 0);
1177 result
= FUNC(frexp
) (12.8L, &x_int
);
1178 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result
, 0.8L, x_int
, 4);
1180 result
= FUNC(frexp
) (-27.34L, &x_int
);
1181 check_frexp ("frexp: -27.34 == -0.854375 * 2^5", result
, -0.854375L, x_int
, 5);
1186 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
1187 /* All floating-point numbers can be put in one of these categories. */
1191 #define FP_NAN FP_NAN
1193 #define FP_INFINITE FP_INFINITE
1195 #define FP_ZERO FP_ZERO
1197 #define FP_SUBNORMAL FP_SUBNORMAL
1199 #define FP_NORMAL FP_NORMAL
1205 fpclassify_test (void)
1209 /* fpclassify is a macro, don't give it constants as parameter */
1210 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value
) == FP_NAN
);
1211 check_bool ("fpclassify (+inf) == FP_INFINITE",
1212 fpclassify (plus_infty
) == FP_INFINITE
);
1213 check_bool ("fpclassify (-inf) == FP_INFINITE",
1214 fpclassify (minus_infty
) == FP_INFINITE
);
1215 check_bool ("fpclassify (+0) == FP_ZERO",
1216 fpclassify (plus_zero
) == FP_ZERO
);
1217 check_bool ("fpclassify (-0) == FP_ZERO",
1218 fpclassify (minus_zero
) == FP_ZERO
);
1221 check_bool ("fpclassify (1000) == FP_NORMAL",
1222 fpclassify (x
) == FP_NORMAL
);
1227 isfinite_test (void)
1229 check_bool ("isfinite (0) != 0", isfinite (0));
1230 check_bool ("isfinite (-0) != 0", isfinite (minus_zero
));
1231 check_bool ("isfinite (10) != 0", isfinite (10));
1232 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty
) == 0);
1233 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty
) == 0);
1234 check_bool ("isfinite (NaN) == 0", isfinite (nan_value
) == 0);
1239 isnormal_test (void)
1241 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1242 check_bool ("isnormal (-0) == 0", isnormal (minus_zero
) == 0);
1243 check_bool ("isnormal (10) != 0", isnormal (10));
1244 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty
) == 0);
1245 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty
) == 0);
1246 check_bool ("isnormal (NaN) == 0", isnormal (nan_value
) == 0);
1256 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1257 check_bool ("signbit (-0) != 0", signbit (minus_zero
));
1258 check_bool ("signbit (+inf) == 0", signbit (plus_infty
) == 0);
1259 check_bool ("signbit (-inf) != 0", signbit (minus_infty
));
1260 check_bool ("signbit (NaN) == 0", signbit (nan_value
));
1262 x
= random_less (0);
1263 check_bool ("signbit (x) != 0 for x < 0", signbit (x
));
1265 x
= random_greater (0);
1266 check_bool ("signbit (x) == 0 for x > 0", signbit (x
) == 0);
1277 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma
) (plus_infty
));
1278 check_isnan_exc ("gamma (0) == NaN plus invalid exception",
1279 FUNC(gamma
) (0), INVALID_EXCEPTION
);
1281 x
= random_less (0.0);
1282 check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for x <= 0",
1283 FUNC(gamma
) (x
), INVALID_EXCEPTION
, x
);
1284 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1285 FUNC(gamma
) (minus_infty
), INVALID_EXCEPTION
);
1287 check ("gamma (0.5) == sqrt(pi)", FUNC(gamma
) (0.5), FUNC(sqrt
) (M_PI
));
1288 check ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma
) (-0.5),
1289 -2*FUNC(sqrt
) (M_PI
));
1291 check ("gamma (1) == 1", FUNC(gamma
) (1), 1);
1292 check ("gamma (4) == 6", FUNC(gamma
) (4), 6);
1302 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma
) (plus_infty
));
1303 check_isnan_exc ("lgamma (0) == +inf plus divide by zero exception",
1304 FUNC(lgamma
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1306 x
= random_less (0.0);
1307 check_isnan_exc_ext ("lgamma (x) == +inf plus divide by zero exception for x <= 0",
1308 FUNC(lgamma
) (x
), DIVIDE_BY_ZERO_EXCEPTION
, x
);
1309 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1310 FUNC(lgamma
) (minus_infty
), INVALID_EXCEPTION
);
1312 check ("lgamma (1) == 0", FUNC(lgamma
) (1), 0);
1313 check_int ("lgamma (0) sets signgam to 1", signgam
, 1);
1315 check ("lgamma (3) == M_LN2", FUNC(lgamma
) (3), M_LN2
);
1316 check_int ("lgamma (3) sets signgam to 1", signgam
, 1);
1318 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma
) (0.5),
1319 FUNC(log
) (FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 1e-7));
1320 check_int ("lgamma (0.5) sets signgam to 1", signgam
, 1);
1322 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma
) (-0.5),
1323 FUNC(log
) (2*FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 0));
1325 check_int ("lgamma (-0.5) sets signgam to -1", signgam
, -1);
1334 /* XXX Are these tests correct? I couldn't find any specification */
1336 /* the source suggests that the following calls should fail -
1337 but shall we test these special cases or just ignore them? */
1338 check_isinfp ("ilogb (+inf) == +inf", FUNC(ilogb
) (plus_infty
));
1339 check_isinfp ("ilogb (-inf) == +inf", FUNC(ilogb
) (minus_infty
));
1341 check_isinfn_exc ("ilogb (+0) == -inf plus divide-by-zero exception",
1342 FUNC(ilogb
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1344 check_isinfn_exc ("ilogb (-0) == -inf plus divide-by-zero exception",
1345 FUNC(ilogb
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1347 check ("ilogb (1) == 0", FUNC(ilogb
) (1), 0);
1348 check ("ilogb (e) == 1", FUNC(ilogb
) (M_E
), 1);
1349 check ("ilogb (1024) == 10", FUNC(ilogb
) (1024), 10);
1350 check ("ilogb (-2000) == 10", FUNC(ilogb
) (-2000), 10);
1360 check ("ldexp (0, 0) == 0", FUNC(ldexp
) (0, 0), 0);
1362 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp
) (plus_infty
, 1));
1363 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp
) (minus_infty
, 1));
1364 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp
) (nan_value
, 1));
1366 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp
) (0.8L, 4), 12.8L);
1367 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp
) (-0.854375L, 5), -27.34L);
1369 x
= random_greater (0.0);
1370 check_ext ("ldexp (x, 0) == x", FUNC(ldexp
) (x
, 0L), x
, x
);
1378 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1379 FUNC(log
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1380 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1381 FUNC(log
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1383 check ("log (1) == 0", FUNC(log
) (1), 0);
1385 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1386 FUNC(log
) (-1), INVALID_EXCEPTION
);
1387 check_isinfp ("log (+inf) == +inf", FUNC(log
) (plus_infty
));
1389 check_eps ("log (e) == 1", FUNC(log
) (M_E
), 1, CHOOSE (1e-18L, 0, 9e-8L));
1390 check_eps ("log (1/e) == -1", FUNC(log
) (1.0 / M_E
), -1,
1391 CHOOSE (2e-18L, 0, 0));
1392 check ("log (2) == M_LN2", FUNC(log
) (2), M_LN2
);
1393 check_eps ("log (10) == M_LN10", FUNC(log
) (10), M_LN10
,
1394 CHOOSE (1e-18L, 0, 0));
1401 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1402 FUNC(log10
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1403 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1404 FUNC(log10
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1406 check ("log10 (1) == +0", FUNC(log10
) (1), 0);
1408 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1409 FUNC(log10
) (-1), INVALID_EXCEPTION
);
1411 check_isinfp ("log10 (+inf) == +inf", FUNC(log10
) (plus_infty
));
1413 check_eps ("log10 (0.1) == -1", FUNC(log10
) (0.1L), -1,
1414 CHOOSE (1e-18L, 0, 0));
1415 check_eps ("log10 (10) == 1", FUNC(log10
) (10.0), 1,
1416 CHOOSE (1e-18L, 0, 0));
1417 check_eps ("log10 (100) == 2", FUNC(log10
) (100.0), 2,
1418 CHOOSE (1e-18L, 0, 0));
1419 check ("log10 (10000) == 4", FUNC(log10
) (10000.0), 4);
1420 check_eps ("log10 (e) == M_LOG10E", FUNC(log10
) (M_E
), M_LOG10E
,
1421 CHOOSE (1e-18, 0, 9e-8));
1428 check ("log1p (+0) == +0", FUNC(log1p
) (0), 0);
1429 check ("log1p (-0) == -0", FUNC(log1p
) (minus_zero
), minus_zero
);
1431 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1432 FUNC(log1p
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
1433 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1434 FUNC(log1p
) (-2), INVALID_EXCEPTION
);
1436 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p
) (plus_infty
));
1438 check_eps ("log1p (e-1) == 1", FUNC(log1p
) (M_E
- 1.0), 1,
1439 CHOOSE (1e-18L, 0, 0));
1447 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1448 FUNC(log2
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1449 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1450 FUNC(log2
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1452 check ("log2 (1) == +0", FUNC(log2
) (1), 0);
1454 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1455 FUNC(log2
) (-1), INVALID_EXCEPTION
);
1457 check_isinfp ("log2 (+inf) == +inf", FUNC(log2
) (plus_infty
));
1459 check_eps ("log2 (e) == M_LOG2E", FUNC(log2
) (M_E
), M_LOG2E
,
1460 CHOOSE (1e-18L, 0, 0));
1461 check ("log2 (2) == 1", FUNC(log2
) (2.0), 1);
1462 check_eps ("log2 (16) == 4", FUNC(log2
) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1463 check ("log2 (256) == 8", FUNC(log2
) (256.0), 8);
1471 check_isinfp ("logb (+inf) == +inf", FUNC(logb
) (plus_infty
));
1472 check_isinfp ("logb (-inf) == +inf", FUNC(logb
) (minus_infty
));
1474 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1475 FUNC(logb
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1477 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1478 FUNC(logb
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1480 check ("logb (1) == 0", FUNC(logb
) (1), 0);
1481 check ("logb (e) == 1", FUNC(logb
) (M_E
), 1);
1482 check ("logb (1024) == 10", FUNC(logb
) (1024), 10);
1483 check ("logb (-2000) == 10", FUNC(logb
) (-2000), 10);
1491 MATHTYPE result
, intpart
;
1493 result
= FUNC(modf
) (plus_infty
, &intpart
);
1494 check ("modf (+inf, &x) returns +0", result
, 0);
1495 check_isinfp ("modf (+inf, &x) set x to +inf", intpart
);
1497 result
= FUNC(modf
) (minus_infty
, &intpart
);
1498 check ("modf (-inf, &x) returns -0", result
, minus_zero
);
1499 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart
);
1501 result
= FUNC(modf
) (nan_value
, &intpart
);
1502 check_isnan ("modf (NaN, &x) returns NaN", result
);
1503 check_isnan ("modf (NaN, &x) sets x to NaN", intpart
);
1505 result
= FUNC(modf
) (0, &intpart
);
1506 check ("modf (0, &x) returns 0", result
, 0);
1507 check ("modf (0, &x) sets x to 0", intpart
, 0);
1509 result
= FUNC(modf
) (minus_zero
, &intpart
);
1510 check ("modf (-0, &x) returns -0", result
, minus_zero
);
1511 check ("modf (-0, &x) sets x to -0", intpart
, minus_zero
);
1513 result
= FUNC(modf
) (2.5, &intpart
);
1514 check ("modf (2.5, &x) returns 0.5", result
, 0.5);
1515 check ("modf (2.5, &x) sets x to 2", intpart
, 2);
1517 result
= FUNC(modf
) (-2.5, &intpart
);
1518 check ("modf (-2.5, &x) returns -0.5", result
, -0.5);
1519 check ("modf (-2.5, &x) sets x to -2", intpart
, -2);
1529 check ("scalb (0, 0) == 0", FUNC(scalb
) (0, 0), 0);
1531 check_isinfp ("scalb (+inf, 1) == +inf", FUNC(scalb
) (plus_infty
, 1));
1532 check_isinfn ("scalb (-inf, 1) == -inf", FUNC(scalb
) (minus_infty
, 1));
1533 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb
) (nan_value
, 1));
1535 check ("scalb (0.8, 4) == 12.8", FUNC(scalb
) (0.8L, 4), 12.8L);
1536 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb
) (-0.854375L, 5), -27.34L);
1538 x
= random_greater (0.0);
1539 check_ext ("scalb (x, 0) == x", FUNC(scalb
) (x
, 0L), x
, x
);
1548 check ("scalbn (0, 0) == 0", FUNC(scalbn
) (0, 0), 0);
1550 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn
) (plus_infty
, 1));
1551 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn
) (minus_infty
, 1));
1552 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn
) (nan_value
, 1));
1554 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn
) (0.8L, 4), 12.8L);
1555 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn
) (-0.854375L, 5), -27.34L);
1557 x
= random_greater (0.0);
1558 check_ext ("scalbn (x, 0) == x", FUNC(scalbn
) (x
, 0L), x
, x
);
1565 check ("sin (+0) == +0", FUNC(sin
) (0), 0);
1566 check ("sin (-0) == -0", FUNC(sin
) (minus_zero
), minus_zero
);
1567 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1568 FUNC(sin
) (plus_infty
),
1570 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1571 FUNC(sin
) (minus_infty
),
1574 check_eps ("sin (pi/6) == 0.5", FUNC(sin
) (M_PI
/ 6.0), 0.5,
1575 CHOOSE (4e-18L, 0, 0));
1576 check ("sin (pi/2) == 1", FUNC(sin
) (M_PI_2
), 1);
1583 check ("sinh (+0) == +0", FUNC(sinh
) (0), 0);
1586 check ("sinh (-0) == -0", FUNC(sinh
) (minus_zero
), minus_zero
);
1588 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh
) (plus_infty
));
1589 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh
) (minus_infty
));
1597 MATHTYPE sin_res
, cos_res
;
1600 FUNC(sincos
) (0, &sin_res
, &cos_res
);
1602 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res
, 0);
1604 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1606 FUNC(sincos
) (minus_zero
, &sin_res
, &cos_res
);
1608 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res
, minus_zero
);
1610 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1612 FUNC(sincos
) (plus_infty
, &sin_res
, &cos_res
);
1614 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1615 sin_res
, INVALID_EXCEPTION
);
1617 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1618 cos_res
, INVALID_EXCEPTION
);
1620 FUNC(sincos
) (minus_infty
, &sin_res
, &cos_res
);
1622 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1623 sin_res
, INVALID_EXCEPTION
);
1625 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1626 cos_res
, INVALID_EXCEPTION
);
1628 FUNC(sincos
) (M_PI_2
, &sin_res
, &cos_res
);
1630 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res
, 1);
1632 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res
, 0,
1633 CHOOSE(0, 1e-16, 1e-7));
1635 FUNC(sincos
) (M_PI
/ 6.0, &sin_res
, &cos_res
);
1636 check ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res
, 0.5);
1638 FUNC(sincos
) (M_PI
/ 3.0, &sin_res
, &cos_res
);
1639 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res
, 0.5,
1640 CHOOSE(0, 1e-15, 1e-7));
1649 check ("tan (+0) == +0", FUNC(tan
) (0), 0);
1650 check ("tan (-0) == -0", FUNC(tan
) (minus_zero
), minus_zero
);
1651 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1652 FUNC(tan
) (plus_infty
), INVALID_EXCEPTION
);
1653 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1654 FUNC(tan
) (minus_infty
), INVALID_EXCEPTION
);
1656 check_eps ("tan (pi/4) == 1", FUNC(tan
) (M_PI_4
), 1,
1657 CHOOSE (2e-18L, 1e-15L, 0));
1664 check ("tanh (+0) == +0", FUNC(tanh
) (0), 0);
1666 check ("tanh (-0) == -0", FUNC(tanh
) (minus_zero
), minus_zero
);
1668 check ("tanh (+inf) == +1", FUNC(tanh
) (plus_infty
), 1);
1669 check ("tanh (-inf) == -1", FUNC(tanh
) (minus_infty
), -1);
1677 check ("fabs (+0) == +0", FUNC(fabs
) (0), 0);
1678 check ("fabs (-0) == +0", FUNC(fabs
) (minus_zero
), 0);
1680 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs
) (plus_infty
));
1681 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs
) (minus_infty
));
1683 check ("fabs (+38) == 38", FUNC(fabs
) (38.0), 38.0);
1684 check ("fabs (-e) == e", FUNC(fabs
) (-M_E
), M_E
);
1691 check ("floor (+0) == +0", FUNC(floor
) (0.0), 0.0);
1692 check ("floor (-0) == -0", FUNC(floor
) (minus_zero
), minus_zero
);
1693 check_isinfp ("floor (+inf) == +inf", FUNC(floor
) (plus_infty
));
1694 check_isinfn ("floor (-inf) == -inf", FUNC(floor
) (minus_infty
));
1696 check ("floor (pi) == 3", FUNC(floor
) (M_PI
), 3.0);
1697 check ("floor (-pi) == -4", FUNC(floor
) (-M_PI
), -4.0);
1706 a
= random_greater (0);
1707 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot
) (plus_infty
, a
), a
);
1708 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot
) (minus_infty
, a
), a
);
1711 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1712 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1715 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot
) (nan_value
, nan_value
));
1717 a
= FUNC(hypot
) (12.4L, 0.7L);
1718 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot
) (0.7L, 12.4L), a
);
1719 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot
) (-12.4L, 0.7L), a
);
1720 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot
) (-0.7L, 12.4L), a
);
1721 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot
) (-12.4L, -0.7L), a
);
1722 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot
) (-0.7L, -12.4L), a
);
1723 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-0.7L, 0), 0.7L);
1724 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (0.7L, 0), 0.7L);
1725 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-1.0L, 0), 1.0L);
1726 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (1.0L, 0), 1.0L);
1727 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-5.7e7L
, 0), 5.7e7L
);
1728 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (5.7e7L
, 0), 5.7e7L
);
1737 check ("pow (+0, +0) == 1", FUNC(pow
) (0, 0), 1);
1738 check ("pow (+0, -0) == 1", FUNC(pow
) (0, minus_zero
), 1);
1739 check ("pow (-0, +0) == 1", FUNC(pow
) (minus_zero
, 0), 1);
1740 check ("pow (-0, -0) == 1", FUNC(pow
) (minus_zero
, minus_zero
), 1);
1742 check ("pow (+10, +0) == 1", FUNC(pow
) (10, 0), 1);
1743 check ("pow (+10, -0) == 1", FUNC(pow
) (10, minus_zero
), 1);
1744 check ("pow (-10, +0) == 1", FUNC(pow
) (-10, 0), 1);
1745 check ("pow (-10, -0) == 1", FUNC(pow
) (-10, minus_zero
), 1);
1747 check ("pow (NaN, +0) == 1", FUNC(pow
) (nan_value
, 0), 1);
1748 check ("pow (NaN, -0) == 1", FUNC(pow
) (nan_value
, minus_zero
), 1);
1751 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow
) (1.1, plus_infty
));
1752 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow
) (plus_infty
, plus_infty
));
1753 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow
) (-1.1, plus_infty
));
1754 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow
) (minus_infty
, plus_infty
));
1756 check ("pow (0.9, +inf) == +0", FUNC(pow
) (0.9L, plus_infty
), 0);
1757 check ("pow (1e-7, +inf) == +0", FUNC(pow
) (1e-7L, plus_infty
), 0);
1758 check ("pow (-0.9, +inf) == +0", FUNC(pow
) (-0.9L, plus_infty
), 0);
1759 check ("pow (-1e-7, +inf) == +0", FUNC(pow
) (-1e-7L, plus_infty
), 0);
1761 check ("pow (+1.1, -inf) == 0", FUNC(pow
) (1.1, minus_infty
), 0);
1762 check ("pow (+inf, -inf) == 0", FUNC(pow
) (plus_infty
, minus_infty
), 0);
1763 check ("pow (-1.1, -inf) == 0", FUNC(pow
) (-1.1, minus_infty
), 0);
1764 check ("pow (-inf, -inf) == 0", FUNC(pow
) (minus_infty
, minus_infty
), 0);
1766 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow
) (0.9L, minus_infty
));
1767 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow
) (1e-7L, minus_infty
));
1768 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow
) (-0.9L, minus_infty
));
1769 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow
) (-1e-7L, minus_infty
));
1771 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow
) (plus_infty
, 1e-7L));
1772 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow
) (plus_infty
, 1));
1773 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow
) (plus_infty
, 1e7L
));
1775 check ("pow (+inf, -1e-7) == 0", FUNC(pow
) (plus_infty
, -1e-7L), 0);
1776 check ("pow (+inf, -1) == 0", FUNC(pow
) (plus_infty
, -1), 0);
1777 check ("pow (+inf, -1e7) == 0", FUNC(pow
) (plus_infty
, -1e7L
), 0);
1779 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow
) (minus_infty
, 1));
1780 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow
) (minus_infty
, 11));
1781 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow
) (minus_infty
, 1001));
1783 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow
) (minus_infty
, 2));
1784 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow
) (minus_infty
, 12));
1785 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow
) (minus_infty
, 1002));
1786 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow
) (minus_infty
, 0.1));
1787 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow
) (minus_infty
, 1.1));
1788 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow
) (minus_infty
, 11.1));
1789 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow
) (minus_infty
, 1001.1));
1791 check ("pow (-inf, -1) == -0", FUNC(pow
) (minus_infty
, -1), minus_zero
);
1792 check ("pow (-inf, -11) == -0", FUNC(pow
) (minus_infty
, -11), minus_zero
);
1793 check ("pow (-inf, -1001) == -0", FUNC(pow
) (minus_infty
, -1001), minus_zero
);
1795 check ("pow (-inf, -2) == +0", FUNC(pow
) (minus_infty
, -2), 0);
1796 check ("pow (-inf, -12) == +0", FUNC(pow
) (minus_infty
, -12), 0);
1797 check ("pow (-inf, -1002) == +0", FUNC(pow
) (minus_infty
, -1002), 0);
1798 check ("pow (-inf, -0.1) == +0", FUNC(pow
) (minus_infty
, -0.1), 0);
1799 check ("pow (-inf, -1.1) == +0", FUNC(pow
) (minus_infty
, -1.1), 0);
1800 check ("pow (-inf, -11.1) == +0", FUNC(pow
) (minus_infty
, -11.1), 0);
1801 check ("pow (-inf, -1001.1) == +0", FUNC(pow
) (minus_infty
, -1001.1), 0);
1803 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow
) (nan_value
, nan_value
));
1804 check_isnan ("pow (0, NaN) == NaN", FUNC(pow
) (0, nan_value
));
1805 check_isnan ("pow (1, NaN) == NaN", FUNC(pow
) (1, nan_value
));
1806 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow
) (-1, nan_value
));
1807 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow
) (nan_value
, 1));
1808 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow
) (nan_value
, -1));
1810 x
= random_greater (0.0);
1811 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow
) (x
, nan_value
), x
);
1813 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
1814 FUNC(pow
) (1, plus_infty
), INVALID_EXCEPTION
);
1815 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
1816 FUNC(pow
) (-1, plus_infty
), INVALID_EXCEPTION
);
1817 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
1818 FUNC(pow
) (1, minus_infty
), INVALID_EXCEPTION
);
1819 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
1820 FUNC(pow
) (-1, minus_infty
), INVALID_EXCEPTION
);
1822 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
1823 FUNC(pow
) (-0.1, 1.1), INVALID_EXCEPTION
);
1824 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
1825 FUNC(pow
) (-0.1, -1.1), INVALID_EXCEPTION
);
1826 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
1827 FUNC(pow
) (-10.1, 1.1), INVALID_EXCEPTION
);
1828 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
1829 FUNC(pow
) (-10.1, -1.1), INVALID_EXCEPTION
);
1831 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
1832 FUNC(pow
) (0, -1), DIVIDE_BY_ZERO_EXCEPTION
);
1833 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
1834 FUNC(pow
) (0, -11), DIVIDE_BY_ZERO_EXCEPTION
);
1835 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
1836 FUNC(pow
) (minus_zero
, -1), DIVIDE_BY_ZERO_EXCEPTION
);
1837 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
1838 FUNC(pow
) (minus_zero
, -11), DIVIDE_BY_ZERO_EXCEPTION
);
1840 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
1841 FUNC(pow
) (0, -2), DIVIDE_BY_ZERO_EXCEPTION
);
1842 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
1843 FUNC(pow
) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
1844 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
1845 FUNC(pow
) (minus_zero
, -2), DIVIDE_BY_ZERO_EXCEPTION
);
1846 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
1847 FUNC(pow
) (minus_zero
, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
1850 check ("pow (+0, 1) == +0", FUNC(pow
) (0, 1), 0);
1851 check ("pow (+0, 11) == +0", FUNC(pow
) (0, 11), 0);
1853 check ("pow (-0, 1) == -0", FUNC(pow
) (minus_zero
, 1), minus_zero
);
1854 check ("pow (-0, 11) == -0", FUNC(pow
) (minus_zero
, 11), minus_zero
);
1857 check ("pow (+0, 2) == +0", FUNC(pow
) (0, 2), 0);
1858 check ("pow (+0, 11.1) == +0", FUNC(pow
) (0, 11.1), 0);
1861 check ("pow (-0, 2) == +0", FUNC(pow
) (minus_zero
, 2), 0);
1862 check ("pow (-0, 11.1) == +0", FUNC(pow
) (minus_zero
, 11.1), 0);
1864 x
= random_greater (1.0);
1865 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
1866 FUNC(pow
) (x
, plus_infty
), x
);
1868 x
= random_value (-1.0, 1.0);
1869 check_ext ("pow (x, +inf) == +0 for |x| < 1",
1870 FUNC(pow
) (x
, plus_infty
), 0.0, x
);
1872 x
= random_greater (1.0);
1873 check_ext ("pow (x, -inf) == +0 for |x| > 1",
1874 FUNC(pow
) (x
, minus_infty
), 0.0, x
);
1876 x
= random_value (-1.0, 1.0);
1877 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
1878 FUNC(pow
) (x
, minus_infty
), x
);
1880 x
= random_greater (0.0);
1881 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
1882 FUNC(pow
) (plus_infty
, x
), x
);
1884 x
= random_less (0.0);
1885 check_ext ("pow (+inf, y) == +0 for y < 0",
1886 FUNC(pow
) (plus_infty
, x
), 0.0, x
);
1888 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
1889 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
1890 FUNC(pow
) (minus_infty
, x
), x
);
1892 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
1893 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
1894 FUNC(pow
) (minus_infty
, x
), x
);
1896 x
= -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
1897 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
1898 FUNC(pow
) (minus_infty
, x
), minus_zero
, x
);
1900 x
= ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
1901 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
1902 FUNC(pow
) (minus_infty
, x
), 0.0, x
);
1905 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
1906 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
1907 FUNC(pow
) (0.0, x
), 0.0, x
);
1909 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
1910 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
1911 FUNC(pow
) (minus_zero
, x
), minus_zero
, x
);
1914 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
1915 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
1916 FUNC(pow
) (0.0, x
), 0.0, x
);
1918 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
1919 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
1920 FUNC(pow
) (minus_zero
, x
), 0.0, x
);
1927 check ("fdim (+0, +0) = +0", FUNC(fdim
) (0, 0), 0);
1928 check ("fdim (9, 0) = 9", FUNC(fdim
) (9, 0), 9);
1929 check ("fdim (0, 9) = 0", FUNC(fdim
) (0, 9), 0);
1930 check ("fdim (-9, 0) = 9", FUNC(fdim
) (-9, 0), 0);
1931 check ("fdim (0, -9) = 9", FUNC(fdim
) (0, -9), 9);
1933 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim
) (plus_infty
, 9));
1934 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim
) (plus_infty
, -9));
1935 check ("fdim (-inf, 9) = 0", FUNC(fdim
) (minus_infty
, 9), 0);
1936 check ("fdim (-inf, -9) = 0", FUNC(fdim
) (minus_infty
, -9), 0);
1937 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim
) (9, minus_infty
));
1938 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim
) (-9, minus_infty
));
1939 check ("fdim (9, inf) = 0", FUNC(fdim
) (9, plus_infty
), 0);
1940 check ("fdim (-9, inf) = 0", FUNC(fdim
) (-9, plus_infty
), 0);
1942 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim
) (0, nan_value
));
1943 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim
) (9, nan_value
));
1944 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim
) (-9, nan_value
));
1945 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim
) (nan_value
, 9));
1946 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim
) (nan_value
, -9));
1947 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim
) (plus_infty
, nan_value
));
1948 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim
) (minus_infty
, nan_value
));
1949 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim
) (nan_value
, plus_infty
));
1950 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim
) (nan_value
, minus_infty
));
1951 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim
) (nan_value
, nan_value
));
1958 check ("fmin (+0, +0) = +0", FUNC(fmin
) (0, 0), 0);
1959 check ("fmin (9, 0) = 0", FUNC(fmin
) (9, 0), 0);
1960 check ("fmin (0, 9) = 0", FUNC(fmin
) (0, 9), 0);
1961 check ("fmin (-9, 0) = -9", FUNC(fmin
) (-9, 0), -9);
1962 check ("fmin (0, -9) = -9", FUNC(fmin
) (0, -9), -9);
1964 check ("fmin (+inf, 9) = 9", FUNC(fmin
) (plus_infty
, 9), 9);
1965 check ("fmin (9, +inf) = 9", FUNC(fmin
) (9, plus_infty
), 9);
1966 check ("fmin (+inf, -9) = -9", FUNC(fmin
) (plus_infty
, -9), -9);
1967 check ("fmin (-9, +inf) = -9", FUNC(fmin
) (-9, plus_infty
), -9);
1968 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin
) (minus_infty
, 9));
1969 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin
) (minus_infty
, -9));
1970 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin
) (9, minus_infty
));
1971 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin
) (-9, minus_infty
));
1973 check ("fmin (0, NaN) = 0", FUNC(fmin
) (0, nan_value
), 0);
1974 check ("fmin (9, NaN) = 9", FUNC(fmin
) (9, nan_value
), 9);
1975 check ("fmin (-9, NaN) = 9", FUNC(fmin
) (-9, nan_value
), -9);
1976 check ("fmin (NaN, 0) = 0", FUNC(fmin
) (nan_value
, 0), 0);
1977 check ("fmin (NaN, 9) = NaN", FUNC(fmin
) (nan_value
, 9), 9);
1978 check ("fmin (NaN, -9) = NaN", FUNC(fmin
) (nan_value
, -9), -9);
1979 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin
) (plus_infty
, nan_value
));
1980 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin
) (minus_infty
, nan_value
));
1981 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin
) (nan_value
, plus_infty
));
1982 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin
) (nan_value
, minus_infty
));
1983 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin
) (nan_value
, nan_value
));
1990 check ("fmax (+0, +0) = +0", FUNC(fmax
) (0, 0), 0);
1991 check ("fmax (9, 0) = 9", FUNC(fmax
) (9, 0), 9);
1992 check ("fmax (0, 9) = 9", FUNC(fmax
) (0, 9), 9);
1993 check ("fmax (-9, 0) = 0", FUNC(fmax
) (-9, 0), 0);
1994 check ("fmax (0, -9) = 0", FUNC(fmax
) (0, -9), 0);
1996 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax
) (plus_infty
, 9));
1997 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax
) (0, plus_infty
));
1998 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax
) (-9, plus_infty
));
1999 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax
) (plus_infty
, -9));
2000 check ("fmax (-inf, 9) = 9", FUNC(fmax
) (minus_infty
, 9), 9);
2001 check ("fmax (-inf, -9) = -9", FUNC(fmax
) (minus_infty
, -9), -9);
2002 check ("fmax (+9, -inf) = 9", FUNC(fmax
) (9, minus_infty
), 9);
2003 check ("fmax (-9, -inf) = -9", FUNC(fmax
) (-9, minus_infty
), -9);
2005 check ("fmax (0, NaN) = 0", FUNC(fmax
) (0, nan_value
), 0);
2006 check ("fmax (9, NaN) = 9", FUNC(fmax
) (9, nan_value
), 9);
2007 check ("fmax (-9, NaN) = 9", FUNC(fmax
) (-9, nan_value
), -9);
2008 check ("fmax (NaN, 0) = 0", FUNC(fmax
) (nan_value
, 0), 0);
2009 check ("fmax (NaN, 9) = NaN", FUNC(fmax
) (nan_value
, 9), 9);
2010 check ("fmax (NaN, -9) = NaN", FUNC(fmax
) (nan_value
, -9), -9);
2011 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax
) (plus_infty
, nan_value
));
2012 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax
) (minus_infty
, nan_value
));
2013 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax
) (nan_value
, plus_infty
));
2014 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax
) (nan_value
, minus_infty
));
2015 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax
) (nan_value
, nan_value
));
2024 x
= random_greater (0);
2025 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod
) (0, x
), 0, x
);
2027 x
= random_greater (0);
2028 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod
) (minus_zero
, x
),
2031 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2032 FUNC(fmod
) (plus_infty
, x
), INVALID_EXCEPTION
, x
);
2033 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2034 FUNC(fmod
) (minus_infty
, x
), INVALID_EXCEPTION
, x
);
2035 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2036 FUNC(fmod
) (x
, 0), INVALID_EXCEPTION
, x
);
2037 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2038 FUNC(fmod
) (x
, minus_zero
), INVALID_EXCEPTION
, x
);
2040 x
= random_greater (0);
2041 check_ext ("fmod (x, +inf) == x for x not infinite",
2042 FUNC(fmod
) (x
, plus_infty
), x
, x
);
2043 x
= random_greater (0);
2044 check_ext ("fmod (x, -inf) == x for x not infinite",
2045 FUNC(fmod
) (x
, minus_infty
), x
, x
);
2047 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod
) (6.5, 2.3), 1.9,
2048 CHOOSE(0, 1e-15, 0));
2049 check_eps ("fmod (-6.5, 2.3) == 1.9", FUNC(fmod
) (-6.5, 2.3), -1.9,
2050 CHOOSE(0, 1e-15, 0));
2051 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod
) (6.5, -2.3), 1.9,
2052 CHOOSE(0, 1e-15, 0));
2053 check_eps ("fmod (-6.5, -2.3) == 1.9", FUNC(fmod
) (-6.5, -2.3), -1.9,
2054 CHOOSE(0, 1e-15, 0));
2061 nextafter_test (void)
2065 check ("nextafter (+0, +0) = +0", FUNC(nextafter
) (0, 0), 0);
2066 check ("nextafter (-0, +0) = +0", FUNC(nextafter
) (minus_zero
, 0), 0);
2067 check ("nextafter (+0, -0) = -0", FUNC(nextafter
) (0, minus_zero
),
2069 check ("nextafter (-0, -0) = -0", FUNC(nextafter
) (minus_zero
, minus_zero
),
2072 check ("nextafter (9, 9) = 9", FUNC(nextafter
) (9, 9), 9);
2073 check ("nextafter (-9, -9) = -9", FUNC(nextafter
) (-9, -9), -9);
2074 check_isinfp ("nextafter (+inf, +inf) = +inf",
2075 FUNC(nextafter
) (plus_infty
, plus_infty
));
2076 check_isinfn ("nextafter (-inf, -inf) = -inf",
2077 FUNC(nextafter
) (minus_infty
, minus_infty
));
2080 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter
) (nan_value
, x
));
2081 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter
) (x
, nan_value
));
2082 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter
) (nan_value
,
2085 /* XXX We need the hexadecimal FP number representation here for further
2091 copysign_test (void)
2093 check ("copysign (0, 4) = 0", FUNC(copysign
) (0, 4), 0);
2094 check ("copysign (0, -4) = -0", FUNC(copysign
) (0, -4), minus_zero
);
2095 check ("copysign (-0, 4) = 0", FUNC(copysign
) (minus_zero
, 4), 0);
2096 check ("copysign (-0, -4) = -0", FUNC(copysign
) (minus_zero
, -4),
2099 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign
) (plus_infty
, 0));
2100 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign
) (plus_infty
,
2102 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign
) (minus_infty
, 0));
2103 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign
) (minus_infty
,
2106 check ("copysign (0, +inf) = 0", FUNC(copysign
) (0, plus_infty
), 0);
2107 check ("copysign (0, -inf) = -0", FUNC(copysign
) (0, minus_zero
),
2109 check ("copysign (-0, +inf) = 0", FUNC(copysign
) (minus_zero
, plus_infty
),
2111 check ("copysign (-0, -inf) = -0", FUNC(copysign
) (minus_zero
, minus_zero
),
2114 /* XXX More correctly we would have to check the sign of the NaN. */
2115 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign
) (nan_value
, 0));
2116 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign
) (nan_value
,
2118 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign
) (-nan_value
, 0));
2119 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign
) (-nan_value
,
2127 check ("trunc(0) = 0", FUNC(trunc
) (0), 0);
2128 check ("trunc(-0) = -0", FUNC(trunc
) (minus_zero
), minus_zero
);
2129 check ("trunc(0.625) = 0", FUNC(trunc
) (0.625), 0);
2130 check ("trunc(-0.625) = -0", FUNC(trunc
) (-0.625), minus_zero
);
2131 check ("trunc(1) = 1", FUNC(trunc
) (1), 1);
2132 check ("trunc(-1) = -1", FUNC(trunc
) (-1), -1);
2133 check ("trunc(1.625) = 1", FUNC(trunc
) (1.625), 1);
2134 check ("trunc(-1.625) = -1", FUNC(trunc
) (-1.625), -1);
2136 check ("trunc(1048580.625) = 1048580", FUNC(trunc
) (1048580.625L),
2138 check ("trunc(-1048580.625) = -1048580", FUNC(trunc
) (-1048580.625L),
2141 check ("trunc(8388610.125) = 8388610", FUNC(trunc
) (8388610.125L),
2143 check ("trunc(-8388610.125) = -8388610", FUNC(trunc
) (-8388610.125L),
2146 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc
) (4294967296.625L),
2148 check ("trunc(-4294967296.625) = -4294967296",
2149 FUNC(trunc
) (-4294967296.625L), -4294967296.0L);
2151 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc
) (plus_infty
));
2152 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc
) (minus_infty
));
2153 check_isnan ("trunc(NaN) = NaN", FUNC(trunc
) (nan_value
));
2163 /* XXX Tests fuer negative x are missing */
2164 check ("sqrt (0) == 0", FUNC(sqrt
) (0), 0);
2165 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt
) (nan_value
));
2166 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt
) (plus_infty
));
2168 check ("sqrt (-0) == -0", FUNC(sqrt
) (0), 0);
2170 x
= random_less (0.0);
2171 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2172 FUNC(sqrt
) (x
), INVALID_EXCEPTION
, x
);
2174 x
= random_value (0, 10000);
2175 check_ext ("sqrt (x*x) == x", FUNC(sqrt
) (x
*x
), x
, x
);
2176 check ("sqrt (4) == 2", FUNC(sqrt
) (4), 2);
2181 remainder_test (void)
2185 result
= FUNC(remainder
) (1, 0);
2186 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2187 result
, INVALID_EXCEPTION
);
2189 result
= FUNC(remainder
) (1, minus_zero
);
2190 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2191 result
, INVALID_EXCEPTION
);
2193 result
= FUNC(remainder
) (plus_infty
, 1);
2194 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2195 result
, INVALID_EXCEPTION
);
2197 result
= FUNC(remainder
) (minus_infty
, 1);
2198 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2199 result
, INVALID_EXCEPTION
);
2201 result
= FUNC(remainder
) (1.625, 1.0);
2202 check ("remainder(1.625, 1.0) == -0.375", result
, -0.375);
2204 result
= FUNC(remainder
) (-1.625, 1.0);
2205 check ("remainder(-1.625, 1.0) == 0.375", result
, 0.375);
2207 result
= FUNC(remainder
) (1.625, -1.0);
2208 check ("remainder(1.625, -1.0) == -0.375", result
, -0.375);
2210 result
= FUNC(remainder
) (-1.625, -1.0);
2211 check ("remainder(-1.625, -1.0) == 0.375", result
, 0.375);
2213 result
= FUNC(remainder
) (5.0, 2.0);
2214 check ("remainder(5.0, 2.0) == 1.0", result
, 1.0);
2216 result
= FUNC(remainder
) (3.0, 2.0);
2217 check ("remainder(3.0, 2.0) == -1.0", result
, -1.0);
2227 result
= FUNC(remquo
) (1, 0, &quo
);
2228 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2229 result
, INVALID_EXCEPTION
);
2231 result
= FUNC(remquo
) (1, minus_zero
, &quo
);
2232 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2233 result
, INVALID_EXCEPTION
);
2235 result
= FUNC(remquo
) (plus_infty
, 1, &quo
);
2236 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2237 result
, INVALID_EXCEPTION
);
2239 result
= FUNC(remquo
) (minus_infty
, 1, &quo
);
2240 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2241 result
, INVALID_EXCEPTION
);
2243 result
= FUNC(remquo
) (1.625, 1.0, &quo
);
2244 check ("remquo(1.625, 1.0, &x) == -0.375", result
, -0.375);
2245 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo
, 2);
2247 result
= FUNC(remquo
) (-1.625, 1.0, &quo
);
2248 check ("remquo(-1.625, 1.0, &x) == 0.375", result
, 0.375);
2249 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo
, -2);
2251 result
= FUNC(remquo
) (1.625, -1.0, &quo
);
2252 check ("remquo(1.625, -1.0, &x) == -0.375", result
, -0.375);
2253 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo
, -2);
2255 result
= FUNC(remquo
) (-1.625, -1.0, &quo
);
2256 check ("remquo(-1.625, -1.0, &x) == 0.375", result
, 0.375);
2257 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo
, 2);
2259 result
= FUNC(remquo
) (5.0, 2.0, &quo
);
2260 check ("remquo(5.0, 2.0, &x) == 1.0", result
, 1.0);
2261 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo
, 2);
2263 result
= FUNC(remquo
) (3.0, 2.0, &quo
);
2264 check ("remquo(3.0, 2.0, &x) == -1.0", result
, -1.0);
2265 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo
, 2);
2272 __complex__ MATHTYPE result
;
2274 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, plus_zero
));
2275 check ("real(cexp(0 + 0i)) = 1", __real__ result
, 1);
2276 check ("imag(cexp(0 + 0i)) = 0", __imag__ result
, 0);
2277 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_zero
));
2278 check ("real(cexp(-0 + 0i)) = 1", __real__ result
, 1);
2279 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result
, 0);
2280 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, minus_zero
));
2281 check ("real(cexp(0 - 0i)) = 1", __real__ result
, 1);
2282 check ("imag(cexp(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2283 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2284 check ("real(cexp(-0 - 0i)) = 1", __real__ result
, 1);
2285 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2287 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_zero
));
2288 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result
);
2289 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result
, 0);
2290 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2291 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result
);
2292 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result
, minus_zero
);
2294 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_zero
));
2295 check ("real(cexp(-inf + 0i)) = 0", __real__ result
, 0);
2296 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result
, 0);
2297 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2298 check ("real(cexp(-inf - 0i)) = 0", __real__ result
, 0);
2299 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result
, minus_zero
);
2302 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, plus_infty
));
2303 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2304 __real__ result
, INVALID_EXCEPTION
);
2305 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2308 #if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR <= 7
2310 printf ("The following test for cexp might fail due to a gcc compiler error!\n");
2313 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2314 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2315 __real__ result
, INVALID_EXCEPTION
);
2316 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2318 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, minus_infty
));
2319 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2320 __real__ result
, INVALID_EXCEPTION
);
2321 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2323 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2324 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2325 __real__ result
, INVALID_EXCEPTION
);
2326 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2329 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, plus_infty
));
2330 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2331 __real__ result
, INVALID_EXCEPTION
);
2332 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2334 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, plus_infty
));
2335 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2336 __real__ result
, INVALID_EXCEPTION
);
2337 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2339 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, minus_infty
));
2340 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2341 __real__ result
, INVALID_EXCEPTION
);
2342 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2344 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, minus_infty
));
2345 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2346 __real__ result
, INVALID_EXCEPTION
);
2347 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result
);
2349 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 2.0));
2350 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result
, minus_zero
);
2351 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result
, 0);
2352 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 4.0));
2353 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result
, minus_zero
);
2354 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result
, minus_zero
);
2356 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 2.0));
2357 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result
);
2358 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result
);
2359 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 4.0));
2360 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result
);
2361 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result
);
2363 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2364 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2365 __real__ result
, INVALID_EXCEPTION
);
2366 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2368 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2369 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2370 __real__ result
, INVALID_EXCEPTION
);
2371 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2374 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2375 check ("real(cexp(-inf + i inf)) = 0", __real__ result
, 0);
2376 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result
, 0);
2377 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2378 check ("real(cexp(-inf - i inf)) = 0", __real__ result
, 0);
2379 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result
, minus_zero
);
2381 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2382 check ("real(cexp(-inf + i NaN)) = 0", __real__ result
, 0);
2383 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result
), 0);
2385 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2386 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result
);
2387 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result
);
2389 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 0.0));
2390 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2391 __real__ result
, INVALID_EXCEPTION
);
2392 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2394 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 1.0));
2395 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2396 __real__ result
, INVALID_EXCEPTION
);
2397 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2399 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2400 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2401 __real__ result
, INVALID_EXCEPTION
);
2402 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2405 result
= FUNC(cexp
) (BUILD_COMPLEX (0, nan_value
));
2406 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2407 __real__ result
, INVALID_EXCEPTION
);
2408 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2410 result
= FUNC(cexp
) (BUILD_COMPLEX (1, nan_value
));
2411 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2412 __real__ result
, INVALID_EXCEPTION
);
2413 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2416 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, nan_value
));
2417 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result
);
2418 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result
);
2425 __complex__ MATHTYPE result
;
2427 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, 0.0));
2428 check ("real(csin(0 + 0i)) = 0", __real__ result
, 0);
2429 check ("imag(csin(0 + 0i)) = 0", __imag__ result
, 0);
2430 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, 0.0));
2431 check ("real(csin(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2432 check ("imag(csin(-0 + 0i)) = 0", __imag__ result
, 0);
2433 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_zero
));
2434 check ("real(csin(0 - 0i)) = 0", __real__ result
, 0);
2435 check ("imag(csin(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2436 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2437 check ("real(csin(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2438 check ("imag(csin(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2440 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, plus_infty
));
2441 check ("real(csin(0 + i Inf)) = 0", __real__ result
, 0);
2442 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result
);
2443 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2444 check ("real(csin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
2445 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result
);
2446 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_infty
));
2447 check ("real(csin(0 - i Inf)) = 0", __real__ result
, 0);
2448 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result
);
2449 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2450 check ("real(csin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
2451 check_isinfn("imag(csin(-0 - i Inf)) = -Inf", __imag__ result
);
2453 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 0.0));
2454 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2455 __real__ result
, INVALID_EXCEPTION
);
2456 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2457 FUNC(fabs
) (__imag__ result
), 0);
2458 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 0.0));
2459 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2460 __real__ result
, INVALID_EXCEPTION
);
2461 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2462 FUNC(fabs
) (__imag__ result
), 0);
2463 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2464 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2465 __real__ result
, INVALID_EXCEPTION
);
2466 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2467 FUNC(fabs
) (__imag__ result
), 0.0);
2468 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2469 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2470 __real__ result
, INVALID_EXCEPTION
);
2471 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2472 FUNC(fabs
) (__imag__ result
), 0.0);
2474 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2475 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2476 __real__ result
, INVALID_EXCEPTION
);
2477 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2478 FUNC(fabs
) (__imag__ result
));
2479 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2480 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2481 __real__ result
, INVALID_EXCEPTION
);
2482 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2483 FUNC(fabs
) (__imag__ result
));
2484 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2485 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2486 __real__ result
, INVALID_EXCEPTION
);
2487 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2488 FUNC(fabs
) (__imag__ result
));
2489 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2490 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2491 __real__ result
, INVALID_EXCEPTION
);
2492 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2493 FUNC(fabs
) (__imag__ result
));
2495 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 6.75));
2496 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2497 __real__ result
, INVALID_EXCEPTION
);
2498 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2500 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, -6.75));
2501 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2502 __real__ result
, INVALID_EXCEPTION
);
2503 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2505 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 6.75));
2506 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2507 __real__ result
, INVALID_EXCEPTION
);
2508 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2510 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, -6.75));
2511 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2512 __real__ result
, INVALID_EXCEPTION
);
2513 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2516 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, plus_infty
));
2517 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result
);
2518 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result
);
2519 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, minus_infty
));
2520 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result
);
2521 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result
);
2522 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, plus_infty
));
2523 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result
);
2524 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result
);
2525 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, minus_infty
));
2526 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result
);
2527 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result
);
2529 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 0.0));
2530 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result
);
2531 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2532 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2533 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result
);
2534 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2536 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2537 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result
);
2538 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2539 FUNC(fabs
) (__imag__ result
));
2540 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2541 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result
);
2542 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2543 FUNC(fabs
) (__imag__ result
));
2545 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 9.0));
2546 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2547 __real__ result
, INVALID_EXCEPTION
);
2548 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2550 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -9.0));
2551 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2552 __real__ result
, INVALID_EXCEPTION
);
2553 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2556 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, nan_value
));
2557 check ("real(csin(0 + i NaN))", __real__ result
, 0.0);
2558 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result
);
2559 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2560 check ("real(csin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
2561 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result
);
2563 result
= FUNC(csin
) (BUILD_COMPLEX (10.0, nan_value
));
2564 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2565 __real__ result
, INVALID_EXCEPTION
);
2566 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2568 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -10.0));
2569 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2570 __real__ result
, INVALID_EXCEPTION
);
2571 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2574 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2575 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2576 __real__ result
, INVALID_EXCEPTION
);
2577 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2579 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2580 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2581 __real__ result
, INVALID_EXCEPTION
);
2582 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2585 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, nan_value
));
2586 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result
);
2587 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result
);
2594 __complex__ MATHTYPE result
;
2596 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, 0.0));
2597 check ("real(csinh(0 + 0i)) = 0", __real__ result
, 0);
2598 check ("imag(csinh(0 + 0i)) = 0", __imag__ result
, 0);
2599 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, 0.0));
2600 check ("real(csinh(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2601 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result
, 0);
2602 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_zero
));
2603 check ("real(csinh(0 - 0i)) = 0", __real__ result
, 0);
2604 check ("imag(csinh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2605 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2606 check ("real(csinh(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2607 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2609 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, plus_infty
));
2610 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2611 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2612 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2614 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2615 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2616 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2617 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2619 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_infty
));
2620 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2621 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2622 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2624 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2625 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2626 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2627 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2630 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 0.0));
2631 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result
);
2632 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result
, 0);
2633 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 0.0));
2634 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result
);
2635 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result
, 0);
2636 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2637 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result
);
2638 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2639 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2640 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result
);
2641 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2643 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2644 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2645 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2646 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2648 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2649 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2650 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2651 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2653 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2654 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2655 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2656 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2658 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2659 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2660 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2661 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2664 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 4.625));
2665 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result
);
2666 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result
);
2667 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 4.625));
2668 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result
);
2669 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result
);
2670 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, -4.625));
2671 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result
);
2672 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result
);
2673 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, -4.625));
2674 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result
);
2675 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result
);
2677 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, plus_infty
));
2678 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2679 __real__ result
, INVALID_EXCEPTION
);
2680 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2682 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, plus_infty
));
2683 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2684 __real__ result
, INVALID_EXCEPTION
);
2685 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2687 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, minus_infty
));
2688 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2689 __real__ result
, INVALID_EXCEPTION
);
2690 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2692 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, minus_infty
));
2693 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2694 __real__ result
, INVALID_EXCEPTION
);
2695 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2698 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, nan_value
));
2699 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
2700 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result
);
2701 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2702 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
2703 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result
);
2705 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2706 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
2707 FUNC(fabs
) (__real__ result
));
2708 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result
);
2709 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2710 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
2711 FUNC(fabs
) (__real__ result
));
2712 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result
);
2714 result
= FUNC(csinh
) (BUILD_COMPLEX (9.0, nan_value
));
2715 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2716 __real__ result
, INVALID_EXCEPTION
);
2717 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2719 result
= FUNC(csinh
) (BUILD_COMPLEX (-9.0, nan_value
));
2720 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2721 __real__ result
, INVALID_EXCEPTION
);
2722 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2725 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 0.0));
2726 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result
);
2727 check ("imag(csinh(NaN + i0)) = 0", __imag__ result
, 0.0);
2728 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2729 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result
);
2730 check ("imag(csinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
2732 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 10.0));
2733 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2734 __real__ result
, INVALID_EXCEPTION
);
2735 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2737 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, -10.0));
2738 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2739 __real__ result
, INVALID_EXCEPTION
);
2740 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2743 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2744 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2745 __real__ result
, INVALID_EXCEPTION
);
2746 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2748 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2749 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2750 __real__ result
, INVALID_EXCEPTION
);
2751 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2754 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
2755 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result
);
2756 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result
);
2763 __complex__ MATHTYPE result
;
2765 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, 0.0));
2766 check ("real(ccos(0 + 0i)) = 1.0", __real__ result
, 1.0);
2767 check ("imag(ccos(0 + 0i)) = 0", __imag__ result
, 0);
2768 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, 0.0));
2769 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result
, 1.0);
2770 check ("imag(ccos(-0 + 0i)) = -0", __imag__ result
, minus_zero
);
2771 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_zero
));
2772 check ("real(ccos(0 - 0i)) = 1.0", __real__ result
, 1.0);
2773 check ("imag(ccos(0 - 0i)) = 0", __imag__ result
, 0.0);
2774 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2775 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result
, 1.0);
2776 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2778 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 0.0));
2779 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
2780 __real__ result
, INVALID_EXCEPTION
);
2781 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
2782 FUNC(fabs
) (__imag__ result
), 0);
2783 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2784 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
2785 __real__ result
, INVALID_EXCEPTION
);
2786 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
2787 FUNC(fabs
) (__imag__ result
), 0);
2788 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 0.0));
2789 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
2790 __real__ result
, INVALID_EXCEPTION
);
2791 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
2792 FUNC(fabs
) (__imag__ result
), 0);
2793 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2794 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
2795 __real__ result
, INVALID_EXCEPTION
);
2796 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
2797 FUNC(fabs
) (__imag__ result
), 0);
2799 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, plus_infty
));
2800 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result
);
2801 check ("imag(ccos(0 + i Inf)) = 0", __imag__ result
, 0);
2802 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_infty
));
2803 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result
);
2804 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result
, 0);
2805 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2806 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result
);
2807 check ("imag(ccos(-0 + i Inf)) = -0", __imag__ result
, minus_zero
);
2808 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2809 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result
);
2810 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
2812 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2813 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
2814 __real__ result
, INVALID_EXCEPTION
);
2815 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
2817 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2818 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
2819 __real__ result
, INVALID_EXCEPTION
);
2820 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
2822 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2823 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
2824 __real__ result
, INVALID_EXCEPTION
);
2825 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
2827 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2828 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
2829 __real__ result
, INVALID_EXCEPTION
);
2830 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
2833 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, plus_infty
));
2834 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result
);
2835 check_isinfn ("imag(ccos(4.625 + i Inf)) = -Inf", __imag__ result
);
2836 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, minus_infty
));
2837 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result
);
2838 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result
);
2839 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, plus_infty
));
2840 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result
);
2841 check_isinfp ("imag(ccos(-4.625 + i Inf)) = +Inf", __imag__ result
);
2842 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, minus_infty
));
2843 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result
);
2844 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result
);
2846 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 6.75));
2847 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2848 __real__ result
, INVALID_EXCEPTION
);
2849 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2851 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, -6.75));
2852 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2853 __real__ result
, INVALID_EXCEPTION
);
2854 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2856 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 6.75));
2857 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
2858 __real__ result
, INVALID_EXCEPTION
);
2859 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
2861 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, -6.75));
2862 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
2863 __real__ result
, INVALID_EXCEPTION
);
2864 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
2867 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 0.0));
2868 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result
);
2869 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2870 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2871 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result
);
2872 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2874 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2875 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result
);
2876 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result
);
2877 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2878 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result
);
2879 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result
);
2881 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 9.0));
2882 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
2883 __real__ result
, INVALID_EXCEPTION
);
2884 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
2886 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, -9.0));
2887 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
2888 __real__ result
, INVALID_EXCEPTION
);
2889 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
2892 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, nan_value
));
2893 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result
);
2894 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
2895 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2896 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result
);
2897 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
2899 result
= FUNC(ccos
) (BUILD_COMPLEX (10.0, nan_value
));
2900 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
2901 __real__ result
, INVALID_EXCEPTION
);
2902 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
2904 result
= FUNC(ccos
) (BUILD_COMPLEX (-10.0, nan_value
));
2905 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
2906 __real__ result
, INVALID_EXCEPTION
);
2907 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
2910 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2911 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
2912 __real__ result
, INVALID_EXCEPTION
);
2913 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
2915 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2916 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
2917 __real__ result
, INVALID_EXCEPTION
);
2918 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
2921 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, nan_value
));
2922 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result
);
2923 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result
);
2930 __complex__ MATHTYPE result
;
2932 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, 0.0));
2933 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result
, 1.0);
2934 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result
, 0);
2935 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, 0.0));
2936 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result
, 1.0);
2937 check ("imag(ccosh(-0 + 0i)) = 0", __imag__ result
, 0);
2938 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_zero
));
2939 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result
, 1.0);
2940 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2941 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2942 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result
, 1.0);
2943 check ("imag(ccosh(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2945 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, plus_infty
));
2946 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
2947 __real__ result
, INVALID_EXCEPTION
);
2948 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
2949 FUNC(fabs
) (__imag__ result
), 0);
2950 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2951 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
2952 __real__ result
, INVALID_EXCEPTION
);
2953 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
2954 FUNC(fabs
) (__imag__ result
), 0);
2955 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_infty
));
2956 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
2957 __real__ result
, INVALID_EXCEPTION
);
2958 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
2959 FUNC(fabs
) (__imag__ result
), 0);
2960 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2961 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
2962 __real__ result
, INVALID_EXCEPTION
);
2963 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
2964 FUNC(fabs
) (__imag__ result
), 0);
2966 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 0.0));
2967 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result
);
2968 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result
, 0);
2969 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 0.0));
2970 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result
);
2971 check ("imag(ccosh(-Inf + 0i)) = 0", __imag__ result
, 0);
2972 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2973 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result
);
2974 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2975 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2976 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result
);
2977 check ("imag(ccosh(-Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2979 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2980 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
2981 __real__ result
, INVALID_EXCEPTION
);
2982 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
2984 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2985 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
2986 __real__ result
, INVALID_EXCEPTION
);
2987 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
2989 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2990 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
2991 __real__ result
, INVALID_EXCEPTION
);
2992 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
2994 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2995 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
2996 __real__ result
, INVALID_EXCEPTION
);
2997 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3000 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 4.625));
3001 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result
);
3002 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result
);
3003 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 4.625));
3004 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result
);
3005 check_isinfn ("imag(ccosh(-Inf + i4.625)) = -Inf", __imag__ result
);
3006 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, -4.625));
3007 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result
);
3008 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result
);
3009 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, -4.625));
3010 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result
);
3011 check_isinfp ("imag(ccosh(-Inf - i4.625)) = +Inf", __imag__ result
);
3013 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, plus_infty
));
3014 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3015 __real__ result
, INVALID_EXCEPTION
);
3016 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3018 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, plus_infty
));
3019 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3020 __real__ result
, INVALID_EXCEPTION
);
3021 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3023 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, minus_infty
));
3024 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3025 __real__ result
, INVALID_EXCEPTION
);
3026 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3028 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, minus_infty
));
3029 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3030 __real__ result
, INVALID_EXCEPTION
);
3031 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3034 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, nan_value
));
3035 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result
);
3036 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3037 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3038 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result
);
3039 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3041 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3042 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result
);
3043 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result
);
3044 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3045 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result
);
3046 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result
);
3048 result
= FUNC(ccosh
) (BUILD_COMPLEX (9.0, nan_value
));
3049 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3050 __real__ result
, INVALID_EXCEPTION
);
3051 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3053 result
= FUNC(ccosh
) (BUILD_COMPLEX (-9.0, nan_value
));
3054 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3055 __real__ result
, INVALID_EXCEPTION
);
3056 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3059 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 0.0));
3060 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result
);
3061 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3062 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3063 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result
);
3064 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3066 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 10.0));
3067 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3068 __real__ result
, INVALID_EXCEPTION
);
3069 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3071 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, -10.0));
3072 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3073 __real__ result
, INVALID_EXCEPTION
);
3074 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3077 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3078 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3079 __real__ result
, INVALID_EXCEPTION
);
3080 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3082 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3083 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3084 __real__ result
, INVALID_EXCEPTION
);
3085 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3088 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3089 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result
);
3090 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result
);
3097 __complex__ MATHTYPE result
;
3099 result
= FUNC(cacos
) (BUILD_COMPLEX (0, 0));
3100 check ("real(cacos(0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3101 check ("imag(cacos(0 + i0)) = -0", __imag__ result
, minus_zero
);
3102 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, 0));
3103 check ("real(cacos(-0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3104 check ("imag(cacos(-0 + i0)) = -0", __imag__ result
, minus_zero
);
3105 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_zero
));
3106 check ("real(cacos(0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3107 check ("imag(cacos(0 - i0)) = 0", __imag__ result
, 0);
3108 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3109 check ("real(cacos(-0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3110 check ("imag(cacos(-0 - i0)) = 0", __imag__ result
, 0);
3112 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3113 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3114 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result
);
3115 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3116 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3117 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result
);
3119 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3120 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3121 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result
);
3122 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3123 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3124 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result
);
3126 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, plus_infty
));
3127 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3128 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result
);
3129 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, minus_infty
));
3130 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3131 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result
);
3132 result
= FUNC(cacos
) (BUILD_COMPLEX (0, plus_infty
));
3133 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3134 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result
);
3135 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_infty
));
3136 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3137 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result
);
3138 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, plus_infty
));
3139 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3140 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result
);
3141 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, minus_infty
));
3142 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3143 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result
);
3145 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 0));
3146 check ("real(cacos(-Inf + i0)) = pi", __real__ result
, M_PI
);
3147 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result
);
3148 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3149 check ("real(cacos(-Inf - i0)) = pi", __real__ result
, M_PI
);
3150 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result
);
3151 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 100));
3152 check ("real(cacos(-Inf + i100)) = pi", __real__ result
, M_PI
);
3153 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result
);
3154 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, -100));
3155 check ("real(cacos(-Inf - i100)) = pi", __real__ result
, M_PI
);
3156 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result
);
3158 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0));
3159 check ("real(cacos(+Inf + i0)) = 0", __real__ result
, 0);
3160 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result
);
3161 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3162 check ("real(cacos(+Inf - i0)) = 0", __real__ result
, 0);
3163 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result
);
3164 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0.5));
3165 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result
, 0);
3166 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result
);
3167 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, -0.5));
3168 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result
, 0);
3169 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result
);
3171 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3172 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result
);
3173 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3174 FUNC(fabs
) (__imag__ result
));
3175 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3176 check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result
);
3177 check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf",
3178 FUNC(fabs
) (__imag__ result
));
3180 result
= FUNC(cacos
) (BUILD_COMPLEX (0, nan_value
));
3181 check ("real(cacos(0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3182 check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result
);
3183 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3184 check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3185 check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result
);
3187 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3188 check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result
);
3189 check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result
);
3190 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3191 check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result
);
3192 check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result
);
3194 result
= FUNC(cacos
) (BUILD_COMPLEX (10.5, nan_value
));
3195 check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3196 __real__ result
, INVALID_EXCEPTION
);
3197 check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3199 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3200 check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3201 __real__ result
, INVALID_EXCEPTION
);
3202 check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3205 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, 0.75));
3206 check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3207 __real__ result
, INVALID_EXCEPTION
);
3208 check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3210 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3211 check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3212 __real__ result
, INVALID_EXCEPTION
);
3213 check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3216 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, nan_value
));
3217 check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result
);
3218 check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result
);
3225 __complex__ MATHTYPE result
;
3227 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, 0));
3228 check ("real(cacosh(0 + i0)) = 0", __real__ result
, 0);
3229 check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3230 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, 0));
3231 check ("real(cacosh(-0 + i0)) = 0", __real__ result
, 0);
3232 check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3233 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_zero
));
3234 check ("real(cacosh(0 - i0)) = 0", __real__ result
, 0);
3235 check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3236 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3237 check ("real(cacosh(-0 - i0)) = 0", __real__ result
, 0);
3238 check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3240 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3241 check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result
);
3242 check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result
,
3244 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3245 check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result
);
3246 check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result
,
3249 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3250 check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result
);
3251 check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3252 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3253 check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result
);
3254 check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3256 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3257 check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result
);
3258 check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3259 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3260 check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result
);
3261 check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3262 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, plus_infty
));
3263 check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result
);
3264 check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3265 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_infty
));
3266 check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result
);
3267 check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3268 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, plus_infty
));
3269 check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result
);
3270 check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3271 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, minus_infty
));
3272 check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result
);
3273 check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3275 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 0));
3276 check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result
);
3277 check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result
, M_PI
);
3278 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3279 check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result
);
3280 check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
3281 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 100));
3282 check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result
);
3283 check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result
, M_PI
);
3284 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, -100));
3285 check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result
);
3286 check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result
, -M_PI
);
3288 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0));
3289 check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result
);
3290 check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result
, 0);
3291 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3292 check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result
);
3293 check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3294 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3295 check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result
);
3296 check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3297 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3298 check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result
);
3299 check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3301 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3302 check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result
);
3303 check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result
);
3304 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3305 check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result
);
3306 check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result
);
3308 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, nan_value
));
3309 check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result
);
3310 check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result
);
3311 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3312 check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result
);
3313 check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result
);
3315 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3316 check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result
);
3317 check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result
);
3318 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3319 check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result
);
3320 check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result
);
3322 result
= FUNC(cacosh
) (BUILD_COMPLEX (10.5, nan_value
));
3323 check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3324 __real__ result
, INVALID_EXCEPTION
);
3325 check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3327 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3328 check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3329 __real__ result
, INVALID_EXCEPTION
);
3330 check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3333 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, 0.75));
3334 check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3335 __real__ result
, INVALID_EXCEPTION
);
3336 check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3338 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3339 check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3340 __real__ result
, INVALID_EXCEPTION
);
3341 check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3344 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3345 check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result
);
3346 check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result
);
3353 __complex__ MATHTYPE result
;
3355 result
= FUNC(casin
) (BUILD_COMPLEX (0, 0));
3356 check ("real(casin(0 + i0)) = 0", __real__ result
, 0);
3357 check ("imag(casin(0 + i0)) = 0", __imag__ result
, 0);
3358 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, 0));
3359 check ("real(casin(-0 + i0)) = -0", __real__ result
, minus_zero
);
3360 check ("imag(casin(-0 + i0)) = 0", __imag__ result
, 0);
3361 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_zero
));
3362 check ("real(casin(0 - i0)) = 0", __real__ result
, 0);
3363 check ("imag(casin(0 - i0)) = -0", __imag__ result
, minus_zero
);
3364 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3365 check ("real(casin(-0 - i0)) = -0", __real__ result
, minus_zero
);
3366 check ("imag(casin(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3368 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3369 check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3370 check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result
);
3371 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3372 check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3373 check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result
);
3374 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3375 check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3376 check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result
);
3377 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3378 check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3379 check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result
);
3381 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, plus_infty
));
3382 check ("real(casin(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
3383 check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result
);
3384 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, minus_infty
));
3385 check ("real(casin(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
3386 check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result
);
3387 result
= FUNC(casin
) (BUILD_COMPLEX (0, plus_infty
));
3388 check ("real(casin(0 + i Inf)) = 0", __real__ result
, 0.0);
3389 check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result
);
3390 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_infty
));
3391 check ("real(casin(0 - i Inf)) = 0", __real__ result
, 0.0);
3392 check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result
);
3393 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3394 check ("real(casin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
3395 check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result
);
3396 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3397 check ("real(casin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
3398 check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result
);
3399 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, plus_infty
));
3400 check ("real(casin(0.1 + i Inf)) = 0", __real__ result
, 0);
3401 check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result
);
3402 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, minus_infty
));
3403 check ("real(casin(0.1 - i Inf)) = 0", __real__ result
, 0);
3404 check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result
);
3406 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 0));
3407 check ("real(casin(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
3408 check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result
);
3409 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3410 check ("real(casin(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
3411 check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result
);
3412 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 100));
3413 check ("real(casin(-Inf + i100)) = -pi/2", __real__ result
, -M_PI_2
);
3414 check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result
);
3415 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, -100));
3416 check ("real(casin(-Inf - i100)) = -pi/2", __real__ result
, -M_PI_2
);
3417 check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result
);
3419 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0));
3420 check ("real(casin(+Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
3421 check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result
);
3422 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3423 check ("real(casin(+Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
3424 check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result
);
3425 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0.5));
3426 check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result
, M_PI_2
);
3427 check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result
);
3428 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, -0.5));
3429 check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result
, M_PI_2
);
3430 check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result
);
3432 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3433 check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result
);
3434 check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result
);
3435 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3436 check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result
);
3437 check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result
);
3439 result
= FUNC(casin
) (BUILD_COMPLEX (0.0, nan_value
));
3440 check ("real(casin(0 + i NaN)) = 0", __real__ result
, 0.0);
3441 check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result
);
3442 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3443 check ("real(casin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
3444 check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result
);
3446 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3447 check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result
);
3448 check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
3449 FUNC(fabs
) (__imag__ result
));
3450 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3451 check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result
);
3452 check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
3453 FUNC(fabs
) (__imag__ result
));
3455 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, 10.5));
3456 check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3457 __real__ result
, INVALID_EXCEPTION
);
3458 check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3460 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, -10.5));
3461 check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3462 __real__ result
, INVALID_EXCEPTION
);
3463 check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3466 result
= FUNC(casin
) (BUILD_COMPLEX (0.75, nan_value
));
3467 check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3468 __real__ result
, INVALID_EXCEPTION
);
3469 check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3471 result
= FUNC(casin
) (BUILD_COMPLEX (-0.75, nan_value
));
3472 check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3473 __real__ result
, INVALID_EXCEPTION
);
3474 check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3477 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, nan_value
));
3478 check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result
);
3479 check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result
);
3486 __complex__ MATHTYPE result
;
3488 result
= FUNC(casinh
) (BUILD_COMPLEX (0, 0));
3489 check ("real(casinh(0 + i0)) = 0", __real__ result
, 0);
3490 check ("imag(casinh(0 + i0)) = 0", __imag__ result
, 0);
3491 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, 0));
3492 check ("real(casinh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3493 check ("imag(casinh(-0 + i0)) = 0", __imag__ result
, 0);
3494 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_zero
));
3495 check ("real(casinh(0 - i0)) = 0", __real__ result
, 0);
3496 check ("imag(casinh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3497 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3498 check ("real(casinh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3499 check ("imag(casinh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3501 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3502 check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result
);
3503 check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3504 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3505 check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result
);
3506 check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3507 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3508 check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result
);
3509 check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3510 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3511 check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result
);
3512 check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3514 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3515 check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result
);
3516 check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3517 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3518 check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result
);
3519 check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3520 result
= FUNC(casinh
) (BUILD_COMPLEX (0, plus_infty
));
3521 check_isinfp ("real(casinh(0 + i Inf)) = +Inf", __real__ result
);
3522 check ("imag(casinh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3523 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_infty
));
3524 check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result
);
3525 check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3526 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3527 check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result
);
3528 check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3529 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3530 check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result
);
3531 check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3532 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, plus_infty
));
3533 check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result
);
3534 check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3535 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, minus_infty
));
3536 check_isinfp ("real(casinh(0.1 - i Inf)) = +Inf", __real__ result
);
3537 check ("imag(casinh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3539 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 0));
3540 check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result
);
3541 check ("imag(casinh(-Inf + i0)) = 0", __imag__ result
, 0);
3542 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3543 check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result
);
3544 check ("imag(casinh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3545 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 100));
3546 check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result
);
3547 check ("imag(casinh(-Inf + i100)) = 0", __imag__ result
, 0);
3548 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, -100));
3549 check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result
);
3550 check ("imag(casinh(-Inf - i100)) = -0", __imag__ result
, minus_zero
);
3552 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0));
3553 check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result
);
3554 check ("imag(casinh(+Inf + i0)) = 0", __imag__ result
, 0);
3555 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3556 check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result
);
3557 check ("imag(casinh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3558 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3559 check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result
);
3560 check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3561 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3562 check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result
);
3563 check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3565 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3566 check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result
);
3567 check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result
);
3568 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3569 check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result
);
3570 check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result
);
3572 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0));
3573 check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result
);
3574 check ("imag(casinh(NaN + i0)) = 0", __imag__ result
, 0);
3575 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3576 check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result
);
3577 check ("imag(casinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3579 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3580 check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
3581 FUNC(fabs
) (__real__ result
));
3582 check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result
);
3583 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3584 check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
3585 FUNC(fabs
) (__real__ result
));
3586 check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result
);
3588 result
= FUNC(casinh
) (BUILD_COMPLEX (10.5, nan_value
));
3589 check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3590 __real__ result
, INVALID_EXCEPTION
);
3591 check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3593 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.5, nan_value
));
3594 check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3595 __real__ result
, INVALID_EXCEPTION
);
3596 check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3599 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0.75));
3600 check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3601 __real__ result
, INVALID_EXCEPTION
);
3602 check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3604 result
= FUNC(casinh
) (BUILD_COMPLEX (-0.75, nan_value
));
3605 check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3606 __real__ result
, INVALID_EXCEPTION
);
3607 check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3610 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3611 check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result
);
3612 check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result
);
3619 __complex__ MATHTYPE result
;
3621 result
= FUNC(catan
) (BUILD_COMPLEX (0, 0));
3622 check ("real(catan(0 + i0)) = 0", __real__ result
, 0);
3623 check ("imag(catan(0 + i0)) = 0", __imag__ result
, 0);
3624 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, 0));
3625 check ("real(catan(-0 + i0)) = -0", __real__ result
, minus_zero
);
3626 check ("imag(catan(-0 + i0)) = 0", __imag__ result
, 0);
3627 result
= FUNC(catan
) (BUILD_COMPLEX (0, minus_zero
));
3628 check ("real(catan(0 - i0)) = 0", __real__ result
, 0);
3629 check ("imag(catan(0 - i0)) = -0", __imag__ result
, minus_zero
);
3630 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3631 check ("real(catan(-0 - i0)) = -0", __real__ result
, minus_zero
);
3632 check ("imag(catan(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3634 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3635 check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3636 check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result
, 0);
3637 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3638 check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3639 check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
3640 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3641 check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3642 check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result
, 0.0);
3643 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3644 check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3645 check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
3647 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, -10.0));
3648 check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result
, M_PI_2
);
3649 check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
3650 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, -10.0));
3651 check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result
, -M_PI_2
);
3652 check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
3653 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3654 check ("real(catan(Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
3655 check ("imag(catan(Inf - i0)) = -0", __imag__ result
, minus_zero
);
3656 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3657 check ("real(catan(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
3658 check ("imag(catan(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3659 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.0));
3660 check ("real(catan(Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
3661 check ("imag(catan(Inf + i0)) = 0", __imag__ result
, 0.0);
3662 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.0));
3663 check ("real(catan(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
3664 check ("imag(catan(-Inf + i0)) = 0", __imag__ result
, 0.0);
3665 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.1));
3666 check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result
, M_PI_2
);
3667 check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result
, 0);
3668 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.1));
3669 check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result
, -M_PI_2
);
3670 check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result
, 0);
3672 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, minus_infty
));
3673 check ("real(catan(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3674 check ("imag(catan(0 - i Inf)) = -0", __imag__ result
, minus_zero
);
3675 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3676 check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3677 check ("imag(catan(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
3678 result
= FUNC(catan
) (BUILD_COMPLEX (100.0, minus_infty
));
3679 check ("real(catan(100 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3680 check ("imag(catan(100 - i Inf)) = -0", __imag__ result
, minus_zero
);
3681 result
= FUNC(catan
) (BUILD_COMPLEX (-100.0, minus_infty
));
3682 check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3683 check ("imag(catan(-100 - i Inf)) = -0", __imag__ result
, minus_zero
);
3685 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, plus_infty
));
3686 check ("real(catan(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3687 check ("imag(catan(0 + i Inf)) = 0", __imag__ result
, 0);
3688 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3689 check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3690 check ("imag(catan(-0 + i Inf)) = 0", __imag__ result
, 0);
3691 result
= FUNC(catan
) (BUILD_COMPLEX (0.5, plus_infty
));
3692 check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3693 check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result
, 0);
3694 result
= FUNC(catan
) (BUILD_COMPLEX (-0.5, plus_infty
));
3695 check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3696 check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result
, 0);
3698 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 0.0));
3699 check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result
);
3700 check ("imag(catan(NaN + i0)) = 0", __imag__ result
, 0.0);
3701 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3702 check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result
);
3703 check ("imag(catan(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3705 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3706 check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result
);
3707 check ("imag(catan(NaN + i Inf)) = 0", __imag__ result
, 0);
3708 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3709 check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result
);
3710 check ("imag(catan(NaN - i Inf)) = -0", __imag__ result
, minus_zero
);
3712 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, nan_value
));
3713 check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result
);
3714 check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result
);
3715 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3716 check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result
);
3717 check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result
);
3719 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3720 check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3721 check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3722 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3723 check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result
, -M_PI_2
);
3724 check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3726 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 10.5));
3727 check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3728 __real__ result
, INVALID_EXCEPTION
);
3729 check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3731 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, -10.5));
3732 check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3733 __real__ result
, INVALID_EXCEPTION
);
3734 check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3737 result
= FUNC(catan
) (BUILD_COMPLEX (0.75, nan_value
));
3738 check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3739 __real__ result
, INVALID_EXCEPTION
);
3740 check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3742 result
= FUNC(catan
) (BUILD_COMPLEX (-0.75, nan_value
));
3743 check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3744 __real__ result
, INVALID_EXCEPTION
);
3745 check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3748 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, nan_value
));
3749 check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result
);
3750 check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result
);
3757 __complex__ MATHTYPE result
;
3759 result
= FUNC(catanh
) (BUILD_COMPLEX (0, 0));
3760 check ("real(catanh(0 + i0)) = 0", __real__ result
, 0);
3761 check ("imag(catanh(0 + i0)) = 0", __imag__ result
, 0);
3762 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, 0));
3763 check ("real(catanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3764 check ("imag(catanh(-0 + i0)) = 0", __imag__ result
, 0);
3765 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_zero
));
3766 check ("real(catanh(0 - i0)) = 0", __real__ result
, 0);
3767 check ("imag(catanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3768 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3769 check ("real(catanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3770 check ("imag(catanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3772 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3773 check ("real(catanh(+Inf + i Inf)) = 0", __real__ result
, 0);
3774 check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3775 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3776 check ("real(catanh(+Inf - i Inf)) = 0", __real__ result
, 0);
3777 check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3778 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3779 check ("real(catanh(-Inf + i Inf)) = -0", __real__ result
, minus_zero
);
3780 check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3781 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3782 check ("real(catanh(-Inf - i Inf)) = -0", __real__ result
, minus_zero
);
3783 check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3785 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3786 check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
3787 check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3788 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3789 check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
3790 check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3791 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3792 check ("real(catanh(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
3793 check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3794 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3795 check ("real(catanh(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
3796 check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3797 result
= FUNC(catanh
) (BUILD_COMPLEX (0, plus_infty
));
3798 check ("real(catanh(0 + i Inf)) = 0", __real__ result
, 0);
3799 check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3800 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_infty
));
3801 check ("real(catanh(0 - i Inf)) = 0", __real__ result
, 0);
3802 check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3803 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, plus_infty
));
3804 check ("real(catanh(0.1 + i Inf)) = 0", __real__ result
, 0);
3805 check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3806 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, minus_infty
));
3807 check ("real(catanh(0.1 - i Inf)) = 0", __real__ result
, 0);
3808 check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3810 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 0));
3811 check ("real(catanh(-Inf + i0)) = -0", __real__ result
, minus_zero
);
3812 check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
3813 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3814 check ("real(catanh(-Inf - i0)) = -0", __real__ result
, minus_zero
);
3815 check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3816 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 100));
3817 check ("real(catanh(-Inf + i100)) = -0", __real__ result
, minus_zero
);
3818 check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result
, M_PI_2
);
3819 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, -100));
3820 check ("real(catanh(-Inf - i100)) = -0", __real__ result
, minus_zero
);
3821 check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result
, -M_PI_2
);
3823 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0));
3824 check ("real(catanh(+Inf + i0)) = 0", __real__ result
, 0);
3825 check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
3826 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3827 check ("real(catanh(+Inf - i0)) = 0", __real__ result
, 0);
3828 check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3829 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3830 check ("real(catanh(+Inf + i0.5)) = 0", __real__ result
, 0);
3831 check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result
, M_PI_2
);
3832 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3833 check ("real(catanh(+Inf - i0.5)) = 0", __real__ result
, 0);
3834 check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result
, -M_PI_2
);
3836 result
= FUNC(catanh
) (BUILD_COMPLEX (0, nan_value
));
3837 check ("real(catanh(0 + i NaN)) = 0", __real__ result
, 0);
3838 check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result
);
3839 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3840 check ("real(catanh(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
3841 check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result
);
3843 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3844 check ("real(catanh(+Inf + i NaN)) = 0", __real__ result
, 0);
3845 check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result
);
3846 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3847 check ("real(catanh(-Inf + i NaN)) = -0", __real__ result
, minus_zero
);
3848 check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result
);
3850 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0));
3851 check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result
);
3852 check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result
);
3853 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3854 check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result
);
3855 check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result
);
3857 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3858 check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
3859 check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3860 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3861 check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
3862 check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3864 result
= FUNC(catanh
) (BUILD_COMPLEX (10.5, nan_value
));
3865 check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3866 __real__ result
, INVALID_EXCEPTION
);
3867 check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3869 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.5, nan_value
));
3870 check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3871 __real__ result
, INVALID_EXCEPTION
);
3872 check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3875 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0.75));
3876 check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
3877 __real__ result
, INVALID_EXCEPTION
);
3878 check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
3880 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, -0.75));
3881 check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
3882 __real__ result
, INVALID_EXCEPTION
);
3883 check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
3886 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3887 check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result
);
3888 check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result
);
3895 __complex__ MATHTYPE result
;
3897 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, 0));
3898 check ("real(ctanh(0 + i0)) = 0", __real__ result
, 0);
3899 check ("imag(ctanh(0 + i0)) = 0", __imag__ result
, 0);
3900 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_zero
));
3901 check ("real(ctanh(0 - i0)) = 0", __real__ result
, 0);
3902 check ("imag(ctanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3903 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, 0));
3904 check ("real(ctanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3905 check ("imag(ctanh(-0 + i0)) = 0", __imag__ result
, 0);
3906 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3907 check ("real(ctanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3908 check ("imag(ctanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3910 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 0));
3911 check ("real(ctanh(+Inf + i0)) = 1", __real__ result
, 1);
3912 check ("imag(ctanh(+Inf + i0)) = 0", __imag__ result
, 0);
3913 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 1));
3914 check ("real(ctanh(+Inf + i1)) = 1", __real__ result
, 1);
3915 check ("imag(ctanh(+Inf + i1)) = 0", __imag__ result
, 0);
3916 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3917 check ("real(ctanh(+Inf - i0)) = 1", __real__ result
, 1);
3918 check ("imag(ctanh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3919 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, -1));
3920 check ("real(ctanh(+Inf - i1)) = 1", __real__ result
, 1);
3921 check ("imag(ctanh(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
3922 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 0));
3923 check ("real(ctanh(-Inf + i0)) = -1", __real__ result
, -1);
3924 check ("imag(ctanh(-Inf + i0)) = 0", __imag__ result
, 0);
3925 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 1));
3926 check ("real(ctanh(-Inf + i1)) = -1", __real__ result
, -1);
3927 check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result
, 0);
3928 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3929 check ("real(ctanh(-Inf - i0)) = -1", __real__ result
, -1);
3930 check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3931 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, -1));
3932 check ("real(ctanh(-Inf - i1)) = -1", __real__ result
, -1);
3933 check ("imag(ctanh(-Inf - i1)) = -0", __imag__ result
, minus_zero
);
3935 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, plus_infty
));
3936 check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
3937 __real__ result
, INVALID_EXCEPTION
);
3938 check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
3940 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, plus_infty
));
3941 check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
3942 __real__ result
, INVALID_EXCEPTION
);
3943 check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
3945 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_infty
));
3946 check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
3947 __real__ result
, INVALID_EXCEPTION
);
3948 check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
3950 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, minus_infty
));
3951 check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
3952 __real__ result
, INVALID_EXCEPTION
);
3953 check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
3955 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3956 check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
3957 __real__ result
, INVALID_EXCEPTION
);
3958 check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
3960 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, plus_infty
));
3961 check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
3962 __real__ result
, INVALID_EXCEPTION
);
3963 check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
3965 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3966 check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
3967 __real__ result
, INVALID_EXCEPTION
);
3968 check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
3970 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, minus_infty
));
3971 check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
3972 __real__ result
, INVALID_EXCEPTION
);
3973 check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
3976 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3977 check ("real(ctanh(+Inf + i NaN)) = 1", __real__ result
, 1);
3978 check ("imag(ctanh(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3979 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3980 check ("real(ctanh(-Inf + i NaN)) = -1", __real__ result
, -1);
3981 check ("imag(ctanh(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3983 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0));
3984 check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result
);
3985 check ("imag(ctanh(NaN + i0)) = 0", __imag__ result
, 0);
3986 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3987 check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result
);
3988 check ("imag(ctanh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3990 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0.5));
3991 check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
3992 __real__ result
, INVALID_EXCEPTION
);
3993 check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
3995 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, -4.5));
3996 check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
3997 __real__ result
, INVALID_EXCEPTION
);
3998 check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4001 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, nan_value
));
4002 check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4003 __real__ result
, INVALID_EXCEPTION
);
4004 check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4006 result
= FUNC(ctanh
) (BUILD_COMPLEX (5, nan_value
));
4007 check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4008 __real__ result
, INVALID_EXCEPTION
);
4009 check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4011 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4012 check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4013 __real__ result
, INVALID_EXCEPTION
);
4014 check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4016 result
= FUNC(ctanh
) (BUILD_COMPLEX (-0.25, nan_value
));
4017 check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4018 __real__ result
, INVALID_EXCEPTION
);
4019 check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4022 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
4023 check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result
);
4024 check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result
);
4031 __complex__ MATHTYPE result
;
4033 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, 0));
4034 check_isinfn_exc ("real(clog(-0 + i0)) = -Inf plus divide-by-zero exception",
4035 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4036 check ("imag(clog(-0 + i0)) = pi plus divide-by-zero exception",
4037 __imag__ result
, M_PI
);
4038 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4039 check_isinfn_exc ("real(clog(-0 - i0)) = -Inf plus divide-by-zero exception",
4040 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4041 check ("imag(clog(-0 - i0)) = -pi plus divide-by-zero exception",
4042 __imag__ result
, -M_PI
);
4044 result
= FUNC(clog
) (BUILD_COMPLEX (0, 0));
4045 check_isinfn_exc ("real(clog(0 + i0)) = -Inf plus divide-by-zero exception",
4046 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4047 check ("imag(clog(0 + i0)) = 0 plus divide-by-zero exception",
4048 __imag__ result
, 0);
4049 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_zero
));
4050 check_isinfn_exc ("real(clog(0 - i0)) = -Inf plus divide-by-zero exception",
4051 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4052 check ("imag(clog(0 - i0)) = -0 plus divide-by-zero exception",
4053 __imag__ result
, minus_zero
);
4055 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4056 check_isinfp ("real(clog(-Inf + i Inf)) = +Inf", __real__ result
);
4057 check ("imag(clog(-Inf + i Inf)) = 3*pi/4", __imag__ result
, M_PI
- M_PI_4
);
4058 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4059 check_isinfp ("real(clog(-Inf - i Inf)) = +Inf", __real__ result
);
4060 check ("imag(clog(-Inf - i Inf)) = -3*pi/4", __imag__ result
, M_PI_4
- M_PI
);
4062 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4063 check_isinfp ("real(clog(+Inf + i Inf)) = +Inf", __real__ result
);
4064 check ("imag(clog(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
4065 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4066 check_isinfp ("real(clog(+Inf - i Inf)) = +Inf", __real__ result
);
4067 check ("imag(clog(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
4069 result
= FUNC(clog
) (BUILD_COMPLEX (0, plus_infty
));
4070 check_isinfp ("real(clog(0 + i Inf)) = +Inf", __real__ result
);
4071 check ("imag(clog(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4072 result
= FUNC(clog
) (BUILD_COMPLEX (3, plus_infty
));
4073 check_isinfp ("real(clog(3 + i Inf)) = +Inf", __real__ result
);
4074 check ("imag(clog(3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4075 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4076 check_isinfp ("real(clog(-0 + i Inf)) = +Inf", __real__ result
);
4077 check ("imag(clog(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4078 result
= FUNC(clog
) (BUILD_COMPLEX (-3, plus_infty
));
4079 check_isinfp ("real(clog(-3 + i Inf)) = +Inf", __real__ result
);
4080 check ("imag(clog(-3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4081 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_infty
));
4082 check_isinfp ("real(clog(0 - i Inf)) = +Inf", __real__ result
);
4083 check ("imag(clog(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4084 result
= FUNC(clog
) (BUILD_COMPLEX (3, minus_infty
));
4085 check_isinfp ("real(clog(3 - i Inf)) = +Inf", __real__ result
);
4086 check ("imag(clog(3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4087 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4088 check_isinfp ("real(clog(-0 - i Inf)) = +Inf", __real__ result
);
4089 check ("imag(clog(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4090 result
= FUNC(clog
) (BUILD_COMPLEX (-3, minus_infty
));
4091 check_isinfp ("real(clog(-3 - i Inf)) = +Inf", __real__ result
);
4092 check ("imag(clog(-3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4094 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 0));
4095 check_isinfp ("real(clog(-Inf + i0)) = +Inf", __real__ result
);
4096 check ("imag(clog(-Inf + i0)) = pi", __imag__ result
, M_PI
);
4097 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 1));
4098 check_isinfp ("real(clog(-Inf + i1)) = +Inf", __real__ result
);
4099 check ("imag(clog(-Inf + i1)) = pi", __imag__ result
, M_PI
);
4100 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4101 check_isinfp ("real(clog(-Inf - i0)) = +Inf", __real__ result
);
4102 check ("imag(clog(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
4103 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, -1));
4104 check_isinfp ("real(clog(-Inf - i1)) = +Inf", __real__ result
);
4105 check ("imag(clog(-Inf - i1)) = -pi", __imag__ result
, -M_PI
);
4107 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 0));
4108 check_isinfp ("real(clog(+Inf + i0)) = +Inf", __real__ result
);
4109 check ("imag(clog(+Inf + i0)) = 0", __imag__ result
, 0);
4110 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 1));
4111 check_isinfp ("real(clog(+Inf + i1)) = +Inf", __real__ result
);
4112 check ("imag(clog(+Inf + i1)) = 0", __imag__ result
, 0);
4113 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4114 check_isinfp ("real(clog(+Inf - i0)) = +Inf", __real__ result
);
4115 check ("imag(clog(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4116 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, -1));
4117 check_isinfp ("real(clog(+Inf - i1)) = +Inf", __real__ result
);
4118 check ("imag(clog(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4120 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4121 check_isinfp ("real(clog(+Inf + i NaN)) = +Inf", __real__ result
);
4122 check_isnan ("imag(clog(+Inf + i NaN)) = NaN", __imag__ result
);
4123 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4124 check_isinfp ("real(clog(-Inf + i NaN)) = +Inf", __real__ result
);
4125 check_isnan ("imag(clog(-Inf + i NaN)) = NaN", __imag__ result
);
4127 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4128 check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result
);
4129 check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result
);
4130 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4131 check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result
);
4132 check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result
);
4134 result
= FUNC(clog
) (BUILD_COMPLEX (0, nan_value
));
4135 check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4136 __real__ result
, INVALID_EXCEPTION
);
4137 check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4139 result
= FUNC(clog
) (BUILD_COMPLEX (3, nan_value
));
4140 check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4141 __real__ result
, INVALID_EXCEPTION
);
4142 check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4144 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4145 check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4146 __real__ result
, INVALID_EXCEPTION
);
4147 check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4149 result
= FUNC(clog
) (BUILD_COMPLEX (-3, nan_value
));
4150 check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4151 __real__ result
, INVALID_EXCEPTION
);
4152 check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4155 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 0));
4156 check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
4157 __real__ result
, INVALID_EXCEPTION
);
4158 check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
4160 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 5));
4161 check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
4162 __real__ result
, INVALID_EXCEPTION
);
4163 check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
4165 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4166 check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
4167 __real__ result
, INVALID_EXCEPTION
);
4168 check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
4170 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, -5));
4171 check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
4172 __real__ result
, INVALID_EXCEPTION
);
4173 check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
4176 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, nan_value
));
4177 check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result
);
4178 check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result
);
4185 __complex__ MATHTYPE result
;
4187 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, 0));
4188 check ("real(csqrt(0 + i0)) = 0", __real__ result
, 0);
4189 check ("imag(csqrt(0 + i0)) = 0", __imag__ result
, 0);
4190 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_zero
));
4191 check ("real(csqrt(0 - i0)) = 0", __real__ result
, 0);
4192 check ("imag(csqrt(0 - i0)) = -0", __imag__ result
, minus_zero
);
4193 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, 0));
4194 check ("real(csqrt(-0 + i0)) = 0", __real__ result
, 0);
4195 check ("imag(csqrt(-0 + i0)) = 0", __imag__ result
, 0);
4196 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4197 check ("real(csqrt(-0 - i0)) = 0", __real__ result
, 0);
4198 check ("imag(csqrt(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4200 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 0));
4201 check ("real(csqrt(-Inf + i0)) = 0", __real__ result
, 0);
4202 check_isinfp ("imag(csqrt(-Inf + i0)) = +Inf", __imag__ result
);
4203 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 6));
4204 check ("real(csqrt(-Inf + i6)) = 0", __real__ result
, 0);
4205 check_isinfp ("imag(csqrt(-Inf + i6)) = +Inf", __imag__ result
);
4206 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4207 check ("real(csqrt(-Inf - i0)) = 0", __real__ result
, 0);
4208 check_isinfn ("imag(csqrt(-Inf - i0)) = -Inf", __imag__ result
);
4209 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, -6));
4210 check ("real(csqrt(-Inf - i6)) = 0", __real__ result
, 0);
4211 check_isinfn ("imag(csqrt(-Inf - i6)) = -Inf", __imag__ result
);
4213 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 0));
4214 check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result
);
4215 check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result
, 0);
4216 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 6));
4217 check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result
);
4218 check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result
, 0);
4219 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4220 check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result
);
4221 check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4222 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, -6));
4223 check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result
);
4224 check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result
, minus_zero
);
4226 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, plus_infty
));
4227 check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result
);
4228 check_isinfp ("imag(csqrt(0 + i Inf)) = +Inf", __imag__ result
);
4229 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, plus_infty
));
4230 check_isinfp ("real(csqrt(4 + i Inf)) = +Inf", __real__ result
);
4231 check_isinfp ("imag(csqrt(4 + i Inf)) = +Inf", __imag__ result
);
4232 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4233 check_isinfp ("real(csqrt(+Inf + i Inf)) = +Inf", __real__ result
);
4234 check_isinfp ("imag(csqrt(+Inf + i Inf)) = +Inf", __imag__ result
);
4235 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4236 check_isinfp ("real(csqrt(-0 + i Inf)) = +Inf", __real__ result
);
4237 check_isinfp ("imag(csqrt(-0 + i Inf)) = +Inf", __imag__ result
);
4238 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, plus_infty
));
4239 check_isinfp ("real(csqrt(-4 + i Inf)) = +Inf", __real__ result
);
4240 check_isinfp ("imag(csqrt(-4 + i Inf)) = +Inf", __imag__ result
);
4241 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4242 check_isinfp ("real(csqrt(-Inf + i Inf)) = +Inf", __real__ result
);
4243 check_isinfp ("imag(csqrt(-Inf + i Inf)) = +Inf", __imag__ result
);
4244 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_infty
));
4245 check_isinfp ("real(csqrt(0 - i Inf)) = +Inf", __real__ result
);
4246 check_isinfn ("imag(csqrt(0 - i Inf)) = -Inf", __imag__ result
);
4247 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, minus_infty
));
4248 check_isinfp ("real(csqrt(4 - i Inf)) = +Inf", __real__ result
);
4249 check_isinfn ("imag(csqrt(4 - i Inf)) = -Inf", __imag__ result
);
4250 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4251 check_isinfp ("real(csqrt(+Inf - i Inf)) = +Inf", __real__ result
);
4252 check_isinfn ("imag(csqrt(+Inf - i Inf)) = -Inf", __imag__ result
);
4253 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4254 check_isinfp ("real(csqrt(-0 - i Inf)) = +Inf", __real__ result
);
4255 check_isinfn ("imag(csqrt(-0 - i Inf)) = -Inf", __imag__ result
);
4256 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, minus_infty
));
4257 check_isinfp ("real(csqrt(-4 - i Inf)) = +Inf", __real__ result
);
4258 check_isinfn ("imag(csqrt(-4 - i Inf)) = -Inf", __imag__ result
);
4259 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4260 check_isinfp ("real(csqrt(-Inf - i Inf)) = +Inf", __real__ result
);
4261 check_isinfn ("imag(csqrt(-Inf - i Inf)) = -Inf", __imag__ result
);
4263 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4264 check_isnan ("real(csqrt(-Inf + i NaN)) = NaN", __real__ result
);
4265 check_isinfp ("imag(csqrt(-Inf + i NaN)) = +-Inf",
4266 FUNC(fabs
) (__imag__ result
));
4268 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4269 check_isinfp ("real(csqrt(+Inf + i NaN)) = +Inf", __real__ result
);
4270 check_isnan ("imag(csqrt(+Inf + i NaN)) = NaN", __imag__ result
);
4272 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, nan_value
));
4273 check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4274 __real__ result
, INVALID_EXCEPTION
);
4275 check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4277 result
= FUNC(csqrt
) (BUILD_COMPLEX (1, nan_value
));
4278 check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4279 __real__ result
, INVALID_EXCEPTION
);
4280 check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4282 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4283 check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4284 __real__ result
, INVALID_EXCEPTION
);
4285 check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4287 result
= FUNC(csqrt
) (BUILD_COMPLEX (-1, nan_value
));
4288 check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4289 __real__ result
, INVALID_EXCEPTION
);
4290 check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4293 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 0));
4294 check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4295 __real__ result
, INVALID_EXCEPTION
);
4296 check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4298 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 8));
4299 check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4300 __real__ result
, INVALID_EXCEPTION
);
4301 check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4303 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4304 check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4305 __real__ result
, INVALID_EXCEPTION
);
4306 check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4308 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, -8));
4309 check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4310 __real__ result
, INVALID_EXCEPTION
);
4311 check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4314 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, nan_value
));
4315 check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result
);
4316 check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result
);
4323 __complex__ MATHTYPE result
;
4325 result
= FUNC (cpow
) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
4326 check ("real(cpow (1 + i0), (0 + i0)) = 0", __real__ result
, 1);
4327 check ("imag(cpow (1 + i0), (0 + i0)) = 0", __imag__ result
, 0);
4329 result
= FUNC (cpow
) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
4330 check_eps ("real(cpow (2 + i0), (10 + i0)) = 1024", __real__ result
, 1024,
4331 CHOOSE (2e-16L, 0, 0));
4332 check ("imag(cpow (2 + i0), (10 + i0)) = 0", __imag__ result
, 0);
4338 nearbyint_test (void)
4340 check ("nearbyint(+0) = 0", FUNC(nearbyint
) (0.0), 0.0);
4341 check ("nearbyint(-0) = -0", FUNC(nearbyint
) (minus_zero
), minus_zero
);
4342 check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint
) (plus_infty
));
4343 check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint
) (minus_infty
));
4350 check ("rint(0) = 0", FUNC(rint
) (0.0), 0.0);
4351 check ("rint(-0) = -0", FUNC(rint
) (minus_zero
), minus_zero
);
4352 check_isinfp ("rint(+Inf) = +Inf", FUNC(rint
) (plus_infty
));
4353 check_isinfn ("rint(-Inf) = -Inf", FUNC(rint
) (minus_infty
));
4360 /* XXX this test is incomplete. We need to have a way to specifiy
4361 the rounding method and test the critical cases. So far, only
4362 unproblematic numbers are tested. */
4364 check_long ("rinttol(0) = 0", rinttol (0.0), 0);
4365 check_long ("rinttol(-0) = 0", rinttol (minus_zero
), 0);
4366 check_long ("rinttol(0.2) = 0", rinttol (0.2), 0);
4367 check_long ("rinttol(-0.2) = 0", rinttol (-0.2), 0);
4369 check_long ("rinttol(1.4) = 1", rinttol (1.4), 1);
4370 check_long ("rinttol(-1.4) = -1", rinttol (-1.4), -1);
4372 check_long ("rinttol(8388600.3) = 8388600", rinttol (8388600.3), 8388600);
4373 check_long ("rinttol(-8388600.3) = -8388600", rinttol (-8388600.3),
4379 rinttoll_test (void)
4381 /* XXX this test is incomplete. We need to have a way to specifiy
4382 the rounding method and test the critical cases. So far, only
4383 unproblematic numbers are tested. */
4385 check_longlong ("rinttoll(0) = 0", rinttoll (0.0), 0);
4386 check_longlong ("rinttoll(-0) = 0", rinttoll (minus_zero
), 0);
4387 check_longlong ("rinttoll(0.2) = 0", rinttoll (0.2), 0);
4388 check_longlong ("rinttoll(-0.2) = 0", rinttoll (-0.2), 0);
4390 check_longlong ("rinttoll(1.4) = 1", rinttoll (1.4), 1);
4391 check_longlong ("rinttoll(-1.4) = -1", rinttoll (-1.4), -1);
4393 check_longlong ("rinttoll(8388600.3) = 8388600", rinttoll (8388600.3),
4395 check_longlong ("rinttoll(-8388600.3) = -8388600", rinttoll (-8388600.3),
4403 check ("round(0) = 0", FUNC(round
) (0), 0);
4404 check ("round(-0) = -0", FUNC(round
) (minus_zero
), minus_zero
);
4405 check ("round(0.2) = 0", FUNC(round
) (0.2), 0.0);
4406 check ("round(-0.2) = -0", FUNC(round
) (-0.2), minus_zero
);
4407 check ("round(0.5) = 1", FUNC(round
) (0.5), 1.0);
4408 check ("round(-0.5) = -1", FUNC(round
) (-0.5), -1.0);
4409 check ("round(0.8) = 1", FUNC(round
) (0.8), 1.0);
4410 check ("round(-0.8) = -1", FUNC(round
) (-0.8), -1.0);
4411 check ("round(1.5) = 2", FUNC(round
) (1.5), 2.0);
4412 check ("round(-1.5) = -2", FUNC(round
) (-1.5), -2.0);
4413 check ("round(2097152.5) = 2097153", FUNC(round
) (2097152.5), 2097153);
4414 check ("round(-2097152.5) = -2097153", FUNC(round
) (-2097152.5), -2097153);
4419 roundtol_test (void)
4421 check_long ("roundtol(0) = 0", roundtol (0), 0);
4422 check_long ("roundtol(-0) = 0", roundtol (minus_zero
), 0);
4423 check_long ("roundtol(0.2) = 0", roundtol (0.2), 0.0);
4424 check_long ("roundtol(-0.2) = 0", roundtol (-0.2), 0);
4425 check_long ("roundtol(0.5) = 1", roundtol (0.5), 1);
4426 check_long ("roundtol(-0.5) = -1", roundtol (-0.5), -1);
4427 check_long ("roundtol(0.8) = 1", roundtol (0.8), 1);
4428 check_long ("roundtol(-0.8) = -1", roundtol (-0.8), -1);
4429 check_long ("roundtol(1.5) = 2", roundtol (1.5), 2);
4430 check_long ("roundtol(-1.5) = -2", roundtol (-1.5), -2);
4431 check_long ("roundtol(2097152.5) = 2097153", roundtol (2097152.5), 2097153);
4432 check_long ("roundtol(-2097152.5) = -2097153", roundtol (-2097152.5),
4438 roundtoll_test (void)
4440 check_longlong ("roundtoll(0) = 0", roundtoll (0), 0);
4441 check_longlong ("roundtoll(-0) = 0", roundtoll (minus_zero
), 0);
4442 check_longlong ("roundtoll(0.2) = 0", roundtoll (0.2), 0.0);
4443 check_longlong ("roundtoll(-0.2) = 0", roundtoll (-0.2), 0);
4444 check_longlong ("roundtoll(0.5) = 1", roundtoll (0.5), 1);
4445 check_longlong ("roundtoll(-0.5) = -1", roundtoll (-0.5), -1);
4446 check_longlong ("roundtoll(0.8) = 1", roundtoll (0.8), 1);
4447 check_longlong ("roundtoll(-0.8) = -1", roundtoll (-0.8), -1);
4448 check_longlong ("roundtoll(1.5) = 2", roundtoll (1.5), 2);
4449 check_longlong ("roundtoll(-1.5) = -2", roundtoll (-1.5), -2);
4450 check_longlong ("roundtoll(2097152.5) = 2097153",
4451 roundtoll (2097152.5), 2097153);
4452 check_longlong ("roundtoll(-2097152.5) = -2097153",
4453 roundtoll (-2097152.5), -2097153);
4454 check_longlong ("roundtoll(34359738368.5) = 34359738369",
4455 roundtoll (34359738368.5), 34359738369ll);
4456 check_longlong ("roundtoll(-34359738368.5) = -34359738369",
4457 roundtoll (-34359738368.5), -34359738369ll);
4462 inverse_func_pair_test (const char *test_name
,
4463 mathfunc f1
, mathfunc inverse
,
4464 MATHTYPE x
, MATHTYPE epsilon
)
4466 MATHTYPE a
, b
, difference
;
4474 output_new_test (test_name
);
4475 result
= check_equal (b
, x
, epsilon
, &difference
);
4476 output_result (test_name
, result
,
4477 b
, x
, difference
, PRINT
, PRINT
);
4482 inverse_functions (void)
4484 inverse_func_pair_test ("asin(sin(x)) == x",
4485 FUNC(sin
), FUNC(asin
), 1.0, CHOOSE (2e-18L, 0, 1e-7L));
4486 inverse_func_pair_test ("sin(asin(x)) == x",
4487 FUNC(asin
), FUNC(sin
), 1.0, 0.0);
4489 inverse_func_pair_test ("acos(cos(x)) == x",
4490 FUNC(cos
), FUNC(acos
), 1.0, CHOOSE (4e-18L, 1e-15L, 0));
4491 inverse_func_pair_test ("cos(acos(x)) == x",
4492 FUNC(acos
), FUNC(cos
), 1.0, 0.0);
4493 inverse_func_pair_test ("atan(tan(x)) == x",
4494 FUNC(tan
), FUNC(atan
), 1.0, CHOOSE (2e-18L, 0, 0));
4495 inverse_func_pair_test ("tan(atan(x)) == x",
4496 FUNC(atan
), FUNC(tan
), 1.0, CHOOSE (2e-18L, 1e-15L, 0));
4498 inverse_func_pair_test ("asinh(sinh(x)) == x",
4499 FUNC(sinh
), FUNC(asinh
), 1.0, CHOOSE (1e-18L, 0, 1e-7));
4500 inverse_func_pair_test ("sinh(asinh(x)) == x",
4501 FUNC(asinh
), FUNC(sinh
), 1.0, CHOOSE (2e-18L, 0, 0));
4503 inverse_func_pair_test ("acosh(cosh(x)) == x",
4504 FUNC(cosh
), FUNC(acosh
), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4505 inverse_func_pair_test ("cosh(acosh(x)) == x",
4506 FUNC(acosh
), FUNC(cosh
), 1.0, 0.0);
4508 inverse_func_pair_test ("atanh(tanh(x)) == x",
4509 FUNC(tanh
), FUNC(atanh
), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4510 inverse_func_pair_test ("tanh(atanh(x)) == x",
4511 FUNC(atanh
), FUNC(tanh
), 1.0, 0.0);
4515 /* Test sin and cos with the identity: sin(x)^2 + cos(x)^2 = 1. */
4517 identities1_test (MATHTYPE x
, MATHTYPE epsilon
)
4519 MATHTYPE res1
, res2
, res3
, diff
;
4522 res1
= FUNC(sin
) (x
);
4524 res2
= FUNC(cos
) (x
);
4526 res3
= res1
* res1
+ res2
* res2
;
4529 output_new_test ("sin^2 + cos^2 == 1");
4530 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
4531 output_result_ext ("sin^2 + cos^2 == 1", result
,
4532 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
4536 /* Test sin, cos, tan with the following relation: tan = sin/cos. */
4538 identities2_test (MATHTYPE x
, MATHTYPE epsilon
)
4540 MATHTYPE res1
, res2
, res3
, res4
, diff
;
4543 res1
= FUNC(sin
) (x
);
4545 res2
= FUNC(cos
) (x
);
4547 res3
= FUNC(tan
) (x
);
4552 output_new_test ("sin/cos == tan");
4553 result
= check_equal (res4
, res3
, epsilon
, &diff
);
4554 output_result_ext ("sin/cos == tan", result
,
4555 res4
, res3
, diff
, x
, PRINT
, PRINT
);
4559 /* Test cosh and sinh with the identity cosh^2 - sinh^2 = 1. */
4561 identities3_test (MATHTYPE x
, MATHTYPE epsilon
)
4563 MATHTYPE res1
, res2
, res3
, diff
;
4566 res1
= FUNC(sinh
) (x
);
4568 res2
= FUNC(cosh
) (x
);
4570 res3
= res2
* res2
- res1
* res1
;
4573 output_new_test ("cosh^2 - sinh^2 == 1");
4574 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
4575 output_result_ext ("cosh^2 - sinh^2 == 1", result
,
4576 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
4583 identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
4584 identities1_test (0.9L, CHOOSE (1e-18L, 0, 1e-7));
4585 identities1_test (0, 0);
4586 identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
4588 identities2_test (0.2L, CHOOSE (0, 1e-16, 0));
4589 identities2_test (0.9L, CHOOSE (0, 1e-15, 0));
4590 identities2_test (0, 0);
4591 identities2_test (-1, CHOOSE (1e-18L, 1e-15, 0));
4593 identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
4594 identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
4595 identities3_test (0, CHOOSE (0, 0, 1e-6));
4596 identities3_test (-1, CHOOSE (1e-18L, 0, 1e-6));
4601 Let's test that basic arithmetic is working
4602 tests: Infinity and NaN
4607 /* variables are declared volatile to forbid some compiler
4609 volatile MATHTYPE Inf_var
, NaN_var
, zero_var
, one_var
;
4614 NaN_var
= nan_value
;
4615 Inf_var
= one_var
/ zero_var
;
4622 /* Clear all exceptions. The previous computations raised exceptions. */
4623 feclearexcept (FE_ALL_EXCEPT
);
4625 check_isinfp ("isinf (inf) == +1", Inf_var
);
4626 check_isinfn ("isinf (-inf) == -1", -Inf_var
);
4627 check_bool ("!isinf (1)", !(FUNC(isinf
) (one_var
)));
4628 check_bool ("!isinf (NaN)", !(FUNC(isinf
) (NaN_var
)));
4630 check_isnan ("isnan (NaN)", NaN_var
);
4631 check_isnan ("isnan (-NaN)", -NaN_var
);
4632 check_bool ("!isnan (1)", !(FUNC(isnan
) (one_var
)));
4633 check_bool ("!isnan (inf)", !(FUNC(isnan
) (Inf_var
)));
4635 check_bool ("inf == inf", Inf_var
== Inf_var
);
4636 check_bool ("-inf == -inf", -Inf_var
== -Inf_var
);
4637 check_bool ("inf != -inf", Inf_var
!= -Inf_var
);
4638 check_bool ("NaN != NaN", NaN_var
!= NaN_var
);
4641 the same tests but this time with NAN from <nan.h>
4642 NAN is a double const
4644 check_bool ("isnan (NAN)", isnan (NAN
));
4645 check_bool ("isnan (-NAN)", isnan (-NAN
));
4646 check_bool ("!isinf (NAN)", !(isinf (NAN
)));
4647 check_bool ("!isinf (-NAN)", !(isinf (-NAN
)));
4648 check_bool ("NAN != NAN", NAN
!= NAN
);
4651 And again with the value returned by the `nan' function.
4653 check_bool ("isnan (NAN)", FUNC(isnan
) (FUNC(nan
) ("")));
4654 check_bool ("isnan (-NAN)", FUNC(isnan
) (-FUNC(nan
) ("")));
4655 check_bool ("!isinf (NAN)", !(FUNC(isinf
) (FUNC(nan
) (""))));
4656 check_bool ("!isinf (-NAN)", !(FUNC(isinf
) (-FUNC(nan
) (""))));
4657 check_bool ("NAN != NAN", FUNC(nan
) ("") != FUNC(nan
) (""));
4659 /* test if EPSILON is ok */
4660 x1
= MATHCONST (1.0);
4661 x2
= x1
+ CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
4662 check_bool ("1 != 1+EPSILON", x1
!= x2
);
4664 x1
= MATHCONST (1.0);
4665 x2
= x1
- CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
4666 check_bool ("1 != 1-EPSILON", x1
!= x2
);
4668 /* test if HUGE_VALx is ok */
4669 x1
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4670 check_bool ("isinf (HUGE_VALx) == +1", ISINF (x1
) == +1);
4671 x1
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4672 check_bool ("isinf (-HUGE_VALx) == -1", ISINF (x1
) == -1);
4680 fpstack_test ("start *init*");
4682 nan_value
= plus_zero
/ plus_zero
; /* Suppress GCC warning */
4684 minus_zero
= FUNC (copysign
) (0.0, -1.0);
4685 plus_infty
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4686 minus_infty
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4692 (void) &minus_infty
;
4694 /* Clear all exceptions. From now on we must not get random exceptions. */
4695 feclearexcept (FE_ALL_EXCEPT
);
4697 /* Test to make sure we start correctly. */
4698 fpstack_test ("end *init*");
4702 static struct option long_options
[] =
4704 {"verbose", optional_argument
, NULL
, 'v'},
4705 {"silent", no_argument
, NULL
, 's'},
4711 parse_options (int argc
, char *argv
[])
4720 c
= getopt_long (argc
, argv
, "v::s",
4721 long_options
, &option_index
);
4723 /* Detect the end of the options. */
4731 verbose
= (unsigned int) strtoul (optarg
, NULL
, 0);
4745 main (int argc
, char *argv
[])
4748 parse_options (argc
, argv
);
4755 /* keep the tests a wee bit ordered (according to ISO 9X) */
4756 /* classification functions */
4762 /* trigonometric functions */
4772 /* hyperbolic functions */
4780 /* exponential and logarithmic functions */
4796 /* power and absolute value functions */
4803 /* error and gamma functions */
4809 /* nearest integer functions */
4821 /* remainder functions */
4826 /* manipulation functions */
4830 /* maximum, minimum and positive difference functions */
4835 /* complex functions */
4854 inverse_functions ();
4858 printf ("\n%d errors occured.\n", noErrors
);
4861 printf ("\n All tests passed successfully.\n");