1 /* Copyright (C) 1997-2002, 2003 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 /* Part of testsuite for libm.
22 This file is processed by a perl script. The resulting file has to
23 be included by a master file that defines:
26 FUNC(function): converts general function name (like cos) to
27 name with correct suffix (e.g. cosl or cosf)
28 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
29 FLOAT: floating point type to test
30 - TEST_MSG: informal message to be displayed
31 CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
32 chooses one of the parameters as delta for testing
34 PRINTF_EXPR Floating point conversion specification to print a variable
35 of type FLOAT with printf. PRINTF_EXPR just contains
36 the specifier, not the percent and width arguments,
38 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
39 PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */
41 /* This testsuite has currently tests for:
42 acos, acosh, asin, asinh, atan, atan2, atanh,
43 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
44 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
46 ilogb, isfinite, isinf, isnan, isnormal,
47 isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
49 ldexp, lgamma, log, log10, log1p, log2, logb,
50 modf, nearbyint, nextafter,
51 pow, remainder, remquo, rint, lrint, llrint,
52 round, lround, llround,
53 scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
54 y0, y1, yn, significand
56 and for the following complex math functions:
57 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
58 ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
60 At the moment the following functions aren't tested:
63 Parameter handling is primitive in the moment:
64 --verbose=[0..3] for different levels of output:
66 1: basic report on failed tests (default)
67 2: full report on all tests
68 -v for full output (equals --verbose=3)
69 -u for generation of an ULPs file
74 This suite tests some aspects of the correct implementation of
75 mathematical functions in libm. Some simple, specific parameters
76 are tested for correctness but there's no exhaustive
77 testing. Handling of specific inputs (e.g. infinity, not-a-number)
78 is also tested. Correct handling of exceptions is checked
79 against. These implemented tests should check all cases that are
82 Exception testing: At the moment only divide-by-zero and invalid
83 exceptions are tested. Overflow/underflow and inexact exceptions
84 aren't checked at the moment.
86 NaN values: There exist signalling and quiet NaNs. This implementation
87 only uses quiet NaN as parameter but does not differenciate
88 between the two kinds of NaNs as result.
90 Inline functions: Inlining functions should give an improvement in
91 speed - but not in precission. The inlined functions return
92 reasonable values for a reasonable range of input values. The
93 result is not necessarily correct for all values and exceptions are
94 not correctly raised in all cases. Problematic input and return
95 values are infinity, not-a-number and minus zero. This suite
96 therefore does not check these specific inputs and the exception
97 handling for inlined mathematical functions - just the "reasonable"
100 Beware: The tests might fail for any of the following reasons:
102 - Functions are wrong
103 - Floating Point Unit not working properly
104 - Compiler has errors
106 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
109 To Do: All parameter should be numbers that can be represented as
110 exact floating point values. Currently some values cannot be
111 represented exactly and therefore the result is not the expected
112 result. For this we will use 36 digits so that numbers can be
113 represented exactly. */
119 #include "libm-test-ulps.h"
132 /* Possible exceptions */
133 #define NO_EXCEPTION 0x0
134 #define INVALID_EXCEPTION 0x1
135 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
136 /* The next flags signals that those exceptions are allowed but not required. */
137 #define INVALID_EXCEPTION_OK 0x4
138 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x8
139 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
140 /* Some special test flags, passed togther with exceptions. */
141 #define IGNORE_ZERO_INF_SIGN 0x10
143 /* Various constants (we must supply them precalculated for accuracy). */
144 #define M_PI_6l .52359877559829887307710723054658383L
145 #define M_E2l 7.389056098930650227230427460575008L
146 #define M_E3l 20.085536923187667740928529654581719L
147 #define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */
148 #define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
149 #define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
150 #define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
151 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
152 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
153 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
154 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
155 #define M_PI_LOG10El M_PIl * M_LOG10El
157 static FILE *ulps_file; /* File to document difference. */
158 static int output_ulps; /* Should ulps printed? */
160 static int noErrors; /* number of errors */
161 static int noTests; /* number of tests (without testing exceptions) */
162 static int noExcTests; /* number of tests for exception flags */
163 static int noXFails; /* number of expected failures. */
164 static int noXPasses; /* number of unexpected passes. */
167 static int output_max_error; /* Should the maximal errors printed? */
168 static int output_points; /* Should the single function results printed? */
169 static int ignore_max_ulp; /* Should we ignore max_ulp? */
171 static FLOAT minus_zero, plus_zero;
172 static FLOAT plus_infty, minus_infty, nan_value;
174 static FLOAT max_error, real_max_error, imag_max_error;
177 #define BUILD_COMPLEX(real, imag) \
178 ({ __complex__ FLOAT __retval; \
179 __real__ __retval = (real); \
180 __imag__ __retval = (imag); \
183 #define BUILD_COMPLEX_INT(real, imag) \
184 ({ __complex__ int __retval; \
185 __real__ __retval = (real); \
186 __imag__ __retval = (imag); \
190 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
191 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
194 init_max_error (void)
199 feclearexcept (FE_ALL_EXCEPT);
203 set_max_error (FLOAT current, FLOAT *curr_max_error)
205 if (current > *curr_max_error)
206 *curr_max_error = current;
210 /* Should the message print to screen? This depends on the verbose flag,
211 and the test status. */
213 print_screen (int ok, int xfail)
217 || (verbose == 1 && ok == xfail)))
223 /* Should the message print to screen? This depends on the verbose flag,
224 and the test status. */
226 print_screen_max_error (int ok, int xfail)
230 || ((verbose == 1) && (ok == xfail))))
235 /* Update statistic counters. */
237 update_stats (int ok, int xfail)
242 else if (!ok && xfail)
244 else if (!ok && !xfail)
249 print_ulps (const char *test_name, FLOAT ulp)
253 fprintf (ulps_file, "Test \"%s\":\n", test_name);
254 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
255 CHOOSE("ldouble", "double", "float",
256 "ildouble", "idouble", "ifloat"),
262 print_function_ulps (const char *function_name, FLOAT ulp)
266 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
267 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
268 CHOOSE("ldouble", "double", "float",
269 "ildouble", "idouble", "ifloat"),
276 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
283 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
284 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
285 CHOOSE("ldouble", "double", "float",
286 "ildouble", "idouble", "ifloat"),
287 FUNC(ceil) (real_ulp));
291 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
292 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
293 CHOOSE("ldouble", "double", "float",
294 "ildouble", "idouble", "ifloat"),
295 FUNC(ceil) (imag_ulp));
304 /* Test if Floating-Point stack hasn't changed */
306 fpstack_test (const char *test_name)
309 static int old_stack;
312 asm ("fnstsw" : "=a" (sw));
318 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
319 test_name, sw, old_stack);
328 print_max_error (const char *func_name, FLOAT allowed, int xfail)
332 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
338 print_function_ulps (func_name, max_error);
341 if (print_screen_max_error (ok, xfail))
343 printf ("Maximal error of `%s'\n", func_name);
344 printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
345 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
348 update_stats (ok, xfail);
353 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
354 __complex__ int xfail)
358 if ((real_max_error == 0 && imag_max_error == 0)
359 || (real_max_error <= __real__ allowed
360 && imag_max_error <= __imag__ allowed
367 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
370 if (print_screen_max_error (ok, xfail))
372 printf ("Maximal error of real part of: %s\n", func_name);
373 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
374 FUNC(ceil) (real_max_error));
375 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
376 FUNC(ceil) (__real__ allowed));
377 printf ("Maximal error of imaginary part of: %s\n", func_name);
378 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
379 FUNC(ceil) (imag_max_error));
380 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
381 FUNC(ceil) (__imag__ allowed));
384 update_stats (ok, xfail);
388 /* Test whether a given exception was raised. */
390 test_single_exception (const char *test_name,
394 const char *flag_name)
398 if (exception & exc_flag)
400 if (fetestexcept (fe_flag))
402 if (print_screen (1, 0))
403 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
408 if (print_screen (0, 0))
409 printf ("Failure: %s: Exception \"%s\" not set\n",
410 test_name, flag_name);
415 if (fetestexcept (fe_flag))
418 if (print_screen (0, 0))
419 printf ("Failure: %s: Exception \"%s\" set\n",
420 test_name, flag_name);
424 if (print_screen (1, 0))
425 printf ("%s: Exception \"%s\" not set\n", test_name,
436 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
437 allowed but not required exceptions.
440 test_exceptions (const char *test_name, int exception)
444 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
445 test_single_exception (test_name, exception,
446 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
450 if ((exception & INVALID_EXCEPTION_OK) == 0)
451 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
452 "Invalid operation");
454 feclearexcept (FE_ALL_EXCEPT);
459 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
460 FLOAT max_ulp, int xfail, int exceptions,
461 FLOAT *curr_max_error)
468 test_exceptions (test_name, exceptions);
469 if (isnan (computed) && isnan (expected))
471 else if (isinf (computed) && isinf (expected))
473 /* Test for sign of infinities. */
474 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
475 && signbit (computed) != signbit (expected))
478 printf ("infinity has wrong sign.\n");
483 /* Don't calc ulp for NaNs or infinities. */
484 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
488 diff = FUNC(fabs) (computed - expected);
489 /* ilogb (0) isn't allowed. */
491 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
493 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
494 set_max_error (ulp, curr_max_error);
496 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
497 && computed == 0.0 && expected == 0.0
498 && signbit(computed) != signbit (expected))
500 else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
505 print_ulps (test_name, ulp);
509 if (print_screen (ok, xfail))
512 printf ("Failure: ");
513 printf ("Test: %s\n", test_name);
514 printf ("Result:\n");
515 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
517 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
521 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
523 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
524 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
527 update_stats (ok, xfail);
529 fpstack_test (test_name);
534 check_float (const char *test_name, FLOAT computed, FLOAT expected,
535 FLOAT max_ulp, int xfail, int exceptions)
537 check_float_internal (test_name, computed, expected, max_ulp, xfail,
538 exceptions, &max_error);
543 check_complex (const char *test_name, __complex__ FLOAT computed,
544 __complex__ FLOAT expected,
545 __complex__ FLOAT max_ulp, __complex__ int xfail,
548 FLOAT part_comp, part_exp, part_max_ulp;
552 sprintf (str, "Real part of: %s", test_name);
553 part_comp = __real__ computed;
554 part_exp = __real__ expected;
555 part_max_ulp = __real__ max_ulp;
556 part_xfail = __real__ xfail;
558 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
559 exception, &real_max_error);
561 sprintf (str, "Imaginary part of: %s", test_name);
562 part_comp = __imag__ computed;
563 part_exp = __imag__ expected;
564 part_max_ulp = __imag__ max_ulp;
565 part_xfail = __imag__ xfail;
567 /* Don't check again for exceptions, just pass through the
568 zero/inf sign test. */
569 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
570 exception & IGNORE_ZERO_INF_SIGN,
575 /* Check that computed and expected values are equal (int values). */
577 check_int (const char *test_name, int computed, int expected, int max_ulp,
578 int xfail, int exceptions)
580 int diff = computed - expected;
583 test_exceptions (test_name, exceptions);
585 if (abs (diff) <= max_ulp)
589 print_ulps (test_name, diff);
591 if (print_screen (ok, xfail))
594 printf ("Failure: ");
595 printf ("Test: %s\n", test_name);
596 printf ("Result:\n");
597 printf (" is: %d\n", computed);
598 printf (" should be: %d\n", expected);
601 update_stats (ok, xfail);
602 fpstack_test (test_name);
606 /* Check that computed and expected values are equal (long int values). */
608 check_long (const char *test_name, long int computed, long int expected,
609 long int max_ulp, int xfail, int exceptions)
611 long int diff = computed - expected;
614 test_exceptions (test_name, exceptions);
616 if (labs (diff) <= max_ulp)
620 print_ulps (test_name, diff);
622 if (print_screen (ok, xfail))
625 printf ("Failure: ");
626 printf ("Test: %s\n", test_name);
627 printf ("Result:\n");
628 printf (" is: %ld\n", computed);
629 printf (" should be: %ld\n", expected);
632 update_stats (ok, xfail);
633 fpstack_test (test_name);
637 /* Check that computed value is true/false. */
639 check_bool (const char *test_name, int computed, int expected,
640 long int max_ulp, int xfail, int exceptions)
644 test_exceptions (test_name, exceptions);
646 if ((computed == 0) == (expected == 0))
649 if (print_screen (ok, xfail))
652 printf ("Failure: ");
653 printf ("Test: %s\n", test_name);
654 printf ("Result:\n");
655 printf (" is: %d\n", computed);
656 printf (" should be: %d\n", expected);
659 update_stats (ok, xfail);
660 fpstack_test (test_name);
664 /* check that computed and expected values are equal (long int values) */
666 check_longlong (const char *test_name, long long int computed,
667 long long int expected,
668 long long int max_ulp, int xfail,
671 long long int diff = computed - expected;
674 test_exceptions (test_name, exceptions);
676 if (llabs (diff) <= max_ulp)
680 print_ulps (test_name, diff);
682 if (print_screen (ok, xfail))
686 printf ("Test: %s\n", test_name);
687 printf ("Result:\n");
688 printf (" is: %lld\n", computed);
689 printf (" should be: %lld\n", expected);
692 update_stats (ok, xfail);
693 fpstack_test (test_name);
698 /* This is to prevent messages from the SVID libm emulation. */
700 matherr (struct exception *x __attribute__ ((unused)))
706 /****************************************************************************
707 Tests for single functions of libm.
708 Please keep them alphabetically sorted!
709 ****************************************************************************/
717 /* Function not implemented. */
722 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
723 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
724 TEST_f_f (acos, nan_value, nan_value);
727 TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
728 TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
730 TEST_f_f (acos, 0, M_PI_2l);
731 TEST_f_f (acos, minus_zero, M_PI_2l);
732 TEST_f_f (acos, 1, 0);
733 TEST_f_f (acos, -1, M_PIl);
734 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
735 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
736 TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
737 TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
738 TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
748 /* Function not implemented. */
753 TEST_f_f (acosh, plus_infty, plus_infty);
754 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
757 TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
759 TEST_f_f (acosh, 1, 0);
760 TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
771 /* Function not implemented. */
776 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
777 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
778 TEST_f_f (asin, nan_value, nan_value);
780 /* asin x == NaN plus invalid exception for |x| > 1. */
781 TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
782 TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
784 TEST_f_f (asin, 0, 0);
785 TEST_f_f (asin, minus_zero, minus_zero);
786 TEST_f_f (asin, 0.5, M_PI_6l);
787 TEST_f_f (asin, -0.5, -M_PI_6l);
788 TEST_f_f (asin, 1.0, M_PI_2l);
789 TEST_f_f (asin, -1.0, -M_PI_2l);
790 TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
801 /* Function not implemented. */
806 TEST_f_f (asinh, 0, 0);
807 TEST_f_f (asinh, minus_zero, minus_zero);
809 TEST_f_f (asinh, plus_infty, plus_infty);
810 TEST_f_f (asinh, minus_infty, minus_infty);
812 TEST_f_f (asinh, nan_value, nan_value);
813 TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
824 /* Function not implemented. */
829 TEST_f_f (atan, 0, 0);
830 TEST_f_f (atan, minus_zero, minus_zero);
832 TEST_f_f (atan, plus_infty, M_PI_2l);
833 TEST_f_f (atan, minus_infty, -M_PI_2l);
834 TEST_f_f (atan, nan_value, nan_value);
836 TEST_f_f (atan, 1, M_PI_4l);
837 TEST_f_f (atan, -1, -M_PI_4l);
839 TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
852 /* Function not implemented. */
858 TEST_f_f (atanh, 0, 0);
859 TEST_f_f (atanh, minus_zero, minus_zero);
861 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
862 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
863 TEST_f_f (atanh, nan_value, nan_value);
865 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
866 TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
867 TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
869 TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
880 /* Function not implemented. */
885 /* atan2 (0,x) == 0 for x > 0. */
886 TEST_ff_f (atan2, 0, 1, 0);
888 /* atan2 (-0,x) == -0 for x > 0. */
889 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
891 TEST_ff_f (atan2, 0, 0, 0);
892 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
894 /* atan2 (+0,x) == +pi for x < 0. */
895 TEST_ff_f (atan2, 0, -1, M_PIl);
897 /* atan2 (-0,x) == -pi for x < 0. */
898 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
900 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
901 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
903 /* atan2 (y,+0) == pi/2 for y > 0. */
904 TEST_ff_f (atan2, 1, 0, M_PI_2l);
906 /* atan2 (y,-0) == pi/2 for y > 0. */
907 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
909 /* atan2 (y,+0) == -pi/2 for y < 0. */
910 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
912 /* atan2 (y,-0) == -pi/2 for y < 0. */
913 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
915 /* atan2 (y,inf) == +0 for finite y > 0. */
916 TEST_ff_f (atan2, 1, plus_infty, 0);
918 /* atan2 (y,inf) == -0 for finite y < 0. */
919 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
921 /* atan2(+inf, x) == pi/2 for finite x. */
922 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
924 /* atan2(-inf, x) == -pi/2 for finite x. */
925 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
927 /* atan2 (y,-inf) == +pi for finite y > 0. */
928 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
930 /* atan2 (y,-inf) == -pi for finite y < 0. */
931 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
933 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
934 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
935 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
936 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
937 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
939 TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
940 TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
941 TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
942 TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
943 TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
944 TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
953 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
955 /* Function not implemented. */
960 /* cabs (x + iy) is specified as hypot (x,y) */
962 /* cabs (+inf + i x) == +inf. */
963 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
964 /* cabs (-inf + i x) == +inf. */
965 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
967 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
968 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
970 TEST_c_f (cabs, nan_value, nan_value, nan_value);
972 /* cabs (x,y) == cabs (y,x). */
973 TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
974 /* cabs (x,y) == cabs (-x,y). */
975 TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
976 /* cabs (x,y) == cabs (-y,x). */
977 TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
978 /* cabs (x,y) == cabs (-x,-y). */
979 TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
980 /* cabs (x,y) == cabs (-y,-x). */
981 TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
982 /* cabs (x,0) == fabs (x). */
983 TEST_c_f (cabs, -0.75L, 0, 0.75L);
984 TEST_c_f (cabs, 0.75L, 0, 0.75L);
985 TEST_c_f (cabs, -1.0L, 0, 1.0L);
986 TEST_c_f (cabs, 1.0L, 0, 1.0L);
987 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
988 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
990 TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
1000 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1001 if (errno == ENOSYS)
1002 /* Function not implemented. */
1008 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
1009 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
1010 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
1011 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1013 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1014 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1016 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1017 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1019 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1020 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1021 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1022 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1023 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1024 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1026 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1027 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1028 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1029 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1031 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1032 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1033 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1034 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1036 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1037 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1039 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1040 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1042 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1043 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1045 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1046 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1048 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1049 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1051 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1053 TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
1054 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1056 END (cacos, complex);
1063 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1064 if (errno == ENOSYS)
1065 /* Function not implemented. */
1071 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1072 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1073 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1074 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1075 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1076 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1078 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1079 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1081 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1082 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1083 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1084 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1085 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1086 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1088 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1089 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1090 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1091 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1093 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1094 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1095 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1096 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1098 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1099 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1101 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1102 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1104 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1105 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1107 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1108 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1110 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1111 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1113 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1115 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
1116 TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
1118 END (cacosh, complex);
1127 /* carg (x + iy) is specified as atan2 (y, x) */
1129 /* carg (x + i 0) == 0 for x > 0. */
1130 TEST_c_f (carg, 2.0, 0, 0);
1131 /* carg (x - i 0) == -0 for x > 0. */
1132 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1134 TEST_c_f (carg, 0, 0, 0);
1135 TEST_c_f (carg, 0, minus_zero, minus_zero);
1137 /* carg (x + i 0) == +pi for x < 0. */
1138 TEST_c_f (carg, -2.0, 0, M_PIl);
1140 /* carg (x - i 0) == -pi for x < 0. */
1141 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1143 TEST_c_f (carg, minus_zero, 0, M_PIl);
1144 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1146 /* carg (+0 + i y) == pi/2 for y > 0. */
1147 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1149 /* carg (-0 + i y) == pi/2 for y > 0. */
1150 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1152 /* carg (+0 + i y) == -pi/2 for y < 0. */
1153 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1155 /* carg (-0 + i y) == -pi/2 for y < 0. */
1156 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1158 /* carg (inf + i y) == +0 for finite y > 0. */
1159 TEST_c_f (carg, plus_infty, 2.0, 0);
1161 /* carg (inf + i y) == -0 for finite y < 0. */
1162 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1164 /* carg(x + i inf) == pi/2 for finite x. */
1165 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1167 /* carg(x - i inf) == -pi/2 for finite x. */
1168 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1170 /* carg (-inf + i y) == +pi for finite y > 0. */
1171 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1173 /* carg (-inf + i y) == -pi for finite y < 0. */
1174 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1176 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1178 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1180 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1182 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1184 TEST_c_f (carg, nan_value, nan_value, nan_value);
1193 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1194 if (errno == ENOSYS)
1195 /* Function not implemented. */
1200 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1201 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1202 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1203 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1205 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1206 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1207 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1208 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1210 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1211 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1212 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1213 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1214 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1215 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1216 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1217 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1219 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1220 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1221 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1222 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1224 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1225 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1226 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1227 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1229 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1230 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1232 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1233 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1235 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1236 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1238 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1239 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1241 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1242 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1244 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1246 TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
1247 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1249 END (casin, complex);
1257 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1258 if (errno == ENOSYS)
1259 /* Function not implemented. */
1264 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1265 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1266 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1267 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1269 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1270 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1271 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1272 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1274 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1275 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1276 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1277 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1278 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1279 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1280 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1281 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1283 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1284 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1285 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1286 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1288 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1289 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1290 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1291 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1293 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1294 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1296 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1297 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1299 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1300 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1302 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1303 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1305 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1306 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1308 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1310 TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
1311 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1313 END (casinh, complex);
1321 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1322 if (errno == ENOSYS)
1323 /* Function not implemented. */
1328 TEST_c_c (catan, 0, 0, 0, 0);
1329 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1330 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1331 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1333 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1334 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1335 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1336 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1339 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1340 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1341 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1342 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1343 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1344 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1345 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1346 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1348 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1349 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1350 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1351 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1353 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1354 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1355 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1356 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1358 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1359 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1361 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1362 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1364 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1365 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1367 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1368 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1370 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1371 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1373 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1374 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1376 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1378 TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
1379 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1381 END (catan, complex);
1388 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1389 if (errno == ENOSYS)
1390 /* Function not implemented. */
1395 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1396 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1397 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1398 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1400 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1401 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1402 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1403 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1405 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1406 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1407 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1408 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1409 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1410 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1411 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1412 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1414 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1415 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1416 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1417 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1419 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1420 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1421 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1422 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1424 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1425 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1427 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1428 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1430 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1431 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1433 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1434 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1436 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1437 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1439 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1440 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1442 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1444 TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
1445 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1447 END (catanh, complex);
1455 if (errno == ENOSYS)
1456 /* Function not implemented. */
1461 TEST_f_f (cbrt, 0.0, 0.0);
1462 TEST_f_f (cbrt, minus_zero, minus_zero);
1464 TEST_f_f (cbrt, plus_infty, plus_infty);
1465 TEST_f_f (cbrt, minus_infty, minus_infty);
1466 TEST_f_f (cbrt, nan_value, nan_value);
1468 TEST_f_f (cbrt, -0.001L, -0.1L);
1469 TEST_f_f (cbrt, 8, 2);
1470 TEST_f_f (cbrt, -27.0, -3.0);
1471 TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
1472 TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
1482 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1483 if (errno == ENOSYS)
1484 /* Function not implemented. */
1489 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1490 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1491 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1492 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1494 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1495 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1496 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1497 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1499 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1500 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1501 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1502 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1504 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1505 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1506 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1507 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1509 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1510 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1511 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1512 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1514 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1515 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1516 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1517 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1519 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1520 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1522 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1523 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1525 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1526 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1528 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1529 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1531 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1532 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1534 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1535 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1537 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1539 TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
1540 TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
1542 END (ccos, complex);
1550 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1551 if (errno == ENOSYS)
1552 /* Function not implemented. */
1557 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1558 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1559 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1560 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1562 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1563 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1564 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1565 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1567 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1568 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1569 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1570 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1572 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1573 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1574 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1575 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1577 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1578 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1579 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1580 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1582 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1583 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1584 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1585 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1587 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1588 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1590 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1591 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1593 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1594 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1596 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1597 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1599 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1600 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1602 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1603 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1605 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1607 TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
1609 TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
1611 END (ccosh, complex);
1620 TEST_f_f (ceil, 0.0, 0.0);
1621 TEST_f_f (ceil, minus_zero, minus_zero);
1622 TEST_f_f (ceil, plus_infty, plus_infty);
1623 TEST_f_f (ceil, minus_infty, minus_infty);
1624 TEST_f_f (ceil, nan_value, nan_value);
1626 TEST_f_f (ceil, M_PIl, 4.0);
1627 TEST_f_f (ceil, -M_PIl, -3.0);
1637 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1638 if (errno == ENOSYS)
1639 /* Function not implemented. */
1644 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1645 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1646 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1647 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1649 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1650 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1652 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1653 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1655 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1656 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1658 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1659 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1661 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1662 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1664 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1665 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1667 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1668 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1669 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1670 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1672 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1673 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1675 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1676 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1678 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1680 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1682 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1683 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1685 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1686 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1687 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1688 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1690 TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
1691 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1693 END (cexp, complex);
1701 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1702 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1703 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1704 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1705 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1706 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1707 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1716 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1717 if (errno == ENOSYS)
1718 /* Function not implemented. */
1723 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1724 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1726 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1727 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1729 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1730 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1732 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1733 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1735 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1736 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1737 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1738 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1739 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1740 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1741 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1742 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1744 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1745 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1746 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1747 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1749 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1750 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1751 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1752 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1754 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1755 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1757 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1758 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1760 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1761 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1762 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1763 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1765 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1766 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1767 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1768 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1770 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1772 TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
1773 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1775 END (clog, complex);
1783 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1784 if (errno == ENOSYS)
1785 /* Function not implemented. */
1790 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1791 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1793 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1794 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1796 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1798 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1799 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1801 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1802 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1803 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1804 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1805 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1806 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1807 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1808 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1810 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1811 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1812 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1813 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1815 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1816 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1817 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1818 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1820 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1821 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1823 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1824 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1826 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1827 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1828 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1829 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1831 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1832 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1833 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1834 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1836 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1838 TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
1839 TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
1841 END (clog10, complex);
1849 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1850 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1851 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1852 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1853 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1854 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1855 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1857 END (conj, complex);
1862 copysign_test (void)
1866 TEST_ff_f (copysign, 0, 4, 0);
1867 TEST_ff_f (copysign, 0, -4, minus_zero);
1868 TEST_ff_f (copysign, minus_zero, 4, 0);
1869 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1871 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1872 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1873 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1874 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1876 TEST_ff_f (copysign, 0, plus_infty, 0);
1877 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1878 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1879 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1881 /* XXX More correctly we would have to check the sign of the NaN. */
1882 TEST_ff_f (copysign, nan_value, 0, nan_value);
1883 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1884 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1885 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1896 if (errno == ENOSYS)
1897 /* Function not implemented. */
1902 TEST_f_f (cos, 0, 1);
1903 TEST_f_f (cos, minus_zero, 1);
1904 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1905 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1906 TEST_f_f (cos, nan_value, nan_value);
1908 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1909 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1910 TEST_f_f (cos, M_PI_2l, 0);
1912 TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
1915 TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
1927 if (errno == ENOSYS)
1928 /* Function not implemented. */
1932 TEST_f_f (cosh, 0, 1);
1933 TEST_f_f (cosh, minus_zero, 1);
1936 TEST_f_f (cosh, plus_infty, plus_infty);
1937 TEST_f_f (cosh, minus_infty, plus_infty);
1939 TEST_f_f (cosh, nan_value, nan_value);
1941 TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
1951 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
1952 if (errno == ENOSYS)
1953 /* Function not implemented. */
1958 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
1959 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
1961 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
1962 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
1964 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
1966 TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
1967 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
1968 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
1969 TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
1971 END (cpow, complex);
1979 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
1980 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
1981 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
1982 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
1984 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
1986 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
1987 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
1988 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
1989 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
1991 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
1992 TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
1994 END (cproj, complex);
2002 TEST_c_f (creal, 0.0, 1.0, 0.0);
2003 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
2004 TEST_c_f (creal, nan_value, 1.0, nan_value);
2005 TEST_c_f (creal, nan_value, nan_value, nan_value);
2006 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
2007 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
2008 TEST_c_f (creal, 2.0, 3.0, 2.0);
2017 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2018 if (errno == ENOSYS)
2019 /* Function not implemented. */
2024 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
2025 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
2026 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
2027 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2029 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2030 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2031 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2032 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2034 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2035 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2036 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2037 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2039 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2040 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2041 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2042 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2044 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2045 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2046 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2047 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2049 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2050 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2051 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2052 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2054 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2055 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2057 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2058 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2060 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2061 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2063 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2064 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2066 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2067 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2069 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2070 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2072 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2074 TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
2075 TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
2077 END (csin, complex);
2085 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2086 if (errno == ENOSYS)
2087 /* Function not implemented. */
2092 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2093 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2094 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2095 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2097 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2098 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2099 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2100 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2102 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2103 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2104 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2105 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2107 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2108 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2109 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2110 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2112 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2113 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2114 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2115 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2117 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2118 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2119 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2120 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2122 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2123 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2125 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2126 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2128 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2129 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2131 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2132 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2134 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2135 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2137 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2138 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2140 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2142 TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
2143 TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
2145 END (csinh, complex);
2153 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2154 if (errno == ENOSYS)
2155 /* Function not implemented. */
2160 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2161 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2162 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2163 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2165 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2166 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2167 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2168 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2170 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2171 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2172 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2173 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2175 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2176 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2177 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2178 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2179 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2180 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2181 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2182 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2183 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2184 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2185 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2186 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2188 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2190 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2192 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2193 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2194 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2195 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2197 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2198 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2199 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2200 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2202 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2204 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2205 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2206 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2207 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2208 TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
2209 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2210 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2212 END (csqrt, complex);
2219 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2220 if (errno == ENOSYS)
2221 /* Function not implemented. */
2226 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2227 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2228 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2229 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2231 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2232 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2233 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2234 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2236 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2237 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2238 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2239 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2241 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2242 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2243 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2244 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2245 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2246 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2247 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2248 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2250 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2251 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2253 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2254 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2256 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2257 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2259 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2260 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2261 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2262 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2264 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2266 TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
2267 TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
2269 END (ctan, complex);
2277 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2278 if (errno == ENOSYS)
2279 /* Function not implemented. */
2284 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2285 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2286 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2287 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2289 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2290 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2291 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2292 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2293 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2294 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2295 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2296 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2298 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2299 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2300 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2301 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2302 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2303 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2304 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2305 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2307 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2308 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2310 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2311 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2313 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2314 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2316 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2317 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2318 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2319 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2321 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2323 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2325 TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
2326 TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
2328 END (ctanh, complex);
2337 if (errno == ENOSYS)
2338 /* Function not implemented. */
2343 TEST_f_f (erf, 0, 0);
2344 TEST_f_f (erf, minus_zero, minus_zero);
2345 TEST_f_f (erf, plus_infty, 1);
2346 TEST_f_f (erf, minus_infty, -1);
2347 TEST_f_f (erf, nan_value, nan_value);
2349 TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
2350 TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
2351 TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
2352 TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
2353 TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
2354 TEST_f_f (erf, 27.0L, 1.0L);
2365 if (errno == ENOSYS)
2366 /* Function not implemented. */
2371 TEST_f_f (erfc, plus_infty, 0.0);
2372 TEST_f_f (erfc, minus_infty, 2.0);
2373 TEST_f_f (erfc, 0.0, 1.0);
2374 TEST_f_f (erfc, minus_zero, 1.0);
2375 TEST_f_f (erfc, nan_value, nan_value);
2377 TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
2378 TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
2379 TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
2380 TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
2381 TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
2383 /* The result can only be represented in long double. */
2384 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
2396 if (errno == ENOSYS)
2397 /* Function not implemented. */
2402 TEST_f_f (exp, 0, 1);
2403 TEST_f_f (exp, minus_zero, 1);
2406 TEST_f_f (exp, plus_infty, plus_infty);
2407 TEST_f_f (exp, minus_infty, 0);
2409 TEST_f_f (exp, nan_value, nan_value);
2410 TEST_f_f (exp, 1, M_El);
2412 TEST_f_f (exp, 2, M_E2l);
2413 TEST_f_f (exp, 3, M_E3l);
2414 TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
2415 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
2417 /* The result can only be represented in long double. */
2418 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
2430 if (errno == ENOSYS)
2431 /* Function not implemented. */
2436 TEST_f_f (exp10, 0, 1);
2437 TEST_f_f (exp10, minus_zero, 1);
2439 TEST_f_f (exp10, plus_infty, plus_infty);
2440 TEST_f_f (exp10, minus_infty, 0);
2441 TEST_f_f (exp10, nan_value, nan_value);
2442 TEST_f_f (exp10, 3, 1000);
2443 TEST_f_f (exp10, -1, 0.1L);
2444 TEST_f_f (exp10, 1e6, plus_infty);
2445 TEST_f_f (exp10, -1e6, 0);
2446 TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
2457 if (errno == ENOSYS)
2458 /* Function not implemented. */
2463 TEST_f_f (exp2, 0, 1);
2464 TEST_f_f (exp2, minus_zero, 1);
2465 TEST_f_f (exp2, plus_infty, plus_infty);
2466 TEST_f_f (exp2, minus_infty, 0);
2467 TEST_f_f (exp2, nan_value, nan_value);
2469 TEST_f_f (exp2, 10, 1024);
2470 TEST_f_f (exp2, -1, 0.5);
2471 TEST_f_f (exp2, 1e6, plus_infty);
2472 TEST_f_f (exp2, -1e6, 0);
2473 TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
2484 if (errno == ENOSYS)
2485 /* Function not implemented. */
2490 TEST_f_f (expm1, 0, 0);
2491 TEST_f_f (expm1, minus_zero, minus_zero);
2494 TEST_f_f (expm1, plus_infty, plus_infty);
2495 TEST_f_f (expm1, minus_infty, -1);
2497 TEST_f_f (expm1, nan_value, nan_value);
2499 TEST_f_f (expm1, 1, M_El - 1.0);
2500 TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
2511 TEST_f_f (fabs, 0, 0);
2512 TEST_f_f (fabs, minus_zero, 0);
2514 TEST_f_f (fabs, plus_infty, plus_infty);
2515 TEST_f_f (fabs, minus_infty, plus_infty);
2516 TEST_f_f (fabs, nan_value, nan_value);
2518 TEST_f_f (fabs, 38.0, 38.0);
2519 TEST_f_f (fabs, -M_El, M_El);
2530 TEST_ff_f (fdim, 0, 0, 0);
2531 TEST_ff_f (fdim, 9, 0, 9);
2532 TEST_ff_f (fdim, 0, 9, 0);
2533 TEST_ff_f (fdim, -9, 0, 0);
2534 TEST_ff_f (fdim, 0, -9, 9);
2536 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2537 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2538 TEST_ff_f (fdim, minus_infty, 9, 0);
2539 TEST_ff_f (fdim, minus_infty, -9, 0);
2540 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2541 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2542 TEST_ff_f (fdim, 9, plus_infty, 0);
2543 TEST_ff_f (fdim, -9, plus_infty, 0);
2545 TEST_ff_f (fdim, 0, nan_value, nan_value);
2546 TEST_ff_f (fdim, 9, nan_value, nan_value);
2547 TEST_ff_f (fdim, -9, nan_value, nan_value);
2548 TEST_ff_f (fdim, nan_value, 9, nan_value);
2549 TEST_ff_f (fdim, nan_value, -9, nan_value);
2550 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2551 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2552 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2553 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2554 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2565 TEST_f_f (floor, 0.0, 0.0);
2566 TEST_f_f (floor, minus_zero, minus_zero);
2567 TEST_f_f (floor, plus_infty, plus_infty);
2568 TEST_f_f (floor, minus_infty, minus_infty);
2569 TEST_f_f (floor, nan_value, nan_value);
2571 TEST_f_f (floor, M_PIl, 3.0);
2572 TEST_f_f (floor, -M_PIl, -4.0);
2583 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2584 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2585 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2586 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2587 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2588 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2589 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2590 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2591 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2592 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2593 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2594 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2596 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2597 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2598 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2599 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2601 TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
2612 TEST_ff_f (fmax, 0, 0, 0);
2613 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2614 TEST_ff_f (fmax, 9, 0, 9);
2615 TEST_ff_f (fmax, 0, 9, 9);
2616 TEST_ff_f (fmax, -9, 0, 0);
2617 TEST_ff_f (fmax, 0, -9, 0);
2619 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2620 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2621 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2622 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2624 TEST_ff_f (fmax, minus_infty, 9, 9);
2625 TEST_ff_f (fmax, minus_infty, -9, -9);
2626 TEST_ff_f (fmax, 9, minus_infty, 9);
2627 TEST_ff_f (fmax, -9, minus_infty, -9);
2629 TEST_ff_f (fmax, 0, nan_value, 0);
2630 TEST_ff_f (fmax, 9, nan_value, 9);
2631 TEST_ff_f (fmax, -9, nan_value, -9);
2632 TEST_ff_f (fmax, nan_value, 0, 0);
2633 TEST_ff_f (fmax, nan_value, 9, 9);
2634 TEST_ff_f (fmax, nan_value, -9, -9);
2635 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2636 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2637 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2638 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2639 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2650 TEST_ff_f (fmin, 0, 0, 0);
2651 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2652 TEST_ff_f (fmin, 9, 0, 0);
2653 TEST_ff_f (fmin, 0, 9, 0);
2654 TEST_ff_f (fmin, -9, 0, -9);
2655 TEST_ff_f (fmin, 0, -9, -9);
2657 TEST_ff_f (fmin, plus_infty, 9, 9);
2658 TEST_ff_f (fmin, 9, plus_infty, 9);
2659 TEST_ff_f (fmin, plus_infty, -9, -9);
2660 TEST_ff_f (fmin, -9, plus_infty, -9);
2661 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2662 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2663 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2664 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2666 TEST_ff_f (fmin, 0, nan_value, 0);
2667 TEST_ff_f (fmin, 9, nan_value, 9);
2668 TEST_ff_f (fmin, -9, nan_value, -9);
2669 TEST_ff_f (fmin, nan_value, 0, 0);
2670 TEST_ff_f (fmin, nan_value, 9, 9);
2671 TEST_ff_f (fmin, nan_value, -9, -9);
2672 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2673 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2674 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2675 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2676 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2686 FUNC(fmod) (6.5, 2.3L);
2687 if (errno == ENOSYS)
2688 /* Function not implemented. */
2693 /* fmod (+0, y) == +0 for y != 0. */
2694 TEST_ff_f (fmod, 0, 3, 0);
2696 /* fmod (-0, y) == -0 for y != 0. */
2697 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2699 /* fmod (+inf, y) == NaN plus invalid exception. */
2700 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2701 /* fmod (-inf, y) == NaN plus invalid exception. */
2702 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2703 /* fmod (x, +0) == NaN plus invalid exception. */
2704 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2705 /* fmod (x, -0) == NaN plus invalid exception. */
2706 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2708 /* fmod (x, +inf) == x for x not infinite. */
2709 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2710 /* fmod (x, -inf) == x for x not infinite. */
2711 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2713 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2715 TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
2716 TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
2717 TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
2718 TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
2725 fpclassify_test (void)
2729 TEST_f_i (fpclassify, nan_value, FP_NAN);
2730 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2731 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2732 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2733 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2734 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2747 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2748 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2749 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2751 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2752 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2754 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
2755 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
2767 if (errno == ENOSYS)
2768 /* Function not implemented. */
2770 feclearexcept (FE_ALL_EXCEPT);
2774 TEST_f_f (gamma, plus_infty, plus_infty);
2775 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2776 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2777 TEST_f_f (gamma, minus_infty, plus_infty);
2778 TEST_f_f (gamma, nan_value, nan_value);
2780 TEST_f_f1 (gamma, 1, 0, 1);
2781 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2783 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2784 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2793 FUNC(hypot) (0.7L, 12.4L);
2794 if (errno == ENOSYS)
2795 /* Function not implemented. */
2800 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2801 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2804 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2805 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2806 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2807 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2810 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2812 /* hypot (x,y) == hypot (+-x, +-y) */
2813 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
2814 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
2815 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
2816 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
2817 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
2818 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
2819 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
2820 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
2822 /* hypot (x,0) == fabs (x) */
2823 TEST_ff_f (hypot, 0.75L, 0, 0.75L);
2824 TEST_ff_f (hypot, -0.75L, 0, 0.75L);
2825 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
2827 TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
2838 TEST_f_i (ilogb, 1, 0);
2839 TEST_f_i (ilogb, M_El, 1);
2840 TEST_f_i (ilogb, 1024, 10);
2841 TEST_f_i (ilogb, -2000, 10);
2843 /* XXX We have a problem here: the standard does not tell us whether
2844 exceptions are allowed/required. ignore them for now. */
2846 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
2847 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
2848 TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
2849 TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
2855 isfinite_test (void)
2859 TEST_f_b (isfinite, 0, 1);
2860 TEST_f_b (isfinite, minus_zero, 1);
2861 TEST_f_b (isfinite, 10, 1);
2862 TEST_f_b (isfinite, plus_infty, 0);
2863 TEST_f_b (isfinite, minus_infty, 0);
2864 TEST_f_b (isfinite, nan_value, 0);
2870 isnormal_test (void)
2874 TEST_f_b (isnormal, 0, 0);
2875 TEST_f_b (isnormal, minus_zero, 0);
2876 TEST_f_b (isnormal, 10, 1);
2877 TEST_f_b (isnormal, plus_infty, 0);
2878 TEST_f_b (isnormal, minus_infty, 0);
2879 TEST_f_b (isnormal, nan_value, 0);
2889 FUNC (sincos) (0, &s, &c);
2890 if (errno == ENOSYS)
2891 /* Required function not implemented. */
2894 if (errno == ENOSYS)
2895 /* Function not implemented. */
2900 /* j0 is the Bessel function of the first kind of order 0 */
2901 TEST_f_f (j0, nan_value, nan_value);
2902 TEST_f_f (j0, plus_infty, 0);
2903 TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
2904 TEST_f_f (j0, 0.0, 1.0);
2905 TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
2906 TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
2907 TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
2908 TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
2909 TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
2910 TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
2911 TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
2912 TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
2913 TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
2924 FUNC (sincos) (0, &s, &c);
2925 if (errno == ENOSYS)
2926 /* Required function not implemented. */
2929 if (errno == ENOSYS)
2930 /* Function not implemented. */
2933 /* j1 is the Bessel function of the first kind of order 1 */
2937 TEST_f_f (j1, nan_value, nan_value);
2938 TEST_f_f (j1, plus_infty, 0);
2940 TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
2941 TEST_f_f (j1, 0.0, 0.0);
2942 TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
2943 TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
2944 TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
2945 TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
2946 TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
2947 TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
2948 TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
2958 FUNC (sincos) (0, &s, &c);
2959 if (errno == ENOSYS)
2960 /* Required function not implemented. */
2963 if (errno == ENOSYS)
2964 /* Function not implemented. */
2967 /* jn is the Bessel function of the first kind of order n. */
2970 /* jn (0, x) == j0 (x) */
2971 TEST_ff_f (jn, 0, nan_value, nan_value);
2972 TEST_ff_f (jn, 0, plus_infty, 0);
2973 TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
2974 TEST_ff_f (jn, 0, 0.0, 1.0);
2975 TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
2976 TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
2977 TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
2978 TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
2979 TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
2980 TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
2981 TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
2982 TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
2983 TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
2985 /* jn (1, x) == j1 (x) */
2986 TEST_ff_f (jn, 1, nan_value, nan_value);
2987 TEST_ff_f (jn, 1, plus_infty, 0);
2988 TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
2989 TEST_ff_f (jn, 1, 0.0, 0.0);
2990 TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
2991 TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
2992 TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
2993 TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
2994 TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
2995 TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
2996 TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
2999 TEST_ff_f (jn, 3, nan_value, nan_value);
3000 TEST_ff_f (jn, 3, plus_infty, 0);
3002 TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
3003 TEST_ff_f (jn, 3, 0.0, 0.0);
3004 TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
3005 TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
3006 TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
3007 TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
3008 TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
3011 TEST_ff_f (jn, 10, nan_value, nan_value);
3012 TEST_ff_f (jn, 10, plus_infty, 0);
3014 TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
3015 TEST_ff_f (jn, 10, 0.0, 0.0);
3016 TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
3017 TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
3018 TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
3019 TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
3020 TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
3029 TEST_ff_f (ldexp, 0, 0, 0);
3030 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
3032 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
3033 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
3034 TEST_ff_f (ldexp, nan_value, 1, nan_value);
3036 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
3037 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
3039 /* ldexp (x, 0) == x. */
3040 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
3049 if (errno == ENOSYS)
3050 /* Function not implemented. */
3052 feclearexcept (FE_ALL_EXCEPT);
3056 TEST_f_f (lgamma, plus_infty, plus_infty);
3057 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3058 TEST_f_f (lgamma, nan_value, nan_value);
3060 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3061 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3062 TEST_f_f (lgamma, minus_infty, plus_infty);
3064 TEST_f_f1 (lgamma, 1, 0, 1);
3066 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3068 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3069 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3070 TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
3071 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
3080 /* XXX this test is incomplete. We need to have a way to specifiy
3081 the rounding method and test the critical cases. So far, only
3082 unproblematic numbers are tested. */
3086 TEST_f_l (lrint, 0.0, 0);
3087 TEST_f_l (lrint, minus_zero, 0);
3088 TEST_f_l (lrint, 0.2L, 0);
3089 TEST_f_l (lrint, -0.2L, 0);
3091 TEST_f_l (lrint, 1.4L, 1);
3092 TEST_f_l (lrint, -1.4L, -1);
3094 TEST_f_l (lrint, 8388600.3L, 8388600);
3095 TEST_f_l (lrint, -8388600.3L, -8388600);
3104 /* XXX this test is incomplete. We need to have a way to specifiy
3105 the rounding method and test the critical cases. So far, only
3106 unproblematic numbers are tested. */
3110 TEST_f_L (llrint, 0.0, 0);
3111 TEST_f_L (llrint, minus_zero, 0);
3112 TEST_f_L (llrint, 0.2L, 0);
3113 TEST_f_L (llrint, -0.2L, 0);
3115 TEST_f_L (llrint, 1.4L, 1);
3116 TEST_f_L (llrint, -1.4L, -1);
3118 TEST_f_L (llrint, 8388600.3L, 8388600);
3119 TEST_f_L (llrint, -8388600.3L, -8388600);
3121 /* Test boundary conditions. */
3123 TEST_f_L (llrint, 2097151.0,2097151LL);
3125 TEST_f_L (llrint, 8388608.0, 8388608LL);
3127 TEST_f_L (llrint, 16777216.0, 16777216LL);
3129 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3131 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3132 /* 0x10000000000000 */
3133 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3134 /* 0x10000080000000 */
3135 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3136 /* 0x20000000000000 */
3137 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3138 /* 0x80000000000000 */
3139 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3140 /* 0x100000000000000 */
3141 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3152 if (errno == ENOSYS)
3153 /* Function not implemented. */
3157 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3158 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3160 TEST_f_f (log, 1, 0);
3162 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
3163 TEST_f_f (log, plus_infty, plus_infty);
3165 TEST_f_f (log, M_El, 1);
3166 TEST_f_f (log, 1.0 / M_El, -1);
3167 TEST_f_f (log, 2, M_LN2l);
3168 TEST_f_f (log, 10, M_LN10l);
3169 TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
3180 if (errno == ENOSYS)
3181 /* Function not implemented. */
3186 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3187 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3189 TEST_f_f (log10, 1, 0);
3191 /* log10 (x) == NaN plus invalid exception if x < 0. */
3192 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
3194 TEST_f_f (log10, plus_infty, plus_infty);
3195 TEST_f_f (log10, nan_value, nan_value);
3197 TEST_f_f (log10, 0.1L, -1);
3198 TEST_f_f (log10, 10.0, 1);
3199 TEST_f_f (log10, 100.0, 2);
3200 TEST_f_f (log10, 10000.0, 4);
3201 TEST_f_f (log10, M_El, M_LOG10El);
3202 TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
3213 if (errno == ENOSYS)
3214 /* Function not implemented. */
3219 TEST_f_f (log1p, 0, 0);
3220 TEST_f_f (log1p, minus_zero, minus_zero);
3222 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3223 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
3225 TEST_f_f (log1p, plus_infty, plus_infty);
3226 TEST_f_f (log1p, nan_value, nan_value);
3228 TEST_f_f (log1p, M_El - 1.0, 1);
3230 TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
3231 TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
3242 if (errno == ENOSYS)
3243 /* Function not implemented. */
3248 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3249 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3251 TEST_f_f (log2, 1, 0);
3253 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
3255 TEST_f_f (log2, plus_infty, plus_infty);
3256 TEST_f_f (log2, nan_value, nan_value);
3258 TEST_f_f (log2, M_El, M_LOG2El);
3259 TEST_f_f (log2, 2.0, 1);
3260 TEST_f_f (log2, 16.0, 4);
3261 TEST_f_f (log2, 256.0, 8);
3262 TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
3273 TEST_f_f (logb, plus_infty, plus_infty);
3274 TEST_f_f (logb, minus_infty, plus_infty);
3276 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3278 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3279 TEST_f_f (logb, nan_value, nan_value);
3281 TEST_f_f (logb, 1, 0);
3282 TEST_f_f (logb, M_El, 1);
3283 TEST_f_f (logb, 1024, 10);
3284 TEST_f_f (logb, -2000, 10);
3295 TEST_f_l (lround, 0, 0);
3296 TEST_f_l (lround, minus_zero, 0);
3297 TEST_f_l (lround, 0.2L, 0.0);
3298 TEST_f_l (lround, -0.2L, 0);
3299 TEST_f_l (lround, 0.5, 1);
3300 TEST_f_l (lround, -0.5, -1);
3301 TEST_f_l (lround, 0.8L, 1);
3302 TEST_f_l (lround, -0.8L, -1);
3303 TEST_f_l (lround, 1.5, 2);
3304 TEST_f_l (lround, -1.5, -2);
3305 TEST_f_l (lround, 22514.5, 22515);
3306 TEST_f_l (lround, -22514.5, -22515);
3308 TEST_f_l (lround, 2097152.5, 2097153);
3309 TEST_f_l (lround, -2097152.5, -2097153);
3320 TEST_f_L (llround, 0, 0);
3321 TEST_f_L (llround, minus_zero, 0);
3322 TEST_f_L (llround, 0.2L, 0.0);
3323 TEST_f_L (llround, -0.2L, 0);
3324 TEST_f_L (llround, 0.5, 1);
3325 TEST_f_L (llround, -0.5, -1);
3326 TEST_f_L (llround, 0.8L, 1);
3327 TEST_f_L (llround, -0.8L, -1);
3328 TEST_f_L (llround, 1.5, 2);
3329 TEST_f_L (llround, -1.5, -2);
3330 TEST_f_L (llround, 22514.5, 22515);
3331 TEST_f_L (llround, -22514.5, -22515);
3333 TEST_f_L (llround, 2097152.5, 2097153);
3334 TEST_f_L (llround, -2097152.5, -2097153);
3335 TEST_f_L (llround, 34359738368.5, 34359738369ll);
3336 TEST_f_L (llround, -34359738368.5, -34359738369ll);
3339 /* Test boundary conditions. */
3341 TEST_f_L (llround, 2097151.0, 2097151LL);
3343 TEST_f_L (llround, 8388608.0, 8388608LL);
3345 TEST_f_L (llround, 16777216.0, 16777216LL);
3347 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
3349 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
3350 /* 0x10000000000000 */
3351 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
3352 /* 0x10000080000000 */
3353 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3354 /* 0x20000000000000 */
3355 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
3356 /* 0x80000000000000 */
3357 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
3358 /* 0x100000000000000 */
3359 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
3363 TEST_f_L (llround, 4294967295.5, 4294967296LL);
3365 TEST_f_L (llround, 8589934591.5, 8589934592LL);
3378 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
3379 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
3380 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
3381 TEST_fF_f1 (modf, 0, 0, 0);
3382 TEST_fF_f1 (modf, 1.5, 0.5, 1);
3383 TEST_fF_f1 (modf, 2.5, 0.5, 2);
3384 TEST_fF_f1 (modf, -2.5, -0.5, -2);
3385 TEST_fF_f1 (modf, 20, 0, 20);
3386 TEST_fF_f1 (modf, 21, 0, 21);
3387 TEST_fF_f1 (modf, 89.5, 0.5, 89);
3394 nearbyint_test (void)
3398 TEST_f_f (nearbyint, 0.0, 0.0);
3399 TEST_f_f (nearbyint, minus_zero, minus_zero);
3400 TEST_f_f (nearbyint, plus_infty, plus_infty);
3401 TEST_f_f (nearbyint, minus_infty, minus_infty);
3402 TEST_f_f (nearbyint, nan_value, nan_value);
3404 /* Default rounding mode is round to nearest. */
3405 TEST_f_f (nearbyint, 0.5, 0.0);
3406 TEST_f_f (nearbyint, 1.5, 2.0);
3407 TEST_f_f (nearbyint, -0.5, minus_zero);
3408 TEST_f_f (nearbyint, -1.5, -2.0);
3414 nextafter_test (void)
3419 TEST_ff_f (nextafter, 0, 0, 0);
3420 TEST_ff_f (nextafter, minus_zero, 0, 0);
3421 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
3422 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
3424 TEST_ff_f (nextafter, 9, 9, 9);
3425 TEST_ff_f (nextafter, -9, -9, -9);
3426 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
3427 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
3429 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
3430 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
3431 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
3434 // XXX Enable once gcc is fixed.
3435 //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
3438 /* XXX We need the hexadecimal FP number representation here for further
3446 nexttoward_test (void)
3449 TEST_ff_f (nexttoward, 0, 0, 0);
3450 TEST_ff_f (nexttoward, minus_zero, 0, 0);
3451 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
3452 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
3454 TEST_ff_f (nexttoward, 9, 9, 9);
3455 TEST_ff_f (nexttoward, -9, -9, -9);
3456 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
3457 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
3459 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
3460 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
3461 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
3463 /* XXX We need the hexadecimal FP number representation here for further
3476 if (errno == ENOSYS)
3477 /* Function not implemented. */
3482 TEST_ff_f (pow, 0, 0, 1);
3483 TEST_ff_f (pow, 0, minus_zero, 1);
3484 TEST_ff_f (pow, minus_zero, 0, 1);
3485 TEST_ff_f (pow, minus_zero, minus_zero, 1);
3487 TEST_ff_f (pow, 10, 0, 1);
3488 TEST_ff_f (pow, 10, minus_zero, 1);
3489 TEST_ff_f (pow, -10, 0, 1);
3490 TEST_ff_f (pow, -10, minus_zero, 1);
3492 TEST_ff_f (pow, nan_value, 0, 1);
3493 TEST_ff_f (pow, nan_value, minus_zero, 1);
3497 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
3498 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
3499 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
3500 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
3502 TEST_ff_f (pow, 0.9L, plus_infty, 0);
3503 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
3504 TEST_ff_f (pow, -0.9L, plus_infty, 0);
3505 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
3507 TEST_ff_f (pow, 1.1L, minus_infty, 0);
3508 TEST_ff_f (pow, plus_infty, minus_infty, 0);
3509 TEST_ff_f (pow, -1.1L, minus_infty, 0);
3510 TEST_ff_f (pow, minus_infty, minus_infty, 0);
3512 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
3513 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
3514 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
3515 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
3517 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
3518 TEST_ff_f (pow, plus_infty, 1, plus_infty);
3519 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
3521 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
3522 TEST_ff_f (pow, plus_infty, -1, 0);
3523 TEST_ff_f (pow, plus_infty, -1e7L, 0);
3525 TEST_ff_f (pow, minus_infty, 1, minus_infty);
3526 TEST_ff_f (pow, minus_infty, 11, minus_infty);
3527 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
3529 TEST_ff_f (pow, minus_infty, 2, plus_infty);
3530 TEST_ff_f (pow, minus_infty, 12, plus_infty);
3531 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
3532 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
3533 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
3534 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
3535 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
3537 TEST_ff_f (pow, minus_infty, -1, minus_zero);
3538 TEST_ff_f (pow, minus_infty, -11, minus_zero);
3539 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
3541 TEST_ff_f (pow, minus_infty, -2, 0);
3542 TEST_ff_f (pow, minus_infty, -12, 0);
3543 TEST_ff_f (pow, minus_infty, -1002, 0);
3544 TEST_ff_f (pow, minus_infty, -0.1L, 0);
3545 TEST_ff_f (pow, minus_infty, -1.1L, 0);
3546 TEST_ff_f (pow, minus_infty, -11.1L, 0);
3547 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
3550 TEST_ff_f (pow, nan_value, nan_value, nan_value);
3551 TEST_ff_f (pow, 0, nan_value, nan_value);
3552 TEST_ff_f (pow, 1, nan_value, 1);
3553 TEST_ff_f (pow, -1, nan_value, nan_value);
3554 TEST_ff_f (pow, nan_value, 1, nan_value);
3555 TEST_ff_f (pow, nan_value, -1, nan_value);
3557 /* pow (x, NaN) == NaN. */
3558 TEST_ff_f (pow, 3.0, nan_value, nan_value);
3560 TEST_ff_f (pow, 1, plus_infty, 1);
3561 TEST_ff_f (pow, -1, plus_infty, 1);
3562 TEST_ff_f (pow, 1, minus_infty, 1);
3563 TEST_ff_f (pow, -1, minus_infty, 1);
3565 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3566 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3567 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
3568 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
3570 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3571 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3572 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3573 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3575 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3576 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3577 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3578 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3581 TEST_ff_f (pow, 0, 1, 0);
3582 TEST_ff_f (pow, 0, 11, 0);
3584 TEST_ff_f (pow, minus_zero, 1, minus_zero);
3585 TEST_ff_f (pow, minus_zero, 11, minus_zero);
3588 TEST_ff_f (pow, 0, 2, 0);
3589 TEST_ff_f (pow, 0, 11.1L, 0);
3592 TEST_ff_f (pow, minus_zero, 2, 0);
3593 TEST_ff_f (pow, minus_zero, 11.1L, 0);
3596 /* pow (x, +inf) == +inf for |x| > 1. */
3597 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
3599 /* pow (x, +inf) == +0 for |x| < 1. */
3600 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
3602 /* pow (x, -inf) == +0 for |x| > 1. */
3603 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
3605 /* pow (x, -inf) == +inf for |x| < 1. */
3606 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
3609 /* pow (+inf, y) == +inf for y > 0. */
3610 TEST_ff_f (pow, plus_infty, 2, plus_infty);
3612 /* pow (+inf, y) == +0 for y < 0. */
3613 TEST_ff_f (pow, plus_infty, -1, 0.0);
3615 /* pow (-inf, y) == -inf for y an odd integer > 0. */
3616 TEST_ff_f (pow, minus_infty, 27, minus_infty);
3618 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
3619 TEST_ff_f (pow, minus_infty, 28, plus_infty);
3621 /* pow (-inf, y) == -0 for y an odd integer < 0. */
3622 TEST_ff_f (pow, minus_infty, -3, minus_zero);
3623 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
3624 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
3626 /* pow (+0, y) == +0 for y an odd integer > 0. */
3627 TEST_ff_f (pow, 0.0, 27, 0.0);
3629 /* pow (-0, y) == -0 for y an odd integer > 0. */
3630 TEST_ff_f (pow, minus_zero, 27, minus_zero);
3632 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
3633 TEST_ff_f (pow, 0.0, 4, 0.0);
3635 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
3636 TEST_ff_f (pow, minus_zero, 4, 0.0);
3638 TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
3640 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
3641 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
3648 remainder_test (void)
3651 FUNC(remainder) (1.625, 1.0);
3652 if (errno == ENOSYS)
3653 /* Function not implemented. */
3658 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
3659 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
3660 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
3661 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
3662 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
3664 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
3665 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
3666 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
3667 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
3668 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
3669 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
3681 FUNC(remquo) (1.625, 1.0, &x);
3682 if (errno == ENOSYS)
3683 /* Function not implemented. */
3688 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
3689 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
3690 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3691 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
3692 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
3694 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
3695 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
3696 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
3697 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
3699 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
3700 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
3710 TEST_f_f (rint, 0.0, 0.0);
3711 TEST_f_f (rint, minus_zero, minus_zero);
3712 TEST_f_f (rint, plus_infty, plus_infty);
3713 TEST_f_f (rint, minus_infty, minus_infty);
3715 /* Default rounding mode is round to even. */
3716 TEST_f_f (rint, 0.5, 0.0);
3717 TEST_f_f (rint, 1.5, 2.0);
3718 TEST_f_f (rint, 2.5, 2.0);
3719 TEST_f_f (rint, 3.5, 4.0);
3720 TEST_f_f (rint, 4.5, 4.0);
3721 TEST_f_f (rint, -0.5, -0.0);
3722 TEST_f_f (rint, -1.5, -2.0);
3723 TEST_f_f (rint, -2.5, -2.0);
3724 TEST_f_f (rint, -3.5, -4.0);
3725 TEST_f_f (rint, -4.5, -4.0);
3735 TEST_f_f (round, 0, 0);
3736 TEST_f_f (round, minus_zero, minus_zero);
3737 TEST_f_f (round, 0.2L, 0.0);
3738 TEST_f_f (round, -0.2L, minus_zero);
3739 TEST_f_f (round, 0.5, 1.0);
3740 TEST_f_f (round, -0.5, -1.0);
3741 TEST_f_f (round, 0.8L, 1.0);
3742 TEST_f_f (round, -0.8L, -1.0);
3743 TEST_f_f (round, 1.5, 2.0);
3744 TEST_f_f (round, -1.5, -2.0);
3745 TEST_f_f (round, 2097152.5, 2097153);
3746 TEST_f_f (round, -2097152.5, -2097153);
3758 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
3759 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
3761 TEST_ff_f (scalb, 0, nan_value, nan_value);
3762 TEST_ff_f (scalb, 1, nan_value, nan_value);
3764 TEST_ff_f (scalb, 1, 0, 1);
3765 TEST_ff_f (scalb, -1, 0, -1);
3767 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
3768 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
3770 TEST_ff_f (scalb, 0, 2, 0);
3771 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
3772 TEST_ff_f (scalb, 0, 0, 0);
3773 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
3774 TEST_ff_f (scalb, 0, -1, 0);
3775 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
3776 TEST_ff_f (scalb, 0, minus_infty, 0);
3777 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
3779 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
3780 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
3781 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
3782 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
3783 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
3784 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
3786 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
3787 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
3789 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
3790 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
3791 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
3792 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
3794 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3795 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3797 TEST_ff_f (scalb, nan_value, 1, nan_value);
3798 TEST_ff_f (scalb, 1, nan_value, nan_value);
3799 TEST_ff_f (scalb, nan_value, 0, nan_value);
3800 TEST_ff_f (scalb, 0, nan_value, nan_value);
3801 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
3802 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
3803 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
3805 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
3806 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
3818 TEST_fi_f (scalbn, 0, 0, 0);
3819 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
3821 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
3822 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
3823 TEST_fi_f (scalbn, nan_value, 1, nan_value);
3825 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
3826 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
3828 TEST_fi_f (scalbn, 1, 0L, 1);
3840 TEST_fl_f (scalbln, 0, 0, 0);
3841 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
3843 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
3844 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
3845 TEST_fl_f (scalbln, nan_value, 1, nan_value);
3847 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
3848 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
3850 TEST_fl_f (scalbln, 1, 0L, 1);
3862 TEST_f_b (signbit, 0, 0);
3863 TEST_f_b (signbit, minus_zero, 1);
3864 TEST_f_b (signbit, plus_infty, 0);
3865 TEST_f_b (signbit, minus_infty, 1);
3867 /* signbit (x) != 0 for x < 0. */
3868 TEST_f_b (signbit, -1, 1);
3869 /* signbit (x) == 0 for x >= 0. */
3870 TEST_f_b (signbit, 1, 0);
3881 if (errno == ENOSYS)
3882 /* Function not implemented. */
3887 TEST_f_f (sin, 0, 0);
3888 TEST_f_f (sin, minus_zero, minus_zero);
3889 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
3890 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
3891 TEST_f_f (sin, nan_value, nan_value);
3893 TEST_f_f (sin, M_PI_6l, 0.5);
3894 TEST_f_f (sin, -M_PI_6l, -0.5);
3895 TEST_f_f (sin, M_PI_2l, 1);
3896 TEST_f_f (sin, -M_PI_2l, -1);
3897 TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
3900 TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
3911 FLOAT sin_res, cos_res;
3914 FUNC(sincos) (0, &sin_res, &cos_res);
3915 if (errno == ENOSYS)
3916 /* Function not implemented. */
3921 /* sincos is treated differently because it returns void. */
3922 TEST_extra (sincos, 0, 0, 1);
3924 TEST_extra (sincos, minus_zero, minus_zero, 1);
3925 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3926 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3927 TEST_extra (sincos, nan_value, nan_value, nan_value);
3929 TEST_extra (sincos, M_PI_2l, 1, 0);
3930 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
3931 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
3932 TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
3935 TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
3946 if (errno == ENOSYS)
3947 /* Function not implemented. */
3951 TEST_f_f (sinh, 0, 0);
3952 TEST_f_f (sinh, minus_zero, minus_zero);
3955 TEST_f_f (sinh, plus_infty, plus_infty);
3956 TEST_f_f (sinh, minus_infty, minus_infty);
3958 TEST_f_f (sinh, nan_value, nan_value);
3960 TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
3961 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
3971 if (errno == ENOSYS)
3972 /* Function not implemented. */
3977 TEST_f_f (sqrt, 0, 0);
3978 TEST_f_f (sqrt, nan_value, nan_value);
3979 TEST_f_f (sqrt, plus_infty, plus_infty);
3981 TEST_f_f (sqrt, minus_zero, minus_zero);
3983 /* sqrt (x) == NaN plus invalid exception for x < 0. */
3984 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
3985 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
3986 TEST_f_f (sqrt, nan_value, nan_value);
3988 TEST_f_f (sqrt, 2209, 47);
3989 TEST_f_f (sqrt, 4, 2);
3990 TEST_f_f (sqrt, 2, M_SQRT2l);
3991 TEST_f_f (sqrt, 0.25, 0.5);
3992 TEST_f_f (sqrt, 6642.25, 81.5);
3993 TEST_f_f (sqrt, 15190.5625L, 123.25L);
3994 TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
4005 if (errno == ENOSYS)
4006 /* Function not implemented. */
4011 TEST_f_f (tan, 0, 0);
4012 TEST_f_f (tan, minus_zero, minus_zero);
4013 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
4014 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
4015 TEST_f_f (tan, nan_value, nan_value);
4017 TEST_f_f (tan, M_PI_4l, 1);
4018 TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
4028 if (errno == ENOSYS)
4029 /* Function not implemented. */
4034 TEST_f_f (tanh, 0, 0);
4035 TEST_f_f (tanh, minus_zero, minus_zero);
4038 TEST_f_f (tanh, plus_infty, 1);
4039 TEST_f_f (tanh, minus_infty, -1);
4041 TEST_f_f (tanh, nan_value, nan_value);
4043 TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
4044 TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
4046 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
4047 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
4050 TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
4060 if (errno == ENOSYS)
4061 /* Function not implemented. */
4063 feclearexcept (FE_ALL_EXCEPT);
4067 TEST_f_f (tgamma, plus_infty, plus_infty);
4068 TEST_f_f (tgamma, 0, nan_value, INVALID_EXCEPTION);
4069 TEST_f_f (tgamma, minus_zero, nan_value, INVALID_EXCEPTION);
4070 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
4071 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
4072 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
4073 TEST_f_f (tgamma, nan_value, nan_value);
4075 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
4076 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
4078 TEST_f_f (tgamma, 1, 1);
4079 TEST_f_f (tgamma, 4, 6);
4081 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
4082 TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
4093 TEST_f_f (trunc, plus_infty, plus_infty);
4094 TEST_f_f (trunc, minus_infty, minus_infty);
4095 TEST_f_f (trunc, nan_value, nan_value);
4097 TEST_f_f (trunc, 0, 0);
4098 TEST_f_f (trunc, minus_zero, minus_zero);
4099 TEST_f_f (trunc, 0.625, 0);
4100 TEST_f_f (trunc, -0.625, minus_zero);
4101 TEST_f_f (trunc, 1, 1);
4102 TEST_f_f (trunc, -1, -1);
4103 TEST_f_f (trunc, 1.625, 1);
4104 TEST_f_f (trunc, -1.625, -1);
4106 TEST_f_f (trunc, 1048580.625L, 1048580L);
4107 TEST_f_f (trunc, -1048580.625L, -1048580L);
4109 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
4110 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
4112 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
4113 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
4124 FUNC (sincos) (0, &s, &c);
4125 if (errno == ENOSYS)
4126 /* Required function not implemented. */
4129 if (errno == ENOSYS)
4130 /* Function not implemented. */
4133 /* y0 is the Bessel function of the second kind of order 0 */
4136 TEST_f_f (y0, -1.0, minus_infty);
4137 TEST_f_f (y0, 0.0, minus_infty);
4138 TEST_f_f (y0, nan_value, nan_value);
4139 TEST_f_f (y0, plus_infty, 0);
4141 TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
4142 TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
4143 TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
4144 TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
4145 TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
4146 TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
4147 TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
4158 FUNC (sincos) (0, &s, &c);
4159 if (errno == ENOSYS)
4160 /* Required function not implemented. */
4163 if (errno == ENOSYS)
4164 /* Function not implemented. */
4167 /* y1 is the Bessel function of the second kind of order 1 */
4170 TEST_f_f (y1, -1.0, minus_infty);
4171 TEST_f_f (y1, 0.0, minus_infty);
4172 TEST_f_f (y1, plus_infty, 0);
4173 TEST_f_f (y1, nan_value, nan_value);
4175 TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
4176 TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
4177 TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
4178 TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
4179 TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
4180 TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
4181 TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
4192 FUNC (sincos) (0, &s, &c);
4193 if (errno == ENOSYS)
4194 /* Required function not implemented. */
4197 if (errno == ENOSYS)
4198 /* Function not implemented. */
4201 /* yn is the Bessel function of the second kind of order n */
4204 /* yn (0, x) == y0 (x) */
4205 TEST_ff_f (yn, 0, -1.0, minus_infty);
4206 TEST_ff_f (yn, 0, 0.0, minus_infty);
4207 TEST_ff_f (yn, 0, nan_value, nan_value);
4208 TEST_ff_f (yn, 0, plus_infty, 0);
4210 TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
4211 TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
4212 TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
4213 TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
4214 TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
4215 TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
4216 TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
4218 /* yn (1, x) == y1 (x) */
4219 TEST_ff_f (yn, 1, -1.0, minus_infty);
4220 TEST_ff_f (yn, 1, 0.0, minus_infty);
4221 TEST_ff_f (yn, 1, plus_infty, 0);
4222 TEST_ff_f (yn, 1, nan_value, nan_value);
4224 TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
4225 TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
4226 TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
4227 TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
4228 TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
4229 TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
4230 TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
4233 TEST_ff_f (yn, 3, plus_infty, 0);
4234 TEST_ff_f (yn, 3, nan_value, nan_value);
4236 TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
4237 TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
4238 TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
4239 TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
4240 TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
4243 TEST_ff_f (yn, 10, plus_infty, 0);
4244 TEST_ff_f (yn, 10, nan_value, nan_value);
4246 TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
4247 TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
4248 TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
4249 TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
4250 TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
4258 significand_test (void)
4260 /* significand returns the mantissa of the exponential representation. */
4261 START (significand);
4263 TEST_f_f (significand, 4.0, 1.0);
4264 TEST_f_f (significand, 6.0, 1.5);
4265 TEST_f_f (significand, 8.0, 1.0);
4274 fpstack_test ("start *init*");
4276 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
4278 minus_zero = FUNC(copysign) (0.0, -1.0);
4279 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
4280 HUGE_VALL, HUGE_VAL, HUGE_VALF);
4281 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
4282 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
4288 (void) &minus_infty;
4290 /* Clear all exceptions. From now on we must not get random exceptions. */
4291 feclearexcept (FE_ALL_EXCEPT);
4293 /* Test to make sure we start correctly. */
4294 fpstack_test ("end *init*");
4297 /* Definitions of arguments for argp functions. */
4298 static const struct argp_option options[] =
4300 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
4301 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
4302 { "no-max-error", 'f', NULL, 0,
4303 "Don't output maximal errors of functions"},
4304 { "no-points", 'p', NULL, 0,
4305 "Don't output results of functions invocations"},
4306 { "ignore-max-ulp", 'i', "yes/no", 0,
4307 "Ignore given maximal errors"},
4308 { NULL, 0, NULL, 0, NULL }
4311 /* Short description of program. */
4312 static const char doc[] = "Math test suite: " TEST_MSG ;
4314 /* Prototype for option handler. */
4315 static error_t parse_opt (int key, char *arg, struct argp_state *state);
4317 /* Data structure to communicate with argp functions. */
4318 static struct argp argp =
4320 options, parse_opt, NULL, doc,
4324 /* Handle program arguments. */
4326 parse_opt (int key, char *arg, struct argp_state *state)
4331 output_max_error = 0;
4334 if (strcmp (arg, "yes") == 0)
4336 else if (strcmp (arg, "no") == 0)
4347 verbose = (unsigned int) strtoul (optarg, NULL, 0);
4352 return ARGP_ERR_UNKNOWN;
4358 /* function to check our ulp calculation. */
4365 /* This gives one ulp. */
4366 u = FUNC(nextafter) (10, 20);
4367 check_equal (10.0, u, 1, &diff, &ulp);
4368 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
4370 /* This gives one more ulp. */
4371 u = FUNC(nextafter) (u, 20);
4372 check_equal (10.0, u, 2, &diff, &ulp);
4373 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
4375 /* And now calculate 100 ulp. */
4376 for (i = 2; i < 100; i++)
4377 u = FUNC(nextafter) (u, 20);
4378 check_equal (10.0, u, 100, &diff, &ulp);
4379 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
4384 main (int argc, char **argv)
4391 output_max_error = 1;
4393 /* XXX set to 0 for releases. */
4396 /* Parse and process arguments. */
4397 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
4399 if (remaining != argc)
4401 fprintf (stderr, "wrong number of arguments");
4402 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
4403 exit (EXIT_FAILURE);
4408 ulps_file = fopen ("ULPs", "a");
4409 if (ulps_file == NULL)
4411 perror ("can't open file `ULPs' for writing: ");
4424 /* Keep the tests a wee bit ordered (according to ISO C99). */
4425 /* Classification macros: */
4431 /* Trigonometric functions: */
4441 /* Hyperbolic functions: */
4449 /* Exponential and logarithmic functions: */
4466 significand_test ();
4468 /* Power and absolute value functions: */
4475 /* Error and gamma functions: */
4482 /* Nearest integer functions: */
4494 /* Remainder functions: */
4499 /* Manipulation functions: */
4504 /* maximum, minimum and positive difference functions */
4509 /* Multiply and add: */
4512 /* Complex functions: */
4537 /* Bessel functions: */
4548 printf ("\nTest suite completed:\n");
4549 printf (" %d test cases plus %d tests for exception flags executed.\n",
4550 noTests, noExcTests);
4552 printf (" %d expected failures occurred.\n", noXFails);
4554 printf (" %d unexpected passes occurred.\n", noXPasses);
4557 printf (" %d errors occurred.\n", noErrors);
4560 printf (" All tests passed successfully.\n");