1 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 Part of testsuite for libm.
24 This file has to be included by a master file that defines:
27 FUNC(function): converts general function name (like cos) to
28 name with correct suffix (e.g. cosl or cosf)
29 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
30 MATHTYPE: floating point type to test
31 TEST_MSG: informal message to be displayed
32 CHOOSE(Clongdouble,Cdouble,Cfloat):
33 chooses one of the parameters as epsilon for testing
35 PRINTF_EXPR Floating point conversion specification to print a variable
36 of type MATHTYPE with printf. PRINTF_EXPR just contains
37 the specifier, not the percent and width arguments,
39 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
42 /* This program isn't finished yet.
44 acos, acosh, asin, asinh, atan, atan2, atanh,
45 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
46 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
48 ilogb, isfinite, isinf, isnan, isnormal,
49 ldexp, lgamma, log, log10, log1p, log2, logb,
50 modf, nearbyint, nextafter,
51 pow, remainder, remquo, rint, lrint, llrint,
52 round, lround, llround,
53 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
55 and for the following complex math functions:
56 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
57 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan, ctanh.
59 At the moment the following functions aren't tested:
60 conj, cproj, cimag, creal, drem,
61 j0, j1, jn, y0, y1, yn,
63 nan, comparison macros (isless,isgreater,...).
65 The routines using random variables are still under construction. I don't
66 like it the way it's working now and will change it.
68 Parameter handling is primitive in the moment:
69 --verbose=[0..4] for different levels of output:
71 1: basic report on failed tests (default)
72 2: full report on failed tests
73 3: full report on failed and passed tests
74 4: additional report on exceptions
75 -v for full output (equals --verbose=4)
76 -s,--silent outputs only the error count (equals --verbose=0)
81 This suite tests some aspects of the correct implementation of
82 mathematical functions in libm. Some simple, specific parameters
83 are tested for correctness but there's no exhaustive
84 testing. Handling of specific inputs (e.g. infinity, not-a-number)
85 is also tested. Correct handling of exceptions is checked
86 against. These implemented tests should check all cases that are
87 specified in ISO C 9X.
89 Exception testing: At the moment only divide-by-zero and invalid
90 exceptions are tested. Overflow/underflow and inexact exceptions
91 aren't checked at the moment.
93 NaN values: There exist signalling and quiet NaNs. This implementation
94 only uses signalling NaN as parameter but does not differenciate
95 between the two kinds of NaNs as result.
97 Inline functions: Inlining functions should give an improvement in
98 speed - but not in precission. The inlined functions return
99 reasonable values for a reasonable range of input values. The
100 result is not necessarily correct for all values and exceptions are
101 not correctly raised in all cases. Problematic input and return
102 values are infinity, not-a-number and minus zero. This suite
103 therefore does not check these specific inputs and the exception
104 handling for inlined mathematical functions - just the "reasonable"
107 Beware: The tests might fail for any of the following reasons:
109 - Functions are wrong
110 - Floating Point Unit not working properly
111 - Compiler has errors
113 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
131 /* Possible exceptions */
132 #define NO_EXCEPTION 0x0
133 #define INVALID_EXCEPTION 0x1
134 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
139 /* Various constants (we must supply them precalculated for accuracy). */
140 #define M_PI_6 .52359877559829887308L
141 #define M_E2 7.389056098930650227230L
142 #define M_E3 20.08553692318766774093L
144 static int noErrors
; /* number of errors */
145 static int noTests
; /* number of tests (without testing exceptions) */
146 static int noExcTests
; /* number of tests for exception flags */
148 static int verbose
= 3;
149 static MATHTYPE minus_zero
, plus_zero
;
150 static MATHTYPE plus_infty
, minus_infty
, nan_value
;
152 typedef MATHTYPE (*mathfunc
) (MATHTYPE
);
154 #define BUILD_COMPLEX(real, imag) \
155 ({ __complex__ MATHTYPE __retval; \
156 __real__ __retval = (real); \
157 __imag__ __retval = (imag); \
162 (sizeof (x) == sizeof (float) ? \
164 : sizeof (x) == sizeof (double) ? \
165 isinf (x) : isinfl (x))
169 Test if Floating-Point stack hasn't changed
172 fpstack_test (const char *test_name
)
175 static int old_stack
;
177 asm ("fnstsw":"=a" (sw
));
182 printf ("FP-Stack wrong after test %s\n", test_name
);
184 printf ("=======> stack = %d\n", sw
);
193 Get a random value x with min_value < x < max_value
194 and min_value, max_value finite,
195 max_value and min_value shouldn't be too close together
198 random_value (MATHTYPE min_value
, MATHTYPE max_value
)
205 x
= (max_value
- min_value
) / RAND_MAX
* (MATHTYPE
) r
+ min_value
;
207 if ((x
<= min_value
) || (x
>= max_value
) || !isfinite (x
))
208 x
= (max_value
- min_value
) / 2 + min_value
;
210 /* Make sure the RNG has no influence on the exceptions. */
211 feclearexcept (FE_ALL_EXCEPT
);
216 /* Get a random value x with x > min_value. */
218 random_greater (MATHTYPE min_value
)
220 return random_value (min_value
, 1e6
); /* CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX) */
223 /* Get a random value x with x < max_value. */
225 random_less (MATHTYPE max_value
)
227 return random_value (-1e6
, max_value
);
232 output_new_test (const char *test_name
)
235 printf ("\nTesting: %s\n", test_name
);
240 output_pass_value (void)
243 printf ("Pass: Value Ok.\n");
248 output_fail_value (const char * test_name
)
250 if (verbose
> 0 && verbose
< 3)
251 printf ("Fail: %s\n", test_name
);
257 /* Test whether a given exception was raised. */
259 test_single_exception (const char *test_name
,
263 const char *flag_name
)
266 if (exception
& exc_flag
)
268 if (fetestexcept (fe_flag
))
271 printf ("Pass: Exception \"%s\" set\n", flag_name
);
275 if (verbose
&& verbose
< 3)
276 printf ("Fail: %s: Exception \"%s\" not set\n",
277 test_name
, flag_name
);
279 printf ("Fail: Exception \"%s\" not set\n",
286 if (fetestexcept (fe_flag
))
288 if (verbose
&& verbose
< 3)
289 printf ("Fail: %s: Exception \"%s\" set\n",
290 test_name
, flag_name
);
292 printf ("Fail: Exception \"%s\" set\n",
299 printf ("Pass: Exception \"%s\" not set\n",
307 /* Test whether exception given by EXCEPTION are raised. */
309 test_not_exception (const char *test_name
, short int exception
)
313 if ((exception
& DIVIDE_BY_ZERO_EXCEPTION
) == 0)
314 test_single_exception (test_name
, exception
,
315 DIVIDE_BY_ZERO_EXCEPTION
, FE_DIVBYZERO
,
319 if ((exception
& INVALID_EXCEPTION
) == 0)
320 test_single_exception (test_name
, exception
, INVALID_EXCEPTION
, FE_INVALID
,
321 "Invalid operation");
323 feclearexcept (FE_ALL_EXCEPT
);
327 /* Test whether exceptions given by EXCEPTION are raised. */
329 test_exceptions (const char *test_name
, short int exception
)
333 test_single_exception (test_name
, exception
,
334 DIVIDE_BY_ZERO_EXCEPTION
, FE_DIVBYZERO
,
338 test_single_exception (test_name
, exception
, INVALID_EXCEPTION
, FE_INVALID
,
339 "Invalid operation");
341 feclearexcept (FE_ALL_EXCEPT
);
345 /* Test if two floating point numbers are equal. */
347 check_equal (MATHTYPE computed
, MATHTYPE supplied
, MATHTYPE eps
, MATHTYPE
* diff
)
351 /* Both plus Infinity or both minus infinity. */
352 if (ISINF (computed
) && (ISINF (computed
) == ISINF (supplied
)))
355 if (isnan (computed
) && isnan (supplied
)) /* isnan works for all types */
358 *diff
= FUNC(fabs
) (computed
- supplied
);
361 ret_value
= (*diff
<= eps
&&
362 (signbit (computed
) == signbit (supplied
) || eps
!= 0.0));
364 /* Make sure the subtraction/comparsion have no influence on the exceptions. */
365 feclearexcept (FE_ALL_EXCEPT
);
373 output_result_bool (const char *test_name
, int result
)
378 output_pass_value ();
382 output_fail_value (test_name
);
384 printf (" Value: %d\n", result
);
388 fpstack_test (test_name
);
393 output_isvalue (const char *test_name
, int result
,
399 output_pass_value ();
403 output_fail_value (test_name
);
405 printf (" Value: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
410 fpstack_test (test_name
);
415 output_isvalue_ext (const char *test_name
, int result
,
416 MATHTYPE value
, MATHTYPE parameter
)
421 output_pass_value ();
425 output_fail_value (test_name
);
428 printf (" Value: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
430 printf (" Parameter: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
431 parameter
, parameter
);
436 fpstack_test (test_name
);
441 output_result (const char *test_name
, int result
,
442 MATHTYPE computed
, MATHTYPE expected
,
444 int print_values
, int print_diff
)
449 output_pass_value ();
453 output_fail_value (test_name
);
454 if (verbose
> 1 && print_values
)
456 printf ("Result:\n");
457 printf (" is: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
459 printf (" should be: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
462 printf (" difference: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
463 "\n", difference
, difference
);
468 fpstack_test (test_name
);
473 output_result_ext (const char *test_name
, int result
,
474 MATHTYPE computed
, MATHTYPE expected
,
477 int print_values
, int print_diff
)
482 output_pass_value ();
486 output_fail_value (test_name
);
487 if (verbose
> 1 && print_values
)
489 printf ("Result:\n");
490 printf (" is: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
492 printf (" should be: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
495 printf (" difference: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
496 "\n", difference
, difference
);
497 printf ("Parameter: % .20" PRINTF_EXPR
" % .20" PRINTF_XEXPR
"\n",
498 parameter
, parameter
);
503 fpstack_test (test_name
);
507 check that computed and expected values are the same
510 check (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
)
515 output_new_test (test_name
);
516 test_exceptions (test_name
, NO_EXCEPTION
);
517 result
= check_equal (computed
, expected
, 0, &diff
);
518 output_result (test_name
, result
,
519 computed
, expected
, diff
, PRINT
, PRINT
);
524 check that computed and expected values are the same,
525 outputs the parameter to the function
528 check_ext (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
534 output_new_test (test_name
);
535 test_exceptions (test_name
, NO_EXCEPTION
);
536 result
= check_equal (computed
, expected
, 0, &diff
);
537 output_result_ext (test_name
, result
,
538 computed
, expected
, diff
, parameter
, PRINT
, PRINT
);
543 check that computed and expected values are the same and
544 checks also for exception flags
547 check_exc (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
553 output_new_test (test_name
);
554 test_exceptions (test_name
, exception
);
555 result
= check_equal (computed
, expected
, 0, &diff
);
556 output_result (test_name
, result
,
557 computed
, expected
, diff
, PRINT
, PRINT
);
561 check that computed and expected values are close enough
564 check_eps (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
570 output_new_test (test_name
);
571 test_exceptions (test_name
, NO_EXCEPTION
);
572 result
= check_equal (computed
, expected
, epsilon
, &diff
);
573 output_result (test_name
, result
,
574 computed
, expected
, diff
, PRINT
, PRINT
);
578 check a boolean condition
581 check_bool (const char *test_name
, int computed
)
583 output_new_test (test_name
);
584 test_exceptions (test_name
, NO_EXCEPTION
);
585 output_result_bool (test_name
, computed
);
591 check that computed and expected values are equal (int values)
594 check_int (const char *test_name
, int computed
, int expected
)
596 int diff
= computed
- expected
;
597 int result
= diff
== 0;
599 output_new_test (test_name
);
600 test_exceptions (test_name
, NO_EXCEPTION
);
604 output_pass_value ();
608 output_fail_value (test_name
);
611 printf ("Result:\n");
612 printf (" is: %d\n", computed
);
613 printf (" should be: %d\n", expected
);
618 fpstack_test (test_name
);
623 check that computed and expected values are equal (long int values)
626 check_long (const char *test_name
, long int computed
, long int expected
)
628 long int diff
= computed
- expected
;
629 int result
= diff
== 0;
632 output_new_test (test_name
);
633 test_exceptions (test_name
, NO_EXCEPTION
);
637 output_pass_value ();
641 output_fail_value (test_name
);
644 printf ("Result:\n");
645 printf (" is: %ld\n", computed
);
646 printf (" should be: %ld\n", expected
);
651 fpstack_test (test_name
);
655 check that computed and expected values are equal (long long int values)
658 check_longlong (const char *test_name
, long long int computed
,
659 long long int expected
)
661 long long int diff
= computed
- expected
;
662 int result
= diff
== 0;
665 output_new_test (test_name
);
666 test_exceptions (test_name
, NO_EXCEPTION
);
670 output_pass_value ();
674 output_fail_value (test_name
);
677 printf ("Result:\n");
678 printf (" is: %lld\n", computed
);
679 printf (" should be: %lld\n", expected
);
684 fpstack_test (test_name
);
688 check that computed value is not-a-number
691 check_isnan (const char *test_name
, MATHTYPE computed
)
693 output_new_test (test_name
);
694 test_exceptions (test_name
, NO_EXCEPTION
);
695 output_isvalue (test_name
, isnan (computed
), computed
);
700 check that computed value is not-a-number and test for exceptions
703 check_isnan_exc (const char *test_name
, MATHTYPE computed
,
706 output_new_test (test_name
);
707 test_exceptions (test_name
, exception
);
708 output_isvalue (test_name
, isnan (computed
), computed
);
713 check that computed value is not-a-number and test for exceptions
716 check_isnan_maybe_exc (const char *test_name
, MATHTYPE computed
,
719 output_new_test (test_name
);
720 test_not_exception (test_name
, exception
);
721 output_isvalue (test_name
, isnan (computed
), computed
);
725 check that computed value is not-a-number and supply parameter
729 check_isnan_ext (const char *test_name
, MATHTYPE computed
,
732 output_new_test (test_name
);
733 test_exceptions (test_name
, NO_EXCEPTION
);
734 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
739 check that computed value is not-a-number, test for exceptions
743 check_isnan_exc_ext (const char *test_name
, MATHTYPE computed
,
744 short exception
, MATHTYPE parameter
)
746 output_new_test (test_name
);
747 test_exceptions (test_name
,exception
);
748 output_isvalue_ext (test_name
, isnan (computed
), computed
, parameter
);
752 /* Tests if computed is +Inf */
754 check_isinfp (const char *test_name
, MATHTYPE computed
)
756 output_new_test (test_name
);
757 test_exceptions (test_name
, NO_EXCEPTION
);
758 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
763 check_isinfp_ext (const char *test_name
, MATHTYPE computed
,
766 output_new_test (test_name
);
767 test_exceptions (test_name
, NO_EXCEPTION
);
768 output_isvalue_ext (test_name
, (ISINF (computed
) == +1), computed
, parameter
);
772 /* Tests if computed is +Inf */
774 check_isinfp_exc (const char *test_name
, MATHTYPE computed
,
777 output_new_test (test_name
);
778 test_exceptions (test_name
, exception
);
779 output_isvalue (test_name
, (ISINF (computed
) == +1), computed
);
782 /* Tests if computed is -Inf */
784 check_isinfn (const char *test_name
, MATHTYPE computed
)
786 output_new_test (test_name
);
787 test_exceptions (test_name
, NO_EXCEPTION
);
788 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
794 check_isinfn_ext (const char *test_name
, MATHTYPE computed
,
797 output_new_test (test_name
);
798 test_exceptions (test_name
, NO_EXCEPTION
);
799 output_isvalue_ext (test_name
, (ISINF (computed
) == -1), computed
, parameter
);
804 /* Tests if computed is -Inf */
806 check_isinfn_exc (const char *test_name
, MATHTYPE computed
,
809 output_new_test (test_name
);
810 test_exceptions (test_name
, exception
);
811 output_isvalue (test_name
, (ISINF (computed
) == -1), computed
);
815 /* This is to prevent messages from the SVID libm emulation. */
817 matherr (struct exception
*x
__attribute__ ((unused
)))
823 /****************************************************************************
824 Test for single functions of libm
825 ****************************************************************************/
833 x
= random_greater (1);
834 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
839 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
843 check ("acos (0) == pi/2", FUNC(acos
) (0), M_PI_2
);
844 check ("acos (-0) == pi/2", FUNC(acos
) (minus_zero
), M_PI_2
);
846 check ("acos (1) == 0", FUNC(acos
) (1), 0);
847 check ("acos (-1) == pi", FUNC(acos
) (-1), M_PI
);
849 check_eps ("acos (0.5) == pi/3", FUNC(acos
) (0.5), M_PI_6
* 2.0,
850 CHOOSE (1e-18, 0, 0));
851 check_eps ("acos (-0.5) == 2*pi/3", FUNC(acos
) (-0.5), M_PI_6
* 4.0,
852 CHOOSE (1e-17, 0, 0));
854 check_eps ("acos (0.7) == 0.795398830...", FUNC(acos
) (0.7),
855 0.7953988301841435554L, CHOOSE(7e-17L, 0, 0));
866 check_isinfp ("acosh(+inf) == +inf", FUNC(acosh
) (plus_infty
));
869 check_isnan_exc ("acosh(x) == NaN plus invalid exception if x < 1",
870 FUNC(acosh
) (x
), INVALID_EXCEPTION
);
873 check ("acosh(1) == 0", FUNC(acosh
) (1), 0);
874 check_eps ("acosh(7) == 2.633915793...", FUNC(acosh
) (7),
875 2.6339157938496334172L, CHOOSE (3e-19, 0, 0));
885 x
= random_greater (1);
886 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
891 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
896 check ("asin (0) == 0", FUNC(asin
) (0), 0);
897 check ("asin (-0) == -0", FUNC(asin
) (minus_zero
), minus_zero
);
898 check_eps ("asin (0.5) == pi/6", FUNC(asin
) (0.5), M_PI_6
,
899 CHOOSE(3.5e-18, 0, 2e-7));
900 check_eps ("asin (-0.5) == -pi/6", FUNC(asin
) (-0.5), -M_PI_6
,
901 CHOOSE(3.5e-18, 0, 2e-7));
902 check ("asin (1.0) == pi/2", FUNC(asin
) (1.0), M_PI_2
);
903 check ("asin (-1.0) == -pi/2", FUNC(asin
) (-1.0), -M_PI_2
);
904 check_eps ("asin (0.7) == 0.775397496...", FUNC(asin
) (0.7),
905 0.7753974966107530637L, CHOOSE(7e-17L, 2e-16, 0));
913 check ("asinh(+0) == +0", FUNC(asinh
) (0), 0);
915 check ("asinh(-0) == -0", FUNC(asinh
) (minus_zero
), minus_zero
);
916 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh
) (plus_infty
));
917 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh
) (minus_infty
));
919 check_eps ("asinh(0.7) == 0.652666566...", FUNC(asinh
) (0.7),
920 0.652666566082355786L, CHOOSE(4e-17L, 0, 0));
928 check ("atan (0) == 0", FUNC(atan
) (0), 0);
929 check ("atan (-0) == -0", FUNC(atan
) (minus_zero
), minus_zero
);
931 check ("atan (+inf) == pi/2", FUNC(atan
) (plus_infty
), M_PI_2
);
932 check ("atan (-inf) == -pi/2", FUNC(atan
) (minus_infty
), -M_PI_2
);
934 check_eps ("atan (1) == pi/4", FUNC(atan
) (1), M_PI_4
,
935 CHOOSE (1e-18, 0, 0));
936 check_eps ("atan (-1) == -pi/4", FUNC(atan
) (1), M_PI_4
,
937 CHOOSE (1e-18, 0, 0));
939 check_eps ("atan (0.7) == 0.610725964...", FUNC(atan
) (0.7),
940 0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
949 x
= random_greater (0);
950 check ("atan2 (0,x) == 0 for x > 0",
951 FUNC(atan2
) (0, x
), 0);
952 x
= random_greater (0);
953 check ("atan2 (-0,x) == -0 for x > 0",
954 FUNC(atan2
) (minus_zero
, x
), minus_zero
);
956 check ("atan2 (+0,+0) == +0", FUNC(atan2
) (0, 0), 0);
957 check ("atan2 (-0,+0) == -0", FUNC(atan2
) (minus_zero
, 0), minus_zero
);
959 x
= -random_greater (0);
960 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2
) (0, x
), M_PI
);
962 x
= -random_greater (0);
963 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2
) (minus_zero
, x
), -M_PI
);
965 check ("atan2 (+0,-0) == +pi", FUNC(atan2
) (0, minus_zero
), M_PI
);
966 check ("atan2 (-0,-0) == -pi", FUNC(atan2
) (minus_zero
, minus_zero
), -M_PI
);
968 x
= random_greater (0);
969 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2
) (x
, 0), M_PI_2
);
971 x
= random_greater (0);
972 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2
) (x
, minus_zero
), M_PI_2
);
975 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2
) (x
, 0), -M_PI_2
);
978 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2
) (x
, minus_zero
), -M_PI_2
);
980 x
= random_greater (0);
981 check ("atan2 (y,inf) == +0 for finite y > 0",
982 FUNC(atan2
) (x
, plus_infty
), 0);
984 x
= -random_greater (0);
985 check ("atan2 (y,inf) == -0 for finite y < 0",
986 FUNC(atan2
) (x
, plus_infty
), minus_zero
);
988 x
= random_value (-1e4
, 1e4
);
989 check ("atan2(+inf, x) == pi/2 for finite x",
990 FUNC(atan2
) (plus_infty
, x
), M_PI_2
);
992 x
= random_value (-1e4
, 1e4
);
993 check ("atan2(-inf, x) == -pi/2 for finite x",
994 FUNC(atan2
) (minus_infty
, x
), -M_PI_2
);
996 x
= random_greater (0);
997 check ("atan2 (y,-inf) == +pi for finite y > 0",
998 FUNC(atan2
) (x
, minus_infty
), M_PI
);
1000 x
= -random_greater (0);
1001 check ("atan2 (y,-inf) == -pi for finite y < 0",
1002 FUNC(atan2
) (x
, minus_infty
), -M_PI
);
1004 check ("atan2 (+inf,+inf) == +pi/4",
1005 FUNC(atan2
) (plus_infty
, plus_infty
), M_PI_4
);
1007 check ("atan2 (-inf,+inf) == -pi/4",
1008 FUNC(atan2
) (minus_infty
, plus_infty
), -M_PI_4
);
1010 check ("atan2 (+inf,-inf) == +3*pi/4",
1011 FUNC(atan2
) (plus_infty
, minus_infty
), 3 * M_PI_4
);
1013 check ("atan2 (-inf,-inf) == -3*pi/4",
1014 FUNC(atan2
) (minus_infty
, minus_infty
), -3 * M_PI_4
);
1016 /* FIXME: Add some specific tests */
1017 check_eps ("atan2 (0.7,1) == 0.61072...", FUNC(atan2
) (0.7,1),
1018 0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
1019 check_eps ("atan2 (0.4,0.0003) == 1.57004...", FUNC(atan2
) (0.4, 0.0003),
1020 1.5700463269355215718L, CHOOSE(2e-19L, 0, 0));
1032 check ("atanh(+0) == +0", FUNC(atanh
) (0), 0);
1034 check ("atanh(-0) == -0", FUNC(atanh
) (minus_zero
), minus_zero
);
1036 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
1037 FUNC(atanh
) (1), DIVIDE_BY_ZERO_EXCEPTION
);
1038 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
1039 FUNC(atanh
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
1041 x
= random_greater (1.0);
1042 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1043 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
1045 x
= random_less (1.0);
1046 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1047 FUNC(atanh
) (x
), INVALID_EXCEPTION
, x
);
1050 check_eps ("atanh(0.7) == 0.867300527...", FUNC(atanh
) (0.7),
1051 0.8673005276940531944L, CHOOSE(9e-17L, 2e-16, 0));
1058 check ("cbrt (+0) == +0", FUNC(cbrt
) (0.0), 0.0);
1059 check ("cbrt (-0) == -0", FUNC(cbrt
) (minus_zero
), minus_zero
);
1062 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt
) (plus_infty
));
1063 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt
) (minus_infty
));
1064 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt
) (nan_value
));
1066 check_eps ("cbrt (-0.001) == -0.1", FUNC(cbrt
) (-0.001), -0.1,
1067 CHOOSE (5e-18L, 0, 0));
1068 check_eps ("cbrt (8) == 2", FUNC(cbrt
) (8), 2, CHOOSE (5e-17L, 0, 0));
1069 check_eps ("cbrt (-27) == -3", FUNC(cbrt
) (-27.0), -3.0,
1070 CHOOSE (3e-16L, 5e-16, 0));
1071 check_eps ("cbrt (0.970299) == 0.99", FUNC(cbrt
) (0.970299), 0.99,
1072 CHOOSE (2e-17L, 0, 0));
1073 check_eps ("cbrt (0.7) == .8879040017...", FUNC(cbrt
) (0.7),
1074 0.8879040017426007084L, CHOOSE(2e-17L, 6e-16, 0));
1082 check ("ceil (+0) == +0", FUNC(ceil
) (0.0), 0.0);
1083 check ("ceil (-0) == -0", FUNC(ceil
) (minus_zero
), minus_zero
);
1084 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil
) (plus_infty
));
1085 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil
) (minus_infty
));
1087 check ("ceil (pi) == 4", FUNC(ceil
) (M_PI
), 4.0);
1088 check ("ceil (-pi) == -3", FUNC(ceil
) (-M_PI
), -3.0);
1096 check ("cos (+0) == 1", FUNC(cos
) (0), 1);
1097 check ("cos (-0) == 1", FUNC(cos
) (minus_zero
), 1);
1098 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1099 FUNC(cos
) (plus_infty
),
1101 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1102 FUNC(cos
) (minus_infty
),
1105 check_eps ("cos (pi/3) == 0.5", FUNC(cos
) (M_PI_6
* 2.0),
1106 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1107 check_eps ("cos (2*pi/3) == -0.5", FUNC(cos
) (M_PI_6
* 4.0),
1108 -0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1109 check_eps ("cos (pi/2) == 0", FUNC(cos
) (M_PI_2
),
1110 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1112 check_eps ("cos (0.7) == 0.7648421872...", FUNC(cos
) (0.7),
1113 0.7648421872844884262L, CHOOSE(3e-17, 2e-16, 0));
1119 check ("cosh (+0) == 1", FUNC(cosh
) (0), 1);
1120 check ("cosh (-0) == 1", FUNC(cosh
) (minus_zero
), 1);
1123 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh
) (plus_infty
));
1124 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh
) (minus_infty
));
1127 check_eps ("cosh (0.7) == 1.2551690056...", FUNC(cosh
) (0.7),
1128 1.255169005630943018L, CHOOSE(4e-17L, 0, 0));
1137 if (errno
== ENOSYS
)
1138 /* Function not implemented. */
1141 check ("erf (+0) == +0", FUNC(erf
) (0), 0);
1142 check ("erf (-0) == -0", FUNC(erf
) (minus_zero
), minus_zero
);
1143 check ("erf (+inf) == +1", FUNC(erf
) (plus_infty
), 1);
1144 check ("erf (-inf) == -1", FUNC(erf
) (minus_infty
), -1);
1146 check_eps ("erf (0.7) == 0.6778011938...", FUNC(erf
) (0.7),
1147 0.67780119383741847297L, CHOOSE(0, 2e-16, 0));
1156 if (errno
== ENOSYS
)
1157 /* Function not implemented. */
1160 check ("erfc (+inf) == 0", FUNC(erfc
) (plus_infty
), 0.0);
1161 check ("erfc (-inf) == 2", FUNC(erfc
) (minus_infty
), 2.0);
1162 check ("erfc (+0) == 1", FUNC(erfc
) (0.0), 1.0);
1163 check ("erfc (-0) == 1", FUNC(erfc
) (minus_zero
), 1.0);
1165 check_eps ("erfc (0.7) == 0.3221988061...", FUNC(erfc
) (0.7),
1166 0.32219880616258152702L, CHOOSE(0, 6e-17, 0));
1173 check ("exp (+0) == 1", FUNC(exp
) (0), 1);
1174 check ("exp (-0) == 1", FUNC(exp
) (minus_zero
), 1);
1177 check_isinfp ("exp (+inf) == +inf", FUNC(exp
) (plus_infty
));
1178 check ("exp (-inf) == 0", FUNC(exp
) (minus_infty
), 0);
1180 check_eps ("exp (1) == e", FUNC(exp
) (1), M_E
, CHOOSE (4e-18L, 0, 0));
1182 check_eps ("exp (2) == e^2", FUNC(exp
) (2), M_E2
,
1183 CHOOSE (1e-18, 0, 0));
1184 check_eps ("exp (3) == e^3", FUNC(exp
) (3), M_E3
,
1185 CHOOSE (1.5e-17, 0, 0));
1186 check_eps ("exp (0.7) == 2.0137527074...", FUNC(exp
) (0.7),
1187 2.0137527074704765216L, CHOOSE(9e-17L, 0, 0));
1196 if (errno
== ENOSYS
)
1197 /* Function not implemented. */
1200 check ("exp2 (+0) == 1", FUNC(exp2
) (0), 1);
1201 check ("exp2 (-0) == 1", FUNC(exp2
) (minus_zero
), 1);
1203 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2
) (plus_infty
));
1204 check ("exp2 (-inf) == 0", FUNC(exp2
) (minus_infty
), 0);
1205 check ("exp2 (10) == 1024", FUNC(exp2
) (10), 1024);
1206 check ("exp2 (-1) == 0.5", FUNC(exp2
) (-1), 0.5);
1207 check_isinfp ("exp2 (1e6) == +inf", FUNC(exp2
) (1e6
));
1208 check ("exp2 (-1e6) == 0", FUNC(exp2
) (-1e6
), 0);
1209 check_eps ("exp2 (0.7) == 1.6245047927...", FUNC(exp2
) (0.7),
1210 1.6245047927124710452L, CHOOSE(6e-17L, 0, 6e-8));
1217 check ("expm1 (+0) == 0", FUNC(expm1
) (0), 0);
1219 check ("expm1 (-0) == -0", FUNC(expm1
) (minus_zero
), minus_zero
);
1221 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1
) (plus_infty
));
1222 check ("expm1 (-inf) == -1", FUNC(expm1
) (minus_infty
), -1);
1225 check_eps ("expm1 (1) == e-1", FUNC(expm1
) (1), M_E
- 1.0,
1226 CHOOSE (4e-18L, 0, 2e-7));
1228 check_eps ("expm1 (0.7) == 1.01375...", FUNC(expm1
) (0.7),
1229 1.0137527074704765216L, CHOOSE(9e-17L, 0, 0));
1236 check_frexp (const char *test_name
, MATHTYPE computed
, MATHTYPE expected
,
1237 int comp_int
, int exp_int
)
1242 result
= (check_equal (computed
, expected
, 0, &diff
)
1243 && (comp_int
== exp_int
));
1248 printf ("Pass: %s\n", test_name
);
1253 printf ("Fail: %s\n", test_name
);
1256 printf ("Result:\n");
1257 printf (" is: %.20" PRINTF_EXPR
" *2^%d %.20"
1258 PRINTF_XEXPR
"*2^%d\n",
1259 computed
, comp_int
, computed
, comp_int
);
1260 printf (" should be: %.20" PRINTF_EXPR
" *2^%d %.20"
1261 PRINTF_XEXPR
"*2^%d\n",
1262 expected
, exp_int
, expected
, exp_int
);
1263 printf (" difference: %.20" PRINTF_EXPR
" %.20" PRINTF_XEXPR
"\n",
1268 fpstack_test (test_name
);
1269 output_result (test_name
, result
,
1270 computed
, expected
, diff
, PRINT
, PRINT
);
1280 result
= FUNC(frexp
) (plus_infty
, &x_int
);
1281 check_isinfp ("frexp (+inf, expr) == +inf", result
);
1283 result
= FUNC(frexp
) (minus_infty
, &x_int
);
1284 check_isinfn ("frexp (-inf, expr) == -inf", result
);
1286 result
= FUNC(frexp
) (nan_value
, &x_int
);
1287 check_isnan ("frexp (Nan, expr) == NaN", result
);
1289 result
= FUNC(frexp
) (0, &x_int
);
1290 check_frexp ("frexp: +0 == 0 * 2^0", result
, 0, x_int
, 0);
1292 result
= FUNC(frexp
) (minus_zero
, &x_int
);
1293 check_frexp ("frexp: -0 == -0 * 2^0", result
, minus_zero
, x_int
, 0);
1295 result
= FUNC(frexp
) (12.8L, &x_int
);
1296 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result
, 0.8L, x_int
, 4);
1298 result
= FUNC(frexp
) (-27.34L, &x_int
);
1299 check_frexp ("frexp: -27.34 == -0.854375 * 2^5", result
, -0.854375L, x_int
, 5);
1304 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
1305 /* All floating-point numbers can be put in one of these categories. */
1309 #define FP_NAN FP_NAN
1311 #define FP_INFINITE FP_INFINITE
1313 #define FP_ZERO FP_ZERO
1315 #define FP_SUBNORMAL FP_SUBNORMAL
1317 #define FP_NORMAL FP_NORMAL
1323 fpclassify_test (void)
1327 /* fpclassify is a macro, don't give it constants as parameter */
1328 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value
) == FP_NAN
);
1329 check_bool ("fpclassify (+inf) == FP_INFINITE",
1330 fpclassify (plus_infty
) == FP_INFINITE
);
1331 check_bool ("fpclassify (-inf) == FP_INFINITE",
1332 fpclassify (minus_infty
) == FP_INFINITE
);
1333 check_bool ("fpclassify (+0) == FP_ZERO",
1334 fpclassify (plus_zero
) == FP_ZERO
);
1335 check_bool ("fpclassify (-0) == FP_ZERO",
1336 fpclassify (minus_zero
) == FP_ZERO
);
1339 check_bool ("fpclassify (1000) == FP_NORMAL",
1340 fpclassify (x
) == FP_NORMAL
);
1345 isfinite_test (void)
1347 check_bool ("isfinite (0) != 0", isfinite (0));
1348 check_bool ("isfinite (-0) != 0", isfinite (minus_zero
));
1349 check_bool ("isfinite (10) != 0", isfinite (10));
1350 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty
) == 0);
1351 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty
) == 0);
1352 check_bool ("isfinite (NaN) == 0", isfinite (nan_value
) == 0);
1357 isnormal_test (void)
1359 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1360 check_bool ("isnormal (-0) == 0", isnormal (minus_zero
) == 0);
1361 check_bool ("isnormal (10) != 0", isnormal (10));
1362 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty
) == 0);
1363 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty
) == 0);
1364 check_bool ("isnormal (NaN) == 0", isnormal (nan_value
) == 0);
1374 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1375 check_bool ("signbit (-0) != 0", signbit (minus_zero
));
1376 check_bool ("signbit (+inf) == 0", signbit (plus_infty
) == 0);
1377 check_bool ("signbit (-inf) != 0", signbit (minus_infty
));
1379 x
= random_less (0);
1380 check_bool ("signbit (x) != 0 for x < 0", signbit (x
));
1382 x
= random_greater (0);
1383 check_bool ("signbit (x) == 0 for x > 0", signbit (x
) == 0);
1389 gamma has different semantics depending on _LIB_VERSION:
1390 if _LIB_VERSION is _SVID, gamma is just an alias for lgamma,
1391 otherwise gamma is the real gamma function as definied in ISO C 9X.
1396 int save_lib_version
= _LIB_VERSION
;
1399 if (errno
== ENOSYS
)
1400 /* Function not implemented. */
1402 feclearexcept (FE_ALL_EXCEPT
);
1405 _LIB_VERSION
= _SVID_
;
1407 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma
) (plus_infty
));
1408 check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
1409 FUNC(gamma
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1411 check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
1412 FUNC(gamma
) (-3), DIVIDE_BY_ZERO_EXCEPTION
);
1413 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1414 FUNC(gamma
) (minus_infty
), INVALID_EXCEPTION
);
1417 check ("gamma (1) == 0", FUNC(gamma
) (1), 0);
1418 check_int ("gamma (0) sets signgam to 1", signgam
, 1);
1421 check ("gamma (3) == M_LN2", FUNC(gamma
) (3), M_LN2
);
1422 check_int ("gamma (3) sets signgam to 1", signgam
, 1);
1425 check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma
) (0.5),
1426 FUNC(log
) (FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 1e-7));
1427 check_int ("gamma (0.5) sets signgam to 1", signgam
, 1);
1430 check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma
) (-0.5),
1431 FUNC(log
) (2*FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 0));
1433 check_int ("gamma (-0.5) sets signgam to -1", signgam
, -1);
1436 _LIB_VERSION
= _IEEE_
;
1438 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma
) (plus_infty
));
1439 check_isnan_exc ("gamma (0) == NaN plus invalid exception",
1440 FUNC(gamma
) (0), INVALID_EXCEPTION
);
1442 check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for integer x <= 0",
1443 FUNC(gamma
) (-2), INVALID_EXCEPTION
, -2);
1444 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1445 FUNC(gamma
) (minus_infty
), INVALID_EXCEPTION
);
1448 check_eps ("gamma (0.5) == sqrt(pi)", FUNC(gamma
) (0.5), FUNC(sqrt
) (M_PI
),
1449 CHOOSE (0, 5e-16, 2e-7));
1451 check_eps ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma
) (-0.5),
1452 -2*FUNC(sqrt
) (M_PI
), CHOOSE (0, 5e-16, 3e-7));
1454 check ("gamma (1) == 1", FUNC(gamma
) (1), 1);
1455 check ("gamma (4) == 6", FUNC(gamma
) (4), 6);
1457 check_eps ("gamma (0.7) == 1.29805...", FUNC(gamma
) (0.7),
1458 1.29805533264755778568L, CHOOSE(0, 3e-16, 2e-7));
1459 check ("gamma (1.2) == 0.91816...", FUNC(gamma
) (1.2), 0.91816874239976061064L);
1461 _LIB_VERSION
= save_lib_version
;
1470 if (errno
== ENOSYS
)
1471 /* Function not implemented. */
1473 feclearexcept (FE_ALL_EXCEPT
);
1475 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma
) (plus_infty
));
1476 check_isinfp_exc ("lgamma (0) == +inf plus divide by zero exception",
1477 FUNC(lgamma
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1479 check_isinfp_exc ("lgamma (x) == +inf plus divide by zero exception for integer x <= 0",
1480 FUNC(lgamma
) (-3), DIVIDE_BY_ZERO_EXCEPTION
);
1481 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1482 FUNC(lgamma
) (minus_infty
), INVALID_EXCEPTION
);
1485 check ("lgamma (1) == 0", FUNC(lgamma
) (1), 0);
1486 check_int ("lgamma (0) sets signgam to 1", signgam
, 1);
1489 check ("lgamma (3) == M_LN2", FUNC(lgamma
) (3), M_LN2
);
1490 check_int ("lgamma (3) sets signgam to 1", signgam
, 1);
1493 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma
) (0.5),
1494 FUNC(log
) (FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 1e-7));
1495 check_int ("lgamma (0.5) sets signgam to 1", signgam
, 1);
1498 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma
) (-0.5),
1499 FUNC(log
) (2*FUNC(sqrt
) (M_PI
)), CHOOSE (0, 1e-15, 0));
1501 check_int ("lgamma (-0.5) sets signgam to -1", signgam
, -1);
1504 check_eps ("lgamma (0.7) == 0.26086...", FUNC(lgamma
) (0.7),
1505 0.26086724653166651439L, CHOOSE(0, 6e-17, 3e-8));
1506 check_int ("lgamma (0.7) sets signgam to 1", signgam
, 1);
1509 check_eps ("lgamma (1.2) == -0.08537...", FUNC(lgamma
) (1.2),
1510 -0.853740900033158497197e-1L, CHOOSE(0, 2e-17, 2e-8));
1511 check_int ("lgamma (1.2) sets signgam to 1", signgam
, 1);
1521 check_int ("ilogb (1) == 0", FUNC(ilogb
) (1), 0);
1522 check_int ("ilogb (e) == 1", FUNC(ilogb
) (M_E
), 1);
1523 check_int ("ilogb (1024) == 10", FUNC(ilogb
) (1024), 10);
1524 check_int ("ilogb (-2000) == 10", FUNC(ilogb
) (-2000), 10);
1526 /* XXX We have a problem here: the standard does not tell us whether
1527 exceptions are allowed/required. ignore them for now. */
1528 i
= FUNC (ilogb
) (0.0);
1529 feclearexcept (FE_ALL_EXCEPT
);
1530 check_int ("ilogb (0) == FP_ILOGB0", i
, FP_ILOGB0
);
1531 i
= FUNC(ilogb
) (nan_value
);
1532 feclearexcept (FE_ALL_EXCEPT
);
1533 check_int ("ilogb (NaN) == FP_ILOGBNAN", i
, FP_ILOGBNAN
);
1543 check ("ldexp (0, 0) == 0", FUNC(ldexp
) (0, 0), 0);
1545 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp
) (plus_infty
, 1));
1546 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp
) (minus_infty
, 1));
1547 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp
) (nan_value
, 1));
1549 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp
) (0.8L, 4), 12.8L);
1550 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp
) (-0.854375L, 5), -27.34L);
1552 x
= random_greater (0.0);
1553 check_ext ("ldexp (x, 0) == x", FUNC(ldexp
) (x
, 0L), x
, x
);
1561 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1562 FUNC(log
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1563 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1564 FUNC(log
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1566 check ("log (1) == 0", FUNC(log
) (1), 0);
1568 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1569 FUNC(log
) (-1), INVALID_EXCEPTION
);
1570 check_isinfp ("log (+inf) == +inf", FUNC(log
) (plus_infty
));
1572 check_eps ("log (e) == 1", FUNC(log
) (M_E
), 1, CHOOSE (1e-18L, 0, 9e-8L));
1573 check_eps ("log (1/e) == -1", FUNC(log
) (1.0 / M_E
), -1,
1574 CHOOSE (2e-18L, 0, 0));
1575 check ("log (2) == M_LN2", FUNC(log
) (2), M_LN2
);
1576 check_eps ("log (10) == M_LN10", FUNC(log
) (10), M_LN10
,
1577 CHOOSE (1e-18L, 0, 0));
1578 check_eps ("log (0.7) == -0.3566749439...", FUNC(log
) (0.7),
1579 -0.35667494393873237891L, CHOOSE(7e-17L, 6e-17, 3e-8));
1586 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1587 FUNC(log10
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1588 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1589 FUNC(log10
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1591 check ("log10 (1) == +0", FUNC(log10
) (1), 0);
1593 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1594 FUNC(log10
) (-1), INVALID_EXCEPTION
);
1596 check_isinfp ("log10 (+inf) == +inf", FUNC(log10
) (plus_infty
));
1598 check_eps ("log10 (0.1) == -1", FUNC(log10
) (0.1L), -1,
1599 CHOOSE (1e-18L, 0, 0));
1600 check_eps ("log10 (10) == 1", FUNC(log10
) (10.0), 1,
1601 CHOOSE (1e-18L, 0, 0));
1602 check_eps ("log10 (100) == 2", FUNC(log10
) (100.0), 2,
1603 CHOOSE (1e-18L, 0, 0));
1604 check ("log10 (10000) == 4", FUNC(log10
) (10000.0), 4);
1605 check_eps ("log10 (e) == M_LOG10E", FUNC(log10
) (M_E
), M_LOG10E
,
1606 CHOOSE (1e-18, 0, 9e-8));
1607 check_eps ("log10 (0.7) == -0.1549019599...", FUNC(log10
) (0.7),
1608 -0.15490195998574316929L, CHOOSE(3e-17L, 3e-17, 0));
1615 check ("log1p (+0) == +0", FUNC(log1p
) (0), 0);
1616 check ("log1p (-0) == -0", FUNC(log1p
) (minus_zero
), minus_zero
);
1618 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1619 FUNC(log1p
) (-1), DIVIDE_BY_ZERO_EXCEPTION
);
1620 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1621 FUNC(log1p
) (-2), INVALID_EXCEPTION
);
1623 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p
) (plus_infty
));
1625 check_eps ("log1p (e-1) == 1", FUNC(log1p
) (M_E
- 1.0), 1,
1626 CHOOSE (1e-18L, 0, 6e-8));
1628 check_eps ("log1p (-0.3) == -0.35667...", FUNC(log1p
) (-0.3),
1629 -0.35667494393873237891L, CHOOSE(2e-17L, 6e-17, 3e-8));
1636 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1637 FUNC(log2
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1638 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1639 FUNC(log2
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1641 check ("log2 (1) == +0", FUNC(log2
) (1), 0);
1643 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1644 FUNC(log2
) (-1), INVALID_EXCEPTION
);
1646 check_isinfp ("log2 (+inf) == +inf", FUNC(log2
) (plus_infty
));
1648 check_eps ("log2 (e) == M_LOG2E", FUNC(log2
) (M_E
), M_LOG2E
,
1649 CHOOSE (1e-18L, 0, 0));
1650 check ("log2 (2) == 1", FUNC(log2
) (2.0), 1);
1651 check_eps ("log2 (16) == 4", FUNC(log2
) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1652 check ("log2 (256) == 8", FUNC(log2
) (256.0), 8);
1653 check_eps ("log2 (0.7) == -0.5145731728...", FUNC(log2
) (0.7),
1654 -0.51457317282975824043L, CHOOSE(1e-16L, 2e-16, 6e-8));
1662 check_isinfp ("logb (+inf) == +inf", FUNC(logb
) (plus_infty
));
1663 check_isinfp ("logb (-inf) == +inf", FUNC(logb
) (minus_infty
));
1665 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1666 FUNC(logb
) (0), DIVIDE_BY_ZERO_EXCEPTION
);
1668 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1669 FUNC(logb
) (minus_zero
), DIVIDE_BY_ZERO_EXCEPTION
);
1671 check ("logb (1) == 0", FUNC(logb
) (1), 0);
1672 check ("logb (e) == 1", FUNC(logb
) (M_E
), 1);
1673 check ("logb (1024) == 10", FUNC(logb
) (1024), 10);
1674 check ("logb (-2000) == 10", FUNC(logb
) (-2000), 10);
1682 MATHTYPE result
, intpart
;
1684 result
= FUNC(modf
) (plus_infty
, &intpart
);
1685 check ("modf (+inf, &x) returns +0", result
, 0);
1686 check_isinfp ("modf (+inf, &x) set x to +inf", intpart
);
1688 result
= FUNC(modf
) (minus_infty
, &intpart
);
1689 check ("modf (-inf, &x) returns -0", result
, minus_zero
);
1690 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart
);
1692 result
= FUNC(modf
) (nan_value
, &intpart
);
1693 check_isnan ("modf (NaN, &x) returns NaN", result
);
1694 check_isnan ("modf (NaN, &x) sets x to NaN", intpart
);
1696 result
= FUNC(modf
) (0, &intpart
);
1697 check ("modf (0, &x) returns 0", result
, 0);
1698 check ("modf (0, &x) sets x to 0", intpart
, 0);
1700 result
= FUNC(modf
) (minus_zero
, &intpart
);
1701 check ("modf (-0, &x) returns -0", result
, minus_zero
);
1702 check ("modf (-0, &x) sets x to -0", intpart
, minus_zero
);
1704 result
= FUNC(modf
) (2.5, &intpart
);
1705 check ("modf (2.5, &x) returns 0.5", result
, 0.5);
1706 check ("modf (2.5, &x) sets x to 2", intpart
, 2);
1708 result
= FUNC(modf
) (-2.5, &intpart
);
1709 check ("modf (-2.5, &x) returns -0.5", result
, -0.5);
1710 check ("modf (-2.5, &x) sets x to -2", intpart
, -2);
1712 result
= FUNC(modf
) (20, &intpart
);
1713 check ("modf (20, &x) returns 0", result
, 0);
1714 check ("modf (20, &x) sets x to 20", intpart
, 20);
1716 result
= FUNC(modf
) (21, &intpart
);
1717 check ("modf (21, &x) returns 0", result
, 0);
1718 check ("modf (21, &x) sets x to 21", intpart
, 21);
1720 result
= FUNC(modf
) (89.6, &intpart
);
1721 check_eps ("modf (89.6, &x) returns 0.6", result
, 0.6,
1722 CHOOSE(6e-15L, 6e-15, 2e-6));
1723 check ("modf (89.6, &x) sets x to 89", intpart
, 89);
1732 check_isnan ("scalb (2, 0.5) == NaN", FUNC(scalb
) (2, 0.5));
1733 check_isnan ("scalb (3, -2.5) == NaN", FUNC(scalb
) (3, -2.5));
1735 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb
) (0, nan_value
));
1736 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb
) (1, nan_value
));
1738 x
= random_greater (0.0);
1739 check ("scalb (x, 0) == 0", FUNC(scalb
) (x
, 0), x
);
1740 x
= random_greater (0.0);
1741 check ("scalb (-x, 0) == 0", FUNC(scalb
) (-x
, 0), -x
);
1743 check_isnan_exc ("scalb (+0, +inf) == NaN plus invalid exception",
1744 FUNC(scalb
) (0, plus_infty
), INVALID_EXCEPTION
);
1745 check_isnan_exc ("scalb (-0, +inf) == NaN plus invalid exception",
1746 FUNC(scalb
) (minus_zero
, plus_infty
), INVALID_EXCEPTION
);
1748 check ("scalb (+0, 2) == +0", FUNC(scalb
) (0, 2), 0);
1749 check ("scalb (-0, 4) == -0", FUNC(scalb
) (minus_zero
, -4), minus_zero
);
1750 check ("scalb (+0, 0) == +0", FUNC(scalb
) (0, 0), 0);
1751 check ("scalb (-0, 0) == -0", FUNC(scalb
) (minus_zero
, 0), minus_zero
);
1752 check ("scalb (+0, -1) == +0", FUNC(scalb
) (0, -1), 0);
1753 check ("scalb (-0, -10) == -0", FUNC(scalb
) (minus_zero
, -10), minus_zero
);
1754 check ("scalb (+0, -inf) == +0", FUNC(scalb
) (0, minus_infty
), 0);
1755 check ("scalb (-0, -inf) == -0", FUNC(scalb
) (minus_zero
, minus_infty
),
1758 check_isinfp ("scalb (+inf, -1) == +inf", FUNC(scalb
) (plus_infty
, -1));
1759 check_isinfn ("scalb (-inf, -10) == -inf", FUNC(scalb
) (minus_infty
, -10));
1760 check_isinfp ("scalb (+inf, 0) == +inf", FUNC(scalb
) (plus_infty
, 0));
1761 check_isinfn ("scalb (-inf, 0) == -inf", FUNC(scalb
) (minus_infty
, 0));
1762 check_isinfp ("scalb (+inf, 2) == +inf", FUNC(scalb
) (plus_infty
, 2));
1763 check_isinfn ("scalb (-inf, 100) == -inf", FUNC(scalb
) (minus_infty
, 100));
1765 x
= random_greater (0.0);
1766 check ("scalb (x, -inf) == 0", FUNC(scalb
) (x
, minus_infty
), 0.0);
1767 check ("scalb (-x, -inf) == -0", FUNC(scalb
) (-x
, minus_infty
), minus_zero
);
1769 x
= random_greater (0.0);
1770 check_isinfp ("scalb (x, +inf) == +inf", FUNC(scalb
) (x
, plus_infty
));
1771 x
= random_greater (0.0);
1772 check_isinfn ("scalb (-x, +inf) == -inf", FUNC(scalb
) (-x
, plus_infty
));
1773 check_isinfp ("scalb (+inf, +inf) == +inf",
1774 FUNC(scalb
) (plus_infty
, plus_infty
));
1775 check_isinfn ("scalb (-inf, +inf) == -inf",
1776 FUNC(scalb
) (minus_infty
, plus_infty
));
1778 check_isnan ("scalb (+inf, -inf) == NaN",
1779 FUNC(scalb
) (plus_infty
, minus_infty
));
1780 check_isnan ("scalb (-inf, -inf) == NaN",
1781 FUNC(scalb
) (minus_infty
, minus_infty
));
1783 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb
) (nan_value
, 1));
1784 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb
) (1, nan_value
));
1785 check_isnan ("scalb (NaN, 0) == NaN", FUNC(scalb
) (nan_value
, 0));
1786 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb
) (0, nan_value
));
1787 check_isnan ("scalb (NaN, +inf) == NaN",
1788 FUNC(scalb
) (nan_value
, plus_infty
));
1789 check_isnan ("scalb (+inf, NaN) == NaN",
1790 FUNC(scalb
) (plus_infty
, nan_value
));
1791 check_isnan ("scalb (NaN, NaN) == NaN", FUNC(scalb
) (nan_value
, nan_value
));
1793 check ("scalb (0.8, 4) == 12.8", FUNC(scalb
) (0.8L, 4), 12.8L);
1794 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb
) (-0.854375L, 5), -27.34L);
1803 check ("scalbn (0, 0) == 0", FUNC(scalbn
) (0, 0), 0);
1805 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn
) (plus_infty
, 1));
1806 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn
) (minus_infty
, 1));
1807 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn
) (nan_value
, 1));
1809 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn
) (0.8L, 4), 12.8L);
1810 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn
) (-0.854375L, 5), -27.34L);
1812 x
= random_greater (0.0);
1813 check_ext ("scalbn (x, 0) == x", FUNC(scalbn
) (x
, 0L), x
, x
);
1820 check ("sin (+0) == +0", FUNC(sin
) (0), 0);
1821 check ("sin (-0) == -0", FUNC(sin
) (minus_zero
), minus_zero
);
1822 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1823 FUNC(sin
) (plus_infty
),
1825 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1826 FUNC(sin
) (minus_infty
),
1829 check_eps ("sin (pi/6) == 0.5", FUNC(sin
) (M_PI_6
),
1830 0.5, CHOOSE (4e-18L, 0, 0));
1831 check_eps ("sin (-pi/6) == -0.5", FUNC(sin
) (-M_PI_6
),
1832 -0.5, CHOOSE (4e-18L, 0, 0));
1833 check ("sin (pi/2) == 1", FUNC(sin
) (M_PI_2
), 1);
1834 check ("sin (-pi/2) == -1", FUNC(sin
) (-M_PI_2
), -1);
1835 check_eps ("sin (0.7) == 0.6442176872...", FUNC(sin
) (0.7),
1836 0.64421768723769105367L, CHOOSE(4e-17L, 0, 0));
1843 check ("sinh (+0) == +0", FUNC(sinh
) (0), 0);
1846 check ("sinh (-0) == -0", FUNC(sinh
) (minus_zero
), minus_zero
);
1848 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh
) (plus_infty
));
1849 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh
) (minus_infty
));
1852 check_eps ("sinh (0.7) == 0.7585837018...", FUNC(sinh
) (0.7),
1853 0.75858370183953350346L, CHOOSE(6e-17L, 0, 6e-8));
1860 MATHTYPE sin_res
, cos_res
;
1863 FUNC(sincos
) (0, &sin_res
, &cos_res
);
1865 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res
, 0);
1867 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1869 FUNC(sincos
) (minus_zero
, &sin_res
, &cos_res
);
1871 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res
, minus_zero
);
1873 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res
, 1);
1875 FUNC(sincos
) (plus_infty
, &sin_res
, &cos_res
);
1877 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1878 sin_res
, INVALID_EXCEPTION
);
1880 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1881 cos_res
, INVALID_EXCEPTION
);
1883 FUNC(sincos
) (minus_infty
, &sin_res
, &cos_res
);
1885 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1886 sin_res
, INVALID_EXCEPTION
);
1888 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1889 cos_res
, INVALID_EXCEPTION
);
1891 FUNC(sincos
) (M_PI_2
, &sin_res
, &cos_res
);
1893 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res
, 1);
1895 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res
, 0,
1896 CHOOSE (1e-18L, 1e-16, 1e-7));
1898 FUNC(sincos
) (M_PI_6
, &sin_res
, &cos_res
);
1899 check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res
, 0.5,
1900 CHOOSE (5e-18L, 0, 0));
1902 FUNC(sincos
) (M_PI_6
*2.0, &sin_res
, &cos_res
);
1903 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res
, 0.5,
1904 CHOOSE (5e-18L, 1e-15, 1e-7));
1906 FUNC(sincos
) (0.7, &sin_res
, &cos_res
);
1907 check_eps ("sincos (0.7, &sin, &cos) puts 0.6442176872... in sin", sin_res
,
1908 0.64421768723769105367L, CHOOSE(4e-17L, 0, 0));
1909 check_eps ("sincos (0.7, &sin, &cos) puts 0.7648421872... in cos", cos_res
,
1910 0.76484218728448842626L, CHOOSE(3e-17L, 2e-16, 0));
1917 check ("tan (+0) == +0", FUNC(tan
) (0), 0);
1918 check ("tan (-0) == -0", FUNC(tan
) (minus_zero
), minus_zero
);
1919 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1920 FUNC(tan
) (plus_infty
), INVALID_EXCEPTION
);
1921 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1922 FUNC(tan
) (minus_infty
), INVALID_EXCEPTION
);
1924 check_eps ("tan (pi/4) == 1", FUNC(tan
) (M_PI_4
), 1,
1925 CHOOSE (2e-18L, 1e-15L, 2e-7));
1926 check_eps ("tan (0.7) == 0.8422883804...", FUNC(tan
) (0.7),
1927 0.84228838046307944813L, CHOOSE(8e-17L, 0, 0));
1934 check ("tanh (+0) == +0", FUNC(tanh
) (0), 0);
1936 check ("tanh (-0) == -0", FUNC(tanh
) (minus_zero
), minus_zero
);
1938 check ("tanh (+inf) == +1", FUNC(tanh
) (plus_infty
), 1);
1939 check ("tanh (-inf) == -1", FUNC(tanh
) (minus_infty
), -1);
1941 check_eps ("tanh (0.7) == 0.6043677771...", FUNC(tanh
) (0.7),
1942 0.60436777711716349631L, CHOOSE(3e-17L, 0, 0));
1949 check ("fabs (+0) == +0", FUNC(fabs
) (0), 0);
1950 check ("fabs (-0) == +0", FUNC(fabs
) (minus_zero
), 0);
1952 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs
) (plus_infty
));
1953 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs
) (minus_infty
));
1955 check ("fabs (+38) == 38", FUNC(fabs
) (38.0), 38.0);
1956 check ("fabs (-e) == e", FUNC(fabs
) (-M_E
), M_E
);
1963 check ("floor (+0) == +0", FUNC(floor
) (0.0), 0.0);
1964 check ("floor (-0) == -0", FUNC(floor
) (minus_zero
), minus_zero
);
1965 check_isinfp ("floor (+inf) == +inf", FUNC(floor
) (plus_infty
));
1966 check_isinfn ("floor (-inf) == -inf", FUNC(floor
) (minus_infty
));
1968 check ("floor (pi) == 3", FUNC(floor
) (M_PI
), 3.0);
1969 check ("floor (-pi) == -4", FUNC(floor
) (-M_PI
), -4.0);
1978 a
= random_greater (0);
1979 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot
) (plus_infty
, a
), a
);
1980 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot
) (minus_infty
, a
), a
);
1983 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1984 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot
) (minus_infty
, nan_value
));
1987 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot
) (nan_value
, nan_value
));
1989 a
= FUNC(hypot
) (12.4L, 0.7L);
1990 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot
) (0.7L, 12.4L), a
);
1991 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot
) (-12.4L, 0.7L), a
);
1992 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot
) (-0.7L, 12.4L), a
);
1993 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot
) (-12.4L, -0.7L), a
);
1994 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot
) (-0.7L, -12.4L), a
);
1995 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-0.7L, 0), 0.7L);
1996 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (0.7L, 0), 0.7L);
1997 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-1.0L, 0), 1.0L);
1998 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (1.0L, 0), 1.0L);
1999 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (-5.7e7L
, 0), 5.7e7L
);
2000 check ("hypot (x,0) == fabs (x)", FUNC(hypot
) (5.7e7L
, 0), 5.7e7L
);
2002 check_eps ("hypot (0.7,1.2) == 1.38924...", FUNC(hypot
) (0.7, 1.2),
2003 1.3892443989449804508L, CHOOSE(7e-17L, 3e-16, 0));
2012 check ("pow (+0, +0) == 1", FUNC(pow
) (0, 0), 1);
2013 check ("pow (+0, -0) == 1", FUNC(pow
) (0, minus_zero
), 1);
2014 check ("pow (-0, +0) == 1", FUNC(pow
) (minus_zero
, 0), 1);
2015 check ("pow (-0, -0) == 1", FUNC(pow
) (minus_zero
, minus_zero
), 1);
2017 check ("pow (+10, +0) == 1", FUNC(pow
) (10, 0), 1);
2018 check ("pow (+10, -0) == 1", FUNC(pow
) (10, minus_zero
), 1);
2019 check ("pow (-10, +0) == 1", FUNC(pow
) (-10, 0), 1);
2020 check ("pow (-10, -0) == 1", FUNC(pow
) (-10, minus_zero
), 1);
2022 check ("pow (NaN, +0) == 1", FUNC(pow
) (nan_value
, 0), 1);
2023 check ("pow (NaN, -0) == 1", FUNC(pow
) (nan_value
, minus_zero
), 1);
2026 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow
) (1.1, plus_infty
));
2027 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow
) (plus_infty
, plus_infty
));
2028 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow
) (-1.1, plus_infty
));
2029 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow
) (minus_infty
, plus_infty
));
2031 check ("pow (0.9, +inf) == +0", FUNC(pow
) (0.9L, plus_infty
), 0);
2032 check ("pow (1e-7, +inf) == +0", FUNC(pow
) (1e-7L, plus_infty
), 0);
2033 check ("pow (-0.9, +inf) == +0", FUNC(pow
) (-0.9L, plus_infty
), 0);
2034 check ("pow (-1e-7, +inf) == +0", FUNC(pow
) (-1e-7L, plus_infty
), 0);
2036 check ("pow (+1.1, -inf) == 0", FUNC(pow
) (1.1, minus_infty
), 0);
2037 check ("pow (+inf, -inf) == 0", FUNC(pow
) (plus_infty
, minus_infty
), 0);
2038 check ("pow (-1.1, -inf) == 0", FUNC(pow
) (-1.1, minus_infty
), 0);
2039 check ("pow (-inf, -inf) == 0", FUNC(pow
) (minus_infty
, minus_infty
), 0);
2041 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow
) (0.9L, minus_infty
));
2042 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow
) (1e-7L, minus_infty
));
2043 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow
) (-0.9L, minus_infty
));
2044 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow
) (-1e-7L, minus_infty
));
2046 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow
) (plus_infty
, 1e-7L));
2047 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow
) (plus_infty
, 1));
2048 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow
) (plus_infty
, 1e7L
));
2050 check ("pow (+inf, -1e-7) == 0", FUNC(pow
) (plus_infty
, -1e-7L), 0);
2051 check ("pow (+inf, -1) == 0", FUNC(pow
) (plus_infty
, -1), 0);
2052 check ("pow (+inf, -1e7) == 0", FUNC(pow
) (plus_infty
, -1e7L
), 0);
2054 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow
) (minus_infty
, 1));
2055 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow
) (minus_infty
, 11));
2056 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow
) (minus_infty
, 1001));
2058 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow
) (minus_infty
, 2));
2059 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow
) (minus_infty
, 12));
2060 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow
) (minus_infty
, 1002));
2061 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow
) (minus_infty
, 0.1));
2062 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow
) (minus_infty
, 1.1));
2063 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow
) (minus_infty
, 11.1));
2064 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow
) (minus_infty
, 1001.1));
2066 check ("pow (-inf, -1) == -0", FUNC(pow
) (minus_infty
, -1), minus_zero
);
2067 check ("pow (-inf, -11) == -0", FUNC(pow
) (minus_infty
, -11), minus_zero
);
2068 check ("pow (-inf, -1001) == -0", FUNC(pow
) (minus_infty
, -1001), minus_zero
);
2070 check ("pow (-inf, -2) == +0", FUNC(pow
) (minus_infty
, -2), 0);
2071 check ("pow (-inf, -12) == +0", FUNC(pow
) (minus_infty
, -12), 0);
2072 check ("pow (-inf, -1002) == +0", FUNC(pow
) (minus_infty
, -1002), 0);
2073 check ("pow (-inf, -0.1) == +0", FUNC(pow
) (minus_infty
, -0.1), 0);
2074 check ("pow (-inf, -1.1) == +0", FUNC(pow
) (minus_infty
, -1.1), 0);
2075 check ("pow (-inf, -11.1) == +0", FUNC(pow
) (minus_infty
, -11.1), 0);
2076 check ("pow (-inf, -1001.1) == +0", FUNC(pow
) (minus_infty
, -1001.1), 0);
2078 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow
) (nan_value
, nan_value
));
2079 check_isnan ("pow (0, NaN) == NaN", FUNC(pow
) (0, nan_value
));
2080 check_isnan ("pow (1, NaN) == NaN", FUNC(pow
) (1, nan_value
));
2081 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow
) (-1, nan_value
));
2082 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow
) (nan_value
, 1));
2083 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow
) (nan_value
, -1));
2085 x
= random_greater (0.0);
2086 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow
) (x
, nan_value
), x
);
2088 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
2089 FUNC(pow
) (1, plus_infty
), INVALID_EXCEPTION
);
2090 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
2091 FUNC(pow
) (-1, plus_infty
), INVALID_EXCEPTION
);
2092 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
2093 FUNC(pow
) (1, minus_infty
), INVALID_EXCEPTION
);
2094 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
2095 FUNC(pow
) (-1, minus_infty
), INVALID_EXCEPTION
);
2097 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
2098 FUNC(pow
) (-0.1, 1.1), INVALID_EXCEPTION
);
2099 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
2100 FUNC(pow
) (-0.1, -1.1), INVALID_EXCEPTION
);
2101 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
2102 FUNC(pow
) (-10.1, 1.1), INVALID_EXCEPTION
);
2103 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
2104 FUNC(pow
) (-10.1, -1.1), INVALID_EXCEPTION
);
2106 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
2107 FUNC(pow
) (0, -1), DIVIDE_BY_ZERO_EXCEPTION
);
2108 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
2109 FUNC(pow
) (0, -11), DIVIDE_BY_ZERO_EXCEPTION
);
2110 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
2111 FUNC(pow
) (minus_zero
, -1), DIVIDE_BY_ZERO_EXCEPTION
);
2112 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
2113 FUNC(pow
) (minus_zero
, -11), DIVIDE_BY_ZERO_EXCEPTION
);
2115 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
2116 FUNC(pow
) (0, -2), DIVIDE_BY_ZERO_EXCEPTION
);
2117 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
2118 FUNC(pow
) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
2119 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
2120 FUNC(pow
) (minus_zero
, -2), DIVIDE_BY_ZERO_EXCEPTION
);
2121 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
2122 FUNC(pow
) (minus_zero
, -11.1), DIVIDE_BY_ZERO_EXCEPTION
);
2125 check ("pow (+0, 1) == +0", FUNC(pow
) (0, 1), 0);
2126 check ("pow (+0, 11) == +0", FUNC(pow
) (0, 11), 0);
2128 check ("pow (-0, 1) == -0", FUNC(pow
) (minus_zero
, 1), minus_zero
);
2129 check ("pow (-0, 11) == -0", FUNC(pow
) (minus_zero
, 11), minus_zero
);
2132 check ("pow (+0, 2) == +0", FUNC(pow
) (0, 2), 0);
2133 check ("pow (+0, 11.1) == +0", FUNC(pow
) (0, 11.1), 0);
2136 check ("pow (-0, 2) == +0", FUNC(pow
) (minus_zero
, 2), 0);
2137 check ("pow (-0, 11.1) == +0", FUNC(pow
) (minus_zero
, 11.1), 0);
2139 x
= random_greater (1.0);
2140 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
2141 FUNC(pow
) (x
, plus_infty
), x
);
2143 x
= random_value (-1.0, 1.0);
2144 check_ext ("pow (x, +inf) == +0 for |x| < 1",
2145 FUNC(pow
) (x
, plus_infty
), 0.0, x
);
2147 x
= random_greater (1.0);
2148 check_ext ("pow (x, -inf) == +0 for |x| > 1",
2149 FUNC(pow
) (x
, minus_infty
), 0.0, x
);
2151 x
= random_value (-1.0, 1.0);
2152 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
2153 FUNC(pow
) (x
, minus_infty
), x
);
2155 x
= random_greater (0.0);
2156 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
2157 FUNC(pow
) (plus_infty
, x
), x
);
2159 x
= random_less (0.0);
2160 check_ext ("pow (+inf, y) == +0 for y < 0",
2161 FUNC(pow
) (plus_infty
, x
), 0.0, x
);
2163 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2164 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
2165 FUNC(pow
) (minus_infty
, x
), x
);
2167 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2168 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
2169 FUNC(pow
) (minus_infty
, x
), x
);
2171 x
= -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
2172 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
2173 FUNC(pow
) (minus_infty
, x
), minus_zero
, x
);
2175 x
= ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
2176 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
2177 FUNC(pow
) (minus_infty
, x
), 0.0, x
);
2180 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2181 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
2182 FUNC(pow
) (0.0, x
), 0.0, x
);
2184 x
= (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2185 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
2186 FUNC(pow
) (minus_zero
, x
), minus_zero
, x
);
2189 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2190 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
2191 FUNC(pow
) (0.0, x
), 0.0, x
);
2193 x
= ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2194 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
2195 FUNC(pow
) (minus_zero
, x
), 0.0, x
);
2197 check_eps ("pow (0.7, 1.2) == 0.65180...", FUNC(pow
) (0.7, 1.2),
2198 0.65180494056638638188L, CHOOSE(4e-17L, 0, 0));
2205 check ("fdim (+0, +0) = +0", FUNC(fdim
) (0, 0), 0);
2206 check ("fdim (9, 0) = 9", FUNC(fdim
) (9, 0), 9);
2207 check ("fdim (0, 9) = 0", FUNC(fdim
) (0, 9), 0);
2208 check ("fdim (-9, 0) = 9", FUNC(fdim
) (-9, 0), 0);
2209 check ("fdim (0, -9) = 9", FUNC(fdim
) (0, -9), 9);
2211 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim
) (plus_infty
, 9));
2212 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim
) (plus_infty
, -9));
2213 check ("fdim (-inf, 9) = 0", FUNC(fdim
) (minus_infty
, 9), 0);
2214 check ("fdim (-inf, -9) = 0", FUNC(fdim
) (minus_infty
, -9), 0);
2215 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim
) (9, minus_infty
));
2216 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim
) (-9, minus_infty
));
2217 check ("fdim (9, inf) = 0", FUNC(fdim
) (9, plus_infty
), 0);
2218 check ("fdim (-9, inf) = 0", FUNC(fdim
) (-9, plus_infty
), 0);
2220 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim
) (0, nan_value
));
2221 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim
) (9, nan_value
));
2222 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim
) (-9, nan_value
));
2223 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim
) (nan_value
, 9));
2224 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim
) (nan_value
, -9));
2225 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim
) (plus_infty
, nan_value
));
2226 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim
) (minus_infty
, nan_value
));
2227 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim
) (nan_value
, plus_infty
));
2228 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim
) (nan_value
, minus_infty
));
2229 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim
) (nan_value
, nan_value
));
2236 check ("fmin (+0, +0) = +0", FUNC(fmin
) (0, 0), 0);
2237 check ("fmin (9, 0) = 0", FUNC(fmin
) (9, 0), 0);
2238 check ("fmin (0, 9) = 0", FUNC(fmin
) (0, 9), 0);
2239 check ("fmin (-9, 0) = -9", FUNC(fmin
) (-9, 0), -9);
2240 check ("fmin (0, -9) = -9", FUNC(fmin
) (0, -9), -9);
2242 check ("fmin (+inf, 9) = 9", FUNC(fmin
) (plus_infty
, 9), 9);
2243 check ("fmin (9, +inf) = 9", FUNC(fmin
) (9, plus_infty
), 9);
2244 check ("fmin (+inf, -9) = -9", FUNC(fmin
) (plus_infty
, -9), -9);
2245 check ("fmin (-9, +inf) = -9", FUNC(fmin
) (-9, plus_infty
), -9);
2246 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin
) (minus_infty
, 9));
2247 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin
) (minus_infty
, -9));
2248 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin
) (9, minus_infty
));
2249 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin
) (-9, minus_infty
));
2251 check ("fmin (0, NaN) = 0", FUNC(fmin
) (0, nan_value
), 0);
2252 check ("fmin (9, NaN) = 9", FUNC(fmin
) (9, nan_value
), 9);
2253 check ("fmin (-9, NaN) = 9", FUNC(fmin
) (-9, nan_value
), -9);
2254 check ("fmin (NaN, 0) = 0", FUNC(fmin
) (nan_value
, 0), 0);
2255 check ("fmin (NaN, 9) = NaN", FUNC(fmin
) (nan_value
, 9), 9);
2256 check ("fmin (NaN, -9) = NaN", FUNC(fmin
) (nan_value
, -9), -9);
2257 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin
) (plus_infty
, nan_value
));
2258 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin
) (minus_infty
, nan_value
));
2259 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin
) (nan_value
, plus_infty
));
2260 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin
) (nan_value
, minus_infty
));
2261 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin
) (nan_value
, nan_value
));
2268 check ("fmax (+0, +0) = +0", FUNC(fmax
) (0, 0), 0);
2269 check ("fmax (9, 0) = 9", FUNC(fmax
) (9, 0), 9);
2270 check ("fmax (0, 9) = 9", FUNC(fmax
) (0, 9), 9);
2271 check ("fmax (-9, 0) = 0", FUNC(fmax
) (-9, 0), 0);
2272 check ("fmax (0, -9) = 0", FUNC(fmax
) (0, -9), 0);
2274 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax
) (plus_infty
, 9));
2275 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax
) (0, plus_infty
));
2276 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax
) (-9, plus_infty
));
2277 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax
) (plus_infty
, -9));
2278 check ("fmax (-inf, 9) = 9", FUNC(fmax
) (minus_infty
, 9), 9);
2279 check ("fmax (-inf, -9) = -9", FUNC(fmax
) (minus_infty
, -9), -9);
2280 check ("fmax (+9, -inf) = 9", FUNC(fmax
) (9, minus_infty
), 9);
2281 check ("fmax (-9, -inf) = -9", FUNC(fmax
) (-9, minus_infty
), -9);
2283 check ("fmax (0, NaN) = 0", FUNC(fmax
) (0, nan_value
), 0);
2284 check ("fmax (9, NaN) = 9", FUNC(fmax
) (9, nan_value
), 9);
2285 check ("fmax (-9, NaN) = 9", FUNC(fmax
) (-9, nan_value
), -9);
2286 check ("fmax (NaN, 0) = 0", FUNC(fmax
) (nan_value
, 0), 0);
2287 check ("fmax (NaN, 9) = NaN", FUNC(fmax
) (nan_value
, 9), 9);
2288 check ("fmax (NaN, -9) = NaN", FUNC(fmax
) (nan_value
, -9), -9);
2289 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax
) (plus_infty
, nan_value
));
2290 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax
) (minus_infty
, nan_value
));
2291 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax
) (nan_value
, plus_infty
));
2292 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax
) (nan_value
, minus_infty
));
2293 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax
) (nan_value
, nan_value
));
2302 x
= random_greater (0);
2303 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod
) (0, x
), 0, x
);
2305 x
= random_greater (0);
2306 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod
) (minus_zero
, x
),
2309 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2310 FUNC(fmod
) (plus_infty
, x
), INVALID_EXCEPTION
, x
);
2311 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2312 FUNC(fmod
) (minus_infty
, x
), INVALID_EXCEPTION
, x
);
2313 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2314 FUNC(fmod
) (x
, 0), INVALID_EXCEPTION
, x
);
2315 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2316 FUNC(fmod
) (x
, minus_zero
), INVALID_EXCEPTION
, x
);
2318 x
= random_greater (0);
2319 check_ext ("fmod (x, +inf) == x for x not infinite",
2320 FUNC(fmod
) (x
, plus_infty
), x
, x
);
2321 x
= random_greater (0);
2322 check_ext ("fmod (x, -inf) == x for x not infinite",
2323 FUNC(fmod
) (x
, minus_infty
), x
, x
);
2325 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod
) (6.5, 2.3), 1.9,
2326 CHOOSE(5e-16, 1e-15, 2e-7));
2327 check_eps ("fmod (-6.5, 2.3) == -1.9", FUNC(fmod
) (-6.5, 2.3), -1.9,
2328 CHOOSE(5e-16, 1e-15, 2e-7));
2329 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod
) (6.5, -2.3), 1.9,
2330 CHOOSE(5e-16, 1e-15, 2e-7));
2331 check_eps ("fmod (-6.5, -2.3) == -1.9", FUNC(fmod
) (-6.5, -2.3), -1.9,
2332 CHOOSE(5e-16, 1e-15, 2e-7));
2339 nextafter_test (void)
2343 check ("nextafter (+0, +0) = +0", FUNC(nextafter
) (0, 0), 0);
2344 check ("nextafter (-0, +0) = +0", FUNC(nextafter
) (minus_zero
, 0), 0);
2345 check ("nextafter (+0, -0) = -0", FUNC(nextafter
) (0, minus_zero
),
2347 check ("nextafter (-0, -0) = -0", FUNC(nextafter
) (minus_zero
, minus_zero
),
2350 check ("nextafter (9, 9) = 9", FUNC(nextafter
) (9, 9), 9);
2351 check ("nextafter (-9, -9) = -9", FUNC(nextafter
) (-9, -9), -9);
2352 check_isinfp ("nextafter (+inf, +inf) = +inf",
2353 FUNC(nextafter
) (plus_infty
, plus_infty
));
2354 check_isinfn ("nextafter (-inf, -inf) = -inf",
2355 FUNC(nextafter
) (minus_infty
, minus_infty
));
2358 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter
) (nan_value
, x
));
2359 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter
) (x
, nan_value
));
2360 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter
) (nan_value
,
2363 /* XXX We need the hexadecimal FP number representation here for further
2369 copysign_test (void)
2371 check ("copysign (0, 4) = 0", FUNC(copysign
) (0, 4), 0);
2372 check ("copysign (0, -4) = -0", FUNC(copysign
) (0, -4), minus_zero
);
2373 check ("copysign (-0, 4) = 0", FUNC(copysign
) (minus_zero
, 4), 0);
2374 check ("copysign (-0, -4) = -0", FUNC(copysign
) (minus_zero
, -4),
2377 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign
) (plus_infty
, 0));
2378 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign
) (plus_infty
,
2380 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign
) (minus_infty
, 0));
2381 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign
) (minus_infty
,
2384 check ("copysign (0, +inf) = 0", FUNC(copysign
) (0, plus_infty
), 0);
2385 check ("copysign (0, -inf) = -0", FUNC(copysign
) (0, minus_zero
),
2387 check ("copysign (-0, +inf) = 0", FUNC(copysign
) (minus_zero
, plus_infty
),
2389 check ("copysign (-0, -inf) = -0", FUNC(copysign
) (minus_zero
, minus_zero
),
2392 /* XXX More correctly we would have to check the sign of the NaN. */
2393 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign
) (nan_value
, 0));
2394 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign
) (nan_value
,
2396 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign
) (-nan_value
, 0));
2397 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign
) (-nan_value
,
2405 check ("trunc(0) = 0", FUNC(trunc
) (0), 0);
2406 check ("trunc(-0) = -0", FUNC(trunc
) (minus_zero
), minus_zero
);
2407 check ("trunc(0.625) = 0", FUNC(trunc
) (0.625), 0);
2408 check ("trunc(-0.625) = -0", FUNC(trunc
) (-0.625), minus_zero
);
2409 check ("trunc(1) = 1", FUNC(trunc
) (1), 1);
2410 check ("trunc(-1) = -1", FUNC(trunc
) (-1), -1);
2411 check ("trunc(1.625) = 1", FUNC(trunc
) (1.625), 1);
2412 check ("trunc(-1.625) = -1", FUNC(trunc
) (-1.625), -1);
2414 check ("trunc(1048580.625) = 1048580", FUNC(trunc
) (1048580.625L),
2416 check ("trunc(-1048580.625) = -1048580", FUNC(trunc
) (-1048580.625L),
2419 check ("trunc(8388610.125) = 8388610", FUNC(trunc
) (8388610.125L),
2421 check ("trunc(-8388610.125) = -8388610", FUNC(trunc
) (-8388610.125L),
2424 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc
) (4294967296.625L),
2426 check ("trunc(-4294967296.625) = -4294967296",
2427 FUNC(trunc
) (-4294967296.625L), -4294967296.0L);
2429 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc
) (plus_infty
));
2430 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc
) (minus_infty
));
2431 check_isnan ("trunc(NaN) = NaN", FUNC(trunc
) (nan_value
));
2441 /* XXX Tests fuer negative x are missing */
2442 check ("sqrt (0) == 0", FUNC(sqrt
) (0), 0);
2443 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt
) (nan_value
));
2444 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt
) (plus_infty
));
2446 check ("sqrt (-0) == -0", FUNC(sqrt
) (0), 0);
2448 x
= random_less (0.0);
2449 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2450 FUNC(sqrt
) (x
), INVALID_EXCEPTION
, x
);
2452 x
= random_value (0, 10000);
2453 check_ext ("sqrt (x*x) == x", FUNC(sqrt
) (x
*x
), x
, x
);
2454 check ("sqrt (4) == 2", FUNC(sqrt
) (4), 2);
2455 check ("sqrt (0.25) == 0.5", FUNC(sqrt
) (0.25), 0.5);
2456 check ("sqrt (6642.25) == 81.5", FUNC(sqrt
) (6642.25), 81.5);
2457 check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt
) (15239.903), 123.45,
2458 CHOOSE (3e-6L, 3e-6, 8e-6));
2459 check_eps ("sqrt (0.7) == 0.8366600265", FUNC(sqrt
) (0.7),
2460 0.83666002653407554798L, CHOOSE(3e-17L, 0, 0));
2464 remainder_test (void)
2468 result
= FUNC(remainder
) (1, 0);
2469 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2470 result
, INVALID_EXCEPTION
);
2472 result
= FUNC(remainder
) (1, minus_zero
);
2473 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2474 result
, INVALID_EXCEPTION
);
2476 result
= FUNC(remainder
) (plus_infty
, 1);
2477 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2478 result
, INVALID_EXCEPTION
);
2480 result
= FUNC(remainder
) (minus_infty
, 1);
2481 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2482 result
, INVALID_EXCEPTION
);
2484 result
= FUNC(remainder
) (1.625, 1.0);
2485 check ("remainder(1.625, 1.0) == -0.375", result
, -0.375);
2487 result
= FUNC(remainder
) (-1.625, 1.0);
2488 check ("remainder(-1.625, 1.0) == 0.375", result
, 0.375);
2490 result
= FUNC(remainder
) (1.625, -1.0);
2491 check ("remainder(1.625, -1.0) == -0.375", result
, -0.375);
2493 result
= FUNC(remainder
) (-1.625, -1.0);
2494 check ("remainder(-1.625, -1.0) == 0.375", result
, 0.375);
2496 result
= FUNC(remainder
) (5.0, 2.0);
2497 check ("remainder(5.0, 2.0) == 1.0", result
, 1.0);
2499 result
= FUNC(remainder
) (3.0, 2.0);
2500 check ("remainder(3.0, 2.0) == -1.0", result
, -1.0);
2510 result
= FUNC(remquo
) (1, 0, &quo
);
2511 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2512 result
, INVALID_EXCEPTION
);
2514 result
= FUNC(remquo
) (1, minus_zero
, &quo
);
2515 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2516 result
, INVALID_EXCEPTION
);
2518 result
= FUNC(remquo
) (plus_infty
, 1, &quo
);
2519 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2520 result
, INVALID_EXCEPTION
);
2522 result
= FUNC(remquo
) (minus_infty
, 1, &quo
);
2523 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2524 result
, INVALID_EXCEPTION
);
2526 result
= FUNC(remquo
) (1.625, 1.0, &quo
);
2527 check ("remquo(1.625, 1.0, &x) == -0.375", result
, -0.375);
2528 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo
, 2);
2530 result
= FUNC(remquo
) (-1.625, 1.0, &quo
);
2531 check ("remquo(-1.625, 1.0, &x) == 0.375", result
, 0.375);
2532 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo
, -2);
2534 result
= FUNC(remquo
) (1.625, -1.0, &quo
);
2535 check ("remquo(1.625, -1.0, &x) == -0.375", result
, -0.375);
2536 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo
, -2);
2538 result
= FUNC(remquo
) (-1.625, -1.0, &quo
);
2539 check ("remquo(-1.625, -1.0, &x) == 0.375", result
, 0.375);
2540 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo
, 2);
2542 result
= FUNC(remquo
) (5.0, 2.0, &quo
);
2543 check ("remquo(5.0, 2.0, &x) == 1.0", result
, 1.0);
2544 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo
, 2);
2546 result
= FUNC(remquo
) (3.0, 2.0, &quo
);
2547 check ("remquo(3.0, 2.0, &x) == -1.0", result
, -1.0);
2548 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo
, 2);
2555 __complex__ MATHTYPE result
;
2557 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, plus_zero
));
2558 check ("real(cexp(0 + 0i)) = 1", __real__ result
, 1);
2559 check ("imag(cexp(0 + 0i)) = 0", __imag__ result
, 0);
2560 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_zero
));
2561 check ("real(cexp(-0 + 0i)) = 1", __real__ result
, 1);
2562 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result
, 0);
2563 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_zero
, minus_zero
));
2564 check ("real(cexp(0 - 0i)) = 1", __real__ result
, 1);
2565 check ("imag(cexp(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2566 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2567 check ("real(cexp(-0 - 0i)) = 1", __real__ result
, 1);
2568 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2570 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_zero
));
2571 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result
);
2572 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result
, 0);
2573 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2574 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result
);
2575 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result
, minus_zero
);
2577 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_zero
));
2578 check ("real(cexp(-inf + 0i)) = 0", __real__ result
, 0);
2579 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result
, 0);
2580 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2581 check ("real(cexp(-inf - 0i)) = 0", __real__ result
, 0);
2582 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result
, minus_zero
);
2585 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, plus_infty
));
2586 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2587 __real__ result
, INVALID_EXCEPTION
);
2588 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2591 #if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR__ <= 7
2593 printf ("The following test for cexp might fail due to a gcc compiler error!\n");
2596 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2597 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2598 __real__ result
, INVALID_EXCEPTION
);
2599 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2601 result
= FUNC(cexp
) (BUILD_COMPLEX (0.0, minus_infty
));
2602 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2603 __real__ result
, INVALID_EXCEPTION
);
2604 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2606 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2607 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2608 __real__ result
, INVALID_EXCEPTION
);
2609 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2612 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, plus_infty
));
2613 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2614 __real__ result
, INVALID_EXCEPTION
);
2615 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2617 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, plus_infty
));
2618 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2619 __real__ result
, INVALID_EXCEPTION
);
2620 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2622 result
= FUNC(cexp
) (BUILD_COMPLEX (100.0, minus_infty
));
2623 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2624 __real__ result
, INVALID_EXCEPTION
);
2625 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2627 result
= FUNC(cexp
) (BUILD_COMPLEX (-100.0, minus_infty
));
2628 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2629 __real__ result
, INVALID_EXCEPTION
);
2630 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result
);
2632 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 2.0));
2633 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result
, minus_zero
);
2634 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result
, 0);
2635 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, 4.0));
2636 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result
, minus_zero
);
2637 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result
, minus_zero
);
2639 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 2.0));
2640 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result
);
2641 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result
);
2642 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, 4.0));
2643 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result
);
2644 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result
);
2646 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2647 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2648 __real__ result
, INVALID_EXCEPTION
);
2649 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2651 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2652 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2653 __real__ result
, INVALID_EXCEPTION
);
2654 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2657 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2658 check ("real(cexp(-inf + i inf)) = 0", __real__ result
, 0);
2659 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result
, 0);
2660 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2661 check ("real(cexp(-inf - i inf)) = 0", __real__ result
, 0);
2662 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result
, minus_zero
);
2664 result
= FUNC(cexp
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2665 check ("real(cexp(-inf + i NaN)) = 0", __real__ result
, 0);
2666 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result
), 0);
2668 result
= FUNC(cexp
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2669 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result
);
2670 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result
);
2672 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 0.0));
2673 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2674 __real__ result
, INVALID_EXCEPTION
);
2675 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2677 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, 1.0));
2678 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2679 __real__ result
, INVALID_EXCEPTION
);
2680 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2682 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2683 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2684 __real__ result
, INVALID_EXCEPTION
);
2685 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2688 result
= FUNC(cexp
) (BUILD_COMPLEX (0, nan_value
));
2689 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2690 __real__ result
, INVALID_EXCEPTION
);
2691 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2693 result
= FUNC(cexp
) (BUILD_COMPLEX (1, nan_value
));
2694 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2695 __real__ result
, INVALID_EXCEPTION
);
2696 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2699 result
= FUNC(cexp
) (BUILD_COMPLEX (nan_value
, nan_value
));
2700 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result
);
2701 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result
);
2703 result
= FUNC(cexp
) (BUILD_COMPLEX (0.7, 1.2));
2704 check_eps ("real(cexp(0.7 + i 1.2)) == 0.72969...", __real__ result
,
2705 0.7296989091503236012L, CHOOSE(6e-17L, 0, 2e-7));
2706 check_eps ("imag(cexp(0.7 + i 1.2)) == 1.87689...", __imag__ result
,
2707 1.8768962328348102821L, CHOOSE(2e-16L, 0, 3e-7));
2709 result
= FUNC(cexp
) (BUILD_COMPLEX (-2, -3));
2710 check_eps ("real(cexp(-2 - i 3)) == -0.13398...", __real__ result
,
2711 -0.1339809149295426134L, CHOOSE(6e-20L, 0, 2e-8));
2712 check_eps ("imag(cexp(-2 - i 3)) == -0.01909...", __imag__ result
,
2713 -0.0190985162611351964L, CHOOSE(4e-20L, 0, 2e-9));
2720 __complex__ MATHTYPE result
;
2722 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, 0.0));
2723 check ("real(csin(0 + 0i)) = 0", __real__ result
, 0);
2724 check ("imag(csin(0 + 0i)) = 0", __imag__ result
, 0);
2725 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, 0.0));
2726 check ("real(csin(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2727 check ("imag(csin(-0 + 0i)) = 0", __imag__ result
, 0);
2728 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_zero
));
2729 check ("real(csin(0 - 0i)) = 0", __real__ result
, 0);
2730 check ("imag(csin(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2731 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2732 check ("real(csin(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2733 check ("imag(csin(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2735 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, plus_infty
));
2736 check ("real(csin(0 + i Inf)) = 0", __real__ result
, 0);
2737 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result
);
2738 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2739 check ("real(csin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
2740 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result
);
2741 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, minus_infty
));
2742 check ("real(csin(0 - i Inf)) = 0", __real__ result
, 0);
2743 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result
);
2744 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2745 check ("real(csin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
2746 check_isinfn("imag(csin(-0 - i Inf)) = -Inf", __imag__ result
);
2748 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 0.0));
2749 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2750 __real__ result
, INVALID_EXCEPTION
);
2751 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2752 FUNC(fabs
) (__imag__ result
), 0);
2753 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 0.0));
2754 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2755 __real__ result
, INVALID_EXCEPTION
);
2756 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2757 FUNC(fabs
) (__imag__ result
), 0);
2758 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2759 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2760 __real__ result
, INVALID_EXCEPTION
);
2761 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2762 FUNC(fabs
) (__imag__ result
), 0.0);
2763 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2764 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2765 __real__ result
, INVALID_EXCEPTION
);
2766 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2767 FUNC(fabs
) (__imag__ result
), 0.0);
2769 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2770 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2771 __real__ result
, INVALID_EXCEPTION
);
2772 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2773 FUNC(fabs
) (__imag__ result
));
2774 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2775 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2776 __real__ result
, INVALID_EXCEPTION
);
2777 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2778 FUNC(fabs
) (__imag__ result
));
2779 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2780 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2781 __real__ result
, INVALID_EXCEPTION
);
2782 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2783 FUNC(fabs
) (__imag__ result
));
2784 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2785 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2786 __real__ result
, INVALID_EXCEPTION
);
2787 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2788 FUNC(fabs
) (__imag__ result
));
2790 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, 6.75));
2791 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2792 __real__ result
, INVALID_EXCEPTION
);
2793 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2795 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, -6.75));
2796 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2797 __real__ result
, INVALID_EXCEPTION
);
2798 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2800 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, 6.75));
2801 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2802 __real__ result
, INVALID_EXCEPTION
);
2803 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2805 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, -6.75));
2806 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2807 __real__ result
, INVALID_EXCEPTION
);
2808 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2811 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, plus_infty
));
2812 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result
);
2813 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result
);
2814 result
= FUNC(csin
) (BUILD_COMPLEX (4.625, minus_infty
));
2815 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result
);
2816 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result
);
2817 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, plus_infty
));
2818 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result
);
2819 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result
);
2820 result
= FUNC(csin
) (BUILD_COMPLEX (-4.625, minus_infty
));
2821 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result
);
2822 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result
);
2824 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 0.0));
2825 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result
);
2826 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2827 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_zero
));
2828 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result
);
2829 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
2831 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
2832 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result
);
2833 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2834 FUNC(fabs
) (__imag__ result
));
2835 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
2836 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result
);
2837 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2838 FUNC(fabs
) (__imag__ result
));
2840 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, 9.0));
2841 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2842 __real__ result
, INVALID_EXCEPTION
);
2843 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2845 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -9.0));
2846 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2847 __real__ result
, INVALID_EXCEPTION
);
2848 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2851 result
= FUNC(csin
) (BUILD_COMPLEX (0.0, nan_value
));
2852 check ("real(csin(0 + i NaN))", __real__ result
, 0.0);
2853 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result
);
2854 result
= FUNC(csin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
2855 check ("real(csin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
2856 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result
);
2858 result
= FUNC(csin
) (BUILD_COMPLEX (10.0, nan_value
));
2859 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2860 __real__ result
, INVALID_EXCEPTION
);
2861 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2863 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, -10.0));
2864 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2865 __real__ result
, INVALID_EXCEPTION
);
2866 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2869 result
= FUNC(csin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
2870 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2871 __real__ result
, INVALID_EXCEPTION
);
2872 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2874 result
= FUNC(csin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
2875 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2876 __real__ result
, INVALID_EXCEPTION
);
2877 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2880 result
= FUNC(csin
) (BUILD_COMPLEX (nan_value
, nan_value
));
2881 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result
);
2882 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result
);
2884 result
= FUNC(csin
) (BUILD_COMPLEX (0.7, 1.2));
2885 check_eps ("real(csin(0.7 + i 1.2)) = 1.166456341...", __real__ result
,
2886 1.1664563419657581376L, CHOOSE(2e-16L, 0, 0));
2887 check_eps ("imag(csin(0.7 + i 1.2)) = 1.154499724...", __imag__ result
,
2888 1.1544997246948547371L, CHOOSE(2e-17L, 0, 2e-7));
2890 result
= FUNC(csin
) (BUILD_COMPLEX (-2, -3));
2891 check_eps ("real(csin(-2 - i 3)) == -9.15449...", __real__ result
,
2892 -9.1544991469114295734L, CHOOSE(4e-18L, 0, 1e-6));
2893 check_eps ("imag(csin(-2 - i 3)) == -4.16890...", __imag__ result
,
2894 4.1689069599665643507L, CHOOSE(2e-17L, 0, 5e-7));
2901 __complex__ MATHTYPE result
;
2903 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, 0.0));
2904 check ("real(csinh(0 + 0i)) = 0", __real__ result
, 0);
2905 check ("imag(csinh(0 + 0i)) = 0", __imag__ result
, 0);
2906 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, 0.0));
2907 check ("real(csinh(-0 + 0i)) = -0", __real__ result
, minus_zero
);
2908 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result
, 0);
2909 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_zero
));
2910 check ("real(csinh(0 - 0i)) = 0", __real__ result
, 0);
2911 check ("imag(csinh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
2912 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
2913 check ("real(csinh(-0 - 0i)) = -0", __real__ result
, minus_zero
);
2914 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
2916 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, plus_infty
));
2917 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2918 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2919 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2921 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
2922 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2923 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2924 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2926 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, minus_infty
));
2927 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2928 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2929 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2931 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
2932 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2933 FUNC(fabs
) (__real__ result
), 0, INVALID_EXCEPTION
);
2934 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2937 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 0.0));
2938 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result
);
2939 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result
, 0);
2940 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 0.0));
2941 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result
);
2942 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result
, 0);
2943 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
2944 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result
);
2945 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2946 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
2947 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result
);
2948 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result
, minus_zero
);
2950 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
2951 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2952 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2953 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2955 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
2956 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2957 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2958 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2960 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
2961 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2962 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2963 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2965 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
2966 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2967 FUNC(fabs
) (__real__ result
), INVALID_EXCEPTION
);
2968 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2971 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, 4.625));
2972 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result
);
2973 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result
);
2974 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, 4.625));
2975 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result
);
2976 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result
);
2977 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, -4.625));
2978 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result
);
2979 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result
);
2980 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, -4.625));
2981 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result
);
2982 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result
);
2984 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, plus_infty
));
2985 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2986 __real__ result
, INVALID_EXCEPTION
);
2987 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2989 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, plus_infty
));
2990 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2991 __real__ result
, INVALID_EXCEPTION
);
2992 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2994 result
= FUNC(csinh
) (BUILD_COMPLEX (6.75, minus_infty
));
2995 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2996 __real__ result
, INVALID_EXCEPTION
);
2997 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2999 result
= FUNC(csinh
) (BUILD_COMPLEX (-6.75, minus_infty
));
3000 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
3001 __real__ result
, INVALID_EXCEPTION
);
3002 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
3005 result
= FUNC(csinh
) (BUILD_COMPLEX (0.0, nan_value
));
3006 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
3007 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result
);
3008 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3009 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs
) (__real__ result
), 0);
3010 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result
);
3012 result
= FUNC(csinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3013 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
3014 FUNC(fabs
) (__real__ result
));
3015 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result
);
3016 result
= FUNC(csinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3017 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
3018 FUNC(fabs
) (__real__ result
));
3019 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result
);
3021 result
= FUNC(csinh
) (BUILD_COMPLEX (9.0, nan_value
));
3022 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3023 __real__ result
, INVALID_EXCEPTION
);
3024 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3026 result
= FUNC(csinh
) (BUILD_COMPLEX (-9.0, nan_value
));
3027 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3028 __real__ result
, INVALID_EXCEPTION
);
3029 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3032 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 0.0));
3033 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result
);
3034 check ("imag(csinh(NaN + i0)) = 0", __imag__ result
, 0.0);
3035 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3036 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result
);
3037 check ("imag(csinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3039 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, 10.0));
3040 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
3041 __real__ result
, INVALID_EXCEPTION
);
3042 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
3044 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, -10.0));
3045 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
3046 __real__ result
, INVALID_EXCEPTION
);
3047 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
3050 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3051 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
3052 __real__ result
, INVALID_EXCEPTION
);
3053 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
3055 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3056 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
3057 __real__ result
, INVALID_EXCEPTION
);
3058 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
3061 result
= FUNC(csinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3062 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result
);
3063 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result
);
3065 result
= FUNC(csinh
) (BUILD_COMPLEX (0.7, 1.2));
3066 check_eps ("real(csinh(0.7 + i 1.2)) = 0.274878686...", __real__ result
,
3067 0.27487868678117583582L, CHOOSE(2e-17L, 6e-17, 3e-8));
3068 check_eps ("imag(csinh(0.7 + i 1.2)) = 1.169866572...", __imag__ result
,
3069 1.1698665727426565139L, CHOOSE(6e-17L, 0, 2e-7));
3071 result
= FUNC(csinh
) (BUILD_COMPLEX (-2, -3));
3072 check_eps ("real(csinh(-2 - i 3)) == -3.59056...", __real__ result
,
3073 3.5905645899857799520L, CHOOSE(7e-19L, 5e-16, 3e-7));
3074 check_eps ("imag(csinh(-2 - i 3)) == -0.53092...", __imag__ result
,
3075 -0.5309210862485198052L, CHOOSE(3e-19L, 2e-16, 6e-8));
3082 __complex__ MATHTYPE result
;
3084 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, 0.0));
3085 check ("real(ccos(0 + 0i)) = 1.0", __real__ result
, 1.0);
3086 check ("imag(ccos(0 + 0i)) = -0", __imag__ result
, minus_zero
);
3087 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, 0.0));
3088 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result
, 1.0);
3089 check ("imag(ccos(-0 + 0i)) = 0", __imag__ result
, 0.0);
3090 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_zero
));
3091 check ("real(ccos(0 - 0i)) = 1.0", __real__ result
, 1.0);
3092 check ("imag(ccos(0 - 0i)) = 0", __imag__ result
, 0.0);
3093 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3094 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result
, 1.0);
3095 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result
, minus_zero
);
3097 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 0.0));
3098 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
3099 __real__ result
, INVALID_EXCEPTION
);
3100 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
3101 FUNC(fabs
) (__imag__ result
), 0);
3102 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3103 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
3104 __real__ result
, INVALID_EXCEPTION
);
3105 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
3106 FUNC(fabs
) (__imag__ result
), 0);
3107 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 0.0));
3108 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
3109 __real__ result
, INVALID_EXCEPTION
);
3110 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
3111 FUNC(fabs
) (__imag__ result
), 0);
3112 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3113 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
3114 __real__ result
, INVALID_EXCEPTION
);
3115 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
3116 FUNC(fabs
) (__imag__ result
), 0);
3118 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, plus_infty
));
3119 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result
);
3120 check ("imag(ccos(0 + i Inf)) = -0", __imag__ result
, minus_zero
);
3121 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, minus_infty
));
3122 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result
);
3123 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result
, 0);
3124 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3125 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result
);
3126 check ("imag(ccos(-0 + i Inf)) = 0", __imag__ result
, 0.0);
3127 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3128 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result
);
3129 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
3131 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3132 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
3133 __real__ result
, INVALID_EXCEPTION
);
3134 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
3136 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3137 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
3138 __real__ result
, INVALID_EXCEPTION
);
3139 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
3141 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3142 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
3143 __real__ result
, INVALID_EXCEPTION
);
3144 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
3146 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3147 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
3148 __real__ result
, INVALID_EXCEPTION
);
3149 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
3152 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, plus_infty
));
3153 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result
);
3154 check_isinfp ("imag(ccos(4.625 + i Inf)) = +Inf", __imag__ result
);
3155 result
= FUNC(ccos
) (BUILD_COMPLEX (4.625, minus_infty
));
3156 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result
);
3157 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result
);
3158 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, plus_infty
));
3159 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result
);
3160 check_isinfn ("imag(ccos(-4.625 + i Inf)) = -Inf", __imag__ result
);
3161 result
= FUNC(ccos
) (BUILD_COMPLEX (-4.625, minus_infty
));
3162 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result
);
3163 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result
);
3165 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, 6.75));
3166 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3167 __real__ result
, INVALID_EXCEPTION
);
3168 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3170 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, -6.75));
3171 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3172 __real__ result
, INVALID_EXCEPTION
);
3173 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3175 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, 6.75));
3176 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3177 __real__ result
, INVALID_EXCEPTION
);
3178 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3180 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, -6.75));
3181 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3182 __real__ result
, INVALID_EXCEPTION
);
3183 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3186 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 0.0));
3187 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result
);
3188 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3189 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3190 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result
);
3191 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3193 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3194 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result
);
3195 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result
);
3196 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3197 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result
);
3198 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result
);
3200 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, 9.0));
3201 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3202 __real__ result
, INVALID_EXCEPTION
);
3203 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3205 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, -9.0));
3206 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3207 __real__ result
, INVALID_EXCEPTION
);
3208 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3211 result
= FUNC(ccos
) (BUILD_COMPLEX (0.0, nan_value
));
3212 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result
);
3213 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3214 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3215 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result
);
3216 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3218 result
= FUNC(ccos
) (BUILD_COMPLEX (10.0, nan_value
));
3219 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3220 __real__ result
, INVALID_EXCEPTION
);
3221 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3223 result
= FUNC(ccos
) (BUILD_COMPLEX (-10.0, nan_value
));
3224 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3225 __real__ result
, INVALID_EXCEPTION
);
3226 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3229 result
= FUNC(ccos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3230 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3231 __real__ result
, INVALID_EXCEPTION
);
3232 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3234 result
= FUNC(ccos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3235 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3236 __real__ result
, INVALID_EXCEPTION
);
3237 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3240 result
= FUNC(ccos
) (BUILD_COMPLEX (nan_value
, nan_value
));
3241 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result
);
3242 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result
);
3244 result
= FUNC(ccos
) (BUILD_COMPLEX (0.7, 1.2));
3245 check_eps ("real(ccos(0.7 + i 1.2)) = 1.384865764...", __real__ result
,
3246 1.3848657645312111080L, CHOOSE(4e-18L, 3e-16, 2e-7));
3247 check_eps ("imag(ccos(0.7 + i 1.2)) = -0.972421703...", __imag__ result
,
3248 -0.97242170335830028619L, CHOOSE(2e-16L, 2e-16, 0));
3250 result
= FUNC(ccos
) (BUILD_COMPLEX (-2, -3));
3251 check_eps ("real(ccos(-2 - i 3)) == -4.18962...", __real__ result
,
3252 -4.1896256909688072301L, CHOOSE(2e-17L, 0, 5e-7));
3253 check_eps ("imag(ccos(-2 - i 3)) == -9.10922...", __imag__ result
,
3254 -9.1092278937553365979L, CHOOSE(3e-18L, 0, 1e-6));
3261 __complex__ MATHTYPE result
;
3263 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, 0.0));
3264 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result
, 1.0);
3265 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result
, 0);
3266 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, 0.0));
3267 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result
, 1.0);
3268 check ("imag(ccosh(-0 + 0i)) = -0", __imag__ result
, minus_zero
);
3269 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_zero
));
3270 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result
, 1.0);
3271 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result
, minus_zero
);
3272 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3273 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result
, 1.0);
3274 check ("imag(ccosh(-0 - 0i)) = 0", __imag__ result
, 0.0);
3276 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, plus_infty
));
3277 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
3278 __real__ result
, INVALID_EXCEPTION
);
3279 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
3280 FUNC(fabs
) (__imag__ result
), 0);
3281 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3282 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
3283 __real__ result
, INVALID_EXCEPTION
);
3284 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
3285 FUNC(fabs
) (__imag__ result
), 0);
3286 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, minus_infty
));
3287 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
3288 __real__ result
, INVALID_EXCEPTION
);
3289 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
3290 FUNC(fabs
) (__imag__ result
), 0);
3291 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3292 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
3293 __real__ result
, INVALID_EXCEPTION
);
3294 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
3295 FUNC(fabs
) (__imag__ result
), 0);
3297 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 0.0));
3298 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result
);
3299 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result
, 0);
3300 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 0.0));
3301 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result
);
3302 check ("imag(ccosh(-Inf + 0i)) = -0", __imag__ result
, minus_zero
);
3303 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3304 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result
);
3305 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result
, minus_zero
);
3306 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3307 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result
);
3308 check ("imag(ccosh(-Inf - 0i)) = 0", __imag__ result
, 0.0);
3310 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3311 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
3312 __real__ result
, INVALID_EXCEPTION
);
3313 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
3315 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3316 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
3317 __real__ result
, INVALID_EXCEPTION
);
3318 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
3320 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3321 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
3322 __real__ result
, INVALID_EXCEPTION
);
3323 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
3325 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3326 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
3327 __real__ result
, INVALID_EXCEPTION
);
3328 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3331 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, 4.625));
3332 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result
);
3333 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result
);
3334 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, 4.625));
3335 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result
);
3336 check_isinfp ("imag(ccosh(-Inf + i4.625)) = Inf", __imag__ result
);
3337 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, -4.625));
3338 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result
);
3339 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result
);
3340 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, -4.625));
3341 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result
);
3342 check_isinfn ("imag(ccosh(-Inf - i4.625)) = -Inf", __imag__ result
);
3344 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, plus_infty
));
3345 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3346 __real__ result
, INVALID_EXCEPTION
);
3347 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3349 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, plus_infty
));
3350 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3351 __real__ result
, INVALID_EXCEPTION
);
3352 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3354 result
= FUNC(ccosh
) (BUILD_COMPLEX (6.75, minus_infty
));
3355 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3356 __real__ result
, INVALID_EXCEPTION
);
3357 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3359 result
= FUNC(ccosh
) (BUILD_COMPLEX (-6.75, minus_infty
));
3360 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3361 __real__ result
, INVALID_EXCEPTION
);
3362 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3365 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.0, nan_value
));
3366 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result
);
3367 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3368 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3369 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result
);
3370 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
3372 result
= FUNC(ccosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3373 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result
);
3374 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result
);
3375 result
= FUNC(ccosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3376 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result
);
3377 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result
);
3379 result
= FUNC(ccosh
) (BUILD_COMPLEX (9.0, nan_value
));
3380 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3381 __real__ result
, INVALID_EXCEPTION
);
3382 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3384 result
= FUNC(ccosh
) (BUILD_COMPLEX (-9.0, nan_value
));
3385 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3386 __real__ result
, INVALID_EXCEPTION
);
3387 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3390 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 0.0));
3391 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result
);
3392 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3393 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3394 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result
);
3395 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs
) (__imag__ result
), 0.0);
3397 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, 10.0));
3398 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3399 __real__ result
, INVALID_EXCEPTION
);
3400 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3402 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, -10.0));
3403 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3404 __real__ result
, INVALID_EXCEPTION
);
3405 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3408 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3409 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3410 __real__ result
, INVALID_EXCEPTION
);
3411 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3413 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3414 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3415 __real__ result
, INVALID_EXCEPTION
);
3416 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3419 result
= FUNC(ccosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3420 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result
);
3421 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result
);
3423 result
= FUNC(ccosh
) (BUILD_COMPLEX (0.7, 1.2));
3424 check_eps ("real(ccosh(0.7 + i 1.2)) == 0.45482...", __real__ result
,
3425 0.4548202223691477654L, CHOOSE(5e-17L, 6e-17, 9e-8));
3426 check_eps ("imag(ccosh(0.7 + i 1.2)) == 0.70702...", __imag__ result
,
3427 0.7070296600921537682L, CHOOSE(7e-17L, 0, 0));
3429 result
= FUNC(ccosh
) (BUILD_COMPLEX (-2, -3));
3430 check_eps ("real(ccosh(-2 - i 3)) == -3.72454...", __real__ result
,
3431 -3.7245455049153225654L, CHOOSE(7e-19L, 0, 3e-7));
3432 check_eps ("imag(ccosh(-2 - i 3)) == -0.51182...", __imag__ result
,
3433 0.5118225699873846088L, CHOOSE(3e-19L, 2e-16, 6e-8));
3440 __complex__ MATHTYPE result
;
3442 result
= FUNC(cacos
) (BUILD_COMPLEX (0, 0));
3443 check ("real(cacos(0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3444 check ("imag(cacos(0 + i0)) = -0", __imag__ result
, minus_zero
);
3445 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, 0));
3446 check ("real(cacos(-0 + i0)) = pi/2", __real__ result
, M_PI_2
);
3447 check ("imag(cacos(-0 + i0)) = -0", __imag__ result
, minus_zero
);
3448 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_zero
));
3449 check ("real(cacos(0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3450 check ("imag(cacos(0 - i0)) = 0", __imag__ result
, 0);
3451 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3452 check ("real(cacos(-0 - i0)) = pi/2", __real__ result
, M_PI_2
);
3453 check ("imag(cacos(-0 - i0)) = 0", __imag__ result
, 0);
3455 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3456 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3457 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result
);
3458 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3459 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result
, M_PI
- M_PI_4
);
3460 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result
);
3462 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3463 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3464 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result
);
3465 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3466 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3467 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result
);
3469 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, plus_infty
));
3470 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3471 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result
);
3472 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.0, minus_infty
));
3473 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3474 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result
);
3475 result
= FUNC(cacos
) (BUILD_COMPLEX (0, plus_infty
));
3476 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3477 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result
);
3478 result
= FUNC(cacos
) (BUILD_COMPLEX (0, minus_infty
));
3479 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3480 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result
);
3481 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, plus_infty
));
3482 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
3483 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result
);
3484 result
= FUNC(cacos
) (BUILD_COMPLEX (0.1, minus_infty
));
3485 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
3486 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result
);
3488 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 0));
3489 check ("real(cacos(-Inf + i0)) = pi", __real__ result
, M_PI
);
3490 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result
);
3491 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3492 check ("real(cacos(-Inf - i0)) = pi", __real__ result
, M_PI
);
3493 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result
);
3494 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, 100));
3495 check ("real(cacos(-Inf + i100)) = pi", __real__ result
, M_PI
);
3496 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result
);
3497 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, -100));
3498 check ("real(cacos(-Inf - i100)) = pi", __real__ result
, M_PI
);
3499 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result
);
3501 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0));
3502 check ("real(cacos(+Inf + i0)) = 0", __real__ result
, 0);
3503 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result
);
3504 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3505 check ("real(cacos(+Inf - i0)) = 0", __real__ result
, 0);
3506 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result
);
3507 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, 0.5));
3508 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result
, 0);
3509 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result
);
3510 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, -0.5));
3511 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result
, 0);
3512 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result
);
3514 result
= FUNC(cacos
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3515 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result
);
3516 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3517 FUNC(fabs
) (__imag__ result
));
3518 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3519 check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result
);
3520 check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf",
3521 FUNC(fabs
) (__imag__ result
));
3523 result
= FUNC(cacos
) (BUILD_COMPLEX (0, nan_value
));
3524 check ("real(cacos(0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3525 check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result
);
3526 result
= FUNC(cacos
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3527 check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result
, M_PI_2
);
3528 check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result
);
3530 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3531 check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result
);
3532 check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result
);
3533 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3534 check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result
);
3535 check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result
);
3537 result
= FUNC(cacos
) (BUILD_COMPLEX (10.5, nan_value
));
3538 check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3539 __real__ result
, INVALID_EXCEPTION
);
3540 check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
3542 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3543 check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3544 __real__ result
, INVALID_EXCEPTION
);
3545 check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3548 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, 0.75));
3549 check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3550 __real__ result
, INVALID_EXCEPTION
);
3551 check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
3553 result
= FUNC(cacos
) (BUILD_COMPLEX (-10.5, nan_value
));
3554 check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3555 __real__ result
, INVALID_EXCEPTION
);
3556 check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
3559 result
= FUNC(cacos
) (BUILD_COMPLEX (nan_value
, nan_value
));
3560 check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result
);
3561 check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result
);
3563 result
= FUNC(cacos
) (BUILD_COMPLEX (0.7, 1.2));
3564 check_eps ("real(cacos(0.7 + i 1.2)) == 1.13518...", __real__ result
,
3565 1.1351827477151551089L, CHOOSE(2e-17L, 3e-16, 2e-7));
3566 check_eps ("imag(cacos(0.7 + i 1.2)) == -1.09276...", __imag__ result
,
3567 -1.0927647857577371459L, CHOOSE(4e-17L, 0, 3e-7));
3569 result
= FUNC(cacos
) (BUILD_COMPLEX (-2, -3));
3570 check_eps ("real(cacos(-2 - i 3)) == 2.14144...", __real__ result
,
3571 2.1414491111159960199L, CHOOSE(3e-19L, 0, 0));
3572 check_eps ("imag(cacos(-2 - i 3)) == -1.98338...", __imag__ result
,
3573 1.9833870299165354323L, CHOOSE(3e-19L, 0, 0));
3580 __complex__ MATHTYPE result
;
3582 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, 0));
3583 check ("real(cacosh(0 + i0)) = 0", __real__ result
, 0);
3584 check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3585 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, 0));
3586 check ("real(cacosh(-0 + i0)) = 0", __real__ result
, 0);
3587 check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result
, M_PI_2
);
3588 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_zero
));
3589 check ("real(cacosh(0 - i0)) = 0", __real__ result
, 0);
3590 check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3591 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3592 check ("real(cacosh(-0 - i0)) = 0", __real__ result
, 0);
3593 check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
3595 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3596 check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result
);
3597 check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result
,
3599 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3600 check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result
);
3601 check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result
,
3604 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3605 check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result
);
3606 check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3607 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3608 check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result
);
3609 check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3611 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3612 check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result
);
3613 check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3614 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3615 check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result
);
3616 check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3617 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, plus_infty
));
3618 check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result
);
3619 check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3620 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, minus_infty
));
3621 check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result
);
3622 check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3623 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, plus_infty
));
3624 check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result
);
3625 check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3626 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.1, minus_infty
));
3627 check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result
);
3628 check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3630 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 0));
3631 check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result
);
3632 check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result
, M_PI
);
3633 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3634 check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result
);
3635 check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
3636 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, 100));
3637 check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result
);
3638 check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result
, M_PI
);
3639 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, -100));
3640 check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result
);
3641 check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result
, -M_PI
);
3643 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0));
3644 check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result
);
3645 check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result
, 0);
3646 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3647 check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result
);
3648 check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3649 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3650 check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result
);
3651 check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3652 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3653 check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result
);
3654 check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3656 result
= FUNC(cacosh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3657 check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result
);
3658 check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result
);
3659 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3660 check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result
);
3661 check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result
);
3663 result
= FUNC(cacosh
) (BUILD_COMPLEX (0, nan_value
));
3664 check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result
);
3665 check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result
);
3666 result
= FUNC(cacosh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3667 check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result
);
3668 check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result
);
3670 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3671 check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result
);
3672 check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result
);
3673 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3674 check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result
);
3675 check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result
);
3677 result
= FUNC(cacosh
) (BUILD_COMPLEX (10.5, nan_value
));
3678 check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3679 __real__ result
, INVALID_EXCEPTION
);
3680 check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3682 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3683 check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3684 __real__ result
, INVALID_EXCEPTION
);
3685 check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3688 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, 0.75));
3689 check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3690 __real__ result
, INVALID_EXCEPTION
);
3691 check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
3693 result
= FUNC(cacosh
) (BUILD_COMPLEX (-10.5, nan_value
));
3694 check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3695 __real__ result
, INVALID_EXCEPTION
);
3696 check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
3699 result
= FUNC(cacosh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3700 check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result
);
3701 check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result
);
3703 result
= FUNC(cacosh
) (BUILD_COMPLEX (0.7, 1.2));
3704 check_eps ("real(cacosh(0.7 + i 1.2)) == 1.09276...", __real__ result
,
3705 1.0927647857577371459L, CHOOSE(4e-17L, 3e-16, 0));
3706 check_eps ("imag(cacosh(0.7 + i 1.2)) == 1.13518...", __imag__ result
,
3707 1.1351827477151551089L, CHOOSE(2e-17L, 0, 0));
3709 result
= FUNC(cacosh
) (BUILD_COMPLEX (-2, -3));
3710 check_eps ("real(cacosh(-2 - i 3)) == -1.98338...", __real__ result
,
3711 -1.9833870299165354323L, CHOOSE (2e-18L, 3e-16, 9e-7));
3712 check_eps ("imag(cacosh(-2 - i 3)) == 2.14144...", __imag__ result
,
3713 2.1414491111159960199L, CHOOSE (3e-19, 5e-16, 1e-6));
3720 __complex__ MATHTYPE result
;
3722 result
= FUNC(casin
) (BUILD_COMPLEX (0, 0));
3723 check ("real(casin(0 + i0)) = 0", __real__ result
, 0);
3724 check ("imag(casin(0 + i0)) = 0", __imag__ result
, 0);
3725 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, 0));
3726 check ("real(casin(-0 + i0)) = -0", __real__ result
, minus_zero
);
3727 check ("imag(casin(-0 + i0)) = 0", __imag__ result
, 0);
3728 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_zero
));
3729 check ("real(casin(0 - i0)) = 0", __real__ result
, 0);
3730 check ("imag(casin(0 - i0)) = -0", __imag__ result
, minus_zero
);
3731 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3732 check ("real(casin(-0 - i0)) = -0", __real__ result
, minus_zero
);
3733 check ("imag(casin(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3735 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3736 check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result
, M_PI_4
);
3737 check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result
);
3738 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3739 check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result
, M_PI_4
);
3740 check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result
);
3741 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3742 check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3743 check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result
);
3744 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3745 check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result
, -M_PI_4
);
3746 check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result
);
3748 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, plus_infty
));
3749 check ("real(casin(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
3750 check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result
);
3751 result
= FUNC(casin
) (BUILD_COMPLEX (-10.0, minus_infty
));
3752 check ("real(casin(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
3753 check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result
);
3754 result
= FUNC(casin
) (BUILD_COMPLEX (0, plus_infty
));
3755 check ("real(casin(0 + i Inf)) = 0", __real__ result
, 0.0);
3756 check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result
);
3757 result
= FUNC(casin
) (BUILD_COMPLEX (0, minus_infty
));
3758 check ("real(casin(0 - i Inf)) = 0", __real__ result
, 0.0);
3759 check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result
);
3760 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3761 check ("real(casin(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
3762 check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result
);
3763 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3764 check ("real(casin(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
3765 check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result
);
3766 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, plus_infty
));
3767 check ("real(casin(0.1 + i Inf)) = 0", __real__ result
, 0);
3768 check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result
);
3769 result
= FUNC(casin
) (BUILD_COMPLEX (0.1, minus_infty
));
3770 check ("real(casin(0.1 - i Inf)) = 0", __real__ result
, 0);
3771 check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result
);
3773 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 0));
3774 check ("real(casin(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
3775 check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result
);
3776 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3777 check ("real(casin(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
3778 check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result
);
3779 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, 100));
3780 check ("real(casin(-Inf + i100)) = -pi/2", __real__ result
, -M_PI_2
);
3781 check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result
);
3782 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, -100));
3783 check ("real(casin(-Inf - i100)) = -pi/2", __real__ result
, -M_PI_2
);
3784 check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result
);
3786 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0));
3787 check ("real(casin(+Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
3788 check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result
);
3789 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3790 check ("real(casin(+Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
3791 check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result
);
3792 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, 0.5));
3793 check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result
, M_PI_2
);
3794 check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result
);
3795 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, -0.5));
3796 check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result
, M_PI_2
);
3797 check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result
);
3799 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3800 check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result
);
3801 check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result
);
3802 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3803 check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result
);
3804 check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result
);
3806 result
= FUNC(casin
) (BUILD_COMPLEX (0.0, nan_value
));
3807 check ("real(casin(0 + i NaN)) = 0", __real__ result
, 0.0);
3808 check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result
);
3809 result
= FUNC(casin
) (BUILD_COMPLEX (minus_zero
, nan_value
));
3810 check ("real(casin(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
3811 check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result
);
3813 result
= FUNC(casin
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3814 check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result
);
3815 check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
3816 FUNC(fabs
) (__imag__ result
));
3817 result
= FUNC(casin
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3818 check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result
);
3819 check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
3820 FUNC(fabs
) (__imag__ result
));
3822 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, 10.5));
3823 check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3824 __real__ result
, INVALID_EXCEPTION
);
3825 check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
3827 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, -10.5));
3828 check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3829 __real__ result
, INVALID_EXCEPTION
);
3830 check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
3833 result
= FUNC(casin
) (BUILD_COMPLEX (0.75, nan_value
));
3834 check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3835 __real__ result
, INVALID_EXCEPTION
);
3836 check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
3838 result
= FUNC(casin
) (BUILD_COMPLEX (-0.75, nan_value
));
3839 check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3840 __real__ result
, INVALID_EXCEPTION
);
3841 check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
3844 result
= FUNC(casin
) (BUILD_COMPLEX (nan_value
, nan_value
));
3845 check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result
);
3846 check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result
);
3848 result
= FUNC(casin
) (BUILD_COMPLEX (0.7, 1.2));
3849 check_eps ("real(casin(0.7 + i 1.2)) == 0.43561...", __real__ result
,
3850 0.4356135790797415103L, CHOOSE(2e-17L, 2e-16, 2e-7));
3851 check_eps ("imag(casin(0.7 + i 1.2)) == 1.09276...", __imag__ result
,
3852 1.0927647857577371459L, CHOOSE(4e-17L, 0, 3e-7));
3854 result
= FUNC(casin
) (BUILD_COMPLEX (-2, -3));
3855 check_eps ("real(casin(-2 - i 3)) == -0.57065...", __real__ result
,
3856 -0.5706527843210994007L, CHOOSE(4e-19L, 0, 0));
3857 check_eps ("imag(casin(-2 - i 3)) == -1.98338...", __imag__ result
,
3858 -1.9833870299165354323L, CHOOSE(3e-19L, 0, 0));
3865 __complex__ MATHTYPE result
;
3867 result
= FUNC(casinh
) (BUILD_COMPLEX (0, 0));
3868 check ("real(casinh(0 + i0)) = 0", __real__ result
, 0);
3869 check ("imag(casinh(0 + i0)) = 0", __imag__ result
, 0);
3870 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, 0));
3871 check ("real(casinh(-0 + i0)) = -0", __real__ result
, minus_zero
);
3872 check ("imag(casinh(-0 + i0)) = 0", __imag__ result
, 0);
3873 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_zero
));
3874 check ("real(casinh(0 - i0)) = 0", __real__ result
, 0);
3875 check ("imag(casinh(0 - i0)) = -0", __imag__ result
, minus_zero
);
3876 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
3877 check ("real(casinh(-0 - i0)) = -0", __real__ result
, minus_zero
);
3878 check ("imag(casinh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
3880 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
3881 check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result
);
3882 check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3883 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
3884 check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result
);
3885 check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3886 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
3887 check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result
);
3888 check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
3889 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
3890 check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result
);
3891 check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
3893 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, plus_infty
));
3894 check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result
);
3895 check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3896 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.0, minus_infty
));
3897 check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result
);
3898 check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3899 result
= FUNC(casinh
) (BUILD_COMPLEX (0, plus_infty
));
3900 check_isinfp ("real(casinh(0 + i Inf)) = +Inf", __real__ result
);
3901 check ("imag(casinh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3902 result
= FUNC(casinh
) (BUILD_COMPLEX (0, minus_infty
));
3903 check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result
);
3904 check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3905 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
3906 check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result
);
3907 check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3908 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
3909 check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result
);
3910 check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3911 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, plus_infty
));
3912 check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result
);
3913 check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
3914 result
= FUNC(casinh
) (BUILD_COMPLEX (0.1, minus_infty
));
3915 check_isinfp ("real(casinh(0.1 - i Inf)) = +Inf", __real__ result
);
3916 check ("imag(casinh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
3918 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 0));
3919 check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result
);
3920 check ("imag(casinh(-Inf + i0)) = 0", __imag__ result
, 0);
3921 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
3922 check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result
);
3923 check ("imag(casinh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
3924 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, 100));
3925 check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result
);
3926 check ("imag(casinh(-Inf + i100)) = 0", __imag__ result
, 0);
3927 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, -100));
3928 check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result
);
3929 check ("imag(casinh(-Inf - i100)) = -0", __imag__ result
, minus_zero
);
3931 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0));
3932 check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result
);
3933 check ("imag(casinh(+Inf + i0)) = 0", __imag__ result
, 0);
3934 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
3935 check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result
);
3936 check ("imag(casinh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
3937 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, 0.5));
3938 check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result
);
3939 check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result
, 0);
3940 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, -0.5));
3941 check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result
);
3942 check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result
, minus_zero
);
3944 result
= FUNC(casinh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
3945 check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result
);
3946 check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result
);
3947 result
= FUNC(casinh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
3948 check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result
);
3949 check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result
);
3951 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0));
3952 check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result
);
3953 check ("imag(casinh(NaN + i0)) = 0", __imag__ result
, 0);
3954 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
3955 check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result
);
3956 check ("imag(casinh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
3958 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
3959 check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
3960 FUNC(fabs
) (__real__ result
));
3961 check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result
);
3962 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
3963 check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
3964 FUNC(fabs
) (__real__ result
));
3965 check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result
);
3967 result
= FUNC(casinh
) (BUILD_COMPLEX (10.5, nan_value
));
3968 check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3969 __real__ result
, INVALID_EXCEPTION
);
3970 check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
3972 result
= FUNC(casinh
) (BUILD_COMPLEX (-10.5, nan_value
));
3973 check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3974 __real__ result
, INVALID_EXCEPTION
);
3975 check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
3978 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, 0.75));
3979 check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3980 __real__ result
, INVALID_EXCEPTION
);
3981 check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
3983 result
= FUNC(casinh
) (BUILD_COMPLEX (-0.75, nan_value
));
3984 check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3985 __real__ result
, INVALID_EXCEPTION
);
3986 check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
3989 result
= FUNC(casinh
) (BUILD_COMPLEX (nan_value
, nan_value
));
3990 check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result
);
3991 check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result
);
3993 result
= FUNC(casinh
) (BUILD_COMPLEX (0.7, 1.2));
3994 check_eps ("real(casinh(0.7 + i 1.2)) == 0.97865...", __real__ result
,
3995 0.9786545955936738768L, CHOOSE(5e-17L, 2e-16, 0));
3996 check_eps ("imag(casinh(0.7 + i 1.2)) == 0.91135...", __imag__ result
,
3997 0.9113541895315601156L, CHOOSE(7e-19L, 2e-16, 6e-8));
3999 result
= FUNC(casinh
) (BUILD_COMPLEX (-2, -3));
4000 check_eps ("real(casinh(-2 - i 3)) == -1.96863...", __real__ result
,
4001 -1.9686379257930962917L, CHOOSE(7e-19L, 2e-15, 2e-7));
4002 check_eps ("imag(casinh(-2 - i 3)) == -0.96465...", __imag__ result
,
4003 -0.9646585044076027920L, CHOOSE(4e-19L, 2e-15, 4e-7));
4010 __complex__ MATHTYPE result
;
4012 result
= FUNC(catan
) (BUILD_COMPLEX (0, 0));
4013 check ("real(catan(0 + i0)) = 0", __real__ result
, 0);
4014 check ("imag(catan(0 + i0)) = 0", __imag__ result
, 0);
4015 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, 0));
4016 check ("real(catan(-0 + i0)) = -0", __real__ result
, minus_zero
);
4017 check ("imag(catan(-0 + i0)) = 0", __imag__ result
, 0);
4018 result
= FUNC(catan
) (BUILD_COMPLEX (0, minus_zero
));
4019 check ("real(catan(0 - i0)) = 0", __real__ result
, 0);
4020 check ("imag(catan(0 - i0)) = -0", __imag__ result
, minus_zero
);
4021 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4022 check ("real(catan(-0 - i0)) = -0", __real__ result
, minus_zero
);
4023 check ("imag(catan(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4025 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4026 check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result
, M_PI_2
);
4027 check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result
, 0);
4028 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4029 check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result
, M_PI_2
);
4030 check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
4031 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4032 check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4033 check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result
, 0.0);
4034 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4035 check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4036 check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result
, minus_zero
);
4038 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, -10.0));
4039 check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result
, M_PI_2
);
4040 check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
4041 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, -10.0));
4042 check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result
, -M_PI_2
);
4043 check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result
, minus_zero
);
4044 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4045 check ("real(catan(Inf - i0)) = pi/2", __real__ result
, M_PI_2
);
4046 check ("imag(catan(Inf - i0)) = -0", __imag__ result
, minus_zero
);
4047 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4048 check ("real(catan(-Inf - i0)) = -pi/2", __real__ result
, -M_PI_2
);
4049 check ("imag(catan(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
4050 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.0));
4051 check ("real(catan(Inf + i0)) = pi/2", __real__ result
, M_PI_2
);
4052 check ("imag(catan(Inf + i0)) = 0", __imag__ result
, 0.0);
4053 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.0));
4054 check ("real(catan(-Inf + i0)) = -pi/2", __real__ result
, -M_PI_2
);
4055 check ("imag(catan(-Inf + i0)) = 0", __imag__ result
, 0.0);
4056 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, 0.1));
4057 check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result
, M_PI_2
);
4058 check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result
, 0);
4059 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, 0.1));
4060 check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result
, -M_PI_2
);
4061 check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result
, 0);
4063 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, minus_infty
));
4064 check ("real(catan(0 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
4065 check ("imag(catan(0 - i Inf)) = -0", __imag__ result
, minus_zero
);
4066 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4067 check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4068 check ("imag(catan(-0 - i Inf)) = -0", __imag__ result
, minus_zero
);
4069 result
= FUNC(catan
) (BUILD_COMPLEX (100.0, minus_infty
));
4070 check ("real(catan(100 - i Inf)) = pi/2", __real__ result
, M_PI_2
);
4071 check ("imag(catan(100 - i Inf)) = -0", __imag__ result
, minus_zero
);
4072 result
= FUNC(catan
) (BUILD_COMPLEX (-100.0, minus_infty
));
4073 check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4074 check ("imag(catan(-100 - i Inf)) = -0", __imag__ result
, minus_zero
);
4076 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, plus_infty
));
4077 check ("real(catan(0 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
4078 check ("imag(catan(0 + i Inf)) = 0", __imag__ result
, 0);
4079 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4080 check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4081 check ("imag(catan(-0 + i Inf)) = 0", __imag__ result
, 0);
4082 result
= FUNC(catan
) (BUILD_COMPLEX (0.5, plus_infty
));
4083 check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result
, M_PI_2
);
4084 check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result
, 0);
4085 result
= FUNC(catan
) (BUILD_COMPLEX (-0.5, plus_infty
));
4086 check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result
, -M_PI_2
);
4087 check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result
, 0);
4089 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 0.0));
4090 check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result
);
4091 check ("imag(catan(NaN + i0)) = 0", __imag__ result
, 0.0);
4092 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4093 check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result
);
4094 check ("imag(catan(NaN - i0)) = -0", __imag__ result
, minus_zero
);
4096 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4097 check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result
);
4098 check ("imag(catan(NaN + i Inf)) = 0", __imag__ result
, 0);
4099 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4100 check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result
);
4101 check ("imag(catan(NaN - i Inf)) = -0", __imag__ result
, minus_zero
);
4103 result
= FUNC(catan
) (BUILD_COMPLEX (0.0, nan_value
));
4104 check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result
);
4105 check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result
);
4106 result
= FUNC(catan
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4107 check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result
);
4108 check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result
);
4110 result
= FUNC(catan
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4111 check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result
, M_PI_2
);
4112 check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4113 result
= FUNC(catan
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4114 check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result
, -M_PI_2
);
4115 check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4117 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, 10.5));
4118 check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
4119 __real__ result
, INVALID_EXCEPTION
);
4120 check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
4122 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, -10.5));
4123 check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
4124 __real__ result
, INVALID_EXCEPTION
);
4125 check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
4128 result
= FUNC(catan
) (BUILD_COMPLEX (0.75, nan_value
));
4129 check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
4130 __real__ result
, INVALID_EXCEPTION
);
4131 check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
4133 result
= FUNC(catan
) (BUILD_COMPLEX (-0.75, nan_value
));
4134 check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
4135 __real__ result
, INVALID_EXCEPTION
);
4136 check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
4139 result
= FUNC(catan
) (BUILD_COMPLEX (nan_value
, nan_value
));
4140 check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result
);
4141 check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result
);
4143 result
= FUNC(catan
) (BUILD_COMPLEX (0.7, 1.2));
4144 check_eps ("real(catan(0.7 + i 1.2)) == 1.07857...", __real__ result
,
4145 1.0785743834118921877L, CHOOSE (3e-17, 0, 0));
4146 check_eps ("imag(catan(0.7 + i 1.2)) == 0.57705...", __imag__ result
,
4147 0.5770573776534306764L, CHOOSE(3e-17L, 0, 6e-8));
4149 result
= FUNC(catan
) (BUILD_COMPLEX (-2, -3));
4150 check ("real(catan(-2 - i 3)) == -1.40992...", __real__ result
,
4151 -1.4099210495965755225L);
4152 check_eps ("imag(catan(-2 - i 3)) == -0.22907...", __imag__ result
,
4153 -0.2290726829685387662L, CHOOSE(1.1e-19L, 3e-17, 2e-8));
4160 __complex__ MATHTYPE result
;
4162 result
= FUNC(catanh
) (BUILD_COMPLEX (0, 0));
4163 check ("real(catanh(0 + i0)) = 0", __real__ result
, 0);
4164 check ("imag(catanh(0 + i0)) = 0", __imag__ result
, 0);
4165 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, 0));
4166 check ("real(catanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
4167 check ("imag(catanh(-0 + i0)) = 0", __imag__ result
, 0);
4168 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_zero
));
4169 check ("real(catanh(0 - i0)) = 0", __real__ result
, 0);
4170 check ("imag(catanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
4171 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4172 check ("real(catanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
4173 check ("imag(catanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4175 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4176 check ("real(catanh(+Inf + i Inf)) = 0", __real__ result
, 0);
4177 check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4178 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4179 check ("real(catanh(+Inf - i Inf)) = 0", __real__ result
, 0);
4180 check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4181 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4182 check ("real(catanh(-Inf + i Inf)) = -0", __real__ result
, minus_zero
);
4183 check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4184 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4185 check ("real(catanh(-Inf - i Inf)) = -0", __real__ result
, minus_zero
);
4186 check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4188 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, plus_infty
));
4189 check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result
, minus_zero
);
4190 check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4191 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.0, minus_infty
));
4192 check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result
, minus_zero
);
4193 check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4194 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4195 check ("real(catanh(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
4196 check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4197 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4198 check ("real(catanh(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
4199 check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4200 result
= FUNC(catanh
) (BUILD_COMPLEX (0, plus_infty
));
4201 check ("real(catanh(0 + i Inf)) = 0", __real__ result
, 0);
4202 check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4203 result
= FUNC(catanh
) (BUILD_COMPLEX (0, minus_infty
));
4204 check ("real(catanh(0 - i Inf)) = 0", __real__ result
, 0);
4205 check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4206 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, plus_infty
));
4207 check ("real(catanh(0.1 + i Inf)) = 0", __real__ result
, 0);
4208 check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4209 result
= FUNC(catanh
) (BUILD_COMPLEX (0.1, minus_infty
));
4210 check ("real(catanh(0.1 - i Inf)) = 0", __real__ result
, 0);
4211 check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4213 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 0));
4214 check ("real(catanh(-Inf + i0)) = -0", __real__ result
, minus_zero
);
4215 check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
4216 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4217 check ("real(catanh(-Inf - i0)) = -0", __real__ result
, minus_zero
);
4218 check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
4219 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, 100));
4220 check ("real(catanh(-Inf + i100)) = -0", __real__ result
, minus_zero
);
4221 check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result
, M_PI_2
);
4222 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, -100));
4223 check ("real(catanh(-Inf - i100)) = -0", __real__ result
, minus_zero
);
4224 check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result
, -M_PI_2
);
4226 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0));
4227 check ("real(catanh(+Inf + i0)) = 0", __real__ result
, 0);
4228 check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result
, M_PI_2
);
4229 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4230 check ("real(catanh(+Inf - i0)) = 0", __real__ result
, 0);
4231 check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result
, -M_PI_2
);
4232 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, 0.5));
4233 check ("real(catanh(+Inf + i0.5)) = 0", __real__ result
, 0);
4234 check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result
, M_PI_2
);
4235 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, -0.5));
4236 check ("real(catanh(+Inf - i0.5)) = 0", __real__ result
, 0);
4237 check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result
, -M_PI_2
);
4239 result
= FUNC(catanh
) (BUILD_COMPLEX (0, nan_value
));
4240 check ("real(catanh(0 + i NaN)) = 0", __real__ result
, 0);
4241 check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result
);
4242 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4243 check ("real(catanh(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
4244 check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result
);
4246 result
= FUNC(catanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4247 check ("real(catanh(+Inf + i NaN)) = 0", __real__ result
, 0);
4248 check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result
);
4249 result
= FUNC(catanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4250 check ("real(catanh(-Inf + i NaN)) = -0", __real__ result
, minus_zero
);
4251 check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result
);
4253 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0));
4254 check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result
);
4255 check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result
);
4256 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4257 check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result
);
4258 check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result
);
4260 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4261 check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4262 check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4263 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4264 check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4265 check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4267 result
= FUNC(catanh
) (BUILD_COMPLEX (10.5, nan_value
));
4268 check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4269 __real__ result
, INVALID_EXCEPTION
);
4270 check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
4272 result
= FUNC(catanh
) (BUILD_COMPLEX (-10.5, nan_value
));
4273 check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4274 __real__ result
, INVALID_EXCEPTION
);
4275 check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
4278 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, 0.75));
4279 check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4280 __real__ result
, INVALID_EXCEPTION
);
4281 check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
4283 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, -0.75));
4284 check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4285 __real__ result
, INVALID_EXCEPTION
);
4286 check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
4289 result
= FUNC(catanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
4290 check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result
);
4291 check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result
);
4293 result
= FUNC(catanh
) (BUILD_COMPLEX (0.7, 1.2));
4294 check_eps ("real(catanh(0.7 + i 1.2)) == 0.26007...", __real__ result
,
4295 0.2600749516525135959L, CHOOSE (2e-18, 0, 0));
4296 check_eps ("imag(catanh(0.7 + i 1.2)) == 0.97024...", __imag__ result
,
4297 0.9702403077950989849L, CHOOSE (3e-17, 0, 0));
4299 result
= FUNC(catanh
) (BUILD_COMPLEX (-2, -3));
4300 check_eps ("real(catanh(-2 - i 3)) == -0.14694...", __real__ result
,
4301 -0.1469466662255297520L, CHOOSE (9e-20L, 6e-17, 2e-8));
4302 check_eps ("imag(catanh(-2 - i 3)) == -1.33897...", __imag__ result
,
4303 -1.3389725222944935611L, CHOOSE (7e-19L, 0, 0));
4310 __complex__ MATHTYPE result
;
4312 result
= FUNC(ctan
) (BUILD_COMPLEX (0, 0));
4313 check ("real(ctan(0 + i0)) = 0", __real__ result
, 0);
4314 check ("imag(ctan(0 + i0)) = 0", __imag__ result
, 0);
4315 result
= FUNC(ctan
) (BUILD_COMPLEX (0, minus_zero
));
4316 check ("real(ctan(0 - i0)) = 0", __real__ result
, 0);
4317 check ("imag(ctan(0 - i0)) = -0", __imag__ result
, minus_zero
);
4318 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_zero
, 0));
4319 check ("real(ctan(-0 + i0)) = -0", __real__ result
, minus_zero
);
4320 check ("imag(ctan(-0 + i0)) = 0", __imag__ result
, 0);
4321 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4322 check ("real(ctan(-0 - i0)) = -0", __real__ result
, minus_zero
);
4323 check ("imag(ctan(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4326 result
= FUNC(ctan
) (BUILD_COMPLEX (0, plus_infty
));
4327 check ("real(ctan(0 + i Inf)) = 0", __real__ result
, 0);
4328 check ("imag(ctan(0 + i Inf)) = 1", __imag__ result
, 1);
4329 result
= FUNC(ctan
) (BUILD_COMPLEX (1, plus_infty
));
4330 check ("real(ctan(1 + i Inf)) = 0", __real__ result
, 0);
4331 check ("imag(ctan(1 + i Inf)) = 1", __imag__ result
, 1);
4332 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4333 check ("real(ctan(-0 + i Inf)) = -0", __real__ result
, minus_zero
);
4334 check ("imag(ctan(-0 + i Inf)) = 1", __imag__ result
, 1);
4335 result
= FUNC(ctan
) (BUILD_COMPLEX (-1, plus_infty
));
4336 check ("real(ctan(-1 + i Inf)) = -0", __real__ result
, minus_zero
);
4337 check ("imag(ctan(-1 + i Inf)) = 1", __imag__ result
, 1);
4339 result
= FUNC(ctan
) (BUILD_COMPLEX (0, minus_infty
));
4340 check ("real(ctan(0 - i Inf)) = 0", __real__ result
, 0);
4341 check ("imag(ctan(0 - i Inf)) = -1", __imag__ result
, -1);
4342 result
= FUNC(ctan
) (BUILD_COMPLEX (1, minus_infty
));
4343 check ("real(ctan(1 - i Inf)) = 0", __real__ result
, 0);
4344 check ("imag(ctan(1 - i Inf)) = -1", __imag__ result
, -1);
4345 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4346 check ("real(ctan(-0 - i Inf)) = -0", __real__ result
, minus_zero
);
4347 check ("imag(ctan(-0 - i Inf)) = -1", __imag__ result
, -1);
4348 result
= FUNC(ctan
) (BUILD_COMPLEX (-1, minus_infty
));
4349 check ("real(ctan(-1 - i Inf)) = -0", __real__ result
, minus_zero
);
4350 check ("imag(ctan(-1 - i Inf)) = -1", __imag__ result
, -1);
4352 result
= FUNC(ctan
) (BUILD_COMPLEX (plus_infty
, 0));
4353 check_isnan_exc ("real(ctan(Inf + i 0)) = NaN plus invalid exception",
4354 __real__ result
, INVALID_EXCEPTION
);
4355 check_isnan ("imag(ctan(Inf + i 0)) = NaN plus invalid exception",
4357 result
= FUNC(ctan
) (BUILD_COMPLEX (plus_infty
, 2));
4358 check_isnan_exc ("real(ctan(Inf + i 2)) = NaN plus invalid exception",
4359 __real__ result
, INVALID_EXCEPTION
);
4360 check_isnan ("imag(ctan(Inf + i 2)) = NaN plus invalid exception",
4362 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_infty
, 0));
4363 check_isnan_exc ("real(ctan(-Inf + i 0)) = NaN plus invalid exception",
4364 __real__ result
, INVALID_EXCEPTION
);
4365 check_isnan ("imag(ctan(-Inf + i 0)) = NaN plus invalid exception",
4367 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_infty
, 2));
4368 check_isnan_exc ("real(ctan(- Inf + i 2)) = NaN plus invalid exception",
4369 __real__ result
, INVALID_EXCEPTION
);
4370 check_isnan ("imag(ctan(- Inf + i 2)) = NaN plus invalid exception",
4372 result
= FUNC(ctan
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4373 check_isnan_exc ("real(ctan(Inf - i 0)) = NaN plus invalid exception",
4374 __real__ result
, INVALID_EXCEPTION
);
4375 check_isnan ("imag(ctan(Inf - i 0)) = NaN plus invalid exception",
4377 result
= FUNC(ctan
) (BUILD_COMPLEX (plus_infty
, -2));
4378 check_isnan_exc ("real(ctan(Inf - i 2)) = NaN plus invalid exception",
4379 __real__ result
, INVALID_EXCEPTION
);
4380 check_isnan ("imag(ctan(Inf - i 2)) = NaN plus invalid exception",
4382 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4383 check_isnan_exc ("real(ctan(-Inf - i 0)) = NaN plus invalid exception",
4384 __real__ result
, INVALID_EXCEPTION
);
4385 check_isnan ("imag(ctan(-Inf - i 0)) = NaN plus invalid exception",
4387 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_infty
, -2));
4388 check_isnan_exc ("real(ctan(-Inf - i 2)) = NaN plus invalid exception",
4389 __real__ result
, INVALID_EXCEPTION
);
4390 check_isnan ("imag(ctan(-Inf - i 2)) = NaN plus invalid exception",
4393 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4394 check ("real(ctan(NaN + i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4395 check ("imag(ctan(NaN + i Inf)) = 1", __imag__ result
, 1);
4396 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4397 check ("real(ctan(NaN - i Inf)) = +-0", FUNC(fabs
) (__real__ result
), 0);
4398 check ("imag(ctan(NaN - i Inf)) = -1", __imag__ result
, -1);
4400 result
= FUNC(ctan
) (BUILD_COMPLEX (0, nan_value
));
4401 check ("real(ctan(0 + i NaN)) = 0", __real__ result
, 0);
4402 check_isnan ("imag(ctan(0 + i NaN)) = NaN", __imag__ result
);
4403 result
= FUNC(ctan
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4404 check ("real(ctan(-0 + i NaN)) = -0", __real__ result
, minus_zero
);
4405 check_isnan ("imag(ctan(-0 + i NaN)) = NaN", __imag__ result
);
4407 result
= FUNC(ctan
) (BUILD_COMPLEX (0.5, nan_value
));
4408 check_isnan_maybe_exc ("real(ctan(0.5 + i NaN)) = NaN plus maybe invalid exception",
4409 __real__ result
, INVALID_EXCEPTION
);
4410 check_isnan ("imag(ctan(0.5 + i NaN)) = NaN plus maybe invalid exception",
4412 result
= FUNC(ctan
) (BUILD_COMPLEX (-4.5, nan_value
));
4413 check_isnan_maybe_exc ("real(ctan(-4.5 + i NaN)) = NaN plus maybe invalid exception",
4414 __real__ result
, INVALID_EXCEPTION
);
4415 check_isnan ("imag(ctan(-4.5 + i NaN)) = NaN plus maybe invalid exception",
4418 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, 0));
4419 check_isnan_maybe_exc ("real(ctan(NaN + i 0)) = NaN plus maybe invalid exception",
4420 __real__ result
, INVALID_EXCEPTION
);
4421 check_isnan ("imag(ctan(NaN + i 0)) = NaN plus maybe invalid exception",
4423 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, 5));
4424 check_isnan_maybe_exc ("real(ctan(NaN + i 5)) = NaN plus maybe invalid exception",
4425 __real__ result
, INVALID_EXCEPTION
);
4426 check_isnan ("imag(ctan(NaN + i 5)) = NaN plus maybe invalid exception",
4428 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4429 check_isnan_maybe_exc ("real(ctan(NaN - i 0)) = NaN plus maybe invalid exception",
4430 __real__ result
, INVALID_EXCEPTION
);
4431 check_isnan ("imag(ctan(NaN - i 0)) = NaN plus maybe invalid exception",
4433 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, -0.25));
4434 check_isnan_maybe_exc ("real(ctan(NaN -i 0.25)) = NaN plus maybe invalid exception",
4435 __real__ result
, INVALID_EXCEPTION
);
4436 check_isnan ("imag(ctan(NaN -i 0.25)) = NaN plus maybe invalid exception",
4439 result
= FUNC(ctan
) (BUILD_COMPLEX (nan_value
, nan_value
));
4440 check_isnan ("real(ctan(NaN + i NaN)) = NaN", __real__ result
);
4441 check_isnan ("imag(ctan(NaN + i NaN)) = NaN", __imag__ result
);
4443 result
= FUNC(ctan
) (BUILD_COMPLEX (0.7, 1.2));
4444 check_eps ("real(ctan(0.7 + i 1.2)) == 0.17207...", __real__ result
,
4445 0.1720734197630349001L, CHOOSE(1e-17L, 3e-17, 2e-8));
4446 check_eps ("imag(ctan(0.7 + i 1.2)) == 0.95448...", __imag__ result
,
4447 0.9544807059989405538L, CHOOSE(2e-17L, 2e-16, 0));
4449 result
= FUNC(ctan
) (BUILD_COMPLEX (-2, -3));
4450 check_eps ("real(ctan(-2 - i 3)) == -0.00376...", __real__ result
,
4451 0.0037640256415042482L, CHOOSE(1e-19L, 0, 0));
4452 check_eps ("imag(ctan(-2 - i 3)) == -1.00323...", __imag__ result
,
4453 -1.0032386273536098014L, CHOOSE(2e-19L, 0, 2e-7));
4460 __complex__ MATHTYPE result
;
4462 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, 0));
4463 check ("real(ctanh(0 + i0)) = 0", __real__ result
, 0);
4464 check ("imag(ctanh(0 + i0)) = 0", __imag__ result
, 0);
4465 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_zero
));
4466 check ("real(ctanh(0 - i0)) = 0", __real__ result
, 0);
4467 check ("imag(ctanh(0 - i0)) = -0", __imag__ result
, minus_zero
);
4468 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, 0));
4469 check ("real(ctanh(-0 + i0)) = -0", __real__ result
, minus_zero
);
4470 check ("imag(ctanh(-0 + i0)) = 0", __imag__ result
, 0);
4471 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4472 check ("real(ctanh(-0 - i0)) = -0", __real__ result
, minus_zero
);
4473 check ("imag(ctanh(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4475 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 0));
4476 check ("real(ctanh(+Inf + i0)) = 1", __real__ result
, 1);
4477 check ("imag(ctanh(+Inf + i0)) = 0", __imag__ result
, 0);
4478 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, 1));
4479 check ("real(ctanh(+Inf + i1)) = 1", __real__ result
, 1);
4480 check ("imag(ctanh(+Inf + i1)) = 0", __imag__ result
, 0);
4481 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4482 check ("real(ctanh(+Inf - i0)) = 1", __real__ result
, 1);
4483 check ("imag(ctanh(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4484 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, -1));
4485 check ("real(ctanh(+Inf - i1)) = 1", __real__ result
, 1);
4486 check ("imag(ctanh(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4487 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 0));
4488 check ("real(ctanh(-Inf + i0)) = -1", __real__ result
, -1);
4489 check ("imag(ctanh(-Inf + i0)) = 0", __imag__ result
, 0);
4490 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, 1));
4491 check ("real(ctanh(-Inf + i1)) = -1", __real__ result
, -1);
4492 check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result
, 0);
4493 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4494 check ("real(ctanh(-Inf - i0)) = -1", __real__ result
, -1);
4495 check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result
, minus_zero
);
4496 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, -1));
4497 check ("real(ctanh(-Inf - i1)) = -1", __real__ result
, -1);
4498 check ("imag(ctanh(-Inf - i1)) = -0", __imag__ result
, minus_zero
);
4500 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, plus_infty
));
4501 check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
4502 __real__ result
, INVALID_EXCEPTION
);
4503 check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
4505 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, plus_infty
));
4506 check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
4507 __real__ result
, INVALID_EXCEPTION
);
4508 check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
4510 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, minus_infty
));
4511 check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
4512 __real__ result
, INVALID_EXCEPTION
);
4513 check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
4515 result
= FUNC(ctanh
) (BUILD_COMPLEX (2, minus_infty
));
4516 check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
4517 __real__ result
, INVALID_EXCEPTION
);
4518 check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
4520 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4521 check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4522 __real__ result
, INVALID_EXCEPTION
);
4523 check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
4525 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, plus_infty
));
4526 check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4527 __real__ result
, INVALID_EXCEPTION
);
4528 check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
4530 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4531 check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4532 __real__ result
, INVALID_EXCEPTION
);
4533 check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
4535 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, minus_infty
));
4536 check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4537 __real__ result
, INVALID_EXCEPTION
);
4538 check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
4541 result
= FUNC(ctanh
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4542 check ("real(ctanh(+Inf + i NaN)) = 1", __real__ result
, 1);
4543 check ("imag(ctanh(+Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4544 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4545 check ("real(ctanh(-Inf + i NaN)) = -1", __real__ result
, -1);
4546 check ("imag(ctanh(-Inf + i NaN)) = +-0", FUNC(fabs
) (__imag__ result
), 0);
4548 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0));
4549 check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result
);
4550 check ("imag(ctanh(NaN + i0)) = 0", __imag__ result
, 0);
4551 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4552 check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result
);
4553 check ("imag(ctanh(NaN - i0)) = -0", __imag__ result
, minus_zero
);
4555 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, 0.5));
4556 check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4557 __real__ result
, INVALID_EXCEPTION
);
4558 check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
4560 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, -4.5));
4561 check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4562 __real__ result
, INVALID_EXCEPTION
);
4563 check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
4566 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, nan_value
));
4567 check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4568 __real__ result
, INVALID_EXCEPTION
);
4569 check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
4571 result
= FUNC(ctanh
) (BUILD_COMPLEX (5, nan_value
));
4572 check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4573 __real__ result
, INVALID_EXCEPTION
);
4574 check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
4576 result
= FUNC(ctanh
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4577 check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4578 __real__ result
, INVALID_EXCEPTION
);
4579 check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
4581 result
= FUNC(ctanh
) (BUILD_COMPLEX (-0.25, nan_value
));
4582 check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4583 __real__ result
, INVALID_EXCEPTION
);
4584 check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
4587 result
= FUNC(ctanh
) (BUILD_COMPLEX (nan_value
, nan_value
));
4588 check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result
);
4589 check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result
);
4591 result
= FUNC(ctanh
) (BUILD_COMPLEX (0, M_PI_4
));
4592 check ("real(ctanh (0 + i pi/4)) == 0", __real__ result
, 0);
4593 check_eps ("imag(ctanh (0 + i pi/4)) == 1", __imag__ result
, 1,
4594 CHOOSE (0, 2e-16, 2e-7));
4596 result
= FUNC(ctanh
) (BUILD_COMPLEX (0.7, 1.2));
4597 check_eps ("real(ctanh(0.7 + i 1.2)) == 1.34721...", __real__ result
,
4598 1.3472197399061191630L, CHOOSE(4e-17L, 6e-17, 2e-7));
4599 check_eps ("imag(ctanh(0.7 + i 1.2)) == -0.47786...", __imag__ result
,
4600 0.4778641038326365540L, CHOOSE(9e-17L, 6e-17, 0));
4602 result
= FUNC(ctanh
) (BUILD_COMPLEX (-2, -3));
4603 check_eps ("real(ctanh(-2 - i 3)) == -0.96538...", __real__ result
,
4604 -0.9653858790221331242L, CHOOSE(2e-19L, 0, 0));
4605 check_eps ("imag(ctanh(-2 - i 3)) == 0.00988...", __imag__ result
,
4606 0.0098843750383224937L, CHOOSE(7e-20L, 0, 1e-9));
4613 __complex__ MATHTYPE result
;
4615 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, 0));
4616 check_isinfn_exc ("real(clog(-0 + i0)) = -Inf plus divide-by-zero exception",
4617 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4618 check ("imag(clog(-0 + i0)) = pi plus divide-by-zero exception",
4619 __imag__ result
, M_PI
);
4620 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4621 check_isinfn_exc ("real(clog(-0 - i0)) = -Inf plus divide-by-zero exception",
4622 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4623 check ("imag(clog(-0 - i0)) = -pi plus divide-by-zero exception",
4624 __imag__ result
, -M_PI
);
4626 result
= FUNC(clog
) (BUILD_COMPLEX (0, 0));
4627 check_isinfn_exc ("real(clog(0 + i0)) = -Inf plus divide-by-zero exception",
4628 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4629 check ("imag(clog(0 + i0)) = 0 plus divide-by-zero exception",
4630 __imag__ result
, 0);
4631 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_zero
));
4632 check_isinfn_exc ("real(clog(0 - i0)) = -Inf plus divide-by-zero exception",
4633 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4634 check ("imag(clog(0 - i0)) = -0 plus divide-by-zero exception",
4635 __imag__ result
, minus_zero
);
4637 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4638 check_isinfp ("real(clog(-Inf + i Inf)) = +Inf", __real__ result
);
4639 check ("imag(clog(-Inf + i Inf)) = 3*pi/4", __imag__ result
, M_PI
- M_PI_4
);
4640 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4641 check_isinfp ("real(clog(-Inf - i Inf)) = +Inf", __real__ result
);
4642 check ("imag(clog(-Inf - i Inf)) = -3*pi/4", __imag__ result
, M_PI_4
- M_PI
);
4644 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4645 check_isinfp ("real(clog(+Inf + i Inf)) = +Inf", __real__ result
);
4646 check ("imag(clog(+Inf + i Inf)) = pi/4", __imag__ result
, M_PI_4
);
4647 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4648 check_isinfp ("real(clog(+Inf - i Inf)) = +Inf", __real__ result
);
4649 check ("imag(clog(+Inf - i Inf)) = -pi/4", __imag__ result
, -M_PI_4
);
4651 result
= FUNC(clog
) (BUILD_COMPLEX (0, plus_infty
));
4652 check_isinfp ("real(clog(0 + i Inf)) = +Inf", __real__ result
);
4653 check ("imag(clog(0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4654 result
= FUNC(clog
) (BUILD_COMPLEX (3, plus_infty
));
4655 check_isinfp ("real(clog(3 + i Inf)) = +Inf", __real__ result
);
4656 check ("imag(clog(3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4657 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4658 check_isinfp ("real(clog(-0 + i Inf)) = +Inf", __real__ result
);
4659 check ("imag(clog(-0 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4660 result
= FUNC(clog
) (BUILD_COMPLEX (-3, plus_infty
));
4661 check_isinfp ("real(clog(-3 + i Inf)) = +Inf", __real__ result
);
4662 check ("imag(clog(-3 + i Inf)) = pi/2", __imag__ result
, M_PI_2
);
4663 result
= FUNC(clog
) (BUILD_COMPLEX (0, minus_infty
));
4664 check_isinfp ("real(clog(0 - i Inf)) = +Inf", __real__ result
);
4665 check ("imag(clog(0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4666 result
= FUNC(clog
) (BUILD_COMPLEX (3, minus_infty
));
4667 check_isinfp ("real(clog(3 - i Inf)) = +Inf", __real__ result
);
4668 check ("imag(clog(3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4669 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4670 check_isinfp ("real(clog(-0 - i Inf)) = +Inf", __real__ result
);
4671 check ("imag(clog(-0 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4672 result
= FUNC(clog
) (BUILD_COMPLEX (-3, minus_infty
));
4673 check_isinfp ("real(clog(-3 - i Inf)) = +Inf", __real__ result
);
4674 check ("imag(clog(-3 - i Inf)) = -pi/2", __imag__ result
, -M_PI_2
);
4676 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 0));
4677 check_isinfp ("real(clog(-Inf + i0)) = +Inf", __real__ result
);
4678 check ("imag(clog(-Inf + i0)) = pi", __imag__ result
, M_PI
);
4679 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, 1));
4680 check_isinfp ("real(clog(-Inf + i1)) = +Inf", __real__ result
);
4681 check ("imag(clog(-Inf + i1)) = pi", __imag__ result
, M_PI
);
4682 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4683 check_isinfp ("real(clog(-Inf - i0)) = +Inf", __real__ result
);
4684 check ("imag(clog(-Inf - i0)) = -pi", __imag__ result
, -M_PI
);
4685 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, -1));
4686 check_isinfp ("real(clog(-Inf - i1)) = +Inf", __real__ result
);
4687 check ("imag(clog(-Inf - i1)) = -pi", __imag__ result
, -M_PI
);
4689 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 0));
4690 check_isinfp ("real(clog(+Inf + i0)) = +Inf", __real__ result
);
4691 check ("imag(clog(+Inf + i0)) = 0", __imag__ result
, 0);
4692 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, 1));
4693 check_isinfp ("real(clog(+Inf + i1)) = +Inf", __real__ result
);
4694 check ("imag(clog(+Inf + i1)) = 0", __imag__ result
, 0);
4695 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4696 check_isinfp ("real(clog(+Inf - i0)) = +Inf", __real__ result
);
4697 check ("imag(clog(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4698 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, -1));
4699 check_isinfp ("real(clog(+Inf - i1)) = +Inf", __real__ result
);
4700 check ("imag(clog(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4702 result
= FUNC(clog
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4703 check_isinfp ("real(clog(+Inf + i NaN)) = +Inf", __real__ result
);
4704 check_isnan ("imag(clog(+Inf + i NaN)) = NaN", __imag__ result
);
4705 result
= FUNC(clog
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4706 check_isinfp ("real(clog(-Inf + i NaN)) = +Inf", __real__ result
);
4707 check_isnan ("imag(clog(-Inf + i NaN)) = NaN", __imag__ result
);
4709 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4710 check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result
);
4711 check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result
);
4712 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4713 check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result
);
4714 check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result
);
4716 result
= FUNC(clog
) (BUILD_COMPLEX (0, nan_value
));
4717 check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4718 __real__ result
, INVALID_EXCEPTION
);
4719 check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
4721 result
= FUNC(clog
) (BUILD_COMPLEX (3, nan_value
));
4722 check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4723 __real__ result
, INVALID_EXCEPTION
);
4724 check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
4726 result
= FUNC(clog
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4727 check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4728 __real__ result
, INVALID_EXCEPTION
);
4729 check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
4731 result
= FUNC(clog
) (BUILD_COMPLEX (-3, nan_value
));
4732 check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4733 __real__ result
, INVALID_EXCEPTION
);
4734 check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
4737 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 0));
4738 check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
4739 __real__ result
, INVALID_EXCEPTION
);
4740 check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
4742 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, 5));
4743 check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
4744 __real__ result
, INVALID_EXCEPTION
);
4745 check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
4747 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4748 check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
4749 __real__ result
, INVALID_EXCEPTION
);
4750 check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
4752 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, -5));
4753 check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
4754 __real__ result
, INVALID_EXCEPTION
);
4755 check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
4758 result
= FUNC(clog
) (BUILD_COMPLEX (nan_value
, nan_value
));
4759 check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result
);
4760 check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result
);
4762 result
= FUNC(clog
) (BUILD_COMPLEX (0.7, 1.2));
4763 check_eps ("real(clog(0.7 + i 1.2)) == 0.32876...", __real__ result
,
4764 0.3287600014583970919L, CHOOSE(5e-17L, 6e-17, 3e-8));
4765 check_eps ("imag(clog(0.7 + i 1.2)) == 1.04272...", __imag__ result
,
4766 1.0427218783685369524L, CHOOSE(2e-17L, 0, 0));
4768 result
= FUNC(clog
) (BUILD_COMPLEX (-2, -3));
4769 check_eps ("real(clog(-2 - i 3)) == 1.28247...", __real__ result
,
4770 1.2824746787307683680L, CHOOSE(3e-19L, 0, 0));
4771 check_eps ("imag(clog(-2 - i 3)) == -2.15879...", __imag__ result
,
4772 -2.1587989303424641704L, CHOOSE(2e-18L, 0, 0));
4779 __complex__ MATHTYPE result
;
4781 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_zero
, 0));
4782 check_isinfn_exc ("real(clog10(-0 + i0)) = -Inf plus divide-by-zero exception",
4783 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4784 check ("imag(clog10(-0 + i0)) = pi plus divide-by-zero exception",
4785 __imag__ result
, M_PI
);
4786 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4787 check_isinfn_exc ("real(clog10(-0 - i0)) = -Inf plus divide-by-zero exception",
4788 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4789 check ("imag(clog10(-0 - i0)) = -pi plus divide-by-zero exception",
4790 __imag__ result
, -M_PI
);
4792 result
= FUNC(clog10
) (BUILD_COMPLEX (0, 0));
4793 check_isinfn_exc ("real(clog10(0 + i0)) = -Inf plus divide-by-zero exception",
4794 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4795 check ("imag(clog10(0 + i0)) = 0 plus divide-by-zero exception",
4796 __imag__ result
, 0);
4797 result
= FUNC(clog10
) (BUILD_COMPLEX (0, minus_zero
));
4798 check_isinfn_exc ("real(clog10(0 - i0)) = -Inf plus divide-by-zero exception",
4799 __real__ result
, DIVIDE_BY_ZERO_EXCEPTION
);
4800 check ("imag(clog10(0 - i0)) = -0 plus divide-by-zero exception",
4801 __imag__ result
, minus_zero
);
4803 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
4804 check_isinfp ("real(clog10(-Inf + i Inf)) = +Inf", __real__ result
);
4805 check_eps ("imag(clog10(-Inf + i Inf)) = 3*pi/4*M_LOG10E", __imag__ result
,
4806 (M_PI
- M_PI_4
) * M_LOG10E
, CHOOSE (0, 3e-16, 0));
4807 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
4808 check_isinfp ("real(clog10(-Inf - i Inf)) = +Inf", __real__ result
);
4809 check_eps ("imag(clog10(-Inf - i Inf)) = -3*pi/4*M_LOG10E", __imag__ result
,
4810 (M_PI_4
- M_PI
) * M_LOG10E
, CHOOSE (0, 3e-16, 0));
4812 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
4813 check_isinfp ("real(clog10(+Inf + i Inf)) = +Inf", __real__ result
);
4814 check_eps ("imag(clog10(+Inf + i Inf)) = pi/4*M_LOG10E", __imag__ result
,
4815 M_PI_4
* M_LOG10E
, CHOOSE (0, 6e-17, 3e-8));
4816 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
4817 check_isinfp ("real(clog10(+Inf - i Inf)) = +Inf", __real__ result
);
4818 check_eps ("imag(clog10(+Inf - i Inf)) = -pi/4*M_LOG10E", __imag__ result
,
4819 -M_PI_4
* M_LOG10E
, CHOOSE (0, 6e-17, 3e-8));
4821 result
= FUNC(clog10
) (BUILD_COMPLEX (0, plus_infty
));
4822 check_isinfp ("real(clog10(0 + i Inf)) = +Inf", __real__ result
);
4823 check_eps ("imag(clog10(0 + i Inf)) = pi/2*M_LOG10E", __imag__ result
,
4824 M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4825 result
= FUNC(clog10
) (BUILD_COMPLEX (3, plus_infty
));
4826 check_isinfp ("real(clog10(3 + i Inf)) = +Inf", __real__ result
);
4827 check_eps ("imag(clog10(3 + i Inf)) = pi/2*M_LOG10E", __imag__ result
,
4828 M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4829 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
4830 check_isinfp ("real(clog10(-0 + i Inf)) = +Inf", __real__ result
);
4831 check_eps ("imag(clog10(-0 + i Inf)) = pi/2*M_LOG10E", __imag__ result
,
4832 M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4833 result
= FUNC(clog10
) (BUILD_COMPLEX (-3, plus_infty
));
4834 check_isinfp ("real(clog10(-3 + i Inf)) = +Inf", __real__ result
);
4835 check_eps ("imag(clog10(-3 + i Inf)) = pi/2*M_LOG10E", __imag__ result
,
4836 M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4837 result
= FUNC(clog10
) (BUILD_COMPLEX (0, minus_infty
));
4838 check_isinfp ("real(clog10(0 - i Inf)) = +Inf", __real__ result
);
4839 check_eps ("imag(clog10(0 - i Inf)) = -pi/2*M_LOG10E", __imag__ result
,
4840 -M_PI_2
*M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4841 result
= FUNC(clog10
) (BUILD_COMPLEX (3, minus_infty
));
4842 check_isinfp ("real(clog10(3 - i Inf)) = +Inf", __real__ result
);
4843 check_eps ("imag(clog10(3 - i Inf)) = -pi/2*M_LOG10E", __imag__ result
,
4844 -M_PI_2
*M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4845 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
4846 check_isinfp ("real(clog10(-0 - i Inf)) = +Inf", __real__ result
);
4847 check_eps ("imag(clog10(-0 - i Inf)) = -pi/2*M_LOG10E", __imag__ result
,
4848 -M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4849 result
= FUNC(clog10
) (BUILD_COMPLEX (-3, minus_infty
));
4850 check_isinfp ("real(clog10(-3 - i Inf)) = +Inf", __real__ result
);
4851 check_eps ("imag(clog10(-3 - i Inf)) = -pi/2*M_LOG10E", __imag__ result
,
4852 -M_PI_2
* M_LOG10E
, CHOOSE (0, 2e-16, 6e-8));
4854 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, 0));
4855 check_isinfp ("real(clog10(-Inf + i0)) = +Inf", __real__ result
);
4856 check_eps ("imag(clog10(-Inf + i0)) = pi*M_LOG10E", __imag__ result
,
4857 M_PI
* M_LOG10E
, CHOOSE (0, 3e-16, 2e-7));
4858 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, 1));
4859 check_isinfp ("real(clog10(-Inf + i1)) = +Inf", __real__ result
);
4860 check_eps ("imag(clog10(-Inf + i1)) = pi*M_LOG10E", __imag__ result
,
4861 M_PI
* M_LOG10E
, CHOOSE (0, 3e-16, 2e-7));
4862 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4863 check_isinfp ("real(clog10(-Inf - i0)) = +Inf", __real__ result
);
4864 check_eps ("imag(clog10(-Inf - i0)) = -pi*M_LOG10E", __imag__ result
,
4865 -M_PI
* M_LOG10E
, CHOOSE (0, 3e-16, 2e-7));
4866 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, -1));
4867 check_isinfp ("real(clog10(-Inf - i1)) = +Inf", __real__ result
);
4868 check_eps ("imag(clog10(-Inf - i1)) = -pi*M_LOG10E", __imag__ result
,
4869 -M_PI
* M_LOG10E
, CHOOSE (0, 3e-16, 2e-7));
4871 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, 0));
4872 check_isinfp ("real(clog10(+Inf + i0)) = +Inf", __real__ result
);
4873 check ("imag(clog10(+Inf + i0)) = 0", __imag__ result
, 0);
4874 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, 1));
4875 check_isinfp ("real(clog10(+Inf + i1)) = +Inf", __real__ result
);
4876 check ("imag(clog10(+Inf + i1)) = 0", __imag__ result
, 0);
4877 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4878 check_isinfp ("real(clog10(+Inf - i0)) = +Inf", __real__ result
);
4879 check ("imag(clog10(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4880 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, -1));
4881 check_isinfp ("real(clog10(+Inf - i1)) = +Inf", __real__ result
);
4882 check ("imag(clog10(+Inf - i1)) = -0", __imag__ result
, minus_zero
);
4884 result
= FUNC(clog10
) (BUILD_COMPLEX (plus_infty
, nan_value
));
4885 check_isinfp ("real(clog10(+Inf + i NaN)) = +Inf", __real__ result
);
4886 check_isnan ("imag(clog10(+Inf + i NaN)) = NaN", __imag__ result
);
4887 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_infty
, nan_value
));
4888 check_isinfp ("real(clog10(-Inf + i NaN)) = +Inf", __real__ result
);
4889 check_isnan ("imag(clog10(-Inf + i NaN)) = NaN", __imag__ result
);
4891 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, plus_infty
));
4892 check_isinfp ("real(clog10(NaN + i Inf)) = +Inf", __real__ result
);
4893 check_isnan ("imag(clog10(NaN + i Inf)) = NaN", __imag__ result
);
4894 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, minus_infty
));
4895 check_isinfp ("real(clog10(NaN - i Inf)) = +Inf", __real__ result
);
4896 check_isnan ("imag(clog10(NaN - i Inf)) = NaN", __imag__ result
);
4898 result
= FUNC(clog10
) (BUILD_COMPLEX (0, nan_value
));
4899 check_isnan_maybe_exc ("real(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
4900 __real__ result
, INVALID_EXCEPTION
);
4901 check_isnan ("imag(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
4903 result
= FUNC(clog10
) (BUILD_COMPLEX (3, nan_value
));
4904 check_isnan_maybe_exc ("real(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
4905 __real__ result
, INVALID_EXCEPTION
);
4906 check_isnan ("imag(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
4908 result
= FUNC(clog10
) (BUILD_COMPLEX (minus_zero
, nan_value
));
4909 check_isnan_maybe_exc ("real(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
4910 __real__ result
, INVALID_EXCEPTION
);
4911 check_isnan ("imag(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
4913 result
= FUNC(clog10
) (BUILD_COMPLEX (-3, nan_value
));
4914 check_isnan_maybe_exc ("real(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
4915 __real__ result
, INVALID_EXCEPTION
);
4916 check_isnan ("imag(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
4919 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, 0));
4920 check_isnan_maybe_exc ("real(clog10(NaN + i0)) = NaN plus maybe invalid exception",
4921 __real__ result
, INVALID_EXCEPTION
);
4922 check_isnan ("imag(clog10(NaN + i0)) = NaN plus maybe invalid exception",
4924 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, 5));
4925 check_isnan_maybe_exc ("real(clog10(NaN + i5)) = NaN plus maybe invalid exception",
4926 __real__ result
, INVALID_EXCEPTION
);
4927 check_isnan ("imag(clog10(NaN + i5)) = NaN plus maybe invalid exception",
4929 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, minus_zero
));
4930 check_isnan_maybe_exc ("real(clog10(NaN - i0)) = NaN plus maybe invalid exception",
4931 __real__ result
, INVALID_EXCEPTION
);
4932 check_isnan ("imag(clog10(NaN - i0)) = NaN plus maybe invalid exception",
4934 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, -5));
4935 check_isnan_maybe_exc ("real(clog10(NaN - i5)) = NaN plus maybe invalid exception",
4936 __real__ result
, INVALID_EXCEPTION
);
4937 check_isnan ("imag(clog10(NaN - i5)) = NaN plus maybe invalid exception",
4940 result
= FUNC(clog10
) (BUILD_COMPLEX (nan_value
, nan_value
));
4941 check_isnan ("real(clog10(NaN + i NaN)) = NaN", __real__ result
);
4942 check_isnan ("imag(clog10(NaN + i NaN)) = NaN", __imag__ result
);
4944 result
= FUNC(clog10
) (BUILD_COMPLEX (0.7, 1.2));
4945 check_eps ("real(clog10(0.7 + i 1.2)) == 0.14277...", __real__ result
,
4946 0.1427786545038868803L, CHOOSE(2e-17L, 6e-17, 2e-8));
4947 check_eps ("imag(clog10(0.7 + i 1.2)) == 0.45284...", __imag__ result
,
4948 0.4528483579352493248L, CHOOSE(6e-18, 6e-17, 3e-8));
4950 result
= FUNC(clog10
) (BUILD_COMPLEX (-2, -3));
4951 check_eps ("real(clog10(-2 - i 3)) == 0.55697...", __real__ result
,
4952 0.5569716761534183846L, CHOOSE(6e-20L, 0, 0));
4953 check_eps ("imag(clog10(-2 - i 3)) == -0.93755...", __imag__ result
,
4954 -0.9375544629863747085L, CHOOSE (7e-19L, 2e-16, 0));
4961 __complex__ MATHTYPE result
;
4963 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, 0));
4964 check ("real(csqrt(0 + i0)) = 0", __real__ result
, 0);
4965 check ("imag(csqrt(0 + i0)) = 0", __imag__ result
, 0);
4966 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_zero
));
4967 check ("real(csqrt(0 - i0)) = 0", __real__ result
, 0);
4968 check ("imag(csqrt(0 - i0)) = -0", __imag__ result
, minus_zero
);
4969 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, 0));
4970 check ("real(csqrt(-0 + i0)) = 0", __real__ result
, 0);
4971 check ("imag(csqrt(-0 + i0)) = 0", __imag__ result
, 0);
4972 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_zero
));
4973 check ("real(csqrt(-0 - i0)) = 0", __real__ result
, 0);
4974 check ("imag(csqrt(-0 - i0)) = -0", __imag__ result
, minus_zero
);
4976 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 0));
4977 check ("real(csqrt(-Inf + i0)) = 0", __real__ result
, 0);
4978 check_isinfp ("imag(csqrt(-Inf + i0)) = +Inf", __imag__ result
);
4979 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, 6));
4980 check ("real(csqrt(-Inf + i6)) = 0", __real__ result
, 0);
4981 check_isinfp ("imag(csqrt(-Inf + i6)) = +Inf", __imag__ result
);
4982 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_zero
));
4983 check ("real(csqrt(-Inf - i0)) = 0", __real__ result
, 0);
4984 check_isinfn ("imag(csqrt(-Inf - i0)) = -Inf", __imag__ result
);
4985 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, -6));
4986 check ("real(csqrt(-Inf - i6)) = 0", __real__ result
, 0);
4987 check_isinfn ("imag(csqrt(-Inf - i6)) = -Inf", __imag__ result
);
4989 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 0));
4990 check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result
);
4991 check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result
, 0);
4992 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, 6));
4993 check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result
);
4994 check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result
, 0);
4995 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_zero
));
4996 check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result
);
4997 check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result
, minus_zero
);
4998 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, -6));
4999 check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result
);
5000 check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result
, minus_zero
);
5002 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, plus_infty
));
5003 check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result
);
5004 check_isinfp ("imag(csqrt(0 + i Inf)) = +Inf", __imag__ result
);
5005 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, plus_infty
));
5006 check_isinfp ("real(csqrt(4 + i Inf)) = +Inf", __real__ result
);
5007 check_isinfp ("imag(csqrt(4 + i Inf)) = +Inf", __imag__ result
);
5008 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, plus_infty
));
5009 check_isinfp ("real(csqrt(+Inf + i Inf)) = +Inf", __real__ result
);
5010 check_isinfp ("imag(csqrt(+Inf + i Inf)) = +Inf", __imag__ result
);
5011 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, plus_infty
));
5012 check_isinfp ("real(csqrt(-0 + i Inf)) = +Inf", __real__ result
);
5013 check_isinfp ("imag(csqrt(-0 + i Inf)) = +Inf", __imag__ result
);
5014 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, plus_infty
));
5015 check_isinfp ("real(csqrt(-4 + i Inf)) = +Inf", __real__ result
);
5016 check_isinfp ("imag(csqrt(-4 + i Inf)) = +Inf", __imag__ result
);
5017 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, plus_infty
));
5018 check_isinfp ("real(csqrt(-Inf + i Inf)) = +Inf", __real__ result
);
5019 check_isinfp ("imag(csqrt(-Inf + i Inf)) = +Inf", __imag__ result
);
5020 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, minus_infty
));
5021 check_isinfp ("real(csqrt(0 - i Inf)) = +Inf", __real__ result
);
5022 check_isinfn ("imag(csqrt(0 - i Inf)) = -Inf", __imag__ result
);
5023 result
= FUNC(csqrt
) (BUILD_COMPLEX (4, minus_infty
));
5024 check_isinfp ("real(csqrt(4 - i Inf)) = +Inf", __real__ result
);
5025 check_isinfn ("imag(csqrt(4 - i Inf)) = -Inf", __imag__ result
);
5026 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, minus_infty
));
5027 check_isinfp ("real(csqrt(+Inf - i Inf)) = +Inf", __real__ result
);
5028 check_isinfn ("imag(csqrt(+Inf - i Inf)) = -Inf", __imag__ result
);
5029 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, minus_infty
));
5030 check_isinfp ("real(csqrt(-0 - i Inf)) = +Inf", __real__ result
);
5031 check_isinfn ("imag(csqrt(-0 - i Inf)) = -Inf", __imag__ result
);
5032 result
= FUNC(csqrt
) (BUILD_COMPLEX (-4, minus_infty
));
5033 check_isinfp ("real(csqrt(-4 - i Inf)) = +Inf", __real__ result
);
5034 check_isinfn ("imag(csqrt(-4 - i Inf)) = -Inf", __imag__ result
);
5035 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, minus_infty
));
5036 check_isinfp ("real(csqrt(-Inf - i Inf)) = +Inf", __real__ result
);
5037 check_isinfn ("imag(csqrt(-Inf - i Inf)) = -Inf", __imag__ result
);
5039 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_infty
, nan_value
));
5040 check_isnan ("real(csqrt(-Inf + i NaN)) = NaN", __real__ result
);
5041 check_isinfp ("imag(csqrt(-Inf + i NaN)) = +-Inf",
5042 FUNC(fabs
) (__imag__ result
));
5044 result
= FUNC(csqrt
) (BUILD_COMPLEX (plus_infty
, nan_value
));
5045 check_isinfp ("real(csqrt(+Inf + i NaN)) = +Inf", __real__ result
);
5046 check_isnan ("imag(csqrt(+Inf + i NaN)) = NaN", __imag__ result
);
5048 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, nan_value
));
5049 check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
5050 __real__ result
, INVALID_EXCEPTION
);
5051 check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
5053 result
= FUNC(csqrt
) (BUILD_COMPLEX (1, nan_value
));
5054 check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
5055 __real__ result
, INVALID_EXCEPTION
);
5056 check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
5058 result
= FUNC(csqrt
) (BUILD_COMPLEX (minus_zero
, nan_value
));
5059 check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
5060 __real__ result
, INVALID_EXCEPTION
);
5061 check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
5063 result
= FUNC(csqrt
) (BUILD_COMPLEX (-1, nan_value
));
5064 check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
5065 __real__ result
, INVALID_EXCEPTION
);
5066 check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
5069 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 0));
5070 check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
5071 __real__ result
, INVALID_EXCEPTION
);
5072 check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
5074 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, 8));
5075 check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
5076 __real__ result
, INVALID_EXCEPTION
);
5077 check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
5079 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, minus_zero
));
5080 check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
5081 __real__ result
, INVALID_EXCEPTION
);
5082 check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
5084 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, -8));
5085 check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
5086 __real__ result
, INVALID_EXCEPTION
);
5087 check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
5090 result
= FUNC(csqrt
) (BUILD_COMPLEX (nan_value
, nan_value
));
5091 check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result
);
5092 check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result
);
5094 result
= FUNC(csqrt
) (BUILD_COMPLEX (16.0, -30.0));
5095 check ("real(csqrt(16 - 30i)) = 5", __real__ result
, 5.0);
5096 check ("imag(csqrt(16 - 30i)) = -3", __imag__ result
, -3.0);
5098 result
= FUNC(csqrt
) (BUILD_COMPLEX (-1, 0));
5099 check ("real(csqrt(1 + i0) = 0", __real__ result
, 0);
5100 check ("imag(csqrt(1 + i0) = 1", __imag__ result
, 1);
5102 result
= FUNC(csqrt
) (BUILD_COMPLEX (0, 2));
5103 check ("real(csqrt(0 + i 2) = 1", __real__ result
, 1);
5104 check ("imag(csqrt(0 + i 2) = 1", __imag__ result
, 1);
5106 result
= FUNC(csqrt
) (BUILD_COMPLEX (119, 120));
5107 check ("real(csqrt(119 + i 120) = 12", __real__ result
, 12);
5108 check ("imag(csqrt(119 + i 120) = 5", __imag__ result
, 5);
5110 result
= FUNC(csqrt
) (BUILD_COMPLEX (0.7, 1.2));
5111 check_eps ("real(csqrt(0.7 + i 1.2)) == 1.02206...", __real__ result
,
5112 1.0220676100300264507L, CHOOSE(3e-17L, 3e-16, 2e-7));
5113 check_eps ("imag(csqrt(0.7 + i 1.2)) == 0.58704...", __imag__ result
,
5114 0.5870453129635652115L, CHOOSE(7e-18L, 0, 0));
5116 result
= FUNC(csqrt
) (BUILD_COMPLEX (-2, -3));
5117 check_eps ("real(csqrt(-2 - i 3)) == -0.89597...", __real__ result
,
5118 0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8));
5119 check_eps ("imag(csqrt(-2 - i 3)) == -1.67414...", __imag__ result
,
5120 -1.6741492280355400404L, CHOOSE(0, 5e-16, 0));
5127 __complex__ MATHTYPE result
;
5129 result
= FUNC (cpow
) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
5130 check ("real(cpow (1 + i0), (0 + i0)) == 0", __real__ result
, 1);
5131 check ("imag(cpow (1 + i0), (0 + i0)) == 0", __imag__ result
, 0);
5133 result
= FUNC (cpow
) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
5134 check_eps ("real(cpow (2 + i0), (10 + i0)) == 1024", __real__ result
, 1024,
5135 CHOOSE (2e-16L, 0, 0));
5136 check ("imag(cpow (2 + i0), (10 + i0)) == 0", __imag__ result
, 0);
5138 result
= FUNC (cpow
) (BUILD_COMPLEX (M_E
, 0), BUILD_COMPLEX (0, 2*M_PI
));
5139 check_eps ("real(cpow (e + i0), (0 + i 2*PI)) == 1", __real__ result
, 1,
5140 CHOOSE (0, 0, 6e-8));
5141 check_eps ("imag(cpow (e + i0), (0 + i 2*PI)) == 0", __imag__ result
, 0,
5142 CHOOSE (3e-18L, 3e-16, 4e-7));
5144 result
= FUNC (cpow
) (BUILD_COMPLEX (2, 3), BUILD_COMPLEX (4, 0));
5145 check_eps ("real(cpow (2 + i3), (4 + i0)) == -119", __real__ result
, -119,
5146 CHOOSE (9e-16L, 2e-14, 4e-5));
5147 check_eps ("imag(cpow (2 + i3), (4 + i0)) == -120", __imag__ result
, -120,
5148 CHOOSE (1e-15L, 0, 5e-5));
5155 /* cabs (x + iy) is specified as hypot (x,y) */
5157 a
= random_greater (0);
5158 check_isinfp_ext ("cabs (+inf + i x) == +inf",
5159 FUNC(cabs
) (BUILD_COMPLEX (plus_infty
, a
)), a
);
5160 check_isinfp_ext ("cabs (-inf + i x) == +inf",
5161 FUNC(cabs
) (BUILD_COMPLEX (minus_infty
, a
)), a
);
5163 check_isinfp ("cabs (+inf+ iNaN) == +inf",
5164 FUNC(cabs
) (BUILD_COMPLEX(minus_infty
, nan_value
)));
5165 check_isinfp ("cabs (-inf+ iNaN) == +inf",
5166 FUNC(cabs
) (BUILD_COMPLEX(minus_infty
, nan_value
)));
5168 check_isnan ("cabs (NaN+ iNaN) == NaN",
5169 FUNC(cabs
) (BUILD_COMPLEX(nan_value
, nan_value
)));
5171 a
= FUNC(cabs
) (BUILD_COMPLEX (12.4L, 0.7L));
5172 check ("cabs (x,y) == cabs (y,x)",
5173 FUNC(cabs
) (BUILD_COMPLEX(0.7L, 12.4L)), a
);
5174 check ("cabs (x,y) == cabs (-x,y)",
5175 FUNC(cabs
) (BUILD_COMPLEX(-12.4L, 0.7L)), a
);
5176 check ("cabs (x,y) == cabs (-y,x)",
5177 FUNC(cabs
) (BUILD_COMPLEX(-0.7L, 12.4L)), a
);
5178 check ("cabs (x,y) == cabs (-x,-y)",
5179 FUNC(cabs
) (BUILD_COMPLEX(-12.4L, -0.7L)), a
);
5180 check ("cabs (x,y) == cabs (-y,-x)",
5181 FUNC(cabs
) (BUILD_COMPLEX(-0.7L, -12.4L)), a
);
5182 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(-0.7L, 0)), 0.7L);
5183 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(0.7L, 0)), 0.7L);
5184 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(-1.0L, 0)), 1.0L);
5185 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(1.0L, 0)), 1.0L);
5186 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(-5.7e7L
, 0)),
5188 check ("cabs (x,0) == fabs (x)", FUNC(cabs
) (BUILD_COMPLEX(5.7e7L
, 0)),
5191 check_eps ("cabs (0.7 + i 1.2) == 1.38924...", FUNC(cabs
) (BUILD_COMPLEX(0.7, 1.2)),
5192 1.3892443989449804508L, CHOOSE(7e-17L, 3e-16, 0));
5199 /* carg (x + iy) is specified as atan2 (y, x) */
5202 x
= random_greater (0);
5203 check ("carg (x + i 0) == 0 for x > 0",
5204 FUNC(carg
) (BUILD_COMPLEX(x
, 0)), 0);
5205 x
= random_greater (0);
5206 check ("carg (x - i 0) == -0 for x > 0",
5207 FUNC(carg
) (BUILD_COMPLEX(x
, minus_zero
)), minus_zero
);
5209 check ("carg (+0 + i 0) == +0", FUNC(carg
) (BUILD_COMPLEX(0, 0)), 0);
5210 check ("carg (+0 - i 0) == -0", FUNC(carg
) (BUILD_COMPLEX(0, minus_zero
)),
5213 x
= -random_greater (0);
5214 check ("carg (x + i 0) == +pi for x < 0", FUNC(carg
) (BUILD_COMPLEX(x
, 0)),
5217 x
= -random_greater (0);
5218 check ("carg (x - i 0) == -pi for x < 0",
5219 FUNC(carg
) (BUILD_COMPLEX(x
, minus_zero
)), -M_PI
);
5221 check ("carg (-0 + i 0) == +pi", FUNC(carg
) (BUILD_COMPLEX(minus_zero
, 0)),
5223 check ("carg (-0 - i 0) == -pi",
5224 FUNC(carg
) (BUILD_COMPLEX(minus_zero
, minus_zero
)), -M_PI
);
5226 x
= random_greater (0);
5227 check ("carg (+0 + i y) == pi/2 for y > 0", FUNC(carg
) (BUILD_COMPLEX(0, x
)),
5230 x
= random_greater (0);
5231 check ("carg (-0 + i y) == pi/2 for y > 0",
5232 FUNC(carg
) (BUILD_COMPLEX(minus_zero
, x
)), M_PI_2
);
5234 x
= random_less (0);
5235 check ("carg (+0 + i y) == -pi/2 for y < 0", FUNC(carg
) (BUILD_COMPLEX(0, x
)),
5238 x
= random_less (0);
5239 check ("carg (-0 + i y) == -pi/2 for y < 0",
5240 FUNC(carg
) (BUILD_COMPLEX(minus_zero
, x
)), -M_PI_2
);
5242 x
= random_greater (0);
5243 check ("carg (inf + i y) == +0 for finite y > 0",
5244 FUNC(carg
) (BUILD_COMPLEX(plus_infty
, x
)), 0);
5246 x
= -random_greater (0);
5247 check ("carg (inf + i y) == -0 for finite y < 0",
5248 FUNC(carg
) (BUILD_COMPLEX(plus_infty
, x
)), minus_zero
);
5250 x
= random_value (-1e4
, 1e4
);
5251 check ("carg(x + i inf) == pi/2 for finite x",
5252 FUNC(carg
) (BUILD_COMPLEX(x
, plus_infty
)), M_PI_2
);
5254 x
= random_value (-1e4
, 1e4
);
5255 check ("carg(x - i inf) == -pi/2 for finite x",
5256 FUNC(carg
) (BUILD_COMPLEX(x
, minus_infty
)), -M_PI_2
);
5258 x
= random_greater (0);
5259 check ("carg (-inf + i y) == +pi for finite y > 0",
5260 FUNC(carg
) (BUILD_COMPLEX(minus_infty
, x
)), M_PI
);
5262 x
= -random_greater (0);
5263 check ("carg (-inf + i y) == -pi for finite y < 0",
5264 FUNC(carg
) (BUILD_COMPLEX(minus_infty
, x
)), -M_PI
);
5266 check ("carg (+inf + i inf) == +pi/4",
5267 FUNC(carg
) (BUILD_COMPLEX(plus_infty
, plus_infty
)), M_PI_4
);
5269 check ("carg (+inf -i inf) == -pi/4",
5270 FUNC(carg
) (BUILD_COMPLEX(plus_infty
, minus_infty
)), -M_PI_4
);
5272 check ("carg (-inf +i inf) == +3*pi/4",
5273 FUNC(carg
) (BUILD_COMPLEX(minus_infty
, plus_infty
)), 3 * M_PI_4
);
5275 check ("carg (-inf -i inf) == -3*pi/4",
5276 FUNC(carg
) (BUILD_COMPLEX(minus_infty
, minus_infty
)), -3 * M_PI_4
);
5282 nearbyint_test (void)
5284 check ("nearbyint(+0) = 0", FUNC(nearbyint
) (0.0), 0.0);
5285 check ("nearbyint(-0) = -0", FUNC(nearbyint
) (minus_zero
), minus_zero
);
5286 check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint
) (plus_infty
));
5287 check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint
) (minus_infty
));
5294 check ("rint(0) = 0", FUNC(rint
) (0.0), 0.0);
5295 check ("rint(-0) = -0", FUNC(rint
) (minus_zero
), minus_zero
);
5296 check_isinfp ("rint(+Inf) = +Inf", FUNC(rint
) (plus_infty
));
5297 check_isinfn ("rint(-Inf) = -Inf", FUNC(rint
) (minus_infty
));
5304 /* XXX this test is incomplete. We need to have a way to specifiy
5305 the rounding method and test the critical cases. So far, only
5306 unproblematic numbers are tested. */
5308 check_long ("lrint(0) = 0", FUNC(lrint
) (0.0), 0);
5309 check_long ("lrint(-0) = 0", FUNC(lrint
) (minus_zero
), 0);
5310 check_long ("lrint(0.2) = 0", FUNC(lrint
) (0.2), 0);
5311 check_long ("lrint(-0.2) = 0", FUNC(lrint
) (-0.2), 0);
5313 check_long ("lrint(1.4) = 1", FUNC(lrint
) (1.4), 1);
5314 check_long ("lrint(-1.4) = -1", FUNC(lrint
) (-1.4), -1);
5316 check_long ("lrint(8388600.3) = 8388600", FUNC(lrint
) (8388600.3), 8388600);
5317 check_long ("lrint(-8388600.3) = -8388600", FUNC(lrint
) (-8388600.3),
5325 /* XXX this test is incomplete. We need to have a way to specifiy
5326 the rounding method and test the critical cases. So far, only
5327 unproblematic numbers are tested. */
5329 check_longlong ("llrint(0) = 0", FUNC(llrint
) (0.0), 0);
5330 check_longlong ("llrint(-0) = 0", FUNC(llrint
) (minus_zero
), 0);
5331 check_longlong ("llrint(0.2) = 0", FUNC(llrint
) (0.2), 0);
5332 check_longlong ("llrint(-0.2) = 0", FUNC(llrint
) (-0.2), 0);
5334 check_longlong ("llrint(1.4) = 1", FUNC(llrint
) (1.4), 1);
5335 check_longlong ("llrint(-1.4) = -1", FUNC(llrint
) (-1.4), -1);
5337 check_longlong ("llrint(8388600.3) = 8388600", FUNC(llrint
) (8388600.3),
5339 check_longlong ("llrint(-8388600.3) = -8388600", FUNC(llrint
) (-8388600.3),
5342 /* Test boundary conditions. */
5344 check_longlong ("llrint(2097151.0) = 2097151", FUNC(llrint
) (2097151.0),
5347 check_longlong ("llrint(8388608.0) = 8388608", FUNC(llrint
) (8388608.0),
5350 check_longlong ("llrint(16777216.0) = 16777216",
5351 FUNC(llrint
) (16777216.0), 16777216LL);
5353 check_longlong ("llrint(2199023255552.0) = 2199023255552",
5354 FUNC(llrint
) (2199023255552.0), 2199023255552LL);
5356 check_longlong ("llrint(4398046511104.0) = 4398046511104",
5357 FUNC(llrint
) (4398046511104.0), 4398046511104LL);
5358 /* 0x10000000000000 */
5359 check_longlong ("llrint(4503599627370496.0) = 4503599627370496",
5360 FUNC(llrint
) (4503599627370496.0), 4503599627370496LL);
5361 /* 0x10000080000000 */
5362 check_longlong ("llrint(4503601774854144.0) = 4503601774854144",
5363 FUNC(llrint
) (4503601774854144.0), 4503601774854144LL);
5364 /* 0x20000000000000 */
5365 check_longlong ("llrint(9007199254740992.0) = 9007199254740992",
5366 FUNC(llrint
) (9007199254740992.0), 9007199254740992LL);
5367 /* 0x80000000000000 */
5368 check_longlong ("llrint(36028797018963968.0) = 36028797018963968",
5369 FUNC(llrint
) (36028797018963968.0), 36028797018963968LL);
5370 /* 0x100000000000000 */
5371 check_longlong ("llrint(72057594037927936.0) = 72057594037927936",
5372 FUNC(llrint
) (72057594037927936.0), 72057594037927936LL);
5379 check ("round(0) = 0", FUNC(round
) (0), 0);
5380 check ("round(-0) = -0", FUNC(round
) (minus_zero
), minus_zero
);
5381 check ("round(0.2) = 0", FUNC(round
) (0.2), 0.0);
5382 check ("round(-0.2) = -0", FUNC(round
) (-0.2), minus_zero
);
5383 check ("round(0.5) = 1", FUNC(round
) (0.5), 1.0);
5384 check ("round(-0.5) = -1", FUNC(round
) (-0.5), -1.0);
5385 check ("round(0.8) = 1", FUNC(round
) (0.8), 1.0);
5386 check ("round(-0.8) = -1", FUNC(round
) (-0.8), -1.0);
5387 check ("round(1.5) = 2", FUNC(round
) (1.5), 2.0);
5388 check ("round(-1.5) = -2", FUNC(round
) (-1.5), -2.0);
5389 check ("round(2097152.5) = 2097153", FUNC(round
) (2097152.5), 2097153);
5390 check ("round(-2097152.5) = -2097153", FUNC(round
) (-2097152.5), -2097153);
5397 check_long ("lround(0) = 0", FUNC(lround
) (0), 0);
5398 check_long ("lround(-0) = 0", FUNC(lround
) (minus_zero
), 0);
5399 check_long ("lround(0.2) = 0", FUNC(lround
) (0.2), 0.0);
5400 check_long ("lround(-0.2) = 0", FUNC(lround
) (-0.2), 0);
5401 check_long ("lround(0.5) = 1", FUNC(lround
) (0.5), 1);
5402 check_long ("lround(-0.5) = -1", FUNC(lround
) (-0.5), -1);
5403 check_long ("lround(0.8) = 1", FUNC(lround
) (0.8), 1);
5404 check_long ("lround(-0.8) = -1", FUNC(lround
) (-0.8), -1);
5405 check_long ("lround(1.5) = 2", FUNC(lround
) (1.5), 2);
5406 check_long ("lround(-1.5) = -2", FUNC(lround
) (-1.5), -2);
5407 check_long ("lround(22514.5) = 22515", FUNC(lround
) (22514.5), 22515);
5408 check_long ("lround(-22514.5) = -22515", FUNC(lround
) (-22514.5), -22515);
5410 check_long ("lround(2097152.5) = 2097153", FUNC(lround
) (2097152.5),
5412 check_long ("lround(-2097152.5) = -2097153", FUNC(lround
) (-2097152.5),
5421 check_longlong ("llround(0) = 0", FUNC(llround
) (0), 0);
5422 check_longlong ("llround(-0) = 0", FUNC(llround
) (minus_zero
), 0);
5423 check_longlong ("llround(0.2) = 0", FUNC(llround
) (0.2), 0.0);
5424 check_longlong ("llround(-0.2) = 0", FUNC(llround
) (-0.2), 0);
5425 check_longlong ("llround(0.5) = 1", FUNC(llround
) (0.5), 1);
5426 check_longlong ("llround(-0.5) = -1", FUNC(llround
) (-0.5), -1);
5427 check_longlong ("llround(0.8) = 1", FUNC(llround
) (0.8), 1);
5428 check_longlong ("llround(-0.8) = -1", FUNC(llround
) (-0.8), -1);
5429 check_longlong ("llround(1.5) = 2", FUNC(llround
) (1.5), 2);
5430 check_longlong ("llround(-1.5) = -2", FUNC(llround
) (-1.5), -2);
5431 check_longlong ("llround(22514.5) = 22515", FUNC(llround
) (22514.5), 22515);
5432 check_longlong ("llround(-22514.5) = -22515", FUNC(llround
) (-22514.5),
5435 check_longlong ("llround(2097152.5) = 2097153",
5436 FUNC(llround
) (2097152.5), 2097153);
5437 check_longlong ("llround(-2097152.5) = -2097153",
5438 FUNC(llround
) (-2097152.5), -2097153);
5439 check_longlong ("llround(34359738368.5) = 34359738369",
5440 FUNC(llround
) (34359738368.5), 34359738369ll);
5441 check_longlong ("llround(-34359738368.5) = -34359738369",
5442 FUNC(llround
) (-34359738368.5), -34359738369ll);
5445 /* Test boundary conditions. */
5447 check_longlong ("llround(2097151.0) = 2097151", FUNC(llround
) (2097151.0),
5450 check_longlong ("llround(8388608.0) = 8388608", FUNC(llround
) (8388608.0),
5453 check_longlong ("llround(16777216.0) = 16777216",
5454 FUNC(llround
) (16777216.0), 16777216LL);
5456 check_longlong ("llround(2199023255552.0) = 2199023255552",
5457 FUNC(llround
) (2199023255552.0), 2199023255552LL);
5459 check_longlong ("llround(4398046511104.0) = 4398046511104",
5460 FUNC(llround
) (4398046511104.0), 4398046511104LL);
5461 /* 0x10000000000000 */
5462 check_longlong ("llround(4503599627370496.0) = 4503599627370496",
5463 FUNC(llround
) (4503599627370496.0), 4503599627370496LL);
5464 /* 0x10000080000000 */
5465 check_longlong ("llrint(4503601774854144.0) = 4503601774854144",
5466 FUNC(llrint
) (4503601774854144.0), 4503601774854144LL);
5467 /* 0x20000000000000 */
5468 check_longlong ("llround(9007199254740992.0) = 9007199254740992",
5469 FUNC(llround
) (9007199254740992.0), 9007199254740992LL);
5470 /* 0x80000000000000 */
5471 check_longlong ("llround(36028797018963968.0) = 36028797018963968",
5472 FUNC(llround
) (36028797018963968.0), 36028797018963968LL);
5473 /* 0x100000000000000 */
5474 check_longlong ("llround(72057594037927936.0) = 72057594037927936",
5475 FUNC(llround
) (72057594037927936.0), 72057594037927936LL);
5482 check ("fma(1.0, 2.0, 3.0) = 5.0", FUNC(fma
) (1.0, 2.0, 3.0), 5.0);
5483 check_isnan ("fma(NaN, 2.0, 3.0) = NaN", FUNC(fma
) (nan_value
, 2.0, 3.0));
5484 check_isnan ("fma(1.0, NaN, 3.0) = NaN", FUNC(fma
) (1.0, nan_value
, 3.0));
5485 check_isnan_maybe_exc ("fma(1.0, 2.0, NaN) = NaN",
5486 FUNC(fma
) (1.0, 2.0, nan_value
), INVALID_EXCEPTION
);
5487 check_isnan_maybe_exc ("fma(+Inf, 0.0, NaN) = NaN",
5488 FUNC(fma
) (plus_infty
, 0.0, nan_value
),
5490 check_isnan_maybe_exc ("fma(-Inf, 0.0, NaN) = NaN",
5491 FUNC(fma
) (minus_infty
, 0.0, nan_value
),
5493 check_isnan_maybe_exc ("fma(0.0, +Inf, NaN) = NaN",
5494 FUNC(fma
) (0.0, plus_infty
, nan_value
),
5496 check_isnan_maybe_exc ("fma(0.0, -Inf, NaN) = NaN",
5497 FUNC(fma
) (0.0, minus_infty
, nan_value
),
5499 check_isnan_exc ("fma(+Inf, 0.0, 1.0) = NaN",
5500 FUNC(fma
) (plus_infty
, 0.0, 1.0), INVALID_EXCEPTION
);
5501 check_isnan_exc ("fma(-Inf, 0.0, 1.0) = NaN",
5502 FUNC(fma
) (minus_infty
, 0.0, 1.0), INVALID_EXCEPTION
);
5503 check_isnan_exc ("fma(0.0, +Inf, 1.0) = NaN",
5504 FUNC(fma
) (0.0, plus_infty
, 1.0), INVALID_EXCEPTION
);
5505 check_isnan_exc ("fma(0.0, -Inf, 1.0) = NaN",
5506 FUNC(fma
) (0.0, minus_infty
, 1.0), INVALID_EXCEPTION
);
5508 check_isnan_exc ("fma(+Inf, +Inf, -Inf) = NaN",
5509 FUNC(fma
) (plus_infty
, plus_infty
, minus_infty
),
5511 check_isnan_exc ("fma(-Inf, +Inf, +Inf) = NaN",
5512 FUNC(fma
) (minus_infty
, plus_infty
, plus_infty
),
5514 check_isnan_exc ("fma(+Inf, -Inf, +Inf) = NaN",
5515 FUNC(fma
) (plus_infty
, minus_infty
, plus_infty
),
5517 check_isnan_exc ("fma(-Inf, -Inf, -Inf) = NaN",
5518 FUNC(fma
) (minus_infty
, minus_infty
, minus_infty
),
5524 inverse_func_pair_test (const char *test_name
,
5525 mathfunc f1
, mathfunc inverse
,
5526 MATHTYPE x
, MATHTYPE epsilon
)
5528 MATHTYPE a
, b
, difference
;
5536 output_new_test (test_name
);
5537 result
= check_equal (b
, x
, epsilon
, &difference
);
5538 output_result (test_name
, result
,
5539 b
, x
, difference
, PRINT
, PRINT
);
5544 inverse_functions (void)
5546 inverse_func_pair_test ("asin(sin(x)) == x",
5547 FUNC(sin
), FUNC(asin
), 1.0,
5548 CHOOSE (2e-18L, 0, 3e-7L));
5549 inverse_func_pair_test ("sin(asin(x)) == x",
5550 FUNC(asin
), FUNC(sin
), 1.0, 0.0);
5552 inverse_func_pair_test ("acos(cos(x)) == x",
5553 FUNC(cos
), FUNC(acos
), 1.0,
5554 CHOOSE (4e-18L, 1e-15L, 0));
5555 inverse_func_pair_test ("cos(acos(x)) == x",
5556 FUNC(acos
), FUNC(cos
), 1.0, 0.0);
5557 inverse_func_pair_test ("atan(tan(x)) == x",
5558 FUNC(tan
), FUNC(atan
), 1.0, CHOOSE (2e-18L, 0, 0));
5559 inverse_func_pair_test ("tan(atan(x)) == x",
5560 FUNC(atan
), FUNC(tan
), 1.0,
5561 CHOOSE (2e-18L, 1e-15L, 2e-7));
5563 inverse_func_pair_test ("asinh(sinh(x)) == x",
5564 FUNC(sinh
), FUNC(asinh
), 1.0, CHOOSE (1e-18L, 0, 1e-7));
5565 inverse_func_pair_test ("sinh(asinh(x)) == x",
5566 FUNC(asinh
), FUNC(sinh
), 1.0,
5567 CHOOSE (2e-18L, 2e-16L, 2e-7));
5569 inverse_func_pair_test ("acosh(cosh(x)) == x",
5570 FUNC(cosh
), FUNC(acosh
), 1.0,
5571 CHOOSE (1e-18L, 1e-15L, 6e-8));
5572 inverse_func_pair_test ("cosh(acosh(x)) == x",
5573 FUNC(acosh
), FUNC(cosh
), 1.0, 0.0);
5575 inverse_func_pair_test ("atanh(tanh(x)) == x",
5576 FUNC(tanh
), FUNC(atanh
), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
5577 inverse_func_pair_test ("tanh(atanh(x)) == x",
5578 FUNC(atanh
), FUNC(tanh
), 1.0, 0.0);
5582 /* Test sin and cos with the identity: sin(x)^2 + cos(x)^2 = 1. */
5584 identities1_test (MATHTYPE x
, MATHTYPE epsilon
)
5586 MATHTYPE res1
, res2
, res3
, diff
;
5589 res1
= FUNC(sin
) (x
);
5591 res2
= FUNC(cos
) (x
);
5593 res3
= res1
* res1
+ res2
* res2
;
5596 output_new_test ("sin^2 + cos^2 == 1");
5597 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
5598 output_result_ext ("sin^2 + cos^2 == 1", result
,
5599 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
5603 /* Test sin, cos, tan with the following relation: tan = sin/cos. */
5605 identities2_test (MATHTYPE x
, MATHTYPE epsilon
)
5608 MATHTYPE res1
, res2
, res3
, res4
, diff
;
5611 res1
= FUNC(sin
) (x
);
5613 res2
= FUNC(cos
) (x
);
5615 res3
= FUNC(tan
) (x
);
5620 output_new_test ("sin/cos == tan");
5621 result
= check_equal (res4
, res3
, epsilon
, &diff
);
5622 output_result_ext ("sin/cos == tan", result
,
5623 res4
, res3
, diff
, x
, PRINT
, PRINT
);
5628 /* Test cosh and sinh with the identity cosh^2 - sinh^2 = 1. */
5630 identities3_test (MATHTYPE x
, MATHTYPE epsilon
)
5632 MATHTYPE res1
, res2
, res3
, diff
;
5635 res1
= FUNC(sinh
) (x
);
5637 res2
= FUNC(cosh
) (x
);
5639 res3
= res2
* res2
- res1
* res1
;
5642 output_new_test ("cosh^2 - sinh^2 == 1");
5643 result
= check_equal (res3
, 1.0, epsilon
, &diff
);
5644 output_result_ext ("cosh^2 - sinh^2 == 1", result
,
5645 res3
, 1.0, diff
, x
, PRINT
, PRINT
);
5652 identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
5653 identities1_test (0.9L, CHOOSE (1e-18L, 0, 1e-7));
5654 identities1_test (0, 0);
5655 identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
5657 identities2_test (0.2L, CHOOSE (1e-19L, 1e-16, 0));
5658 identities2_test (0.9L, CHOOSE (3e-19L, 1e-15, 2e-7));
5659 identities2_test (0, 0);
5660 identities2_test (-1, CHOOSE (1e-18L, 1e-15, 2e-7));
5662 identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
5663 identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
5664 identities3_test (0, CHOOSE (0, 0, 1e-6));
5665 identities3_test (-1, CHOOSE (1e-18L, 7e-16, 1e-6));
5670 Let's test that basic arithmetic is working
5671 tests: Infinity and NaN
5676 /* variables are declared volatile to forbid some compiler
5678 volatile MATHTYPE Inf_var
, NaN_var
, zero_var
, one_var
;
5683 NaN_var
= nan_value
;
5684 Inf_var
= one_var
/ zero_var
;
5691 /* Clear all exceptions. The previous computations raised exceptions. */
5692 feclearexcept (FE_ALL_EXCEPT
);
5694 check_isinfp ("isinf (inf) == +1", Inf_var
);
5695 check_isinfn ("isinf (-inf) == -1", -Inf_var
);
5696 check_bool ("!isinf (1)", !(FUNC(isinf
) (one_var
)));
5697 check_bool ("!isinf (NaN)", !(FUNC(isinf
) (NaN_var
)));
5699 check_isnan ("isnan (NaN)", NaN_var
);
5700 check_isnan ("isnan (-NaN)", -NaN_var
);
5701 check_bool ("!isnan (1)", !(FUNC(isnan
) (one_var
)));
5702 check_bool ("!isnan (inf)", !(FUNC(isnan
) (Inf_var
)));
5704 check_bool ("inf == inf", Inf_var
== Inf_var
);
5705 check_bool ("-inf == -inf", -Inf_var
== -Inf_var
);
5706 check_bool ("inf != -inf", Inf_var
!= -Inf_var
);
5707 check_bool ("NaN != NaN", NaN_var
!= NaN_var
);
5710 the same tests but this time with NAN from <bits/nan.h>
5711 NAN is a double const
5713 check_bool ("isnan (NAN)", isnan (NAN
));
5714 check_bool ("isnan (-NAN)", isnan (-NAN
));
5715 check_bool ("!isinf (NAN)", !(isinf (NAN
)));
5716 check_bool ("!isinf (-NAN)", !(isinf (-NAN
)));
5717 check_bool ("NAN != NAN", NAN
!= NAN
);
5720 And again with the value returned by the `nan' function.
5722 check_bool ("isnan (NAN)", FUNC(isnan
) (FUNC(nan
) ("")));
5723 check_bool ("isnan (-NAN)", FUNC(isnan
) (-FUNC(nan
) ("")));
5724 check_bool ("!isinf (NAN)", !(FUNC(isinf
) (FUNC(nan
) (""))));
5725 check_bool ("!isinf (-NAN)", !(FUNC(isinf
) (-FUNC(nan
) (""))));
5726 check_bool ("NAN != NAN", FUNC(nan
) ("") != FUNC(nan
) (""));
5728 /* test if EPSILON is ok */
5729 x1
= MATHCONST (1.0);
5730 x2
= x1
+ CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
5731 check_bool ("1 != 1+EPSILON", x1
!= x2
);
5733 x1
= MATHCONST (1.0);
5734 x2
= x1
- CHOOSE (LDBL_EPSILON
, DBL_EPSILON
, FLT_EPSILON
);
5735 check_bool ("1 != 1-EPSILON", x1
!= x2
);
5737 /* test if HUGE_VALx is ok */
5738 x1
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
5739 check_bool ("isinf (HUGE_VALx) == +1", ISINF (x1
) == +1);
5740 x1
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
5741 check_bool ("isinf (-HUGE_VALx) == -1", ISINF (x1
) == -1);
5749 fpstack_test ("start *init*");
5751 nan_value
= plus_zero
/ plus_zero
; /* Suppress GCC warning */
5753 minus_zero
= FUNC (copysign
) (0.0, -1.0);
5754 plus_infty
= CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
5755 minus_infty
= -CHOOSE (HUGE_VALL
, HUGE_VAL
, HUGE_VALF
);
5761 (void) &minus_infty
;
5763 /* Clear all exceptions. From now on we must not get random exceptions. */
5764 feclearexcept (FE_ALL_EXCEPT
);
5766 /* Test to make sure we start correctly. */
5767 fpstack_test ("end *init*");
5771 static struct option long_options
[] =
5773 {"verbose", optional_argument
, NULL
, 'v'},
5774 {"silent", no_argument
, NULL
, 's'},
5780 parse_options (int argc
, char *argv
[])
5789 c
= getopt_long (argc
, argv
, "v::s",
5790 long_options
, &option_index
);
5792 /* Detect the end of the options. */
5800 verbose
= (unsigned int) strtoul (optarg
, NULL
, 0);
5814 main (int argc
, char *argv
[])
5817 parse_options (argc
, argv
);
5824 /* keep the tests a wee bit ordered (according to ISO 9X) */
5825 /* classification functions */
5831 /* trigonometric functions */
5841 /* hyperbolic functions */
5849 /* exponential and logarithmic functions */
5865 /* power and absolute value functions */
5872 /* error and gamma functions */
5878 /* nearest integer functions */
5890 /* remainder functions */
5895 /* manipulation functions */
5899 /* maximum, minimum and positive difference functions */
5904 /* complex functions */
5925 /* multiply and add */
5930 inverse_functions ();
5932 printf ("\nTest suite completed:\n");
5933 printf (" %d test cases plus %d tests for exception flags executed.\n",
5934 noTests
, noExcTests
);
5937 printf (" %d errors occured.\n", noErrors
);
5940 printf (" All tests passed successfully.\n");