1 /* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, 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
156 #define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
158 static FILE *ulps_file; /* File to document difference. */
159 static int output_ulps; /* Should ulps printed? */
161 static int noErrors; /* number of errors */
162 static int noTests; /* number of tests (without testing exceptions) */
163 static int noExcTests; /* number of tests for exception flags */
164 static int noXFails; /* number of expected failures. */
165 static int noXPasses; /* number of unexpected passes. */
168 static int output_max_error; /* Should the maximal errors printed? */
169 static int output_points; /* Should the single function results printed? */
170 static int ignore_max_ulp; /* Should we ignore max_ulp? */
172 static FLOAT minus_zero, plus_zero;
173 static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
175 static FLOAT max_error, real_max_error, imag_max_error;
178 #define BUILD_COMPLEX(real, imag) \
179 ({ __complex__ FLOAT __retval; \
180 __real__ __retval = (real); \
181 __imag__ __retval = (imag); \
184 #define BUILD_COMPLEX_INT(real, imag) \
185 ({ __complex__ int __retval; \
186 __real__ __retval = (real); \
187 __imag__ __retval = (imag); \
191 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
192 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
195 init_max_error (void)
200 feclearexcept (FE_ALL_EXCEPT);
204 set_max_error (FLOAT current, FLOAT *curr_max_error)
206 if (current > *curr_max_error)
207 *curr_max_error = current;
211 /* Should the message print to screen? This depends on the verbose flag,
212 and the test status. */
214 print_screen (int ok, int xfail)
218 || (verbose == 1 && ok == xfail)))
224 /* Should the message print to screen? This depends on the verbose flag,
225 and the test status. */
227 print_screen_max_error (int ok, int xfail)
231 || ((verbose == 1) && (ok == xfail))))
236 /* Update statistic counters. */
238 update_stats (int ok, int xfail)
243 else if (!ok && xfail)
245 else if (!ok && !xfail)
250 print_ulps (const char *test_name, FLOAT ulp)
254 fprintf (ulps_file, "Test \"%s\":\n", test_name);
255 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
256 CHOOSE("ldouble", "double", "float",
257 "ildouble", "idouble", "ifloat"),
263 print_function_ulps (const char *function_name, FLOAT ulp)
267 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
268 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
269 CHOOSE("ldouble", "double", "float",
270 "ildouble", "idouble", "ifloat"),
277 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
284 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
285 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
286 CHOOSE("ldouble", "double", "float",
287 "ildouble", "idouble", "ifloat"),
288 FUNC(ceil) (real_ulp));
292 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
293 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
294 CHOOSE("ldouble", "double", "float",
295 "ildouble", "idouble", "ifloat"),
296 FUNC(ceil) (imag_ulp));
305 /* Test if Floating-Point stack hasn't changed */
307 fpstack_test (const char *test_name)
310 static int old_stack;
313 asm ("fnstsw" : "=a" (sw));
319 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
320 test_name, sw, old_stack);
329 print_max_error (const char *func_name, FLOAT allowed, int xfail)
333 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
339 print_function_ulps (func_name, max_error);
342 if (print_screen_max_error (ok, xfail))
344 printf ("Maximal error of `%s'\n", func_name);
345 printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
346 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
349 update_stats (ok, xfail);
354 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
355 __complex__ int xfail)
359 if ((real_max_error == 0 && imag_max_error == 0)
360 || (real_max_error <= __real__ allowed
361 && imag_max_error <= __imag__ allowed
368 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
371 if (print_screen_max_error (ok, xfail))
373 printf ("Maximal error of real part of: %s\n", func_name);
374 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
375 FUNC(ceil) (real_max_error));
376 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
377 FUNC(ceil) (__real__ allowed));
378 printf ("Maximal error of imaginary part of: %s\n", func_name);
379 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
380 FUNC(ceil) (imag_max_error));
381 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
382 FUNC(ceil) (__imag__ allowed));
385 update_stats (ok, xfail);
389 /* Test whether a given exception was raised. */
391 test_single_exception (const char *test_name,
395 const char *flag_name)
399 if (exception & exc_flag)
401 if (fetestexcept (fe_flag))
403 if (print_screen (1, 0))
404 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
409 if (print_screen (0, 0))
410 printf ("Failure: %s: Exception \"%s\" not set\n",
411 test_name, flag_name);
416 if (fetestexcept (fe_flag))
419 if (print_screen (0, 0))
420 printf ("Failure: %s: Exception \"%s\" set\n",
421 test_name, flag_name);
425 if (print_screen (1, 0))
426 printf ("%s: Exception \"%s\" not set\n", test_name,
437 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
438 allowed but not required exceptions.
441 test_exceptions (const char *test_name, int exception)
445 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
446 test_single_exception (test_name, exception,
447 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
451 if ((exception & INVALID_EXCEPTION_OK) == 0)
452 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
453 "Invalid operation");
455 feclearexcept (FE_ALL_EXCEPT);
460 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
461 FLOAT max_ulp, int xfail, int exceptions,
462 FLOAT *curr_max_error)
469 test_exceptions (test_name, exceptions);
470 if (isnan (computed) && isnan (expected))
472 else if (isinf (computed) && isinf (expected))
474 /* Test for sign of infinities. */
475 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
476 && signbit (computed) != signbit (expected))
479 printf ("infinity has wrong sign.\n");
484 /* Don't calc ulp for NaNs or infinities. */
485 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
489 diff = FUNC(fabs) (computed - expected);
490 /* ilogb (0) isn't allowed. */
492 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
494 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
495 set_max_error (ulp, curr_max_error);
497 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
498 && computed == 0.0 && expected == 0.0
499 && signbit(computed) != signbit (expected))
501 else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
506 print_ulps (test_name, ulp);
510 if (print_screen (ok, xfail))
513 printf ("Failure: ");
514 printf ("Test: %s\n", test_name);
515 printf ("Result:\n");
516 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
518 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
522 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
524 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
525 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
528 update_stats (ok, xfail);
530 fpstack_test (test_name);
535 check_float (const char *test_name, FLOAT computed, FLOAT expected,
536 FLOAT max_ulp, int xfail, int exceptions)
538 check_float_internal (test_name, computed, expected, max_ulp, xfail,
539 exceptions, &max_error);
544 check_complex (const char *test_name, __complex__ FLOAT computed,
545 __complex__ FLOAT expected,
546 __complex__ FLOAT max_ulp, __complex__ int xfail,
549 FLOAT part_comp, part_exp, part_max_ulp;
553 sprintf (str, "Real part of: %s", test_name);
554 part_comp = __real__ computed;
555 part_exp = __real__ expected;
556 part_max_ulp = __real__ max_ulp;
557 part_xfail = __real__ xfail;
559 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
560 exception, &real_max_error);
562 sprintf (str, "Imaginary part of: %s", test_name);
563 part_comp = __imag__ computed;
564 part_exp = __imag__ expected;
565 part_max_ulp = __imag__ max_ulp;
566 part_xfail = __imag__ xfail;
568 /* Don't check again for exceptions, just pass through the
569 zero/inf sign test. */
570 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
571 exception & IGNORE_ZERO_INF_SIGN,
576 /* Check that computed and expected values are equal (int values). */
578 check_int (const char *test_name, int computed, int expected, int max_ulp,
579 int xfail, int exceptions)
581 int diff = computed - expected;
584 test_exceptions (test_name, exceptions);
586 if (abs (diff) <= max_ulp)
590 print_ulps (test_name, diff);
592 if (print_screen (ok, xfail))
595 printf ("Failure: ");
596 printf ("Test: %s\n", test_name);
597 printf ("Result:\n");
598 printf (" is: %d\n", computed);
599 printf (" should be: %d\n", expected);
602 update_stats (ok, xfail);
603 fpstack_test (test_name);
607 /* Check that computed and expected values are equal (long int values). */
609 check_long (const char *test_name, long int computed, long int expected,
610 long int max_ulp, int xfail, int exceptions)
612 long int diff = computed - expected;
615 test_exceptions (test_name, exceptions);
617 if (labs (diff) <= max_ulp)
621 print_ulps (test_name, diff);
623 if (print_screen (ok, xfail))
626 printf ("Failure: ");
627 printf ("Test: %s\n", test_name);
628 printf ("Result:\n");
629 printf (" is: %ld\n", computed);
630 printf (" should be: %ld\n", expected);
633 update_stats (ok, xfail);
634 fpstack_test (test_name);
638 /* Check that computed value is true/false. */
640 check_bool (const char *test_name, int computed, int expected,
641 long int max_ulp, int xfail, int exceptions)
645 test_exceptions (test_name, exceptions);
647 if ((computed == 0) == (expected == 0))
650 if (print_screen (ok, xfail))
653 printf ("Failure: ");
654 printf ("Test: %s\n", test_name);
655 printf ("Result:\n");
656 printf (" is: %d\n", computed);
657 printf (" should be: %d\n", expected);
660 update_stats (ok, xfail);
661 fpstack_test (test_name);
665 /* check that computed and expected values are equal (long int values) */
667 check_longlong (const char *test_name, long long int computed,
668 long long int expected,
669 long long int max_ulp, int xfail,
672 long long int diff = computed - expected;
675 test_exceptions (test_name, exceptions);
677 if (llabs (diff) <= max_ulp)
681 print_ulps (test_name, diff);
683 if (print_screen (ok, xfail))
687 printf ("Test: %s\n", test_name);
688 printf ("Result:\n");
689 printf (" is: %lld\n", computed);
690 printf (" should be: %lld\n", expected);
693 update_stats (ok, xfail);
694 fpstack_test (test_name);
699 /* This is to prevent messages from the SVID libm emulation. */
701 matherr (struct exception *x __attribute__ ((unused)))
707 /****************************************************************************
708 Tests for single functions of libm.
709 Please keep them alphabetically sorted!
710 ****************************************************************************/
718 /* Function not implemented. */
723 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
724 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
725 TEST_f_f (acos, nan_value, nan_value);
728 TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
729 TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
731 TEST_f_f (acos, 0, M_PI_2l);
732 TEST_f_f (acos, minus_zero, M_PI_2l);
733 TEST_f_f (acos, 1, 0);
734 TEST_f_f (acos, -1, M_PIl);
735 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
736 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
737 TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
738 TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
739 TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
749 /* Function not implemented. */
754 TEST_f_f (acosh, plus_infty, plus_infty);
755 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
758 TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
760 TEST_f_f (acosh, 1, 0);
761 TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
772 /* Function not implemented. */
777 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
778 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
779 TEST_f_f (asin, nan_value, nan_value);
781 /* asin x == NaN plus invalid exception for |x| > 1. */
782 TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
783 TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
785 TEST_f_f (asin, 0, 0);
786 TEST_f_f (asin, minus_zero, minus_zero);
787 TEST_f_f (asin, 0.5, M_PI_6l);
788 TEST_f_f (asin, -0.5, -M_PI_6l);
789 TEST_f_f (asin, 1.0, M_PI_2l);
790 TEST_f_f (asin, -1.0, -M_PI_2l);
791 TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
802 /* Function not implemented. */
807 TEST_f_f (asinh, 0, 0);
808 TEST_f_f (asinh, minus_zero, minus_zero);
810 TEST_f_f (asinh, plus_infty, plus_infty);
811 TEST_f_f (asinh, minus_infty, minus_infty);
813 TEST_f_f (asinh, nan_value, nan_value);
814 TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
825 /* Function not implemented. */
830 TEST_f_f (atan, 0, 0);
831 TEST_f_f (atan, minus_zero, minus_zero);
833 TEST_f_f (atan, plus_infty, M_PI_2l);
834 TEST_f_f (atan, minus_infty, -M_PI_2l);
835 TEST_f_f (atan, nan_value, nan_value);
837 TEST_f_f (atan, 1, M_PI_4l);
838 TEST_f_f (atan, -1, -M_PI_4l);
840 TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
853 /* Function not implemented. */
859 TEST_f_f (atanh, 0, 0);
860 TEST_f_f (atanh, minus_zero, minus_zero);
862 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
863 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
864 TEST_f_f (atanh, nan_value, nan_value);
866 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
867 TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
868 TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
870 TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
881 /* Function not implemented. */
886 /* atan2 (0,x) == 0 for x > 0. */
887 TEST_ff_f (atan2, 0, 1, 0);
889 /* atan2 (-0,x) == -0 for x > 0. */
890 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
892 TEST_ff_f (atan2, 0, 0, 0);
893 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
895 /* atan2 (+0,x) == +pi for x < 0. */
896 TEST_ff_f (atan2, 0, -1, M_PIl);
898 /* atan2 (-0,x) == -pi for x < 0. */
899 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
901 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
902 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
904 /* atan2 (y,+0) == pi/2 for y > 0. */
905 TEST_ff_f (atan2, 1, 0, M_PI_2l);
907 /* atan2 (y,-0) == pi/2 for y > 0. */
908 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
910 /* atan2 (y,+0) == -pi/2 for y < 0. */
911 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
913 /* atan2 (y,-0) == -pi/2 for y < 0. */
914 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
916 /* atan2 (y,inf) == +0 for finite y > 0. */
917 TEST_ff_f (atan2, 1, plus_infty, 0);
919 /* atan2 (y,inf) == -0 for finite y < 0. */
920 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
922 /* atan2(+inf, x) == pi/2 for finite x. */
923 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
925 /* atan2(-inf, x) == -pi/2 for finite x. */
926 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
928 /* atan2 (y,-inf) == +pi for finite y > 0. */
929 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
931 /* atan2 (y,-inf) == -pi for finite y < 0. */
932 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
934 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
935 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
936 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
937 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
938 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
940 TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
941 TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
942 TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
943 TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
944 TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
945 TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
947 TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
956 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
958 /* Function not implemented. */
963 /* cabs (x + iy) is specified as hypot (x,y) */
965 /* cabs (+inf + i x) == +inf. */
966 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
967 /* cabs (-inf + i x) == +inf. */
968 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
970 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
971 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
973 TEST_c_f (cabs, nan_value, nan_value, nan_value);
975 /* cabs (x,y) == cabs (y,x). */
976 TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
977 /* cabs (x,y) == cabs (-x,y). */
978 TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
979 /* cabs (x,y) == cabs (-y,x). */
980 TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
981 /* cabs (x,y) == cabs (-x,-y). */
982 TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
983 /* cabs (x,y) == cabs (-y,-x). */
984 TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
985 /* cabs (x,0) == fabs (x). */
986 TEST_c_f (cabs, -0.75L, 0, 0.75L);
987 TEST_c_f (cabs, 0.75L, 0, 0.75L);
988 TEST_c_f (cabs, -1.0L, 0, 1.0L);
989 TEST_c_f (cabs, 1.0L, 0, 1.0L);
990 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
991 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
993 TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
1003 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1004 if (errno == ENOSYS)
1005 /* Function not implemented. */
1011 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
1012 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
1013 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
1014 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1016 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1017 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1019 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1020 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1022 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1023 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1024 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1025 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1026 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1027 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1029 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1030 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1031 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1032 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1034 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1035 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1036 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1037 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1039 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1040 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1042 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1043 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1045 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1046 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1048 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1049 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1051 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1052 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1054 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1056 TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
1057 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1059 END (cacos, complex);
1066 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1067 if (errno == ENOSYS)
1068 /* Function not implemented. */
1074 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1075 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1076 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1077 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1078 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1079 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1081 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1082 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1084 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1085 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1086 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1087 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1088 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1089 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1091 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1092 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1093 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1094 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1096 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1097 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1098 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1099 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1101 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1102 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1104 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1105 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1107 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1108 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1110 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1111 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1113 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1114 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1116 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1118 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
1119 TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
1121 END (cacosh, complex);
1130 /* carg (x + iy) is specified as atan2 (y, x) */
1132 /* carg (x + i 0) == 0 for x > 0. */
1133 TEST_c_f (carg, 2.0, 0, 0);
1134 /* carg (x - i 0) == -0 for x > 0. */
1135 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1137 TEST_c_f (carg, 0, 0, 0);
1138 TEST_c_f (carg, 0, minus_zero, minus_zero);
1140 /* carg (x + i 0) == +pi for x < 0. */
1141 TEST_c_f (carg, -2.0, 0, M_PIl);
1143 /* carg (x - i 0) == -pi for x < 0. */
1144 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1146 TEST_c_f (carg, minus_zero, 0, M_PIl);
1147 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1149 /* carg (+0 + i y) == pi/2 for y > 0. */
1150 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1152 /* carg (-0 + i y) == pi/2 for y > 0. */
1153 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1155 /* carg (+0 + i y) == -pi/2 for y < 0. */
1156 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1158 /* carg (-0 + i y) == -pi/2 for y < 0. */
1159 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1161 /* carg (inf + i y) == +0 for finite y > 0. */
1162 TEST_c_f (carg, plus_infty, 2.0, 0);
1164 /* carg (inf + i y) == -0 for finite y < 0. */
1165 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1167 /* carg(x + i inf) == pi/2 for finite x. */
1168 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1170 /* carg(x - i inf) == -pi/2 for finite x. */
1171 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1173 /* carg (-inf + i y) == +pi for finite y > 0. */
1174 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1176 /* carg (-inf + i y) == -pi for finite y < 0. */
1177 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1179 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1181 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1183 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1185 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1187 TEST_c_f (carg, nan_value, nan_value, nan_value);
1196 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1197 if (errno == ENOSYS)
1198 /* Function not implemented. */
1203 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1204 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1205 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1206 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1208 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1209 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1210 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1211 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1213 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1214 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1215 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1216 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1217 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1218 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1219 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1220 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1222 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1223 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1224 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1225 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1227 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1228 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1229 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1230 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1232 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1233 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1235 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1236 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1238 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1239 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1241 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1242 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1244 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1245 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1247 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1249 TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
1250 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1252 END (casin, complex);
1260 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1261 if (errno == ENOSYS)
1262 /* Function not implemented. */
1267 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1268 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1269 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1270 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1272 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1273 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1274 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1275 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1277 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1278 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1279 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1280 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1281 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1282 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1283 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1284 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1286 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1287 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1288 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1289 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1291 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1292 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1293 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1294 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1296 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1297 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1299 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1300 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1302 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1303 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1305 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1306 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1308 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1309 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1311 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1313 TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
1314 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1316 END (casinh, complex);
1324 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1325 if (errno == ENOSYS)
1326 /* Function not implemented. */
1331 TEST_c_c (catan, 0, 0, 0, 0);
1332 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1333 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1334 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1336 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1337 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1338 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1339 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1342 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1343 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1344 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1345 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1346 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1347 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1348 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1349 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1351 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1352 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1353 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1354 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1356 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1357 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1358 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1359 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1361 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1362 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1364 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1365 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1367 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1368 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1370 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1371 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1373 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1374 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1376 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1377 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1379 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1381 TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
1382 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1384 END (catan, complex);
1391 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1392 if (errno == ENOSYS)
1393 /* Function not implemented. */
1398 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1399 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1400 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1401 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1403 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1404 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1405 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1406 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1408 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1409 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1410 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1411 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1412 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1413 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1414 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1415 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1417 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1418 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1419 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1420 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1422 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1423 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1424 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1425 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1427 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1428 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1430 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1431 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1433 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1434 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1436 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1437 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1439 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1440 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1442 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1443 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1445 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1447 TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
1448 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1450 END (catanh, complex);
1458 if (errno == ENOSYS)
1459 /* Function not implemented. */
1464 TEST_f_f (cbrt, 0.0, 0.0);
1465 TEST_f_f (cbrt, minus_zero, minus_zero);
1467 TEST_f_f (cbrt, plus_infty, plus_infty);
1468 TEST_f_f (cbrt, minus_infty, minus_infty);
1469 TEST_f_f (cbrt, nan_value, nan_value);
1471 TEST_f_f (cbrt, -0.001L, -0.1L);
1472 TEST_f_f (cbrt, 8, 2);
1473 TEST_f_f (cbrt, -27.0, -3.0);
1474 TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
1475 TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
1485 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1486 if (errno == ENOSYS)
1487 /* Function not implemented. */
1492 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1493 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1494 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1495 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1497 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1498 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1499 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1500 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1502 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1503 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1504 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1505 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1507 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1508 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1509 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1510 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1512 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1513 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1514 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1515 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1517 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1518 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1519 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1520 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1522 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1523 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1525 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1526 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1528 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1529 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1531 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1532 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1534 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1535 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1537 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1538 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1540 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1542 TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
1543 TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
1545 END (ccos, complex);
1553 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1554 if (errno == ENOSYS)
1555 /* Function not implemented. */
1560 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1561 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1562 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1563 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1565 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1566 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1567 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1568 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1570 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1571 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1572 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1573 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1575 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1576 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1577 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1578 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1580 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1581 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1582 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1583 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1585 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1586 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1587 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1588 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1590 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1591 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1593 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1594 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1596 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1597 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1599 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1600 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1602 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1603 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1605 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1606 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1608 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1610 TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
1612 TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
1614 END (ccosh, complex);
1623 TEST_f_f (ceil, 0.0, 0.0);
1624 TEST_f_f (ceil, minus_zero, minus_zero);
1625 TEST_f_f (ceil, plus_infty, plus_infty);
1626 TEST_f_f (ceil, minus_infty, minus_infty);
1627 TEST_f_f (ceil, nan_value, nan_value);
1629 TEST_f_f (ceil, M_PIl, 4.0);
1630 TEST_f_f (ceil, -M_PIl, -3.0);
1631 TEST_f_f (ceil, 0.1, 1.0);
1632 TEST_f_f (ceil, 0.25, 1.0);
1633 TEST_f_f (ceil, 0.625, 1.0);
1634 TEST_f_f (ceil, -0.1, minus_zero);
1635 TEST_f_f (ceil, -0.25, minus_zero);
1636 TEST_f_f (ceil, -0.625, minus_zero);
1639 /* The result can only be represented in long double. */
1640 TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
1641 TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
1642 TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
1643 TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
1644 TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
1646 TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
1647 TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
1648 TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
1649 TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
1650 TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
1652 # if LDBL_MANT_DIG > 100
1653 TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L);
1654 TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L);
1655 TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L);
1656 TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L);
1657 TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L);
1658 TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L);
1661 TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
1662 TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
1663 TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
1664 TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
1665 TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
1667 TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
1668 TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
1669 TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
1670 TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
1671 TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
1673 # if LDBL_MANT_DIG > 100
1674 TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L);
1675 TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L);
1676 TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L);
1677 TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L);
1678 TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L);
1679 TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L);
1681 TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L);
1682 TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L);
1683 TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L);
1684 TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L);
1685 TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L);
1686 TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L);
1689 TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
1690 TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
1691 TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
1692 TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
1693 TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
1695 TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
1696 TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
1697 TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
1698 TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
1699 TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
1701 TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
1702 TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
1703 TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
1704 TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
1705 TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
1716 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1717 if (errno == ENOSYS)
1718 /* Function not implemented. */
1723 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1724 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1725 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1726 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1728 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1729 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1731 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1732 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1734 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1735 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1737 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1738 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1740 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1741 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1743 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1744 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1746 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1747 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1748 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1749 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1751 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1752 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1754 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1755 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1757 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1759 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1761 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1762 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1764 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1765 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1766 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1767 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1769 TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
1770 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1772 END (cexp, complex);
1780 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1781 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1782 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1783 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1784 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1785 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1786 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1795 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1796 if (errno == ENOSYS)
1797 /* Function not implemented. */
1802 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1803 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1805 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1806 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1808 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1809 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1811 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1812 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1814 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1815 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1816 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1817 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1818 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1819 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1820 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1821 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1823 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1824 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1825 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1826 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1828 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1829 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1830 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1831 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1833 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1834 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1836 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1837 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1839 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1840 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1841 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1842 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1844 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1845 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1846 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1847 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1849 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1851 TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
1852 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1854 END (clog, complex);
1862 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1863 if (errno == ENOSYS)
1864 /* Function not implemented. */
1869 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1870 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1872 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1873 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1875 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1877 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1878 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1880 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1881 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1882 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1883 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1884 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1885 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1886 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1887 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1889 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1890 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1891 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1892 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1894 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1895 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1896 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1897 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1899 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1900 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1902 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1903 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1905 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1906 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1907 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1908 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1910 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1911 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1912 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1913 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1915 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1917 TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
1918 TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
1920 END (clog10, complex);
1928 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1929 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1930 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1931 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1932 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1933 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1934 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1936 END (conj, complex);
1941 copysign_test (void)
1945 TEST_ff_f (copysign, 0, 4, 0);
1946 TEST_ff_f (copysign, 0, -4, minus_zero);
1947 TEST_ff_f (copysign, minus_zero, 4, 0);
1948 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1950 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1951 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1952 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1953 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1955 TEST_ff_f (copysign, 0, plus_infty, 0);
1956 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1957 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1958 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1960 /* XXX More correctly we would have to check the sign of the NaN. */
1961 TEST_ff_f (copysign, nan_value, 0, nan_value);
1962 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1963 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1964 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1975 if (errno == ENOSYS)
1976 /* Function not implemented. */
1981 TEST_f_f (cos, 0, 1);
1982 TEST_f_f (cos, minus_zero, 1);
1983 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1984 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
1985 TEST_f_f (cos, nan_value, nan_value);
1987 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
1988 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
1989 TEST_f_f (cos, M_PI_2l, 0);
1991 TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
1994 TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
2006 if (errno == ENOSYS)
2007 /* Function not implemented. */
2011 TEST_f_f (cosh, 0, 1);
2012 TEST_f_f (cosh, minus_zero, 1);
2015 TEST_f_f (cosh, plus_infty, plus_infty);
2016 TEST_f_f (cosh, minus_infty, plus_infty);
2018 TEST_f_f (cosh, nan_value, nan_value);
2020 TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
2030 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
2031 if (errno == ENOSYS)
2032 /* Function not implemented. */
2037 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
2038 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
2040 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
2041 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
2043 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
2045 TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
2046 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
2047 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
2048 TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
2050 END (cpow, complex);
2058 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
2059 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
2060 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
2061 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
2063 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
2065 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
2066 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
2067 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
2068 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
2070 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
2071 TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
2073 END (cproj, complex);
2081 TEST_c_f (creal, 0.0, 1.0, 0.0);
2082 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
2083 TEST_c_f (creal, nan_value, 1.0, nan_value);
2084 TEST_c_f (creal, nan_value, nan_value, nan_value);
2085 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
2086 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
2087 TEST_c_f (creal, 2.0, 3.0, 2.0);
2096 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2097 if (errno == ENOSYS)
2098 /* Function not implemented. */
2103 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
2104 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
2105 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
2106 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2108 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2109 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2110 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2111 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2113 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2114 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2115 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2116 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2118 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2119 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2120 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2121 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2123 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2124 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2125 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2126 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2128 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2129 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2130 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2131 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2133 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2134 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2136 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2137 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2139 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2140 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2142 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2143 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2145 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2146 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2148 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2149 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2151 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2153 TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
2154 TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
2156 END (csin, complex);
2164 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2165 if (errno == ENOSYS)
2166 /* Function not implemented. */
2171 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2172 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2173 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2174 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2176 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2177 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2178 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2179 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2181 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2182 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2183 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2184 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2186 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2187 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2188 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2189 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2191 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2192 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2193 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2194 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2196 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2197 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2198 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2199 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2201 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2202 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2204 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2205 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2207 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2208 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2210 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2211 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2213 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2214 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2216 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2217 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2219 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2221 TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
2222 TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
2224 END (csinh, complex);
2232 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2233 if (errno == ENOSYS)
2234 /* Function not implemented. */
2239 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2240 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2241 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2242 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2244 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2245 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2246 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2247 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2249 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2250 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2251 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2252 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2254 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2255 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2256 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2257 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2258 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2259 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2260 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2261 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2262 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2263 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2264 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2265 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2267 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2269 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2271 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2272 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2273 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2274 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2276 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2277 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2278 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2279 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2281 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2283 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2284 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2285 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2286 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2287 TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
2288 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2289 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2290 /* Principal square root should be returned (i.e., non-negative real
2292 TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
2294 END (csqrt, complex);
2301 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2302 if (errno == ENOSYS)
2303 /* Function not implemented. */
2308 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2309 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2310 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2311 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2313 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2314 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2315 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2316 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2318 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2319 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2320 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2321 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2323 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2324 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2325 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2326 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2327 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2328 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2329 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2330 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2332 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2333 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2335 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2336 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2338 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2339 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2341 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2342 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2343 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2344 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2346 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2348 TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
2349 TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
2351 END (ctan, complex);
2359 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2360 if (errno == ENOSYS)
2361 /* Function not implemented. */
2366 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2367 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2368 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2369 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2371 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2372 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2373 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2374 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2375 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2376 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2377 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2378 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2380 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2381 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2382 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2383 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2384 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2385 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2386 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2387 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2389 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2390 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2392 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2393 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2395 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2396 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2398 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2399 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2400 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2401 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2403 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2405 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2407 TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
2408 TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
2410 END (ctanh, complex);
2419 if (errno == ENOSYS)
2420 /* Function not implemented. */
2425 TEST_f_f (erf, 0, 0);
2426 TEST_f_f (erf, minus_zero, minus_zero);
2427 TEST_f_f (erf, plus_infty, 1);
2428 TEST_f_f (erf, minus_infty, -1);
2429 TEST_f_f (erf, nan_value, nan_value);
2431 TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
2432 TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
2433 TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
2434 TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
2435 TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
2436 TEST_f_f (erf, 27.0L, 1.0L);
2447 if (errno == ENOSYS)
2448 /* Function not implemented. */
2453 TEST_f_f (erfc, plus_infty, 0.0);
2454 TEST_f_f (erfc, minus_infty, 2.0);
2455 TEST_f_f (erfc, 0.0, 1.0);
2456 TEST_f_f (erfc, minus_zero, 1.0);
2457 TEST_f_f (erfc, nan_value, nan_value);
2459 TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
2460 TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
2461 TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
2462 TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
2463 TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
2465 /* The result can only be represented in long double. */
2466 # if LDBL_MIN_10_EXP < -319
2467 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
2480 if (errno == ENOSYS)
2481 /* Function not implemented. */
2486 TEST_f_f (exp, 0, 1);
2487 TEST_f_f (exp, minus_zero, 1);
2490 TEST_f_f (exp, plus_infty, plus_infty);
2491 TEST_f_f (exp, minus_infty, 0);
2493 TEST_f_f (exp, nan_value, nan_value);
2494 TEST_f_f (exp, 1, M_El);
2496 TEST_f_f (exp, 2, M_E2l);
2497 TEST_f_f (exp, 3, M_E3l);
2498 TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
2499 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
2501 /* The result can only be represented in long double. */
2502 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
2514 if (errno == ENOSYS)
2515 /* Function not implemented. */
2520 TEST_f_f (exp10, 0, 1);
2521 TEST_f_f (exp10, minus_zero, 1);
2523 TEST_f_f (exp10, plus_infty, plus_infty);
2524 TEST_f_f (exp10, minus_infty, 0);
2525 TEST_f_f (exp10, nan_value, nan_value);
2526 TEST_f_f (exp10, 3, 1000);
2527 TEST_f_f (exp10, -1, 0.1L);
2528 TEST_f_f (exp10, 1e6, plus_infty);
2529 TEST_f_f (exp10, -1e6, 0);
2530 TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
2541 if (errno == ENOSYS)
2542 /* Function not implemented. */
2547 TEST_f_f (exp2, 0, 1);
2548 TEST_f_f (exp2, minus_zero, 1);
2549 TEST_f_f (exp2, plus_infty, plus_infty);
2550 TEST_f_f (exp2, minus_infty, 0);
2551 TEST_f_f (exp2, nan_value, nan_value);
2553 TEST_f_f (exp2, 10, 1024);
2554 TEST_f_f (exp2, -1, 0.5);
2555 TEST_f_f (exp2, 1e6, plus_infty);
2556 TEST_f_f (exp2, -1e6, 0);
2557 TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
2568 if (errno == ENOSYS)
2569 /* Function not implemented. */
2574 TEST_f_f (expm1, 0, 0);
2575 TEST_f_f (expm1, minus_zero, minus_zero);
2578 TEST_f_f (expm1, plus_infty, plus_infty);
2579 TEST_f_f (expm1, minus_infty, -1);
2581 TEST_f_f (expm1, nan_value, nan_value);
2583 TEST_f_f (expm1, 1, M_El - 1.0);
2584 TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
2595 TEST_f_f (fabs, 0, 0);
2596 TEST_f_f (fabs, minus_zero, 0);
2598 TEST_f_f (fabs, plus_infty, plus_infty);
2599 TEST_f_f (fabs, minus_infty, plus_infty);
2600 TEST_f_f (fabs, nan_value, nan_value);
2602 TEST_f_f (fabs, 38.0, 38.0);
2603 TEST_f_f (fabs, -M_El, M_El);
2614 TEST_ff_f (fdim, 0, 0, 0);
2615 TEST_ff_f (fdim, 9, 0, 9);
2616 TEST_ff_f (fdim, 0, 9, 0);
2617 TEST_ff_f (fdim, -9, 0, 0);
2618 TEST_ff_f (fdim, 0, -9, 9);
2620 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2621 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2622 TEST_ff_f (fdim, minus_infty, 9, 0);
2623 TEST_ff_f (fdim, minus_infty, -9, 0);
2624 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2625 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2626 TEST_ff_f (fdim, 9, plus_infty, 0);
2627 TEST_ff_f (fdim, -9, plus_infty, 0);
2629 TEST_ff_f (fdim, 0, nan_value, nan_value);
2630 TEST_ff_f (fdim, 9, nan_value, nan_value);
2631 TEST_ff_f (fdim, -9, nan_value, nan_value);
2632 TEST_ff_f (fdim, nan_value, 9, nan_value);
2633 TEST_ff_f (fdim, nan_value, -9, nan_value);
2634 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2635 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2636 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2637 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2638 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2640 TEST_ff_f (fdim, plus_infty, plus_infty, 0);
2651 TEST_f_f (floor, 0.0, 0.0);
2652 TEST_f_f (floor, minus_zero, minus_zero);
2653 TEST_f_f (floor, plus_infty, plus_infty);
2654 TEST_f_f (floor, minus_infty, minus_infty);
2655 TEST_f_f (floor, nan_value, nan_value);
2657 TEST_f_f (floor, M_PIl, 3.0);
2658 TEST_f_f (floor, -M_PIl, -4.0);
2660 TEST_f_f (floor, 0.1, 0.0);
2661 TEST_f_f (floor, 0.25, 0.0);
2662 TEST_f_f (floor, 0.625, 0.0);
2663 TEST_f_f (floor, -0.1, -1.0);
2664 TEST_f_f (floor, -0.25, -1.0);
2665 TEST_f_f (floor, -0.625, -1.0);
2668 /* The result can only be represented in long double. */
2669 TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
2670 TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
2671 TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
2672 TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
2673 TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
2674 # if LDBL_MANT_DIG > 100
2675 TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L);
2676 TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L);
2677 TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L);
2680 TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
2681 TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
2682 TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
2683 TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
2684 TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
2685 # if LDBL_MANT_DIG > 100
2686 TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L);
2687 TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L);
2688 TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L);
2691 TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
2692 TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
2693 TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
2694 TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
2695 TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
2697 # if LDBL_MANT_DIG > 100
2698 TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L);
2699 TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L);
2700 TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L);
2701 TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L);
2702 TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L);
2703 TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L);
2706 TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
2707 TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
2708 TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
2709 TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
2710 TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
2712 # if LDBL_MANT_DIG > 100
2713 TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L);
2714 TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L);
2715 TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L);
2716 TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L);
2717 TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L);
2718 TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L);
2721 TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
2722 TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
2723 TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
2724 TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
2725 TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
2727 TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
2728 TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
2729 TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
2730 TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
2731 TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
2733 TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
2734 TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
2735 TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
2736 TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
2737 TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
2749 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2750 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2751 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2752 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2753 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2754 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2755 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2756 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2757 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2758 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2759 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2760 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2762 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2763 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2764 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2765 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2767 TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
2778 TEST_ff_f (fmax, 0, 0, 0);
2779 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2780 TEST_ff_f (fmax, 9, 0, 9);
2781 TEST_ff_f (fmax, 0, 9, 9);
2782 TEST_ff_f (fmax, -9, 0, 0);
2783 TEST_ff_f (fmax, 0, -9, 0);
2785 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2786 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2787 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2788 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2790 TEST_ff_f (fmax, minus_infty, 9, 9);
2791 TEST_ff_f (fmax, minus_infty, -9, -9);
2792 TEST_ff_f (fmax, 9, minus_infty, 9);
2793 TEST_ff_f (fmax, -9, minus_infty, -9);
2795 TEST_ff_f (fmax, 0, nan_value, 0);
2796 TEST_ff_f (fmax, 9, nan_value, 9);
2797 TEST_ff_f (fmax, -9, nan_value, -9);
2798 TEST_ff_f (fmax, nan_value, 0, 0);
2799 TEST_ff_f (fmax, nan_value, 9, 9);
2800 TEST_ff_f (fmax, nan_value, -9, -9);
2801 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2802 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2803 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2804 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2805 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2816 TEST_ff_f (fmin, 0, 0, 0);
2817 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2818 TEST_ff_f (fmin, 9, 0, 0);
2819 TEST_ff_f (fmin, 0, 9, 0);
2820 TEST_ff_f (fmin, -9, 0, -9);
2821 TEST_ff_f (fmin, 0, -9, -9);
2823 TEST_ff_f (fmin, plus_infty, 9, 9);
2824 TEST_ff_f (fmin, 9, plus_infty, 9);
2825 TEST_ff_f (fmin, plus_infty, -9, -9);
2826 TEST_ff_f (fmin, -9, plus_infty, -9);
2827 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2828 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2829 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2830 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2832 TEST_ff_f (fmin, 0, nan_value, 0);
2833 TEST_ff_f (fmin, 9, nan_value, 9);
2834 TEST_ff_f (fmin, -9, nan_value, -9);
2835 TEST_ff_f (fmin, nan_value, 0, 0);
2836 TEST_ff_f (fmin, nan_value, 9, 9);
2837 TEST_ff_f (fmin, nan_value, -9, -9);
2838 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2839 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2840 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2841 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2842 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2852 FUNC(fmod) (6.5, 2.3L);
2853 if (errno == ENOSYS)
2854 /* Function not implemented. */
2859 /* fmod (+0, y) == +0 for y != 0. */
2860 TEST_ff_f (fmod, 0, 3, 0);
2862 /* fmod (-0, y) == -0 for y != 0. */
2863 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2865 /* fmod (+inf, y) == NaN plus invalid exception. */
2866 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2867 /* fmod (-inf, y) == NaN plus invalid exception. */
2868 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2869 /* fmod (x, +0) == NaN plus invalid exception. */
2870 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2871 /* fmod (x, -0) == NaN plus invalid exception. */
2872 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2874 /* fmod (x, +inf) == x for x not infinite. */
2875 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2876 /* fmod (x, -inf) == x for x not infinite. */
2877 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2879 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2881 TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
2882 TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
2883 TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
2884 TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
2891 fpclassify_test (void)
2895 TEST_f_i (fpclassify, nan_value, FP_NAN);
2896 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2897 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2898 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2899 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
2900 TEST_f_i (fpclassify, 1000, FP_NORMAL);
2913 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
2914 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
2915 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
2917 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
2918 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
2920 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
2921 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
2933 if (errno == ENOSYS)
2934 /* Function not implemented. */
2936 feclearexcept (FE_ALL_EXCEPT);
2940 TEST_f_f (gamma, plus_infty, plus_infty);
2941 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2942 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
2943 TEST_f_f (gamma, minus_infty, plus_infty);
2944 TEST_f_f (gamma, nan_value, nan_value);
2946 TEST_f_f1 (gamma, 1, 0, 1);
2947 TEST_f_f1 (gamma, 3, M_LN2l, 1);
2949 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
2950 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
2959 FUNC(hypot) (0.7L, 12.4L);
2960 if (errno == ENOSYS)
2961 /* Function not implemented. */
2966 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2967 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
2970 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
2971 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
2972 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
2973 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
2976 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
2978 /* hypot (x,y) == hypot (+-x, +-y) */
2979 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
2980 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
2981 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
2982 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
2983 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
2984 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
2985 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
2986 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
2988 /* hypot (x,0) == fabs (x) */
2989 TEST_ff_f (hypot, 0.75L, 0, 0.75L);
2990 TEST_ff_f (hypot, -0.75L, 0, 0.75L);
2991 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
2993 TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
3004 TEST_f_i (ilogb, 1, 0);
3005 TEST_f_i (ilogb, M_El, 1);
3006 TEST_f_i (ilogb, 1024, 10);
3007 TEST_f_i (ilogb, -2000, 10);
3009 /* XXX We have a problem here: the standard does not tell us whether
3010 exceptions are allowed/required. ignore them for now. */
3012 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
3013 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
3014 TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
3015 TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
3021 isfinite_test (void)
3025 TEST_f_b (isfinite, 0, 1);
3026 TEST_f_b (isfinite, minus_zero, 1);
3027 TEST_f_b (isfinite, 10, 1);
3028 TEST_f_b (isfinite, plus_infty, 0);
3029 TEST_f_b (isfinite, minus_infty, 0);
3030 TEST_f_b (isfinite, nan_value, 0);
3036 isnormal_test (void)
3040 TEST_f_b (isnormal, 0, 0);
3041 TEST_f_b (isnormal, minus_zero, 0);
3042 TEST_f_b (isnormal, 10, 1);
3043 TEST_f_b (isnormal, plus_infty, 0);
3044 TEST_f_b (isnormal, minus_infty, 0);
3045 TEST_f_b (isnormal, nan_value, 0);
3055 FUNC (sincos) (0, &s, &c);
3056 if (errno == ENOSYS)
3057 /* Required function not implemented. */
3060 if (errno == ENOSYS)
3061 /* Function not implemented. */
3066 /* j0 is the Bessel function of the first kind of order 0 */
3067 TEST_f_f (j0, nan_value, nan_value);
3068 TEST_f_f (j0, plus_infty, 0);
3069 TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
3070 TEST_f_f (j0, 0.0, 1.0);
3071 TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
3072 TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
3073 TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
3074 TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
3075 TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
3076 TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
3077 TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
3078 TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3079 TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3090 FUNC (sincos) (0, &s, &c);
3091 if (errno == ENOSYS)
3092 /* Required function not implemented. */
3095 if (errno == ENOSYS)
3096 /* Function not implemented. */
3099 /* j1 is the Bessel function of the first kind of order 1 */
3103 TEST_f_f (j1, nan_value, nan_value);
3104 TEST_f_f (j1, plus_infty, 0);
3106 TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
3107 TEST_f_f (j1, 0.0, 0.0);
3108 TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
3109 TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
3110 TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
3111 TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
3112 TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
3113 TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
3114 TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
3124 FUNC (sincos) (0, &s, &c);
3125 if (errno == ENOSYS)
3126 /* Required function not implemented. */
3129 if (errno == ENOSYS)
3130 /* Function not implemented. */
3133 /* jn is the Bessel function of the first kind of order n. */
3136 /* jn (0, x) == j0 (x) */
3137 TEST_ff_f (jn, 0, nan_value, nan_value);
3138 TEST_ff_f (jn, 0, plus_infty, 0);
3139 TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
3140 TEST_ff_f (jn, 0, 0.0, 1.0);
3141 TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
3142 TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
3143 TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
3144 TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
3145 TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
3146 TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
3147 TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
3148 TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3149 TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3151 /* jn (1, x) == j1 (x) */
3152 TEST_ff_f (jn, 1, nan_value, nan_value);
3153 TEST_ff_f (jn, 1, plus_infty, 0);
3154 TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
3155 TEST_ff_f (jn, 1, 0.0, 0.0);
3156 TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
3157 TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
3158 TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
3159 TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
3160 TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
3161 TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
3162 TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
3165 TEST_ff_f (jn, 3, nan_value, nan_value);
3166 TEST_ff_f (jn, 3, plus_infty, 0);
3168 TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
3169 TEST_ff_f (jn, 3, 0.0, 0.0);
3170 TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
3171 TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
3172 TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
3173 TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
3174 TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
3177 TEST_ff_f (jn, 10, nan_value, nan_value);
3178 TEST_ff_f (jn, 10, plus_infty, 0);
3180 TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
3181 TEST_ff_f (jn, 10, 0.0, 0.0);
3182 TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
3183 TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
3184 TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
3185 TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
3186 TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
3195 TEST_ff_f (ldexp, 0, 0, 0);
3196 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
3198 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
3199 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
3200 TEST_ff_f (ldexp, nan_value, 1, nan_value);
3202 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
3203 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
3205 /* ldexp (x, 0) == x. */
3206 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
3215 if (errno == ENOSYS)
3216 /* Function not implemented. */
3218 feclearexcept (FE_ALL_EXCEPT);
3222 TEST_f_f (lgamma, plus_infty, plus_infty);
3223 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3224 TEST_f_f (lgamma, nan_value, nan_value);
3226 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3227 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3228 TEST_f_f (lgamma, minus_infty, plus_infty);
3230 TEST_f_f1 (lgamma, 1, 0, 1);
3232 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3234 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3235 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3236 TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
3237 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
3246 /* XXX this test is incomplete. We need to have a way to specifiy
3247 the rounding method and test the critical cases. So far, only
3248 unproblematic numbers are tested. */
3252 TEST_f_l (lrint, 0.0, 0);
3253 TEST_f_l (lrint, minus_zero, 0);
3254 TEST_f_l (lrint, 0.2L, 0);
3255 TEST_f_l (lrint, -0.2L, 0);
3257 TEST_f_l (lrint, 1.4L, 1);
3258 TEST_f_l (lrint, -1.4L, -1);
3260 TEST_f_l (lrint, 8388600.3L, 8388600);
3261 TEST_f_l (lrint, -8388600.3L, -8388600);
3263 TEST_f_l (lrint, 1071930.0008, 1071930);
3265 TEST_f_l (lrint, 1073741824.01, 1073741824);
3266 # if LONG_MAX > 281474976710656
3267 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3278 /* XXX this test is incomplete. We need to have a way to specifiy
3279 the rounding method and test the critical cases. So far, only
3280 unproblematic numbers are tested. */
3284 TEST_f_L (llrint, 0.0, 0);
3285 TEST_f_L (llrint, minus_zero, 0);
3286 TEST_f_L (llrint, 0.2L, 0);
3287 TEST_f_L (llrint, -0.2L, 0);
3289 TEST_f_L (llrint, 1.4L, 1);
3290 TEST_f_L (llrint, -1.4L, -1);
3292 TEST_f_L (llrint, 8388600.3L, 8388600);
3293 TEST_f_L (llrint, -8388600.3L, -8388600);
3295 TEST_f_l (llrint, 1071930.0008, 1071930);
3297 /* Test boundary conditions. */
3299 TEST_f_L (llrint, 2097151.0,2097151LL);
3301 TEST_f_L (llrint, 8388608.0, 8388608LL);
3303 TEST_f_L (llrint, 16777216.0, 16777216LL);
3305 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3307 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3308 /* 0x1000000000000 */
3309 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3310 /* 0x10000000000000 */
3311 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3312 /* 0x10000080000000 */
3313 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3314 /* 0x20000000000000 */
3315 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3316 /* 0x80000000000000 */
3317 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3318 /* 0x100000000000000 */
3319 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3321 /* The input can only be represented in long double. */
3322 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3323 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3324 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3325 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3326 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3328 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3329 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3330 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3331 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3332 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3334 # if LDBL_MANT_DIG > 100
3335 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3336 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3337 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3338 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
3339 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
3340 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
3342 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3343 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3344 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3345 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
3346 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
3347 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
3350 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3351 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3352 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3353 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3354 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3356 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3357 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3358 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3359 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3360 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3362 # if LDBL_MANT_DIG > 100
3363 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3364 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3365 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3366 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
3367 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
3368 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
3370 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3371 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3372 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3373 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
3374 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
3375 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
3378 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3379 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3380 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3381 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3382 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3384 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3385 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3386 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3387 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3388 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3390 # if LDBL_MANT_DIG > 100
3391 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
3392 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
3393 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3394 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3395 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3396 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3397 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3398 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3399 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
3400 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
3401 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3402 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3410 llrint_test_tonearest (void)
3412 int save_round_mode;
3413 START (llrint_tonearest);
3415 save_round_mode = fegetround ();
3417 if (!fesetround (FE_TONEAREST))
3419 TEST_f_L (llrint, 0.0, 0);
3420 TEST_f_L (llrint, minus_zero, 0);
3421 TEST_f_L (llrint, 0.2L, 0);
3422 TEST_f_L (llrint, -0.2L, 0);
3424 TEST_f_L (llrint, 1.4L, 1);
3425 TEST_f_L (llrint, -1.4L, -1);
3427 TEST_f_L (llrint, 8388600.3L, 8388600);
3428 TEST_f_L (llrint, -8388600.3L, -8388600);
3430 TEST_f_l (llrint, 1071930.0008, 1071930);
3432 /* Test boundary conditions. */
3434 TEST_f_L (llrint, 2097151.0,2097151LL);
3436 TEST_f_L (llrint, 8388608.0, 8388608LL);
3438 TEST_f_L (llrint, 16777216.0, 16777216LL);
3440 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3442 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3443 /* 0x1000000000000 */
3444 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3445 /* 0x10000000000000 */
3446 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3447 /* 0x10000080000000 */
3448 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3449 /* 0x20000000000000 */
3450 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3451 /* 0x80000000000000 */
3452 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3453 /* 0x100000000000000 */
3454 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3456 /* The input can only be represented in long double. */
3457 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3458 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3459 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3460 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3461 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3463 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3464 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3465 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3466 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3467 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3469 # if LDBL_MANT_DIG > 100
3470 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3471 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3472 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3473 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
3474 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
3475 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
3477 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3478 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3479 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3480 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
3481 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
3482 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
3485 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3486 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3487 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3488 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3489 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3491 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3492 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3493 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3494 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3495 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3497 # if LDBL_MANT_DIG > 100
3498 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3499 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3500 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3501 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
3502 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
3503 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
3505 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3506 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3507 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3508 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
3509 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
3510 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
3513 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3514 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3515 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3516 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3517 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3519 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3520 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3521 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3522 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3523 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3525 # if LDBL_MANT_DIG > 100
3526 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
3527 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
3528 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3529 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3530 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3531 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3532 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3533 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3534 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
3535 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
3536 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3537 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3542 fesetround (save_round_mode);
3544 END (llrint_tonearest);
3548 llrint_test_towardzero (void)
3550 int save_round_mode;
3551 START (llrint_towardzero);
3553 save_round_mode = fegetround ();
3555 if (!fesetround (FE_TOWARDZERO))
3557 TEST_f_L (llrint, 0.0, 0);
3558 TEST_f_L (llrint, minus_zero, 0);
3559 TEST_f_L (llrint, 0.2L, 0);
3560 TEST_f_L (llrint, -0.2L, 0);
3562 TEST_f_L (llrint, 1.4L, 1);
3563 TEST_f_L (llrint, -1.4L, -1);
3565 TEST_f_L (llrint, 8388600.3L, 8388600);
3566 TEST_f_L (llrint, -8388600.3L, -8388600);
3568 TEST_f_l (llrint, 1071930.0008, 1071930);
3570 /* Test boundary conditions. */
3572 TEST_f_L (llrint, 2097151.0,2097151LL);
3574 TEST_f_L (llrint, 8388608.0, 8388608LL);
3576 TEST_f_L (llrint, 16777216.0, 16777216LL);
3578 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3580 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3581 /* 0x1000000000000 */
3582 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3583 /* 0x10000000000000 */
3584 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3585 /* 0x10000080000000 */
3586 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3587 /* 0x20000000000000 */
3588 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3589 /* 0x80000000000000 */
3590 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3591 /* 0x100000000000000 */
3592 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3594 /* The input can only be represented in long double. */
3595 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
3596 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3597 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3598 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
3599 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
3601 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
3602 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3603 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3604 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
3605 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
3607 # if LDBL_MANT_DIG > 100
3608 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3609 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3610 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3611 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
3612 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
3613 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
3615 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3616 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3617 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3618 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
3619 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
3620 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
3623 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
3624 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3625 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3626 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
3627 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
3629 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
3630 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3631 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3632 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
3633 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
3635 # if LDBL_MANT_DIG > 100
3636 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3637 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3638 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3639 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
3640 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
3641 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
3643 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3644 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3645 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3646 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
3647 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
3648 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
3651 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
3652 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3653 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3654 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
3655 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
3657 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
3658 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3659 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3660 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
3661 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
3663 # if LDBL_MANT_DIG > 100
3664 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
3665 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
3666 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3667 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3668 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3669 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3670 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3671 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3672 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
3673 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
3674 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3675 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3680 fesetround (save_round_mode);
3682 END (llrint_towardzero);
3686 llrint_test_downward (void)
3688 int save_round_mode;
3689 START (llrint_downward);
3691 save_round_mode = fegetround ();
3693 if (!fesetround (FE_DOWNWARD))
3695 TEST_f_L (llrint, 0.0, 0);
3696 TEST_f_L (llrint, minus_zero, 0);
3697 TEST_f_L (llrint, 0.2L, 0);
3698 TEST_f_L (llrint, -0.2L, -1);
3700 TEST_f_L (llrint, 1.4L, 1);
3701 TEST_f_L (llrint, -1.4L, -2);
3703 TEST_f_L (llrint, 8388600.3L, 8388600);
3704 TEST_f_L (llrint, -8388600.3L, -8388601);
3706 TEST_f_l (llrint, 1071930.0008, 1071930);
3708 /* Test boundary conditions. */
3710 TEST_f_L (llrint, 2097151.0,2097151LL);
3712 TEST_f_L (llrint, 8388608.0, 8388608LL);
3714 TEST_f_L (llrint, 16777216.0, 16777216LL);
3716 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3718 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3719 /* 0x1000000000000 */
3720 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3721 /* 0x10000000000000 */
3722 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3723 /* 0x10000080000000 */
3724 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3725 /* 0x20000000000000 */
3726 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3727 /* 0x80000000000000 */
3728 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3729 /* 0x100000000000000 */
3730 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3732 /* The input can only be represented in long double. */
3733 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
3734 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3735 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3736 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
3737 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
3739 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3740 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3741 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3742 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
3743 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
3744 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
3746 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3747 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
3748 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
3749 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3750 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3752 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
3753 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
3754 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
3755 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
3756 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
3757 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
3759 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
3760 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3761 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3762 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
3763 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
3765 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3766 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3767 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3768 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
3769 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
3770 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
3772 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3773 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
3774 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
3775 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3776 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3778 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
3779 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
3780 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
3781 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
3782 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
3783 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
3785 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
3786 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3787 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3788 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
3789 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
3791 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3792 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
3793 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
3794 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3795 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3797 # if LDBL_MANT_DIG > 100
3798 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
3799 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
3800 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3801 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3802 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3803 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
3804 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3805 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
3806 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
3807 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
3808 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3809 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3814 fesetround (save_round_mode);
3816 END (llrint_downward);
3820 llrint_test_upward (void)
3822 int save_round_mode;
3823 START (llrint_upward);
3825 save_round_mode = fegetround ();
3827 if (!fesetround (FE_UPWARD))
3829 TEST_f_L (llrint, 0.0, 0);
3830 TEST_f_L (llrint, minus_zero, 0);
3831 TEST_f_L (llrint, 0.2L, 1);
3832 TEST_f_L (llrint, -0.2L, 0);
3834 TEST_f_L (llrint, 1.4L, 2);
3835 TEST_f_L (llrint, -1.4L, -1);
3837 TEST_f_L (llrint, 8388600.3L, 8388601);
3838 TEST_f_L (llrint, -8388600.3L, -8388600);
3840 TEST_f_l (llrint, 1071930.0008, 1071931);
3842 /* Test boundary conditions. */
3844 TEST_f_L (llrint, 2097151.0,2097151LL);
3846 TEST_f_L (llrint, 8388608.0, 8388608LL);
3848 TEST_f_L (llrint, 16777216.0, 16777216LL);
3850 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3852 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3853 /* 0x1000000000000 */
3854 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3855 /* 0x10000000000000 */
3856 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3857 /* 0x10000080000000 */
3858 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3859 /* 0x20000000000000 */
3860 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3861 /* 0x80000000000000 */
3862 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3863 /* 0x100000000000000 */
3864 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3866 /* The input can only be represented in long double. */
3867 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3868 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
3869 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
3870 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3871 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3873 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
3874 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
3875 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
3876 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
3877 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
3878 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
3880 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
3881 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3882 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3883 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
3884 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
3886 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3887 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3888 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3889 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
3890 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
3891 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
3893 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3894 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
3895 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
3896 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3897 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3899 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
3900 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
3901 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
3902 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
3903 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
3904 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
3906 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
3907 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3908 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3909 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
3910 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
3912 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3913 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3914 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3915 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
3916 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
3917 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
3919 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3920 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
3921 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
3922 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3923 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3925 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
3926 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3927 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3928 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
3929 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
3931 # if LDBL_MANT_DIG > 100
3932 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
3933 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
3934 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3935 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3936 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
3937 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3938 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
3939 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3940 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
3941 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
3942 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3943 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3948 fesetround (save_round_mode);
3950 END (llrint_upward);
3959 if (errno == ENOSYS)
3960 /* Function not implemented. */
3964 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3965 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3967 TEST_f_f (log, 1, 0);
3969 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
3970 TEST_f_f (log, plus_infty, plus_infty);
3972 TEST_f_f (log, M_El, 1);
3973 TEST_f_f (log, 1.0 / M_El, -1);
3974 TEST_f_f (log, 2, M_LN2l);
3975 TEST_f_f (log, 10, M_LN10l);
3976 TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
3987 if (errno == ENOSYS)
3988 /* Function not implemented. */
3993 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3994 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3996 TEST_f_f (log10, 1, 0);
3998 /* log10 (x) == NaN plus invalid exception if x < 0. */
3999 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
4001 TEST_f_f (log10, plus_infty, plus_infty);
4002 TEST_f_f (log10, nan_value, nan_value);
4004 TEST_f_f (log10, 0.1L, -1);
4005 TEST_f_f (log10, 10.0, 1);
4006 TEST_f_f (log10, 100.0, 2);
4007 TEST_f_f (log10, 10000.0, 4);
4008 TEST_f_f (log10, M_El, M_LOG10El);
4009 TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
4020 if (errno == ENOSYS)
4021 /* Function not implemented. */
4026 TEST_f_f (log1p, 0, 0);
4027 TEST_f_f (log1p, minus_zero, minus_zero);
4029 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4030 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
4032 TEST_f_f (log1p, plus_infty, plus_infty);
4033 TEST_f_f (log1p, nan_value, nan_value);
4035 TEST_f_f (log1p, M_El - 1.0, 1);
4037 TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
4038 TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
4049 if (errno == ENOSYS)
4050 /* Function not implemented. */
4055 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4056 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4058 TEST_f_f (log2, 1, 0);
4060 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
4062 TEST_f_f (log2, plus_infty, plus_infty);
4063 TEST_f_f (log2, nan_value, nan_value);
4065 TEST_f_f (log2, M_El, M_LOG2El);
4066 TEST_f_f (log2, 2.0, 1);
4067 TEST_f_f (log2, 16.0, 4);
4068 TEST_f_f (log2, 256.0, 8);
4069 TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
4080 TEST_f_f (logb, plus_infty, plus_infty);
4081 TEST_f_f (logb, minus_infty, plus_infty);
4083 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4085 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4086 TEST_f_f (logb, nan_value, nan_value);
4088 TEST_f_f (logb, 1, 0);
4089 TEST_f_f (logb, M_El, 1);
4090 TEST_f_f (logb, 1024, 10);
4091 TEST_f_f (logb, -2000, 10);
4102 TEST_f_l (lround, 0, 0);
4103 TEST_f_l (lround, minus_zero, 0);
4104 TEST_f_l (lround, 0.2L, 0.0);
4105 TEST_f_l (lround, -0.2L, 0);
4106 TEST_f_l (lround, 0.5, 1);
4107 TEST_f_l (lround, -0.5, -1);
4108 TEST_f_l (lround, 0.8L, 1);
4109 TEST_f_l (lround, -0.8L, -1);
4110 TEST_f_l (lround, 1.5, 2);
4111 TEST_f_l (lround, -1.5, -2);
4112 TEST_f_l (lround, 22514.5, 22515);
4113 TEST_f_l (lround, -22514.5, -22515);
4114 TEST_f_l (lround, 1071930.0008, 1071930);
4116 TEST_f_l (lround, 1073741824.01, 1073741824);
4117 # if LONG_MAX > 281474976710656
4118 TEST_f_l (lround, 281474976710656.025, 281474976710656);
4120 TEST_f_l (lround, 2097152.5, 2097153);
4121 TEST_f_l (lround, -2097152.5, -2097153);
4132 TEST_f_L (llround, 0, 0);
4133 TEST_f_L (llround, minus_zero, 0);
4134 TEST_f_L (llround, 0.2L, 0.0);
4135 TEST_f_L (llround, -0.2L, 0);
4136 TEST_f_L (llround, 0.5, 1);
4137 TEST_f_L (llround, -0.5, -1);
4138 TEST_f_L (llround, 0.8L, 1);
4139 TEST_f_L (llround, -0.8L, -1);
4140 TEST_f_L (llround, 1.5, 2);
4141 TEST_f_L (llround, -1.5, -2);
4142 TEST_f_L (llround, 22514.5, 22515);
4143 TEST_f_L (llround, -22514.5, -22515);
4144 TEST_f_l (llround, 1071930.0008, 1071930);
4146 TEST_f_L (llround, 2097152.5, 2097153);
4147 TEST_f_L (llround, -2097152.5, -2097153);
4148 TEST_f_L (llround, 34359738368.5, 34359738369ll);
4149 TEST_f_L (llround, -34359738368.5, -34359738369ll);
4152 /* Test boundary conditions. */
4154 TEST_f_L (llround, 2097151.0, 2097151LL);
4156 TEST_f_L (llround, 8388608.0, 8388608LL);
4158 TEST_f_L (llround, 16777216.0, 16777216LL);
4160 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
4162 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
4163 /* 0x1000000000000 */
4164 TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
4165 /* 0x10000000000000 */
4166 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
4167 /* 0x10000080000000 */
4168 TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
4169 /* 0x20000000000000 */
4170 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
4171 /* 0x80000000000000 */
4172 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
4173 /* 0x100000000000000 */
4174 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
4178 TEST_f_L (llround, 4294967295.5, 4294967296LL);
4180 TEST_f_L (llround, 8589934591.5, 8589934592LL);
4184 /* The input can only be represented in long double. */
4185 TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
4186 TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
4187 TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
4188 TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
4189 TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
4191 # if LDBL_MANT_DIG > 100
4192 TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
4193 TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
4194 TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
4195 TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
4196 TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
4197 TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
4199 TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
4200 TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
4201 TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
4202 TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
4203 TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
4204 TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
4207 TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
4208 TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
4209 TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
4210 TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
4211 TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
4213 TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
4214 TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
4215 TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
4216 TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
4217 TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
4219 # if LDBL_MANT_DIG > 100
4220 TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
4221 TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
4222 TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
4223 TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
4224 TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
4225 TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
4227 TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
4228 TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
4229 TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
4230 TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
4231 TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
4232 TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
4235 TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
4236 TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
4237 TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
4238 TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
4239 TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
4241 TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
4242 TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
4243 TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
4244 TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
4245 TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
4247 TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
4248 TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
4249 TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
4250 TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
4251 TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
4253 TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
4254 TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
4255 TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
4256 TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
4257 TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
4258 TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
4271 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
4272 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
4273 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
4274 TEST_fF_f1 (modf, 0, 0, 0);
4275 TEST_fF_f1 (modf, 1.5, 0.5, 1);
4276 TEST_fF_f1 (modf, 2.5, 0.5, 2);
4277 TEST_fF_f1 (modf, -2.5, -0.5, -2);
4278 TEST_fF_f1 (modf, 20, 0, 20);
4279 TEST_fF_f1 (modf, 21, 0, 21);
4280 TEST_fF_f1 (modf, 89.5, 0.5, 89);
4287 nearbyint_test (void)
4291 TEST_f_f (nearbyint, 0.0, 0.0);
4292 TEST_f_f (nearbyint, minus_zero, minus_zero);
4293 TEST_f_f (nearbyint, plus_infty, plus_infty);
4294 TEST_f_f (nearbyint, minus_infty, minus_infty);
4295 TEST_f_f (nearbyint, nan_value, nan_value);
4297 /* Default rounding mode is round to nearest. */
4298 TEST_f_f (nearbyint, 0.5, 0.0);
4299 TEST_f_f (nearbyint, 1.5, 2.0);
4300 TEST_f_f (nearbyint, -0.5, minus_zero);
4301 TEST_f_f (nearbyint, -1.5, -2.0);
4307 nextafter_test (void)
4312 TEST_ff_f (nextafter, 0, 0, 0);
4313 TEST_ff_f (nextafter, minus_zero, 0, 0);
4314 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
4315 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
4317 TEST_ff_f (nextafter, 9, 9, 9);
4318 TEST_ff_f (nextafter, -9, -9, -9);
4319 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
4320 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
4322 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
4323 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
4324 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
4326 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
4327 LDBL_MAX, DBL_MAX, FLT_MAX);
4328 TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
4329 TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
4332 // XXX Enable once gcc is fixed.
4333 //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
4336 /* XXX We need the hexadecimal FP number representation here for further
4344 nexttoward_test (void)
4347 TEST_ff_f (nexttoward, 0, 0, 0);
4348 TEST_ff_f (nexttoward, minus_zero, 0, 0);
4349 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
4350 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
4352 TEST_ff_f (nexttoward, 9, 9, 9);
4353 TEST_ff_f (nexttoward, -9, -9, -9);
4354 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
4355 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
4357 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
4358 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
4359 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
4361 /* XXX We need the hexadecimal FP number representation here for further
4374 if (errno == ENOSYS)
4375 /* Function not implemented. */
4380 TEST_ff_f (pow, 0, 0, 1);
4381 TEST_ff_f (pow, 0, minus_zero, 1);
4382 TEST_ff_f (pow, minus_zero, 0, 1);
4383 TEST_ff_f (pow, minus_zero, minus_zero, 1);
4385 TEST_ff_f (pow, 10, 0, 1);
4386 TEST_ff_f (pow, 10, minus_zero, 1);
4387 TEST_ff_f (pow, -10, 0, 1);
4388 TEST_ff_f (pow, -10, minus_zero, 1);
4390 TEST_ff_f (pow, nan_value, 0, 1);
4391 TEST_ff_f (pow, nan_value, minus_zero, 1);
4395 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
4396 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
4397 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
4398 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
4400 TEST_ff_f (pow, 0.9L, plus_infty, 0);
4401 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
4402 TEST_ff_f (pow, -0.9L, plus_infty, 0);
4403 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
4405 TEST_ff_f (pow, 1.1L, minus_infty, 0);
4406 TEST_ff_f (pow, plus_infty, minus_infty, 0);
4407 TEST_ff_f (pow, -1.1L, minus_infty, 0);
4408 TEST_ff_f (pow, minus_infty, minus_infty, 0);
4410 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
4411 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
4412 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
4413 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
4415 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
4416 TEST_ff_f (pow, plus_infty, 1, plus_infty);
4417 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
4419 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
4420 TEST_ff_f (pow, plus_infty, -1, 0);
4421 TEST_ff_f (pow, plus_infty, -1e7L, 0);
4423 TEST_ff_f (pow, minus_infty, 1, minus_infty);
4424 TEST_ff_f (pow, minus_infty, 11, minus_infty);
4425 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
4427 TEST_ff_f (pow, minus_infty, 2, plus_infty);
4428 TEST_ff_f (pow, minus_infty, 12, plus_infty);
4429 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
4430 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
4431 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
4432 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
4433 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
4435 TEST_ff_f (pow, minus_infty, -1, minus_zero);
4436 TEST_ff_f (pow, minus_infty, -11, minus_zero);
4437 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
4439 TEST_ff_f (pow, minus_infty, -2, 0);
4440 TEST_ff_f (pow, minus_infty, -12, 0);
4441 TEST_ff_f (pow, minus_infty, -1002, 0);
4442 TEST_ff_f (pow, minus_infty, -0.1L, 0);
4443 TEST_ff_f (pow, minus_infty, -1.1L, 0);
4444 TEST_ff_f (pow, minus_infty, -11.1L, 0);
4445 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
4448 TEST_ff_f (pow, nan_value, nan_value, nan_value);
4449 TEST_ff_f (pow, 0, nan_value, nan_value);
4450 TEST_ff_f (pow, 1, nan_value, 1);
4451 TEST_ff_f (pow, -1, nan_value, nan_value);
4452 TEST_ff_f (pow, nan_value, 1, nan_value);
4453 TEST_ff_f (pow, nan_value, -1, nan_value);
4455 /* pow (x, NaN) == NaN. */
4456 TEST_ff_f (pow, 3.0, nan_value, nan_value);
4458 TEST_ff_f (pow, 1, plus_infty, 1);
4459 TEST_ff_f (pow, -1, plus_infty, 1);
4460 TEST_ff_f (pow, 1, minus_infty, 1);
4461 TEST_ff_f (pow, -1, minus_infty, 1);
4462 TEST_ff_f (pow, 1, 1, 1);
4463 TEST_ff_f (pow, 1, -1, 1);
4464 TEST_ff_f (pow, 1, 1.25, 1);
4465 TEST_ff_f (pow, 1, -1.25, 1);
4466 TEST_ff_f (pow, 1, 0x1p62L, 1);
4467 TEST_ff_f (pow, 1, 0x1p63L, 1);
4468 TEST_ff_f (pow, 1, 0x1p64L, 1);
4469 TEST_ff_f (pow, 1, 0x1p72L, 1);
4471 /* pow (x, +-0) == 1. */
4472 TEST_ff_f (pow, plus_infty, 0, 1);
4473 TEST_ff_f (pow, plus_infty, minus_zero, 1);
4474 TEST_ff_f (pow, minus_infty, 0, 1);
4475 TEST_ff_f (pow, minus_infty, minus_zero, 1);
4476 TEST_ff_f (pow, 32.75L, 0, 1);
4477 TEST_ff_f (pow, 32.75L, minus_zero, 1);
4478 TEST_ff_f (pow, -32.75L, 0, 1);
4479 TEST_ff_f (pow, -32.75L, minus_zero, 1);
4480 TEST_ff_f (pow, 0x1p72L, 0, 1);
4481 TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
4482 TEST_ff_f (pow, 0x1p-72L, 0, 1);
4483 TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
4485 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
4486 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
4487 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
4488 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
4490 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4491 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4492 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4493 TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4495 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4496 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4497 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4498 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4500 TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
4501 TEST_ff_f (pow, 10, -0x1p72L, 0);
4502 TEST_ff_f (pow, max_value, max_value, plus_infty);
4503 TEST_ff_f (pow, 10, -max_value, 0);
4505 TEST_ff_f (pow, 0, 1, 0);
4506 TEST_ff_f (pow, 0, 11, 0);
4508 TEST_ff_f (pow, minus_zero, 1, minus_zero);
4509 TEST_ff_f (pow, minus_zero, 11, minus_zero);
4512 TEST_ff_f (pow, 0, 2, 0);
4513 TEST_ff_f (pow, 0, 11.1L, 0);
4516 TEST_ff_f (pow, minus_zero, 2, 0);
4517 TEST_ff_f (pow, minus_zero, 11.1L, 0);
4518 TEST_ff_f (pow, 0, plus_infty, 0);
4519 TEST_ff_f (pow, minus_zero, plus_infty, 0);
4522 /* pow (x, +inf) == +inf for |x| > 1. */
4523 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
4525 /* pow (x, +inf) == +0 for |x| < 1. */
4526 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
4528 /* pow (x, -inf) == +0 for |x| > 1. */
4529 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
4531 /* pow (x, -inf) == +inf for |x| < 1. */
4532 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
4535 /* pow (+inf, y) == +inf for y > 0. */
4536 TEST_ff_f (pow, plus_infty, 2, plus_infty);
4538 /* pow (+inf, y) == +0 for y < 0. */
4539 TEST_ff_f (pow, plus_infty, -1, 0.0);
4541 /* pow (-inf, y) == -inf for y an odd integer > 0. */
4542 TEST_ff_f (pow, minus_infty, 27, minus_infty);
4544 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
4545 TEST_ff_f (pow, minus_infty, 28, plus_infty);
4547 /* pow (-inf, y) == -0 for y an odd integer < 0. */
4548 TEST_ff_f (pow, minus_infty, -3, minus_zero);
4549 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
4550 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
4552 /* pow (+0, y) == +0 for y an odd integer > 0. */
4553 TEST_ff_f (pow, 0.0, 27, 0.0);
4555 /* pow (-0, y) == -0 for y an odd integer > 0. */
4556 TEST_ff_f (pow, minus_zero, 27, minus_zero);
4558 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
4559 TEST_ff_f (pow, 0.0, 4, 0.0);
4561 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
4562 TEST_ff_f (pow, minus_zero, 4, 0.0);
4564 TEST_ff_f (pow, 16, 0.25L, 2);
4565 TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
4566 TEST_ff_f (pow, 2, 4, 16);
4567 TEST_ff_f (pow, 256, 8, 0x1p64L);
4569 TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
4571 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
4572 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
4579 remainder_test (void)
4582 FUNC(remainder) (1.625, 1.0);
4583 if (errno == ENOSYS)
4584 /* Function not implemented. */
4589 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
4590 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
4591 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
4592 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
4593 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
4595 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
4596 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
4597 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
4598 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
4599 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
4600 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
4612 FUNC(remquo) (1.625, 1.0, &x);
4613 if (errno == ENOSYS)
4614 /* Function not implemented. */
4619 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
4620 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
4621 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
4622 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
4623 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
4625 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
4626 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
4627 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
4628 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
4630 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
4631 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
4641 TEST_f_f (rint, 0.0, 0.0);
4642 TEST_f_f (rint, minus_zero, minus_zero);
4643 TEST_f_f (rint, plus_infty, plus_infty);
4644 TEST_f_f (rint, minus_infty, minus_infty);
4646 /* Default rounding mode is round to even. */
4647 TEST_f_f (rint, 0.5, 0.0);
4648 TEST_f_f (rint, 1.5, 2.0);
4649 TEST_f_f (rint, 2.5, 2.0);
4650 TEST_f_f (rint, 3.5, 4.0);
4651 TEST_f_f (rint, 4.5, 4.0);
4652 TEST_f_f (rint, -0.5, -0.0);
4653 TEST_f_f (rint, -1.5, -2.0);
4654 TEST_f_f (rint, -2.5, -2.0);
4655 TEST_f_f (rint, -3.5, -4.0);
4656 TEST_f_f (rint, -4.5, -4.0);
4657 TEST_f_f (rint, 0.1, 0.0);
4658 TEST_f_f (rint, 0.25, 0.0);
4659 TEST_f_f (rint, 0.625, 1.0);
4660 TEST_f_f (rint, -0.1, -0.0);
4661 TEST_f_f (rint, -0.25, -0.0);
4662 TEST_f_f (rint, -0.625, -1.0);
4664 /* The result can only be represented in long double. */
4665 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
4666 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
4667 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
4668 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
4669 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
4671 # if LDBL_MANT_DIG > 100
4672 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
4673 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
4674 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
4677 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
4678 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
4679 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
4680 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
4681 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
4683 # if LDBL_MANT_DIG > 100
4684 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
4685 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
4686 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
4688 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
4689 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
4690 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
4691 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
4692 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
4693 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
4695 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
4696 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
4697 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
4698 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
4699 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
4700 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
4703 TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
4704 TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
4705 TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
4706 TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
4707 TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
4709 TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
4710 TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
4711 TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
4712 TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
4713 TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
4715 TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
4716 TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
4717 TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
4718 TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
4719 TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
4721 TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
4722 TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
4723 TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
4724 TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
4725 TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
4727 TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
4728 TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
4729 TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
4730 TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
4731 TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
4738 rint_test_tonearest (void)
4740 int save_round_mode;
4741 START (rint_tonearest);
4743 save_round_mode = fegetround ();
4745 if (!fesetround (FE_TONEAREST))
4747 TEST_f_f (rint, 2.0, 2.0);
4748 TEST_f_f (rint, 1.5, 2.0);
4749 TEST_f_f (rint, 1.0, 1.0);
4750 TEST_f_f (rint, 0.5, 0.0);
4751 TEST_f_f (rint, 0.0, 0.0);
4752 TEST_f_f (rint, minus_zero, minus_zero);
4753 TEST_f_f (rint, -0.5, -0.0);
4754 TEST_f_f (rint, -1.0, -1.0);
4755 TEST_f_f (rint, -1.5, -2.0);
4756 TEST_f_f (rint, -2.0, -2.0);
4757 TEST_f_f (rint, 0.1, 0.0);
4758 TEST_f_f (rint, 0.25, 0.0);
4759 TEST_f_f (rint, 0.625, 1.0);
4760 TEST_f_f (rint, -0.1, -0.0);
4761 TEST_f_f (rint, -0.25, -0.0);
4762 TEST_f_f (rint, -0.625, -1.0);
4764 /* The result can only be represented in long double. */
4765 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
4766 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
4767 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
4768 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
4769 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
4770 # if LDBL_MANT_DIG > 100
4771 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
4772 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
4773 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
4775 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
4776 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
4777 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
4778 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
4779 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
4780 # if LDBL_MANT_DIG > 100
4781 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
4782 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
4783 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
4785 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
4786 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
4787 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
4788 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
4789 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
4790 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
4792 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
4793 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
4794 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
4795 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
4796 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
4797 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
4802 fesetround (save_round_mode);
4804 END (rint_tonearest);
4808 rint_test_towardzero (void)
4810 int save_round_mode;
4811 START (rint_towardzero);
4813 save_round_mode = fegetround ();
4815 if (!fesetround (FE_TOWARDZERO))
4817 TEST_f_f (rint, 2.0, 2.0);
4818 TEST_f_f (rint, 1.5, 1.0);
4819 TEST_f_f (rint, 1.0, 1.0);
4820 TEST_f_f (rint, 0.5, 0.0);
4821 TEST_f_f (rint, 0.0, 0.0);
4822 TEST_f_f (rint, minus_zero, minus_zero);
4823 TEST_f_f (rint, -0.5, -0.0);
4824 TEST_f_f (rint, -1.0, -1.0);
4825 TEST_f_f (rint, -1.5, -1.0);
4826 TEST_f_f (rint, -2.0, -2.0);
4827 TEST_f_f (rint, 0.1, 0.0);
4828 TEST_f_f (rint, 0.25, 0.0);
4829 TEST_f_f (rint, 0.625, 0.0);
4830 TEST_f_f (rint, -0.1, -0.0);
4831 TEST_f_f (rint, -0.25, -0.0);
4832 TEST_f_f (rint, -0.625, -0.0);
4834 /* The result can only be represented in long double. */
4835 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
4836 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
4837 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
4838 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
4839 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
4840 # if LDBL_MANT_DIG > 100
4841 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
4842 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
4843 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
4845 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
4846 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
4847 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
4848 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
4849 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
4850 # if LDBL_MANT_DIG > 100
4851 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
4852 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
4853 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
4855 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
4856 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
4857 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
4858 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
4859 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
4860 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
4862 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
4863 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
4864 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
4865 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
4866 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
4867 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
4872 fesetround (save_round_mode);
4874 END (rint_towardzero);
4878 rint_test_downward (void)
4880 int save_round_mode;
4881 START (rint_downward);
4883 save_round_mode = fegetround ();
4885 if (!fesetround (FE_DOWNWARD))
4887 TEST_f_f (rint, 2.0, 2.0);
4888 TEST_f_f (rint, 1.5, 1.0);
4889 TEST_f_f (rint, 1.0, 1.0);
4890 TEST_f_f (rint, 0.5, 0.0);
4891 TEST_f_f (rint, 0.0, 0.0);
4892 TEST_f_f (rint, minus_zero, minus_zero);
4893 TEST_f_f (rint, -0.5, -1.0);
4894 TEST_f_f (rint, -1.0, -1.0);
4895 TEST_f_f (rint, -1.5, -2.0);
4896 TEST_f_f (rint, -2.0, -2.0);
4897 TEST_f_f (rint, 0.1, 0.0);
4898 TEST_f_f (rint, 0.25, 0.0);
4899 TEST_f_f (rint, 0.625, 0.0);
4900 TEST_f_f (rint, -0.1, -1.0);
4901 TEST_f_f (rint, -0.25, -1.0);
4902 TEST_f_f (rint, -0.625, -1.0);
4904 /* The result can only be represented in long double. */
4905 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
4906 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
4907 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
4908 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
4909 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
4910 # if LDBL_MANT_DIG > 100
4911 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
4912 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
4913 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
4915 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
4916 TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
4917 TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
4918 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
4919 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
4920 # if LDBL_MANT_DIG > 100
4921 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
4922 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
4923 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
4925 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
4926 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
4927 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
4928 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
4929 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
4930 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
4932 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
4933 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
4934 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
4935 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
4936 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
4937 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
4942 fesetround (save_round_mode);
4944 END (rint_downward);
4948 rint_test_upward (void)
4950 int save_round_mode;
4951 START (rint_upward);
4953 save_round_mode = fegetround ();
4955 if (!fesetround (FE_UPWARD))
4957 TEST_f_f (rint, 2.0, 2.0);
4958 TEST_f_f (rint, 1.5, 2.0);
4959 TEST_f_f (rint, 1.0, 1.0);
4960 TEST_f_f (rint, 0.5, 1.0);
4961 TEST_f_f (rint, 0.0, 0.0);
4962 TEST_f_f (rint, minus_zero, minus_zero);
4963 TEST_f_f (rint, -0.5, -0.0);
4964 TEST_f_f (rint, -1.0, -1.0);
4965 TEST_f_f (rint, -1.5, -1.0);
4966 TEST_f_f (rint, -2.0, -2.0);
4967 TEST_f_f (rint, 0.1, 1.0);
4968 TEST_f_f (rint, 0.25, 1.0);
4969 TEST_f_f (rint, 0.625, 1.0);
4970 TEST_f_f (rint, -0.1, -0.0);
4971 TEST_f_f (rint, -0.25, -0.0);
4972 TEST_f_f (rint, -0.625, -0.0);
4974 /* The result can only be represented in long double. */
4975 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
4976 TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
4977 TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
4978 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
4979 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
4980 # if LDBL_MANT_DIG > 100
4981 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
4982 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
4983 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
4985 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
4986 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
4987 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
4988 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
4989 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
4990 # if LDBL_MANT_DIG > 100
4991 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
4992 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
4993 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
4995 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
4996 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
4997 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
4998 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
4999 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
5000 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
5002 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
5003 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
5004 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
5005 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
5006 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
5007 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
5012 fesetround (save_round_mode);
5022 TEST_f_f (round, 0, 0);
5023 TEST_f_f (round, minus_zero, minus_zero);
5024 TEST_f_f (round, 0.2L, 0.0);
5025 TEST_f_f (round, -0.2L, minus_zero);
5026 TEST_f_f (round, 0.5, 1.0);
5027 TEST_f_f (round, -0.5, -1.0);
5028 TEST_f_f (round, 0.8L, 1.0);
5029 TEST_f_f (round, -0.8L, -1.0);
5030 TEST_f_f (round, 1.5, 2.0);
5031 TEST_f_f (round, -1.5, -2.0);
5032 TEST_f_f (round, 0.1, 0.0);
5033 TEST_f_f (round, 0.25, 0.0);
5034 TEST_f_f (round, 0.625, 1.0);
5035 TEST_f_f (round, -0.1, -0.0);
5036 TEST_f_f (round, -0.25, -0.0);
5037 TEST_f_f (round, -0.625, -1.0);
5038 TEST_f_f (round, 2097152.5, 2097153);
5039 TEST_f_f (round, -2097152.5, -2097153);
5042 /* The result can only be represented in long double. */
5043 TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
5044 TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
5045 TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
5046 TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
5047 TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
5048 # if LDBL_MANT_DIG > 100
5049 TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L);
5050 TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L);
5051 TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
5054 TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
5055 TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
5056 TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
5057 TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
5058 TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
5059 # if LDBL_MANT_DIG > 100
5060 TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
5061 TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L);
5062 TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L);
5065 TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
5066 TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
5067 TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
5068 TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
5069 TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
5071 TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
5072 TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
5073 TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
5074 TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
5075 TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
5077 # if LDBL_MANT_DIG > 100
5078 TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L);
5079 TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L);
5080 TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L);
5081 TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L);
5082 TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L);
5083 TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L);
5085 TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L);
5086 TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L);
5087 TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L);
5088 TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L);
5089 TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L);
5090 TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L);
5093 TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
5094 TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
5095 TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
5096 TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
5097 TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
5099 TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
5100 TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
5101 TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
5102 TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
5103 TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
5105 TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
5106 TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
5107 TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
5108 TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
5109 TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
5122 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
5123 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
5125 TEST_ff_f (scalb, 0, nan_value, nan_value);
5126 TEST_ff_f (scalb, 1, nan_value, nan_value);
5128 TEST_ff_f (scalb, 1, 0, 1);
5129 TEST_ff_f (scalb, -1, 0, -1);
5131 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
5132 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
5134 TEST_ff_f (scalb, 0, 2, 0);
5135 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
5136 TEST_ff_f (scalb, 0, 0, 0);
5137 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
5138 TEST_ff_f (scalb, 0, -1, 0);
5139 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
5140 TEST_ff_f (scalb, 0, minus_infty, 0);
5141 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
5143 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
5144 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
5145 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
5146 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
5147 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
5148 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
5150 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
5151 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
5153 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
5154 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
5155 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
5156 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
5158 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
5159 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
5161 TEST_ff_f (scalb, nan_value, 1, nan_value);
5162 TEST_ff_f (scalb, 1, nan_value, nan_value);
5163 TEST_ff_f (scalb, nan_value, 0, nan_value);
5164 TEST_ff_f (scalb, 0, nan_value, nan_value);
5165 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
5166 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
5167 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
5169 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
5170 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
5182 TEST_fi_f (scalbn, 0, 0, 0);
5183 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
5185 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
5186 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
5187 TEST_fi_f (scalbn, nan_value, 1, nan_value);
5189 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
5190 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
5192 TEST_fi_f (scalbn, 1, 0L, 1);
5204 TEST_fl_f (scalbln, 0, 0, 0);
5205 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
5207 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
5208 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
5209 TEST_fl_f (scalbln, nan_value, 1, nan_value);
5211 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
5212 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
5214 TEST_fl_f (scalbln, 1, 0L, 1);
5226 TEST_f_b (signbit, 0, 0);
5227 TEST_f_b (signbit, minus_zero, 1);
5228 TEST_f_b (signbit, plus_infty, 0);
5229 TEST_f_b (signbit, minus_infty, 1);
5231 /* signbit (x) != 0 for x < 0. */
5232 TEST_f_b (signbit, -1, 1);
5233 /* signbit (x) == 0 for x >= 0. */
5234 TEST_f_b (signbit, 1, 0);
5245 if (errno == ENOSYS)
5246 /* Function not implemented. */
5251 TEST_f_f (sin, 0, 0);
5252 TEST_f_f (sin, minus_zero, minus_zero);
5253 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
5254 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
5255 TEST_f_f (sin, nan_value, nan_value);
5257 TEST_f_f (sin, M_PI_6l, 0.5);
5258 TEST_f_f (sin, -M_PI_6l, -0.5);
5259 TEST_f_f (sin, M_PI_2l, 1);
5260 TEST_f_f (sin, -M_PI_2l, -1);
5261 TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
5264 TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
5275 FLOAT sin_res, cos_res;
5278 FUNC(sincos) (0, &sin_res, &cos_res);
5279 if (errno == ENOSYS)
5280 /* Function not implemented. */
5285 /* sincos is treated differently because it returns void. */
5286 TEST_extra (sincos, 0, 0, 1);
5288 TEST_extra (sincos, minus_zero, minus_zero, 1);
5289 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
5290 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
5291 TEST_extra (sincos, nan_value, nan_value, nan_value);
5293 TEST_extra (sincos, M_PI_2l, 1, 0);
5294 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
5295 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
5296 TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
5299 TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
5310 if (errno == ENOSYS)
5311 /* Function not implemented. */
5315 TEST_f_f (sinh, 0, 0);
5316 TEST_f_f (sinh, minus_zero, minus_zero);
5319 TEST_f_f (sinh, plus_infty, plus_infty);
5320 TEST_f_f (sinh, minus_infty, minus_infty);
5322 TEST_f_f (sinh, nan_value, nan_value);
5324 TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
5325 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
5335 if (errno == ENOSYS)
5336 /* Function not implemented. */
5341 TEST_f_f (sqrt, 0, 0);
5342 TEST_f_f (sqrt, nan_value, nan_value);
5343 TEST_f_f (sqrt, plus_infty, plus_infty);
5345 TEST_f_f (sqrt, minus_zero, minus_zero);
5347 /* sqrt (x) == NaN plus invalid exception for x < 0. */
5348 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
5349 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
5350 TEST_f_f (sqrt, nan_value, nan_value);
5352 TEST_f_f (sqrt, 2209, 47);
5353 TEST_f_f (sqrt, 4, 2);
5354 TEST_f_f (sqrt, 2, M_SQRT2l);
5355 TEST_f_f (sqrt, 0.25, 0.5);
5356 TEST_f_f (sqrt, 6642.25, 81.5);
5357 TEST_f_f (sqrt, 15190.5625L, 123.25L);
5358 TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
5369 if (errno == ENOSYS)
5370 /* Function not implemented. */
5375 TEST_f_f (tan, 0, 0);
5376 TEST_f_f (tan, minus_zero, minus_zero);
5377 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
5378 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
5379 TEST_f_f (tan, nan_value, nan_value);
5381 TEST_f_f (tan, M_PI_4l, 1);
5382 TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
5392 if (errno == ENOSYS)
5393 /* Function not implemented. */
5398 TEST_f_f (tanh, 0, 0);
5399 TEST_f_f (tanh, minus_zero, minus_zero);
5402 TEST_f_f (tanh, plus_infty, 1);
5403 TEST_f_f (tanh, minus_infty, -1);
5405 TEST_f_f (tanh, nan_value, nan_value);
5407 TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
5408 TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
5410 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
5411 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
5414 TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
5424 if (errno == ENOSYS)
5425 /* Function not implemented. */
5427 feclearexcept (FE_ALL_EXCEPT);
5431 TEST_f_f (tgamma, plus_infty, plus_infty);
5432 TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5433 TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5434 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
5435 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
5436 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
5437 TEST_f_f (tgamma, nan_value, nan_value);
5439 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
5440 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
5442 TEST_f_f (tgamma, 1, 1);
5443 TEST_f_f (tgamma, 4, 6);
5445 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
5446 TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
5457 TEST_f_f (trunc, plus_infty, plus_infty);
5458 TEST_f_f (trunc, minus_infty, minus_infty);
5459 TEST_f_f (trunc, nan_value, nan_value);
5461 TEST_f_f (trunc, 0, 0);
5462 TEST_f_f (trunc, minus_zero, minus_zero);
5463 TEST_f_f (trunc, 0.1, 0);
5464 TEST_f_f (trunc, 0.25, 0);
5465 TEST_f_f (trunc, 0.625, 0);
5466 TEST_f_f (trunc, -0.1, minus_zero);
5467 TEST_f_f (trunc, -0.25, minus_zero);
5468 TEST_f_f (trunc, -0.625, minus_zero);
5469 TEST_f_f (trunc, 1, 1);
5470 TEST_f_f (trunc, -1, -1);
5471 TEST_f_f (trunc, 1.625, 1);
5472 TEST_f_f (trunc, -1.625, -1);
5474 TEST_f_f (trunc, 1048580.625L, 1048580L);
5475 TEST_f_f (trunc, -1048580.625L, -1048580L);
5477 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
5478 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
5480 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
5481 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
5484 /* The result can only be represented in long double. */
5485 TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
5486 TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
5487 TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
5488 TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
5489 TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
5491 # if LDBL_MANT_DIG > 100
5492 TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L);
5493 TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
5494 TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
5497 TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
5498 TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
5499 TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
5500 TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
5501 TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
5503 # if LDBL_MANT_DIG > 100
5504 TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
5505 TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
5506 TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L);
5509 TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
5510 TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
5511 TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
5512 TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
5513 TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
5515 # if LDBL_MANT_DIG > 100
5516 TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L);
5517 TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L);
5518 TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L);
5519 TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L);
5520 TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L);
5521 TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L);
5524 TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
5525 TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
5526 TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
5527 TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
5528 TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
5530 # if LDBL_MANT_DIG > 100
5531 TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L);
5532 TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L);
5533 TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L);
5534 TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L);
5535 TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L);
5536 TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L);
5539 TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
5540 TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
5541 TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
5542 TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
5543 TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
5545 TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
5546 TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
5547 TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
5548 TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
5549 TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
5551 TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
5552 TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
5553 TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
5554 TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
5555 TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
5566 FUNC (sincos) (0, &s, &c);
5567 if (errno == ENOSYS)
5568 /* Required function not implemented. */
5571 if (errno == ENOSYS)
5572 /* Function not implemented. */
5575 /* y0 is the Bessel function of the second kind of order 0 */
5578 TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
5579 TEST_f_f (y0, 0.0, minus_infty);
5580 TEST_f_f (y0, nan_value, nan_value);
5581 TEST_f_f (y0, plus_infty, 0);
5583 TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
5584 TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
5585 TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
5586 TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
5587 TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
5588 TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
5589 TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
5600 FUNC (sincos) (0, &s, &c);
5601 if (errno == ENOSYS)
5602 /* Required function not implemented. */
5605 if (errno == ENOSYS)
5606 /* Function not implemented. */
5609 /* y1 is the Bessel function of the second kind of order 1 */
5612 TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
5613 TEST_f_f (y1, 0.0, minus_infty);
5614 TEST_f_f (y1, plus_infty, 0);
5615 TEST_f_f (y1, nan_value, nan_value);
5617 TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
5618 TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
5619 TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
5620 TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
5621 TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
5622 TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
5623 TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
5634 FUNC (sincos) (0, &s, &c);
5635 if (errno == ENOSYS)
5636 /* Required function not implemented. */
5639 if (errno == ENOSYS)
5640 /* Function not implemented. */
5643 /* yn is the Bessel function of the second kind of order n */
5646 /* yn (0, x) == y0 (x) */
5647 TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
5648 TEST_ff_f (yn, 0, 0.0, minus_infty);
5649 TEST_ff_f (yn, 0, nan_value, nan_value);
5650 TEST_ff_f (yn, 0, plus_infty, 0);
5652 TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
5653 TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
5654 TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
5655 TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
5656 TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
5657 TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
5658 TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
5660 /* yn (1, x) == y1 (x) */
5661 TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
5662 TEST_ff_f (yn, 1, 0.0, minus_infty);
5663 TEST_ff_f (yn, 1, plus_infty, 0);
5664 TEST_ff_f (yn, 1, nan_value, nan_value);
5666 TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
5667 TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
5668 TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
5669 TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
5670 TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
5671 TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
5672 TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
5675 TEST_ff_f (yn, 3, plus_infty, 0);
5676 TEST_ff_f (yn, 3, nan_value, nan_value);
5678 TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
5679 TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
5680 TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
5681 TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
5682 TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
5685 TEST_ff_f (yn, 10, plus_infty, 0);
5686 TEST_ff_f (yn, 10, nan_value, nan_value);
5688 TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
5689 TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
5690 TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
5691 TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
5692 TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
5700 significand_test (void)
5702 /* significand returns the mantissa of the exponential representation. */
5703 START (significand);
5705 TEST_f_f (significand, 4.0, 1.0);
5706 TEST_f_f (significand, 6.0, 1.5);
5707 TEST_f_f (significand, 8.0, 1.0);
5716 fpstack_test ("start *init*");
5718 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
5720 minus_zero = FUNC(copysign) (0.0, -1.0);
5721 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
5722 HUGE_VALL, HUGE_VAL, HUGE_VALF);
5723 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
5724 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
5725 max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
5726 LDBL_MAX, DBL_MAX, FLT_MAX);
5727 min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
5728 LDBL_MIN, DBL_MIN, FLT_MIN);
5734 (void) &minus_infty;
5738 /* Clear all exceptions. From now on we must not get random exceptions. */
5739 feclearexcept (FE_ALL_EXCEPT);
5741 /* Test to make sure we start correctly. */
5742 fpstack_test ("end *init*");
5745 /* Definitions of arguments for argp functions. */
5746 static const struct argp_option options[] =
5748 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
5749 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
5750 { "no-max-error", 'f', NULL, 0,
5751 "Don't output maximal errors of functions"},
5752 { "no-points", 'p', NULL, 0,
5753 "Don't output results of functions invocations"},
5754 { "ignore-max-ulp", 'i', "yes/no", 0,
5755 "Ignore given maximal errors"},
5756 { NULL, 0, NULL, 0, NULL }
5759 /* Short description of program. */
5760 static const char doc[] = "Math test suite: " TEST_MSG ;
5762 /* Prototype for option handler. */
5763 static error_t parse_opt (int key, char *arg, struct argp_state *state);
5765 /* Data structure to communicate with argp functions. */
5766 static struct argp argp =
5768 options, parse_opt, NULL, doc,
5772 /* Handle program arguments. */
5774 parse_opt (int key, char *arg, struct argp_state *state)
5779 output_max_error = 0;
5782 if (strcmp (arg, "yes") == 0)
5784 else if (strcmp (arg, "no") == 0)
5795 verbose = (unsigned int) strtoul (optarg, NULL, 0);
5800 return ARGP_ERR_UNKNOWN;
5806 /* function to check our ulp calculation. */
5813 /* This gives one ulp. */
5814 u = FUNC(nextafter) (10, 20);
5815 check_equal (10.0, u, 1, &diff, &ulp);
5816 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
5818 /* This gives one more ulp. */
5819 u = FUNC(nextafter) (u, 20);
5820 check_equal (10.0, u, 2, &diff, &ulp);
5821 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
5823 /* And now calculate 100 ulp. */
5824 for (i = 2; i < 100; i++)
5825 u = FUNC(nextafter) (u, 20);
5826 check_equal (10.0, u, 100, &diff, &ulp);
5827 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
5832 main (int argc, char **argv)
5839 output_max_error = 1;
5841 /* XXX set to 0 for releases. */
5844 /* Parse and process arguments. */
5845 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
5847 if (remaining != argc)
5849 fprintf (stderr, "wrong number of arguments");
5850 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
5851 exit (EXIT_FAILURE);
5856 ulps_file = fopen ("ULPs", "a");
5857 if (ulps_file == NULL)
5859 perror ("can't open file `ULPs' for writing: ");
5872 /* Keep the tests a wee bit ordered (according to ISO C99). */
5873 /* Classification macros: */
5879 /* Trigonometric functions: */
5889 /* Hyperbolic functions: */
5897 /* Exponential and logarithmic functions: */
5914 significand_test ();
5916 /* Power and absolute value functions: */
5923 /* Error and gamma functions: */
5930 /* Nearest integer functions: */
5935 rint_test_tonearest ();
5936 rint_test_towardzero ();
5937 rint_test_downward ();
5938 rint_test_upward ();
5941 llrint_test_tonearest ();
5942 llrint_test_towardzero ();
5943 llrint_test_downward ();
5944 llrint_test_upward ();
5950 /* Remainder functions: */
5955 /* Manipulation functions: */
5960 /* maximum, minimum and positive difference functions */
5965 /* Multiply and add: */
5968 /* Complex functions: */
5993 /* Bessel functions: */
6004 printf ("\nTest suite completed:\n");
6005 printf (" %d test cases plus %d tests for exception flags executed.\n",
6006 noTests, noExcTests);
6008 printf (" %d expected failures occurred.\n", noXFails);
6010 printf (" %d unexpected passes occurred.\n", noXPasses);
6013 printf (" %d errors occurred.\n", noErrors);
6016 printf (" All tests passed successfully.\n");