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. */
20 /* Part of testsuite for libm.
22 This file has to be included by a master file that defines:
25 FUNC(function): converts general function name (like cos) to
26 name with correct suffix (e.g. cosl or cosf)
27 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
28 MATHTYPE: floating point type to test
29 TEST_MSG: informal message to be displayed
30 CHOOSE(Clongdouble,Cdouble,Cfloat):
31 chooses one of the parameters as epsilon for testing
33 PRINTF_EXPR Floating point conversion specification to print a variable
34 of type MATHTYPE with printf. PRINTF_EXPR just contains
35 the specifier, not the percent and width arguments,
37 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
40 /* This program isn't finished yet.
42 acos, acosh, asin, asinh, atan, atan2, atanh,
43 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
44 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
46 ilogb, isfinite, isinf, isnan, isnormal,
47 isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, lrint, llrint,
51 round, lround, llround,
52 scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc
54 and for the following complex math functions:
55 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
56 ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan, ctanh.
58 At the moment the following functions aren't tested:
59 conj, cproj, cimag, creal, drem,
60 j0, j1, jn, y0, y1, yn,
64 The routines using random variables are still under construction. I don't
65 like it the way it's working now and will change it.
67 Parameter handling is primitive in the moment:
68 --verbose=[0..4] for different levels of output:
70 1: basic report on failed tests (default)
71 2: full report on failed tests
72 3: full report on failed and passed tests
73 4: additional report on exceptions
74 -v for full output (equals --verbose=4)
75 -s,--silent outputs only the error count (equals --verbose=0)
80 This suite tests some aspects of the correct implementation of
81 mathematical functions in libm. Some simple, specific parameters
82 are tested for correctness but there's no exhaustive
83 testing. Handling of specific inputs (e.g. infinity, not-a-number)
84 is also tested. Correct handling of exceptions is checked
85 against. These implemented tests should check all cases that are
86 specified in ISO C 9X.
88 Exception testing: At the moment only divide-by-zero and invalid
89 exceptions are tested. Overflow/underflow and inexact exceptions
90 aren't checked at the moment.
92 NaN values: There exist signalling and quiet NaNs. This implementation
93 only uses signalling NaN as parameter but does not differenciate
94 between the two kinds of NaNs as result.
96 Inline functions: Inlining functions should give an improvement in
97 speed - but not in precission. The inlined functions return
98 reasonable values for a reasonable range of input values. The
99 result is not necessarily correct for all values and exceptions are
100 not correctly raised in all cases. Problematic input and return
101 values are infinity, not-a-number and minus zero. This suite
102 therefore does not check these specific inputs and the exception
103 handling for inlined mathematical functions - just the "reasonable"
106 Beware: The tests might fail for any of the following reasons:
108 - Functions are wrong
109 - Floating Point Unit not working properly
110 - Compiler has errors
112 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
129 /* Possible exceptions */
130 #define NO_EXCEPTION 0x0
131 #define INVALID_EXCEPTION 0x1
132 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
137 /* Various constants (we must supply them precalculated for accuracy). */
138 #define M_PI_6l .52359877559829887308L
139 #define M_E2l 7.389056098930650227230L
140 #define M_E3l 20.08553692318766774093L
142 static int noErrors; /* number of errors */
143 static int noTests; /* number of tests (without testing exceptions) */
144 static int noExcTests; /* number of tests for exception flags */
146 static int verbose = 3;
147 static MATHTYPE minus_zero, plus_zero;
148 static MATHTYPE plus_infty, minus_infty, nan_value;
150 typedef MATHTYPE (*mathfunc) (MATHTYPE);
152 #define BUILD_COMPLEX(real, imag) \
153 ({ __complex__ MATHTYPE __retval; \
154 __real__ __retval = (real); \
155 __imag__ __retval = (imag); \
158 /* Test if Floating-Point stack hasn't changed */
160 fpstack_test (const char *test_name)
163 static int old_stack;
166 asm ("fnstsw" : "=a" (sw));
172 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
173 test_name, sw, old_stack);
181 /* Get a random value x with min_value < x < max_value
182 and min_value, max_value finite,
183 max_value and min_value shouldn't be too close together */
185 random_value (MATHTYPE min_value, MATHTYPE max_value)
192 x = (max_value - min_value) / RAND_MAX * (MATHTYPE) r + min_value;
194 if ((x <= min_value) || (x >= max_value) || !isfinite (x))
195 x = (max_value - min_value) / 2 + min_value;
197 /* Make sure the RNG has no influence on the exceptions. */
198 feclearexcept (FE_ALL_EXCEPT);
204 /* Get a random value x with x > min_value. */
206 random_greater (MATHTYPE min_value)
208 return random_value (min_value, 1e6); /* CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX) */
212 /* Get a random value x with x < max_value. */
214 random_less (MATHTYPE max_value)
216 return random_value (-1e6, max_value);
221 output_new_test (const char *test_name)
224 printf ("\nTesting: %s\n", test_name);
229 output_pass_value (void)
232 printf ("Pass: Value Ok.\n");
237 output_fail_value (const char *test_name)
239 if (verbose > 0 && verbose < 3)
240 printf ("Fail: %s\n", test_name);
246 /* Test whether a given exception was raised. */
248 test_single_exception (const char *test_name,
252 const char *flag_name)
255 if (exception & exc_flag)
257 if (fetestexcept (fe_flag))
260 printf ("Pass: Exception \"%s\" set\n", flag_name);
264 if (verbose && verbose < 3)
265 printf ("Fail: %s: Exception \"%s\" not set\n",
266 test_name, flag_name);
268 printf ("Fail: Exception \"%s\" not set\n",
275 if (fetestexcept (fe_flag))
277 if (verbose && verbose < 3)
278 printf ("Fail: %s: Exception \"%s\" set\n",
279 test_name, flag_name);
281 printf ("Fail: Exception \"%s\" set\n",
288 printf ("Pass: Exception \"%s\" not set\n",
296 /* Test whether exception given by EXCEPTION are raised. */
298 test_not_exception (const char *test_name, short int exception)
302 if ((exception & DIVIDE_BY_ZERO_EXCEPTION) == 0)
303 test_single_exception (test_name, exception,
304 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
308 if ((exception & INVALID_EXCEPTION) == 0)
309 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
310 "Invalid operation");
312 feclearexcept (FE_ALL_EXCEPT);
316 /* Test whether exceptions given by EXCEPTION are raised. */
318 test_exceptions (const char *test_name, short int exception)
322 test_single_exception (test_name, exception,
323 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
327 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
328 "Invalid operation");
330 feclearexcept (FE_ALL_EXCEPT);
334 /* Test if two floating point numbers are equal. */
336 check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff)
340 /* Both plus Infinity or both minus infinity. */
341 if (isinf (computed) && (isinf (computed) == isinf (supplied)))
344 if (isnan (computed) && isnan (supplied)) /* isnan works for all types */
347 *diff = FUNC(fabs) (computed - supplied);
350 ret_value = (*diff <= eps &&
351 (signbit (computed) == signbit (supplied) || eps != 0.0));
353 /* Make sure the subtraction/comparison
354 have no influence on the exceptions. */
355 feclearexcept (FE_ALL_EXCEPT);
362 output_result_bool (const char *test_name, int result)
367 output_pass_value ();
371 output_fail_value (test_name);
373 printf (" Value: %d\n", result);
377 fpstack_test (test_name);
382 output_isvalue (const char *test_name, int result,
388 output_pass_value ();
392 output_fail_value (test_name);
394 printf (" Value: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
399 fpstack_test (test_name);
404 output_isvalue_ext (const char *test_name, int result,
405 MATHTYPE value, MATHTYPE parameter)
410 output_pass_value ();
414 output_fail_value (test_name);
417 printf (" Value: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
419 printf (" Parameter: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
420 parameter, parameter);
425 fpstack_test (test_name);
430 output_result (const char *test_name, int result,
431 MATHTYPE computed, MATHTYPE expected,
433 int print_values, int print_diff)
438 output_pass_value ();
442 output_fail_value (test_name);
443 if (verbose > 1 && print_values)
445 printf ("Result:\n");
446 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
448 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
451 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
452 "\n", difference, difference);
457 fpstack_test (test_name);
462 output_result_ext (const char *test_name, int result,
463 MATHTYPE computed, MATHTYPE expected,
466 int print_values, int print_diff)
471 output_pass_value ();
475 output_fail_value (test_name);
476 if (verbose > 1 && print_values)
478 printf ("Result:\n");
479 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
481 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
484 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
485 "\n", difference, difference);
486 printf ("Parameter: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
487 parameter, parameter);
492 fpstack_test (test_name);
496 /* check that computed and expected values are the same */
498 check (const char *test_name, MATHTYPE computed, MATHTYPE expected)
503 output_new_test (test_name);
504 test_exceptions (test_name, NO_EXCEPTION);
505 result = check_equal (computed, expected, 0, &diff);
506 output_result (test_name, result,
507 computed, expected, diff, PRINT, PRINT);
511 /* check that computed and expected values are the same,
512 outputs the parameter to the function */
514 check_ext (const char *test_name, MATHTYPE computed, MATHTYPE expected,
520 output_new_test (test_name);
521 test_exceptions (test_name, NO_EXCEPTION);
522 result = check_equal (computed, expected, 0, &diff);
523 output_result_ext (test_name, result,
524 computed, expected, diff, parameter, PRINT, PRINT);
528 /* check that computed and expected values are the same and
529 checks also for exception flags */
531 check_exc (const char *test_name, MATHTYPE computed, MATHTYPE expected,
537 output_new_test (test_name);
538 test_exceptions (test_name, exception);
539 result = check_equal (computed, expected, 0, &diff);
540 output_result (test_name, result,
541 computed, expected, diff, PRINT, PRINT);
545 /* check that computed and expected values are close enough */
547 check_eps (const char *test_name, MATHTYPE computed, MATHTYPE expected,
553 output_new_test (test_name);
554 test_exceptions (test_name, NO_EXCEPTION);
555 result = check_equal (computed, expected, epsilon, &diff);
556 output_result (test_name, result,
557 computed, expected, diff, PRINT, PRINT);
561 /* check a boolean condition */
563 check_bool (const char *test_name, int computed)
565 output_new_test (test_name);
566 test_exceptions (test_name, NO_EXCEPTION);
567 output_result_bool (test_name, computed);
571 /* check that computed and expected values are equal (int values) */
573 check_int (const char *test_name, int computed, int expected)
575 int diff = computed - expected;
576 int result = diff == 0;
578 output_new_test (test_name);
579 test_exceptions (test_name, NO_EXCEPTION);
583 output_pass_value ();
587 output_fail_value (test_name);
590 printf ("Result:\n");
591 printf (" is: %d\n", computed);
592 printf (" should be: %d\n", expected);
597 fpstack_test (test_name);
601 /* check that computed and expected values are equal (long int values) */
603 check_long (const char *test_name, long int computed, long int expected)
605 long int diff = computed - expected;
606 int result = diff == 0;
609 output_new_test (test_name);
610 test_exceptions (test_name, NO_EXCEPTION);
614 output_pass_value ();
618 output_fail_value (test_name);
621 printf ("Result:\n");
622 printf (" is: %ld\n", computed);
623 printf (" should be: %ld\n", expected);
628 fpstack_test (test_name);
632 /* check that computed and expected values are equal (long long int values) */
634 check_longlong (const char *test_name, long long int computed,
635 long long int expected)
637 long long int diff = computed - expected;
638 int result = diff == 0;
641 output_new_test (test_name);
642 test_exceptions (test_name, NO_EXCEPTION);
646 output_pass_value ();
650 output_fail_value (test_name);
653 printf ("Result:\n");
654 printf (" is: %lld\n", computed);
655 printf (" should be: %lld\n", expected);
660 fpstack_test (test_name);
664 /* check that computed value is not-a-number */
666 check_isnan (const char *test_name, MATHTYPE computed)
668 output_new_test (test_name);
669 test_exceptions (test_name, NO_EXCEPTION);
670 output_isvalue (test_name, isnan (computed), computed);
674 /* check that computed value is not-a-number and test for exceptions */
676 check_isnan_exc (const char *test_name, MATHTYPE computed,
679 output_new_test (test_name);
680 test_exceptions (test_name, exception);
681 output_isvalue (test_name, isnan (computed), computed);
685 /* check that computed value is not-a-number and test for exceptions */
687 check_isnan_maybe_exc (const char *test_name, MATHTYPE computed,
690 output_new_test (test_name);
691 test_not_exception (test_name, exception);
692 output_isvalue (test_name, isnan (computed), computed);
696 /* check that computed value is not-a-number and supply parameter */
699 check_isnan_ext (const char *test_name, MATHTYPE computed,
702 output_new_test (test_name);
703 test_exceptions (test_name, NO_EXCEPTION);
704 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
708 /* check that computed value is not-a-number, test for exceptions
709 and supply parameter */
711 check_isnan_exc_ext (const char *test_name, MATHTYPE computed,
712 short exception, MATHTYPE parameter)
714 output_new_test (test_name);
715 test_exceptions (test_name, exception);
716 output_isvalue_ext (test_name, isnan (computed), computed, parameter);
720 /* Tests if computed is +Inf */
722 check_isinfp (const char *test_name, MATHTYPE computed)
724 output_new_test (test_name);
725 test_exceptions (test_name, NO_EXCEPTION);
726 output_isvalue (test_name, (isinf (computed) == +1), computed);
730 /* Tests if computed is +Inf and supply parameter */
732 check_isinfp_ext (const char *test_name, MATHTYPE computed,
735 output_new_test (test_name);
736 test_exceptions (test_name, NO_EXCEPTION);
737 output_isvalue_ext (test_name, (isinf (computed) == +1), computed, parameter);
741 /* Tests if computed is +Inf and check exceptions */
743 check_isinfp_exc (const char *test_name, MATHTYPE computed,
746 output_new_test (test_name);
747 test_exceptions (test_name, exception);
748 output_isvalue (test_name, (isinf (computed) == +1), computed);
752 /* Tests if computed is -Inf */
754 check_isinfn (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);
762 /* Tests if computed is -Inf and supply parameter */
765 check_isinfn_ext (const char *test_name, MATHTYPE computed,
768 output_new_test (test_name);
769 test_exceptions (test_name, NO_EXCEPTION);
770 output_isvalue_ext (test_name, (isinf (computed) == -1), computed, parameter);
774 /* Tests if computed is -Inf and check exceptions */
776 check_isinfn_exc (const char *test_name, MATHTYPE computed,
779 output_new_test (test_name);
780 test_exceptions (test_name, exception);
781 output_isvalue (test_name, (isinf (computed) == -1), computed);
785 /* This is to prevent messages from the SVID libm emulation. */
787 matherr (struct exception *x __attribute__ ((unused)))
793 /****************************************************************************
794 Test for single functions of libm
795 ****************************************************************************/
803 x = random_greater (1);
804 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
809 check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
813 check ("acos (0) == pi/2", FUNC(acos) (0), M_PI_2l);
814 check ("acos (-0) == pi/2", FUNC(acos) (minus_zero), M_PI_2l);
816 check ("acos (1) == 0", FUNC(acos) (1), 0);
817 check ("acos (-1) == pi", FUNC(acos) (-1), M_PIl);
819 check_eps ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6l * 2.0,
820 CHOOSE (1e-18, 0, 0));
821 check_eps ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6l * 4.0,
822 CHOOSE (1e-17, 0, 0));
824 check_eps ("acos (0.7) == 0.795398830...", FUNC(acos) (0.7),
825 0.7953988301841435554L, CHOOSE (7e-17L, 0, 0));
835 check_isinfp ("acosh(+inf) == +inf", FUNC(acosh) (plus_infty));
838 check_isnan_exc ("acosh(x) == NaN plus invalid exception if x < 1",
839 FUNC(acosh) (x), INVALID_EXCEPTION);
842 check ("acosh(1) == 0", FUNC(acosh) (1), 0);
843 check_eps ("acosh(7) == 2.633915793...", FUNC(acosh) (7),
844 2.6339157938496334172L, CHOOSE (3e-19, 0, 0));
854 x = random_greater (1);
855 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
860 check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
865 check ("asin (0) == 0", FUNC(asin) (0), 0);
866 check ("asin (-0) == -0", FUNC(asin) (minus_zero), minus_zero);
867 check_eps ("asin (0.5) == pi/6", FUNC(asin) (0.5), M_PI_6l,
868 CHOOSE (3.5e-18, 0, 2e-7));
869 check_eps ("asin (-0.5) == -pi/6", FUNC(asin) (-0.5), -M_PI_6l,
870 CHOOSE (3.5e-18, 0, 2e-7));
871 check ("asin (1.0) == pi/2", FUNC(asin) (1.0), M_PI_2l);
872 check ("asin (-1.0) == -pi/2", FUNC(asin) (-1.0), -M_PI_2l);
873 check_eps ("asin (0.7) == 0.775397496...", FUNC(asin) (0.7),
874 0.7753974966107530637L, CHOOSE (7e-17L, 2e-16, 2e-7));
881 check ("asinh(+0) == +0", FUNC(asinh) (0), 0);
883 check ("asinh(-0) == -0", FUNC(asinh) (minus_zero), minus_zero);
884 check_isinfp ("asinh(+inf) == +inf", FUNC(asinh) (plus_infty));
885 check_isinfn ("asinh(-inf) == -inf", FUNC(asinh) (minus_infty));
887 check_eps ("asinh(0.7) == 0.652666566...", FUNC(asinh) (0.7),
888 0.652666566082355786L, CHOOSE (4e-17L, 0, 6e-8));
895 check ("atan (0) == 0", FUNC(atan) (0), 0);
896 check ("atan (-0) == -0", FUNC(atan) (minus_zero), minus_zero);
898 check ("atan (+inf) == pi/2", FUNC(atan) (plus_infty), M_PI_2l);
899 check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2l);
901 check_eps ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4l,
902 CHOOSE (1e-18, 0, 0));
903 check_eps ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4l,
904 CHOOSE (1e-18, 0, 0));
906 check_eps ("atan (0.7) == 0.610725964...", FUNC(atan) (0.7),
907 0.6107259643892086165L, CHOOSE (3e-17L, 0, 0));
916 x = random_greater (0);
917 check ("atan2 (0,x) == 0 for x > 0",
918 FUNC(atan2) (0, x), 0);
919 x = random_greater (0);
920 check ("atan2 (-0,x) == -0 for x > 0",
921 FUNC(atan2) (minus_zero, x), minus_zero);
923 check ("atan2 (+0,+0) == +0", FUNC(atan2) (0, 0), 0);
924 check ("atan2 (-0,+0) == -0", FUNC(atan2) (minus_zero, 0), minus_zero);
926 x = -random_greater (0);
927 check ("atan2 (+0,x) == +pi for x < 0", FUNC(atan2) (0, x), M_PIl);
929 x = -random_greater (0);
930 check ("atan2 (-0,x) == -pi for x < 0", FUNC(atan2) (minus_zero, x), -M_PIl);
932 check ("atan2 (+0,-0) == +pi", FUNC(atan2) (0, minus_zero), M_PIl);
933 check ("atan2 (-0,-0) == -pi", FUNC(atan2) (minus_zero, minus_zero), -M_PIl);
935 x = random_greater (0);
936 check ("atan2 (y,+0) == pi/2 for y > 0", FUNC(atan2) (x, 0), M_PI_2l);
938 x = random_greater (0);
939 check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2) (x, minus_zero),
943 check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2) (x, 0), -M_PI_2l);
946 check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2) (x, minus_zero),
949 x = random_greater (0);
950 check ("atan2 (y,inf) == +0 for finite y > 0",
951 FUNC(atan2) (x, plus_infty), 0);
953 x = -random_greater (0);
954 check ("atan2 (y,inf) == -0 for finite y < 0",
955 FUNC(atan2) (x, plus_infty), minus_zero);
957 x = random_value (-1e4, 1e4);
958 check ("atan2(+inf, x) == pi/2 for finite x",
959 FUNC(atan2) (plus_infty, x), M_PI_2l);
961 x = random_value (-1e4, 1e4);
962 check ("atan2(-inf, x) == -pi/2 for finite x",
963 FUNC(atan2) (minus_infty, x), -M_PI_2l);
965 x = random_greater (0);
966 check ("atan2 (y,-inf) == +pi for finite y > 0",
967 FUNC(atan2) (x, minus_infty), M_PIl);
969 x = -random_greater (0);
970 check ("atan2 (y,-inf) == -pi for finite y < 0",
971 FUNC(atan2) (x, minus_infty), -M_PIl);
973 check ("atan2 (+inf,+inf) == +pi/4",
974 FUNC(atan2) (plus_infty, plus_infty), M_PI_4l);
976 check ("atan2 (-inf,+inf) == -pi/4",
977 FUNC(atan2) (minus_infty, plus_infty), -M_PI_4l);
979 check ("atan2 (+inf,-inf) == +3*pi/4",
980 FUNC(atan2) (plus_infty, minus_infty), 3 * M_PI_4l);
982 check ("atan2 (-inf,-inf) == -3*pi/4",
983 FUNC(atan2) (minus_infty, minus_infty), -3 * M_PI_4l);
985 /* FIXME: Add some specific tests */
986 check_eps ("atan2 (0.7,1) == 0.61072...", FUNC(atan2) (0.7, 1),
987 0.6107259643892086165L, CHOOSE (3e-17L, 0, 0));
988 check_eps ("atan2 (0.4,0.0003) == 1.57004...", FUNC(atan2) (0.4, 0.0003),
989 1.5700463269355215718L, CHOOSE (2e-19L, 0, 1.2e-7));
1000 check ("atanh(+0) == +0", FUNC(atanh) (0), 0);
1002 check ("atanh(-0) == -0", FUNC(atanh) (minus_zero), minus_zero);
1004 check_isinfp_exc ("atanh(+1) == +inf plus divide-by-zero exception",
1005 FUNC(atanh) (1), DIVIDE_BY_ZERO_EXCEPTION);
1006 check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
1007 FUNC(atanh) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1009 x = random_greater (1.0);
1010 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1011 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1013 x = random_less (1.0);
1014 check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
1015 FUNC(atanh) (x), INVALID_EXCEPTION, x);
1018 check_eps ("atanh(0.7) == 0.867300527...", FUNC(atanh) (0.7),
1019 0.8673005276940531944L, CHOOSE (9e-17L, 2e-16, 0));
1026 check ("cbrt (+0) == +0", FUNC(cbrt) (0.0), 0.0);
1027 check ("cbrt (-0) == -0", FUNC(cbrt) (minus_zero), minus_zero);
1030 check_isinfp ("cbrt (+inf) == +inf", FUNC(cbrt) (plus_infty));
1031 check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty));
1032 check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value));
1034 check_eps ("cbrt (-0.001) == -0.1", FUNC(cbrt) (-0.001), -0.1,
1035 CHOOSE (5e-18L, 0, 0));
1036 check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0));
1037 check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0,
1038 CHOOSE (3e-16L, 5e-16, 0));
1039 check_eps ("cbrt (0.970299) == 0.99", FUNC(cbrt) (0.970299), 0.99,
1040 CHOOSE (2e-17L, 2e-16, 0));
1041 check_eps ("cbrt (0.7) == .8879040017...", FUNC(cbrt) (0.7),
1042 0.8879040017426007084L, CHOOSE (2e-17L, 6e-16, 0));
1049 check ("ceil (+0) == +0", FUNC(ceil) (0.0), 0.0);
1050 check ("ceil (-0) == -0", FUNC(ceil) (minus_zero), minus_zero);
1051 check_isinfp ("ceil (+inf) == +inf", FUNC(ceil) (plus_infty));
1052 check_isinfn ("ceil (-inf) == -inf", FUNC(ceil) (minus_infty));
1054 check ("ceil (pi) == 4", FUNC(ceil) (M_PIl), 4.0);
1055 check ("ceil (-pi) == -3", FUNC(ceil) (-M_PIl), -3.0);
1062 check ("cos (+0) == 1", FUNC(cos) (0), 1);
1063 check ("cos (-0) == 1", FUNC(cos) (minus_zero), 1);
1064 check_isnan_exc ("cos (+inf) == NaN plus invalid exception",
1065 FUNC(cos) (plus_infty),
1067 check_isnan_exc ("cos (-inf) == NaN plus invalid exception",
1068 FUNC(cos) (minus_infty),
1071 check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6l * 2.0),
1072 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1073 check_eps ("cos (2*pi/3) == -0.5", FUNC(cos) (M_PI_6l * 4.0),
1074 -0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
1075 check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2l),
1076 0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
1078 check_eps ("cos (0.7) == 0.7648421872...", FUNC(cos) (0.7),
1079 0.7648421872844884262L, CHOOSE (3e-17, 2e-16, 6e-8));
1086 check ("cosh (+0) == 1", FUNC(cosh) (0), 1);
1087 check ("cosh (-0) == 1", FUNC(cosh) (minus_zero), 1);
1090 check_isinfp ("cosh (+inf) == +inf", FUNC(cosh) (plus_infty));
1091 check_isinfp ("cosh (-inf) == +inf", FUNC(cosh) (minus_infty));
1094 check_eps ("cosh (0.7) == 1.2551690056...", FUNC(cosh) (0.7),
1095 1.255169005630943018L, CHOOSE (4e-17L, 0, 0));
1104 if (errno == ENOSYS)
1105 /* Function not implemented. */
1108 check ("erf (+0) == +0", FUNC(erf) (0), 0);
1109 check ("erf (-0) == -0", FUNC(erf) (minus_zero), minus_zero);
1110 check ("erf (+inf) == +1", FUNC(erf) (plus_infty), 1);
1111 check ("erf (-inf) == -1", FUNC(erf) (minus_infty), -1);
1113 check_eps ("erf (0.7) == 0.6778011938...", FUNC(erf) (0.7),
1114 0.67780119383741847297L, CHOOSE (0, 2e-16, 0));
1123 if (errno == ENOSYS)
1124 /* Function not implemented. */
1127 check ("erfc (+inf) == 0", FUNC(erfc) (plus_infty), 0.0);
1128 check ("erfc (-inf) == 2", FUNC(erfc) (minus_infty), 2.0);
1129 check ("erfc (+0) == 1", FUNC(erfc) (0.0), 1.0);
1130 check ("erfc (-0) == 1", FUNC(erfc) (minus_zero), 1.0);
1132 check_eps ("erfc (0.7) == 0.3221988061...", FUNC(erfc) (0.7),
1133 0.32219880616258152702L, CHOOSE (0, 6e-17, 0));
1140 check ("exp (+0) == 1", FUNC(exp) (0), 1);
1141 check ("exp (-0) == 1", FUNC(exp) (minus_zero), 1);
1144 check_isinfp ("exp (+inf) == +inf", FUNC(exp) (plus_infty));
1145 check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0);
1147 check_eps ("exp (1) == e", FUNC(exp) (1), M_El, CHOOSE (4e-18L, 0, 0));
1149 check_eps ("exp (2) == e^2", FUNC(exp) (2), M_E2l,
1150 CHOOSE (1e-18, 0, 0));
1151 check_eps ("exp (3) == e^3", FUNC(exp) (3), M_E3l,
1152 CHOOSE (1.5e-17, 0, 0));
1153 check_eps ("exp (0.7) == 2.0137527074...", FUNC(exp) (0.7),
1154 2.0137527074704765216L, CHOOSE (9e-17L, 0, 0));
1163 if (errno == ENOSYS)
1164 /* Function not implemented. */
1167 check ("exp10 (+0) == 1", FUNC(exp10) (0), 1);
1168 check ("exp10 (-0) == 1", FUNC(exp10) (minus_zero), 1);
1170 check_isinfp ("exp10 (+inf) == +inf", FUNC(exp10) (plus_infty));
1171 check ("exp10 (-inf) == 0", FUNC(exp10) (minus_infty), 0);
1172 check_eps ("exp10 (3) == 1000", FUNC(exp10) (3), 1000,
1173 CHOOSE (5e-16, 7e-13, 2e-4));
1174 check_eps ("exp10 (-1) == 0.1", FUNC(exp10) (-1), 0.1,
1175 CHOOSE (6e-18, 3e-17, 8e-09));
1176 check_isinfp ("exp10 (1e6) == +inf", FUNC(exp10) (1e6));
1177 check ("exp10 (-1e6) == 0", FUNC(exp10) (-1e6), 0);
1178 check_eps ("exp10 (0.7) == 5.0118723...", FUNC(exp10) (0.7),
1179 5.0118723362727228500L, CHOOSE (6e-16, 9e-16, 5e-7));
1188 if (errno == ENOSYS)
1189 /* Function not implemented. */
1192 check ("exp2 (+0) == 1", FUNC(exp2) (0), 1);
1193 check ("exp2 (-0) == 1", FUNC(exp2) (minus_zero), 1);
1195 check_isinfp ("exp2 (+inf) == +inf", FUNC(exp2) (plus_infty));
1196 check ("exp2 (-inf) == 0", FUNC(exp2) (minus_infty), 0);
1197 check ("exp2 (10) == 1024", FUNC(exp2) (10), 1024);
1198 check ("exp2 (-1) == 0.5", FUNC(exp2) (-1), 0.5);
1199 check_isinfp ("exp2 (1e6) == +inf", FUNC(exp2) (1e6));
1200 check ("exp2 (-1e6) == 0", FUNC(exp2) (-1e6), 0);
1201 check_eps ("exp2 (0.7) == 1.6245047927...", FUNC(exp2) (0.7),
1202 1.6245047927124710452L, CHOOSE (6e-17L, 0, 6e-8));
1209 check ("expm1 (+0) == 0", FUNC(expm1) (0), 0);
1211 check ("expm1 (-0) == -0", FUNC(expm1) (minus_zero), minus_zero);
1213 check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1) (plus_infty));
1214 check ("expm1 (-inf) == -1", FUNC(expm1) (minus_infty), -1);
1217 check_eps ("expm1 (1) == e-1", FUNC(expm1) (1), M_El - 1.0,
1218 CHOOSE (4e-18L, 0, 2e-7));
1220 check_eps ("expm1 (0.7) == 1.01375...", FUNC(expm1) (0.7),
1221 1.0137527074704765216L, CHOOSE (9e-17L, 0, 0));
1226 check_frexp (const char *test_name, MATHTYPE computed, MATHTYPE expected,
1227 int comp_int, int exp_int)
1232 result = (check_equal (computed, expected, 0, &diff)
1233 && (comp_int == exp_int));
1238 printf ("Pass: %s\n", test_name);
1243 printf ("Fail: %s\n", test_name);
1246 printf ("Result:\n");
1247 printf (" is: %.20" PRINTF_EXPR " *2^%d %.20"
1248 PRINTF_XEXPR "*2^%d\n",
1249 computed, comp_int, computed, comp_int);
1250 printf (" should be: %.20" PRINTF_EXPR " *2^%d %.20"
1251 PRINTF_XEXPR "*2^%d\n",
1252 expected, exp_int, expected, exp_int);
1253 printf (" difference: %.20" PRINTF_EXPR " %.20" PRINTF_XEXPR "\n",
1258 fpstack_test (test_name);
1259 output_result (test_name, result,
1260 computed, expected, diff, PRINT, PRINT);
1270 result = FUNC(frexp) (plus_infty, &x_int);
1271 check_isinfp ("frexp (+inf, expr) == +inf", result);
1273 result = FUNC(frexp) (minus_infty, &x_int);
1274 check_isinfn ("frexp (-inf, expr) == -inf", result);
1276 result = FUNC(frexp) (nan_value, &x_int);
1277 check_isnan ("frexp (Nan, expr) == NaN", result);
1279 result = FUNC(frexp) (0, &x_int);
1280 check_frexp ("frexp: +0 == 0 * 2^0", result, 0, x_int, 0);
1282 result = FUNC(frexp) (minus_zero, &x_int);
1283 check_frexp ("frexp: -0 == -0 * 2^0", result, minus_zero, x_int, 0);
1285 result = FUNC(frexp) (12.8L, &x_int);
1286 check_frexp ("frexp: 12.8 == 0.8 * 2^4", result, 0.8L, x_int, 4);
1288 result = FUNC(frexp) (-27.34L, &x_int);
1289 check_frexp ("frexp: -27.34 == -0.854375 * 2^5",
1290 result, -0.854375L, x_int, 5);
1295 fpclassify_test (void)
1299 /* fpclassify is a macro, don't give it constants as parameter */
1300 check_bool ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value) == FP_NAN);
1301 check_bool ("fpclassify (+inf) == FP_INFINITE",
1302 fpclassify (plus_infty) == FP_INFINITE);
1303 check_bool ("fpclassify (-inf) == FP_INFINITE",
1304 fpclassify (minus_infty) == FP_INFINITE);
1305 check_bool ("fpclassify (+0) == FP_ZERO",
1306 fpclassify (plus_zero) == FP_ZERO);
1307 check_bool ("fpclassify (-0) == FP_ZERO",
1308 fpclassify (minus_zero) == FP_ZERO);
1311 check_bool ("fpclassify (1000) == FP_NORMAL",
1312 fpclassify (x) == FP_NORMAL);
1317 isfinite_test (void)
1319 check_bool ("isfinite (0) != 0", isfinite (0));
1320 check_bool ("isfinite (-0) != 0", isfinite (minus_zero));
1321 check_bool ("isfinite (10) != 0", isfinite (10));
1322 check_bool ("isfinite (+inf) == 0", isfinite (plus_infty) == 0);
1323 check_bool ("isfinite (-inf) == 0", isfinite (minus_infty) == 0);
1324 check_bool ("isfinite (NaN) == 0", isfinite (nan_value) == 0);
1329 isnormal_test (void)
1331 check_bool ("isnormal (0) == 0", isnormal (0) == 0);
1332 check_bool ("isnormal (-0) == 0", isnormal (minus_zero) == 0);
1333 check_bool ("isnormal (10) != 0", isnormal (10));
1334 check_bool ("isnormal (+inf) == 0", isnormal (plus_infty) == 0);
1335 check_bool ("isnormal (-inf) == 0", isnormal (minus_infty) == 0);
1336 check_bool ("isnormal (NaN) == 0", isnormal (nan_value) == 0);
1345 check_bool ("signbit (+0) == 0", signbit (0) == 0);
1346 check_bool ("signbit (-0) != 0", signbit (minus_zero));
1347 check_bool ("signbit (+inf) == 0", signbit (plus_infty) == 0);
1348 check_bool ("signbit (-inf) != 0", signbit (minus_infty));
1350 x = random_less (0);
1351 check_bool ("signbit (x) != 0 for x < 0", signbit (x));
1353 x = random_greater (0);
1354 check_bool ("signbit (x) == 0 for x > 0", signbit (x) == 0);
1363 if (errno == ENOSYS)
1364 /* Function not implemented. */
1366 feclearexcept (FE_ALL_EXCEPT);
1369 check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
1370 check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
1371 FUNC(gamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1373 check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
1374 FUNC(gamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1375 check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
1376 FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
1379 check ("gamma (1) == 0", FUNC(gamma) (1), 0);
1380 check_int ("gamma (1) sets signgam to 1", signgam, 1);
1383 check ("gamma (3) == M_LN2", FUNC(gamma) (3), M_LN2l);
1384 check_int ("gamma (3) sets signgam to 1", signgam, 1);
1387 check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma) (0.5),
1388 FUNC(log) (FUNC(sqrt) (M_PIl)), CHOOSE (0, 1e-15, 1e-7));
1389 check_int ("gamma (0.5) sets signgam to 1", signgam, 1);
1392 check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma) (-0.5),
1393 FUNC(log) (2*FUNC(sqrt) (M_PIl)), CHOOSE (0, 1e-15, 0));
1395 check_int ("gamma (-0.5) sets signgam to -1", signgam, -1);
1404 if (errno == ENOSYS)
1405 /* Function not implemented. */
1407 feclearexcept (FE_ALL_EXCEPT);
1409 check_isinfp ("tgamma (+inf) == +inf", FUNC(tgamma) (plus_infty));
1410 check_isnan_exc ("tgamma (0) == NaN plus invalid exception",
1411 FUNC(tgamma) (0), INVALID_EXCEPTION);
1413 check_isnan_exc_ext ("tgamma (x) == NaN plus invalid exception for integer x <= 0",
1414 FUNC(tgamma) (-2), INVALID_EXCEPTION, -2);
1415 check_isnan_exc ("tgamma (-inf) == NaN plus invalid exception",
1416 FUNC(tgamma) (minus_infty), INVALID_EXCEPTION);
1418 check_eps ("tgamma (0.5) == sqrt(pi)", FUNC(tgamma) (0.5),
1419 FUNC(sqrt) (M_PIl), CHOOSE (0, 5e-16, 2e-7));
1420 check_eps ("tgamma (-0.5) == -2*sqrt(pi)", FUNC(tgamma) (-0.5),
1421 -2*FUNC(sqrt) (M_PIl), CHOOSE (0, 5e-16, 3e-7));
1423 check ("tgamma (1) == 1", FUNC(tgamma) (1), 1);
1424 check ("tgamma (4) == 6", FUNC(tgamma) (4), 6);
1426 check_eps ("tgamma (0.7) == 1.29805...", FUNC(tgamma) (0.7),
1427 1.29805533264755778568L, CHOOSE (0, 3e-16, 2e-7));
1428 check ("tgamma (1.2) == 0.91816...", FUNC(tgamma) (1.2),
1429 0.91816874239976061064L);
1438 if (errno == ENOSYS)
1439 /* Function not implemented. */
1441 feclearexcept (FE_ALL_EXCEPT);
1443 check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma) (plus_infty));
1444 check_isinfp_exc ("lgamma (0) == +inf plus divide by zero exception",
1445 FUNC(lgamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
1447 check_isinfp_exc ("lgamma (x) == +inf plus divide by zero exception for integer x <= 0",
1448 FUNC(lgamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
1449 check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
1450 FUNC(lgamma) (minus_infty), INVALID_EXCEPTION);
1453 check ("lgamma (1) == 0", FUNC(lgamma) (1), 0);
1454 check_int ("lgamma (0) sets signgam to 1", signgam, 1);
1457 check ("lgamma (3) == M_LN2", FUNC(lgamma) (3), M_LN2l);
1458 check_int ("lgamma (3) sets signgam to 1", signgam, 1);
1461 check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma) (0.5),
1462 FUNC(log) (FUNC(sqrt) (M_PIl)), CHOOSE (0, 1e-15, 1e-7));
1463 check_int ("lgamma (0.5) sets signgam to 1", signgam, 1);
1466 check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma) (-0.5),
1467 FUNC(log) (2*FUNC(sqrt) (M_PIl)), CHOOSE (0, 1e-15, 0));
1469 check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1);
1472 check_eps ("lgamma (0.7) == 0.26086...", FUNC(lgamma) (0.7),
1473 0.26086724653166651439L, CHOOSE (0, 6e-17, 3e-8));
1474 check_int ("lgamma (0.7) sets signgam to 1", signgam, 1);
1477 check_eps ("lgamma (1.2) == -0.08537...", FUNC(lgamma) (1.2),
1478 -0.853740900033158497197e-1L, CHOOSE (0, 2e-17, 2e-8));
1479 check_int ("lgamma (1.2) sets signgam to 1", signgam, 1);
1488 check_int ("ilogb (1) == 0", FUNC(ilogb) (1), 0);
1489 check_int ("ilogb (e) == 1", FUNC(ilogb) (M_El), 1);
1490 check_int ("ilogb (1024) == 10", FUNC(ilogb) (1024), 10);
1491 check_int ("ilogb (-2000) == 10", FUNC(ilogb) (-2000), 10);
1493 /* XXX We have a problem here: the standard does not tell us whether
1494 exceptions are allowed/required. ignore them for now. */
1495 i = FUNC(ilogb) (0.0);
1496 feclearexcept (FE_ALL_EXCEPT);
1497 check_int ("ilogb (0) == FP_ILOGB0", i, FP_ILOGB0);
1498 i = FUNC(ilogb) (nan_value);
1499 feclearexcept (FE_ALL_EXCEPT);
1500 check_int ("ilogb (NaN) == FP_ILOGBNAN", i, FP_ILOGBNAN);
1509 check ("ldexp (0, 0) == 0", FUNC(ldexp) (0, 0), 0);
1511 check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp) (plus_infty, 1));
1512 check_isinfn ("ldexp (-inf, 1) == -inf", FUNC(ldexp) (minus_infty, 1));
1513 check_isnan ("ldexp (NaN, 1) == NaN", FUNC(ldexp) (nan_value, 1));
1515 check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp) (0.8L, 4), 12.8L);
1516 check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp) (-0.854375L, 5), -27.34L);
1518 x = random_greater (0.0);
1519 check_ext ("ldexp (x, 0) == x", FUNC(ldexp) (x, 0L), x, x);
1526 check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception",
1527 FUNC(log) (0), DIVIDE_BY_ZERO_EXCEPTION);
1528 check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception",
1529 FUNC(log) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1531 check ("log (1) == 0", FUNC(log) (1), 0);
1533 check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0",
1534 FUNC(log) (-1), INVALID_EXCEPTION);
1535 check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty));
1537 check_eps ("log (e) == 1", FUNC(log) (M_El), 1, CHOOSE (1e-18L, 0, 9e-8L));
1538 check_eps ("log (1/e) == -1", FUNC(log) (1.0 / M_El), -1,
1539 CHOOSE (2e-18L, 0, 0));
1540 check_eps ("log (2) == M_LN2", FUNC(log) (2), M_LN2l,
1541 CHOOSE (6e-20L, 0, 0));
1542 check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10l,
1543 CHOOSE (1e-18L, 0, 0));
1544 check_eps ("log (0.7) == -0.3566749439...", FUNC(log) (0.7),
1545 -0.35667494393873237891L, CHOOSE (7e-17L, 6e-17, 3e-8));
1552 check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception",
1553 FUNC(log10) (0), DIVIDE_BY_ZERO_EXCEPTION);
1554 check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception",
1555 FUNC(log10) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1557 check ("log10 (1) == +0", FUNC(log10) (1), 0);
1559 check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0",
1560 FUNC(log10) (-1), INVALID_EXCEPTION);
1562 check_isinfp ("log10 (+inf) == +inf", FUNC(log10) (plus_infty));
1564 check_eps ("log10 (0.1) == -1", FUNC(log10) (0.1L), -1,
1565 CHOOSE (1e-18L, 0, 0));
1566 check_eps ("log10 (10) == 1", FUNC(log10) (10.0), 1,
1567 CHOOSE (1e-18L, 0, 0));
1568 check_eps ("log10 (100) == 2", FUNC(log10) (100.0), 2,
1569 CHOOSE (1e-18L, 0, 0));
1570 check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
1571 check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_El), M_LOG10El,
1572 CHOOSE (1e-18, 0, 9e-8));
1573 check_eps ("log10 (0.7) == -0.1549019599...", FUNC(log10) (0.7),
1574 -0.15490195998574316929L, CHOOSE (3e-17L, 3e-17, 2e-8));
1581 check ("log1p (+0) == +0", FUNC(log1p) (0), 0);
1582 check ("log1p (-0) == -0", FUNC(log1p) (minus_zero), minus_zero);
1584 check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception",
1585 FUNC(log1p) (-1), DIVIDE_BY_ZERO_EXCEPTION);
1586 check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1",
1587 FUNC(log1p) (-2), INVALID_EXCEPTION);
1589 check_isinfp ("log1p (+inf) == +inf", FUNC(log1p) (plus_infty));
1591 check_eps ("log1p (e-1) == 1", FUNC(log1p) (M_El - 1.0), 1,
1592 CHOOSE (1e-18L, 0, 6e-8));
1594 check_eps ("log1p (-0.3) == -0.35667...", FUNC(log1p) (-0.3),
1595 -0.35667494393873237891L, CHOOSE (2e-17L, 6e-17, 3e-8));
1602 check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception",
1603 FUNC(log2) (0), DIVIDE_BY_ZERO_EXCEPTION);
1604 check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception",
1605 FUNC(log2) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1607 check ("log2 (1) == +0", FUNC(log2) (1), 0);
1609 check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0",
1610 FUNC(log2) (-1), INVALID_EXCEPTION);
1612 check_isinfp ("log2 (+inf) == +inf", FUNC(log2) (plus_infty));
1614 check_eps ("log2 (e) == M_LOG2E", FUNC(log2) (M_El), M_LOG2El,
1615 CHOOSE (1e-18L, 0, 0));
1616 check ("log2 (2) == 1", FUNC(log2) (2.0), 1);
1617 check_eps ("log2 (16) == 4", FUNC(log2) (16.0), 4, CHOOSE (1e-18L, 0, 0));
1618 check ("log2 (256) == 8", FUNC(log2) (256.0), 8);
1619 check_eps ("log2 (0.7) == -0.5145731728...", FUNC(log2) (0.7),
1620 -0.51457317282975824043L, CHOOSE (1e-16L, 2e-16, 6e-8));
1627 check_isinfp ("logb (+inf) == +inf", FUNC(logb) (plus_infty));
1628 check_isinfp ("logb (-inf) == +inf", FUNC(logb) (minus_infty));
1630 check_isinfn_exc ("logb (+0) == -inf plus divide-by-zero exception",
1631 FUNC(logb) (0), DIVIDE_BY_ZERO_EXCEPTION);
1633 check_isinfn_exc ("logb (-0) == -inf plus divide-by-zero exception",
1634 FUNC(logb) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
1636 check ("logb (1) == 0", FUNC(logb) (1), 0);
1637 check ("logb (e) == 1", FUNC(logb) (M_El), 1);
1638 check ("logb (1024) == 10", FUNC(logb) (1024), 10);
1639 check ("logb (-2000) == 10", FUNC(logb) (-2000), 10);
1646 MATHTYPE result, intpart;
1648 result = FUNC(modf) (plus_infty, &intpart);
1649 check ("modf (+inf, &x) returns +0", result, 0);
1650 check_isinfp ("modf (+inf, &x) set x to +inf", intpart);
1652 result = FUNC(modf) (minus_infty, &intpart);
1653 check ("modf (-inf, &x) returns -0", result, minus_zero);
1654 check_isinfn ("modf (-inf, &x) sets x to -inf", intpart);
1656 result = FUNC(modf) (nan_value, &intpart);
1657 check_isnan ("modf (NaN, &x) returns NaN", result);
1658 check_isnan ("modf (NaN, &x) sets x to NaN", intpart);
1660 result = FUNC(modf) (0, &intpart);
1661 check ("modf (0, &x) returns 0", result, 0);
1662 check ("modf (0, &x) sets x to 0", intpart, 0);
1664 result = FUNC(modf) (minus_zero, &intpart);
1665 check ("modf (-0, &x) returns -0", result, minus_zero);
1666 check ("modf (-0, &x) sets x to -0", intpart, minus_zero);
1668 result = FUNC(modf) (1.5, &intpart);
1669 check ("modf (1.5, &x) returns 0.5", result, 0.5);
1670 check ("modf (1.5, &x) sets x to 1", intpart, 1);
1672 result = FUNC(modf) (2.5, &intpart);
1673 check ("modf (2.5, &x) returns 0.5", result, 0.5);
1674 check ("modf (2.5, &x) sets x to 2", intpart, 2);
1676 result = FUNC(modf) (-2.5, &intpart);
1677 check ("modf (-2.5, &x) returns -0.5", result, -0.5);
1678 check ("modf (-2.5, &x) sets x to -2", intpart, -2);
1680 result = FUNC(modf) (20, &intpart);
1681 check ("modf (20, &x) returns 0", result, 0);
1682 check ("modf (20, &x) sets x to 20", intpart, 20);
1684 result = FUNC(modf) (21, &intpart);
1685 check ("modf (21, &x) returns 0", result, 0);
1686 check ("modf (21, &x) sets x to 21", intpart, 21);
1688 result = FUNC(modf) (89.6, &intpart);
1689 check_eps ("modf (89.6, &x) returns 0.6", result, 0.6,
1690 CHOOSE (6e-15L, 6e-15, 2e-6));
1691 check ("modf (89.6, &x) sets x to 89", intpart, 89);
1700 check_isnan ("scalb (2, 0.5) == NaN", FUNC(scalb) (2, 0.5));
1701 check_isnan ("scalb (3, -2.5) == NaN", FUNC(scalb) (3, -2.5));
1703 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1704 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1706 x = random_greater (0.0);
1707 check ("scalb (x, 0) == 0", FUNC(scalb) (x, 0), x);
1708 x = random_greater (0.0);
1709 check ("scalb (-x, 0) == 0", FUNC(scalb) (-x, 0), -x);
1711 check_isnan_exc ("scalb (+0, +inf) == NaN plus invalid exception",
1712 FUNC(scalb) (0, plus_infty), INVALID_EXCEPTION);
1713 check_isnan_exc ("scalb (-0, +inf) == NaN plus invalid exception",
1714 FUNC(scalb) (minus_zero, plus_infty), INVALID_EXCEPTION);
1716 check ("scalb (+0, 2) == +0", FUNC(scalb) (0, 2), 0);
1717 check ("scalb (-0, 4) == -0", FUNC(scalb) (minus_zero, -4), minus_zero);
1718 check ("scalb (+0, 0) == +0", FUNC(scalb) (0, 0), 0);
1719 check ("scalb (-0, 0) == -0", FUNC(scalb) (minus_zero, 0), minus_zero);
1720 check ("scalb (+0, -1) == +0", FUNC(scalb) (0, -1), 0);
1721 check ("scalb (-0, -10) == -0", FUNC(scalb) (minus_zero, -10), minus_zero);
1722 check ("scalb (+0, -inf) == +0", FUNC(scalb) (0, minus_infty), 0);
1723 check ("scalb (-0, -inf) == -0", FUNC(scalb) (minus_zero, minus_infty),
1726 check_isinfp ("scalb (+inf, -1) == +inf", FUNC(scalb) (plus_infty, -1));
1727 check_isinfn ("scalb (-inf, -10) == -inf", FUNC(scalb) (minus_infty, -10));
1728 check_isinfp ("scalb (+inf, 0) == +inf", FUNC(scalb) (plus_infty, 0));
1729 check_isinfn ("scalb (-inf, 0) == -inf", FUNC(scalb) (minus_infty, 0));
1730 check_isinfp ("scalb (+inf, 2) == +inf", FUNC(scalb) (plus_infty, 2));
1731 check_isinfn ("scalb (-inf, 100) == -inf", FUNC(scalb) (minus_infty, 100));
1733 x = random_greater (0.0);
1734 check ("scalb (x, -inf) == 0", FUNC(scalb) (x, minus_infty), 0.0);
1735 check ("scalb (-x, -inf) == -0", FUNC(scalb) (-x, minus_infty), minus_zero);
1737 x = random_greater (0.0);
1738 check_isinfp ("scalb (x, +inf) == +inf", FUNC(scalb) (x, plus_infty));
1739 x = random_greater (0.0);
1740 check_isinfn ("scalb (-x, +inf) == -inf", FUNC(scalb) (-x, plus_infty));
1741 check_isinfp ("scalb (+inf, +inf) == +inf",
1742 FUNC(scalb) (plus_infty, plus_infty));
1743 check_isinfn ("scalb (-inf, +inf) == -inf",
1744 FUNC(scalb) (minus_infty, plus_infty));
1746 check_isnan ("scalb (+inf, -inf) == NaN",
1747 FUNC(scalb) (plus_infty, minus_infty));
1748 check_isnan ("scalb (-inf, -inf) == NaN",
1749 FUNC(scalb) (minus_infty, minus_infty));
1751 check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb) (nan_value, 1));
1752 check_isnan ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value));
1753 check_isnan ("scalb (NaN, 0) == NaN", FUNC(scalb) (nan_value, 0));
1754 check_isnan ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value));
1755 check_isnan ("scalb (NaN, +inf) == NaN",
1756 FUNC(scalb) (nan_value, plus_infty));
1757 check_isnan ("scalb (+inf, NaN) == NaN",
1758 FUNC(scalb) (plus_infty, nan_value));
1759 check_isnan ("scalb (NaN, NaN) == NaN", FUNC(scalb) (nan_value, nan_value));
1761 check ("scalb (0.8, 4) == 12.8", FUNC(scalb) (0.8L, 4), 12.8L);
1762 check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb) (-0.854375L, 5), -27.34L);
1771 check ("scalbn (0, 0) == 0", FUNC(scalbn) (0, 0), 0);
1773 check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn) (plus_infty, 1));
1774 check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn) (minus_infty, 1));
1775 check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn) (nan_value, 1));
1777 check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn) (0.8L, 4), 12.8L);
1778 check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn) (-0.854375L, 5), -27.34L);
1780 x = random_greater (0.0);
1781 check_ext ("scalbn (x, 0) == x", FUNC(scalbn) (x, 0L), x, x);
1788 check ("sin (+0) == +0", FUNC(sin) (0), 0);
1789 check ("sin (-0) == -0", FUNC(sin) (minus_zero), minus_zero);
1790 check_isnan_exc ("sin (+inf) == NaN plus invalid exception",
1791 FUNC(sin) (plus_infty),
1793 check_isnan_exc ("sin (-inf) == NaN plus invalid exception",
1794 FUNC(sin) (minus_infty),
1797 check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6l),
1798 0.5, CHOOSE (4e-18L, 0, 0));
1799 check_eps ("sin (-pi/6) == -0.5", FUNC(sin) (-M_PI_6l),
1800 -0.5, CHOOSE (4e-18L, 0, 0));
1801 check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2l), 1);
1802 check ("sin (-pi/2) == -1", FUNC(sin) (-M_PI_2l), -1);
1803 check_eps ("sin (0.7) == 0.6442176872...", FUNC(sin) (0.7),
1804 0.64421768723769105367L, CHOOSE (4e-17L, 0, 0));
1811 check ("sinh (+0) == +0", FUNC(sinh) (0), 0);
1814 check ("sinh (-0) == -0", FUNC(sinh) (minus_zero), minus_zero);
1816 check_isinfp ("sinh (+inf) == +inf", FUNC(sinh) (plus_infty));
1817 check_isinfn ("sinh (-inf) == -inf", FUNC(sinh) (minus_infty));
1820 check_eps ("sinh (0.7) == 0.7585837018...", FUNC(sinh) (0.7),
1821 0.75858370183953350346L, CHOOSE (6e-17L, 2e-16, 6e-8));
1828 MATHTYPE sin_res, cos_res;
1831 FUNC(sincos) (0, &sin_res, &cos_res);
1833 check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res, 0);
1835 check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res, 1);
1837 FUNC(sincos) (minus_zero, &sin_res, &cos_res);
1839 check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res, minus_zero);
1841 check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res, 1);
1843 FUNC(sincos) (plus_infty, &sin_res, &cos_res);
1845 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
1846 sin_res, INVALID_EXCEPTION);
1848 check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
1849 cos_res, INVALID_EXCEPTION);
1851 FUNC(sincos) (minus_infty, &sin_res, &cos_res);
1853 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
1854 sin_res, INVALID_EXCEPTION);
1856 check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
1857 cos_res, INVALID_EXCEPTION);
1859 FUNC(sincos) (M_PI_2l, &sin_res, &cos_res);
1861 check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res, 1);
1863 check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
1864 CHOOSE (1e-18L, 1e-16, 1e-7));
1866 FUNC(sincos) (M_PI_6l, &sin_res, &cos_res);
1867 check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5,
1868 CHOOSE (5e-18L, 0, 0));
1870 FUNC(sincos) (M_PI_6l*2.0, &sin_res, &cos_res);
1871 check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
1872 CHOOSE (5e-18L, 1e-15, 1e-7));
1874 FUNC(sincos) (0.7, &sin_res, &cos_res);
1875 check_eps ("sincos (0.7, &sin, &cos) puts 0.6442176872... in sin", sin_res,
1876 0.64421768723769105367L, CHOOSE (4e-17L, 0, 0));
1877 check_eps ("sincos (0.7, &sin, &cos) puts 0.7648421872... in cos", cos_res,
1878 0.76484218728448842626L, CHOOSE (3e-17L, 2e-16, 6e-8));
1885 check ("tan (+0) == +0", FUNC(tan) (0), 0);
1886 check ("tan (-0) == -0", FUNC(tan) (minus_zero), minus_zero);
1887 check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
1888 FUNC(tan) (plus_infty), INVALID_EXCEPTION);
1889 check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
1890 FUNC(tan) (minus_infty), INVALID_EXCEPTION);
1892 check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4l), 1,
1893 CHOOSE (2e-18L, 1e-15L, 2e-7));
1894 check_eps ("tan (0.7) == 0.8422883804...", FUNC(tan) (0.7),
1895 0.84228838046307944813L, CHOOSE (8e-17L, 0, 0));
1902 check ("tanh (+0) == +0", FUNC(tanh) (0), 0);
1904 check ("tanh (-0) == -0", FUNC(tanh) (minus_zero), minus_zero);
1906 check ("tanh (+inf) == +1", FUNC(tanh) (plus_infty), 1);
1907 check ("tanh (-inf) == -1", FUNC(tanh) (minus_infty), -1);
1909 check_eps ("tanh (0.7) == 0.6043677771...", FUNC(tanh) (0.7),
1910 0.60436777711716349631L, CHOOSE (3e-17L, 2e-16, 6e-8));
1917 check ("fabs (+0) == +0", FUNC(fabs) (0), 0);
1918 check ("fabs (-0) == +0", FUNC(fabs) (minus_zero), 0);
1920 check_isinfp ("fabs (+inf) == +inf", FUNC(fabs) (plus_infty));
1921 check_isinfp ("fabs (-inf) == +inf", FUNC(fabs) (minus_infty));
1923 check ("fabs (+38) == 38", FUNC(fabs) (38.0), 38.0);
1924 check ("fabs (-e) == e", FUNC(fabs) (-M_El), M_El);
1931 check ("floor (+0) == +0", FUNC(floor) (0.0), 0.0);
1932 check ("floor (-0) == -0", FUNC(floor) (minus_zero), minus_zero);
1933 check_isinfp ("floor (+inf) == +inf", FUNC(floor) (plus_infty));
1934 check_isinfn ("floor (-inf) == -inf", FUNC(floor) (minus_infty));
1936 check ("floor (pi) == 3", FUNC(floor) (M_PIl), 3.0);
1937 check ("floor (-pi) == -4", FUNC(floor) (-M_PIl), -4.0);
1946 a = random_greater (0);
1947 check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot) (plus_infty, a), a);
1948 check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot) (minus_infty, a), a);
1951 check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot) (plus_infty, nan_value));
1952 check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
1955 check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot) (nan_value, nan_value));
1957 a = FUNC(hypot) (12.4L, 0.7L);
1958 check ("hypot (x,y) == hypot (y,x)", FUNC(hypot) (0.7L, 12.4L), a);
1959 check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot) (-12.4L, 0.7L), a);
1960 check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot) (-0.7L, 12.4L), a);
1961 check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot) (-12.4L, -0.7L), a);
1962 check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot) (-0.7L, -12.4L), a);
1963 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-0.7L, 0), 0.7L);
1964 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (0.7L, 0), 0.7L);
1965 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-1.0L, 0), 1.0L);
1966 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (1.0L, 0), 1.0L);
1967 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
1968 check ("hypot (x,0) == fabs (x)", FUNC(hypot) (5.7e7L, 0), 5.7e7L);
1970 check_eps ("hypot (0.7,1.2) == 1.38924...", FUNC(hypot) (0.7, 1.2),
1971 1.3892443989449804508L, CHOOSE (7e-17L, 3e-16, 0));
1980 check ("pow (+0, +0) == 1", FUNC(pow) (0, 0), 1);
1981 check ("pow (+0, -0) == 1", FUNC(pow) (0, minus_zero), 1);
1982 check ("pow (-0, +0) == 1", FUNC(pow) (minus_zero, 0), 1);
1983 check ("pow (-0, -0) == 1", FUNC(pow) (minus_zero, minus_zero), 1);
1985 check ("pow (+10, +0) == 1", FUNC(pow) (10, 0), 1);
1986 check ("pow (+10, -0) == 1", FUNC(pow) (10, minus_zero), 1);
1987 check ("pow (-10, +0) == 1", FUNC(pow) (-10, 0), 1);
1988 check ("pow (-10, -0) == 1", FUNC(pow) (-10, minus_zero), 1);
1990 check ("pow (NaN, +0) == 1", FUNC(pow) (nan_value, 0), 1);
1991 check ("pow (NaN, -0) == 1", FUNC(pow) (nan_value, minus_zero), 1);
1994 check_isinfp ("pow (+1.1, +inf) == +inf", FUNC(pow) (1.1, plus_infty));
1995 check_isinfp ("pow (+inf, +inf) == +inf", FUNC(pow) (plus_infty, plus_infty));
1996 check_isinfp ("pow (-1.1, +inf) == +inf", FUNC(pow) (-1.1, plus_infty));
1997 check_isinfp ("pow (-inf, +inf) == +inf", FUNC(pow) (minus_infty, plus_infty));
1999 check ("pow (0.9, +inf) == +0", FUNC(pow) (0.9L, plus_infty), 0);
2000 check ("pow (1e-7, +inf) == +0", FUNC(pow) (1e-7L, plus_infty), 0);
2001 check ("pow (-0.9, +inf) == +0", FUNC(pow) (-0.9L, plus_infty), 0);
2002 check ("pow (-1e-7, +inf) == +0", FUNC(pow) (-1e-7L, plus_infty), 0);
2004 check ("pow (+1.1, -inf) == 0", FUNC(pow) (1.1, minus_infty), 0);
2005 check ("pow (+inf, -inf) == 0", FUNC(pow) (plus_infty, minus_infty), 0);
2006 check ("pow (-1.1, -inf) == 0", FUNC(pow) (-1.1, minus_infty), 0);
2007 check ("pow (-inf, -inf) == 0", FUNC(pow) (minus_infty, minus_infty), 0);
2009 check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow) (0.9L, minus_infty));
2010 check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow) (1e-7L, minus_infty));
2011 check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow) (-0.9L, minus_infty));
2012 check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow) (-1e-7L, minus_infty));
2014 check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow) (plus_infty, 1e-7L));
2015 check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow) (plus_infty, 1));
2016 check_isinfp ("pow (+inf, 1e7) == +inf", FUNC(pow) (plus_infty, 1e7L));
2018 check ("pow (+inf, -1e-7) == 0", FUNC(pow) (plus_infty, -1e-7L), 0);
2019 check ("pow (+inf, -1) == 0", FUNC(pow) (plus_infty, -1), 0);
2020 check ("pow (+inf, -1e7) == 0", FUNC(pow) (plus_infty, -1e7L), 0);
2022 check_isinfn ("pow (-inf, 1) == -inf", FUNC(pow) (minus_infty, 1));
2023 check_isinfn ("pow (-inf, 11) == -inf", FUNC(pow) (minus_infty, 11));
2024 check_isinfn ("pow (-inf, 1001) == -inf", FUNC(pow) (minus_infty, 1001));
2026 check_isinfp ("pow (-inf, 2) == +inf", FUNC(pow) (minus_infty, 2));
2027 check_isinfp ("pow (-inf, 12) == +inf", FUNC(pow) (minus_infty, 12));
2028 check_isinfp ("pow (-inf, 1002) == +inf", FUNC(pow) (minus_infty, 1002));
2029 check_isinfp ("pow (-inf, 0.1) == +inf", FUNC(pow) (minus_infty, 0.1));
2030 check_isinfp ("pow (-inf, 1.1) == +inf", FUNC(pow) (minus_infty, 1.1));
2031 check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow) (minus_infty, 11.1));
2032 check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow) (minus_infty, 1001.1));
2034 check ("pow (-inf, -1) == -0", FUNC(pow) (minus_infty, -1), minus_zero);
2035 check ("pow (-inf, -11) == -0", FUNC(pow) (minus_infty, -11), minus_zero);
2036 check ("pow (-inf, -1001) == -0", FUNC(pow) (minus_infty, -1001), minus_zero);
2038 check ("pow (-inf, -2) == +0", FUNC(pow) (minus_infty, -2), 0);
2039 check ("pow (-inf, -12) == +0", FUNC(pow) (minus_infty, -12), 0);
2040 check ("pow (-inf, -1002) == +0", FUNC(pow) (minus_infty, -1002), 0);
2041 check ("pow (-inf, -0.1) == +0", FUNC(pow) (minus_infty, -0.1), 0);
2042 check ("pow (-inf, -1.1) == +0", FUNC(pow) (minus_infty, -1.1), 0);
2043 check ("pow (-inf, -11.1) == +0", FUNC(pow) (minus_infty, -11.1), 0);
2044 check ("pow (-inf, -1001.1) == +0", FUNC(pow) (minus_infty, -1001.1), 0);
2046 check_isnan ("pow (NaN, NaN) == NaN", FUNC(pow) (nan_value, nan_value));
2047 check_isnan ("pow (0, NaN) == NaN", FUNC(pow) (0, nan_value));
2048 check_isnan ("pow (1, NaN) == NaN", FUNC(pow) (1, nan_value));
2049 check_isnan ("pow (-1, NaN) == NaN", FUNC(pow) (-1, nan_value));
2050 check_isnan ("pow (NaN, 1) == NaN", FUNC(pow) (nan_value, 1));
2051 check_isnan ("pow (NaN, -1) == NaN", FUNC(pow) (nan_value, -1));
2053 x = random_greater (0.0);
2054 check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow) (x, nan_value), x);
2056 check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception",
2057 FUNC(pow) (1, plus_infty), INVALID_EXCEPTION);
2058 check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception",
2059 FUNC(pow) (-1, plus_infty), INVALID_EXCEPTION);
2060 check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception",
2061 FUNC(pow) (1, minus_infty), INVALID_EXCEPTION);
2062 check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception",
2063 FUNC(pow) (-1, minus_infty), INVALID_EXCEPTION);
2065 check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception",
2066 FUNC(pow) (-0.1, 1.1), INVALID_EXCEPTION);
2067 check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception",
2068 FUNC(pow) (-0.1, -1.1), INVALID_EXCEPTION);
2069 check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception",
2070 FUNC(pow) (-10.1, 1.1), INVALID_EXCEPTION);
2071 check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception",
2072 FUNC(pow) (-10.1, -1.1), INVALID_EXCEPTION);
2074 check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception",
2075 FUNC(pow) (0, -1), DIVIDE_BY_ZERO_EXCEPTION);
2076 check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception",
2077 FUNC(pow) (0, -11), DIVIDE_BY_ZERO_EXCEPTION);
2078 check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception",
2079 FUNC(pow) (minus_zero, -1), DIVIDE_BY_ZERO_EXCEPTION);
2080 check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception",
2081 FUNC(pow) (minus_zero, -11), DIVIDE_BY_ZERO_EXCEPTION);
2083 check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception",
2084 FUNC(pow) (0, -2), DIVIDE_BY_ZERO_EXCEPTION);
2085 check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception",
2086 FUNC(pow) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
2087 check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception",
2088 FUNC(pow) (minus_zero, -2), DIVIDE_BY_ZERO_EXCEPTION);
2089 check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception",
2090 FUNC(pow) (minus_zero, -11.1), DIVIDE_BY_ZERO_EXCEPTION);
2093 check ("pow (+0, 1) == +0", FUNC(pow) (0, 1), 0);
2094 check ("pow (+0, 11) == +0", FUNC(pow) (0, 11), 0);
2096 check ("pow (-0, 1) == -0", FUNC(pow) (minus_zero, 1), minus_zero);
2097 check ("pow (-0, 11) == -0", FUNC(pow) (minus_zero, 11), minus_zero);
2100 check ("pow (+0, 2) == +0", FUNC(pow) (0, 2), 0);
2101 check ("pow (+0, 11.1) == +0", FUNC(pow) (0, 11.1), 0);
2104 check ("pow (-0, 2) == +0", FUNC(pow) (minus_zero, 2), 0);
2105 check ("pow (-0, 11.1) == +0", FUNC(pow) (minus_zero, 11.1), 0);
2107 x = random_greater (1.0);
2108 check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
2109 FUNC(pow) (x, plus_infty), x);
2111 x = random_value (-1.0, 1.0);
2112 check_ext ("pow (x, +inf) == +0 for |x| < 1",
2113 FUNC(pow) (x, plus_infty), 0.0, x);
2115 x = random_greater (1.0);
2116 check_ext ("pow (x, -inf) == +0 for |x| > 1",
2117 FUNC(pow) (x, minus_infty), 0.0, x);
2119 x = random_value (-1.0, 1.0);
2120 check_isinfp_ext ("pow (x, -inf) == +inf for |x| < 1",
2121 FUNC(pow) (x, minus_infty), x);
2123 x = random_greater (0.0);
2124 check_isinfp_ext ("pow (+inf, y) == +inf for y > 0",
2125 FUNC(pow) (plus_infty, x), x);
2127 x = random_less (0.0);
2128 check_ext ("pow (+inf, y) == +0 for y < 0",
2129 FUNC(pow) (plus_infty, x), 0.0, x);
2131 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2132 check_isinfn_ext ("pow (-inf, y) == -inf for y an odd integer > 0",
2133 FUNC(pow) (minus_infty, x), x);
2135 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2136 check_isinfp_ext ("pow (-inf, y) == +inf for y > 0 and not an odd integer",
2137 FUNC(pow) (minus_infty, x), x);
2139 x = -((rand () % 1000000) * 2.0 + 1); /* Get random odd integer < 0 */
2140 check_ext ("pow (-inf, y) == -0 for y an odd integer < 0",
2141 FUNC(pow) (minus_infty, x), minus_zero, x);
2143 x = ((rand () % 1000000) + 1) * -2.0; /* Get random even integer < 0 */
2144 check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
2145 FUNC(pow) (minus_infty, x), 0.0, x);
2148 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2149 check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
2150 FUNC(pow) (0.0, x), 0.0, x);
2152 x = (rand () % 1000000) * 2.0 + 1; /* Get random odd integer > 0 */
2153 check_ext ("pow (-0, y) == -0 for y an odd integer > 0",
2154 FUNC(pow) (minus_zero, x), minus_zero, x);
2157 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2158 check_ext ("pow (+0, y) == +0 for y > 0 and not an odd integer",
2159 FUNC(pow) (0.0, x), 0.0, x);
2161 x = ((rand () % 1000000) + 1) * 2.0; /* Get random even integer > 1 */
2162 check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
2163 FUNC(pow) (minus_zero, x), 0.0, x);
2165 check_eps ("pow (0.7, 1.2) == 0.65180...", FUNC(pow) (0.7, 1.2),
2166 0.65180494056638638188L, CHOOSE (4e-17L, 0, 0));
2169 check ("pow (-7.49321e+133, -9.80818e+16) == 0",
2170 FUNC(pow) (-7.49321e+133, -9.80818e+16), 0);
2178 check ("fdim (+0, +0) = +0", FUNC(fdim) (0, 0), 0);
2179 check ("fdim (9, 0) = 9", FUNC(fdim) (9, 0), 9);
2180 check ("fdim (0, 9) = 0", FUNC(fdim) (0, 9), 0);
2181 check ("fdim (-9, 0) = 9", FUNC(fdim) (-9, 0), 0);
2182 check ("fdim (0, -9) = 9", FUNC(fdim) (0, -9), 9);
2184 check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim) (plus_infty, 9));
2185 check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim) (plus_infty, -9));
2186 check ("fdim (-inf, 9) = 0", FUNC(fdim) (minus_infty, 9), 0);
2187 check ("fdim (-inf, -9) = 0", FUNC(fdim) (minus_infty, -9), 0);
2188 check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim) (9, minus_infty));
2189 check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim) (-9, minus_infty));
2190 check ("fdim (9, inf) = 0", FUNC(fdim) (9, plus_infty), 0);
2191 check ("fdim (-9, inf) = 0", FUNC(fdim) (-9, plus_infty), 0);
2193 check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim) (0, nan_value));
2194 check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim) (9, nan_value));
2195 check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim) (-9, nan_value));
2196 check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim) (nan_value, 9));
2197 check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim) (nan_value, -9));
2198 check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim) (plus_infty, nan_value));
2199 check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim) (minus_infty, nan_value));
2200 check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim) (nan_value, plus_infty));
2201 check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim) (nan_value, minus_infty));
2202 check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim) (nan_value, nan_value));
2209 check ("fmin (+0, +0) = +0", FUNC(fmin) (0, 0), 0);
2210 check ("fmin (9, 0) = 0", FUNC(fmin) (9, 0), 0);
2211 check ("fmin (0, 9) = 0", FUNC(fmin) (0, 9), 0);
2212 check ("fmin (-9, 0) = -9", FUNC(fmin) (-9, 0), -9);
2213 check ("fmin (0, -9) = -9", FUNC(fmin) (0, -9), -9);
2215 check ("fmin (+inf, 9) = 9", FUNC(fmin) (plus_infty, 9), 9);
2216 check ("fmin (9, +inf) = 9", FUNC(fmin) (9, plus_infty), 9);
2217 check ("fmin (+inf, -9) = -9", FUNC(fmin) (plus_infty, -9), -9);
2218 check ("fmin (-9, +inf) = -9", FUNC(fmin) (-9, plus_infty), -9);
2219 check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin) (minus_infty, 9));
2220 check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin) (minus_infty, -9));
2221 check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin) (9, minus_infty));
2222 check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin) (-9, minus_infty));
2224 check ("fmin (0, NaN) = 0", FUNC(fmin) (0, nan_value), 0);
2225 check ("fmin (9, NaN) = 9", FUNC(fmin) (9, nan_value), 9);
2226 check ("fmin (-9, NaN) = 9", FUNC(fmin) (-9, nan_value), -9);
2227 check ("fmin (NaN, 0) = 0", FUNC(fmin) (nan_value, 0), 0);
2228 check ("fmin (NaN, 9) = NaN", FUNC(fmin) (nan_value, 9), 9);
2229 check ("fmin (NaN, -9) = NaN", FUNC(fmin) (nan_value, -9), -9);
2230 check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin) (plus_infty, nan_value));
2231 check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin) (minus_infty, nan_value));
2232 check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin) (nan_value, plus_infty));
2233 check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin) (nan_value, minus_infty));
2234 check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin) (nan_value, nan_value));
2241 check ("fmax (+0, +0) = +0", FUNC(fmax) (0, 0), 0);
2242 check ("fmax (9, 0) = 9", FUNC(fmax) (9, 0), 9);
2243 check ("fmax (0, 9) = 9", FUNC(fmax) (0, 9), 9);
2244 check ("fmax (-9, 0) = 0", FUNC(fmax) (-9, 0), 0);
2245 check ("fmax (0, -9) = 0", FUNC(fmax) (0, -9), 0);
2247 check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax) (plus_infty, 9));
2248 check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax) (0, plus_infty));
2249 check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax) (-9, plus_infty));
2250 check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax) (plus_infty, -9));
2251 check ("fmax (-inf, 9) = 9", FUNC(fmax) (minus_infty, 9), 9);
2252 check ("fmax (-inf, -9) = -9", FUNC(fmax) (minus_infty, -9), -9);
2253 check ("fmax (+9, -inf) = 9", FUNC(fmax) (9, minus_infty), 9);
2254 check ("fmax (-9, -inf) = -9", FUNC(fmax) (-9, minus_infty), -9);
2256 check ("fmax (0, NaN) = 0", FUNC(fmax) (0, nan_value), 0);
2257 check ("fmax (9, NaN) = 9", FUNC(fmax) (9, nan_value), 9);
2258 check ("fmax (-9, NaN) = 9", FUNC(fmax) (-9, nan_value), -9);
2259 check ("fmax (NaN, 0) = 0", FUNC(fmax) (nan_value, 0), 0);
2260 check ("fmax (NaN, 9) = NaN", FUNC(fmax) (nan_value, 9), 9);
2261 check ("fmax (NaN, -9) = NaN", FUNC(fmax) (nan_value, -9), -9);
2262 check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax) (plus_infty, nan_value));
2263 check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax) (minus_infty, nan_value));
2264 check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax) (nan_value, plus_infty));
2265 check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax) (nan_value, minus_infty));
2266 check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax) (nan_value, nan_value));
2275 x = random_greater (0);
2276 check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod) (0, x), 0, x);
2278 x = random_greater (0);
2279 check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod) (minus_zero, x),
2282 check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
2283 FUNC(fmod) (plus_infty, x), INVALID_EXCEPTION, x);
2284 check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
2285 FUNC(fmod) (minus_infty, x), INVALID_EXCEPTION, x);
2286 check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
2287 FUNC(fmod) (x, 0), INVALID_EXCEPTION, x);
2288 check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
2289 FUNC(fmod) (x, minus_zero), INVALID_EXCEPTION, x);
2291 x = random_greater (0);
2292 check_ext ("fmod (x, +inf) == x for x not infinite",
2293 FUNC(fmod) (x, plus_infty), x, x);
2294 x = random_greater (0);
2295 check_ext ("fmod (x, -inf) == x for x not infinite",
2296 FUNC(fmod) (x, minus_infty), x, x);
2298 check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod) (6.5, 2.3), 1.9,
2299 CHOOSE (5e-16, 1e-15, 2e-7));
2300 check_eps ("fmod (-6.5, 2.3) == -1.9", FUNC(fmod) (-6.5, 2.3), -1.9,
2301 CHOOSE (5e-16, 1e-15, 2e-7));
2302 check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod) (6.5, -2.3), 1.9,
2303 CHOOSE (5e-16, 1e-15, 2e-7));
2304 check_eps ("fmod (-6.5, -2.3) == -1.9", FUNC(fmod) (-6.5, -2.3), -1.9,
2305 CHOOSE (5e-16, 1e-15, 2e-7));
2310 nextafter_test (void)
2314 check ("nextafter (+0, +0) = +0", FUNC(nextafter) (0, 0), 0);
2315 check ("nextafter (-0, +0) = +0", FUNC(nextafter) (minus_zero, 0), 0);
2316 check ("nextafter (+0, -0) = -0", FUNC(nextafter) (0, minus_zero),
2318 check ("nextafter (-0, -0) = -0", FUNC(nextafter) (minus_zero, minus_zero),
2321 check ("nextafter (9, 9) = 9", FUNC(nextafter) (9, 9), 9);
2322 check ("nextafter (-9, -9) = -9", FUNC(nextafter) (-9, -9), -9);
2323 check_isinfp ("nextafter (+inf, +inf) = +inf",
2324 FUNC(nextafter) (plus_infty, plus_infty));
2325 check_isinfn ("nextafter (-inf, -inf) = -inf",
2326 FUNC(nextafter) (minus_infty, minus_infty));
2329 check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter) (nan_value, x));
2330 check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter) (x, nan_value));
2331 check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter) (nan_value,
2334 /* XXX We need the hexadecimal FP number representation here for further
2340 copysign_test (void)
2342 check ("copysign (0, 4) = 0", FUNC(copysign) (0, 4), 0);
2343 check ("copysign (0, -4) = -0", FUNC(copysign) (0, -4), minus_zero);
2344 check ("copysign (-0, 4) = 0", FUNC(copysign) (minus_zero, 4), 0);
2345 check ("copysign (-0, -4) = -0", FUNC(copysign) (minus_zero, -4),
2348 check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign) (plus_infty, 0));
2349 check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign) (plus_infty,
2351 check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign) (minus_infty, 0));
2352 check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign) (minus_infty,
2355 check ("copysign (0, +inf) = 0", FUNC(copysign) (0, plus_infty), 0);
2356 check ("copysign (0, -inf) = -0", FUNC(copysign) (0, minus_zero),
2358 check ("copysign (-0, +inf) = 0", FUNC(copysign) (minus_zero, plus_infty),
2360 check ("copysign (-0, -inf) = -0", FUNC(copysign) (minus_zero, minus_zero),
2363 /* XXX More correctly we would have to check the sign of the NaN. */
2364 check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign) (nan_value, 0));
2365 check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign) (nan_value,
2367 check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign) (-nan_value, 0));
2368 check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign) (-nan_value,
2376 check ("trunc(0) = 0", FUNC(trunc) (0), 0);
2377 check ("trunc(-0) = -0", FUNC(trunc) (minus_zero), minus_zero);
2378 check ("trunc(0.625) = 0", FUNC(trunc) (0.625), 0);
2379 check ("trunc(-0.625) = -0", FUNC(trunc) (-0.625), minus_zero);
2380 check ("trunc(1) = 1", FUNC(trunc) (1), 1);
2381 check ("trunc(-1) = -1", FUNC(trunc) (-1), -1);
2382 check ("trunc(1.625) = 1", FUNC(trunc) (1.625), 1);
2383 check ("trunc(-1.625) = -1", FUNC(trunc) (-1.625), -1);
2385 check ("trunc(1048580.625) = 1048580", FUNC(trunc) (1048580.625L),
2387 check ("trunc(-1048580.625) = -1048580", FUNC(trunc) (-1048580.625L),
2390 check ("trunc(8388610.125) = 8388610", FUNC(trunc) (8388610.125L),
2392 check ("trunc(-8388610.125) = -8388610", FUNC(trunc) (-8388610.125L),
2395 check ("trunc(4294967296.625) = 4294967296", FUNC(trunc) (4294967296.625L),
2397 check ("trunc(-4294967296.625) = -4294967296",
2398 FUNC(trunc) (-4294967296.625L), -4294967296.0L);
2400 check_isinfp ("trunc(+inf) = +inf", FUNC(trunc) (plus_infty));
2401 check_isinfn ("trunc(-inf) = -inf", FUNC(trunc) (minus_infty));
2402 check_isnan ("trunc(NaN) = NaN", FUNC(trunc) (nan_value));
2412 /* XXX Tests fuer negative x are missing */
2413 check ("sqrt (0) == 0", FUNC(sqrt) (0), 0);
2414 check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt) (nan_value));
2415 check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt) (plus_infty));
2417 check ("sqrt (-0) == -0", FUNC(sqrt) (0), 0);
2419 x = random_less (0.0);
2420 check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
2421 FUNC(sqrt) (x), INVALID_EXCEPTION, x);
2423 x = random_value (0, 10000);
2424 check_ext ("sqrt (x*x) == x", FUNC(sqrt) (x*x), x, x);
2425 check ("sqrt (4) == 2", FUNC(sqrt) (4), 2);
2426 check ("sqrt (2) == 1.14142...", FUNC(sqrt) (2), M_SQRT2l);
2427 check ("sqrt (0.25) == 0.5", FUNC(sqrt) (0.25), 0.5);
2428 check ("sqrt (6642.25) == 81.5", FUNC(sqrt) (6642.25), 81.5);
2429 check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt) (15239.903), 123.45,
2430 CHOOSE (3e-6L, 3e-6, 8e-6));
2431 check_eps ("sqrt (0.7) == 0.8366600265", FUNC(sqrt) (0.7),
2432 0.83666002653407554798L, CHOOSE (3e-17L, 0, 0));
2437 remainder_test (void)
2441 result = FUNC(remainder) (1, 0);
2442 check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
2443 result, INVALID_EXCEPTION);
2445 result = FUNC(remainder) (1, minus_zero);
2446 check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
2447 result, INVALID_EXCEPTION);
2449 result = FUNC(remainder) (plus_infty, 1);
2450 check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
2451 result, INVALID_EXCEPTION);
2453 result = FUNC(remainder) (minus_infty, 1);
2454 check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
2455 result, INVALID_EXCEPTION);
2457 result = FUNC(remainder) (1.625, 1.0);
2458 check ("remainder(1.625, 1.0) == -0.375", result, -0.375);
2460 result = FUNC(remainder) (-1.625, 1.0);
2461 check ("remainder(-1.625, 1.0) == 0.375", result, 0.375);
2463 result = FUNC(remainder) (1.625, -1.0);
2464 check ("remainder(1.625, -1.0) == -0.375", result, -0.375);
2466 result = FUNC(remainder) (-1.625, -1.0);
2467 check ("remainder(-1.625, -1.0) == 0.375", result, 0.375);
2469 result = FUNC(remainder) (5.0, 2.0);
2470 check ("remainder(5.0, 2.0) == 1.0", result, 1.0);
2472 result = FUNC(remainder) (3.0, 2.0);
2473 check ("remainder(3.0, 2.0) == -1.0", result, -1.0);
2483 result = FUNC(remquo) (1, 0, &quo);
2484 check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
2485 result, INVALID_EXCEPTION);
2487 result = FUNC(remquo) (1, minus_zero, &quo);
2488 check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
2489 result, INVALID_EXCEPTION);
2491 result = FUNC(remquo) (plus_infty, 1, &quo);
2492 check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
2493 result, INVALID_EXCEPTION);
2495 result = FUNC(remquo) (minus_infty, 1, &quo);
2496 check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
2497 result, INVALID_EXCEPTION);
2499 result = FUNC(remquo) (1.625, 1.0, &quo);
2500 check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
2501 check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo, 2);
2503 result = FUNC(remquo) (-1.625, 1.0, &quo);
2504 check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
2505 check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo, -2);
2507 result = FUNC(remquo) (1.625, -1.0, &quo);
2508 check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
2509 check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo, -2);
2511 result = FUNC(remquo) (-1.625, -1.0, &quo);
2512 check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
2513 check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo, 2);
2515 result = FUNC(remquo) (5.0, 2.0, &quo);
2516 check ("remquo(5.0, 2.0, &x) == 1.0", result, 1.0);
2517 check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo, 2);
2519 result = FUNC(remquo) (3.0, 2.0, &quo);
2520 check ("remquo(3.0, 2.0, &x) == -1.0", result, -1.0);
2521 check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo, 2);
2528 __complex__ MATHTYPE result;
2530 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, plus_zero));
2531 check ("real(cexp(0 + 0i)) = 1", __real__ result, 1);
2532 check ("imag(cexp(0 + 0i)) = 0", __imag__ result, 0);
2533 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_zero));
2534 check ("real(cexp(-0 + 0i)) = 1", __real__ result, 1);
2535 check ("imag(cexp(-0 + 0i)) = 0", __imag__ result, 0);
2536 result = FUNC(cexp) (BUILD_COMPLEX (plus_zero, minus_zero));
2537 check ("real(cexp(0 - 0i)) = 1", __real__ result, 1);
2538 check ("imag(cexp(0 - 0i)) = -0", __imag__ result, minus_zero);
2539 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_zero));
2540 check ("real(cexp(-0 - 0i)) = 1", __real__ result, 1);
2541 check ("imag(cexp(-0 - 0i)) = -0", __imag__ result, minus_zero);
2543 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_zero));
2544 check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result);
2545 check ("imag(cexp(+inf + 0i)) = 0", __imag__ result, 0);
2546 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_zero));
2547 check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result);
2548 check ("imag(cexp(+inf - 0i)) = -0", __imag__ result, minus_zero);
2550 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_zero));
2551 check ("real(cexp(-inf + 0i)) = 0", __real__ result, 0);
2552 check ("imag(cexp(-inf + 0i)) = 0", __imag__ result, 0);
2553 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_zero));
2554 check ("real(cexp(-inf - 0i)) = 0", __real__ result, 0);
2555 check ("imag(cexp(-inf - 0i)) = -0", __imag__ result, minus_zero);
2558 result = FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty));
2559 check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
2560 __real__ result, INVALID_EXCEPTION);
2561 check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
2564 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty));
2565 check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
2566 __real__ result, INVALID_EXCEPTION);
2567 check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
2569 result = FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty));
2570 check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
2571 __real__ result, INVALID_EXCEPTION);
2572 check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
2574 result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty));
2575 check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
2576 __real__ result, INVALID_EXCEPTION);
2577 check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
2580 result = FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty));
2581 check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
2582 __real__ result, INVALID_EXCEPTION);
2583 check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
2585 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty));
2586 check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2587 __real__ result, INVALID_EXCEPTION);
2588 check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
2590 result = FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty));
2591 check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
2592 __real__ result, INVALID_EXCEPTION);
2593 check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
2595 result = FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty));
2596 check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
2597 __real__ result, INVALID_EXCEPTION);
2598 check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result);
2600 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 2.0));
2601 check ("real(cexp(-inf + 2.0i)) = -0", __real__ result, minus_zero);
2602 check ("imag(cexp(-inf + 2.0i)) = 0", __imag__ result, 0);
2603 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 4.0));
2604 check ("real(cexp(-inf + 4.0i)) = -0", __real__ result, minus_zero);
2605 check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result, minus_zero);
2607 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 2.0));
2608 check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result);
2609 check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result);
2610 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 4.0));
2611 check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result);
2612 check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result);
2614 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty));
2615 check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
2616 __real__ result, INVALID_EXCEPTION);
2617 check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
2619 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_infty));
2620 check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
2621 __real__ result, INVALID_EXCEPTION);
2622 check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
2625 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_infty));
2626 check ("real(cexp(-inf + i inf)) = 0", __real__ result, 0);
2627 check ("imag(cexp(-inf + i inf)) = 0", __imag__ result, 0);
2628 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_infty));
2629 check ("real(cexp(-inf - i inf)) = 0", __real__ result, 0);
2630 check ("imag(cexp(-inf - i inf)) = -0", __imag__ result, minus_zero);
2632 result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, nan_value));
2633 check ("real(cexp(-inf + i NaN)) = 0", __real__ result, 0);
2634 check ("imag(cexp(-inf + i NaN)) = 0", fabs (__imag__ result), 0);
2636 result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, nan_value));
2637 check_isinfp ("real(cexp(+inf + i NaN)) = +inf", __real__ result);
2638 check_isnan ("imag(cexp(+inf + i NaN)) = NaN", __imag__ result);
2640 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 0.0));
2641 check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2642 __real__ result, INVALID_EXCEPTION);
2643 check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
2645 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
2646 check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2647 __real__ result, INVALID_EXCEPTION);
2648 check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
2650 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
2651 check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2652 __real__ result, INVALID_EXCEPTION);
2653 check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
2656 result = FUNC(cexp) (BUILD_COMPLEX (0, nan_value));
2657 check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2658 __real__ result, INVALID_EXCEPTION);
2659 check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
2661 result = FUNC(cexp) (BUILD_COMPLEX (1, nan_value));
2662 check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2663 __real__ result, INVALID_EXCEPTION);
2664 check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
2667 result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
2668 check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
2669 check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
2671 result = FUNC(cexp) (BUILD_COMPLEX (0.7, 1.2));
2672 check_eps ("real(cexp(0.7 + i 1.2)) == 0.72969...", __real__ result,
2673 0.7296989091503236012L, CHOOSE (6e-17L, 2e-16, 2e-7));
2674 check_eps ("imag(cexp(0.7 + i 1.2)) == 1.87689...", __imag__ result,
2675 1.8768962328348102821L, CHOOSE (2e-16L, 2.5e-16, 3e-7));
2677 result = FUNC(cexp) (BUILD_COMPLEX (-2, -3));
2678 check_eps ("real(cexp(-2 - i 3)) == -0.13398...", __real__ result,
2679 -0.1339809149295426134L, CHOOSE (6.8e-20L, 0, 2e-8));
2680 check_eps ("imag(cexp(-2 - i 3)) == -0.01909...", __imag__ result,
2681 -0.0190985162611351964L, CHOOSE (4e-20L, 0, 2e-9));
2688 __complex__ MATHTYPE result;
2690 result = FUNC(csin) (BUILD_COMPLEX (0.0, 0.0));
2691 check ("real(csin(0 + 0i)) = 0", __real__ result, 0);
2692 check ("imag(csin(0 + 0i)) = 0", __imag__ result, 0);
2693 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, 0.0));
2694 check ("real(csin(-0 + 0i)) = -0", __real__ result, minus_zero);
2695 check ("imag(csin(-0 + 0i)) = 0", __imag__ result, 0);
2696 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_zero));
2697 check ("real(csin(0 - 0i)) = 0", __real__ result, 0);
2698 check ("imag(csin(0 - 0i)) = -0", __imag__ result, minus_zero);
2699 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_zero));
2700 check ("real(csin(-0 - 0i)) = -0", __real__ result, minus_zero);
2701 check ("imag(csin(-0 - 0i)) = -0", __imag__ result, minus_zero);
2703 result = FUNC(csin) (BUILD_COMPLEX (0.0, plus_infty));
2704 check ("real(csin(0 + i Inf)) = 0", __real__ result, 0);
2705 check_isinfp ("imag(csin(0 + i Inf)) = +Inf", __imag__ result);
2706 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, plus_infty));
2707 check ("real(csin(-0 + i Inf)) = -0", __real__ result, minus_zero);
2708 check_isinfp ("imag(csin(-0 + i Inf)) = +Inf", __imag__ result);
2709 result = FUNC(csin) (BUILD_COMPLEX (0.0, minus_infty));
2710 check ("real(csin(0 - i Inf)) = 0", __real__ result, 0);
2711 check_isinfn ("imag(csin(0 - i Inf)) = -Inf", __imag__ result);
2712 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_infty));
2713 check ("real(csin(-0 - i Inf)) = -0", __real__ result, minus_zero);
2714 check_isinfn ("imag(csin(-0 - i Inf)) = -Inf", __imag__ result);
2716 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 0.0));
2717 check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
2718 __real__ result, INVALID_EXCEPTION);
2719 check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
2720 FUNC(fabs) (__imag__ result), 0);
2721 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 0.0));
2722 check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
2723 __real__ result, INVALID_EXCEPTION);
2724 check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
2725 FUNC(fabs) (__imag__ result), 0);
2726 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_zero));
2727 check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
2728 __real__ result, INVALID_EXCEPTION);
2729 check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
2730 FUNC(fabs) (__imag__ result), 0.0);
2731 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_zero));
2732 check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
2733 __real__ result, INVALID_EXCEPTION);
2734 check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
2735 FUNC(fabs) (__imag__ result), 0.0);
2737 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, plus_infty));
2738 check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
2739 __real__ result, INVALID_EXCEPTION);
2740 check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
2741 FUNC(fabs) (__imag__ result));
2742 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, plus_infty));
2743 check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
2744 __real__ result, INVALID_EXCEPTION);
2745 check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
2746 FUNC(fabs) (__imag__ result));
2747 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_infty));
2748 check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
2749 __real__ result, INVALID_EXCEPTION);
2750 check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
2751 FUNC(fabs) (__imag__ result));
2752 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_infty));
2753 check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
2754 __real__ result, INVALID_EXCEPTION);
2755 check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
2756 FUNC(fabs) (__imag__ result));
2758 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 6.75));
2759 check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
2760 __real__ result, INVALID_EXCEPTION);
2761 check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
2763 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, -6.75));
2764 check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
2765 __real__ result, INVALID_EXCEPTION);
2766 check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
2768 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 6.75));
2769 check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
2770 __real__ result, INVALID_EXCEPTION);
2771 check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
2773 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, -6.75));
2774 check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
2775 __real__ result, INVALID_EXCEPTION);
2776 check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
2779 result = FUNC(csin) (BUILD_COMPLEX (4.625, plus_infty));
2780 check_isinfn ("real(csin(4.625 + i Inf)) = -Inf", __real__ result);
2781 check_isinfn ("imag(csin(4.625 + i Inf)) = -Inf", __imag__ result);
2782 result = FUNC(csin) (BUILD_COMPLEX (4.625, minus_infty));
2783 check_isinfn ("real(csin(4.625 - i Inf)) = -Inf", __real__ result);
2784 check_isinfp ("imag(csin(4.625 - i Inf)) = +Inf", __imag__ result);
2785 result = FUNC(csin) (BUILD_COMPLEX (-4.625, plus_infty));
2786 check_isinfp ("real(csin(-4.625 + i Inf)) = +Inf", __real__ result);
2787 check_isinfn ("imag(csin(-4.625 + i Inf)) = -Inf", __imag__ result);
2788 result = FUNC(csin) (BUILD_COMPLEX (-4.625, minus_infty));
2789 check_isinfp ("real(csin(-4.625 - i Inf)) = +Inf", __real__ result);
2790 check_isinfp ("imag(csin(-4.625 - i Inf)) = +Inf", __imag__ result);
2792 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 0.0));
2793 check_isnan ("real(csin(NaN + i0)) = NaN", __real__ result);
2794 check ("imag(csin(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2795 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_zero));
2796 check_isnan ("real(csin(NaN - i0)) = NaN", __real__ result);
2797 check ("imag(csin(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
2799 result = FUNC(csin) (BUILD_COMPLEX (nan_value, plus_infty));
2800 check_isnan ("real(csin(NaN + i Inf)) = NaN", __real__ result);
2801 check_isinfp ("imag(csin(NaN + i Inf)) = +-Inf",
2802 FUNC(fabs) (__imag__ result));
2803 result = FUNC(csin) (BUILD_COMPLEX (nan_value, minus_infty));
2804 check_isnan ("real(csin(NaN - i Inf)) = NaN", __real__ result);
2805 check_isinfp ("real(csin(NaN - i Inf)) = +-Inf",
2806 FUNC(fabs) (__imag__ result));
2808 result = FUNC(csin) (BUILD_COMPLEX (nan_value, 9.0));
2809 check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2810 __real__ result, INVALID_EXCEPTION);
2811 check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
2813 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -9.0));
2814 check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2815 __real__ result, INVALID_EXCEPTION);
2816 check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
2819 result = FUNC(csin) (BUILD_COMPLEX (0.0, nan_value));
2820 check ("real(csin(0 + i NaN))", __real__ result, 0.0);
2821 check_isnan ("imag(csin(0 + i NaN)) = NaN", __imag__ result);
2822 result = FUNC(csin) (BUILD_COMPLEX (minus_zero, nan_value));
2823 check ("real(csin(-0 + i NaN)) = -0", __real__ result, minus_zero);
2824 check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result);
2826 result = FUNC(csin) (BUILD_COMPLEX (10.0, nan_value));
2827 check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2828 __real__ result, INVALID_EXCEPTION);
2829 check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
2831 result = FUNC(csin) (BUILD_COMPLEX (nan_value, -10.0));
2832 check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2833 __real__ result, INVALID_EXCEPTION);
2834 check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
2837 result = FUNC(csin) (BUILD_COMPLEX (plus_infty, nan_value));
2838 check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2839 __real__ result, INVALID_EXCEPTION);
2840 check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
2842 result = FUNC(csin) (BUILD_COMPLEX (minus_infty, nan_value));
2843 check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2844 __real__ result, INVALID_EXCEPTION);
2845 check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
2848 result = FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value));
2849 check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result);
2850 check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result);
2852 result = FUNC(csin) (BUILD_COMPLEX (0.7, 1.2));
2853 check_eps ("real(csin(0.7 + i 1.2)) = 1.166456341...", __real__ result,
2854 1.1664563419657581376L, CHOOSE (2e-16L, 0, 0));
2855 check_eps ("imag(csin(0.7 + i 1.2)) = 1.154499724...", __imag__ result,
2856 1.1544997246948547371L, CHOOSE (2e-17L, 0, 2e-7));
2858 result = FUNC(csin) (BUILD_COMPLEX (-2, -3));
2859 check_eps ("real(csin(-2 - i 3)) == -9.15449...", __real__ result,
2860 -9.1544991469114295734L, CHOOSE (4e-18L, 0, 1e-6));
2861 check_eps ("imag(csin(-2 - i 3)) == -4.16890...", __imag__ result,
2862 4.1689069599665643507L, CHOOSE (2e-17L, 0, 5e-7));
2869 __complex__ MATHTYPE result;
2871 result = FUNC(csinh) (BUILD_COMPLEX (0.0, 0.0));
2872 check ("real(csinh(0 + 0i)) = 0", __real__ result, 0);
2873 check ("imag(csinh(0 + 0i)) = 0", __imag__ result, 0);
2874 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, 0.0));
2875 check ("real(csinh(-0 + 0i)) = -0", __real__ result, minus_zero);
2876 check ("imag(csinh(-0 + 0i)) = 0", __imag__ result, 0);
2877 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_zero));
2878 check ("real(csinh(0 - 0i)) = 0", __real__ result, 0);
2879 check ("imag(csinh(0 - 0i)) = -0", __imag__ result, minus_zero);
2880 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_zero));
2881 check ("real(csinh(-0 - 0i)) = -0", __real__ result, minus_zero);
2882 check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero);
2884 result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
2885 check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
2886 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2887 check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
2889 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
2890 check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
2891 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2892 check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
2894 result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
2895 check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
2896 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2897 check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
2899 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
2900 check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
2901 FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
2902 check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
2905 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0));
2906 check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result);
2907 check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result, 0);
2908 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 0.0));
2909 check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result);
2910 check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result, 0);
2911 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_zero));
2912 check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result);
2913 check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
2914 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_zero));
2915 check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result);
2916 check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result, minus_zero);
2918 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty));
2919 check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
2920 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2921 check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
2923 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty));
2924 check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
2925 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2926 check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
2928 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty));
2929 check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
2930 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2931 check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
2933 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
2934 check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
2935 FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
2936 check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
2939 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 4.625));
2940 check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result);
2941 check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result);
2942 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 4.625));
2943 check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result);
2944 check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result);
2945 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, -4.625));
2946 check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result);
2947 check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result);
2948 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, -4.625));
2949 check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result);
2950 check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result);
2952 result = FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty));
2953 check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2954 __real__ result, INVALID_EXCEPTION);
2955 check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
2957 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty));
2958 check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2959 __real__ result, INVALID_EXCEPTION);
2960 check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
2962 result = FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty));
2963 check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2964 __real__ result, INVALID_EXCEPTION);
2965 check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
2967 result = FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty));
2968 check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2969 __real__ result, INVALID_EXCEPTION);
2970 check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
2973 result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value));
2974 check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2975 check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result);
2976 result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value));
2977 check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
2978 check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
2980 result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value));
2981 check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf",
2982 FUNC(fabs) (__real__ result));
2983 check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result);
2984 result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value));
2985 check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
2986 FUNC(fabs) (__real__ result));
2987 check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result);
2989 result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
2990 check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2991 __real__ result, INVALID_EXCEPTION);
2992 check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
2994 result = FUNC(csinh) (BUILD_COMPLEX (-9.0, nan_value));
2995 check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
2996 __real__ result, INVALID_EXCEPTION);
2997 check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3000 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0));
3001 check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result);
3002 check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0);
3003 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero));
3004 check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result);
3005 check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero);
3007 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
3008 check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
3009 __real__ result, INVALID_EXCEPTION);
3010 check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
3012 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0));
3013 check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
3014 __real__ result, INVALID_EXCEPTION);
3015 check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
3018 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty));
3019 check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
3020 __real__ result, INVALID_EXCEPTION);
3021 check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
3023 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty));
3024 check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
3025 __real__ result, INVALID_EXCEPTION);
3026 check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
3029 result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value));
3030 check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result);
3031 check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result);
3033 result = FUNC(csinh) (BUILD_COMPLEX (0.7, 1.2));
3034 check_eps ("real(csinh(0.7 + i 1.2)) = 0.274878686...", __real__ result,
3035 0.27487868678117583582L, CHOOSE (2e-17L, 6e-17, 3e-8));
3036 check_eps ("imag(csinh(0.7 + i 1.2)) = 1.169866572...", __imag__ result,
3037 1.1698665727426565139L, CHOOSE (6e-17L, 0, 2e-7));
3039 result = FUNC(csinh) (BUILD_COMPLEX (-2, -3));
3040 check_eps ("real(csinh(-2 - i 3)) == -3.59056...", __real__ result,
3041 3.5905645899857799520L, CHOOSE (7e-19L, 5e-16, 3e-7));
3042 check_eps ("imag(csinh(-2 - i 3)) == -0.53092...", __imag__ result,
3043 -0.5309210862485198052L, CHOOSE (3e-19L, 2e-16, 6e-8));
3050 __complex__ MATHTYPE result;
3052 result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0));
3053 check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0);
3054 check ("imag(ccos(0 + 0i)) = -0", __imag__ result, minus_zero);
3055 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0));
3056 check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0);
3057 check ("imag(ccos(-0 + 0i)) = 0", __imag__ result, 0.0);
3058 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero));
3059 check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0);
3060 check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0);
3061 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero));
3062 check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0);
3063 check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero);
3065 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
3066 check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
3067 __real__ result, INVALID_EXCEPTION);
3068 check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
3069 FUNC(fabs) (__imag__ result), 0);
3070 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
3071 check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
3072 __real__ result, INVALID_EXCEPTION);
3073 check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
3074 FUNC(fabs) (__imag__ result), 0);
3075 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
3076 check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
3077 __real__ result, INVALID_EXCEPTION);
3078 check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
3079 FUNC(fabs) (__imag__ result), 0);
3080 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
3081 check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
3082 __real__ result, INVALID_EXCEPTION);
3083 check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
3084 FUNC(fabs) (__imag__ result), 0);
3086 result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty));
3087 check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result);
3088 check ("imag(ccos(0 + i Inf)) = -0", __imag__ result, minus_zero);
3089 result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty));
3090 check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result);
3091 check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0);
3092 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty));
3093 check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result);
3094 check ("imag(ccos(-0 + i Inf)) = 0", __imag__ result, 0.0);
3095 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty));
3096 check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result);
3097 check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero);
3099 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
3100 check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
3101 __real__ result, INVALID_EXCEPTION);
3102 check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
3104 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
3105 check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
3106 __real__ result, INVALID_EXCEPTION);
3107 check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
3109 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
3110 check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
3111 __real__ result, INVALID_EXCEPTION);
3112 check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
3114 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
3115 check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
3116 __real__ result, INVALID_EXCEPTION);
3117 check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
3120 result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty));
3121 check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result);
3122 check_isinfp ("imag(ccos(4.625 + i Inf)) = +Inf", __imag__ result);
3123 result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty));
3124 check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result);
3125 check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result);
3126 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty));
3127 check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result);
3128 check_isinfn ("imag(ccos(-4.625 + i Inf)) = -Inf", __imag__ result);
3129 result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty));
3130 check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result);
3131 check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result);
3133 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
3134 check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3135 __real__ result, INVALID_EXCEPTION);
3136 check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
3138 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
3139 check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3140 __real__ result, INVALID_EXCEPTION);
3141 check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
3143 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
3144 check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3145 __real__ result, INVALID_EXCEPTION);
3146 check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
3148 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
3149 check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3150 __real__ result, INVALID_EXCEPTION);
3151 check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
3154 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0));
3155 check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result);
3156 check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3157 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero));
3158 check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result);
3159 check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
3161 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty));
3162 check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result);
3163 check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result);
3164 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty));
3165 check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result);
3166 check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result);
3168 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
3169 check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3170 __real__ result, INVALID_EXCEPTION);
3171 check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
3173 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
3174 check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3175 __real__ result, INVALID_EXCEPTION);
3176 check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
3179 result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value));
3180 check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result);
3181 check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3182 result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value));
3183 check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result);
3184 check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3186 result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
3187 check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3188 __real__ result, INVALID_EXCEPTION);
3189 check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
3191 result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
3192 check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3193 __real__ result, INVALID_EXCEPTION);
3194 check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
3197 result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
3198 check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3199 __real__ result, INVALID_EXCEPTION);
3200 check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
3202 result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
3203 check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3204 __real__ result, INVALID_EXCEPTION);
3205 check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
3208 result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
3209 check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
3210 check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
3212 result = FUNC(ccos) (BUILD_COMPLEX (0.7, 1.2));
3213 check_eps ("real(ccos(0.7 + i 1.2)) = 1.384865764...", __real__ result,
3214 1.3848657645312111080L, CHOOSE (4e-18L, 3e-16, 2e-7));
3215 check_eps ("imag(ccos(0.7 + i 1.2)) = -0.972421703...", __imag__ result,
3216 -0.97242170335830028619L, CHOOSE (2e-16L, 2e-16, 0));
3218 result = FUNC(ccos) (BUILD_COMPLEX (-2, -3));
3219 check_eps ("real(ccos(-2 - i 3)) == -4.18962...", __real__ result,
3220 -4.1896256909688072301L, CHOOSE (2e-17L, 0, 5e-7));
3221 check_eps ("imag(ccos(-2 - i 3)) == -9.10922...", __imag__ result,
3222 -9.1092278937553365979L, CHOOSE (3e-18L, 0, 1e-6));
3229 __complex__ MATHTYPE result;
3231 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0));
3232 check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0);
3233 check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0);
3234 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0));
3235 check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0);
3236 check ("imag(ccosh(-0 + 0i)) = -0", __imag__ result, minus_zero);
3237 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero));
3238 check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0);
3239 check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero);
3240 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero));
3241 check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0);
3242 check ("imag(ccosh(-0 - 0i)) = 0", __imag__ result, 0.0);
3244 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
3245 check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
3246 __real__ result, INVALID_EXCEPTION);
3247 check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
3248 FUNC(fabs) (__imag__ result), 0);
3249 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
3250 check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
3251 __real__ result, INVALID_EXCEPTION);
3252 check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
3253 FUNC(fabs) (__imag__ result), 0);
3254 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
3255 check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
3256 __real__ result, INVALID_EXCEPTION);
3257 check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
3258 FUNC(fabs) (__imag__ result), 0);
3259 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
3260 check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
3261 __real__ result, INVALID_EXCEPTION);
3262 check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
3263 FUNC(fabs) (__imag__ result), 0);
3265 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0));
3266 check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result);
3267 check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result, 0);
3268 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 0.0));
3269 check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result);
3270 check ("imag(ccosh(-Inf + 0i)) = -0", __imag__ result, minus_zero);
3271 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_zero));
3272 check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result);
3273 check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result, minus_zero);
3274 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_zero));
3275 check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result);
3276 check ("imag(ccosh(-Inf - 0i)) = 0", __imag__ result, 0.0);
3278 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty));
3279 check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
3280 __real__ result, INVALID_EXCEPTION);
3281 check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
3283 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty));
3284 check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
3285 __real__ result, INVALID_EXCEPTION);
3286 check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
3288 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty));
3289 check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
3290 __real__ result, INVALID_EXCEPTION);
3291 check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
3293 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty));
3294 check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
3295 __real__ result, INVALID_EXCEPTION);
3296 check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
3299 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 4.625));
3300 check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result);
3301 check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result);
3302 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 4.625));
3303 check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result);
3304 check_isinfp ("imag(ccosh(-Inf + i4.625)) = Inf", __imag__ result);
3305 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, -4.625));
3306 check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result);
3307 check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result);
3308 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, -4.625));
3309 check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result);
3310 check_isinfn ("imag(ccosh(-Inf - i4.625)) = -Inf", __imag__ result);
3312 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty));
3313 check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3314 __real__ result, INVALID_EXCEPTION);
3315 check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
3317 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty));
3318 check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3319 __real__ result, INVALID_EXCEPTION);
3320 check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
3322 result = FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty));
3323 check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3324 __real__ result, INVALID_EXCEPTION);
3325 check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
3327 result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty));
3328 check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3329 __real__ result, INVALID_EXCEPTION);
3330 check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
3333 result = FUNC(ccosh) (BUILD_COMPLEX (0.0, nan_value));
3334 check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result);
3335 check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3336 result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, nan_value));
3337 check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result);
3338 check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
3340 result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, nan_value));
3341 check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result);
3342 check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result);
3343 result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value));
3344 check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result);
3345 check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result);
3347 result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
3348 check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3349 __real__ result, INVALID_EXCEPTION);
3350 check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
3352 result = FUNC(ccosh) (BUILD_COMPLEX (-9.0, nan_value));
3353 check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3354 __real__ result, INVALID_EXCEPTION);
3355 check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
3358 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0));
3359 check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result);
3360 check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3361 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero));
3362 check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result);
3363 check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
3365 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
3366 check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3367 __real__ result, INVALID_EXCEPTION);
3368 check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
3370 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0));
3371 check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3372 __real__ result, INVALID_EXCEPTION);
3373 check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
3376 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty));
3377 check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3378 __real__ result, INVALID_EXCEPTION);
3379 check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
3381 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty));
3382 check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3383 __real__ result, INVALID_EXCEPTION);
3384 check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
3387 result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value));
3388 check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result);
3389 check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result);
3391 result = FUNC(ccosh) (BUILD_COMPLEX (0.7, 1.2));
3392 check_eps ("real(ccosh(0.7 + i 1.2)) == 0.45482...", __real__ result,
3393 0.4548202223691477654L, CHOOSE (5e-17L, 6e-17, 9e-8));
3394 check_eps ("imag(ccosh(0.7 + i 1.2)) == 0.70702...", __imag__ result,
3395 0.7070296600921537682L, CHOOSE (7e-17L, 2e-16, 0));
3397 result = FUNC(ccosh) (BUILD_COMPLEX (-2, -3));
3398 check_eps ("real(ccosh(-2 - i 3)) == -3.72454...", __real__ result,
3399 -3.7245455049153225654L, CHOOSE (7e-19L, 0, 3e-7));
3400 check_eps ("imag(ccosh(-2 - i 3)) == -0.51182...", __imag__ result,
3401 0.5118225699873846088L, CHOOSE (3e-19L, 2e-16, 6e-8));
3408 __complex__ MATHTYPE result;
3410 result = FUNC(cacos) (BUILD_COMPLEX (0, 0));
3411 check ("real(cacos(0 + i0)) = pi/2", __real__ result, M_PI_2l);
3412 check ("imag(cacos(0 + i0)) = -0", __imag__ result, minus_zero);
3413 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, 0));
3414 check ("real(cacos(-0 + i0)) = pi/2", __real__ result, M_PI_2l);
3415 check ("imag(cacos(-0 + i0)) = -0", __imag__ result, minus_zero);
3416 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_zero));
3417 check ("real(cacos(0 - i0)) = pi/2", __real__ result, M_PI_2l);
3418 check ("imag(cacos(0 - i0)) = 0", __imag__ result, 0);
3419 result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, minus_zero));
3420 check ("real(cacos(-0 - i0)) = pi/2", __real__ result, M_PI_2l);
3421 check ("imag(cacos(-0 - i0)) = 0", __imag__ result, 0);
3423 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, plus_infty));
3424 check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result,
3426 check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result);
3427 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_infty));
3428 check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result,
3430 check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result);
3432 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, plus_infty));
3433 check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4l);
3434 check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result);
3435 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_infty));
3436 check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4l);
3437 check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result);
3439 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, plus_infty));
3440 check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result, M_PI_2l);
3441 check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result);
3442 result = FUNC(cacos) (BUILD_COMPLEX (-10.0, minus_infty));
3443 check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result, M_PI_2l);
3444 check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result);
3445 result = FUNC(cacos) (BUILD_COMPLEX (0, plus_infty));
3446 check ("real(cacos(0 + i Inf)) = pi/2", __real__ result, M_PI_2l);
3447 check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result);
3448 result = FUNC(cacos) (BUILD_COMPLEX (0, minus_infty));
3449 check ("real(cacos(0 - i Inf)) = pi/2", __real__ result, M_PI_2l);
3450 check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result);
3451 result = FUNC(cacos) (BUILD_COMPLEX (0.1, plus_infty));
3452 check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result, M_PI_2l);
3453 check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result);
3454 result = FUNC(cacos) (BUILD_COMPLEX (0.1, minus_infty));
3455 check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result, M_PI_2l);
3456 check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result);
3458 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 0));
3459 check ("real(cacos(-Inf + i0)) = pi", __real__ result, M_PIl);
3460 check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result);
3461 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_zero));
3462 check ("real(cacos(-Inf - i0)) = pi", __real__ result, M_PIl);
3463 check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result);
3464 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 100));
3465 check ("real(cacos(-Inf + i100)) = pi", __real__ result, M_PIl);
3466 check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result);
3467 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, -100));
3468 check ("real(cacos(-Inf - i100)) = pi", __real__ result, M_PIl);
3469 check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result);
3471 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0));
3472 check ("real(cacos(+Inf + i0)) = 0", __real__ result, 0);
3473 check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result);
3474 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_zero));
3475 check ("real(cacos(+Inf - i0)) = 0", __real__ result, 0);
3476 check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result);
3477 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0.5));
3478 check ("real(cacos(+Inf + i0.5)) = 0", __real__ result, 0);
3479 check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result);
3480 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, -0.5));
3481 check ("real(cacos(+Inf - i0.5)) = 0", __real__ result, 0);
3482 check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result);
3484 result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, nan_value));
3485 check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result);
3486 check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf",
3487 FUNC(fabs) (__imag__ result));
3488 result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, nan_value));
3489 check_isnan ("real(cacos(-Inf + i NaN)) = NaN