1 /* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.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, see
17 <http://www.gnu.org/licenses/>. */
19 /* Part of testsuite for libm.
21 This file is processed by a perl script. The resulting file has to
22 be included by a master file that defines:
25 FUNC(function): converts general function name (like cos) to
26 name with correct suffix (e.g. cosl or cosf)
27 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
28 FLOAT: floating point type to test
29 - TEST_MSG: informal message to be displayed
30 CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
31 chooses one of the parameters as delta for testing
33 PRINTF_EXPR Floating point conversion specification to print a variable
34 of type FLOAT with printf. PRINTF_EXPR just contains
35 the specifier, not the percent and width arguments,
37 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
38 PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */
40 /* This testsuite has currently tests for:
41 acos, acosh, asin, asinh, atan, atan2, atanh,
42 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
43 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
45 ilogb, isfinite, isinf, isnan, isnormal,
46 isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, lrint, llrint,
51 round, lround, llround,
52 scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
53 y0, y1, yn, significand
55 and for the following complex math functions:
56 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
57 ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
59 At the moment the following functions aren't tested:
62 Parameter handling is primitive in the moment:
63 --verbose=[0..3] for different levels of output:
65 1: basic report on failed tests (default)
66 2: full report on all tests
67 -v for full output (equals --verbose=3)
68 -u for generation of an ULPs file
73 This suite tests some aspects of the correct implementation of
74 mathematical functions in libm. Some simple, specific parameters
75 are tested for correctness but there's no exhaustive
76 testing. Handling of specific inputs (e.g. infinity, not-a-number)
77 is also tested. Correct handling of exceptions is checked
78 against. These implemented tests should check all cases that are
81 Exception testing: At the moment only divide-by-zero and invalid
82 exceptions are tested. Overflow/underflow and inexact exceptions
83 aren't checked at the moment.
85 NaN values: There exist signalling and quiet NaNs. This implementation
86 only uses quiet NaN as parameter but does not differenciate
87 between the two kinds of NaNs as result.
89 Inline functions: Inlining functions should give an improvement in
90 speed - but not in precission. The inlined functions return
91 reasonable values for a reasonable range of input values. The
92 result is not necessarily correct for all values and exceptions are
93 not correctly raised in all cases. Problematic input and return
94 values are infinity, not-a-number and minus zero. This suite
95 therefore does not check these specific inputs and the exception
96 handling for inlined mathematical functions - just the "reasonable"
99 Beware: The tests might fail for any of the following reasons:
101 - Functions are wrong
102 - Floating Point Unit not working properly
103 - Compiler has errors
105 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
108 To Do: All parameter should be numbers that can be represented as
109 exact floating point values. Currently some values cannot be
110 represented exactly and therefore the result is not the expected
111 result. For this we will use 36 digits so that numbers can be
112 represented exactly. */
118 #undef __CHK_COMPLEX_STUFF
119 #define __CHK_COMPLEX_STUFF 0
121 #include "libm-test-ulps.h"
134 /* Possible exceptions */
135 #define NO_EXCEPTION 0x0
136 #define INVALID_EXCEPTION 0x1
137 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
138 /* The next flags signals that those exceptions are allowed but not required. */
139 #define INVALID_EXCEPTION_OK 0x4
140 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x8
141 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
142 /* Some special test flags, passed togther with exceptions. */
143 #define IGNORE_ZERO_INF_SIGN 0x10
145 /* Various constants (we must supply them precalculated for accuracy). */
146 #define M_PI_6l .52359877559829887307710723054658383L
147 #define M_E2l 7.389056098930650227230427460575008L
148 #define M_E3l 20.085536923187667740928529654581719L
149 #define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */
150 #define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
151 #define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
152 #define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
153 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
154 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
155 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
156 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
157 #define M_PI_LOG10El M_PIl * M_LOG10El
158 #define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
160 static FILE *ulps_file; /* File to document difference. */
161 static int output_ulps; /* Should ulps printed? */
163 static int noErrors; /* number of errors */
164 static int noTests; /* number of tests (without testing exceptions) */
165 static int noExcTests; /* number of tests for exception flags */
166 static int noXFails; /* number of expected failures. */
167 static int noXPasses; /* number of unexpected passes. */
170 static int output_max_error; /* Should the maximal errors printed? */
171 static int output_points; /* Should the single function results printed? */
172 static int ignore_max_ulp; /* Should we ignore max_ulp? */
174 static FLOAT minus_zero, plus_zero;
175 static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
177 static FLOAT max_error, real_max_error, imag_max_error;
180 #define BUILD_COMPLEX(real, imag) \
181 ({ __complex__ FLOAT __retval; \
182 __real__ __retval = (real); \
183 __imag__ __retval = (imag); \
186 #define BUILD_COMPLEX_INT(real, imag) \
187 ({ __complex__ int __retval; \
188 __real__ __retval = (real); \
189 __imag__ __retval = (imag); \
193 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
194 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
197 init_max_error (void)
202 feclearexcept (FE_ALL_EXCEPT);
206 set_max_error (FLOAT current, FLOAT *curr_max_error)
208 if (current > *curr_max_error)
209 *curr_max_error = current;
213 /* Should the message print to screen? This depends on the verbose flag,
214 and the test status. */
216 print_screen (int ok, int xfail)
220 || (verbose == 1 && ok == xfail)))
226 /* Should the message print to screen? This depends on the verbose flag,
227 and the test status. */
229 print_screen_max_error (int ok, int xfail)
233 || ((verbose == 1) && (ok == xfail))))
238 /* Update statistic counters. */
240 update_stats (int ok, int xfail)
245 else if (!ok && xfail)
247 else if (!ok && !xfail)
252 print_ulps (const char *test_name, FLOAT ulp)
256 fprintf (ulps_file, "Test \"%s\":\n", test_name);
257 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
258 CHOOSE("ldouble", "double", "float",
259 "ildouble", "idouble", "ifloat"),
265 print_function_ulps (const char *function_name, FLOAT ulp)
269 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
270 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
271 CHOOSE("ldouble", "double", "float",
272 "ildouble", "idouble", "ifloat"),
279 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
286 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
287 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
288 CHOOSE("ldouble", "double", "float",
289 "ildouble", "idouble", "ifloat"),
290 FUNC(ceil) (real_ulp));
294 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
295 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
296 CHOOSE("ldouble", "double", "float",
297 "ildouble", "idouble", "ifloat"),
298 FUNC(ceil) (imag_ulp));
307 /* Test if Floating-Point stack hasn't changed */
309 fpstack_test (const char *test_name)
312 static int old_stack;
315 __asm__ ("fnstsw" : "=a" (sw));
321 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
322 test_name, sw, old_stack);
331 print_max_error (const char *func_name, FLOAT allowed, int xfail)
335 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
341 print_function_ulps (func_name, max_error);
344 if (print_screen_max_error (ok, xfail))
346 printf ("Maximal error of `%s'\n", func_name);
347 printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
348 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
351 update_stats (ok, xfail);
356 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
357 __complex__ int xfail)
361 if ((real_max_error == 0 && imag_max_error == 0)
362 || (real_max_error <= __real__ allowed
363 && imag_max_error <= __imag__ allowed
370 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
373 if (print_screen_max_error (ok, xfail))
375 printf ("Maximal error of real part of: %s\n", func_name);
376 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
377 FUNC(ceil) (real_max_error));
378 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
379 FUNC(ceil) (__real__ allowed));
380 printf ("Maximal error of imaginary part of: %s\n", func_name);
381 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
382 FUNC(ceil) (imag_max_error));
383 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
384 FUNC(ceil) (__imag__ allowed));
387 update_stats (ok, xfail);
391 /* Test whether a given exception was raised. */
393 test_single_exception (const char *test_name,
397 const char *flag_name)
401 if (exception & exc_flag)
403 if (fetestexcept (fe_flag))
405 if (print_screen (1, 0))
406 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
411 if (print_screen (0, 0))
412 printf ("Failure: %s: Exception \"%s\" not set\n",
413 test_name, flag_name);
418 if (fetestexcept (fe_flag))
421 if (print_screen (0, 0))
422 printf ("Failure: %s: Exception \"%s\" set\n",
423 test_name, flag_name);
427 if (print_screen (1, 0))
428 printf ("%s: Exception \"%s\" not set\n", test_name,
439 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
440 allowed but not required exceptions.
443 test_exceptions (const char *test_name, int exception)
447 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
448 test_single_exception (test_name, exception,
449 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
453 if ((exception & INVALID_EXCEPTION_OK) == 0)
454 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
455 "Invalid operation");
457 feclearexcept (FE_ALL_EXCEPT);
462 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
463 FLOAT max_ulp, int xfail, int exceptions,
464 FLOAT *curr_max_error)
471 test_exceptions (test_name, exceptions);
472 if (isnan (computed) && isnan (expected))
474 else if (isinf (computed) && isinf (expected))
476 /* Test for sign of infinities. */
477 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
478 && signbit (computed) != signbit (expected))
481 printf ("infinity has wrong sign.\n");
486 /* Don't calc ulp for NaNs or infinities. */
487 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
491 diff = FUNC(fabs) (computed - expected);
492 /* ilogb (0) isn't allowed. */
494 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
496 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
497 set_max_error (ulp, curr_max_error);
499 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
500 && computed == 0.0 && expected == 0.0
501 && signbit(computed) != signbit (expected))
503 else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
508 print_ulps (test_name, ulp);
512 if (print_screen (ok, xfail))
515 printf ("Failure: ");
516 printf ("Test: %s\n", test_name);
517 printf ("Result:\n");
518 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
520 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
524 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
526 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
527 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
530 update_stats (ok, xfail);
532 fpstack_test (test_name);
537 check_float (const char *test_name, FLOAT computed, FLOAT expected,
538 FLOAT max_ulp, int xfail, int exceptions)
540 check_float_internal (test_name, computed, expected, max_ulp, xfail,
541 exceptions, &max_error);
546 check_complex (const char *test_name, __complex__ FLOAT computed,
547 __complex__ FLOAT expected,
548 __complex__ FLOAT max_ulp, __complex__ int xfail,
551 FLOAT part_comp, part_exp, part_max_ulp;
555 sprintf (str, "Real part of: %s", test_name);
556 part_comp = __real__ computed;
557 part_exp = __real__ expected;
558 part_max_ulp = __real__ max_ulp;
559 part_xfail = __real__ xfail;
561 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
562 exception, &real_max_error);
564 sprintf (str, "Imaginary part of: %s", test_name);
565 part_comp = __imag__ computed;
566 part_exp = __imag__ expected;
567 part_max_ulp = __imag__ max_ulp;
568 part_xfail = __imag__ xfail;
570 /* Don't check again for exceptions, just pass through the
571 zero/inf sign test. */
572 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
573 exception & IGNORE_ZERO_INF_SIGN,
578 /* Check that computed and expected values are equal (int values). */
580 check_int (const char *test_name, int computed, int expected, int max_ulp,
581 int xfail, int exceptions)
583 int diff = computed - expected;
586 test_exceptions (test_name, exceptions);
588 if (abs (diff) <= max_ulp)
592 print_ulps (test_name, diff);
594 if (print_screen (ok, xfail))
597 printf ("Failure: ");
598 printf ("Test: %s\n", test_name);
599 printf ("Result:\n");
600 printf (" is: %d\n", computed);
601 printf (" should be: %d\n", expected);
604 update_stats (ok, xfail);
605 fpstack_test (test_name);
609 /* Check that computed and expected values are equal (long int values). */
611 check_long (const char *test_name, long int computed, long int expected,
612 long int max_ulp, int xfail, int exceptions)
614 long int diff = computed - expected;
617 test_exceptions (test_name, exceptions);
619 if (labs (diff) <= max_ulp)
623 print_ulps (test_name, diff);
625 if (print_screen (ok, xfail))
628 printf ("Failure: ");
629 printf ("Test: %s\n", test_name);
630 printf ("Result:\n");
631 printf (" is: %ld\n", computed);
632 printf (" should be: %ld\n", expected);
635 update_stats (ok, xfail);
636 fpstack_test (test_name);
640 /* Check that computed value is true/false. */
642 check_bool (const char *test_name, int computed, int expected,
643 long int max_ulp, int xfail, int exceptions)
647 test_exceptions (test_name, exceptions);
649 if ((computed == 0) == (expected == 0))
652 if (print_screen (ok, xfail))
655 printf ("Failure: ");
656 printf ("Test: %s\n", test_name);
657 printf ("Result:\n");
658 printf (" is: %d\n", computed);
659 printf (" should be: %d\n", expected);
662 update_stats (ok, xfail);
663 fpstack_test (test_name);
667 /* check that computed and expected values are equal (long int values) */
669 check_longlong (const char *test_name, long long int computed,
670 long long int expected,
671 long long int max_ulp, int xfail,
674 long long int diff = computed - expected;
677 test_exceptions (test_name, exceptions);
679 if (llabs (diff) <= max_ulp)
683 print_ulps (test_name, diff);
685 if (print_screen (ok, xfail))
689 printf ("Test: %s\n", test_name);
690 printf ("Result:\n");
691 printf (" is: %lld\n", computed);
692 printf (" should be: %lld\n", expected);
695 update_stats (ok, xfail);
696 fpstack_test (test_name);
701 /* This is to prevent messages from the SVID libm emulation. */
703 matherr (struct exception *x __attribute__ ((unused)))
709 /****************************************************************************
710 Tests for single functions of libm.
711 Please keep them alphabetically sorted!
712 ****************************************************************************/
720 /* Function not implemented. */
725 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
726 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
727 TEST_f_f (acos, nan_value, nan_value);
730 TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
731 TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
733 TEST_f_f (acos, 0, M_PI_2l);
734 TEST_f_f (acos, minus_zero, M_PI_2l);
735 TEST_f_f (acos, 1, 0);
736 TEST_f_f (acos, -1, M_PIl);
737 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
738 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
739 TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
740 TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
741 TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
751 /* Function not implemented. */
756 TEST_f_f (acosh, plus_infty, plus_infty);
757 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
760 TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
762 TEST_f_f (acosh, 1, 0);
763 TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
774 /* Function not implemented. */
779 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
780 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
781 TEST_f_f (asin, nan_value, nan_value);
783 /* asin x == NaN plus invalid exception for |x| > 1. */
784 TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
785 TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
787 TEST_f_f (asin, 0, 0);
788 TEST_f_f (asin, minus_zero, minus_zero);
789 TEST_f_f (asin, 0.5, M_PI_6l);
790 TEST_f_f (asin, -0.5, -M_PI_6l);
791 TEST_f_f (asin, 1.0, M_PI_2l);
792 TEST_f_f (asin, -1.0, -M_PI_2l);
793 TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
804 /* Function not implemented. */
809 TEST_f_f (asinh, 0, 0);
810 TEST_f_f (asinh, minus_zero, minus_zero);
812 TEST_f_f (asinh, plus_infty, plus_infty);
813 TEST_f_f (asinh, minus_infty, minus_infty);
815 TEST_f_f (asinh, nan_value, nan_value);
816 TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
827 /* Function not implemented. */
832 TEST_f_f (atan, 0, 0);
833 TEST_f_f (atan, minus_zero, minus_zero);
835 TEST_f_f (atan, plus_infty, M_PI_2l);
836 TEST_f_f (atan, minus_infty, -M_PI_2l);
837 TEST_f_f (atan, nan_value, nan_value);
839 TEST_f_f (atan, 1, M_PI_4l);
840 TEST_f_f (atan, -1, -M_PI_4l);
842 TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
855 /* Function not implemented. */
861 TEST_f_f (atanh, 0, 0);
862 TEST_f_f (atanh, minus_zero, minus_zero);
864 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
865 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
866 TEST_f_f (atanh, nan_value, nan_value);
868 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
869 TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
870 TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
872 TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
883 /* Function not implemented. */
888 /* atan2 (0,x) == 0 for x > 0. */
889 TEST_ff_f (atan2, 0, 1, 0);
891 /* atan2 (-0,x) == -0 for x > 0. */
892 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
894 TEST_ff_f (atan2, 0, 0, 0);
895 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
897 /* atan2 (+0,x) == +pi for x < 0. */
898 TEST_ff_f (atan2, 0, -1, M_PIl);
900 /* atan2 (-0,x) == -pi for x < 0. */
901 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
903 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
904 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
906 /* atan2 (y,+0) == pi/2 for y > 0. */
907 TEST_ff_f (atan2, 1, 0, M_PI_2l);
909 /* atan2 (y,-0) == pi/2 for y > 0. */
910 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
912 /* atan2 (y,+0) == -pi/2 for y < 0. */
913 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
915 /* atan2 (y,-0) == -pi/2 for y < 0. */
916 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
918 /* atan2 (y,inf) == +0 for finite y > 0. */
919 TEST_ff_f (atan2, 1, plus_infty, 0);
921 /* atan2 (y,inf) == -0 for finite y < 0. */
922 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
924 /* atan2(+inf, x) == pi/2 for finite x. */
925 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
927 /* atan2(-inf, x) == -pi/2 for finite x. */
928 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
930 /* atan2 (y,-inf) == +pi for finite y > 0. */
931 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
933 /* atan2 (y,-inf) == -pi for finite y < 0. */
934 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
936 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
937 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
938 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
939 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
940 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
942 TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
943 TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
944 TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
945 TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
946 TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
947 TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
949 TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
958 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
960 /* Function not implemented. */
965 /* cabs (x + iy) is specified as hypot (x,y) */
967 /* cabs (+inf + i x) == +inf. */
968 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
969 /* cabs (-inf + i x) == +inf. */
970 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
972 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
973 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
975 TEST_c_f (cabs, nan_value, nan_value, nan_value);
977 /* cabs (x,y) == cabs (y,x). */
978 TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
979 /* cabs (x,y) == cabs (-x,y). */
980 TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
981 /* cabs (x,y) == cabs (-y,x). */
982 TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
983 /* cabs (x,y) == cabs (-x,-y). */
984 TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
985 /* cabs (x,y) == cabs (-y,-x). */
986 TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
987 /* cabs (x,0) == fabs (x). */
988 TEST_c_f (cabs, -0.75L, 0, 0.75L);
989 TEST_c_f (cabs, 0.75L, 0, 0.75L);
990 TEST_c_f (cabs, -1.0L, 0, 1.0L);
991 TEST_c_f (cabs, 1.0L, 0, 1.0L);
992 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
993 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
995 TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
1006 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1007 if (errno == ENOSYS)
1008 /* Function not implemented. */
1014 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
1015 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
1016 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
1017 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1019 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1020 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1022 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1023 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1025 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1026 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1027 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1028 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1029 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1030 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1032 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1033 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1034 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1035 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1037 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1038 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1039 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1040 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1042 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1043 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1045 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1046 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1048 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1049 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1051 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1052 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1054 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1055 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1057 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1059 TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
1060 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1062 END (cacos, complex);
1069 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1070 if (errno == ENOSYS)
1071 /* Function not implemented. */
1077 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1078 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1079 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1080 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1081 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1082 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1084 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1085 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1087 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1088 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1089 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1090 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1091 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1092 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1094 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1095 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1096 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1097 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1099 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1100 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1101 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1102 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1104 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1105 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1107 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1108 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1110 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1111 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1113 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1114 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1116 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1117 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1119 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1121 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
1122 TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
1124 END (cacosh, complex);
1129 #if __CHK_COMPLEX_STUFF
1135 /* carg (x + iy) is specified as atan2 (y, x) */
1137 /* carg (x + i 0) == 0 for x > 0. */
1138 TEST_c_f (carg, 2.0, 0, 0);
1139 /* carg (x - i 0) == -0 for x > 0. */
1140 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1142 TEST_c_f (carg, 0, 0, 0);
1143 TEST_c_f (carg, 0, minus_zero, minus_zero);
1145 /* carg (x + i 0) == +pi for x < 0. */
1146 TEST_c_f (carg, -2.0, 0, M_PIl);
1148 /* carg (x - i 0) == -pi for x < 0. */
1149 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1151 TEST_c_f (carg, minus_zero, 0, M_PIl);
1152 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1154 /* carg (+0 + i y) == pi/2 for y > 0. */
1155 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1157 /* carg (-0 + i y) == pi/2 for y > 0. */
1158 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1160 /* carg (+0 + i y) == -pi/2 for y < 0. */
1161 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1163 /* carg (-0 + i y) == -pi/2 for y < 0. */
1164 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1166 /* carg (inf + i y) == +0 for finite y > 0. */
1167 TEST_c_f (carg, plus_infty, 2.0, 0);
1169 /* carg (inf + i y) == -0 for finite y < 0. */
1170 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1172 /* carg(x + i inf) == pi/2 for finite x. */
1173 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1175 /* carg(x - i inf) == -pi/2 for finite x. */
1176 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1178 /* carg (-inf + i y) == +pi for finite y > 0. */
1179 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1181 /* carg (-inf + i y) == -pi for finite y < 0. */
1182 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1184 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1186 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1188 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1190 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1192 TEST_c_f (carg, nan_value, nan_value, nan_value);
1196 #endif /* __CHK_COMPLEX_STUFF */
1203 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1204 if (errno == ENOSYS)
1205 /* Function not implemented. */
1210 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1211 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1212 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1213 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1215 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1216 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1217 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1218 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1220 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1221 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1222 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1223 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1224 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1225 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1226 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1227 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1229 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1230 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1231 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1232 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1234 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1235 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1236 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1237 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1239 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1240 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1242 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1243 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1245 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1246 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1248 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1249 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1251 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1252 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1254 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1256 TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
1257 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1259 END (casin, complex);
1267 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1268 if (errno == ENOSYS)
1269 /* Function not implemented. */
1274 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1275 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1276 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1277 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1279 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1280 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1281 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1282 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1284 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1285 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1286 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1287 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1288 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1289 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1290 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1291 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1293 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1294 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1295 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1296 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1298 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1299 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1300 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1301 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1303 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1304 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1306 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1307 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1309 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1310 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1312 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1313 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1315 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1316 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1318 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1320 TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
1321 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1323 END (casinh, complex);
1331 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1332 if (errno == ENOSYS)
1333 /* Function not implemented. */
1338 TEST_c_c (catan, 0, 0, 0, 0);
1339 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1340 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1341 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1343 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1344 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1345 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1346 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1349 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1350 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1351 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1352 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1353 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1354 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1355 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1356 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1358 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1359 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1360 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1361 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1363 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1364 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1365 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1366 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1368 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1369 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1371 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1372 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1374 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1375 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1377 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1378 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1380 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1381 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1383 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1384 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1386 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1388 TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
1389 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1391 END (catan, complex);
1398 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1399 if (errno == ENOSYS)
1400 /* Function not implemented. */
1405 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1406 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1407 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1408 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1410 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1411 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1412 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1413 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1415 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1416 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1417 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1418 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1419 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1420 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1421 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1422 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1424 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1425 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1426 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1427 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1429 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1430 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1431 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1432 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1434 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1435 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1437 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1438 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1440 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1441 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1443 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1444 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1446 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1447 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1449 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1450 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1452 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1454 TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
1455 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1457 END (catanh, complex);
1466 if (errno == ENOSYS)
1467 /* Function not implemented. */
1472 TEST_f_f (cbrt, 0.0, 0.0);
1473 TEST_f_f (cbrt, minus_zero, minus_zero);
1475 TEST_f_f (cbrt, plus_infty, plus_infty);
1476 TEST_f_f (cbrt, minus_infty, minus_infty);
1477 TEST_f_f (cbrt, nan_value, nan_value);
1479 TEST_f_f (cbrt, -0.001L, -0.1L);
1480 TEST_f_f (cbrt, 8, 2);
1481 TEST_f_f (cbrt, -27.0, -3.0);
1482 TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
1483 TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
1494 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1495 if (errno == ENOSYS)
1496 /* Function not implemented. */
1501 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1502 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1503 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1504 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1506 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1507 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1508 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1509 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1511 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1512 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1513 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1514 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1516 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1517 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1518 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1519 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1521 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1522 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1523 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1524 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1526 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1527 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1528 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1529 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1531 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1532 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1534 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1535 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1537 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1538 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1540 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1541 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1543 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1544 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1546 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1547 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1549 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1551 TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
1552 TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
1554 END (ccos, complex);
1562 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1563 if (errno == ENOSYS)
1564 /* Function not implemented. */
1569 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1570 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1571 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1572 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1574 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1575 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1576 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1577 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1579 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1580 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1581 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1582 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1584 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1585 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1586 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1587 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1589 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1590 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1591 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1592 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1594 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1595 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1596 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1597 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1599 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1600 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1602 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1603 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1605 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1606 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1608 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1609 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1611 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1612 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1614 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1615 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1617 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1619 TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
1621 TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
1623 END (ccosh, complex);
1633 TEST_f_f (ceil, 0.0, 0.0);
1634 TEST_f_f (ceil, minus_zero, minus_zero);
1635 TEST_f_f (ceil, plus_infty, plus_infty);
1636 TEST_f_f (ceil, minus_infty, minus_infty);
1637 TEST_f_f (ceil, nan_value, nan_value);
1639 TEST_f_f (ceil, M_PIl, 4.0);
1640 TEST_f_f (ceil, -M_PIl, -3.0);
1641 TEST_f_f (ceil, 0.25, 1.0);
1642 TEST_f_f (ceil, -0.25, minus_zero);
1645 /* The result can only be represented in long double. */
1646 TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
1647 TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
1648 TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
1649 TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
1650 TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
1652 TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
1653 TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
1654 TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
1655 TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
1656 TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
1658 TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
1659 TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
1660 TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
1661 TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
1662 TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
1664 TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
1665 TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
1666 TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
1667 TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
1668 TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
1670 TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
1671 TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
1672 TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
1673 TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
1674 TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
1676 TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
1677 TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
1678 TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
1679 TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
1680 TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
1682 TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
1683 TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
1684 TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
1685 TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
1686 TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
1693 #if __CHK_COMPLEX_STUFF
1698 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1699 if (errno == ENOSYS)
1700 /* Function not implemented. */
1705 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1706 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1707 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1708 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1710 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1711 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1713 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1714 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1716 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1717 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1719 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1720 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1722 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1723 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1725 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1726 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1728 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1729 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1730 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1731 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1733 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1734 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1736 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1737 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1739 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1741 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1743 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1744 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1746 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1747 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1748 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1749 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1751 TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
1752 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1754 END (cexp, complex);
1756 #endif /* __CHK_COMPLEX_STUFF */
1763 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1764 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1765 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1766 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1767 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1768 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1769 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1778 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1779 if (errno == ENOSYS)
1780 /* Function not implemented. */
1785 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1786 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1788 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1789 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1791 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1792 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1794 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1795 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1797 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1798 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1799 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1800 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1801 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1802 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1803 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1804 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1806 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1807 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1808 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1809 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1811 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1812 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1813 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1814 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1816 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1817 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1819 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1820 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1822 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1823 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1824 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1825 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1827 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1828 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1829 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1830 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1832 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1834 TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
1835 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1837 END (clog, complex);
1845 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1846 if (errno == ENOSYS)
1847 /* Function not implemented. */
1852 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1853 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1855 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1856 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1858 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1860 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1861 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1863 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1864 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1865 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1866 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1867 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1868 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1869 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1870 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1872 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1873 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1874 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1875 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1877 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1878 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1879 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1880 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1882 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1883 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1885 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1886 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1888 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1889 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1890 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1891 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1893 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1894 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1895 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1896 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1898 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1900 TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
1901 TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
1903 END (clog10, complex);
1913 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1914 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1915 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1916 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1917 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1918 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1919 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1921 END (conj, complex);
1927 copysign_test (void)
1931 TEST_ff_f (copysign, 0, 4, 0);
1932 TEST_ff_f (copysign, 0, -4, minus_zero);
1933 TEST_ff_f (copysign, minus_zero, 4, 0);
1934 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1936 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1937 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1938 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1939 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1941 TEST_ff_f (copysign, 0, plus_infty, 0);
1942 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1943 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1944 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1946 /* XXX More correctly we would have to check the sign of the NaN. */
1947 TEST_ff_f (copysign, nan_value, 0, nan_value);
1948 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1949 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1950 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1961 if (errno == ENOSYS)
1962 /* Function not implemented. */
1967 TEST_f_f (cos, 0, 1);
1968 TEST_f_f (cos, minus_zero, 1);
1969 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1970 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1971 TEST_f_f (cos, nan_value, nan_value);
1973 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1974 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1975 TEST_f_f (cos, M_PI_2l, 0);
1977 TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
1980 TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
1992 if (errno == ENOSYS)
1993 /* Function not implemented. */
1997 TEST_f_f (cosh, 0, 1);
1998 TEST_f_f (cosh, minus_zero, 1);
2001 TEST_f_f (cosh, plus_infty, plus_infty);
2002 TEST_f_f (cosh, minus_infty, plus_infty);
2004 TEST_f_f (cosh, nan_value, nan_value);
2006 TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
2017 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
2018 if (errno == ENOSYS)
2019 /* Function not implemented. */
2024 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
2025 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
2027 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
2028 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
2030 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
2032 TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
2033 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
2034 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
2035 TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
2037 END (cpow, complex);
2045 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
2046 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
2047 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
2048 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
2050 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
2052 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
2053 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
2054 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
2055 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
2057 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
2058 TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
2060 END (cproj, complex);
2068 TEST_c_f (creal, 0.0, 1.0, 0.0);
2069 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
2070 TEST_c_f (creal, nan_value, 1.0, nan_value);
2071 TEST_c_f (creal, nan_value, nan_value, nan_value);
2072 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
2073 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
2074 TEST_c_f (creal, 2.0, 3.0, 2.0);
2083 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2084 if (errno == ENOSYS)
2085 /* Function not implemented. */
2090 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
2091 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
2092 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
2093 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2095 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2096 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2097 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2098 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2100 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2101 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2102 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2103 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2105 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2106 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2107 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2108 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2110 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2111 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2112 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2113 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2115 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2116 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2117 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2118 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2120 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2121 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2123 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2124 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2126 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2127 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2129 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2130 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2132 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2133 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2135 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2136 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2138 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2140 TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
2141 TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
2143 END (csin, complex);
2151 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2152 if (errno == ENOSYS)
2153 /* Function not implemented. */
2158 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2159 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2160 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2161 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2163 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2164 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2165 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2166 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2168 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2169 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2170 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2171 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2173 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2174 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2175 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2176 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2178 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2179 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2180 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2181 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2183 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2184 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2185 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2186 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2188 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2189 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2191 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2192 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2194 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2195 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2197 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2198 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2200 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2201 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2203 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2204 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2206 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2208 TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
2209 TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
2211 END (csinh, complex);
2219 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2220 if (errno == ENOSYS)
2221 /* Function not implemented. */
2226 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2227 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2228 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2229 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2231 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2232 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2233 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2234 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2236 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2237 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2238 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2239 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2241 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2242 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2243 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2244 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2245 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2246 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2247 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2248 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2249 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2250 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2251 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2252 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2254 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2256 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2258 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2259 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2260 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2261 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2263 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2264 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2265 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2266 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2268 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2270 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2271 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2272 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2273 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2274 TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
2275 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2276 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2277 /* Principal square root should be returned (i.e., non-negative real
2279 TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
2281 END (csqrt, complex);
2288 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2289 if (errno == ENOSYS)
2290 /* Function not implemented. */
2295 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2296 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2297 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2298 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2300 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2301 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2302 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2303 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2305 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2306 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2307 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2308 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2310 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2311 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2312 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2313 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2314 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2315 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2316 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2317 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2319 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2320 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2322 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2323 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2325 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2326 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2328 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2329 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2330 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2331 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2333 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2335 TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
2336 TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
2338 END (ctan, complex);
2346 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2347 if (errno == ENOSYS)
2348 /* Function not implemented. */
2353 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2354 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2355 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2356 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2358 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2359 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2360 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2361 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2362 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2363 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2364 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2365 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2367 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2368 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2369 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2370 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2371 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2372 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2373 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2374 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2376 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2377 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2379 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2380 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2382 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2383 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2385 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2386 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2387 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2388 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2390 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2392 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2394 TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
2395 TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
2397 END (ctanh, complex);
2407 if (errno == ENOSYS)
2408 /* Function not implemented. */
2413 TEST_f_f (erf, 0, 0);
2414 TEST_f_f (erf, minus_zero, minus_zero);
2415 TEST_f_f (erf, plus_infty, 1);
2416 TEST_f_f (erf, minus_infty, -1);
2417 TEST_f_f (erf, nan_value, nan_value);
2419 TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
2420 TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
2421 TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
2422 TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
2423 TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
2424 TEST_f_f (erf, 27.0L, 1.0L);
2435 if (errno == ENOSYS)
2436 /* Function not implemented. */
2441 TEST_f_f (erfc, plus_infty, 0.0);
2442 TEST_f_f (erfc, minus_infty, 2.0);
2443 TEST_f_f (erfc, 0.0, 1.0);
2444 TEST_f_f (erfc, minus_zero, 1.0);
2445 TEST_f_f (erfc, nan_value, nan_value);
2447 TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
2448 TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
2449 TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
2450 TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
2451 TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
2453 /* The result can only be represented in long double. */
2454 # if LDBL_MIN_10_EXP < -319
2455 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
2468 if (errno == ENOSYS)
2469 /* Function not implemented. */
2474 TEST_f_f (exp, 0, 1);
2475 TEST_f_f (exp, minus_zero, 1);
2478 TEST_f_f (exp, plus_infty, plus_infty);
2479 TEST_f_f (exp, minus_infty, 0);
2481 TEST_f_f (exp, nan_value, nan_value);
2482 TEST_f_f (exp, 1, M_El);
2484 TEST_f_f (exp, 2, M_E2l);
2485 TEST_f_f (exp, 3, M_E3l);
2486 TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
2487 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
2489 /* The result can only be represented in long double. */
2490 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
2503 if (errno == ENOSYS)
2504 /* Function not implemented. */
2509 TEST_f_f (exp10, 0, 1);
2510 TEST_f_f (exp10, minus_zero, 1);
2512 TEST_f_f (exp10, plus_infty, plus_infty);
2513 TEST_f_f (exp10, minus_infty, 0);
2514 TEST_f_f (exp10, nan_value, nan_value);
2515 TEST_f_f (exp10, 3, 1000);
2516 TEST_f_f (exp10, -1, 0.1L);
2517 TEST_f_f (exp10, 1e6, plus_infty);
2518 TEST_f_f (exp10, -1e6, 0);
2519 TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
2530 if (errno == ENOSYS)
2531 /* Function not implemented. */
2536 TEST_f_f (exp2, 0, 1);
2537 TEST_f_f (exp2, minus_zero, 1);
2538 TEST_f_f (exp2, plus_infty, plus_infty);
2539 TEST_f_f (exp2, minus_infty, 0);
2540 TEST_f_f (exp2, nan_value, nan_value);
2542 TEST_f_f (exp2, 10, 1024);
2543 TEST_f_f (exp2, -1, 0.5);
2544 TEST_f_f (exp2, 1e6, plus_infty);
2545 TEST_f_f (exp2, -1e6, 0);
2546 TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
2558 if (errno == ENOSYS)
2559 /* Function not implemented. */
2564 TEST_f_f (expm1, 0, 0);
2565 TEST_f_f (expm1, minus_zero, minus_zero);
2568 TEST_f_f (expm1, plus_infty, plus_infty);
2569 TEST_f_f (expm1, minus_infty, -1);
2571 TEST_f_f (expm1, nan_value, nan_value);
2573 TEST_f_f (expm1, 1, M_El - 1.0);
2574 TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
2585 TEST_f_f (fabs, 0, 0);
2586 TEST_f_f (fabs, minus_zero, 0);
2588 TEST_f_f (fabs, plus_infty, plus_infty);
2589 TEST_f_f (fabs, minus_infty, plus_infty);
2590 TEST_f_f (fabs, nan_value, nan_value);
2592 TEST_f_f (fabs, 38.0, 38.0);
2593 TEST_f_f (fabs, -M_El, M_El);
2604 TEST_ff_f (fdim, 0, 0, 0);
2605 TEST_ff_f (fdim, 9, 0, 9);
2606 TEST_ff_f (fdim, 0, 9, 0);
2607 TEST_ff_f (fdim, -9, 0, 0);
2608 TEST_ff_f (fdim, 0, -9, 9);
2610 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2611 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2612 TEST_ff_f (fdim, minus_infty, 9, 0);
2613 TEST_ff_f (fdim, minus_infty, -9, 0);
2614 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2615 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2616 TEST_ff_f (fdim, 9, plus_infty, 0);
2617 TEST_ff_f (fdim, -9, plus_infty, 0);
2619 TEST_ff_f (fdim, 0, nan_value, nan_value);
2620 TEST_ff_f (fdim, 9, nan_value, nan_value);
2621 TEST_ff_f (fdim, -9, nan_value, nan_value);
2622 TEST_ff_f (fdim, nan_value, 9, nan_value);
2623 TEST_ff_f (fdim, nan_value, -9, nan_value);
2624 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2625 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2626 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2627 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2628 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2630 TEST_ff_f (fdim, plus_infty, plus_infty, 0);
2641 TEST_f_f (floor, 0.0, 0.0);
2642 TEST_f_f (floor, minus_zero, minus_zero);
2643 TEST_f_f (floor, plus_infty, plus_infty);
2644 TEST_f_f (floor, minus_infty, minus_infty);
2645 TEST_f_f (floor, nan_value, nan_value);
2647 TEST_f_f (floor, M_PIl, 3.0);
2648 TEST_f_f (floor, -M_PIl, -4.0);
2650 TEST_f_f (floor, 0.25, 0.0);
2651 TEST_f_f (floor, -0.25, -1.0);
2655 /* The result can only be represented in long double. */
2656 TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
2657 TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
2658 TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
2659 TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
2660 TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
2662 TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
2663 TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
2664 TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
2665 TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
2666 TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
2668 TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
2669 TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
2670 TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
2671 TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
2672 TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
2674 TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
2675 TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
2676 TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
2677 TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
2678 TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
2680 TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
2681 TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
2682 TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
2683 TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
2684 TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
2686 TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
2687 TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
2688 TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
2689 TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
2690 TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
2692 TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
2693 TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
2694 TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
2695 TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
2696 TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
2708 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2709 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2710 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2711 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2712 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2713 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2714 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2715 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2716 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2717 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2718 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2719 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2721 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2722 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2723 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2724 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2726 TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
2737 TEST_ff_f (fmax, 0, 0, 0);
2738 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2739 TEST_ff_f (fmax, 9, 0, 9);
2740 TEST_ff_f (fmax, 0, 9, 9);
2741 TEST_ff_f (fmax, -9, 0, 0);
2742 TEST_ff_f (fmax, 0, -9, 0);
2744 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2745 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2746 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2747 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2749 TEST_ff_f (fmax, minus_infty, 9, 9);
2750 TEST_ff_f (fmax, minus_infty, -9, -9);
2751 TEST_ff_f (fmax, 9, minus_infty, 9);
2752 TEST_ff_f (fmax, -9, minus_infty, -9);
2754 TEST_ff_f (fmax, 0, nan_value, 0);
2755 TEST_ff_f (fmax, 9, nan_value, 9);
2756 TEST_ff_f (fmax, -9, nan_value, -9);
2757 TEST_ff_f (fmax, nan_value, 0, 0);
2758 TEST_ff_f (fmax, nan_value, 9, 9);
2759 TEST_ff_f (fmax, nan_value, -9, -9);
2760 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2761 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2762 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2763 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2764 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2775 TEST_ff_f (fmin, 0, 0, 0);
2776 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2777 TEST_ff_f (fmin, 9, 0, 0);
2778 TEST_ff_f (fmin, 0, 9, 0);
2779 TEST_ff_f (fmin, -9, 0, -9);
2780 TEST_ff_f (fmin, 0, -9, -9);
2782 TEST_ff_f (fmin, plus_infty, 9, 9);
2783 TEST_ff_f (fmin, 9, plus_infty, 9);
2784 TEST_ff_f (fmin, plus_infty, -9, -9);
2785 TEST_ff_f (fmin, -9, plus_infty, -9);
2786 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2787 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2788 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2789 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2791 TEST_ff_f (fmin, 0, nan_value, 0);
2792 TEST_ff_f (fmin, 9, nan_value, 9);
2793 TEST_ff_f (fmin, -9, nan_value, -9);
2794 TEST_ff_f (fmin, nan_value, 0, 0);
2795 TEST_ff_f (fmin, nan_value, 9, 9);
2796 TEST_ff_f (fmin, nan_value, -9, -9);
2797 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2798 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2799 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2800 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2801 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2811 FUNC(fmod) (6.5, 2.3L);
2812 if (errno == ENOSYS)
2813 /* Function not implemented. */
2818 /* fmod (+0, y) == +0 for y != 0. */
2819 TEST_ff_f (fmod, 0, 3, 0);
2821 /* fmod (-0, y) == -0 for y != 0. */
2822 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2824 /* fmod (+inf, y) == NaN plus invalid exception. */
2825 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2826 /* fmod (-inf, y) == NaN plus invalid exception. */
2827 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2828 /* fmod (x, +0) == NaN plus invalid exception. */
2829 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2830 /* fmod (x, -0) == NaN plus invalid exception. */
2831 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2833 /* fmod (x, +inf) == x for x not infinite. */
2834 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2835 /* fmod (x, -inf) == x for x not infinite. */
2836 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2838 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2840 TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
2841 TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
2842 TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
2843 TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
2850 fpclassify_test (void)
2854 TEST_f_i (fpclassify, nan_value, FP_NAN);
2855 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2856 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2857 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2858 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2859 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2872 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2873 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2874 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2876 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2877 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2879 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
2880 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
2892 if (errno == ENOSYS)
2893 /* Function not implemented. */
2895 feclearexcept (FE_ALL_EXCEPT);
2899 TEST_f_f (gamma, plus_infty, plus_infty);
2900 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2901 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2902 TEST_f_f (gamma, minus_infty, plus_infty);
2903 TEST_f_f (gamma, nan_value, nan_value);
2905 TEST_f_f1 (gamma, 1, 0, 1);
2906 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2908 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2909 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2918 FUNC(hypot) (0.7L, 12.4L);
2919 if (errno == ENOSYS)
2920 /* Function not implemented. */
2925 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2926 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2929 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2930 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2931 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2932 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2935 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2937 /* hypot (x,y) == hypot (+-x, +-y) */
2938 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
2939 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
2940 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
2941 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
2942 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
2943 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
2944 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
2945 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
2947 /* hypot (x,0) == fabs (x) */
2948 TEST_ff_f (hypot, 0.75L, 0, 0.75L);
2949 TEST_ff_f (hypot, -0.75L, 0, 0.75L);
2950 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
2952 TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
2963 TEST_f_i (ilogb, 1, 0);
2964 TEST_f_i (ilogb, M_El, 1);
2965 TEST_f_i (ilogb, 1024, 10);
2966 TEST_f_i (ilogb, -2000, 10);
2968 /* XXX We have a problem here: the standard does not tell us whether
2969 exceptions are allowed/required. ignore them for now. */
2971 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
2972 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
2973 TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
2974 TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
2980 isfinite_test (void)
2984 TEST_f_b (isfinite, 0, 1);
2985 TEST_f_b (isfinite, minus_zero, 1);
2986 TEST_f_b (isfinite, 10, 1);
2987 TEST_f_b (isfinite, plus_infty, 0);
2988 TEST_f_b (isfinite, minus_infty, 0);
2989 TEST_f_b (isfinite, nan_value, 0);
2995 isnormal_test (void)
2999 TEST_f_b (isnormal, 0, 0);
3000 TEST_f_b (isnormal, minus_zero, 0);
3001 TEST_f_b (isnormal, 10, 1);
3002 TEST_f_b (isnormal, plus_infty, 0);
3003 TEST_f_b (isnormal, minus_infty, 0);
3004 TEST_f_b (isnormal, nan_value, 0);
3009 #if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
3016 FUNC (sincos) (0, &s, &c);
3017 if (errno == ENOSYS)
3018 /* Required function not implemented. */
3022 if (errno == ENOSYS)
3023 /* Function not implemented. */
3028 /* j0 is the Bessel function of the first kind of order 0 */
3029 TEST_f_f (j0, nan_value, nan_value);
3030 TEST_f_f (j0, plus_infty, 0);
3031 TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
3032 TEST_f_f (j0, 0.0, 1.0);
3033 TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
3034 TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
3035 TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
3036 TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
3037 TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
3038 TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
3039 TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
3040 TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3041 TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3053 FUNC (sincos) (0, &s, &c);
3054 if (errno == ENOSYS)
3055 /* Required function not implemented. */
3059 if (errno == ENOSYS)
3060 /* Function not implemented. */
3063 /* j1 is the Bessel function of the first kind of order 1 */
3067 TEST_f_f (j1, nan_value, nan_value);
3068 TEST_f_f (j1, plus_infty, 0);
3070 TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
3071 TEST_f_f (j1, 0.0, 0.0);
3072 TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
3073 TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
3074 TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
3075 TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
3076 TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
3077 TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
3078 TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
3089 FUNC (sincos) (0, &s, &c);
3090 if (errno == ENOSYS)
3091 /* Required function not implemented. */
3095 if (errno == ENOSYS)
3096 /* Function not implemented. */
3099 /* jn is the Bessel function of the first kind of order n. */
3102 /* jn (0, x) == j0 (x) */
3103 TEST_ff_f (jn, 0, nan_value, nan_value);
3104 TEST_ff_f (jn, 0, plus_infty, 0);
3105 TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
3106 TEST_ff_f (jn, 0, 0.0, 1.0);
3107 TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
3108 TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
3109 TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
3110 TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
3111 TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
3112 TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
3113 TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
3114 TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3115 TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3117 /* jn (1, x) == j1 (x) */
3118 TEST_ff_f (jn, 1, nan_value, nan_value);
3119 TEST_ff_f (jn, 1, plus_infty, 0);
3120 TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
3121 TEST_ff_f (jn, 1, 0.0, 0.0);
3122 TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
3123 TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
3124 TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
3125 TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
3126 TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
3127 TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
3128 TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
3131 TEST_ff_f (jn, 3, nan_value, nan_value);
3132 TEST_ff_f (jn, 3, plus_infty, 0);
3134 TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
3135 TEST_ff_f (jn, 3, 0.0, 0.0);
3136 TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
3137 TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
3138 TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
3139 TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
3140 TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
3143 TEST_ff_f (jn, 10, nan_value, nan_value);
3144 TEST_ff_f (jn, 10, plus_infty, 0);
3146 TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
3147 TEST_ff_f (jn, 10, 0.0, 0.0);
3148 TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
3149 TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
3150 TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
3151 TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
3152 TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
3156 #endif /* __DO_XSI_MATH__ */
3162 TEST_ff_f (ldexp, 0, 0, 0);
3163 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
3165 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
3166 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
3167 TEST_ff_f (ldexp, nan_value, 1, nan_value);
3169 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
3170 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
3172 /* ldexp (x, 0) == x. */
3173 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
3182 if (errno == ENOSYS)
3183 /* Function not implemented. */
3185 feclearexcept (FE_ALL_EXCEPT);
3189 TEST_f_f (lgamma, plus_infty, plus_infty);
3190 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3191 TEST_f_f (lgamma, nan_value, nan_value);
3193 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3194 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3195 TEST_f_f (lgamma, minus_infty, plus_infty);
3197 TEST_f_f1 (lgamma, 1, 0, 1);
3199 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3201 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3202 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3203 TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
3204 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
3214 /* XXX this test is incomplete. We need to have a way to specifiy
3215 the rounding method and test the critical cases. So far, only
3216 unproblematic numbers are tested. */
3220 TEST_f_l (lrint, 0.0, 0);
3221 TEST_f_l (lrint, minus_zero, 0);
3222 TEST_f_l (lrint, 0.2L, 0);
3223 TEST_f_l (lrint, -0.2L, 0);
3225 TEST_f_l (lrint, 1.4L, 1);
3226 TEST_f_l (lrint, -1.4L, -1);
3228 TEST_f_l (lrint, 8388600.3L, 8388600);
3229 TEST_f_l (lrint, -8388600.3L, -8388600);
3231 TEST_f_l (lrint, 1071930.0008, 1071930);
3233 TEST_f_l (lrint, 1073741824.01, 1073741824);
3234 # if LONG_MAX > 281474976710656
3235 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3246 /* XXX this test is incomplete. We need to have a way to specifiy
3247 the rounding method and test the critical cases. So far, only
3248 unproblematic numbers are tested. */
3252 TEST_f_L (llrint, 0.0, 0);
3253 TEST_f_L (llrint, minus_zero, 0);
3254 TEST_f_L (llrint, 0.2L, 0);
3255 TEST_f_L (llrint, -0.2L, 0);
3257 TEST_f_L (llrint, 1.4L, 1);
3258 TEST_f_L (llrint, -1.4L, -1);
3260 TEST_f_L (llrint, 8388600.3L, 8388600);
3261 TEST_f_L (llrint, -8388600.3L, -8388600);
3263 TEST_f_l (llrint, 1071930.0008, 1071930);
3265 /* Test boundary conditions. */
3267 TEST_f_L (llrint, 2097151.0,2097151LL);
3269 TEST_f_L (llrint, 8388608.0, 8388608LL);
3271 TEST_f_L (llrint, 16777216.0, 16777216LL);
3273 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3275 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3276 /* 0x1000000000000 */
3277 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3278 /* 0x10000000000000 */
3279 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3280 /* 0x10000080000000 */
3281 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3282 /* 0x20000000000000 */
3283 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3284 /* 0x80000000000000 */
3285 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3286 /* 0x100000000000000 */
3287 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3289 /* The input can only be represented in long double. */
3290 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3291 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3292 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3293 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3294 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3296 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3297 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3298 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3299 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3300 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3302 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3303 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3304 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3305 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3306 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3308 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3309 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3310 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3311 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3312 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3314 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3315 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3316 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3317 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3318 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3320 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3321 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3322 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3323 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3324 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3337 if (errno == ENOSYS)
3338 /* Function not implemented. */
3342 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3343 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3345 TEST_f_f (log, 1, 0);
3347 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
3348 TEST_f_f (log, plus_infty, plus_infty);
3350 TEST_f_f (log, M_El, 1);
3351 TEST_f_f (log, 1.0 / M_El, -1);
3352 TEST_f_f (log, 2, M_LN2l);
3353 TEST_f_f (log, 10, M_LN10l);
3354 TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
3365 if (errno == ENOSYS)
3366 /* Function not implemented. */
3371 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3372 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3374 TEST_f_f (log10, 1, 0);
3376 /* log10 (x) == NaN plus invalid exception if x < 0. */
3377 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
3379 TEST_f_f (log10, plus_infty, plus_infty);
3380 TEST_f_f (log10, nan_value, nan_value);
3382 TEST_f_f (log10, 0.1L, -1);
3383 TEST_f_f (log10, 10.0, 1);
3384 TEST_f_f (log10, 100.0, 2);
3385 TEST_f_f (log10, 10000.0, 4);
3386 TEST_f_f (log10, M_El, M_LOG10El);
3387 TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
3398 if (errno == ENOSYS)
3399 /* Function not implemented. */
3404 TEST_f_f (log1p, 0, 0);
3405 TEST_f_f (log1p, minus_zero, minus_zero);
3407 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3408 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
3410 TEST_f_f (log1p, plus_infty, plus_infty);
3411 TEST_f_f (log1p, nan_value, nan_value);
3413 TEST_f_f (log1p, M_El - 1.0, 1);
3415 TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
3416 TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
3428 if (errno == ENOSYS)
3429 /* Function not implemented. */
3434 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3435 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3437 TEST_f_f (log2, 1, 0);
3439 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
3441 TEST_f_f (log2, plus_infty, plus_infty);
3442 TEST_f_f (log2, nan_value, nan_value);
3444 TEST_f_f (log2, M_El, M_LOG2El);
3445 TEST_f_f (log2, 2.0, 1);
3446 TEST_f_f (log2, 16.0, 4);
3447 TEST_f_f (log2, 256.0, 8);
3448 TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
3460 TEST_f_f (logb, plus_infty, plus_infty);
3461 TEST_f_f (logb, minus_infty, plus_infty);
3463 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3465 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3466 TEST_f_f (logb, nan_value, nan_value);
3468 TEST_f_f (logb, 1, 0);
3469 TEST_f_f (logb, M_El, 1);
3470 TEST_f_f (logb, 1024, 10);
3471 TEST_f_f (logb, -2000, 10);
3483 TEST_f_l (lround, 0, 0);
3484 TEST_f_l (lround, minus_zero, 0);
3485 TEST_f_l (lround, 0.2L, 0.0);
3486 TEST_f_l (lround, -0.2L, 0);
3487 TEST_f_l (lround, 0.5, 1);
3488 TEST_f_l (lround, -0.5, -1);
3489 TEST_f_l (lround, 0.8L, 1);
3490 TEST_f_l (lround, -0.8L, -1);
3491 TEST_f_l (lround, 1.5, 2);
3492 TEST_f_l (lround, -1.5, -2);
3493 TEST_f_l (lround, 22514.5, 22515);
3494 TEST_f_l (lround, -22514.5, -22515);
3495 TEST_f_l (lround, 1071930.0008, 1071930);
3497 TEST_f_l (lround, 1073741824.01, 1073741824);
3498 # if LONG_MAX > 281474976710656
3499 TEST_f_l (lround, 281474976710656.025, 281474976710656);
3501 TEST_f_l (lround, 2097152.5, 2097153);
3502 TEST_f_l (lround, -2097152.5, -2097153);
3513 TEST_f_L (llround, 0, 0);
3514 TEST_f_L (llround, minus_zero, 0);
3515 TEST_f_L (llround, 0.2L, 0.0);
3516 TEST_f_L (llround, -0.2L, 0);
3517 TEST_f_L (llround, 0.5, 1);
3518 TEST_f_L (llround, -0.5, -1);
3519 TEST_f_L (llround, 0.8L, 1);
3520 TEST_f_L (llround, -0.8L, -1);
3521 TEST_f_L (llround, 1.5, 2);
3522 TEST_f_L (llround, -1.5, -2);
3523 TEST_f_L (llround, 22514.5, 22515);
3524 TEST_f_L (llround, -22514.5, -22515);
3525 TEST_f_l (llround, 1071930.0008, 1071930);
3527 TEST_f_L (llround, 2097152.5, 2097153);
3528 TEST_f_L (llround, -2097152.5, -2097153);
3529 TEST_f_L (llround, 34359738368.5, 34359738369ll);
3530 TEST_f_L (llround, -34359738368.5, -34359738369ll);
3533 /* Test boundary conditions. */
3535 TEST_f_L (llround, 2097151.0, 2097151LL);
3537 TEST_f_L (llround, 8388608.0, 8388608LL);
3539 TEST_f_L (llround, 16777216.0, 16777216LL);
3541 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
3543 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
3544 /* 0x1000000000000 */
3545 TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
3546 /* 0x10000000000000 */
3547 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
3548 /* 0x10000080000000 */
3549 TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
3550 /* 0x20000000000000 */
3551 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
3552 /* 0x80000000000000 */
3553 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
3554 /* 0x100000000000000 */
3555 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
3559 TEST_f_L (llround, 4294967295.5, 4294967296LL);
3561 TEST_f_L (llround, 8589934591.5, 8589934592LL);
3565 /* The input can only be represented in long double. */
3566 TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
3567 TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
3568 TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
3569 TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
3570 TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
3572 TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
3573 TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
3574 TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
3575 TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
3576 TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
3578 TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
3579 TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
3580 TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
3581 TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
3582 TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
3584 TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
3585 TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
3586 TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
3587 TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
3588 TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
3590 TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
3591 TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
3592 TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
3593 TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
3594 TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
3596 TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
3597 TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
3598 TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
3599 TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
3600 TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
3602 TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
3603 TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
3604 TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
3605 TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
3606 TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
3607 TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
3621 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
3622 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
3623 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
3624 TEST_fF_f1 (modf, 0, 0, 0);
3625 TEST_fF_f1 (modf, 1.5, 0.5, 1);
3626 TEST_fF_f1 (modf, 2.5, 0.5, 2);
3627 TEST_fF_f1 (modf, -2.5, -0.5, -2);
3628 TEST_fF_f1 (modf, 20, 0, 20);
3629 TEST_fF_f1 (modf, 21, 0, 21);
3630 TEST_fF_f1 (modf, 89.5, 0.5, 89);
3637 nearbyint_test (void)
3641 TEST_f_f (nearbyint, 0.0, 0.0);
3642 TEST_f_f (nearbyint, minus_zero, minus_zero);
3643 TEST_f_f (nearbyint, plus_infty, plus_infty);
3644 TEST_f_f (nearbyint, minus_infty, minus_infty);
3645 TEST_f_f (nearbyint, nan_value, nan_value);
3647 /* Default rounding mode is round to nearest. */
3648 TEST_f_f (nearbyint, 0.5, 0.0);
3649 TEST_f_f (nearbyint, 1.5, 2.0);
3650 TEST_f_f (nearbyint, -0.5, minus_zero);
3651 TEST_f_f (nearbyint, -1.5, -2.0);
3657 nextafter_test (void)
3662 TEST_ff_f (nextafter, 0, 0, 0);
3663 TEST_ff_f (nextafter, minus_zero, 0, 0);
3664 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
3665 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
3667 TEST_ff_f (nextafter, 9, 9, 9);
3668 TEST_ff_f (nextafter, -9, -9, -9);
3669 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
3670 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
3672 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
3673 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
3674 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
3676 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
3677 LDBL_MAX, DBL_MAX, FLT_MAX);
3678 TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
3679 TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
3682 // XXX Enable once gcc is fixed.
3683 //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
3686 /* XXX We need the hexadecimal FP number representation here for further
3694 nexttoward_test (void)
3697 TEST_ff_f (nexttoward, 0, 0, 0);
3698 TEST_ff_f (nexttoward, minus_zero, 0, 0);
3699 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
3700 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
3702 TEST_ff_f (nexttoward, 9, 9, 9);
3703 TEST_ff_f (nexttoward, -9, -9, -9);
3704 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
3705 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
3707 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
3708 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
3709 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
3711 /* XXX We need the hexadecimal FP number representation here for further
3724 if (errno == ENOSYS)
3725 /* Function not implemented. */
3730 TEST_ff_f (pow, 0, 0, 1);
3731 TEST_ff_f (pow, 0, minus_zero, 1);
3732 TEST_ff_f (pow, minus_zero, 0, 1);
3733 TEST_ff_f (pow, minus_zero, minus_zero, 1);
3735 TEST_ff_f (pow, 10, 0, 1);
3736 TEST_ff_f (pow, 10, minus_zero, 1);
3737 TEST_ff_f (pow, -10, 0, 1);
3738 TEST_ff_f (pow, -10, minus_zero, 1);
3740 TEST_ff_f (pow, nan_value, 0, 1);
3741 TEST_ff_f (pow, nan_value, minus_zero, 1);
3745 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
3746 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
3747 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
3748 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
3750 TEST_ff_f (pow, 0.9L, plus_infty, 0);
3751 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
3752 TEST_ff_f (pow, -0.9L, plus_infty, 0);
3753 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
3755 TEST_ff_f (pow, 1.1L, minus_infty, 0);
3756 TEST_ff_f (pow, plus_infty, minus_infty, 0);
3757 TEST_ff_f (pow, -1.1L, minus_infty, 0);
3758 TEST_ff_f (pow, minus_infty, minus_infty, 0);
3760 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
3761 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
3762 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
3763 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
3765 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
3766 TEST_ff_f (pow, plus_infty, 1, plus_infty);
3767 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
3769 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
3770 TEST_ff_f (pow, plus_infty, -1, 0);
3771 TEST_ff_f (pow, plus_infty, -1e7L, 0);
3773 TEST_ff_f (pow, minus_infty, 1, minus_infty);
3774 TEST_ff_f (pow, minus_infty, 11, minus_infty);
3775 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
3777 TEST_ff_f (pow, minus_infty, 2, plus_infty);
3778 TEST_ff_f (pow, minus_infty, 12, plus_infty);
3779 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
3780 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
3781 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
3782 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
3783 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
3785 TEST_ff_f (pow, minus_infty, -1, minus_zero);
3786 TEST_ff_f (pow, minus_infty, -11, minus_zero);
3787 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
3789 TEST_ff_f (pow, minus_infty, -2, 0);
3790 TEST_ff_f (pow, minus_infty, -12, 0);
3791 TEST_ff_f (pow, minus_infty, -1002, 0);
3792 TEST_ff_f (pow, minus_infty, -0.1L, 0);
3793 TEST_ff_f (pow, minus_infty, -1.1L, 0);
3794 TEST_ff_f (pow, minus_infty, -11.1L, 0);
3795 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
3798 TEST_ff_f (pow, nan_value, nan_value, nan_value);
3799 TEST_ff_f (pow, 0, nan_value, nan_value);
3800 TEST_ff_f (pow, 1, nan_value, 1);
3801 TEST_ff_f (pow, -1, nan_value, nan_value);
3802 TEST_ff_f (pow, nan_value, 1, nan_value);
3803 TEST_ff_f (pow, nan_value, -1, nan_value);
3805 /* pow (x, NaN) == NaN. */
3806 TEST_ff_f (pow, 3.0, nan_value, nan_value);
3808 TEST_ff_f (pow, 1, plus_infty, 1);
3809 TEST_ff_f (pow, -1, plus_infty, 1);
3810 TEST_ff_f (pow, 1, minus_infty, 1);
3811 TEST_ff_f (pow, -1, minus_infty, 1);
3812 TEST_ff_f (pow, 1, 1, 1);
3813 TEST_ff_f (pow, 1, -1, 1);
3814 TEST_ff_f (pow, 1, 1.25, 1);
3815 TEST_ff_f (pow, 1, -1.25, 1);
3816 TEST_ff_f (pow, 1, 0x1p62L, 1);
3817 TEST_ff_f (pow, 1, 0x1p63L, 1);
3818 TEST_ff_f (pow, 1, 0x1p64L, 1);
3819 TEST_ff_f (pow, 1, 0x1p72L, 1);
3821 /* pow (x, +-0) == 1. */
3822 TEST_ff_f (pow, plus_infty, 0, 1);
3823 TEST_ff_f (pow, plus_infty, minus_zero, 1);
3824 TEST_ff_f (pow, minus_infty, 0, 1);
3825 TEST_ff_f (pow, minus_infty, minus_zero, 1);
3826 TEST_ff_f (pow, 32.75L, 0, 1);
3827 TEST_ff_f (pow, 32.75L, minus_zero, 1);
3828 TEST_ff_f (pow, -32.75L, 0, 1);
3829 TEST_ff_f (pow, -32.75L, minus_zero, 1);
3830 TEST_ff_f (pow, 0x1p72L, 0, 1);
3831 TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
3832 TEST_ff_f (pow, 0x1p-72L, 0, 1);
3833 TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
3835 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3836 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3837 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3838 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3840 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3841 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3842 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3843 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3845 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3846 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3847 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3848 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3850 TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
3851 TEST_ff_f (pow, 10, -0x1p72L, 0);
3852 TEST_ff_f (pow, max_value, max_value, plus_infty);
3853 TEST_ff_f (pow, 10, -max_value, 0);
3855 TEST_ff_f (pow, 0, 1, 0);
3856 TEST_ff_f (pow, 0, 11, 0);
3858 TEST_ff_f (pow, minus_zero, 1, minus_zero);
3859 TEST_ff_f (pow, minus_zero, 11, minus_zero);
3862 TEST_ff_f (pow, 0, 2, 0);
3863 TEST_ff_f (pow, 0, 11.1L, 0);
3866 TEST_ff_f (pow, minus_zero, 2, 0);
3867 TEST_ff_f (pow, minus_zero, 11.1L, 0);
3868 TEST_ff_f (pow, 0, plus_infty, 0);
3869 TEST_ff_f (pow, minus_zero, plus_infty, 0);
3872 /* pow (x, +inf) == +inf for |x| > 1. */
3873 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
3875 /* pow (x, +inf) == +0 for |x| < 1. */
3876 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
3878 /* pow (x, -inf) == +0 for |x| > 1. */
3879 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
3881 /* pow (x, -inf) == +inf for |x| < 1. */
3882 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
3885 /* pow (+inf, y) == +inf for y > 0. */
3886 TEST_ff_f (pow, plus_infty, 2, plus_infty);
3888 /* pow (+inf, y) == +0 for y < 0. */
3889 TEST_ff_f (pow, plus_infty, -1, 0.0);
3891 /* pow (-inf, y) == -inf for y an odd integer > 0. */
3892 TEST_ff_f (pow, minus_infty, 27, minus_infty);
3894 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
3895 TEST_ff_f (pow, minus_infty, 28, plus_infty);
3897 /* pow (-inf, y) == -0 for y an odd integer < 0. */
3898 TEST_ff_f (pow, minus_infty, -3, minus_zero);
3899 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
3900 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
3902 /* pow (+0, y) == +0 for y an odd integer > 0. */
3903 TEST_ff_f (pow, 0.0, 27, 0.0);
3905 /* pow (-0, y) == -0 for y an odd integer > 0. */
3906 TEST_ff_f (pow, minus_zero, 27, minus_zero);
3908 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
3909 TEST_ff_f (pow, 0.0, 4, 0.0);
3911 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
3912 TEST_ff_f (pow, minus_zero, 4, 0.0);
3914 TEST_ff_f (pow, 16, 0.25L, 2);
3915 TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
3916 TEST_ff_f (pow, 2, 4, 16);
3917 TEST_ff_f (pow, 256, 8, 0x1p64L);
3919 TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
3921 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
3922 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
3929 remainder_test (void)
3932 FUNC(remainder) (1.625, 1.0);
3933 if (errno == ENOSYS)
3934 /* Function not implemented. */
3939 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
3940 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
3941 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
3942 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
3943 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
3945 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
3946 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
3947 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
3948 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
3949 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
3950 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
3962 FUNC(remquo) (1.625, 1.0, &x);
3963 if (errno == ENOSYS)
3964 /* Function not implemented. */
3969 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
3970 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
3971 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3972 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3973 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
3975 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
3976 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
3977 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
3978 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
3980 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
3981 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
3991 TEST_f_f (rint, 0.0, 0.0);
3992 TEST_f_f (rint, minus_zero, minus_zero);
3993 TEST_f_f (rint, plus_infty, plus_infty);
3994 TEST_f_f (rint, minus_infty, minus_infty);
3996 /* Default rounding mode is round to even. */
3997 TEST_f_f (rint, 0.5, 0.0);
3998 TEST_f_f (rint, 1.5, 2.0);
3999 TEST_f_f (rint, 2.5, 2.0);
4000 TEST_f_f (rint, 3.5, 4.0);
4001 TEST_f_f (rint, 4.5, 4.0);
4002 TEST_f_f (rint, -0.5, -0.0);
4003 TEST_f_f (rint, -1.5, -2.0);
4004 TEST_f_f (rint, -2.5, -2.0);
4005 TEST_f_f (rint, -3.5, -4.0);
4006 TEST_f_f (rint, -4.5, -4.0);
4008 /* The result can only be represented in long double. */
4009 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
4010 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
4011 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
4012 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
4013 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
4015 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
4016 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
4017 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
4018 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
4019 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
4021 TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
4022 TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
4023 TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
4024 TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
4025 TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
4027 TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
4028 TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
4029 TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
4030 TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
4031 TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
4033 TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
4034 TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
4035 TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
4036 TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
4037 TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
4039 TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
4040 TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
4041 TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
4042 TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
4043 TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
4045 TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
4046 TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
4047 TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
4048 TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
4049 TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
4057 rint_test_tonearest (void)
4059 int save_round_mode;
4060 START (rint_tonearest);
4062 save_round_mode = fegetround();
4064 if (!fesetround (FE_TONEAREST))
4066 TEST_f_f (rint, 2.0, 2.0);
4067 TEST_f_f (rint, 1.5, 2.0);
4068 TEST_f_f (rint, 1.0, 1.0);
4069 TEST_f_f (rint, 0.5, 0.0);
4070 TEST_f_f (rint, 0.0, 0.0);
4071 TEST_f_f (rint, minus_zero, minus_zero);
4072 TEST_f_f (rint, -0.5, -0.0);
4073 TEST_f_f (rint, -1.0, -1.0);
4074 TEST_f_f (rint, -1.5, -2.0);
4075 TEST_f_f (rint, -2.0, -2.0);
4078 fesetround(save_round_mode);
4080 END (rint_tonearest);
4084 rint_test_towardzero (void)
4086 int save_round_mode;
4087 START (rint_towardzero);
4089 save_round_mode = fegetround();
4091 if (!fesetround (FE_TOWARDZERO))
4093 TEST_f_f (rint, 2.0, 2.0);
4094 TEST_f_f (rint, 1.5, 1.0);
4095 TEST_f_f (rint, 1.0, 1.0);
4096 TEST_f_f (rint, 0.5, 0.0);
4097 TEST_f_f (rint, 0.0, 0.0);
4098 TEST_f_f (rint, minus_zero, minus_zero);
4099 TEST_f_f (rint, -0.5, -0.0);
4100 TEST_f_f (rint, -1.0, -1.0);
4101 TEST_f_f (rint, -1.5, -1.0);
4102 TEST_f_f (rint, -2.0, -2.0);
4105 fesetround(save_round_mode);
4107 END (rint_towardzero);
4111 rint_test_downward (void)
4113 int save_round_mode;
4114 START (rint_downward);
4116 save_round_mode = fegetround();
4118 if (!fesetround (FE_DOWNWARD))
4120 TEST_f_f (rint, 2.0, 2.0);
4121 TEST_f_f (rint, 1.5, 1.0);
4122 TEST_f_f (rint, 1.0, 1.0);
4123 TEST_f_f (rint, 0.5, 0.0);
4124 TEST_f_f (rint, 0.0, 0.0);
4125 TEST_f_f (rint, minus_zero, minus_zero);
4126 TEST_f_f (rint, -0.5, -1.0);
4127 TEST_f_f (rint, -1.0, -1.0);
4128 TEST_f_f (rint, -1.5, -2.0);
4129 TEST_f_f (rint, -2.0, -2.0);
4132 fesetround(save_round_mode);
4134 END (rint_downward);
4138 rint_test_upward (void)
4140 int save_round_mode;
4141 START (rint_upward);
4143 save_round_mode = fegetround();
4145 if (!fesetround (FE_UPWARD))
4147 TEST_f_f (rint, 2.0, 2.0);
4148 TEST_f_f (rint, 1.5, 2.0);
4149 TEST_f_f (rint, 1.0, 1.0);
4150 TEST_f_f (rint, 0.5, 1.0);
4151 TEST_f_f (rint, 0.0, 0.0);
4152 TEST_f_f (rint, minus_zero, minus_zero);
4153 TEST_f_f (rint, -0.5, -0.0);
4154 TEST_f_f (rint, -1.0, -1.0);
4155 TEST_f_f (rint, -1.5, -1.0);
4156 TEST_f_f (rint, -2.0, -2.0);
4159 fesetround(save_round_mode);
4169 TEST_f_f (round, 0, 0);
4170 TEST_f_f (round, minus_zero, minus_zero);
4171 TEST_f_f (round, 0.2L, 0.0);
4172 TEST_f_f (round, -0.2L, minus_zero);
4173 TEST_f_f (round, 0.5, 1.0);
4174 TEST_f_f (round, -0.5, -1.0);
4175 TEST_f_f (round, 0.8L, 1.0);
4176 TEST_f_f (round, -0.8L, -1.0);
4177 TEST_f_f (round, 1.5, 2.0);
4178 TEST_f_f (round, -1.5, -2.0);
4179 TEST_f_f (round, 2097152.5, 2097153);
4180 TEST_f_f (round, -2097152.5, -2097153);
4183 /* The result can only be represented in long double. */
4184 TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
4185 TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
4186 TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
4187 TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
4188 TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
4190 TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
4191 TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
4192 TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
4193 TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
4194 TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
4196 TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
4197 TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
4198 TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
4199 TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
4200 TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
4202 TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
4203 TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
4204 TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
4205 TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
4206 TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
4208 TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
4209 TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
4210 TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
4211 TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
4212 TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
4214 TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
4215 TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
4216 TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
4217 TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
4218 TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
4220 TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
4221 TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
4222 TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
4223 TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
4224 TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
4232 #ifdef __UCLIBC_SUSV3_LEGACY__
4237 #ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */
4239 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
4240 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
4242 TEST_ff_f (scalb, 0, nan_value, nan_value);
4243 TEST_ff_f (scalb, 1, nan_value, nan_value);
4245 TEST_ff_f (scalb, 1, 0, 1);
4246 TEST_ff_f (scalb, -1, 0, -1);
4248 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
4249 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
4251 TEST_ff_f (scalb, 0, 2, 0);
4252 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
4253 TEST_ff_f (scalb, 0, 0, 0);
4254 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
4255 TEST_ff_f (scalb, 0, -1, 0);
4256 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
4257 TEST_ff_f (scalb, 0, minus_infty, 0);
4258 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
4260 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
4261 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
4262 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
4263 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
4264 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
4265 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
4267 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
4268 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
4270 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
4271 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
4272 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
4273 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
4275 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
4276 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
4278 TEST_ff_f (scalb, nan_value, 1, nan_value);
4279 TEST_ff_f (scalb, 1, nan_value, nan_value);
4280 TEST_ff_f (scalb, nan_value, 0, nan_value);
4281 TEST_ff_f (scalb, 0, nan_value, nan_value);
4282 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
4283 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
4284 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
4286 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
4287 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
4288 #endif /* TEST_LDOUBLE */
4299 TEST_fi_f (scalbn, 0, 0, 0);
4300 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
4302 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
4303 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
4304 TEST_fi_f (scalbn, nan_value, 1, nan_value);
4306 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
4307 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
4309 TEST_fi_f (scalbn, 1, 0L, 1);
4321 TEST_fl_f (scalbln, 0, 0, 0);
4322 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
4324 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
4325 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
4326 TEST_fl_f (scalbln, nan_value, 1, nan_value);
4328 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
4329 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
4331 TEST_fl_f (scalbln, 1, 0L, 1);
4343 TEST_f_b (signbit, 0, 0);
4344 TEST_f_b (signbit, minus_zero, 1);
4345 TEST_f_b (signbit, plus_infty, 0);
4346 TEST_f_b (signbit, minus_infty, 1);
4348 /* signbit (x) != 0 for x < 0. */
4349 TEST_f_b (signbit, -1, 1);
4350 /* signbit (x) == 0 for x >= 0. */
4351 TEST_f_b (signbit, 1, 0);
4362 if (errno == ENOSYS)
4363 /* Function not implemented. */
4368 TEST_f_f (sin, 0, 0);
4369 TEST_f_f (sin, minus_zero, minus_zero);
4370 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
4371 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
4372 TEST_f_f (sin, nan_value, nan_value);
4374 TEST_f_f (sin, M_PI_6l, 0.5);
4375 TEST_f_f (sin, -M_PI_6l, -0.5);
4376 TEST_f_f (sin, M_PI_2l, 1);
4377 TEST_f_f (sin, -M_PI_2l, -1);
4378 TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
4381 TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
4393 FLOAT sin_res, cos_res;
4396 FUNC(sincos) (0, &sin_res, &cos_res);
4397 if (errno == ENOSYS)
4398 /* Function not implemented. */
4403 /* sincos is treated differently because it returns void. */
4404 TEST_extra (sincos, 0, 0, 1);
4406 TEST_extra (sincos, minus_zero, minus_zero, 1);
4407 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
4408 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
4409 TEST_extra (sincos, nan_value, nan_value, nan_value);
4411 TEST_extra (sincos, M_PI_2l, 1, 0);
4412 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
4413 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
4414 TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
4417 TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
4429 if (errno == ENOSYS)
4430 /* Function not implemented. */
4434 TEST_f_f (sinh, 0, 0);
4435 TEST_f_f (sinh, minus_zero, minus_zero);
4438 TEST_f_f (sinh, plus_infty, plus_infty);
4439 TEST_f_f (sinh, minus_infty, minus_infty);
4441 TEST_f_f (sinh, nan_value, nan_value);
4443 TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
4444 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
4454 if (errno == ENOSYS)
4455 /* Function not implemented. */
4460 TEST_f_f (sqrt, 0, 0);
4461 TEST_f_f (sqrt, nan_value, nan_value);
4462 TEST_f_f (sqrt, plus_infty, plus_infty);
4464 TEST_f_f (sqrt, minus_zero, minus_zero);
4466 /* sqrt (x) == NaN plus invalid exception for x < 0. */
4467 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
4468 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
4469 TEST_f_f (sqrt, nan_value, nan_value);
4471 TEST_f_f (sqrt, 2209, 47);
4472 TEST_f_f (sqrt, 4, 2);
4473 TEST_f_f (sqrt, 2, M_SQRT2l);
4474 TEST_f_f (sqrt, 0.25, 0.5);
4475 TEST_f_f (sqrt, 6642.25, 81.5);
4476 TEST_f_f (sqrt, 15190.5625L, 123.25L);
4477 TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
4488 if (errno == ENOSYS)
4489 /* Function not implemented. */
4494 TEST_f_f (tan, 0, 0);
4495 TEST_f_f (tan, minus_zero, minus_zero);
4496 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
4497 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
4498 TEST_f_f (tan, nan_value, nan_value);
4500 TEST_f_f (tan, M_PI_4l, 1);
4501 TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
4511 if (errno == ENOSYS)
4512 /* Function not implemented. */
4517 TEST_f_f (tanh, 0, 0);
4518 /* vda: uclibc: added IGNORE_ZERO_INF_SIGN to treat -0 as ok */
4519 TEST_f_f (tanh, minus_zero, minus_zero, IGNORE_ZERO_INF_SIGN);
4522 TEST_f_f (tanh, plus_infty, 1);
4523 TEST_f_f (tanh, minus_infty, -1);
4525 TEST_f_f (tanh, nan_value, nan_value);
4527 TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
4528 TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
4530 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
4531 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
4534 TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
4544 if (errno == ENOSYS)
4545 /* Function not implemented. */
4547 feclearexcept (FE_ALL_EXCEPT);
4551 TEST_f_f (tgamma, plus_infty, plus_infty);
4552 TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4553 TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4554 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
4555 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
4556 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
4557 TEST_f_f (tgamma, nan_value, nan_value);
4559 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
4560 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
4562 TEST_f_f (tgamma, 1, 1);
4563 TEST_f_f (tgamma, 4, 6);
4565 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
4566 TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
4578 TEST_f_f (trunc, plus_infty, plus_infty);
4579 TEST_f_f (trunc, minus_infty, minus_infty);
4580 TEST_f_f (trunc, nan_value, nan_value);
4582 TEST_f_f (trunc, 0, 0);
4583 TEST_f_f (trunc, minus_zero, minus_zero);
4584 TEST_f_f (trunc, 0.625, 0);
4585 TEST_f_f (trunc, -0.625, minus_zero);
4586 TEST_f_f (trunc, 1, 1);
4587 TEST_f_f (trunc, -1, -1);
4588 TEST_f_f (trunc, 1.625, 1);
4589 TEST_f_f (trunc, -1.625, -1);
4591 TEST_f_f (trunc, 1048580.625L, 1048580L);
4592 TEST_f_f (trunc, -1048580.625L, -1048580L);
4594 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
4595 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
4597 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
4598 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
4601 /* The result can only be represented in long double. */
4602 TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
4603 TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
4604 TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
4605 TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
4606 TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
4608 TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
4609 TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
4610 TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
4611 TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
4612 TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
4614 TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
4615 TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
4616 TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
4617 TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
4618 TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
4620 TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
4621 TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
4622 TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
4623 TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
4624 TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
4626 TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
4627 TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
4628 TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
4629 TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
4630 TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
4632 TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
4633 TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
4634 TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
4635 TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
4636 TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
4638 TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
4639 TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
4640 TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
4641 TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
4642 TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
4649 #if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
4656 FUNC (sincos) (0, &s, &c);
4657 if (errno == ENOSYS)
4658 /* Required function not implemented. */
4662 if (errno == ENOSYS)
4663 /* Function not implemented. */
4666 /* y0 is the Bessel function of the second kind of order 0 */
4669 TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
4670 TEST_f_f (y0, 0.0, minus_infty);
4671 TEST_f_f (y0, nan_value, nan_value);
4672 TEST_f_f (y0, plus_infty, 0);
4674 TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
4675 TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
4676 TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
4677 TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
4678 TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
4679 TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
4680 TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
4692 FUNC (sincos) (0, &s, &c);
4693 if (errno == ENOSYS)
4694 /* Required function not implemented. */
4698 if (errno == ENOSYS)
4699 /* Function not implemented. */
4702 /* y1 is the Bessel function of the second kind of order 1 */
4705 TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
4706 TEST_f_f (y1, 0.0, minus_infty);
4707 TEST_f_f (y1, plus_infty, 0);
4708 TEST_f_f (y1, nan_value, nan_value);
4710 TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
4711 TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
4712 TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
4713 TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
4714 TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
4715 TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
4716 TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
4728 FUNC (sincos) (0, &s, &c);
4729 if (errno == ENOSYS)
4730 /* Required function not implemented. */
4734 if (errno == ENOSYS)
4735 /* Function not implemented. */
4738 /* yn is the Bessel function of the second kind of order n */
4741 /* yn (0, x) == y0 (x) */
4742 TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
4743 TEST_ff_f (yn, 0, 0.0, minus_infty);
4744 TEST_ff_f (yn, 0, nan_value, nan_value);
4745 TEST_ff_f (yn, 0, plus_infty, 0);
4747 TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
4748 TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
4749 TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
4750 TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
4751 TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
4752 TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
4753 TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
4755 /* yn (1, x) == y1 (x) */
4756 TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
4757 TEST_ff_f (yn, 1, 0.0, minus_infty);
4758 TEST_ff_f (yn, 1, plus_infty, 0);
4759 TEST_ff_f (yn, 1, nan_value, nan_value);
4761 TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
4762 TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
4763 TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
4764 TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
4765 TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
4766 TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
4767 TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
4770 TEST_ff_f (yn, 3, plus_infty, 0);
4771 TEST_ff_f (yn, 3, nan_value, nan_value);
4773 TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
4774 TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
4775 TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
4776 TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
4777 TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
4780 TEST_ff_f (yn, 10, plus_infty, 0);
4781 TEST_ff_f (yn, 10, nan_value, nan_value);
4783 TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
4784 TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
4785 TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
4786 TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
4787 TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
4792 #endif /* __DO_XSI_MATH__ */
4796 significand_test (void)
4798 /* significand returns the mantissa of the exponential representation. */
4799 START (significand);
4801 TEST_f_f (significand, 4.0, 1.0);
4802 TEST_f_f (significand, 6.0, 1.5);
4803 TEST_f_f (significand, 8.0, 1.0);
4812 fpstack_test ("start *init*");
4814 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
4816 minus_zero = FUNC(copysign) (0.0, -1.0);
4817 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
4818 HUGE_VALL, HUGE_VAL, HUGE_VALF);
4819 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
4820 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
4821 max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
4822 LDBL_MAX, DBL_MAX, FLT_MAX);
4823 min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
4824 LDBL_MIN, DBL_MIN, FLT_MIN);
4830 (void) &minus_infty;
4834 /* Clear all exceptions. From now on we must not get random exceptions. */
4835 feclearexcept (FE_ALL_EXCEPT);
4837 /* Test to make sure we start correctly. */
4838 fpstack_test ("end *init*");
4842 /* function to check our ulp calculation. */
4849 /* This gives one ulp. */
4850 u = FUNC(nextafter) (10, 20);
4851 check_equal (10.0, u, 1, &diff, &ulp);
4852 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
4854 /* This gives one more ulp. */
4855 u = FUNC(nextafter) (u, 20);
4856 check_equal (10.0, u, 2, &diff, &ulp);
4857 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
4859 /* And now calculate 100 ulp. */
4860 for (i = 2; i < 100; i++)
4861 u = FUNC(nextafter) (u, 20);
4862 check_equal (10.0, u, 100, &diff, &ulp);
4863 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
4868 main (int argc, char **argv)
4875 output_max_error = 1;
4877 /* XXX set to 0 for releases. */
4880 /* Parse and process arguments. */
4881 while ((key = getopt(argc, argv, "fi:puv")) > 0) {
4885 output_max_error = 0;
4888 if (strcmp (optarg, "yes") == 0)
4890 else if (strcmp (optarg, "no") == 0)
4903 fprintf (stderr, "Unknown argument: %c", key);
4904 exit (EXIT_FAILURE);
4910 fprintf (stderr, "wrong number of arguments");
4911 exit (EXIT_FAILURE);
4916 ulps_file = fopen ("ULPs", "a");
4917 if (ulps_file == NULL)
4919 perror ("can't open file `ULPs' for writing: ");
4932 /* Keep the tests a wee bit ordered (according to ISO C99). */
4933 /* Classification macros: */
4939 /* Trigonometric functions: */
4951 /* Hyperbolic functions: */
4959 /* Exponential and logarithmic functions: */
4977 #ifdef __UCLIBC_SUSV3_LEGACY__
4982 significand_test ();
4984 /* Power and absolute value functions: */
4991 /* Error and gamma functions: */
4998 /* Nearest integer functions: */
5004 rint_test_tonearest ();
5005 rint_test_towardzero ();
5006 rint_test_downward ();
5007 rint_test_upward ();
5016 /* Remainder functions: */
5021 /* Manipulation functions: */
5026 /* maximum, minimum and positive difference functions */
5031 /* Multiply and add: */
5035 /* Complex functions: */
5037 #if __CHK_COMPLEX_STUFF
5066 #endif /* __CHK_COMPLEX_STUFF */
5068 /* Bessel functions: */
5069 #if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
5076 #endif /* __DO_XSI_MATH__ */
5081 printf ("\nTest suite completed:\n");
5082 printf (" %d test cases plus %d tests for exception flags executed.\n",
5083 noTests, noExcTests);
5085 printf (" %d expected failures occurred.\n", noXFails);
5087 printf (" %d unexpected passes occurred.\n", noXPasses);
5090 printf (" %d errors occurred.\n", noErrors);
5093 printf (" All tests passed successfully.\n");