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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
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.
109 To Do: All parameter should be numbers that can be represented as
110 exact floating point values. Currently some values cannot be represented
111 exactly and therefore the result is not the expected result.
118 #include "libm-test-ulps.h"
131 /* Possible exceptions */
132 #define NO_EXCEPTION 0x0
133 #define INVALID_EXCEPTION 0x1
134 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
135 /* The next flags signals that those exceptions are allowed but not required. */
136 #define INVALID_EXCEPTION_OK 0x4
137 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x8
138 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
139 /* Some special test flags, passed togther with exceptions. */
140 #define IGNORE_ZERO_INF_SIGN 0x10
142 /* Various constants (we must supply them precalculated for accuracy). */
143 #define M_PI_6l .52359877559829887307710723054658383L
144 #define M_E2l 7.389056098930650227230427460575008L
145 #define M_E3l 20.085536923187667740928529654581719L
146 #define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */
147 #define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
148 #define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
149 #define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
150 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
151 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
152 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
153 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
154 #define M_PI_LOG10El M_PIl * M_LOG10El
156 static FILE *ulps_file; /* File to document difference. */
157 static int output_ulps; /* Should ulps printed? */
159 static int noErrors; /* number of errors */
160 static int noTests; /* number of tests (without testing exceptions) */
161 static int noExcTests; /* number of tests for exception flags */
162 static int noXFails; /* number of expected failures. */
163 static int noXPasses; /* number of unexpected passes. */
166 static int output_max_error; /* Should the maximal errors printed? */
167 static int output_points; /* Should the single function results printed? */
168 static int ignore_max_ulp; /* Should we ignore max_ulp? */
170 static FLOAT minus_zero, plus_zero;
171 static FLOAT plus_infty, minus_infty, nan_value;
173 static FLOAT max_error, real_max_error, imag_max_error;
176 #define BUILD_COMPLEX(real, imag) \
177 ({ __complex__ FLOAT __retval; \
178 __real__ __retval = (real); \
179 __imag__ __retval = (imag); \
182 #define BUILD_COMPLEX_INT(real, imag) \
183 ({ __complex__ int __retval; \
184 __real__ __retval = (real); \
185 __imag__ __retval = (imag); \
189 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
190 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
193 init_max_error (void)
198 feclearexcept (FE_ALL_EXCEPT);
202 set_max_error (FLOAT current, FLOAT *curr_max_error)
204 if (current > *curr_max_error)
205 *curr_max_error = current;
209 /* Should the message print to screen? This depends on the verbose flag,
210 and the test status. */
212 print_screen (int ok, int xfail)
216 || (verbose == 1 && ok == xfail)))
222 /* Should the message print to screen? This depends on the verbose flag,
223 and the test status. */
225 print_screen_max_error (int ok, int xfail)
229 || ((verbose == 1) && (ok == xfail))))
234 /* Update statistic counters. */
236 update_stats (int ok, int xfail)
241 else if (!ok && xfail)
243 else if (!ok && !xfail)
248 print_ulps (const char *test_name, FLOAT ulp)
252 fprintf (ulps_file, "Test \"%s\":\n", test_name);
253 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
254 CHOOSE("ldouble", "double", "float",
255 "ildouble", "idouble", "ifloat"), ulp);
260 print_function_ulps (const char *function_name, FLOAT ulp)
264 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
265 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
266 CHOOSE("ldouble", "double", "float",
267 "ildouble", "idouble", "ifloat"), ulp);
273 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
280 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
281 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
282 CHOOSE("ldouble", "double", "float",
283 "ildouble", "idouble", "ifloat"), real_ulp);
287 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
288 fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
289 CHOOSE("ldouble", "double", "float",
290 "ildouble", "idouble", "ifloat"), imag_ulp);
299 /* Test if Floating-Point stack hasn't changed */
301 fpstack_test (const char *test_name)
304 static int old_stack;
307 asm ("fnstsw" : "=a" (sw));
313 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
314 test_name, sw, old_stack);
323 print_max_error (const char *func_name, FLOAT allowed, int xfail)
327 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
333 print_function_ulps (func_name, max_error);
336 if (print_screen_max_error (ok, xfail))
338 printf ("Maximal error of `%s'\n", func_name);
339 printf (" is : % .4" PRINTF_NEXPR " ulp\n", max_error);
340 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", allowed);
343 update_stats (ok, xfail);
348 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
349 __complex__ int xfail)
353 if ((real_max_error <= __real__ allowed)
354 && (imag_max_error <= __imag__ allowed))
360 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
363 if (print_screen_max_error (ok, xfail))
365 printf ("Maximal error of real part of: %s\n", func_name);
366 printf (" is : % .4" PRINTF_NEXPR " ulp\n", real_max_error);
367 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __real__ allowed);
368 printf ("Maximal error of imaginary part of: %s\n", func_name);
369 printf (" is : % .4" PRINTF_NEXPR " ulp\n", imag_max_error);
370 printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __imag__ allowed);
373 update_stats (ok, xfail);
377 /* Test whether a given exception was raised. */
379 test_single_exception (const char *test_name,
383 const char *flag_name)
387 if (exception & exc_flag)
389 if (fetestexcept (fe_flag))
391 if (print_screen (1, 0))
392 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
397 if (print_screen (0, 0))
398 printf ("Failure: %s: Exception \"%s\" not set\n",
399 test_name, flag_name);
404 if (fetestexcept (fe_flag))
407 if (print_screen (0, 0))
408 printf ("Failure: %s: Exception \"%s\" set\n",
409 test_name, flag_name);
413 if (print_screen (1, 0))
414 printf ("%s: Exception \"%s\" not set\n", test_name,
425 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
426 allowed but not required exceptions.
429 test_exceptions (const char *test_name, int exception)
433 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
434 test_single_exception (test_name, exception,
435 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
439 if ((exception & INVALID_EXCEPTION_OK) == 0)
440 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
441 "Invalid operation");
443 feclearexcept (FE_ALL_EXCEPT);
448 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
449 FLOAT max_ulp, int xfail, int exceptions,
450 FLOAT *curr_max_error)
457 test_exceptions (test_name, exceptions);
458 if (isnan (computed) && isnan (expected))
460 else if (isinf (computed) && isinf (expected))
462 /* Test for sign of infinities. */
463 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
464 && signbit (computed) != signbit (expected))
467 printf ("infinity has wrong sign.\n");
472 /* Don't calc ulp for NaNs or infinities. */
473 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
477 diff = FUNC(fabs) (computed - expected);
478 /* ilogb (0) isn't allowed. */
480 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
482 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
483 set_max_error (ulp, curr_max_error);
485 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
486 && computed == 0.0 && expected == 0.0
487 && signbit(computed) != signbit (expected))
489 else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
494 print_ulps (test_name, ulp);
498 if (print_screen (ok, xfail))
501 printf ("Failure: ");
502 printf ("Test: %s\n", test_name);
503 printf ("Result:\n");
504 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
506 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
510 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
512 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
513 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
516 update_stats (ok, xfail);
518 fpstack_test (test_name);
523 check_float (const char *test_name, FLOAT computed, FLOAT expected,
524 FLOAT max_ulp, int xfail, int exceptions)
526 check_float_internal (test_name, computed, expected, max_ulp, xfail,
527 exceptions, &max_error);
532 check_complex (const char *test_name, __complex__ FLOAT computed,
533 __complex__ FLOAT expected,
534 __complex__ FLOAT max_ulp, __complex__ int xfail,
537 FLOAT part_comp, part_exp, part_max_ulp;
541 sprintf (str, "Real part of: %s", test_name);
542 part_comp = __real__ computed;
543 part_exp = __real__ expected;
544 part_max_ulp = __real__ max_ulp;
545 part_xfail = __real__ xfail;
547 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
548 exception, &real_max_error);
550 sprintf (str, "Imaginary part of: %s", test_name);
551 part_comp = __imag__ computed;
552 part_exp = __imag__ expected;
553 part_max_ulp = __imag__ max_ulp;
554 part_xfail = __imag__ xfail;
556 /* Don't check again for exceptions, just pass through the
557 zero/inf sign test. */
558 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
559 exception & IGNORE_ZERO_INF_SIGN,
564 /* Check that computed and expected values are equal (int values). */
566 check_int (const char *test_name, int computed, int expected, int max_ulp,
567 int xfail, int exceptions)
569 int diff = computed - expected;
572 test_exceptions (test_name, exceptions);
574 if (abs (diff) <= max_ulp)
578 print_ulps (test_name, diff);
580 if (print_screen (ok, xfail))
583 printf ("Failure: ");
584 printf ("Test: %s\n", test_name);
585 printf ("Result:\n");
586 printf (" is: %d\n", computed);
587 printf (" should be: %d\n", expected);
590 update_stats (ok, xfail);
591 fpstack_test (test_name);
595 /* Check that computed and expected values are equal (long int values). */
597 check_long (const char *test_name, long int computed, long int expected,
598 long int max_ulp, int xfail, int exceptions)
600 long int diff = computed - expected;
603 test_exceptions (test_name, exceptions);
605 if (labs (diff) <= max_ulp)
609 print_ulps (test_name, diff);
611 if (print_screen (ok, xfail))
614 printf ("Failure: ");
615 printf ("Test: %s\n", test_name);
616 printf ("Result:\n");
617 printf (" is: %ld\n", computed);
618 printf (" should be: %ld\n", expected);
621 update_stats (ok, xfail);
622 fpstack_test (test_name);
626 /* Check that computed value is true/false. */
628 check_bool (const char *test_name, int computed, int expected,
629 long int max_ulp, int xfail, int exceptions)
633 test_exceptions (test_name, exceptions);
635 if ((computed == 0) == (expected == 0))
638 if (print_screen (ok, xfail))
641 printf ("Failure: ");
642 printf ("Test: %s\n", test_name);
643 printf ("Result:\n");
644 printf (" is: %d\n", computed);
645 printf (" should be: %d\n", expected);
648 update_stats (ok, xfail);
649 fpstack_test (test_name);
653 /* check that computed and expected values are equal (long int values) */
655 check_longlong (const char *test_name, long long int computed,
656 long long int expected,
657 long long int max_ulp, int xfail,
660 long long int diff = computed - expected;
663 test_exceptions (test_name, exceptions);
665 if (llabs (diff) <= max_ulp)
669 print_ulps (test_name, diff);
671 if (print_screen (ok, xfail))
675 printf ("Test: %s\n", test_name);
676 printf ("Result:\n");
677 printf (" is: %lld\n", computed);
678 printf (" should be: %lld\n", expected);
681 update_stats (ok, xfail);
682 fpstack_test (test_name);
687 /* This is to prevent messages from the SVID libm emulation. */
689 matherr (struct exception *x __attribute__ ((unused)))
695 /****************************************************************************
696 Tests for single functions of libm.
697 Please keep them alphabetically sorted!
698 ****************************************************************************/
706 /* Function not implemented. */
711 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
712 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
713 TEST_f_f (acos, nan_value, nan_value);
716 TEST_f_f (acos, 1.1L, nan_value, INVALID_EXCEPTION);
717 TEST_f_f (acos, -1.1L, nan_value, INVALID_EXCEPTION);
719 TEST_f_f (acos, 0, M_PI_2l);
720 TEST_f_f (acos, minus_zero, M_PI_2l);
721 TEST_f_f (acos, 1, 0);
722 TEST_f_f (acos, -1, M_PIl);
723 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
724 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
725 TEST_f_f (acos, 0.7L, 0.79539883018414355549096833892476432L);
736 /* Function not implemented. */
741 TEST_f_f (acosh, plus_infty, plus_infty);
742 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
745 TEST_f_f (acosh, -1.1L, nan_value, INVALID_EXCEPTION);
747 TEST_f_f (acosh, 1, 0);
748 TEST_f_f (acosh, 7, 2.633915793849633417250092694615937L);
759 /* Function not implemented. */
764 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
765 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
766 TEST_f_f (asin, nan_value, nan_value);
768 /* asin x == NaN plus invalid exception for |x| > 1. */
769 TEST_f_f (asin, 1.1L, nan_value, INVALID_EXCEPTION);
770 TEST_f_f (asin, -1.1L, nan_value, INVALID_EXCEPTION);
772 TEST_f_f (asin, 0, 0);
773 TEST_f_f (asin, minus_zero, minus_zero);
774 TEST_f_f (asin, 0.5, M_PI_6l);
775 TEST_f_f (asin, -0.5, -M_PI_6l);
776 TEST_f_f (asin, 1.0, M_PI_2l);
777 TEST_f_f (asin, -1.0, -M_PI_2l);
778 TEST_f_f (asin, 0.7L, 0.77539749661075306374035335271498708L);
789 /* Function not implemented. */
794 TEST_f_f (asinh, 0, 0);
795 TEST_f_f (asinh, minus_zero, minus_zero);
797 TEST_f_f (asinh, plus_infty, plus_infty);
798 TEST_f_f (asinh, minus_infty, minus_infty);
800 TEST_f_f (asinh, nan_value, nan_value);
801 TEST_f_f (asinh, 0.7L, 0.652666566082355786L);
812 /* Function not implemented. */
817 TEST_f_f (atan, 0, 0);
818 TEST_f_f (atan, minus_zero, minus_zero);
820 TEST_f_f (atan, plus_infty, M_PI_2l);
821 TEST_f_f (atan, minus_infty, -M_PI_2l);
822 TEST_f_f (atan, nan_value, nan_value);
824 TEST_f_f (atan, 1, M_PI_4l);
825 TEST_f_f (atan, -1, -M_PI_4l);
827 TEST_f_f (atan, 0.7L, 0.61072596438920861654375887649023613L);
840 /* Function not implemented. */
846 TEST_f_f (atanh, 0, 0);
847 TEST_f_f (atanh, minus_zero, minus_zero);
849 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
850 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
851 TEST_f_f (atanh, nan_value, nan_value);
853 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
854 TEST_f_f (atanh, 1.1L, nan_value, INVALID_EXCEPTION);
855 TEST_f_f (atanh, -1.1L, nan_value, INVALID_EXCEPTION);
857 TEST_f_f (atanh, 0.7L, 0.8673005276940531944L);
868 /* Function not implemented. */
873 /* atan2 (0,x) == 0 for x > 0. */
874 TEST_ff_f (atan2, 0, 1, 0);
876 /* atan2 (-0,x) == -0 for x > 0. */
877 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
879 TEST_ff_f (atan2, 0, 0, 0);
880 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
882 /* atan2 (+0,x) == +pi for x < 0. */
883 TEST_ff_f (atan2, 0, -1, M_PIl);
885 /* atan2 (-0,x) == -pi for x < 0. */
886 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
888 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
889 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
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,+0) == -pi/2 for y < 0. */
898 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
900 /* atan2 (y,-0) == -pi/2 for y < 0. */
901 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
903 /* atan2 (y,inf) == +0 for finite y > 0. */
904 TEST_ff_f (atan2, 1, plus_infty, 0);
906 /* atan2 (y,inf) == -0 for finite y < 0. */
907 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
909 /* atan2(+inf, x) == pi/2 for finite x. */
910 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
912 /* atan2(-inf, x) == -pi/2 for finite x. */
913 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
915 /* atan2 (y,-inf) == +pi for finite y > 0. */
916 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
918 /* atan2 (y,-inf) == -pi for finite y < 0. */
919 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
921 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
922 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
923 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
924 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
925 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
927 TEST_ff_f (atan2, 0.7L, 1, 0.61072596438920861654375887649023613L);
928 TEST_ff_f (atan2, -0.7L, 1.0L, -0.61072596438920861654375887649023613L);
929 TEST_ff_f (atan2, 0.7L, -1.0L, 2.530866689200584621918884506789267L);
930 TEST_ff_f (atan2, -0.7L, -1.0L, -2.530866689200584621918884506789267L);
931 TEST_ff_f (atan2, 0.4L, 0.0003L, 1.5700463269355215717704032607580829L);
932 TEST_ff_f (atan2, 1.4L, -0.93L, 2.1571487668237843754887415992772736L);
942 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
944 /* Function not implemented. */
949 /* cabs (x + iy) is specified as hypot (x,y) */
951 /* cabs (+inf + i x) == +inf. */
952 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
953 /* cabs (-inf + i x) == +inf. */
954 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
956 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
957 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
959 TEST_c_f (cabs, nan_value, nan_value, nan_value);
961 /* cabs (x,y) == cabs (y,x). */
962 TEST_c_f (cabs, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
963 /* cabs (x,y) == cabs (-x,y). */
964 TEST_c_f (cabs, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
965 /* cabs (x,y) == cabs (-y,x). */
966 TEST_c_f (cabs, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
967 /* cabs (x,y) == cabs (-x,-y). */
968 TEST_c_f (cabs, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
969 /* cabs (x,y) == cabs (-y,-x). */
970 TEST_c_f (cabs, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
971 /* cabs (x,0) == fabs (x). */
972 TEST_c_f (cabs, -0.7L, 0, 0.7L);
973 TEST_c_f (cabs, 0.7L, 0, 0.7L);
974 TEST_c_f (cabs, -1.0L, 0, 1.0L);
975 TEST_c_f (cabs, 1.0L, 0, 1.0L);
976 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
977 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
979 TEST_c_f (cabs, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
988 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
990 /* Function not implemented. */
996 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
997 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
998 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
999 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1001 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1002 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1004 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1005 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1007 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1008 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1009 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1010 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1011 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1012 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1014 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1015 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1016 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1017 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1019 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1020 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1021 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1022 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1024 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1025 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1027 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1028 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1030 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1031 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1033 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1034 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1036 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1037 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1039 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1041 TEST_c_c (cacos, 0.7L, 1.2L, 1.1351827477151551088992008271819053L, -1.0927647857577371459105272080819308L);
1042 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1044 END (cacos, complex);
1052 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1053 if (errno == ENOSYS)
1054 /* Function not implemented. */
1060 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1061 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1062 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1063 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1064 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1065 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1067 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1068 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1070 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1071 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1072 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1073 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1074 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1075 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1077 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1078 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1079 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1080 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1082 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1083 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1084 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1085 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1087 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1088 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1090 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1091 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1093 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1094 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1096 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1097 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1099 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1100 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1102 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1104 TEST_c_c (cacosh, 0.7L, 1.2L, 1.0927647857577371459105272080819308L, 1.1351827477151551088992008271819053L);
1105 TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
1107 END (cacosh, complex);
1115 /* carg (x + iy) is specified as atan2 (y, x) */
1117 /* carg (x + i 0) == 0 for x > 0. */
1118 TEST_c_f (carg, 2.0, 0, 0);
1119 /* carg (x - i 0) == -0 for x > 0. */
1120 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1122 TEST_c_f (carg, 0, 0, 0);
1123 TEST_c_f (carg, 0, minus_zero, minus_zero);
1125 /* carg (x + i 0) == +pi for x < 0. */
1126 TEST_c_f (carg, -2.0, 0, M_PIl);
1128 /* carg (x - i 0) == -pi for x < 0. */
1129 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1131 TEST_c_f (carg, minus_zero, 0, M_PIl);
1132 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
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 (+0 + i y) == -pi/2 for y < 0. */
1141 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1143 /* carg (-0 + i y) == -pi/2 for y < 0. */
1144 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1146 /* carg (inf + i y) == +0 for finite y > 0. */
1147 TEST_c_f (carg, plus_infty, 2.0, 0);
1149 /* carg (inf + i y) == -0 for finite y < 0. */
1150 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1152 /* carg(x + i inf) == pi/2 for finite x. */
1153 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1155 /* carg(x - i inf) == -pi/2 for finite x. */
1156 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1158 /* carg (-inf + i y) == +pi for finite y > 0. */
1159 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1161 /* carg (-inf + i y) == -pi for finite y < 0. */
1162 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1164 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1166 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1168 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1170 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1172 TEST_c_f (carg, nan_value, nan_value, nan_value);
1181 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1182 if (errno == ENOSYS)
1183 /* Function not implemented. */
1188 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1189 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1190 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1191 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1193 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1194 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1195 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1196 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1198 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1199 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1200 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1201 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1202 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1203 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1204 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1205 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1207 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1208 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1209 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1210 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1212 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1213 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1214 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1215 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1217 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1218 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1220 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1221 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1223 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1224 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1226 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1227 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1229 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1230 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1232 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1234 TEST_c_c (casin, 0.7L, 1.2L, 0.4356135790797415103321208644578462L, 1.0927647857577371459105272080819308L);
1235 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1237 END (casin, complex);
1245 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1246 if (errno == ENOSYS)
1247 /* Function not implemented. */
1252 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1253 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1254 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1255 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1257 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1258 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1259 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1260 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1262 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1263 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1264 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1265 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1266 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1267 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1268 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1269 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1271 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1272 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1273 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1274 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1276 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1277 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1278 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1279 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1281 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1282 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1284 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1285 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1287 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1288 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1290 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1291 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1293 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1294 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1296 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1298 TEST_c_c (casinh, 0.7L, 1.2L, 0.97865459559367387689317593222160964L, 0.91135418953156011567903546856170941L);
1299 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1301 END (casinh, complex);
1309 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1310 if (errno == ENOSYS)
1311 /* Function not implemented. */
1316 TEST_c_c (catan, 0, 0, 0, 0);
1317 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1318 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1319 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1321 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1322 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1323 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1324 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1327 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1328 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1329 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1330 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1331 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1332 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1333 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1334 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1336 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1337 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1338 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1339 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1341 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1342 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1343 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1344 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1346 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1347 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1349 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1350 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1352 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1353 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1355 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1356 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1358 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1359 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1361 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1362 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1364 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1366 TEST_c_c (catan, 0.7L, 1.2L, 1.0785743834118921877443707996386368L, 0.57705737765343067644394541889341712L);
1368 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1370 END (catan, complex);
1377 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1378 if (errno == ENOSYS)
1379 /* Function not implemented. */
1384 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1385 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1386 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1387 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1389 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1390 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1391 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1392 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1394 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1395 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1396 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1397 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1398 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1399 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1400 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1401 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1403 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1404 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1405 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1406 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1408 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1409 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1410 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1411 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1413 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1414 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1416 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1417 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1419 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1420 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1422 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1423 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1425 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1426 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1428 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1429 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1431 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1433 TEST_c_c (catanh, 0.7L, 1.2L, 0.2600749516525135959200648705635915L, 0.97024030779509898497385130162655963L);
1434 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1436 END (catanh, complex);
1444 if (errno == ENOSYS)
1445 /* Function not implemented. */
1450 TEST_f_f (cbrt, 0.0, 0.0);
1451 TEST_f_f (cbrt, minus_zero, minus_zero);
1453 TEST_f_f (cbrt, plus_infty, plus_infty);
1454 TEST_f_f (cbrt, minus_infty, minus_infty);
1455 TEST_f_f (cbrt, nan_value, nan_value);
1457 TEST_f_f (cbrt, -0.001L, -0.1L);
1458 TEST_f_f (cbrt, 8, 2);
1459 TEST_f_f (cbrt, -27.0, -3.0);
1460 TEST_f_f (cbrt, 0.970299L, 0.99L);
1461 TEST_f_f (cbrt, 0.7L, 0.8879040017426007084L);
1470 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1471 if (errno == ENOSYS)
1472 /* Function not implemented. */
1477 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1478 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1479 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1480 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1482 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1483 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1484 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1485 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1487 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1488 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1489 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1490 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1492 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1493 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1494 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1495 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1497 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1498 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1499 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1500 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1502 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1503 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1504 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1505 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1507 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1508 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1510 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1511 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1513 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1514 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1516 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1517 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1519 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1520 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1522 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1523 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1525 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1527 TEST_c_c (ccos, 0.7L, 1.2L, 1.3848657645312111080L, -0.97242170335830028619L);
1529 TEST_c_c (ccos, -2, -3, -4.1896256909688072301L, -9.1092278937553365979L);
1531 END (ccos, complex);
1539 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1540 if (errno == ENOSYS)
1541 /* Function not implemented. */
1546 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1547 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1548 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1549 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1551 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1552 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1553 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1554 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1556 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1557 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1558 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1559 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1561 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1562 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1563 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1564 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1566 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1567 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1568 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1569 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1571 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1572 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1573 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1574 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1576 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1577 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1579 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1580 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1582 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1583 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1585 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1586 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1588 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1589 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1591 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1592 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1594 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1596 TEST_c_c (ccosh, 0.7L, 1.2L, 0.4548202223691477654L, 0.7070296600921537682L);
1598 TEST_c_c (ccosh, -2, -3, -3.7245455049153225654L, 0.5118225699873846088L);
1600 END (ccosh, complex);
1609 TEST_f_f (ceil, 0.0, 0.0);
1610 TEST_f_f (ceil, minus_zero, minus_zero);
1611 TEST_f_f (ceil, plus_infty, plus_infty);
1612 TEST_f_f (ceil, minus_infty, minus_infty);
1613 TEST_f_f (ceil, nan_value, nan_value);
1615 TEST_f_f (ceil, M_PIl, 4.0);
1616 TEST_f_f (ceil, -M_PIl, -3.0);
1626 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1627 if (errno == ENOSYS)
1628 /* Function not implemented. */
1633 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1634 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1635 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1636 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1638 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1639 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1641 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1642 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1644 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1645 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1647 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1648 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1650 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1651 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1653 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1654 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1656 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1657 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1658 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1659 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1661 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1662 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1664 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1665 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1667 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1669 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1671 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1672 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1674 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1675 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1676 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1677 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1679 TEST_c_c (cexp, 0.7L, 1.2L, 0.72969890915032360123451688642930727L, 1.8768962328348102821139467908203072L);
1680 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1682 END (cexp, complex);
1689 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1690 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1691 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1692 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1693 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1694 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1695 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1704 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1705 if (errno == ENOSYS)
1706 /* Function not implemented. */
1711 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1712 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1714 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1715 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1717 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1718 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1720 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1721 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1723 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1724 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1725 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1726 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1727 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1728 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1729 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1730 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1732 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1733 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1734 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1735 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1737 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1738 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1739 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1740 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1742 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1743 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1745 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1746 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1748 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1749 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1750 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1751 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1753 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1754 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1755 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1756 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1758 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1759 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1761 END (clog, complex);
1769 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1770 if (errno == ENOSYS)
1771 /* Function not implemented. */
1776 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1777 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1779 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1780 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1782 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1784 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1785 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1787 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1788 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1789 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1790 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1791 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1792 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1793 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1794 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1796 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1797 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1798 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1799 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1801 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1802 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1803 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1804 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1806 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1807 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1809 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1810 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1812 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1813 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1814 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1815 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1817 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1818 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1819 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1820 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1822 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1824 TEST_c_c (clog10, 0.7L, 1.2L, 0.1427786545038868803L, 0.4528483579352493248L);
1825 TEST_c_c (clog10, -2, -3, 0.5569716761534183846L, -0.9375544629863747085L);
1827 END (clog10, complex);
1834 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1835 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1836 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1837 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1838 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1839 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1840 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1842 END (conj, complex);
1847 copysign_test (void)
1851 TEST_ff_f (copysign, 0, 4, 0);
1852 TEST_ff_f (copysign, 0, -4, minus_zero);
1853 TEST_ff_f (copysign, minus_zero, 4, 0);
1854 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1856 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1857 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1858 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1859 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1861 TEST_ff_f (copysign, 0, plus_infty, 0);
1862 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1863 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1864 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1866 /* XXX More correctly we would have to check the sign of the NaN. */
1867 TEST_ff_f (copysign, nan_value, 0, nan_value);
1868 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1869 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1870 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1880 if (errno == ENOSYS)
1881 /* Function not implemented. */
1886 TEST_f_f (cos, 0, 1);
1887 TEST_f_f (cos, minus_zero, 1);
1888 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1889 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1890 TEST_f_f (cos, nan_value, nan_value);
1892 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1893 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1894 TEST_f_f (cos, M_PI_2l, 0);
1896 TEST_f_f (cos, 0.7L, 0.76484218728448842625585999019186495L);
1906 if (errno == ENOSYS)
1907 /* Function not implemented. */
1911 TEST_f_f (cosh, 0, 1);
1912 TEST_f_f (cosh, minus_zero, 1);
1915 TEST_f_f (cosh, plus_infty, plus_infty);
1916 TEST_f_f (cosh, minus_infty, plus_infty);
1918 TEST_f_f (cosh, nan_value, nan_value);
1920 TEST_f_f (cosh, 0.7L, 1.255169005630943018L);
1929 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
1930 if (errno == ENOSYS)
1931 /* Function not implemented. */
1936 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
1937 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
1939 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
1940 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
1942 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
1944 END (cpow, complex);
1951 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
1952 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
1953 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
1954 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
1956 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
1958 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
1959 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
1960 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
1961 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
1963 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
1964 TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
1966 END (cproj, complex);
1973 TEST_c_f (creal, 0.0, 1.0, 0.0);
1974 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
1975 TEST_c_f (creal, nan_value, 1.0, nan_value);
1976 TEST_c_f (creal, nan_value, nan_value, nan_value);
1977 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
1978 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
1979 TEST_c_f (creal, 2.0, 3.0, 2.0);
1988 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
1989 if (errno == ENOSYS)
1990 /* Function not implemented. */
1995 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
1996 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
1997 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
1998 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2000 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2001 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2002 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2003 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2005 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2006 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2007 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2008 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2010 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2011 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2012 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2013 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2015 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2016 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2017 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2018 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2020 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2021 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2022 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2023 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2025 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2026 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2028 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2029 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2031 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2032 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2034 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2035 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2037 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2038 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2040 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2041 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2043 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2045 TEST_c_c (csin, 0.7L, 1.2L, 1.1664563419657581376L, 1.1544997246948547371L);
2047 TEST_c_c (csin, -2, -3, -9.1544991469114295734L, 4.1689069599665643507L);
2049 END (csin, complex);
2057 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2058 if (errno == ENOSYS)
2059 /* Function not implemented. */
2064 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2065 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2066 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2067 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2069 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2070 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2071 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2072 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2074 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2075 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2076 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2077 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2079 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2080 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2081 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2082 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2084 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2085 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2086 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2087 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2089 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2090 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2091 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2092 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2094 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2095 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2097 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2098 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2100 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2101 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2103 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2104 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2106 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2107 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2109 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2110 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2112 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2114 TEST_c_c (csinh, 0.7L, 1.2L, 0.27487868678117583582L, 1.1698665727426565139L);
2115 TEST_c_c (csinh, -2, -3, 3.5905645899857799520L, -0.5309210862485198052L);
2117 END (csinh, complex);
2124 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2125 if (errno == ENOSYS)
2126 /* Function not implemented. */
2131 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2132 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2133 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2134 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2136 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2137 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2138 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2139 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2141 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2142 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2143 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2144 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2146 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2147 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2148 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2149 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2150 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2151 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2152 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2153 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2154 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2155 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2156 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2157 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2159 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2161 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2163 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2164 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2165 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2166 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2168 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2169 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2170 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2171 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2173 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2175 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2176 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2177 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2178 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2179 TEST_c_c (csqrt, 0.7L, 1.2L, 1.022067610030026450706487883081139L, 0.58704531296356521154977678719838035L);
2180 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2181 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2183 END (csqrt, complex);
2190 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2191 if (errno == ENOSYS)
2192 /* Function not implemented. */
2197 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2198 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2199 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2200 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2202 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2203 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2204 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2205 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2207 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2208 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2209 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2210 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2212 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2213 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2214 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2215 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2216 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2217 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2218 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2219 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2221 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2222 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2224 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2225 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2227 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2228 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2230 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2231 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2232 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2233 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2235 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2237 TEST_c_c (ctan, 0.7L, 1.2L, 0.1720734197630349001L, 0.9544807059989405538L);
2238 TEST_c_c (ctan, -2, -3, 0.0037640256415042482L, -1.0032386273536098014L);
2240 END (ctan, complex);
2248 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2249 if (errno == ENOSYS)
2250 /* Function not implemented. */
2255 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2256 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2257 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2258 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2260 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2261 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2262 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2263 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2264 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2265 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2266 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2267 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2269 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2270 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2271 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2272 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2273 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2274 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2275 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2276 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2278 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2279 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2281 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2282 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2284 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2285 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2287 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2288 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2289 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2290 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2292 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2294 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2296 TEST_c_c (ctanh, 0.7L, 1.2L, 1.3472197399061191630L, 0.4778641038326365540L);
2297 TEST_c_c (ctanh, -2, -3, -0.9653858790221331242L, 0.0098843750383224937L);
2299 END (ctanh, complex);
2307 if (errno == ENOSYS)
2308 /* Function not implemented. */
2313 TEST_f_f (erf, 0, 0);
2314 TEST_f_f (erf, minus_zero, minus_zero);
2315 TEST_f_f (erf, plus_infty, 1);
2316 TEST_f_f (erf, minus_infty, -1);
2317 TEST_f_f (erf, nan_value, nan_value);
2319 TEST_f_f (erf, 0.7L, 0.67780119383741847297L);
2321 TEST_f_f (erf, 1.2L, 0.91031397822963538024L);
2322 TEST_f_f (erf, 2.0, 0.99532226501895273416L);
2323 TEST_f_f (erf, 4.1L, 0.99999999329997234592L);
2324 TEST_f_f (erf, 27, 1.0L);
2335 if (errno == ENOSYS)
2336 /* Function not implemented. */
2341 TEST_f_f (erfc, plus_infty, 0.0);
2342 TEST_f_f (erfc, minus_infty, 2.0);
2343 TEST_f_f (erfc, 0.0, 1.0);
2344 TEST_f_f (erfc, minus_zero, 1.0);
2345 TEST_f_f (erfc, nan_value, nan_value);
2347 TEST_f_f (erfc, 0.7L, 0.32219880616258152702L);
2349 TEST_f_f (erfc, 1.2L, 0.089686021770364619762L);
2350 TEST_f_f (erfc, 2.0, 0.0046777349810472658379L);
2351 TEST_f_f (erfc, 4.1L, 0.67000276540848983727e-8L);
2352 TEST_f_f (erfc, 9, 0.41370317465138102381e-36L);
2362 if (errno == ENOSYS)
2363 /* Function not implemented. */
2368 TEST_f_f (exp, 0, 1);
2369 TEST_f_f (exp, minus_zero, 1);
2372 TEST_f_f (exp, plus_infty, plus_infty);
2373 TEST_f_f (exp, minus_infty, 0);
2375 TEST_f_f (exp, nan_value, nan_value);
2376 TEST_f_f (exp, 1, M_El);
2378 TEST_f_f (exp, 2, M_E2l);
2379 TEST_f_f (exp, 3, M_E3l);
2380 TEST_f_f (exp, 0.7L, 2.0137527074704765216L);
2381 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
2383 /* The result can only be represented in long double. */
2384 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
2395 if (errno == ENOSYS)
2396 /* Function not implemented. */
2401 TEST_f_f (exp10, 0, 1);
2402 TEST_f_f (exp10, minus_zero, 1);
2404 TEST_f_f (exp10, plus_infty, plus_infty);
2405 TEST_f_f (exp10, minus_infty, 0);
2406 TEST_f_f (exp10, nan_value, nan_value);
2407 TEST_f_f (exp10, 3, 1000);
2408 TEST_f_f (exp10, -1, 0.1L);
2409 TEST_f_f (exp10, 1e6, plus_infty);
2410 TEST_f_f (exp10, -1e6, 0);
2411 TEST_f_f (exp10, 0.7L, 5.0118723362727228500155418688494574L);
2421 if (errno == ENOSYS)
2422 /* Function not implemented. */
2427 TEST_f_f (exp2, 0, 1);
2428 TEST_f_f (exp2, minus_zero, 1);
2429 TEST_f_f (exp2, plus_infty, plus_infty);
2430 TEST_f_f (exp2, minus_infty, 0);
2431 TEST_f_f (exp2, nan_value, nan_value);
2433 TEST_f_f (exp2, 10, 1024);
2434 TEST_f_f (exp2, -1, 0.5);
2435 TEST_f_f (exp2, 1e6, plus_infty);
2436 TEST_f_f (exp2, -1e6, 0);
2437 TEST_f_f (exp2, 0.7L, 1.6245047927124710452L);
2447 if (errno == ENOSYS)
2448 /* Function not implemented. */
2453 TEST_f_f (expm1, 0, 0);
2454 TEST_f_f (expm1, minus_zero, minus_zero);
2457 TEST_f_f (expm1, plus_infty, plus_infty);
2458 TEST_f_f (expm1, minus_infty, -1);
2460 TEST_f_f (expm1, nan_value, nan_value);
2462 TEST_f_f (expm1, 1, M_El - 1.0);
2463 TEST_f_f (expm1, 0.7L, 1.0137527074704765216L);
2473 TEST_f_f (fabs, 0, 0);
2474 TEST_f_f (fabs, minus_zero, 0);
2476 TEST_f_f (fabs, plus_infty, plus_infty);
2477 TEST_f_f (fabs, minus_infty, plus_infty);
2478 TEST_f_f (fabs, nan_value, nan_value);
2480 TEST_f_f (fabs, 38.0, 38.0);
2481 TEST_f_f (fabs, -M_El, M_El);
2491 TEST_ff_f (fdim, 0, 0, 0);
2492 TEST_ff_f (fdim, 9, 0, 9);
2493 TEST_ff_f (fdim, 0, 9, 0);
2494 TEST_ff_f (fdim, -9, 0, 0);
2495 TEST_ff_f (fdim, 0, -9, 9);
2497 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2498 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2499 TEST_ff_f (fdim, minus_infty, 9, 0);
2500 TEST_ff_f (fdim, minus_infty, -9, 0);
2501 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2502 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2503 TEST_ff_f (fdim, 9, plus_infty, 0);
2504 TEST_ff_f (fdim, -9, plus_infty, 0);
2506 TEST_ff_f (fdim, 0, nan_value, nan_value);
2507 TEST_ff_f (fdim, 9, nan_value, nan_value);
2508 TEST_ff_f (fdim, -9, nan_value, nan_value);
2509 TEST_ff_f (fdim, nan_value, 9, nan_value);
2510 TEST_ff_f (fdim, nan_value, -9, nan_value);
2511 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2512 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2513 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2514 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2515 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2525 TEST_f_f (floor, 0.0, 0.0);
2526 TEST_f_f (floor, minus_zero, minus_zero);
2527 TEST_f_f (floor, plus_infty, plus_infty);
2528 TEST_f_f (floor, minus_infty, minus_infty);
2529 TEST_f_f (floor, nan_value, nan_value);
2531 TEST_f_f (floor, M_PIl, 3.0);
2532 TEST_f_f (floor, -M_PIl, -4.0);
2542 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2543 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2544 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2545 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2546 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2547 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2548 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2549 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2550 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2551 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2552 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2553 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2555 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2556 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2557 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2558 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2569 TEST_ff_f (fmax, 0, 0, 0);
2570 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2571 TEST_ff_f (fmax, 9, 0, 9);
2572 TEST_ff_f (fmax, 0, 9, 9);
2573 TEST_ff_f (fmax, -9, 0, 0);
2574 TEST_ff_f (fmax, 0, -9, 0);
2576 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2577 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2578 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2579 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2581 TEST_ff_f (fmax, minus_infty, 9, 9);
2582 TEST_ff_f (fmax, minus_infty, -9, -9);
2583 TEST_ff_f (fmax, 9, minus_infty, 9);
2584 TEST_ff_f (fmax, -9, minus_infty, -9);
2586 TEST_ff_f (fmax, 0, nan_value, 0);
2587 TEST_ff_f (fmax, 9, nan_value, 9);
2588 TEST_ff_f (fmax, -9, nan_value, -9);
2589 TEST_ff_f (fmax, nan_value, 0, 0);
2590 TEST_ff_f (fmax, nan_value, 9, 9);
2591 TEST_ff_f (fmax, nan_value, -9, -9);
2592 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2593 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2594 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2595 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2596 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2607 TEST_ff_f (fmin, 0, 0, 0);
2608 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2609 TEST_ff_f (fmin, 9, 0, 0);
2610 TEST_ff_f (fmin, 0, 9, 0);
2611 TEST_ff_f (fmin, -9, 0, -9);
2612 TEST_ff_f (fmin, 0, -9, -9);
2614 TEST_ff_f (fmin, plus_infty, 9, 9);
2615 TEST_ff_f (fmin, 9, plus_infty, 9);
2616 TEST_ff_f (fmin, plus_infty, -9, -9);
2617 TEST_ff_f (fmin, -9, plus_infty, -9);
2618 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2619 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2620 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2621 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2623 TEST_ff_f (fmin, 0, nan_value, 0);
2624 TEST_ff_f (fmin, 9, nan_value, 9);
2625 TEST_ff_f (fmin, -9, nan_value, -9);
2626 TEST_ff_f (fmin, nan_value, 0, 0);
2627 TEST_ff_f (fmin, nan_value, 9, 9);
2628 TEST_ff_f (fmin, nan_value, -9, -9);
2629 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2630 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2631 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2632 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2633 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2643 FUNC(fmod) (6.5, 2.3L);
2644 if (errno == ENOSYS)
2645 /* Function not implemented. */
2650 /* fmod (+0, y) == +0 for y != 0. */
2651 TEST_ff_f (fmod, 0, 3, 0);
2653 /* fmod (-0, y) == -0 for y != 0. */
2654 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2656 /* fmod (+inf, y) == NaN plus invalid exception. */
2657 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2658 /* fmod (-inf, y) == NaN plus invalid exception. */
2659 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2660 /* fmod (x, +0) == NaN plus invalid exception. */
2661 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2662 /* fmod (x, -0) == NaN plus invalid exception. */
2663 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2665 /* fmod (x, +inf) == x for x not infinite. */
2666 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2667 /* fmod (x, -inf) == x for x not infinite. */
2668 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2670 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2672 TEST_ff_f (fmod, 6.5, 2.3L, 1.9L);
2673 TEST_ff_f (fmod, -6.5, 2.3L, -1.9L);
2674 TEST_ff_f (fmod, 6.5, -2.3L, 1.9L);
2675 TEST_ff_f (fmod, -6.5, -2.3L, -1.9L);
2681 fpclassify_test (void)
2685 TEST_f_i (fpclassify, nan_value, FP_NAN);
2686 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2687 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2688 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2689 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2690 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2703 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2704 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2705 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2707 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2708 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2710 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
2711 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
2723 if (errno == ENOSYS)
2724 /* Function not implemented. */
2726 feclearexcept (FE_ALL_EXCEPT);
2730 TEST_f_f (gamma, plus_infty, plus_infty);
2731 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2732 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2733 TEST_f_f (gamma, minus_infty, plus_infty);
2734 TEST_f_f (gamma, nan_value, nan_value);
2736 TEST_f_f1 (gamma, 1, 0, 1);
2737 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2739 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2740 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2749 FUNC(hypot) (0.7L, 12.4L);
2750 if (errno == ENOSYS)
2751 /* Function not implemented. */
2756 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2757 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2760 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2761 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2762 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2763 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2766 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2768 /* hypot (x,y) == hypot (+-x, +-y) */
2769 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
2770 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
2771 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
2772 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
2773 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
2774 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
2775 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
2776 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
2778 /* hypot (x,0) == fabs (x) */
2779 TEST_ff_f (hypot, 0.7L, 0, 0.7L);
2780 TEST_ff_f (hypot, -0.7L, 0, 0.7L);
2781 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
2783 TEST_ff_f (hypot, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
2794 TEST_f_i (ilogb, 1, 0);
2795 TEST_f_i (ilogb, M_El, 1);
2796 TEST_f_i (ilogb, 1024, 10);
2797 TEST_f_i (ilogb, -2000, 10);
2799 /* XXX We have a problem here: the standard does not tell us whether
2800 exceptions are allowed/required. ignore them for now. */
2802 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
2803 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
2804 TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
2805 TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
2811 isfinite_test (void)
2815 TEST_f_b (isfinite, 0, 1);
2816 TEST_f_b (isfinite, minus_zero, 1);
2817 TEST_f_b (isfinite, 10, 1);
2818 TEST_f_b (isfinite, plus_infty, 0);
2819 TEST_f_b (isfinite, minus_infty, 0);
2820 TEST_f_b (isfinite, nan_value, 0);
2826 isnormal_test (void)
2830 TEST_f_b (isnormal, 0, 0);
2831 TEST_f_b (isnormal, minus_zero, 0);
2832 TEST_f_b (isnormal, 10, 1);
2833 TEST_f_b (isnormal, plus_infty, 0);
2834 TEST_f_b (isnormal, minus_infty, 0);
2835 TEST_f_b (isnormal, nan_value, 0);
2845 FUNC (sincos) (0, &s, &c);
2846 if (errno == ENOSYS)
2847 /* Required function not implemented. */
2850 if (errno == ENOSYS)
2851 /* Function not implemented. */
2856 /* j0 is the Bessel function of the first kind of order 0 */
2857 TEST_f_f (j0, nan_value, nan_value);
2858 TEST_f_f (j0, plus_infty, 0);
2859 TEST_f_f (j0, -1.0, 0.76519768655796655145L);
2860 TEST_f_f (j0, 0.0, 1.0);
2861 TEST_f_f (j0, 0.1L, 0.99750156206604003228L);
2862 TEST_f_f (j0, 0.7L, 0.88120088860740528084L);
2863 TEST_f_f (j0, 1.0, 0.76519768655796655145L);
2864 TEST_f_f (j0, 1.5, 0.51182767173591812875L);
2865 TEST_f_f (j0, 2.0, 0.22389077914123566805L);
2866 TEST_f_f (j0, 8.0, 0.17165080713755390609L);
2867 TEST_f_f (j0, 10.0, -0.24593576445134833520L);
2878 FUNC (sincos) (0, &s, &c);
2879 if (errno == ENOSYS)
2880 /* Required function not implemented. */
2883 if (errno == ENOSYS)
2884 /* Function not implemented. */
2887 /* j1 is the Bessel function of the first kind of order 1 */
2891 TEST_f_f (j1, nan_value, nan_value);
2892 TEST_f_f (j1, plus_infty, 0);
2894 TEST_f_f (j1, -1.0, -0.44005058574493351596L);
2895 TEST_f_f (j1, 0.0, 0.0);
2896 TEST_f_f (j1, 0.1L, 0.049937526036241997556L);
2897 TEST_f_f (j1, 0.7L, 0.32899574154005894785L);
2898 TEST_f_f (j1, 1.0, 0.44005058574493351596L);
2899 TEST_f_f (j1, 1.5, 0.55793650791009964199L);
2900 TEST_f_f (j1, 2.0, 0.57672480775687338720L);
2901 TEST_f_f (j1, 8.0, 0.23463634685391462438L);
2902 TEST_f_f (j1, 10.0, 0.043472746168861436670L);
2912 FUNC (sincos) (0, &s, &c);
2913 if (errno == ENOSYS)
2914 /* Required function not implemented. */
2917 if (errno == ENOSYS)
2918 /* Function not implemented. */
2921 /* jn is the Bessel function of the first kind of order n. */
2924 /* jn (0, x) == j0 (x) */
2925 TEST_ff_f (jn, 0, nan_value, nan_value);
2926 TEST_ff_f (jn, 0, plus_infty, 0);
2927 TEST_ff_f (jn, 0, -1.0, 0.76519768655796655145L);
2928 TEST_ff_f (jn, 0, 0.0, 1.0);
2929 TEST_ff_f (jn, 0, 0.1L, 0.99750156206604003228L);
2930 TEST_ff_f (jn, 0, 0.7L, 0.88120088860740528084L);
2931 TEST_ff_f (jn, 0, 1.0, 0.76519768655796655145L);
2932 TEST_ff_f (jn, 0, 1.5, 0.51182767173591812875L);
2933 TEST_ff_f (jn, 0, 2.0, 0.22389077914123566805L);
2934 TEST_ff_f (jn, 0, 8.0, 0.17165080713755390609L);
2935 TEST_ff_f (jn, 0, 10.0, -0.24593576445134833520L);
2937 /* jn (1, x) == j1 (x) */
2938 TEST_ff_f (jn, 1, nan_value, nan_value);
2939 TEST_ff_f (jn, 1, plus_infty, 0);
2941 TEST_ff_f (jn, 1, -1.0, -0.44005058574493351596L);
2942 TEST_ff_f (jn, 1, 0.0, 0.0);
2943 TEST_ff_f (jn, 1, 0.1L, 0.049937526036241997556L);
2944 TEST_ff_f (jn, 1, 0.7L, 0.32899574154005894785L);
2945 TEST_ff_f (jn, 1, 1.0, 0.44005058574493351596L);
2946 TEST_ff_f (jn, 1, 1.5, 0.55793650791009964199L);
2947 TEST_ff_f (jn, 1, 2.0, 0.57672480775687338720L);
2948 TEST_ff_f (jn, 1, 8.0, 0.23463634685391462438L);
2949 TEST_ff_f (jn, 1, 10.0, 0.043472746168861436670L);
2952 TEST_ff_f (jn, 3, nan_value, nan_value);
2953 TEST_ff_f (jn, 3, plus_infty, 0);
2955 TEST_ff_f (jn, 3, -1.0, -0.019563353982668405919L);
2956 TEST_ff_f (jn, 3, 0.0, 0.0);
2957 TEST_ff_f (jn, 3, 0.1L, 0.000020820315754756261429L);
2958 TEST_ff_f (jn, 3, 0.7L, 0.0069296548267508408077L);
2959 TEST_ff_f (jn, 3, 1.0, 0.019563353982668405919L);
2960 TEST_ff_f (jn, 3, 2.0, 0.12894324947440205110L);
2961 TEST_ff_f (jn, 3, 10.0, 0.058379379305186812343L);
2964 TEST_ff_f (jn, 10, nan_value, nan_value);
2965 TEST_ff_f (jn, 10, plus_infty, 0);
2967 TEST_ff_f (jn, 10, -1.0, 0.26306151236874532070e-9L);
2968 TEST_ff_f (jn, 10, 0.0, 0.0);
2969 TEST_ff_f (jn, 10, 0.1L, 0.26905328954342155795e-19L);
2970 TEST_ff_f (jn, 10, 0.7L, 0.75175911502153953928e-11L);
2971 TEST_ff_f (jn, 10, 1.0, 0.26306151236874532070e-9L);
2972 TEST_ff_f (jn, 10, 2.0, 0.25153862827167367096e-6L);
2973 TEST_ff_f (jn, 10, 10.0, 0.20748610663335885770L);
2982 TEST_ff_f (ldexp, 0, 0, 0);
2983 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
2985 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
2986 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
2987 TEST_ff_f (ldexp, nan_value, 1, nan_value);
2989 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
2990 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
2992 /* ldexp (x, 0) == x. */
2993 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
3001 if (errno == ENOSYS)
3002 /* Function not implemented. */
3004 feclearexcept (FE_ALL_EXCEPT);
3008 TEST_f_f (lgamma, plus_infty, plus_infty);
3009 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3010 TEST_f_f (lgamma, nan_value, nan_value);
3012 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3013 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3014 TEST_f_f (lgamma, minus_infty, plus_infty);
3016 TEST_f_f1 (lgamma, 1, 0, 1);
3018 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3020 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3021 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3022 TEST_f_f1 (lgamma, 0.7L, 0.26086724653166651439L, 1);
3023 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197e-1L, 1);
3031 /* XXX this test is incomplete. We need to have a way to specifiy
3032 the rounding method and test the critical cases. So far, only
3033 unproblematic numbers are tested. */
3037 TEST_f_l (lrint, 0.0, 0);
3038 TEST_f_l (lrint, minus_zero, 0);
3039 TEST_f_l (lrint, 0.2L, 0);
3040 TEST_f_l (lrint, -0.2L, 0);
3042 TEST_f_l (lrint, 1.4L, 1);
3043 TEST_f_l (lrint, -1.4L, -1);
3045 TEST_f_l (lrint, 8388600.3L, 8388600);
3046 TEST_f_l (lrint, -8388600.3L, -8388600);
3054 /* XXX this test is incomplete. We need to have a way to specifiy
3055 the rounding method and test the critical cases. So far, only
3056 unproblematic numbers are tested. */
3060 TEST_f_L (llrint, 0.0, 0);
3061 TEST_f_L (llrint, minus_zero, 0);
3062 TEST_f_L (llrint, 0.2L, 0);
3063 TEST_f_L (llrint, -0.2L, 0);
3065 TEST_f_L (llrint, 1.4L, 1);
3066 TEST_f_L (llrint, -1.4L, -1);
3068 TEST_f_L (llrint, 8388600.3L, 8388600);
3069 TEST_f_L (llrint, -8388600.3L, -8388600);
3071 /* Test boundary conditions. */
3073 TEST_f_L (llrint, 2097151.0,2097151LL);
3075 TEST_f_L (llrint, 8388608.0, 8388608LL);
3077 TEST_f_L (llrint, 16777216.0, 16777216LL);
3079 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3081 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3082 /* 0x10000000000000 */
3083 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3084 /* 0x10000080000000 */
3085 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3086 /* 0x20000000000000 */
3087 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3088 /* 0x80000000000000 */
3089 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3090 /* 0x100000000000000 */
3091 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3101 if (errno == ENOSYS)
3102 /* Function not implemented. */
3106 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3107 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3109 TEST_f_f (log, 1, 0);
3111 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
3112 TEST_f_f (log, plus_infty, plus_infty);
3114 TEST_f_f (log, M_El, 1);
3115 TEST_f_f (log, 1.0 / M_El, -1);
3116 TEST_f_f (log, 2, M_LN2l);
3117 TEST_f_f (log, 10, M_LN10l);
3118 TEST_f_f (log, 0.7L, -0.35667494393873237891263871124118447L);
3129 if (errno == ENOSYS)
3130 /* Function not implemented. */
3135 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3136 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3138 TEST_f_f (log10, 1, 0);
3140 /* log10 (x) == NaN plus invalid exception if x < 0. */
3141 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
3143 TEST_f_f (log10, plus_infty, plus_infty);
3144 TEST_f_f (log10, nan_value, nan_value);
3146 TEST_f_f (log10, 0.1L, -1);
3147 TEST_f_f (log10, 10.0, 1);
3148 TEST_f_f (log10, 100.0, 2);
3149 TEST_f_f (log10, 10000.0, 4);
3150 TEST_f_f (log10, M_El, M_LOG10El);
3151 TEST_f_f (log10, 0.7L, -0.15490195998574316929L);
3162 if (errno == ENOSYS)
3163 /* Function not implemented. */
3168 TEST_f_f (log1p, 0, 0);
3169 TEST_f_f (log1p, minus_zero, minus_zero);
3171 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3172 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
3174 TEST_f_f (log1p, plus_infty, plus_infty);
3175 TEST_f_f (log1p, nan_value, nan_value);
3177 TEST_f_f (log1p, M_El - 1.0, 1);
3179 TEST_f_f (log1p, -0.3L, -0.35667494393873237891263871124118447L);
3190 if (errno == ENOSYS)
3191 /* Function not implemented. */
3196 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3197 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3199 TEST_f_f (log2, 1, 0);
3201 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
3203 TEST_f_f (log2, plus_infty, plus_infty);
3204 TEST_f_f (log2, nan_value, nan_value);
3206 TEST_f_f (log2, M_El, M_LOG2El);
3207 TEST_f_f (log2, 2.0, 1);
3208 TEST_f_f (log2, 16.0, 4);
3209 TEST_f_f (log2, 256.0, 8);
3210 TEST_f_f (log2, 0.7L, -0.51457317282975824043L);
3221 TEST_f_f (logb, plus_infty, plus_infty);
3222 TEST_f_f (logb, minus_infty, plus_infty);
3224 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3226 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3227 TEST_f_f (logb, nan_value, nan_value);
3229 TEST_f_f (logb, 1, 0);
3230 TEST_f_f (logb, M_El, 1);
3231 TEST_f_f (logb, 1024, 10);
3232 TEST_f_f (logb, -2000, 10);
3242 TEST_f_l (lround, 0, 0);
3243 TEST_f_l (lround, minus_zero, 0);
3244 TEST_f_l (lround, 0.2L, 0.0);
3245 TEST_f_l (lround, -0.2L, 0);
3246 TEST_f_l (lround, 0.5, 1);
3247 TEST_f_l (lround, -0.5, -1);
3248 TEST_f_l (lround, 0.8L, 1);
3249 TEST_f_l (lround, -0.8L, -1);
3250 TEST_f_l (lround, 1.5, 2);
3251 TEST_f_l (lround, -1.5, -2);
3252 TEST_f_l (lround, 22514.5, 22515);
3253 TEST_f_l (lround, -22514.5, -22515);
3255 TEST_f_l (lround, 2097152.5, 2097153);
3256 TEST_f_l (lround, -2097152.5, -2097153);
3267 TEST_f_L (llround, 0, 0);
3268 TEST_f_L (llround, minus_zero, 0);
3269 TEST_f_L (llround, 0.2L, 0.0);
3270 TEST_f_L (llround, -0.2L, 0);
3271 TEST_f_L (llround, 0.5, 1);
3272 TEST_f_L (llround, -0.5, -1);
3273 TEST_f_L (llround, 0.8L, 1);
3274 TEST_f_L (llround, -0.8L, -1);
3275 TEST_f_L (llround, 1.5, 2);
3276 TEST_f_L (llround, -1.5, -2);
3277 TEST_f_L (llround, 22514.5, 22515);
3278 TEST_f_L (llround, -22514.5, -22515);
3280 TEST_f_L (llround, 2097152.5, 2097153);
3281 TEST_f_L (llround, -2097152.5, -2097153);
3282 TEST_f_L (llround, 34359738368.5, 34359738369ll);
3283 TEST_f_L (llround, -34359738368.5, -34359738369ll);
3286 /* Test boundary conditions. */
3288 TEST_f_L (llround, 2097151.0, 2097151LL);
3290 TEST_f_L (llround, 8388608.0, 8388608LL);
3292 TEST_f_L (llround, 16777216.0, 16777216LL);
3294 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
3296 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
3297 /* 0x10000000000000 */
3298 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
3299 /* 0x10000080000000 */
3300 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3301 /* 0x20000000000000 */
3302 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
3303 /* 0x80000000000000 */
3304 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
3305 /* 0x100000000000000 */
3306 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
3310 TEST_f_L (llround, 4294967295.5, 4294967296LL);
3312 TEST_f_L (llround, 8589934591.5, 8589934592LL);
3325 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
3326 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
3327 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
3328 TEST_fF_f1 (modf, 0, 0, 0);
3329 TEST_fF_f1 (modf, 1.5, 0.5, 1);
3330 TEST_fF_f1 (modf, 2.5, 0.5, 2);
3331 TEST_fF_f1 (modf, -2.5, -0.5, -2);
3332 TEST_fF_f1 (modf, 20, 0, 20);
3333 TEST_fF_f1 (modf, 21, 0, 21);
3334 TEST_fF_f1 (modf, 89.5, 0.5, 89);
3341 nearbyint_test (void)
3345 TEST_f_f (nearbyint, 0.0, 0.0);
3346 TEST_f_f (nearbyint, minus_zero, minus_zero);
3347 TEST_f_f (nearbyint, plus_infty, plus_infty);
3348 TEST_f_f (nearbyint, minus_infty, minus_infty);
3349 TEST_f_f (nearbyint, nan_value, nan_value);
3351 /* Default rounding mode is round to nearest. */
3352 TEST_f_f (nearbyint, 0.5, 0.0);
3353 TEST_f_f (nearbyint, 1.5, 2.0);
3354 TEST_f_f (nearbyint, -0.5, minus_zero);
3355 TEST_f_f (nearbyint, -1.5, -2.0);
3361 nextafter_test (void)
3366 TEST_ff_f (nextafter, 0, 0, 0);
3367 TEST_ff_f (nextafter, minus_zero, 0, 0);
3368 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
3369 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
3371 TEST_ff_f (nextafter, 9, 9, 9);
3372 TEST_ff_f (nextafter, -9, -9, -9);
3373 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
3374 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
3376 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
3377 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
3378 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
3380 /* XXX We need the hexadecimal FP number representation here for further
3388 nexttoward_test (void)
3391 TEST_ff_f (nexttoward, 0, 0, 0);
3392 TEST_ff_f (nexttoward, minus_zero, 0, 0);
3393 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
3394 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
3396 TEST_ff_f (nexttoward, 9, 9, 9);
3397 TEST_ff_f (nexttoward, -9, -9, -9);
3398 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
3399 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
3401 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
3402 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
3403 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
3405 /* XXX We need the hexadecimal FP number representation here for further
3418 if (errno == ENOSYS)
3419 /* Function not implemented. */
3424 TEST_ff_f (pow, 0, 0, 1);
3425 TEST_ff_f (pow, 0, minus_zero, 1);
3426 TEST_ff_f (pow, minus_zero, 0, 1);
3427 TEST_ff_f (pow, minus_zero, minus_zero, 1);
3429 TEST_ff_f (pow, 10, 0, 1);
3430 TEST_ff_f (pow, 10, minus_zero, 1);
3431 TEST_ff_f (pow, -10, 0, 1);
3432 TEST_ff_f (pow, -10, minus_zero, 1);
3434 TEST_ff_f (pow, nan_value, 0, 1);
3435 TEST_ff_f (pow, nan_value, minus_zero, 1);
3439 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
3440 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
3441 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
3442 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
3444 TEST_ff_f (pow, 0.9L, plus_infty, 0);
3445 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
3446 TEST_ff_f (pow, -0.9L, plus_infty, 0);
3447 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
3449 TEST_ff_f (pow, 1.1L, minus_infty, 0);
3450 TEST_ff_f (pow, plus_infty, minus_infty, 0);
3451 TEST_ff_f (pow, -1.1L, minus_infty, 0);
3452 TEST_ff_f (pow, minus_infty, minus_infty, 0);
3454 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
3455 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
3456 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
3457 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
3459 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
3460 TEST_ff_f (pow, plus_infty, 1, plus_infty);
3461 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
3463 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
3464 TEST_ff_f (pow, plus_infty, -1, 0);
3465 TEST_ff_f (pow, plus_infty, -1e7L, 0);
3467 TEST_ff_f (pow, minus_infty, 1, minus_infty);
3468 TEST_ff_f (pow, minus_infty, 11, minus_infty);
3469 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
3471 TEST_ff_f (pow, minus_infty, 2, plus_infty);
3472 TEST_ff_f (pow, minus_infty, 12, plus_infty);
3473 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
3474 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
3475 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
3476 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
3477 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
3479 TEST_ff_f (pow, minus_infty, -1, minus_zero);
3480 TEST_ff_f (pow, minus_infty, -11, minus_zero);
3481 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
3483 TEST_ff_f (pow, minus_infty, -2, 0);
3484 TEST_ff_f (pow, minus_infty, -12, 0);
3485 TEST_ff_f (pow, minus_infty, -1002, 0);
3486 TEST_ff_f (pow, minus_infty, -0.1L, 0);
3487 TEST_ff_f (pow, minus_infty, -1.1L, 0);
3488 TEST_ff_f (pow, minus_infty, -11.1L, 0);
3489 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
3492 TEST_ff_f (pow, nan_value, nan_value, nan_value);
3493 TEST_ff_f (pow, 0, nan_value, nan_value);
3494 TEST_ff_f (pow, 1, nan_value, 1);
3495 TEST_ff_f (pow, -1, nan_value, nan_value);
3496 TEST_ff_f (pow, nan_value, 1, nan_value);
3497 TEST_ff_f (pow, nan_value, -1, nan_value);
3499 /* pow (x, NaN) == NaN. */
3500 TEST_ff_f (pow, 3.0, nan_value, nan_value);
3502 TEST_ff_f (pow, 1, plus_infty, 1);
3503 TEST_ff_f (pow, -1, plus_infty, 1);
3504 TEST_ff_f (pow, 1, minus_infty, 1);
3505 TEST_ff_f (pow, -1, minus_infty, 1);
3507 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3508 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3509 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3510 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3512 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3513 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3514 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3515 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3517 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3518 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3519 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3520 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3523 TEST_ff_f (pow, 0, 1, 0);
3524 TEST_ff_f (pow, 0, 11, 0);
3526 TEST_ff_f (pow, minus_zero, 1, minus_zero);
3527 TEST_ff_f (pow, minus_zero, 11, minus_zero);
3530 TEST_ff_f (pow, 0, 2, 0);
3531 TEST_ff_f (pow, 0, 11.1L, 0);
3534 TEST_ff_f (pow, minus_zero, 2, 0);
3535 TEST_ff_f (pow, minus_zero, 11.1L, 0);
3538 /* pow (x, +inf) == +inf for |x| > 1. */
3539 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
3541 /* pow (x, +inf) == +0 for |x| < 1. */
3542 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
3544 /* pow (x, -inf) == +0 for |x| > 1. */
3545 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
3547 /* pow (x, -inf) == +inf for |x| < 1. */
3548 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
3551 /* pow (+inf, y) == +inf for y > 0. */
3552 TEST_ff_f (pow, plus_infty, 2, plus_infty);
3554 /* pow (+inf, y) == +0 for y < 0. */
3555 TEST_ff_f (pow, plus_infty, -1, 0.0);
3557 /* pow (-inf, y) == -inf for y an odd integer > 0. */
3558 TEST_ff_f (pow, minus_infty, 27, minus_infty);
3560 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
3561 TEST_ff_f (pow, minus_infty, 28, plus_infty);
3563 /* pow (-inf, y) == -0 for y an odd integer < 0. */
3564 TEST_ff_f (pow, minus_infty, -3, minus_zero);
3565 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
3566 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
3568 /* pow (+0, y) == +0 for y an odd integer > 0. */
3569 TEST_ff_f (pow, 0.0, 27, 0.0);
3571 /* pow (-0, y) == -0 for y an odd integer > 0. */
3572 TEST_ff_f (pow, minus_zero, 27, minus_zero);
3574 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
3575 TEST_ff_f (pow, 0.0, 4, 0.0);
3577 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
3578 TEST_ff_f (pow, minus_zero, 4, 0.0);
3580 TEST_ff_f (pow, 0.7L, 1.2L, 0.65180494056638638188L);
3582 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
3583 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
3590 remainder_test (void)
3593 FUNC(remainder) (1.625, 1.0);
3594 if (errno == ENOSYS)
3595 /* Function not implemented. */
3600 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
3601 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
3602 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
3603 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
3604 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
3606 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
3607 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
3608 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
3609 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
3610 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
3611 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
3623 FUNC(remquo) (1.625, 1.0, &x);
3624 if (errno == ENOSYS)
3625 /* Function not implemented. */
3630 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
3631 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
3632 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3633 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3634 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
3636 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
3637 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
3638 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
3639 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
3641 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
3642 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
3652 TEST_f_f (rint, 0.0, 0.0);
3653 TEST_f_f (rint, minus_zero, minus_zero);
3654 TEST_f_f (rint, plus_infty, plus_infty);
3655 TEST_f_f (rint, minus_infty, minus_infty);
3657 /* Default rounding mode is round to even. */
3658 TEST_f_f (rint, 0.5, 0.0);
3659 TEST_f_f (rint, 1.5, 2.0);
3660 TEST_f_f (rint, 2.5, 2.0);
3661 TEST_f_f (rint, 3.5, 4.0);
3662 TEST_f_f (rint, 4.5, 4.0);
3663 TEST_f_f (rint, -0.5, -0.0);
3664 TEST_f_f (rint, -1.5, -2.0);
3665 TEST_f_f (rint, -2.5, -2.0);
3666 TEST_f_f (rint, -3.5, -4.0);
3667 TEST_f_f (rint, -4.5, -4.0);
3677 TEST_f_f (round, 0, 0);
3678 TEST_f_f (round, minus_zero, minus_zero);
3679 TEST_f_f (round, 0.2L, 0.0);
3680 TEST_f_f (round, -0.2L, minus_zero);
3681 TEST_f_f (round, 0.5, 1.0);
3682 TEST_f_f (round, -0.5, -1.0);
3683 TEST_f_f (round, 0.8L, 1.0);
3684 TEST_f_f (round, -0.8L, -1.0);
3685 TEST_f_f (round, 1.5, 2.0);
3686 TEST_f_f (round, -1.5, -2.0);
3687 TEST_f_f (round, 2097152.5, 2097153);
3688 TEST_f_f (round, -2097152.5, -2097153);
3700 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
3701 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
3703 TEST_ff_f (scalb, 0, nan_value, nan_value);
3704 TEST_ff_f (scalb, 1, nan_value, nan_value);
3706 TEST_ff_f (scalb, 1, 0, 1);
3707 TEST_ff_f (scalb, -1, 0, -1);
3709 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
3710 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
3712 TEST_ff_f (scalb, 0, 2, 0);
3713 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
3714 TEST_ff_f (scalb, 0, 0, 0);
3715 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
3716 TEST_ff_f (scalb, 0, -1, 0);
3717 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
3718 TEST_ff_f (scalb, 0, minus_infty, 0);
3719 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
3721 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
3722 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
3723 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
3724 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
3725 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
3726 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
3728 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
3729 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
3731 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
3732 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
3733 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
3734 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
3736 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3737 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3739 TEST_ff_f (scalb, nan_value, 1, nan_value);
3740 TEST_ff_f (scalb, 1, nan_value, nan_value);
3741 TEST_ff_f (scalb, nan_value, 0, nan_value);
3742 TEST_ff_f (scalb, 0, nan_value, nan_value);
3743 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
3744 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
3745 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
3747 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
3748 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
3760 TEST_fi_f (scalbn, 0, 0, 0);
3761 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
3763 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
3764 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
3765 TEST_fi_f (scalbn, nan_value, 1, nan_value);
3767 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
3768 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
3770 TEST_fi_f (scalbn, 1, 0L, 1);
3781 TEST_fl_f (scalbln, 0, 0, 0);
3782 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
3784 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
3785 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
3786 TEST_fl_f (scalbln, nan_value, 1, nan_value);
3788 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
3789 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
3791 TEST_fl_f (scalbln, 1, 0L, 1);
3802 TEST_f_b (signbit, 0, 0);
3803 TEST_f_b (signbit, minus_zero, 1);
3804 TEST_f_b (signbit, plus_infty, 0);
3805 TEST_f_b (signbit, minus_infty, 1);
3807 /* signbit (x) != 0 for x < 0. */
3808 TEST_f_b (signbit, -1, 1);
3809 /* signbit (x) == 0 for x >= 0. */
3810 TEST_f_b (signbit, 1, 0);
3820 if (errno == ENOSYS)
3821 /* Function not implemented. */
3826 TEST_f_f (sin, 0, 0);
3827 TEST_f_f (sin, minus_zero, minus_zero);
3828 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
3829 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
3830 TEST_f_f (sin, nan_value, nan_value);
3832 TEST_f_f (sin, M_PI_6l, 0.5);
3833 TEST_f_f (sin, -M_PI_6l, -0.5);
3834 TEST_f_f (sin, M_PI_2l, 1);
3835 TEST_f_f (sin, -M_PI_2l, -1);
3836 TEST_f_f (sin, 0.7L, 0.64421768723769105367261435139872014L);
3845 FLOAT sin_res, cos_res;
3848 FUNC(sincos) (0, &sin_res, &cos_res);
3849 if (errno == ENOSYS)
3850 /* Function not implemented. */
3855 /* sincos is treated differently because it returns void. */
3856 TEST_extra (sincos, 0, 0, 1);
3858 TEST_extra (sincos, minus_zero, minus_zero, 1);
3859 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3860 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3861 TEST_extra (sincos, nan_value, nan_value, nan_value);
3863 TEST_extra (sincos, M_PI_2l, 1, 0);
3864 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
3865 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
3866 TEST_extra (sincos, 0.7L, 0.64421768723769105367261435139872014L, 0.76484218728448842625585999019186495L);
3876 if (errno == ENOSYS)
3877 /* Function not implemented. */
3881 TEST_f_f (sinh, 0, 0);
3882 TEST_f_f (sinh, minus_zero, minus_zero);
3885 TEST_f_f (sinh, plus_infty, plus_infty);
3886 TEST_f_f (sinh, minus_infty, minus_infty);
3888 TEST_f_f (sinh, nan_value, nan_value);
3890 TEST_f_f (sinh, 0.7L, 0.75858370183953350346L);
3891 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
3901 if (errno == ENOSYS)
3902 /* Function not implemented. */
3907 TEST_f_f (sqrt, 0, 0);
3908 TEST_f_f (sqrt, nan_value, nan_value);
3909 TEST_f_f (sqrt, plus_infty, plus_infty);
3911 TEST_f_f (sqrt, minus_zero, minus_zero);
3913 /* sqrt (x) == NaN plus invalid exception for x < 0. */
3914 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
3915 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
3916 TEST_f_f (sqrt, nan_value, nan_value);
3918 TEST_f_f (sqrt, 2209, 47);
3919 TEST_f_f (sqrt, 4, 2);
3920 TEST_f_f (sqrt, 2, M_SQRT2l);
3921 TEST_f_f (sqrt, 0.25, 0.5);
3922 TEST_f_f (sqrt, 6642.25, 81.5);
3923 TEST_f_f (sqrt, 15239.9025L, 123.45L);
3924 TEST_f_f (sqrt, 0.7L, 0.83666002653407554797817202578518747L);
3934 if (errno == ENOSYS)
3935 /* Function not implemented. */
3940 TEST_f_f (tan, 0, 0);
3941 TEST_f_f (tan, minus_zero, minus_zero);
3942 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
3943 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
3944 TEST_f_f (tan, nan_value, nan_value);
3946 TEST_f_f (tan, M_PI_4l, 1);
3947 TEST_f_f (tan, 0.7L, 0.84228838046307944812813500221293775L);
3957 if (errno == ENOSYS)
3958 /* Function not implemented. */
3963 TEST_f_f (tanh, 0, 0);
3964 TEST_f_f (tanh, minus_zero, minus_zero);
3967 TEST_f_f (tanh, plus_infty, 1);
3968 TEST_f_f (tanh, minus_infty, -1);
3970 TEST_f_f (tanh, nan_value, nan_value);
3972 TEST_f_f (tanh, 0.7L, 0.60436777711716349631L);
3973 TEST_f_f (tanh, -0.7L, -0.60436777711716349631L);
3975 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
3976 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
3979 TEST_f_f (tanh, 6.938893903907228377647697925567626953125e-18L,6.938893903907228377647697925567626953125e-18L);
3989 if (errno == ENOSYS)
3990 /* Function not implemented. */
3992 feclearexcept (FE_ALL_EXCEPT);
3996 TEST_f_f (tgamma, plus_infty, plus_infty);
3997 TEST_f_f (tgamma, 0, nan_value, INVALID_EXCEPTION);
3998 TEST_f_f (tgamma, minus_zero, nan_value, INVALID_EXCEPTION);
3999 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
4000 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
4001 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
4002 TEST_f_f (tgamma, nan_value, nan_value);
4004 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
4005 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
4007 TEST_f_f (tgamma, 1, 1);
4008 TEST_f_f (tgamma, 4, 6);
4010 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568L);
4011 TEST_f_f (tgamma, 1.2L, 0.91816874239976061064L);
4021 TEST_f_f (trunc, plus_infty, plus_infty);
4022 TEST_f_f (trunc, minus_infty, minus_infty);
4023 TEST_f_f (trunc, nan_value, nan_value);
4025 TEST_f_f (trunc, 0, 0);
4026 TEST_f_f (trunc, minus_zero, minus_zero);
4027 TEST_f_f (trunc, 0.625, 0);
4028 TEST_f_f (trunc, -0.625, minus_zero);
4029 TEST_f_f (trunc, 1, 1);
4030 TEST_f_f (trunc, -1, -1);
4031 TEST_f_f (trunc, 1.625, 1);
4032 TEST_f_f (trunc, -1.625, -1);
4034 TEST_f_f (trunc, 1048580.625L, 1048580L);
4035 TEST_f_f (trunc, -1048580.625L, -1048580L);
4037 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
4038 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
4040 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
4041 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
4052 FUNC (sincos) (0, &s, &c);
4053 if (errno == ENOSYS)
4054 /* Required function not implemented. */
4057 if (errno == ENOSYS)
4058 /* Function not implemented. */
4061 /* y0 is the Bessel function of the second kind of order 0 */
4064 TEST_f_f (y0, -1.0, minus_infty);
4065 TEST_f_f (y0, 0.0, minus_infty);
4066 TEST_f_f (y0, nan_value, nan_value);
4067 TEST_f_f (y0, plus_infty, 0);
4069 TEST_f_f (y0, 0.1L, -1.5342386513503668441L);
4070 TEST_f_f (y0, 0.7L, -0.19066492933739506743L);
4071 TEST_f_f (y0, 1.0, 0.088256964215676957983L);
4072 TEST_f_f (y0, 1.5, 0.38244892379775884396L);
4073 TEST_f_f (y0, 2.0, 0.51037567264974511960L);
4074 TEST_f_f (y0, 8.0, 0.22352148938756622053L);
4075 TEST_f_f (y0, 10.0, 0.055671167283599391424L);
4086 FUNC (sincos) (0, &s, &c);
4087 if (errno == ENOSYS)
4088 /* Required function not implemented. */
4091 if (errno == ENOSYS)
4092 /* Function not implemented. */
4095 /* y1 is the Bessel function of the second kind of order 1 */
4098 TEST_f_f (y1, -1.0, minus_infty);
4099 TEST_f_f (y1, 0.0, minus_infty);
4100 TEST_f_f (y1, plus_infty, 0);
4101 TEST_f_f (y1, nan_value, nan_value);
4103 TEST_f_f (y1, 0.1L, -6.4589510947020269877L);
4104 TEST_f_f (y1, 0.7L, -1.1032498719076333697L);
4105 TEST_f_f (y1, 1.0, -0.78121282130028871655L);
4106 TEST_f_f (y1, 1.5, -0.41230862697391129595L);
4107 TEST_f_f (y1, 2.0, -0.10703243154093754689L);
4108 TEST_f_f (y1, 8.0, -0.15806046173124749426L);
4109 TEST_f_f (y1, 10.0, 0.24901542420695388392L);
4119 FUNC (sincos) (0, &s, &c);
4120 if (errno == ENOSYS)
4121 /* Required function not implemented. */
4124 if (errno == ENOSYS)
4125 /* Function not implemented. */
4128 /* yn is the Bessel function of the second kind of order n */
4131 /* yn (0, x) == y0 (x) */
4132 TEST_ff_f (yn, 0, -1.0, minus_infty);
4133 TEST_ff_f (yn, 0, 0.0, minus_infty);
4134 TEST_ff_f (yn, 0, nan_value, nan_value);
4135 TEST_ff_f (yn, 0, plus_infty, 0);
4137 TEST_ff_f (yn, 0, 0.1L, -1.5342386513503668441L);
4138 TEST_ff_f (yn, 0, 0.7L, -0.19066492933739506743L);
4139 TEST_ff_f (yn, 0, 1.0, 0.088256964215676957983L);
4140 TEST_ff_f (yn, 0, 1.5, 0.38244892379775884396L);
4141 TEST_ff_f (yn, 0, 2.0, 0.51037567264974511960L);
4142 TEST_ff_f (yn, 0, 8.0, 0.22352148938756622053L);
4143 TEST_ff_f (yn, 0, 10.0, 0.055671167283599391424L);
4145 /* yn (1, x) == y1 (x) */
4146 TEST_ff_f (yn, 1, -1.0, minus_infty);
4147 TEST_ff_f (yn, 1, 0.0, minus_infty);
4148 TEST_ff_f (yn, 1, plus_infty, 0);
4149 TEST_ff_f (yn, 1, nan_value, nan_value);
4151 TEST_ff_f (yn, 1, 0.1L, -6.4589510947020269877L);
4152 TEST_ff_f (yn, 1, 0.7L, -1.1032498719076333697L);
4153 TEST_ff_f (yn, 1, 1.0, -0.78121282130028871655L);
4154 TEST_ff_f (yn, 1, 1.5, -0.41230862697391129595L);
4155 TEST_ff_f (yn, 1, 2.0, -0.10703243154093754689L);
4156 TEST_ff_f (yn, 1, 8.0, -0.15806046173124749426L);
4157 TEST_ff_f (yn, 1, 10.0, 0.24901542420695388392L);
4160 TEST_ff_f (yn, 3, plus_infty, 0);
4161 TEST_ff_f (yn, 3, nan_value, nan_value);
4163 TEST_ff_f (yn, 3, 0.1L, -5099.3323786129048894L);
4164 TEST_ff_f (yn, 3, 0.7L, -15.819479052819633505L);
4165 TEST_ff_f (yn, 3, 1.0, -5.8215176059647288478L);
4166 TEST_ff_f (yn, 3, 2.0, -1.1277837768404277861L);
4167 TEST_ff_f (yn, 3, 10.0, -0.25136265718383732978L);
4170 TEST_ff_f (yn, 10, plus_infty, 0);
4171 TEST_ff_f (yn, 10, nan_value, nan_value);
4173 TEST_ff_f (yn, 10, 0.1L, -0.11831335132045197885e19L);
4174 TEST_ff_f (yn, 10, 0.7L, -0.42447194260703866924e10L);
4175 TEST_ff_f (yn, 10, 1.0, -0.12161801427868918929e9L);
4176 TEST_ff_f (yn, 10, 2.0, -129184.54220803928264L);
4177 TEST_ff_f (yn, 10, 10.0, -0.35981415218340272205L);
4188 fpstack_test ("start *init*");
4190 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
4192 minus_zero = FUNC(copysign) (0.0, -1.0);
4193 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
4194 HUGE_VALL, HUGE_VAL, HUGE_VALF);
4195 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
4196 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
4202 (void) &minus_infty;
4204 /* Clear all exceptions. From now on we must not get random exceptions. */
4205 feclearexcept (FE_ALL_EXCEPT);
4207 /* Test to make sure we start correctly. */
4208 fpstack_test ("end *init*");
4211 /* Definitions of arguments for argp functions. */
4212 static const struct argp_option options[] =
4214 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
4215 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
4216 { "no-max-error", 'f', NULL, 0,
4217 "Don't output maximal errors of functions"},
4218 { "no-points", 'p', NULL, 0,
4219 "Don't output results of functions invocations"},
4220 { "ignore-max-ulp", 'i', "yes/no", 0,
4221 "Ignore given maximal errors"},
4222 { NULL, 0, NULL, 0, NULL }
4225 /* Short description of program. */
4226 static const char doc[] = "Math test suite: " TEST_MSG ;
4228 /* Prototype for option handler. */
4229 static error_t parse_opt (int key, char *arg, struct argp_state *state);
4231 /* Data structure to communicate with argp functions. */
4232 static struct argp argp =
4234 options, parse_opt, NULL, doc,
4238 /* Handle program arguments. */
4240 parse_opt (int key, char *arg, struct argp_state *state)
4245 output_max_error = 0;
4248 if (strcmp (arg, "yes") == 0)
4250 else if (strcmp (arg, "no") == 0)
4261 verbose = (unsigned int) strtoul (optarg, NULL, 0);
4266 return ARGP_ERR_UNKNOWN;
4272 /* function to check our ulp calculation. */
4279 /* This gives one ulp. */
4280 u = FUNC(nextafter) (10, 20);
4281 check_equal (10.0, u, 1, &diff, &ulp);
4282 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
4284 /* This gives one more ulp. */
4285 u = FUNC(nextafter) (u, 20);
4286 check_equal (10.0, u, 2, &diff, &ulp);
4287 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
4289 /* And now calculate 100 ulp. */
4290 for (i = 2; i < 100; i++)
4291 u = FUNC(nextafter) (u, 20);
4292 check_equal (10.0, u, 100, &diff, &ulp);
4293 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
4298 main (int argc, char **argv)
4305 output_max_error = 1;
4307 /* XXX set to 0 for releases. */
4310 /* Parse and process arguments. */
4311 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
4313 if (remaining != argc)
4315 fprintf (stderr, "wrong number of arguments");
4316 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
4317 exit (EXIT_FAILURE);
4322 ulps_file = fopen ("ULPs", "a");
4323 if (ulps_file == NULL)
4325 perror ("can't open file `ULPs' for writing: ");
4338 /* Keep the tests a wee bit ordered (according to ISO C99). */
4339 /* Classification macros: */
4345 /* Trigonometric functions: */
4355 /* Hyperbolic functions: */
4363 /* Exponential and logarithmic functions: */
4381 /* Power and absolute value functions: */
4388 /* Error and gamma functions: */
4395 /* Nearest integer functions: */
4407 /* Remainder functions: */
4412 /* Manipulation functions: */
4417 /* maximum, minimum and positive difference functions */
4422 /* Multiply and add: */
4425 /* Complex functions: */
4450 /* Bessel functions: */
4461 printf ("\nTest suite completed:\n");
4462 printf (" %d test cases plus %d tests for exception flags executed.\n",
4463 noTests, noExcTests);
4465 printf (" %d expected failures occurred.\n", noXFails);
4467 printf (" %d unexpected passes occurred.\n", noXPasses);
4470 printf (" %d errors occurred.\n", noErrors);
4473 printf (" All tests passed successfully.\n");