1 /* Copyright (C) 1997, 1998, 1999, 2000, 2001 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"
125 /* Possible exceptions */
126 #define NO_EXCEPTION 0x0
127 #define INVALID_EXCEPTION 0x1
128 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
129 /* The next flags signals that those exceptions are allowed but not required. */
130 #define INVALID_EXCEPTION_OK 0x4
131 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x8
132 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
133 /* Some special test flags, passed togther with exceptions. */
134 #define IGNORE_ZERO_INF_SIGN 0x10
136 /* Various constants (we must supply them precalculated for accuracy). */
137 #define M_PI_6l .52359877559829887307710723054658383L
138 #define M_E2l 7.389056098930650227230427460575008L
139 #define M_E3l 20.085536923187667740928529654581719L
140 #define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */
141 #define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
142 #define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
143 #define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
144 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
145 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
146 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
147 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
148 #define M_PI_LOG10El M_PIl * M_LOG10El
150 static FILE *ulps_file; /* File to document difference. */
151 static int output_ulps; /* Should ulps printed? */
153 static int noErrors; /* number of errors */
154 static int noTests; /* number of tests (without testing exceptions) */
155 static int noExcTests; /* number of tests for exception flags */
156 static int noXFails; /* number of expected failures. */
157 static int noXPasses; /* number of unexpected passes. */
160 static int output_max_error; /* Should the maximal errors printed? */
161 static int output_points; /* Should the single function results printed? */
162 static int ignore_max_ulp; /* Should we ignore max_ulp? */
164 static FLOAT minus_zero, plus_zero;
165 static FLOAT plus_infty, minus_infty, nan_value;
167 static FLOAT max_error, real_max_error, imag_max_error;
170 #define BUILD_COMPLEX(real, imag) \
171 ({ __complex__ FLOAT __retval; \
172 __real__ __retval = (real); \
173 __imag__ __retval = (imag); \
176 #define BUILD_COMPLEX_INT(real, imag) \
177 ({ __complex__ int __retval; \
178 __real__ __retval = (real); \
179 __imag__ __retval = (imag); \
183 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
184 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
187 init_max_error (void)
192 feclearexcept (FE_ALL_EXCEPT);
196 set_max_error (FLOAT current, FLOAT *curr_max_error)
198 if (current > *curr_max_error)
199 *curr_max_error = current;
203 /* Should the message print to screen? This depends on the verbose flag,
204 and the test status. */
206 print_screen (int ok, int xfail)
210 || (verbose == 1 && ok == xfail)))
216 /* Should the message print to screen? This depends on the verbose flag,
217 and the test status. */
219 print_screen_max_error (int ok, int xfail)
223 || ((verbose == 1) && (ok == xfail))))
228 /* Update statistic counters. */
230 update_stats (int ok, int xfail)
235 else if (!ok && xfail)
237 else if (!ok && !xfail)
242 print_ulps (const char *test_name, FLOAT ulp)
246 fprintf (ulps_file, "Test \"%s\":\n", test_name);
247 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
248 CHOOSE("ldouble", "double", "float",
249 "ildouble", "idouble", "ifloat"), ulp);
254 print_function_ulps (const char *function_name, FLOAT ulp)
258 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
259 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
260 CHOOSE("ldouble", "double", "float",
261 "ildouble", "idouble", "ifloat"), ulp);
267 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
274 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
275 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
276 CHOOSE("ldouble", "double", "float",
277 "ildouble", "idouble", "ifloat"), real_ulp);
281 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
282 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
283 CHOOSE("ldouble", "double", "float",
284 "ildouble", "idouble", "ifloat"), imag_ulp);
293 /* Test if Floating-Point stack hasn't changed */
295 fpstack_test (const char *test_name)
298 static int old_stack;
301 asm ("fnstsw" : "=a" (sw));
307 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
308 test_name, sw, old_stack);
317 print_max_error (const char *func_name, FLOAT allowed, int xfail)
321 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
327 print_function_ulps (func_name, max_error);
330 if (print_screen_max_error (ok, xfail))
332 printf ("Maximal error of `%s'\n", func_name);
333 printf (" is : % .4" PRINTF_NEXPR " ulp\n", max_error);
334 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", allowed);
337 update_stats (ok, xfail);
342 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
343 __complex__ int xfail)
347 if ((real_max_error <= __real__ allowed)
348 && (imag_max_error <= __imag__ allowed))
354 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
357 if (print_screen_max_error (ok, xfail))
359 printf ("Maximal error of real part of: %s\n", func_name);
360 printf (" is : % .4" PRINTF_NEXPR " ulp\n", real_max_error);
361 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __real__ allowed);
362 printf ("Maximal error of imaginary part of: %s\n", func_name);
363 printf (" is : % .4" PRINTF_NEXPR " ulp\n", imag_max_error);
364 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __imag__ allowed);
367 update_stats (ok, xfail);
371 /* Test whether a given exception was raised. */
373 test_single_exception (const char *test_name,
377 const char *flag_name)
381 if (exception & exc_flag)
383 if (fetestexcept (fe_flag))
385 if (print_screen (1, 0))
386 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
391 if (print_screen (0, 0))
392 printf ("Failure: %s: Exception \"%s\" not set\n",
393 test_name, flag_name);
398 if (fetestexcept (fe_flag))
401 if (print_screen (0, 0))
402 printf ("Failure: %s: Exception \"%s\" set\n",
403 test_name, flag_name);
407 if (print_screen (1, 0))
408 printf ("%s: Exception \"%s\" not set\n", test_name,
419 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
420 allowed but not required exceptions.
423 test_exceptions (const char *test_name, int exception)
427 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
428 test_single_exception (test_name, exception,
429 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
433 if ((exception & INVALID_EXCEPTION_OK) == 0)
434 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
435 "Invalid operation");
437 feclearexcept (FE_ALL_EXCEPT);
442 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
443 FLOAT max_ulp, int xfail, int exceptions,
444 FLOAT *curr_max_error)
451 test_exceptions (test_name, exceptions);
452 if (isnan (computed) && isnan (expected))
454 else if (isinf (computed) && isinf (expected))
456 /* Test for sign of infinities. */
457 if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0)
458 && (isinf (computed) != isinf (expected)))
461 printf ("infinity has wrong sign.\n");
466 /* Don't calc ulp for NaNs or infinities. */
467 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
471 diff = FUNC(fabs) (computed - expected);
472 /* ilogb (0) isn't allowed. */
474 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
476 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
477 set_max_error (ulp, curr_max_error);
479 if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0)
480 && (computed == 0.0 && expected == 0.0
481 && signbit(computed) != signbit (expected)))
483 else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
488 print_ulps (test_name, ulp);
492 if (print_screen (ok, xfail))
495 printf ("Failure: ");
496 printf ("Test: %s\n", test_name);
497 printf ("Result:\n");
498 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
500 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
504 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
506 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
507 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
510 update_stats (ok, xfail);
512 fpstack_test (test_name);
517 check_float (const char *test_name, FLOAT computed, FLOAT expected,
518 FLOAT max_ulp, int xfail, int exceptions)
520 check_float_internal (test_name, computed, expected, max_ulp, xfail,
521 exceptions, &max_error);
526 check_complex (const char *test_name, __complex__ FLOAT computed,
527 __complex__ FLOAT expected,
528 __complex__ FLOAT max_ulp, __complex__ int xfail,
531 FLOAT part_comp, part_exp, part_max_ulp;
535 sprintf (str, "Real part of: %s", test_name);
536 part_comp = __real__ computed;
537 part_exp = __real__ expected;
538 part_max_ulp = __real__ max_ulp;
539 part_xfail = __real__ xfail;
541 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
542 exception, &real_max_error);
544 sprintf (str, "Imaginary part of: %s", test_name);
545 part_comp = __imag__ computed;
546 part_exp = __imag__ expected;
547 part_max_ulp = __imag__ max_ulp;
548 part_xfail = __imag__ xfail;
550 /* Don't check again for exceptions, just pass through the
551 zero/inf sign test. */
552 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
553 exception & IGNORE_ZERO_INF_SIGN,
558 /* Check that computed and expected values are equal (int values). */
560 check_int (const char *test_name, int computed, int expected, int max_ulp,
561 int xfail, int exceptions)
563 int diff = computed - expected;
566 test_exceptions (test_name, exceptions);
568 if (abs (diff) <= max_ulp)
572 print_ulps (test_name, diff);
574 if (print_screen (ok, xfail))
577 printf ("Failure: ");
578 printf ("Test: %s\n", test_name);
579 printf ("Result:\n");
580 printf (" is: %d\n", computed);
581 printf (" should be: %d\n", expected);
584 update_stats (ok, xfail);
585 fpstack_test (test_name);
589 /* Check that computed and expected values are equal (long int values). */
591 check_long (const char *test_name, long int computed, long int expected,
592 long int max_ulp, int xfail, int exceptions)
594 long int diff = computed - expected;
597 test_exceptions (test_name, exceptions);
599 if (labs (diff) <= max_ulp)
603 print_ulps (test_name, diff);
605 if (print_screen (ok, xfail))
608 printf ("Failure: ");
609 printf ("Test: %s\n", test_name);
610 printf ("Result:\n");
611 printf (" is: %ld\n", computed);
612 printf (" should be: %ld\n", expected);
615 update_stats (ok, xfail);
616 fpstack_test (test_name);
620 /* Check that computed value is true/false. */
622 check_bool (const char *test_name, int computed, int expected,
623 long int max_ulp, int xfail, int exceptions)
627 test_exceptions (test_name, exceptions);
629 if ((computed == 0) == (expected == 0))
632 if (print_screen (ok, xfail))
635 printf ("Failure: ");
636 printf ("Test: %s\n", test_name);
637 printf ("Result:\n");
638 printf (" is: %d\n", computed);
639 printf (" should be: %d\n", expected);
642 update_stats (ok, xfail);
643 fpstack_test (test_name);
647 /* check that computed and expected values are equal (long int values) */
649 check_longlong (const char *test_name, long long int computed,
650 long long int expected,
651 long long int max_ulp, int xfail,
654 long long int diff = computed - expected;
657 test_exceptions (test_name, exceptions);
659 if (llabs (diff) <= max_ulp)
663 print_ulps (test_name, diff);
665 if (print_screen (ok, xfail))
669 printf ("Test: %s\n", test_name);
670 printf ("Result:\n");
671 printf (" is: %lld\n", computed);
672 printf (" should be: %lld\n", expected);
675 update_stats (ok, xfail);
676 fpstack_test (test_name);
681 /* This is to prevent messages from the SVID libm emulation. */
683 matherr (struct exception *x __attribute__ ((unused)))
689 /****************************************************************************
690 Tests for single functions of libm.
691 Please keep them alphabetically sorted!
692 ****************************************************************************/
700 /* Function not implemented. */
705 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
706 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
707 TEST_f_f (acos, nan_value, nan_value);
710 TEST_f_f (acos, 1.1L, nan_value, INVALID_EXCEPTION);
711 TEST_f_f (acos, -1.1L, nan_value, INVALID_EXCEPTION);
713 TEST_f_f (acos, 0, M_PI_2l);
714 TEST_f_f (acos, minus_zero, M_PI_2l);
715 TEST_f_f (acos, 1, 0);
716 TEST_f_f (acos, -1, M_PIl);
717 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
718 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
719 TEST_f_f (acos, 0.7L, 0.79539883018414355549096833892476432L);
730 /* Function not implemented. */
735 TEST_f_f (acosh, plus_infty, plus_infty);
736 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
739 TEST_f_f (acosh, -1.1L, nan_value, INVALID_EXCEPTION);
741 TEST_f_f (acosh, 1, 0);
742 TEST_f_f (acosh, 7, 2.633915793849633417250092694615937L);
753 /* Function not implemented. */
758 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
759 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
760 TEST_f_f (asin, nan_value, nan_value);
762 /* asin x == NaN plus invalid exception for |x| > 1. */
763 TEST_f_f (asin, 1.1L, nan_value, INVALID_EXCEPTION);
764 TEST_f_f (asin, -1.1L, nan_value, INVALID_EXCEPTION);
766 TEST_f_f (asin, 0, 0);
767 TEST_f_f (asin, minus_zero, minus_zero);
768 TEST_f_f (asin, 0.5, M_PI_6l);
769 TEST_f_f (asin, -0.5, -M_PI_6l);
770 TEST_f_f (asin, 1.0, M_PI_2l);
771 TEST_f_f (asin, -1.0, -M_PI_2l);
772 TEST_f_f (asin, 0.7L, 0.77539749661075306374035335271498708L);
783 /* Function not implemented. */
788 TEST_f_f (asinh, 0, 0);
789 TEST_f_f (asinh, minus_zero, minus_zero);
791 TEST_f_f (asinh, plus_infty, plus_infty);
792 TEST_f_f (asinh, minus_infty, minus_infty);
794 TEST_f_f (asinh, nan_value, nan_value);
795 TEST_f_f (asinh, 0.7L, 0.652666566082355786L);
806 /* Function not implemented. */
811 TEST_f_f (atan, 0, 0);
812 TEST_f_f (atan, minus_zero, minus_zero);
814 TEST_f_f (atan, plus_infty, M_PI_2l);
815 TEST_f_f (atan, minus_infty, -M_PI_2l);
816 TEST_f_f (atan, nan_value, nan_value);
818 TEST_f_f (atan, 1, M_PI_4l);
819 TEST_f_f (atan, -1, -M_PI_4l);
821 TEST_f_f (atan, 0.7L, 0.61072596438920861654375887649023613L);
834 /* Function not implemented. */
840 TEST_f_f (atanh, 0, 0);
841 TEST_f_f (atanh, minus_zero, minus_zero);
843 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
844 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
845 TEST_f_f (atanh, nan_value, nan_value);
847 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
848 TEST_f_f (atanh, 1.1L, nan_value, INVALID_EXCEPTION);
849 TEST_f_f (atanh, -1.1L, nan_value, INVALID_EXCEPTION);
851 TEST_f_f (atanh, 0.7L, 0.8673005276940531944L);
862 /* Function not implemented. */
867 /* atan2 (0,x) == 0 for x > 0. */
868 TEST_ff_f (atan2, 0, 1, 0);
870 /* atan2 (-0,x) == -0 for x > 0. */
871 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
873 TEST_ff_f (atan2, 0, 0, 0);
874 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
876 /* atan2 (+0,x) == +pi for x < 0. */
877 TEST_ff_f (atan2, 0, -1, M_PIl);
879 /* atan2 (-0,x) == -pi for x < 0. */
880 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
882 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
883 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
885 /* atan2 (y,+0) == pi/2 for y > 0. */
886 TEST_ff_f (atan2, 1, 0, M_PI_2l);
888 /* atan2 (y,-0) == pi/2 for y > 0. */
889 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
891 /* atan2 (y,+0) == -pi/2 for y < 0. */
892 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
894 /* atan2 (y,-0) == -pi/2 for y < 0. */
895 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
897 /* atan2 (y,inf) == +0 for finite y > 0. */
898 TEST_ff_f (atan2, 1, plus_infty, 0);
900 /* atan2 (y,inf) == -0 for finite y < 0. */
901 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
903 /* atan2(+inf, x) == pi/2 for finite x. */
904 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
906 /* atan2(-inf, x) == -pi/2 for finite x. */
907 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
909 /* atan2 (y,-inf) == +pi for finite y > 0. */
910 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
912 /* atan2 (y,-inf) == -pi for finite y < 0. */
913 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
915 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
916 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
917 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
918 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
919 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
921 TEST_ff_f (atan2, 0.7L, 1, 0.61072596438920861654375887649023613L);
922 TEST_ff_f (atan2, -0.7L, 1.0L, -0.61072596438920861654375887649023613L);
923 TEST_ff_f (atan2, 0.7L, -1.0L, 2.530866689200584621918884506789267L);
924 TEST_ff_f (atan2, -0.7L, -1.0L, -2.530866689200584621918884506789267L);
925 TEST_ff_f (atan2, 0.4L, 0.0003L, 1.5700463269355215717704032607580829L);
926 TEST_ff_f (atan2, 1.4L, -0.93L, 2.1571487668237843754887415992772736L);
936 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
938 /* Function not implemented. */
943 /* cabs (x + iy) is specified as hypot (x,y) */
945 /* cabs (+inf + i x) == +inf. */
946 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
947 /* cabs (-inf + i x) == +inf. */
948 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
950 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
951 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
953 TEST_c_f (cabs, nan_value, nan_value, nan_value);
955 /* cabs (x,y) == cabs (y,x). */
956 TEST_c_f (cabs, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
957 /* cabs (x,y) == cabs (-x,y). */
958 TEST_c_f (cabs, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
959 /* cabs (x,y) == cabs (-y,x). */
960 TEST_c_f (cabs, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
961 /* cabs (x,y) == cabs (-x,-y). */
962 TEST_c_f (cabs, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
963 /* cabs (x,y) == cabs (-y,-x). */
964 TEST_c_f (cabs, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
965 /* cabs (x,0) == fabs (x). */
966 TEST_c_f (cabs, -0.7L, 0, 0.7L);
967 TEST_c_f (cabs, 0.7L, 0, 0.7L);
968 TEST_c_f (cabs, -1.0L, 0, 1.0L);
969 TEST_c_f (cabs, 1.0L, 0, 1.0L);
970 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
971 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
973 TEST_c_f (cabs, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
982 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
984 /* Function not implemented. */
990 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
991 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
992 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
993 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
995 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
996 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
998 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
999 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1001 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1002 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1003 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1004 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1005 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1006 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1008 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1009 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1010 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1011 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1013 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1014 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1015 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1016 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1018 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1019 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1021 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1022 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1024 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1025 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1027 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1028 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1030 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1031 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1033 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1035 TEST_c_c (cacos, 0.7L, 1.2L, 1.1351827477151551088992008271819053L, -1.0927647857577371459105272080819308L);
1036 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1038 END (cacos, complex);
1046 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1047 if (errno == ENOSYS)
1048 /* Function not implemented. */
1054 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1055 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1056 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1057 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1058 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1059 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1061 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1062 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1064 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1065 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1066 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1067 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1068 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1069 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1071 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1072 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1073 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1074 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1076 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1077 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1078 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1079 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1081 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1082 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1084 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1085 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1087 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1088 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1090 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1091 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1093 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1094 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1096 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1098 TEST_c_c (cacosh, 0.7L, 1.2L, 1.0927647857577371459105272080819308L, 1.1351827477151551088992008271819053L);
1099 TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
1101 END (cacosh, complex);
1109 /* carg (x + iy) is specified as atan2 (y, x) */
1111 /* carg (x + i 0) == 0 for x > 0. */
1112 TEST_c_f (carg, 2.0, 0, 0);
1113 /* carg (x - i 0) == -0 for x > 0. */
1114 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1116 TEST_c_f (carg, 0, 0, 0);
1117 TEST_c_f (carg, 0, minus_zero, minus_zero);
1119 /* carg (x + i 0) == +pi for x < 0. */
1120 TEST_c_f (carg, -2.0, 0, M_PIl);
1122 /* carg (x - i 0) == -pi for x < 0. */
1123 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1125 TEST_c_f (carg, minus_zero, 0, M_PIl);
1126 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1128 /* carg (+0 + i y) == pi/2 for y > 0. */
1129 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1131 /* carg (-0 + i y) == pi/2 for y > 0. */
1132 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1134 /* carg (+0 + i y) == -pi/2 for y < 0. */
1135 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1137 /* carg (-0 + i y) == -pi/2 for y < 0. */
1138 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1140 /* carg (inf + i y) == +0 for finite y > 0. */
1141 TEST_c_f (carg, plus_infty, 2.0, 0);
1143 /* carg (inf + i y) == -0 for finite y < 0. */
1144 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1146 /* carg(x + i inf) == pi/2 for finite x. */
1147 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1149 /* carg(x - i inf) == -pi/2 for finite x. */
1150 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1152 /* carg (-inf + i y) == +pi for finite y > 0. */
1153 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1155 /* carg (-inf + i y) == -pi for finite y < 0. */
1156 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1158 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1160 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1162 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1164 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1166 TEST_c_f (carg, nan_value, nan_value, nan_value);
1175 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1176 if (errno == ENOSYS)
1177 /* Function not implemented. */
1182 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1183 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1184 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1185 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1187 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1188 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1189 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1190 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1192 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1193 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1194 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1195 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1196 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1197 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1198 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1199 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1201 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1202 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1203 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1204 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1206 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1207 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1208 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1209 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1211 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1212 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1214 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1215 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1217 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1218 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1220 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1221 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1223 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1224 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1226 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1228 TEST_c_c (casin, 0.7L, 1.2L, 0.4356135790797415103321208644578462L, 1.0927647857577371459105272080819308L);
1229 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1231 END (casin, complex);
1239 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1240 if (errno == ENOSYS)
1241 /* Function not implemented. */
1246 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1247 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1248 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1249 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1251 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1252 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1253 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1254 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1256 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1257 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1258 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1259 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1260 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1261 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1262 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1263 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1265 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1266 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1267 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1268 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1270 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1271 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1272 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1273 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1275 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1276 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1278 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1279 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1281 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1282 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1284 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1285 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1287 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1288 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1290 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1292 TEST_c_c (casinh, 0.7L, 1.2L, 0.97865459559367387689317593222160964L, 0.91135418953156011567903546856170941L);
1293 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1295 END (casinh, complex);
1303 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1304 if (errno == ENOSYS)
1305 /* Function not implemented. */
1310 TEST_c_c (catan, 0, 0, 0, 0);
1311 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1312 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1313 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1315 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1316 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1317 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1318 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1321 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1322 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1323 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1324 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1325 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1326 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1327 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1328 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1330 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1331 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1332 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1333 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1335 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1336 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1337 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1338 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1340 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1341 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1343 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1344 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1346 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1347 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1349 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1350 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1352 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1353 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1355 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1356 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1358 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1360 TEST_c_c (catan, 0.7L, 1.2L, 1.0785743834118921877443707996386368L, 0.57705737765343067644394541889341712L);
1362 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1364 END (catan, complex);
1371 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1372 if (errno == ENOSYS)
1373 /* Function not implemented. */
1378 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1379 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1380 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1381 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1383 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1384 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1385 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1386 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1388 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1389 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1390 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1391 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1392 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1393 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1394 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1395 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1397 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1398 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1399 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1400 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1402 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1403 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1404 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1405 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1407 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1408 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1410 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1411 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1413 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1414 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1416 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1417 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1419 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1420 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1422 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1423 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1425 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1427 TEST_c_c (catanh, 0.7L, 1.2L, 0.2600749516525135959200648705635915L, 0.97024030779509898497385130162655963L);
1428 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1430 END (catanh, complex);
1438 if (errno == ENOSYS)
1439 /* Function not implemented. */
1444 TEST_f_f (cbrt, 0.0, 0.0);
1445 TEST_f_f (cbrt, minus_zero, minus_zero);
1447 TEST_f_f (cbrt, plus_infty, plus_infty);
1448 TEST_f_f (cbrt, minus_infty, minus_infty);
1449 TEST_f_f (cbrt, nan_value, nan_value);
1451 TEST_f_f (cbrt, -0.001L, -0.1L);
1452 TEST_f_f (cbrt, 8, 2);
1453 TEST_f_f (cbrt, -27.0, -3.0);
1454 TEST_f_f (cbrt, 0.970299L, 0.99L);
1455 TEST_f_f (cbrt, 0.7L, 0.8879040017426007084L);
1464 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1465 if (errno == ENOSYS)
1466 /* Function not implemented. */
1471 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1472 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1473 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1474 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1476 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1477 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1478 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1479 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1481 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1482 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1483 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1484 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1486 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1487 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1488 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1489 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1491 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1492 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1493 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1494 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1496 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1497 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1498 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1499 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1501 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1502 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1504 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1505 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1507 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1508 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1510 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1511 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1513 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1514 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1516 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1517 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1519 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1521 TEST_c_c (ccos, 0.7L, 1.2L, 1.3848657645312111080L, -0.97242170335830028619L);
1523 TEST_c_c (ccos, -2, -3, -4.1896256909688072301L, -9.1092278937553365979L);
1525 END (ccos, complex);
1533 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1534 if (errno == ENOSYS)
1535 /* Function not implemented. */
1540 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1541 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1542 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1543 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1545 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1546 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1547 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1548 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1550 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1551 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1552 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1553 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1555 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1556 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1557 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1558 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1560 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1561 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1562 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1563 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1565 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1566 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1567 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1568 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1570 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1571 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1573 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1574 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1576 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1577 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1579 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1580 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1582 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1583 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1585 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1586 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1588 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1590 TEST_c_c (ccosh, 0.7L, 1.2L, 0.4548202223691477654L, 0.7070296600921537682L);
1592 TEST_c_c (ccosh, -2, -3, -3.7245455049153225654L, 0.5118225699873846088L);
1594 END (ccosh, complex);
1603 TEST_f_f (ceil, 0.0, 0.0);
1604 TEST_f_f (ceil, minus_zero, minus_zero);
1605 TEST_f_f (ceil, plus_infty, plus_infty);
1606 TEST_f_f (ceil, minus_infty, minus_infty);
1607 TEST_f_f (ceil, nan_value, nan_value);
1609 TEST_f_f (ceil, M_PIl, 4.0);
1610 TEST_f_f (ceil, -M_PIl, -3.0);
1620 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1621 if (errno == ENOSYS)
1622 /* Function not implemented. */
1627 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1628 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1629 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1630 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1632 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1633 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1635 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1636 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1638 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1639 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1641 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1642 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1644 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1645 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1647 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1648 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1650 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1651 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1652 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1653 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1655 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1656 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1658 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1659 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1661 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1663 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1665 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1666 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1668 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1669 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1670 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1671 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1673 TEST_c_c (cexp, 0.7L, 1.2L, 0.72969890915032360123451688642930727L, 1.8768962328348102821139467908203072L);
1674 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1676 END (cexp, complex);
1683 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1684 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1685 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1686 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1687 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1688 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1689 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1698 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1699 if (errno == ENOSYS)
1700 /* Function not implemented. */
1705 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1706 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1708 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1709 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1711 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1712 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1714 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1715 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1717 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1718 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1719 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1720 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1721 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1722 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1723 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1724 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1726 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1727 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1728 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1729 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1731 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1732 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1733 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1734 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1736 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1737 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1739 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1740 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1742 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1743 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1744 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1745 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1747 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1748 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1749 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1750 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1752 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1753 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1755 END (clog, complex);
1763 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1764 if (errno == ENOSYS)
1765 /* Function not implemented. */
1770 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1771 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1773 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1774 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1776 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1778 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1779 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1781 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1782 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1783 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1784 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1785 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1786 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1787 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1788 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1790 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1791 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1792 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1793 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1795 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1796 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1797 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1798 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1800 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1801 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1803 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1804 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1806 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1807 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1808 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1809 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1811 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1812 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1813 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1814 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1816 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1818 TEST_c_c (clog10, 0.7L, 1.2L, 0.1427786545038868803L, 0.4528483579352493248L);
1819 TEST_c_c (clog10, -2, -3, 0.5569716761534183846L, -0.9375544629863747085L);
1821 END (clog10, complex);
1828 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1829 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1830 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1831 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1832 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1833 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1834 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1836 END (conj, complex);
1841 copysign_test (void)
1845 TEST_ff_f (copysign, 0, 4, 0);
1846 TEST_ff_f (copysign, 0, -4, minus_zero);
1847 TEST_ff_f (copysign, minus_zero, 4, 0);
1848 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1850 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1851 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1852 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1853 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1855 TEST_ff_f (copysign, 0, plus_infty, 0);
1856 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1857 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1858 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1860 /* XXX More correctly we would have to check the sign of the NaN. */
1861 TEST_ff_f (copysign, nan_value, 0, nan_value);
1862 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1863 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1864 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1874 if (errno == ENOSYS)
1875 /* Function not implemented. */
1880 TEST_f_f (cos, 0, 1);
1881 TEST_f_f (cos, minus_zero, 1);
1882 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1883 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1884 TEST_f_f (cos, nan_value, nan_value);
1886 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1887 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1888 TEST_f_f (cos, M_PI_2l, 0);
1890 TEST_f_f (cos, 0.7L, 0.76484218728448842625585999019186495L);
1900 if (errno == ENOSYS)
1901 /* Function not implemented. */
1905 TEST_f_f (cosh, 0, 1);
1906 TEST_f_f (cosh, minus_zero, 1);
1909 TEST_f_f (cosh, plus_infty, plus_infty);
1910 TEST_f_f (cosh, minus_infty, plus_infty);
1912 TEST_f_f (cosh, nan_value, nan_value);
1914 TEST_f_f (cosh, 0.7L, 1.255169005630943018L);
1923 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
1924 if (errno == ENOSYS)
1925 /* Function not implemented. */
1930 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
1931 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
1933 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
1934 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
1936 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
1938 END (cpow, complex);
1945 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
1946 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
1947 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
1948 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
1950 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
1952 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
1953 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
1954 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
1955 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
1957 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
1958 TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
1960 END (cproj, complex);
1967 TEST_c_f (creal, 0.0, 1.0, 0.0);
1968 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
1969 TEST_c_f (creal, nan_value, 1.0, nan_value);
1970 TEST_c_f (creal, nan_value, nan_value, nan_value);
1971 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
1972 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
1973 TEST_c_f (creal, 2.0, 3.0, 2.0);
1982 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
1983 if (errno == ENOSYS)
1984 /* Function not implemented. */
1989 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
1990 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
1991 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
1992 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
1994 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
1995 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
1996 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
1997 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
1999 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2000 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2001 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2002 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2004 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2005 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2006 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2007 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2009 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2010 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2011 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2012 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2014 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2015 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2016 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2017 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2019 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2020 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2022 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2023 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2025 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2026 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2028 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2029 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2031 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2032 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2034 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2035 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2037 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2039 TEST_c_c (csin, 0.7L, 1.2L, 1.1664563419657581376L, 1.1544997246948547371L);
2041 TEST_c_c (csin, -2, -3, -9.1544991469114295734L, 4.1689069599665643507L);
2043 END (csin, complex);
2051 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2052 if (errno == ENOSYS)
2053 /* Function not implemented. */
2058 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2059 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2060 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2061 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2063 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2064 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2065 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2066 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2068 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2069 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2070 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2071 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2073 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2074 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2075 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2076 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2078 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2079 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2080 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2081 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2083 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2084 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2085 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2086 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2088 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2089 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2091 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2092 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2094 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2095 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2097 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2098 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2100 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2101 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2103 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2104 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2106 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2108 TEST_c_c (csinh, 0.7L, 1.2L, 0.27487868678117583582L, 1.1698665727426565139L);
2109 TEST_c_c (csinh, -2, -3, 3.5905645899857799520L, -0.5309210862485198052L);
2111 END (csinh, complex);
2118 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2119 if (errno == ENOSYS)
2120 /* Function not implemented. */
2125 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2126 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2127 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2128 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2130 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2131 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2132 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2133 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2135 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2136 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2137 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2138 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2140 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2141 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2142 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2143 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2144 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2145 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2146 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2147 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2148 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2149 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2150 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2151 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2153 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2155 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2157 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2158 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2159 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2160 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2162 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2163 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2164 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2165 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2167 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2169 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2170 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2171 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2172 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2173 TEST_c_c (csqrt, 0.7L, 1.2L, 1.022067610030026450706487883081139L, 0.58704531296356521154977678719838035L);
2174 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2175 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2177 END (csqrt, complex);
2184 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2185 if (errno == ENOSYS)
2186 /* Function not implemented. */
2191 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2192 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2193 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2194 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2196 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2197 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2198 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2199 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2201 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2202 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2203 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2204 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2206 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2207 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2208 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2209 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2210 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2211 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2212 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2213 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2215 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2216 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2218 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2219 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2221 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2222 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2224 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2225 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2226 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2227 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2229 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2231 TEST_c_c (ctan, 0.7L, 1.2L, 0.1720734197630349001L, 0.9544807059989405538L);
2232 TEST_c_c (ctan, -2, -3, 0.0037640256415042482L, -1.0032386273536098014L);
2234 END (ctan, complex);
2242 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2243 if (errno == ENOSYS)
2244 /* Function not implemented. */
2249 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2250 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2251 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2252 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2254 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2255 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2256 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2257 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2258 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2259 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2260 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2261 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2263 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2264 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2265 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2266 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2267 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2268 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2269 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2270 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2272 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2273 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2275 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2276 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2278 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2279 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2281 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2282 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2283 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2284 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2286 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2288 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2290 TEST_c_c (ctanh, 0.7L, 1.2L, 1.3472197399061191630L, 0.4778641038326365540L);
2291 TEST_c_c (ctanh, -2, -3, -0.9653858790221331242L, 0.0098843750383224937L);
2293 END (ctanh, complex);
2301 if (errno == ENOSYS)
2302 /* Function not implemented. */
2307 TEST_f_f (erf, 0, 0);
2308 TEST_f_f (erf, minus_zero, minus_zero);
2309 TEST_f_f (erf, plus_infty, 1);
2310 TEST_f_f (erf, minus_infty, -1);
2311 TEST_f_f (erf, nan_value, nan_value);
2313 TEST_f_f (erf, 0.7L, 0.67780119383741847297L);
2315 TEST_f_f (erf, 1.2L, 0.91031397822963538024L);
2316 TEST_f_f (erf, 2.0, 0.99532226501895273416L);
2317 TEST_f_f (erf, 4.1L, 0.99999999329997234592L);
2318 TEST_f_f (erf, 27, 1.0L);
2329 if (errno == ENOSYS)
2330 /* Function not implemented. */
2335 TEST_f_f (erfc, plus_infty, 0.0);
2336 TEST_f_f (erfc, minus_infty, 2.0);
2337 TEST_f_f (erfc, 0.0, 1.0);
2338 TEST_f_f (erfc, minus_zero, 1.0);
2339 TEST_f_f (erfc, nan_value, nan_value);
2341 TEST_f_f (erfc, 0.7L, 0.32219880616258152702L);
2343 TEST_f_f (erfc, 1.2L, 0.089686021770364619762L);
2344 TEST_f_f (erfc, 2.0, 0.0046777349810472658379L);
2345 TEST_f_f (erfc, 4.1L, 0.67000276540848983727e-8L);
2346 TEST_f_f (erfc, 9, 0.41370317465138102381e-36L);
2356 if (errno == ENOSYS)
2357 /* Function not implemented. */
2362 TEST_f_f (exp, 0, 1);
2363 TEST_f_f (exp, minus_zero, 1);
2366 TEST_f_f (exp, plus_infty, plus_infty);
2367 TEST_f_f (exp, minus_infty, 0);
2369 TEST_f_f (exp, nan_value, nan_value);
2370 TEST_f_f (exp, 1, M_El);
2372 TEST_f_f (exp, 2, M_E2l);
2373 TEST_f_f (exp, 3, M_E3l);
2374 TEST_f_f (exp, 0.7L, 2.0137527074704765216L);
2385 if (errno == ENOSYS)
2386 /* Function not implemented. */
2391 TEST_f_f (exp10, 0, 1);
2392 TEST_f_f (exp10, minus_zero, 1);
2394 TEST_f_f (exp10, plus_infty, plus_infty);
2395 TEST_f_f (exp10, minus_infty, 0);
2396 TEST_f_f (exp10, nan_value, nan_value);
2397 TEST_f_f (exp10, 3, 1000);
2398 TEST_f_f (exp10, -1, 0.1L);
2399 TEST_f_f (exp10, 1e6, plus_infty);
2400 TEST_f_f (exp10, -1e6, 0);
2401 TEST_f_f (exp10, 0.7L, 5.0118723362727228500155418688494574L);
2411 if (errno == ENOSYS)
2412 /* Function not implemented. */
2417 TEST_f_f (exp2, 0, 1);
2418 TEST_f_f (exp2, minus_zero, 1);
2419 TEST_f_f (exp2, plus_infty, plus_infty);
2420 TEST_f_f (exp2, minus_infty, 0);
2421 TEST_f_f (exp2, nan_value, nan_value);
2423 TEST_f_f (exp2, 10, 1024);
2424 TEST_f_f (exp2, -1, 0.5);
2425 TEST_f_f (exp2, 1e6, plus_infty);
2426 TEST_f_f (exp2, -1e6, 0);
2427 TEST_f_f (exp2, 0.7L, 1.6245047927124710452L);
2437 if (errno == ENOSYS)
2438 /* Function not implemented. */
2443 TEST_f_f (expm1, 0, 0);
2444 TEST_f_f (expm1, minus_zero, minus_zero);
2447 TEST_f_f (expm1, plus_infty, plus_infty);
2448 TEST_f_f (expm1, minus_infty, -1);
2450 TEST_f_f (expm1, nan_value, nan_value);
2452 TEST_f_f (expm1, 1, M_El - 1.0);
2453 TEST_f_f (expm1, 0.7L, 1.0137527074704765216L);
2463 TEST_f_f (fabs, 0, 0);
2464 TEST_f_f (fabs, minus_zero, 0);
2466 TEST_f_f (fabs, plus_infty, plus_infty);
2467 TEST_f_f (fabs, minus_infty, plus_infty);
2468 TEST_f_f (fabs, nan_value, nan_value);
2470 TEST_f_f (fabs, 38.0, 38.0);
2471 TEST_f_f (fabs, -M_El, M_El);
2481 TEST_ff_f (fdim, 0, 0, 0);
2482 TEST_ff_f (fdim, 9, 0, 9);
2483 TEST_ff_f (fdim, 0, 9, 0);
2484 TEST_ff_f (fdim, -9, 0, 0);
2485 TEST_ff_f (fdim, 0, -9, 9);
2487 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2488 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2489 TEST_ff_f (fdim, minus_infty, 9, 0);
2490 TEST_ff_f (fdim, minus_infty, -9, 0);
2491 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2492 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2493 TEST_ff_f (fdim, 9, plus_infty, 0);
2494 TEST_ff_f (fdim, -9, plus_infty, 0);
2496 TEST_ff_f (fdim, 0, nan_value, nan_value);
2497 TEST_ff_f (fdim, 9, nan_value, nan_value);
2498 TEST_ff_f (fdim, -9, nan_value, nan_value);
2499 TEST_ff_f (fdim, nan_value, 9, nan_value);
2500 TEST_ff_f (fdim, nan_value, -9, nan_value);
2501 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2502 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2503 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2504 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2505 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2515 TEST_f_f (floor, 0.0, 0.0);
2516 TEST_f_f (floor, minus_zero, minus_zero);
2517 TEST_f_f (floor, plus_infty, plus_infty);
2518 TEST_f_f (floor, minus_infty, minus_infty);
2519 TEST_f_f (floor, nan_value, nan_value);
2521 TEST_f_f (floor, M_PIl, 3.0);
2522 TEST_f_f (floor, -M_PIl, -4.0);
2532 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2533 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2534 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2535 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2536 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2537 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2538 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2539 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2540 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2541 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2542 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2543 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2545 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2546 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2547 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2548 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2559 TEST_ff_f (fmax, 0, 0, 0);
2560 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2561 TEST_ff_f (fmax, 9, 0, 9);
2562 TEST_ff_f (fmax, 0, 9, 9);
2563 TEST_ff_f (fmax, -9, 0, 0);
2564 TEST_ff_f (fmax, 0, -9, 0);
2566 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2567 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2568 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2569 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2571 TEST_ff_f (fmax, minus_infty, 9, 9);
2572 TEST_ff_f (fmax, minus_infty, -9, -9);
2573 TEST_ff_f (fmax, 9, minus_infty, 9);
2574 TEST_ff_f (fmax, -9, minus_infty, -9);
2576 TEST_ff_f (fmax, 0, nan_value, 0);
2577 TEST_ff_f (fmax, 9, nan_value, 9);
2578 TEST_ff_f (fmax, -9, nan_value, -9);
2579 TEST_ff_f (fmax, nan_value, 0, 0);
2580 TEST_ff_f (fmax, nan_value, 9, 9);
2581 TEST_ff_f (fmax, nan_value, -9, -9);
2582 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2583 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2584 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2585 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2586 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2597 TEST_ff_f (fmin, 0, 0, 0);
2598 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2599 TEST_ff_f (fmin, 9, 0, 0);
2600 TEST_ff_f (fmin, 0, 9, 0);
2601 TEST_ff_f (fmin, -9, 0, -9);
2602 TEST_ff_f (fmin, 0, -9, -9);
2604 TEST_ff_f (fmin, plus_infty, 9, 9);
2605 TEST_ff_f (fmin, 9, plus_infty, 9);
2606 TEST_ff_f (fmin, plus_infty, -9, -9);
2607 TEST_ff_f (fmin, -9, plus_infty, -9);
2608 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2609 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2610 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2611 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2613 TEST_ff_f (fmin, 0, nan_value, 0);
2614 TEST_ff_f (fmin, 9, nan_value, 9);
2615 TEST_ff_f (fmin, -9, nan_value, -9);
2616 TEST_ff_f (fmin, nan_value, 0, 0);
2617 TEST_ff_f (fmin, nan_value, 9, 9);
2618 TEST_ff_f (fmin, nan_value, -9, -9);
2619 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2620 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2621 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2622 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2623 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2633 FUNC(fmod) (6.5, 2.3L);
2634 if (errno == ENOSYS)
2635 /* Function not implemented. */
2640 /* fmod (+0, y) == +0 for y != 0. */
2641 TEST_ff_f (fmod, 0, 3, 0);
2643 /* fmod (-0, y) == -0 for y != 0. */
2644 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2646 /* fmod (+inf, y) == NaN plus invalid exception. */
2647 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2648 /* fmod (-inf, y) == NaN plus invalid exception. */
2649 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2650 /* fmod (x, +0) == NaN plus invalid exception. */
2651 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2652 /* fmod (x, -0) == NaN plus invalid exception. */
2653 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2655 /* fmod (x, +inf) == x for x not infinite. */
2656 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2657 /* fmod (x, -inf) == x for x not infinite. */
2658 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2660 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2662 TEST_ff_f (fmod, 6.5, 2.3L, 1.9L);
2663 TEST_ff_f (fmod, -6.5, 2.3L, -1.9L);
2664 TEST_ff_f (fmod, 6.5, -2.3L, 1.9L);
2665 TEST_ff_f (fmod, -6.5, -2.3L, -1.9L);
2671 fpclassify_test (void)
2675 TEST_f_i (fpclassify, nan_value, FP_NAN);
2676 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2677 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2678 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2679 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2680 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2693 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2694 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2695 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2697 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2698 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2700 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
2701 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
2713 if (errno == ENOSYS)
2714 /* Function not implemented. */
2716 feclearexcept (FE_ALL_EXCEPT);
2720 TEST_f_f (gamma, plus_infty, plus_infty);
2721 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2722 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2723 TEST_f_f (gamma, minus_infty, plus_infty);
2724 TEST_f_f (gamma, nan_value, nan_value);
2726 TEST_f_f1 (gamma, 1, 0, 1);
2727 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2729 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2730 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2739 FUNC(hypot) (0.7L, 12.4L);
2740 if (errno == ENOSYS)
2741 /* Function not implemented. */
2746 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2747 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2750 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2751 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2752 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2753 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2756 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2758 /* hypot (x,y) == hypot (+-x, +-y) */
2759 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
2760 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
2761 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
2762 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
2763 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
2764 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
2765 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
2766 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
2768 /* hypot (x,0) == fabs (x) */
2769 TEST_ff_f (hypot, 0.7L, 0, 0.7L);
2770 TEST_ff_f (hypot, -0.7L, 0, 0.7L);
2771 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
2773 TEST_ff_f (hypot, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
2784 TEST_f_i (ilogb, 1, 0);
2785 TEST_f_i (ilogb, M_El, 1);
2786 TEST_f_i (ilogb, 1024, 10);
2787 TEST_f_i (ilogb, -2000, 10);
2789 /* XXX We have a problem here: the standard does not tell us whether
2790 exceptions are allowed/required. ignore them for now. */
2792 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
2793 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
2799 isfinite_test (void)
2803 TEST_f_b (isfinite, 0, 1);
2804 TEST_f_b (isfinite, minus_zero, 1);
2805 TEST_f_b (isfinite, 10, 1);
2806 TEST_f_b (isfinite, plus_infty, 0);
2807 TEST_f_b (isfinite, minus_infty, 0);
2808 TEST_f_b (isfinite, nan_value, 0);
2814 isnormal_test (void)
2818 TEST_f_b (isnormal, 0, 0);
2819 TEST_f_b (isnormal, minus_zero, 0);
2820 TEST_f_b (isnormal, 10, 1);
2821 TEST_f_b (isnormal, plus_infty, 0);
2822 TEST_f_b (isnormal, minus_infty, 0);
2823 TEST_f_b (isnormal, nan_value, 0);
2833 FUNC (sincos) (0, &s, &c);
2834 if (errno == ENOSYS)
2835 /* Required function not implemented. */
2838 if (errno == ENOSYS)
2839 /* Function not implemented. */
2844 /* j0 is the Bessel function of the first kind of order 0 */
2845 TEST_f_f (j0, nan_value, nan_value);
2846 TEST_f_f (j0, plus_infty, 0);
2847 TEST_f_f (j0, -1.0, 0.76519768655796655145L);
2848 TEST_f_f (j0, 0.0, 1.0);
2849 TEST_f_f (j0, 0.1L, 0.99750156206604003228L);
2850 TEST_f_f (j0, 0.7L, 0.88120088860740528084L);
2851 TEST_f_f (j0, 1.0, 0.76519768655796655145L);
2852 TEST_f_f (j0, 1.5, 0.51182767173591812875L);
2853 TEST_f_f (j0, 2.0, 0.22389077914123566805L);
2854 TEST_f_f (j0, 8.0, 0.17165080713755390609L);
2855 TEST_f_f (j0, 10.0, -0.24593576445134833520L);
2866 FUNC (sincos) (0, &s, &c);
2867 if (errno == ENOSYS)
2868 /* Required function not implemented. */
2871 if (errno == ENOSYS)
2872 /* Function not implemented. */
2875 /* j1 is the Bessel function of the first kind of order 1 */
2879 TEST_f_f (j1, nan_value, nan_value);
2880 TEST_f_f (j1, plus_infty, 0);
2882 TEST_f_f (j1, -1.0, -0.44005058574493351596L);
2883 TEST_f_f (j1, 0.0, 0.0);
2884 TEST_f_f (j1, 0.1L, 0.049937526036241997556L);
2885 TEST_f_f (j1, 0.7L, 0.32899574154005894785L);
2886 TEST_f_f (j1, 1.0, 0.44005058574493351596L);
2887 TEST_f_f (j1, 1.5, 0.55793650791009964199L);
2888 TEST_f_f (j1, 2.0, 0.57672480775687338720L);
2889 TEST_f_f (j1, 8.0, 0.23463634685391462438L);
2890 TEST_f_f (j1, 10.0, 0.043472746168861436670L);
2900 FUNC (sincos) (0, &s, &c);
2901 if (errno == ENOSYS)
2902 /* Required function not implemented. */
2905 if (errno == ENOSYS)
2906 /* Function not implemented. */
2909 /* jn is the Bessel function of the first kind of order n. */
2912 /* jn (0, x) == j0 (x) */
2913 TEST_ff_f (jn, 0, nan_value, nan_value);
2914 TEST_ff_f (jn, 0, plus_infty, 0);
2915 TEST_ff_f (jn, 0, -1.0, 0.76519768655796655145L);
2916 TEST_ff_f (jn, 0, 0.0, 1.0);
2917 TEST_ff_f (jn, 0, 0.1L, 0.99750156206604003228L);
2918 TEST_ff_f (jn, 0, 0.7L, 0.88120088860740528084L);
2919 TEST_ff_f (jn, 0, 1.0, 0.76519768655796655145L);
2920 TEST_ff_f (jn, 0, 1.5, 0.51182767173591812875L);
2921 TEST_ff_f (jn, 0, 2.0, 0.22389077914123566805L);
2922 TEST_ff_f (jn, 0, 8.0, 0.17165080713755390609L);
2923 TEST_ff_f (jn, 0, 10.0, -0.24593576445134833520L);
2925 /* jn (1, x) == j1 (x) */
2926 TEST_ff_f (jn, 1, nan_value, nan_value);
2927 TEST_ff_f (jn, 1, plus_infty, 0);
2929 TEST_ff_f (jn, 1, -1.0, -0.44005058574493351596L);
2930 TEST_ff_f (jn, 1, 0.0, 0.0);
2931 TEST_ff_f (jn, 1, 0.1L, 0.049937526036241997556L);
2932 TEST_ff_f (jn, 1, 0.7L, 0.32899574154005894785L);
2933 TEST_ff_f (jn, 1, 1.0, 0.44005058574493351596L);
2934 TEST_ff_f (jn, 1, 1.5, 0.55793650791009964199L);
2935 TEST_ff_f (jn, 1, 2.0, 0.57672480775687338720L);
2936 TEST_ff_f (jn, 1, 8.0, 0.23463634685391462438L);
2937 TEST_ff_f (jn, 1, 10.0, 0.043472746168861436670L);
2940 TEST_ff_f (jn, 3, nan_value, nan_value);
2941 TEST_ff_f (jn, 3, plus_infty, 0);
2943 TEST_ff_f (jn, 3, -1.0, -0.019563353982668405919L);
2944 TEST_ff_f (jn, 3, 0.0, 0.0);
2945 TEST_ff_f (jn, 3, 0.1L, 0.000020820315754756261429L);
2946 TEST_ff_f (jn, 3, 0.7L, 0.0069296548267508408077L);
2947 TEST_ff_f (jn, 3, 1.0, 0.019563353982668405919L);
2948 TEST_ff_f (jn, 3, 2.0, 0.12894324947440205110L);
2949 TEST_ff_f (jn, 3, 10.0, 0.058379379305186812343L);
2952 TEST_ff_f (jn, 10, nan_value, nan_value);
2953 TEST_ff_f (jn, 10, plus_infty, 0);
2955 TEST_ff_f (jn, 10, -1.0, 0.26306151236874532070e-9L);
2956 TEST_ff_f (jn, 10, 0.0, 0.0);
2957 TEST_ff_f (jn, 10, 0.1L, 0.26905328954342155795e-19L);
2958 TEST_ff_f (jn, 10, 0.7L, 0.75175911502153953928e-11L);
2959 TEST_ff_f (jn, 10, 1.0, 0.26306151236874532070e-9L);
2960 TEST_ff_f (jn, 10, 2.0, 0.25153862827167367096e-6L);
2961 TEST_ff_f (jn, 10, 10.0, 0.20748610663335885770L);
2970 TEST_ff_f (ldexp, 0, 0, 0);
2971 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
2973 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
2974 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
2975 TEST_ff_f (ldexp, nan_value, 1, nan_value);
2977 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
2978 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
2980 /* ldexp (x, 0) == x. */
2981 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
2989 if (errno == ENOSYS)
2990 /* Function not implemented. */
2992 feclearexcept (FE_ALL_EXCEPT);
2996 TEST_f_f (lgamma, plus_infty, plus_infty);
2997 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2998 TEST_f_f (lgamma, nan_value, nan_value);
3000 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3001 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3002 TEST_f_f (lgamma, minus_infty, plus_infty);
3004 TEST_f_f1 (lgamma, 1, 0, 1);
3006 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3008 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3009 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3010 TEST_f_f1 (lgamma, 0.7L, 0.26086724653166651439L, 1);
3011 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197e-1L, 1);
3019 /* XXX this test is incomplete. We need to have a way to specifiy
3020 the rounding method and test the critical cases. So far, only
3021 unproblematic numbers are tested. */
3025 TEST_f_l (lrint, 0.0, 0);
3026 TEST_f_l (lrint, minus_zero, 0);
3027 TEST_f_l (lrint, 0.2L, 0);
3028 TEST_f_l (lrint, -0.2L, 0);
3030 TEST_f_l (lrint, 1.4L, 1);
3031 TEST_f_l (lrint, -1.4L, -1);
3033 TEST_f_l (lrint, 8388600.3L, 8388600);
3034 TEST_f_l (lrint, -8388600.3L, -8388600);
3042 /* XXX this test is incomplete. We need to have a way to specifiy
3043 the rounding method and test the critical cases. So far, only
3044 unproblematic numbers are tested. */
3048 TEST_f_L (llrint, 0.0, 0);
3049 TEST_f_L (llrint, minus_zero, 0);
3050 TEST_f_L (llrint, 0.2L, 0);
3051 TEST_f_L (llrint, -0.2L, 0);
3053 TEST_f_L (llrint, 1.4L, 1);
3054 TEST_f_L (llrint, -1.4L, -1);
3056 TEST_f_L (llrint, 8388600.3L, 8388600);
3057 TEST_f_L (llrint, -8388600.3L, -8388600);
3059 /* Test boundary conditions. */
3061 TEST_f_L (llrint, 2097151.0,2097151LL);
3063 TEST_f_L (llrint, 8388608.0, 8388608LL);
3065 TEST_f_L (llrint, 16777216.0, 16777216LL);
3067 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3069 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3070 /* 0x10000000000000 */
3071 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3072 /* 0x10000080000000 */
3073 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3074 /* 0x20000000000000 */
3075 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3076 /* 0x80000000000000 */
3077 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3078 /* 0x100000000000000 */
3079 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3089 if (errno == ENOSYS)
3090 /* Function not implemented. */
3094 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3095 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3097 TEST_f_f (log, 1, 0);
3099 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
3100 TEST_f_f (log, plus_infty, plus_infty);
3102 TEST_f_f (log, M_El, 1);
3103 TEST_f_f (log, 1.0 / M_El, -1);
3104 TEST_f_f (log, 2, M_LN2l);
3105 TEST_f_f (log, 10, M_LN10l);
3106 TEST_f_f (log, 0.7L, -0.35667494393873237891263871124118447L);
3117 if (errno == ENOSYS)
3118 /* Function not implemented. */
3123 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3124 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3126 TEST_f_f (log10, 1, 0);
3128 /* log10 (x) == NaN plus invalid exception if x < 0. */
3129 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
3131 TEST_f_f (log10, plus_infty, plus_infty);
3132 TEST_f_f (log10, nan_value, nan_value);
3134 TEST_f_f (log10, 0.1L, -1);
3135 TEST_f_f (log10, 10.0, 1);
3136 TEST_f_f (log10, 100.0, 2);
3137 TEST_f_f (log10, 10000.0, 4);
3138 TEST_f_f (log10, M_El, M_LOG10El);
3139 TEST_f_f (log10, 0.7L, -0.15490195998574316929L);
3150 if (errno == ENOSYS)
3151 /* Function not implemented. */
3156 TEST_f_f (log1p, 0, 0);
3157 TEST_f_f (log1p, minus_zero, minus_zero);
3159 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3160 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
3162 TEST_f_f (log1p, plus_infty, plus_infty);
3163 TEST_f_f (log1p, nan_value, nan_value);
3165 TEST_f_f (log1p, M_El - 1.0, 1);
3167 TEST_f_f (log1p, -0.3L, -0.35667494393873237891263871124118447L);
3178 if (errno == ENOSYS)
3179 /* Function not implemented. */
3184 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3185 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3187 TEST_f_f (log2, 1, 0);
3189 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
3191 TEST_f_f (log2, plus_infty, plus_infty);
3192 TEST_f_f (log2, nan_value, nan_value);
3194 TEST_f_f (log2, M_El, M_LOG2El);
3195 TEST_f_f (log2, 2.0, 1);
3196 TEST_f_f (log2, 16.0, 4);
3197 TEST_f_f (log2, 256.0, 8);
3198 TEST_f_f (log2, 0.7L, -0.51457317282975824043L);
3209 TEST_f_f (logb, plus_infty, plus_infty);
3210 TEST_f_f (logb, minus_infty, plus_infty);
3212 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3214 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3215 TEST_f_f (logb, nan_value, nan_value);
3217 TEST_f_f (logb, 1, 0);
3218 TEST_f_f (logb, M_El, 1);
3219 TEST_f_f (logb, 1024, 10);
3220 TEST_f_f (logb, -2000, 10);
3230 TEST_f_l (lround, 0, 0);
3231 TEST_f_l (lround, minus_zero, 0);
3232 TEST_f_l (lround, 0.2L, 0.0);
3233 TEST_f_l (lround, -0.2L, 0);
3234 TEST_f_l (lround, 0.5, 1);
3235 TEST_f_l (lround, -0.5, -1);
3236 TEST_f_l (lround, 0.8L, 1);
3237 TEST_f_l (lround, -0.8L, -1);
3238 TEST_f_l (lround, 1.5, 2);
3239 TEST_f_l (lround, -1.5, -2);
3240 TEST_f_l (lround, 22514.5, 22515);
3241 TEST_f_l (lround, -22514.5, -22515);
3243 TEST_f_l (lround, 2097152.5, 2097153);
3244 TEST_f_l (lround, -2097152.5, -2097153);
3255 TEST_f_L (llround, 0, 0);
3256 TEST_f_L (llround, minus_zero, 0);
3257 TEST_f_L (llround, 0.2L, 0.0);
3258 TEST_f_L (llround, -0.2L, 0);
3259 TEST_f_L (llround, 0.5, 1);
3260 TEST_f_L (llround, -0.5, -1);
3261 TEST_f_L (llround, 0.8L, 1);
3262 TEST_f_L (llround, -0.8L, -1);
3263 TEST_f_L (llround, 1.5, 2);
3264 TEST_f_L (llround, -1.5, -2);
3265 TEST_f_L (llround, 22514.5, 22515);
3266 TEST_f_L (llround, -22514.5, -22515);
3268 TEST_f_L (llround, 2097152.5, 2097153);
3269 TEST_f_L (llround, -2097152.5, -2097153);
3270 TEST_f_L (llround, 34359738368.5, 34359738369ll);
3271 TEST_f_L (llround, -34359738368.5, -34359738369ll);
3274 /* Test boundary conditions. */
3276 TEST_f_L (llround, 2097151.0, 2097151LL);
3278 TEST_f_L (llround, 8388608.0, 8388608LL);
3280 TEST_f_L (llround, 16777216.0, 16777216LL);
3282 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
3284 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
3285 /* 0x10000000000000 */
3286 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
3287 /* 0x10000080000000 */
3288 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3289 /* 0x20000000000000 */
3290 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
3291 /* 0x80000000000000 */
3292 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
3293 /* 0x100000000000000 */
3294 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
3306 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
3307 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
3308 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
3309 TEST_fF_f1 (modf, 0, 0, 0);
3310 TEST_fF_f1 (modf, 1.5, 0.5, 1);
3311 TEST_fF_f1 (modf, 2.5, 0.5, 2);
3312 TEST_fF_f1 (modf, -2.5, -0.5, -2);
3313 TEST_fF_f1 (modf, 20, 0, 20);
3314 TEST_fF_f1 (modf, 21, 0, 21);
3315 TEST_fF_f1 (modf, 89.5, 0.5, 89);
3322 nearbyint_test (void)
3326 TEST_f_f (nearbyint, 0.0, 0.0);
3327 TEST_f_f (nearbyint, minus_zero, minus_zero);
3328 TEST_f_f (nearbyint, plus_infty, plus_infty);
3329 TEST_f_f (nearbyint, minus_infty, minus_infty);
3330 TEST_f_f (nearbyint, nan_value, nan_value);
3332 /* Default rounding mode is round to nearest. */
3333 TEST_f_f (nearbyint, 0.5, 0.0);
3334 TEST_f_f (nearbyint, 1.5, 2.0);
3335 TEST_f_f (nearbyint, -0.5, minus_zero);
3336 TEST_f_f (nearbyint, -1.5, -2.0);
3342 nextafter_test (void)
3347 TEST_ff_f (nextafter, 0, 0, 0);
3348 TEST_ff_f (nextafter, minus_zero, 0, 0);
3349 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
3350 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
3352 TEST_ff_f (nextafter, 9, 9, 9);
3353 TEST_ff_f (nextafter, -9, -9, -9);
3354 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
3355 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
3357 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
3358 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
3359 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
3361 /* XXX We need the hexadecimal FP number representation here for further
3369 nexttoward_test (void)
3372 TEST_ff_f (nexttoward, 0, 0, 0);
3373 TEST_ff_f (nexttoward, minus_zero, 0, 0);
3374 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
3375 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
3377 TEST_ff_f (nexttoward, 9, 9, 9);
3378 TEST_ff_f (nexttoward, -9, -9, -9);
3379 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
3380 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
3382 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
3383 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
3384 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
3386 /* XXX We need the hexadecimal FP number representation here for further
3399 if (errno == ENOSYS)
3400 /* Function not implemented. */
3405 TEST_ff_f (pow, 0, 0, 1);
3406 TEST_ff_f (pow, 0, minus_zero, 1);
3407 TEST_ff_f (pow, minus_zero, 0, 1);
3408 TEST_ff_f (pow, minus_zero, minus_zero, 1);
3410 TEST_ff_f (pow, 10, 0, 1);
3411 TEST_ff_f (pow, 10, minus_zero, 1);
3412 TEST_ff_f (pow, -10, 0, 1);
3413 TEST_ff_f (pow, -10, minus_zero, 1);
3415 TEST_ff_f (pow, nan_value, 0, 1);
3416 TEST_ff_f (pow, nan_value, minus_zero, 1);
3420 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
3421 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
3422 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
3423 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
3425 TEST_ff_f (pow, 0.9L, plus_infty, 0);
3426 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
3427 TEST_ff_f (pow, -0.9L, plus_infty, 0);
3428 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
3430 TEST_ff_f (pow, 1.1L, minus_infty, 0);
3431 TEST_ff_f (pow, plus_infty, minus_infty, 0);
3432 TEST_ff_f (pow, -1.1L, minus_infty, 0);
3433 TEST_ff_f (pow, minus_infty, minus_infty, 0);
3435 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
3436 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
3437 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
3438 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
3440 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
3441 TEST_ff_f (pow, plus_infty, 1, plus_infty);
3442 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
3444 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
3445 TEST_ff_f (pow, plus_infty, -1, 0);
3446 TEST_ff_f (pow, plus_infty, -1e7L, 0);
3448 TEST_ff_f (pow, minus_infty, 1, minus_infty);
3449 TEST_ff_f (pow, minus_infty, 11, minus_infty);
3450 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
3452 TEST_ff_f (pow, minus_infty, 2, plus_infty);
3453 TEST_ff_f (pow, minus_infty, 12, plus_infty);
3454 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
3455 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
3456 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
3457 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
3458 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
3460 TEST_ff_f (pow, minus_infty, -1, minus_zero);
3461 TEST_ff_f (pow, minus_infty, -11, minus_zero);
3462 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
3464 TEST_ff_f (pow, minus_infty, -2, 0);
3465 TEST_ff_f (pow, minus_infty, -12, 0);
3466 TEST_ff_f (pow, minus_infty, -1002, 0);
3467 TEST_ff_f (pow, minus_infty, -0.1L, 0);
3468 TEST_ff_f (pow, minus_infty, -1.1L, 0);
3469 TEST_ff_f (pow, minus_infty, -11.1L, 0);
3470 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
3473 TEST_ff_f (pow, nan_value, nan_value, nan_value);
3474 TEST_ff_f (pow, 0, nan_value, nan_value);
3475 TEST_ff_f (pow, 1, nan_value, 1);
3476 TEST_ff_f (pow, -1, nan_value, nan_value);
3477 TEST_ff_f (pow, nan_value, 1, nan_value);
3478 TEST_ff_f (pow, nan_value, -1, nan_value);
3480 /* pow (x, NaN) == NaN. */
3481 TEST_ff_f (pow, 3.0, nan_value, nan_value);
3483 TEST_ff_f (pow, 1, plus_infty, 1);
3484 TEST_ff_f (pow, -1, plus_infty, 1);
3485 TEST_ff_f (pow, 1, minus_infty, 1);
3486 TEST_ff_f (pow, -1, minus_infty, 1);
3488 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3489 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3490 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3491 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3493 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3494 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3495 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3496 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3498 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3499 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3500 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3501 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3504 TEST_ff_f (pow, 0, 1, 0);
3505 TEST_ff_f (pow, 0, 11, 0);
3507 TEST_ff_f (pow, minus_zero, 1, minus_zero);
3508 TEST_ff_f (pow, minus_zero, 11, minus_zero);
3511 TEST_ff_f (pow, 0, 2, 0);
3512 TEST_ff_f (pow, 0, 11.1L, 0);
3515 TEST_ff_f (pow, minus_zero, 2, 0);
3516 TEST_ff_f (pow, minus_zero, 11.1L, 0);
3519 /* pow (x, +inf) == +inf for |x| > 1. */
3520 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
3522 /* pow (x, +inf) == +0 for |x| < 1. */
3523 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
3525 /* pow (x, -inf) == +0 for |x| > 1. */
3526 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
3528 /* pow (x, -inf) == +inf for |x| < 1. */
3529 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
3532 /* pow (+inf, y) == +inf for y > 0. */
3533 TEST_ff_f (pow, plus_infty, 2, plus_infty);
3535 /* pow (+inf, y) == +0 for y < 0. */
3536 TEST_ff_f (pow, plus_infty, -1, 0.0);
3538 /* pow (-inf, y) == -inf for y an odd integer > 0. */
3539 TEST_ff_f (pow, minus_infty, 27, minus_infty);
3541 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
3542 TEST_ff_f (pow, minus_infty, 28, plus_infty);
3544 /* pow (-inf, y) == -0 for y an odd integer < 0. */
3545 TEST_ff_f (pow, minus_infty, -3, minus_zero);
3546 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
3547 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
3549 /* pow (+0, y) == +0 for y an odd integer > 0. */
3550 TEST_ff_f (pow, 0.0, 27, 0.0);
3552 /* pow (-0, y) == -0 for y an odd integer > 0. */
3553 TEST_ff_f (pow, minus_zero, 27, minus_zero);
3555 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
3556 TEST_ff_f (pow, 0.0, 4, 0.0);
3558 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
3559 TEST_ff_f (pow, minus_zero, 4, 0.0);
3561 TEST_ff_f (pow, 0.7L, 1.2L, 0.65180494056638638188L);
3564 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
3571 remainder_test (void)
3574 FUNC(remainder) (1.625, 1.0);
3575 if (errno == ENOSYS)
3576 /* Function not implemented. */
3581 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
3582 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
3583 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
3584 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
3585 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
3587 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
3588 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
3589 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
3590 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
3591 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
3592 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
3604 FUNC(remquo) (1.625, 1.0, &x);
3605 if (errno == ENOSYS)
3606 /* Function not implemented. */
3611 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
3612 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
3613 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3614 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3615 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
3617 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
3618 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
3619 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
3620 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
3622 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
3623 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
3633 TEST_f_f (rint, 0.0, 0.0);
3634 TEST_f_f (rint, minus_zero, minus_zero);
3635 TEST_f_f (rint, plus_infty, plus_infty);
3636 TEST_f_f (rint, minus_infty, minus_infty);
3638 /* Default rounding mode is round to even. */
3639 TEST_f_f (rint, 0.5, 0.0);
3640 TEST_f_f (rint, 1.5, 2.0);
3641 TEST_f_f (rint, 2.5, 2.0);
3642 TEST_f_f (rint, 3.5, 4.0);
3643 TEST_f_f (rint, 4.5, 4.0);
3644 TEST_f_f (rint, -0.5, -0.0);
3645 TEST_f_f (rint, -1.5, -2.0);
3646 TEST_f_f (rint, -2.5, -2.0);
3647 TEST_f_f (rint, -3.5, -4.0);
3648 TEST_f_f (rint, -4.5, -4.0);
3658 TEST_f_f (round, 0, 0);
3659 TEST_f_f (round, minus_zero, minus_zero);
3660 TEST_f_f (round, 0.2L, 0.0);
3661 TEST_f_f (round, -0.2L, minus_zero);
3662 TEST_f_f (round, 0.5, 1.0);
3663 TEST_f_f (round, -0.5, -1.0);
3664 TEST_f_f (round, 0.8L, 1.0);
3665 TEST_f_f (round, -0.8L, -1.0);
3666 TEST_f_f (round, 1.5, 2.0);
3667 TEST_f_f (round, -1.5, -2.0);
3668 TEST_f_f (round, 2097152.5, 2097153);
3669 TEST_f_f (round, -2097152.5, -2097153);
3681 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
3682 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
3684 TEST_ff_f (scalb, 0, nan_value, nan_value);
3685 TEST_ff_f (scalb, 1, nan_value, nan_value);
3687 TEST_ff_f (scalb, 1, 0, 1);
3688 TEST_ff_f (scalb, -1, 0, -1);
3690 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
3691 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
3693 TEST_ff_f (scalb, 0, 2, 0);
3694 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
3695 TEST_ff_f (scalb, 0, 0, 0);
3696 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
3697 TEST_ff_f (scalb, 0, -1, 0);
3698 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
3699 TEST_ff_f (scalb, 0, minus_infty, 0);
3700 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
3702 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
3703 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
3704 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
3705 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
3706 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
3707 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
3709 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
3710 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
3712 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
3713 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
3714 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
3715 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
3717 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3718 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3720 TEST_ff_f (scalb, nan_value, 1, nan_value);
3721 TEST_ff_f (scalb, 1, nan_value, nan_value);
3722 TEST_ff_f (scalb, nan_value, 0, nan_value);
3723 TEST_ff_f (scalb, 0, nan_value, nan_value);
3724 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
3725 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
3726 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
3728 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
3729 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
3741 TEST_fi_f (scalbn, 0, 0, 0);
3742 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
3744 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
3745 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
3746 TEST_fi_f (scalbn, nan_value, 1, nan_value);
3748 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
3749 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
3751 TEST_fi_f (scalbn, 1, 0L, 1);
3762 TEST_fl_f (scalbln, 0, 0, 0);
3763 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
3765 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
3766 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
3767 TEST_fl_f (scalbln, nan_value, 1, nan_value);
3769 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
3770 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
3772 TEST_fl_f (scalbln, 1, 0L, 1);
3783 TEST_f_b (signbit, 0, 0);
3784 TEST_f_b (signbit, minus_zero, 1);
3785 TEST_f_b (signbit, plus_infty, 0);
3786 TEST_f_b (signbit, minus_infty, 1);
3788 /* signbit (x) != 0 for x < 0. */
3789 TEST_f_b (signbit, -1, 1);
3790 /* signbit (x) == 0 for x >= 0. */
3791 TEST_f_b (signbit, 1, 0);
3801 if (errno == ENOSYS)
3802 /* Function not implemented. */
3807 TEST_f_f (sin, 0, 0);
3808 TEST_f_f (sin, minus_zero, minus_zero);
3809 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
3810 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
3811 TEST_f_f (sin, nan_value, nan_value);
3813 TEST_f_f (sin, M_PI_6l, 0.5);
3814 TEST_f_f (sin, -M_PI_6l, -0.5);
3815 TEST_f_f (sin, M_PI_2l, 1);
3816 TEST_f_f (sin, -M_PI_2l, -1);
3817 TEST_f_f (sin, 0.7L, 0.64421768723769105367261435139872014L);
3826 FLOAT sin_res, cos_res;
3829 FUNC(sincos) (0, &sin_res, &cos_res);
3830 if (errno == ENOSYS)
3831 /* Function not implemented. */
3836 /* sincos is treated differently because it returns void. */
3837 TEST_extra (sincos, 0, 0, 1);
3839 TEST_extra (sincos, minus_zero, minus_zero, 1);
3840 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3841 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3842 TEST_extra (sincos, nan_value, nan_value, nan_value);
3844 TEST_extra (sincos, M_PI_2l, 1, 0);
3845 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
3846 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
3847 TEST_extra (sincos, 0.7L, 0.64421768723769105367261435139872014L, 0.76484218728448842625585999019186495L);
3857 if (errno == ENOSYS)
3858 /* Function not implemented. */
3862 TEST_f_f (sinh, 0, 0);
3863 TEST_f_f (sinh, minus_zero, minus_zero);
3866 TEST_f_f (sinh, plus_infty, plus_infty);
3867 TEST_f_f (sinh, minus_infty, minus_infty);
3869 TEST_f_f (sinh, nan_value, nan_value);
3871 TEST_f_f (sinh, 0.7L, 0.75858370183953350346L);
3881 if (errno == ENOSYS)
3882 /* Function not implemented. */
3887 TEST_f_f (sqrt, 0, 0);
3888 TEST_f_f (sqrt, nan_value, nan_value);
3889 TEST_f_f (sqrt, plus_infty, plus_infty);
3891 TEST_f_f (sqrt, minus_zero, minus_zero);
3893 /* sqrt (x) == NaN plus invalid exception for x < 0. */
3894 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
3895 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
3896 TEST_f_f (sqrt, nan_value, nan_value);
3898 TEST_f_f (sqrt, 2209, 47);
3899 TEST_f_f (sqrt, 4, 2);
3900 TEST_f_f (sqrt, 2, M_SQRT2l);
3901 TEST_f_f (sqrt, 0.25, 0.5);
3902 TEST_f_f (sqrt, 6642.25, 81.5);
3903 TEST_f_f (sqrt, 15239.9025L, 123.45L);
3904 TEST_f_f (sqrt, 0.7L, 0.83666002653407554797817202578518747L);
3914 if (errno == ENOSYS)
3915 /* Function not implemented. */
3920 TEST_f_f (tan, 0, 0);
3921 TEST_f_f (tan, minus_zero, minus_zero);
3922 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
3923 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
3924 TEST_f_f (tan, nan_value, nan_value);
3926 TEST_f_f (tan, M_PI_4l, 1);
3927 TEST_f_f (tan, 0.7L, 0.84228838046307944812813500221293775L);
3937 if (errno == ENOSYS)
3938 /* Function not implemented. */
3943 TEST_f_f (tanh, 0, 0);
3944 TEST_f_f (tanh, minus_zero, minus_zero);
3947 TEST_f_f (tanh, plus_infty, 1);
3948 TEST_f_f (tanh, minus_infty, -1);
3950 TEST_f_f (tanh, nan_value, nan_value);
3952 TEST_f_f (tanh, 0.7L, 0.60436777711716349631L);
3962 if (errno == ENOSYS)
3963 /* Function not implemented. */
3965 feclearexcept (FE_ALL_EXCEPT);
3969 TEST_f_f (tgamma, plus_infty, plus_infty);
3970 TEST_f_f (tgamma, 0, nan_value, INVALID_EXCEPTION);
3971 TEST_f_f (tgamma, minus_zero, nan_value, INVALID_EXCEPTION);
3972 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
3973 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
3974 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
3975 TEST_f_f (tgamma, nan_value, nan_value);
3977 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
3978 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
3980 TEST_f_f (tgamma, 1, 1);
3981 TEST_f_f (tgamma, 4, 6);
3983 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568L);
3984 TEST_f_f (tgamma, 1.2L, 0.91816874239976061064L);
3994 TEST_f_f (trunc, plus_infty, plus_infty);
3995 TEST_f_f (trunc, minus_infty, minus_infty);
3996 TEST_f_f (trunc, nan_value, nan_value);
3998 TEST_f_f (trunc, 0, 0);
3999 TEST_f_f (trunc, minus_zero, minus_zero);
4000 TEST_f_f (trunc, 0.625, 0);
4001 TEST_f_f (trunc, -0.625, minus_zero);
4002 TEST_f_f (trunc, 1, 1);
4003 TEST_f_f (trunc, -1, -1);
4004 TEST_f_f (trunc, 1.625, 1);
4005 TEST_f_f (trunc, -1.625, -1);
4007 TEST_f_f (trunc, 1048580.625L, 1048580L);
4008 TEST_f_f (trunc, -1048580.625L, -1048580L);
4010 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
4011 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
4013 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
4014 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
4025 FUNC (sincos) (0, &s, &c);
4026 if (errno == ENOSYS)
4027 /* Required function not implemented. */
4030 if (errno == ENOSYS)
4031 /* Function not implemented. */
4034 /* y0 is the Bessel function of the second kind of order 0 */
4037 TEST_f_f (y0, -1.0, minus_infty);
4038 TEST_f_f (y0, 0.0, minus_infty);
4039 TEST_f_f (y0, nan_value, nan_value);
4040 TEST_f_f (y0, plus_infty, 0);
4042 TEST_f_f (y0, 0.1L, -1.5342386513503668441L);
4043 TEST_f_f (y0, 0.7L, -0.19066492933739506743L);
4044 TEST_f_f (y0, 1.0, 0.088256964215676957983L);
4045 TEST_f_f (y0, 1.5, 0.38244892379775884396L);
4046 TEST_f_f (y0, 2.0, 0.51037567264974511960L);
4047 TEST_f_f (y0, 8.0, 0.22352148938756622053L);
4048 TEST_f_f (y0, 10.0, 0.055671167283599391424L);
4059 FUNC (sincos) (0, &s, &c);
4060 if (errno == ENOSYS)
4061 /* Required function not implemented. */
4064 if (errno == ENOSYS)
4065 /* Function not implemented. */
4068 /* y1 is the Bessel function of the second kind of order 1 */
4071 TEST_f_f (y1, -1.0, minus_infty);
4072 TEST_f_f (y1, 0.0, minus_infty);
4073 TEST_f_f (y1, plus_infty, 0);
4074 TEST_f_f (y1, nan_value, nan_value);
4076 TEST_f_f (y1, 0.1L, -6.4589510947020269877L);
4077 TEST_f_f (y1, 0.7L, -1.1032498719076333697L);
4078 TEST_f_f (y1, 1.0, -0.78121282130028871655L);
4079 TEST_f_f (y1, 1.5, -0.41230862697391129595L);
4080 TEST_f_f (y1, 2.0, -0.10703243154093754689L);
4081 TEST_f_f (y1, 8.0, -0.15806046173124749426L);
4082 TEST_f_f (y1, 10.0, 0.24901542420695388392L);
4092 FUNC (sincos) (0, &s, &c);
4093 if (errno == ENOSYS)
4094 /* Required function not implemented. */
4097 if (errno == ENOSYS)
4098 /* Function not implemented. */
4101 /* yn is the Bessel function of the second kind of order n */
4104 /* yn (0, x) == y0 (x) */
4105 TEST_ff_f (yn, 0, -1.0, minus_infty);
4106 TEST_ff_f (yn, 0, 0.0, minus_infty);
4107 TEST_ff_f (yn, 0, nan_value, nan_value);
4108 TEST_ff_f (yn, 0, plus_infty, 0);
4110 TEST_ff_f (yn, 0, 0.1L, -1.5342386513503668441L);
4111 TEST_ff_f (yn, 0, 0.7L, -0.19066492933739506743L);
4112 TEST_ff_f (yn, 0, 1.0, 0.088256964215676957983L);
4113 TEST_ff_f (yn, 0, 1.5, 0.38244892379775884396L);
4114 TEST_ff_f (yn, 0, 2.0, 0.51037567264974511960L);
4115 TEST_ff_f (yn, 0, 8.0, 0.22352148938756622053L);
4116 TEST_ff_f (yn, 0, 10.0, 0.055671167283599391424L);
4118 /* yn (1, x) == y1 (x) */
4119 TEST_ff_f (yn, 1, -1.0, minus_infty);
4120 TEST_ff_f (yn, 1, 0.0, minus_infty);
4121 TEST_ff_f (yn, 1, plus_infty, 0);
4122 TEST_ff_f (yn, 1, nan_value, nan_value);
4124 TEST_ff_f (yn, 1, 0.1L, -6.4589510947020269877L);
4125 TEST_ff_f (yn, 1, 0.7L, -1.1032498719076333697L);
4126 TEST_ff_f (yn, 1, 1.0, -0.78121282130028871655L);
4127 TEST_ff_f (yn, 1, 1.5, -0.41230862697391129595L);
4128 TEST_ff_f (yn, 1, 2.0, -0.10703243154093754689L);
4129 TEST_ff_f (yn, 1, 8.0, -0.15806046173124749426L);
4130 TEST_ff_f (yn, 1, 10.0, 0.24901542420695388392L);
4133 TEST_ff_f (yn, 3, plus_infty, 0);
4134 TEST_ff_f (yn, 3, nan_value, nan_value);
4136 TEST_ff_f (yn, 3, 0.1L, -5099.3323786129048894L);
4137 TEST_ff_f (yn, 3, 0.7L, -15.819479052819633505L);
4138 TEST_ff_f (yn, 3, 1.0, -5.8215176059647288478L);
4139 TEST_ff_f (yn, 3, 2.0, -1.1277837768404277861L);
4140 TEST_ff_f (yn, 3, 10.0, -0.25136265718383732978L);
4143 TEST_ff_f (yn, 10, plus_infty, 0);
4144 TEST_ff_f (yn, 10, nan_value, nan_value);
4146 TEST_ff_f (yn, 10, 0.1L, -0.11831335132045197885e19L);
4147 TEST_ff_f (yn, 10, 0.7L, -0.42447194260703866924e10L);
4148 TEST_ff_f (yn, 10, 1.0, -0.12161801427868918929e9L);
4149 TEST_ff_f (yn, 10, 2.0, -129184.54220803928264L);
4150 TEST_ff_f (yn, 10, 10.0, -0.35981415218340272205L);
4161 fpstack_test ("start *init*");
4163 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
4165 minus_zero = FUNC(copysign) (0.0, -1.0);
4166 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
4167 HUGE_VALL, HUGE_VAL, HUGE_VALF);
4168 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
4169 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
4175 (void) &minus_infty;
4177 /* Clear all exceptions. From now on we must not get random exceptions. */
4178 feclearexcept (FE_ALL_EXCEPT);
4180 /* Test to make sure we start correctly. */
4181 fpstack_test ("end *init*");
4184 /* Definitions of arguments for argp functions. */
4185 static const struct argp_option options[] =
4187 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
4188 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
4189 { "no-max-error", 'f', NULL, 0,
4190 "Don't output maximal errors of functions"},
4191 { "no-points", 'p', NULL, 0,
4192 "Don't output results of functions invocations"},
4193 { "ignore-max-ulp", 'i', "yes/no", 0,
4194 "Ignore given maximal errors"},
4195 { NULL, 0, NULL, 0, NULL }
4198 /* Short description of program. */
4199 static const char doc[] = "Math test suite: " TEST_MSG ;
4201 /* Prototype for option handler. */
4202 static error_t parse_opt (int key, char *arg, struct argp_state *state);
4204 /* Data structure to communicate with argp functions. */
4205 static struct argp argp =
4207 options, parse_opt, NULL, doc,
4211 /* Handle program arguments. */
4213 parse_opt (int key, char *arg, struct argp_state *state)
4218 output_max_error = 0;
4221 if (strcmp (arg, "yes") == 0)
4223 else if (strcmp (arg, "no") == 0)
4234 verbose = (unsigned int) strtoul (optarg, NULL, 0);
4239 return ARGP_ERR_UNKNOWN;
4245 /* function to check our ulp calculation. */
4252 /* This gives one ulp. */
4253 u = FUNC(nextafter) (10, 20);
4254 check_equal (10.0, u, 1, &diff, &ulp);
4255 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
4257 /* This gives one more ulp. */
4258 u = FUNC(nextafter) (u, 20);
4259 check_equal (10.0, u, 2, &diff, &ulp);
4260 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
4262 /* And now calculate 100 ulp. */
4263 for (i = 2; i < 100; i++)
4264 u = FUNC(nextafter) (u, 20);
4265 check_equal (10.0, u, 100, &diff, &ulp);
4266 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
4271 main (int argc, char **argv)
4278 output_max_error = 1;
4280 /* XXX set to 0 for releases. */
4283 /* Parse and process arguments. */
4284 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
4286 if (remaining != argc)
4288 fprintf (stderr, "wrong number of arguments");
4289 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
4290 exit (EXIT_FAILURE);
4295 ulps_file = fopen ("ULPs", "a");
4296 if (ulps_file == NULL)
4298 perror ("can't open file `ULPs' for writing: ");
4311 /* Keep the tests a wee bit ordered (according to ISO C99). */
4312 /* Classification macros: */
4318 /* Trigonometric functions: */
4328 /* Hyperbolic functions: */
4336 /* Exponential and logarithmic functions: */
4354 /* Power and absolute value functions: */
4361 /* Error and gamma functions: */
4368 /* Nearest integer functions: */
4380 /* Remainder functions: */
4385 /* Manipulation functions: */
4390 /* maximum, minimum and positive difference functions */
4395 /* Multiply and add: */
4398 /* Complex functions: */
4423 /* Bessel functions: */
4434 printf ("\nTest suite completed:\n");
4435 printf (" %d test cases plus %d tests for exception flags executed.\n",
4436 noTests, noExcTests);
4438 printf (" %d expected failures occurred.\n", noXFails);
4440 printf (" %d unexpected passes occurred.\n", noXPasses);
4443 printf (" %d errors occurred.\n", noErrors);
4446 printf (" All tests passed successfully.\n");