1 /* Copyright (C) 1997-2006, 2007, 2009, 2010, 2011 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 switch (fpclassify (expected))
493 /* ilogb (0) isn't allowed. */
494 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
497 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
500 ulp = (FUNC(ldexp) (diff, MANT_DIG)
501 / FUNC(ldexp) (1.0, FUNC(ilogb) (expected)));
504 /* It should never happen. */
508 set_max_error (ulp, curr_max_error);
510 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
511 && computed == 0.0 && expected == 0.0
512 && signbit(computed) != signbit (expected))
514 else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
519 print_ulps (test_name, ulp);
523 if (print_screen (ok, xfail))
526 printf ("Failure: ");
527 printf ("Test: %s\n", test_name);
528 printf ("Result:\n");
529 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
531 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
535 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
537 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
538 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
541 update_stats (ok, xfail);
543 fpstack_test (test_name);
548 check_float (const char *test_name, FLOAT computed, FLOAT expected,
549 FLOAT max_ulp, int xfail, int exceptions)
551 check_float_internal (test_name, computed, expected, max_ulp, xfail,
552 exceptions, &max_error);
557 check_complex (const char *test_name, __complex__ FLOAT computed,
558 __complex__ FLOAT expected,
559 __complex__ FLOAT max_ulp, __complex__ int xfail,
562 FLOAT part_comp, part_exp, part_max_ulp;
566 sprintf (str, "Real part of: %s", test_name);
567 part_comp = __real__ computed;
568 part_exp = __real__ expected;
569 part_max_ulp = __real__ max_ulp;
570 part_xfail = __real__ xfail;
572 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
573 exception, &real_max_error);
575 sprintf (str, "Imaginary part of: %s", test_name);
576 part_comp = __imag__ computed;
577 part_exp = __imag__ expected;
578 part_max_ulp = __imag__ max_ulp;
579 part_xfail = __imag__ xfail;
581 /* Don't check again for exceptions, just pass through the
582 zero/inf sign test. */
583 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
584 exception & IGNORE_ZERO_INF_SIGN,
589 /* Check that computed and expected values are equal (int values). */
591 check_int (const char *test_name, int computed, int expected, int max_ulp,
592 int xfail, int exceptions)
594 int diff = computed - expected;
597 test_exceptions (test_name, exceptions);
599 if (abs (diff) <= max_ulp)
603 print_ulps (test_name, diff);
605 if (print_screen (ok, xfail))
608 printf ("Failure: ");
609 printf ("Test: %s\n", test_name);
610 printf ("Result:\n");
611 printf (" is: %d\n", computed);
612 printf (" should be: %d\n", expected);
615 update_stats (ok, xfail);
616 fpstack_test (test_name);
620 /* Check that computed and expected values are equal (long int values). */
622 check_long (const char *test_name, long int computed, long int expected,
623 long int max_ulp, int xfail, int exceptions)
625 long int diff = computed - expected;
628 test_exceptions (test_name, exceptions);
630 if (labs (diff) <= max_ulp)
634 print_ulps (test_name, diff);
636 if (print_screen (ok, xfail))
639 printf ("Failure: ");
640 printf ("Test: %s\n", test_name);
641 printf ("Result:\n");
642 printf (" is: %ld\n", computed);
643 printf (" should be: %ld\n", expected);
646 update_stats (ok, xfail);
647 fpstack_test (test_name);
651 /* Check that computed value is true/false. */
653 check_bool (const char *test_name, int computed, int expected,
654 long int max_ulp, int xfail, int exceptions)
658 test_exceptions (test_name, exceptions);
660 if ((computed == 0) == (expected == 0))
663 if (print_screen (ok, xfail))
666 printf ("Failure: ");
667 printf ("Test: %s\n", test_name);
668 printf ("Result:\n");
669 printf (" is: %d\n", computed);
670 printf (" should be: %d\n", expected);
673 update_stats (ok, xfail);
674 fpstack_test (test_name);
678 /* check that computed and expected values are equal (long int values) */
680 check_longlong (const char *test_name, long long int computed,
681 long long int expected,
682 long long int max_ulp, int xfail,
685 long long int diff = computed - expected;
688 test_exceptions (test_name, exceptions);
690 if (llabs (diff) <= max_ulp)
694 print_ulps (test_name, diff);
696 if (print_screen (ok, xfail))
700 printf ("Test: %s\n", test_name);
701 printf ("Result:\n");
702 printf (" is: %lld\n", computed);
703 printf (" should be: %lld\n", expected);
706 update_stats (ok, xfail);
707 fpstack_test (test_name);
712 /* This is to prevent messages from the SVID libm emulation. */
714 matherr (struct exception *x __attribute__ ((unused)))
720 /****************************************************************************
721 Tests for single functions of libm.
722 Please keep them alphabetically sorted!
723 ****************************************************************************/
731 /* Function not implemented. */
736 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
737 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
738 TEST_f_f (acos, nan_value, nan_value);
741 TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
742 TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
744 TEST_f_f (acos, 0, M_PI_2l);
745 TEST_f_f (acos, minus_zero, M_PI_2l);
746 TEST_f_f (acos, 1, 0);
747 TEST_f_f (acos, -1, M_PIl);
748 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
749 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
750 TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
751 TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
752 TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
762 /* Function not implemented. */
767 TEST_f_f (acosh, plus_infty, plus_infty);
768 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
771 TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
773 TEST_f_f (acosh, 1, 0);
774 TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
785 /* Function not implemented. */
790 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
791 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
792 TEST_f_f (asin, nan_value, nan_value);
794 /* asin x == NaN plus invalid exception for |x| > 1. */
795 TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
796 TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
798 TEST_f_f (asin, 0, 0);
799 TEST_f_f (asin, minus_zero, minus_zero);
800 TEST_f_f (asin, 0.5, M_PI_6l);
801 TEST_f_f (asin, -0.5, -M_PI_6l);
802 TEST_f_f (asin, 1.0, M_PI_2l);
803 TEST_f_f (asin, -1.0, -M_PI_2l);
804 TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
815 /* Function not implemented. */
820 TEST_f_f (asinh, 0, 0);
821 TEST_f_f (asinh, minus_zero, minus_zero);
823 TEST_f_f (asinh, plus_infty, plus_infty);
824 TEST_f_f (asinh, minus_infty, minus_infty);
826 TEST_f_f (asinh, nan_value, nan_value);
827 TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
838 /* Function not implemented. */
843 TEST_f_f (atan, 0, 0);
844 TEST_f_f (atan, minus_zero, minus_zero);
846 TEST_f_f (atan, plus_infty, M_PI_2l);
847 TEST_f_f (atan, minus_infty, -M_PI_2l);
848 TEST_f_f (atan, nan_value, nan_value);
850 TEST_f_f (atan, 1, M_PI_4l);
851 TEST_f_f (atan, -1, -M_PI_4l);
853 TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
866 /* Function not implemented. */
872 TEST_f_f (atanh, 0, 0);
873 TEST_f_f (atanh, minus_zero, minus_zero);
875 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
876 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
877 TEST_f_f (atanh, nan_value, nan_value);
879 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
880 TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
881 TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
883 TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
894 /* Function not implemented. */
899 /* atan2 (0,x) == 0 for x > 0. */
900 TEST_ff_f (atan2, 0, 1, 0);
902 /* atan2 (-0,x) == -0 for x > 0. */
903 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
905 TEST_ff_f (atan2, 0, 0, 0);
906 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
908 /* atan2 (+0,x) == +pi for x < 0. */
909 TEST_ff_f (atan2, 0, -1, M_PIl);
911 /* atan2 (-0,x) == -pi for x < 0. */
912 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
914 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
915 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
917 /* atan2 (y,+0) == pi/2 for y > 0. */
918 TEST_ff_f (atan2, 1, 0, M_PI_2l);
920 /* atan2 (y,-0) == pi/2 for y > 0. */
921 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
923 /* atan2 (y,+0) == -pi/2 for y < 0. */
924 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
926 /* atan2 (y,-0) == -pi/2 for y < 0. */
927 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
929 /* atan2 (y,inf) == +0 for finite y > 0. */
930 TEST_ff_f (atan2, 1, plus_infty, 0);
932 /* atan2 (y,inf) == -0 for finite y < 0. */
933 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
935 /* atan2(+inf, x) == pi/2 for finite x. */
936 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
938 /* atan2(-inf, x) == -pi/2 for finite x. */
939 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
941 /* atan2 (y,-inf) == +pi for finite y > 0. */
942 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
944 /* atan2 (y,-inf) == -pi for finite y < 0. */
945 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
947 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
948 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
949 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
950 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
951 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
953 TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
954 TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
955 TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
956 TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
957 TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
958 TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
960 TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
969 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
971 /* Function not implemented. */
976 /* cabs (x + iy) is specified as hypot (x,y) */
978 /* cabs (+inf + i x) == +inf. */
979 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
980 /* cabs (-inf + i x) == +inf. */
981 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
983 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
984 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
986 TEST_c_f (cabs, nan_value, nan_value, nan_value);
988 /* cabs (x,y) == cabs (y,x). */
989 TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
990 /* cabs (x,y) == cabs (-x,y). */
991 TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
992 /* cabs (x,y) == cabs (-y,x). */
993 TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
994 /* cabs (x,y) == cabs (-x,-y). */
995 TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
996 /* cabs (x,y) == cabs (-y,-x). */
997 TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
998 /* cabs (x,0) == fabs (x). */
999 TEST_c_f (cabs, -0.75L, 0, 0.75L);
1000 TEST_c_f (cabs, 0.75L, 0, 0.75L);
1001 TEST_c_f (cabs, -1.0L, 0, 1.0L);
1002 TEST_c_f (cabs, 1.0L, 0, 1.0L);
1003 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
1004 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
1006 TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
1016 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1017 if (errno == ENOSYS)
1018 /* Function not implemented. */
1024 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
1025 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
1026 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
1027 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1029 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1030 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1032 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1033 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1035 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1036 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1037 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1038 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1039 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1040 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1042 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1043 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1044 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1045 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1047 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1048 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1049 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1050 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1052 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1053 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1055 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1056 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1058 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1059 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1061 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1062 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1064 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1065 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1067 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1069 TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
1070 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1072 END (cacos, complex);
1079 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1080 if (errno == ENOSYS)
1081 /* Function not implemented. */
1087 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1088 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1089 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1090 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1091 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1092 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1094 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1095 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1097 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1098 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1099 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1100 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1101 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1102 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1104 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1105 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1106 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1107 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1109 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1110 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1111 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1112 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1114 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1115 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1117 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1118 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1120 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1121 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1123 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1124 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1126 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1127 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1129 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1131 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
1132 TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
1134 END (cacosh, complex);
1143 /* carg (x + iy) is specified as atan2 (y, x) */
1145 /* carg (x + i 0) == 0 for x > 0. */
1146 TEST_c_f (carg, 2.0, 0, 0);
1147 /* carg (x - i 0) == -0 for x > 0. */
1148 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1150 TEST_c_f (carg, 0, 0, 0);
1151 TEST_c_f (carg, 0, minus_zero, minus_zero);
1153 /* carg (x + i 0) == +pi for x < 0. */
1154 TEST_c_f (carg, -2.0, 0, M_PIl);
1156 /* carg (x - i 0) == -pi for x < 0. */
1157 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1159 TEST_c_f (carg, minus_zero, 0, M_PIl);
1160 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1162 /* carg (+0 + i y) == pi/2 for y > 0. */
1163 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1165 /* carg (-0 + i y) == pi/2 for y > 0. */
1166 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1168 /* carg (+0 + i y) == -pi/2 for y < 0. */
1169 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1171 /* carg (-0 + i y) == -pi/2 for y < 0. */
1172 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1174 /* carg (inf + i y) == +0 for finite y > 0. */
1175 TEST_c_f (carg, plus_infty, 2.0, 0);
1177 /* carg (inf + i y) == -0 for finite y < 0. */
1178 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1180 /* carg(x + i inf) == pi/2 for finite x. */
1181 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1183 /* carg(x - i inf) == -pi/2 for finite x. */
1184 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1186 /* carg (-inf + i y) == +pi for finite y > 0. */
1187 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1189 /* carg (-inf + i y) == -pi for finite y < 0. */
1190 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1192 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1194 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1196 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1198 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1200 TEST_c_f (carg, nan_value, nan_value, nan_value);
1209 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1210 if (errno == ENOSYS)
1211 /* Function not implemented. */
1216 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1217 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1218 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1219 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1221 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1222 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1223 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1224 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1226 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1227 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1228 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1229 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1230 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1231 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1232 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1233 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1235 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1236 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1237 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1238 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1240 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1241 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1242 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1243 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1245 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1246 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1248 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1249 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1251 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1252 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1254 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1255 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1257 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1258 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1260 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1262 TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
1263 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1265 END (casin, complex);
1273 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1274 if (errno == ENOSYS)
1275 /* Function not implemented. */
1280 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1281 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1282 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1283 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1285 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1286 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1287 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1288 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1290 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1291 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1292 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1293 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1294 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1295 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1296 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1297 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1299 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1300 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1301 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1302 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1304 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1305 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1306 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1307 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1309 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1310 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1312 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1313 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1315 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1316 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1318 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1319 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1321 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1322 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1324 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1326 TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
1327 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1329 END (casinh, complex);
1337 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1338 if (errno == ENOSYS)
1339 /* Function not implemented. */
1344 TEST_c_c (catan, 0, 0, 0, 0);
1345 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1346 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1347 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1349 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1350 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1351 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1352 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1355 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1356 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1357 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1358 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1359 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1360 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1361 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1362 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1364 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1365 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1366 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1367 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1369 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1370 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1371 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1372 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1374 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1375 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1377 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1378 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1380 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1381 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1383 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1384 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1386 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1387 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1389 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1390 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1392 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1394 TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
1395 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1397 END (catan, complex);
1404 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1405 if (errno == ENOSYS)
1406 /* Function not implemented. */
1411 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1412 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1413 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1414 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1416 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1417 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1418 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1419 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1421 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1422 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1423 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1424 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1425 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1426 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1427 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1428 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1430 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1431 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1432 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1433 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1435 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1436 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1437 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1438 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1440 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1441 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1443 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1444 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1446 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1447 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1449 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1450 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1452 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1453 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1455 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1456 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1458 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1460 TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
1461 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1463 END (catanh, complex);
1471 if (errno == ENOSYS)
1472 /* Function not implemented. */
1477 TEST_f_f (cbrt, 0.0, 0.0);
1478 TEST_f_f (cbrt, minus_zero, minus_zero);
1480 TEST_f_f (cbrt, plus_infty, plus_infty);
1481 TEST_f_f (cbrt, minus_infty, minus_infty);
1482 TEST_f_f (cbrt, nan_value, nan_value);
1484 TEST_f_f (cbrt, -0.001L, -0.1L);
1485 TEST_f_f (cbrt, 8, 2);
1486 TEST_f_f (cbrt, -27.0, -3.0);
1487 TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
1488 TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
1498 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1499 if (errno == ENOSYS)
1500 /* Function not implemented. */
1505 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1506 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1507 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1508 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1510 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1511 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1512 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1513 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1515 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1516 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1517 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1518 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1520 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1521 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1522 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1523 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1525 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1526 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1527 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1528 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1530 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1531 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1532 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1533 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1535 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1536 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1538 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1539 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1541 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1542 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1544 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1545 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1547 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1548 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1550 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1551 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1553 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1555 TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
1556 TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
1558 END (ccos, complex);
1566 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1567 if (errno == ENOSYS)
1568 /* Function not implemented. */
1573 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1574 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1575 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1576 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1578 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1579 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1580 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1581 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1583 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1584 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1585 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1586 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1588 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1589 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1590 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1591 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1593 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1594 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1595 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1596 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1598 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1599 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1600 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1601 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1603 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1604 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1606 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1607 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1609 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1610 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1612 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1613 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1615 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1616 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1618 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1619 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1621 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
1623 TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
1625 TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
1627 END (ccosh, complex);
1636 TEST_f_f (ceil, 0.0, 0.0);
1637 TEST_f_f (ceil, minus_zero, minus_zero);
1638 TEST_f_f (ceil, plus_infty, plus_infty);
1639 TEST_f_f (ceil, minus_infty, minus_infty);
1640 TEST_f_f (ceil, nan_value, nan_value);
1642 TEST_f_f (ceil, M_PIl, 4.0);
1643 TEST_f_f (ceil, -M_PIl, -3.0);
1644 TEST_f_f (ceil, 0.1, 1.0);
1645 TEST_f_f (ceil, 0.25, 1.0);
1646 TEST_f_f (ceil, 0.625, 1.0);
1647 TEST_f_f (ceil, -0.1, minus_zero);
1648 TEST_f_f (ceil, -0.25, minus_zero);
1649 TEST_f_f (ceil, -0.625, minus_zero);
1652 /* The result can only be represented in long double. */
1653 TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
1654 TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
1655 TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
1656 TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
1657 TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
1659 TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
1660 TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
1661 TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
1662 TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
1663 TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
1665 # if LDBL_MANT_DIG > 100
1666 TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L);
1667 TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L);
1668 TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L);
1669 TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L);
1670 TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L);
1671 TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L);
1674 TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
1675 TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
1676 TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
1677 TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
1678 TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
1680 TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
1681 TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
1682 TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
1683 TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
1684 TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
1686 # if LDBL_MANT_DIG > 100
1687 TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L);
1688 TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L);
1689 TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L);
1690 TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L);
1691 TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L);
1692 TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L);
1694 TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L);
1695 TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L);
1696 TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L);
1697 TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L);
1698 TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L);
1699 TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L);
1702 TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
1703 TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
1704 TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
1705 TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
1706 TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
1708 TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
1709 TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
1710 TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
1711 TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
1712 TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
1714 TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
1715 TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
1716 TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
1717 TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
1718 TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
1729 FUNC(cexp) (BUILD_COMPLEX (0, 0));
1730 if (errno == ENOSYS)
1731 /* Function not implemented. */
1736 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
1737 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
1738 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
1739 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
1741 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
1742 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
1744 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
1745 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
1747 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1748 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1750 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1751 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1753 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1754 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1756 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1757 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1759 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
1760 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
1761 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
1762 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
1764 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1765 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1767 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
1768 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
1770 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
1772 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
1774 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1775 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1777 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
1778 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1779 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1780 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
1782 TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
1783 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
1785 END (cexp, complex);
1793 TEST_c_f (cimag, 1.0, 0.0, 0.0);
1794 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
1795 TEST_c_f (cimag, 1.0, nan_value, nan_value);
1796 TEST_c_f (cimag, nan_value, nan_value, nan_value);
1797 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
1798 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
1799 TEST_c_f (cimag, 2.0, 3.0, 3.0);
1808 FUNC(clog) (BUILD_COMPLEX (-2, -3));
1809 if (errno == ENOSYS)
1810 /* Function not implemented. */
1815 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1816 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1818 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1819 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1821 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
1822 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1824 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
1825 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1827 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
1828 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
1829 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
1830 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
1831 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
1832 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
1833 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
1834 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
1836 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
1837 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
1838 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
1839 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
1841 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
1842 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
1843 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
1844 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
1846 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
1847 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
1849 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
1850 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
1852 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1853 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1854 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1855 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1857 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1858 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1859 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1860 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1862 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
1864 TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
1865 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
1867 END (clog, complex);
1875 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1876 if (errno == ENOSYS)
1877 /* Function not implemented. */
1882 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1883 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
1885 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
1886 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
1888 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
1890 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
1891 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
1893 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
1894 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
1895 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
1896 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
1897 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
1898 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
1899 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
1900 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
1902 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
1903 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
1904 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
1905 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
1907 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
1908 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
1909 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
1910 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
1912 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
1913 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
1915 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
1916 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
1918 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1919 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1920 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1921 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1923 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1924 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1925 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
1926 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1928 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
1930 TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
1931 TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
1933 END (clog10, complex);
1941 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
1942 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
1943 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
1944 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
1945 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
1946 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
1947 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
1949 END (conj, complex);
1954 copysign_test (void)
1958 TEST_ff_f (copysign, 0, 4, 0);
1959 TEST_ff_f (copysign, 0, -4, minus_zero);
1960 TEST_ff_f (copysign, minus_zero, 4, 0);
1961 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
1963 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
1964 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
1965 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
1966 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
1968 TEST_ff_f (copysign, 0, plus_infty, 0);
1969 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
1970 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
1971 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
1973 /* XXX More correctly we would have to check the sign of the NaN. */
1974 TEST_ff_f (copysign, nan_value, 0, nan_value);
1975 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
1976 TEST_ff_f (copysign, -nan_value, 0, nan_value);
1977 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
1988 if (errno == ENOSYS)
1989 /* Function not implemented. */
1994 TEST_f_f (cos, 0, 1);
1995 TEST_f_f (cos, minus_zero, 1);
1997 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
1998 check_int ("errno for cos(+inf) == EDOM", errno, EDOM, 0, 0, 0);
2000 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
2001 check_int ("errno for cos(-inf) == EDOM", errno, EDOM, 0, 0, 0);
2003 TEST_f_f (cos, nan_value, nan_value);
2004 check_int ("errno for cos(NaN) unchanged", errno, 0, 0, 0, 0);
2006 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
2007 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
2008 TEST_f_f (cos, M_PI_2l, 0);
2010 TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
2013 TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
2025 if (errno == ENOSYS)
2026 /* Function not implemented. */
2030 TEST_f_f (cosh, 0, 1);
2031 TEST_f_f (cosh, minus_zero, 1);
2034 TEST_f_f (cosh, plus_infty, plus_infty);
2035 TEST_f_f (cosh, minus_infty, plus_infty);
2037 TEST_f_f (cosh, nan_value, nan_value);
2039 TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
2049 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
2050 if (errno == ENOSYS)
2051 /* Function not implemented. */
2056 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
2057 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
2059 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
2060 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
2062 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
2064 TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
2065 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
2066 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
2067 TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
2069 END (cpow, complex);
2077 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
2078 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
2079 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
2080 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
2082 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
2084 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
2085 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
2086 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
2087 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
2089 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
2090 TEST_c_c (cproj, 2.0, 3.0, 2.0, 3.0);
2092 END (cproj, complex);
2100 TEST_c_f (creal, 0.0, 1.0, 0.0);
2101 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
2102 TEST_c_f (creal, nan_value, 1.0, nan_value);
2103 TEST_c_f (creal, nan_value, nan_value, nan_value);
2104 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
2105 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
2106 TEST_c_f (creal, 2.0, 3.0, 2.0);
2115 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2116 if (errno == ENOSYS)
2117 /* Function not implemented. */
2122 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
2123 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
2124 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
2125 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2127 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2128 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2129 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2130 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2132 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2133 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2134 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2135 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2137 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2138 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2139 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2140 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2142 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2143 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2144 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2145 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2147 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2148 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2149 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2150 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2152 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2153 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2155 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2156 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2158 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2159 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2161 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2162 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2164 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2165 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2167 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2168 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2170 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2172 TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
2173 TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
2175 END (csin, complex);
2183 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2184 if (errno == ENOSYS)
2185 /* Function not implemented. */
2190 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2191 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2192 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2193 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2195 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2196 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2197 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2198 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2200 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2201 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2202 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2203 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2205 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2206 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2207 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2208 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2210 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2211 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2212 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2213 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2215 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2216 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2217 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2218 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2220 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2221 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2223 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2224 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2226 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2227 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2229 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2230 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2232 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2233 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2235 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2236 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2238 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2240 TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
2241 TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
2243 END (csinh, complex);
2251 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2252 if (errno == ENOSYS)
2253 /* Function not implemented. */
2258 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2259 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2260 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2261 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2263 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2264 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2265 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2266 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2268 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2269 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2270 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2271 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2273 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2274 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2275 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2276 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2277 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2278 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2279 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
2280 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
2281 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
2282 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
2283 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
2284 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
2286 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2288 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
2290 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2291 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2292 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2293 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2295 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2296 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2297 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2298 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
2300 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
2302 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
2303 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
2304 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
2305 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
2306 TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
2307 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
2308 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
2309 /* Principal square root should be returned (i.e., non-negative real
2311 TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
2313 END (csqrt, complex);
2320 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2321 if (errno == ENOSYS)
2322 /* Function not implemented. */
2327 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
2328 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
2329 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
2330 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
2332 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
2333 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
2334 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
2335 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
2337 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
2338 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
2339 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
2340 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
2342 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2343 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2344 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
2345 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
2346 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2347 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2348 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
2349 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
2351 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
2352 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
2354 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
2355 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
2357 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2358 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2360 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2361 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2362 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2363 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
2365 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
2367 TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
2368 TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
2370 END (ctan, complex);
2378 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2379 if (errno == ENOSYS)
2380 /* Function not implemented. */
2385 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
2386 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
2387 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
2388 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
2390 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
2391 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
2392 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
2393 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
2394 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
2395 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
2396 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
2397 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
2399 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2400 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2401 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2402 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2403 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2404 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2405 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2406 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2408 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2409 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
2411 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
2412 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
2414 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2415 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2417 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2418 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2419 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2420 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2422 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
2424 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
2426 TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
2427 TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
2429 END (ctanh, complex);
2438 if (errno == ENOSYS)
2439 /* Function not implemented. */
2444 TEST_f_f (erf, 0, 0);
2445 TEST_f_f (erf, minus_zero, minus_zero);
2446 TEST_f_f (erf, plus_infty, 1);
2447 TEST_f_f (erf, minus_infty, -1);
2448 TEST_f_f (erf, nan_value, nan_value);
2450 TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
2451 TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
2452 TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
2453 TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
2454 TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
2455 TEST_f_f (erf, 27.0L, 1.0L);
2466 if (errno == ENOSYS)
2467 /* Function not implemented. */
2472 TEST_f_f (erfc, plus_infty, 0.0);
2473 TEST_f_f (erfc, minus_infty, 2.0);
2474 TEST_f_f (erfc, 0.0, 1.0);
2475 TEST_f_f (erfc, minus_zero, 1.0);
2476 TEST_f_f (erfc, nan_value, nan_value);
2478 TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
2479 TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
2480 TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
2481 TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
2482 TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
2484 /* The result can only be represented in long double. */
2485 # if LDBL_MIN_10_EXP < -319
2486 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
2499 if (errno == ENOSYS)
2500 /* Function not implemented. */
2505 TEST_f_f (exp, 0, 1);
2506 TEST_f_f (exp, minus_zero, 1);
2509 TEST_f_f (exp, plus_infty, plus_infty);
2510 TEST_f_f (exp, minus_infty, 0);
2512 TEST_f_f (exp, nan_value, nan_value);
2513 TEST_f_f (exp, 1, M_El);
2515 TEST_f_f (exp, 2, M_E2l);
2516 TEST_f_f (exp, 3, M_E3l);
2517 TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
2518 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
2519 TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L);
2520 #if defined TEST_LDOUBLE && __LDBL_MAX_EXP__ > 1024
2521 /* The result can only be represented in sane long double. */
2522 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
2534 if (errno == ENOSYS)
2535 /* Function not implemented. */
2540 TEST_f_f (exp10, 0, 1);
2541 TEST_f_f (exp10, minus_zero, 1);
2543 TEST_f_f (exp10, plus_infty, plus_infty);
2544 TEST_f_f (exp10, minus_infty, 0);
2545 TEST_f_f (exp10, nan_value, nan_value);
2546 TEST_f_f (exp10, 3, 1000);
2547 TEST_f_f (exp10, -1, 0.1L);
2548 TEST_f_f (exp10, 1e6, plus_infty);
2549 TEST_f_f (exp10, -1e6, 0);
2550 TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
2561 if (errno == ENOSYS)
2562 /* Function not implemented. */
2567 TEST_f_f (exp2, 0, 1);
2568 TEST_f_f (exp2, minus_zero, 1);
2569 TEST_f_f (exp2, plus_infty, plus_infty);
2570 TEST_f_f (exp2, minus_infty, 0);
2571 TEST_f_f (exp2, nan_value, nan_value);
2573 TEST_f_f (exp2, 10, 1024);
2574 TEST_f_f (exp2, -1, 0.5);
2575 TEST_f_f (exp2, 1e6, plus_infty);
2576 TEST_f_f (exp2, -1e6, 0);
2577 TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
2588 if (errno == ENOSYS)
2589 /* Function not implemented. */
2594 TEST_f_f (expm1, 0, 0);
2595 TEST_f_f (expm1, minus_zero, minus_zero);
2598 TEST_f_f (expm1, plus_infty, plus_infty);
2599 TEST_f_f (expm1, minus_infty, -1);
2601 TEST_f_f (expm1, nan_value, nan_value);
2603 TEST_f_f (expm1, 1, M_El - 1.0);
2604 TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
2607 TEST_f_f (expm1, 100000.0, plus_infty);
2608 check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0);
2619 TEST_f_f (fabs, 0, 0);
2620 TEST_f_f (fabs, minus_zero, 0);
2622 TEST_f_f (fabs, plus_infty, plus_infty);
2623 TEST_f_f (fabs, minus_infty, plus_infty);
2624 TEST_f_f (fabs, nan_value, nan_value);
2626 TEST_f_f (fabs, 38.0, 38.0);
2627 TEST_f_f (fabs, -M_El, M_El);
2638 TEST_ff_f (fdim, 0, 0, 0);
2639 TEST_ff_f (fdim, 9, 0, 9);
2640 TEST_ff_f (fdim, 0, 9, 0);
2641 TEST_ff_f (fdim, -9, 0, 0);
2642 TEST_ff_f (fdim, 0, -9, 9);
2644 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
2645 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
2646 TEST_ff_f (fdim, minus_infty, 9, 0);
2647 TEST_ff_f (fdim, minus_infty, -9, 0);
2648 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
2649 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
2650 TEST_ff_f (fdim, 9, plus_infty, 0);
2651 TEST_ff_f (fdim, -9, plus_infty, 0);
2653 TEST_ff_f (fdim, 0, nan_value, nan_value);
2654 TEST_ff_f (fdim, 9, nan_value, nan_value);
2655 TEST_ff_f (fdim, -9, nan_value, nan_value);
2656 TEST_ff_f (fdim, nan_value, 9, nan_value);
2657 TEST_ff_f (fdim, nan_value, -9, nan_value);
2658 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
2659 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
2660 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
2661 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
2662 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
2664 TEST_ff_f (fdim, plus_infty, plus_infty, 0);
2675 TEST_f_f (floor, 0.0, 0.0);
2676 TEST_f_f (floor, minus_zero, minus_zero);
2677 TEST_f_f (floor, plus_infty, plus_infty);
2678 TEST_f_f (floor, minus_infty, minus_infty);
2679 TEST_f_f (floor, nan_value, nan_value);
2681 TEST_f_f (floor, M_PIl, 3.0);
2682 TEST_f_f (floor, -M_PIl, -4.0);
2684 TEST_f_f (floor, 0.1, 0.0);
2685 TEST_f_f (floor, 0.25, 0.0);
2686 TEST_f_f (floor, 0.625, 0.0);
2687 TEST_f_f (floor, -0.1, -1.0);
2688 TEST_f_f (floor, -0.25, -1.0);
2689 TEST_f_f (floor, -0.625, -1.0);
2692 /* The result can only be represented in long double. */
2693 TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
2694 TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
2695 TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
2696 TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
2697 TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
2698 # if LDBL_MANT_DIG > 100
2699 TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L);
2700 TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L);
2701 TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L);
2704 TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
2705 TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
2706 TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
2707 TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
2708 TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
2709 # if LDBL_MANT_DIG > 100
2710 TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L);
2711 TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L);
2712 TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L);
2715 TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
2716 TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
2717 TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
2718 TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
2719 TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
2721 # if LDBL_MANT_DIG > 100
2722 TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L);
2723 TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L);
2724 TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L);
2725 TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L);
2726 TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L);
2727 TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L);
2730 TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
2731 TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
2732 TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
2733 TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
2734 TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
2736 # if LDBL_MANT_DIG > 100
2737 TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L);
2738 TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L);
2739 TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L);
2740 TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L);
2741 TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L);
2742 TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L);
2745 TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
2746 TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
2747 TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
2748 TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
2749 TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
2751 TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
2752 TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
2753 TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
2754 TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
2755 TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
2757 TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
2758 TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
2759 TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
2760 TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
2761 TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
2773 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
2774 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
2775 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
2776 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2777 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2778 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2779 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2780 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2781 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2782 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
2783 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2784 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
2786 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2787 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2788 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2789 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
2790 TEST_fff_f (fma, plus_infty, 3.5L, minus_infty, nan_value, INVALID_EXCEPTION);
2791 TEST_fff_f (fma, minus_infty, -7.5L, minus_infty, nan_value, INVALID_EXCEPTION);
2792 TEST_fff_f (fma, -13.5L, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
2793 TEST_fff_f (fma, minus_infty, 7.5L, plus_infty, nan_value, INVALID_EXCEPTION);
2795 TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
2797 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
2798 LDBL_MAX, DBL_MAX, FLT_MAX);
2799 TEST_fff_f (fma, -fltmax, -fltmax, minus_infty, minus_infty);
2800 TEST_fff_f (fma, fltmax / 2, fltmax / 2, minus_infty, minus_infty);
2801 TEST_fff_f (fma, -fltmax, fltmax, plus_infty, plus_infty);
2802 TEST_fff_f (fma, fltmax / 2, -fltmax / 4, plus_infty, plus_infty);
2803 TEST_fff_f (fma, plus_infty, 4, plus_infty, plus_infty);
2804 TEST_fff_f (fma, 2, minus_infty, minus_infty, minus_infty);
2805 TEST_fff_f (fma, minus_infty, minus_infty, plus_infty, plus_infty);
2806 TEST_fff_f (fma, plus_infty, minus_infty, minus_infty, minus_infty);
2808 #if defined (TEST_FLOAT) && FLT_MANT_DIG == 24
2809 TEST_fff_f (fma, 0x1.7ff8p+13, 0x1.000002p+0, 0x1.ffffp-24, 0x1.7ff802p+13);
2810 TEST_fff_f (fma, 0x1.fffp+0, 0x1.00001p+0, -0x1.fffp+0, 0x1.fffp-20);
2811 TEST_fff_f (fma, 0x1.9abcdep+127, 0x0.9abcdep-126, -0x1.f08948p+0, 0x1.bb421p-25);
2812 TEST_fff_f (fma, 0x1.9abcdep+100, 0x0.9abcdep-126, -0x1.f08948p-27, 0x1.bb421p-52);
2813 TEST_fff_f (fma, 0x1.fffffep+127, 0x1.001p+0, -0x1.fffffep+127, 0x1.fffffep+115);
2814 TEST_fff_f (fma, -0x1.fffffep+127, 0x1.fffffep+0, 0x1.fffffep+127, -0x1.fffffap+127);
2815 TEST_fff_f (fma, 0x1.fffffep+127, 2.0, -0x1.fffffep+127, 0x1.fffffep+127);
2817 #if defined (TEST_DOUBLE) && DBL_MANT_DIG == 53
2818 TEST_fff_f (fma, 0x1.7fp+13, 0x1.0000000000001p+0, 0x1.ffep-48, 0x1.7f00000000001p+13);
2819 TEST_fff_f (fma, 0x1.fffp+0, 0x1.0000000000001p+0, -0x1.fffp+0, 0x1.fffp-52);
2820 TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, 0x1p-300, 1.0);
2821 TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, -0x1p-300, 0x1.fffffffffffffp-1);
2822 TEST_fff_f (fma, 0x1.deadbeef2feedp+1023, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp+1, 0x1.0989687bc9da4p-53);
2823 TEST_fff_f (fma, 0x1.deadbeef2feedp+900, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp-122, 0x1.0989687bc9da4p-176);
2824 TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 0x1.001p+0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1011);
2825 TEST_fff_f (fma, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+0, 0x1.fffffffffffffp+1023, -0x1.ffffffffffffdp+1023);
2826 TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 2.0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023);
2827 TEST_fff_f (fma, 0x1.6a09e667f3bccp-538, 0x1.6a09e667f3bccp-538, 0.0, 0.0);
2828 TEST_fff_f (fma, 0x1.deadbeef2feedp-495, 0x1.deadbeef2feedp-495, -0x1.bf86a5786a574p-989, 0x0.0000042625a1fp-1022);
2829 TEST_fff_f (fma, 0x1.deadbeef2feedp-503, 0x1.deadbeef2feedp-503, -0x1.bf86a5786a574p-1005, 0x0.0000000004262p-1022);
2830 TEST_fff_f (fma, 0x1p-537, 0x1p-538, 0x1p-1074, 0x0.0000000000002p-1022);
2831 TEST_fff_f (fma, 0x1.7fffff8p-968, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000001p-1022);
2832 TEST_fff_f (fma, 0x1.4000004p-967, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000003p-1022);
2833 TEST_fff_f (fma, 0x1.4p-967, -0x1p-106, -0x0.000001p-1022, -0x0.0000010000002p-1022);
2834 TEST_fff_f (fma, -0x1.19cab66d73e17p-959, 0x1.c7108a8c5ff51p-107, -0x0.80b0ad65d9b64p-1022, -0x0.80b0ad65d9d59p-1022);
2835 TEST_fff_f (fma, -0x1.d2eaed6e8e9d3p-979, -0x1.4e066c62ac9ddp-63, -0x0.9245e6b003454p-1022, -0x0.9245c09c5fb5dp-1022);
2836 TEST_fff_f (fma, 0x1.153d650bb9f06p-907, 0x1.2d01230d48407p-125, -0x0.b278d5acfc3cp-1022, -0x0.b22757123bbe9p-1022);
2837 TEST_fff_f (fma, -0x1.fffffffffffffp-711, 0x1.fffffffffffffp-275, 0x1.fffffe00007ffp-983, 0x1.7ffffe00007ffp-983);
2839 #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 64
2840 TEST_fff_f (fma, -0x8.03fcp+3696L, 0xf.fffffffffffffffp-6140L, 0x8.3ffffffffffffffp-2450L, -0x8.01ecp-2440L);
2841 TEST_fff_f (fma, 0x9.fcp+2033L, -0x8.000e1f000ff800fp-3613L, -0xf.fffffffffffc0ffp-1579L, -0xd.fc119fb093ed092p-1577L);
2842 TEST_fff_f (fma, 0xc.7fc000003ffffffp-1194L, 0x8.1e0003fffffffffp+15327L, -0x8.fffep+14072L, 0xc.ae9f164020effffp+14136L);
2843 TEST_fff_f (fma, -0x8.0001fc000000003p+1798L, 0xcp-2230L, 0x8.f7e000000000007p-468L, -0xc.0002f9ffee10404p-429L);
2844 TEST_fff_f (fma, 0xc.0000000000007ffp+10130L, -0x8.000000000000001p+4430L, 0xc.07000000001ffffp+14513L, -0xb.fffffffffffd7e4p+14563L);
2845 TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L);
2847 #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 113
2848 TEST_fff_f (fma, 0x1.bb2de33e02ccbbfa6e245a7c1f71p-2584L, -0x1.6b500daf0580d987f1bc0cadfcddp-13777L, 0x1.613cd91d9fed34b33820e5ab9d8dp-16378L, -0x1.3a79fb50eb9ce887cffa0f09bd9fp-16360L);
2849 TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L);
2850 TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L);
2851 TEST_fff_f (fma, -0x1.ac79c9376ef447f3827c9e9de008p-2228L, -0x1.5ba830022b6139e21fbe7270cad8p-6314L, 0x1.e8282b6a26bb6a9daf5c8e73e9f9p-8616L, 0x1.22f14a0253878a730cd1aee373adp-8541L);
2852 TEST_fff_f (fma, -0x1.c69749ec574caaa2ab8e97ddb9f3p+2652L, 0x1.f34235ff9d095449c29b4831b62dp+3311L, 0x1.fbe4302df23354dbd0c4d3cfe606p+5879L, -0x1.bb473bfdfb7a6e18886ce6e57eafp+5964L);
2853 TEST_fff_f (fma, -0x1.ca8835fc6ecfb5398625fc891be5p-1686L, 0x1.621e1972bbe2180e5be9dd7d8df5p-7671L, -0x1.7d2d21b73b52cf20dec2a83902a4p-9395L, -0x1.3d2322191c9c88bc68a62ab8042cp-9356L);
2854 TEST_fff_f (fma, -0x1.55cff679ec49c2541fab41fc843ep-11819L, 0x1.e60e9f464f9e8df0509647c7c971p+12325L, 0x1.eaa2a7649d765c2f564f7a5beca7p+454L, -0x1.447e29fa7e406a285f4e350fcf86p+507L);
2855 TEST_fff_f (fma, 0x1.f0e7b1454908576f2537d863cf9bp+11432L, 0x1.cdce52f09d4ca76e68706f34b5d5p-1417L, -0x1.2e986187c70f146235ea2066e486p+9979L, 0x1.c030dad3cc5643f3dd0f5619f661p+10016L);
2856 TEST_fff_f (fma, 0x1.f102f7da4a57a3a4aab620e29452p-3098L, -0x1.cc06a4ff40248f9e2dcc4b6afd84p-11727L, 0x1.d512a11126b5ac8ed8973b8580c8p-14849L, -0x1.be8f1cf737ab4d1c31c54f5ec23bp-14824L);
2857 TEST_fff_f (fma, -0x1.fc47ac7434b993cd8dcb2b431f25p-3816L, 0x1.fbc9750da8468852d84558e1db6dp-5773L, -0x1.00a98abf783f75c40fe5b7a37d86p-9607L, -0x1.f81917b166f45e763cfcc057e2adp-9588L);
2858 TEST_fff_f (fma, 0x1.00000000000007ffffffffffffffp-9045L, -0x1.ffffffffffff80000001ffffffffp+4773L, -0x1.f8p-4316L, -0x1.00000000000f88000000fffffdffp-4271L);
2859 TEST_fff_f (fma, 0x1.4e922764c90701d4a2f21d01893dp-8683L, -0x1.955a12e2d7c9447c27fa022fc865p+212L, -0x1.e9634462eaef96528b90b6944578p-8521L, -0x1.08e1783184a371943d3598e10865p-8470L);
2860 TEST_fff_f (fma, 0x1.801181509c03bdbef10d6165588cp-15131L, 0x1.ad86f8e57d3d40bfa8007780af63p-368L, -0x1.6e9df0dab1c9f1d7a6043c390741p-15507L, 0x1.417c9b2b15e2ad57dc9e0e920844p-15498L);
2872 TEST_ff_f (fmax, 0, 0, 0);
2873 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
2874 TEST_ff_f (fmax, 9, 0, 9);
2875 TEST_ff_f (fmax, 0, 9, 9);
2876 TEST_ff_f (fmax, -9, 0, 0);
2877 TEST_ff_f (fmax, 0, -9, 0);
2879 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
2880 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
2881 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
2882 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
2884 TEST_ff_f (fmax, minus_infty, 9, 9);
2885 TEST_ff_f (fmax, minus_infty, -9, -9);
2886 TEST_ff_f (fmax, 9, minus_infty, 9);
2887 TEST_ff_f (fmax, -9, minus_infty, -9);
2889 TEST_ff_f (fmax, 0, nan_value, 0);
2890 TEST_ff_f (fmax, 9, nan_value, 9);
2891 TEST_ff_f (fmax, -9, nan_value, -9);
2892 TEST_ff_f (fmax, nan_value, 0, 0);
2893 TEST_ff_f (fmax, nan_value, 9, 9);
2894 TEST_ff_f (fmax, nan_value, -9, -9);
2895 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
2896 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
2897 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
2898 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
2899 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
2910 TEST_ff_f (fmin, 0, 0, 0);
2911 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
2912 TEST_ff_f (fmin, 9, 0, 0);
2913 TEST_ff_f (fmin, 0, 9, 0);
2914 TEST_ff_f (fmin, -9, 0, -9);
2915 TEST_ff_f (fmin, 0, -9, -9);
2917 TEST_ff_f (fmin, plus_infty, 9, 9);
2918 TEST_ff_f (fmin, 9, plus_infty, 9);
2919 TEST_ff_f (fmin, plus_infty, -9, -9);
2920 TEST_ff_f (fmin, -9, plus_infty, -9);
2921 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
2922 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
2923 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
2924 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
2926 TEST_ff_f (fmin, 0, nan_value, 0);
2927 TEST_ff_f (fmin, 9, nan_value, 9);
2928 TEST_ff_f (fmin, -9, nan_value, -9);
2929 TEST_ff_f (fmin, nan_value, 0, 0);
2930 TEST_ff_f (fmin, nan_value, 9, 9);
2931 TEST_ff_f (fmin, nan_value, -9, -9);
2932 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
2933 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
2934 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
2935 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
2936 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
2946 FUNC(fmod) (6.5, 2.3L);
2947 if (errno == ENOSYS)
2948 /* Function not implemented. */
2953 /* fmod (+0, y) == +0 for y != 0. */
2954 TEST_ff_f (fmod, 0, 3, 0);
2956 /* fmod (-0, y) == -0 for y != 0. */
2957 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
2959 /* fmod (+inf, y) == NaN plus invalid exception. */
2961 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
2962 check_int ("errno for fmod(Inf,3) unchanged", errno, EDOM, 0, 0, 0);
2963 /* fmod (-inf, y) == NaN plus invalid exception. */
2965 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
2966 check_int ("errno for fmod(-Inf,3) unchanged", errno, EDOM, 0, 0, 0);
2967 /* fmod (x, +0) == NaN plus invalid exception. */
2969 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
2970 check_int ("errno for fmod(3,0) unchanged", errno, EDOM, 0, 0, 0);
2971 /* fmod (x, -0) == NaN plus invalid exception. */
2972 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
2974 /* fmod (x, +inf) == x for x not infinite. */
2975 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
2976 /* fmod (x, -inf) == x for x not infinite. */
2977 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
2979 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
2981 TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
2982 TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
2983 TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
2984 TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
2991 fpclassify_test (void)
2995 TEST_f_i (fpclassify, nan_value, FP_NAN);
2996 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
2997 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
2998 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
2999 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
3000 TEST_f_i (fpclassify, 1000, FP_NORMAL);
3013 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
3014 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
3015 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
3017 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
3018 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
3020 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
3021 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
3033 if (errno == ENOSYS)
3034 /* Function not implemented. */
3036 feclearexcept (FE_ALL_EXCEPT);
3040 TEST_f_f (gamma, plus_infty, plus_infty);
3041 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3042 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3043 TEST_f_f (gamma, minus_infty, plus_infty);
3044 TEST_f_f (gamma, nan_value, nan_value);
3046 TEST_f_f1 (gamma, 1, 0, 1);
3047 TEST_f_f1 (gamma, 3, M_LN2l, 1);
3049 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
3050 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3059 FUNC(hypot) (0.7L, 12.4L);
3060 if (errno == ENOSYS)
3061 /* Function not implemented. */
3066 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
3067 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
3070 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
3071 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
3072 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
3073 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
3076 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
3078 /* hypot (x,y) == hypot (+-x, +-y) */
3079 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
3080 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
3081 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
3082 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
3083 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
3084 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
3085 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
3086 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
3088 /* hypot (x,0) == fabs (x) */
3089 TEST_ff_f (hypot, 0.75L, 0, 0.75L);
3090 TEST_ff_f (hypot, -0.75L, 0, 0.75L);
3091 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
3093 TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
3104 TEST_f_i (ilogb, 1, 0);
3105 TEST_f_i (ilogb, M_El, 1);
3106 TEST_f_i (ilogb, 1024, 10);
3107 TEST_f_i (ilogb, -2000, 10);
3109 /* XXX We have a problem here: the standard does not tell us whether
3110 exceptions are allowed/required. ignore them for now. */
3112 TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
3113 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
3114 TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
3115 TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
3121 isfinite_test (void)
3125 TEST_f_b (isfinite, 0, 1);
3126 TEST_f_b (isfinite, minus_zero, 1);
3127 TEST_f_b (isfinite, 10, 1);
3128 TEST_f_b (isfinite, plus_infty, 0);
3129 TEST_f_b (isfinite, minus_infty, 0);
3130 TEST_f_b (isfinite, nan_value, 0);
3136 isnormal_test (void)
3140 TEST_f_b (isnormal, 0, 0);
3141 TEST_f_b (isnormal, minus_zero, 0);
3142 TEST_f_b (isnormal, 10, 1);
3143 TEST_f_b (isnormal, plus_infty, 0);
3144 TEST_f_b (isnormal, minus_infty, 0);
3145 TEST_f_b (isnormal, nan_value, 0);
3155 FUNC (sincos) (0, &s, &c);
3156 if (errno == ENOSYS)
3157 /* Required function not implemented. */
3160 if (errno == ENOSYS)
3161 /* Function not implemented. */
3166 /* j0 is the Bessel function of the first kind of order 0 */
3167 TEST_f_f (j0, nan_value, nan_value);
3168 TEST_f_f (j0, plus_infty, 0);
3169 TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
3170 TEST_f_f (j0, 0.0, 1.0);
3171 TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
3172 TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
3173 TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
3174 TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
3175 TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
3176 TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
3177 TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
3178 TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3179 TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3190 FUNC (sincos) (0, &s, &c);
3191 if (errno == ENOSYS)
3192 /* Required function not implemented. */
3195 if (errno == ENOSYS)
3196 /* Function not implemented. */
3199 /* j1 is the Bessel function of the first kind of order 1 */
3203 TEST_f_f (j1, nan_value, nan_value);
3204 TEST_f_f (j1, plus_infty, 0);
3206 TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
3207 TEST_f_f (j1, 0.0, 0.0);
3208 TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
3209 TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
3210 TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
3211 TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
3212 TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
3213 TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
3214 TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
3224 FUNC (sincos) (0, &s, &c);
3225 if (errno == ENOSYS)
3226 /* Required function not implemented. */
3229 if (errno == ENOSYS)
3230 /* Function not implemented. */
3233 /* jn is the Bessel function of the first kind of order n. */
3236 /* jn (0, x) == j0 (x) */
3237 TEST_ff_f (jn, 0, nan_value, nan_value);
3238 TEST_ff_f (jn, 0, plus_infty, 0);
3239 TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
3240 TEST_ff_f (jn, 0, 0.0, 1.0);
3241 TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
3242 TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
3243 TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
3244 TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
3245 TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
3246 TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
3247 TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
3248 TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
3249 TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
3251 /* jn (1, x) == j1 (x) */
3252 TEST_ff_f (jn, 1, nan_value, nan_value);
3253 TEST_ff_f (jn, 1, plus_infty, 0);
3254 TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
3255 TEST_ff_f (jn, 1, 0.0, 0.0);
3256 TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
3257 TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
3258 TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
3259 TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
3260 TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
3261 TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
3262 TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
3265 TEST_ff_f (jn, 3, nan_value, nan_value);
3266 TEST_ff_f (jn, 3, plus_infty, 0);
3268 TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
3269 TEST_ff_f (jn, 3, 0.0, 0.0);
3270 TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
3271 TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
3272 TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
3273 TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
3274 TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
3277 TEST_ff_f (jn, 10, nan_value, nan_value);
3278 TEST_ff_f (jn, 10, plus_infty, 0);
3280 TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
3281 TEST_ff_f (jn, 10, 0.0, 0.0);
3282 TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
3283 TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
3284 TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
3285 TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
3286 TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
3289 TEST_ff_f (jn, 2, 2.4048255576957729, 0.43175480701968038399746111312430703L);
3290 TEST_ff_f (jn, 3, 2.4048255576957729, 0.19899990535769083404042146764530813L);
3291 TEST_ff_f (jn, 4, 2.4048255576957729, 0.647466661641779720084932282551219891E-1L);
3292 TEST_ff_f (jn, 5, 2.4048255576957729, 0.163892432048058525099230549946147698E-1L);
3293 TEST_ff_f (jn, 6, 2.4048255576957729, 0.34048184720278336646673682895929161E-2L);
3294 TEST_ff_f (jn, 7, 2.4048255576957729, 0.60068836573295394221291569249883076E-3L);
3295 TEST_ff_f (jn, 8, 2.4048255576957729, 0.92165786705344923232879022467054148E-4L);
3296 TEST_ff_f (jn, 9, 2.4048255576957729, 0.12517270977961513005428966643852564E-4L)
3305 TEST_ff_f (ldexp, 0, 0, 0);
3306 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
3308 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
3309 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
3310 TEST_ff_f (ldexp, nan_value, 1, nan_value);
3312 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
3313 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
3315 /* ldexp (x, 0) == x. */
3316 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
3325 if (errno == ENOSYS)
3326 /* Function not implemented. */
3328 feclearexcept (FE_ALL_EXCEPT);
3332 TEST_f_f (lgamma, plus_infty, plus_infty);
3333 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3334 check_int ("signgam for lgamma(0) == 1", signgam, 1, 0, 0, 0);
3335 TEST_f_f (lgamma, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3336 check_int ("signgam for lgamma(-0) == -1", signgam, -1, 0, 0, 0);
3337 TEST_f_f (lgamma, nan_value, nan_value);
3339 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
3341 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
3342 check_int ("errno for lgamma(-integer) == ERANGE", errno, ERANGE, 0, 0, 0);
3343 TEST_f_f (lgamma, minus_infty, plus_infty);
3345 TEST_f_f1 (lgamma, 1, 0, 1);
3347 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
3349 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
3350 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
3351 TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
3352 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
3361 /* XXX this test is incomplete. We need to have a way to specifiy
3362 the rounding method and test the critical cases. So far, only
3363 unproblematic numbers are tested. */
3367 TEST_f_l (lrint, 0.0, 0);
3368 TEST_f_l (lrint, minus_zero, 0);
3369 TEST_f_l (lrint, 0.2L, 0);
3370 TEST_f_l (lrint, -0.2L, 0);
3372 TEST_f_l (lrint, 1.4L, 1);
3373 TEST_f_l (lrint, -1.4L, -1);
3375 TEST_f_l (lrint, 8388600.3L, 8388600);
3376 TEST_f_l (lrint, -8388600.3L, -8388600);
3378 TEST_f_l (lrint, 1071930.0008, 1071930);
3380 TEST_f_l (lrint, 1073741824.01, 1073741824);
3381 # if LONG_MAX > 281474976710656
3382 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3391 lrint_test_tonearest (void)
3393 int save_round_mode;
3394 START (lrint_tonearest);
3396 save_round_mode = fegetround ();
3398 if (!fesetround (FE_TONEAREST))
3400 TEST_f_l (lrint, 0.0, 0);
3401 TEST_f_l (lrint, minus_zero, 0);
3402 TEST_f_l (lrint, 0.2L, 0);
3403 TEST_f_l (lrint, -0.2L, 0);
3404 TEST_f_l (lrint, 0.5L, 0);
3405 TEST_f_l (lrint, -0.5L, 0);
3406 TEST_f_l (lrint, 0.8L, 1);
3407 TEST_f_l (lrint, -0.8L, -1);
3409 TEST_f_l (lrint, 1.4L, 1);
3410 TEST_f_l (lrint, -1.4L, -1);
3412 TEST_f_l (lrint, 8388600.3L, 8388600);
3413 TEST_f_l (lrint, -8388600.3L, -8388600);
3415 TEST_f_l (lrint, 1071930.0008, 1071930);
3417 TEST_f_l (lrint, 1073741824.01, 1073741824);
3418 # if LONG_MAX > 281474976710656
3419 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3424 fesetround (save_round_mode);
3426 END (lrint_tonearest);
3431 lrint_test_towardzero (void)
3433 int save_round_mode;
3434 START (lrint_towardzero);
3436 save_round_mode = fegetround ();
3438 if (!fesetround (FE_TOWARDZERO))
3440 TEST_f_l (lrint, 0.0, 0);
3441 TEST_f_l (lrint, minus_zero, 0);
3442 TEST_f_l (lrint, 0.2L, 0);
3443 TEST_f_l (lrint, -0.2L, 0);
3444 TEST_f_l (lrint, 0.5L, 0);
3445 TEST_f_l (lrint, -0.5L, 0);
3446 TEST_f_l (lrint, 0.8L, 0);
3447 TEST_f_l (lrint, -0.8L, 0);
3449 TEST_f_l (lrint, 1.4L, 1);
3450 TEST_f_l (lrint, -1.4L, -1);
3452 TEST_f_l (lrint, 8388600.3L, 8388600);
3453 TEST_f_l (lrint, -8388600.3L, -8388600);
3455 TEST_f_l (lrint, 1071930.0008, 1071930);
3457 TEST_f_l (lrint, 1073741824.01, 1073741824);
3458 # if LONG_MAX > 281474976710656
3459 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3464 fesetround (save_round_mode);
3466 END (lrint_towardzero);
3471 lrint_test_downward (void)
3473 int save_round_mode;
3474 START (lrint_downward);
3476 save_round_mode = fegetround ();
3478 if (!fesetround (FE_DOWNWARD))
3480 TEST_f_l (lrint, 0.0, 0);
3481 TEST_f_l (lrint, minus_zero, 0);
3482 TEST_f_l (lrint, 0.2L, 0);
3483 TEST_f_l (lrint, -0.2L, -1);
3484 TEST_f_l (lrint, 0.5L, 0);
3485 TEST_f_l (lrint, -0.5L, -1);
3486 TEST_f_l (lrint, 0.8L, 0);
3487 TEST_f_l (lrint, -0.8L, -1);
3489 TEST_f_l (lrint, 1.4L, 1);
3490 TEST_f_l (lrint, -1.4L, -2);
3492 TEST_f_l (lrint, 8388600.3L, 8388600);
3493 TEST_f_l (lrint, -8388600.3L, -8388601);
3495 TEST_f_l (lrint, 1071930.0008, 1071930);
3497 TEST_f_l (lrint, 1073741824.01, 1073741824);
3498 # if LONG_MAX > 281474976710656
3499 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3504 fesetround (save_round_mode);
3506 END (lrint_downward);
3511 lrint_test_upward (void)
3513 int save_round_mode;
3514 START (lrint_upward);
3516 save_round_mode = fegetround ();
3518 if (!fesetround (FE_UPWARD))
3520 TEST_f_l (lrint, 0.0, 0);
3521 TEST_f_l (lrint, minus_zero, 0);
3522 TEST_f_l (lrint, 0.2L, 1);
3523 TEST_f_l (lrint, -0.2L, 0);
3524 TEST_f_l (lrint, 0.5L, 1);
3525 TEST_f_l (lrint, -0.5L, 0);
3526 TEST_f_l (lrint, 0.8L, 1);
3527 TEST_f_l (lrint, -0.8L, 0);
3529 TEST_f_l (lrint, 1.4L, 2);
3530 TEST_f_l (lrint, -1.4L, -1);
3532 TEST_f_l (lrint, 8388600.3L, 8388601);
3533 TEST_f_l (lrint, -8388600.3L, -8388600);
3536 TEST_f_l (lrint, 1071930.0008, 1071931);
3537 TEST_f_l (lrint, 1073741824.01, 1073741825);
3538 # if LONG_MAX > 281474976710656 && defined (TEST_LDOUBLE)
3539 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
3544 fesetround (save_round_mode);
3553 /* XXX this test is incomplete. We need to have a way to specifiy
3554 the rounding method and test the critical cases. So far, only
3555 unproblematic numbers are tested. */
3559 TEST_f_L (llrint, 0.0, 0);
3560 TEST_f_L (llrint, minus_zero, 0);
3561 TEST_f_L (llrint, 0.2L, 0);
3562 TEST_f_L (llrint, -0.2L, 0);
3564 TEST_f_L (llrint, 1.4L, 1);
3565 TEST_f_L (llrint, -1.4L, -1);
3567 TEST_f_L (llrint, 8388600.3L, 8388600);
3568 TEST_f_L (llrint, -8388600.3L, -8388600);
3570 TEST_f_l (llrint, 1071930.0008, 1071930);
3572 /* Test boundary conditions. */
3574 TEST_f_L (llrint, 2097151.0,2097151LL);
3576 TEST_f_L (llrint, 8388608.0, 8388608LL);
3578 TEST_f_L (llrint, 16777216.0, 16777216LL);
3580 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3582 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3583 /* 0x1000000000000 */
3584 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3585 /* 0x10000000000000 */
3586 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3587 /* 0x10000080000000 */
3588 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3589 /* 0x20000000000000 */
3590 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3591 /* 0x80000000000000 */
3592 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3593 /* 0x100000000000000 */
3594 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3596 /* The input can only be represented in long double. */
3597 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3598 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3599 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3600 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3601 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3603 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3604 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3605 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3606 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3607 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3609 # if LDBL_MANT_DIG > 100
3610 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3611 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3612 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3613 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
3614 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
3615 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
3617 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3618 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3619 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3620 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
3621 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
3622 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
3625 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3626 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3627 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3628 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3629 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3631 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3632 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3633 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3634 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3635 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3637 # if LDBL_MANT_DIG > 100
3638 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3639 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3640 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3641 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
3642 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
3643 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
3645 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3646 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3647 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3648 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
3649 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
3650 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
3653 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3654 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3655 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3656 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3657 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3659 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3660 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3661 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3662 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3663 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3665 # if LDBL_MANT_DIG > 100
3666 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
3667 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
3668 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3669 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3670 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3671 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3672 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3673 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3674 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
3675 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
3676 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3677 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3685 llrint_test_tonearest (void)
3687 int save_round_mode;
3688 START (llrint_tonearest);
3690 save_round_mode = fegetround ();
3692 if (!fesetround (FE_TONEAREST))
3694 TEST_f_L (llrint, 0.0, 0);
3695 TEST_f_L (llrint, minus_zero, 0);
3696 TEST_f_L (llrint, 0.2L, 0);
3697 TEST_f_L (llrint, -0.2L, 0);
3699 TEST_f_L (llrint, 1.4L, 1);
3700 TEST_f_L (llrint, -1.4L, -1);
3702 TEST_f_L (llrint, 8388600.3L, 8388600);
3703 TEST_f_L (llrint, -8388600.3L, -8388600);
3705 TEST_f_l (llrint, 1071930.0008, 1071930);
3707 /* Test boundary conditions. */
3709 TEST_f_L (llrint, 2097151.0,2097151LL);
3711 TEST_f_L (llrint, 8388608.0, 8388608LL);
3713 TEST_f_L (llrint, 16777216.0, 16777216LL);
3715 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3717 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3718 /* 0x1000000000000 */
3719 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3720 /* 0x10000000000000 */
3721 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3722 /* 0x10000080000000 */
3723 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3724 /* 0x20000000000000 */
3725 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3726 /* 0x80000000000000 */
3727 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3728 /* 0x100000000000000 */
3729 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3731 /* The input can only be represented in long double. */
3732 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
3733 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3734 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3735 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
3736 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
3738 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
3739 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3740 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3741 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
3742 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
3744 # if LDBL_MANT_DIG > 100
3745 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3746 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3747 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3748 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
3749 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
3750 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
3752 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3753 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3754 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3755 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
3756 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
3757 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
3760 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
3761 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3762 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3763 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
3764 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
3766 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
3767 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3768 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3769 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
3770 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
3772 # if LDBL_MANT_DIG > 100
3773 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3774 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3775 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3776 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
3777 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
3778 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
3780 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3781 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3782 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3783 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
3784 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
3785 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
3788 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
3789 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3790 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3791 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
3792 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
3794 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
3795 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3796 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3797 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
3798 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
3800 # if LDBL_MANT_DIG > 100
3801 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
3802 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
3803 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3804 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3805 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3806 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3807 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3808 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3809 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
3810 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
3811 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3812 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3817 fesetround (save_round_mode);
3819 END (llrint_tonearest);
3823 llrint_test_towardzero (void)
3825 int save_round_mode;
3826 START (llrint_towardzero);
3828 save_round_mode = fegetround ();
3830 if (!fesetround (FE_TOWARDZERO))
3832 TEST_f_L (llrint, 0.0, 0);
3833 TEST_f_L (llrint, minus_zero, 0);
3834 TEST_f_L (llrint, 0.2L, 0);
3835 TEST_f_L (llrint, -0.2L, 0);
3837 TEST_f_L (llrint, 1.4L, 1);
3838 TEST_f_L (llrint, -1.4L, -1);
3840 TEST_f_L (llrint, 8388600.3L, 8388600);
3841 TEST_f_L (llrint, -8388600.3L, -8388600);
3843 TEST_f_l (llrint, 1071930.0008, 1071930);
3845 /* Test boundary conditions. */
3847 TEST_f_L (llrint, 2097151.0,2097151LL);
3849 TEST_f_L (llrint, 8388608.0, 8388608LL);
3851 TEST_f_L (llrint, 16777216.0, 16777216LL);
3853 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3855 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3856 /* 0x1000000000000 */
3857 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3858 /* 0x10000000000000 */
3859 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3860 /* 0x10000080000000 */
3861 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
3862 /* 0x20000000000000 */
3863 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
3864 /* 0x80000000000000 */
3865 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
3866 /* 0x100000000000000 */
3867 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
3869 /* The input can only be represented in long double. */
3870 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
3871 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
3872 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
3873 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
3874 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
3876 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
3877 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
3878 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
3879 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
3880 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
3882 # if LDBL_MANT_DIG > 100
3883 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
3884 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
3885 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
3886 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
3887 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
3888 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
3890 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
3891 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
3892 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
3893 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
3894 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
3895 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
3898 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
3899 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
3900 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
3901 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
3902 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
3904 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
3905 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
3906 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
3907 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
3908 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
3910 # if LDBL_MANT_DIG > 100
3911 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
3912 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
3913 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
3914 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
3915 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
3916 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
3918 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
3919 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
3920 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
3921 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
3922 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
3923 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
3926 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
3927 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
3928 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
3929 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
3930 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
3932 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
3933 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
3934 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
3935 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
3936 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
3938 # if LDBL_MANT_DIG > 100
3939 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
3940 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
3941 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
3942 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
3943 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
3944 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
3945 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
3946 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
3947 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
3948 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
3949 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
3950 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
3955 fesetround (save_round_mode);
3957 END (llrint_towardzero);
3961 llrint_test_downward (void)
3963 int save_round_mode;
3964 START (llrint_downward);
3966 save_round_mode = fegetround ();
3968 if (!fesetround (FE_DOWNWARD))
3970 TEST_f_L (llrint, 0.0, 0);
3971 TEST_f_L (llrint, minus_zero, 0);
3972 TEST_f_L (llrint, 0.2L, 0);
3973 TEST_f_L (llrint, -0.2L, -1);
3975 TEST_f_L (llrint, 1.4L, 1);
3976 TEST_f_L (llrint, -1.4L, -2);
3978 TEST_f_L (llrint, 8388600.3L, 8388600);
3979 TEST_f_L (llrint, -8388600.3L, -8388601);
3981 TEST_f_l (llrint, 1071930.0008, 1071930);
3983 /* Test boundary conditions. */
3985 TEST_f_L (llrint, 2097151.0,2097151LL);
3987 TEST_f_L (llrint, 8388608.0, 8388608LL);
3989 TEST_f_L (llrint, 16777216.0, 16777216LL);
3991 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
3993 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
3994 /* 0x1000000000000 */
3995 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
3996 /* 0x10000000000000 */
3997 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
3998 /* 0x10000080000000 */
3999 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
4000 /* 0x20000000000000 */
4001 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
4002 /* 0x80000000000000 */
4003 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
4004 /* 0x100000000000000 */
4005 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
4007 /* The input can only be represented in long double. */
4008 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
4009 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
4010 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
4011 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
4012 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
4014 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
4015 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
4016 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
4017 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
4018 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
4019 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
4021 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
4022 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
4023 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
4024 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
4025 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
4027 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
4028 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
4029 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
4030 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
4031 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
4032 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
4034 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
4035 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
4036 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
4037 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
4038 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
4040 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
4041 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
4042 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
4043 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
4044 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
4045 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
4047 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
4048 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
4049 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
4050 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
4051 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
4053 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
4054 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
4055 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
4056 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
4057 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
4058 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
4060 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
4061 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
4062 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
4063 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
4064 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
4066 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
4067 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
4068 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
4069 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
4070 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
4072 # if LDBL_MANT_DIG > 100
4073 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
4074 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
4075 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
4076 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
4077 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
4078 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
4079 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
4080 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
4081 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
4082 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
4083 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
4084 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
4089 fesetround (save_round_mode);
4091 END (llrint_downward);
4095 llrint_test_upward (void)
4097 int save_round_mode;
4098 START (llrint_upward);
4100 save_round_mode = fegetround ();
4102 if (!fesetround (FE_UPWARD))
4104 TEST_f_L (llrint, 0.0, 0);
4105 TEST_f_L (llrint, minus_zero, 0);
4106 TEST_f_L (llrint, 0.2L, 1);
4107 TEST_f_L (llrint, -0.2L, 0);
4109 TEST_f_L (llrint, 1.4L, 2);
4110 TEST_f_L (llrint, -1.4L, -1);
4112 TEST_f_L (llrint, 8388600.3L, 8388601);
4113 TEST_f_L (llrint, -8388600.3L, -8388600);
4115 TEST_f_l (llrint, 1071930.0008, 1071931);
4117 /* Test boundary conditions. */
4119 TEST_f_L (llrint, 2097151.0,2097151LL);
4121 TEST_f_L (llrint, 8388608.0, 8388608LL);
4123 TEST_f_L (llrint, 16777216.0, 16777216LL);
4125 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
4127 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
4128 /* 0x1000000000000 */
4129 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
4130 /* 0x10000000000000 */
4131 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
4132 /* 0x10000080000000 */
4133 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
4134 /* 0x20000000000000 */
4135 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
4136 /* 0x80000000000000 */
4137 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
4138 /* 0x100000000000000 */
4139 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
4141 /* The input can only be represented in long double. */
4142 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
4143 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
4144 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
4145 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
4146 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
4148 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
4149 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
4150 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
4151 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
4152 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
4153 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
4155 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
4156 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
4157 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
4158 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
4159 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
4161 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
4162 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
4163 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
4164 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
4165 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
4166 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
4168 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
4169 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
4170 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
4171 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
4172 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
4174 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
4175 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
4176 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
4177 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
4178 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
4179 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
4181 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
4182 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
4183 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
4184 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
4185 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
4187 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
4188 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
4189 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
4190 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
4191 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
4192 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
4194 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
4195 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
4196 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
4197 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
4198 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
4200 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
4201 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
4202 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
4203 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
4204 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
4206 # if LDBL_MANT_DIG > 100
4207 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
4208 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
4209 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
4210 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
4211 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
4212 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
4213 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
4214 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
4215 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
4216 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
4217 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
4218 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
4223 fesetround (save_round_mode);
4225 END (llrint_upward);
4234 if (errno == ENOSYS)
4235 /* Function not implemented. */
4239 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4240 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4242 TEST_f_f (log, 1, 0);
4244 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
4245 TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
4246 TEST_f_f (log, plus_infty, plus_infty);
4247 TEST_f_f (log, nan_value, nan_value);
4249 TEST_f_f (log, M_El, 1);
4250 TEST_f_f (log, 1.0 / M_El, -1);
4251 TEST_f_f (log, 2, M_LN2l);
4252 TEST_f_f (log, 10, M_LN10l);
4253 TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
4264 if (errno == ENOSYS)
4265 /* Function not implemented. */
4270 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4271 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4273 TEST_f_f (log10, 1, 0);
4275 /* log10 (x) == NaN plus invalid exception if x < 0. */
4276 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
4277 TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
4279 TEST_f_f (log10, plus_infty, plus_infty);
4280 TEST_f_f (log10, nan_value, nan_value);
4282 TEST_f_f (log10, 0.1L, -1);
4283 TEST_f_f (log10, 10.0, 1);
4284 TEST_f_f (log10, 100.0, 2);
4285 TEST_f_f (log10, 10000.0, 4);
4286 TEST_f_f (log10, M_El, M_LOG10El);
4287 TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
4298 if (errno == ENOSYS)
4299 /* Function not implemented. */
4304 TEST_f_f (log1p, 0, 0);
4305 TEST_f_f (log1p, minus_zero, minus_zero);
4307 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4308 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
4309 TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
4311 TEST_f_f (log1p, plus_infty, plus_infty);
4312 TEST_f_f (log1p, nan_value, nan_value);
4314 TEST_f_f (log1p, M_El - 1.0, 1);
4316 TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
4317 TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
4328 if (errno == ENOSYS)
4329 /* Function not implemented. */
4334 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4335 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4337 TEST_f_f (log2, 1, 0);
4339 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
4340 TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
4342 TEST_f_f (log2, plus_infty, plus_infty);
4343 TEST_f_f (log2, nan_value, nan_value);
4345 TEST_f_f (log2, M_El, M_LOG2El);
4346 TEST_f_f (log2, 2.0, 1);
4347 TEST_f_f (log2, 16.0, 4);
4348 TEST_f_f (log2, 256.0, 8);
4349 TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
4360 TEST_f_f (logb, plus_infty, plus_infty);
4361 TEST_f_f (logb, minus_infty, plus_infty);
4363 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4365 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4366 TEST_f_f (logb, nan_value, nan_value);
4368 TEST_f_f (logb, 1, 0);
4369 TEST_f_f (logb, M_El, 1);
4370 TEST_f_f (logb, 1024, 10);
4371 TEST_f_f (logb, -2000, 10);
4382 TEST_f_l (lround, 0, 0);
4383 TEST_f_l (lround, minus_zero, 0);
4384 TEST_f_l (lround, 0.2L, 0.0);
4385 TEST_f_l (lround, -0.2L, 0);
4386 TEST_f_l (lround, 0.5, 1);
4387 TEST_f_l (lround, -0.5, -1);
4388 TEST_f_l (lround, 0.8L, 1);
4389 TEST_f_l (lround, -0.8L, -1);
4390 TEST_f_l (lround, 1.5, 2);
4391 TEST_f_l (lround, -1.5, -2);
4392 TEST_f_l (lround, 22514.5, 22515);
4393 TEST_f_l (lround, -22514.5, -22515);
4394 TEST_f_l (lround, 1071930.0008, 1071930);
4396 TEST_f_l (lround, 1073741824.01, 1073741824);
4397 # if LONG_MAX > 281474976710656
4398 TEST_f_l (lround, 281474976710656.025, 281474976710656);
4399 TEST_f_l (llround, -3.65309740835E17, -365309740835000000);
4401 TEST_f_l (lround, 2097152.5, 2097153);
4402 TEST_f_l (lround, -2097152.5, -2097153);
4403 /* nextafter(0.5,-1) */
4404 TEST_f_l (lround, 0x1.fffffffffffffp-2, 0);
4405 /* nextafter(-0.5,1) */
4406 TEST_f_l (lround, -0x1.fffffffffffffp-2, 0);
4408 /* nextafter(0.5,-1) */
4409 TEST_f_l (lround, 0x1.fffffp-2, 0);
4410 /* nextafter(-0.5,1) */
4411 TEST_f_l (lround, -0x1.fffffp-2, 0);
4412 TEST_f_l (lround, 0x1.fffffep+23, 16777215);
4413 TEST_f_l (lround, -0x1.fffffep+23, -16777215);
4424 TEST_f_L (llround, 0, 0);
4425 TEST_f_L (llround, minus_zero, 0);
4426 TEST_f_L (llround, 0.2L, 0.0);
4427 TEST_f_L (llround, -0.2L, 0);
4428 TEST_f_L (llround, 0.5, 1);
4429 TEST_f_L (llround, -0.5, -1);
4430 TEST_f_L (llround, 0.8L, 1);
4431 TEST_f_L (llround, -0.8L, -1);
4432 TEST_f_L (llround, 1.5, 2);
4433 TEST_f_L (llround, -1.5, -2);
4434 TEST_f_L (llround, 22514.5, 22515);
4435 TEST_f_L (llround, -22514.5, -22515);
4436 TEST_f_l (llround, 1071930.0008, 1071930);
4438 TEST_f_L (llround, 2097152.5, 2097153);
4439 TEST_f_L (llround, -2097152.5, -2097153);
4440 TEST_f_L (llround, 34359738368.5, 34359738369ll);
4441 TEST_f_L (llround, -34359738368.5, -34359738369ll);
4444 /* Test boundary conditions. */
4446 TEST_f_L (llround, 2097151.0, 2097151LL);
4448 TEST_f_L (llround, 8388608.0, 8388608LL);
4450 TEST_f_L (llround, 16777216.0, 16777216LL);
4452 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
4454 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
4455 /* 0x1000000000000 */
4456 TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
4457 /* 0x10000000000000 */
4458 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
4459 /* 0x10000080000000 */
4460 TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
4461 /* 0x20000000000000 */
4462 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
4463 /* 0x80000000000000 */
4464 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
4465 /* 0x100000000000000 */
4466 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
4470 TEST_f_L (llround, 4294967295.5, 4294967296LL);
4472 TEST_f_L (llround, 8589934591.5, 8589934592LL);
4474 /* nextafter(0.5,-1) */
4475 TEST_f_L (llround, 0x1.fffffffffffffp-2, 0);
4476 /* nextafter(-0.5,1) */
4477 TEST_f_L (llround, -0x1.fffffffffffffp-2, 0);
4478 /* On PowerPC an exponent of '52' is the largest incrementally
4479 * representable sequence of whole-numbers in the 'double' range. We test
4480 * lround to make sure that a guard bit set during the lround operation
4481 * hasn't forced an erroneous shift giving us an incorrect result. The odd
4482 * numbers between +-(2^52+1 and 2^53-1) are affected since they have the
4483 * rightmost bit set. */
4485 TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL);
4486 TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL);
4487 /* +-(2^53-1): Input is the last (positive and negative) incrementally
4488 * representable whole-number in the 'double' range that might round
4490 TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL);
4491 TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL);
4493 /* nextafter(0.5,-1) */
4494 TEST_f_L (llround, 0x1.fffffep-2, 0);
4495 /* nextafter(-0.5,1) */
4496 TEST_f_L (llround, -0x1.fffffep-2, 0);
4497 /* As above, on PowerPC an exponent of '23' is the largest incrementally
4498 * representable sequence of whole-numbers in the 'float' range.
4499 * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected. */
4500 TEST_f_L (llround, 0x1.000002p+23,8388609);
4501 TEST_f_L (llround, -0x1.000002p+23,-8388609);
4502 TEST_f_L (llround, 0x1.fffffep+23, 16777215);
4503 TEST_f_L (llround, -0x1.fffffep+23, -16777215);
4508 /* The input can only be represented in long double. */
4509 TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
4510 TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
4511 TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
4512 TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
4513 TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
4515 # if LDBL_MANT_DIG > 100
4516 TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
4517 TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
4518 TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
4519 TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
4520 TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
4521 TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
4523 TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
4524 TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
4525 TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
4526 TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
4527 TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
4528 TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
4531 TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
4532 TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
4533 TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
4534 TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
4535 TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
4537 TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
4538 TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
4539 TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
4540 TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
4541 TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
4543 # if LDBL_MANT_DIG > 100
4544 TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
4545 TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
4546 TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
4547 TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
4548 TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
4549 TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
4551 TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
4552 TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
4553 TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
4554 TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
4555 TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
4556 TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
4559 TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
4560 TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
4561 TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
4562 TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
4563 TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
4565 TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
4566 TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
4567 TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
4568 TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
4569 TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
4571 TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
4572 TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
4573 TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
4574 TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
4575 TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
4577 TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
4578 TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
4579 TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
4580 TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
4581 TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
4582 TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
4595 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
4596 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
4597 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
4598 TEST_fF_f1 (modf, 0, 0, 0);
4599 TEST_fF_f1 (modf, 1.5, 0.5, 1);
4600 TEST_fF_f1 (modf, 2.5, 0.5, 2);
4601 TEST_fF_f1 (modf, -2.5, -0.5, -2);
4602 TEST_fF_f1 (modf, 20, 0, 20);
4603 TEST_fF_f1 (modf, 21, 0, 21);
4604 TEST_fF_f1 (modf, 89.5, 0.5, 89);
4611 nearbyint_test (void)
4615 TEST_f_f (nearbyint, 0.0, 0.0);
4616 TEST_f_f (nearbyint, minus_zero, minus_zero);
4617 TEST_f_f (nearbyint, plus_infty, plus_infty);
4618 TEST_f_f (nearbyint, minus_infty, minus_infty);
4619 TEST_f_f (nearbyint, nan_value, nan_value);
4621 /* Subnormal values */
4622 TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
4623 TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
4625 /* Default rounding mode is round to nearest. */
4626 TEST_f_f (nearbyint, 0.5, 0.0);
4627 TEST_f_f (nearbyint, 1.5, 2.0);
4628 TEST_f_f (nearbyint, -0.5, minus_zero);
4629 TEST_f_f (nearbyint, -1.5, -2.0);
4631 TEST_f_f (nearbyint, 262144.75, 262145.0);
4632 TEST_f_f (nearbyint, 262142.75, 262143.0);
4633 TEST_f_f (nearbyint, 524286.75, 524287.0);
4634 TEST_f_f (nearbyint, 524288.75, 524289.0);
4640 nextafter_test (void)
4645 TEST_ff_f (nextafter, 0, 0, 0);
4646 TEST_ff_f (nextafter, minus_zero, 0, 0);
4647 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
4648 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
4650 TEST_ff_f (nextafter, 9, 9, 9);
4651 TEST_ff_f (nextafter, -9, -9, -9);
4652 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
4653 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
4655 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
4656 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
4657 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
4659 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
4660 LDBL_MAX, DBL_MAX, FLT_MAX);
4661 TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
4662 TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
4665 // XXX Enable once gcc is fixed.
4666 //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
4669 /* XXX We need the hexadecimal FP number representation here for further
4677 nexttoward_test (void)
4680 TEST_ff_f (nexttoward, 0, 0, 0);
4681 TEST_ff_f (nexttoward, minus_zero, 0, 0);
4682 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
4683 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
4685 TEST_ff_f (nexttoward, 9, 9, 9);
4686 TEST_ff_f (nexttoward, -9, -9, -9);
4687 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
4688 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
4690 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
4691 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
4692 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
4694 /* XXX We need the hexadecimal FP number representation here for further
4707 if (errno == ENOSYS)
4708 /* Function not implemented. */
4713 TEST_ff_f (pow, 0, 0, 1);
4714 TEST_ff_f (pow, 0, minus_zero, 1);
4715 TEST_ff_f (pow, minus_zero, 0, 1);
4716 TEST_ff_f (pow, minus_zero, minus_zero, 1);
4718 TEST_ff_f (pow, 10, 0, 1);
4719 TEST_ff_f (pow, 10, minus_zero, 1);
4720 TEST_ff_f (pow, -10, 0, 1);
4721 TEST_ff_f (pow, -10, minus_zero, 1);
4723 TEST_ff_f (pow, nan_value, 0, 1);
4724 TEST_ff_f (pow, nan_value, minus_zero, 1);
4728 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
4729 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
4730 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
4731 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
4733 TEST_ff_f (pow, 0.9L, plus_infty, 0);
4734 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
4735 TEST_ff_f (pow, -0.9L, plus_infty, 0);
4736 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
4738 TEST_ff_f (pow, 1.1L, minus_infty, 0);
4739 TEST_ff_f (pow, plus_infty, minus_infty, 0);
4740 TEST_ff_f (pow, -1.1L, minus_infty, 0);
4741 TEST_ff_f (pow, minus_infty, minus_infty, 0);
4743 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
4744 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
4745 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
4746 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
4748 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
4749 TEST_ff_f (pow, plus_infty, 1, plus_infty);
4750 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
4752 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
4753 TEST_ff_f (pow, plus_infty, -1, 0);
4754 TEST_ff_f (pow, plus_infty, -1e7L, 0);
4756 TEST_ff_f (pow, minus_infty, 1, minus_infty);
4757 TEST_ff_f (pow, minus_infty, 11, minus_infty);
4758 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
4760 TEST_ff_f (pow, minus_infty, 2, plus_infty);
4761 TEST_ff_f (pow, minus_infty, 12, plus_infty);
4762 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
4763 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
4764 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
4765 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
4766 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
4768 TEST_ff_f (pow, minus_infty, -1, minus_zero);
4769 TEST_ff_f (pow, minus_infty, -11, minus_zero);
4770 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
4772 TEST_ff_f (pow, minus_infty, -2, 0);
4773 TEST_ff_f (pow, minus_infty, -12, 0);
4774 TEST_ff_f (pow, minus_infty, -1002, 0);
4775 TEST_ff_f (pow, minus_infty, -0.1L, 0);
4776 TEST_ff_f (pow, minus_infty, -1.1L, 0);
4777 TEST_ff_f (pow, minus_infty, -11.1L, 0);
4778 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
4781 TEST_ff_f (pow, nan_value, nan_value, nan_value);
4782 TEST_ff_f (pow, 0, nan_value, nan_value);
4783 TEST_ff_f (pow, 1, nan_value, 1);
4784 TEST_ff_f (pow, -1, nan_value, nan_value);
4785 TEST_ff_f (pow, nan_value, 1, nan_value);
4786 TEST_ff_f (pow, nan_value, -1, nan_value);
4788 /* pow (x, NaN) == NaN. */
4789 TEST_ff_f (pow, 3.0, nan_value, nan_value);
4790 TEST_ff_f (pow, minus_zero, nan_value, nan_value);
4791 TEST_ff_f (pow, plus_infty, nan_value, nan_value);
4792 TEST_ff_f (pow, -3.0, nan_value, nan_value);
4793 TEST_ff_f (pow, minus_infty, nan_value, nan_value);
4795 TEST_ff_f (pow, nan_value, 3.0, nan_value);
4796 TEST_ff_f (pow, nan_value, -3.0, nan_value);
4797 TEST_ff_f (pow, nan_value, plus_infty, nan_value);
4798 TEST_ff_f (pow, nan_value, minus_infty, nan_value);
4799 TEST_ff_f (pow, nan_value, 2.5, nan_value);
4800 TEST_ff_f (pow, nan_value, -2.5, nan_value);
4802 TEST_ff_f (pow, 1, plus_infty, 1);
4803 TEST_ff_f (pow, -1, plus_infty, 1);
4804 TEST_ff_f (pow, 1, minus_infty, 1);
4805 TEST_ff_f (pow, -1, minus_infty, 1);
4806 TEST_ff_f (pow, 1, 1, 1);
4807 TEST_ff_f (pow, 1, -1, 1);
4808 TEST_ff_f (pow, 1, 1.25, 1);
4809 TEST_ff_f (pow, 1, -1.25, 1);
4810 TEST_ff_f (pow, 1, 0x1p62L, 1);
4811 TEST_ff_f (pow, 1, 0x1p63L, 1);
4812 TEST_ff_f (pow, 1, 0x1p64L, 1);
4813 TEST_ff_f (pow, 1, 0x1p72L, 1);
4815 /* pow (x, +-0) == 1. */
4816 TEST_ff_f (pow, plus_infty, 0, 1);
4817 TEST_ff_f (pow, plus_infty, minus_zero, 1);
4818 TEST_ff_f (pow, minus_infty, 0, 1);
4819 TEST_ff_f (pow, minus_infty, minus_zero, 1);
4820 TEST_ff_f (pow, 32.75L, 0, 1);
4821 TEST_ff_f (pow, 32.75L, minus_zero, 1);
4822 TEST_ff_f (pow, -32.75L, 0, 1);
4823 TEST_ff_f (pow, -32.75L, minus_zero, 1);
4824 TEST_ff_f (pow, 0x1p72L, 0, 1);
4825 TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
4826 TEST_ff_f (pow, 0x1p-72L, 0, 1);
4827 TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
4829 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
4830 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
4831 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
4832 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
4835 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4836 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
4838 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4839 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
4841 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4842 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
4844 TEST_ff_f (pow, minus_zero, -11L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4845 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
4848 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4849 check_int ("errno for pow(0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
4851 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4852 check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
4854 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4855 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
4857 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4858 check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
4860 TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
4861 TEST_ff_f (pow, 10, -0x1p72L, 0);
4862 TEST_ff_f (pow, max_value, max_value, plus_infty);
4863 TEST_ff_f (pow, 10, -max_value, 0);
4865 TEST_ff_f (pow, 0, 1, 0);
4866 TEST_ff_f (pow, 0, 11, 0);
4868 TEST_ff_f (pow, minus_zero, 1, minus_zero);
4869 TEST_ff_f (pow, minus_zero, 11, minus_zero);
4871 TEST_ff_f (pow, 0, 2, 0);
4872 TEST_ff_f (pow, 0, 11.1L, 0);
4874 TEST_ff_f (pow, minus_zero, 2, 0);
4875 TEST_ff_f (pow, minus_zero, 11.1L, 0);
4876 TEST_ff_f (pow, 0, plus_infty, 0);
4877 TEST_ff_f (pow, minus_zero, plus_infty, 0);
4880 /* pow (x, +inf) == +inf for |x| > 1. */
4881 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
4883 /* pow (x, +inf) == +0 for |x| < 1. */
4884 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
4886 /* pow (x, -inf) == +0 for |x| > 1. */
4887 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
4889 /* pow (x, -inf) == +inf for |x| < 1. */
4890 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
4893 /* pow (+inf, y) == +inf for y > 0. */
4894 TEST_ff_f (pow, plus_infty, 2, plus_infty);
4896 /* pow (+inf, y) == +0 for y < 0. */
4897 TEST_ff_f (pow, plus_infty, -1, 0.0);
4899 /* pow (-inf, y) == -inf for y an odd integer > 0. */
4900 TEST_ff_f (pow, minus_infty, 27, minus_infty);
4902 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
4903 TEST_ff_f (pow, minus_infty, 28, plus_infty);
4905 /* pow (-inf, y) == -0 for y an odd integer < 0. */
4906 TEST_ff_f (pow, minus_infty, -3, minus_zero);
4907 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
4908 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
4910 /* pow (+0, y) == +0 for y an odd integer > 0. */
4911 TEST_ff_f (pow, 0.0, 27, 0.0);
4913 /* pow (-0, y) == -0 for y an odd integer > 0. */
4914 TEST_ff_f (pow, minus_zero, 27, minus_zero);
4916 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
4917 TEST_ff_f (pow, 0.0, 4, 0.0);
4919 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
4920 TEST_ff_f (pow, minus_zero, 4, 0.0);
4922 TEST_ff_f (pow, 16, 0.25L, 2);
4923 TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
4924 TEST_ff_f (pow, 2, 4, 16);
4925 TEST_ff_f (pow, 256, 8, 0x1p64L);
4927 TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
4929 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
4930 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
4937 remainder_test (void)
4940 FUNC(remainder) (1.625, 1.0);
4941 if (errno == ENOSYS)
4942 /* Function not implemented. */
4948 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
4949 check_int ("errno for remainder(1, 0) = EDOM ", errno, EDOM, 0, 0, 0);
4951 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
4952 check_int ("errno for remainder(1, -0) = EDOM ", errno, EDOM, 0, 0, 0);
4954 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
4955 check_int ("errno for remainder(INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
4957 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
4958 check_int ("errno for remainder(-INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
4960 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
4961 check_int ("errno for remainder(NAN, NAN) unchanged", errno, 0, 0, 0, 0);
4963 TEST_ff_f (remainder, 0, nan_value, nan_value);
4964 check_int ("errno for remainder(0, NAN) unchanged", errno, 0, 0, 0, 0);
4966 TEST_ff_f (remainder, nan_value, 0, nan_value);
4967 check_int ("errno for remainder(NaN, 0) unchanged", errno, 0, 0, 0, 0);
4969 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
4970 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
4971 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
4972 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
4973 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
4974 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
4986 FUNC(remquo) (1.625, 1.0, &x);
4987 if (errno == ENOSYS)
4988 /* Function not implemented. */
4993 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
4994 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
4995 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
4996 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
4997 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
4999 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
5000 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
5001 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
5002 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
5004 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
5005 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
5015 TEST_f_f (rint, 0.0, 0.0);
5016 TEST_f_f (rint, minus_zero, minus_zero);
5017 TEST_f_f (rint, plus_infty, plus_infty);
5018 TEST_f_f (rint, minus_infty, minus_infty);
5020 /* Default rounding mode is round to even. */
5021 TEST_f_f (rint, 0.5, 0.0);
5022 TEST_f_f (rint, 1.5, 2.0);
5023 TEST_f_f (rint, 2.5, 2.0);
5024 TEST_f_f (rint, 3.5, 4.0);
5025 TEST_f_f (rint, 4.5, 4.0);
5026 TEST_f_f (rint, -0.5, -0.0);
5027 TEST_f_f (rint, -1.5, -2.0);
5028 TEST_f_f (rint, -2.5, -2.0);
5029 TEST_f_f (rint, -3.5, -4.0);
5030 TEST_f_f (rint, -4.5, -4.0);
5031 TEST_f_f (rint, 0.1, 0.0);
5032 TEST_f_f (rint, 0.25, 0.0);
5033 TEST_f_f (rint, 0.625, 1.0);
5034 TEST_f_f (rint, -0.1, -0.0);
5035 TEST_f_f (rint, -0.25, -0.0);
5036 TEST_f_f (rint, -0.625, -1.0);
5037 TEST_f_f (rint, 262144.75, 262145.0);
5038 TEST_f_f (rint, 262142.75, 262143.0);
5039 TEST_f_f (rint, 524286.75, 524287.0);
5040 TEST_f_f (rint, 524288.75, 524289.0);
5042 /* The result can only be represented in long double. */
5043 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
5044 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
5045 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
5046 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
5047 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
5049 # if LDBL_MANT_DIG > 100
5050 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
5051 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
5052 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
5055 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
5056 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
5057 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
5058 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
5059 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
5061 # if LDBL_MANT_DIG > 100
5062 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
5063 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
5064 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
5066 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
5067 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
5068 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
5069 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
5070 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
5071 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
5073 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
5074 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
5075 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
5076 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
5077 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
5078 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
5081 TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
5082 TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
5083 TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
5084 TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
5085 TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
5087 TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
5088 TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
5089 TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
5090 TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
5091 TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
5093 TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
5094 TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
5095 TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
5096 TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
5097 TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
5099 TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
5100 TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
5101 TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
5102 TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
5103 TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
5105 TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
5106 TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
5107 TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
5108 TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
5109 TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
5116 rint_test_tonearest (void)
5118 int save_round_mode;
5119 START (rint_tonearest);
5121 save_round_mode = fegetround ();
5123 if (!fesetround (FE_TONEAREST))
5125 TEST_f_f (rint, 2.0, 2.0);
5126 TEST_f_f (rint, 1.5, 2.0);
5127 TEST_f_f (rint, 1.0, 1.0);
5128 TEST_f_f (rint, 0.5, 0.0);
5129 TEST_f_f (rint, 0.0, 0.0);
5130 TEST_f_f (rint, minus_zero, minus_zero);
5131 TEST_f_f (rint, -0.5, -0.0);
5132 TEST_f_f (rint, -1.0, -1.0);
5133 TEST_f_f (rint, -1.5, -2.0);
5134 TEST_f_f (rint, -2.0, -2.0);
5135 TEST_f_f (rint, 0.1, 0.0);
5136 TEST_f_f (rint, 0.25, 0.0);
5137 TEST_f_f (rint, 0.625, 1.0);
5138 TEST_f_f (rint, -0.1, -0.0);
5139 TEST_f_f (rint, -0.25, -0.0);
5140 TEST_f_f (rint, -0.625, -1.0);
5142 /* The result can only be represented in long double. */
5143 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
5144 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
5145 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
5146 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
5147 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
5148 # if LDBL_MANT_DIG > 100
5149 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
5150 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
5151 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
5153 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
5154 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
5155 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
5156 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
5157 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
5158 # if LDBL_MANT_DIG > 100
5159 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
5160 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
5161 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
5163 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
5164 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
5165 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
5166 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
5167 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
5168 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
5170 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
5171 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
5172 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
5173 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
5174 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
5175 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
5180 fesetround (save_round_mode);
5182 END (rint_tonearest);
5186 rint_test_towardzero (void)
5188 int save_round_mode;
5189 START (rint_towardzero);
5191 save_round_mode = fegetround ();
5193 if (!fesetround (FE_TOWARDZERO))
5195 TEST_f_f (rint, 2.0, 2.0);
5196 TEST_f_f (rint, 1.5, 1.0);
5197 TEST_f_f (rint, 1.0, 1.0);
5198 TEST_f_f (rint, 0.5, 0.0);
5199 TEST_f_f (rint, 0.0, 0.0);
5200 TEST_f_f (rint, minus_zero, minus_zero);
5201 TEST_f_f (rint, -0.5, -0.0);
5202 TEST_f_f (rint, -1.0, -1.0);
5203 TEST_f_f (rint, -1.5, -1.0);
5204 TEST_f_f (rint, -2.0, -2.0);
5205 TEST_f_f (rint, 0.1, 0.0);
5206 TEST_f_f (rint, 0.25, 0.0);
5207 TEST_f_f (rint, 0.625, 0.0);
5208 TEST_f_f (rint, -0.1, -0.0);
5209 TEST_f_f (rint, -0.25, -0.0);
5210 TEST_f_f (rint, -0.625, -0.0);
5212 /* The result can only be represented in long double. */
5213 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
5214 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
5215 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
5216 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
5217 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
5218 # if LDBL_MANT_DIG > 100
5219 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
5220 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
5221 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
5223 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
5224 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
5225 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
5226 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
5227 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
5228 # if LDBL_MANT_DIG > 100
5229 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
5230 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
5231 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
5233 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
5234 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
5235 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
5236 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
5237 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
5238 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
5240 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
5241 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
5242 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
5243 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
5244 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
5245 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
5250 fesetround (save_round_mode);
5252 END (rint_towardzero);
5256 rint_test_downward (void)
5258 int save_round_mode;
5259 START (rint_downward);
5261 save_round_mode = fegetround ();
5263 if (!fesetround (FE_DOWNWARD))
5265 TEST_f_f (rint, 2.0, 2.0);
5266 TEST_f_f (rint, 1.5, 1.0);
5267 TEST_f_f (rint, 1.0, 1.0);
5268 TEST_f_f (rint, 0.5, 0.0);
5269 TEST_f_f (rint, 0.0, 0.0);
5270 TEST_f_f (rint, minus_zero, minus_zero);
5271 TEST_f_f (rint, -0.5, -1.0);
5272 TEST_f_f (rint, -1.0, -1.0);
5273 TEST_f_f (rint, -1.5, -2.0);
5274 TEST_f_f (rint, -2.0, -2.0);
5275 TEST_f_f (rint, 0.1, 0.0);
5276 TEST_f_f (rint, 0.25, 0.0);
5277 TEST_f_f (rint, 0.625, 0.0);
5278 TEST_f_f (rint, -0.1, -1.0);
5279 TEST_f_f (rint, -0.25, -1.0);
5280 TEST_f_f (rint, -0.625, -1.0);
5282 /* The result can only be represented in long double. */
5283 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
5284 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
5285 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
5286 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
5287 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
5288 # if LDBL_MANT_DIG > 100
5289 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
5290 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
5291 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
5293 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
5294 TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
5295 TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
5296 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
5297 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
5298 # if LDBL_MANT_DIG > 100
5299 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
5300 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
5301 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
5303 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
5304 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
5305 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
5306 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
5307 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
5308 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
5310 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
5311 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
5312 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
5313 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
5314 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
5315 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
5320 fesetround (save_round_mode);
5322 END (rint_downward);
5326 rint_test_upward (void)
5328 int save_round_mode;
5329 START (rint_upward);
5331 save_round_mode = fegetround ();
5333 if (!fesetround (FE_UPWARD))
5335 TEST_f_f (rint, 2.0, 2.0);
5336 TEST_f_f (rint, 1.5, 2.0);
5337 TEST_f_f (rint, 1.0, 1.0);
5338 TEST_f_f (rint, 0.5, 1.0);
5339 TEST_f_f (rint, 0.0, 0.0);
5340 TEST_f_f (rint, minus_zero, minus_zero);
5341 TEST_f_f (rint, -0.5, -0.0);
5342 TEST_f_f (rint, -1.0, -1.0);
5343 TEST_f_f (rint, -1.5, -1.0);
5344 TEST_f_f (rint, -2.0, -2.0);
5345 TEST_f_f (rint, 0.1, 1.0);
5346 TEST_f_f (rint, 0.25, 1.0);
5347 TEST_f_f (rint, 0.625, 1.0);
5348 TEST_f_f (rint, -0.1, -0.0);
5349 TEST_f_f (rint, -0.25, -0.0);
5350 TEST_f_f (rint, -0.625, -0.0);
5352 /* The result can only be represented in long double. */
5353 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
5354 TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
5355 TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
5356 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
5357 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
5358 # if LDBL_MANT_DIG > 100
5359 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
5360 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
5361 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
5363 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
5364 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
5365 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
5366 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
5367 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
5368 # if LDBL_MANT_DIG > 100
5369 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
5370 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
5371 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
5373 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
5374 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
5375 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
5376 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
5377 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
5378 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
5380 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
5381 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
5382 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
5383 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
5384 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
5385 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
5390 fesetround (save_round_mode);
5400 TEST_f_f (round, 0, 0);
5401 TEST_f_f (round, minus_zero, minus_zero);
5402 TEST_f_f (round, 0.2L, 0.0);
5403 TEST_f_f (round, -0.2L, minus_zero);
5404 TEST_f_f (round, 0.5, 1.0);
5405 TEST_f_f (round, -0.5, -1.0);
5406 TEST_f_f (round, 0.8L, 1.0);
5407 TEST_f_f (round, -0.8L, -1.0);
5408 TEST_f_f (round, 1.5, 2.0);
5409 TEST_f_f (round, -1.5, -2.0);
5410 TEST_f_f (round, 0.1, 0.0);
5411 TEST_f_f (round, 0.25, 0.0);
5412 TEST_f_f (round, 0.625, 1.0);
5413 TEST_f_f (round, -0.1, -0.0);
5414 TEST_f_f (round, -0.25, -0.0);
5415 TEST_f_f (round, -0.625, -1.0);
5416 TEST_f_f (round, 2097152.5, 2097153);
5417 TEST_f_f (round, -2097152.5, -2097153);
5420 /* The result can only be represented in long double. */
5421 TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
5422 TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
5423 TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
5424 TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
5425 TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
5426 # if LDBL_MANT_DIG > 100
5427 TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L);
5428 TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L);
5429 TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
5432 TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
5433 TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
5434 TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
5435 TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
5436 TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
5437 # if LDBL_MANT_DIG > 100
5438 TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
5439 TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L);
5440 TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L);
5443 TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
5444 TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
5445 TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
5446 TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
5447 TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
5449 TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
5450 TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
5451 TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
5452 TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
5453 TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
5455 # if LDBL_MANT_DIG > 100
5456 TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L);
5457 TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L);
5458 TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L);
5459 TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L);
5460 TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L);
5461 TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L);
5463 TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L);
5464 TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L);
5465 TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L);
5466 TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L);
5467 TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L);
5468 TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L);
5471 TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
5472 TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
5473 TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
5474 TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
5475 TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
5477 TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
5478 TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
5479 TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
5480 TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
5481 TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
5483 TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
5484 TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
5485 TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
5486 TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
5487 TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
5500 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
5501 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
5503 TEST_ff_f (scalb, 0, nan_value, nan_value);
5504 TEST_ff_f (scalb, 1, nan_value, nan_value);
5506 TEST_ff_f (scalb, 1, 0, 1);
5507 TEST_ff_f (scalb, -1, 0, -1);
5509 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
5510 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
5512 TEST_ff_f (scalb, 0, 2, 0);
5513 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
5514 TEST_ff_f (scalb, 0, 0, 0);
5515 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
5516 TEST_ff_f (scalb, 0, -1, 0);
5517 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
5518 TEST_ff_f (scalb, 0, minus_infty, 0);
5519 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
5521 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
5522 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
5523 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
5524 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
5525 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
5526 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
5528 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
5529 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
5531 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
5532 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
5533 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
5534 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
5536 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
5537 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
5539 TEST_ff_f (scalb, nan_value, 1, nan_value);
5540 TEST_ff_f (scalb, 1, nan_value, nan_value);
5541 TEST_ff_f (scalb, nan_value, 0, nan_value);
5542 TEST_ff_f (scalb, 0, nan_value, nan_value);
5543 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
5544 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
5545 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
5547 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
5548 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
5560 TEST_fi_f (scalbn, 0, 0, 0);
5561 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
5563 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
5564 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
5565 TEST_fi_f (scalbn, nan_value, 1, nan_value);
5567 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
5568 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
5570 TEST_fi_f (scalbn, 1, 0L, 1);
5582 TEST_fl_f (scalbln, 0, 0, 0);
5583 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
5585 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
5586 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
5587 TEST_fl_f (scalbln, nan_value, 1, nan_value);
5589 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
5590 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
5592 TEST_fl_f (scalbln, 1, 0L, 1);
5604 TEST_f_b (signbit, 0, 0);
5605 TEST_f_b (signbit, minus_zero, 1);
5606 TEST_f_b (signbit, plus_infty, 0);
5607 TEST_f_b (signbit, minus_infty, 1);
5609 /* signbit (x) != 0 for x < 0. */
5610 TEST_f_b (signbit, -1, 1);
5611 /* signbit (x) == 0 for x >= 0. */
5612 TEST_f_b (signbit, 1, 0);
5623 if (errno == ENOSYS)
5624 /* Function not implemented. */
5629 TEST_f_f (sin, 0, 0);
5630 TEST_f_f (sin, minus_zero, minus_zero);
5632 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
5633 check_int ("errno for sin(+inf) == EDOM", errno, EDOM, 0, 0, 0);
5635 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
5636 check_int ("errno for sin(-inf) == EDOM", errno, EDOM, 0, 0, 0);
5638 TEST_f_f (sin, nan_value, nan_value);
5639 check_int ("errno for sin(NaN) unchanged", errno, 0, 0, 0, 0);
5641 TEST_f_f (sin, M_PI_6l, 0.5);
5642 TEST_f_f (sin, -M_PI_6l, -0.5);
5643 TEST_f_f (sin, M_PI_2l, 1);
5644 TEST_f_f (sin, -M_PI_2l, -1);
5645 TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
5648 TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
5649 TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1);
5660 FLOAT sin_res, cos_res;
5663 FUNC(sincos) (0, &sin_res, &cos_res);
5664 if (errno == ENOSYS)
5665 /* Function not implemented. */
5670 /* sincos is treated differently because it returns void. */
5671 TEST_extra (sincos, 0, 0, 1);
5673 TEST_extra (sincos, minus_zero, minus_zero, 1);
5674 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
5675 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
5676 TEST_extra (sincos, nan_value, nan_value, nan_value);
5678 TEST_extra (sincos, M_PI_2l, 1, 0);
5679 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
5680 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
5681 TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
5684 TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
5695 if (errno == ENOSYS)
5696 /* Function not implemented. */
5700 TEST_f_f (sinh, 0, 0);
5701 TEST_f_f (sinh, minus_zero, minus_zero);
5704 TEST_f_f (sinh, plus_infty, plus_infty);
5705 TEST_f_f (sinh, minus_infty, minus_infty);
5707 TEST_f_f (sinh, nan_value, nan_value);
5709 TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
5710 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
5720 if (errno == ENOSYS)
5721 /* Function not implemented. */
5726 TEST_f_f (sqrt, 0, 0);
5727 TEST_f_f (sqrt, nan_value, nan_value);
5728 TEST_f_f (sqrt, plus_infty, plus_infty);
5730 TEST_f_f (sqrt, minus_zero, minus_zero);
5732 /* sqrt (x) == NaN plus invalid exception for x < 0. */
5733 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
5734 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
5735 TEST_f_f (sqrt, nan_value, nan_value);
5737 TEST_f_f (sqrt, 2209, 47);
5738 TEST_f_f (sqrt, 4, 2);
5739 TEST_f_f (sqrt, 2, M_SQRT2l);
5740 TEST_f_f (sqrt, 0.25, 0.5);
5741 TEST_f_f (sqrt, 6642.25, 81.5);
5742 TEST_f_f (sqrt, 15190.5625L, 123.25L);
5743 TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
5754 if (errno == ENOSYS)
5755 /* Function not implemented. */
5760 TEST_f_f (tan, 0, 0);
5761 TEST_f_f (tan, minus_zero, minus_zero);
5763 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
5764 check_int ("errno for tan(Inf) == EDOM", errno, EDOM, 0, 0, 0);
5766 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
5767 check_int ("errno for tan(-Inf) == EDOM", errno, EDOM, 0, 0, 0);
5769 TEST_f_f (tan, nan_value, nan_value);
5770 check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0);
5772 TEST_f_f (tan, M_PI_4l, 1);
5773 TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
5783 if (errno == ENOSYS)
5784 /* Function not implemented. */
5789 TEST_f_f (tanh, 0, 0);
5790 TEST_f_f (tanh, minus_zero, minus_zero);
5793 TEST_f_f (tanh, plus_infty, 1);
5794 TEST_f_f (tanh, minus_infty, -1);
5796 TEST_f_f (tanh, nan_value, nan_value);
5798 TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
5799 TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
5801 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
5802 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
5805 TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
5815 if (errno == ENOSYS)
5816 /* Function not implemented. */
5818 feclearexcept (FE_ALL_EXCEPT);
5822 TEST_f_f (tgamma, plus_infty, plus_infty);
5823 TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5824 TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5825 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
5826 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
5827 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
5828 TEST_f_f (tgamma, nan_value, nan_value);
5830 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
5831 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
5833 TEST_f_f (tgamma, 1, 1);
5834 TEST_f_f (tgamma, 4, 6);
5836 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
5837 TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
5848 TEST_f_f (trunc, plus_infty, plus_infty);
5849 TEST_f_f (trunc, minus_infty, minus_infty);
5850 TEST_f_f (trunc, nan_value, nan_value);
5852 TEST_f_f (trunc, 0, 0);
5853 TEST_f_f (trunc, minus_zero, minus_zero);
5854 TEST_f_f (trunc, 0.1, 0);
5855 TEST_f_f (trunc, 0.25, 0);
5856 TEST_f_f (trunc, 0.625, 0);
5857 TEST_f_f (trunc, -0.1, minus_zero);
5858 TEST_f_f (trunc, -0.25, minus_zero);
5859 TEST_f_f (trunc, -0.625, minus_zero);
5860 TEST_f_f (trunc, 1, 1);
5861 TEST_f_f (trunc, -1, -1);
5862 TEST_f_f (trunc, 1.625, 1);
5863 TEST_f_f (trunc, -1.625, -1);
5865 TEST_f_f (trunc, 1048580.625L, 1048580L);
5866 TEST_f_f (trunc, -1048580.625L, -1048580L);
5868 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
5869 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
5871 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
5872 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
5875 /* The result can only be represented in long double. */
5876 TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
5877 TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
5878 TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
5879 TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
5880 TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
5882 # if LDBL_MANT_DIG > 100
5883 TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L);
5884 TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
5885 TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
5888 TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
5889 TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
5890 TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
5891 TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
5892 TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
5894 # if LDBL_MANT_DIG > 100
5895 TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
5896 TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
5897 TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L);
5900 TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
5901 TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
5902 TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
5903 TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
5904 TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
5906 # if LDBL_MANT_DIG > 100
5907 TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L);
5908 TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L);
5909 TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L);
5910 TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L);
5911 TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L);
5912 TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L);
5915 TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
5916 TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
5917 TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
5918 TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
5919 TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
5921 # if LDBL_MANT_DIG > 100
5922 TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L);
5923 TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L);
5924 TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L);
5925 TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L);
5926 TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L);
5927 TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L);
5930 TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
5931 TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
5932 TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
5933 TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
5934 TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
5936 TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
5937 TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
5938 TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
5939 TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
5940 TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
5942 TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
5943 TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
5944 TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
5945 TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
5946 TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
5957 FUNC (sincos) (0, &s, &c);
5958 if (errno == ENOSYS)
5959 /* Required function not implemented. */
5962 if (errno == ENOSYS)
5963 /* Function not implemented. */
5966 /* y0 is the Bessel function of the second kind of order 0 */
5969 TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
5970 TEST_f_f (y0, 0.0, minus_infty);
5971 TEST_f_f (y0, nan_value, nan_value);
5972 TEST_f_f (y0, plus_infty, 0);
5974 TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
5975 TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
5976 TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
5977 TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
5978 TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
5979 TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
5980 TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
5991 FUNC (sincos) (0, &s, &c);
5992 if (errno == ENOSYS)
5993 /* Required function not implemented. */
5996 if (errno == ENOSYS)
5997 /* Function not implemented. */
6000 /* y1 is the Bessel function of the second kind of order 1 */
6003 TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
6004 TEST_f_f (y1, 0.0, minus_infty);
6005 TEST_f_f (y1, plus_infty, 0);
6006 TEST_f_f (y1, nan_value, nan_value);
6008 TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
6009 TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
6010 TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
6011 TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
6012 TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
6013 TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
6014 TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
6025 FUNC (sincos) (0, &s, &c);
6026 if (errno == ENOSYS)
6027 /* Required function not implemented. */
6030 if (errno == ENOSYS)
6031 /* Function not implemented. */
6034 /* yn is the Bessel function of the second kind of order n */
6037 /* yn (0, x) == y0 (x) */
6038 TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
6039 TEST_ff_f (yn, 0, 0.0, minus_infty);
6040 TEST_ff_f (yn, 0, nan_value, nan_value);
6041 TEST_ff_f (yn, 0, plus_infty, 0);
6043 TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
6044 TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
6045 TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
6046 TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
6047 TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
6048 TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
6049 TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
6051 /* yn (1, x) == y1 (x) */
6052 TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
6053 TEST_ff_f (yn, 1, 0.0, minus_infty);
6054 TEST_ff_f (yn, 1, plus_infty, 0);
6055 TEST_ff_f (yn, 1, nan_value, nan_value);
6057 TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
6058 TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
6059 TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
6060 TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
6061 TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
6062 TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
6063 TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
6066 TEST_ff_f (yn, 3, plus_infty, 0);
6067 TEST_ff_f (yn, 3, nan_value, nan_value);
6069 TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
6070 TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
6071 TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
6072 TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
6073 TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
6076 TEST_ff_f (yn, 10, plus_infty, 0);
6077 TEST_ff_f (yn, 10, nan_value, nan_value);
6079 TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
6080 TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
6081 TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
6082 TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
6083 TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
6091 significand_test (void)
6093 /* significand returns the mantissa of the exponential representation. */
6094 START (significand);
6096 TEST_f_f (significand, 4.0, 1.0);
6097 TEST_f_f (significand, 6.0, 1.5);
6098 TEST_f_f (significand, 8.0, 1.0);
6107 fpstack_test ("start *init*");
6109 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
6111 minus_zero = FUNC(copysign) (0.0, -1.0);
6112 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
6113 HUGE_VALL, HUGE_VAL, HUGE_VALF);
6114 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
6115 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
6116 max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
6117 LDBL_MAX, DBL_MAX, FLT_MAX);
6118 min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
6119 LDBL_MIN, DBL_MIN, FLT_MIN);
6125 (void) &minus_infty;
6129 /* Clear all exceptions. From now on we must not get random exceptions. */
6130 feclearexcept (FE_ALL_EXCEPT);
6132 /* Test to make sure we start correctly. */
6133 fpstack_test ("end *init*");
6136 /* Definitions of arguments for argp functions. */
6137 static const struct argp_option options[] =
6139 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
6140 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
6141 { "no-max-error", 'f', NULL, 0,
6142 "Don't output maximal errors of functions"},
6143 { "no-points", 'p', NULL, 0,
6144 "Don't output results of functions invocations"},
6145 { "ignore-max-ulp", 'i', "yes/no", 0,
6146 "Ignore given maximal errors"},
6147 { NULL, 0, NULL, 0, NULL }
6150 /* Short description of program. */
6151 static const char doc[] = "Math test suite: " TEST_MSG ;
6153 /* Prototype for option handler. */
6154 static error_t parse_opt (int key, char *arg, struct argp_state *state);
6156 /* Data structure to communicate with argp functions. */
6157 static struct argp argp =
6159 options, parse_opt, NULL, doc,
6163 /* Handle program arguments. */
6165 parse_opt (int key, char *arg, struct argp_state *state)
6170 output_max_error = 0;
6173 if (strcmp (arg, "yes") == 0)
6175 else if (strcmp (arg, "no") == 0)
6186 verbose = (unsigned int) strtoul (optarg, NULL, 0);
6191 return ARGP_ERR_UNKNOWN;
6197 /* function to check our ulp calculation. */
6204 /* This gives one ulp. */
6205 u = FUNC(nextafter) (10, 20);
6206 check_equal (10.0, u, 1, &diff, &ulp);
6207 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
6209 /* This gives one more ulp. */
6210 u = FUNC(nextafter) (u, 20);
6211 check_equal (10.0, u, 2, &diff, &ulp);
6212 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
6214 /* And now calculate 100 ulp. */
6215 for (i = 2; i < 100; i++)
6216 u = FUNC(nextafter) (u, 20);
6217 check_equal (10.0, u, 100, &diff, &ulp);
6218 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
6223 main (int argc, char **argv)
6230 output_max_error = 1;
6232 /* XXX set to 0 for releases. */
6235 /* Parse and process arguments. */
6236 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
6238 if (remaining != argc)
6240 fprintf (stderr, "wrong number of arguments");
6241 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
6242 exit (EXIT_FAILURE);
6247 ulps_file = fopen ("ULPs", "a");
6248 if (ulps_file == NULL)
6250 perror ("can't open file `ULPs' for writing: ");
6263 /* Keep the tests a wee bit ordered (according to ISO C99). */
6264 /* Classification macros: */
6270 /* Trigonometric functions: */
6280 /* Hyperbolic functions: */
6288 /* Exponential and logarithmic functions: */
6305 significand_test ();
6307 /* Power and absolute value functions: */
6314 /* Error and gamma functions: */
6321 /* Nearest integer functions: */
6326 rint_test_tonearest ();
6327 rint_test_towardzero ();
6328 rint_test_downward ();
6329 rint_test_upward ();
6331 lrint_test_tonearest ();
6332 lrint_test_towardzero ();
6333 lrint_test_downward ();
6334 lrint_test_upward ();
6336 llrint_test_tonearest ();
6337 llrint_test_towardzero ();
6338 llrint_test_downward ();
6339 llrint_test_upward ();
6345 /* Remainder functions: */
6350 /* Manipulation functions: */
6355 /* maximum, minimum and positive difference functions */
6360 /* Multiply and add: */
6363 /* Complex functions: */
6388 /* Bessel functions: */
6399 printf ("\nTest suite completed:\n");
6400 printf (" %d test cases plus %d tests for exception flags executed.\n",
6401 noTests, noExcTests);
6403 printf (" %d expected failures occurred.\n", noXFails);
6405 printf (" %d unexpected passes occurred.\n", noXPasses);
6408 printf (" %d errors occurred.\n", noErrors);
6411 printf (" All tests passed successfully.\n");