1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 Part of testsuite for libm.
24 This file has to be included by a master file that defines:
27 FUNC(function): converts general function name (like cos) to
28 name with correct suffix (e.g. cosl or cosf)
29 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
30 MATHTYPE: floating point type to test
31 TEST_MSG: informal message to be displayed
32 CHOOSE(Clongdouble,Cdouble,Cfloat):
33 chooses one of the parameters as epsilon for testing
35 PRINTF_EXPR Floating point conversion specification to print a variable
36 of type MATHTYPE with printf. PRINTF_EXPR just contains
37 the specifier, not the percent and width arguments,
41 /* This program isn't finished yet.
43 acos, acosh, asin, asinh, atan, atan2, atanh,
44 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
45 fabs, fdim, floor, fmin, fmax, fmod, fpclassify,
47 ilogb, isfinite, isinf, isnan, isnormal,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, lrint, llrint,
51 round, lround, llround,
52 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
54 and for the following complex math functions:
55 cacos, cacosh, casin, casinh, catan, catanh,
56 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctanh.
58 At the moment the following functions aren't tested:
59 cabs, carg, conj, cproj, cimag, creal, ctan, drem,
60 j0, j1, jn, y0, y1, yn,
62 nan, comparison macros (isless,isgreater,...).
64 The routines using random variables are still under construction. I don't
65 like it the way it's working now and will change it.
67 Parameter handling is primitive in the moment:
68 --verbose=[0..4] for different levels of output:
70 1: basic report on failed tests (default)
71 2: full report on failed tests
72 3: full report on failed and passed tests
73 4: additional report on exceptions
74 -v for full output (equals --verbose=4)
75 -s,--silent outputs only the error count (equals --verbose=0)
80 This suite tests the correct implementation of mathematical
81 functions in libm. Some simple, specific parameters are tested for
82 correctness. Handling of specific inputs (e.g. infinity,
83 not-a-number) is also tested. Correct handling of exceptions is
84 checked against. These implemented tests should check all cases
85 that are specified in ISO C 9X.
87 Exception testing: At the moment only divide-by-zero and invalid
88 exceptions are tested. Overflow/underflow and inexact exceptions
89 aren't checked at the moment.
91 NaN values: There exist signalling and quiet NaNs. This implementation
92 only uses signalling NaN as parameter but does not differenciate
93 between the two kinds of NaNs as result.
95 Inline functions: Inlining functions should give an improvement in
96 speed - but not in precission. The inlined functions return
97 reasonable values for a reasonable range of input values. The
98 result is not necessarily correct for all values and exceptions are
99 not correctly raised in all cases. Problematic input and return
100 values are infinity, not-a-number and minus zero. This suite
101 therefore does not check these specific inputs and the exception
102 handling for inlined mathematical functions - just the "reasonable"
105 Beware: The tests might fail for any of the following reasons:
107 - Functions are wrong
108 - Floating Point Unit not working properly
109 - Compiler has errors
111 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
129 /* Possible exceptions */
130 #define NO_EXCEPTION 0x0
131 #define INVALID_EXCEPTION 0x1
132 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
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
);
597 check_int_exc (const char *test_name
, int computed
, int expected
,
600 int diff
= computed
- expected
;
601 int result
= diff
== 0;
603 output_new_test (test_name
);
604 test_exceptions (test_name
, exception
);
608 output_pass_value ();
612 output_fail_value (test_name
);
615 printf ("Result:\n");
616 printf (" is: %d\n", computed
);
617 printf (" should be: %d\n", expected
);
622 fpstack_test (test_name
);
627 check that computed and expected values are equal (long int values)
630 check_long (const char *test_name
, long int computed
, long int expected
)
632 long int diff
= computed
- expected
;
633 int result
= diff
== 0;
635 output_new_test (test_name
);
636 test_exceptions (test_name
, NO_EXCEPTION
);
640 output_pass_value ();
644 output_fail_value (test_name
);
647 printf ("Result:\n");
648 printf (" is: %ld\n", computed
);
649 printf (" should be: %ld\n", expected
);
654 fpstack_test (test_name
);
658 check that computed and expected values are equal (long long int values)
661 check_longlong (const char *test_name
, long long int computed
,
662 long long int expected
)
664 long long int diff
= computed
- expected
;
665 int result
= diff
== 0;
667 output_new_test (test_name
);
668 test_exceptions (test_name
, NO_EXCEPTION
);
672 output_pass_value ();
676 output_fail_value (test_name
);
679 printf ("Result:\n");
680 printf (" is: %lld\n", computed
);
681 printf (" should be: %lld\n", expected
);
686 fpstack_test (test_name
);
690 check that computed value is not-a-number
693 check_isnan (const char *test_name
, MATHTYPE computed
)
695 output_new_test (test_name
);
696 test_exceptions (test_name
, NO_EXCEPTION
);
697 output_isvalue (test_name
, isnan (computed
), computed
);
702 check that computed value is not-a-number and test for exceptions
705 check_isnan_exc (const char *test_name
, MATHTYPE computed
,
708 output_new_test (test_name
);
709 test_exceptions (test_name
, exception
);
710 output_isvalue (test_name
, isnan (computed
), computed
);
715 check that computed value is not-a-number and test for exceptions
718 check_isnan_maybe_exc (const char *test_name
, MATHTYPE computed
,
721 output_new_test (test_name
);
722 test_not_exception (test_name
, exception
);
723 output_isvalue (test_name
, isnan (computed
), computed
);
727 check that computed value is not-a-number and supply parameter
731 check_isnan_ext (const char *test_name
, MATHTYPE computed
,
734 output_new_test (test_name
);
735 test_exceptions (test_name
, NO_EXCEPTION
);
736 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
741 check that computed value is not-a-number, test for exceptions
745 check_isnan_exc_ext (const char *test_name
, MATHTYPE computed
,
746 short exception
, MATHTYPE parameter
)
748 output_new_test (test_name
);
749 test_exceptions (test_name
,exception
);
750 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
754 /* Tests if computed is +Inf */
756 check_isinfp (const char *test_name
, MATHTYPE computed
)
758 output_new_test (test_name
);
759 test_exceptions (test_name
, NO_EXCEPTION
);
760 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
765 check_isinfp_ext (const char *test_name
, MATHTYPE computed
,
768 output_new_test (test_name
);
769 test_exceptions (test_name
, NO_EXCEPTION
);
770 output_isvalue_ext (test_name
, (ISINF (computed
) == +1), computed
, parameter
);
774 /* Tests if computed is +Inf */
776 check_isinfp_exc (const char *test_name
, MATHTYPE computed
,
779 output_new_test (test_name
);
780 test_exceptions (test_name
, exception
);
781 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
784 /* Tests if computed is -Inf */
786 check_isinfn (const char *test_name
, MATHTYPE computed
)
788 output_new_test (test_name
);
789 test_exceptions (test_name
, NO_EXCEPTION
);
790 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
796 check_isinfn_ext (const char *test_name
, MATHTYPE computed
,
799 output_new_test (test_name
);
800 test_exceptions (test_name
, NO_EXCEPTION
);
801 output_isvalue_ext (test_name
, (ISINF (computed
) == -1), computed
, parameter
);
806 /* Tests if computed is -Inf */
808 check_isinfn_exc (const char *test_name
, MATHTYPE computed
,
811 output_new_test (test_name
);
812 test_exceptions (test_name
, exception
);
813 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
817 /* This is to prevent messages from the SVID libm emulation. */
819 matherr (struct exception
*x
__attribute__ ((unused
)))
825 /****************************************************************************
826 Test for single functions of libm
827 ****************************************************************************/
835 x
= random_greater (1);
836 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
841 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
846 check ("acos (1) == 0", FUNC(acos
) (1), 0);
847 check ("acos (-1) == pi", FUNC(acos
) (-1), M_PI
);
857 check_isinfp ("acosh(+inf) == +inf", FUNC(acosh
) (plus_infty
));
860 check_isnan_exc ("acosh(x) == NaN plus invalid exception if x < 1",
861 FUNC(acosh
) (x
), INVALID_EXCEPTION
);
864 check ("acosh(1) == 0", FUNC(acosh
) (1), 0);
874 x
= random_greater (1);
875 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
880 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
885 check ("asin (0) == 0", FUNC(asin
) (0), 0);
893 check ("asinh(+0) == +0", FUNC(asinh
) (0), 0);
895 check ("asinh(-0) == -0", FUNC(asinh
) (minus_zero
), minus_zero
);
896 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh
) (plus_infty
));
897 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh
) (minus_infty
));
906 check ("atan (0) == 0", FUNC(atan
) (0), 0);
907 check ("atan (-0) == -0", FUNC(atan
) (minus_zero
), minus_zero
);
909 check ("atan (+inf) == pi/2", FUNC(atan
) (plus_infty
), M_PI_2
);
910 check ("atan (-inf) == -pi/2", FUNC(atan
) (minus_infty
), -M_PI_2
);
919 x
= random_greater (0);
920 check ("atan2 (0,x) == 0 for x > 0",
921 FUNC(atan2
) (0, x
), 0);
922 x
= random_greater (0);
923 check ("atan2 (-0,x) == -0 for x > 0",
924 FUNC(atan2
) (minus_zero
, x
), minus_zero
);
926 check ("atan2 (+0,+0) == +0", FUNC(atan2
) (0, 0), 0);
927 check ("atan2 (-0,+0) == -0", FUNC(atan2
) (minus_zero
, 0), minus_zero
);
929 x
= -random_greater (0);
930 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2
) (0, x
), M_PI
);
932 x
= -random_greater (0);
933 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2
) (minus_zero
, x
), -M_PI
);
935 check ("atan2 (+0,-0) == +pi", FUNC(atan2
) (0, minus_zero
), M_PI
);
936 check ("atan2 (-0,-0) == -pi", FUNC(atan2
) (minus_zero
, minus_zero
), -M_PI
);
938 x
= random_greater (0);
939 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2
) (x
, 0), M_PI_2
);
941 x
= random_greater (0);
942 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2
) (x
, minus_zero
), M_PI_2
);
945 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2
) (x
, 0), -M_PI_2
);
948 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2
) (x
, minus_zero
), -M_PI_2
);
950 x
= random_greater (0);
951 check ("atan2 (y,inf) == +0 for finite y > 0",
952 FUNC(atan2
) (x
, plus_infty
), 0);
954 x
= -random_greater (0);
955 check ("atan2 (y,inf) == -0 for finite y < 0",
956 FUNC(atan2
) (x
, plus_infty
), minus_zero
);
958 x
= random_value (-1e4
, 1e4
);
959 check ("atan2(+inf, x) == pi/2 for finite x",
960 FUNC(atan2
) (plus_infty
, x
), M_PI_2
);
962 x
= random_value (-1e4
, 1e4
);
963 check ("atan2(-inf, x) == -pi/2 for finite x",
964 FUNC(atan2
) (minus_infty
, x
), -M_PI_2
);
966 x
= random_greater (0);
967 check ("atan2 (y,-inf) == +pi for finite y > 0",
968 FUNC(atan2
) (x
, minus_infty
), M_PI
);
970 x
= -random_greater (0);
971 check ("atan2 (y,-inf) == -pi for finite y < 0",
972 FUNC(atan2
) (x
, minus_infty
), -M_PI
);
974 check ("atan2 (+inf,+inf) == +pi/4",
975 FUNC(atan2
) (plus_infty
, plus_infty
), M_PI_4
);
977 check ("atan2 (-inf,+inf) == -pi/4",
978 FUNC(atan2
) (minus_infty
, plus_infty
), -M_PI_4
);
980 check ("atan2 (+inf,-inf) == +3*pi/4",
981 FUNC(atan2
) (plus_infty
, minus_infty
), 3 * M_PI_4
);
983 check ("atan2 (-inf,-inf) == -3*pi/4",
984 FUNC(atan2
) (minus_infty
, minus_infty
), -3 * M_PI_4
);
986 /* FIXME: Add some specific tests */
997 check ("atanh(+0) == +0", FUNC(atanh
) (0), 0);
999 check ("atanh(-0) == -0", FUNC(atanh
) (minus_zero
), minus_zero
);
1001 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
1002 FUNC(atanh
) (1), DIVIDE_BY_ZERO_EXCEPTION
);
1003 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
1004 FUNC(atanh
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
1006 x
= random_greater (1.0);
1007 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1008 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
1010 x
= random_less (1.0);
1011 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1012 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
1021 check ("cbrt (+0) == +0", FUNC(cbrt
) (0.0), 0.0);
1022 check ("cbrt (-0) == -0", FUNC(cbrt
) (minus_zero
), minus_zero
);
1025 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt
) (plus_infty
));
1026 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt
) (minus_infty
));
1027 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt
) (nan_value
));
1029 check_eps ("cbrt (8) == 2", FUNC(cbrt
) (8), 2, CHOOSE (5e-17L, 0, 0));
1030 check_eps ("cbrt (-27) == -3", FUNC(cbrt
) (-27.0), -3.0,
1031 CHOOSE (3e-16L, 0, 0));
1038 check ("ceil (+0) == +0", FUNC(ceil
) (0.0), 0.0);
1039 check ("ceil (-0) == -0", FUNC(ceil
) (minus_zero
), minus_zero
);
1040 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil
) (plus_infty
));
1041 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil
) (minus_infty
));
1043 check ("ceil (pi) == 4", FUNC(ceil
) (M_PI
), 4.0);
1044 check ("ceil (-pi) == -3", FUNC(ceil
) (-M_PI
), -3.0);
1052 check ("cos (+0) == 1", FUNC(cos
) (0), 1);
1053 check ("cos (-0) == 1", FUNC(cos
) (minus_zero
), 1);
1054 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1055 FUNC(cos
) (plus_infty
),
1057 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1058 FUNC(cos
) (minus_infty
),
1061 check_eps ("cos (pi/3) == 0.5", FUNC(cos
) (M_PI
/ 3.0),
1062 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1063 check_eps ("cos (pi/2) == 0", FUNC(cos
) (M_PI_2
),
1064 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1071 check ("cosh (+0) == 1", FUNC(cosh
) (0), 1);
1072 check ("cosh (-0) == 1", FUNC(cosh
) (minus_zero
), 1);
1075 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh
) (plus_infty
));
1076 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh
) (minus_infty
));
1086 if (errno
== ENOSYS
)
1087 /* Function not implemented. */
1090 check ("erf (+0) == +0", FUNC(erf
) (0), 0);
1091 check ("erf (-0) == -0", FUNC(erf
) (minus_zero
), minus_zero
);
1092 check ("erf (+inf) == +1", FUNC(erf
) (plus_infty
), 1);
1093 check ("erf (-inf) == -1", FUNC(erf
) (minus_infty
), -1);
1102 if (errno
== ENOSYS
)
1103 /* Function not implemented. */
1106 check ("erfc (+inf) == 0", FUNC(erfc
) (plus_infty
), 0.0);
1107 check ("erfc (-inf) == 2", FUNC(erfc
) (minus_infty
), 2.0);
1108 check ("erfc (+0) == 1", FUNC(erfc
) (0.0), 1.0);
1109 check ("erfc (-0) == 1", FUNC(erfc
) (minus_zero
), 1.0);
1116 check ("exp (+0) == 1", FUNC(exp
) (0), 1);
1117 check ("exp (-0) == 1", FUNC(exp
) (minus_zero
), 1);
1120 check_isinfp ("exp (+inf) == +inf", FUNC(exp
) (plus_infty
));
1121 check ("exp (-inf) == 0", FUNC(exp
) (minus_infty
), 0);
1123 check_eps ("exp (1) == e", FUNC(exp
) (1), M_E
, CHOOSE (4e-18L, 0, 0));
1132 if (errno
== ENOSYS
)
1133 /* Function not implemented. */
1136 check ("exp2 (+0) == 1", FUNC(exp2
) (0), 1);
1137 check ("exp2 (-0) == 1", FUNC(exp2
) (minus_zero
), 1);
1139 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2
) (plus_infty
));
1140 check ("exp2 (-inf) == 0", FUNC(exp2
) (minus_infty
), 0);
1141 check ("exp2 (10) == 1024", FUNC(exp2
) (10), 1024);
1148 check ("expm1 (+0) == 0", FUNC(expm1
) (0), 0);
1149 check ("expm1 (-0) == -0", FUNC(expm1
) (minus_zero
), minus_zero
);
1151 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1
) (plus_infty
));
1152 check ("expm1 (-inf) == -1", FUNC(expm1
) (minus_infty
), -1);
1154 check_eps ("expm1 (1) == e-1", FUNC(expm1
) (1), M_E
- 1.0,
1155 CHOOSE (4e-18L, 0, 0));
1162 check_frexp (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
1163 int comp_int
, int exp_int
)
1168 result
= (check_equal (computed
, expected
, 0, &diff
)
1169 && (comp_int
== exp_int
));
1174 printf ("Pass: %s\n", test_name
);
1179 printf ("Fail: %s\n", test_name
);
1182 printf ("Result:\n");
1183 printf (" is: %.20" PRINTF_EXPR
" *2^%d\n", computed
, comp_int
);
1184 printf (" should be: %.20" PRINTF_EXPR
" *2^%d\n", expected
, exp_int
);
1185 printf (" difference: %.20" PRINTF_EXPR
"\n", diff
);
1189 fpstack_test (test_name
);
1190 output_result (test_name
, result
,
1191 computed
, expected
, diff
, PRINT
, PRINT
);
1201 result
= FUNC(frexp
) (plus_infty
, &x_int
);
1202 check_isinfp ("frexp (+inf, expr) == +inf", result
);
1204 result
= FUNC(frexp
) (minus_infty
, &x_int
);
1205 check_isinfn ("frexp (-inf, expr) == -inf", result
);
1207 result
= FUNC(frexp
) (nan_value
, &x_int
);
1208 check_isnan ("frexp (Nan, expr) == NaN", result
);
1210 result
= FUNC(frexp
) (0, &x_int
);
1211 check_frexp ("frexp: +0 == 0 * 2^0", result
, 0, x_int
, 0);
1213 result
= FUNC(frexp
) (minus_zero
, &x_int
);
1214 check_frexp ("frexp: -0 == -0 * 2^0", result
, minus_zero
, x_int
, 0);
1216 result
= FUNC(frexp
) (12.8L, &x_int
);
1217 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result
, 0.8L, x_int
, 4);
1219 result
= FUNC(frexp
) (-27.34L, &x_int
);
1220 check_frexp ("frexp: -27.34 == -0.854375 * 2^5", result
, -0.854375L, x_int
, 5);
1225 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
1226 /* All floating-point numbers can be put in one of these categories. */
1230 #define FP_NAN FP_NAN
1232 #define FP_INFINITE FP_INFINITE
1234 #define FP_ZERO FP_ZERO
1236 #define FP_SUBNORMAL FP_SUBNORMAL
1238 #define FP_NORMAL FP_NORMAL
1244 fpclassify_test (void)
1248 /* fpclassify is a macro, don't give it constants as parameter */
1249 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value
) == FP_NAN
);
1250 check_bool ("fpclassify (+inf) == FP_INFINITE",
1251 fpclassify (plus_infty
) == FP_INFINITE
);
1252 check_bool ("fpclassify (-inf) == FP_INFINITE",
1253 fpclassify (minus_infty
) == FP_INFINITE
);
1254 check_bool ("fpclassify (+0) == FP_ZERO",
1255 fpclassify (plus_zero
) == FP_ZERO
);
1256 check_bool ("fpclassify (-0) == FP_ZERO",
1257 fpclassify (minus_zero
) == FP_ZERO
);
1260 check_bool ("fpclassify (1000) == FP_NORMAL",
1261 fpclassify (x
) == FP_NORMAL
);
1266 isfinite_test (void)
1268 check_bool ("isfinite (0) != 0", isfinite (0));
1269 check_bool ("isfinite (-0) != 0", isfinite (minus_zero
));
1270 check_bool ("isfinite (10) != 0", isfinite (10));
1271 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty
) == 0);
1272 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty
) == 0);
1273 check_bool ("isfinite (NaN) == 0", isfinite (nan_value
) == 0);
1278 isnormal_test (void)
1280 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1281 check_bool ("isnormal (-0) == 0", isnormal (minus_zero
) == 0);
1282 check_bool ("isnormal (10) != 0", isnormal (10));
1283 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty
) == 0);
1284 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty
) == 0);
1285 check_bool ("isnormal (NaN) == 0", isnormal (nan_value
) == 0);
1295 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1296 check_bool ("signbit (-0) != 0", signbit (minus_zero
));
1297 check_bool ("signbit (+inf) == 0", signbit (plus_infty
) == 0);
1298 check_bool ("signbit (-inf) != 0", signbit (minus_infty
));
1300 x
= random_less (0);
1301 check_bool ("signbit (x) != 0 for x < 0", signbit (x
));
1303 x
= random_greater (0);
1304 check_bool ("signbit (x) == 0 for x > 0", signbit (x
) == 0);
1310 gamma has different semantics depending on _LIB_VERSION:
1311 if _LIB_VERSION is _SVID, gamma is just an alias for lgamma,
1312 otherwise gamma is the real gamma function as definied in ISO C 9X.
1317 int save_lib_version
= _LIB_VERSION
;
1320 if (errno
== ENOSYS
)
1321 /* Function not implemented. */
1323 feclearexcept (FE_ALL_EXCEPT
);
1326 _LIB_VERSION
= _SVID_
;
1328 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma
) (plus_infty
));
1329 check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
1330 FUNC(gamma
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1332 check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
1333 FUNC(gamma
) (-3), DIVIDE_BY_ZERO_EXCEPTION
);
1334 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1335 FUNC(gamma
) (minus_infty
), INVALID_EXCEPTION
);
1338 check ("gamma (1) == 0", FUNC(gamma
) (1), 0);
1339 check_int ("gamma (0) sets signgam to 1", signgam
, 1);
1342 check ("gamma (3) == M_LN2", FUNC(gamma
) (3), M_LN2
);
1343 check_int ("gamma (3) sets signgam to 1", signgam
, 1);
1346 check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma
) (0.5),
1347 FUNC(log
) (FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 1e-7));
1348 check_int ("gamma (0.5) sets signgam to 1", signgam
, 1);
1351 check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma
) (-0.5),
1352 FUNC(log
) (2*FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 0));
1354 check_int ("gamma (-0.5) sets signgam to -1", signgam
, -1);
1357 _LIB_VERSION
= _IEEE_
;
1359 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma
) (plus_infty
));
1360 check_isnan_exc ("gamma (0) == NaN plus invalid exception",
1361 FUNC(gamma
) (0), INVALID_EXCEPTION
);
1363 check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for integer x <= 0",
1364 FUNC(gamma
) (-2), INVALID_EXCEPTION
, -2);
1365 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1366 FUNC(gamma
) (minus_infty
), INVALID_EXCEPTION
);
1368 check_eps ("gamma (0.5) == sqrt(pi)", FUNC(gamma
) (0.5), FUNC(sqrt
) (M_PI
),
1369 CHOOSE (0, 5e-16, 2e-7));
1370 check_eps ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma
) (-0.5),
1371 -2*FUNC(sqrt
) (M_PI
), CHOOSE (0, 5e-16, 3e-7));
1373 check ("gamma (1) == 1", FUNC(gamma
) (1), 1);
1374 check ("gamma (4) == 6", FUNC(gamma
) (4), 6);
1376 _LIB_VERSION
= save_lib_version
;
1385 if (errno
== ENOSYS
)
1386 /* Function not implemented. */
1388 feclearexcept (FE_ALL_EXCEPT
);
1390 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma
) (plus_infty
));
1391 check_isinfp_exc ("lgamma (0) == +inf plus divide by zero exception",
1392 FUNC(lgamma
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1394 check_isinfp_exc ("lgamma (x) == +inf plus divide by zero exception for integer x <= 0",
1395 FUNC(lgamma
) (-3), DIVIDE_BY_ZERO_EXCEPTION
);
1396 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1397 FUNC(lgamma
) (minus_infty
), INVALID_EXCEPTION
);
1400 check ("lgamma (1) == 0", FUNC(lgamma
) (1), 0);
1401 check_int ("lgamma (0) sets signgam to 1", signgam
, 1);
1404 check ("lgamma (3) == M_LN2", FUNC(lgamma
) (3), M_LN2
);
1405 check_int ("lgamma (3) sets signgam to 1", signgam
, 1);
1408 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma
) (0.5),
1409 FUNC(log
) (FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 1e-7));
1410 check_int ("lgamma (0.5) sets signgam to 1", signgam
, 1);
1413 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma
) (-0.5),
1414 FUNC(log
) (2*FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 0));
1416 check_int ("lgamma (-0.5) sets signgam to -1", signgam
, -1);
1426 check_int ("ilogb (1) == 0", FUNC(ilogb
) (1), 0);
1427 check_int ("ilogb (e) == 1", FUNC(ilogb
) (M_E
), 1);
1428 check_int ("ilogb (1024) == 10", FUNC(ilogb
) (1024), 10);
1429 check_int ("ilogb (-2000) == 10", FUNC(ilogb
) (-2000), 10);
1431 /* XXX We have a problem here: the standard does not tell us whether
1432 exceptions are allowed/required. ignore them for now. */
1433 i
= FUNC (ilogb
) (0.0);
1434 feclearexcept (FE_ALL_EXCEPT
);
1435 check_int ("ilogb (0) == FP_ILOGB0", i
, FP_ILOGB0
);
1436 i
= FUNC(ilogb
) (nan_value
);
1437 feclearexcept (FE_ALL_EXCEPT
);
1438 check_int ("ilogb (NaN) == FP_ILOGBNAN", i
, FP_ILOGBNAN
);
1448 check ("ldexp (0, 0) == 0", FUNC(ldexp
) (0, 0), 0);
1450 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp
) (plus_infty
, 1));
1451 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp
) (minus_infty
, 1));
1452 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp
) (nan_value
, 1));
1454 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp
) (0.8L, 4), 12.8L);
1455 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp
) (-0.854375L, 5), -27.34L);
1457 x
= random_greater (0.0);
1458 check_ext ("ldexp (x, 0) == x", FUNC(ldexp
) (x
, 0L), x
, x
);
1466 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1467 FUNC(log
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1468 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1469 FUNC(log
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1471 check ("log (1) == 0", FUNC(log
) (1), 0);
1473 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1474 FUNC(log
) (-1), INVALID_EXCEPTION
);
1475 check_isinfp ("log (+inf) == +inf", FUNC(log
) (plus_infty
));
1477 check_eps ("log (e) == 1", FUNC(log
) (M_E
), 1, CHOOSE (1e-18L, 0, 9e-8L));
1478 check_eps ("log (1/e) == -1", FUNC(log
) (1.0 / M_E
), -1,
1479 CHOOSE (2e-18L, 0, 0));
1480 check ("log (2) == M_LN2", FUNC(log
) (2), M_LN2
);
1481 check_eps ("log (10) == M_LN10", FUNC(log
) (10), M_LN10
,
1482 CHOOSE (1e-18L, 0, 0));
1489 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1490 FUNC(log10
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1491 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1492 FUNC(log10
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1494 check ("log10 (1) == +0", FUNC(log10
) (1), 0);
1496 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1497 FUNC(log10
) (-1), INVALID_EXCEPTION
);
1499 check_isinfp ("log10 (+inf) == +inf", FUNC(log10
) (plus_infty
));
1501 check_eps ("log10 (0.1) == -1", FUNC(log10
) (0.1L), -1,
1502 CHOOSE (1e-18L, 0, 0));
1503 check_eps ("log10 (10) == 1", FUNC(log10
) (10.0), 1,
1504 CHOOSE (1e-18L, 0, 0));
1505 check_eps ("log10 (100) == 2", FUNC(log10
) (100.0), 2,
1506 CHOOSE (1e-18L, 0, 0));
1507 check ("log10 (10000) == 4", FUNC(log10
) (10000.0), 4);
1508 check_eps ("log10 (e) == M_LOG10E", FUNC(log10
) (M_E
), M_LOG10E
,
1509 CHOOSE (1e-18, 0, 9e-8));
1516 check ("log1p (+0) == +0", FUNC(log1p
) (0), 0);
1517 check ("log1p (-0) == -0", FUNC(log1p
) (minus_zero
), minus_zero
);
1519 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1520 FUNC(log1p
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
1521 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1522 FUNC(log1p
) (-2), INVALID_EXCEPTION
);
1524 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p
) (plus_infty
));
1526 check_eps ("log1p (e-1) == 1", FUNC(log1p
) (M_E
- 1.0), 1,
1527 CHOOSE (1e-18L, 0, 0));
1535 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1536 FUNC(log2
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1537 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1538 FUNC(log2
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1540 check ("log2 (1) == +0", FUNC(log2
) (1), 0);
1542 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1543 FUNC(log2
) (-1), INVALID_EXCEPTION
);
1545 check_isinfp ("log2 (+inf) == +inf", FUNC(log2
) (plus_infty
));
1547 check_eps ("log2 (e) == M_LOG2E", FUNC(log2
) (M_E
), M_LOG2E
,
1548 CHOOSE (1e-18L, 0, 0));
1549 check ("log2 (2) == 1", FUNC(log2
) (2.0), 1);
1550 check_eps ("log2 (16) == 4", FUNC(log2
) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1551 check ("log2 (256) == 8", FUNC(log2
) (256.0), 8);
1559 check_isinfp ("logb (+inf) == +inf", FUNC(logb
) (plus_infty
));
1560 check_isinfp ("logb (-inf) == +inf", FUNC(logb
) (minus_infty
));
1562 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1563 FUNC(logb
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1565 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1566 FUNC(logb
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1568 check ("logb (1) == 0", FUNC(logb
) (1), 0);
1569 check ("logb (e) == 1", FUNC(logb
) (M_E
), 1);
1570 check ("logb (1024) == 10", FUNC(logb
) (1024), 10);
1571 check ("logb (-2000) == 10", FUNC(logb
) (-2000), 10);
1579 MATHTYPE result
, intpart
;
1581 result
= FUNC(modf
) (plus_infty
, &intpart
);
1582 check ("modf (+inf, &x) returns +0", result
, 0);
1583 check_isinfp ("modf (+inf, &x) set x to +inf", intpart
);
1585 result
= FUNC(modf
) (minus_infty
, &intpart
);
1586 check ("modf (-inf, &x) returns -0", result
, minus_zero
);
1587 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart
);
1589 result
= FUNC(modf
) (nan_value
, &intpart
);
1590 check_isnan ("modf (NaN, &x) returns NaN", result
);
1591 check_isnan ("modf (NaN, &x) sets x to NaN", intpart
);
1593 result
= FUNC(modf
) (0, &intpart
);
1594 check ("modf (0, &x) returns 0", result
, 0);
1595 check ("modf (0, &x) sets x to 0", intpart
, 0);
1597 result
= FUNC(modf
) (minus_zero
, &intpart
);
1598 check ("modf (-0, &x) returns -0", result
, minus_zero
);
1599 check ("modf (-0, &x) sets x to -0", intpart
, minus_zero
);
1601 result
= FUNC(modf
) (2.5, &intpart
);
1602 check ("modf (2.5, &x) returns 0.5", result
, 0.5);
1603 check ("modf (2.5, &x) sets x to 2", intpart
, 2);
1605 result
= FUNC(modf
) (-2.5, &intpart
);
1606 check ("modf (-2.5, &x) returns -0.5", result
, -0.5);
1607 check ("modf (-2.5, &x) sets x to -2", intpart
, -2);
1617 check_isnan ("scalb (2, 0.5) == NaN", FUNC(scalb
) (2, 0.5));
1618 check_isnan ("scalb (3, -2.5) == NaN", FUNC(scalb
) (3, -2.5));
1620 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb
) (0, nan_value
));
1621 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb
) (1, nan_value
));
1623 x
= random_greater (0.0);
1624 check ("scalb (x, 0) == 0", FUNC(scalb
) (x
, 0), x
);
1625 x
= random_greater (0.0);
1626 check ("scalb (-x, 0) == 0", FUNC(scalb
) (-x
, 0), -x
);
1628 check_isnan_exc ("scalb (+0, +inf) == NaN plus invalid exception",
1629 FUNC(scalb
) (0, plus_infty
), INVALID_EXCEPTION
);
1630 check_isnan_exc ("scalb (-0, +inf) == NaN plus invalid exception",
1631 FUNC(scalb
) (minus_zero
, plus_infty
), INVALID_EXCEPTION
);
1633 check ("scalb (+0, 2) == +0", FUNC(scalb
) (0, 2), 0);
1634 check ("scalb (-0, 4) == -0", FUNC(scalb
) (minus_zero
, -4), minus_zero
);
1635 check ("scalb (+0, 0) == +0", FUNC(scalb
) (0, 0), 0);
1636 check ("scalb (-0, 0) == -0", FUNC(scalb
) (minus_zero
, 0), minus_zero
);
1637 check ("scalb (+0, -1) == +0", FUNC(scalb
) (0, -1), 0);
1638 check ("scalb (-0, -10) == -0", FUNC(scalb
) (minus_zero
, -10), minus_zero
);
1639 check ("scalb (+0, -inf) == +0", FUNC(scalb
) (0, minus_infty
), 0);
1640 check ("scalb (-0, -inf) == -0", FUNC(scalb
) (minus_zero
, minus_infty
),
1643 check_isinfp ("scalb (+inf, -1) == +inf", FUNC(scalb
) (plus_infty
, -1));
1644 check_isinfn ("scalb (-inf, -10) == -inf", FUNC(scalb
) (minus_infty
, -10));
1645 check_isinfp ("scalb (+inf, 0) == +inf", FUNC(scalb
) (plus_infty
, 0));
1646 check_isinfn ("scalb (-inf, 0) == -inf", FUNC(scalb
) (minus_infty
, 0));
1647 check_isinfp ("scalb (+inf, 2) == +inf", FUNC(scalb
) (plus_infty
, 2));
1648 check_isinfn ("scalb (-inf, 100) == -inf", FUNC(scalb
) (minus_infty
, 100));
1650 x
= random_greater (0.0);
1651 check ("scalb (x, -inf) == 0", FUNC(scalb
) (x
, minus_infty
), 0.0);
1652 check ("scalb (-x, -inf) == -0", FUNC(scalb
) (-x
, minus_infty
), minus_zero
);
1654 x
= random_greater (0.0);
1655 check_isinfp ("scalb (x, +inf) == +inf", FUNC(scalb
) (x
, plus_infty
));
1656 x
= random_greater (0.0);
1657 check_isinfn ("scalb (-x, +inf) == -inf", FUNC(scalb
) (-x
, plus_infty
));
1658 check_isinfp ("scalb (+inf, +inf) == +inf",
1659 FUNC(scalb
) (plus_infty
, plus_infty
));
1660 check_isinfn ("scalb (-inf, +inf) == -inf",
1661 FUNC(scalb
) (minus_infty
, plus_infty
));
1663 check_isnan ("scalb (+inf, -inf) == NaN",
1664 FUNC(scalb
) (plus_infty
, minus_infty
));
1665 check_isnan ("scalb (-inf, -inf) == NaN",
1666 FUNC(scalb
) (minus_infty
, minus_infty
));
1668 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb
) (nan_value
, 1));
1669 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb
) (1, nan_value
));
1670 check_isnan ("scalb (NaN, 0) == NaN", FUNC(scalb
) (nan_value
, 0));
1671 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb
) (0, nan_value
));
1672 check_isnan ("scalb (NaN, +inf) == NaN",
1673 FUNC(scalb
) (nan_value
, plus_infty
));
1674 check_isnan ("scalb (+inf, NaN) == NaN",
1675 FUNC(scalb
) (plus_infty
, nan_value
));
1676 check_isnan ("scalb (NaN, NaN) == NaN", FUNC(scalb
) (nan_value
, nan_value
));
1678 check ("scalb (0.8, 4) == 12.8", FUNC(scalb
) (0.8L, 4), 12.8L);
1679 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb
) (-0.854375L, 5), -27.34L);
1688 check ("scalbn (0, 0) == 0", FUNC(scalbn
) (0, 0), 0);
1690 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn
) (plus_infty
, 1));
1691 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn
) (minus_infty
, 1));
1692 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn
) (nan_value
, 1));
1694 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn
) (0.8L, 4), 12.8L);
1695 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn
) (-0.854375L, 5), -27.34L);
1697 x
= random_greater (0.0);
1698 check_ext ("scalbn (x, 0) == x", FUNC(scalbn
) (x
, 0L), x
, x
);
1705 check ("sin (+0) == +0", FUNC(sin
) (0), 0);
1706 check ("sin (-0) == -0", FUNC(sin
) (minus_zero
), minus_zero
);
1707 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1708 FUNC(sin
) (plus_infty
),
1710 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1711 FUNC(sin
) (minus_infty
),
1714 check_eps ("sin (pi/6) == 0.5", FUNC(sin
) (M_PI
/ 6.0), 0.5,
1715 CHOOSE (4e-18L, 0, 0));
1716 check ("sin (pi/2) == 1", FUNC(sin
) (M_PI_2
), 1);
1723 check ("sinh (+0) == +0", FUNC(sinh
) (0), 0);
1726 check ("sinh (-0) == -0", FUNC(sinh
) (minus_zero
), minus_zero
);
1728 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh
) (plus_infty
));
1729 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh
) (minus_infty
));
1737 MATHTYPE sin_res
, cos_res
;
1740 FUNC(sincos
) (0, &sin_res
, &cos_res
);
1742 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res
, 0);
1744 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1746 FUNC(sincos
) (minus_zero
, &sin_res
, &cos_res
);
1748 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res
, minus_zero
);
1750 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1752 FUNC(sincos
) (plus_infty
, &sin_res
, &cos_res
);
1754 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1755 sin_res
, INVALID_EXCEPTION
);
1757 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1758 cos_res
, INVALID_EXCEPTION
);
1760 FUNC(sincos
) (minus_infty
, &sin_res
, &cos_res
);
1762 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1763 sin_res
, INVALID_EXCEPTION
);
1765 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1766 cos_res
, INVALID_EXCEPTION
);
1768 FUNC(sincos
) (M_PI_2
, &sin_res
, &cos_res
);
1770 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res
, 1);
1772 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res
, 0,
1773 CHOOSE (1e-18L, 1e-16, 1e-7));
1775 FUNC(sincos
) (M_PI
/ 6.0, &sin_res
, &cos_res
);
1776 check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res
, 0.5,
1777 CHOOSE (5e-18L, 0, 0));
1779 FUNC(sincos
) (M_PI
/ 3.0, &sin_res
, &cos_res
);
1780 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res
, 0.5,
1781 CHOOSE (5e-18L, 1e-15, 1e-7));
1790 check ("tan (+0) == +0", FUNC(tan
) (0), 0);
1791 check ("tan (-0) == -0", FUNC(tan
) (minus_zero
), minus_zero
);
1792 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1793 FUNC(tan
) (plus_infty
), INVALID_EXCEPTION
);
1794 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1795 FUNC(tan
) (minus_infty
), INVALID_EXCEPTION
);
1797 check_eps ("tan (pi/4) == 1", FUNC(tan
) (M_PI_4
), 1,
1798 CHOOSE (2e-18L, 1e-15L, 0));
1805 check ("tanh (+0) == +0", FUNC(tanh
) (0), 0);
1807 check ("tanh (-0) == -0", FUNC(tanh
) (minus_zero
), minus_zero
);
1809 check ("tanh (+inf) == +1", FUNC(tanh
) (plus_infty
), 1);
1810 check ("tanh (-inf) == -1", FUNC(tanh
) (minus_infty
), -1);
1818 check ("fabs (+0) == +0", FUNC(fabs
) (0), 0);
1819 check ("fabs (-0) == +0", FUNC(fabs
) (minus_zero
), 0);
1821 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs
) (plus_infty
));
1822 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs
) (minus_infty
));
1824 check ("fabs (+38) == 38", FUNC(fabs
) (38.0), 38.0);
1825 check ("fabs (-e) == e", FUNC(fabs
) (-M_E
), M_E
);
1832 check ("floor (+0) == +0", FUNC(floor
) (0.0), 0.0);
1833 check ("floor (-0) == -0", FUNC(floor
) (minus_zero
), minus_zero
);
1834 check_isinfp ("floor (+inf) == +inf", FUNC(floor
) (plus_infty
));
1835 check_isinfn ("floor (-inf) == -inf", FUNC(floor
) (minus_infty
));
1837 check ("floor (pi) == 3", FUNC(floor
) (M_PI
), 3.0);
1838 check ("floor (-pi) == -4", FUNC(floor
) (-M_PI
), -4.0);
1847 a
= random_greater (0);
1848 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot
) (plus_infty
, a
), a
);
1849 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot
) (minus_infty
, a
), a
);
1852 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1853 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1856 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot
) (nan_value
, nan_value
));
1858 a
= FUNC(hypot
) (12.4L, 0.7L);
1859 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot
) (0.7L, 12.4L), a
);
1860 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot
) (-12.4L, 0.7L), a
);
1861 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot
) (-0.7L, 12.4L), a
);
1862 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot
) (-12.4L, -0.7L), a
);
1863 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot
) (-0.7L, -12.4L), a
);
1864 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-0.7L, 0), 0.7L);
1865 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (0.7L, 0), 0.7L);
1866 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-1.0L, 0), 1.0L);
1867 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (1.0L, 0), 1.0L);
1868 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-5.7e7L
, 0), 5.7e7L
);
1869 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (5.7e7L
, 0), 5.7e7L
);
1878 check ("pow (+0, +0) == 1", FUNC(pow
) (0, 0), 1);
1879 check ("pow (+0, -0) == 1", FUNC(pow
) (0, minus_zero
), 1);
1880 check ("pow (-0, +0) == 1", FUNC(pow
) (minus_zero
, 0), 1);
1881 check ("pow (-0, -0) == 1", FUNC(pow
) (minus_zero
, minus_zero
), 1);
1883 check ("pow (+10, +0) == 1", FUNC(pow
) (10, 0), 1);
1884 check ("pow (+10, -0) == 1", FUNC(pow
) (10, minus_zero
), 1);
1885 check ("pow (-10, +0) == 1", FUNC(pow
) (-10, 0), 1);
1886 check ("pow (-10, -0) == 1", FUNC(pow
) (-10, minus_zero
), 1);
1888 check ("pow (NaN, +0) == 1", FUNC(pow
) (nan_value
, 0), 1);
1889 check ("pow (NaN, -0) == 1", FUNC(pow
) (nan_value
, minus_zero
), 1);
1892 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow
) (1.1, plus_infty
));
1893 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow
) (plus_infty
, plus_infty
));
1894 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow
) (-1.1, plus_infty
));
1895 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow
) (minus_infty
, plus_infty
));
1897 check ("pow (0.9, +inf) == +0", FUNC(pow
) (0.9L, plus_infty
), 0);
1898 check ("pow (1e-7, +inf) == +0", FUNC(pow
) (1e-7L, plus_infty
), 0);
1899 check ("pow (-0.9, +inf) == +0", FUNC(pow
) (-0.9L, plus_infty
), 0);
1900 check ("pow (-1e-7, +inf) == +0", FUNC(pow
) (-1e-7L, plus_infty
), 0);
1902 check ("pow (+1.1, -inf) == 0", FUNC(pow
) (1.1, minus_infty
), 0);
1903 check ("pow (+inf, -inf) == 0", FUNC(pow
) (plus_infty
, minus_infty
), 0);
1904 check ("pow (-1.1, -inf) == 0", FUNC(pow
) (-1.1, minus_infty
), 0);
1905 check ("pow (-inf, -inf) == 0", FUNC(pow
) (minus_infty
, minus_infty
), 0);
1907 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow
) (0.9L, minus_infty
));
1908 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow
) (1e-7L, minus_infty
));
1909 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow
) (-0.9L, minus_infty
));
1910 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow
) (-1e-7L, minus_infty
));
1912 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow
) (plus_infty
, 1e-7L));
1913 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow
) (plus_infty
, 1));
1914 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow
) (plus_infty
, 1e7L
));
1916 check ("pow (+inf, -1e-7) == 0", FUNC(pow
) (plus_infty
, -1e-7L), 0);
1917 check ("pow (+inf, -1) == 0", FUNC(pow
) (plus_infty
, -1), 0);
1918 check ("pow (+inf, -1e7) == 0", FUNC(pow
) (plus_infty
, -1e7L
), 0);
1920 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow
) (minus_infty
, 1));
1921 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow
) (minus_infty
, 11));
1922 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow
) (minus_infty
, 1001));
1924 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow
) (minus_infty
, 2));
1925 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow
) (minus_infty
, 12));
1926 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow
) (minus_infty
, 1002));
1927 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow
) (minus_infty
, 0.1));
1928 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow
) (minus_infty
, 1.1));
1929 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow
) (minus_infty
, 11.1));
1930 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow
) (minus_infty
, 1001.1));
1932 check ("pow (-inf, -1) == -0", FUNC(pow
) (minus_infty
, -1), minus_zero
);
1933 check ("pow (-inf, -11) == -0", FUNC(pow
) (minus_infty
, -11), minus_zero
);
1934 check ("pow (-inf, -1001) == -0", FUNC(pow
) (minus_infty
, -1001), minus_zero
);
1936 check ("pow (-inf, -2) == +0", FUNC(pow
) (minus_infty
, -2), 0);
1937 check ("pow (-inf, -12) == +0", FUNC(pow
) (minus_infty
, -12), 0);
1938 check ("pow (-inf, -1002) == +0", FUNC(pow
) (minus_infty
, -1002), 0);
1939 check ("pow (-inf, -0.1) == +0", FUNC(pow
) (minus_infty
, -0.1), 0);
1940 check ("pow (-inf, -1.1) == +0", FUNC(pow
) (minus_infty
, -1.1), 0);
1941 check ("pow (-inf, -11.1) == +0", FUNC(pow
) (minus_infty
, -11.1), 0);
1942 check ("pow (-inf, -1001.1) == +0", FUNC(pow
) (minus_infty
, -1001.1), 0);
1944 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow
) (nan_value
, nan_value
));
1945 check_isnan ("pow (0, NaN) == NaN", FUNC(pow
) (0, nan_value
));
1946 check_isnan ("pow (1, NaN) == NaN", FUNC(pow
) (1, nan_value
));
1947 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow
) (-1, nan_value
));
1948 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow
) (nan_value
, 1));
1949 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow
) (nan_value
, -1));
1951 x
= random_greater (0.0);
1952 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow
) (x
, nan_value
), x
);
1954 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
1955 FUNC(pow
) (1, plus_infty
), INVALID_EXCEPTION
);
1956 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
1957 FUNC(pow
) (-1, plus_infty
), INVALID_EXCEPTION
);
1958 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
1959 FUNC(pow
) (1, minus_infty
), INVALID_EXCEPTION
);
1960 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
1961 FUNC(pow
) (-1, minus_infty
), INVALID_EXCEPTION
);
1963 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
1964 FUNC(pow
) (-0.1, 1.1), INVALID_EXCEPTION
);
1965 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
1966 FUNC(pow
) (-0.1, -1.1), INVALID_EXCEPTION
);
1967 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
1968 FUNC(pow
) (-10.1, 1.1), INVALID_EXCEPTION
);
1969 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
1970 FUNC(pow
) (-10.1, -1.1), INVALID_EXCEPTION
);
1972 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
1973 FUNC(pow
) (0, -1), DIVIDE_BY_ZERO_EXCEPTION
);
1974 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
1975 FUNC(pow
) (0, -11), DIVIDE_BY_ZERO_EXCEPTION
);
1976 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
1977 FUNC(pow
) (minus_zero
, -1), DIVIDE_BY_ZERO_EXCEPTION
);
1978 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
1979 FUNC(pow
) (minus_zero
, -11), DIVIDE_BY_ZERO_EXCEPTION
);
1981 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
1982 FUNC(pow
) (0, -2), DIVIDE_BY_ZERO_EXCEPTION
);
1983 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
1984 FUNC(pow
) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
1985 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
1986 FUNC(pow
) (minus_zero
, -2), DIVIDE_BY_ZERO_EXCEPTION
);
1987 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
1988 FUNC(pow
) (minus_zero
, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
1991 check ("pow (+0, 1) == +0", FUNC(pow
) (0, 1), 0);
1992 check ("pow (+0, 11) == +0", FUNC(pow
) (0, 11), 0);
1994 check ("pow (-0, 1) == -0", FUNC(pow
) (minus_zero
, 1), minus_zero
);
1995 check ("pow (-0, 11) == -0", FUNC(pow
) (minus_zero
, 11), minus_zero
);
1998 check ("pow (+0, 2) == +0", FUNC(pow
) (0, 2), 0);
1999 check ("pow (+0, 11.1) == +0", FUNC(pow
) (0, 11.1), 0);
2002 check ("pow (-0, 2) == +0", FUNC(pow
) (minus_zero
, 2), 0);
2003 check ("pow (-0, 11.1) == +0", FUNC(pow
) (minus_zero
, 11.1), 0);
2005 x
= random_greater (1.0);
2006 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
2007 FUNC(pow
) (x
, plus_infty
), x
);
2009 x
= random_value (-1.0, 1.0);
2010 check_ext ("pow (x, +inf) == +0 for |x| < 1",
2011 FUNC(pow
) (x
, plus_infty
), 0.0, x
);
2013 x
= random_greater (1.0);
2014 check_ext ("pow (x, -inf) == +0 for |x| > 1",
2015 FUNC(pow
) (x
, minus_infty
), 0.0, x
);
2017 x
= random_value (-1.0, 1.0);
2018 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
2019 FUNC(pow
) (x
, minus_infty
), x
);
2021 x
= random_greater (0.0);
2022 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
2023 FUNC(pow
) (plus_infty
, x
), x
);
2025 x
= random_less (0.0);
2026 check_ext ("pow (+inf, y) == +0 for y < 0",
2027 FUNC(pow
) (plus_infty
, x
), 0.0, x
);
2029 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2030 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
2031 FUNC(pow
) (minus_infty
, x
), x
);
2033 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2034 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
2035 FUNC(pow
) (minus_infty
, x
), x
);
2037 x
= -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
2038 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
2039 FUNC(pow
) (minus_infty
, x
), minus_zero
, x
);
2041 x
= ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
2042 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
2043 FUNC(pow
) (minus_infty
, x
), 0.0, x
);
2046 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2047 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
2048 FUNC(pow
) (0.0, x
), 0.0, x
);
2050 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2051 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
2052 FUNC(pow
) (minus_zero
, x
), minus_zero
, x
);
2055 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2056 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
2057 FUNC(pow
) (0.0, x
), 0.0, x
);
2059 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2060 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
2061 FUNC(pow
) (minus_zero
, x
), 0.0, x
);
2068 check ("fdim (+0, +0) = +0", FUNC(fdim
) (0, 0), 0);
2069 check ("fdim (9, 0) = 9", FUNC(fdim
) (9, 0), 9);
2070 check ("fdim (0, 9) = 0", FUNC(fdim
) (0, 9), 0);
2071 check ("fdim (-9, 0) = 9", FUNC(fdim
) (-9, 0), 0);
2072 check ("fdim (0, -9) = 9", FUNC(fdim
) (0, -9), 9);
2074 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim
) (plus_infty
, 9));
2075 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim
) (plus_infty
, -9));
2076 check ("fdim (-inf, 9) = 0", FUNC(fdim
) (minus_infty
, 9), 0);
2077 check ("fdim (-inf, -9) = 0", FUNC(fdim
) (minus_infty
, -9), 0);
2078 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim
) (9, minus_infty
));
2079 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim
) (-9, minus_infty
));
2080 check ("fdim (9, inf) = 0", FUNC(fdim
) (9, plus_infty
), 0);
2081 check ("fdim (-9, inf) = 0", FUNC(fdim
) (-9, plus_infty
), 0);
2083 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim
) (0, nan_value
));
2084 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim
) (9, nan_value
));
2085 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim
) (-9, nan_value
));
2086 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim
) (nan_value
, 9));
2087 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim
) (nan_value
, -9));
2088 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim
) (plus_infty
, nan_value
));
2089 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim
) (minus_infty
, nan_value
));
2090 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim
) (nan_value
, plus_infty
));
2091 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim
) (nan_value
, minus_infty
));
2092 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim
) (nan_value
, nan_value
));
2099 check ("fmin (+0, +0) = +0", FUNC(fmin
) (0, 0), 0);
2100 check ("fmin (9, 0) = 0", FUNC(fmin
) (9, 0), 0);
2101 check ("fmin (0, 9) = 0", FUNC(fmin
) (0, 9), 0);
2102 check ("fmin (-9, 0) = -9", FUNC(fmin
) (-9, 0), -9);
2103 check ("fmin (0, -9) = -9", FUNC(fmin
) (0, -9), -9);
2105 check ("fmin (+inf, 9) = 9", FUNC(fmin
) (plus_infty
, 9), 9);
2106 check ("fmin (9, +inf) = 9", FUNC(fmin
) (9, plus_infty
), 9);
2107 check ("fmin (+inf, -9) = -9", FUNC(fmin
) (plus_infty
, -9), -9);
2108 check ("fmin (-9, +inf) = -9", FUNC(fmin
) (-9, plus_infty
), -9);
2109 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin
) (minus_infty
, 9));
2110 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin
) (minus_infty
, -9));
2111 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin
) (9, minus_infty
));
2112 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin
) (-9, minus_infty
));
2114 check ("fmin (0, NaN) = 0", FUNC(fmin
) (0, nan_value
), 0);
2115 check ("fmin (9, NaN) = 9", FUNC(fmin
) (9, nan_value
), 9);
2116 check ("fmin (-9, NaN) = 9", FUNC(fmin
) (-9, nan_value
), -9);
2117 check ("fmin (NaN, 0) = 0", FUNC(fmin
) (nan_value
, 0), 0);
2118 check ("fmin (NaN, 9) = NaN", FUNC(fmin
) (nan_value
, 9), 9);
2119 check ("fmin (NaN, -9) = NaN", FUNC(fmin
) (nan_value
, -9), -9);
2120 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin
) (plus_infty
, nan_value
));
2121 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin
) (minus_infty
, nan_value
));
2122 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin
) (nan_value
, plus_infty
));
2123 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin
) (nan_value
, minus_infty
));
2124 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin
) (nan_value
, nan_value
));
2131 check ("fmax (+0, +0) = +0", FUNC(fmax
) (0, 0), 0);
2132 check ("fmax (9, 0) = 9", FUNC(fmax
) (9, 0), 9);
2133 check ("fmax (0, 9) = 9", FUNC(fmax
) (0, 9), 9);
2134 check ("fmax (-9, 0) = 0", FUNC(fmax
) (-9, 0), 0);
2135 check ("fmax (0, -9) = 0", FUNC(fmax
) (0, -9), 0);
2137 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax
) (plus_infty
, 9));
2138 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax
) (0, plus_infty
));
2139 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax
) (-9, plus_infty
));
2140 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax
) (plus_infty
, -9));
2141 check ("fmax (-inf, 9) = 9", FUNC(fmax
) (minus_infty
, 9), 9);
2142 check ("fmax (-inf, -9) = -9", FUNC(fmax
) (minus_infty
, -9), -9);
2143 check ("fmax (+9, -inf) = 9", FUNC(fmax
) (9, minus_infty
), 9);
2144 check ("fmax (-9, -inf) = -9", FUNC(fmax
) (-9, minus_infty
), -9);
2146 check ("fmax (0, NaN) = 0", FUNC(fmax
) (0, nan_value
), 0);
2147 check ("fmax (9, NaN) = 9", FUNC(fmax
) (9, nan_value
), 9);
2148 check ("fmax (-9, NaN) = 9", FUNC(fmax
) (-9, nan_value
), -9);
2149 check ("fmax (NaN, 0) = 0", FUNC(fmax
) (nan_value
, 0), 0);
2150 check ("fmax (NaN, 9) = NaN", FUNC(fmax
) (nan_value
, 9), 9);
2151 check ("fmax (NaN, -9) = NaN", FUNC(fmax
) (nan_value
, -9), -9);
2152 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax
) (plus_infty
, nan_value
));
2153 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax
) (minus_infty
, nan_value
));
2154 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax
) (nan_value
, plus_infty
));
2155 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax
) (nan_value
, minus_infty
));
2156 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax
) (nan_value
, nan_value
));
2165 x
= random_greater (0);
2166 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod
) (0, x
), 0, x
);
2168 x
= random_greater (0);
2169 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod
) (minus_zero
, x
),
2172 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2173 FUNC(fmod
) (plus_infty
, x
), INVALID_EXCEPTION
, x
);
2174 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2175 FUNC(fmod
) (minus_infty
, x
), INVALID_EXCEPTION
, x
);
2176 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2177 FUNC(fmod
) (x
, 0), INVALID_EXCEPTION
, x
);
2178 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2179 FUNC(fmod
) (x
, minus_zero
), INVALID_EXCEPTION
, x
);
2181 x
= random_greater (0);
2182 check_ext ("fmod (x, +inf) == x for x not infinite",
2183 FUNC(fmod
) (x
, plus_infty
), x
, x
);
2184 x
= random_greater (0);
2185 check_ext ("fmod (x, -inf) == x for x not infinite",
2186 FUNC(fmod
) (x
, minus_infty
), x
, x
);
2188 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod
) (6.5, 2.3), 1.9,
2189 CHOOSE(5e-16, 1e-15, 2e-7));
2190 check_eps ("fmod (-6.5, 2.3) == -1.9", FUNC(fmod
) (-6.5, 2.3), -1.9,
2191 CHOOSE(5e-16, 1e-15, 2e-7));
2192 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod
) (6.5, -2.3), 1.9,
2193 CHOOSE(5e-16, 1e-15, 2e-7));
2194 check_eps ("fmod (-6.5, -2.3) == -1.9", FUNC(fmod
) (-6.5, -2.3), -1.9,
2195 CHOOSE(5e-16, 1e-15, 2e-7));
2202 nextafter_test (void)
2206 check ("nextafter (+0, +0) = +0", FUNC(nextafter
) (0, 0), 0);
2207 check ("nextafter (-0, +0) = +0", FUNC(nextafter
) (minus_zero
, 0), 0);
2208 check ("nextafter (+0, -0) = -0", FUNC(nextafter
) (0, minus_zero
),
2210 check ("nextafter (-0, -0) = -0", FUNC(nextafter
) (minus_zero
, minus_zero
),
2213 check ("nextafter (9, 9) = 9", FUNC(nextafter
) (9, 9), 9);
2214 check ("nextafter (-9, -9) = -9", FUNC(nextafter
) (-9, -9), -9);
2215 check_isinfp ("nextafter (+inf, +inf) = +inf",
2216 FUNC(nextafter
) (plus_infty
, plus_infty
));
2217 check_isinfn ("nextafter (-inf, -inf) = -inf",
2218 FUNC(nextafter
) (minus_infty
, minus_infty
));
2221 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter
) (nan_value
, x
));
2222 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter
) (x
, nan_value
));
2223 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter
) (nan_value
,
2226 /* XXX We need the hexadecimal FP number representation here for further
2232 copysign_test (void)
2234 check ("copysign (0, 4) = 0", FUNC(copysign
) (0, 4), 0);
2235 check ("copysign (0, -4) = -0", FUNC(copysign
) (0, -4), minus_zero
);
2236 check ("copysign (-0, 4) = 0", FUNC(copysign
) (minus_zero
, 4), 0);
2237 check ("copysign (-0, -4) = -0", FUNC(copysign
) (minus_zero
, -4),
2240 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign
) (plus_infty
, 0));
2241 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign
) (plus_infty
,
2243 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign
) (minus_infty
, 0));
2244 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign
) (minus_infty
,
2247 check ("copysign (0, +inf) = 0", FUNC(copysign
) (0, plus_infty
), 0);
2248 check ("copysign (0, -inf) = -0", FUNC(copysign
) (0, minus_zero
),
2250 check ("copysign (-0, +inf) = 0", FUNC(copysign
) (minus_zero
, plus_infty
),
2252 check ("copysign (-0, -inf) = -0", FUNC(copysign
) (minus_zero
, minus_zero
),
2255 /* XXX More correctly we would have to check the sign of the NaN. */
2256 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign
) (nan_value
, 0));
2257 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign
) (nan_value
,
2259 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign
) (-nan_value
, 0));
2260 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign
) (-nan_value
,
2268 check ("trunc(0) = 0", FUNC(trunc
) (0), 0);
2269 check ("trunc(-0) = -0", FUNC(trunc
) (minus_zero
), minus_zero
);
2270 check ("trunc(0.625) = 0", FUNC(trunc
) (0.625), 0);
2271 check ("trunc(-0.625) = -0", FUNC(trunc
) (-0.625), minus_zero
);
2272 check ("trunc(1) = 1", FUNC(trunc
) (1), 1);
2273 check ("trunc(-1) = -1", FUNC(trunc
) (-1), -1);
2274 check ("trunc(1.625) = 1", FUNC(trunc
) (1.625), 1);
2275 check ("trunc(-1.625) = -1", FUNC(trunc
) (-1.625), -1);
2277 check ("trunc(1048580.625) = 1048580", FUNC(trunc
) (1048580.625L),
2279 check ("trunc(-1048580.625) = -1048580", FUNC(trunc
) (-1048580.625L),
2282 check ("trunc(8388610.125) = 8388610", FUNC(trunc
) (8388610.125L),
2284 check ("trunc(-8388610.125) = -8388610", FUNC(trunc
) (-8388610.125L),
2287 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc
) (4294967296.625L),
2289 check ("trunc(-4294967296.625) = -4294967296",
2290 FUNC(trunc
) (-4294967296.625L), -4294967296.0L);
2292 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc
) (plus_infty
));
2293 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc
) (minus_infty
));
2294 check_isnan ("trunc(NaN) = NaN", FUNC(trunc
) (nan_value
));
2304 /* XXX Tests fuer negative x are missing */
2305 check ("sqrt (0) == 0", FUNC(sqrt
) (0), 0);
2306 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt
) (nan_value
));
2307 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt
) (plus_infty
));
2309 check ("sqrt (-0) == -0", FUNC(sqrt
) (0), 0);
2311 x
= random_less (0.0);
2312 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2313 FUNC(sqrt
) (x
), INVALID_EXCEPTION
, x
);
2315 x
= random_value (0, 10000);
2316 check_ext ("sqrt (x*x) == x", FUNC(sqrt
) (x
*x
), x
, x
);
2317 check ("sqrt (4) == 2", FUNC(sqrt
) (4), 2);
2322 remainder_test (void)
2326 result
= FUNC(remainder
) (1, 0);
2327 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2328 result
, INVALID_EXCEPTION
);
2330 result
= FUNC(remainder
) (1, minus_zero
);
2331 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2332 result
, INVALID_EXCEPTION
);
2334 result
= FUNC(remainder
) (plus_infty
, 1);
2335 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2336 result
, INVALID_EXCEPTION
);
2338 result
= FUNC(remainder
) (minus_infty
, 1);
2339 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2340 result
, INVALID_EXCEPTION
);
2342 result
= FUNC(remainder
) (1.625, 1.0);
2343 check ("remainder(1.625, 1.0) == -0.375", result
, -0.375);
2345 result
= FUNC(remainder
) (-1.625, 1.0);
2346 check ("remainder(-1.625, 1.0) == 0.375", result
, 0.375);
2348 result
= FUNC(remainder
) (1.625, -1.0);
2349 check ("remainder(1.625, -1.0) == -0.375", result
, -0.375);
2351 result
= FUNC(remainder
) (-1.625, -1.0);
2352 check ("remainder(-1.625, -1.0) == 0.375", result
, 0.375);
2354 result
= FUNC(remainder
) (5.0, 2.0);
2355 check ("remainder(5.0, 2.0) == 1.0", result
, 1.0);
2357 result
= FUNC(remainder
) (3.0, 2.0);
2358 check ("remainder(3.0, 2.0) == -1.0", result
, -1.0);
2368 result
= FUNC(remquo
) (1, 0, &quo
);
2369 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2370 result
, INVALID_EXCEPTION
);
2372 result
= FUNC(remquo
) (1, minus_zero
, &quo
);
2373 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2374 result
, INVALID_EXCEPTION
);
2376 result
= FUNC(remquo
) (plus_infty
, 1, &quo
);
2377 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2378 result
, INVALID_EXCEPTION
);
2380 result
= FUNC(remquo
) (minus_infty
, 1, &quo
);
2381 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2382 result
, INVALID_EXCEPTION
);
2384 result
= FUNC(remquo
) (1.625, 1.0, &quo
);
2385 check ("remquo(1.625, 1.0, &x) == -0.375", result
, -0.375);
2386 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo
, 2);
2388 result
= FUNC(remquo
) (-1.625, 1.0, &quo
);
2389 check ("remquo(-1.625, 1.0, &x) == 0.375", result
, 0.375);
2390 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo
, -2);
2392 result
= FUNC(remquo
) (1.625, -1.0, &quo
);
2393 check ("remquo(1.625, -1.0, &x) == -0.375", result
, -0.375);
2394 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo
, -2);
2396 result
= FUNC(remquo
) (-1.625, -1.0, &quo
);
2397 check ("remquo(-1.625, -1.0, &x) == 0.375", result
, 0.375);
2398 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo
, 2);
2400 result
= FUNC(remquo
) (5.0, 2.0, &quo
);
2401 check ("remquo(5.0, 2.0, &x) == 1.0", result
, 1.0);
2402 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo
, 2);
2404 result
= FUNC(remquo
) (3.0, 2.0, &quo
);
2405 check ("remquo(3.0, 2.0, &x) == -1.0", result
, -1.0);
2406 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo
, 2);
2413 __complex__ MATHTYPE result
;
2415 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, plus_zero
));
2416 check ("real(cexp(0 + 0i)) = 1", __real__ result
, 1);
2417 check ("imag(cexp(0 + 0i)) = 0", __imag__ result
, 0);
2418 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_zero
));
2419 check ("real(cexp(-0 + 0i)) = 1", __real__ result
, 1);
2420 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result
, 0);
2421 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, minus_zero
));
2422 check ("real(cexp(0 - 0i)) = 1", __real__ result
, 1);
2423 check ("imag(cexp(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2424 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2425 check ("real(cexp(-0 - 0i)) = 1", __real__ result
, 1);
2426 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2428 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_zero
));
2429 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result
);
2430 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result
, 0);
2431 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2432 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result
);
2433 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result
, minus_zero
);
2435 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_zero
));
2436 check ("real(cexp(-inf + 0i)) = 0", __real__ result
, 0);
2437 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result
, 0);
2438 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2439 check ("real(cexp(-inf - 0i)) = 0", __real__ result
, 0);
2440 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result
, minus_zero
);
2443 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, plus_infty
));
2444 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2445 __real__ result
, INVALID_EXCEPTION
);
2446 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2449 #if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR <= 7
2451 printf ("The following test for cexp might fail due to a gcc compiler error!\n");
2454 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2455 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2456 __real__ result
, INVALID_EXCEPTION
);
2457 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2459 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, minus_infty
));
2460 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2461 __real__ result
, INVALID_EXCEPTION
);
2462 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2464 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2465 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2466 __real__ result
, INVALID_EXCEPTION
);
2467 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2470 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, plus_infty
));
2471 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2472 __real__ result
, INVALID_EXCEPTION
);
2473 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2475 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, plus_infty
));
2476 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2477 __real__ result
, INVALID_EXCEPTION
);
2478 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2480 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, minus_infty
));
2481 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2482 __real__ result
, INVALID_EXCEPTION
);
2483 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2485 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, minus_infty
));
2486 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2487 __real__ result
, INVALID_EXCEPTION
);
2488 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result
);
2490 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 2.0));
2491 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result
, minus_zero
);
2492 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result
, 0);
2493 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 4.0));
2494 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result
, minus_zero
);
2495 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result
, minus_zero
);
2497 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 2.0));
2498 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result
);
2499 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result
);
2500 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 4.0));
2501 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result
);
2502 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result
);
2504 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2505 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2506 __real__ result
, INVALID_EXCEPTION
);
2507 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2509 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2510 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2511 __real__ result
, INVALID_EXCEPTION
);
2512 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2515 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2516 check ("real(cexp(-inf + i inf)) = 0", __real__ result
, 0);
2517 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result
, 0);
2518 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2519 check ("real(cexp(-inf - i inf)) = 0", __real__ result
, 0);
2520 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result
, minus_zero
);
2522 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2523 check ("real(cexp(-inf + i NaN)) = 0", __real__ result
, 0);
2524 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result
), 0);
2526 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2527 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result
);
2528 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result
);
2530 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 0.0));
2531 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2532 __real__ result
, INVALID_EXCEPTION
);
2533 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2535 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 1.0));
2536 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2537 __real__ result
, INVALID_EXCEPTION
);
2538 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2540 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2541 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2542 __real__ result
, INVALID_EXCEPTION
);
2543 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2546 result
= FUNC(cexp
) (BUILD_COMPLEX (0, nan_value
));
2547 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2548 __real__ result
, INVALID_EXCEPTION
);
2549 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2551 result
= FUNC(cexp
) (BUILD_COMPLEX (1, nan_value
));
2552 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2553 __real__ result
, INVALID_EXCEPTION
);
2554 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2557 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, nan_value
));
2558 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result
);
2559 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result
);
2566 __complex__ MATHTYPE result
;
2568 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, 0.0));
2569 check ("real(csin(0 + 0i)) = 0", __real__ result
, 0);
2570 check ("imag(csin(0 + 0i)) = 0", __imag__ result
, 0);
2571 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, 0.0));
2572 check ("real(csin(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2573 check ("imag(csin(-0 + 0i)) = 0", __imag__ result
, 0);
2574 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_zero
));
2575 check ("real(csin(0 - 0i)) = 0", __real__ result
, 0);
2576 check ("imag(csin(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2577 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2578 check ("real(csin(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2579 check ("imag(csin(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2581 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, plus_infty
));
2582 check ("real(csin(0 + i Inf)) = 0", __real__ result
, 0);
2583 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result
);
2584 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2585 check ("real(csin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
2586 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result
);
2587 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_infty
));
2588 check ("real(csin(0 - i Inf)) = 0", __real__ result
, 0);
2589 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result
);
2590 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2591 check ("real(csin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
2592 check_isinfn("imag(csin(-0 - i Inf)) = -Inf", __imag__ result
);
2594 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 0.0));
2595 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2596 __real__ result
, INVALID_EXCEPTION
);
2597 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2598 FUNC(fabs
) (__imag__ result
), 0);
2599 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 0.0));
2600 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2601 __real__ result
, INVALID_EXCEPTION
);
2602 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2603 FUNC(fabs
) (__imag__ result
), 0);
2604 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2605 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2606 __real__ result
, INVALID_EXCEPTION
);
2607 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2608 FUNC(fabs
) (__imag__ result
), 0.0);
2609 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2610 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2611 __real__ result
, INVALID_EXCEPTION
);
2612 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2613 FUNC(fabs
) (__imag__ result
), 0.0);
2615 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2616 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2617 __real__ result
, INVALID_EXCEPTION
);
2618 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2619 FUNC(fabs
) (__imag__ result
));
2620 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2621 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2622 __real__ result
, INVALID_EXCEPTION
);
2623 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2624 FUNC(fabs
) (__imag__ result
));
2625 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2626 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2627 __real__ result
, INVALID_EXCEPTION
);
2628 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2629 FUNC(fabs
) (__imag__ result
));
2630 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2631 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2632 __real__ result
, INVALID_EXCEPTION
);
2633 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2634 FUNC(fabs
) (__imag__ result
));
2636 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 6.75));
2637 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2638 __real__ result
, INVALID_EXCEPTION
);
2639 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2641 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, -6.75));
2642 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2643 __real__ result
, INVALID_EXCEPTION
);
2644 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2646 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 6.75));
2647 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2648 __real__ result
, INVALID_EXCEPTION
);
2649 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2651 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, -6.75));
2652 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2653 __real__ result
, INVALID_EXCEPTION
);
2654 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2657 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, plus_infty
));
2658 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result
);
2659 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result
);
2660 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, minus_infty
));
2661 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result
);
2662 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result
);
2663 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, plus_infty
));
2664 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result
);
2665 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result
);
2666 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, minus_infty
));
2667 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result
);
2668 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result
);
2670 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 0.0));
2671 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result
);
2672 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2673 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2674 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result
);
2675 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2677 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2678 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result
);
2679 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2680 FUNC(fabs
) (__imag__ result
));
2681 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2682 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result
);
2683 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2684 FUNC(fabs
) (__imag__ result
));
2686 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 9.0));
2687 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2688 __real__ result
, INVALID_EXCEPTION
);
2689 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2691 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -9.0));
2692 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2693 __real__ result
, INVALID_EXCEPTION
);
2694 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2697 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, nan_value
));
2698 check ("real(csin(0 + i NaN))", __real__ result
, 0.0);
2699 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result
);
2700 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2701 check ("real(csin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
2702 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result
);
2704 result
= FUNC(csin
) (BUILD_COMPLEX (10.0, nan_value
));
2705 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2706 __real__ result
, INVALID_EXCEPTION
);
2707 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2709 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -10.0));
2710 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2711 __real__ result
, INVALID_EXCEPTION
);
2712 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2715 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2716 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2717 __real__ result
, INVALID_EXCEPTION
);
2718 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2720 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2721 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2722 __real__ result
, INVALID_EXCEPTION
);
2723 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2726 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, nan_value
));
2727 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result
);
2728 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result
);
2735 __complex__ MATHTYPE result
;
2737 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, 0.0));
2738 check ("real(csinh(0 + 0i)) = 0", __real__ result
, 0);
2739 check ("imag(csinh(0 + 0i)) = 0", __imag__ result
, 0);
2740 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, 0.0));
2741 check ("real(csinh(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2742 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result
, 0);
2743 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_zero
));
2744 check ("real(csinh(0 - 0i)) = 0", __real__ result
, 0);
2745 check ("imag(csinh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2746 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2747 check ("real(csinh(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2748 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2750 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, plus_infty
));
2751 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2752 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2753 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2755 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2756 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2757 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2758 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2760 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_infty
));
2761 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2762 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2763 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2765 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2766 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2767 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2768 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2771 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 0.0));
2772 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result
);
2773 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result
, 0);
2774 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 0.0));
2775 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result
);
2776 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result
, 0);
2777 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2778 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result
);
2779 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2780 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2781 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result
);
2782 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2784 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2785 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2786 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2787 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2789 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2790 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2791 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2792 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2794 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2795 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2796 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2797 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2799 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2800 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2801 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2802 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2805 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 4.625));
2806 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result
);
2807 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result
);
2808 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 4.625));
2809 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result
);
2810 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result
);
2811 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, -4.625));
2812 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result
);
2813 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result
);
2814 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, -4.625));
2815 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result
);
2816 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result
);
2818 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, plus_infty
));
2819 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2820 __real__ result
, INVALID_EXCEPTION
);
2821 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2823 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, plus_infty
));
2824 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2825 __real__ result
, INVALID_EXCEPTION
);
2826 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2828 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, minus_infty
));
2829 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2830 __real__ result
, INVALID_EXCEPTION
);
2831 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2833 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, minus_infty
));
2834 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2835 __real__ result
, INVALID_EXCEPTION
);
2836 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2839 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, nan_value
));
2840 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
2841 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result
);
2842 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2843 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
2844 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result
);
2846 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2847 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
2848 FUNC(fabs
) (__real__ result
));
2849 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result
);
2850 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2851 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
2852 FUNC(fabs
) (__real__ result
));
2853 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result
);
2855 result
= FUNC(csinh
) (BUILD_COMPLEX (9.0, nan_value
));
2856 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2857 __real__ result
, INVALID_EXCEPTION
);
2858 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2860 result
= FUNC(csinh
) (BUILD_COMPLEX (-9.0, nan_value
));
2861 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2862 __real__ result
, INVALID_EXCEPTION
);
2863 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2866 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 0.0));
2867 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result
);
2868 check ("imag(csinh(NaN + i0)) = 0", __imag__ result
, 0.0);
2869 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2870 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result
);
2871 check ("imag(csinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
2873 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 10.0));
2874 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2875 __real__ result
, INVALID_EXCEPTION
);
2876 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
2878 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, -10.0));
2879 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2880 __real__ result
, INVALID_EXCEPTION
);
2881 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
2884 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2885 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2886 __real__ result
, INVALID_EXCEPTION
);
2887 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
2889 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2890 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2891 __real__ result
, INVALID_EXCEPTION
);
2892 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
2895 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
2896 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result
);
2897 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result
);
2904 __complex__ MATHTYPE result
;
2906 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, 0.0));
2907 check ("real(ccos(0 + 0i)) = 1.0", __real__ result
, 1.0);
2908 check ("imag(ccos(0 + 0i)) = 0", __imag__ result
, 0);
2909 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, 0.0));
2910 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result
, 1.0);
2911 check ("imag(ccos(-0 + 0i)) = -0", __imag__ result
, minus_zero
);
2912 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_zero
));
2913 check ("real(ccos(0 - 0i)) = 1.0", __real__ result
, 1.0);
2914 check ("imag(ccos(0 - 0i)) = 0", __imag__ result
, 0.0);
2915 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2916 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result
, 1.0);
2917 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2919 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 0.0));
2920 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
2921 __real__ result
, INVALID_EXCEPTION
);
2922 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
2923 FUNC(fabs
) (__imag__ result
), 0);
2924 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2925 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
2926 __real__ result
, INVALID_EXCEPTION
);
2927 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
2928 FUNC(fabs
) (__imag__ result
), 0);
2929 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 0.0));
2930 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
2931 __real__ result
, INVALID_EXCEPTION
);
2932 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
2933 FUNC(fabs
) (__imag__ result
), 0);
2934 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2935 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
2936 __real__ result
, INVALID_EXCEPTION
);
2937 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
2938 FUNC(fabs
) (__imag__ result
), 0);
2940 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, plus_infty
));
2941 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result
);
2942 check ("imag(ccos(0 + i Inf)) = 0", __imag__ result
, 0);
2943 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_infty
));
2944 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result
);
2945 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result
, 0);
2946 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2947 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result
);
2948 check ("imag(ccos(-0 + i Inf)) = -0", __imag__ result
, minus_zero
);
2949 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2950 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result
);
2951 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
2953 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2954 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
2955 __real__ result
, INVALID_EXCEPTION
);
2956 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
2958 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2959 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
2960 __real__ result
, INVALID_EXCEPTION
);
2961 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
2963 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2964 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
2965 __real__ result
, INVALID_EXCEPTION
);
2966 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
2968 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2969 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
2970 __real__ result
, INVALID_EXCEPTION
);
2971 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
2974 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, plus_infty
));
2975 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result
);
2976 check_isinfn ("imag(ccos(4.625 + i Inf)) = -Inf", __imag__ result
);
2977 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, minus_infty
));
2978 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result
);
2979 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result
);
2980 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, plus_infty
));
2981 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result
);
2982 check_isinfp ("imag(ccos(-4.625 + i Inf)) = +Inf", __imag__ result
);
2983 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, minus_infty
));
2984 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result
);
2985 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result
);
2987 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 6.75));
2988 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2989 __real__ result
, INVALID_EXCEPTION
);
2990 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
2992 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, -6.75));
2993 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2994 __real__ result
, INVALID_EXCEPTION
);
2995 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
2997 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 6.75));
2998 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
2999 __real__ result
, INVALID_EXCEPTION
);
3000 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3002 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, -6.75));
3003 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3004 __real__ result
, INVALID_EXCEPTION
);
3005 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3008 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 0.0));
3009 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result
);
3010 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3011 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3012 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result
);
3013 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3015 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3016 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result
);
3017 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result
);
3018 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3019 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result
);
3020 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result
);
3022 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 9.0));
3023 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3024 __real__ result
, INVALID_EXCEPTION
);
3025 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3027 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, -9.0));
3028 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3029 __real__ result
, INVALID_EXCEPTION
);
3030 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3033 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, nan_value
));
3034 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result
);
3035 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3036 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3037 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result
);
3038 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3040 result
= FUNC(ccos
) (BUILD_COMPLEX (10.0, nan_value
));
3041 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3042 __real__ result
, INVALID_EXCEPTION
);
3043 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3045 result
= FUNC(ccos
) (BUILD_COMPLEX (-10.0, nan_value
));
3046 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3047 __real__ result
, INVALID_EXCEPTION
);
3048 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3051 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3052 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3053 __real__ result
, INVALID_EXCEPTION
);
3054 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3056 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3057 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3058 __real__ result
, INVALID_EXCEPTION
);
3059 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3062 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, nan_value
));
3063 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result
);
3064 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result
);
3071 __complex__ MATHTYPE result
;
3073 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, 0.0));
3074 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result
, 1.0);
3075 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result
, 0);
3076 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, 0.0));
3077 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result
, 1.0);
3078 check ("imag(ccosh(-0 + 0i)) = 0", __imag__ result
, 0);
3079 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_zero
));
3080 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result
, 1.0);
3081 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
3082 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3083 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result
, 1.0);
3084 check ("imag(ccosh(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
3086 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, plus_infty
));
3087 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
3088 __real__ result
, INVALID_EXCEPTION
);
3089 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
3090 FUNC(fabs
) (__imag__ result
), 0);
3091 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3092 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
3093 __real__ result
, INVALID_EXCEPTION
);
3094 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
3095 FUNC(fabs
) (__imag__ result
), 0);
3096 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_infty
));
3097 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
3098 __real__ result
, INVALID_EXCEPTION
);
3099 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
3100 FUNC(fabs
) (__imag__ result
), 0);
3101 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3102 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
3103 __real__ result
, INVALID_EXCEPTION
);
3104 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
3105 FUNC(fabs
) (__imag__ result
), 0);
3107 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 0.0));
3108 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result
);
3109 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result
, 0);
3110 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 0.0));
3111 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result
);
3112 check ("imag(ccosh(-Inf + 0i)) = 0", __imag__ result
, 0);
3113 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3114 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result
);
3115 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
3116 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3117 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result
);
3118 check ("imag(ccosh(-Inf - 0i)) = -0", __imag__ result
, minus_zero
);
3120 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3121 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
3122 __real__ result
, INVALID_EXCEPTION
);
3123 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
3125 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3126 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
3127 __real__ result
, INVALID_EXCEPTION
);
3128 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
3130 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3131 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
3132 __real__ result
, INVALID_EXCEPTION
);
3133 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
3135 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3136 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
3137 __real__ result
, INVALID_EXCEPTION
);
3138 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3141 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 4.625));
3142 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result
);
3143 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result
);
3144 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 4.625));
3145 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result
);
3146 check_isinfn ("imag(ccosh(-Inf + i4.625)) = -Inf", __imag__ result
);
3147 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, -4.625));
3148 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result
);
3149 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result
);
3150 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, -4.625));
3151 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result
);
3152 check_isinfp ("imag(ccosh(-Inf - i4.625)) = +Inf", __imag__ result
);
3154 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, plus_infty
));
3155 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3156 __real__ result
, INVALID_EXCEPTION
);
3157 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3159 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, plus_infty
));
3160 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3161 __real__ result
, INVALID_EXCEPTION
);
3162 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3164 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, minus_infty
));
3165 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3166 __real__ result
, INVALID_EXCEPTION
);
3167 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3169 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, minus_infty
));
3170 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3171 __real__ result
, INVALID_EXCEPTION
);
3172 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3175 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, nan_value
));
3176 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result
);
3177 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3178 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3179 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result
);
3180 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3182 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3183 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result
);
3184 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result
);
3185 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3186 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result
);
3187 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result
);
3189 result
= FUNC(ccosh
) (BUILD_COMPLEX (9.0, nan_value
));
3190 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3191 __real__ result
, INVALID_EXCEPTION
);
3192 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3194 result
= FUNC(ccosh
) (BUILD_COMPLEX (-9.0, nan_value
));
3195 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3196 __real__ result
, INVALID_EXCEPTION
);
3197 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3200 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 0.0));
3201 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result
);
3202 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3203 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3204 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result
);
3205 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3207 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 10.0));
3208 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3209 __real__ result
, INVALID_EXCEPTION
);
3210 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3212 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, -10.0));
3213 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3214 __real__ result
, INVALID_EXCEPTION
);
3215 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3218 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3219 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3220 __real__ result
, INVALID_EXCEPTION
);
3221 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3223 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3224 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3225 __real__ result
, INVALID_EXCEPTION
);
3226 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3229 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3230 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result
);
3231 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result
);
3238 __complex__ MATHTYPE result
;
3240 result
= FUNC(cacos
) (BUILD_COMPLEX (0, 0));
3241 check ("real(cacos(0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3242 check ("imag(cacos(0 + i0)) = -0", __imag__ result
, minus_zero
);
3243 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, 0));
3244 check ("real(cacos(-0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3245 check ("imag(cacos(-0 + i0)) = -0", __imag__ result
, minus_zero
);
3246 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_zero
));
3247 check ("real(cacos(0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3248 check ("imag(cacos(0 - i0)) = 0", __imag__ result
, 0);
3249 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3250 check ("real(cacos(-0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3251 check ("imag(cacos(-0 - i0)) = 0", __imag__ result
, 0);
3253 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3254 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3255 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result
);
3256 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3257 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3258 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result
);
3260 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3261 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3262 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result
);
3263 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3264 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3265 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result
);
3267 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, plus_infty
));
3268 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3269 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result
);
3270 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, minus_infty
));
3271 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3272 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result
);
3273 result
= FUNC(cacos
) (BUILD_COMPLEX (0, plus_infty
));
3274 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3275 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result
);
3276 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_infty
));
3277 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3278 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result
);
3279 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, plus_infty
));
3280 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3281 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result
);
3282 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, minus_infty
));
3283 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3284 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result
);
3286 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 0));
3287 check ("real(cacos(-Inf + i0)) = pi", __real__ result
, M_PI
);
3288 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result
);
3289 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3290 check ("real(cacos(-Inf - i0)) = pi", __real__ result
, M_PI
);
3291 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result
);
3292 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 100));
3293 check ("real(cacos(-Inf + i100)) = pi", __real__ result
, M_PI
);
3294 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result
);
3295 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, -100));
3296 check ("real(cacos(-Inf - i100)) = pi", __real__ result
, M_PI
);
3297 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result
);
3299 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0));
3300 check ("real(cacos(+Inf + i0)) = 0", __real__ result
, 0);
3301 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result
);
3302 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3303 check ("real(cacos(+Inf - i0)) = 0", __real__ result
, 0);
3304 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result
);
3305 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0.5));
3306 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result
, 0);
3307 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result
);
3308 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, -0.5));
3309 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result
, 0);
3310 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result
);
3312 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3313 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result
);
3314 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3315 FUNC(fabs
) (__imag__ result
));
3316 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3317 check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result
);
3318 check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf",
3319 FUNC(fabs
) (__imag__ result
));
3321 result
= FUNC(cacos
) (BUILD_COMPLEX (0, nan_value
));
3322 check ("real(cacos(0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3323 check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result
);
3324 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3325 check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3326 check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result
);
3328 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3329 check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result
);
3330 check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result
);
3331 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3332 check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result
);
3333 check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result
);
3335 result
= FUNC(cacos
) (BUILD_COMPLEX (10.5, nan_value
));
3336 check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3337 __real__ result
, INVALID_EXCEPTION
);
3338 check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3340 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3341 check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3342 __real__ result
, INVALID_EXCEPTION
);
3343 check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3346 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, 0.75));
3347 check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3348 __real__ result
, INVALID_EXCEPTION
);
3349 check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3351 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3352 check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3353 __real__ result
, INVALID_EXCEPTION
);
3354 check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3357 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, nan_value
));
3358 check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result
);
3359 check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result
);
3366 __complex__ MATHTYPE result
;
3368 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, 0));
3369 check ("real(cacosh(0 + i0)) = 0", __real__ result
, 0);
3370 check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3371 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, 0));
3372 check ("real(cacosh(-0 + i0)) = 0", __real__ result
, 0);
3373 check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3374 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_zero
));
3375 check ("real(cacosh(0 - i0)) = 0", __real__ result
, 0);
3376 check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3377 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3378 check ("real(cacosh(-0 - i0)) = 0", __real__ result
, 0);
3379 check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3381 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3382 check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result
);
3383 check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result
,
3385 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3386 check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result
);
3387 check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result
,
3390 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3391 check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result
);
3392 check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3393 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3394 check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result
);
3395 check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3397 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3398 check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result
);
3399 check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3400 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3401 check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result
);
3402 check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3403 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, plus_infty
));
3404 check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result
);
3405 check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3406 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_infty
));
3407 check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result
);
3408 check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3409 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, plus_infty
));
3410 check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result
);
3411 check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3412 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, minus_infty
));
3413 check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result
);
3414 check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3416 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 0));
3417 check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result
);
3418 check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result
, M_PI
);
3419 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3420 check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result
);
3421 check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
3422 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 100));
3423 check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result
);
3424 check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result
, M_PI
);
3425 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, -100));
3426 check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result
);
3427 check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result
, -M_PI
);
3429 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0));
3430 check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result
);
3431 check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result
, 0);
3432 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3433 check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result
);
3434 check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3435 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3436 check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result
);
3437 check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3438 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3439 check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result
);
3440 check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3442 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3443 check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result
);
3444 check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result
);
3445 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3446 check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result
);
3447 check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result
);
3449 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, nan_value
));
3450 check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result
);
3451 check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result
);
3452 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3453 check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result
);
3454 check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result
);
3456 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3457 check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result
);
3458 check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result
);
3459 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3460 check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result
);
3461 check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result
);
3463 result
= FUNC(cacosh
) (BUILD_COMPLEX (10.5, nan_value
));
3464 check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3465 __real__ result
, INVALID_EXCEPTION
);
3466 check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3468 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3469 check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3470 __real__ result
, INVALID_EXCEPTION
);
3471 check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3474 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, 0.75));
3475 check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3476 __real__ result
, INVALID_EXCEPTION
);
3477 check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3479 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3480 check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3481 __real__ result
, INVALID_EXCEPTION
);
3482 check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3485 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3486 check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result
);
3487 check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result
);
3494 __complex__ MATHTYPE result
;
3496 result
= FUNC(casin
) (BUILD_COMPLEX (0, 0));
3497 check ("real(casin(0 + i0)) = 0", __real__ result
, 0);
3498 check ("imag(casin(0 + i0)) = 0", __imag__ result
, 0);
3499 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, 0));
3500 check ("real(casin(-0 + i0)) = -0", __real__ result
, minus_zero
);
3501 check ("imag(casin(-0 + i0)) = 0", __imag__ result
, 0);
3502 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_zero
));
3503 check ("real(casin(0 - i0)) = 0", __real__ result
, 0);
3504 check ("imag(casin(0 - i0)) = -0", __imag__ result
, minus_zero
);
3505 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3506 check ("real(casin(-0 - i0)) = -0", __real__ result
, minus_zero
);
3507 check ("imag(casin(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3509 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3510 check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3511 check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result
);
3512 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3513 check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3514 check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result
);
3515 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3516 check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3517 check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result
);
3518 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3519 check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3520 check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result
);
3522 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, plus_infty
));
3523 check ("real(casin(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
3524 check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result
);
3525 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, minus_infty
));
3526 check ("real(casin(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
3527 check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result
);
3528 result
= FUNC(casin
) (BUILD_COMPLEX (0, plus_infty
));
3529 check ("real(casin(0 + i Inf)) = 0", __real__ result
, 0.0);
3530 check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result
);
3531 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_infty
));
3532 check ("real(casin(0 - i Inf)) = 0", __real__ result
, 0.0);
3533 check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result
);
3534 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3535 check ("real(casin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
3536 check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result
);
3537 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3538 check ("real(casin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
3539 check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result
);
3540 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, plus_infty
));
3541 check ("real(casin(0.1 + i Inf)) = 0", __real__ result
, 0);
3542 check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result
);
3543 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, minus_infty
));
3544 check ("real(casin(0.1 - i Inf)) = 0", __real__ result
, 0);
3545 check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result
);
3547 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 0));
3548 check ("real(casin(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
3549 check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result
);
3550 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3551 check ("real(casin(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
3552 check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result
);
3553 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 100));
3554 check ("real(casin(-Inf + i100)) = -pi/2", __real__ result
, -M_PI_2
);
3555 check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result
);
3556 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, -100));
3557 check ("real(casin(-Inf - i100)) = -pi/2", __real__ result
, -M_PI_2
);
3558 check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result
);
3560 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0));
3561 check ("real(casin(+Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
3562 check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result
);
3563 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3564 check ("real(casin(+Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
3565 check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result
);
3566 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0.5));
3567 check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result
, M_PI_2
);
3568 check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result
);
3569 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, -0.5));
3570 check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result
, M_PI_2
);
3571 check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result
);
3573 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3574 check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result
);
3575 check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result
);
3576 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3577 check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result
);
3578 check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result
);
3580 result
= FUNC(casin
) (BUILD_COMPLEX (0.0, nan_value
));
3581 check ("real(casin(0 + i NaN)) = 0", __real__ result
, 0.0);
3582 check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result
);
3583 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3584 check ("real(casin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
3585 check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result
);
3587 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3588 check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result
);
3589 check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
3590 FUNC(fabs
) (__imag__ result
));
3591 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3592 check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result
);
3593 check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
3594 FUNC(fabs
) (__imag__ result
));
3596 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, 10.5));
3597 check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3598 __real__ result
, INVALID_EXCEPTION
);
3599 check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3601 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, -10.5));
3602 check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3603 __real__ result
, INVALID_EXCEPTION
);
3604 check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3607 result
= FUNC(casin
) (BUILD_COMPLEX (0.75, nan_value
));
3608 check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3609 __real__ result
, INVALID_EXCEPTION
);
3610 check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3612 result
= FUNC(casin
) (BUILD_COMPLEX (-0.75, nan_value
));
3613 check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3614 __real__ result
, INVALID_EXCEPTION
);
3615 check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3618 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, nan_value
));
3619 check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result
);
3620 check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result
);
3627 __complex__ MATHTYPE result
;
3629 result
= FUNC(casinh
) (BUILD_COMPLEX (0, 0));
3630 check ("real(casinh(0 + i0)) = 0", __real__ result
, 0);
3631 check ("imag(casinh(0 + i0)) = 0", __imag__ result
, 0);
3632 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, 0));
3633 check ("real(casinh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3634 check ("imag(casinh(-0 + i0)) = 0", __imag__ result
, 0);
3635 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_zero
));
3636 check ("real(casinh(0 - i0)) = 0", __real__ result
, 0);
3637 check ("imag(casinh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3638 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3639 check ("real(casinh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3640 check ("imag(casinh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3642 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3643 check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result
);
3644 check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3645 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3646 check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result
);
3647 check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3648 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3649 check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result
);
3650 check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3651 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3652 check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result
);
3653 check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3655 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3656 check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result
);
3657 check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3658 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3659 check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result
);
3660 check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3661 result
= FUNC(casinh
) (BUILD_COMPLEX (0, plus_infty
));
3662 check_isinfp ("real(casinh(0 + i Inf)) = +Inf", __real__ result
);
3663 check ("imag(casinh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3664 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_infty
));
3665 check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result
);
3666 check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3667 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3668 check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result
);
3669 check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3670 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3671 check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result
);
3672 check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3673 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, plus_infty
));
3674 check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result
);
3675 check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3676 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, minus_infty
));
3677 check_isinfp ("real(casinh(0.1 - i Inf)) = +Inf", __real__ result
);
3678 check ("imag(casinh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3680 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 0));
3681 check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result
);
3682 check ("imag(casinh(-Inf + i0)) = 0", __imag__ result
, 0);
3683 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3684 check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result
);
3685 check ("imag(casinh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3686 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 100));
3687 check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result
);
3688 check ("imag(casinh(-Inf + i100)) = 0", __imag__ result
, 0);
3689 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, -100));
3690 check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result
);
3691 check ("imag(casinh(-Inf - i100)) = -0", __imag__ result
, minus_zero
);
3693 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0));
3694 check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result
);
3695 check ("imag(casinh(+Inf + i0)) = 0", __imag__ result
, 0);
3696 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3697 check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result
);
3698 check ("imag(casinh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3699 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3700 check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result
);
3701 check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3702 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3703 check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result
);
3704 check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3706 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3707 check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result
);
3708 check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result
);
3709 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3710 check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result
);
3711 check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result
);
3713 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0));
3714 check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result
);
3715 check ("imag(casinh(NaN + i0)) = 0", __imag__ result
, 0);
3716 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3717 check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result
);
3718 check ("imag(casinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3720 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3721 check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
3722 FUNC(fabs
) (__real__ result
));
3723 check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result
);
3724 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3725 check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
3726 FUNC(fabs
) (__real__ result
));
3727 check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result
);
3729 result
= FUNC(casinh
) (BUILD_COMPLEX (10.5, nan_value
));
3730 check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3731 __real__ result
, INVALID_EXCEPTION
);
3732 check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3734 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.5, nan_value
));
3735 check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3736 __real__ result
, INVALID_EXCEPTION
);
3737 check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3740 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0.75));
3741 check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3742 __real__ result
, INVALID_EXCEPTION
);
3743 check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3745 result
= FUNC(casinh
) (BUILD_COMPLEX (-0.75, nan_value
));
3746 check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3747 __real__ result
, INVALID_EXCEPTION
);
3748 check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3751 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3752 check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result
);
3753 check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result
);
3760 __complex__ MATHTYPE result
;
3762 result
= FUNC(catan
) (BUILD_COMPLEX (0, 0));
3763 check ("real(catan(0 + i0)) = 0", __real__ result
, 0);
3764 check ("imag(catan(0 + i0)) = 0", __imag__ result
, 0);
3765 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, 0));
3766 check ("real(catan(-0 + i0)) = -0", __real__ result
, minus_zero
);
3767 check ("imag(catan(-0 + i0)) = 0", __imag__ result
, 0);
3768 result
= FUNC(catan
) (BUILD_COMPLEX (0, minus_zero
));
3769 check ("real(catan(0 - i0)) = 0", __real__ result
, 0);
3770 check ("imag(catan(0 - i0)) = -0", __imag__ result
, minus_zero
);
3771 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3772 check ("real(catan(-0 - i0)) = -0", __real__ result
, minus_zero
);
3773 check ("imag(catan(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3775 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3776 check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3777 check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result
, 0);
3778 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3779 check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3780 check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
3781 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3782 check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3783 check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result
, 0.0);
3784 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3785 check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3786 check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
3788 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, -10.0));
3789 check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result
, M_PI_2
);
3790 check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
3791 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, -10.0));
3792 check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result
, -M_PI_2
);
3793 check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
3794 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3795 check ("real(catan(Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
3796 check ("imag(catan(Inf - i0)) = -0", __imag__ result
, minus_zero
);
3797 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3798 check ("real(catan(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
3799 check ("imag(catan(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3800 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.0));
3801 check ("real(catan(Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
3802 check ("imag(catan(Inf + i0)) = 0", __imag__ result
, 0.0);
3803 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.0));
3804 check ("real(catan(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
3805 check ("imag(catan(-Inf + i0)) = 0", __imag__ result
, 0.0);
3806 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.1));
3807 check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result
, M_PI_2
);
3808 check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result
, 0);
3809 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.1));
3810 check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result
, -M_PI_2
);
3811 check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result
, 0);
3813 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, minus_infty
));
3814 check ("real(catan(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3815 check ("imag(catan(0 - i Inf)) = -0", __imag__ result
, minus_zero
);
3816 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3817 check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3818 check ("imag(catan(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
3819 result
= FUNC(catan
) (BUILD_COMPLEX (100.0, minus_infty
));
3820 check ("real(catan(100 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3821 check ("imag(catan(100 - i Inf)) = -0", __imag__ result
, minus_zero
);
3822 result
= FUNC(catan
) (BUILD_COMPLEX (-100.0, minus_infty
));
3823 check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3824 check ("imag(catan(-100 - i Inf)) = -0", __imag__ result
, minus_zero
);
3826 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, plus_infty
));
3827 check ("real(catan(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3828 check ("imag(catan(0 + i Inf)) = 0", __imag__ result
, 0);
3829 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3830 check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3831 check ("imag(catan(-0 + i Inf)) = 0", __imag__ result
, 0);
3832 result
= FUNC(catan
) (BUILD_COMPLEX (0.5, plus_infty
));
3833 check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3834 check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result
, 0);
3835 result
= FUNC(catan
) (BUILD_COMPLEX (-0.5, plus_infty
));
3836 check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
3837 check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result
, 0);
3839 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 0.0));
3840 check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result
);
3841 check ("imag(catan(NaN + i0)) = 0", __imag__ result
, 0.0);
3842 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3843 check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result
);
3844 check ("imag(catan(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3846 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3847 check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result
);
3848 check ("imag(catan(NaN + i Inf)) = 0", __imag__ result
, 0);
3849 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3850 check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result
);
3851 check ("imag(catan(NaN - i Inf)) = -0", __imag__ result
, minus_zero
);
3853 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, nan_value
));
3854 check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result
);
3855 check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result
);
3856 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3857 check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result
);
3858 check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result
);
3860 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3861 check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3862 check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3863 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3864 check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result
, -M_PI_2
);
3865 check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3867 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 10.5));
3868 check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3869 __real__ result
, INVALID_EXCEPTION
);
3870 check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
3872 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, -10.5));
3873 check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3874 __real__ result
, INVALID_EXCEPTION
);
3875 check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
3878 result
= FUNC(catan
) (BUILD_COMPLEX (0.75, nan_value
));
3879 check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3880 __real__ result
, INVALID_EXCEPTION
);
3881 check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
3883 result
= FUNC(catan
) (BUILD_COMPLEX (-0.75, nan_value
));
3884 check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3885 __real__ result
, INVALID_EXCEPTION
);
3886 check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3889 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, nan_value
));
3890 check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result
);
3891 check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result
);
3898 __complex__ MATHTYPE result
;
3900 result
= FUNC(catanh
) (BUILD_COMPLEX (0, 0));
3901 check ("real(catanh(0 + i0)) = 0", __real__ result
, 0);
3902 check ("imag(catanh(0 + i0)) = 0", __imag__ result
, 0);
3903 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, 0));
3904 check ("real(catanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3905 check ("imag(catanh(-0 + i0)) = 0", __imag__ result
, 0);
3906 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_zero
));
3907 check ("real(catanh(0 - i0)) = 0", __real__ result
, 0);
3908 check ("imag(catanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3909 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3910 check ("real(catanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3911 check ("imag(catanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3913 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3914 check ("real(catanh(+Inf + i Inf)) = 0", __real__ result
, 0);
3915 check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3916 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3917 check ("real(catanh(+Inf - i Inf)) = 0", __real__ result
, 0);
3918 check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3919 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3920 check ("real(catanh(-Inf + i Inf)) = -0", __real__ result
, minus_zero
);
3921 check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3922 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3923 check ("real(catanh(-Inf - i Inf)) = -0", __real__ result
, minus_zero
);
3924 check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3926 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3927 check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
3928 check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3929 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3930 check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
3931 check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3932 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3933 check ("real(catanh(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
3934 check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3935 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3936 check ("real(catanh(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
3937 check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3938 result
= FUNC(catanh
) (BUILD_COMPLEX (0, plus_infty
));
3939 check ("real(catanh(0 + i Inf)) = 0", __real__ result
, 0);
3940 check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3941 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_infty
));
3942 check ("real(catanh(0 - i Inf)) = 0", __real__ result
, 0);
3943 check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3944 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, plus_infty
));
3945 check ("real(catanh(0.1 + i Inf)) = 0", __real__ result
, 0);
3946 check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3947 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, minus_infty
));
3948 check ("real(catanh(0.1 - i Inf)) = 0", __real__ result
, 0);
3949 check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3951 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 0));
3952 check ("real(catanh(-Inf + i0)) = -0", __real__ result
, minus_zero
);
3953 check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
3954 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3955 check ("real(catanh(-Inf - i0)) = -0", __real__ result
, minus_zero
);
3956 check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3957 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 100));
3958 check ("real(catanh(-Inf + i100)) = -0", __real__ result
, minus_zero
);
3959 check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result
, M_PI_2
);
3960 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, -100));
3961 check ("real(catanh(-Inf - i100)) = -0", __real__ result
, minus_zero
);
3962 check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result
, -M_PI_2
);
3964 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0));
3965 check ("real(catanh(+Inf + i0)) = 0", __real__ result
, 0);
3966 check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
3967 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3968 check ("real(catanh(+Inf - i0)) = 0", __real__ result
, 0);
3969 check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3970 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3971 check ("real(catanh(+Inf + i0.5)) = 0", __real__ result
, 0);
3972 check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result
, M_PI_2
);
3973 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3974 check ("real(catanh(+Inf - i0.5)) = 0", __real__ result
, 0);
3975 check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result
, -M_PI_2
);
3977 result
= FUNC(catanh
) (BUILD_COMPLEX (0, nan_value
));
3978 check ("real(catanh(0 + i NaN)) = 0", __real__ result
, 0);
3979 check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result
);
3980 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3981 check ("real(catanh(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
3982 check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result
);
3984 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3985 check ("real(catanh(+Inf + i NaN)) = 0", __real__ result
, 0);
3986 check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result
);
3987 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3988 check ("real(catanh(-Inf + i NaN)) = -0", __real__ result
, minus_zero
);
3989 check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result
);
3991 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0));
3992 check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result
);
3993 check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result
);
3994 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3995 check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result
);
3996 check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result
);
3998 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3999 check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4000 check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4001 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4002 check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4003 check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4005 result
= FUNC(catanh
) (BUILD_COMPLEX (10.5, nan_value
));
4006 check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4007 __real__ result
, INVALID_EXCEPTION
);
4008 check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4010 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.5, nan_value
));
4011 check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4012 __real__ result
, INVALID_EXCEPTION
);
4013 check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4016 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0.75));
4017 check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4018 __real__ result
, INVALID_EXCEPTION
);
4019 check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4021 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, -0.75));
4022 check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4023 __real__ result
, INVALID_EXCEPTION
);
4024 check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4027 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
4028 check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result
);
4029 check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result
);
4036 __complex__ MATHTYPE result
;
4038 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, 0));
4039 check ("real(ctanh(0 + i0)) = 0", __real__ result
, 0);
4040 check ("imag(ctanh(0 + i0)) = 0", __imag__ result
, 0);
4041 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_zero
));
4042 check ("real(ctanh(0 - i0)) = 0", __real__ result
, 0);
4043 check ("imag(ctanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
4044 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, 0));
4045 check ("real(ctanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
4046 check ("imag(ctanh(-0 + i0)) = 0", __imag__ result
, 0);
4047 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4048 check ("real(ctanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
4049 check ("imag(ctanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4051 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 0));
4052 check ("real(ctanh(+Inf + i0)) = 1", __real__ result
, 1);
4053 check ("imag(ctanh(+Inf + i0)) = 0", __imag__ result
, 0);
4054 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 1));
4055 check ("real(ctanh(+Inf + i1)) = 1", __real__ result
, 1);
4056 check ("imag(ctanh(+Inf + i1)) = 0", __imag__ result
, 0);
4057 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4058 check ("real(ctanh(+Inf - i0)) = 1", __real__ result
, 1);
4059 check ("imag(ctanh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4060 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, -1));
4061 check ("real(ctanh(+Inf - i1)) = 1", __real__ result
, 1);
4062 check ("imag(ctanh(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4063 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 0));
4064 check ("real(ctanh(-Inf + i0)) = -1", __real__ result
, -1);
4065 check ("imag(ctanh(-Inf + i0)) = 0", __imag__ result
, 0);
4066 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 1));
4067 check ("real(ctanh(-Inf + i1)) = -1", __real__ result
, -1);
4068 check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result
, 0);
4069 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4070 check ("real(ctanh(-Inf - i0)) = -1", __real__ result
, -1);
4071 check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
4072 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, -1));
4073 check ("real(ctanh(-Inf - i1)) = -1", __real__ result
, -1);
4074 check ("imag(ctanh(-Inf - i1)) = -0", __imag__ result
, minus_zero
);
4076 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, plus_infty
));
4077 check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
4078 __real__ result
, INVALID_EXCEPTION
);
4079 check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
4081 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, plus_infty
));
4082 check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
4083 __real__ result
, INVALID_EXCEPTION
);
4084 check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
4086 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_infty
));
4087 check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
4088 __real__ result
, INVALID_EXCEPTION
);
4089 check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
4091 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, minus_infty
));
4092 check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
4093 __real__ result
, INVALID_EXCEPTION
);
4094 check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
4096 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4097 check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4098 __real__ result
, INVALID_EXCEPTION
);
4099 check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4101 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, plus_infty
));
4102 check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4103 __real__ result
, INVALID_EXCEPTION
);
4104 check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4106 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4107 check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4108 __real__ result
, INVALID_EXCEPTION
);
4109 check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4111 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, minus_infty
));
4112 check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4113 __real__ result
, INVALID_EXCEPTION
);
4114 check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4117 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4118 check ("real(ctanh(+Inf + i NaN)) = 1", __real__ result
, 1);
4119 check ("imag(ctanh(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4120 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4121 check ("real(ctanh(-Inf + i NaN)) = -1", __real__ result
, -1);
4122 check ("imag(ctanh(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4124 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0));
4125 check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result
);
4126 check ("imag(ctanh(NaN + i0)) = 0", __imag__ result
, 0);
4127 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4128 check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result
);
4129 check ("imag(ctanh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
4131 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0.5));
4132 check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4133 __real__ result
, INVALID_EXCEPTION
);
4134 check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4136 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, -4.5));
4137 check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4138 __real__ result
, INVALID_EXCEPTION
);
4139 check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4142 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, nan_value
));
4143 check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4144 __real__ result
, INVALID_EXCEPTION
);
4145 check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4147 result
= FUNC(ctanh
) (BUILD_COMPLEX (5, nan_value
));
4148 check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4149 __real__ result
, INVALID_EXCEPTION
);
4150 check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4152 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4153 check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4154 __real__ result
, INVALID_EXCEPTION
);
4155 check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4157 result
= FUNC(ctanh
) (BUILD_COMPLEX (-0.25, nan_value
));
4158 check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4159 __real__ result
, INVALID_EXCEPTION
);
4160 check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4163 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
4164 check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result
);
4165 check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result
);
4172 __complex__ MATHTYPE result
;
4174 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, 0));
4175 check_isinfn_exc ("real(clog(-0 + i0)) = -Inf plus divide-by-zero exception",
4176 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4177 check ("imag(clog(-0 + i0)) = pi plus divide-by-zero exception",
4178 __imag__ result
, M_PI
);
4179 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4180 check_isinfn_exc ("real(clog(-0 - i0)) = -Inf plus divide-by-zero exception",
4181 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4182 check ("imag(clog(-0 - i0)) = -pi plus divide-by-zero exception",
4183 __imag__ result
, -M_PI
);
4185 result
= FUNC(clog
) (BUILD_COMPLEX (0, 0));
4186 check_isinfn_exc ("real(clog(0 + i0)) = -Inf plus divide-by-zero exception",
4187 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4188 check ("imag(clog(0 + i0)) = 0 plus divide-by-zero exception",
4189 __imag__ result
, 0);
4190 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_zero
));
4191 check_isinfn_exc ("real(clog(0 - i0)) = -Inf plus divide-by-zero exception",
4192 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4193 check ("imag(clog(0 - i0)) = -0 plus divide-by-zero exception",
4194 __imag__ result
, minus_zero
);
4196 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4197 check_isinfp ("real(clog(-Inf + i Inf)) = +Inf", __real__ result
);
4198 check ("imag(clog(-Inf + i Inf)) = 3*pi/4", __imag__ result
, M_PI
- M_PI_4
);
4199 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4200 check_isinfp ("real(clog(-Inf - i Inf)) = +Inf", __real__ result
);
4201 check ("imag(clog(-Inf - i Inf)) = -3*pi/4", __imag__ result
, M_PI_4
- M_PI
);
4203 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4204 check_isinfp ("real(clog(+Inf + i Inf)) = +Inf", __real__ result
);
4205 check ("imag(clog(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
4206 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4207 check_isinfp ("real(clog(+Inf - i Inf)) = +Inf", __real__ result
);
4208 check ("imag(clog(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
4210 result
= FUNC(clog
) (BUILD_COMPLEX (0, plus_infty
));
4211 check_isinfp ("real(clog(0 + i Inf)) = +Inf", __real__ result
);
4212 check ("imag(clog(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4213 result
= FUNC(clog
) (BUILD_COMPLEX (3, plus_infty
));
4214 check_isinfp ("real(clog(3 + i Inf)) = +Inf", __real__ result
);
4215 check ("imag(clog(3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4216 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4217 check_isinfp ("real(clog(-0 + i Inf)) = +Inf", __real__ result
);
4218 check ("imag(clog(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4219 result
= FUNC(clog
) (BUILD_COMPLEX (-3, plus_infty
));
4220 check_isinfp ("real(clog(-3 + i Inf)) = +Inf", __real__ result
);
4221 check ("imag(clog(-3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4222 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_infty
));
4223 check_isinfp ("real(clog(0 - i Inf)) = +Inf", __real__ result
);
4224 check ("imag(clog(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4225 result
= FUNC(clog
) (BUILD_COMPLEX (3, minus_infty
));
4226 check_isinfp ("real(clog(3 - i Inf)) = +Inf", __real__ result
);
4227 check ("imag(clog(3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4228 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4229 check_isinfp ("real(clog(-0 - i Inf)) = +Inf", __real__ result
);
4230 check ("imag(clog(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4231 result
= FUNC(clog
) (BUILD_COMPLEX (-3, minus_infty
));
4232 check_isinfp ("real(clog(-3 - i Inf)) = +Inf", __real__ result
);
4233 check ("imag(clog(-3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4235 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 0));
4236 check_isinfp ("real(clog(-Inf + i0)) = +Inf", __real__ result
);
4237 check ("imag(clog(-Inf + i0)) = pi", __imag__ result
, M_PI
);
4238 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 1));
4239 check_isinfp ("real(clog(-Inf + i1)) = +Inf", __real__ result
);
4240 check ("imag(clog(-Inf + i1)) = pi", __imag__ result
, M_PI
);
4241 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4242 check_isinfp ("real(clog(-Inf - i0)) = +Inf", __real__ result
);
4243 check ("imag(clog(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
4244 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, -1));
4245 check_isinfp ("real(clog(-Inf - i1)) = +Inf", __real__ result
);
4246 check ("imag(clog(-Inf - i1)) = -pi", __imag__ result
, -M_PI
);
4248 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 0));
4249 check_isinfp ("real(clog(+Inf + i0)) = +Inf", __real__ result
);
4250 check ("imag(clog(+Inf + i0)) = 0", __imag__ result
, 0);
4251 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 1));
4252 check_isinfp ("real(clog(+Inf + i1)) = +Inf", __real__ result
);
4253 check ("imag(clog(+Inf + i1)) = 0", __imag__ result
, 0);
4254 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4255 check_isinfp ("real(clog(+Inf - i0)) = +Inf", __real__ result
);
4256 check ("imag(clog(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4257 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, -1));
4258 check_isinfp ("real(clog(+Inf - i1)) = +Inf", __real__ result
);
4259 check ("imag(clog(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4261 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4262 check_isinfp ("real(clog(+Inf + i NaN)) = +Inf", __real__ result
);
4263 check_isnan ("imag(clog(+Inf + i NaN)) = NaN", __imag__ result
);
4264 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4265 check_isinfp ("real(clog(-Inf + i NaN)) = +Inf", __real__ result
);
4266 check_isnan ("imag(clog(-Inf + i NaN)) = NaN", __imag__ result
);
4268 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4269 check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result
);
4270 check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result
);
4271 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4272 check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result
);
4273 check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result
);
4275 result
= FUNC(clog
) (BUILD_COMPLEX (0, nan_value
));
4276 check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4277 __real__ result
, INVALID_EXCEPTION
);
4278 check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4280 result
= FUNC(clog
) (BUILD_COMPLEX (3, nan_value
));
4281 check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4282 __real__ result
, INVALID_EXCEPTION
);
4283 check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4285 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4286 check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4287 __real__ result
, INVALID_EXCEPTION
);
4288 check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4290 result
= FUNC(clog
) (BUILD_COMPLEX (-3, nan_value
));
4291 check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4292 __real__ result
, INVALID_EXCEPTION
);
4293 check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4296 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 0));
4297 check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
4298 __real__ result
, INVALID_EXCEPTION
);
4299 check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
4301 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 5));
4302 check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
4303 __real__ result
, INVALID_EXCEPTION
);
4304 check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
4306 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4307 check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
4308 __real__ result
, INVALID_EXCEPTION
);
4309 check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
4311 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, -5));
4312 check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
4313 __real__ result
, INVALID_EXCEPTION
);
4314 check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
4317 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, nan_value
));
4318 check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result
);
4319 check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result
);
4326 __complex__ MATHTYPE result
;
4328 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, 0));
4329 check ("real(csqrt(0 + i0)) = 0", __real__ result
, 0);
4330 check ("imag(csqrt(0 + i0)) = 0", __imag__ result
, 0);
4331 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_zero
));
4332 check ("real(csqrt(0 - i0)) = 0", __real__ result
, 0);
4333 check ("imag(csqrt(0 - i0)) = -0", __imag__ result
, minus_zero
);
4334 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, 0));
4335 check ("real(csqrt(-0 + i0)) = 0", __real__ result
, 0);
4336 check ("imag(csqrt(-0 + i0)) = 0", __imag__ result
, 0);
4337 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4338 check ("real(csqrt(-0 - i0)) = 0", __real__ result
, 0);
4339 check ("imag(csqrt(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4341 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 0));
4342 check ("real(csqrt(-Inf + i0)) = 0", __real__ result
, 0);
4343 check_isinfp ("imag(csqrt(-Inf + i0)) = +Inf", __imag__ result
);
4344 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 6));
4345 check ("real(csqrt(-Inf + i6)) = 0", __real__ result
, 0);
4346 check_isinfp ("imag(csqrt(-Inf + i6)) = +Inf", __imag__ result
);
4347 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4348 check ("real(csqrt(-Inf - i0)) = 0", __real__ result
, 0);
4349 check_isinfn ("imag(csqrt(-Inf - i0)) = -Inf", __imag__ result
);
4350 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, -6));
4351 check ("real(csqrt(-Inf - i6)) = 0", __real__ result
, 0);
4352 check_isinfn ("imag(csqrt(-Inf - i6)) = -Inf", __imag__ result
);
4354 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 0));
4355 check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result
);
4356 check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result
, 0);
4357 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 6));
4358 check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result
);
4359 check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result
, 0);
4360 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4361 check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result
);
4362 check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4363 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, -6));
4364 check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result
);
4365 check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result
, minus_zero
);
4367 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, plus_infty
));
4368 check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result
);
4369 check_isinfp ("imag(csqrt(0 + i Inf)) = +Inf", __imag__ result
);
4370 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, plus_infty
));
4371 check_isinfp ("real(csqrt(4 + i Inf)) = +Inf", __real__ result
);
4372 check_isinfp ("imag(csqrt(4 + i Inf)) = +Inf", __imag__ result
);
4373 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4374 check_isinfp ("real(csqrt(+Inf + i Inf)) = +Inf", __real__ result
);
4375 check_isinfp ("imag(csqrt(+Inf + i Inf)) = +Inf", __imag__ result
);
4376 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4377 check_isinfp ("real(csqrt(-0 + i Inf)) = +Inf", __real__ result
);
4378 check_isinfp ("imag(csqrt(-0 + i Inf)) = +Inf", __imag__ result
);
4379 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, plus_infty
));
4380 check_isinfp ("real(csqrt(-4 + i Inf)) = +Inf", __real__ result
);
4381 check_isinfp ("imag(csqrt(-4 + i Inf)) = +Inf", __imag__ result
);
4382 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4383 check_isinfp ("real(csqrt(-Inf + i Inf)) = +Inf", __real__ result
);
4384 check_isinfp ("imag(csqrt(-Inf + i Inf)) = +Inf", __imag__ result
);
4385 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_infty
));
4386 check_isinfp ("real(csqrt(0 - i Inf)) = +Inf", __real__ result
);
4387 check_isinfn ("imag(csqrt(0 - i Inf)) = -Inf", __imag__ result
);
4388 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, minus_infty
));
4389 check_isinfp ("real(csqrt(4 - i Inf)) = +Inf", __real__ result
);
4390 check_isinfn ("imag(csqrt(4 - i Inf)) = -Inf", __imag__ result
);
4391 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4392 check_isinfp ("real(csqrt(+Inf - i Inf)) = +Inf", __real__ result
);
4393 check_isinfn ("imag(csqrt(+Inf - i Inf)) = -Inf", __imag__ result
);
4394 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4395 check_isinfp ("real(csqrt(-0 - i Inf)) = +Inf", __real__ result
);
4396 check_isinfn ("imag(csqrt(-0 - i Inf)) = -Inf", __imag__ result
);
4397 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, minus_infty
));
4398 check_isinfp ("real(csqrt(-4 - i Inf)) = +Inf", __real__ result
);
4399 check_isinfn ("imag(csqrt(-4 - i Inf)) = -Inf", __imag__ result
);
4400 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4401 check_isinfp ("real(csqrt(-Inf - i Inf)) = +Inf", __real__ result
);
4402 check_isinfn ("imag(csqrt(-Inf - i Inf)) = -Inf", __imag__ result
);
4404 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4405 check_isnan ("real(csqrt(-Inf + i NaN)) = NaN", __real__ result
);
4406 check_isinfp ("imag(csqrt(-Inf + i NaN)) = +-Inf",
4407 FUNC(fabs
) (__imag__ result
));
4409 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4410 check_isinfp ("real(csqrt(+Inf + i NaN)) = +Inf", __real__ result
);
4411 check_isnan ("imag(csqrt(+Inf + i NaN)) = NaN", __imag__ result
);
4413 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, nan_value
));
4414 check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4415 __real__ result
, INVALID_EXCEPTION
);
4416 check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
4418 result
= FUNC(csqrt
) (BUILD_COMPLEX (1, nan_value
));
4419 check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4420 __real__ result
, INVALID_EXCEPTION
);
4421 check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
4423 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4424 check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4425 __real__ result
, INVALID_EXCEPTION
);
4426 check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
4428 result
= FUNC(csqrt
) (BUILD_COMPLEX (-1, nan_value
));
4429 check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4430 __real__ result
, INVALID_EXCEPTION
);
4431 check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
4434 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 0));
4435 check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4436 __real__ result
, INVALID_EXCEPTION
);
4437 check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
4439 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 8));
4440 check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4441 __real__ result
, INVALID_EXCEPTION
);
4442 check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
4444 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4445 check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4446 __real__ result
, INVALID_EXCEPTION
);
4447 check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
4449 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, -8));
4450 check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4451 __real__ result
, INVALID_EXCEPTION
);
4452 check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
4455 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, nan_value
));
4456 check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result
);
4457 check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result
);
4464 __complex__ MATHTYPE result
;
4466 result
= FUNC (cpow
) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
4467 check ("real(cpow (1 + i0), (0 + i0)) = 0", __real__ result
, 1);
4468 check ("imag(cpow (1 + i0), (0 + i0)) = 0", __imag__ result
, 0);
4470 result
= FUNC (cpow
) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
4471 check_eps ("real(cpow (2 + i0), (10 + i0)) = 1024", __real__ result
, 1024,
4472 CHOOSE (2e-16L, 0, 0));
4473 check ("imag(cpow (2 + i0), (10 + i0)) = 0", __imag__ result
, 0);
4479 nearbyint_test (void)
4481 check ("nearbyint(+0) = 0", FUNC(nearbyint
) (0.0), 0.0);
4482 check ("nearbyint(-0) = -0", FUNC(nearbyint
) (minus_zero
), minus_zero
);
4483 check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint
) (plus_infty
));
4484 check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint
) (minus_infty
));
4491 check ("rint(0) = 0", FUNC(rint
) (0.0), 0.0);
4492 check ("rint(-0) = -0", FUNC(rint
) (minus_zero
), minus_zero
);
4493 check_isinfp ("rint(+Inf) = +Inf", FUNC(rint
) (plus_infty
));
4494 check_isinfn ("rint(-Inf) = -Inf", FUNC(rint
) (minus_infty
));
4501 /* XXX this test is incomplete. We need to have a way to specifiy
4502 the rounding method and test the critical cases. So far, only
4503 unproblematic numbers are tested. */
4505 check_long ("lrint(0) = 0", lrint (0.0), 0);
4506 check_long ("lrint(-0) = 0", lrint (minus_zero
), 0);
4507 check_long ("lrint(0.2) = 0", lrint (0.2), 0);
4508 check_long ("lrint(-0.2) = 0", lrint (-0.2), 0);
4510 check_long ("lrint(1.4) = 1", lrint (1.4), 1);
4511 check_long ("lrint(-1.4) = -1", lrint (-1.4), -1);
4513 check_long ("lrint(8388600.3) = 8388600", lrint (8388600.3), 8388600);
4514 check_long ("lrint(-8388600.3) = -8388600", lrint (-8388600.3),
4522 /* XXX this test is incomplete. We need to have a way to specifiy
4523 the rounding method and test the critical cases. So far, only
4524 unproblematic numbers are tested. */
4526 check_longlong ("llrint(0) = 0", llrint (0.0), 0);
4527 check_longlong ("llrint(-0) = 0", llrint (minus_zero
), 0);
4528 check_longlong ("llrint(0.2) = 0", llrint (0.2), 0);
4529 check_longlong ("llrint(-0.2) = 0", llrint (-0.2), 0);
4531 check_longlong ("llrint(1.4) = 1", llrint (1.4), 1);
4532 check_longlong ("llrint(-1.4) = -1", llrint (-1.4), -1);
4534 check_longlong ("llrint(8388600.3) = 8388600", llrint (8388600.3),
4536 check_longlong ("llrint(-8388600.3) = -8388600", llrint (-8388600.3),
4544 check ("round(0) = 0", FUNC(round
) (0), 0);
4545 check ("round(-0) = -0", FUNC(round
) (minus_zero
), minus_zero
);
4546 check ("round(0.2) = 0", FUNC(round
) (0.2), 0.0);
4547 check ("round(-0.2) = -0", FUNC(round
) (-0.2), minus_zero
);
4548 check ("round(0.5) = 1", FUNC(round
) (0.5), 1.0);
4549 check ("round(-0.5) = -1", FUNC(round
) (-0.5), -1.0);
4550 check ("round(0.8) = 1", FUNC(round
) (0.8), 1.0);
4551 check ("round(-0.8) = -1", FUNC(round
) (-0.8), -1.0);
4552 check ("round(1.5) = 2", FUNC(round
) (1.5), 2.0);
4553 check ("round(-1.5) = -2", FUNC(round
) (-1.5), -2.0);
4554 check ("round(2097152.5) = 2097153", FUNC(round
) (2097152.5), 2097153);
4555 check ("round(-2097152.5) = -2097153", FUNC(round
) (-2097152.5), -2097153);
4562 check_long ("lround(0) = 0", lround (0), 0);
4563 check_long ("lround(-0) = 0", lround (minus_zero
), 0);
4564 check_long ("lround(0.2) = 0", lround (0.2), 0.0);
4565 check_long ("lround(-0.2) = 0", lround (-0.2), 0);
4566 check_long ("lround(0.5) = 1", lround (0.5), 1);
4567 check_long ("lround(-0.5) = -1", lround (-0.5), -1);
4568 check_long ("lround(0.8) = 1", lround (0.8), 1);
4569 check_long ("lround(-0.8) = -1", lround (-0.8), -1);
4570 check_long ("lround(1.5) = 2", lround (1.5), 2);
4571 check_long ("lround(-1.5) = -2", lround (-1.5), -2);
4572 check_long ("lround(2097152.5) = 2097153", lround (2097152.5), 2097153);
4573 check_long ("lround(-2097152.5) = -2097153", lround (-2097152.5),
4581 check_longlong ("llround(0) = 0", llround (0), 0);
4582 check_longlong ("llround(-0) = 0", llround (minus_zero
), 0);
4583 check_longlong ("llround(0.2) = 0", llround (0.2), 0.0);
4584 check_longlong ("llround(-0.2) = 0", llround (-0.2), 0);
4585 check_longlong ("llround(0.5) = 1", llround (0.5), 1);
4586 check_longlong ("llround(-0.5) = -1", llround (-0.5), -1);
4587 check_longlong ("llround(0.8) = 1", llround (0.8), 1);
4588 check_longlong ("llround(-0.8) = -1", llround (-0.8), -1);
4589 check_longlong ("llround(1.5) = 2", llround (1.5), 2);
4590 check_longlong ("llround(-1.5) = -2", llround (-1.5), -2);
4591 check_longlong ("llround(2097152.5) = 2097153",
4592 llround (2097152.5), 2097153);
4593 check_longlong ("llround(-2097152.5) = -2097153",
4594 llround (-2097152.5), -2097153);
4595 check_longlong ("llround(34359738368.5) = 34359738369",
4596 llround (34359738368.5), 34359738369ll);
4597 check_longlong ("llround(-34359738368.5) = -34359738369",
4598 llround (-34359738368.5), -34359738369ll);
4603 inverse_func_pair_test (const char *test_name
,
4604 mathfunc f1
, mathfunc inverse
,
4605 MATHTYPE x
, MATHTYPE epsilon
)
4607 MATHTYPE a
, b
, difference
;
4615 output_new_test (test_name
);
4616 result
= check_equal (b
, x
, epsilon
, &difference
);
4617 output_result (test_name
, result
,
4618 b
, x
, difference
, PRINT
, PRINT
);
4623 inverse_functions (void)
4625 inverse_func_pair_test ("asin(sin(x)) == x",
4626 FUNC(sin
), FUNC(asin
), 1.0, CHOOSE (2e-18L, 0, 1e-7L));
4627 inverse_func_pair_test ("sin(asin(x)) == x",
4628 FUNC(asin
), FUNC(sin
), 1.0, 0.0);
4630 inverse_func_pair_test ("acos(cos(x)) == x",
4631 FUNC(cos
), FUNC(acos
), 1.0, CHOOSE (4e-18L, 1e-15L, 0));
4632 inverse_func_pair_test ("cos(acos(x)) == x",
4633 FUNC(acos
), FUNC(cos
), 1.0, 0.0);
4634 inverse_func_pair_test ("atan(tan(x)) == x",
4635 FUNC(tan
), FUNC(atan
), 1.0, CHOOSE (2e-18L, 0, 0));
4636 inverse_func_pair_test ("tan(atan(x)) == x",
4637 FUNC(atan
), FUNC(tan
), 1.0, CHOOSE (2e-18L, 1e-15L, 0));
4639 inverse_func_pair_test ("asinh(sinh(x)) == x",
4640 FUNC(sinh
), FUNC(asinh
), 1.0, CHOOSE (1e-18L, 0, 1e-7));
4641 inverse_func_pair_test ("sinh(asinh(x)) == x",
4642 FUNC(asinh
), FUNC(sinh
), 1.0, CHOOSE (2e-18L, 0, 0));
4644 inverse_func_pair_test ("acosh(cosh(x)) == x",
4645 FUNC(cosh
), FUNC(acosh
), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4646 inverse_func_pair_test ("cosh(acosh(x)) == x",
4647 FUNC(acosh
), FUNC(cosh
), 1.0, 0.0);
4649 inverse_func_pair_test ("atanh(tanh(x)) == x",
4650 FUNC(tanh
), FUNC(atanh
), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
4651 inverse_func_pair_test ("tanh(atanh(x)) == x",
4652 FUNC(atanh
), FUNC(tanh
), 1.0, 0.0);
4656 /* Test sin and cos with the identity: sin(x)^2 + cos(x)^2 = 1. */
4658 identities1_test (MATHTYPE x
, MATHTYPE epsilon
)
4660 MATHTYPE res1
, res2
, res3
, diff
;
4663 res1
= FUNC(sin
) (x
);
4665 res2
= FUNC(cos
) (x
);
4667 res3
= res1
* res1
+ res2
* res2
;
4670 output_new_test ("sin^2 + cos^2 == 1");
4671 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
4672 output_result_ext ("sin^2 + cos^2 == 1", result
,
4673 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
4677 /* Test sin, cos, tan with the following relation: tan = sin/cos. */
4679 identities2_test (MATHTYPE x
, MATHTYPE epsilon
)
4681 MATHTYPE res1
, res2
, res3
, res4
, diff
;
4684 res1
= FUNC(sin
) (x
);
4686 res2
= FUNC(cos
) (x
);
4688 res3
= FUNC(tan
) (x
);
4693 output_new_test ("sin/cos == tan");
4694 result
= check_equal (res4
, res3
, epsilon
, &diff
);
4695 output_result_ext ("sin/cos == tan", result
,
4696 res4
, res3
, diff
, x
, PRINT
, PRINT
);
4700 /* Test cosh and sinh with the identity cosh^2 - sinh^2 = 1. */
4702 identities3_test (MATHTYPE x
, MATHTYPE epsilon
)
4704 MATHTYPE res1
, res2
, res3
, diff
;
4707 res1
= FUNC(sinh
) (x
);
4709 res2
= FUNC(cosh
) (x
);
4711 res3
= res2
* res2
- res1
* res1
;
4714 output_new_test ("cosh^2 - sinh^2 == 1");
4715 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
4716 output_result_ext ("cosh^2 - sinh^2 == 1", result
,
4717 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
4724 identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
4725 identities1_test (0.9L, CHOOSE (1e-18L, 0, 1e-7));
4726 identities1_test (0, 0);
4727 identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
4729 identities2_test (0.2L, CHOOSE (0, 1e-16, 0));
4730 identities2_test (0.9L, CHOOSE (0, 1e-15, 0));
4731 identities2_test (0, 0);
4732 identities2_test (-1, CHOOSE (1e-18L, 1e-15, 0));
4734 identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
4735 identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
4736 identities3_test (0, CHOOSE (0, 0, 1e-6));
4737 identities3_test (-1, CHOOSE (1e-18L, 0, 1e-6));
4742 Let's test that basic arithmetic is working
4743 tests: Infinity and NaN
4748 /* variables are declared volatile to forbid some compiler
4750 volatile MATHTYPE Inf_var
, NaN_var
, zero_var
, one_var
;
4755 NaN_var
= nan_value
;
4756 Inf_var
= one_var
/ zero_var
;
4763 /* Clear all exceptions. The previous computations raised exceptions. */
4764 feclearexcept (FE_ALL_EXCEPT
);
4766 check_isinfp ("isinf (inf) == +1", Inf_var
);
4767 check_isinfn ("isinf (-inf) == -1", -Inf_var
);
4768 check_bool ("!isinf (1)", !(FUNC(isinf
) (one_var
)));
4769 check_bool ("!isinf (NaN)", !(FUNC(isinf
) (NaN_var
)));
4771 check_isnan ("isnan (NaN)", NaN_var
);
4772 check_isnan ("isnan (-NaN)", -NaN_var
);
4773 check_bool ("!isnan (1)", !(FUNC(isnan
) (one_var
)));
4774 check_bool ("!isnan (inf)", !(FUNC(isnan
) (Inf_var
)));
4776 check_bool ("inf == inf", Inf_var
== Inf_var
);
4777 check_bool ("-inf == -inf", -Inf_var
== -Inf_var
);
4778 check_bool ("inf != -inf", Inf_var
!= -Inf_var
);
4779 check_bool ("NaN != NaN", NaN_var
!= NaN_var
);
4782 the same tests but this time with NAN from <bits/nan.h>
4783 NAN is a double const
4785 check_bool ("isnan (NAN)", isnan (NAN
));
4786 check_bool ("isnan (-NAN)", isnan (-NAN
));
4787 check_bool ("!isinf (NAN)", !(isinf (NAN
)));
4788 check_bool ("!isinf (-NAN)", !(isinf (-NAN
)));
4789 check_bool ("NAN != NAN", NAN
!= NAN
);
4792 And again with the value returned by the `nan' function.
4794 check_bool ("isnan (NAN)", FUNC(isnan
) (FUNC(nan
) ("")));
4795 check_bool ("isnan (-NAN)", FUNC(isnan
) (-FUNC(nan
) ("")));
4796 check_bool ("!isinf (NAN)", !(FUNC(isinf
) (FUNC(nan
) (""))));
4797 check_bool ("!isinf (-NAN)", !(FUNC(isinf
) (-FUNC(nan
) (""))));
4798 check_bool ("NAN != NAN", FUNC(nan
) ("") != FUNC(nan
) (""));
4800 /* test if EPSILON is ok */
4801 x1
= MATHCONST (1.0);
4802 x2
= x1
+ CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
4803 check_bool ("1 != 1+EPSILON", x1
!= x2
);
4805 x1
= MATHCONST (1.0);
4806 x2
= x1
- CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
4807 check_bool ("1 != 1-EPSILON", x1
!= x2
);
4809 /* test if HUGE_VALx is ok */
4810 x1
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4811 check_bool ("isinf (HUGE_VALx) == +1", ISINF (x1
) == +1);
4812 x1
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4813 check_bool ("isinf (-HUGE_VALx) == -1", ISINF (x1
) == -1);
4821 fpstack_test ("start *init*");
4823 nan_value
= plus_zero
/ plus_zero
; /* Suppress GCC warning */
4825 minus_zero
= FUNC (copysign
) (0.0, -1.0);
4826 plus_infty
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4827 minus_infty
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
4833 (void) &minus_infty
;
4835 /* Clear all exceptions. From now on we must not get random exceptions. */
4836 feclearexcept (FE_ALL_EXCEPT
);
4838 /* Test to make sure we start correctly. */
4839 fpstack_test ("end *init*");
4843 static struct option long_options
[] =
4845 {"verbose", optional_argument
, NULL
, 'v'},
4846 {"silent", no_argument
, NULL
, 's'},
4852 parse_options (int argc
, char *argv
[])
4861 c
= getopt_long (argc
, argv
, "v::s",
4862 long_options
, &option_index
);
4864 /* Detect the end of the options. */
4872 verbose
= (unsigned int) strtoul (optarg
, NULL
, 0);
4886 main (int argc
, char *argv
[])
4889 parse_options (argc
, argv
);
4896 /* keep the tests a wee bit ordered (according to ISO 9X) */
4897 /* classification functions */
4903 /* trigonometric functions */
4913 /* hyperbolic functions */
4921 /* exponential and logarithmic functions */
4937 /* power and absolute value functions */
4944 /* error and gamma functions */
4950 /* nearest integer functions */
4962 /* remainder functions */
4967 /* manipulation functions */
4971 /* maximum, minimum and positive difference functions */
4976 /* complex functions */
4995 inverse_functions ();
4999 printf ("\n%d errors occured.\n", noErrors
);
5002 printf ("\n All tests passed successfully.\n");