1 /* Copyright (C) 1997, 1998, 1999 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 is processed by a perl script. The resulting file has to
23 be included by a master file that defines:
26 FUNC(function): converts general function name (like cos) to
27 name with correct suffix (e.g. cosl or cosf)
28 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
29 FLOAT: floating point type to test
30 - TEST_MSG: informal message to be displayed
31 CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
32 chooses one of the parameters as delta for testing
34 PRINTF_EXPR Floating point conversion specification to print a variable
35 of type FLOAT with printf. PRINTF_EXPR just contains
36 the specifier, not the percent and width arguments,
38 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
39 PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */
41 /* This testsuite has currently tests for:
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,
49 ldexp, lgamma, log, log10, log1p, log2, logb,
50 modf, nearbyint, nextafter,
51 pow, remainder, remquo, rint, lrint, llrint,
52 round, lround, llround,
53 scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
56 and for the following complex math functions:
57 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
58 ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
60 At the moment the following functions aren't tested:
61 drem, significand, nan
63 Parameter handling is primitive in the moment:
64 --verbose=[0..3] for different levels of output:
66 1: basic report on failed tests (default)
67 2: full report on all tests
68 -v for full output (equals --verbose=3)
69 -u for generation of an ULPs file
74 This suite tests some aspects of the correct implementation of
75 mathematical functions in libm. Some simple, specific parameters
76 are tested for correctness but there's no exhaustive
77 testing. Handling of specific inputs (e.g. infinity, not-a-number)
78 is also tested. Correct handling of exceptions is checked
79 against. These implemented tests should check all cases that are
82 Exception testing: At the moment only divide-by-zero and invalid
83 exceptions are tested. Overflow/underflow and inexact exceptions
84 aren't checked at the moment.
86 NaN values: There exist signalling and quiet NaNs. This implementation
87 only uses signalling NaN as parameter but does not differenciate
88 between the two kinds of NaNs as result.
90 Inline functions: Inlining functions should give an improvement in
91 speed - but not in precission. The inlined functions return
92 reasonable values for a reasonable range of input values. The
93 result is not necessarily correct for all values and exceptions are
94 not correctly raised in all cases. Problematic input and return
95 values are infinity, not-a-number and minus zero. This suite
96 therefore does not check these specific inputs and the exception
97 handling for inlined mathematical functions - just the "reasonable"
100 Beware: The tests might fail for any of the following reasons:
102 - Functions are wrong
103 - Floating Point Unit not working properly
104 - Compiler has errors
106 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
113 #include "libm-test-ulps.h"
124 /* Possible exceptions */
125 #define NO_EXCEPTION 0x0
126 #define INVALID_EXCEPTION 0x1
127 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
128 /* The next flags signals that those exceptions are allowed but not required. */
129 #define INVALID_EXCEPTION_OK 0x4
130 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x8
131 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
132 /* Some special test flags, passed togther with exceptions. */
133 #define IGNORE_ZERO_INF_SIGN 0x10
135 /* Various constants (we must supply them precalculated for accuracy). */
136 #define M_PI_6l .52359877559829887308L
137 #define M_E2l 7.389056098930650227230L
138 #define M_E3l 20.08553692318766774093L
139 #define M_2_SQRT_PIl 3.5449077018110320545963L /* 2 sqrt (M_PIl) */
140 #define M_SQRT_PIl 1.77245385090551602729817L /* sqrt (M_PIl) */
141 #define M_LOG_SQRT_PIl 0.572364942924700087072L /* log(sqrt(M_PIl)) */
142 #define M_LOG_2_SQRT_PIl 1.265512123484645396489L /* log(2*sqrt(M_PIl)) */
143 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
144 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
145 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
146 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
147 #define M_PI_LOG10El M_PIl * M_LOG10El
149 static FILE *ulps_file; /* File to document difference. */
150 static int output_ulps; /* Should ulps printed? */
152 static int noErrors; /* number of errors */
153 static int noTests; /* number of tests (without testing exceptions) */
154 static int noExcTests; /* number of tests for exception flags */
155 static int noXFails; /* number of expected failures. */
156 static int noXPasses; /* number of unexpected passes. */
159 static int output_max_error; /* Should the maximal errors printed? */
160 static int output_points; /* Should the single function results printed? */
161 static int ignore_max_ulp; /* Should we ignore max_ulp? */
163 static FLOAT minus_zero, plus_zero;
164 static FLOAT plus_infty, minus_infty, nan_value;
166 static FLOAT max_error, real_max_error, imag_max_error;
169 #define BUILD_COMPLEX(real, imag) \
170 ({ __complex__ FLOAT __retval; \
171 __real__ __retval = (real); \
172 __imag__ __retval = (imag); \
175 #define BUILD_COMPLEX_INT(real, imag) \
176 ({ __complex__ int __retval; \
177 __real__ __retval = (real); \
178 __imag__ __retval = (imag); \
182 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
183 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
186 init_max_error (void)
194 set_max_error (FLOAT current, FLOAT *curr_max_error)
196 if (current > *curr_max_error)
197 *curr_max_error = current;
201 /* Should the message print to screen? This depends on the verbose flag,
202 and the test status. */
204 print_screen (int ok, int xfail)
208 || (verbose == 1 && ok == xfail)))
214 /* Should the message print to screen? This depends on the verbose flag,
215 and the test status. */
217 print_screen_max_error (int ok, int xfail)
221 || ((verbose == 1) && (ok == xfail))))
226 /* Update statistic counters. */
228 update_stats (int ok, int xfail)
233 else if (!ok && xfail)
235 else if (!ok && !xfail)
240 print_ulps (const char *test_name, FLOAT ulp)
244 fprintf (ulps_file, "Test \"%s\":\n", test_name);
245 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
246 CHOOSE("ldouble", "double", "float",
247 "ildouble", "idouble", "ifloat"), ulp);
252 print_function_ulps (const char *function_name, FLOAT ulp)
256 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
257 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
258 CHOOSE("ldouble", "double", "float",
259 "ildouble", "idouble", "ifloat"), ulp);
265 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
272 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
273 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
274 CHOOSE("ldouble", "double", "float",
275 "ildouble", "idouble", "ifloat"), real_ulp);
279 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
280 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
281 CHOOSE("ldouble", "double", "float",
282 "ildouble", "idouble", "ifloat"), imag_ulp);
291 /* Test if Floating-Point stack hasn't changed */
293 fpstack_test (const char *test_name)
296 static int old_stack;
299 asm ("fnstsw" : "=a" (sw));
305 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
306 test_name, sw, old_stack);
315 print_max_error (const char *func_name, FLOAT allowed, int xfail)
319 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
325 print_function_ulps (func_name, max_error);
328 if (print_screen_max_error (ok, xfail))
330 printf ("Maximal error of `%s'\n", func_name);
331 printf (" is : % .4" PRINTF_NEXPR " ulp\n", max_error);
332 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", allowed);
335 update_stats (ok, xfail);
340 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
341 __complex__ int xfail)
345 if ((real_max_error <= __real__ allowed)
346 && (imag_max_error <= __imag__ allowed))
352 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
355 if (print_screen_max_error (ok, xfail))
357 printf ("Maximal error of real part of: %s\n", func_name);
358 printf (" is : % .4" PRINTF_NEXPR " ulp\n", real_max_error);
359 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __real__ allowed);
360 printf ("Maximal error of imaginary part of: %s\n", func_name);
361 printf (" is : % .4" PRINTF_NEXPR " ulp\n", imag_max_error);
362 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __imag__ allowed);
365 update_stats (ok, xfail);
369 /* Test whether a given exception was raised. */
371 test_single_exception (const char *test_name,
375 const char *flag_name)
379 if (exception & exc_flag)
381 if (fetestexcept (fe_flag))
383 if (print_screen (1, 0))
384 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
389 if (print_screen (0, 0))
390 printf ("Failure: %s: Exception \"%s\" not set\n",
391 test_name, flag_name);
396 if (fetestexcept (fe_flag))
399 if (print_screen (0, 0))
400 printf ("Failure: %s: Exception \"%s\" set\n",
401 test_name, flag_name);
405 if (print_screen (1, 0))
406 printf ("%s: Exception \"%s\" not set\n", test_name,
417 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
418 allowed but not required exceptions.
421 test_exceptions (const char *test_name, int exception)
425 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
426 test_single_exception (test_name, exception,
427 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
431 if ((exception & INVALID_EXCEPTION_OK) == 0)
432 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
433 "Invalid operation");
435 feclearexcept (FE_ALL_EXCEPT);
440 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
441 FLOAT max_ulp, int xfail, int exceptions,
442 FLOAT *curr_max_error)
449 test_exceptions (test_name, exceptions);
450 if (isnan (computed) && isnan (expected))
452 else if (isinf (computed) && isinf (expected))
454 /* Test for sign of infinities. */
455 if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0)
456 && (isinf (computed) != isinf (expected)))
459 printf ("infinity has wrong sign.\n");
464 /* Don't calc ulp for NaNs or infinities. */
465 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
469 diff = FUNC(fabs) (computed - expected);
470 /* ilogb (0) isn't allowed. */
472 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
474 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
475 set_max_error (ulp, curr_max_error);
477 if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0)
478 && (computed == 0.0 && expected == 0.0
479 && signbit(computed) != signbit (expected)))
481 else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
486 print_ulps (test_name, ulp);
490 if (print_screen (ok, xfail))
493 printf ("Failure: ");
494 printf ("Test: %s\n", test_name);
495 printf ("Result:\n");
496 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
498 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
502 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
504 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
505 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
508 update_stats (ok, xfail);
510 fpstack_test (test_name);
515 check_float (const char *test_name, FLOAT computed, FLOAT expected,
516 FLOAT max_ulp, int xfail, int exceptions)
518 check_float_internal (test_name, computed, expected, max_ulp, xfail,
519 exceptions, &max_error);
524 check_complex (const char *test_name, __complex__ FLOAT computed,
525 __complex__ FLOAT expected,
526 __complex__ FLOAT max_ulp, __complex__ int xfail,
529 FLOAT part_comp, part_exp, part_max_ulp;
533 sprintf (str, "Real part of: %s", test_name);
534 part_comp = __real__ computed;
535 part_exp = __real__ expected;
536 part_max_ulp = __real__ max_ulp;
537 part_xfail = __real__ xfail;
539 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
540 exception, &real_max_error);
542 sprintf (str, "Imaginary part of: %s", test_name);
543 part_comp = __imag__ computed;
544 part_exp = __imag__ expected;
545 part_max_ulp = __imag__ max_ulp;
546 part_xfail = __imag__ xfail;
548 /* Don't check again for exceptions, just pass through the
549 zero/inf sign test. */
550 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
551 exception & IGNORE_ZERO_INF_SIGN,
556 /* Check that computed and expected values are equal (int values). */
558 check_int (const char *test_name, int computed, int expected, int max_ulp,
559 int xfail, int exceptions)
561 int diff = computed - expected;
564 test_exceptions (test_name, exceptions);
566 if (abs (diff) <= max_ulp)
570 print_ulps (test_name, diff);
572 if (print_screen (ok, xfail))
575 printf ("Failure: ");
576 printf ("Test: %s\n", test_name);
577 printf ("Result:\n");
578 printf (" is: %d\n", computed);
579 printf (" should be: %d\n", expected);
582 update_stats (ok, xfail);
583 fpstack_test (test_name);
587 /* Check that computed and expected values are equal (long int values). */
589 check_long (const char *test_name, long int computed, long int expected,
590 long int max_ulp, int xfail, int exceptions)
592 long int diff = computed - expected;
595 test_exceptions (test_name, exceptions);
597 if (labs (diff) <= max_ulp)
601 print_ulps (test_name, diff);
603 if (print_screen (ok, xfail))
606 printf ("Failure: ");
607 printf ("Test: %s\n", test_name);
608 printf ("Result:\n");
609 printf (" is: %ld\n", computed);
610 printf (" should be: %ld\n", expected);
613 update_stats (ok, xfail);
614 fpstack_test (test_name);
618 /* Check that computed value is true/false. */
620 check_bool (const char *test_name, int computed, int expected,
621 long int max_ulp, int xfail, int exceptions)
625 test_exceptions (test_name, exceptions);
627 if ((computed == 0) == (expected == 0))
630 if (print_screen (ok, xfail))
633 printf ("Failure: ");
634 printf ("Test: %s\n", test_name);
635 printf ("Result:\n");
636 printf (" is: %d\n", computed);
637 printf (" should be: %d\n", expected);
640 update_stats (ok, xfail);
641 fpstack_test (test_name);
645 /* check that computed and expected values are equal (long int values) */
647 check_longlong (const char *test_name, long long int computed,
648 long long int expected,
649 long long int max_ulp, int xfail,
652 long long int diff = computed - expected;
655 test_exceptions (test_name, exceptions);
657 if (llabs (diff) <= max_ulp)
661 print_ulps (test_name, diff);
663 if (print_screen (ok, xfail))
667 printf ("Test: %s\n", test_name);
668 printf ("Result:\n");
669 printf (" is: %lld\n", computed);
670 printf (" should be: %lld\n", expected);
673 update_stats (ok, xfail);
674 fpstack_test (test_name);
679 /* This is to prevent messages from the SVID libm emulation. */
681 matherr (struct exception *x __attribute__ ((unused)))
687 /****************************************************************************
688 Tests for single functions of libm.
689 Please keep them alphabetically sorted!
690 ****************************************************************************/
697 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
698 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
699 TEST_f_f (acos, nan_value, nan_value);
702 TEST_f_f (acos, 1.1, nan_value, INVALID_EXCEPTION);
703 TEST_f_f (acos, -1.1, nan_value, INVALID_EXCEPTION);
705 TEST_f_f (acos, 0, M_PI_2l);
706 TEST_f_f (acos, minus_zero, M_PI_2l);
707 TEST_f_f (acos, 1, 0);
708 TEST_f_f (acos, -1, M_PIl);
709 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
710 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
711 TEST_f_f (acos, 0.7, 0.7953988301841435554L);
721 TEST_f_f (acosh, plus_infty, plus_infty);
722 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
725 TEST_f_f (acosh, -1.1, nan_value, INVALID_EXCEPTION);
727 TEST_f_f (acosh, 1, 0);
728 TEST_f_f (acosh, 7, 2.6339157938496334172L);
739 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
740 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
741 TEST_f_f (asin, nan_value, nan_value);
743 /* asin x == NaN plus invalid exception for |x| > 1. */
744 TEST_f_f (asin, 1.1, nan_value, INVALID_EXCEPTION);
745 TEST_f_f (asin, -1.1, nan_value, INVALID_EXCEPTION);
747 TEST_f_f (asin, 0, 0);
748 TEST_f_f (asin, minus_zero, minus_zero);
749 TEST_f_f (asin, 0.5, M_PI_6l);
750 TEST_f_f (asin, -0.5, -M_PI_6l);
751 TEST_f_f (asin, 1.0, M_PI_2l);
752 TEST_f_f (asin, -1.0, -M_PI_2l);
753 TEST_f_f (asin, 0.7, 0.7753974966107530637L);
763 TEST_f_f (asinh, 0, 0);
764 TEST_f_f (asinh, minus_zero, minus_zero);
766 TEST_f_f (asinh, plus_infty, plus_infty);
767 TEST_f_f (asinh, minus_infty, minus_infty);
769 TEST_f_f (asinh, nan_value, nan_value);
770 TEST_f_f (asinh, 0.7, 0.652666566082355786L);
781 TEST_f_f (atan, 0, 0);
782 TEST_f_f (atan, minus_zero, minus_zero);
784 TEST_f_f (atan, plus_infty, M_PI_2l);
785 TEST_f_f (atan, minus_infty, -M_PI_2l);
786 TEST_f_f (atan, nan_value, nan_value);
788 TEST_f_f (atan, 1, M_PI_4l);
789 TEST_f_f (atan, -1, -M_PI_4l);
791 TEST_f_f (atan, 0.7, 0.6107259643892086165L);
805 TEST_f_f (atanh, 0, 0);
806 TEST_f_f (atanh, minus_zero, minus_zero);
808 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
809 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
810 TEST_f_f (atanh, nan_value, nan_value);
812 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
813 TEST_f_f (atanh, 1.1, nan_value, INVALID_EXCEPTION);
814 TEST_f_f (atanh, -1.1, nan_value, INVALID_EXCEPTION);
816 TEST_f_f (atanh, 0.7, 0.8673005276940531944L);
826 /* atan2 (0,x) == 0 for x > 0. */
827 TEST_ff_f (atan2, 0, 1, 0);
829 /* atan2 (-0,x) == -0 for x > 0. */
830 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
832 TEST_ff_f (atan2, 0, 0, 0);
833 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
835 /* atan2 (+0,x) == +pi for x < 0. */
836 TEST_ff_f (atan2, 0, -1, M_PIl);
838 /* atan2 (-0,x) == -pi for x < 0. */
839 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
841 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
842 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
844 /* atan2 (y,+0) == pi/2 for y > 0. */
845 TEST_ff_f (atan2, 1, 0, M_PI_2l);
847 /* atan2 (y,-0) == pi/2 for y > 0. */
848 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
850 /* atan2 (y,+0) == -pi/2 for y < 0. */
851 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
853 /* atan2 (y,-0) == -pi/2 for y < 0. */
854 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
856 /* atan2 (y,inf) == +0 for finite y > 0. */
857 TEST_ff_f (atan2, 1, plus_infty, 0);
859 /* atan2 (y,inf) == -0 for finite y < 0. */
860 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
862 /* atan2(+inf, x) == pi/2 for finite x. */
863 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
865 /* atan2(-inf, x) == -pi/2 for finite x. */
866 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
868 /* atan2 (y,-inf) == +pi for finite y > 0. */
869 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
871 /* atan2 (y,-inf) == -pi for finite y < 0. */
872 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
874 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
875 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
876 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
877 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
878 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
880 TEST_ff_f (atan2, 0.7, 1, 0.6107259643892086165L);
881 TEST_ff_f (atan2, 0.4, 0.0003, 1.5700463269355215718L);
892 /* cabs (x + iy) is specified as hypot (x,y) */
894 /* cabs (+inf + i x) == +inf. */
895 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
896 /* cabs (-inf + i x) == +inf. */
897 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
899 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
900 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
902 TEST_c_f (cabs, nan_value, nan_value, nan_value);
904 /* cabs (x,y) == cabs (y,x). */
905 TEST_c_f (cabs, 0.7L, 12.4L, 12.41974234837422060118L);
906 /* cabs (x,y) == cabs (-x,y). */
907 TEST_c_f (cabs, -12.4L, 0.7L, 12.41974234837422060118L);
908 /* cabs (x,y) == cabs (-y,x). */
909 TEST_c_f (cabs, -0.7L, 12.4L, 12.41974234837422060118L);
910 /* cabs (x,y) == cabs (-x,-y). */
911 TEST_c_f (cabs, -12.4L, -0.7L, 12.41974234837422060118L);
912 /* cabs (x,y) == cabs (-y,-x). */
913 TEST_c_f (cabs, -0.7L, -12.4L, 12.41974234837422060118L);
914 /* cabs (x,0) == fabs (x). */
915 TEST_c_f (cabs, -0.7L, 0, 0.7L);
916 TEST_c_f (cabs, 0.7L, 0, 0.7L);
917 TEST_c_f (cabs, -1.0L, 0, 1.0L);
918 TEST_c_f (cabs, 1.0L, 0, 1.0L);
919 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
920 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
922 TEST_c_f (cabs, 0.7, 1.2, 1.3892443989449804508L);
933 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
934 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
935 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
936 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
938 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
939 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
941 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
942 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
944 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
945 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
946 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
947 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
948 TEST_c_c (cacos, 0.1, plus_infty, M_PI_2l, minus_infty);
949 TEST_c_c (cacos, 0.1, minus_infty, M_PI_2l, plus_infty);
951 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
952 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
953 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
954 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
956 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
957 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
958 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
959 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
961 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
962 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
964 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
965 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
967 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
968 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
970 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
971 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
973 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
974 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
976 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
978 TEST_c_c (cacos, 0.7, 1.2, 1.1351827477151551089L, -1.0927647857577371459L);
979 TEST_c_c (cacos, -2, -3, 2.1414491111159960199L, 1.9833870299165354323L);
981 END (cacos, complex);
991 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
992 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
993 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
994 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
995 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
996 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
998 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
999 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1001 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1002 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1003 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1004 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1005 TEST_c_c (cacosh, 0.1, plus_infty, plus_infty, M_PI_2l);
1006 TEST_c_c (cacosh, 0.1, minus_infty, plus_infty, -M_PI_2l);
1008 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1009 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1010 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1011 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1013 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1014 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1015 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1016 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1018 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1019 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1021 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1022 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1024 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1025 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1027 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1028 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1030 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1031 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1033 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1035 TEST_c_c (cacosh, 0.7, 1.2, 1.0927647857577371459L, 1.1351827477151551089L);
1036 TEST_c_c (cacosh, -2, -3, -1.9833870299165354323L, 2.1414491111159960199L);
1038 END (cacosh, complex);
1046 /* carg (x + iy) is specified as atan2 (y, x) */
1048 /* carg (x + i 0) == 0 for x > 0. */
1049 TEST_c_f (carg, 2.0, 0, 0);
1050 /* carg (x - i 0) == -0 for x > 0. */
1051 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1053 TEST_c_f (carg, 0, 0, 0);
1054 TEST_c_f (carg, 0, minus_zero, minus_zero);
1056 /* carg (x + i 0) == +pi for x < 0. */
1057 TEST_c_f (carg, -2.0, 0, M_PIl);
1059 /* carg (x - i 0) == -pi for x < 0. */
1060 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1062 TEST_c_f (carg, minus_zero, 0, M_PIl);
1063 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1065 /* carg (+0 + i y) == pi/2 for y > 0. */
1066 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1068 /* carg (-0 + i y) == pi/2 for y > 0. */
1069 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1071 /* carg (+0 + i y) == -pi/2 for y < 0. */
1072 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1074 /* carg (-0 + i y) == -pi/2 for y < 0. */
1075 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1077 /* carg (inf + i y) == +0 for finite y > 0. */
1078 TEST_c_f (carg, plus_infty, 2.0, 0);
1080 /* carg (inf + i y) == -0 for finite y < 0. */
1081 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1083 /* carg(x + i inf) == pi/2 for finite x. */
1084 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1086 /* carg(x - i inf) == -pi/2 for finite x. */
1087 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1089 /* carg (-inf + i y) == +pi for finite y > 0. */
1090 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1092 /* carg (-inf + i y) == -pi for finite y < 0. */
1093 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1095 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1097 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1099 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1101 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1103 TEST_c_f (carg, nan_value, nan_value, nan_value);
1113 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1114 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1115 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1116 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1118 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1119 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1120 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1121 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1123 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1124 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1125 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1126 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1127 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1128 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1129 TEST_c_c (casin, 0.1, plus_infty, 0.0, plus_infty);
1130 TEST_c_c (casin, 0.1, minus_infty, 0.0, minus_infty);
1132 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1133 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1134 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1135 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1137 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1138 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1139 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1140 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1142 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1143 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1145 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1146 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1148 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1149 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1151 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1152 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1154 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1155 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1157 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1159 TEST_c_c (casin, 0.7, 1.2, 0.4356135790797415103L, 1.0927647857577371459L);
1160 TEST_c_c (casin, -2, -3, -0.5706527843210994007L, -1.9833870299165354323L);
1162 END (casin, complex);
1171 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1172 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1173 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1174 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1176 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1177 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1178 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1179 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1181 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1182 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1183 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1184 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1185 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1186 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1187 TEST_c_c (casinh, 0.1, plus_infty, plus_infty, M_PI_2l);
1188 TEST_c_c (casinh, 0.1, minus_infty, plus_infty, -M_PI_2l);
1190 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1191 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1192 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1193 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1195 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1196 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1197 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1198 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1200 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1201 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1203 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1204 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1206 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1207 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1209 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1210 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1212 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1213 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1215 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1217 TEST_c_c (casinh, 0.7, 1.2, 0.9786545955936738768L, 0.9113541895315601156L);
1218 TEST_c_c (casinh, -2, -3, -1.9686379257930962917L, -0.9646585044076027920L);
1220 END (casinh, complex);
1229 TEST_c_c (catan, 0, 0, 0, 0);
1230 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1231 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1232 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1234 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1235 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1236 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1237 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1240 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1241 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1242 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1243 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1244 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1245 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1246 TEST_c_c (catan, plus_infty, 0.1, M_PI_2l, 0);
1247 TEST_c_c (catan, minus_infty, 0.1, -M_PI_2l, 0);
1249 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1250 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1251 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1252 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1254 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1255 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1256 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1257 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1259 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1260 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1262 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1263 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1265 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1266 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1268 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1269 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1271 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1272 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1274 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1275 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1277 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1279 TEST_c_c (catan, 0.7, 1.2, 1.0785743834118921877L, 0.5770573776534306764L);
1281 TEST_c_c (catan, -2, -3, -1.4099210495965755225L, -0.2290726829685387662L);
1283 END (catan, complex);
1291 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1292 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1293 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1294 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1296 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1297 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1298 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1299 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1301 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1302 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1303 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1304 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1305 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1306 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1307 TEST_c_c (catanh, 0.1, plus_infty, 0.0, M_PI_2l);
1308 TEST_c_c (catanh, 0.1, minus_infty, 0.0, -M_PI_2l);
1310 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1311 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1312 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1313 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1315 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1316 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1317 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1318 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1320 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1321 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1323 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1324 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1326 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1327 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1329 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1330 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1332 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1333 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1335 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1336 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1338 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1340 TEST_c_c (catanh, 0.7, 1.2, 0.2600749516525135959L, 0.9702403077950989849L);
1341 TEST_c_c (catanh, -2, -3, -0.1469466662255297520L, -1.3389725222944935611L);
1343 END (catanh, complex);
1351 TEST_f_f (cbrt, 0.0, 0.0);
1352 TEST_f_f (cbrt, minus_zero, minus_zero);
1354 TEST_f_f (cbrt, plus_infty, plus_infty);
1355 TEST_f_f (cbrt, minus_infty, minus_infty);
1356 TEST_f_f (cbrt, nan_value, nan_value);
1358 TEST_f_f (cbrt, -0.001, -0.1);
1359 TEST_f_f (cbrt, 8, 2);
1360 TEST_f_f (cbrt, -27.0, -3.0);
1361 TEST_f_f (cbrt, 0.970299, 0.99);
1362 TEST_f_f (cbrt, 0.7, 0.8879040017426007084L);
1373 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1374 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1375 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1376 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1378 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1379 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1380 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1381 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1383 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1384 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1385 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1386 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1388 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1389 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1390 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1391 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1393 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1394 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1395 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1396 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1398 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1399 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1400 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1401 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1403 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1404 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1406 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1407 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1409 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1410 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1412 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1413 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1415 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1416 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1418 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1419 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1421 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1423 TEST_c_c (ccos, 0.7, 1.2, 1.3848657645312111080L, -0.97242170335830028619L);
1425 TEST_c_c (ccos, -2, -3, -4.1896256909688072301L, -9.1092278937553365979L);
1427 END (ccos, complex);
1437 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1438 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1439 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1440 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1442 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1443 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1444 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1445 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1447 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1448 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1449 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1450 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1452 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1453 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1454 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1455 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1457 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1458 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1459 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1460 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1462 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1463 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1464 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1465 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1467 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1468 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1470 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1471 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1473 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1474 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1476 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1477 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1479 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1480 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1482 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1483 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1485 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1487 TEST_c_c (ccosh, 0.7, 1.2, 0.4548202223691477654L, 0.7070296600921537682L);
1489 TEST_c_c (ccosh, -2, -3, -3.7245455049153225654L, 0.5118225699873846088L);
1491 END (ccosh, complex);
1500 TEST_f_f (ceil, 0.0, 0.0);
1501 TEST_f_f (ceil, minus_zero, minus_zero);
1502 TEST_f_f (ceil, plus_infty, plus_infty);
1503 TEST_f_f (ceil, minus_infty, minus_infty);
1504 TEST_f_f (ceil, nan_value, nan_value);
1506 TEST_f_f (ceil, M_PIl, 4.0);
1507 TEST_f_f (ceil, -M_PIl, -3.0);
1518 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1519 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1520 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1521 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1523 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1524 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1526 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1527 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1529 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1530 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1532 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1533 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1535 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1536 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1538 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1539 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1541 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1542 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1543 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1544 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1546 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1547 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1549 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1550 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1552 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1554 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1556 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1557 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1559 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1560 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1561 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1562 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1564 TEST_c_c (cexp, 0.7, 1.2, 0.7296989091503236012L, 1.8768962328348102821L);
1565 TEST_c_c (cexp, -2.0, -3.0, -0.1339809149295426134L, -0.0190985162611351964L);
1567 END (cexp, complex);
1574 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1575 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1576 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1577 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1578 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1579 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1580 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1590 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1591 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1593 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1594 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1596 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1597 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1599 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1600 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1602 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1603 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1604 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1605 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1606 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1607 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1608 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1609 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1611 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1612 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1613 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1614 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1616 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1617 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1618 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1619 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1621 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1622 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1624 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1625 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1627 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1628 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1629 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1630 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1632 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1633 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1634 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1635 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1637 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1638 TEST_c_c (clog, -2, -3, 1.2824746787307683680L, -2.1587989303424641704L);
1640 END (clog, complex);
1649 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1650 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1652 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1653 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1655 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1657 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1658 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1660 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1661 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1662 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1663 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1664 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1665 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1666 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1667 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1669 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1670 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1671 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1672 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1674 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1675 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1676 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1677 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1679 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1680 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1682 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1683 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1685 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1686 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1687 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1688 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1690 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1691 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1692 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1693 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1695 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1697 TEST_c_c (clog10, 0.7, 1.2, 0.1427786545038868803L, 0.4528483579352493248L);
1698 TEST_c_c (clog10, -2, -3, 0.5569716761534183846L, -0.9375544629863747085L);
1700 END (clog10, complex);
1707 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1708 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1709 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1710 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1711 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1712 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1713 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1715 END (conj, complex);
1720 copysign_test (void)
1724 TEST_ff_f (copysign, 0, 4, 0);
1725 TEST_ff_f (copysign, 0, -4, minus_zero);
1726 TEST_ff_f (copysign, minus_zero, 4, 0);
1727 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1729 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1730 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1731 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1732 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1734 TEST_ff_f (copysign, 0, plus_infty, 0);
1735 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1736 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1737 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1739 /* XXX More correctly we would have to check the sign of the NaN. */
1740 TEST_ff_f (copysign, nan_value, 0, nan_value);
1741 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1742 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1743 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1753 TEST_f_f (cos, 0, 1);
1754 TEST_f_f (cos, minus_zero, 1);
1755 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1756 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1757 TEST_f_f (cos, nan_value, nan_value);
1759 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1760 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1761 TEST_f_f (cos, M_PI_2l, 0);
1763 TEST_f_f (cos, 0.7, 0.7648421872844884262L);
1772 TEST_f_f (cosh, 0, 1);
1773 TEST_f_f (cosh, minus_zero, 1);
1776 TEST_f_f (cosh, plus_infty, plus_infty);
1777 TEST_f_f (cosh, minus_infty, plus_infty);
1779 TEST_f_f (cosh, nan_value, nan_value);
1781 TEST_f_f (cosh, 0.7, 1.255169005630943018L);
1791 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
1792 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
1794 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
1795 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
1797 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
1799 END (cpow, complex);
1806 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
1807 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
1808 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
1809 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
1811 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
1813 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
1814 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
1815 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
1816 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
1818 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
1819 TEST_c_c (cproj, 2.0, 3.0, 0.28571428571428571429L, .42857142857142857143L);
1821 END (cproj, complex);
1828 TEST_c_f (creal, 0.0, 1.0, 0.0);
1829 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
1830 TEST_c_f (creal, nan_value, 1.0, nan_value);
1831 TEST_c_f (creal, nan_value, nan_value, nan_value);
1832 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
1833 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
1834 TEST_c_f (creal, 2.0, 3.0, 2.0);
1845 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
1846 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
1847 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
1848 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
1850 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
1851 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
1852 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
1853 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
1855 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1856 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1857 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1858 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1860 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1861 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1862 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1863 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1865 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1866 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1867 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1868 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1870 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
1871 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
1872 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
1873 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
1875 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1876 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1878 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1879 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1881 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1882 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1884 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
1885 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
1887 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1888 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1890 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1891 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1893 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
1895 TEST_c_c (csin, 0.7, 1.2, 1.1664563419657581376L, 1.1544997246948547371L);
1897 TEST_c_c (csin, -2, -3, -9.1544991469114295734L, 4.1689069599665643507L);
1899 END (csin, complex);
1909 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
1910 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
1911 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
1912 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
1914 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1915 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1916 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1917 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1919 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
1920 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
1921 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
1922 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
1924 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1925 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1926 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1927 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1929 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
1930 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
1931 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
1932 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
1934 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1935 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1936 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1937 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1939 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
1940 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
1942 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1943 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1945 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION);
1946 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION);
1948 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
1949 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
1951 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1952 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1954 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1955 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1957 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
1959 TEST_c_c (csinh, 0.7, 1.2, 0.27487868678117583582L, 1.1698665727426565139L);
1960 TEST_c_c (csinh, -2, -3, 3.5905645899857799520L, -0.5309210862485198052L);
1962 END (csinh, complex);
1970 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
1971 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
1972 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
1973 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
1975 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
1976 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
1977 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
1978 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
1980 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
1981 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
1982 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
1983 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
1985 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
1986 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
1987 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
1988 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
1989 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
1990 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
1991 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
1992 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
1993 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
1994 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
1995 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
1996 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
1998 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2000 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2002 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2003 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2004 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2005 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2007 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2008 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2009 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2010 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2012 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2014 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2015 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2016 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2017 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2018 TEST_c_c (csqrt, 0.7, 1.2, 1.0220676100300264507L, 0.5870453129635652115L);
2019 TEST_c_c (csqrt, -2, -3, 0.8959774761298381247L, -1.6741492280355400404L);
2020 TEST_c_c (csqrt, -2, 3, 0.8959774761298381247L, 1.6741492280355400404L);
2022 END (csqrt, complex);
2030 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2031 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2032 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2033 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2035 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2036 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2037 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2038 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2040 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2041 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2042 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2043 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2045 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2046 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2047 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2048 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2049 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2050 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2051 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2052 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2054 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2055 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2057 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2058 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2060 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2061 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2063 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2064 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2065 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2066 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2068 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2070 TEST_c_c (ctan, 0.7, 1.2, 0.1720734197630349001L, 0.9544807059989405538L);
2071 TEST_c_c (ctan, -2, -3, 0.0037640256415042482L, -1.0032386273536098014L);
2073 END (ctan, complex);
2082 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2083 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2084 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2085 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2087 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2088 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2089 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2090 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2091 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2092 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2093 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2094 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2096 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2097 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2098 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2099 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2100 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2101 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2102 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2103 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2105 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2106 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2108 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2109 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2111 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2112 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2114 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2115 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2116 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2117 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2119 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2121 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2123 TEST_c_c (ctanh, 0.7, 1.2, 1.3472197399061191630L, 0.4778641038326365540L);
2124 TEST_c_c (ctanh, -2, -3, -0.9653858790221331242L, 0.0098843750383224937L);
2126 END (ctanh, complex);
2134 if (errno == ENOSYS)
2135 /* Function not implemented. */
2140 TEST_f_f (erf, 0, 0);
2141 TEST_f_f (erf, minus_zero, minus_zero);
2142 TEST_f_f (erf, plus_infty, 1);
2143 TEST_f_f (erf, minus_infty, -1);
2144 TEST_f_f (erf, nan_value, nan_value);
2146 TEST_f_f (erf, 0.7, 0.67780119383741847297L);
2148 TEST_f_f (erf, 1.2, 0.91031397822963538024L);
2149 TEST_f_f (erf, 2.0, 0.99532226501895273416L);
2150 TEST_f_f (erf, 4.1, 0.99999999329997234592L);
2151 TEST_f_f (erf, 27, 1.0L);
2162 if (errno == ENOSYS)
2163 /* Function not implemented. */
2168 TEST_f_f (erfc, plus_infty, 0.0);
2169 TEST_f_f (erfc, minus_infty, 2.0);
2170 TEST_f_f (erfc, 0.0, 1.0);
2171 TEST_f_f (erfc, minus_zero, 1.0);
2172 TEST_f_f (erfc, nan_value, nan_value);
2174 TEST_f_f (erfc, 0.7, 0.32219880616258152702L);
2176 TEST_f_f (erfc, 1.2, 0.089686021770364619762L);
2177 TEST_f_f (erfc, 2.0, 0.0046777349810472658379L);
2178 TEST_f_f (erfc, 4.1, 0.67000276540848983727e-8L);
2179 TEST_f_f (erfc, 9, 0.41370317465138102381e-36L);
2189 TEST_f_f (exp, 0, 1);
2190 TEST_f_f (exp, minus_zero, 1);
2193 TEST_f_f (exp, plus_infty, plus_infty);
2194 TEST_f_f (exp, minus_infty, 0);
2196 TEST_f_f (exp, nan_value, nan_value);
2197 TEST_f_f (exp, 1, M_El);
2199 TEST_f_f (exp, 2, M_E2l);
2200 TEST_f_f (exp, 3, M_E3l);
2201 TEST_f_f (exp, 0.7, 2.0137527074704765216L);
2212 if (errno == ENOSYS)
2213 /* Function not implemented. */
2218 TEST_f_f (exp10, 0, 1);
2219 TEST_f_f (exp10, minus_zero, 1);
2221 TEST_f_f (exp10, plus_infty, plus_infty);
2222 TEST_f_f (exp10, minus_infty, 0);
2223 TEST_f_f (exp10, nan_value, nan_value);
2224 TEST_f_f (exp10, 3, 1000);
2225 TEST_f_f (exp10, -1, 0.1);
2226 TEST_f_f (exp10, 1e6, plus_infty);
2227 TEST_f_f (exp10, -1e6, 0);
2228 TEST_f_f (exp10, 0.7, 5.0118723362727228500L);
2238 if (errno == ENOSYS)
2239 /* Function not implemented. */
2244 TEST_f_f (exp2, 0, 1);
2245 TEST_f_f (exp2, minus_zero, 1);
2246 TEST_f_f (exp2, plus_infty, plus_infty);
2247 TEST_f_f (exp2, minus_infty, 0);
2248 TEST_f_f (exp2, nan_value, nan_value);
2250 TEST_f_f (exp2, 10, 1024);
2251 TEST_f_f (exp2, -1, 0.5);
2252 TEST_f_f (exp2, 1e6, plus_infty);
2253 TEST_f_f (exp2, -1e6, 0);
2254 TEST_f_f (exp2, 0.7, 1.6245047927124710452L);
2264 TEST_f_f (expm1, 0, 0);
2265 TEST_f_f (expm1, minus_zero, minus_zero);
2268 TEST_f_f (expm1, plus_infty, plus_infty);
2269 TEST_f_f (expm1, minus_infty, -1);
2271 TEST_f_f (expm1, nan_value, nan_value);
2273 TEST_f_f (expm1, 1, M_El - 1.0);
2274 TEST_f_f (expm1, 0.7, 1.0137527074704765216L);
2284 TEST_f_f (fabs, 0, 0);
2285 TEST_f_f (fabs, minus_zero, 0);
2287 TEST_f_f (fabs, plus_infty, plus_infty);
2288 TEST_f_f (fabs, minus_infty, plus_infty);
2289 TEST_f_f (fabs, nan_value, nan_value);
2291 TEST_f_f (fabs, 38.0, 38.0);
2292 TEST_f_f (fabs, -M_El, M_El);
2302 TEST_ff_f (fdim, 0, 0, 0);
2303 TEST_ff_f (fdim, 9, 0, 9);
2304 TEST_ff_f (fdim, 0, 9, 0);
2305 TEST_ff_f (fdim, -9, 0, 0);
2306 TEST_ff_f (fdim, 0, -9, 9);
2308 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2309 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2310 TEST_ff_f (fdim, minus_infty, 9, 0);
2311 TEST_ff_f (fdim, minus_infty, -9, 0);
2312 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2313 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2314 TEST_ff_f (fdim, 9, plus_infty, 0);
2315 TEST_ff_f (fdim, -9, plus_infty, 0);
2317 TEST_ff_f (fdim, 0, nan_value, nan_value);
2318 TEST_ff_f (fdim, 9, nan_value, nan_value);
2319 TEST_ff_f (fdim, -9, nan_value, nan_value);
2320 TEST_ff_f (fdim, nan_value, 9, nan_value);
2321 TEST_ff_f (fdim, nan_value, -9, nan_value);
2322 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2323 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2324 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2325 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2326 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2336 TEST_f_f (floor, 0.0, 0.0);
2337 TEST_f_f (floor, minus_zero, minus_zero);
2338 TEST_f_f (floor, plus_infty, plus_infty);
2339 TEST_f_f (floor, minus_infty, minus_infty);
2340 TEST_f_f (floor, nan_value, nan_value);
2342 TEST_f_f (floor, M_PIl, 3.0);
2343 TEST_f_f (floor, -M_PIl, -4.0);
2353 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2354 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2355 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2356 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2357 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2358 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2359 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2360 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2361 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2362 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2363 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2364 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2366 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2367 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2368 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2369 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2380 TEST_ff_f (fmax, 0, 0, 0);
2381 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2382 TEST_ff_f (fmax, 9, 0, 9);
2383 TEST_ff_f (fmax, 0, 9, 9);
2384 TEST_ff_f (fmax, -9, 0, 0);
2385 TEST_ff_f (fmax, 0, -9, 0);
2387 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2388 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2389 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2390 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2392 TEST_ff_f (fmax, minus_infty, 9, 9);
2393 TEST_ff_f (fmax, minus_infty, -9, -9);
2394 TEST_ff_f (fmax, 9, minus_infty, 9);
2395 TEST_ff_f (fmax, -9, minus_infty, -9);
2397 TEST_ff_f (fmax, 0, nan_value, 0);
2398 TEST_ff_f (fmax, 9, nan_value, 9);
2399 TEST_ff_f (fmax, -9, nan_value, -9);
2400 TEST_ff_f (fmax, nan_value, 0, 0);
2401 TEST_ff_f (fmax, nan_value, 9, 9);
2402 TEST_ff_f (fmax, nan_value, -9, -9);
2403 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2404 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2405 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2406 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2407 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2418 TEST_ff_f (fmin, 0, 0, 0);
2419 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2420 TEST_ff_f (fmin, 9, 0, 0);
2421 TEST_ff_f (fmin, 0, 9, 0);
2422 TEST_ff_f (fmin, -9, 0, -9);
2423 TEST_ff_f (fmin, 0, -9, -9);
2425 TEST_ff_f (fmin, plus_infty, 9, 9);
2426 TEST_ff_f (fmin, 9, plus_infty, 9);
2427 TEST_ff_f (fmin, plus_infty, -9, -9);
2428 TEST_ff_f (fmin, -9, plus_infty, -9);
2429 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2430 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2431 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2432 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2434 TEST_ff_f (fmin, 0, nan_value, 0);
2435 TEST_ff_f (fmin, 9, nan_value, 9);
2436 TEST_ff_f (fmin, -9, nan_value, -9);
2437 TEST_ff_f (fmin, nan_value, 0, 0);
2438 TEST_ff_f (fmin, nan_value, 9, 9);
2439 TEST_ff_f (fmin, nan_value, -9, -9);
2440 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2441 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2442 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2443 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2444 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2456 /* fmod (+0, y) == +0 for y != 0. */
2457 TEST_ff_f (fmod, 0, 3, 0);
2459 /* fmod (-0, y) == -0 for y != 0. */
2460 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2462 /* fmod (+inf, y) == NaN plus invalid exception. */
2463 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2464 /* fmod (-inf, y) == NaN plus invalid exception. */
2465 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2466 /* fmod (x, +0) == NaN plus invalid exception. */
2467 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2468 /* fmod (x, -0) == NaN plus invalid exception. */
2469 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2471 /* fmod (x, +inf) == x for x not infinite. */
2472 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2473 /* fmod (x, -inf) == x for x not infinite. */
2474 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2476 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2478 TEST_ff_f (fmod, 6.5, 2.3, 1.9);
2479 TEST_ff_f (fmod, -6.5, 2.3, -1.9);
2480 TEST_ff_f (fmod, 6.5, -2.3, 1.9);
2481 TEST_ff_f (fmod, -6.5, -2.3, -1.9);
2487 fpclassify_test (void)
2491 TEST_f_i (fpclassify, nan_value, FP_NAN);
2492 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2493 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2494 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2495 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2496 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2509 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2510 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2511 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2513 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2514 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2516 TEST_fI_f1 (frexp, 12.8, 0.8, 4);
2517 TEST_fI_f1 (frexp, -27.34, -0.854375, 5);
2529 if (errno == ENOSYS)
2530 /* Function not implemented. */
2532 feclearexcept (FE_ALL_EXCEPT);
2536 TEST_f_f (gamma, plus_infty, plus_infty);
2537 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2538 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2539 TEST_f_f (gamma, minus_infty, plus_infty);
2540 TEST_f_f (gamma, nan_value, nan_value);
2542 TEST_f_f1 (gamma, 1, 0, 1);
2543 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2545 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2546 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2556 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2557 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2560 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2561 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2562 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2563 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2566 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2568 /* hypot (x,y) == hypot (+-x, +-y) */
2569 TEST_ff_f (hypot, 0.7, 12.4, 12.41974234837422060118L);
2570 TEST_ff_f (hypot, -0.7, 12.4, 12.41974234837422060118L);
2571 TEST_ff_f (hypot, 0.7, -12.4, 12.41974234837422060118L);
2572 TEST_ff_f (hypot, -0.7, -12.4, 12.41974234837422060118L);
2573 TEST_ff_f (hypot, 12.4, 0.7, 12.41974234837422060118L);
2574 TEST_ff_f (hypot, -12.4, 0.7, 12.41974234837422060118L);
2575 TEST_ff_f (hypot, 12.4, -0.7, 12.41974234837422060118L);
2576 TEST_ff_f (hypot, -12.4, -0.7, 12.41974234837422060118L);
2578 /* hypot (x,0) == fabs (x) */
2579 TEST_ff_f (hypot, 0.7, 0, 0.7);
2580 TEST_ff_f (hypot, -0.7, 0, 0.7);
2581 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7);
2583 TEST_ff_f (hypot, 0.7, 1.2, 1.3892443989449804508L);
2594 TEST_f_i (ilogb, 1, 0);
2595 TEST_f_i (ilogb, M_El, 1);
2596 TEST_f_i (ilogb, 1024, 10);
2597 TEST_f_i (ilogb, -2000, 10);
2599 /* XXX We have a problem here: the standard does not tell us whether
2600 exceptions are allowed/required. ignore them for now. */
2602 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
2603 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
2609 isfinite_test (void)
2613 TEST_f_b (isfinite, 0, 1);
2614 TEST_f_b (isfinite, minus_zero, 1);
2615 TEST_f_b (isfinite, 10, 1);
2616 TEST_f_b (isfinite, plus_infty, 0);
2617 TEST_f_b (isfinite, minus_infty, 0);
2618 TEST_f_b (isfinite, nan_value, 0);
2624 isnormal_test (void)
2628 TEST_f_b (isnormal, 0, 0);
2629 TEST_f_b (isnormal, minus_zero, 0);
2630 TEST_f_b (isnormal, 10, 1);
2631 TEST_f_b (isnormal, plus_infty, 0);
2632 TEST_f_b (isnormal, minus_infty, 0);
2633 TEST_f_b (isnormal, nan_value, 0);
2643 if (errno == ENOSYS)
2644 /* Function not implemented. */
2649 /* j0 is the Bessel function of the first kind of order 0 */
2650 TEST_f_f (j0, nan_value, nan_value);
2651 TEST_f_f (j0, plus_infty, 0);
2652 TEST_f_f (j0, -1.0, 0.76519768655796655145);
2653 TEST_f_f (j0, 0.0, 1.0);
2654 TEST_f_f (j0, 0.1, 0.99750156206604003228);
2655 TEST_f_f (j0, 0.7, 0.88120088860740528084);
2656 TEST_f_f (j0, 1.0, 0.76519768655796655145);
2657 TEST_f_f (j0, 1.5, 0.51182767173591812875);
2658 TEST_f_f (j0, 2.0, 0.22389077914123566805);
2659 TEST_f_f (j0, 8.0, 0.17165080713755390609);
2660 TEST_f_f (j0, 10.0, -0.24593576445134833520);
2671 if (errno == ENOSYS)
2672 /* Function not implemented. */
2675 /* j1 is the Bessel function of the first kind of order 1 */
2679 TEST_f_f (j1, nan_value, nan_value);
2680 TEST_f_f (j1, plus_infty, 0);
2682 TEST_f_f (j1, -1.0, -0.44005058574493351596);
2683 TEST_f_f (j1, 0.0, 0.0);
2684 TEST_f_f (j1, 0.1, 0.049937526036241997556);
2685 TEST_f_f (j1, 0.7, 0.32899574154005894785);
2686 TEST_f_f (j1, 1.0, 0.44005058574493351596);
2687 TEST_f_f (j1, 1.5, 0.55793650791009964199);
2688 TEST_f_f (j1, 2.0, 0.57672480775687338720);
2689 TEST_f_f (j1, 8.0, 0.23463634685391462438);
2690 TEST_f_f (j1, 10.0, 0.043472746168861436670);
2700 if (errno == ENOSYS)
2701 /* Function not implemented. */
2704 /* jn is the Bessel function of the first kind of order n. */
2707 /* jn (0, x) == j0 (x) */
2708 TEST_ff_f (jn, 0, nan_value, nan_value);
2709 TEST_ff_f (jn, 0, plus_infty, 0);
2710 TEST_ff_f (jn, 0, -1.0, 0.76519768655796655145);
2711 TEST_ff_f (jn, 0, 0.0, 1.0);
2712 TEST_ff_f (jn, 0, 0.1, 0.99750156206604003228);
2713 TEST_ff_f (jn, 0, 0.7, 0.88120088860740528084);
2714 TEST_ff_f (jn, 0, 1.0, 0.76519768655796655145);
2715 TEST_ff_f (jn, 0, 1.5, 0.51182767173591812875);
2716 TEST_ff_f (jn, 0, 2.0, 0.22389077914123566805);
2717 TEST_ff_f (jn, 0, 8.0, 0.17165080713755390609);
2718 TEST_ff_f (jn, 0, 10.0, -0.24593576445134833520);
2720 /* jn (1, x) == j1 (x) */
2721 TEST_ff_f (jn, 1, nan_value, nan_value);
2722 TEST_ff_f (jn, 1, plus_infty, 0);
2724 TEST_ff_f (jn, 1, -1.0, -0.44005058574493351596);
2725 TEST_ff_f (jn, 1, 0.0, 0.0);
2726 TEST_ff_f (jn, 1, 0.1, 0.049937526036241997556);
2727 TEST_ff_f (jn, 1, 0.7, 0.32899574154005894785);
2728 TEST_ff_f (jn, 1, 1.0, 0.44005058574493351596);
2729 TEST_ff_f (jn, 1, 1.5, 0.55793650791009964199);
2730 TEST_ff_f (jn, 1, 2.0, 0.57672480775687338720);
2731 TEST_ff_f (jn, 1, 8.0, 0.23463634685391462438);
2732 TEST_ff_f (jn, 1, 10.0, 0.043472746168861436670);
2735 TEST_ff_f (jn, 3, nan_value, nan_value);
2736 TEST_ff_f (jn, 3, plus_infty, 0);
2738 TEST_ff_f (jn, 3, -1.0, -0.019563353982668405919);
2739 TEST_ff_f (jn, 3, 0.0, 0.0);
2740 TEST_ff_f (jn, 3, 0.1, 0.000020820315754756261429);
2741 TEST_ff_f (jn, 3, 0.7, 0.0069296548267508408077);
2742 TEST_ff_f (jn, 3, 1.0, 0.019563353982668405919);
2743 TEST_ff_f (jn, 3, 2.0, 0.12894324947440205110);
2744 TEST_ff_f (jn, 3, 10.0, 0.058379379305186812343);
2747 TEST_ff_f (jn, 10, nan_value, nan_value);
2748 TEST_ff_f (jn, 10, plus_infty, 0);
2750 TEST_ff_f (jn, 10, -1.0, 0.26306151236874532070e-9);
2751 TEST_ff_f (jn, 10, 0.0, 0.0);
2752 TEST_ff_f (jn, 10, 0.1, 0.26905328954342155795e-19);
2753 TEST_ff_f (jn, 10, 0.7, 0.75175911502153953928e-11);
2754 TEST_ff_f (jn, 10, 1.0, 0.26306151236874532070e-9);
2755 TEST_ff_f (jn, 10, 2.0, 0.25153862827167367096e-6);
2756 TEST_ff_f (jn, 10, 10.0, 0.20748610663335885770);
2765 TEST_ff_f (ldexp, 0, 0, 0);
2766 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
2768 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
2769 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
2770 TEST_ff_f (ldexp, nan_value, 1, nan_value);
2772 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
2773 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
2775 /* ldexp (x, 0) == x. */
2776 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
2784 if (errno == ENOSYS)
2785 /* Function not implemented. */
2787 feclearexcept (FE_ALL_EXCEPT);
2791 TEST_f_f (lgamma, plus_infty, plus_infty);
2792 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2793 TEST_f_f (lgamma, nan_value, nan_value);
2795 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
2796 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2797 TEST_f_f (lgamma, minus_infty, plus_infty);
2799 TEST_f_f1 (lgamma, 1, 0, 1);
2801 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
2803 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
2804 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2805 TEST_f_f1 (lgamma, 0.7, 0.26086724653166651439L, 1);
2806 TEST_f_f1 (lgamma, 1.2, -0.853740900033158497197e-1L, 1);
2814 /* XXX this test is incomplete. We need to have a way to specifiy
2815 the rounding method and test the critical cases. So far, only
2816 unproblematic numbers are tested. */
2820 TEST_f_l (lrint, 0.0, 0);
2821 TEST_f_l (lrint, minus_zero, 0);
2822 TEST_f_l (lrint, 0.2, 0);
2823 TEST_f_l (lrint, -0.2, 0);
2825 TEST_f_l (lrint, 1.4, 1);
2826 TEST_f_l (lrint, -1.4, -1);
2828 TEST_f_l (lrint, 8388600.3, 8388600);
2829 TEST_f_l (lrint, -8388600.3, -8388600);
2837 /* XXX this test is incomplete. We need to have a way to specifiy
2838 the rounding method and test the critical cases. So far, only
2839 unproblematic numbers are tested. */
2843 TEST_f_L (llrint, 0.0, 0);
2844 TEST_f_L (llrint, minus_zero, 0);
2845 TEST_f_L (llrint, 0.2, 0);
2846 TEST_f_L (llrint, -0.2, 0);
2848 TEST_f_L (llrint, 1.4, 1);
2849 TEST_f_L (llrint, -1.4, -1);
2851 TEST_f_L (llrint, 8388600.3, 8388600);
2852 TEST_f_L (llrint, -8388600.3, -8388600);
2854 /* Test boundary conditions. */
2856 TEST_f_L (llrint, 2097151.0,2097151LL);
2858 TEST_f_L (llrint, 8388608.0, 8388608LL);
2860 TEST_f_L (llrint, 16777216.0, 16777216LL);
2862 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
2864 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
2865 /* 0x10000000000000 */
2866 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
2867 /* 0x10000080000000 */
2868 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
2869 /* 0x20000000000000 */
2870 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
2871 /* 0x80000000000000 */
2872 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
2873 /* 0x100000000000000 */
2874 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
2884 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2885 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2887 TEST_f_f (log, 1, 0);
2889 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
2890 TEST_f_f (log, plus_infty, plus_infty);
2892 TEST_f_f (log, M_El, 1);
2893 TEST_f_f (log, 1.0 / M_El, -1);
2894 TEST_f_f (log, 2, M_LN2l);
2895 TEST_f_f (log, 10, M_LN10l);
2896 TEST_f_f (log, 0.7, -0.35667494393873237891L);
2907 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2908 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2910 TEST_f_f (log10, 1, 0);
2912 /* log10 (x) == NaN plus invalid exception if x < 0. */
2913 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
2915 TEST_f_f (log10, plus_infty, plus_infty);
2916 TEST_f_f (log10, nan_value, nan_value);
2918 TEST_f_f (log10, 0.1L, -1);
2919 TEST_f_f (log10, 10.0, 1);
2920 TEST_f_f (log10, 100.0, 2);
2921 TEST_f_f (log10, 10000.0, 4);
2922 TEST_f_f (log10, M_El, M_LOG10El);
2923 TEST_f_f (log10, 0.7, -0.15490195998574316929L);
2934 TEST_f_f (log1p, 0, 0);
2935 TEST_f_f (log1p, minus_zero, minus_zero);
2937 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2938 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
2940 TEST_f_f (log1p, plus_infty, plus_infty);
2941 TEST_f_f (log1p, nan_value, nan_value);
2943 TEST_f_f (log1p, M_El - 1.0, 1);
2945 TEST_f_f (log1p, -0.3, -0.35667494393873237891L);
2956 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2957 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2959 TEST_f_f (log2, 1, 0);
2961 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
2963 TEST_f_f (log2, plus_infty, plus_infty);
2964 TEST_f_f (log2, nan_value, nan_value);
2966 TEST_f_f (log2, M_El, M_LOG2El);
2967 TEST_f_f (log2, 2.0, 1);
2968 TEST_f_f (log2, 16.0, 4);
2969 TEST_f_f (log2, 256.0, 8);
2970 TEST_f_f (log2, 0.7, -0.51457317282975824043L);
2981 TEST_f_f (logb, plus_infty, plus_infty);
2982 TEST_f_f (logb, minus_infty, plus_infty);
2984 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2986 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2987 TEST_f_f (logb, nan_value, nan_value);
2989 TEST_f_f (logb, 1, 0);
2990 TEST_f_f (logb, M_El, 1);
2991 TEST_f_f (logb, 1024, 10);
2992 TEST_f_f (logb, -2000, 10);
3002 TEST_f_l (lround, 0, 0);
3003 TEST_f_l (lround, minus_zero, 0);
3004 TEST_f_l (lround, 0.2, 0.0);
3005 TEST_f_l (lround, -0.2, 0);
3006 TEST_f_l (lround, 0.5, 1);
3007 TEST_f_l (lround, -0.5, -1);
3008 TEST_f_l (lround, 0.8, 1);
3009 TEST_f_l (lround, -0.8, -1);
3010 TEST_f_l (lround, 1.5, 2);
3011 TEST_f_l (lround, -1.5, -2);
3012 TEST_f_l (lround, 22514.5, 22515);
3013 TEST_f_l (lround, -22514.5, -22515);
3015 TEST_f_l (lround, 2097152.5, 2097153);
3016 TEST_f_l (lround, -2097152.5, -2097153);
3027 TEST_f_L (llround, 0, 0);
3028 TEST_f_L (llround, minus_zero, 0);
3029 TEST_f_L (llround, 0.2, 0.0);
3030 TEST_f_L (llround, -0.2, 0);
3031 TEST_f_L (llround, 0.5, 1);
3032 TEST_f_L (llround, -0.5, -1);
3033 TEST_f_L (llround, 0.8, 1);
3034 TEST_f_L (llround, -0.8, -1);
3035 TEST_f_L (llround, 1.5, 2);
3036 TEST_f_L (llround, -1.5, -2);
3037 TEST_f_L (llround, 22514.5, 22515);
3038 TEST_f_L (llround, -22514.5, -22515);
3040 TEST_f_L (llround, 2097152.5, 2097153);
3041 TEST_f_L (llround, -2097152.5, -2097153);
3042 TEST_f_L (llround, 34359738368.5, 34359738369ll);
3043 TEST_f_L (llround, -34359738368.5, -34359738369ll);
3046 /* Test boundary conditions. */
3048 TEST_f_L (llround, 2097151.0, 2097151LL);
3050 TEST_f_L (llround, 8388608.0, 8388608LL);
3052 TEST_f_L (llround, 16777216.0, 16777216LL);
3054 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
3056 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
3057 /* 0x10000000000000 */
3058 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
3059 /* 0x10000080000000 */
3060 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3061 /* 0x20000000000000 */
3062 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
3063 /* 0x80000000000000 */
3064 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
3065 /* 0x100000000000000 */
3066 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
3078 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
3079 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
3080 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
3081 TEST_fF_f1 (modf, 0, 0, 0);
3082 TEST_fF_f1 (modf, 1.5, 0.5, 1);
3083 TEST_fF_f1 (modf, 2.5, 0.5, 2);
3084 TEST_fF_f1 (modf, -2.5, -0.5, -2);
3085 TEST_fF_f1 (modf, 20, 0, 20);
3086 TEST_fF_f1 (modf, 21, 0, 21);
3087 TEST_fF_f1 (modf, 89.5, 0.5, 89);
3094 nearbyint_test (void)
3098 TEST_f_f (nearbyint, 0.0, 0.0);
3099 TEST_f_f (nearbyint, minus_zero, minus_zero);
3100 TEST_f_f (nearbyint, plus_infty, plus_infty);
3101 TEST_f_f (nearbyint, minus_infty, minus_infty);
3102 TEST_f_f (nearbyint, nan_value, nan_value);
3108 nextafter_test (void)
3113 TEST_ff_f (nextafter, 0, 0, 0);
3114 TEST_ff_f (nextafter, minus_zero, 0, 0);
3115 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
3116 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
3118 TEST_ff_f (nextafter, 9, 9, 9);
3119 TEST_ff_f (nextafter, -9, -9, -9);
3120 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
3121 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
3123 TEST_ff_f (nextafter, nan_value, 1.1, nan_value);
3124 TEST_ff_f (nextafter, 1.1, nan_value, nan_value);
3125 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
3127 /* XXX We need the hexadecimal FP number representation here for further
3135 nexttoward_test (void)
3138 TEST_ff_f (nexttoward, 0, 0, 0);
3139 TEST_ff_f (nexttoward, minus_zero, 0, 0);
3140 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
3141 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
3143 TEST_ff_f (nexttoward, 9, 9, 9);
3144 TEST_ff_f (nexttoward, -9, -9, -9);
3145 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
3146 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
3148 TEST_ff_f (nexttoward, nan_value, 1.1, nan_value);
3149 TEST_ff_f (nexttoward, 1.1, nan_value, nan_value);
3150 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
3152 /* XXX We need the hexadecimal FP number representation here for further
3165 TEST_ff_f (pow, 0, 0, 1);
3166 TEST_ff_f (pow, 0, minus_zero, 1);
3167 TEST_ff_f (pow, minus_zero, 0, 1);
3168 TEST_ff_f (pow, minus_zero, minus_zero, 1);
3170 TEST_ff_f (pow, 10, 0, 1);
3171 TEST_ff_f (pow, 10, minus_zero, 1);
3172 TEST_ff_f (pow, -10, 0, 1);
3173 TEST_ff_f (pow, -10, minus_zero, 1);
3175 TEST_ff_f (pow, nan_value, 0, 1);
3176 TEST_ff_f (pow, nan_value, minus_zero, 1);
3180 TEST_ff_f (pow, 1.1, plus_infty, plus_infty);
3181 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
3182 TEST_ff_f (pow, -1.1, plus_infty, plus_infty);
3183 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
3185 TEST_ff_f (pow, 0.9L, plus_infty, 0);
3186 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
3187 TEST_ff_f (pow, -0.9L, plus_infty, 0);
3188 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
3190 TEST_ff_f (pow, 1.1, minus_infty, 0);
3191 TEST_ff_f (pow, plus_infty, minus_infty, 0);
3192 TEST_ff_f (pow, -1.1, minus_infty, 0);
3193 TEST_ff_f (pow, minus_infty, minus_infty, 0);
3195 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
3196 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
3197 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
3198 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
3200 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
3201 TEST_ff_f (pow, plus_infty, 1, plus_infty);
3202 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
3204 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
3205 TEST_ff_f (pow, plus_infty, -1, 0);
3206 TEST_ff_f (pow, plus_infty, -1e7L, 0);
3208 TEST_ff_f (pow, minus_infty, 1, minus_infty);
3209 TEST_ff_f (pow, minus_infty, 11, minus_infty);
3210 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
3212 TEST_ff_f (pow, minus_infty, 2, plus_infty);
3213 TEST_ff_f (pow, minus_infty, 12, plus_infty);
3214 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
3215 TEST_ff_f (pow, minus_infty, 0.1, plus_infty);
3216 TEST_ff_f (pow, minus_infty, 1.1, plus_infty);
3217 TEST_ff_f (pow, minus_infty, 11.1, plus_infty);
3218 TEST_ff_f (pow, minus_infty, 1001.1, plus_infty);
3220 TEST_ff_f (pow, minus_infty, -1, minus_zero);
3221 TEST_ff_f (pow, minus_infty, -11, minus_zero);
3222 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
3224 TEST_ff_f (pow, minus_infty, -2, 0);
3225 TEST_ff_f (pow, minus_infty, -12, 0);
3226 TEST_ff_f (pow, minus_infty, -1002, 0);
3227 TEST_ff_f (pow, minus_infty, -0.1, 0);
3228 TEST_ff_f (pow, minus_infty, -1.1, 0);
3229 TEST_ff_f (pow, minus_infty, -11.1, 0);
3230 TEST_ff_f (pow, minus_infty, -1001.1, 0);
3233 TEST_ff_f (pow, nan_value, nan_value, nan_value);
3234 TEST_ff_f (pow, 0, nan_value, nan_value);
3235 TEST_ff_f (pow, 1, nan_value, nan_value);
3236 TEST_ff_f (pow, -1, nan_value, nan_value);
3237 TEST_ff_f (pow, nan_value, 1, nan_value);
3238 TEST_ff_f (pow, nan_value, -1, nan_value);
3240 /* pow (x, NaN) == NaN. */
3241 TEST_ff_f (pow, 3.0, nan_value, nan_value);
3243 TEST_ff_f (pow, 1, plus_infty, nan_value, INVALID_EXCEPTION);
3244 TEST_ff_f (pow, -1, plus_infty, nan_value, INVALID_EXCEPTION);
3245 TEST_ff_f (pow, 1, minus_infty, nan_value, INVALID_EXCEPTION);
3246 TEST_ff_f (pow, -1, minus_infty, nan_value, INVALID_EXCEPTION);
3248 TEST_ff_f (pow, -0.1, 1.1, nan_value, INVALID_EXCEPTION);
3249 TEST_ff_f (pow, -0.1, -1.1, nan_value, INVALID_EXCEPTION);
3250 TEST_ff_f (pow, -10.1, 1.1, nan_value, INVALID_EXCEPTION);
3251 TEST_ff_f (pow, -10.1, -1.1, nan_value, INVALID_EXCEPTION);
3253 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3254 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3255 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3256 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3258 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3259 TEST_ff_f (pow, 0, -11.1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3260 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3261 TEST_ff_f (pow, minus_zero, -11.1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3264 TEST_ff_f (pow, 0, 1, 0);
3265 TEST_ff_f (pow, 0, 11, 0);
3267 TEST_ff_f (pow, minus_zero, 1, minus_zero);
3268 TEST_ff_f (pow, minus_zero, 11, minus_zero);
3271 TEST_ff_f (pow, 0, 2, 0);
3272 TEST_ff_f (pow, 0, 11.1, 0);
3275 TEST_ff_f (pow, minus_zero, 2, 0);
3276 TEST_ff_f (pow, minus_zero, 11.1, 0);
3279 /* pow (x, +inf) == +inf for |x| > 1. */
3280 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
3282 /* pow (x, +inf) == +0 for |x| < 1. */
3283 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
3285 /* pow (x, -inf) == +0 for |x| > 1. */
3286 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
3288 /* pow (x, -inf) == +inf for |x| < 1. */
3289 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
3292 /* pow (+inf, y) == +inf for y > 0. */
3293 TEST_ff_f (pow, plus_infty, 2, plus_infty);
3295 /* pow (+inf, y) == +0 for y < 0. */
3296 TEST_ff_f (pow, plus_infty, -1, 0.0);
3298 /* pow (-inf, y) == -inf for y an odd integer > 0. */
3299 TEST_ff_f (pow, minus_infty, 27, minus_infty);
3301 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
3302 TEST_ff_f (pow, minus_infty, 28, plus_infty);
3304 /* pow (-inf, y) == -0 for y an odd integer < 0. */
3305 TEST_ff_f (pow, minus_infty, -3, minus_zero);
3306 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
3307 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
3309 /* pow (+0, y) == +0 for y an odd integer > 0. */
3310 TEST_ff_f (pow, 0.0, 27, 0.0);
3312 /* pow (-0, y) == -0 for y an odd integer > 0. */
3313 TEST_ff_f (pow, minus_zero, 27, minus_zero);
3315 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
3316 TEST_ff_f (pow, 0.0, 4, 0.0);
3318 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
3319 TEST_ff_f (pow, minus_zero, 4, 0.0);
3321 TEST_ff_f (pow, 0.7, 1.2, 0.65180494056638638188L);
3324 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
3331 remainder_test (void)
3336 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
3337 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
3338 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
3339 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
3340 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
3342 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
3343 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
3344 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
3345 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
3346 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
3347 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
3360 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
3361 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
3362 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3363 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3364 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
3366 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
3367 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
3368 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
3369 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
3371 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
3372 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
3382 TEST_f_f (rint, 0.0, 0.0);
3383 TEST_f_f (rint, minus_zero, minus_zero);
3384 TEST_f_f (rint, plus_infty, plus_infty);
3385 TEST_f_f (rint, minus_infty, minus_infty);
3395 TEST_f_f (round, 0, 0);
3396 TEST_f_f (round, minus_zero, minus_zero);
3397 TEST_f_f (round, 0.2, 0.0);
3398 TEST_f_f (round, -0.2, minus_zero);
3399 TEST_f_f (round, 0.5, 1.0);
3400 TEST_f_f (round, -0.5, -1.0);
3401 TEST_f_f (round, 0.8, 1.0);
3402 TEST_f_f (round, -0.8, -1.0);
3403 TEST_f_f (round, 1.5, 2.0);
3404 TEST_f_f (round, -1.5, -2.0);
3405 TEST_f_f (round, 2097152.5, 2097153);
3406 TEST_f_f (round, -2097152.5, -2097153);
3418 TEST_ff_f (scalb, 2.0, 0.5, nan_value);
3419 TEST_ff_f (scalb, 3.0, -2.5, nan_value);
3421 TEST_ff_f (scalb, 0, nan_value, nan_value);
3422 TEST_ff_f (scalb, 1, nan_value, nan_value);
3424 TEST_ff_f (scalb, 1, 0, 1);
3425 TEST_ff_f (scalb, -1, 0, -1);
3427 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
3428 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
3430 TEST_ff_f (scalb, 0, 2, 0);
3431 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
3432 TEST_ff_f (scalb, 0, 0, 0);
3433 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
3434 TEST_ff_f (scalb, 0, -1, 0);
3435 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
3436 TEST_ff_f (scalb, 0, minus_infty, 0);
3437 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
3439 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
3440 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
3441 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
3442 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
3443 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
3444 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
3446 TEST_ff_f (scalb, 0.1, minus_infty, 0.0);
3447 TEST_ff_f (scalb, -0.1, minus_infty, minus_zero);
3449 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
3450 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
3451 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
3452 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
3454 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value);
3455 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value);
3457 TEST_ff_f (scalb, nan_value, 1, nan_value);
3458 TEST_ff_f (scalb, 1, nan_value, nan_value);
3459 TEST_ff_f (scalb, nan_value, 0, nan_value);
3460 TEST_ff_f (scalb, 0, nan_value, nan_value);
3461 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
3462 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
3463 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
3465 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
3466 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
3478 TEST_fi_f (scalbn, 0, 0, 0);
3479 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
3481 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
3482 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
3483 TEST_fi_f (scalbn, nan_value, 1, nan_value);
3485 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
3486 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
3488 TEST_fi_f (scalbn, 1, 0L, 1);
3499 TEST_fl_f (scalbln, 0, 0, 0);
3500 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
3502 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
3503 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
3504 TEST_fl_f (scalbln, nan_value, 1, nan_value);
3506 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
3507 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
3509 TEST_fl_f (scalbln, 1, 0L, 1);
3520 TEST_f_b (signbit, 0, 0);
3521 TEST_f_b (signbit, minus_zero, 1);
3522 TEST_f_b (signbit, plus_infty, 0);
3523 TEST_f_b (signbit, minus_infty, 1);
3525 /* signbit (x) != 0 for x < 0. */
3526 TEST_f_b (signbit, -1, 1);
3527 /* signbit (x) == 0 for x >= 0. */
3528 TEST_f_b (signbit, 1, 0);
3538 TEST_f_f (sin, 0, 0);
3539 TEST_f_f (sin, minus_zero, minus_zero);
3540 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
3541 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
3542 TEST_f_f (sin, nan_value, nan_value);
3544 TEST_f_f (sin, M_PI_6l, 0.5);
3545 TEST_f_f (sin, -M_PI_6l, -0.5);
3546 TEST_f_f (sin, M_PI_2l, 1);
3547 TEST_f_f (sin, -M_PI_2l, -1);
3548 TEST_f_f (sin, 0.7, 0.64421768723769105367L);
3557 FLOAT sin_res, cos_res;
3561 /* sincos is treated differently because it returns void. */
3562 TEST_extra (sincos, 0, 0, 1);
3564 TEST_extra (sincos, minus_zero, minus_zero, 1);
3565 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3566 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3567 TEST_extra (sincos, nan_value, nan_value, nan_value);
3569 TEST_extra (sincos, M_PI_2l, 1, 0);
3570 TEST_extra (sincos, M_PI_6l, 0.5, 0.866025403784438646764L);
3571 TEST_extra (sincos, M_PI_6l*2.0, 0.866025403784438646764L, 0.5);
3572 TEST_extra (sincos, 0.7, 0.64421768723769105367L, 0.76484218728448842626L);
3581 TEST_f_f (sinh, 0, 0);
3582 TEST_f_f (sinh, minus_zero, minus_zero);
3585 TEST_f_f (sinh, plus_infty, plus_infty);
3586 TEST_f_f (sinh, minus_infty, minus_infty);
3588 TEST_f_f (sinh, nan_value, nan_value);
3590 TEST_f_f (sinh, 0.7, 0.75858370183953350346L);
3600 TEST_f_f (sqrt, 0, 0);
3601 TEST_f_f (sqrt, nan_value, nan_value);
3602 TEST_f_f (sqrt, plus_infty, plus_infty);
3604 TEST_f_f (sqrt, minus_zero, minus_zero);
3606 /* sqrt (x) == NaN plus invalid exception for x < 0. */
3607 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
3608 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
3609 TEST_f_f (sqrt, nan_value, nan_value);
3611 TEST_f_f (sqrt, 2209, 47);
3612 TEST_f_f (sqrt, 4, 2);
3613 TEST_f_f (sqrt, 2, M_SQRT2l);
3614 TEST_f_f (sqrt, 0.25, 0.5);
3615 TEST_f_f (sqrt, 6642.25, 81.5);
3616 TEST_f_f (sqrt, 15239.9025, 123.45);
3617 TEST_f_f (sqrt, 0.7, 0.83666002653407554798L);
3627 TEST_f_f (tan, 0, 0);
3628 TEST_f_f (tan, minus_zero, minus_zero);
3629 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
3630 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
3631 TEST_f_f (tan, nan_value, nan_value);
3633 TEST_f_f (tan, M_PI_4l, 1);
3634 TEST_f_f (tan, 0.7, 0.84228838046307944813L);
3644 TEST_f_f (tanh, 0, 0);
3645 TEST_f_f (tanh, minus_zero, minus_zero);
3648 TEST_f_f (tanh, plus_infty, 1);
3649 TEST_f_f (tanh, minus_infty, -1);
3651 TEST_f_f (tanh, nan_value, nan_value);
3653 TEST_f_f (tanh, 0.7, 0.60436777711716349631L);
3663 if (errno == ENOSYS)
3664 /* Function not implemented. */
3666 feclearexcept (FE_ALL_EXCEPT);
3670 TEST_f_f (tgamma, plus_infty, plus_infty);
3671 TEST_f_f (tgamma, 0, nan_value, INVALID_EXCEPTION);
3672 TEST_f_f (tgamma, minus_zero, nan_value, INVALID_EXCEPTION);
3673 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
3674 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
3675 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
3676 TEST_f_f (tgamma, nan_value, nan_value);
3678 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
3679 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
3681 TEST_f_f (tgamma, 1, 1);
3682 TEST_f_f (tgamma, 4, 6);
3684 TEST_f_f (tgamma, 0.7, 1.29805533264755778568L);
3685 TEST_f_f (tgamma, 1.2, 0.91816874239976061064L);
3695 TEST_f_f (trunc, plus_infty, plus_infty);
3696 TEST_f_f (trunc, minus_infty, minus_infty);
3697 TEST_f_f (trunc, nan_value, nan_value);
3699 TEST_f_f (trunc, 0, 0);
3700 TEST_f_f (trunc, minus_zero, minus_zero);
3701 TEST_f_f (trunc, 0.625, 0);
3702 TEST_f_f (trunc, -0.625, minus_zero);
3703 TEST_f_f (trunc, 1, 1);
3704 TEST_f_f (trunc, -1, -1);
3705 TEST_f_f (trunc, 1.625, 1);
3706 TEST_f_f (trunc, -1.625, -1);
3708 TEST_f_f (trunc, 1048580.625L, 1048580L);
3709 TEST_f_f (trunc, -1048580.625L, -1048580L);
3711 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
3712 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
3714 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
3715 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
3726 if (errno == ENOSYS)
3727 /* Function not implemented. */
3730 /* y0 is the Bessel function of the second kind of order 0 */
3733 TEST_f_f (y0, -1.0, minus_infty);
3734 TEST_f_f (y0, 0.0, minus_infty);
3735 TEST_f_f (y0, nan_value, nan_value);
3736 TEST_f_f (y0, plus_infty, 0);
3738 TEST_f_f (y0, 0.1, -1.5342386513503668441);
3739 TEST_f_f (y0, 0.7, -0.19066492933739506743);
3740 TEST_f_f (y0, 1.0, 0.088256964215676957983);
3741 TEST_f_f (y0, 1.5, 0.38244892379775884396);
3742 TEST_f_f (y0, 2.0, 0.51037567264974511960);
3743 TEST_f_f (y0, 8.0, 0.22352148938756622053);
3744 TEST_f_f (y0, 10.0, 0.055671167283599391424);
3755 if (errno == ENOSYS)
3756 /* Function not implemented. */
3759 /* y1 is the Bessel function of the second kind of order 1 */
3762 TEST_f_f (y1, -1.0, minus_infty);
3763 TEST_f_f (y1, 0.0, minus_infty);
3764 TEST_f_f (y1, plus_infty, 0);
3765 TEST_f_f (y1, nan_value, nan_value);
3767 TEST_f_f (y1, 0.1, -6.4589510947020269877);
3768 TEST_f_f (y1, 0.7, -1.1032498719076333697);
3769 TEST_f_f (y1, 1.0, -0.78121282130028871655);
3770 TEST_f_f (y1, 1.5, -0.41230862697391129595);
3771 TEST_f_f (y1, 2.0, -0.10703243154093754689);
3772 TEST_f_f (y1, 8.0, -0.15806046173124749426);
3773 TEST_f_f (y1, 10.0, 0.24901542420695388392);
3783 if (errno == ENOSYS)
3784 /* Function not implemented. */
3787 /* yn is the Bessel function of the second kind of order n */
3790 /* yn (0, x) == y0 (x) */
3791 TEST_ff_f (yn, 0, -1.0, minus_infty);
3792 TEST_ff_f (yn, 0, 0.0, minus_infty);
3793 TEST_ff_f (yn, 0, nan_value, nan_value);
3794 TEST_ff_f (yn, 0, plus_infty, 0);
3796 TEST_ff_f (yn, 0, 0.1, -1.5342386513503668441);
3797 TEST_ff_f (yn, 0, 0.7, -0.19066492933739506743);
3798 TEST_ff_f (yn, 0, 1.0, 0.088256964215676957983);
3799 TEST_ff_f (yn, 0, 1.5, 0.38244892379775884396);
3800 TEST_ff_f (yn, 0, 2.0, 0.51037567264974511960);
3801 TEST_ff_f (yn, 0, 8.0, 0.22352148938756622053);
3802 TEST_ff_f (yn, 0, 10.0, 0.055671167283599391424);
3804 /* yn (1, x) == y1 (x) */
3805 TEST_ff_f (yn, 1, -1.0, minus_infty);
3806 TEST_ff_f (yn, 1, 0.0, minus_infty);
3807 TEST_ff_f (yn, 1, plus_infty, 0);
3808 TEST_ff_f (yn, 1, nan_value, nan_value);
3810 TEST_ff_f (yn, 1, 0.1, -6.4589510947020269877);
3811 TEST_ff_f (yn, 1, 0.7, -1.1032498719076333697);
3812 TEST_ff_f (yn, 1, 1.0, -0.78121282130028871655);
3813 TEST_ff_f (yn, 1, 1.5, -0.41230862697391129595);
3814 TEST_ff_f (yn, 1, 2.0, -0.10703243154093754689);
3815 TEST_ff_f (yn, 1, 8.0, -0.15806046173124749426);
3816 TEST_ff_f (yn, 1, 10.0, 0.24901542420695388392);
3819 TEST_ff_f (yn, 3, plus_infty, 0);
3820 TEST_ff_f (yn, 3, nan_value, nan_value);
3822 TEST_ff_f (yn, 3, 0.1, -5099.3323786129048894);
3823 TEST_ff_f (yn, 3, 0.7, -15.819479052819633505);
3824 TEST_ff_f (yn, 3, 1.0, -5.8215176059647288478);
3825 TEST_ff_f (yn, 3, 2.0, -1.1277837768404277861);
3826 TEST_ff_f (yn, 3, 10.0, -0.25136265718383732978);
3829 TEST_ff_f (yn, 10, plus_infty, 0);
3830 TEST_ff_f (yn, 10, nan_value, nan_value);
3832 TEST_ff_f (yn, 10, 0.1, -0.11831335132045197885e19);
3833 TEST_ff_f (yn, 10, 0.7, -0.42447194260703866924e10);
3834 TEST_ff_f (yn, 10, 1.0, -0.12161801427868918929e9);
3835 TEST_ff_f (yn, 10, 2.0, -129184.54220803928264);
3836 TEST_ff_f (yn, 10, 10.0, -0.35981415218340272205);
3847 fpstack_test ("start *init*");
3849 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
3851 minus_zero = FUNC(copysign) (0.0, -1.0);
3852 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
3853 HUGE_VALL, HUGE_VAL, HUGE_VALF);
3854 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
3855 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
3861 (void) &minus_infty;
3863 /* Clear all exceptions. From now on we must not get random exceptions. */
3864 feclearexcept (FE_ALL_EXCEPT);
3866 /* Test to make sure we start correctly. */
3867 fpstack_test ("end *init*");
3870 /* Definitions of arguments for argp functions. */
3871 static const struct argp_option options[] =
3873 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
3874 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
3875 { "no-max-error", 'f', NULL, 0,
3876 "Don't output maximal errors of functions"},
3877 { "no-points", 'p', NULL, 0,
3878 "Don't output results of functions invocations"},
3879 { "ignore-max-ulp", 'i', "yes/no", 0,
3880 "Ignore given maximal errors"},
3881 { NULL, 0, NULL, 0, NULL }
3884 /* Short description of program. */
3885 static const char doc[] = "Math test suite: " TEST_MSG ;
3887 /* Prototype for option handler. */
3888 static error_t parse_opt (int key, char *arg, struct argp_state *state);
3890 /* Data structure to communicate with argp functions. */
3891 static struct argp argp =
3893 options, parse_opt, NULL, doc,
3897 /* Handle program arguments. */
3899 parse_opt (int key, char *arg, struct argp_state *state)
3904 output_max_error = 0;
3907 if (strcmp (arg, "yes") == 0)
3909 else if (strcmp (arg, "no") == 0)
3920 verbose = (unsigned int) strtoul (optarg, NULL, 0);
3925 return ARGP_ERR_UNKNOWN;
3931 /* function to check our ulp calculation. */
3938 /* This gives one ulp. */
3939 u = FUNC(nextafter) (10, 20);
3940 check_equal (10.0, u, 1, &diff, &ulp);
3941 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
3943 /* This gives one more ulp. */
3944 u = FUNC(nextafter) (u, 20);
3945 check_equal (10.0, u, 2, &diff, &ulp);
3946 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
3948 /* And now calculate 100 ulp. */
3949 for (i = 2; i < 100; i++)
3950 u = FUNC(nextafter) (u, 20);
3951 check_equal (10.0, u, 100, &diff, &ulp);
3952 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
3957 main (int argc, char **argv)
3964 output_max_error = 1;
3966 /* XXX set to 0 for releases. */
3969 /* Parse and process arguments. */
3970 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
3972 if (remaining != argc)
3974 fprintf (stderr, "wrong number of arguments");
3975 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
3976 exit (EXIT_FAILURE);
3981 ulps_file = fopen ("ULPs", "a");
3982 if (ulps_file == NULL)
3984 perror ("can't open file `ULPs' for writing: ");
3997 /* Keep the tests a wee bit ordered (according to ISO C99). */
3998 /* Classification macros: */
4004 /* Trigonometric functions: */
4014 /* Hyperbolic functions: */
4022 /* Exponential and logarithmic functions: */
4040 /* Power and absolute value functions: */
4047 /* Error and gamma functions: */
4054 /* Nearest integer functions: */
4066 /* Remainder functions: */
4071 /* Manipulation functions: */
4076 /* maximum, minimum and positive difference functions */
4081 /* Multiply and add: */
4084 /* Complex functions: */
4109 /* Bessel functions: */
4120 printf ("\nTest suite completed:\n");
4121 printf (" %d test cases plus %d tests for exception flags executed.\n",
4122 noTests, noExcTests);
4124 printf (" %d expected failures occured.\n", noXFails);
4126 printf (" %d unexpected passes occured.\n", noXPasses);
4129 printf (" %d errors occured.\n", noErrors);
4132 printf (" All tests passed successfully.\n");