1 /* Copyright (C) 1997-2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 /* Part of testsuite for libm.
21 This file is processed by a perl script. The resulting file has to
22 be included by a master file that defines:
25 FUNC(function): converts general function name (like cos) to
26 name with correct suffix (e.g. cosl or cosf)
27 MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
28 FLOAT: floating point type to test
29 - TEST_MSG: informal message to be displayed
30 CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
31 chooses one of the parameters as delta for testing
33 PRINTF_EXPR Floating point conversion specification to print a variable
34 of type FLOAT with printf. PRINTF_EXPR just contains
35 the specifier, not the percent and width arguments,
37 PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format.
38 PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */
40 /* This testsuite has currently tests for:
41 acos, acosh, asin, asinh, atan, atan2, atanh,
42 cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
43 fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
45 ilogb, isfinite, isinf, isnan, isnormal,
46 isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
48 ldexp, lgamma, log, log10, log1p, log2, logb,
49 modf, nearbyint, nextafter,
50 pow, remainder, remquo, rint, lrint, llrint,
51 round, lround, llround,
52 scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
53 y0, y1, yn, significand
55 and for the following complex math functions:
56 cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
57 ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
59 At the moment the following functions aren't tested:
62 Parameter handling is primitive in the moment:
63 --verbose=[0..3] for different levels of output:
65 1: basic report on failed tests (default)
66 2: full report on all tests
67 -v for full output (equals --verbose=3)
68 -u for generation of an ULPs file
73 This suite tests some aspects of the correct implementation of
74 mathematical functions in libm. Some simple, specific parameters
75 are tested for correctness but there's no exhaustive
76 testing. Handling of specific inputs (e.g. infinity, not-a-number)
77 is also tested. Correct handling of exceptions is checked
78 against. These implemented tests should check all cases that are
81 Exception testing: At the moment only divide-by-zero, invalid and
82 overflow exceptions are tested. Underflow and inexact exceptions
83 aren't checked at the moment.
85 NaN values: There exist signalling and quiet NaNs. This implementation
86 only uses quiet NaN as parameter but does not differenciate
87 between the two kinds of NaNs as result.
89 Inline functions: Inlining functions should give an improvement in
90 speed - but not in precission. The inlined functions return
91 reasonable values for a reasonable range of input values. The
92 result is not necessarily correct for all values and exceptions are
93 not correctly raised in all cases. Problematic input and return
94 values are infinity, not-a-number and minus zero. This suite
95 therefore does not check these specific inputs and the exception
96 handling for inlined mathematical functions - just the "reasonable"
99 Beware: The tests might fail for any of the following reasons:
101 - Functions are wrong
102 - Floating Point Unit not working properly
103 - Compiler has errors
105 With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
108 To Do: All parameter should be numbers that can be represented as
109 exact floating point values. Currently some values cannot be
110 represented exactly and therefore the result is not the expected
111 result. For this we will use 36 digits so that numbers can be
112 represented exactly. */
118 #include "libm-test-ulps.h"
131 /* Possible exceptions */
132 #define NO_EXCEPTION 0x0
133 #define INVALID_EXCEPTION 0x1
134 #define DIVIDE_BY_ZERO_EXCEPTION 0x2
135 #define OVERFLOW_EXCEPTION 0x4
136 /* The next flags signals that those exceptions are allowed but not required. */
137 #define INVALID_EXCEPTION_OK 0x8
138 #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x10
139 #define OVERFLOW_EXCEPTION_OK 0x20
140 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
141 /* Some special test flags, passed togther with exceptions. */
142 #define IGNORE_ZERO_INF_SIGN 0x40
144 /* Various constants (we must supply them precalculated for accuracy). */
145 #define M_PI_6l .52359877559829887307710723054658383L
146 #define M_E2l 7.389056098930650227230427460575008L
147 #define M_E3l 20.085536923187667740928529654581719L
148 #define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */
149 #define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
150 #define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
151 #define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
152 #define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
153 #define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
154 #define M_PI2_LOG10El M_PI_2l * M_LOG10El
155 #define M_PI4_LOG10El M_PI_4l * M_LOG10El
156 #define M_PI_LOG10El M_PIl * M_LOG10El
157 #define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
159 static FILE *ulps_file; /* File to document difference. */
160 static int output_ulps; /* Should ulps printed? */
162 static int noErrors; /* number of errors */
163 static int noTests; /* number of tests (without testing exceptions) */
164 static int noExcTests; /* number of tests for exception flags */
165 static int noXFails; /* number of expected failures. */
166 static int noXPasses; /* number of unexpected passes. */
169 static int output_max_error; /* Should the maximal errors printed? */
170 static int output_points; /* Should the single function results printed? */
171 static int ignore_max_ulp; /* Should we ignore max_ulp? */
173 static FLOAT minus_zero, plus_zero;
174 static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
176 static FLOAT max_error, real_max_error, imag_max_error;
179 #define BUILD_COMPLEX(real, imag) \
180 ({ __complex__ FLOAT __retval; \
181 __real__ __retval = (real); \
182 __imag__ __retval = (imag); \
185 #define BUILD_COMPLEX_INT(real, imag) \
186 ({ __complex__ int __retval; \
187 __real__ __retval = (real); \
188 __imag__ __retval = (imag); \
192 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
193 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
196 init_max_error (void)
201 feclearexcept (FE_ALL_EXCEPT);
205 set_max_error (FLOAT current, FLOAT *curr_max_error)
207 if (current > *curr_max_error)
208 *curr_max_error = current;
212 /* Should the message print to screen? This depends on the verbose flag,
213 and the test status. */
215 print_screen (int ok, int xfail)
219 || (verbose == 1 && ok == xfail)))
225 /* Should the message print to screen? This depends on the verbose flag,
226 and the test status. */
228 print_screen_max_error (int ok, int xfail)
232 || ((verbose == 1) && (ok == xfail))))
237 /* Update statistic counters. */
239 update_stats (int ok, int xfail)
244 else if (!ok && xfail)
246 else if (!ok && !xfail)
251 print_ulps (const char *test_name, FLOAT ulp)
255 fprintf (ulps_file, "Test \"%s\":\n", test_name);
256 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
257 CHOOSE("ldouble", "double", "float",
258 "ildouble", "idouble", "ifloat"),
264 print_function_ulps (const char *function_name, FLOAT ulp)
268 fprintf (ulps_file, "Function: \"%s\":\n", function_name);
269 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
270 CHOOSE("ldouble", "double", "float",
271 "ildouble", "idouble", "ifloat"),
278 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
285 fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
286 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
287 CHOOSE("ldouble", "double", "float",
288 "ildouble", "idouble", "ifloat"),
289 FUNC(ceil) (real_ulp));
293 fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
294 fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
295 CHOOSE("ldouble", "double", "float",
296 "ildouble", "idouble", "ifloat"),
297 FUNC(ceil) (imag_ulp));
306 /* Test if Floating-Point stack hasn't changed */
308 fpstack_test (const char *test_name)
311 static int old_stack;
314 asm ("fnstsw" : "=a" (sw));
320 printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
321 test_name, sw, old_stack);
330 print_max_error (const char *func_name, FLOAT allowed, int xfail)
334 if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
340 print_function_ulps (func_name, max_error);
343 if (print_screen_max_error (ok, xfail))
345 printf ("Maximal error of `%s'\n", func_name);
346 printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
347 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
350 update_stats (ok, xfail);
355 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
356 __complex__ int xfail)
360 if ((real_max_error == 0 && imag_max_error == 0)
361 || (real_max_error <= __real__ allowed
362 && imag_max_error <= __imag__ allowed
369 print_complex_function_ulps (func_name, real_max_error, imag_max_error);
372 if (print_screen_max_error (ok, xfail))
374 printf ("Maximal error of real part of: %s\n", func_name);
375 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
376 FUNC(ceil) (real_max_error));
377 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
378 FUNC(ceil) (__real__ allowed));
379 printf ("Maximal error of imaginary part of: %s\n", func_name);
380 printf (" is : %.0" PRINTF_NEXPR " ulp\n",
381 FUNC(ceil) (imag_max_error));
382 printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
383 FUNC(ceil) (__imag__ allowed));
386 update_stats (ok, xfail);
390 /* Test whether a given exception was raised. */
392 test_single_exception (const char *test_name,
396 const char *flag_name)
400 if (exception & exc_flag)
402 if (fetestexcept (fe_flag))
404 if (print_screen (1, 0))
405 printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
410 if (print_screen (0, 0))
411 printf ("Failure: %s: Exception \"%s\" not set\n",
412 test_name, flag_name);
417 if (fetestexcept (fe_flag))
420 if (print_screen (0, 0))
421 printf ("Failure: %s: Exception \"%s\" set\n",
422 test_name, flag_name);
426 if (print_screen (1, 0))
427 printf ("%s: Exception \"%s\" not set\n", test_name,
438 /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
439 allowed but not required exceptions.
442 test_exceptions (const char *test_name, int exception)
446 if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
447 test_single_exception (test_name, exception,
448 DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
452 if ((exception & INVALID_EXCEPTION_OK) == 0)
453 test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
454 "Invalid operation");
457 if ((exception & OVERFLOW_EXCEPTION_OK) == 0)
458 test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
459 FE_OVERFLOW, "Overflow");
461 feclearexcept (FE_ALL_EXCEPT);
466 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
467 FLOAT max_ulp, int xfail, int exceptions,
468 FLOAT *curr_max_error)
475 test_exceptions (test_name, exceptions);
476 if (isnan (computed) && isnan (expected))
478 else if (isinf (computed) && isinf (expected))
480 /* Test for sign of infinities. */
481 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
482 && signbit (computed) != signbit (expected))
485 printf ("infinity has wrong sign.\n");
490 /* Don't calc ulp for NaNs or infinities. */
491 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
495 diff = FUNC(fabs) (computed - expected);
496 switch (fpclassify (expected))
499 /* ilogb (0) isn't allowed. */
500 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
503 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
506 /* 1ulp for a subnormal value, shifted by MANT_DIG, is the
507 least normal value. */
508 ulp = (FUNC(ldexp) (diff, MANT_DIG) / min_value);
511 /* It should never happen. */
515 set_max_error (ulp, curr_max_error);
517 if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
518 && computed == 0.0 && expected == 0.0
519 && signbit(computed) != signbit (expected))
521 else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
526 print_ulps (test_name, ulp);
530 if (print_screen (ok, xfail))
533 printf ("Failure: ");
534 printf ("Test: %s\n", test_name);
535 printf ("Result:\n");
536 printf (" is: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
538 printf (" should be: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n",
542 printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR
544 printf (" ulp : % .4" PRINTF_NEXPR "\n", ulp);
545 printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp);
548 update_stats (ok, xfail);
550 fpstack_test (test_name);
555 check_float (const char *test_name, FLOAT computed, FLOAT expected,
556 FLOAT max_ulp, int xfail, int exceptions)
558 check_float_internal (test_name, computed, expected, max_ulp, xfail,
559 exceptions, &max_error);
564 check_complex (const char *test_name, __complex__ FLOAT computed,
565 __complex__ FLOAT expected,
566 __complex__ FLOAT max_ulp, __complex__ int xfail,
569 FLOAT part_comp, part_exp, part_max_ulp;
573 sprintf (str, "Real part of: %s", test_name);
574 part_comp = __real__ computed;
575 part_exp = __real__ expected;
576 part_max_ulp = __real__ max_ulp;
577 part_xfail = __real__ xfail;
579 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
580 exception, &real_max_error);
582 sprintf (str, "Imaginary part of: %s", test_name);
583 part_comp = __imag__ computed;
584 part_exp = __imag__ expected;
585 part_max_ulp = __imag__ max_ulp;
586 part_xfail = __imag__ xfail;
588 /* Don't check again for exceptions, just pass through the
589 zero/inf sign test. */
590 check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
591 exception & IGNORE_ZERO_INF_SIGN,
596 /* Check that computed and expected values are equal (int values). */
598 check_int (const char *test_name, int computed, int expected, int max_ulp,
599 int xfail, int exceptions)
601 int diff = computed - expected;
604 test_exceptions (test_name, exceptions);
606 if (abs (diff) <= max_ulp)
610 print_ulps (test_name, diff);
612 if (print_screen (ok, xfail))
615 printf ("Failure: ");
616 printf ("Test: %s\n", test_name);
617 printf ("Result:\n");
618 printf (" is: %d\n", computed);
619 printf (" should be: %d\n", expected);
622 update_stats (ok, xfail);
623 fpstack_test (test_name);
627 /* Check that computed and expected values are equal (long int values). */
629 check_long (const char *test_name, long int computed, long int expected,
630 long int max_ulp, int xfail, int exceptions)
632 long int diff = computed - expected;
635 test_exceptions (test_name, exceptions);
637 if (labs (diff) <= max_ulp)
641 print_ulps (test_name, diff);
643 if (print_screen (ok, xfail))
646 printf ("Failure: ");
647 printf ("Test: %s\n", test_name);
648 printf ("Result:\n");
649 printf (" is: %ld\n", computed);
650 printf (" should be: %ld\n", expected);
653 update_stats (ok, xfail);
654 fpstack_test (test_name);
658 /* Check that computed value is true/false. */
660 check_bool (const char *test_name, int computed, int expected,
661 long int max_ulp, int xfail, int exceptions)
665 test_exceptions (test_name, exceptions);
667 if ((computed == 0) == (expected == 0))
670 if (print_screen (ok, xfail))
673 printf ("Failure: ");
674 printf ("Test: %s\n", test_name);
675 printf ("Result:\n");
676 printf (" is: %d\n", computed);
677 printf (" should be: %d\n", expected);
680 update_stats (ok, xfail);
681 fpstack_test (test_name);
685 /* check that computed and expected values are equal (long int values) */
687 check_longlong (const char *test_name, long long int computed,
688 long long int expected,
689 long long int max_ulp, int xfail,
692 long long int diff = computed - expected;
695 test_exceptions (test_name, exceptions);
697 if (llabs (diff) <= max_ulp)
701 print_ulps (test_name, diff);
703 if (print_screen (ok, xfail))
707 printf ("Test: %s\n", test_name);
708 printf ("Result:\n");
709 printf (" is: %lld\n", computed);
710 printf (" should be: %lld\n", expected);
713 update_stats (ok, xfail);
714 fpstack_test (test_name);
719 /* This is to prevent messages from the SVID libm emulation. */
721 matherr (struct exception *x __attribute__ ((unused)))
727 /****************************************************************************
728 Tests for single functions of libm.
729 Please keep them alphabetically sorted!
730 ****************************************************************************/
738 /* Function not implemented. */
743 TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
744 TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
745 TEST_f_f (acos, nan_value, nan_value);
748 TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
749 TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
750 TEST_f_f (acos, max_value, nan_value, INVALID_EXCEPTION);
751 TEST_f_f (acos, -max_value, nan_value, INVALID_EXCEPTION);
753 TEST_f_f (acos, 0, M_PI_2l);
754 TEST_f_f (acos, minus_zero, M_PI_2l);
755 TEST_f_f (acos, 1, 0);
756 TEST_f_f (acos, -1, M_PIl);
757 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
758 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
759 TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
760 TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
761 TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
762 TEST_f_f (acos, 0x0.ffffffp0L, 3.4526698471620358760324948263873649728491e-4L);
763 TEST_f_f (acos, -0x0.ffffffp0L, 3.1412473866050770348750401337968641476999L);
765 TEST_f_f (acos, 0x0.ffffffff8p0L, 1.5258789062648029736620564947844627548516e-5L);
766 TEST_f_f (acos, -0x0.ffffffff8p0L, 3.1415773948007305904329067627145550395696L);
767 TEST_f_f (acos, 0x0.ffffffffffffp0L, 8.4293697021788088529885473244391795127130e-8L);
768 TEST_f_f (acos, -0x0.ffffffffffffp0L, 3.1415925692960962166745548533940296398054L);
770 #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64
771 TEST_f_f (acos, 0x0.ffffffffffffffffp0L, 3.2927225399135962333718255320079907245059e-10L);
772 TEST_f_f (acos, -0x0.ffffffffffffffffp0L, 3.1415926532605209844712837599423203309964L);
779 acos_test_tonearest (void)
785 /* Function not implemented. */
788 START (acos_tonearest);
790 save_round_mode = fegetround ();
792 if (!fesetround (FE_TONEAREST))
794 TEST_f_f (acos, 0, M_PI_2l);
795 TEST_f_f (acos, minus_zero, M_PI_2l);
796 TEST_f_f (acos, 1, 0);
797 TEST_f_f (acos, -1, M_PIl);
798 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
799 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
802 fesetround (save_round_mode);
804 END (acos_tonearest);
809 acos_test_towardzero (void)
815 /* Function not implemented. */
818 START (acos_towardzero);
820 save_round_mode = fegetround ();
822 if (!fesetround (FE_TOWARDZERO))
824 TEST_f_f (acos, 0, M_PI_2l);
825 TEST_f_f (acos, minus_zero, M_PI_2l);
826 TEST_f_f (acos, 1, 0);
827 TEST_f_f (acos, -1, M_PIl);
828 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
829 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
832 fesetround (save_round_mode);
834 END (acos_towardzero);
839 acos_test_downward (void)
845 /* Function not implemented. */
848 START (acos_downward);
850 save_round_mode = fegetround ();
852 if (!fesetround (FE_DOWNWARD))
854 TEST_f_f (acos, 0, M_PI_2l);
855 TEST_f_f (acos, minus_zero, M_PI_2l);
856 TEST_f_f (acos, 1, 0);
857 TEST_f_f (acos, -1, M_PIl);
858 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
859 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
862 fesetround (save_round_mode);
869 acos_test_upward (void)
875 /* Function not implemented. */
880 save_round_mode = fegetround ();
882 if (!fesetround (FE_UPWARD))
884 TEST_f_f (acos, 0, M_PI_2l);
885 TEST_f_f (acos, minus_zero, M_PI_2l);
886 TEST_f_f (acos, 1, 0);
887 TEST_f_f (acos, -1, M_PIl);
888 TEST_f_f (acos, 0.5, M_PI_6l*2.0);
889 TEST_f_f (acos, -0.5, M_PI_6l*4.0);
892 fesetround (save_round_mode);
903 /* Function not implemented. */
908 TEST_f_f (acosh, plus_infty, plus_infty);
909 TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
912 TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
913 TEST_f_f (acosh, -max_value, nan_value, INVALID_EXCEPTION);
915 TEST_f_f (acosh, 1, 0);
916 TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
927 /* Function not implemented. */
932 TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
933 TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
934 TEST_f_f (asin, nan_value, nan_value);
936 /* asin x == NaN plus invalid exception for |x| > 1. */
937 TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
938 TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
939 TEST_f_f (asin, max_value, nan_value, INVALID_EXCEPTION);
940 TEST_f_f (asin, -max_value, nan_value, INVALID_EXCEPTION);
942 TEST_f_f (asin, 0, 0);
943 TEST_f_f (asin, minus_zero, minus_zero);
944 TEST_f_f (asin, 0.5, M_PI_6l);
945 TEST_f_f (asin, -0.5, -M_PI_6l);
946 TEST_f_f (asin, 1.0, M_PI_2l);
947 TEST_f_f (asin, -1.0, -M_PI_2l);
948 TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
949 TEST_f_f (asin, 0x0.ffffffp0L, 1.5704510598101804156437184421571127056013L);
950 TEST_f_f (asin, -0x0.ffffffp0L, -1.5704510598101804156437184421571127056013L);
952 TEST_f_f (asin, 0x0.ffffffff8p0L, 1.5707810680058339712015850710748035974710L);
953 TEST_f_f (asin, -0x0.ffffffff8p0L, -1.5707810680058339712015850710748035974710L);
954 TEST_f_f (asin, 0x0.ffffffffffffp0L, 1.5707962425011995974432331617542781977068L);
955 TEST_f_f (asin, -0x0.ffffffffffffp0L, -1.5707962425011995974432331617542781977068L);
957 #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64
958 TEST_f_f (asin, 0x0.ffffffffffffffffp0L, 1.5707963264656243652399620683025688888978L);
959 TEST_f_f (asin, -0x0.ffffffffffffffffp0L, -1.5707963264656243652399620683025688888978L);
967 asin_test_tonearest (void)
973 /* Function not implemented. */
976 START (asin_tonearest);
978 save_round_mode = fegetround ();
980 if (!fesetround (FE_TONEAREST))
982 TEST_f_f (asin, 0, 0);
983 TEST_f_f (asin, minus_zero, minus_zero);
984 TEST_f_f (asin, 0.5, M_PI_6l);
985 TEST_f_f (asin, -0.5, -M_PI_6l);
986 TEST_f_f (asin, 1.0, M_PI_2l);
987 TEST_f_f (asin, -1.0, -M_PI_2l);
990 fesetround (save_round_mode);
992 END (asin_tonearest);
997 asin_test_towardzero (void)
1002 if (errno == ENOSYS)
1003 /* Function not implemented. */
1006 START (asin_towardzero);
1008 save_round_mode = fegetround ();
1010 if (!fesetround (FE_TOWARDZERO))
1012 TEST_f_f (asin, 0, 0);
1013 TEST_f_f (asin, minus_zero, minus_zero);
1014 TEST_f_f (asin, 0.5, M_PI_6l);
1015 TEST_f_f (asin, -0.5, -M_PI_6l);
1016 TEST_f_f (asin, 1.0, M_PI_2l);
1017 TEST_f_f (asin, -1.0, -M_PI_2l);
1020 fesetround (save_round_mode);
1022 END (asin_towardzero);
1027 asin_test_downward (void)
1029 int save_round_mode;
1032 if (errno == ENOSYS)
1033 /* Function not implemented. */
1036 START (asin_downward);
1038 save_round_mode = fegetround ();
1040 if (!fesetround (FE_DOWNWARD))
1042 TEST_f_f (asin, 0, 0);
1043 TEST_f_f (asin, minus_zero, minus_zero);
1044 TEST_f_f (asin, 0.5, M_PI_6l);
1045 TEST_f_f (asin, -0.5, -M_PI_6l);
1046 TEST_f_f (asin, 1.0, M_PI_2l);
1047 TEST_f_f (asin, -1.0, -M_PI_2l);
1050 fesetround (save_round_mode);
1052 END (asin_downward);
1057 asin_test_upward (void)
1059 int save_round_mode;
1062 if (errno == ENOSYS)
1063 /* Function not implemented. */
1066 START (asin_upward);
1068 save_round_mode = fegetround ();
1070 if (!fesetround (FE_UPWARD))
1072 TEST_f_f (asin, 0, 0);
1073 TEST_f_f (asin, minus_zero, minus_zero);
1074 TEST_f_f (asin, 0.5, M_PI_6l);
1075 TEST_f_f (asin, -0.5, -M_PI_6l);
1076 TEST_f_f (asin, 1.0, M_PI_2l);
1077 TEST_f_f (asin, -1.0, -M_PI_2l);
1080 fesetround (save_round_mode);
1090 if (errno == ENOSYS)
1091 /* Function not implemented. */
1096 TEST_f_f (asinh, 0, 0);
1097 TEST_f_f (asinh, minus_zero, minus_zero);
1099 TEST_f_f (asinh, plus_infty, plus_infty);
1100 TEST_f_f (asinh, minus_infty, minus_infty);
1102 TEST_f_f (asinh, nan_value, nan_value);
1103 TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
1113 if (errno == ENOSYS)
1114 /* Function not implemented. */
1119 TEST_f_f (atan, 0, 0);
1120 TEST_f_f (atan, minus_zero, minus_zero);
1122 TEST_f_f (atan, plus_infty, M_PI_2l);
1123 TEST_f_f (atan, minus_infty, -M_PI_2l);
1124 TEST_f_f (atan, nan_value, nan_value);
1126 TEST_f_f (atan, 1, M_PI_4l);
1127 TEST_f_f (atan, -1, -M_PI_4l);
1129 TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
1141 if (errno == ENOSYS)
1142 /* Function not implemented. */
1148 TEST_f_f (atanh, 0, 0);
1149 TEST_f_f (atanh, minus_zero, minus_zero);
1151 TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
1152 TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
1153 TEST_f_f (atanh, nan_value, nan_value);
1155 /* atanh (x) == NaN plus invalid exception if |x| > 1. */
1156 TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
1157 TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
1158 TEST_f_f (atanh, max_value, nan_value, INVALID_EXCEPTION);
1159 TEST_f_f (atanh, -max_value, nan_value, INVALID_EXCEPTION);
1161 TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
1170 FUNC(atan2) (-0, 1);
1171 if (errno == ENOSYS)
1172 /* Function not implemented. */
1177 /* atan2 (0,x) == 0 for x > 0. */
1178 TEST_ff_f (atan2, 0, 1, 0);
1180 /* atan2 (-0,x) == -0 for x > 0. */
1181 TEST_ff_f (atan2, minus_zero, 1, minus_zero);
1183 TEST_ff_f (atan2, 0, 0, 0);
1184 TEST_ff_f (atan2, minus_zero, 0, minus_zero);
1186 /* atan2 (+0,x) == +pi for x < 0. */
1187 TEST_ff_f (atan2, 0, -1, M_PIl);
1189 /* atan2 (-0,x) == -pi for x < 0. */
1190 TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
1192 TEST_ff_f (atan2, 0, minus_zero, M_PIl);
1193 TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
1195 /* atan2 (y,+0) == pi/2 for y > 0. */
1196 TEST_ff_f (atan2, 1, 0, M_PI_2l);
1198 /* atan2 (y,-0) == pi/2 for y > 0. */
1199 TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
1201 /* atan2 (y,+0) == -pi/2 for y < 0. */
1202 TEST_ff_f (atan2, -1, 0, -M_PI_2l);
1204 /* atan2 (y,-0) == -pi/2 for y < 0. */
1205 TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
1207 /* atan2 (y,inf) == +0 for finite y > 0. */
1208 TEST_ff_f (atan2, 1, plus_infty, 0);
1210 /* atan2 (y,inf) == -0 for finite y < 0. */
1211 TEST_ff_f (atan2, -1, plus_infty, minus_zero);
1213 /* atan2(+inf, x) == pi/2 for finite x. */
1214 TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
1216 /* atan2(-inf, x) == -pi/2 for finite x. */
1217 TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
1219 /* atan2 (y,-inf) == +pi for finite y > 0. */
1220 TEST_ff_f (atan2, 1, minus_infty, M_PIl);
1222 /* atan2 (y,-inf) == -pi for finite y < 0. */
1223 TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
1225 TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
1226 TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
1227 TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
1228 TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
1229 TEST_ff_f (atan2, nan_value, nan_value, nan_value);
1231 TEST_ff_f (atan2, max_value, max_value, M_PI_4l);
1233 TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
1234 TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
1235 TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
1236 TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
1237 TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
1238 TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
1240 TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
1249 FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
1250 if (errno == ENOSYS)
1251 /* Function not implemented. */
1256 /* cabs (x + iy) is specified as hypot (x,y) */
1258 /* cabs (+inf + i x) == +inf. */
1259 TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
1260 /* cabs (-inf + i x) == +inf. */
1261 TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
1263 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
1264 TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
1266 TEST_c_f (cabs, nan_value, nan_value, nan_value);
1268 /* cabs (x,y) == cabs (y,x). */
1269 TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
1270 /* cabs (x,y) == cabs (-x,y). */
1271 TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
1272 /* cabs (x,y) == cabs (-y,x). */
1273 TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
1274 /* cabs (x,y) == cabs (-x,-y). */
1275 TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
1276 /* cabs (x,y) == cabs (-y,-x). */
1277 TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
1278 /* cabs (x,0) == fabs (x). */
1279 TEST_c_f (cabs, -0.75L, 0, 0.75L);
1280 TEST_c_f (cabs, 0.75L, 0, 0.75L);
1281 TEST_c_f (cabs, -1.0L, 0, 1.0L);
1282 TEST_c_f (cabs, 1.0L, 0, 1.0L);
1283 TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
1284 TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
1286 TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
1296 FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1297 if (errno == ENOSYS)
1298 /* Function not implemented. */
1304 TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
1305 TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
1306 TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
1307 TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
1309 TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
1310 TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
1312 TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
1313 TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
1315 TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
1316 TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
1317 TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
1318 TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
1319 TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
1320 TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
1322 TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
1323 TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
1324 TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
1325 TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
1327 TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
1328 TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
1329 TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
1330 TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
1332 TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1333 TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1335 TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
1336 TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
1338 TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
1339 TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
1341 TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1342 TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1344 TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1345 TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1347 TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
1349 TEST_c_c (cacos, plus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L);
1350 TEST_c_c (cacos, minus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L);
1351 TEST_c_c (cacos, plus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L);
1352 TEST_c_c (cacos, minus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L);
1353 TEST_c_c (cacos, plus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L);
1354 TEST_c_c (cacos, minus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L);
1355 TEST_c_c (cacos, plus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L);
1356 TEST_c_c (cacos, minus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L);
1357 TEST_c_c (cacos, plus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L);
1358 TEST_c_c (cacos, minus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L);
1359 TEST_c_c (cacos, plus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L);
1360 TEST_c_c (cacos, minus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L);
1362 TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L);
1363 TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L);
1364 TEST_c_c (cacos, -1.0L, plus_zero, M_PIl, minus_zero);
1365 TEST_c_c (cacos, -1.0L, minus_zero, M_PIl, plus_zero);
1366 TEST_c_c (cacos, -0.5L, plus_zero, 2.094395102393195492308428922186335256131L, minus_zero);
1367 TEST_c_c (cacos, -0.5L, minus_zero, 2.094395102393195492308428922186335256131L, plus_zero);
1368 TEST_c_c (cacos, 0.5L, plus_zero, 1.047197551196597746154214461093167628066L, minus_zero);
1369 TEST_c_c (cacos, 0.5L, minus_zero, 1.047197551196597746154214461093167628066L, plus_zero);
1370 TEST_c_c (cacos, 1.0L, plus_zero, plus_zero, minus_zero);
1371 TEST_c_c (cacos, 1.0L, minus_zero, plus_zero, plus_zero);
1372 TEST_c_c (cacos, 1.5L, plus_zero, plus_zero, -0.9624236501192068949955178268487368462704L);
1373 TEST_c_c (cacos, 1.5L, minus_zero, plus_zero, 0.9624236501192068949955178268487368462704L);
1375 TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
1376 TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
1378 END (cacos, complex);
1385 FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1386 if (errno == ENOSYS)
1387 /* Function not implemented. */
1393 TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
1394 TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
1395 TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
1396 TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
1397 TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
1398 TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
1400 TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1401 TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1403 TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
1404 TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
1405 TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
1406 TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
1407 TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1408 TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1410 TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
1411 TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
1412 TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
1413 TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
1415 TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
1416 TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
1417 TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
1418 TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
1420 TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
1421 TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
1423 TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
1424 TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
1426 TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
1427 TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
1429 TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1430 TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1432 TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1433 TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1435 TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
1437 TEST_c_c (cacosh, plus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l);
1438 TEST_c_c (cacosh, minus_zero, -1.5L, 1.194763217287109304111930828519090523536L, -M_PI_2l);
1439 TEST_c_c (cacosh, plus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l);
1440 TEST_c_c (cacosh, minus_zero, -1.0L, 0.8813735870195430252326093249797923090282L, -M_PI_2l);
1441 TEST_c_c (cacosh, plus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l);
1442 TEST_c_c (cacosh, minus_zero, -0.5L, 0.4812118250596034474977589134243684231352L, -M_PI_2l);
1443 TEST_c_c (cacosh, plus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l);
1444 TEST_c_c (cacosh, minus_zero, 0.5L, 0.4812118250596034474977589134243684231352L, M_PI_2l);
1445 TEST_c_c (cacosh, plus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l);
1446 TEST_c_c (cacosh, minus_zero, 1.0L, 0.8813735870195430252326093249797923090282L, M_PI_2l);
1447 TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l);
1448 TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, M_PI_2l);
1450 TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, M_PIl);
1451 TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -M_PIl);
1452 TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, M_PIl);
1453 TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -M_PIl);
1454 TEST_c_c (cacosh, -0.5L, plus_zero, plus_zero, 2.094395102393195492308428922186335256131L);
1455 TEST_c_c (cacosh, -0.5L, minus_zero, plus_zero, -2.094395102393195492308428922186335256131L);
1456 TEST_c_c (cacosh, 0.5L, plus_zero, plus_zero, 1.047197551196597746154214461093167628066L);
1457 TEST_c_c (cacosh, 0.5L, minus_zero, plus_zero, -1.047197551196597746154214461093167628066L);
1458 TEST_c_c (cacosh, 1.0L, plus_zero, plus_zero, plus_zero);
1459 TEST_c_c (cacosh, 1.0L, minus_zero, plus_zero, minus_zero);
1460 TEST_c_c (cacosh, 1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, plus_zero);
1461 TEST_c_c (cacosh, 1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, minus_zero);
1463 TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
1464 TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
1466 END (cacosh, complex);
1475 /* carg (x + iy) is specified as atan2 (y, x) */
1477 /* carg (x + i 0) == 0 for x > 0. */
1478 TEST_c_f (carg, 2.0, 0, 0);
1479 /* carg (x - i 0) == -0 for x > 0. */
1480 TEST_c_f (carg, 2.0, minus_zero, minus_zero);
1482 TEST_c_f (carg, 0, 0, 0);
1483 TEST_c_f (carg, 0, minus_zero, minus_zero);
1485 /* carg (x + i 0) == +pi for x < 0. */
1486 TEST_c_f (carg, -2.0, 0, M_PIl);
1488 /* carg (x - i 0) == -pi for x < 0. */
1489 TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
1491 TEST_c_f (carg, minus_zero, 0, M_PIl);
1492 TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
1494 /* carg (+0 + i y) == pi/2 for y > 0. */
1495 TEST_c_f (carg, 0, 2.0, M_PI_2l);
1497 /* carg (-0 + i y) == pi/2 for y > 0. */
1498 TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
1500 /* carg (+0 + i y) == -pi/2 for y < 0. */
1501 TEST_c_f (carg, 0, -2.0, -M_PI_2l);
1503 /* carg (-0 + i y) == -pi/2 for y < 0. */
1504 TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
1506 /* carg (inf + i y) == +0 for finite y > 0. */
1507 TEST_c_f (carg, plus_infty, 2.0, 0);
1509 /* carg (inf + i y) == -0 for finite y < 0. */
1510 TEST_c_f (carg, plus_infty, -2.0, minus_zero);
1512 /* carg(x + i inf) == pi/2 for finite x. */
1513 TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
1515 /* carg(x - i inf) == -pi/2 for finite x. */
1516 TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
1518 /* carg (-inf + i y) == +pi for finite y > 0. */
1519 TEST_c_f (carg, minus_infty, 10.0, M_PIl);
1521 /* carg (-inf + i y) == -pi for finite y < 0. */
1522 TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
1524 TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
1526 TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
1528 TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
1530 TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
1532 TEST_c_f (carg, nan_value, nan_value, nan_value);
1541 FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1542 if (errno == ENOSYS)
1543 /* Function not implemented. */
1548 TEST_c_c (casin, 0, 0, 0.0, 0.0);
1549 TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
1550 TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
1551 TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
1553 TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
1554 TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
1555 TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
1556 TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
1558 TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
1559 TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
1560 TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
1561 TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
1562 TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
1563 TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
1564 TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
1565 TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
1567 TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
1568 TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
1569 TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
1570 TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
1572 TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
1573 TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
1574 TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
1575 TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
1577 TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
1578 TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
1580 TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
1581 TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
1583 TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1584 TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
1586 TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1587 TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1589 TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1590 TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1592 TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
1594 TEST_c_c (casin, plus_zero, -1.5L, plus_zero, -1.194763217287109304111930828519090523536L);
1595 TEST_c_c (casin, minus_zero, -1.5L, minus_zero, -1.194763217287109304111930828519090523536L);
1596 TEST_c_c (casin, plus_zero, -1.0L, plus_zero, -0.8813735870195430252326093249797923090282L);
1597 TEST_c_c (casin, minus_zero, -1.0L, minus_zero, -0.8813735870195430252326093249797923090282L);
1598 TEST_c_c (casin, plus_zero, -0.5L, plus_zero, -0.4812118250596034474977589134243684231352L);
1599 TEST_c_c (casin, minus_zero, -0.5L, minus_zero, -0.4812118250596034474977589134243684231352L);
1600 TEST_c_c (casin, plus_zero, 0.5L, plus_zero, 0.4812118250596034474977589134243684231352L);
1601 TEST_c_c (casin, minus_zero, 0.5L, minus_zero, 0.4812118250596034474977589134243684231352L);
1602 TEST_c_c (casin, plus_zero, 1.0L, plus_zero, 0.8813735870195430252326093249797923090282L);
1603 TEST_c_c (casin, minus_zero, 1.0L, minus_zero, 0.8813735870195430252326093249797923090282L);
1604 TEST_c_c (casin, plus_zero, 1.5L, plus_zero, 1.194763217287109304111930828519090523536L);
1605 TEST_c_c (casin, minus_zero, 1.5L, minus_zero, 1.194763217287109304111930828519090523536L);
1607 TEST_c_c (casin, -1.5L, plus_zero, -M_PI_2l, 0.9624236501192068949955178268487368462704L);
1608 TEST_c_c (casin, -1.5L, minus_zero, -M_PI_2l, -0.9624236501192068949955178268487368462704L);
1609 TEST_c_c (casin, -1.0L, plus_zero, -M_PI_2l, plus_zero);
1610 TEST_c_c (casin, -1.0L, minus_zero, -M_PI_2l, minus_zero);
1611 TEST_c_c (casin, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L, plus_zero);
1612 TEST_c_c (casin, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L, minus_zero);
1613 TEST_c_c (casin, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L, plus_zero);
1614 TEST_c_c (casin, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L, minus_zero);
1615 TEST_c_c (casin, 1.0L, plus_zero, M_PI_2l, plus_zero);
1616 TEST_c_c (casin, 1.0L, minus_zero, M_PI_2l, minus_zero);
1617 TEST_c_c (casin, 1.5L, plus_zero, M_PI_2l, 0.9624236501192068949955178268487368462704L);
1618 TEST_c_c (casin, 1.5L, minus_zero, M_PI_2l, -0.9624236501192068949955178268487368462704L);
1620 TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
1621 TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
1623 END (casin, complex);
1631 FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1632 if (errno == ENOSYS)
1633 /* Function not implemented. */
1638 TEST_c_c (casinh, 0, 0, 0.0, 0.0);
1639 TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
1640 TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
1641 TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
1643 TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
1644 TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
1645 TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
1646 TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
1648 TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
1649 TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
1650 TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
1651 TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
1652 TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
1653 TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
1654 TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
1655 TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
1657 TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
1658 TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
1659 TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
1660 TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
1662 TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
1663 TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
1664 TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
1665 TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
1667 TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
1668 TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
1670 TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
1671 TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
1673 TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1674 TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
1676 TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1677 TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1679 TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1680 TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1682 TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
1684 TEST_c_c (casinh, plus_zero, -1.5L, 0.9624236501192068949955178268487368462704L, -M_PI_2l);
1685 TEST_c_c (casinh, minus_zero, -1.5L, -0.9624236501192068949955178268487368462704L, -M_PI_2l);
1686 TEST_c_c (casinh, plus_zero, -1.0L, plus_zero, -M_PI_2l);
1687 TEST_c_c (casinh, minus_zero, -1.0L, minus_zero, -M_PI_2l);
1688 TEST_c_c (casinh, plus_zero, -0.5L, plus_zero, -0.5235987755982988730771072305465838140329L);
1689 TEST_c_c (casinh, minus_zero, -0.5L, minus_zero, -0.5235987755982988730771072305465838140329L);
1690 TEST_c_c (casinh, plus_zero, 0.5L, plus_zero, 0.5235987755982988730771072305465838140329L);
1691 TEST_c_c (casinh, minus_zero, 0.5L, minus_zero, 0.5235987755982988730771072305465838140329L);
1692 TEST_c_c (casinh, plus_zero, 1.0L, plus_zero, M_PI_2l);
1693 TEST_c_c (casinh, minus_zero, 1.0L, minus_zero, M_PI_2l);
1694 TEST_c_c (casinh, plus_zero, 1.5L, 0.9624236501192068949955178268487368462704L, M_PI_2l);
1695 TEST_c_c (casinh, minus_zero, 1.5L, -0.9624236501192068949955178268487368462704L, M_PI_2l);
1697 TEST_c_c (casinh, -1.5L, plus_zero, -1.194763217287109304111930828519090523536L, plus_zero);
1698 TEST_c_c (casinh, -1.5L, minus_zero, -1.194763217287109304111930828519090523536L, minus_zero);
1699 TEST_c_c (casinh, -1.0L, plus_zero, -0.8813735870195430252326093249797923090282L, plus_zero);
1700 TEST_c_c (casinh, -1.0L, minus_zero, -0.8813735870195430252326093249797923090282L, minus_zero);
1701 TEST_c_c (casinh, -0.5L, plus_zero, -0.4812118250596034474977589134243684231352L, plus_zero);
1702 TEST_c_c (casinh, -0.5L, minus_zero, -0.4812118250596034474977589134243684231352L, minus_zero);
1703 TEST_c_c (casinh, 0.5L, plus_zero, 0.4812118250596034474977589134243684231352L, plus_zero);
1704 TEST_c_c (casinh, 0.5L, minus_zero, 0.4812118250596034474977589134243684231352L, minus_zero);
1705 TEST_c_c (casinh, 1.0L, plus_zero, 0.8813735870195430252326093249797923090282L, plus_zero);
1706 TEST_c_c (casinh, 1.0L, minus_zero, 0.8813735870195430252326093249797923090282L, minus_zero);
1707 TEST_c_c (casinh, 1.5L, plus_zero, 1.194763217287109304111930828519090523536L, plus_zero);
1708 TEST_c_c (casinh, 1.5L, minus_zero, 1.194763217287109304111930828519090523536L, minus_zero);
1710 TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
1711 TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
1713 END (casinh, complex);
1721 FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1722 if (errno == ENOSYS)
1723 /* Function not implemented. */
1728 TEST_c_c (catan, 0, 0, 0, 0);
1729 TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
1730 TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
1731 TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
1733 TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
1734 TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
1735 TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
1736 TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
1739 TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
1740 TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
1741 TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
1742 TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
1743 TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
1744 TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
1745 TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
1746 TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
1748 TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
1749 TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
1750 TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
1751 TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
1753 TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
1754 TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
1755 TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
1756 TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
1758 TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
1759 TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
1761 TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
1762 TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
1764 TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
1765 TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
1767 TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1768 TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
1770 TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1771 TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
1773 TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1774 TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1776 TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
1778 TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
1779 TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
1781 END (catan, complex);
1788 FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1789 if (errno == ENOSYS)
1790 /* Function not implemented. */
1795 TEST_c_c (catanh, 0, 0, 0.0, 0.0);
1796 TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
1797 TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
1798 TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
1800 TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
1801 TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
1802 TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
1803 TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
1805 TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
1806 TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
1807 TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
1808 TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
1809 TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
1810 TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
1811 TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
1812 TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
1814 TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
1815 TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
1816 TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
1817 TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
1819 TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
1820 TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
1821 TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
1822 TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
1824 TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
1825 TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
1827 TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
1828 TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
1830 TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
1831 TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
1833 TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
1834 TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
1836 TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1837 TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1839 TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1840 TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
1842 TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
1844 TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
1845 TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
1847 END (catanh, complex);
1855 if (errno == ENOSYS)
1856 /* Function not implemented. */
1861 TEST_f_f (cbrt, 0.0, 0.0);
1862 TEST_f_f (cbrt, minus_zero, minus_zero);
1864 TEST_f_f (cbrt, plus_infty, plus_infty);
1865 TEST_f_f (cbrt, minus_infty, minus_infty);
1866 TEST_f_f (cbrt, nan_value, nan_value);
1868 TEST_f_f (cbrt, -0.001L, -0.1L);
1869 TEST_f_f (cbrt, 8, 2);
1870 TEST_f_f (cbrt, -27.0, -3.0);
1871 TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
1872 TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
1882 FUNC(ccos) (BUILD_COMPLEX (0, 0));
1883 if (errno == ENOSYS)
1884 /* Function not implemented. */
1889 TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
1890 TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
1891 TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
1892 TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
1894 TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1895 TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1896 TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1897 TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1899 TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
1900 TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
1901 TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
1902 TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
1904 TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1905 TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1906 TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1907 TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1909 TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
1910 TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
1911 TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
1912 TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
1914 TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1915 TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1916 TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
1917 TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
1919 TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1920 TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1922 TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
1923 TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
1925 TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1926 TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
1928 TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1929 TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1931 TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1932 TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1934 TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1935 TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1937 TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
1939 TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
1940 TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
1942 END (ccos, complex);
1950 FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1951 if (errno == ENOSYS)
1952 /* Function not implemented. */
1957 TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
1958 TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
1959 TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
1960 TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
1962 TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1963 TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1964 TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1965 TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1967 TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
1968 TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
1969 TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
1970 TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
1972 TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1973 TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1974 TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1975 TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
1977 TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
1978 TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
1979 TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
1980 TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
1982 TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1983 TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1984 TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1985 TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
1987 TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1988 TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1990 TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
1991 TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
1993 TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1994 TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
1996 TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1997 TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
1999 TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2000 TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2002 TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2003 TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2005 TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
2007 TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
2009 TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
2011 END (ccosh, complex);
2020 TEST_f_f (ceil, 0.0, 0.0);
2021 TEST_f_f (ceil, minus_zero, minus_zero);
2022 TEST_f_f (ceil, plus_infty, plus_infty);
2023 TEST_f_f (ceil, minus_infty, minus_infty);
2024 TEST_f_f (ceil, nan_value, nan_value);
2026 TEST_f_f (ceil, M_PIl, 4.0);
2027 TEST_f_f (ceil, -M_PIl, -3.0);
2028 TEST_f_f (ceil, 0.1, 1.0);
2029 TEST_f_f (ceil, 0.25, 1.0);
2030 TEST_f_f (ceil, 0.625, 1.0);
2031 TEST_f_f (ceil, -0.1, minus_zero);
2032 TEST_f_f (ceil, -0.25, minus_zero);
2033 TEST_f_f (ceil, -0.625, minus_zero);
2036 /* The result can only be represented in long double. */
2037 TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
2038 TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
2039 TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
2040 TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
2041 TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
2043 TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
2044 TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
2045 TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
2046 TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
2047 TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
2049 # if LDBL_MANT_DIG > 100
2050 TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L);
2051 TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L);
2052 TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L);
2053 TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L);
2054 TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L);
2055 TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L);
2058 TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
2059 TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
2060 TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
2061 TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
2062 TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
2064 TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
2065 TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
2066 TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
2067 TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
2068 TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
2070 # if LDBL_MANT_DIG > 100
2071 TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L);
2072 TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L);
2073 TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L);
2074 TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L);
2075 TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L);
2076 TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L);
2078 TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L);
2079 TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L);
2080 TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L);
2081 TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L);
2082 TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L);
2083 TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L);
2086 TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
2087 TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
2088 TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
2089 TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
2090 TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
2092 TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
2093 TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
2094 TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
2095 TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
2096 TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
2098 TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
2099 TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
2100 TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
2101 TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
2102 TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
2113 FUNC(cexp) (BUILD_COMPLEX (0, 0));
2114 if (errno == ENOSYS)
2115 /* Function not implemented. */
2120 TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
2121 TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
2122 TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
2123 TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
2125 TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
2126 TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
2128 TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
2129 TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
2131 TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2132 TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2134 TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2135 TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2137 TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2138 TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2140 TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2141 TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2143 TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
2144 TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
2145 TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
2146 TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
2148 TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2149 TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2151 TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
2152 TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
2154 TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
2156 TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
2158 TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2159 TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2161 TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2162 TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2163 TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2164 TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
2166 TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
2167 TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
2169 TEST_c_c (cexp, 0, 0x1p65, 0.99888622066058013610642172179340364209972L, -0.047183876212354673805106149805700013943218L);
2170 TEST_c_c (cexp, 0, -0x1p65, 0.99888622066058013610642172179340364209972L, 0.047183876212354673805106149805700013943218L);
2171 TEST_c_c (cexp, 50, 0x1p127, 4.053997150228616856622417636046265337193e21L, 3.232070315463388524466674772633810238819e21L);
2174 TEST_c_c (cexp, 0, 1e22, 0.5232147853951389454975944733847094921409L, -0.8522008497671888017727058937530293682618L);
2175 TEST_c_c (cexp, 0, 0x1p1023, -0.826369834614147994500785680811743734805L, 0.5631277798508840134529434079444683477104L);
2176 TEST_c_c (cexp, 500, 0x1p1023, -1.159886268932754433233243794561351783426e217L, 7.904017694554466595359379965081774849708e216L);
2179 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2180 TEST_c_c (cexp, 0, 0x1p16383L, 0.9210843909921906206874509522505756251609L, 0.3893629985894208126948115852610595405563L);
2181 TEST_c_c (cexp, -10000, 0x1p16383L, 1.045876464564882298442774542991176546722e-4343L, 4.421154026488516836023811173959413420548e-4344L);
2184 TEST_c_c (cexp, 88.75, 0.75, 2.558360358486542817001900410314204322891e38L, 2.383359453227311447654736314679677655100e38L);
2185 TEST_c_c (cexp, -95, 0.75, 4.039714446238306526889476684000081624047e-42L, 3.763383677300535390271646960780570275931e-42L);
2188 TEST_c_c (cexp, 709.8125, 0.75, 1.355121963080879535248452862759108365762e308L, 1.262426823598609432507811340856186873507e308L);
2189 TEST_c_c (cexp, -720, 0.75, 1.486960657116368433685753325516638551722e-313L, 1.385247284245720590980701226843815229385e-313L);
2192 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2193 TEST_c_c (cexp, 11356.5625, 0.75, 9.052188470850960144814815984311663764287e4931L, 8.432986734191301036267148978260970230200e4931L);
2194 TEST_c_c (cexp, -11370, 0.75, 8.631121063182211587489310508568170739592e-4939L, 8.040721827809267291427062346918413482824e-4939L);
2198 TEST_c_c (cexp, 180, 0x1p-149, plus_infty, 2.087071793345235105931967606907855310664e33L, OVERFLOW_EXCEPTION);
2201 #if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MAX_EXP == 1024)
2202 TEST_c_c (cexp, 1440, 0x1p-1074, plus_infty, 1.196295853897226111293303155636183216483e302L, OVERFLOW_EXCEPTION);
2205 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2206 TEST_c_c (cexp, 22730, 0x1p-16434L, plus_infty, 2.435706297811211974162115164702304105374e4924L, OVERFLOW_EXCEPTION);
2209 TEST_c_c (cexp, 1e6, 0, plus_infty, 0, OVERFLOW_EXCEPTION);
2210 TEST_c_c (cexp, 1e6, min_value, plus_infty, plus_infty, OVERFLOW_EXCEPTION);
2211 TEST_c_c (cexp, 1e6, -min_value, plus_infty, minus_infty, OVERFLOW_EXCEPTION);
2213 END (cexp, complex);
2221 TEST_c_f (cimag, 1.0, 0.0, 0.0);
2222 TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
2223 TEST_c_f (cimag, 1.0, nan_value, nan_value);
2224 TEST_c_f (cimag, nan_value, nan_value, nan_value);
2225 TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
2226 TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
2227 TEST_c_f (cimag, 2.0, 3.0, 3.0);
2236 FUNC(clog) (BUILD_COMPLEX (-2, -3));
2237 if (errno == ENOSYS)
2238 /* Function not implemented. */
2243 TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
2244 TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
2246 TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
2247 TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
2249 TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
2250 TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
2252 TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
2253 TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
2255 TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
2256 TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
2257 TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
2258 TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
2259 TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
2260 TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
2261 TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
2262 TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
2264 TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
2265 TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
2266 TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
2267 TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
2269 TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
2270 TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
2271 TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
2272 TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
2274 TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
2275 TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
2277 TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
2278 TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
2280 TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2281 TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2282 TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2283 TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2285 TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2286 TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2287 TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2288 TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2290 TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
2292 TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
2293 TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
2295 TEST_c_c (clog, 0x1.fffffep+127L, 0x1.fffffep+127L, 89.06941264234832570836679262104313101776L, M_PI_4l);
2296 TEST_c_c (clog, 0x1.fffffep+127L, 1.0L, 88.72283905206835305365817656031404273372L, 2.938736052218037251011746307725933020145e-39L);
2297 TEST_c_c (clog, 0x1p-149L, 0x1p-149L, -102.9323563131518784484589700365392203592L, M_PI_4l);
2298 TEST_c_c (clog, 0x1p-147L, 0x1p-147L, -101.5460619520319878296245057936228672231L, M_PI_4l);
2301 TEST_c_c (clog, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 710.1292864836639693869320059713862337880L, M_PI_4l);
2302 TEST_c_c (clog, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 709.8942846690411016323109979483151967689L, 0.4636476090008061606231772164674799632783L);
2303 TEST_c_c (clog, 0x1p-1074L, 0x1p-1074L, -744.0934983311012896593986823853525458290L, M_PI_4l);
2304 TEST_c_c (clog, 0x1p-1073L, 0x1p-1073L, -743.4003511505413443499814502638943692610L, M_PI_4l);
2307 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2308 TEST_c_c (clog, 0x1.fp+16383L, 0x1.fp+16383L, 11356.83823118610934184548269774874545400L, M_PI_4l);
2309 TEST_c_c (clog, 0x1.fp+16383L, 0x1p+16383L, 11356.60974243783798653123798337822335902L, 0.4764674194737066993385333770295162295856L);
2310 TEST_c_c (clog, 0x1p-16440L, 0x1p-16441L, -11395.22807662984378194141292922726786191L, 0.4636476090008061162142562314612144020285L);
2313 END (clog, complex);
2321 FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
2322 if (errno == ENOSYS)
2323 /* Function not implemented. */
2328 TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
2329 TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
2331 TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
2332 TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
2334 TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
2336 TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
2337 TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
2339 TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
2340 TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
2341 TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
2342 TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
2343 TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
2344 TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
2345 TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
2346 TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
2348 TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
2349 TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
2350 TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
2351 TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
2353 TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
2354 TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
2355 TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
2356 TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
2358 TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
2359 TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
2361 TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
2362 TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
2364 TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2365 TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2366 TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2367 TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2369 TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2370 TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2371 TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
2372 TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
2374 TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
2376 TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
2377 TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
2379 TEST_c_c (clog10, 0x1.fffffep+127L, 0x1.fffffep+127L, 38.68235441693561449174780668781319348761L, M_PI4_LOG10El);
2380 TEST_c_c (clog10, 0x1.fffffep+127L, 1.0L, 38.53183941910362389414093724045094697423L, 1.276276851248440096917018665609900318458e-39L);
2381 TEST_c_c (clog10, 0x1p-149L, 0x1p-149L, -44.70295435610120748924022586658721447508L, M_PI4_LOG10El);
2382 TEST_c_c (clog10, 0x1p-147L, 0x1p-147L, -44.10089436477324509881274807713822842154L, M_PI4_LOG10El);
2385 TEST_c_c (clog10, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 308.4052305577487344482591243175787477115L, M_PI4_LOG10El);
2386 TEST_c_c (clog10, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 308.3031705664207720674749211936626341569L, 0.2013595981366865903254995612594728746470L);
2387 TEST_c_c (clog10, 0x1p-1074L, 0x1p-1074L, -323.1557003452838130619487034867432642357L, M_PI4_LOG10El);
2388 TEST_c_c (clog10, 0x1p-1073L, 0x1p-1073L, -322.8546703496198318667349645920187712089L, M_PI4_LOG10El);
2391 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2392 TEST_c_c (clog10, 0x1.fp+16383L, 0x1.fp+16383L, 4932.212175672014259683102930239951947672L, M_PI4_LOG10El);
2393 TEST_c_c (clog10, 0x1.fp+16383L, 0x1p+16383L, 4932.112944269463028900262609694408579449L, 0.2069271710841128115912940666587802677383L);
2394 TEST_c_c (clog10, 0x1p-16440L, 0x1p-16441L, -4948.884673709346821106688037612752099609L, 0.2013595981366865710389502301937289472543L);
2397 END (clog10, complex);
2405 TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
2406 TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
2407 TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
2408 TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
2409 TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
2410 TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
2411 TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
2413 END (conj, complex);
2418 copysign_test (void)
2422 TEST_ff_f (copysign, 0, 4, 0);
2423 TEST_ff_f (copysign, 0, -4, minus_zero);
2424 TEST_ff_f (copysign, minus_zero, 4, 0);
2425 TEST_ff_f (copysign, minus_zero, -4, minus_zero);
2427 TEST_ff_f (copysign, plus_infty, 0, plus_infty);
2428 TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
2429 TEST_ff_f (copysign, minus_infty, 0, plus_infty);
2430 TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
2432 TEST_ff_f (copysign, 0, plus_infty, 0);
2433 TEST_ff_f (copysign, 0, minus_zero, minus_zero);
2434 TEST_ff_f (copysign, minus_zero, plus_infty, 0);
2435 TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
2437 /* XXX More correctly we would have to check the sign of the NaN. */
2438 TEST_ff_f (copysign, nan_value, 0, nan_value);
2439 TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
2440 TEST_ff_f (copysign, -nan_value, 0, nan_value);
2441 TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
2452 if (errno == ENOSYS)
2453 /* Function not implemented. */
2458 TEST_f_f (cos, 0, 1);
2459 TEST_f_f (cos, minus_zero, 1);
2461 TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
2462 check_int ("errno for cos(+inf) == EDOM", errno, EDOM, 0, 0, 0);
2464 TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
2465 check_int ("errno for cos(-inf) == EDOM", errno, EDOM, 0, 0, 0);
2467 TEST_f_f (cos, nan_value, nan_value);
2468 check_int ("errno for cos(NaN) unchanged", errno, 0, 0, 0, 0);
2470 TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
2471 TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
2472 TEST_f_f (cos, M_PI_2l, 0);
2474 TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
2476 TEST_f_f (cos, 0x1p65, 0.99888622066058013610642172179340364209972L);
2477 TEST_f_f (cos, -0x1p65, 0.99888622066058013610642172179340364209972L);
2480 TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
2484 TEST_f_f (cos, 1e22, 0.5232147853951389454975944733847094921409L);
2485 TEST_f_f (cos, 0x1p1023, -0.826369834614147994500785680811743734805L);
2488 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
2489 TEST_f_f (cos, 0x1p16383L, 0.9210843909921906206874509522505756251609L);
2497 cos_test_tonearest (void)
2499 int save_round_mode;
2502 if (errno == ENOSYS)
2503 /* Function not implemented. */
2506 START (cos_tonearest);
2508 save_round_mode = fegetround ();
2510 if (!fesetround (FE_TONEAREST))
2512 TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L);
2513 TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L);
2514 TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L);
2515 TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L);
2516 TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L);
2517 TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L);
2518 TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L);
2519 TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L);
2520 TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L);
2521 TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L);
2524 fesetround (save_round_mode);
2526 END (cos_tonearest);
2531 cos_test_towardzero (void)
2533 int save_round_mode;
2536 if (errno == ENOSYS)
2537 /* Function not implemented. */
2540 START (cos_towardzero);
2542 save_round_mode = fegetround ();
2544 if (!fesetround (FE_TOWARDZERO))
2546 TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L);
2547 TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L);
2548 TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L);
2549 TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L);
2550 TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L);
2551 TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L);
2552 TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L);
2553 TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L);
2554 TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L);
2555 TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L);
2558 fesetround (save_round_mode);
2560 END (cos_towardzero);
2565 cos_test_downward (void)
2567 int save_round_mode;
2570 if (errno == ENOSYS)
2571 /* Function not implemented. */
2574 START (cos_downward);
2576 save_round_mode = fegetround ();
2578 if (!fesetround (FE_DOWNWARD))
2580 TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L);
2581 TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L);
2582 TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L);
2583 TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L);
2584 TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L);
2585 TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L);
2586 TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L);
2587 TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L);
2588 TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L);
2589 TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L);
2592 fesetround (save_round_mode);
2599 cos_test_upward (void)
2601 int save_round_mode;
2604 if (errno == ENOSYS)
2605 /* Function not implemented. */
2610 save_round_mode = fegetround ();
2612 if (!fesetround (FE_UPWARD))
2614 TEST_f_f (cos, 1, 0.5403023058681397174009366074429766037323L);
2615 TEST_f_f (cos, 2, -0.4161468365471423869975682295007621897660L);
2616 TEST_f_f (cos, 3, -0.9899924966004454572715727947312613023937L);
2617 TEST_f_f (cos, 4, -0.6536436208636119146391681830977503814241L);
2618 TEST_f_f (cos, 5, 0.2836621854632262644666391715135573083344L);
2619 TEST_f_f (cos, 6, 0.9601702866503660205456522979229244054519L);
2620 TEST_f_f (cos, 7, 0.7539022543433046381411975217191820122183L);
2621 TEST_f_f (cos, 8, -0.1455000338086135258688413818311946826093L);
2622 TEST_f_f (cos, 9, -0.9111302618846769883682947111811653112463L);
2623 TEST_f_f (cos, 10, -0.8390715290764524522588639478240648345199L);
2626 fesetround (save_round_mode);
2637 if (errno == ENOSYS)
2638 /* Function not implemented. */
2642 TEST_f_f (cosh, 0, 1);
2643 TEST_f_f (cosh, minus_zero, 1);
2646 TEST_f_f (cosh, plus_infty, plus_infty);
2647 TEST_f_f (cosh, minus_infty, plus_infty);
2649 TEST_f_f (cosh, nan_value, nan_value);
2651 TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
2658 cosh_test_tonearest (void)
2660 int save_round_mode;
2663 if (errno == ENOSYS)
2664 /* Function not implemented. */
2667 START (cosh_tonearest);
2669 save_round_mode = fegetround ();
2671 if (!fesetround (FE_TONEAREST))
2673 TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L);
2674 TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L);
2675 TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L);
2678 fesetround (save_round_mode);
2680 END (cosh_tonearest);
2685 cosh_test_towardzero (void)
2687 int save_round_mode;
2690 if (errno == ENOSYS)
2691 /* Function not implemented. */
2694 START (cosh_towardzero);
2696 save_round_mode = fegetround ();
2698 if (!fesetround (FE_TOWARDZERO))
2700 TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L);
2701 TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L);
2702 TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L);
2705 fesetround (save_round_mode);
2707 END (cosh_towardzero);
2712 cosh_test_downward (void)
2714 int save_round_mode;
2717 if (errno == ENOSYS)
2718 /* Function not implemented. */
2721 START (cosh_downward);
2723 save_round_mode = fegetround ();
2725 if (!fesetround (FE_DOWNWARD))
2727 TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L);
2728 TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L);
2729 TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L);
2732 fesetround (save_round_mode);
2734 END (cosh_downward);
2739 cosh_test_upward (void)
2741 int save_round_mode;
2744 if (errno == ENOSYS)
2745 /* Function not implemented. */
2748 START (cosh_upward);
2750 save_round_mode = fegetround ();
2752 if (!fesetround (FE_UPWARD))
2754 TEST_f_f (cosh, 22, 1792456423.065795780980053377632656584997L);
2755 TEST_f_f (cosh, 23, 4872401723.124451300068625740569997090344L);
2756 TEST_f_f (cosh, 24, 13244561064.92173614708845674912733665919L);
2759 fesetround (save_round_mode);
2769 FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
2770 if (errno == ENOSYS)
2771 /* Function not implemented. */
2776 TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
2777 TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
2779 TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
2780 TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
2782 TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
2784 TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
2785 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
2786 TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
2787 TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
2789 END (cpow, complex);
2797 TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
2798 TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
2799 TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
2800 TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
2802 TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
2804 TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
2805 TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
2806 TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
2807 TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
2809 TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
2810 TEST_c_c (cproj, 2.0, 3.0, 2.0, 3.0);
2812 END (cproj, complex);
2820 TEST_c_f (creal, 0.0, 1.0, 0.0);
2821 TEST_c_f (creal, minus_zero, 1.0, minus_zero);
2822 TEST_c_f (creal, nan_value, 1.0, nan_value);
2823 TEST_c_f (creal, nan_value, nan_value, nan_value);
2824 TEST_c_f (creal, plus_infty, 1.0, plus_infty);
2825 TEST_c_f (creal, minus_infty, 1.0, minus_infty);
2826 TEST_c_f (creal, 2.0, 3.0, 2.0);
2835 FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2836 if (errno == ENOSYS)
2837 /* Function not implemented. */
2842 TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
2843 TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
2844 TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
2845 TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
2847 TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
2848 TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
2849 TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
2850 TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
2852 TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2853 TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2854 TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2855 TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2857 TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2858 TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2859 TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2860 TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2862 TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2863 TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2864 TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
2865 TEST_c_c (csin, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
2867 TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
2868 TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
2869 TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
2870 TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
2872 TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2873 TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
2875 TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2876 TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
2878 TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2879 TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2881 TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
2882 TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
2884 TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2885 TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2887 TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2888 TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2890 TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
2892 TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
2893 TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
2895 END (csin, complex);
2903 FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2904 if (errno == ENOSYS)
2905 /* Function not implemented. */
2910 TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
2911 TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
2912 TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
2913 TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
2915 TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2916 TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2917 TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2918 TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2920 TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
2921 TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
2922 TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
2923 TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
2925 TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2926 TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2927 TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2928 TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2930 TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
2931 TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
2932 TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
2933 TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
2935 TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2936 TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2937 TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2938 TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
2940 TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2941 TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
2943 TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2944 TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
2946 TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2947 TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
2949 TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
2950 TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
2952 TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2953 TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
2955 TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2956 TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
2958 TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
2960 TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
2961 TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
2963 END (csinh, complex);
2971 FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2972 if (errno == ENOSYS)
2973 /* Function not implemented. */
2978 TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
2979 TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
2980 TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
2981 TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
2983 TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
2984 TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
2985 TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
2986 TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
2988 TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
2989 TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
2990 TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
2991 TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
2993 TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
2994 TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
2995 TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
2996 TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
2997 TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
2998 TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
2999 TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
3000 TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
3001 TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
3002 TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
3003 TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
3004 TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
3006 TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
3008 TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
3010 TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3011 TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3012 TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3013 TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3015 TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
3016 TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
3017 TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
3018 TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
3020 TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
3022 TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
3023 TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
3024 TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
3025 TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
3026 TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
3027 TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
3028 TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
3029 /* Principal square root should be returned (i.e., non-negative real
3031 TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
3033 TEST_c_c (csqrt, 0x1.fffffep+127L, 0x1.fffffep+127L, 2.026714405498316804978751017492482558075e+19L, 8.394925938143272988211878516208015586281e+18L);
3034 TEST_c_c (csqrt, 0x1.fffffep+127L, 1.0L, 1.844674352395372953599975585936590505260e+19L, 2.710505511993121390769065968615872097053e-20L);
3035 TEST_c_c (csqrt, 0x1p-149L, 0x1p-149L, 4.112805464342778798097003462770175200803e-23L, 1.703579802732953750368659735601389709551e-23L);
3036 TEST_c_c (csqrt, 0x1p-147L, 0x1p-147L, 8.225610928685557596194006925540350401606e-23L, 3.407159605465907500737319471202779419102e-23L);
3039 TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 1.473094556905565378990473658199034571917e+154L, 6.101757441282702188537080005372547713595e+153L);
3040 TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 1.379778091031440685006200821918878702861e+154L, 3.257214233483129514781233066898042490248e+153L);
3041 TEST_c_c (csqrt, 0x1p-1074L, 0x1p-1074L, 2.442109726130830256743814843868934877597e-162L, 1.011554969366634726113090867589031782487e-162L);
3042 TEST_c_c (csqrt, 0x1p-1073L, 0x1p-1073L, 3.453664695497464982856905711457966660085e-162L, 1.430554756764195530630723976279903095110e-162L);
3045 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3046 TEST_c_c (csqrt, 0x1.fp+16383L, 0x1.fp+16383L, 1.179514222452201722651836720466795901016e+2466L, 4.885707879516577666702435054303191575148e+2465L);
3047 TEST_c_c (csqrt, 0x1.fp+16383L, 0x1p+16383L, 1.106698967236475180613254276996359485630e+2466L, 2.687568007603946993388538156299100955642e+2465L);
3048 TEST_c_c (csqrt, 0x1p-16440L, 0x1p-16441L, 3.514690655930285351254618340783294558136e-2475L, 8.297059146828716918029689466551384219370e-2476L);
3051 END (csqrt, complex);
3058 FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
3059 if (errno == ENOSYS)
3060 /* Function not implemented. */
3065 TEST_c_c (ctan, 0, 0, 0.0, 0.0);
3066 TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
3067 TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
3068 TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
3070 TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
3071 TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
3072 TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
3073 TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
3075 TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
3076 TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
3077 TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
3078 TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
3080 TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
3081 TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
3082 TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
3083 TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
3084 TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
3085 TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
3086 TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
3087 TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
3089 TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
3090 TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
3092 TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
3093 TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
3095 TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3096 TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3098 TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
3099 TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
3100 TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
3101 TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
3103 TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
3105 TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
3106 TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
3108 TEST_c_c (ctan, 1, 45, 1.490158918874345552942703234806348520895e-39L, 1.000000000000000000000000000000000000001L);
3109 TEST_c_c (ctan, 1, 47, 2.729321264492904590777293425576722354636e-41L, 1.0);
3112 TEST_c_c (ctan, 1, 355, 8.140551093483276762350406321792653551513e-309L, 1.0);
3113 TEST_c_c (ctan, 1, 365, 1.677892637497921890115075995898773550884e-317L, 1.0);
3116 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3117 TEST_c_c (ctan, 1, 5680, 4.725214596136812019616700920476949798307e-4934L, 1.0);
3118 TEST_c_c (ctan, 1, 5690, 9.739393181626937151720816611272607059057e-4943L, 1.0);
3121 TEST_c_c (ctan, 0x3.243f6cp-1, 0, -2.287733242885645987394874673945769518150e7L, 0.0);
3123 TEST_c_c (ctan, 0x1p127, 1, 0.2446359391192790896381501310437708987204L, 0.9101334047676183761532873794426475906201L);
3126 TEST_c_c (ctan, 0x1p1023, 1, -0.2254627924997545057926782581695274244229L, 0.8786063118883068695462540226219865087189L);
3129 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3130 TEST_c_c (ctan, 0x1p16383L, 1, 0.1608598776370396607204448234354670036772L, 0.8133818522051542536316746743877629761488L);
3133 TEST_c_c (ctan, 50000, 50000, plus_zero, 1.0);
3134 TEST_c_c (ctan, 50000, -50000, plus_zero, -1.0);
3135 TEST_c_c (ctan, -50000, 50000, minus_zero, 1.0);
3136 TEST_c_c (ctan, -50000, -50000, minus_zero, -1.0);
3138 END (ctan, complex);
3146 FUNC(ctanh) (BUILD_COMPLEX (0, 0));
3147 if (errno == ENOSYS)
3148 /* Function not implemented. */
3153 TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
3154 TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
3155 TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
3156 TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
3158 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
3159 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
3160 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
3161 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
3162 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
3163 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
3164 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
3165 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
3167 TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3168 TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3169 TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3170 TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3171 TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3172 TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3173 TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3174 TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
3176 TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
3177 TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
3179 TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
3180 TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
3182 TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
3183 TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
3185 TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3186 TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3187 TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3188 TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
3190 TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
3192 TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
3194 TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
3195 TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
3197 TEST_c_c (ctanh, 45, 1, 1.000000000000000000000000000000000000001L, 1.490158918874345552942703234806348520895e-39L);
3198 TEST_c_c (ctanh, 47, 1, 1.0, 2.729321264492904590777293425576722354636e-41L);
3201 TEST_c_c (ctanh, 355, 1, 1.0, 8.140551093483276762350406321792653551513e-309L);
3202 TEST_c_c (ctanh, 365, 1, 1.0, 1.677892637497921890115075995898773550884e-317L);
3205 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3206 TEST_c_c (ctanh, 5680, 1, 1.0, 4.725214596136812019616700920476949798307e-4934L);
3207 TEST_c_c (ctanh, 5690, 1, 1.0, 9.739393181626937151720816611272607059057e-4943L);
3210 TEST_c_c (ctanh, 0, 0x3.243f6cp-1, 0.0, -2.287733242885645987394874673945769518150e7L);
3212 TEST_c_c (ctanh, 1, 0x1p127, 0.9101334047676183761532873794426475906201L, 0.2446359391192790896381501310437708987204L);
3215 TEST_c_c (ctanh, 1, 0x1p1023, 0.8786063118883068695462540226219865087189L, -0.2254627924997545057926782581695274244229L);
3218 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3219 TEST_c_c (ctanh, 1, 0x1p16383L, 0.8133818522051542536316746743877629761488L, 0.1608598776370396607204448234354670036772L);
3222 TEST_c_c (ctanh, 50000, 50000, 1.0, plus_zero);
3223 TEST_c_c (ctanh, 50000, -50000, 1.0, minus_zero);
3224 TEST_c_c (ctanh, -50000, 50000, -1.0, plus_zero);
3225 TEST_c_c (ctanh, -50000, -50000, -1.0, minus_zero);
3227 END (ctanh, complex);
3236 if (errno == ENOSYS)
3237 /* Function not implemented. */
3242 TEST_f_f (erf, 0, 0);
3243 TEST_f_f (erf, minus_zero, minus_zero);
3244 TEST_f_f (erf, plus_infty, 1);
3245 TEST_f_f (erf, minus_infty, -1);
3246 TEST_f_f (erf, nan_value, nan_value);
3248 TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
3249 TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
3250 TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
3251 TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
3252 TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
3253 TEST_f_f (erf, 27.0L, 1.0L);
3264 if (errno == ENOSYS)
3265 /* Function not implemented. */
3270 TEST_f_f (erfc, plus_infty, 0.0);
3271 TEST_f_f (erfc, minus_infty, 2.0);
3272 TEST_f_f (erfc, 0.0, 1.0);
3273 TEST_f_f (erfc, minus_zero, 1.0);
3274 TEST_f_f (erfc, nan_value, nan_value);
3276 TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
3277 TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
3278 TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
3279 TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
3280 TEST_f_f (erfc, 0x1.f7303cp+1L, 2.705500297238986897105236321218861842255e-8L);
3281 TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
3282 TEST_f_f (erfc, 0x1.ffa002p+2L, 1.233585992097580296336099501489175967033e-29L);
3283 TEST_f_f (erfc, 0x1.ffffc8p+2L, 1.122671365033056305522366683719541099329e-29L);
3285 /* The result can only be represented in long double. */
3286 # if LDBL_MIN_10_EXP < -319
3287 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
3289 # if LDBL_MANT_DIG >= 106
3290 TEST_f_f (erfc, 0x1.ffff56789abcdef0123456789a8p+2L, 1.123161416304655390092138725253789378459e-29L);
3303 if (errno == ENOSYS)
3304 /* Function not implemented. */
3309 TEST_f_f (exp, 0, 1);
3310 TEST_f_f (exp, minus_zero, 1);
3313 TEST_f_f (exp, plus_infty, plus_infty);
3314 TEST_f_f (exp, minus_infty, 0);
3316 TEST_f_f (exp, nan_value, nan_value);
3317 TEST_f_f (exp, 1, M_El);
3319 TEST_f_f (exp, 2, M_E2l);
3320 TEST_f_f (exp, 3, M_E3l);
3321 TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
3322 TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
3323 TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L);
3324 #if defined TEST_LDOUBLE && __LDBL_MAX_EXP__ > 1024
3325 /* The result can only be represented in sane long double. */
3326 TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
3329 #if !(defined TEST_LDOUBLE && LDBL_MAX_EXP > 1024)
3330 TEST_f_f (exp, 710, plus_infty, OVERFLOW_EXCEPTION);
3332 TEST_f_f (exp, 1e5, plus_infty, OVERFLOW_EXCEPTION);
3333 TEST_f_f (exp, max_value, plus_infty, OVERFLOW_EXCEPTION);
3334 TEST_f_f (exp, -max_value, 0);
3341 exp_test_tonearest (void)
3343 int save_round_mode;
3346 if (errno == ENOSYS)
3347 /* Function not implemented. */
3350 START (exp_tonearest);
3352 save_round_mode = fegetround ();
3354 if (!fesetround (FE_TONEAREST))
3356 TEST_f_f (exp, 1, M_El);
3357 TEST_f_f (exp, 2, M_E2l);
3358 TEST_f_f (exp, 3, M_E3l);
3361 fesetround (save_round_mode);
3363 END (exp_tonearest);
3368 exp_test_towardzero (void)
3370 int save_round_mode;
3373 if (errno == ENOSYS)
3374 /* Function not implemented. */
3377 START (exp_towardzero);
3379 save_round_mode = fegetround ();
3381 if (!fesetround (FE_TOWARDZERO))
3383 TEST_f_f (exp, 1, M_El);
3384 TEST_f_f (exp, 2, M_E2l);
3385 TEST_f_f (exp, 3, M_E3l);
3388 fesetround (save_round_mode);
3390 END (exp_towardzero);
3395 exp_test_downward (void)
3397 int save_round_mode;
3400 if (errno == ENOSYS)
3401 /* Function not implemented. */
3404 START (exp_downward);
3406 save_round_mode = fegetround ();
3408 if (!fesetround (FE_DOWNWARD))
3410 TEST_f_f (exp, 1, M_El);
3411 TEST_f_f (exp, 2, M_E2l);
3412 TEST_f_f (exp, 3, M_E3l);
3415 fesetround (save_round_mode);
3422 exp_test_upward (void)
3424 int save_round_mode;
3427 if (errno == ENOSYS)
3428 /* Function not implemented. */
3433 save_round_mode = fegetround ();
3435 if (!fesetround (FE_UPWARD))
3437 TEST_f_f (exp, 1, M_El);
3438 TEST_f_f (exp, 2, M_E2l);
3439 TEST_f_f (exp, 3, M_E3l);
3442 fesetround (save_round_mode);
3453 if (errno == ENOSYS)
3454 /* Function not implemented. */
3459 TEST_f_f (exp10, 0, 1);
3460 TEST_f_f (exp10, minus_zero, 1);
3462 TEST_f_f (exp10, plus_infty, plus_infty);
3463 TEST_f_f (exp10, minus_infty, 0);
3464 TEST_f_f (exp10, nan_value, nan_value);
3465 TEST_f_f (exp10, 3, 1000);
3466 TEST_f_f (exp10, -1, 0.1L);
3467 TEST_f_f (exp10, 36, 1.0e36L);
3468 TEST_f_f (exp10, -36, 1.0e-36L);
3470 TEST_f_f (exp10, 305, 1.0e305L);
3471 TEST_f_f (exp10, -305, 1.0e-305L);
3473 #if defined TEST_LDOUBLE && LDBL_MAX_10_EXP >= 4932
3474 TEST_f_f (exp10, 4932, 1.0e4932L);
3475 TEST_f_f (exp10, -4932, 1.0e-4932L);
3477 TEST_f_f (exp10, 1e6, plus_infty, OVERFLOW_EXCEPTION);
3478 TEST_f_f (exp10, -1e6, 0);
3479 TEST_f_f (exp10, max_value, plus_infty, OVERFLOW_EXCEPTION);
3480 TEST_f_f (exp10, -max_value, 0);
3481 TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
3492 if (errno == ENOSYS)
3493 /* Function not implemented. */
3498 TEST_f_f (exp2, 0, 1);
3499 TEST_f_f (exp2, minus_zero, 1);
3500 TEST_f_f (exp2, plus_infty, plus_infty);
3501 TEST_f_f (exp2, minus_infty, 0);
3502 TEST_f_f (exp2, nan_value, nan_value);
3504 TEST_f_f (exp2, 10, 1024);
3505 TEST_f_f (exp2, -1, 0.5);
3506 TEST_f_f (exp2, 1e6, plus_infty, OVERFLOW_EXCEPTION);
3507 TEST_f_f (exp2, -1e6, 0);
3508 TEST_f_f (exp2, max_value, plus_infty, OVERFLOW_EXCEPTION);
3509 TEST_f_f (exp2, -max_value, 0);
3510 TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
3512 TEST_f_f (exp2, 100.5, 1.792728671193156477399422023278661496394e+30L);
3513 TEST_f_f (exp2, 127, 0x1p127);
3514 TEST_f_f (exp2, -149, 0x1p-149);
3517 TEST_f_f (exp2, 1000.25, 1.274245659452564874772384918171765416737e+301L);
3518 TEST_f_f (exp2, 1023, 0x1p1023);
3519 TEST_f_f (exp2, -1074, 0x1p-1074);
3522 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3523 TEST_f_f (exp2, 16383, 0x1p16383L);
3524 TEST_f_f (exp2, -16400, 0x1p-16400L);
3536 if (errno == ENOSYS)
3537 /* Function not implemented. */
3542 TEST_f_f (expm1, 0, 0);
3543 TEST_f_f (expm1, minus_zero, minus_zero);
3546 TEST_f_f (expm1, plus_infty, plus_infty);
3547 TEST_f_f (expm1, minus_infty, -1);
3549 TEST_f_f (expm1, nan_value, nan_value);
3551 TEST_f_f (expm1, 1, M_El - 1.0);
3552 TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
3554 TEST_f_f (expm1, 50.0L, 5.1847055285870724640864533229334853848275e+21L);
3557 TEST_f_f (expm1, 127.0L, 1.4302079958348104463583671072905261080748e+55L);
3558 TEST_f_f (expm1, 500.0L, 1.4035922178528374107397703328409120821806e+217L);
3561 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
3562 TEST_f_f (expm1, 11356.25L, 9.05128237311923300051376115753226014206e+4931L);
3566 TEST_f_f (expm1, 100000.0, plus_infty, OVERFLOW_EXCEPTION);
3567 check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0);
3568 TEST_f_f (expm1, max_value, plus_infty, OVERFLOW_EXCEPTION);
3569 TEST_f_f (expm1, -max_value, -1);
3580 TEST_f_f (fabs, 0, 0);
3581 TEST_f_f (fabs, minus_zero, 0);
3583 TEST_f_f (fabs, plus_infty, plus_infty);
3584 TEST_f_f (fabs, minus_infty, plus_infty);
3585 TEST_f_f (fabs, nan_value, nan_value);
3587 TEST_f_f (fabs, 38.0, 38.0);
3588 TEST_f_f (fabs, -M_El, M_El);
3599 TEST_ff_f (fdim, 0, 0, 0);
3600 TEST_ff_f (fdim, 9, 0, 9);
3601 TEST_ff_f (fdim, 0, 9, 0);
3602 TEST_ff_f (fdim, -9, 0, 0);
3603 TEST_ff_f (fdim, 0, -9, 9);
3605 TEST_ff_f (fdim, plus_infty, 9, plus_infty);
3606 TEST_ff_f (fdim, plus_infty, -9, plus_infty);
3607 TEST_ff_f (fdim, minus_infty, 9, 0);
3608 TEST_ff_f (fdim, minus_infty, -9, 0);
3609 TEST_ff_f (fdim, 9, minus_infty, plus_infty);
3610 TEST_ff_f (fdim, -9, minus_infty, plus_infty);
3611 TEST_ff_f (fdim, 9, plus_infty, 0);
3612 TEST_ff_f (fdim, -9, plus_infty, 0);
3614 TEST_ff_f (fdim, 0, nan_value, nan_value);
3615 TEST_ff_f (fdim, 9, nan_value, nan_value);
3616 TEST_ff_f (fdim, -9, nan_value, nan_value);
3617 TEST_ff_f (fdim, nan_value, 9, nan_value);
3618 TEST_ff_f (fdim, nan_value, -9, nan_value);
3619 TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
3620 TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
3621 TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
3622 TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
3623 TEST_ff_f (fdim, nan_value, nan_value, nan_value);
3625 TEST_ff_f (fdim, plus_infty, plus_infty, 0);
3636 TEST_f_f (floor, 0.0, 0.0);
3637 TEST_f_f (floor, minus_zero, minus_zero);
3638 TEST_f_f (floor, plus_infty, plus_infty);
3639 TEST_f_f (floor, minus_infty, minus_infty);
3640 TEST_f_f (floor, nan_value, nan_value);
3642 TEST_f_f (floor, M_PIl, 3.0);
3643 TEST_f_f (floor, -M_PIl, -4.0);
3645 TEST_f_f (floor, 0.1, 0.0);
3646 TEST_f_f (floor, 0.25, 0.0);
3647 TEST_f_f (floor, 0.625, 0.0);
3648 TEST_f_f (floor, -0.1, -1.0);
3649 TEST_f_f (floor, -0.25, -1.0);
3650 TEST_f_f (floor, -0.625, -1.0);
3653 /* The result can only be represented in long double. */
3654 TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
3655 TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
3656 TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
3657 TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
3658 TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
3659 # if LDBL_MANT_DIG > 100
3660 TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L);
3661 TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L);
3662 TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L);
3665 TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
3666 TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
3667 TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
3668 TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
3669 TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
3670 # if LDBL_MANT_DIG > 100
3671 TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L);
3672 TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L);
3673 TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L);
3676 TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
3677 TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
3678 TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
3679 TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
3680 TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
3682 # if LDBL_MANT_DIG > 100
3683 TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L);
3684 TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L);
3685 TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L);
3686 TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L);
3687 TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L);
3688 TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L);
3691 TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
3692 TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
3693 TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
3694 TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
3695 TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
3697 # if LDBL_MANT_DIG > 100
3698 TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L);
3699 TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L);
3700 TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L);
3701 TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L);
3702 TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L);
3703 TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L);
3706 TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
3707 TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
3708 TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
3709 TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
3710 TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
3712 TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
3713 TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
3714 TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
3715 TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
3716 TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
3718 TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
3719 TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
3720 TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
3721 TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
3722 TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
3724 TEST_f_f (floor, 0xf.ffffffffffffff8p+47L, 0xf.fffffffffffep+47L);
3725 TEST_f_f (floor, -0x8.000000000000004p+48L, -0x8.000000000001p+48L);
3737 TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
3738 TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
3739 TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
3740 TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
3741 TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
3742 TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
3743 TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
3744 TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
3745 TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
3746 TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
3747 TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
3748 TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
3750 TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3751 TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
3752 TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
3753 TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
3754 TEST_fff_f (fma, plus_infty, 3.5L, minus_infty, nan_value, INVALID_EXCEPTION);
3755 TEST_fff_f (fma, minus_infty, -7.5L, minus_infty, nan_value, INVALID_EXCEPTION);
3756 TEST_fff_f (fma, -13.5L, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
3757 TEST_fff_f (fma, minus_infty, 7.5L, plus_infty, nan_value, INVALID_EXCEPTION);
3759 TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
3761 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
3762 LDBL_MAX, DBL_MAX, FLT_MAX);
3763 TEST_fff_f (fma, -fltmax, -fltmax, minus_infty, minus_infty);
3764 TEST_fff_f (fma, fltmax / 2, fltmax / 2, minus_infty, minus_infty);
3765 TEST_fff_f (fma, -fltmax, fltmax, plus_infty, plus_infty);
3766 TEST_fff_f (fma, fltmax / 2, -fltmax / 4, plus_infty, plus_infty);
3767 TEST_fff_f (fma, plus_infty, 4, plus_infty, plus_infty);
3768 TEST_fff_f (fma, 2, minus_infty, minus_infty, minus_infty);
3769 TEST_fff_f (fma, minus_infty, minus_infty, plus_infty, plus_infty);
3770 TEST_fff_f (fma, plus_infty, minus_infty, minus_infty, minus_infty);
3772 #if defined (TEST_FLOAT) && FLT_MANT_DIG == 24
3773 TEST_fff_f (fma, 0x1.7ff8p+13, 0x1.000002p+0, 0x1.ffffp-24, 0x1.7ff802p+13);
3774 TEST_fff_f (fma, 0x1.fffp+0, 0x1.00001p+0, -0x1.fffp+0, 0x1.fffp-20);
3775 TEST_fff_f (fma, 0x1.9abcdep+127, 0x0.9abcdep-126, -0x1.f08948p+0, 0x1.bb421p-25);
3776 TEST_fff_f (fma, 0x1.9abcdep+100, 0x0.9abcdep-126, -0x1.f08948p-27, 0x1.bb421p-52);
3777 TEST_fff_f (fma, 0x1.fffffep+127, 0x1.001p+0, -0x1.fffffep+127, 0x1.fffffep+115);
3778 TEST_fff_f (fma, -0x1.fffffep+127, 0x1.fffffep+0, 0x1.fffffep+127, -0x1.fffffap+127);
3779 TEST_fff_f (fma, 0x1.fffffep+127, 2.0, -0x1.fffffep+127, 0x1.fffffep+127);
3781 #if defined (TEST_DOUBLE) && DBL_MANT_DIG == 53
3782 TEST_fff_f (fma, 0x1.7fp+13, 0x1.0000000000001p+0, 0x1.ffep-48, 0x1.7f00000000001p+13);
3783 TEST_fff_f (fma, 0x1.fffp+0, 0x1.0000000000001p+0, -0x1.fffp+0, 0x1.fffp-52);
3784 TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, 0x1p-300, 1.0);
3785 TEST_fff_f (fma, 0x1.0000002p+0, 0x1.ffffffcp-1, -0x1p-300, 0x1.fffffffffffffp-1);
3786 TEST_fff_f (fma, 0x1.deadbeef2feedp+1023, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp+1, 0x1.0989687bc9da4p-53);
3787 TEST_fff_f (fma, 0x1.deadbeef2feedp+900, 0x0.deadbeef2feedp-1022, -0x1.a05f8c01a4bfbp-122, 0x1.0989687bc9da4p-176);
3788 TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 0x1.001p+0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1011);
3789 TEST_fff_f (fma, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+0, 0x1.fffffffffffffp+1023, -0x1.ffffffffffffdp+1023);
3790 TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 2.0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023);
3791 TEST_fff_f (fma, 0x1.6a09e667f3bccp-538, 0x1.6a09e667f3bccp-538, 0.0, 0.0);
3792 TEST_fff_f (fma, 0x1.deadbeef2feedp-495, 0x1.deadbeef2feedp-495, -0x1.bf86a5786a574p-989, 0x0.0000042625a1fp-1022);
3793 TEST_fff_f (fma, 0x1.deadbeef2feedp-503, 0x1.deadbeef2feedp-503, -0x1.bf86a5786a574p-1005, 0x0.0000000004262p-1022);
3794 TEST_fff_f (fma, 0x1p-537, 0x1p-538, 0x1p-1074, 0x0.0000000000002p-1022);
3795 TEST_fff_f (fma, 0x1.7fffff8p-968, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000001p-1022);
3796 TEST_fff_f (fma, 0x1.4000004p-967, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000003p-1022);
3797 TEST_fff_f (fma, 0x1.4p-967, -0x1p-106, -0x0.000001p-1022, -0x0.0000010000002p-1022);
3798 TEST_fff_f (fma, -0x1.19cab66d73e17p-959, 0x1.c7108a8c5ff51p-107, -0x0.80b0ad65d9b64p-1022, -0x0.80b0ad65d9d59p-1022);
3799 TEST_fff_f (fma, -0x1.d2eaed6e8e9d3p-979, -0x1.4e066c62ac9ddp-63, -0x0.9245e6b003454p-1022, -0x0.9245c09c5fb5dp-1022);
3800 TEST_fff_f (fma, 0x1.153d650bb9f06p-907, 0x1.2d01230d48407p-125, -0x0.b278d5acfc3cp-1022, -0x0.b22757123bbe9p-1022);
3801 TEST_fff_f (fma, -0x1.fffffffffffffp-711, 0x1.fffffffffffffp-275, 0x1.fffffe00007ffp-983, 0x1.7ffffe00007ffp-983);
3803 #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 64
3804 TEST_fff_f (fma, -0x8.03fcp+3696L, 0xf.fffffffffffffffp-6140L, 0x8.3ffffffffffffffp-2450L, -0x8.01ecp-2440L);
3805 TEST_fff_f (fma, 0x9.fcp+2033L, -0x8.000e1f000ff800fp-3613L, -0xf.fffffffffffc0ffp-1579L, -0xd.fc119fb093ed092p-1577L);
3806 TEST_fff_f (fma, 0xc.7fc000003ffffffp-1194L, 0x8.1e0003fffffffffp+15327L, -0x8.fffep+14072L, 0xc.ae9f164020effffp+14136L);
3807 TEST_fff_f (fma, -0x8.0001fc000000003p+1798L, 0xcp-2230L, 0x8.f7e000000000007p-468L, -0xc.0002f9ffee10404p-429L);
3808 TEST_fff_f (fma, 0xc.0000000000007ffp+10130L, -0x8.000000000000001p+4430L, 0xc.07000000001ffffp+14513L, -0xb.fffffffffffd7e4p+14563L);
3809 TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L);
3811 #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 113
3812 TEST_fff_f (fma, 0x1.bb2de33e02ccbbfa6e245a7c1f71p-2584L, -0x1.6b500daf0580d987f1bc0cadfcddp-13777L, 0x1.613cd91d9fed34b33820e5ab9d8dp-16378L, -0x1.3a79fb50eb9ce887cffa0f09bd9fp-16360L);
3813 TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L);
3814 TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L);
3815 TEST_fff_f (fma, -0x1.ac79c9376ef447f3827c9e9de008p-2228L, -0x1.5ba830022b6139e21fbe7270cad8p-6314L, 0x1.e8282b6a26bb6a9daf5c8e73e9f9p-8616L, 0x1.22f14a0253878a730cd1aee373adp-8541L);
3816 TEST_fff_f (fma, -0x1.c69749ec574caaa2ab8e97ddb9f3p+2652L, 0x1.f34235ff9d095449c29b4831b62dp+3311L, 0x1.fbe4302df23354dbd0c4d3cfe606p+5879L, -0x1.bb473bfdfb7a6e18886ce6e57eafp+5964L);
3817 TEST_fff_f (fma, -0x1.ca8835fc6ecfb5398625fc891be5p-1686L, 0x1.621e1972bbe2180e5be9dd7d8df5p-7671L, -0x1.7d2d21b73b52cf20dec2a83902a4p-9395L, -0x1.3d2322191c9c88bc68a62ab8042cp-9356L);
3818 TEST_fff_f (fma, -0x1.55cff679ec49c2541fab41fc843ep-11819L, 0x1.e60e9f464f9e8df0509647c7c971p+12325L, 0x1.eaa2a7649d765c2f564f7a5beca7p+454L, -0x1.447e29fa7e406a285f4e350fcf86p+507L);
3819 TEST_fff_f (fma, 0x1.f0e7b1454908576f2537d863cf9bp+11432L, 0x1.cdce52f09d4ca76e68706f34b5d5p-1417L, -0x1.2e986187c70f146235ea2066e486p+9979L, 0x1.c030dad3cc5643f3dd0f5619f661p+10016L);
3820 TEST_fff_f (fma, 0x1.f102f7da4a57a3a4aab620e29452p-3098L, -0x1.cc06a4ff40248f9e2dcc4b6afd84p-11727L, 0x1.d512a11126b5ac8ed8973b8580c8p-14849L, -0x1.be8f1cf737ab4d1c31c54f5ec23bp-14824L);
3821 TEST_fff_f (fma, -0x1.fc47ac7434b993cd8dcb2b431f25p-3816L, 0x1.fbc9750da8468852d84558e1db6dp-5773L, -0x1.00a98abf783f75c40fe5b7a37d86p-9607L, -0x1.f81917b166f45e763cfcc057e2adp-9588L);
3822 TEST_fff_f (fma, 0x1.00000000000007ffffffffffffffp-9045L, -0x1.ffffffffffff80000001ffffffffp+4773L, -0x1.f8p-4316L, -0x1.00000000000f88000000fffffdffp-4271L);
3823 TEST_fff_f (fma, 0x1.4e922764c90701d4a2f21d01893dp-8683L, -0x1.955a12e2d7c9447c27fa022fc865p+212L, -0x1.e9634462eaef96528b90b6944578p-8521L, -0x1.08e1783184a371943d3598e10865p-8470L);
3824 TEST_fff_f (fma, 0x1.801181509c03bdbef10d6165588cp-15131L, 0x1.ad86f8e57d3d40bfa8007780af63p-368L, -0x1.6e9df0dab1c9f1d7a6043c390741p-15507L, 0x1.417c9b2b15e2ad57dc9e0e920844p-15498L);
3836 TEST_ff_f (fmax, 0, 0, 0);
3837 TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
3838 TEST_ff_f (fmax, 9, 0, 9);
3839 TEST_ff_f (fmax, 0, 9, 9);
3840 TEST_ff_f (fmax, -9, 0, 0);
3841 TEST_ff_f (fmax, 0, -9, 0);
3843 TEST_ff_f (fmax, plus_infty, 9, plus_infty);
3844 TEST_ff_f (fmax, 0, plus_infty, plus_infty);
3845 TEST_ff_f (fmax, -9, plus_infty, plus_infty);
3846 TEST_ff_f (fmax, plus_infty, -9, plus_infty);
3848 TEST_ff_f (fmax, minus_infty, 9, 9);
3849 TEST_ff_f (fmax, minus_infty, -9, -9);
3850 TEST_ff_f (fmax, 9, minus_infty, 9);
3851 TEST_ff_f (fmax, -9, minus_infty, -9);
3853 TEST_ff_f (fmax, 0, nan_value, 0);
3854 TEST_ff_f (fmax, 9, nan_value, 9);
3855 TEST_ff_f (fmax, -9, nan_value, -9);
3856 TEST_ff_f (fmax, nan_value, 0, 0);
3857 TEST_ff_f (fmax, nan_value, 9, 9);
3858 TEST_ff_f (fmax, nan_value, -9, -9);
3859 TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
3860 TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
3861 TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
3862 TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
3863 TEST_ff_f (fmax, nan_value, nan_value, nan_value);
3874 TEST_ff_f (fmin, 0, 0, 0);
3875 TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
3876 TEST_ff_f (fmin, 9, 0, 0);
3877 TEST_ff_f (fmin, 0, 9, 0);
3878 TEST_ff_f (fmin, -9, 0, -9);
3879 TEST_ff_f (fmin, 0, -9, -9);
3881 TEST_ff_f (fmin, plus_infty, 9, 9);
3882 TEST_ff_f (fmin, 9, plus_infty, 9);
3883 TEST_ff_f (fmin, plus_infty, -9, -9);
3884 TEST_ff_f (fmin, -9, plus_infty, -9);
3885 TEST_ff_f (fmin, minus_infty, 9, minus_infty);
3886 TEST_ff_f (fmin, minus_infty, -9, minus_infty);
3887 TEST_ff_f (fmin, 9, minus_infty, minus_infty);
3888 TEST_ff_f (fmin, -9, minus_infty, minus_infty);
3890 TEST_ff_f (fmin, 0, nan_value, 0);
3891 TEST_ff_f (fmin, 9, nan_value, 9);
3892 TEST_ff_f (fmin, -9, nan_value, -9);
3893 TEST_ff_f (fmin, nan_value, 0, 0);
3894 TEST_ff_f (fmin, nan_value, 9, 9);
3895 TEST_ff_f (fmin, nan_value, -9, -9);
3896 TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
3897 TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
3898 TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
3899 TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
3900 TEST_ff_f (fmin, nan_value, nan_value, nan_value);
3910 FUNC(fmod) (6.5, 2.3L);
3911 if (errno == ENOSYS)
3912 /* Function not implemented. */
3917 /* fmod (+0, y) == +0 for y != 0. */
3918 TEST_ff_f (fmod, 0, 3, 0);
3920 /* fmod (-0, y) == -0 for y != 0. */
3921 TEST_ff_f (fmod, minus_zero, 3, minus_zero);
3923 /* fmod (+inf, y) == NaN plus invalid exception. */
3925 TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
3926 check_int ("errno for fmod(Inf,3) unchanged", errno, EDOM, 0, 0, 0);
3927 /* fmod (-inf, y) == NaN plus invalid exception. */
3929 TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
3930 check_int ("errno for fmod(-Inf,3) unchanged", errno, EDOM, 0, 0, 0);
3931 /* fmod (x, +0) == NaN plus invalid exception. */
3933 TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
3934 check_int ("errno for fmod(3,0) unchanged", errno, EDOM, 0, 0, 0);
3935 /* fmod (x, -0) == NaN plus invalid exception. */
3936 TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
3938 /* fmod (x, +inf) == x for x not infinite. */
3939 TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
3940 /* fmod (x, -inf) == x for x not infinite. */
3941 TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
3943 TEST_ff_f (fmod, nan_value, nan_value, nan_value);
3945 TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
3946 TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
3947 TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
3948 TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
3955 fpclassify_test (void)
3959 TEST_f_i (fpclassify, nan_value, FP_NAN);
3960 TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
3961 TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
3962 TEST_f_i (fpclassify, plus_zero, FP_ZERO);
3963 TEST_f_i (fpclassify, minus_zero, FP_ZERO);
3964 TEST_f_i (fpclassify, 1000, FP_NORMAL);
3977 TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
3978 TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
3979 TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
3981 TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
3982 TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
3984 TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
3985 TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
3997 if (errno == ENOSYS)
3998 /* Function not implemented. */
4000 feclearexcept (FE_ALL_EXCEPT);
4004 TEST_f_f (gamma, plus_infty, plus_infty);
4005 TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4006 TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4007 TEST_f_f (gamma, minus_infty, plus_infty);
4008 TEST_f_f (gamma, nan_value, nan_value);
4010 TEST_f_f1 (gamma, 1, 0, 1);
4011 TEST_f_f1 (gamma, 3, M_LN2l, 1);
4013 TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
4014 TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
4023 FUNC(hypot) (0.7L, 12.4L);
4024 if (errno == ENOSYS)
4025 /* Function not implemented. */
4030 TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
4031 TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
4034 TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
4035 TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
4036 TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
4037 TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
4040 TEST_ff_f (hypot, nan_value, nan_value, nan_value);
4042 /* hypot (x,y) == hypot (+-x, +-y) */
4043 TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
4044 TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
4045 TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
4046 TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
4047 TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
4048 TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
4049 TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
4050 TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
4052 /* hypot (x,0) == fabs (x) */
4053 TEST_ff_f (hypot, 0.75L, 0, 0.75L);
4054 TEST_ff_f (hypot, -0.75L, 0, 0.75L);
4055 TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
4057 TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
4059 #if !(defined TEST_FLOAT && defined TEST_INLINE)
4060 TEST_ff_f (hypot, 0x3p125L, 0x4p125L, 0x5p125L);
4061 TEST_ff_f (hypot, 0x1.234566p-126L, 0x1.234566p-126L, 1.891441686191081936598531534017449451173e-38L);
4064 #if !defined TEST_FLOAT && !(defined TEST_DOUBLE && defined TEST_INLINE)
4065 TEST_ff_f (hypot, 0x3p1021L, 0x4p1021L, 0x5p1021L);
4068 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 && !defined TEST_INLINE
4069 TEST_ff_f (hypot, 0x3p16381L, 0x4p16381L, 0x5p16381L);
4081 TEST_f_i (ilogb, 1, 0);
4082 TEST_f_i (ilogb, M_El, 1);
4083 TEST_f_i (ilogb, 1024, 10);
4084 TEST_f_i (ilogb, -2000, 10);
4086 /* ilogb (0.0) == FP_ILOGB0 plus invalid exception */
4088 TEST_f_i (ilogb, 0.0, FP_ILOGB0, INVALID_EXCEPTION);
4089 check_int ("errno for ilogb(0.0) unchanged", errno, EDOM, 0, 0, 0);
4090 /* ilogb (NaN) == FP_ILOGBNAN plus invalid exception */
4092 TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, INVALID_EXCEPTION);
4093 check_int ("errno for ilogb(NaN) unchanged", errno, EDOM, 0, 0, 0);
4094 /* ilogb (inf) == INT_MAX plus invalid exception */
4096 TEST_f_i (ilogb, plus_infty, INT_MAX, INVALID_EXCEPTION);
4097 check_int ("errno for ilogb(Inf) unchanged", errno, EDOM, 0, 0, 0);
4098 /* ilogb (-inf) == INT_MAX plus invalid exception */
4100 TEST_f_i (ilogb, minus_infty, INT_MAX, INVALID_EXCEPTION);
4101 check_int ("errno for ilogb(-Inf) unchanged", errno, EDOM, 0, 0, 0);
4107 isfinite_test (void)
4111 TEST_f_b (isfinite, 0, 1);
4112 TEST_f_b (isfinite, minus_zero, 1);
4113 TEST_f_b (isfinite, 10, 1);
4114 TEST_f_b (isfinite, plus_infty, 0);
4115 TEST_f_b (isfinite, minus_infty, 0);
4116 TEST_f_b (isfinite, nan_value, 0);
4122 isnormal_test (void)
4126 TEST_f_b (isnormal, 0, 0);
4127 TEST_f_b (isnormal, minus_zero, 0);
4128 TEST_f_b (isnormal, 10, 1);
4129 TEST_f_b (isnormal, plus_infty, 0);
4130 TEST_f_b (isnormal, minus_infty, 0);
4131 TEST_f_b (isnormal, nan_value, 0);
4141 FUNC (sincos) (0, &s, &c);
4142 if (errno == ENOSYS)
4143 /* Required function not implemented. */
4146 if (errno == ENOSYS)
4147 /* Function not implemented. */
4152 /* j0 is the Bessel function of the first kind of order 0 */
4153 TEST_f_f (j0, nan_value, nan_value);
4154 TEST_f_f (j0, plus_infty, 0);
4155 TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
4156 TEST_f_f (j0, 0.0, 1.0);
4157 TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
4158 TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
4159 TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
4160 TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
4161 TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
4162 TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
4163 TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
4164 TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
4165 TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
4167 TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L);
4170 TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L);
4182 FUNC (sincos) (0, &s, &c);
4183 if (errno == ENOSYS)
4184 /* Required function not implemented. */
4187 if (errno == ENOSYS)
4188 /* Function not implemented. */
4191 /* j1 is the Bessel function of the first kind of order 1 */
4195 TEST_f_f (j1, nan_value, nan_value);
4196 TEST_f_f (j1, plus_infty, 0);
4198 TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
4199 TEST_f_f (j1, 0.0, 0.0);
4200 TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
4201 TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
4202 TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
4203 TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
4204 TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
4205 TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
4206 TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
4208 TEST_f_f (j1, 0x1.3ffp+74L, 1.818984347516051243459364437186082741567e-12L);
4211 TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
4222 FUNC (sincos) (0, &s, &c);
4223 if (errno == ENOSYS)
4224 /* Required function not implemented. */
4227 if (errno == ENOSYS)
4228 /* Function not implemented. */
4231 /* jn is the Bessel function of the first kind of order n. */
4234 /* jn (0, x) == j0 (x) */
4235 TEST_ff_f (jn, 0, nan_value, nan_value);
4236 TEST_ff_f (jn, 0, plus_infty, 0);
4237 TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
4238 TEST_ff_f (jn, 0, 0.0, 1.0);
4239 TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
4240 TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
4241 TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
4242 TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
4243 TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
4244 TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
4245 TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
4246 TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
4247 TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
4249 /* jn (1, x) == j1 (x) */
4250 TEST_ff_f (jn, 1, nan_value, nan_value);
4251 TEST_ff_f (jn, 1, plus_infty, 0);
4252 TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
4253 TEST_ff_f (jn, 1, 0.0, 0.0);
4254 TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
4255 TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
4256 TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
4257 TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
4258 TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
4259 TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
4260 TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
4263 TEST_ff_f (jn, 3, nan_value, nan_value);
4264 TEST_ff_f (jn, 3, plus_infty, 0);
4266 TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
4267 TEST_ff_f (jn, 3, 0.0, 0.0);
4268 TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
4269 TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
4270 TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
4271 TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
4272 TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
4275 TEST_ff_f (jn, 10, nan_value, nan_value);
4276 TEST_ff_f (jn, 10, plus_infty, 0);
4278 TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
4279 TEST_ff_f (jn, 10, 0.0, 0.0);
4280 TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
4281 TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
4282 TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
4283 TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
4284 TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
4287 TEST_ff_f (jn, 2, 2.4048255576957729L, 0.43175480701968038399746111312430703L);
4288 TEST_ff_f (jn, 3, 2.4048255576957729L, 0.19899990535769083404042146764530813L);
4289 TEST_ff_f (jn, 4, 2.4048255576957729L, 0.647466661641779720084932282551219891E-1L);
4290 TEST_ff_f (jn, 5, 2.4048255576957729L, 0.163892432048058525099230549946147698E-1L);
4291 TEST_ff_f (jn, 6, 2.4048255576957729L, 0.34048184720278336646673682895929161E-2L);
4292 TEST_ff_f (jn, 7, 2.4048255576957729L, 0.60068836573295394221291569249883076E-3L);
4293 TEST_ff_f (jn, 8, 2.4048255576957729L, 0.92165786705344923232879022467054148E-4L);
4294 TEST_ff_f (jn, 9, 2.4048255576957729L, 0.12517270977961513005428966643852564E-4L);
4296 TEST_ff_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L);
4305 TEST_ff_f (ldexp, 0, 0, 0);
4306 TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
4308 TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
4309 TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
4310 TEST_ff_f (ldexp, nan_value, 1, nan_value);
4312 TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
4313 TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
4315 /* ldexp (x, 0) == x. */
4316 TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
4325 if (errno == ENOSYS)
4326 /* Function not implemented. */
4328 feclearexcept (FE_ALL_EXCEPT);
4332 TEST_f_f (lgamma, plus_infty, plus_infty);
4333 TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4334 check_int ("signgam for lgamma(0) == 1", signgam, 1, 0, 0, 0);
4335 TEST_f_f (lgamma, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4336 check_int ("signgam for lgamma(-0) == -1", signgam, -1, 0, 0, 0);
4337 TEST_f_f (lgamma, nan_value, nan_value);
4339 /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
4341 TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4342 check_int ("errno for lgamma(-integer) == ERANGE", errno, ERANGE, 0, 0, 0);
4343 TEST_f_f (lgamma, minus_infty, plus_infty);
4344 TEST_f_f (lgamma, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
4345 TEST_f_f (lgamma, max_value, plus_infty, OVERFLOW_EXCEPTION);
4347 TEST_f_f1 (lgamma, 1, 0, 1);
4349 TEST_f_f1 (lgamma, 3, M_LN2l, 1);
4351 TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
4352 TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
4353 TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
4354 TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
4363 /* XXX this test is incomplete. We need to have a way to specifiy
4364 the rounding method and test the critical cases. So far, only
4365 unproblematic numbers are tested. */
4369 TEST_f_l (lrint, 0.0, 0);
4370 TEST_f_l (lrint, minus_zero, 0);
4371 TEST_f_l (lrint, 0.2L, 0);
4372 TEST_f_l (lrint, -0.2L, 0);
4374 TEST_f_l (lrint, 1.4L, 1);
4375 TEST_f_l (lrint, -1.4L, -1);
4377 TEST_f_l (lrint, 8388600.3L, 8388600);
4378 TEST_f_l (lrint, -8388600.3L, -8388600);
4380 TEST_f_l (lrint, 1071930.0008, 1071930);
4382 TEST_f_l (lrint, 1073741824.01, 1073741824);
4383 # if LONG_MAX > 281474976710656
4384 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
4393 lrint_test_tonearest (void)
4395 int save_round_mode;
4396 START (lrint_tonearest);
4398 save_round_mode = fegetround ();
4400 if (!fesetround (FE_TONEAREST))
4402 TEST_f_l (lrint, 0.0, 0);
4403 TEST_f_l (lrint, minus_zero, 0);
4404 TEST_f_l (lrint, 0.2L, 0);
4405 TEST_f_l (lrint, -0.2L, 0);
4406 TEST_f_l (lrint, 0.5L, 0);
4407 TEST_f_l (lrint, -0.5L, 0);
4408 TEST_f_l (lrint, 0.8L, 1);
4409 TEST_f_l (lrint, -0.8L, -1);
4411 TEST_f_l (lrint, 1.4L, 1);
4412 TEST_f_l (lrint, -1.4L, -1);
4414 TEST_f_l (lrint, 8388600.3L, 8388600);
4415 TEST_f_l (lrint, -8388600.3L, -8388600);
4417 TEST_f_l (lrint, 1071930.0008, 1071930);
4419 TEST_f_l (lrint, 1073741824.01, 1073741824);
4420 # if LONG_MAX > 281474976710656
4421 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
4426 fesetround (save_round_mode);
4428 END (lrint_tonearest);
4433 lrint_test_towardzero (void)
4435 int save_round_mode;
4436 START (lrint_towardzero);
4438 save_round_mode = fegetround ();
4440 if (!fesetround (FE_TOWARDZERO))
4442 TEST_f_l (lrint, 0.0, 0);
4443 TEST_f_l (lrint, minus_zero, 0);
4444 TEST_f_l (lrint, 0.2L, 0);
4445 TEST_f_l (lrint, -0.2L, 0);
4446 TEST_f_l (lrint, 0.5L, 0);
4447 TEST_f_l (lrint, -0.5L, 0);
4448 TEST_f_l (lrint, 0.8L, 0);
4449 TEST_f_l (lrint, -0.8L, 0);
4451 TEST_f_l (lrint, 1.4L, 1);
4452 TEST_f_l (lrint, -1.4L, -1);
4454 TEST_f_l (lrint, 8388600.3L, 8388600);
4455 TEST_f_l (lrint, -8388600.3L, -8388600);
4457 TEST_f_l (lrint, 1071930.0008, 1071930);
4459 TEST_f_l (lrint, 1073741824.01, 1073741824);
4460 # if LONG_MAX > 281474976710656
4461 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
4466 fesetround (save_round_mode);
4468 END (lrint_towardzero);
4473 lrint_test_downward (void)
4475 int save_round_mode;
4476 START (lrint_downward);
4478 save_round_mode = fegetround ();
4480 if (!fesetround (FE_DOWNWARD))
4482 TEST_f_l (lrint, 0.0, 0);
4483 TEST_f_l (lrint, minus_zero, 0);
4484 TEST_f_l (lrint, 0.2L, 0);
4485 TEST_f_l (lrint, -0.2L, -1);
4486 TEST_f_l (lrint, 0.5L, 0);
4487 TEST_f_l (lrint, -0.5L, -1);
4488 TEST_f_l (lrint, 0.8L, 0);
4489 TEST_f_l (lrint, -0.8L, -1);
4491 TEST_f_l (lrint, 1.4L, 1);
4492 TEST_f_l (lrint, -1.4L, -2);
4494 TEST_f_l (lrint, 8388600.3L, 8388600);
4495 TEST_f_l (lrint, -8388600.3L, -8388601);
4497 TEST_f_l (lrint, 1071930.0008, 1071930);
4499 TEST_f_l (lrint, 1073741824.01, 1073741824);
4500 # if LONG_MAX > 281474976710656
4501 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
4506 fesetround (save_round_mode);
4508 END (lrint_downward);
4513 lrint_test_upward (void)
4515 int save_round_mode;
4516 START (lrint_upward);
4518 save_round_mode = fegetround ();
4520 if (!fesetround (FE_UPWARD))
4522 TEST_f_l (lrint, 0.0, 0);
4523 TEST_f_l (lrint, minus_zero, 0);
4524 TEST_f_l (lrint, 0.2L, 1);
4525 TEST_f_l (lrint, -0.2L, 0);
4526 TEST_f_l (lrint, 0.5L, 1);
4527 TEST_f_l (lrint, -0.5L, 0);
4528 TEST_f_l (lrint, 0.8L, 1);
4529 TEST_f_l (lrint, -0.8L, 0);
4531 TEST_f_l (lrint, 1.4L, 2);
4532 TEST_f_l (lrint, -1.4L, -1);
4534 TEST_f_l (lrint, 8388600.3L, 8388601);
4535 TEST_f_l (lrint, -8388600.3L, -8388600);
4538 TEST_f_l (lrint, 1071930.0008, 1071931);
4539 TEST_f_l (lrint, 1073741824.01, 1073741825);
4540 # if LONG_MAX > 281474976710656 && defined (TEST_LDOUBLE)
4541 TEST_f_l (lrint, 281474976710656.025, 281474976710656);
4546 fesetround (save_round_mode);
4555 /* XXX this test is incomplete. We need to have a way to specifiy
4556 the rounding method and test the critical cases. So far, only
4557 unproblematic numbers are tested. */
4561 TEST_f_L (llrint, 0.0, 0);
4562 TEST_f_L (llrint, minus_zero, 0);
4563 TEST_f_L (llrint, 0.2L, 0);
4564 TEST_f_L (llrint, -0.2L, 0);
4566 TEST_f_L (llrint, 1.4L, 1);
4567 TEST_f_L (llrint, -1.4L, -1);
4569 TEST_f_L (llrint, 8388600.3L, 8388600);
4570 TEST_f_L (llrint, -8388600.3L, -8388600);
4572 TEST_f_l (llrint, 1071930.0008, 1071930);
4574 /* Test boundary conditions. */
4576 TEST_f_L (llrint, 2097151.0,2097151LL);
4578 TEST_f_L (llrint, 8388608.0, 8388608LL);
4580 TEST_f_L (llrint, 16777216.0, 16777216LL);
4582 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
4584 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
4585 /* 0x1000000000000 */
4586 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
4587 /* 0x10000000000000 */
4588 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
4589 /* 0x10000080000000 */
4590 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
4591 /* 0x20000000000000 */
4592 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
4593 /* 0x80000000000000 */
4594 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
4595 /* 0x100000000000000 */
4596 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
4598 /* The input can only be represented in long double. */
4599 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
4600 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
4601 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
4602 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
4603 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
4605 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
4606 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
4607 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
4608 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
4609 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
4611 # if LDBL_MANT_DIG > 100
4612 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
4613 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
4614 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
4615 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
4616 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
4617 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
4619 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
4620 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
4621 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
4622 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
4623 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
4624 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
4627 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
4628 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
4629 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
4630 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
4631 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
4633 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
4634 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
4635 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
4636 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
4637 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
4639 # if LDBL_MANT_DIG > 100
4640 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
4641 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
4642 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
4643 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
4644 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
4645 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
4647 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
4648 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
4649 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
4650 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
4651 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
4652 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
4655 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
4656 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
4657 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
4658 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
4659 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
4661 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
4662 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
4663 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
4664 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
4665 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
4667 # if LDBL_MANT_DIG > 100
4668 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
4669 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
4670 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
4671 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
4672 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
4673 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
4674 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
4675 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
4676 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
4677 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
4678 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
4679 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
4687 llrint_test_tonearest (void)
4689 int save_round_mode;
4690 START (llrint_tonearest);
4692 save_round_mode = fegetround ();
4694 if (!fesetround (FE_TONEAREST))
4696 TEST_f_L (llrint, 0.0, 0);
4697 TEST_f_L (llrint, minus_zero, 0);
4698 TEST_f_L (llrint, 0.2L, 0);
4699 TEST_f_L (llrint, -0.2L, 0);
4701 TEST_f_L (llrint, 1.4L, 1);
4702 TEST_f_L (llrint, -1.4L, -1);
4704 TEST_f_L (llrint, 8388600.3L, 8388600);
4705 TEST_f_L (llrint, -8388600.3L, -8388600);
4707 TEST_f_l (llrint, 1071930.0008, 1071930);
4709 /* Test boundary conditions. */
4711 TEST_f_L (llrint, 2097151.0,2097151LL);
4713 TEST_f_L (llrint, 8388608.0, 8388608LL);
4715 TEST_f_L (llrint, 16777216.0, 16777216LL);
4717 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
4719 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
4720 /* 0x1000000000000 */
4721 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
4722 /* 0x10000000000000 */
4723 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
4724 /* 0x10000080000000 */
4725 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
4726 /* 0x20000000000000 */
4727 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
4728 /* 0x80000000000000 */
4729 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
4730 /* 0x100000000000000 */
4731 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
4733 /* The input can only be represented in long double. */
4734 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
4735 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
4736 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
4737 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
4738 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
4740 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
4741 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
4742 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
4743 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
4744 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
4746 # if LDBL_MANT_DIG > 100
4747 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
4748 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
4749 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
4750 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
4751 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
4752 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
4754 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
4755 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
4756 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
4757 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
4758 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
4759 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
4762 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
4763 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
4764 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
4765 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
4766 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
4768 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
4769 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
4770 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
4771 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
4772 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
4774 # if LDBL_MANT_DIG > 100
4775 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
4776 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
4777 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
4778 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
4779 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
4780 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
4782 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
4783 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
4784 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
4785 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
4786 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
4787 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
4790 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
4791 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
4792 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
4793 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
4794 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
4796 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
4797 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
4798 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
4799 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
4800 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
4802 # if LDBL_MANT_DIG > 100
4803 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
4804 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
4805 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
4806 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
4807 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
4808 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
4809 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
4810 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
4811 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
4812 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
4813 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
4814 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
4819 fesetround (save_round_mode);
4821 END (llrint_tonearest);
4825 llrint_test_towardzero (void)
4827 int save_round_mode;
4828 START (llrint_towardzero);
4830 save_round_mode = fegetround ();
4832 if (!fesetround (FE_TOWARDZERO))
4834 TEST_f_L (llrint, 0.0, 0);
4835 TEST_f_L (llrint, minus_zero, 0);
4836 TEST_f_L (llrint, 0.2L, 0);
4837 TEST_f_L (llrint, -0.2L, 0);
4839 TEST_f_L (llrint, 1.4L, 1);
4840 TEST_f_L (llrint, -1.4L, -1);
4842 TEST_f_L (llrint, 8388600.3L, 8388600);
4843 TEST_f_L (llrint, -8388600.3L, -8388600);
4845 TEST_f_l (llrint, 1071930.0008, 1071930);
4847 /* Test boundary conditions. */
4849 TEST_f_L (llrint, 2097151.0,2097151LL);
4851 TEST_f_L (llrint, 8388608.0, 8388608LL);
4853 TEST_f_L (llrint, 16777216.0, 16777216LL);
4855 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
4857 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
4858 /* 0x1000000000000 */
4859 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
4860 /* 0x10000000000000 */
4861 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
4862 /* 0x10000080000000 */
4863 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
4864 /* 0x20000000000000 */
4865 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
4866 /* 0x80000000000000 */
4867 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
4868 /* 0x100000000000000 */
4869 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
4871 /* The input can only be represented in long double. */
4872 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
4873 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
4874 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
4875 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
4876 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
4878 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
4879 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
4880 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
4881 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
4882 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
4884 # if LDBL_MANT_DIG > 100
4885 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
4886 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
4887 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
4888 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
4889 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
4890 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
4892 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
4893 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
4894 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
4895 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
4896 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
4897 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
4900 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
4901 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
4902 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
4903 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
4904 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
4906 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
4907 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
4908 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
4909 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
4910 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
4912 # if LDBL_MANT_DIG > 100
4913 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
4914 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
4915 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
4916 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
4917 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
4918 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
4920 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
4921 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
4922 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
4923 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
4924 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
4925 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
4928 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
4929 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
4930 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
4931 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
4932 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
4934 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
4935 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
4936 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
4937 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
4938 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
4940 # if LDBL_MANT_DIG > 100
4941 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
4942 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
4943 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
4944 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
4945 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
4946 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
4947 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
4948 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
4949 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
4950 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
4951 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
4952 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
4957 fesetround (save_round_mode);
4959 END (llrint_towardzero);
4963 llrint_test_downward (void)
4965 int save_round_mode;
4966 START (llrint_downward);
4968 save_round_mode = fegetround ();
4970 if (!fesetround (FE_DOWNWARD))
4972 TEST_f_L (llrint, 0.0, 0);
4973 TEST_f_L (llrint, minus_zero, 0);
4974 TEST_f_L (llrint, 0.2L, 0);
4975 TEST_f_L (llrint, -0.2L, -1);
4977 TEST_f_L (llrint, 1.4L, 1);
4978 TEST_f_L (llrint, -1.4L, -2);
4980 TEST_f_L (llrint, 8388600.3L, 8388600);
4981 TEST_f_L (llrint, -8388600.3L, -8388601);
4983 TEST_f_l (llrint, 1071930.0008, 1071930);
4985 /* Test boundary conditions. */
4987 TEST_f_L (llrint, 2097151.0,2097151LL);
4989 TEST_f_L (llrint, 8388608.0, 8388608LL);
4991 TEST_f_L (llrint, 16777216.0, 16777216LL);
4993 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
4995 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
4996 /* 0x1000000000000 */
4997 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
4998 /* 0x10000000000000 */
4999 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
5000 /* 0x10000080000000 */
5001 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
5002 /* 0x20000000000000 */
5003 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
5004 /* 0x80000000000000 */
5005 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
5006 /* 0x100000000000000 */
5007 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
5009 /* The input can only be represented in long double. */
5010 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
5011 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
5012 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
5013 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
5014 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
5016 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
5017 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
5018 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
5019 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
5020 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
5021 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
5023 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
5024 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
5025 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
5026 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
5027 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
5029 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
5030 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
5031 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
5032 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
5033 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
5034 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
5036 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
5037 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
5038 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
5039 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
5040 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
5042 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
5043 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
5044 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
5045 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
5046 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
5047 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
5049 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
5050 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
5051 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
5052 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
5053 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
5055 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
5056 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
5057 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
5058 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
5059 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
5060 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
5062 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
5063 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
5064 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
5065 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
5066 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
5068 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
5069 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
5070 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
5071 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
5072 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
5074 # if LDBL_MANT_DIG > 100
5075 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
5076 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
5077 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
5078 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
5079 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
5080 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
5081 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
5082 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
5083 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
5084 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
5085 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
5086 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
5091 fesetround (save_round_mode);
5093 END (llrint_downward);
5097 llrint_test_upward (void)
5099 int save_round_mode;
5100 START (llrint_upward);
5102 save_round_mode = fegetround ();
5104 if (!fesetround (FE_UPWARD))
5106 TEST_f_L (llrint, 0.0, 0);
5107 TEST_f_L (llrint, minus_zero, 0);
5108 TEST_f_L (llrint, 0.2L, 1);
5109 TEST_f_L (llrint, -0.2L, 0);
5111 TEST_f_L (llrint, 1.4L, 2);
5112 TEST_f_L (llrint, -1.4L, -1);
5114 TEST_f_L (llrint, 8388600.3L, 8388601);
5115 TEST_f_L (llrint, -8388600.3L, -8388600);
5117 TEST_f_l (llrint, 1071930.0008, 1071931);
5119 /* Test boundary conditions. */
5121 TEST_f_L (llrint, 2097151.0,2097151LL);
5123 TEST_f_L (llrint, 8388608.0, 8388608LL);
5125 TEST_f_L (llrint, 16777216.0, 16777216LL);
5127 TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
5129 TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
5130 /* 0x1000000000000 */
5131 TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
5132 /* 0x10000000000000 */
5133 TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
5134 /* 0x10000080000000 */
5135 TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
5136 /* 0x20000000000000 */
5137 TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
5138 /* 0x80000000000000 */
5139 TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
5140 /* 0x100000000000000 */
5141 TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
5143 /* The input can only be represented in long double. */
5144 TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
5145 TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
5146 TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
5147 TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
5148 TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
5150 TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
5151 TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
5152 TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
5153 TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
5154 TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
5155 TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
5157 TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
5158 TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
5159 TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
5160 TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
5161 TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
5163 TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
5164 TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
5165 TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
5166 TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
5167 TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
5168 TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
5170 TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
5171 TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
5172 TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
5173 TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
5174 TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
5176 TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
5177 TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
5178 TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
5179 TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
5180 TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
5181 TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
5183 TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
5184 TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
5185 TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
5186 TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
5187 TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
5189 TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
5190 TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
5191 TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
5192 TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
5193 TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
5194 TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
5196 TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
5197 TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
5198 TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
5199 TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
5200 TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
5202 TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
5203 TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
5204 TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
5205 TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
5206 TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
5208 # if LDBL_MANT_DIG > 100
5209 TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
5210 TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
5211 TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
5212 TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
5213 TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
5214 TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
5215 TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
5216 TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
5217 TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
5218 TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
5219 TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
5220 TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
5225 fesetround (save_round_mode);
5227 END (llrint_upward);
5236 if (errno == ENOSYS)
5237 /* Function not implemented. */
5241 TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5242 TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5244 TEST_f_f (log, 1, 0);
5246 TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
5247 TEST_f_f (log, -max_value, nan_value, INVALID_EXCEPTION);
5248 TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
5249 TEST_f_f (log, plus_infty, plus_infty);
5250 TEST_f_f (log, nan_value, nan_value);
5252 TEST_f_f (log, M_El, 1);
5253 TEST_f_f (log, 1.0 / M_El, -1);
5254 TEST_f_f (log, 2, M_LN2l);
5255 TEST_f_f (log, 10, M_LN10l);
5256 TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
5267 if (errno == ENOSYS)
5268 /* Function not implemented. */
5273 TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5274 TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5276 TEST_f_f (log10, 1, 0);
5278 /* log10 (x) == NaN plus invalid exception if x < 0. */
5279 TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
5280 TEST_f_f (log10, -max_value, nan_value, INVALID_EXCEPTION);
5281 TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
5283 TEST_f_f (log10, plus_infty, plus_infty);
5284 TEST_f_f (log10, nan_value, nan_value);
5286 TEST_f_f (log10, 0.1L, -1);
5287 TEST_f_f (log10, 10.0, 1);
5288 TEST_f_f (log10, 100.0, 2);
5289 TEST_f_f (log10, 10000.0, 4);
5290 TEST_f_f (log10, M_El, M_LOG10El);
5291 TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
5302 if (errno == ENOSYS)
5303 /* Function not implemented. */
5308 TEST_f_f (log1p, 0, 0);
5309 TEST_f_f (log1p, minus_zero, minus_zero);
5311 TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5312 TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
5313 TEST_f_f (log1p, -max_value, nan_value, INVALID_EXCEPTION);
5314 TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
5316 TEST_f_f (log1p, plus_infty, plus_infty);
5317 TEST_f_f (log1p, nan_value, nan_value);
5319 TEST_f_f (log1p, M_El - 1.0, 1);
5321 TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
5322 TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
5333 if (errno == ENOSYS)
5334 /* Function not implemented. */
5339 TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5340 TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5342 TEST_f_f (log2, 1, 0);
5344 TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
5345 TEST_f_f (log2, -max_value, nan_value, INVALID_EXCEPTION);
5346 TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
5348 TEST_f_f (log2, plus_infty, plus_infty);
5349 TEST_f_f (log2, nan_value, nan_value);
5351 TEST_f_f (log2, M_El, M_LOG2El);
5352 TEST_f_f (log2, 2.0, 1);
5353 TEST_f_f (log2, 16.0, 4);
5354 TEST_f_f (log2, 256.0, 8);
5355 TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
5366 TEST_f_f (logb, plus_infty, plus_infty);
5367 TEST_f_f (logb, minus_infty, plus_infty);
5369 TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5371 TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5372 TEST_f_f (logb, nan_value, nan_value);
5374 TEST_f_f (logb, 1, 0);
5375 TEST_f_f (logb, M_El, 1);
5376 TEST_f_f (logb, 1024, 10);
5377 TEST_f_f (logb, -2000, 10);
5379 TEST_f_f (logb, 0x0.1p-127, -131);
5380 TEST_f_f (logb, 0x0.01p-127, -135);
5381 TEST_f_f (logb, 0x0.011p-127, -135);
5383 TEST_f_f (logb, 0x0.8p-1022, -1023);
5384 TEST_f_f (logb, 0x0.1p-1022, -1026);
5385 TEST_f_f (logb, 0x0.00111p-1022, -1034);
5386 TEST_f_f (logb, 0x0.00001p-1022, -1042);
5387 TEST_f_f (logb, 0x0.000011p-1022, -1042);
5388 TEST_f_f (logb, 0x0.0000000000001p-1022, -1074);
5390 #if defined TEST_LDOUBLE && LDBL_MIN_EXP - LDBL_MANT_DIG <= -16400
5391 TEST_f_f (logb, 0x1p-16400L, -16400);
5392 TEST_f_f (logb, 0x.00000000001p-16382L, -16426);
5399 logb_test_downward (void)
5401 int save_round_mode;
5405 if (errno == ENOSYS)
5406 /* Function not implemented. */
5409 START (logb_downward);
5411 save_round_mode = fegetround ();
5413 if (!fesetround (FE_DOWNWARD))
5416 /* IEEE 754-2008 says (section 5.3.3) that "logB(1) is +0.". Libm
5417 should not return -0 from logb in any rounding mode. PowerPC32 has
5418 failed with this test for power4 logb (and logbl on all PowerPC
5419 platforms) in the past due to instruction selection. GCC PR 52775
5420 provides the availability of the fcfid insn in 32-bit mode which
5421 eliminates the use of fsub in this instance and prevents the negative
5425 TEST_f_f (logb, 1.000e+0, plus_zero);
5428 fesetround (save_round_mode);
5430 END (logb_downward);
5438 TEST_f_l (lround, 0, 0);
5439 TEST_f_l (lround, minus_zero, 0);
5440 TEST_f_l (lround, 0.2L, 0.0);
5441 TEST_f_l (lround, -0.2L, 0);
5442 TEST_f_l (lround, 0.5, 1);
5443 TEST_f_l (lround, -0.5, -1);
5444 TEST_f_l (lround, 0.8L, 1);
5445 TEST_f_l (lround, -0.8L, -1);
5446 TEST_f_l (lround, 1.5, 2);
5447 TEST_f_l (lround, -1.5, -2);
5448 TEST_f_l (lround, 22514.5, 22515);
5449 TEST_f_l (lround, -22514.5, -22515);
5450 TEST_f_l (lround, 1071930.0008, 1071930);
5452 TEST_f_l (lround, 1073741824.01, 1073741824);
5453 # if LONG_MAX > 281474976710656
5454 TEST_f_l (lround, 281474976710656.025, 281474976710656);
5455 TEST_f_l (lround, 18014398509481974, 18014398509481974);
5457 TEST_f_l (lround, 2097152.5, 2097153);
5458 TEST_f_l (lround, -2097152.5, -2097153);
5459 /* nextafter(0.5,-1) */
5460 TEST_f_l (lround, 0x1.fffffffffffffp-2, 0);
5461 /* nextafter(-0.5,1) */
5462 TEST_f_l (lround, -0x1.fffffffffffffp-2, 0);
5464 /* nextafter(0.5,-1) */
5465 TEST_f_l (lround, 0x1.fffffp-2, 0);
5466 /* nextafter(-0.5,1) */
5467 TEST_f_l (lround, -0x1.fffffp-2, 0);
5468 TEST_f_l (lround, 0x1.fffffep+23, 16777215);
5469 TEST_f_l (lround, -0x1.fffffep+23, -16777215);
5480 TEST_f_L (llround, 0, 0);
5481 TEST_f_L (llround, minus_zero, 0);
5482 TEST_f_L (llround, 0.2L, 0.0);
5483 TEST_f_L (llround, -0.2L, 0);
5484 TEST_f_L (llround, 0.5, 1);
5485 TEST_f_L (llround, -0.5, -1);
5486 TEST_f_L (llround, 0.8L, 1);
5487 TEST_f_L (llround, -0.8L, -1);
5488 TEST_f_L (llround, 1.5, 2);
5489 TEST_f_L (llround, -1.5, -2);
5490 TEST_f_L (llround, 22514.5, 22515);
5491 TEST_f_L (llround, -22514.5, -22515);
5492 TEST_f_l (llround, 1071930.0008, 1071930);
5494 TEST_f_L (llround, 2097152.5, 2097153);
5495 TEST_f_L (llround, -2097152.5, -2097153);
5496 TEST_f_L (llround, 34359738368.5, 34359738369ll);
5497 TEST_f_L (llround, -34359738368.5, -34359738369ll);
5498 TEST_f_L (llround, -3.65309740835E17, -365309740835000000LL);
5501 /* Test boundary conditions. */
5503 TEST_f_L (llround, 2097151.0, 2097151LL);
5505 TEST_f_L (llround, 8388608.0, 8388608LL);
5507 TEST_f_L (llround, 16777216.0, 16777216LL);
5509 TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
5511 TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
5512 /* 0x1000000000000 */
5513 TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
5514 /* 0x10000000000000 */
5515 TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
5516 /* 0x10000080000000 */
5517 TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
5518 /* 0x20000000000000 */
5519 TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
5520 /* 0x80000000000000 */
5521 TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
5522 /* 0x100000000000000 */
5523 TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
5527 TEST_f_L (llround, 4294967295.5, 4294967296LL);
5529 TEST_f_L (llround, 8589934591.5, 8589934592LL);
5531 /* nextafter(0.5,-1) */
5532 TEST_f_L (llround, 0x1.fffffffffffffp-2, 0);
5533 /* nextafter(-0.5,1) */
5534 TEST_f_L (llround, -0x1.fffffffffffffp-2, 0);
5535 /* On PowerPC an exponent of '52' is the largest incrementally
5536 * representable sequence of whole-numbers in the 'double' range. We test
5537 * lround to make sure that a guard bit set during the lround operation
5538 * hasn't forced an erroneous shift giving us an incorrect result. The odd
5539 * numbers between +-(2^52+1 and 2^53-1) are affected since they have the
5540 * rightmost bit set. */
5542 TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL);
5543 TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL);
5544 /* +-(2^53-1): Input is the last (positive and negative) incrementally
5545 * representable whole-number in the 'double' range that might round
5547 TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL);
5548 TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL);
5550 /* nextafter(0.5,-1) */
5551 TEST_f_L (llround, 0x1.fffffep-2, 0);
5552 /* nextafter(-0.5,1) */
5553 TEST_f_L (llround, -0x1.fffffep-2, 0);
5554 /* As above, on PowerPC an exponent of '23' is the largest incrementally
5555 * representable sequence of whole-numbers in the 'float' range.
5556 * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected. */
5557 TEST_f_L (llround, 0x1.000002p+23,8388609);
5558 TEST_f_L (llround, -0x1.000002p+23,-8388609);
5559 TEST_f_L (llround, 0x1.fffffep+23, 16777215);
5560 TEST_f_L (llround, -0x1.fffffep+23, -16777215);
5565 /* The input can only be represented in long double. */
5566 TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
5567 TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
5568 TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
5569 TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
5570 TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
5572 # if LDBL_MANT_DIG > 100
5573 TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
5574 TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
5575 TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
5576 TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
5577 TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
5578 TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
5580 TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
5581 TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
5582 TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
5583 TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
5584 TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
5585 TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
5588 TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
5589 TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
5590 TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
5591 TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
5592 TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
5594 TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
5595 TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
5596 TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
5597 TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
5598 TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
5600 # if LDBL_MANT_DIG > 100
5601 TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
5602 TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
5603 TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
5604 TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
5605 TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
5606 TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
5608 TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
5609 TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
5610 TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
5611 TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
5612 TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
5613 TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
5616 TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
5617 TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
5618 TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
5619 TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
5620 TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
5622 TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
5623 TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
5624 TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
5625 TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
5626 TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
5628 TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
5629 TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
5630 TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
5631 TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
5632 TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
5634 TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
5635 TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
5636 TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
5637 TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
5638 TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
5639 TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
5652 TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
5653 TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
5654 TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
5655 TEST_fF_f1 (modf, 0, 0, 0);
5656 TEST_fF_f1 (modf, 1.5, 0.5, 1);
5657 TEST_fF_f1 (modf, 2.5, 0.5, 2);
5658 TEST_fF_f1 (modf, -2.5, -0.5, -2);
5659 TEST_fF_f1 (modf, 20, 0, 20);
5660 TEST_fF_f1 (modf, 21, 0, 21);
5661 TEST_fF_f1 (modf, 89.5, 0.5, 89);
5668 nearbyint_test (void)
5672 TEST_f_f (nearbyint, 0.0, 0.0);
5673 TEST_f_f (nearbyint, minus_zero, minus_zero);
5674 TEST_f_f (nearbyint, plus_infty, plus_infty);
5675 TEST_f_f (nearbyint, minus_infty, minus_infty);
5676 TEST_f_f (nearbyint, nan_value, nan_value);
5678 /* Subnormal values */
5679 TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
5680 TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
5682 /* Default rounding mode is round to nearest. */
5683 TEST_f_f (nearbyint, 0.5, 0.0);
5684 TEST_f_f (nearbyint, 1.5, 2.0);
5685 TEST_f_f (nearbyint, -0.5, minus_zero);
5686 TEST_f_f (nearbyint, -1.5, -2.0);
5688 TEST_f_f (nearbyint, 262144.75, 262145.0);
5689 TEST_f_f (nearbyint, 262142.75, 262143.0);
5690 TEST_f_f (nearbyint, 524286.75, 524287.0);
5691 TEST_f_f (nearbyint, 524288.75, 524289.0);
5693 TEST_f_f (nearbyint, 1048576.75, 1048577.0);
5694 TEST_f_f (nearbyint, 2097152.75, 2097153.0);
5695 TEST_f_f (nearbyint, 2492472.75, 2492473.0);
5696 TEST_f_f (nearbyint, 2886220.75, 2886221.0);
5697 TEST_f_f (nearbyint, 3058792.75, 3058793.0);
5698 TEST_f_f (nearbyint, -1048576.75, -1048577.0);
5699 TEST_f_f (nearbyint, -2097152.75, -2097153.0);
5700 TEST_f_f (nearbyint, -2492472.75, -2492473.0);
5701 TEST_f_f (nearbyint, -2886220.75, -2886221.0);
5702 TEST_f_f (nearbyint, -3058792.75, -3058793.0);
5704 TEST_f_f (nearbyint, 70368744177664.75, 70368744177665.0);
5705 TEST_f_f (nearbyint, 140737488355328.75, 140737488355329.0);
5706 TEST_f_f (nearbyint, 281474976710656.75, 281474976710657.0);
5707 TEST_f_f (nearbyint, 562949953421312.75, 562949953421313.0);
5708 TEST_f_f (nearbyint, 1125899906842624.75, 1125899906842625.0);
5709 TEST_f_f (nearbyint, -70368744177664.75, -70368744177665.0);
5710 TEST_f_f (nearbyint, -140737488355328.75, -140737488355329.0);
5711 TEST_f_f (nearbyint, -281474976710656.75, -281474976710657.0);
5712 TEST_f_f (nearbyint, -562949953421312.75, -562949953421313.0);
5713 TEST_f_f (nearbyint, -1125899906842624.75, -1125899906842625.0);
5720 nextafter_test (void)
5725 TEST_ff_f (nextafter, 0, 0, 0);
5726 TEST_ff_f (nextafter, minus_zero, 0, 0);
5727 TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
5728 TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
5730 TEST_ff_f (nextafter, 9, 9, 9);
5731 TEST_ff_f (nextafter, -9, -9, -9);
5732 TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
5733 TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
5735 TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
5736 TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
5737 TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
5739 FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
5740 LDBL_MAX, DBL_MAX, FLT_MAX);
5741 TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty, OVERFLOW_EXCEPTION);
5742 TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty, OVERFLOW_EXCEPTION);
5745 // XXX Enable once gcc is fixed.
5746 //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
5749 /* XXX We need the hexadecimal FP number representation here for further
5757 nexttoward_test (void)
5760 TEST_ff_f (nexttoward, 0, 0, 0);
5761 TEST_ff_f (nexttoward, minus_zero, 0, 0);
5762 TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
5763 TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
5765 TEST_ff_f (nexttoward, 9, 9, 9);
5766 TEST_ff_f (nexttoward, -9, -9, -9);
5767 TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
5768 TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
5770 TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
5771 TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
5772 TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
5775 TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.000002p0);
5776 TEST_ff_f (nexttoward, 1.0, LDBL_MAX, 0x1.000002p0);
5777 TEST_ff_f (nexttoward, 1.0, 0x1.0000000000001p0, 0x1.000002p0);
5778 TEST_ff_f (nexttoward, 1.0, 0.9L, 0x0.ffffffp0);
5779 TEST_ff_f (nexttoward, 1.0, -LDBL_MAX, 0x0.ffffffp0);
5780 TEST_ff_f (nexttoward, 1.0, 0x0.fffffffffffff8p0, 0x0.ffffffp0);
5781 TEST_ff_f (nexttoward, -1.0, -1.1L, -0x1.000002p0);
5782 TEST_ff_f (nexttoward, -1.0, -LDBL_MAX, -0x1.000002p0);
5783 TEST_ff_f (nexttoward, -1.0, -0x1.0000000000001p0, -0x1.000002p0);
5784 TEST_ff_f (nexttoward, -1.0, -0.9L, -0x0.ffffffp0);
5785 TEST_ff_f (nexttoward, -1.0, LDBL_MAX, -0x0.ffffffp0);
5786 TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.ffffffp0);
5787 TEST_ff_f (nexttoward, -0x1.3p-145, -0xap-148L, -0x1.4p-145);
5788 # if LDBL_MANT_DIG >= 64
5789 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.000002p0);
5790 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.ffffffp0);
5791 TEST_ff_f (nexttoward, -1.0, -0x1.000000000000002p0L, -0x1.000002p0);
5792 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffp0L, -0x0.ffffffp0);
5794 # if LDBL_MANT_DIG >= 106
5795 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000000000000000008p0L, 0x1.000002p0);
5796 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffcp0L, 0x0.ffffffp0);
5797 TEST_ff_f (nexttoward, -1.0, -0x1.000000000000000000000000008p0L, -0x1.000002p0);
5798 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffcp0L, -0x0.ffffffp0);
5800 # if LDBL_MANT_DIG >= 113
5801 TEST_ff_f (nexttoward, 1.0, 0x1.0000000000000000000000000001p0L, 0x1.000002p0);
5802 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffff8p0L, 0x0.ffffffp0);
5803 TEST_ff_f (nexttoward, -1.0, -0x1.0000000000000000000000000001p0L, -0x1.000002p0);
5804 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffff8p0L, -0x0.ffffffp0);
5808 TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.0000000000001p0);
5809 TEST_ff_f (nexttoward, 1.0, LDBL_MAX, 0x1.0000000000001p0);
5810 TEST_ff_f (nexttoward, 1.0, 0x1.0000000000001p0, 0x1.0000000000001p0);
5811 TEST_ff_f (nexttoward, 1.0, 0.9L, 0x0.fffffffffffff8p0);
5812 TEST_ff_f (nexttoward, 1.0, -LDBL_MAX, 0x0.fffffffffffff8p0);
5813 TEST_ff_f (nexttoward, 1.0, 0x0.fffffffffffff8p0, 0x0.fffffffffffff8p0);
5814 TEST_ff_f (nexttoward, -1.0, -1.1L, -0x1.0000000000001p0);
5815 TEST_ff_f (nexttoward, -1.0, -LDBL_MAX, -0x1.0000000000001p0);
5816 TEST_ff_f (nexttoward, -1.0, -0x1.0000000000001p0, -0x1.0000000000001p0);
5817 TEST_ff_f (nexttoward, -1.0, -0.9L, -0x0.fffffffffffff8p0);
5818 TEST_ff_f (nexttoward, -1.0, LDBL_MAX, -0x0.fffffffffffff8p0);
5819 TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.fffffffffffff8p0);
5820 TEST_ff_f (nexttoward, -1.0, -0x8.00346dc5d6388p-3L, -0x1.0000000000001p0);
5821 TEST_ff_f (nexttoward, 0x1p-1074, 0x1p-1073L, 0x1p-1073);
5822 # if LDBL_MANT_DIG >= 64
5823 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.0000000000001p0);
5824 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.fffffffffffff8p0);
5825 TEST_ff_f (nexttoward, -1.0, -0x1.000000000000002p0L, -0x1.0000000000001p0);
5826 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffp0L, -0x0.fffffffffffff8p0);
5828 # if LDBL_MANT_DIG >= 106
5829 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000000000000000008p0L, 0x1.0000000000001p0);
5830 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffcp0L, 0x0.fffffffffffff8p0);
5831 TEST_ff_f (nexttoward, -1.0, -0x1.000000000000000000000000008p0L, -0x1.0000000000001p0);
5832 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffcp0L, -0x0.fffffffffffff8p0);
5834 # if LDBL_MANT_DIG >= 113
5835 TEST_ff_f (nexttoward, 1.0, 0x1.0000000000000000000000000001p0L, 0x1.0000000000001p0);
5836 TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffffffffffffff8p0L, 0x0.fffffffffffff8p0);
5837 TEST_ff_f (nexttoward, -1.0, -0x1.0000000000000000000000000001p0L, -0x1.0000000000001p0);
5838 TEST_ff_f (nexttoward, -1.0, -0x0.ffffffffffffffffffffffffffff8p0L, -0x0.fffffffffffff8p0);
5852 if (errno == ENOSYS)
5853 /* Function not implemented. */
5858 TEST_ff_f (pow, 0, 0, 1);
5859 TEST_ff_f (pow, 0, minus_zero, 1);
5860 TEST_ff_f (pow, minus_zero, 0, 1);
5861 TEST_ff_f (pow, minus_zero, minus_zero, 1);
5863 TEST_ff_f (pow, 10, 0, 1);
5864 TEST_ff_f (pow, 10, minus_zero, 1);
5865 TEST_ff_f (pow, -10, 0, 1);
5866 TEST_ff_f (pow, -10, minus_zero, 1);
5868 TEST_ff_f (pow, nan_value, 0, 1);
5869 TEST_ff_f (pow, nan_value, minus_zero, 1);
5873 TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
5874 TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
5875 TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
5876 TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
5878 TEST_ff_f (pow, 0.9L, plus_infty, 0);
5879 TEST_ff_f (pow, 1e-7L, plus_infty, 0);
5880 TEST_ff_f (pow, -0.9L, plus_infty, 0);
5881 TEST_ff_f (pow, -1e-7L, plus_infty, 0);
5883 TEST_ff_f (pow, 1.1L, minus_infty, 0);
5884 TEST_ff_f (pow, plus_infty, minus_infty, 0);
5885 TEST_ff_f (pow, -1.1L, minus_infty, 0);
5886 TEST_ff_f (pow, minus_infty, minus_infty, 0);
5888 TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
5889 TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
5890 TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
5891 TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
5893 TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
5894 TEST_ff_f (pow, plus_infty, 1, plus_infty);
5895 TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
5897 TEST_ff_f (pow, plus_infty, -1e-7L, 0);
5898 TEST_ff_f (pow, plus_infty, -1, 0);
5899 TEST_ff_f (pow, plus_infty, -1e7L, 0);
5901 TEST_ff_f (pow, minus_infty, 1, minus_infty);
5902 TEST_ff_f (pow, minus_infty, 11, minus_infty);
5903 TEST_ff_f (pow, minus_infty, 1001, minus_infty);
5905 TEST_ff_f (pow, minus_infty, 2, plus_infty);
5906 TEST_ff_f (pow, minus_infty, 12, plus_infty);
5907 TEST_ff_f (pow, minus_infty, 1002, plus_infty);
5908 TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
5909 TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
5910 TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
5911 TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
5913 TEST_ff_f (pow, minus_infty, -1, minus_zero);
5914 TEST_ff_f (pow, minus_infty, -11, minus_zero);
5915 TEST_ff_f (pow, minus_infty, -1001, minus_zero);
5917 TEST_ff_f (pow, minus_infty, -2, 0);
5918 TEST_ff_f (pow, minus_infty, -12, 0);
5919 TEST_ff_f (pow, minus_infty, -1002, 0);
5920 TEST_ff_f (pow, minus_infty, -0.1L, 0);
5921 TEST_ff_f (pow, minus_infty, -1.1L, 0);
5922 TEST_ff_f (pow, minus_infty, -11.1L, 0);
5923 TEST_ff_f (pow, minus_infty, -1001.1L, 0);
5926 TEST_ff_f (pow, nan_value, nan_value, nan_value);
5927 TEST_ff_f (pow, 0, nan_value, nan_value);
5928 TEST_ff_f (pow, 1, nan_value, 1);
5929 TEST_ff_f (pow, -1, nan_value, nan_value);
5930 TEST_ff_f (pow, nan_value, 1, nan_value);
5931 TEST_ff_f (pow, nan_value, -1, nan_value);
5933 /* pow (x, NaN) == NaN. */
5934 TEST_ff_f (pow, 3.0, nan_value, nan_value);
5935 TEST_ff_f (pow, minus_zero, nan_value, nan_value);
5936 TEST_ff_f (pow, plus_infty, nan_value, nan_value);
5937 TEST_ff_f (pow, -3.0, nan_value, nan_value);
5938 TEST_ff_f (pow, minus_infty, nan_value, nan_value);
5940 TEST_ff_f (pow, nan_value, 3.0, nan_value);
5941 TEST_ff_f (pow, nan_value, -3.0, nan_value);
5942 TEST_ff_f (pow, nan_value, plus_infty, nan_value);
5943 TEST_ff_f (pow, nan_value, minus_infty, nan_value);
5944 TEST_ff_f (pow, nan_value, 2.5, nan_value);
5945 TEST_ff_f (pow, nan_value, -2.5, nan_value);
5947 TEST_ff_f (pow, 1, plus_infty, 1);
5948 TEST_ff_f (pow, -1, plus_infty, 1);
5949 TEST_ff_f (pow, 1, minus_infty, 1);
5950 TEST_ff_f (pow, -1, minus_infty, 1);
5951 TEST_ff_f (pow, 1, 1, 1);
5952 TEST_ff_f (pow, 1, -1, 1);
5953 TEST_ff_f (pow, 1, 1.25, 1);
5954 TEST_ff_f (pow, 1, -1.25, 1);
5955 TEST_ff_f (pow, 1, 0x1p62L, 1);
5956 TEST_ff_f (pow, 1, 0x1p63L, 1);
5957 TEST_ff_f (pow, 1, 0x1p64L, 1);
5958 TEST_ff_f (pow, 1, 0x1p72L, 1);
5960 /* pow (x, +-0) == 1. */
5961 TEST_ff_f (pow, plus_infty, 0, 1);
5962 TEST_ff_f (pow, plus_infty, minus_zero, 1);
5963 TEST_ff_f (pow, minus_infty, 0, 1);
5964 TEST_ff_f (pow, minus_infty, minus_zero, 1);
5965 TEST_ff_f (pow, 32.75L, 0, 1);
5966 TEST_ff_f (pow, 32.75L, minus_zero, 1);
5967 TEST_ff_f (pow, -32.75L, 0, 1);
5968 TEST_ff_f (pow, -32.75L, minus_zero, 1);
5969 TEST_ff_f (pow, 0x1p72L, 0, 1);
5970 TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
5971 TEST_ff_f (pow, 0x1p-72L, 0, 1);
5972 TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
5974 TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
5975 TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
5976 TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
5977 TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
5980 TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5981 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
5983 TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5984 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
5986 TEST_ff_f (pow, 0, -0xffffff, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5987 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
5990 TEST_ff_f (pow, 0, -0x1.fffffffffffffp+52L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5991 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
5994 # if LDBL_MANT_DIG >= 64
5996 TEST_ff_f (pow, 0, -0x1.fffffffffffffffep+63L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
5997 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
5999 # if LDBL_MANT_DIG >= 106
6001 TEST_ff_f (pow, 0, -0x1.ffffffffffffffffffffffffff8p+105L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6002 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6004 # if LDBL_MANT_DIG >= 113
6006 TEST_ff_f (pow, 0, -0x1.ffffffffffffffffffffffffffffp+112L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6007 check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6010 TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6011 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6013 TEST_ff_f (pow, minus_zero, -11L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6014 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6016 TEST_ff_f (pow, minus_zero, -0xffffff, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6017 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6019 TEST_ff_f (pow, minus_zero, -0x1fffffe, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6020 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6023 TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffp+52L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6024 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6026 TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffp+53L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6027 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6030 # if LDBL_MANT_DIG >= 64
6032 TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffffep+63L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6033 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6035 TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffffep+64L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6036 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6038 # if LDBL_MANT_DIG >= 106
6040 TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6041 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6043 TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6044 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6046 # if LDBL_MANT_DIG >= 113
6048 TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6049 check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
6051 TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6052 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6057 TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6058 check_int ("errno for pow(0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6060 TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6061 check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6063 TEST_ff_f (pow, 0, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6064 check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6066 TEST_ff_f (pow, 0, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6067 check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6069 TEST_ff_f (pow, 0, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6070 check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6072 TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6073 check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
6075 TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6076 check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6078 TEST_ff_f (pow, minus_zero, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6079 check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6081 TEST_ff_f (pow, minus_zero, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6082 check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6084 TEST_ff_f (pow, minus_zero, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
6085 check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
6087 TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty, OVERFLOW_EXCEPTION);
6088 TEST_ff_f (pow, 10, -0x1p72L, 0);
6089 TEST_ff_f (pow, max_value, max_value, plus_infty, OVERFLOW_EXCEPTION);
6090 TEST_ff_f (pow, 10, -max_value, 0);
6092 TEST_ff_f (pow, 0, 1, 0);
6093 TEST_ff_f (pow, 0, 11, 0);
6095 TEST_ff_f (pow, minus_zero, 1, minus_zero);
6096 TEST_ff_f (pow, minus_zero, 11, minus_zero);
6098 TEST_ff_f (pow, 0, 2, 0);
6099 TEST_ff_f (pow, 0, 11.1L, 0);
6101 TEST_ff_f (pow, minus_zero, 2, 0);
6102 TEST_ff_f (pow, minus_zero, 11.1L, 0);
6103 TEST_ff_f (pow, 0, plus_infty, 0);
6104 TEST_ff_f (pow, minus_zero, plus_infty, 0);
6107 /* pow (x, +inf) == +inf for |x| > 1. */
6108 TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
6110 /* pow (x, +inf) == +0 for |x| < 1. */
6111 TEST_ff_f (pow, 0.5, plus_infty, 0.0);
6113 /* pow (x, -inf) == +0 for |x| > 1. */
6114 TEST_ff_f (pow, 1.5, minus_infty, 0.0);
6116 /* pow (x, -inf) == +inf for |x| < 1. */
6117 TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
6120 /* pow (+inf, y) == +inf for y > 0. */
6121 TEST_ff_f (pow, plus_infty, 2, plus_infty);
6122 TEST_ff_f (pow, plus_infty, 0xffffff, plus_infty);
6124 TEST_ff_f (pow, plus_infty, 0x1.fffffffffffffp+52L, plus_infty);
6127 # if LDBL_MANT_DIG >= 64
6128 TEST_ff_f (pow, plus_infty, 0x1.fffffffffffffffep+63L, plus_infty);
6130 # if LDBL_MANT_DIG >= 106
6131 TEST_ff_f (pow, plus_infty, 0x1.ffffffffffffffffffffffffff8p+105L, plus_infty);
6133 # if LDBL_MANT_DIG >= 113
6134 TEST_ff_f (pow, plus_infty, 0x1.ffffffffffffffffffffffffffffp+112L, plus_infty);
6137 TEST_ff_f (pow, plus_infty, 0x1p24, plus_infty);
6138 TEST_ff_f (pow, plus_infty, 0x1p127, plus_infty);
6139 TEST_ff_f (pow, plus_infty, max_value, plus_infty);
6141 /* pow (+inf, y) == +0 for y < 0. */
6142 TEST_ff_f (pow, plus_infty, -1, 0.0);
6143 TEST_ff_f (pow, plus_infty, -0xffffff, 0.0);
6145 TEST_ff_f (pow, plus_infty, -0x1.fffffffffffffp+52L, 0.0);
6148 # if LDBL_MANT_DIG >= 64
6149 TEST_ff_f (pow, plus_infty, -0x1.fffffffffffffffep+63L, 0.0);
6151 # if LDBL_MANT_DIG >= 106
6152 TEST_ff_f (pow, plus_infty, -0x1.ffffffffffffffffffffffffff8p+105L, 0.0);
6154 # if LDBL_MANT_DIG >= 113
6155 TEST_ff_f (pow, plus_infty, -0x1.ffffffffffffffffffffffffffffp+112L, 0.0);
6158 TEST_ff_f (pow, plus_infty, -0x1p24, 0.0);
6159 TEST_ff_f (pow, plus_infty, -0x1p127, 0.0);
6160 TEST_ff_f (pow, plus_infty, -max_value, 0.0);
6162 /* pow (-inf, y) == -inf for y an odd integer > 0. */
6163 TEST_ff_f (pow, minus_infty, 27, minus_infty);
6164 TEST_ff_f (pow, minus_infty, 0xffffff, minus_infty);
6165 TEST_ff_f (pow, minus_infty, 0x1fffffe, plus_infty);
6167 TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffp+52L, minus_infty);
6168 TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffp+53L, plus_infty);
6171 # if LDBL_MANT_DIG >= 64
6172 TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffffep+63L, minus_infty);
6173 TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffffep+64L, plus_infty);
6175 # if LDBL_MANT_DIG >= 106
6176 TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty);
6177 TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty);
6179 # if LDBL_MANT_DIG >= 113
6180 TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty);
6181 TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty);
6185 /* pow (-inf, y) == +inf for y > 0 and not an odd integer. */
6186 TEST_ff_f (pow, minus_infty, 28, plus_infty);
6187 TEST_ff_f (pow, minus_infty, 0x1p24, plus_infty);
6188 TEST_ff_f (pow, minus_infty, 0x1p127, plus_infty);
6189 TEST_ff_f (pow, minus_infty, max_value, plus_infty);
6191 /* pow (-inf, y) == -0 for y an odd integer < 0. */
6192 TEST_ff_f (pow, minus_infty, -3, minus_zero);
6193 TEST_ff_f (pow, minus_infty, -0xffffff, minus_zero);
6194 TEST_ff_f (pow, minus_infty, -0x1fffffe, plus_zero);
6196 TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffp+52L, minus_zero);
6197 TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffp+53L, plus_zero);
6200 # if LDBL_MANT_DIG >= 64
6201 TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffffep+63L, minus_zero);
6202 TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffffep+64L, plus_zero);
6204 # if LDBL_MANT_DIG >= 106
6205 TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6206 TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6208 # if LDBL_MANT_DIG >= 113
6209 TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6210 TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6213 /* pow (-inf, y) == +0 for y < 0 and not an odd integer. */
6214 TEST_ff_f (pow, minus_infty, -2.0, 0.0);
6215 TEST_ff_f (pow, minus_infty, -0x1p24, 0.0);
6216 TEST_ff_f (pow, minus_infty, -0x1p127, 0.0);
6217 TEST_ff_f (pow, minus_infty, -max_value, 0.0);
6219 /* pow (+0, y) == +0 for y an odd integer > 0. */
6220 TEST_ff_f (pow, 0.0, 27, 0.0);
6221 TEST_ff_f (pow, 0.0, 0xffffff, 0.0);
6223 TEST_ff_f (pow, 0.0, 0x1.fffffffffffffp+52L, 0.0);
6226 # if LDBL_MANT_DIG >= 64
6227 TEST_ff_f (pow, 0.0, 0x1.fffffffffffffffep+63L, 0.0);
6229 # if LDBL_MANT_DIG >= 106
6230 TEST_ff_f (pow, 0.0, 0x1.ffffffffffffffffffffffffff8p+105L, 0.0);
6232 # if LDBL_MANT_DIG >= 113
6233 TEST_ff_f (pow, 0.0, 0x1.ffffffffffffffffffffffffffffp+112L, 0.0);
6237 /* pow (-0, y) == -0 for y an odd integer > 0. */
6238 TEST_ff_f (pow, minus_zero, 27, minus_zero);
6239 TEST_ff_f (pow, minus_zero, 0xffffff, minus_zero);
6240 TEST_ff_f (pow, minus_zero, 0x1fffffe, plus_zero);
6242 TEST_ff_f (pow, minus_zero, 0x1.fffffffffffffp+52L, minus_zero);
6243 TEST_ff_f (pow, minus_zero, 0x1.fffffffffffffp+53L, plus_zero);
6246 # if LDBL_MANT_DIG >= 64
6247 TEST_ff_f (pow, minus_zero, 0x1.fffffffffffffffep+63L, minus_zero);
6248 TEST_ff_f (pow, minus_zero, 0x1.fffffffffffffffep+64L, plus_zero);
6250 # if LDBL_MANT_DIG >= 106
6251 TEST_ff_f (pow, minus_zero, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6252 TEST_ff_f (pow, minus_zero, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6254 # if LDBL_MANT_DIG >= 113
6255 TEST_ff_f (pow, minus_zero, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6256 TEST_ff_f (pow, minus_zero, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6260 /* pow (+0, y) == +0 for y > 0 and not an odd integer. */
6261 TEST_ff_f (pow, 0.0, 4, 0.0);
6262 TEST_ff_f (pow, 0.0, 0x1p24, 0.0);
6263 TEST_ff_f (pow, 0.0, 0x1p127, 0.0);
6264 TEST_ff_f (pow, 0.0, max_value, 0.0);
6266 /* pow (-0, y) == +0 for y > 0 and not an odd integer. */
6267 TEST_ff_f (pow, minus_zero, 4, 0.0);
6268 TEST_ff_f (pow, minus_zero, 0x1p24, 0.0);
6269 TEST_ff_f (pow, minus_zero, 0x1p127, 0.0);
6270 TEST_ff_f (pow, minus_zero, max_value, 0.0);
6272 TEST_ff_f (pow, 16, 0.25L, 2);
6273 TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
6274 TEST_ff_f (pow, 2, 4, 16);
6275 TEST_ff_f (pow, 256, 8, 0x1p64L);
6277 TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
6279 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
6280 TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
6283 TEST_ff_f (pow, -1.0, -0xffffff, -1.0);
6284 TEST_ff_f (pow, -1.0, -0x1fffffe, 1.0);
6286 TEST_ff_f (pow, -1.0, -0x1.fffffffffffffp+52L, -1.0);
6287 TEST_ff_f (pow, -1.0, -0x1.fffffffffffffp+53L, 1.0);
6290 # if LDBL_MANT_DIG >= 64
6291 TEST_ff_f (pow, -1.0, -0x1.fffffffffffffffep+63L, -1.0);
6292 TEST_ff_f (pow, -1.0, -0x1.fffffffffffffffep+64L, 1.0);
6294 # if LDBL_MANT_DIG >= 106
6295 TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffff8p+105L, -1.0);
6296 TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffff8p+106L, 1.0);
6298 # if LDBL_MANT_DIG >= 113
6299 TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffffffp+112L, -1.0);
6300 TEST_ff_f (pow, -1.0, -0x1.ffffffffffffffffffffffffffffp+113L, 1.0);
6303 TEST_ff_f (pow, -1.0, -max_value, 1.0);
6305 TEST_ff_f (pow, -1.0, 0xffffff, -1.0);
6306 TEST_ff_f (pow, -1.0, 0x1fffffe, 1.0);
6308 TEST_ff_f (pow, -1.0, 0x1.fffffffffffffp+52L, -1.0);
6309 TEST_ff_f (pow, -1.0, 0x1.fffffffffffffp+53L, 1.0);
6312 # if LDBL_MANT_DIG >= 64
6313 TEST_ff_f (pow, -1.0, 0x1.fffffffffffffffep+63L, -1.0);
6314 TEST_ff_f (pow, -1.0, 0x1.fffffffffffffffep+64L, 1.0);
6316 # if LDBL_MANT_DIG >= 106
6317 TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffff8p+105L, -1.0);
6318 TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffff8p+106L, 1.0);
6320 # if LDBL_MANT_DIG >= 113
6321 TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffffffp+112L, -1.0);
6322 TEST_ff_f (pow, -1.0, 0x1.ffffffffffffffffffffffffffffp+113L, 1.0);
6325 TEST_ff_f (pow, -1.0, max_value, 1.0);
6327 TEST_ff_f (pow, -2.0, 126, 0x1p126);
6328 TEST_ff_f (pow, -2.0, 127, -0x1p127);
6329 TEST_ff_f (pow, -2.0, -126, 0x1p-126);
6330 TEST_ff_f (pow, -2.0, -127, -0x1p-127);
6332 TEST_ff_f (pow, -2.0, -0xffffff, minus_zero);
6333 TEST_ff_f (pow, -2.0, -0x1fffffe, plus_zero);
6335 TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+52L, minus_zero);
6336 TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+53L, plus_zero);
6339 # if LDBL_MANT_DIG >= 64
6340 TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+63L, minus_zero);
6341 TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+64L, plus_zero);
6343 # if LDBL_MANT_DIG >= 106
6344 TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6345 TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6347 # if LDBL_MANT_DIG >= 113
6348 TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6349 TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6352 TEST_ff_f (pow, -2.0, -max_value, plus_zero);
6354 TEST_ff_f (pow, -2.0, 0xffffff, minus_infty, OVERFLOW_EXCEPTION);
6355 TEST_ff_f (pow, -2.0, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION);
6357 TEST_ff_f (pow, -2.0, 0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION);
6358 TEST_ff_f (pow, -2.0, 0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION);
6361 # if LDBL_MANT_DIG >= 64
6362 TEST_ff_f (pow, -2.0, 0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION);
6363 TEST_ff_f (pow, -2.0, 0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION);
6365 # if LDBL_MANT_DIG >= 106
6366 TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION);
6367 TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION);
6369 # if LDBL_MANT_DIG >= 113
6370 TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION);
6371 TEST_ff_f (pow, -2.0, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION);
6374 TEST_ff_f (pow, -2.0, max_value, plus_infty, OVERFLOW_EXCEPTION);
6376 TEST_ff_f (pow, -max_value, 0.5, nan_value, INVALID_EXCEPTION);
6377 TEST_ff_f (pow, -max_value, 1.5, nan_value, INVALID_EXCEPTION);
6378 TEST_ff_f (pow, -max_value, 1000.5, nan_value, INVALID_EXCEPTION);
6379 TEST_ff_f (pow, -max_value, -2, plus_zero);
6380 TEST_ff_f (pow, -max_value, -3, minus_zero);
6381 TEST_ff_f (pow, -max_value, 2, plus_infty, OVERFLOW_EXCEPTION);
6382 TEST_ff_f (pow, -max_value, 3, minus_infty, OVERFLOW_EXCEPTION);
6384 TEST_ff_f (pow, -max_value, -0xffffff, minus_zero);
6385 TEST_ff_f (pow, -max_value, -0x1fffffe, plus_zero);
6387 TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+52L, minus_zero);
6388 TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+53L, plus_zero);
6391 # if LDBL_MANT_DIG >= 64
6392 TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+63L, minus_zero);
6393 TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+64L, plus_zero);
6395 # if LDBL_MANT_DIG >= 106
6396 TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6397 TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6399 # if LDBL_MANT_DIG >= 113
6400 TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6401 TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6404 TEST_ff_f (pow, -max_value, -max_value, plus_zero);
6406 TEST_ff_f (pow, -max_value, 0xffffff, minus_infty, OVERFLOW_EXCEPTION);
6407 TEST_ff_f (pow, -max_value, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION);
6409 TEST_ff_f (pow, -max_value, 0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION);
6410 TEST_ff_f (pow, -max_value, 0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION);
6413 # if LDBL_MANT_DIG >= 64
6414 TEST_ff_f (pow, -max_value, 0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION);
6415 TEST_ff_f (pow, -max_value, 0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION);
6417 # if LDBL_MANT_DIG >= 106
6418 TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION);
6419 TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION);
6421 # if LDBL_MANT_DIG >= 113
6422 TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION);
6423 TEST_ff_f (pow, -max_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION);
6426 TEST_ff_f (pow, -max_value, max_value, plus_infty, OVERFLOW_EXCEPTION);
6428 TEST_ff_f (pow, -0.5, 126, 0x1p-126);
6429 TEST_ff_f (pow, -0.5, 127, -0x1p-127);
6430 TEST_ff_f (pow, -0.5, -126, 0x1p126);
6431 TEST_ff_f (pow, -0.5, -127, -0x1p127);
6433 TEST_ff_f (pow, -0.5, -0xffffff, minus_infty, OVERFLOW_EXCEPTION);
6434 TEST_ff_f (pow, -0.5, -0x1fffffe, plus_infty, OVERFLOW_EXCEPTION);
6436 TEST_ff_f (pow, -0.5, -0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION);
6437 TEST_ff_f (pow, -0.5, -0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION);
6440 # if LDBL_MANT_DIG >= 64
6441 TEST_ff_f (pow, -0.5, -0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION);
6442 TEST_ff_f (pow, -0.5, -0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION);
6444 # if LDBL_MANT_DIG >= 106
6445 TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION);
6446 TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION);
6448 # if LDBL_MANT_DIG >= 113
6449 TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION);
6450 TEST_ff_f (pow, -0.5, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION);
6453 TEST_ff_f (pow, -0.5, -max_value, plus_infty, OVERFLOW_EXCEPTION);
6455 TEST_ff_f (pow, -0.5, 0xffffff, minus_zero);
6456 TEST_ff_f (pow, -0.5, 0x1fffffe, plus_zero);
6458 TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+52L, minus_zero);
6459 TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+53L, plus_zero);
6462 # if LDBL_MANT_DIG >= 64
6463 TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+63L, minus_zero);
6464 TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+64L, plus_zero);
6466 # if LDBL_MANT_DIG >= 106
6467 TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6468 TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6470 # if LDBL_MANT_DIG >= 113
6471 TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6472 TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6475 TEST_ff_f (pow, -0.5, max_value, plus_zero);
6477 TEST_ff_f (pow, -min_value, 0.5, nan_value, INVALID_EXCEPTION);
6478 TEST_ff_f (pow, -min_value, 1.5, nan_value, INVALID_EXCEPTION);
6479 TEST_ff_f (pow, -min_value, 1000.5, nan_value, INVALID_EXCEPTION);
6480 TEST_ff_f (pow, -min_value, -2, plus_infty, OVERFLOW_EXCEPTION);
6481 TEST_ff_f (pow, -min_value, -3, minus_infty, OVERFLOW_EXCEPTION);
6482 TEST_ff_f (pow, -min_value, 1, -min_value);
6483 TEST_ff_f (pow, -min_value, 2, plus_zero);
6484 TEST_ff_f (pow, -min_value, 3, minus_zero);
6486 TEST_ff_f (pow, -min_value, -0xffffff, minus_infty, OVERFLOW_EXCEPTION);
6487 TEST_ff_f (pow, -min_value, -0x1fffffe, plus_infty, OVERFLOW_EXCEPTION);
6489 TEST_ff_f (pow, -min_value, -0x1.fffffffffffffp+52L, minus_infty, OVERFLOW_EXCEPTION);
6490 TEST_ff_f (pow, -min_value, -0x1.fffffffffffffp+53L, plus_infty, OVERFLOW_EXCEPTION);
6493 # if LDBL_MANT_DIG >= 64
6494 TEST_ff_f (pow, -min_value, -0x1.fffffffffffffffep+63L, minus_infty, OVERFLOW_EXCEPTION);
6495 TEST_ff_f (pow, -min_value, -0x1.fffffffffffffffep+64L, plus_infty, OVERFLOW_EXCEPTION);
6497 # if LDBL_MANT_DIG >= 106
6498 TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, OVERFLOW_EXCEPTION);
6499 TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, OVERFLOW_EXCEPTION);
6501 # if LDBL_MANT_DIG >= 113
6502 TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, OVERFLOW_EXCEPTION);
6503 TEST_ff_f (pow, -min_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, OVERFLOW_EXCEPTION);
6506 TEST_ff_f (pow, -min_value, -max_value, plus_infty, OVERFLOW_EXCEPTION);
6508 TEST_ff_f (pow, -min_value, 0xffffff, minus_zero);
6509 TEST_ff_f (pow, -min_value, 0x1fffffe, plus_zero);
6511 TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+52L, minus_zero);
6512 TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+53L, plus_zero);
6515 # if LDBL_MANT_DIG >= 64
6516 TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+63L, minus_zero);
6517 TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+64L, plus_zero);
6519 # if LDBL_MANT_DIG >= 106
6520 TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero);
6521 TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero);
6523 # if LDBL_MANT_DIG >= 113
6524 TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero);
6525 TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero);
6528 TEST_ff_f (pow, -min_value, max_value, plus_zero);
6530 #ifndef TEST_LDOUBLE /* Bug 13881. */
6531 TEST_ff_f (pow, 0x0.ffffffp0, 10, 0.999999403953712118183885036774764444747L);
6532 TEST_ff_f (pow, 0x0.ffffffp0, 100, 0.999994039553108359406305079606228341585L);
6533 TEST_ff_f (pow, 0x0.ffffffp0, 1000, 0.9999403971297699052276650144650733772182L);
6534 TEST_ff_f (pow, 0x0.ffffffp0, 0x1p24, 0.3678794302077803437135155590023422899744L);
6535 TEST_ff_f (pow, 0x0.ffffffp0, 0x1p30, 1.603807831524924233828134753069728224044e-28L);
6536 TEST_ff_f (pow, 0x0.ffffffp0, 0x1.234566p30, 2.374884712135295099971443365381007297732e-32L);
6537 TEST_ff_f (pow, 0x0.ffffffp0, -10, 1.000000596046643153205170848674671339688L);
6538 TEST_ff_f (pow, 0x0.ffffffp0, -100, 1.000005960482418779499387594989252621451L);
6539 TEST_ff_f (pow, 0x0.ffffffp0, -1000, 1.000059606422943986382898964231519867906L);
6540 TEST_ff_f (pow, 0x0.ffffffp0, -0x1p24, 2.7182819094701610539628664526874952929416L);
6541 TEST_ff_f (pow, 0x0.ffffffp0, -0x1p30, 6.2351609734265057988914412331288163636075e+27L);
6542 TEST_ff_f (pow, 0x0.ffffffp0, -0x1.234566p30, 4.2107307141696353498921307077142537353515e+31L);
6543 TEST_ff_f (pow, 0x1.000002p0, 0x1p24, 7.3890552180866447284268641248075832310141L);
6544 TEST_ff_f (pow, 0x1.000002p0, 0x1.234566p29, 4.2107033006507495188536371520637025716256e+31L);
6545 TEST_ff_f (pow, 0x1.000002p0, -0x1.234566p29, 2.3749001736727769098946062325205705312166e-32L);
6548 /* Bug 13881: powl inaccurate so these tests disabled for long double. */
6549 #if !defined TEST_FLOAT && !defined TEST_LDOUBLE
6550 TEST_ff_f (pow, 0x0.fffffffffffff8p0L, 0x1.23456789abcdfp62L, 1.0118762747827252817436395051178295138220e-253L);
6551 TEST_ff_f (pow, 0x0.fffffffffffff8p0L, -0x1.23456789abcdfp62L, 9.8826311568054561811190162420900667121992e+252L);
6552 TEST_ff_f (pow, 0x1.0000000000001p0L, 0x1.23456789abcdfp61L, 9.8826311568044974397135026217687399395481e+252L);
6553 TEST_ff_f (pow, 0x1.0000000000001p0L, -0x1.23456789abcdfp61L, 1.0118762747828234466621210689458255908670e-253L);
6561 pow_test_tonearest (void)
6563 int save_round_mode;
6566 if (errno == ENOSYS)
6567 /* Function not implemented. */
6570 START (pow_tonearest);
6572 save_round_mode = fegetround ();
6574 if (!fesetround (FE_TONEAREST))
6576 TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L);
6577 TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L);
6580 fesetround (save_round_mode);
6582 END (pow_tonearest);
6587 pow_test_towardzero (void)
6589 int save_round_mode;
6592 if (errno == ENOSYS)
6593 /* Function not implemented. */
6596 START (pow_towardzero);
6598 save_round_mode = fegetround ();
6600 if (!fesetround (FE_TOWARDZERO))
6602 TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L);
6603 TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L);
6606 fesetround (save_round_mode);
6608 END (pow_towardzero);
6613 pow_test_downward (void)
6615 int save_round_mode;
6618 if (errno == ENOSYS)
6619 /* Function not implemented. */
6622 START (pow_downward);
6624 save_round_mode = fegetround ();
6626 if (!fesetround (FE_DOWNWARD))
6628 TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L);
6629 TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L);
6632 fesetround (save_round_mode);
6639 pow_test_upward (void)
6641 int save_round_mode;
6644 if (errno == ENOSYS)
6645 /* Function not implemented. */
6650 save_round_mode = fegetround ();
6652 if (!fesetround (FE_UPWARD))
6654 TEST_ff_f (pow, 1.0625L, 1.125L, 1.070582293028761362162622578677070098674L);
6655 TEST_ff_f (pow, 1.5L, 1.03125L, 1.519127098714743184071644334163037684948L);
6658 fesetround (save_round_mode);
6665 remainder_test (void)
6668 FUNC(remainder) (1.625, 1.0);
6669 if (errno == ENOSYS)
6670 /* Function not implemented. */
6676 TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
6677 check_int ("errno for remainder(1, 0) = EDOM ", errno, EDOM, 0, 0, 0);
6679 TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
6680 check_int ("errno for remainder(1, -0) = EDOM ", errno, EDOM, 0, 0, 0);
6682 TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
6683 check_int ("errno for remainder(INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
6685 TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
6686 check_int ("errno for remainder(-INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
6688 TEST_ff_f (remainder, nan_value, nan_value, nan_value);
6689 check_int ("errno for remainder(NAN, NAN) unchanged", errno, 0, 0, 0, 0);
6691 TEST_ff_f (remainder, 0, nan_value, nan_value);
6692 check_int ("errno for remainder(0, NAN) unchanged", errno, 0, 0, 0, 0);
6694 TEST_ff_f (remainder, nan_value, 0, nan_value);
6695 check_int ("errno for remainder(NaN, 0) unchanged", errno, 0, 0, 0, 0);
6697 TEST_ff_f (remainder, 1.625, 1.0, -0.375);
6698 TEST_ff_f (remainder, -1.625, 1.0, 0.375);
6699 TEST_ff_f (remainder, 1.625, -1.0, -0.375);
6700 TEST_ff_f (remainder, -1.625, -1.0, 0.375);
6701 TEST_ff_f (remainder, 5.0, 2.0, 1.0);
6702 TEST_ff_f (remainder, 3.0, 2.0, -1.0);
6714 FUNC(remquo) (1.625, 1.0, &x);
6715 if (errno == ENOSYS)
6716 /* Function not implemented. */
6721 TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
6722 TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
6723 TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
6724 TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
6725 TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
6727 TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
6728 TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
6729 TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
6730 TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
6732 TEST_ffI_f1 (remquo, 5, 2, 1, 2);
6733 TEST_ffI_f1 (remquo, 3, 2, -1, 2);
6743 TEST_f_f (rint, 0.0, 0.0);
6744 TEST_f_f (rint, minus_zero, minus_zero);
6745 TEST_f_f (rint, plus_infty, plus_infty);
6746 TEST_f_f (rint, minus_infty, minus_infty);
6748 /* Default rounding mode is round to even. */
6749 TEST_f_f (rint, 0.5, 0.0);
6750 TEST_f_f (rint, 1.5, 2.0);
6751 TEST_f_f (rint, 2.5, 2.0);
6752 TEST_f_f (rint, 3.5, 4.0);
6753 TEST_f_f (rint, 4.5, 4.0);
6754 TEST_f_f (rint, -0.5, -0.0);
6755 TEST_f_f (rint, -1.5, -2.0);
6756 TEST_f_f (rint, -2.5, -2.0);
6757 TEST_f_f (rint, -3.5, -4.0);
6758 TEST_f_f (rint, -4.5, -4.0);
6759 TEST_f_f (rint, 0.1, 0.0);
6760 TEST_f_f (rint, 0.25, 0.0);
6761 TEST_f_f (rint, 0.625, 1.0);
6762 TEST_f_f (rint, -0.1, -0.0);
6763 TEST_f_f (rint, -0.25, -0.0);
6764 TEST_f_f (rint, -0.625, -1.0);
6765 TEST_f_f (rint, 262144.75, 262145.0);
6766 TEST_f_f (rint, 262142.75, 262143.0);
6767 TEST_f_f (rint, 524286.75, 524287.0);
6768 TEST_f_f (rint, 524288.75, 524289.0);
6769 TEST_f_f (rint, 1048576.75, 1048577.0);
6770 TEST_f_f (rint, 2097152.75, 2097153.0);
6771 TEST_f_f (rint, -1048576.75, -1048577.0);
6772 TEST_f_f (rint, -2097152.75, -2097153.0);
6774 TEST_f_f (rint, 70368744177664.75, 70368744177665.0);
6775 TEST_f_f (rint, 140737488355328.75, 140737488355329.0);
6776 TEST_f_f (rint, 281474976710656.75, 281474976710657.0);
6777 TEST_f_f (rint, 562949953421312.75, 562949953421313.0);
6778 TEST_f_f (rint, 1125899906842624.75, 1125899906842625.0);
6779 TEST_f_f (rint, -70368744177664.75, -70368744177665.0);
6780 TEST_f_f (rint, -140737488355328.75, -140737488355329.0);
6781 TEST_f_f (rint, -281474976710656.75, -281474976710657.0);
6782 TEST_f_f (rint, -562949953421312.75, -562949953421313.0);
6783 TEST_f_f (rint, -1125899906842624.75, -1125899906842625.0);
6786 /* The result can only be represented in long double. */
6787 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
6788 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
6789 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
6790 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
6791 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
6793 # if LDBL_MANT_DIG > 100
6794 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
6795 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
6796 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
6799 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
6800 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
6801 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
6802 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
6803 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
6805 # if LDBL_MANT_DIG > 100
6806 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
6807 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
6808 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
6810 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
6811 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
6812 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
6813 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
6814 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
6815 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
6817 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
6818 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
6819 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
6820 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
6821 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
6822 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
6825 TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
6826 TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
6827 TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
6828 TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
6829 TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
6831 TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
6832 TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
6833 TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
6834 TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
6835 TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
6837 TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
6838 TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
6839 TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
6840 TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
6841 TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
6843 TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
6844 TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
6845 TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
6846 TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
6847 TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
6849 TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
6850 TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
6851 TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
6852 TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
6853 TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
6860 rint_test_tonearest (void)
6862 int save_round_mode;
6863 START (rint_tonearest);
6865 save_round_mode = fegetround ();
6867 if (!fesetround (FE_TONEAREST))
6869 TEST_f_f (rint, 2.0, 2.0);
6870 TEST_f_f (rint, 1.5, 2.0);
6871 TEST_f_f (rint, 1.0, 1.0);
6872 TEST_f_f (rint, 0.5, 0.0);
6873 TEST_f_f (rint, 0.0, 0.0);
6874 TEST_f_f (rint, minus_zero, minus_zero);
6875 TEST_f_f (rint, -0.5, -0.0);
6876 TEST_f_f (rint, -1.0, -1.0);
6877 TEST_f_f (rint, -1.5, -2.0);
6878 TEST_f_f (rint, -2.0, -2.0);
6879 TEST_f_f (rint, 0.1, 0.0);
6880 TEST_f_f (rint, 0.25, 0.0);
6881 TEST_f_f (rint, 0.625, 1.0);
6882 TEST_f_f (rint, -0.1, -0.0);
6883 TEST_f_f (rint, -0.25, -0.0);
6884 TEST_f_f (rint, -0.625, -1.0);
6885 TEST_f_f (rint, 1048576.75, 1048577.0);
6886 TEST_f_f (rint, 2097152.75, 2097153.0);
6887 TEST_f_f (rint, -1048576.75, -1048577.0);
6888 TEST_f_f (rint, -2097152.75, -2097153.0);
6890 TEST_f_f (rint, 70368744177664.75, 70368744177665.0);
6891 TEST_f_f (rint, 140737488355328.75, 140737488355329.0);
6892 TEST_f_f (rint, 281474976710656.75, 281474976710657.0);
6893 TEST_f_f (rint, 562949953421312.75, 562949953421313.0);
6894 TEST_f_f (rint, 1125899906842624.75, 1125899906842625.0);
6895 TEST_f_f (rint, -70368744177664.75, -70368744177665.0);
6896 TEST_f_f (rint, -140737488355328.75, -140737488355329.0);
6897 TEST_f_f (rint, -281474976710656.75, -281474976710657.0);
6898 TEST_f_f (rint, -562949953421312.75, -562949953421313.0);
6899 TEST_f_f (rint, -1125899906842624.75, -1125899906842625.0);
6902 /* The result can only be represented in long double. */
6903 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
6904 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
6905 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
6906 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
6907 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
6908 # if LDBL_MANT_DIG > 100
6909 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
6910 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
6911 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
6913 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
6914 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
6915 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
6916 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
6917 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
6918 # if LDBL_MANT_DIG > 100
6919 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
6920 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
6921 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
6923 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
6924 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
6925 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
6926 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
6927 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
6928 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
6930 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
6931 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
6932 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
6933 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
6934 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
6935 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
6940 fesetround (save_round_mode);
6942 END (rint_tonearest);
6946 rint_test_towardzero (void)
6948 int save_round_mode;
6949 START (rint_towardzero);
6951 save_round_mode = fegetround ();
6953 if (!fesetround (FE_TOWARDZERO))
6955 TEST_f_f (rint, 2.0, 2.0);
6956 TEST_f_f (rint, 1.5, 1.0);
6957 TEST_f_f (rint, 1.0, 1.0);
6958 TEST_f_f (rint, 0.5, 0.0);
6959 TEST_f_f (rint, 0.0, 0.0);
6960 TEST_f_f (rint, minus_zero, minus_zero);
6961 TEST_f_f (rint, -0.5, -0.0);
6962 TEST_f_f (rint, -1.0, -1.0);
6963 TEST_f_f (rint, -1.5, -1.0);
6964 TEST_f_f (rint, -2.0, -2.0);
6965 TEST_f_f (rint, 0.1, 0.0);
6966 TEST_f_f (rint, 0.25, 0.0);
6967 TEST_f_f (rint, 0.625, 0.0);
6968 TEST_f_f (rint, -0.1, -0.0);
6969 TEST_f_f (rint, -0.25, -0.0);
6970 TEST_f_f (rint, -0.625, -0.0);
6971 TEST_f_f (rint, 1048576.75, 1048576.0);
6972 TEST_f_f (rint, 2097152.75, 2097152.0);
6973 TEST_f_f (rint, -1048576.75, -1048576.0);
6974 TEST_f_f (rint, -2097152.75, -2097152.0);
6976 TEST_f_f (rint, 70368744177664.75, 70368744177664.0);
6977 TEST_f_f (rint, 140737488355328.75, 140737488355328.0);
6978 TEST_f_f (rint, 281474976710656.75, 281474976710656.0);
6979 TEST_f_f (rint, 562949953421312.75, 562949953421312.0);
6980 TEST_f_f (rint, 1125899906842624.75, 1125899906842624.0);
6981 TEST_f_f (rint, -70368744177664.75, -70368744177664.0);
6982 TEST_f_f (rint, -140737488355328.75, -140737488355328.0);
6983 TEST_f_f (rint, -281474976710656.75, -281474976710656.0);
6984 TEST_f_f (rint, -562949953421312.75, -562949953421312.0);
6985 TEST_f_f (rint, -1125899906842624.75, -1125899906842624.0);
6988 /* The result can only be represented in long double. */
6989 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
6990 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
6991 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
6992 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
6993 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
6994 # if LDBL_MANT_DIG > 100
6995 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
6996 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
6997 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
6999 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
7000 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
7001 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
7002 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
7003 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
7004 # if LDBL_MANT_DIG > 100
7005 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
7006 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
7007 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
7009 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
7010 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
7011 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
7012 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
7013 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
7014 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
7016 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
7017 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
7018 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
7019 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
7020 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
7021 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
7026 fesetround (save_round_mode);
7028 END (rint_towardzero);
7032 rint_test_downward (void)
7034 int save_round_mode;
7035 START (rint_downward);
7037 save_round_mode = fegetround ();
7039 if (!fesetround (FE_DOWNWARD))
7041 TEST_f_f (rint, 2.0, 2.0);
7042 TEST_f_f (rint, 1.5, 1.0);
7043 TEST_f_f (rint, 1.0, 1.0);
7044 TEST_f_f (rint, 0.5, 0.0);
7045 TEST_f_f (rint, 0.0, 0.0);
7046 TEST_f_f (rint, minus_zero, minus_zero);
7047 TEST_f_f (rint, -0.5, -1.0);
7048 TEST_f_f (rint, -1.0, -1.0);
7049 TEST_f_f (rint, -1.5, -2.0);
7050 TEST_f_f (rint, -2.0, -2.0);
7051 TEST_f_f (rint, 0.1, 0.0);
7052 TEST_f_f (rint, 0.25, 0.0);
7053 TEST_f_f (rint, 0.625, 0.0);
7054 TEST_f_f (rint, -0.1, -1.0);
7055 TEST_f_f (rint, -0.25, -1.0);
7056 TEST_f_f (rint, -0.625, -1.0);
7057 TEST_f_f (rint, 1048576.75, 1048576.0);
7058 TEST_f_f (rint, 2097152.75, 2097152.0);
7059 TEST_f_f (rint, -1048576.75, -1048577.0);
7060 TEST_f_f (rint, -2097152.75, -2097153.0);
7062 TEST_f_f (rint, 70368744177664.75, 70368744177664.0);
7063 TEST_f_f (rint, 140737488355328.75, 140737488355328.0);
7064 TEST_f_f (rint, 281474976710656.75, 281474976710656.0);
7065 TEST_f_f (rint, 562949953421312.75, 562949953421312.0);
7066 TEST_f_f (rint, 1125899906842624.75, 1125899906842624.0);
7067 TEST_f_f (rint, -70368744177664.75, -70368744177665.0);
7068 TEST_f_f (rint, -140737488355328.75, -140737488355329.0);
7069 TEST_f_f (rint, -281474976710656.75, -281474976710657.0);
7070 TEST_f_f (rint, -562949953421312.75, -562949953421313.0);
7071 TEST_f_f (rint, -1125899906842624.75, -1125899906842625.0);
7074 /* The result can only be represented in long double. */
7075 TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
7076 TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
7077 TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
7078 TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
7079 TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
7080 # if LDBL_MANT_DIG > 100
7081 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
7082 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
7083 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
7085 TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
7086 TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
7087 TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
7088 TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
7089 TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
7090 # if LDBL_MANT_DIG > 100
7091 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
7092 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
7093 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
7095 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
7096 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
7097 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
7098 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
7099 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
7100 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
7102 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
7103 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
7104 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
7105 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
7106 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
7107 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
7112 fesetround (save_round_mode);
7114 END (rint_downward);
7118 rint_test_upward (void)
7120 int save_round_mode;
7121 START (rint_upward);
7123 save_round_mode = fegetround ();
7125 if (!fesetround (FE_UPWARD))
7127 TEST_f_f (rint, 2.0, 2.0);
7128 TEST_f_f (rint, 1.5, 2.0);
7129 TEST_f_f (rint, 1.0, 1.0);
7130 TEST_f_f (rint, 0.5, 1.0);
7131 TEST_f_f (rint, 0.0, 0.0);
7132 TEST_f_f (rint, minus_zero, minus_zero);
7133 TEST_f_f (rint, -0.5, -0.0);
7134 TEST_f_f (rint, -1.0, -1.0);
7135 TEST_f_f (rint, -1.5, -1.0);
7136 TEST_f_f (rint, -2.0, -2.0);
7137 TEST_f_f (rint, 0.1, 1.0);
7138 TEST_f_f (rint, 0.25, 1.0);
7139 TEST_f_f (rint, 0.625, 1.0);
7140 TEST_f_f (rint, -0.1, -0.0);
7141 TEST_f_f (rint, -0.25, -0.0);
7142 TEST_f_f (rint, -0.625, -0.0);
7143 TEST_f_f (rint, 1048576.75, 1048577.0);
7144 TEST_f_f (rint, 2097152.75, 2097153.0);
7145 TEST_f_f (rint, -1048576.75, -1048576.0);
7146 TEST_f_f (rint, -2097152.75, -2097152.0);
7148 TEST_f_f (rint, 70368744177664.75, 70368744177665.0);
7149 TEST_f_f (rint, 140737488355328.75, 140737488355329.0);
7150 TEST_f_f (rint, 281474976710656.75, 281474976710657.0);
7151 TEST_f_f (rint, 562949953421312.75, 562949953421313.0);
7152 TEST_f_f (rint, 1125899906842624.75, 1125899906842625.0);
7153 TEST_f_f (rint, -70368744177664.75, -70368744177664.0);
7154 TEST_f_f (rint, -140737488355328.75, -140737488355328.0);
7155 TEST_f_f (rint, -281474976710656.75, -281474976710656.0);
7156 TEST_f_f (rint, -562949953421312.75, -562949953421312.0);
7157 TEST_f_f (rint, -1125899906842624.75, -1125899906842624.0);
7160 /* The result can only be represented in long double. */
7161 TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
7162 TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
7163 TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
7164 TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
7165 TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
7166 # if LDBL_MANT_DIG > 100
7167 TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
7168 TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
7169 TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
7171 TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
7172 TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
7173 TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
7174 TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
7175 TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
7176 # if LDBL_MANT_DIG > 100
7177 TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
7178 TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
7179 TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
7181 TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
7182 TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
7183 TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
7184 TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
7185 TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
7186 TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
7188 TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
7189 TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
7190 TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
7191 TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
7192 TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
7193 TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
7198 fesetround (save_round_mode);
7208 TEST_f_f (round, 0, 0);
7209 TEST_f_f (round, minus_zero, minus_zero);
7210 TEST_f_f (round, 0.2L, 0.0);
7211 TEST_f_f (round, -0.2L, minus_zero);
7212 TEST_f_f (round, 0.5, 1.0);
7213 TEST_f_f (round, -0.5, -1.0);
7214 TEST_f_f (round, 0.8L, 1.0);
7215 TEST_f_f (round, -0.8L, -1.0);
7216 TEST_f_f (round, 1.5, 2.0);
7217 TEST_f_f (round, -1.5, -2.0);
7218 TEST_f_f (round, 0.1, 0.0);
7219 TEST_f_f (round, 0.25, 0.0);
7220 TEST_f_f (round, 0.625, 1.0);
7221 TEST_f_f (round, -0.1, -0.0);
7222 TEST_f_f (round, -0.25, -0.0);
7223 TEST_f_f (round, -0.625, -1.0);
7224 TEST_f_f (round, 2097152.5, 2097153);
7225 TEST_f_f (round, -2097152.5, -2097153);
7228 /* The result can only be represented in long double. */
7229 TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
7230 TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
7231 TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
7232 TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
7233 TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
7234 # if LDBL_MANT_DIG > 100
7235 TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L);
7236 TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L);
7237 TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
7240 TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
7241 TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
7242 TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
7243 TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
7244 TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
7245 # if LDBL_MANT_DIG > 100
7246 TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
7247 TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L);
7248 TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L);
7251 TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
7252 TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
7253 TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
7254 TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
7255 TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
7257 TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
7258 TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
7259 TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
7260 TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
7261 TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
7263 # if LDBL_MANT_DIG > 100
7264 TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L);
7265 TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L);
7266 TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L);
7267 TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L);
7268 TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L);
7269 TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L);
7271 TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L);
7272 TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L);
7273 TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L);
7274 TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L);
7275 TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L);
7276 TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L);
7279 TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
7280 TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
7281 TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
7282 TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
7283 TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
7285 TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
7286 TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
7287 TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
7288 TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
7289 TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
7291 TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
7292 TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
7293 TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
7294 TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
7295 TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
7308 TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
7309 TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
7311 TEST_ff_f (scalb, 0, nan_value, nan_value);
7312 TEST_ff_f (scalb, 1, nan_value, nan_value);
7314 TEST_ff_f (scalb, 1, 0, 1);
7315 TEST_ff_f (scalb, -1, 0, -1);
7317 TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
7318 TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
7320 TEST_ff_f (scalb, 0, 2, 0);
7321 TEST_ff_f (scalb, minus_zero, -4, minus_zero);
7322 TEST_ff_f (scalb, 0, 0, 0);
7323 TEST_ff_f (scalb, minus_zero, 0, minus_zero);
7324 TEST_ff_f (scalb, 0, -1, 0);
7325 TEST_ff_f (scalb, minus_zero, -10, minus_zero);
7326 TEST_ff_f (scalb, 0, minus_infty, 0);
7327 TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
7329 TEST_ff_f (scalb, plus_infty, -1, plus_infty);
7330 TEST_ff_f (scalb, minus_infty, -10, minus_infty);
7331 TEST_ff_f (scalb, plus_infty, 0, plus_infty);
7332 TEST_ff_f (scalb, minus_infty, 0, minus_infty);
7333 TEST_ff_f (scalb, plus_infty, 2, plus_infty);
7334 TEST_ff_f (scalb, minus_infty, 100, minus_infty);
7336 TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
7337 TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
7339 TEST_ff_f (scalb, 1, plus_infty, plus_infty);
7340 TEST_ff_f (scalb, -1, plus_infty, minus_infty);
7341 TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
7342 TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
7344 TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
7345 TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
7347 TEST_ff_f (scalb, nan_value, 1, nan_value);
7348 TEST_ff_f (scalb, 1, nan_value, nan_value);
7349 TEST_ff_f (scalb, nan_value, 0, nan_value);
7350 TEST_ff_f (scalb, 0, nan_value, nan_value);
7351 TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
7352 TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
7353 TEST_ff_f (scalb, nan_value, nan_value, nan_value);
7355 TEST_ff_f (scalb, 0.8L, 4, 12.8L);
7356 TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
7368 TEST_fi_f (scalbn, 0, 0, 0);
7369 TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
7371 TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
7372 TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
7373 TEST_fi_f (scalbn, nan_value, 1, nan_value);
7375 TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
7376 TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
7378 TEST_fi_f (scalbn, 1, 0L, 1);
7380 TEST_fi_f (scalbn, 1, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7381 TEST_fi_f (scalbn, 1, INT_MIN, plus_zero);
7382 TEST_fi_f (scalbn, max_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7383 TEST_fi_f (scalbn, max_value, INT_MIN, plus_zero);
7384 TEST_fi_f (scalbn, min_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7385 TEST_fi_f (scalbn, min_value, INT_MIN, plus_zero);
7386 TEST_fi_f (scalbn, min_value / 4, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7387 TEST_fi_f (scalbn, min_value / 4, INT_MIN, plus_zero);
7399 TEST_fl_f (scalbln, 0, 0, 0);
7400 TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
7402 TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
7403 TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
7404 TEST_fl_f (scalbln, nan_value, 1, nan_value);
7406 TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
7407 TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
7409 TEST_fl_f (scalbln, 1, 0L, 1);
7411 TEST_fi_f (scalbln, 1, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7412 TEST_fi_f (scalbln, 1, INT_MIN, plus_zero);
7413 TEST_fi_f (scalbln, max_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7414 TEST_fi_f (scalbln, max_value, INT_MIN, plus_zero);
7415 TEST_fi_f (scalbln, min_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7416 TEST_fi_f (scalbln, min_value, INT_MIN, plus_zero);
7417 TEST_fi_f (scalbln, min_value / 4, INT_MAX, plus_infty, OVERFLOW_EXCEPTION);
7418 TEST_fi_f (scalbln, min_value / 4, INT_MIN, plus_zero);
7420 TEST_fi_f (scalbln, 1, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION);
7421 TEST_fi_f (scalbln, 1, LONG_MIN, plus_zero);
7422 TEST_fi_f (scalbln, max_value, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION);
7423 TEST_fi_f (scalbln, max_value, LONG_MIN, plus_zero);
7424 TEST_fi_f (scalbln, min_value, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION);
7425 TEST_fi_f (scalbln, min_value, LONG_MIN, plus_zero);
7426 TEST_fi_f (scalbln, min_value / 4, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION);
7427 TEST_fi_f (scalbln, min_value / 4, LONG_MIN, plus_zero);
7429 #if LONG_MAX >= 0x100000000
7430 TEST_fi_f (scalbln, 1, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION);
7431 TEST_fi_f (scalbln, 1, -0x88000000L, plus_zero);
7432 TEST_fi_f (scalbln, max_value, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION);
7433 TEST_fi_f (scalbln, max_value, -0x88000000L, plus_zero);
7434 TEST_fi_f (scalbln, min_value, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION);
7435 TEST_fi_f (scalbln, min_value, -0x88000000L, plus_zero);
7436 TEST_fi_f (scalbln, min_value / 4, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION);
7437 TEST_fi_f (scalbln, min_value / 4, -0x88000000L, plus_zero);
7450 TEST_f_b (signbit, 0, 0);
7451 TEST_f_b (signbit, minus_zero, 1);
7452 TEST_f_b (signbit, plus_infty, 0);
7453 TEST_f_b (signbit, minus_infty, 1);
7455 /* signbit (x) != 0 for x < 0. */
7456 TEST_f_b (signbit, -1, 1);
7457 /* signbit (x) == 0 for x >= 0. */
7458 TEST_f_b (signbit, 1, 0);
7469 if (errno == ENOSYS)
7470 /* Function not implemented. */
7475 TEST_f_f (sin, 0, 0);
7476 TEST_f_f (sin, minus_zero, minus_zero);
7478 TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
7479 check_int ("errno for sin(+inf) == EDOM", errno, EDOM, 0, 0, 0);
7481 TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
7482 check_int ("errno for sin(-inf) == EDOM", errno, EDOM, 0, 0, 0);
7484 TEST_f_f (sin, nan_value, nan_value);
7485 check_int ("errno for sin(NaN) unchanged", errno, 0, 0, 0, 0);
7487 TEST_f_f (sin, M_PI_6l, 0.5);
7488 TEST_f_f (sin, -M_PI_6l, -0.5);
7489 TEST_f_f (sin, M_PI_2l, 1);
7490 TEST_f_f (sin, -M_PI_2l, -1);
7491 TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
7493 TEST_f_f (sin, 0x1p65, -0.047183876212354673805106149805700013943218L);
7494 TEST_f_f (sin, -0x1p65, 0.047183876212354673805106149805700013943218L);
7497 TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
7498 TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1);
7502 TEST_f_f (sin, 1e22, -0.8522008497671888017727058937530293682618L);
7503 TEST_f_f (sin, 0x1p1023, 0.5631277798508840134529434079444683477104L);
7506 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
7507 TEST_f_f (sin, 0x1p16383L, 0.3893629985894208126948115852610595405563L);
7516 sin_test_tonearest (void)
7518 int save_round_mode;
7521 if (errno == ENOSYS)
7522 /* Function not implemented. */
7525 START (sin_tonearest);
7527 save_round_mode = fegetround ();
7529 if (!fesetround (FE_TONEAREST))
7531 TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L);
7532 TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L);
7533 TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L);
7534 TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L);
7535 TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L);
7536 TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L);
7537 TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L);
7538 TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L);
7539 TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L);
7540 TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L);
7543 fesetround (save_round_mode);
7545 END (sin_tonearest);
7550 sin_test_towardzero (void)
7552 int save_round_mode;
7555 if (errno == ENOSYS)
7556 /* Function not implemented. */
7559 START (sin_towardzero);
7561 save_round_mode = fegetround ();
7563 if (!fesetround (FE_TOWARDZERO))
7565 TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L);
7566 TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L);
7567 TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L);
7568 TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L);
7569 TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L);
7570 TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L);
7571 TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L);
7572 TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L);
7573 TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L);
7574 TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L);
7577 fesetround (save_round_mode);
7579 END (sin_towardzero);
7584 sin_test_downward (void)
7586 int save_round_mode;
7589 if (errno == ENOSYS)
7590 /* Function not implemented. */
7593 START (sin_downward);
7595 save_round_mode = fegetround ();
7597 if (!fesetround (FE_DOWNWARD))
7599 TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L);
7600 TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L);
7601 TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L);
7602 TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L);
7603 TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L);
7604 TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L);
7605 TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L);
7606 TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L);
7607 TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L);
7608 TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L);
7611 fesetround (save_round_mode);
7618 sin_test_upward (void)
7620 int save_round_mode;
7623 if (errno == ENOSYS)
7624 /* Function not implemented. */
7629 save_round_mode = fegetround ();
7631 if (!fesetround (FE_UPWARD))
7633 TEST_f_f (sin, 1, 0.8414709848078965066525023216302989996226L);
7634 TEST_f_f (sin, 2, 0.9092974268256816953960198659117448427023L);
7635 TEST_f_f (sin, 3, 0.1411200080598672221007448028081102798469L);
7636 TEST_f_f (sin, 4, -0.7568024953079282513726390945118290941359L);
7637 TEST_f_f (sin, 5, -0.9589242746631384688931544061559939733525L);
7638 TEST_f_f (sin, 6, -0.2794154981989258728115554466118947596280L);
7639 TEST_f_f (sin, 7, 0.6569865987187890903969990915936351779369L);
7640 TEST_f_f (sin, 8, 0.9893582466233817778081235982452886721164L);
7641 TEST_f_f (sin, 9, 0.4121184852417565697562725663524351793439L);
7642 TEST_f_f (sin, 10, -0.5440211108893698134047476618513772816836L);
7645 fesetround (save_round_mode);
7654 FLOAT sin_res, cos_res;
7657 FUNC(sincos) (0, &sin_res, &cos_res);
7658 if (errno == ENOSYS)
7659 /* Function not implemented. */
7664 /* sincos is treated differently because it returns void. */
7665 TEST_extra (sincos, 0, 0, 1);
7667 TEST_extra (sincos, minus_zero, minus_zero, 1);
7668 TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
7669 TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
7670 TEST_extra (sincos, nan_value, nan_value, nan_value);
7672 TEST_extra (sincos, M_PI_2l, 1, 0);
7673 TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
7674 TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
7675 TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
7677 TEST_extra (sincos, 0x1p65, -0.047183876212354673805106149805700013943218L, 0.99888622066058013610642172179340364209972L);
7678 TEST_extra (sincos, -0x1p65, 0.047183876212354673805106149805700013943218L, 0.99888622066058013610642172179340364209972L);
7681 TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
7685 TEST_extra (sincos, 1e22, -0.8522008497671888017727058937530293682618L, 0.5232147853951389454975944733847094921409L);
7686 TEST_extra (sincos, 0x1p1023, 0.5631277798508840134529434079444683477104L, -0.826369834614147994500785680811743734805L);
7689 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
7690 TEST_extra (sincos, 0x1p16383L, 0.3893629985894208126948115852610595405563L, 0.9210843909921906206874509522505756251609L);
7701 if (errno == ENOSYS)
7702 /* Function not implemented. */
7706 TEST_f_f (sinh, 0, 0);
7707 TEST_f_f (sinh, minus_zero, minus_zero);
7710 TEST_f_f (sinh, plus_infty, plus_infty);
7711 TEST_f_f (sinh, minus_infty, minus_infty);
7713 TEST_f_f (sinh, nan_value, nan_value);
7715 TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
7716 TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
7723 sinh_test_tonearest (void)
7725 int save_round_mode;
7728 if (errno == ENOSYS)
7729 /* Function not implemented. */
7732 START (sinh_tonearest);
7734 save_round_mode = fegetround ();
7736 if (!fesetround (FE_TONEAREST))
7738 TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L);
7739 TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L);
7740 TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L);
7743 fesetround (save_round_mode);
7745 END (sinh_tonearest);
7750 sinh_test_towardzero (void)
7752 int save_round_mode;
7755 if (errno == ENOSYS)
7756 /* Function not implemented. */
7759 START (sinh_towardzero);
7761 save_round_mode = fegetround ();
7763 if (!fesetround (FE_TOWARDZERO))
7765 TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L);
7766 TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L);
7767 TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L);
7770 fesetround (save_round_mode);
7772 END (sinh_towardzero);
7777 sinh_test_downward (void)
7779 int save_round_mode;
7782 if (errno == ENOSYS)
7783 /* Function not implemented. */
7786 START (sinh_downward);
7788 save_round_mode = fegetround ();
7790 if (!fesetround (FE_DOWNWARD))
7792 TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L);
7793 TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L);
7794 TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L);
7797 fesetround (save_round_mode);
7799 END (sinh_downward);
7804 sinh_test_upward (void)
7806 int save_round_mode;
7809 if (errno == ENOSYS)
7810 /* Function not implemented. */
7813 START (sinh_upward);
7815 save_round_mode = fegetround ();
7817 if (!fesetround (FE_UPWARD))
7819 TEST_f_f (sinh, 22, 1792456423.065795780701106568345764104225L);
7820 TEST_f_f (sinh, 23, 4872401723.124451299966006944252978187305L);
7821 TEST_f_f (sinh, 24, 13244561064.92173614705070540368454568168L);
7824 fesetround (save_round_mode);
7835 if (errno == ENOSYS)
7836 /* Function not implemented. */
7841 TEST_f_f (sqrt, 0, 0);
7842 TEST_f_f (sqrt, nan_value, nan_value);
7843 TEST_f_f (sqrt, plus_infty, plus_infty);
7845 TEST_f_f (sqrt, minus_zero, minus_zero);
7847 /* sqrt (x) == NaN plus invalid exception for x < 0. */
7848 TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
7849 TEST_f_f (sqrt, -max_value, nan_value, INVALID_EXCEPTION);
7850 TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
7851 TEST_f_f (sqrt, nan_value, nan_value);
7853 TEST_f_f (sqrt, 2209, 47);
7854 TEST_f_f (sqrt, 4, 2);
7855 TEST_f_f (sqrt, 2, M_SQRT2l);
7856 TEST_f_f (sqrt, 0.25, 0.5);
7857 TEST_f_f (sqrt, 6642.25, 81.5);
7858 TEST_f_f (sqrt, 15190.5625L, 123.25L);
7859 TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
7870 if (errno == ENOSYS)
7871 /* Function not implemented. */
7876 TEST_f_f (tan, 0, 0);
7877 TEST_f_f (tan, minus_zero, minus_zero);
7879 TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
7880 check_int ("errno for tan(Inf) == EDOM", errno, EDOM, 0, 0, 0);
7882 TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
7883 check_int ("errno for tan(-Inf) == EDOM", errno, EDOM, 0, 0, 0);
7885 TEST_f_f (tan, nan_value, nan_value);
7886 check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0);
7888 TEST_f_f (tan, M_PI_4l, 1);
7889 TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
7891 TEST_f_f (tan, 0x1p65, -0.0472364872359047946798414219288370688827L);
7892 TEST_f_f (tan, -0x1p65, 0.0472364872359047946798414219288370688827L);
7895 TEST_f_f (tan, 1e22, -1.628778225606898878549375936939548513545L);
7896 TEST_f_f (tan, 0x1p1023, -0.6814476476066215012854144040167365190368L);
7899 #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
7900 TEST_f_f (tan, 0x1p16383L, 0.422722393732022337800504160054440141575L);
7908 tan_test_tonearest (void)
7910 int save_round_mode;
7913 if (errno == ENOSYS)
7914 /* Function not implemented. */
7917 START (tan_tonearest);
7919 save_round_mode = fegetround ();
7921 if (!fesetround (FE_TONEAREST))
7923 TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L);
7924 TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L);
7925 TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L);
7926 TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L);
7927 TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L);
7928 TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L);
7929 TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L);
7930 TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L);
7931 TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L);
7932 TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L);
7935 fesetround (save_round_mode);
7937 END (tan_tonearest);
7942 tan_test_towardzero (void)
7944 int save_round_mode;
7947 if (errno == ENOSYS)
7948 /* Function not implemented. */
7951 START (tan_towardzero);
7953 save_round_mode = fegetround ();
7955 if (!fesetround (FE_TOWARDZERO))
7957 TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L);
7958 TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L);
7959 TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L);
7960 TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L);
7961 TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L);
7962 TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L);
7963 TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L);
7964 TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L);
7965 TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L);
7966 TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L);
7969 fesetround (save_round_mode);
7971 END (tan_towardzero);
7976 tan_test_downward (void)
7978 int save_round_mode;
7981 if (errno == ENOSYS)
7982 /* Function not implemented. */
7985 START (tan_downward);
7987 save_round_mode = fegetround ();
7989 if (!fesetround (FE_DOWNWARD))
7991 TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L);
7992 TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L);
7993 TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L);
7994 TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L);
7995 TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L);
7996 TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L);
7997 TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L);
7998 TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L);
7999 TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L);
8000 TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L);
8003 fesetround (save_round_mode);
8010 tan_test_upward (void)
8012 int save_round_mode;
8015 if (errno == ENOSYS)
8016 /* Function not implemented. */
8021 save_round_mode = fegetround ();
8023 if (!fesetround (FE_UPWARD))
8025 TEST_f_f (tan, 1, 1.5574077246549022305069748074583601730873L);
8026 TEST_f_f (tan, 2, -2.1850398632615189916433061023136825434320L);
8027 TEST_f_f (tan, 3, -0.1425465430742778052956354105339134932261L);
8028 TEST_f_f (tan, 4, 1.1578212823495775831373424182673239231198L);
8029 TEST_f_f (tan, 5, -3.3805150062465856369827058794473439087096L);
8030 TEST_f_f (tan, 6, -0.2910061913847491570536995888681755428312L);
8031 TEST_f_f (tan, 7, 0.8714479827243187364564508896003135663222L);
8032 TEST_f_f (tan, 8, -6.7997114552203786999252627596086333648814L);
8033 TEST_f_f (tan, 9, -0.4523156594418098405903708757987855343087L);
8034 TEST_f_f (tan, 10, 0.6483608274590866712591249330098086768169L);
8037 fesetround (save_round_mode);
8048 if (errno == ENOSYS)
8049 /* Function not implemented. */
8054 TEST_f_f (tanh, 0, 0);
8055 TEST_f_f (tanh, minus_zero, minus_zero);
8058 TEST_f_f (tanh, plus_infty, 1);
8059 TEST_f_f (tanh, minus_infty, -1);
8061 TEST_f_f (tanh, nan_value, nan_value);
8063 TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
8064 TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
8066 TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
8067 TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
8070 TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
8080 if (errno == ENOSYS)
8081 /* Function not implemented. */
8083 feclearexcept (FE_ALL_EXCEPT);
8087 TEST_f_f (tgamma, plus_infty, plus_infty);
8088 TEST_f_f (tgamma, max_value, plus_infty, OVERFLOW_EXCEPTION);
8089 TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
8090 TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
8091 /* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
8092 TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
8093 TEST_f_f (tgamma, -max_value, nan_value, INVALID_EXCEPTION);
8094 TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
8095 TEST_f_f (tgamma, nan_value, nan_value);
8097 TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
8098 TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
8100 TEST_f_f (tgamma, 1, 1);
8101 TEST_f_f (tgamma, 4, 6);
8103 TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
8104 TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
8115 TEST_f_f (trunc, plus_infty, plus_infty);
8116 TEST_f_f (trunc, minus_infty, minus_infty);
8117 TEST_f_f (trunc, nan_value, nan_value);
8119 TEST_f_f (trunc, 0, 0);
8120 TEST_f_f (trunc, minus_zero, minus_zero);
8121 TEST_f_f (trunc, 0.1, 0);
8122 TEST_f_f (trunc, 0.25, 0);
8123 TEST_f_f (trunc, 0.625, 0);
8124 TEST_f_f (trunc, -0.1, minus_zero);
8125 TEST_f_f (trunc, -0.25, minus_zero);
8126 TEST_f_f (trunc, -0.625, minus_zero);
8127 TEST_f_f (trunc, 1, 1);
8128 TEST_f_f (trunc, -1, -1);
8129 TEST_f_f (trunc, 1.625, 1);
8130 TEST_f_f (trunc, -1.625, -1);
8132 TEST_f_f (trunc, 1048580.625L, 1048580L);
8133 TEST_f_f (trunc, -1048580.625L, -1048580L);
8135 TEST_f_f (trunc, 8388610.125L, 8388610.0L);
8136 TEST_f_f (trunc, -8388610.125L, -8388610.0L);
8138 TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
8139 TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
8142 /* The result can only be represented in long double. */
8143 TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
8144 TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
8145 TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
8146 TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
8147 TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
8149 # if LDBL_MANT_DIG > 100
8150 TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L);
8151 TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
8152 TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
8155 TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
8156 TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
8157 TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
8158 TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
8159 TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
8161 # if LDBL_MANT_DIG > 100
8162 TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
8163 TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
8164 TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L);
8167 TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
8168 TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
8169 TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
8170 TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
8171 TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
8173 # if LDBL_MANT_DIG > 100
8174 TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L);
8175 TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L);
8176 TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L);
8177 TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L);
8178 TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L);
8179 TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L);
8182 TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
8183 TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
8184 TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
8185 TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
8186 TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
8188 # if LDBL_MANT_DIG > 100
8189 TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L);
8190 TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L);
8191 TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L);
8192 TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L);
8193 TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L);
8194 TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L);
8197 TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
8198 TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
8199 TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
8200 TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
8201 TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
8203 TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
8204 TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
8205 TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
8206 TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
8207 TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
8209 TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
8210 TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
8211 TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
8212 TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
8213 TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
8224 FUNC (sincos) (0, &s, &c);
8225 if (errno == ENOSYS)
8226 /* Required function not implemented. */
8229 if (errno == ENOSYS)
8230 /* Function not implemented. */
8233 /* y0 is the Bessel function of the second kind of order 0 */
8236 TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
8237 TEST_f_f (y0, -max_value, minus_infty, INVALID_EXCEPTION);
8238 TEST_f_f (y0, 0.0, minus_infty);
8239 TEST_f_f (y0, nan_value, nan_value);
8240 TEST_f_f (y0, plus_infty, 0);
8242 TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
8243 TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
8244 TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
8245 TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
8246 TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
8247 TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
8248 TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
8250 TEST_f_f (y0, 0x1.3ffp+74L, 1.818984347516051243459467456433028748678e-12L);
8253 TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
8265 FUNC (sincos) (0, &s, &c);
8266 if (errno == ENOSYS)
8267 /* Required function not implemented. */
8270 if (errno == ENOSYS)
8271 /* Function not implemented. */
8274 /* y1 is the Bessel function of the second kind of order 1 */
8277 TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
8278 TEST_f_f (y1, -max_value, minus_infty, INVALID_EXCEPTION);
8279 TEST_f_f (y1, 0.0, minus_infty);
8280 TEST_f_f (y1, plus_infty, 0);
8281 TEST_f_f (y1, nan_value, nan_value);
8283 TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
8284 TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
8285 TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
8286 TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
8287 TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
8288 TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
8289 TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
8291 TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L);
8294 TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L);
8306 FUNC (sincos) (0, &s, &c);
8307 if (errno == ENOSYS)
8308 /* Required function not implemented. */
8311 if (errno == ENOSYS)
8312 /* Function not implemented. */
8315 /* yn is the Bessel function of the second kind of order n */
8318 /* yn (0, x) == y0 (x) */
8319 TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
8320 TEST_ff_f (yn, 0, -max_value, minus_infty, INVALID_EXCEPTION);
8321 TEST_ff_f (yn, 0, 0.0, minus_infty);
8322 TEST_ff_f (yn, 0, nan_value, nan_value);
8323 TEST_ff_f (yn, 0, plus_infty, 0);
8325 TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
8326 TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
8327 TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
8328 TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
8329 TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
8330 TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
8331 TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
8333 /* yn (1, x) == y1 (x) */
8334 TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
8335 TEST_ff_f (yn, 1, 0.0, minus_infty);
8336 TEST_ff_f (yn, 1, plus_infty, 0);
8337 TEST_ff_f (yn, 1, nan_value, nan_value);
8339 TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
8340 TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
8341 TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
8342 TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
8343 TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
8344 TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
8345 TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
8348 TEST_ff_f (yn, 3, plus_infty, 0);
8349 TEST_ff_f (yn, 3, nan_value, nan_value);
8351 TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
8352 TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
8353 TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
8354 TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
8355 TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
8358 TEST_ff_f (yn, 10, plus_infty, 0);
8359 TEST_ff_f (yn, 10, nan_value, nan_value);
8361 TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
8362 TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
8363 TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
8364 TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
8365 TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
8373 significand_test (void)
8375 /* significand returns the mantissa of the exponential representation. */
8376 START (significand);
8378 TEST_f_f (significand, 4.0, 1.0);
8379 TEST_f_f (significand, 6.0, 1.5);
8380 TEST_f_f (significand, 8.0, 1.0);
8389 fpstack_test ("start *init*");
8391 nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
8393 minus_zero = FUNC(copysign) (0.0, -1.0);
8394 plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
8395 HUGE_VALL, HUGE_VAL, HUGE_VALF);
8396 minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
8397 -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
8398 max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
8399 LDBL_MAX, DBL_MAX, FLT_MAX);
8400 min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
8401 LDBL_MIN, DBL_MIN, FLT_MIN);
8407 (void) &minus_infty;
8411 /* Clear all exceptions. From now on we must not get random exceptions. */
8412 feclearexcept (FE_ALL_EXCEPT);
8414 /* Test to make sure we start correctly. */
8415 fpstack_test ("end *init*");
8418 /* Definitions of arguments for argp functions. */
8419 static const struct argp_option options[] =
8421 { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
8422 { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
8423 { "no-max-error", 'f', NULL, 0,
8424 "Don't output maximal errors of functions"},
8425 { "no-points", 'p', NULL, 0,
8426 "Don't output results of functions invocations"},
8427 { "ignore-max-ulp", 'i', "yes/no", 0,
8428 "Ignore given maximal errors"},
8429 { NULL, 0, NULL, 0, NULL }
8432 /* Short description of program. */
8433 static const char doc[] = "Math test suite: " TEST_MSG ;
8435 /* Prototype for option handler. */
8436 static error_t parse_opt (int key, char *arg, struct argp_state *state);
8438 /* Data structure to communicate with argp functions. */
8439 static struct argp argp =
8441 options, parse_opt, NULL, doc,
8445 /* Handle program arguments. */
8447 parse_opt (int key, char *arg, struct argp_state *state)
8452 output_max_error = 0;
8455 if (strcmp (arg, "yes") == 0)
8457 else if (strcmp (arg, "no") == 0)
8468 verbose = (unsigned int) strtoul (optarg, NULL, 0);
8473 return ARGP_ERR_UNKNOWN;
8479 /* function to check our ulp calculation. */
8486 /* This gives one ulp. */
8487 u = FUNC(nextafter) (10, 20);
8488 check_equal (10.0, u, 1, &diff, &ulp);
8489 printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
8491 /* This gives one more ulp. */
8492 u = FUNC(nextafter) (u, 20);
8493 check_equal (10.0, u, 2, &diff, &ulp);
8494 printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
8496 /* And now calculate 100 ulp. */
8497 for (i = 2; i < 100; i++)
8498 u = FUNC(nextafter) (u, 20);
8499 check_equal (10.0, u, 100, &diff, &ulp);
8500 printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
8505 main (int argc, char **argv)
8512 output_max_error = 1;
8514 /* XXX set to 0 for releases. */
8517 /* Parse and process arguments. */
8518 argp_parse (&argp, argc, argv, 0, &remaining, NULL);
8520 if (remaining != argc)
8522 fprintf (stderr, "wrong number of arguments");
8523 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
8524 exit (EXIT_FAILURE);
8529 ulps_file = fopen ("ULPs", "a");
8530 if (ulps_file == NULL)
8532 perror ("can't open file `ULPs' for writing: ");
8545 /* Keep the tests a wee bit ordered (according to ISO C99). */
8546 /* Classification macros: */
8552 /* Trigonometric functions: */
8554 acos_test_tonearest ();
8555 acos_test_towardzero ();
8556 acos_test_downward ();
8557 acos_test_upward ();
8559 asin_test_tonearest ();
8560 asin_test_towardzero ();
8561 asin_test_downward ();
8562 asin_test_upward ();
8566 cos_test_tonearest ();
8567 cos_test_towardzero ();
8568 cos_test_downward ();
8571 sin_test_tonearest ();
8572 sin_test_towardzero ();
8573 sin_test_downward ();
8577 tan_test_tonearest ();
8578 tan_test_towardzero ();
8579 tan_test_downward ();
8582 /* Hyperbolic functions: */
8587 cosh_test_tonearest ();
8588 cosh_test_towardzero ();
8589 cosh_test_downward ();
8590 cosh_test_upward ();
8592 sinh_test_tonearest ();
8593 sinh_test_towardzero ();
8594 sinh_test_downward ();
8595 sinh_test_upward ();
8598 /* Exponential and logarithmic functions: */
8600 exp_test_tonearest ();
8601 exp_test_towardzero ();
8602 exp_test_downward ();
8614 logb_test_downward ();
8620 significand_test ();
8622 /* Power and absolute value functions: */
8627 pow_test_tonearest ();
8628 pow_test_towardzero ();
8629 pow_test_downward ();
8633 /* Error and gamma functions: */
8640 /* Nearest integer functions: */
8645 rint_test_tonearest ();
8646 rint_test_towardzero ();
8647 rint_test_downward ();
8648 rint_test_upward ();
8650 lrint_test_tonearest ();
8651 lrint_test_towardzero ();
8652 lrint_test_downward ();
8653 lrint_test_upward ();
8655 llrint_test_tonearest ();
8656 llrint_test_towardzero ();
8657 llrint_test_downward ();
8658 llrint_test_upward ();
8664 /* Remainder functions: */
8669 /* Manipulation functions: */
8674 /* maximum, minimum and positive difference functions */
8679 /* Multiply and add: */
8682 /* Complex functions: */
8707 /* Bessel functions: */
8718 printf ("\nTest suite completed:\n");
8719 printf (" %d test cases plus %d tests for exception flags executed.\n",
8720 noTests, noExcTests);
8722 printf (" %d expected failures occurred.\n", noXFails);
8724 printf (" %d unexpected passes occurred.\n", noXPasses);
8727 printf (" %d errors occurred.\n", noErrors);
8730 printf (" All tests passed successfully.\n");