Back to index

glibc  2.9
libm-test.inc
Go to the documentation of this file.
00001 /* Copyright (C) 1997-2006, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Andreas Jaeger <aj@suse.de>, 1997.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* Part of testsuite for libm.
00021 
00022    This file is processed by a perl script.  The resulting file has to
00023    be included by a master file that defines:
00024 
00025    Macros:
00026    FUNC(function): converts general function name (like cos) to
00027    name with correct suffix (e.g. cosl or cosf)
00028    MATHCONST(x):   like FUNC but for constants (e.g convert 0.0 to 0.0L)
00029    FLOAT:        floating point type to test
00030    - TEST_MSG:          informal message to be displayed
00031    CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
00032    chooses one of the parameters as delta for testing
00033    equality
00034    PRINTF_EXPR          Floating point conversion specification to print a variable
00035    of type FLOAT with printf.  PRINTF_EXPR just contains
00036    the specifier, not the percent and width arguments,
00037    e.g. "f".
00038    PRINTF_XEXPR         Like PRINTF_EXPR, but print in hexadecimal format.
00039    PRINTF_NEXPR Like PRINTF_EXPR, but print nice.  */
00040 
00041 /* This testsuite has currently tests for:
00042    acos, acosh, asin, asinh, atan, atan2, atanh,
00043    cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
00044    fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
00045    frexp, gamma, hypot,
00046    ilogb, isfinite, isinf, isnan, isnormal,
00047    isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
00048    j0, j1, jn,
00049    ldexp, lgamma, log, log10, log1p, log2, logb,
00050    modf, nearbyint, nextafter,
00051    pow, remainder, remquo, rint, lrint, llrint,
00052    round, lround, llround,
00053    scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
00054    y0, y1, yn, significand
00055 
00056    and for the following complex math functions:
00057    cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
00058    ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
00059 
00060    At the moment the following functions aren't tested:
00061    drem, nan
00062 
00063    Parameter handling is primitive in the moment:
00064    --verbose=[0..3] for different levels of output:
00065    0: only error count
00066    1: basic report on failed tests (default)
00067    2: full report on all tests
00068    -v for full output (equals --verbose=3)
00069    -u for generation of an ULPs file
00070  */
00071 
00072 /* "Philosophy":
00073 
00074    This suite tests some aspects of the correct implementation of
00075    mathematical functions in libm.  Some simple, specific parameters
00076    are tested for correctness but there's no exhaustive
00077    testing.  Handling of specific inputs (e.g. infinity, not-a-number)
00078    is also tested.  Correct handling of exceptions is checked
00079    against.  These implemented tests should check all cases that are
00080    specified in ISO C99.
00081 
00082    Exception testing: At the moment only divide-by-zero and invalid
00083    exceptions are tested.  Overflow/underflow and inexact exceptions
00084    aren't checked at the moment.
00085 
00086    NaN values: There exist signalling and quiet NaNs.  This implementation
00087    only uses quiet NaN as parameter but does not differenciate
00088    between the two kinds of NaNs as result.
00089 
00090    Inline functions: Inlining functions should give an improvement in
00091    speed - but not in precission.  The inlined functions return
00092    reasonable values for a reasonable range of input values.  The
00093    result is not necessarily correct for all values and exceptions are
00094    not correctly raised in all cases.  Problematic input and return
00095    values are infinity, not-a-number and minus zero.  This suite
00096    therefore does not check these specific inputs and the exception
00097    handling for inlined mathematical functions - just the "reasonable"
00098    values are checked.
00099 
00100    Beware: The tests might fail for any of the following reasons:
00101    - Tests are wrong
00102    - Functions are wrong
00103    - Floating Point Unit not working properly
00104    - Compiler has errors
00105 
00106    With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
00107 
00108 
00109    To Do: All parameter should be numbers that can be represented as
00110    exact floating point values.  Currently some values cannot be
00111    represented exactly and therefore the result is not the expected
00112    result.  For this we will use 36 digits so that numbers can be
00113    represented exactly.  */
00114 
00115 #ifndef _GNU_SOURCE
00116 # define _GNU_SOURCE
00117 #endif
00118 
00119 #include "libm-test-ulps.h"
00120 #include <complex.h>
00121 #include <math.h>
00122 #include <float.h>
00123 #include <fenv.h>
00124 #include <limits.h>
00125 
00126 #include <errno.h>
00127 #include <stdlib.h>
00128 #include <stdio.h>
00129 #include <string.h>
00130 #include <argp.h>
00131 
00132 /* Possible exceptions */
00133 #define NO_EXCEPTION               0x0
00134 #define INVALID_EXCEPTION          0x1
00135 #define DIVIDE_BY_ZERO_EXCEPTION   0x2
00136 /* The next flags signals that those exceptions are allowed but not required.   */
00137 #define INVALID_EXCEPTION_OK              0x4
00138 #define DIVIDE_BY_ZERO_EXCEPTION_OK       0x8
00139 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
00140 /* Some special test flags, passed togther with exceptions.  */
00141 #define IGNORE_ZERO_INF_SIGN              0x10
00142 
00143 /* Various constants (we must supply them precalculated for accuracy).  */
00144 #define M_PI_6l                    .52359877559829887307710723054658383L
00145 #define M_E2l               7.389056098930650227230427460575008L
00146 #define M_E3l               20.085536923187667740928529654581719L
00147 #define M_2_SQRT_PIl        3.5449077018110320545963349666822903L     /* 2 sqrt (M_PIl)  */
00148 #define M_SQRT_PIl          1.7724538509055160272981674833411451L     /* sqrt (M_PIl)  */
00149 #define M_LOG_SQRT_PIl             0.57236494292470008707171367567652933L    /* log(sqrt(M_PIl))  */
00150 #define M_LOG_2_SQRT_PIl    1.265512123484645396488945797134706L      /* log(2*sqrt(M_PIl))  */
00151 #define M_PI_34l            (M_PIl - M_PI_4l)           /* 3*pi/4 */
00152 #define M_PI_34_LOG10El            (M_PIl - M_PI_4l) * M_LOG10El
00153 #define M_PI2_LOG10El              M_PI_2l * M_LOG10El
00154 #define M_PI4_LOG10El              M_PI_4l * M_LOG10El
00155 #define M_PI_LOG10El        M_PIl * M_LOG10El
00156 #define M_SQRT_2_2          0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
00157 
00158 static FILE *ulps_file;     /* File to document difference.  */
00159 static int output_ulps;     /* Should ulps printed?  */
00160 
00161 static int noErrors; /* number of errors */
00162 static int noTests;  /* number of tests (without testing exceptions) */
00163 static int noExcTests;      /* number of tests for exception flags */
00164 static int noXFails; /* number of expected failures.  */
00165 static int noXPasses;       /* number of unexpected passes.  */
00166 
00167 static int verbose;
00168 static int output_max_error;       /* Should the maximal errors printed?  */
00169 static int output_points;   /* Should the single function results printed?  */
00170 static int ignore_max_ulp;  /* Should we ignore max_ulp?  */
00171 
00172 static FLOAT minus_zero, plus_zero;
00173 static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
00174 
00175 static FLOAT max_error, real_max_error, imag_max_error;
00176 
00177 
00178 #define BUILD_COMPLEX(real, imag) \
00179   ({ __complex__ FLOAT __retval;                                     \
00180      __real__ __retval = (real);                                     \
00181      __imag__ __retval = (imag);                                     \
00182      __retval; })
00183 
00184 #define BUILD_COMPLEX_INT(real, imag) \
00185   ({ __complex__ int __retval;                                              \
00186      __real__ __retval = (real);                                     \
00187      __imag__ __retval = (imag);                                     \
00188      __retval; })
00189 
00190 
00191 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
00192                          (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
00193 
00194 static void
00195 init_max_error (void)
00196 {
00197   max_error = 0;
00198   real_max_error = 0;
00199   imag_max_error = 0;
00200   feclearexcept (FE_ALL_EXCEPT);
00201 }
00202 
00203 static void
00204 set_max_error (FLOAT current, FLOAT *curr_max_error)
00205 {
00206   if (current > *curr_max_error)
00207     *curr_max_error = current;
00208 }
00209 
00210 
00211 /* Should the message print to screen?  This depends on the verbose flag,
00212    and the test status.  */
00213 static int
00214 print_screen (int ok, int xfail)
00215 {
00216   if (output_points
00217       && (verbose > 1
00218          || (verbose == 1 && ok == xfail)))
00219     return 1;
00220   return 0;
00221 }
00222 
00223 
00224 /* Should the message print to screen?  This depends on the verbose flag,
00225    and the test status.  */
00226 static int
00227 print_screen_max_error (int ok, int xfail)
00228 {
00229   if (output_max_error
00230       && (verbose > 1
00231          || ((verbose == 1) && (ok == xfail))))
00232     return 1;
00233   return 0;
00234 }
00235 
00236 /* Update statistic counters.  */
00237 static void
00238 update_stats (int ok, int xfail)
00239 {
00240   ++noTests;
00241   if (ok && xfail)
00242     ++noXPasses;
00243   else if (!ok && xfail)
00244     ++noXFails;
00245   else if (!ok && !xfail)
00246     ++noErrors;
00247 }
00248 
00249 static void
00250 print_ulps (const char *test_name, FLOAT ulp)
00251 {
00252   if (output_ulps)
00253     {
00254       fprintf (ulps_file, "Test \"%s\":\n", test_name);
00255       fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
00256               CHOOSE("ldouble", "double", "float",
00257                     "ildouble", "idouble", "ifloat"),
00258               FUNC(ceil) (ulp));
00259     }
00260 }
00261 
00262 static void
00263 print_function_ulps (const char *function_name, FLOAT ulp)
00264 {
00265   if (output_ulps)
00266     {
00267       fprintf (ulps_file, "Function: \"%s\":\n", function_name);
00268       fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
00269               CHOOSE("ldouble", "double", "float",
00270                     "ildouble", "idouble", "ifloat"),
00271               FUNC(ceil) (ulp));
00272     }
00273 }
00274 
00275 
00276 static void
00277 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
00278                           FLOAT imag_ulp)
00279 {
00280   if (output_ulps)
00281     {
00282       if (real_ulp != 0.0)
00283        {
00284          fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
00285          fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
00286                  CHOOSE("ldouble", "double", "float",
00287                        "ildouble", "idouble", "ifloat"),
00288                  FUNC(ceil) (real_ulp));
00289        }
00290       if (imag_ulp != 0.0)
00291        {
00292          fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
00293          fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
00294                  CHOOSE("ldouble", "double", "float",
00295                        "ildouble", "idouble", "ifloat"),
00296                  FUNC(ceil) (imag_ulp));
00297        }
00298 
00299 
00300     }
00301 }
00302 
00303 
00304 
00305 /* Test if Floating-Point stack hasn't changed */
00306 static void
00307 fpstack_test (const char *test_name)
00308 {
00309 #ifdef i386
00310   static int old_stack;
00311   int sw;
00312 
00313   asm ("fnstsw" : "=a" (sw));
00314   sw >>= 11;
00315   sw &= 7;
00316 
00317   if (sw != old_stack)
00318     {
00319       printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
00320              test_name, sw, old_stack);
00321       ++noErrors;
00322       old_stack = sw;
00323     }
00324 #endif
00325 }
00326 
00327 
00328 static void
00329 print_max_error (const char *func_name, FLOAT allowed, int xfail)
00330 {
00331   int ok = 0;
00332 
00333   if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
00334     {
00335       ok = 1;
00336     }
00337 
00338   if (!ok)
00339     print_function_ulps (func_name, max_error);
00340 
00341 
00342   if (print_screen_max_error (ok, xfail))
00343     {
00344       printf ("Maximal error of `%s'\n", func_name);
00345       printf (" is      : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
00346       printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
00347     }
00348 
00349   update_stats (ok, xfail);
00350 }
00351 
00352 
00353 static void
00354 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
00355                       __complex__ int xfail)
00356 {
00357   int ok = 0;
00358 
00359   if ((real_max_error == 0 && imag_max_error == 0)
00360       || (real_max_error <= __real__ allowed
00361          && imag_max_error <= __imag__ allowed
00362          && !ignore_max_ulp))
00363     {
00364       ok = 1;
00365     }
00366 
00367   if (!ok)
00368     print_complex_function_ulps (func_name, real_max_error, imag_max_error);
00369 
00370 
00371   if (print_screen_max_error (ok, xfail))
00372     {
00373       printf ("Maximal error of real part of: %s\n", func_name);
00374       printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
00375              FUNC(ceil) (real_max_error));
00376       printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
00377              FUNC(ceil) (__real__ allowed));
00378       printf ("Maximal error of imaginary part of: %s\n", func_name);
00379       printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
00380              FUNC(ceil) (imag_max_error));
00381       printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
00382              FUNC(ceil) (__imag__ allowed));
00383     }
00384 
00385   update_stats (ok, xfail);
00386 }
00387 
00388 
00389 /* Test whether a given exception was raised.  */
00390 static void
00391 test_single_exception (const char *test_name,
00392                      int exception,
00393                      int exc_flag,
00394                      int fe_flag,
00395                      const char *flag_name)
00396 {
00397 #ifndef TEST_INLINE
00398   int ok = 1;
00399   if (exception & exc_flag)
00400     {
00401       if (fetestexcept (fe_flag))
00402        {
00403          if (print_screen (1, 0))
00404            printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
00405        }
00406       else
00407        {
00408          ok = 0;
00409          if (print_screen (0, 0))
00410            printf ("Failure: %s: Exception \"%s\" not set\n",
00411                   test_name, flag_name);
00412        }
00413     }
00414   else
00415     {
00416       if (fetestexcept (fe_flag))
00417        {
00418          ok = 0;
00419          if (print_screen (0, 0))
00420            printf ("Failure: %s: Exception \"%s\" set\n",
00421                   test_name, flag_name);
00422        }
00423       else
00424        {
00425          if (print_screen (1, 0))
00426            printf ("%s: Exception \"%s\" not set\n", test_name,
00427                   flag_name);
00428        }
00429     }
00430   if (!ok)
00431     ++noErrors;
00432 
00433 #endif
00434 }
00435 
00436 
00437 /* Test whether exceptions given by EXCEPTION are raised.  Ignore thereby
00438    allowed but not required exceptions.
00439 */
00440 static void
00441 test_exceptions (const char *test_name, int exception)
00442 {
00443   ++noExcTests;
00444 #ifdef FE_DIVBYZERO
00445   if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
00446     test_single_exception (test_name, exception,
00447                         DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
00448                         "Divide by zero");
00449 #endif
00450 #ifdef FE_INVALID
00451   if ((exception & INVALID_EXCEPTION_OK) == 0)
00452     test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
00453                       "Invalid operation");
00454 #endif
00455   feclearexcept (FE_ALL_EXCEPT);
00456 }
00457 
00458 
00459 static void
00460 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
00461                     FLOAT max_ulp, int xfail, int exceptions,
00462                     FLOAT *curr_max_error)
00463 {
00464   int ok = 0;
00465   int print_diff = 0;
00466   FLOAT diff = 0;
00467   FLOAT ulp = 0;
00468 
00469   test_exceptions (test_name, exceptions);
00470   if (isnan (computed) && isnan (expected))
00471     ok = 1;
00472   else if (isinf (computed) && isinf (expected))
00473     {
00474       /* Test for sign of infinities.  */
00475       if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
00476          && signbit (computed) != signbit (expected))
00477        {
00478          ok = 0;
00479          printf ("infinity has wrong sign.\n");
00480        }
00481       else
00482        ok = 1;
00483     }
00484   /* Don't calc ulp for NaNs or infinities.  */
00485   else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
00486     ok = 0;
00487   else
00488     {
00489       diff = FUNC(fabs) (computed - expected);
00490       switch (fpclassify (expected))
00491        {
00492        case FP_ZERO:
00493          /* ilogb (0) isn't allowed. */
00494          ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
00495          break;
00496        case FP_NORMAL:
00497          ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
00498          break;
00499        case FP_SUBNORMAL:
00500          ulp = (FUNC(ldexp) (diff, MANT_DIG)
00501                / FUNC(ldexp) (1.0, FUNC(ilogb) (expected)));
00502          break;
00503        default:
00504          /* It should never happen. */
00505          abort ();
00506          break;
00507        }
00508       set_max_error (ulp, curr_max_error);
00509       print_diff = 1;
00510       if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
00511          && computed == 0.0 && expected == 0.0
00512          && signbit(computed) != signbit (expected))
00513        ok = 0;
00514       else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
00515        ok = 1;
00516       else
00517        {
00518          ok = 0;
00519          print_ulps (test_name, ulp);
00520        }
00521 
00522     }
00523   if (print_screen (ok, xfail))
00524     {
00525       if (!ok)
00526        printf ("Failure: ");
00527       printf ("Test: %s\n", test_name);
00528       printf ("Result:\n");
00529       printf (" is:         % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
00530              computed, computed);
00531       printf (" should be:  % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
00532              expected, expected);
00533       if (print_diff)
00534        {
00535          printf (" difference: % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR
00536                 "\n", diff, diff);
00537          printf (" ulp       : % .4" PRINTF_NEXPR "\n", ulp);
00538          printf (" max.ulp   : % .4" PRINTF_NEXPR "\n", max_ulp);
00539        }
00540     }
00541   update_stats (ok, xfail);
00542 
00543   fpstack_test (test_name);
00544 }
00545 
00546 
00547 static void
00548 check_float (const char *test_name, FLOAT computed, FLOAT expected,
00549             FLOAT max_ulp, int xfail, int exceptions)
00550 {
00551   check_float_internal (test_name, computed, expected, max_ulp, xfail,
00552                      exceptions, &max_error);
00553 }
00554 
00555 
00556 static void
00557 check_complex (const char *test_name, __complex__ FLOAT computed,
00558               __complex__ FLOAT expected,
00559               __complex__ FLOAT max_ulp, __complex__ int xfail,
00560               int exception)
00561 {
00562   FLOAT part_comp, part_exp, part_max_ulp;
00563   int part_xfail;
00564   char str[200];
00565 
00566   sprintf (str, "Real part of: %s", test_name);
00567   part_comp = __real__ computed;
00568   part_exp = __real__ expected;
00569   part_max_ulp = __real__ max_ulp;
00570   part_xfail = __real__ xfail;
00571 
00572   check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
00573                      exception, &real_max_error);
00574 
00575   sprintf (str, "Imaginary part of: %s", test_name);
00576   part_comp = __imag__ computed;
00577   part_exp = __imag__ expected;
00578   part_max_ulp = __imag__ max_ulp;
00579   part_xfail = __imag__ xfail;
00580 
00581   /* Don't check again for exceptions, just pass through the
00582      zero/inf sign test.  */
00583   check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
00584                      exception & IGNORE_ZERO_INF_SIGN,
00585                      &imag_max_error);
00586 }
00587 
00588 
00589 /* Check that computed and expected values are equal (int values).  */
00590 static void
00591 check_int (const char *test_name, int computed, int expected, int max_ulp,
00592           int xfail, int exceptions)
00593 {
00594   int diff = computed - expected;
00595   int ok = 0;
00596 
00597   test_exceptions (test_name, exceptions);
00598   noTests++;
00599   if (abs (diff) <= max_ulp)
00600     ok = 1;
00601 
00602   if (!ok)
00603     print_ulps (test_name, diff);
00604 
00605   if (print_screen (ok, xfail))
00606     {
00607       if (!ok)
00608        printf ("Failure: ");
00609       printf ("Test: %s\n", test_name);
00610       printf ("Result:\n");
00611       printf (" is:         %d\n", computed);
00612       printf (" should be:  %d\n", expected);
00613     }
00614 
00615   update_stats (ok, xfail);
00616   fpstack_test (test_name);
00617 }
00618 
00619 
00620 /* Check that computed and expected values are equal (long int values).  */
00621 static void
00622 check_long (const char *test_name, long int computed, long int expected,
00623            long int max_ulp, int xfail, int exceptions)
00624 {
00625   long int diff = computed - expected;
00626   int ok = 0;
00627 
00628   test_exceptions (test_name, exceptions);
00629   noTests++;
00630   if (labs (diff) <= max_ulp)
00631     ok = 1;
00632 
00633   if (!ok)
00634     print_ulps (test_name, diff);
00635 
00636   if (print_screen (ok, xfail))
00637     {
00638       if (!ok)
00639        printf ("Failure: ");
00640       printf ("Test: %s\n", test_name);
00641       printf ("Result:\n");
00642       printf (" is:         %ld\n", computed);
00643       printf (" should be:  %ld\n", expected);
00644     }
00645 
00646   update_stats (ok, xfail);
00647   fpstack_test (test_name);
00648 }
00649 
00650 
00651 /* Check that computed value is true/false.  */
00652 static void
00653 check_bool (const char *test_name, int computed, int expected,
00654            long int max_ulp, int xfail, int exceptions)
00655 {
00656   int ok = 0;
00657 
00658   test_exceptions (test_name, exceptions);
00659   noTests++;
00660   if ((computed == 0) == (expected == 0))
00661     ok = 1;
00662 
00663   if (print_screen (ok, xfail))
00664     {
00665       if (!ok)
00666        printf ("Failure: ");
00667       printf ("Test: %s\n", test_name);
00668       printf ("Result:\n");
00669       printf (" is:         %d\n", computed);
00670       printf (" should be:  %d\n", expected);
00671     }
00672 
00673   update_stats (ok, xfail);
00674   fpstack_test (test_name);
00675 }
00676 
00677 
00678 /* check that computed and expected values are equal (long int values) */
00679 static void
00680 check_longlong (const char *test_name, long long int computed,
00681               long long int expected,
00682               long long int max_ulp, int xfail,
00683               int exceptions)
00684 {
00685   long long int diff = computed - expected;
00686   int ok = 0;
00687 
00688   test_exceptions (test_name, exceptions);
00689   noTests++;
00690   if (llabs (diff) <= max_ulp)
00691     ok = 1;
00692 
00693   if (!ok)
00694     print_ulps (test_name, diff);
00695 
00696   if (print_screen (ok, xfail))
00697     {
00698       if (!ok)
00699        printf ("Failure:");
00700       printf ("Test: %s\n", test_name);
00701       printf ("Result:\n");
00702       printf (" is:         %lld\n", computed);
00703       printf (" should be:  %lld\n", expected);
00704     }
00705 
00706   update_stats (ok, xfail);
00707   fpstack_test (test_name);
00708 }
00709 
00710 
00711 
00712 /* This is to prevent messages from the SVID libm emulation.  */
00713 int
00714 matherr (struct exception *x __attribute__ ((unused)))
00715 {
00716   return 1;
00717 }
00718 
00719 
00720 /****************************************************************************
00721   Tests for single functions of libm.
00722   Please keep them alphabetically sorted!
00723 ****************************************************************************/
00724 
00725 static void
00726 acos_test (void)
00727 {
00728   errno = 0;
00729   FUNC(acos) (0);
00730   if (errno == ENOSYS)
00731     /* Function not implemented.  */
00732     return;
00733 
00734   START (acos);
00735 
00736   TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
00737   TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
00738   TEST_f_f (acos, nan_value, nan_value);
00739 
00740   /* |x| > 1: */
00741   TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
00742   TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
00743 
00744   TEST_f_f (acos, 0, M_PI_2l);
00745   TEST_f_f (acos, minus_zero, M_PI_2l);
00746   TEST_f_f (acos, 1, 0);
00747   TEST_f_f (acos, -1, M_PIl);
00748   TEST_f_f (acos, 0.5, M_PI_6l*2.0);
00749   TEST_f_f (acos, -0.5, M_PI_6l*4.0);
00750   TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
00751   TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
00752   TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
00753   END (acos);
00754 }
00755 
00756 static void
00757 acosh_test (void)
00758 {
00759   errno = 0;
00760   FUNC(acosh) (7);
00761   if (errno == ENOSYS)
00762     /* Function not implemented.  */
00763     return;
00764 
00765   START (acosh);
00766 
00767   TEST_f_f (acosh, plus_infty, plus_infty);
00768   TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
00769 
00770   /* x < 1:  */
00771   TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
00772 
00773   TEST_f_f (acosh, 1, 0);
00774   TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
00775 
00776   END (acosh);
00777 }
00778 
00779 static void
00780 asin_test (void)
00781 {
00782   errno = 0;
00783   FUNC(asin) (0);
00784   if (errno == ENOSYS)
00785     /* Function not implemented.  */
00786     return;
00787 
00788   START (asin);
00789 
00790   TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
00791   TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
00792   TEST_f_f (asin, nan_value, nan_value);
00793 
00794   /* asin x == NaN plus invalid exception for |x| > 1.  */
00795   TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
00796   TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
00797 
00798   TEST_f_f (asin, 0, 0);
00799   TEST_f_f (asin, minus_zero, minus_zero);
00800   TEST_f_f (asin, 0.5, M_PI_6l);
00801   TEST_f_f (asin, -0.5, -M_PI_6l);
00802   TEST_f_f (asin, 1.0, M_PI_2l);
00803   TEST_f_f (asin, -1.0, -M_PI_2l);
00804   TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
00805 
00806   END (asin);
00807 }
00808 
00809 static void
00810 asinh_test (void)
00811 {
00812   errno = 0;
00813   FUNC(asinh) (0.7L);
00814   if (errno == ENOSYS)
00815     /* Function not implemented.  */
00816     return;
00817 
00818   START (asinh);
00819 
00820   TEST_f_f (asinh, 0, 0);
00821   TEST_f_f (asinh, minus_zero, minus_zero);
00822 #ifndef TEST_INLINE
00823   TEST_f_f (asinh, plus_infty, plus_infty);
00824   TEST_f_f (asinh, minus_infty, minus_infty);
00825 #endif
00826   TEST_f_f (asinh, nan_value, nan_value);
00827   TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
00828 
00829   END (asinh);
00830 }
00831 
00832 static void
00833 atan_test (void)
00834 {
00835   errno = 0;
00836   FUNC(atan) (0);
00837   if (errno == ENOSYS)
00838     /* Function not implemented.  */
00839     return;
00840 
00841   START (atan);
00842 
00843   TEST_f_f (atan, 0, 0);
00844   TEST_f_f (atan, minus_zero, minus_zero);
00845 
00846   TEST_f_f (atan, plus_infty, M_PI_2l);
00847   TEST_f_f (atan, minus_infty, -M_PI_2l);
00848   TEST_f_f (atan, nan_value, nan_value);
00849 
00850   TEST_f_f (atan, 1, M_PI_4l);
00851   TEST_f_f (atan, -1, -M_PI_4l);
00852 
00853   TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
00854 
00855   END (atan);
00856 }
00857 
00858 
00859 
00860 static void
00861 atanh_test (void)
00862 {
00863   errno = 0;
00864   FUNC(atanh) (0.7L);
00865   if (errno == ENOSYS)
00866     /* Function not implemented.  */
00867     return;
00868 
00869   START (atanh);
00870 
00871 
00872   TEST_f_f (atanh, 0, 0);
00873   TEST_f_f (atanh, minus_zero, minus_zero);
00874 
00875   TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
00876   TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
00877   TEST_f_f (atanh, nan_value, nan_value);
00878 
00879   /* atanh (x) == NaN plus invalid exception if |x| > 1.  */
00880   TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
00881   TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
00882 
00883   TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
00884 
00885   END (atanh);
00886 }
00887 
00888 static void
00889 atan2_test (void)
00890 {
00891   errno = 0;
00892   FUNC(atan2) (-0, 1);
00893   if (errno == ENOSYS)
00894     /* Function not implemented.  */
00895     return;
00896 
00897   START (atan2);
00898 
00899   /* atan2 (0,x) == 0 for x > 0.  */
00900   TEST_ff_f (atan2, 0, 1, 0);
00901 
00902   /* atan2 (-0,x) == -0 for x > 0.  */
00903   TEST_ff_f (atan2, minus_zero, 1, minus_zero);
00904 
00905   TEST_ff_f (atan2, 0, 0, 0);
00906   TEST_ff_f (atan2, minus_zero, 0, minus_zero);
00907 
00908   /* atan2 (+0,x) == +pi for x < 0.  */
00909   TEST_ff_f (atan2, 0, -1, M_PIl);
00910 
00911   /* atan2 (-0,x) == -pi for x < 0.  */
00912   TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
00913 
00914   TEST_ff_f (atan2, 0, minus_zero, M_PIl);
00915   TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
00916 
00917   /* atan2 (y,+0) == pi/2 for y > 0.  */
00918   TEST_ff_f (atan2, 1, 0, M_PI_2l);
00919 
00920   /* atan2 (y,-0) == pi/2 for y > 0.  */
00921   TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
00922 
00923   /* atan2 (y,+0) == -pi/2 for y < 0.  */
00924   TEST_ff_f (atan2, -1, 0, -M_PI_2l);
00925 
00926   /* atan2 (y,-0) == -pi/2 for y < 0.  */
00927   TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
00928 
00929   /* atan2 (y,inf) == +0 for finite y > 0.  */
00930   TEST_ff_f (atan2, 1, plus_infty, 0);
00931 
00932   /* atan2 (y,inf) == -0 for finite y < 0.  */
00933   TEST_ff_f (atan2, -1, plus_infty, minus_zero);
00934 
00935   /* atan2(+inf, x) == pi/2 for finite x.  */
00936   TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
00937 
00938   /* atan2(-inf, x) == -pi/2 for finite x.  */
00939   TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
00940 
00941   /* atan2 (y,-inf) == +pi for finite y > 0.  */
00942   TEST_ff_f (atan2, 1, minus_infty, M_PIl);
00943 
00944   /* atan2 (y,-inf) == -pi for finite y < 0.  */
00945   TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
00946 
00947   TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
00948   TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
00949   TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
00950   TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
00951   TEST_ff_f (atan2, nan_value, nan_value, nan_value);
00952 
00953   TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
00954   TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
00955   TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
00956   TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
00957   TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
00958   TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
00959 
00960   TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
00961 
00962   END (atan2);
00963 }
00964 
00965 static void
00966 cabs_test (void)
00967 {
00968   errno = 0;
00969   FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
00970   if (errno == ENOSYS)
00971     /* Function not implemented.  */
00972     return;
00973 
00974   START (cabs);
00975 
00976   /* cabs (x + iy) is specified as hypot (x,y) */
00977 
00978   /* cabs (+inf + i x) == +inf.  */
00979   TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
00980   /* cabs (-inf + i x) == +inf.  */
00981   TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
00982 
00983   TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
00984   TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
00985 
00986   TEST_c_f (cabs, nan_value, nan_value, nan_value);
00987 
00988   /* cabs (x,y) == cabs (y,x).  */
00989   TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
00990   /* cabs (x,y) == cabs (-x,y).  */
00991   TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
00992   /* cabs (x,y) == cabs (-y,x).  */
00993   TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
00994   /* cabs (x,y) == cabs (-x,-y).  */
00995   TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
00996   /* cabs (x,y) == cabs (-y,-x).  */
00997   TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
00998   /* cabs (x,0) == fabs (x).  */
00999   TEST_c_f (cabs, -0.75L, 0, 0.75L);
01000   TEST_c_f (cabs, 0.75L, 0, 0.75L);
01001   TEST_c_f (cabs, -1.0L, 0, 1.0L);
01002   TEST_c_f (cabs, 1.0L, 0, 1.0L);
01003   TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
01004   TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
01005 
01006   TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
01007 
01008   END (cabs);
01009 }
01010 
01011 
01012 static void
01013 cacos_test (void)
01014 {
01015   errno = 0;
01016   FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
01017   if (errno == ENOSYS)
01018     /* Function not implemented.  */
01019     return;
01020 
01021   START (cacos);
01022 
01023 
01024   TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
01025   TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
01026   TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
01027   TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
01028 
01029   TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
01030   TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
01031 
01032   TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
01033   TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
01034 
01035   TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
01036   TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
01037   TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
01038   TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
01039   TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
01040   TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
01041 
01042   TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
01043   TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
01044   TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
01045   TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
01046 
01047   TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
01048   TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
01049   TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
01050   TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
01051 
01052   TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
01053   TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
01054 
01055   TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
01056   TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
01057 
01058   TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
01059   TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
01060 
01061   TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01062   TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01063 
01064   TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01065   TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01066 
01067   TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
01068 
01069   TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
01070   TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
01071 
01072   END (cacos, complex);
01073 }
01074 
01075 static void
01076 cacosh_test (void)
01077 {
01078   errno = 0;
01079   FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
01080   if (errno == ENOSYS)
01081     /* Function not implemented.  */
01082     return;
01083 
01084   START (cacosh);
01085 
01086 
01087   TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
01088   TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
01089   TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
01090   TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
01091   TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
01092   TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
01093 
01094   TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
01095   TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
01096 
01097   TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
01098   TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
01099   TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
01100   TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
01101   TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
01102   TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
01103 
01104   TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
01105   TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
01106   TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
01107   TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
01108 
01109   TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
01110   TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
01111   TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
01112   TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
01113 
01114   TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
01115   TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
01116 
01117   TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
01118   TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
01119 
01120   TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
01121   TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
01122 
01123   TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01124   TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01125 
01126   TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01127   TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01128 
01129   TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
01130 
01131   TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
01132   TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
01133 
01134   END (cacosh, complex);
01135 }
01136 
01137 
01138 static void
01139 carg_test (void)
01140 {
01141   START (carg);
01142 
01143   /* carg (x + iy) is specified as atan2 (y, x) */
01144 
01145   /* carg (x + i 0) == 0 for x > 0.  */
01146   TEST_c_f (carg, 2.0, 0, 0);
01147   /* carg (x - i 0) == -0 for x > 0.  */
01148   TEST_c_f (carg, 2.0, minus_zero, minus_zero);
01149 
01150   TEST_c_f (carg, 0, 0, 0);
01151   TEST_c_f (carg, 0, minus_zero, minus_zero);
01152 
01153   /* carg (x + i 0) == +pi for x < 0.  */
01154   TEST_c_f (carg, -2.0, 0, M_PIl);
01155 
01156   /* carg (x - i 0) == -pi for x < 0.  */
01157   TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
01158 
01159   TEST_c_f (carg, minus_zero, 0, M_PIl);
01160   TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
01161 
01162   /* carg (+0 + i y) == pi/2 for y > 0.  */
01163   TEST_c_f (carg, 0, 2.0, M_PI_2l);
01164 
01165   /* carg (-0 + i y) == pi/2 for y > 0.  */
01166   TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
01167 
01168   /* carg (+0 + i y) == -pi/2 for y < 0.  */
01169   TEST_c_f (carg, 0, -2.0, -M_PI_2l);
01170 
01171   /* carg (-0 + i y) == -pi/2 for y < 0.  */
01172   TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
01173 
01174   /* carg (inf + i y) == +0 for finite y > 0.  */
01175   TEST_c_f (carg, plus_infty, 2.0, 0);
01176 
01177   /* carg (inf + i y) == -0 for finite y < 0.  */
01178   TEST_c_f (carg, plus_infty, -2.0, minus_zero);
01179 
01180   /* carg(x + i inf) == pi/2 for finite x.  */
01181   TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
01182 
01183   /* carg(x - i inf) == -pi/2 for finite x.  */
01184   TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
01185 
01186   /* carg (-inf + i y) == +pi for finite y > 0.  */
01187   TEST_c_f (carg, minus_infty, 10.0, M_PIl);
01188 
01189   /* carg (-inf + i y) == -pi for finite y < 0.  */
01190   TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
01191 
01192   TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
01193 
01194   TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
01195 
01196   TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
01197 
01198   TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
01199 
01200   TEST_c_f (carg, nan_value, nan_value, nan_value);
01201 
01202   END (carg);
01203 }
01204 
01205 static void
01206 casin_test (void)
01207 {
01208   errno = 0;
01209   FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
01210   if (errno == ENOSYS)
01211     /* Function not implemented.  */
01212     return;
01213 
01214   START (casin);
01215 
01216   TEST_c_c (casin, 0, 0, 0.0, 0.0);
01217   TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
01218   TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
01219   TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
01220 
01221   TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
01222   TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
01223   TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
01224   TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
01225 
01226   TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
01227   TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
01228   TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
01229   TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
01230   TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
01231   TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
01232   TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
01233   TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
01234 
01235   TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
01236   TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
01237   TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
01238   TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
01239 
01240   TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
01241   TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
01242   TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
01243   TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
01244 
01245   TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
01246   TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
01247 
01248   TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
01249   TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
01250 
01251   TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
01252   TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
01253 
01254   TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01255   TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01256 
01257   TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01258   TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01259 
01260   TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
01261 
01262   TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
01263   TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
01264 
01265   END (casin, complex);
01266 }
01267 
01268 
01269 static void
01270 casinh_test (void)
01271 {
01272   errno = 0;
01273   FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
01274   if (errno == ENOSYS)
01275     /* Function not implemented.  */
01276     return;
01277 
01278   START (casinh);
01279 
01280   TEST_c_c (casinh, 0, 0, 0.0, 0.0);
01281   TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
01282   TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
01283   TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
01284 
01285   TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
01286   TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
01287   TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
01288   TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
01289 
01290   TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
01291   TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
01292   TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
01293   TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
01294   TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
01295   TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
01296   TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
01297   TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
01298 
01299   TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
01300   TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
01301   TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
01302   TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
01303 
01304   TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
01305   TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
01306   TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
01307   TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
01308 
01309   TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
01310   TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
01311 
01312   TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
01313   TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
01314 
01315   TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
01316   TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
01317 
01318   TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01319   TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01320 
01321   TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01322   TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01323 
01324   TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
01325 
01326   TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
01327   TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
01328 
01329   END (casinh, complex);
01330 }
01331 
01332 
01333 static void
01334 catan_test (void)
01335 {
01336   errno = 0;
01337   FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
01338   if (errno == ENOSYS)
01339     /* Function not implemented.  */
01340     return;
01341 
01342   START (catan);
01343 
01344   TEST_c_c (catan, 0, 0, 0, 0);
01345   TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
01346   TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
01347   TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
01348 
01349   TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
01350   TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
01351   TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
01352   TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
01353 
01354 
01355   TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
01356   TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
01357   TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
01358   TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
01359   TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
01360   TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
01361   TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
01362   TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
01363 
01364   TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
01365   TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
01366   TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
01367   TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
01368 
01369   TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
01370   TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
01371   TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
01372   TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
01373 
01374   TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
01375   TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
01376 
01377   TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
01378   TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
01379 
01380   TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
01381   TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
01382 
01383   TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
01384   TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
01385 
01386   TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01387   TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01388 
01389   TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01390   TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01391 
01392   TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
01393 
01394   TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
01395   TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
01396 
01397   END (catan, complex);
01398 }
01399 
01400 static void
01401 catanh_test (void)
01402 {
01403   errno = 0;
01404   FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
01405   if (errno == ENOSYS)
01406     /* Function not implemented.  */
01407     return;
01408 
01409   START (catanh);
01410 
01411   TEST_c_c (catanh, 0, 0, 0.0, 0.0);
01412   TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
01413   TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
01414   TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
01415 
01416   TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
01417   TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
01418   TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
01419   TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
01420 
01421   TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
01422   TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
01423   TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
01424   TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
01425   TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
01426   TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
01427   TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
01428   TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
01429 
01430   TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
01431   TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
01432   TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
01433   TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
01434 
01435   TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
01436   TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
01437   TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
01438   TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
01439 
01440   TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
01441   TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
01442 
01443   TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
01444   TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
01445 
01446   TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
01447   TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
01448 
01449   TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
01450   TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
01451 
01452   TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01453   TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01454 
01455   TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01456   TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
01457 
01458   TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
01459 
01460   TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
01461   TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
01462 
01463   END (catanh, complex);
01464 }
01465 
01466 static void
01467 cbrt_test (void)
01468 {
01469   errno = 0;
01470   FUNC(cbrt) (8);
01471   if (errno == ENOSYS)
01472     /* Function not implemented.  */
01473     return;
01474 
01475   START (cbrt);
01476 
01477   TEST_f_f (cbrt, 0.0, 0.0);
01478   TEST_f_f (cbrt, minus_zero, minus_zero);
01479 
01480   TEST_f_f (cbrt, plus_infty, plus_infty);
01481   TEST_f_f (cbrt, minus_infty, minus_infty);
01482   TEST_f_f (cbrt, nan_value, nan_value);
01483 
01484   TEST_f_f (cbrt, -0.001L, -0.1L);
01485   TEST_f_f (cbrt, 8, 2);
01486   TEST_f_f (cbrt, -27.0, -3.0);
01487   TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
01488   TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
01489 
01490   END (cbrt);
01491 }
01492 
01493 
01494 static void
01495 ccos_test (void)
01496 {
01497   errno = 0;
01498   FUNC(ccos) (BUILD_COMPLEX (0, 0));
01499   if (errno == ENOSYS)
01500     /* Function not implemented.  */
01501     return;
01502 
01503   START (ccos);
01504 
01505   TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
01506   TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
01507   TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
01508   TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
01509 
01510   TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01511   TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01512   TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01513   TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01514 
01515   TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
01516   TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
01517   TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
01518   TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
01519 
01520   TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01521   TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01522   TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01523   TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01524 
01525   TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
01526   TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
01527   TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
01528   TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
01529 
01530   TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
01531   TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
01532   TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
01533   TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
01534 
01535   TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01536   TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01537 
01538   TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
01539   TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
01540 
01541   TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01542   TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01543 
01544   TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01545   TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01546 
01547   TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01548   TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01549 
01550   TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01551   TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01552 
01553   TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
01554 
01555   TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
01556   TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
01557 
01558   END (ccos, complex);
01559 }
01560 
01561 
01562 static void
01563 ccosh_test (void)
01564 {
01565   errno = 0;
01566   FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
01567   if (errno == ENOSYS)
01568     /* Function not implemented.  */
01569     return;
01570 
01571   START (ccosh);
01572 
01573   TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
01574   TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
01575   TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
01576   TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
01577 
01578   TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01579   TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01580   TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01581   TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01582 
01583   TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
01584   TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
01585   TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
01586   TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
01587 
01588   TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01589   TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01590   TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01591   TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
01592 
01593   TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
01594   TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
01595   TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
01596   TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
01597 
01598   TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01599   TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01600   TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01601   TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01602 
01603   TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01604   TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01605 
01606   TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
01607   TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
01608 
01609   TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01610   TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01611 
01612   TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01613   TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
01614 
01615   TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01616   TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01617 
01618   TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
01619   TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
01620 
01621   TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
01622 
01623   TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
01624 
01625   TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
01626 
01627   END (ccosh, complex);
01628 }
01629 
01630 
01631 static void
01632 ceil_test (void)
01633 {
01634   START (ceil);
01635 
01636   TEST_f_f (ceil, 0.0, 0.0);
01637   TEST_f_f (ceil, minus_zero, minus_zero);
01638   TEST_f_f (ceil, plus_infty, plus_infty);
01639   TEST_f_f (ceil, minus_infty, minus_infty);
01640   TEST_f_f (ceil, nan_value, nan_value);
01641 
01642   TEST_f_f (ceil, M_PIl, 4.0);
01643   TEST_f_f (ceil, -M_PIl, -3.0);
01644   TEST_f_f (ceil, 0.1, 1.0);
01645   TEST_f_f (ceil, 0.25, 1.0);
01646   TEST_f_f (ceil, 0.625, 1.0);
01647   TEST_f_f (ceil, -0.1, minus_zero);
01648   TEST_f_f (ceil, -0.25, minus_zero);
01649   TEST_f_f (ceil, -0.625, minus_zero);
01650 
01651 #ifdef TEST_LDOUBLE
01652   /* The result can only be represented in long double.  */
01653   TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
01654   TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
01655   TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
01656   TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
01657   TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
01658 
01659   TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
01660   TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
01661   TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
01662   TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
01663   TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
01664 
01665 # if LDBL_MANT_DIG > 100
01666   TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L);
01667   TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L);
01668   TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L);
01669   TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L);
01670   TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L);
01671   TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L);
01672 # endif
01673 
01674   TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
01675   TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
01676   TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
01677   TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
01678   TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
01679 
01680   TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
01681   TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
01682   TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
01683   TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
01684   TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
01685 
01686 # if LDBL_MANT_DIG > 100
01687   TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L);
01688   TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L);
01689   TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L);
01690   TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L);
01691   TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L);
01692   TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L);
01693 
01694   TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L);
01695   TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L);
01696   TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L);
01697   TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L);
01698   TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L);
01699   TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L);
01700 # endif
01701 
01702   TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
01703   TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
01704   TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
01705   TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
01706   TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
01707 
01708   TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
01709   TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
01710   TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
01711   TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
01712   TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
01713 
01714   TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
01715   TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
01716   TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
01717   TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
01718   TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
01719 #endif
01720 
01721   END (ceil);
01722 }
01723 
01724 
01725 static void
01726 cexp_test (void)
01727 {
01728   errno = 0;
01729   FUNC(cexp) (BUILD_COMPLEX (0, 0));
01730   if (errno == ENOSYS)
01731     /* Function not implemented.  */
01732     return;
01733 
01734   START (cexp);
01735 
01736   TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
01737   TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
01738   TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
01739   TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
01740 
01741   TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
01742   TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
01743 
01744   TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
01745   TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
01746 
01747   TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01748   TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01749 
01750   TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01751   TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01752 
01753   TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01754   TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01755 
01756   TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01757   TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
01758 
01759   TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
01760   TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
01761   TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
01762   TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
01763 
01764   TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01765   TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
01766 
01767   TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
01768   TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
01769 
01770   TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
01771 
01772   TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
01773 
01774   TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01775   TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01776 
01777   TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
01778   TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01779   TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01780   TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
01781 
01782   TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
01783   TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
01784 
01785   END (cexp, complex);
01786 }
01787 
01788 
01789 static void
01790 cimag_test (void)
01791 {
01792   START (cimag);
01793   TEST_c_f (cimag, 1.0, 0.0, 0.0);
01794   TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
01795   TEST_c_f (cimag, 1.0, nan_value, nan_value);
01796   TEST_c_f (cimag, nan_value, nan_value, nan_value);
01797   TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
01798   TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
01799   TEST_c_f (cimag, 2.0, 3.0, 3.0);
01800 
01801   END (cimag);
01802 }
01803 
01804 static void
01805 clog_test (void)
01806 {
01807   errno = 0;
01808   FUNC(clog) (BUILD_COMPLEX (-2, -3));
01809   if (errno == ENOSYS)
01810     /* Function not implemented.  */
01811     return;
01812 
01813   START (clog);
01814 
01815   TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
01816   TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
01817 
01818   TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
01819   TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
01820 
01821   TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
01822   TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
01823 
01824   TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
01825   TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
01826 
01827   TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
01828   TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
01829   TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
01830   TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
01831   TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
01832   TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
01833   TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
01834   TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
01835 
01836   TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
01837   TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
01838   TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
01839   TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
01840 
01841   TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
01842   TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
01843   TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
01844   TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
01845 
01846   TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
01847   TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
01848 
01849   TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
01850   TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
01851 
01852   TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01853   TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01854   TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01855   TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01856 
01857   TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01858   TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01859   TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
01860   TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01861 
01862   TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
01863 
01864   TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
01865   TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
01866 
01867   END (clog, complex);
01868 }
01869 
01870 
01871 static void
01872 clog10_test (void)
01873 {
01874   errno = 0;
01875   FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
01876   if (errno == ENOSYS)
01877     /* Function not implemented.  */
01878     return;
01879 
01880   START (clog10);
01881 
01882   TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
01883   TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
01884 
01885   TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
01886   TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
01887 
01888   TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
01889 
01890   TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
01891   TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
01892 
01893   TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
01894   TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
01895   TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
01896   TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
01897   TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
01898   TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
01899   TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
01900   TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
01901 
01902   TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
01903   TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
01904   TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
01905   TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
01906 
01907   TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
01908   TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
01909   TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
01910   TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
01911 
01912   TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
01913   TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
01914 
01915   TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
01916   TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
01917 
01918   TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01919   TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01920   TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01921   TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
01922 
01923   TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
01924   TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01925   TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
01926   TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
01927 
01928   TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
01929 
01930   TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
01931   TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
01932 
01933   END (clog10, complex);
01934 }
01935 
01936 
01937 static void
01938 conj_test (void)
01939 {
01940   START (conj);
01941   TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
01942   TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
01943   TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
01944   TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
01945   TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
01946   TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
01947   TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
01948 
01949   END (conj, complex);
01950 }
01951 
01952 
01953 static void
01954 copysign_test (void)
01955 {
01956   START (copysign);
01957 
01958   TEST_ff_f (copysign, 0, 4, 0);
01959   TEST_ff_f (copysign, 0, -4, minus_zero);
01960   TEST_ff_f (copysign, minus_zero, 4, 0);
01961   TEST_ff_f (copysign, minus_zero, -4, minus_zero);
01962 
01963   TEST_ff_f (copysign, plus_infty, 0, plus_infty);
01964   TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
01965   TEST_ff_f (copysign, minus_infty, 0, plus_infty);
01966   TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
01967 
01968   TEST_ff_f (copysign, 0, plus_infty, 0);
01969   TEST_ff_f (copysign, 0, minus_zero, minus_zero);
01970   TEST_ff_f (copysign, minus_zero, plus_infty, 0);
01971   TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
01972 
01973   /* XXX More correctly we would have to check the sign of the NaN.  */
01974   TEST_ff_f (copysign, nan_value, 0, nan_value);
01975   TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
01976   TEST_ff_f (copysign, -nan_value, 0, nan_value);
01977   TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
01978 
01979   END (copysign);
01980 }
01981 
01982 
01983 static void
01984 cos_test (void)
01985 {
01986   errno = 0;
01987   FUNC(cos) (0);
01988   if (errno == ENOSYS)
01989     /* Function not implemented.  */
01990     return;
01991 
01992   START (cos);
01993 
01994   TEST_f_f (cos, 0, 1);
01995   TEST_f_f (cos, minus_zero, 1);
01996   TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
01997   TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
01998   TEST_f_f (cos, nan_value, nan_value);
01999 
02000   TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
02001   TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
02002   TEST_f_f (cos, M_PI_2l, 0);
02003 
02004   TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
02005 
02006 #ifdef TEST_DOUBLE
02007   TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
02008 #endif
02009 
02010   END (cos);
02011 }
02012 
02013 
02014 static void
02015 cosh_test (void)
02016 {
02017   errno = 0;
02018   FUNC(cosh) (0.7L);
02019   if (errno == ENOSYS)
02020     /* Function not implemented.  */
02021     return;
02022 
02023   START (cosh);
02024   TEST_f_f (cosh, 0, 1);
02025   TEST_f_f (cosh, minus_zero, 1);
02026 
02027 #ifndef TEST_INLINE
02028   TEST_f_f (cosh, plus_infty, plus_infty);
02029   TEST_f_f (cosh, minus_infty, plus_infty);
02030 #endif
02031   TEST_f_f (cosh, nan_value, nan_value);
02032 
02033   TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
02034 
02035   END (cosh);
02036 }
02037 
02038 
02039 static void
02040 cpow_test (void)
02041 {
02042   errno = 0;
02043   FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
02044   if (errno == ENOSYS)
02045     /* Function not implemented.  */
02046     return;
02047 
02048   START (cpow);
02049 
02050   TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
02051   TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
02052 
02053   TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
02054   TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
02055 
02056   TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
02057 
02058   TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
02059   TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
02060   TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
02061   TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
02062 
02063   END (cpow, complex);
02064 }
02065 
02066 
02067 static void
02068 cproj_test (void)
02069 {
02070   START (cproj);
02071   TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
02072   TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
02073   TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
02074   TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
02075 
02076   TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
02077 
02078   TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
02079   TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
02080   TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
02081   TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
02082 
02083   TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
02084   TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
02085 
02086   END (cproj, complex);
02087 }
02088 
02089 
02090 static void
02091 creal_test (void)
02092 {
02093   START (creal);
02094   TEST_c_f (creal, 0.0, 1.0, 0.0);
02095   TEST_c_f (creal, minus_zero, 1.0, minus_zero);
02096   TEST_c_f (creal, nan_value, 1.0, nan_value);
02097   TEST_c_f (creal, nan_value, nan_value, nan_value);
02098   TEST_c_f (creal, plus_infty, 1.0, plus_infty);
02099   TEST_c_f (creal, minus_infty, 1.0, minus_infty);
02100   TEST_c_f (creal, 2.0, 3.0, 2.0);
02101 
02102   END (creal);
02103 }
02104 
02105 static void
02106 csin_test (void)
02107 {
02108   errno = 0;
02109   FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
02110   if (errno == ENOSYS)
02111     /* Function not implemented.  */
02112     return;
02113 
02114   START (csin);
02115 
02116   TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
02117   TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
02118   TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
02119   TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
02120 
02121   TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
02122   TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
02123   TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
02124   TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
02125 
02126   TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02127   TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02128   TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02129   TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02130 
02131   TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02132   TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02133   TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02134   TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02135 
02136   TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
02137   TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
02138   TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
02139   TEST_c_c (csin, minus_infty, -6.75,  nan_value, nan_value, INVALID_EXCEPTION);
02140 
02141   TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
02142   TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
02143   TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
02144   TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
02145 
02146   TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
02147   TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
02148 
02149   TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
02150   TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
02151 
02152   TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02153   TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02154 
02155   TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
02156   TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
02157 
02158   TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02159   TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02160 
02161   TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02162   TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02163 
02164   TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
02165 
02166   TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
02167   TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
02168 
02169   END (csin, complex);
02170 }
02171 
02172 
02173 static void
02174 csinh_test (void)
02175 {
02176   errno = 0;
02177   FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
02178   if (errno == ENOSYS)
02179     /* Function not implemented.  */
02180     return;
02181 
02182   START (csinh);
02183 
02184   TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
02185   TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
02186   TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
02187   TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
02188 
02189   TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02190   TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02191   TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02192   TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02193 
02194   TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
02195   TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
02196   TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
02197   TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
02198 
02199   TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02200   TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02201   TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02202   TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
02203 
02204   TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
02205   TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
02206   TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
02207   TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
02208 
02209   TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02210   TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02211   TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02212   TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02213 
02214   TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
02215   TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
02216 
02217   TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
02218   TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
02219 
02220   TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02221   TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02222 
02223   TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
02224   TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
02225 
02226   TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02227   TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02228 
02229   TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
02230   TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
02231 
02232   TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
02233 
02234   TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
02235   TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
02236 
02237   END (csinh, complex);
02238 }
02239 
02240 
02241 static void
02242 csqrt_test (void)
02243 {
02244   errno = 0;
02245   FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
02246   if (errno == ENOSYS)
02247     /* Function not implemented.  */
02248     return;
02249 
02250   START (csqrt);
02251 
02252   TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
02253   TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
02254   TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
02255   TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
02256 
02257   TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
02258   TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
02259   TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
02260   TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
02261 
02262   TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
02263   TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
02264   TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
02265   TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
02266 
02267   TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
02268   TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
02269   TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
02270   TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
02271   TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
02272   TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
02273   TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
02274   TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
02275   TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
02276   TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
02277   TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
02278   TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
02279 
02280   TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
02281 
02282   TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
02283 
02284   TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02285   TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02286   TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02287   TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02288 
02289   TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02290   TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
02291   TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
02292   TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
02293 
02294   TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
02295 
02296   TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
02297   TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
02298   TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
02299   TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
02300   TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
02301   TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
02302   TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
02303   /* Principal square root should be returned (i.e., non-negative real
02304      part).  */
02305   TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
02306 
02307   END (csqrt, complex);
02308 }
02309 
02310 static void
02311 ctan_test (void)
02312 {
02313   errno = 0;
02314   FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
02315   if (errno == ENOSYS)
02316     /* Function not implemented.  */
02317     return;
02318 
02319   START (ctan);
02320 
02321   TEST_c_c (ctan, 0, 0, 0.0, 0.0);
02322   TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
02323   TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
02324   TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
02325 
02326   TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
02327   TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
02328   TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
02329   TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
02330 
02331   TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
02332   TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
02333   TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
02334   TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
02335 
02336   TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
02337   TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
02338   TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
02339   TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
02340   TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
02341   TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
02342   TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
02343   TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
02344 
02345   TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
02346   TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
02347 
02348   TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
02349   TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
02350 
02351   TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02352   TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02353 
02354   TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02355   TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
02356   TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
02357   TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
02358 
02359   TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
02360 
02361   TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
02362   TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
02363 
02364   END (ctan, complex);
02365 }
02366 
02367 
02368 static void
02369 ctanh_test (void)
02370 {
02371   errno = 0;
02372   FUNC(ctanh) (BUILD_COMPLEX (0, 0));
02373   if (errno == ENOSYS)
02374     /* Function not implemented.  */
02375     return;
02376 
02377   START (ctanh);
02378 
02379   TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
02380   TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
02381   TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
02382   TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
02383 
02384   TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
02385   TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
02386   TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
02387   TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
02388   TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
02389   TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
02390   TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
02391   TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
02392 
02393   TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02394   TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02395   TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02396   TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02397   TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02398   TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02399   TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02400   TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
02401 
02402   TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
02403   TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
02404 
02405   TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
02406   TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
02407 
02408   TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
02409   TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
02410 
02411   TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02412   TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02413   TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02414   TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
02415 
02416   TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
02417 
02418   TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
02419 
02420   TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
02421   TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
02422 
02423   END (ctanh, complex);
02424 }
02425 
02426 
02427 static void
02428 erf_test (void)
02429 {
02430   errno = 0;
02431   FUNC(erf) (0);
02432   if (errno == ENOSYS)
02433     /* Function not implemented.  */
02434     return;
02435 
02436   START (erf);
02437 
02438   TEST_f_f (erf, 0, 0);
02439   TEST_f_f (erf, minus_zero, minus_zero);
02440   TEST_f_f (erf, plus_infty, 1);
02441   TEST_f_f (erf, minus_infty, -1);
02442   TEST_f_f (erf, nan_value, nan_value);
02443 
02444   TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
02445   TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
02446   TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
02447   TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
02448   TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
02449   TEST_f_f (erf, 27.0L, 1.0L);
02450 
02451   END (erf);
02452 }
02453 
02454 
02455 static void
02456 erfc_test (void)
02457 {
02458   errno = 0;
02459   FUNC(erfc) (0);
02460   if (errno == ENOSYS)
02461     /* Function not implemented.  */
02462     return;
02463 
02464   START (erfc);
02465 
02466   TEST_f_f (erfc, plus_infty, 0.0);
02467   TEST_f_f (erfc, minus_infty, 2.0);
02468   TEST_f_f (erfc, 0.0, 1.0);
02469   TEST_f_f (erfc, minus_zero, 1.0);
02470   TEST_f_f (erfc, nan_value, nan_value);
02471 
02472   TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
02473   TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
02474   TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
02475   TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
02476   TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
02477 #ifdef TEST_LDOUBLE
02478   /* The result can only be represented in long double.  */
02479 # if LDBL_MIN_10_EXP < -319
02480   TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
02481 # endif
02482 #endif
02483 
02484   END (erfc);
02485 }
02486 
02487 
02488 static void
02489 exp_test (void)
02490 {
02491   errno = 0;
02492   FUNC(exp) (0);
02493   if (errno == ENOSYS)
02494     /* Function not implemented.  */
02495     return;
02496 
02497   START (exp);
02498 
02499   TEST_f_f (exp, 0, 1);
02500   TEST_f_f (exp, minus_zero, 1);
02501 
02502 #ifndef TEST_INLINE
02503   TEST_f_f (exp, plus_infty, plus_infty);
02504   TEST_f_f (exp, minus_infty, 0);
02505 #endif
02506   TEST_f_f (exp, nan_value, nan_value);
02507   TEST_f_f (exp, 1, M_El);
02508 
02509   TEST_f_f (exp, 2, M_E2l);
02510   TEST_f_f (exp, 3, M_E3l);
02511   TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
02512   TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
02513   TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L);
02514 #if defined TEST_LDOUBLE && __LDBL_MAX_EXP__ > 1024
02515   /* The result can only be represented in sane long double.  */
02516   TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
02517 #endif
02518 
02519   END (exp);
02520 }
02521 
02522 
02523 static void
02524 exp10_test (void)
02525 {
02526   errno = 0;
02527   FUNC(exp10) (0);
02528   if (errno == ENOSYS)
02529     /* Function not implemented.  */
02530     return;
02531 
02532   START (exp10);
02533 
02534   TEST_f_f (exp10, 0, 1);
02535   TEST_f_f (exp10, minus_zero, 1);
02536 
02537   TEST_f_f (exp10, plus_infty, plus_infty);
02538   TEST_f_f (exp10, minus_infty, 0);
02539   TEST_f_f (exp10, nan_value, nan_value);
02540   TEST_f_f (exp10, 3, 1000);
02541   TEST_f_f (exp10, -1, 0.1L);
02542   TEST_f_f (exp10, 1e6, plus_infty);
02543   TEST_f_f (exp10, -1e6, 0);
02544   TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
02545 
02546   END (exp10);
02547 }
02548 
02549 
02550 static void
02551 exp2_test (void)
02552 {
02553   errno = 0;
02554   FUNC(exp2) (0);
02555   if (errno == ENOSYS)
02556     /* Function not implemented.  */
02557     return;
02558 
02559   START (exp2);
02560 
02561   TEST_f_f (exp2, 0, 1);
02562   TEST_f_f (exp2, minus_zero, 1);
02563   TEST_f_f (exp2, plus_infty, plus_infty);
02564   TEST_f_f (exp2, minus_infty, 0);
02565   TEST_f_f (exp2, nan_value, nan_value);
02566 
02567   TEST_f_f (exp2, 10, 1024);
02568   TEST_f_f (exp2, -1, 0.5);
02569   TEST_f_f (exp2, 1e6, plus_infty);
02570   TEST_f_f (exp2, -1e6, 0);
02571   TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
02572 
02573   END (exp2);
02574 }
02575 
02576 
02577 static void
02578 expm1_test (void)
02579 {
02580   errno = 0;
02581   FUNC(expm1) (0);
02582   if (errno == ENOSYS)
02583     /* Function not implemented.  */
02584     return;
02585 
02586   START (expm1);
02587 
02588   TEST_f_f (expm1, 0, 0);
02589   TEST_f_f (expm1, minus_zero, minus_zero);
02590 
02591 #ifndef TEST_INLINE
02592   TEST_f_f (expm1, plus_infty, plus_infty);
02593   TEST_f_f (expm1, minus_infty, -1);
02594 #endif
02595   TEST_f_f (expm1, nan_value, nan_value);
02596 
02597   TEST_f_f (expm1, 1, M_El - 1.0);
02598   TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
02599 
02600   END (expm1);
02601 }
02602 
02603 
02604 static void
02605 fabs_test (void)
02606 {
02607   START (fabs);
02608 
02609   TEST_f_f (fabs, 0, 0);
02610   TEST_f_f (fabs, minus_zero, 0);
02611 
02612   TEST_f_f (fabs, plus_infty, plus_infty);
02613   TEST_f_f (fabs, minus_infty, plus_infty);
02614   TEST_f_f (fabs, nan_value, nan_value);
02615 
02616   TEST_f_f (fabs, 38.0, 38.0);
02617   TEST_f_f (fabs, -M_El, M_El);
02618 
02619   END (fabs);
02620 }
02621 
02622 
02623 static void
02624 fdim_test (void)
02625 {
02626   START (fdim);
02627 
02628   TEST_ff_f (fdim, 0, 0, 0);
02629   TEST_ff_f (fdim, 9, 0, 9);
02630   TEST_ff_f (fdim, 0, 9, 0);
02631   TEST_ff_f (fdim, -9, 0, 0);
02632   TEST_ff_f (fdim, 0, -9, 9);
02633 
02634   TEST_ff_f (fdim, plus_infty, 9, plus_infty);
02635   TEST_ff_f (fdim, plus_infty, -9, plus_infty);
02636   TEST_ff_f (fdim, minus_infty, 9, 0);
02637   TEST_ff_f (fdim, minus_infty, -9, 0);
02638   TEST_ff_f (fdim, 9, minus_infty, plus_infty);
02639   TEST_ff_f (fdim, -9, minus_infty, plus_infty);
02640   TEST_ff_f (fdim, 9, plus_infty, 0);
02641   TEST_ff_f (fdim, -9, plus_infty, 0);
02642 
02643   TEST_ff_f (fdim, 0, nan_value, nan_value);
02644   TEST_ff_f (fdim, 9, nan_value, nan_value);
02645   TEST_ff_f (fdim, -9, nan_value, nan_value);
02646   TEST_ff_f (fdim, nan_value, 9, nan_value);
02647   TEST_ff_f (fdim, nan_value, -9, nan_value);
02648   TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
02649   TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
02650   TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
02651   TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
02652   TEST_ff_f (fdim, nan_value, nan_value, nan_value);
02653 
02654   TEST_ff_f (fdim, plus_infty, plus_infty, 0);
02655 
02656   END (fdim);
02657 }
02658 
02659 
02660 static void
02661 floor_test (void)
02662 {
02663   START (floor);
02664 
02665   TEST_f_f (floor, 0.0, 0.0);
02666   TEST_f_f (floor, minus_zero, minus_zero);
02667   TEST_f_f (floor, plus_infty, plus_infty);
02668   TEST_f_f (floor, minus_infty, minus_infty);
02669   TEST_f_f (floor, nan_value, nan_value);
02670 
02671   TEST_f_f (floor, M_PIl, 3.0);
02672   TEST_f_f (floor, -M_PIl, -4.0);
02673 
02674   TEST_f_f (floor, 0.1, 0.0);
02675   TEST_f_f (floor, 0.25, 0.0);
02676   TEST_f_f (floor, 0.625, 0.0);
02677   TEST_f_f (floor, -0.1, -1.0);
02678   TEST_f_f (floor, -0.25, -1.0);
02679   TEST_f_f (floor, -0.625, -1.0);
02680 
02681 #ifdef TEST_LDOUBLE
02682   /* The result can only be represented in long double.  */
02683   TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
02684   TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
02685   TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
02686   TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
02687   TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
02688 # if LDBL_MANT_DIG > 100
02689   TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L);
02690   TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L);
02691   TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L);
02692 # endif
02693 
02694   TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
02695   TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
02696   TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
02697   TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
02698   TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
02699 # if LDBL_MANT_DIG > 100
02700   TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L);
02701   TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L);
02702   TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L);
02703 # endif
02704 
02705   TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
02706   TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
02707   TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
02708   TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
02709   TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
02710 
02711 # if LDBL_MANT_DIG > 100
02712   TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L);
02713   TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L);
02714   TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L);
02715   TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L);
02716   TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L);
02717   TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L);
02718 # endif
02719 
02720   TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
02721   TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
02722   TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
02723   TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
02724   TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
02725 
02726 # if LDBL_MANT_DIG > 100
02727   TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L);
02728   TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L);
02729   TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L);
02730   TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L);
02731   TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L);
02732   TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L);
02733 # endif
02734 
02735   TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
02736   TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
02737   TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
02738   TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
02739   TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
02740 
02741   TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
02742   TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
02743   TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
02744   TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
02745   TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
02746 
02747   TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
02748   TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
02749   TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
02750   TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
02751   TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
02752 #endif
02753 
02754   END (floor);
02755 }
02756 
02757 
02758 static void
02759 fma_test (void)
02760 {
02761   START (fma);
02762 
02763   TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
02764   TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
02765   TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
02766   TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02767   TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02768   TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
02769   TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
02770   TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
02771   TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
02772   TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
02773   TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
02774   TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
02775 
02776   TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
02777   TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
02778   TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
02779   TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
02780 
02781   TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
02782 
02783   END (fma);
02784 }
02785 
02786 
02787 static void
02788 fmax_test (void)
02789 {
02790   START (fmax);
02791 
02792   TEST_ff_f (fmax, 0, 0, 0);
02793   TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
02794   TEST_ff_f (fmax, 9, 0, 9);
02795   TEST_ff_f (fmax, 0, 9, 9);
02796   TEST_ff_f (fmax, -9, 0, 0);
02797   TEST_ff_f (fmax, 0, -9, 0);
02798 
02799   TEST_ff_f (fmax, plus_infty, 9, plus_infty);
02800   TEST_ff_f (fmax, 0, plus_infty, plus_infty);
02801   TEST_ff_f (fmax, -9, plus_infty, plus_infty);
02802   TEST_ff_f (fmax, plus_infty, -9, plus_infty);
02803 
02804   TEST_ff_f (fmax, minus_infty, 9, 9);
02805   TEST_ff_f (fmax, minus_infty, -9, -9);
02806   TEST_ff_f (fmax, 9, minus_infty, 9);
02807   TEST_ff_f (fmax, -9, minus_infty, -9);
02808 
02809   TEST_ff_f (fmax, 0, nan_value, 0);
02810   TEST_ff_f (fmax, 9, nan_value, 9);
02811   TEST_ff_f (fmax, -9, nan_value, -9);
02812   TEST_ff_f (fmax, nan_value, 0, 0);
02813   TEST_ff_f (fmax, nan_value, 9, 9);
02814   TEST_ff_f (fmax, nan_value, -9, -9);
02815   TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
02816   TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
02817   TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
02818   TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
02819   TEST_ff_f (fmax, nan_value, nan_value, nan_value);
02820 
02821   END (fmax);
02822 }
02823 
02824 
02825 static void
02826 fmin_test (void)
02827 {
02828   START (fmin);
02829 
02830   TEST_ff_f (fmin, 0, 0, 0);
02831   TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
02832   TEST_ff_f (fmin, 9, 0, 0);
02833   TEST_ff_f (fmin, 0, 9, 0);
02834   TEST_ff_f (fmin, -9, 0, -9);
02835   TEST_ff_f (fmin, 0, -9, -9);
02836 
02837   TEST_ff_f (fmin, plus_infty, 9, 9);
02838   TEST_ff_f (fmin, 9, plus_infty, 9);
02839   TEST_ff_f (fmin, plus_infty, -9, -9);
02840   TEST_ff_f (fmin, -9, plus_infty, -9);
02841   TEST_ff_f (fmin, minus_infty, 9, minus_infty);
02842   TEST_ff_f (fmin, minus_infty, -9, minus_infty);
02843   TEST_ff_f (fmin, 9, minus_infty, minus_infty);
02844   TEST_ff_f (fmin, -9, minus_infty, minus_infty);
02845 
02846   TEST_ff_f (fmin, 0, nan_value, 0);
02847   TEST_ff_f (fmin, 9, nan_value, 9);
02848   TEST_ff_f (fmin, -9, nan_value, -9);
02849   TEST_ff_f (fmin, nan_value, 0, 0);
02850   TEST_ff_f (fmin, nan_value, 9, 9);
02851   TEST_ff_f (fmin, nan_value, -9, -9);
02852   TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
02853   TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
02854   TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
02855   TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
02856   TEST_ff_f (fmin, nan_value, nan_value, nan_value);
02857 
02858   END (fmin);
02859 }
02860 
02861 
02862 static void
02863 fmod_test (void)
02864 {
02865   errno = 0;
02866   FUNC(fmod) (6.5, 2.3L);
02867   if (errno == ENOSYS)
02868     /* Function not implemented.  */
02869     return;
02870 
02871   START (fmod);
02872 
02873   /* fmod (+0, y) == +0 for y != 0.  */
02874   TEST_ff_f (fmod, 0, 3, 0);
02875 
02876   /* fmod (-0, y) == -0 for y != 0.  */
02877   TEST_ff_f (fmod, minus_zero, 3, minus_zero);
02878 
02879   /* fmod (+inf, y) == NaN plus invalid exception.  */
02880   TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
02881   /* fmod (-inf, y) == NaN plus invalid exception.  */
02882   TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
02883   /* fmod (x, +0) == NaN plus invalid exception.  */
02884   TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
02885   /* fmod (x, -0) == NaN plus invalid exception.  */
02886   TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
02887 
02888   /* fmod (x, +inf) == x for x not infinite.  */
02889   TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
02890   /* fmod (x, -inf) == x for x not infinite.  */
02891   TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
02892 
02893   TEST_ff_f (fmod, nan_value, nan_value, nan_value);
02894 
02895   TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
02896   TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
02897   TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
02898   TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
02899 
02900   END (fmod);
02901 }
02902 
02903 
02904 static void
02905 fpclassify_test (void)
02906 {
02907   START (fpclassify);
02908 
02909   TEST_f_i (fpclassify, nan_value, FP_NAN);
02910   TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
02911   TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
02912   TEST_f_i (fpclassify, plus_zero, FP_ZERO);
02913   TEST_f_i (fpclassify, minus_zero, FP_ZERO);
02914   TEST_f_i (fpclassify, 1000, FP_NORMAL);
02915 
02916   END (fpclassify);
02917 }
02918 
02919 
02920 static void
02921 frexp_test (void)
02922 {
02923   int x;
02924 
02925   START (frexp);
02926 
02927   TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
02928   TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
02929   TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
02930 
02931   TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
02932   TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
02933 
02934   TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
02935   TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
02936 
02937   END (frexp);
02938 }
02939 
02940 
02941 static void
02942 gamma_test (void)
02943 {
02944   errno = 0;
02945   FUNC(gamma) (1);
02946 
02947   if (errno == ENOSYS)
02948     /* Function not implemented.  */
02949     return;
02950   feclearexcept (FE_ALL_EXCEPT);
02951 
02952   START (gamma);
02953 
02954   TEST_f_f (gamma, plus_infty, plus_infty);
02955   TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
02956   TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
02957   TEST_f_f (gamma, minus_infty, plus_infty);
02958   TEST_f_f (gamma, nan_value, nan_value);
02959 
02960   TEST_f_f1 (gamma, 1, 0, 1);
02961   TEST_f_f1 (gamma, 3, M_LN2l, 1);
02962 
02963   TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
02964   TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
02965 
02966   END (gamma);
02967 }
02968 
02969 static void
02970 hypot_test (void)
02971 {
02972   errno = 0;
02973   FUNC(hypot) (0.7L, 12.4L);
02974   if (errno == ENOSYS)
02975     /* Function not implemented.  */
02976     return;
02977 
02978   START (hypot);
02979 
02980   TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
02981   TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
02982 
02983 #ifndef TEST_INLINE
02984   TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
02985   TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
02986   TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
02987   TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
02988 #endif
02989 
02990   TEST_ff_f (hypot, nan_value, nan_value, nan_value);
02991 
02992   /* hypot (x,y) == hypot (+-x, +-y)  */
02993   TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
02994   TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
02995   TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
02996   TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
02997   TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
02998   TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
02999   TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
03000   TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
03001 
03002   /*  hypot (x,0) == fabs (x)  */
03003   TEST_ff_f (hypot, 0.75L, 0, 0.75L);
03004   TEST_ff_f (hypot, -0.75L, 0, 0.75L);
03005   TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
03006 
03007   TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
03008 
03009   END (hypot);
03010 }
03011 
03012 
03013 static void
03014 ilogb_test (void)
03015 {
03016   START (ilogb);
03017 
03018   TEST_f_i (ilogb, 1, 0);
03019   TEST_f_i (ilogb, M_El, 1);
03020   TEST_f_i (ilogb, 1024, 10);
03021   TEST_f_i (ilogb, -2000, 10);
03022 
03023   /* XXX We have a problem here: the standard does not tell us whether
03024      exceptions are allowed/required.  ignore them for now.  */
03025 
03026   TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
03027   TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
03028   TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
03029   TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
03030 
03031   END (ilogb);
03032 }
03033 
03034 static void
03035 isfinite_test (void)
03036 {
03037   START (isfinite);
03038 
03039   TEST_f_b (isfinite, 0, 1);
03040   TEST_f_b (isfinite, minus_zero, 1);
03041   TEST_f_b (isfinite, 10, 1);
03042   TEST_f_b (isfinite, plus_infty, 0);
03043   TEST_f_b (isfinite, minus_infty, 0);
03044   TEST_f_b (isfinite, nan_value, 0);
03045 
03046   END (isfinite);
03047 }
03048 
03049 static void
03050 isnormal_test (void)
03051 {
03052   START (isnormal);
03053 
03054   TEST_f_b (isnormal, 0, 0);
03055   TEST_f_b (isnormal, minus_zero, 0);
03056   TEST_f_b (isnormal, 10, 1);
03057   TEST_f_b (isnormal, plus_infty, 0);
03058   TEST_f_b (isnormal, minus_infty, 0);
03059   TEST_f_b (isnormal, nan_value, 0);
03060 
03061   END (isnormal);
03062 }
03063 
03064 static void
03065 j0_test (void)
03066 {
03067   FLOAT s, c;
03068   errno = 0;
03069   FUNC (sincos) (0, &s, &c);
03070   if (errno == ENOSYS)
03071     /* Required function not implemented.  */
03072     return;
03073   FUNC(j0) (0);
03074   if (errno == ENOSYS)
03075     /* Function not implemented.  */
03076     return;
03077 
03078   START (j0);
03079 
03080   /* j0 is the Bessel function of the first kind of order 0 */
03081   TEST_f_f (j0, nan_value, nan_value);
03082   TEST_f_f (j0, plus_infty, 0);
03083   TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
03084   TEST_f_f (j0, 0.0, 1.0);
03085   TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
03086   TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
03087   TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
03088   TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
03089   TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
03090   TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
03091   TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
03092   TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
03093   TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
03094 
03095   END (j0);
03096 }
03097 
03098 
03099 static void
03100 j1_test (void)
03101 {
03102   FLOAT s, c;
03103   errno = 0;
03104   FUNC (sincos) (0, &s, &c);
03105   if (errno == ENOSYS)
03106     /* Required function not implemented.  */
03107     return;
03108   FUNC(j1) (0);
03109   if (errno == ENOSYS)
03110     /* Function not implemented.  */
03111     return;
03112 
03113   /* j1 is the Bessel function of the first kind of order 1 */
03114 
03115   START (j1);
03116 
03117   TEST_f_f (j1, nan_value, nan_value);
03118   TEST_f_f (j1, plus_infty, 0);
03119 
03120   TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
03121   TEST_f_f (j1, 0.0, 0.0);
03122   TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
03123   TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
03124   TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
03125   TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
03126   TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
03127   TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
03128   TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
03129 
03130   END (j1);
03131 }
03132 
03133 static void
03134 jn_test (void)
03135 {
03136   FLOAT s, c;
03137   errno = 0;
03138   FUNC (sincos) (0, &s, &c);
03139   if (errno == ENOSYS)
03140     /* Required function not implemented.  */
03141     return;
03142   FUNC(jn) (1, 1);
03143   if (errno == ENOSYS)
03144     /* Function not implemented.  */
03145     return;
03146 
03147   /* jn is the Bessel function of the first kind of order n.  */
03148   START (jn);
03149 
03150   /* jn (0, x) == j0 (x)  */
03151   TEST_ff_f (jn, 0, nan_value, nan_value);
03152   TEST_ff_f (jn, 0, plus_infty, 0);
03153   TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
03154   TEST_ff_f (jn, 0, 0.0, 1.0);
03155   TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
03156   TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
03157   TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
03158   TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
03159   TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
03160   TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
03161   TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
03162   TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
03163   TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
03164 
03165   /* jn (1, x) == j1 (x)  */
03166   TEST_ff_f (jn, 1, nan_value, nan_value);
03167   TEST_ff_f (jn, 1, plus_infty, 0);
03168   TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
03169   TEST_ff_f (jn, 1, 0.0, 0.0);
03170   TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
03171   TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
03172   TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
03173   TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
03174   TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
03175   TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
03176   TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
03177 
03178   /* jn (3, x)  */
03179   TEST_ff_f (jn, 3, nan_value, nan_value);
03180   TEST_ff_f (jn, 3, plus_infty, 0);
03181 
03182   TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
03183   TEST_ff_f (jn, 3, 0.0, 0.0);
03184   TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
03185   TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
03186   TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
03187   TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
03188   TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
03189 
03190   /*  jn (10, x)  */
03191   TEST_ff_f (jn, 10, nan_value, nan_value);
03192   TEST_ff_f (jn, 10, plus_infty, 0);
03193 
03194   TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
03195   TEST_ff_f (jn, 10, 0.0, 0.0);
03196   TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
03197   TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
03198   TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
03199   TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
03200   TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
03201 
03202   END (jn);
03203 }
03204 
03205 
03206 static void
03207 ldexp_test (void)
03208 {
03209   TEST_ff_f (ldexp, 0, 0, 0);
03210   TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
03211 
03212   TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
03213   TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
03214   TEST_ff_f (ldexp, nan_value, 1, nan_value);
03215 
03216   TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
03217   TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
03218 
03219   /* ldexp (x, 0) == x.  */
03220   TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
03221 }
03222 
03223 
03224 static void
03225 lgamma_test (void)
03226 {
03227   errno = 0;
03228   FUNC(lgamma) (0);
03229   if (errno == ENOSYS)
03230     /* Function not implemented.  */
03231     return;
03232   feclearexcept (FE_ALL_EXCEPT);
03233 
03234   START (lgamma);
03235 
03236   TEST_f_f (lgamma, plus_infty, plus_infty);
03237   TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
03238   check_int ("signgam for lgamma(0) == 1", signgam, 1, 0, 0, 0);
03239   TEST_f_f (lgamma, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
03240   check_int ("signgam for lgamma(-0) == -1", signgam, -1, 0, 0, 0);
03241   TEST_f_f (lgamma, nan_value, nan_value);
03242 
03243   /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0.  */
03244   TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
03245   TEST_f_f (lgamma, minus_infty, plus_infty);
03246 
03247   TEST_f_f1 (lgamma, 1, 0, 1);
03248 
03249   TEST_f_f1 (lgamma, 3, M_LN2l, 1);
03250 
03251   TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
03252   TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
03253   TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
03254   TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
03255 
03256   END (lgamma);
03257 }
03258 
03259 
03260 static void
03261 lrint_test (void)
03262 {
03263   /* XXX this test is incomplete.  We need to have a way to specifiy
03264      the rounding method and test the critical cases.  So far, only
03265      unproblematic numbers are tested.  */
03266 
03267   START (lrint);
03268 
03269   TEST_f_l (lrint, 0.0, 0);
03270   TEST_f_l (lrint, minus_zero, 0);
03271   TEST_f_l (lrint, 0.2L, 0);
03272   TEST_f_l (lrint, -0.2L, 0);
03273 
03274   TEST_f_l (lrint, 1.4L, 1);
03275   TEST_f_l (lrint, -1.4L, -1);
03276 
03277   TEST_f_l (lrint, 8388600.3L, 8388600);
03278   TEST_f_l (lrint, -8388600.3L, -8388600);
03279 
03280   TEST_f_l (lrint, 1071930.0008, 1071930);
03281 #ifndef TEST_FLOAT
03282   TEST_f_l (lrint, 1073741824.01, 1073741824);
03283 # if LONG_MAX > 281474976710656
03284   TEST_f_l (lrint, 281474976710656.025, 281474976710656);
03285 # endif
03286 #endif
03287 
03288   END (lrint);
03289 }
03290 
03291 
03292 static void
03293 lrint_test_tonearest (void)
03294 {
03295   int save_round_mode;
03296   START (lrint_tonearest);
03297 
03298   save_round_mode = fegetround ();
03299 
03300   if (!fesetround (FE_TONEAREST))
03301     {
03302       TEST_f_l (lrint, 0.0, 0);
03303       TEST_f_l (lrint, minus_zero, 0);
03304       TEST_f_l (lrint, 0.2L, 0);
03305       TEST_f_l (lrint, -0.2L, 0);
03306       TEST_f_l (lrint, 0.5L, 0);
03307       TEST_f_l (lrint, -0.5L, 0);
03308       TEST_f_l (lrint, 0.8L, 1);
03309       TEST_f_l (lrint, -0.8L, -1);
03310 
03311       TEST_f_l (lrint, 1.4L, 1);
03312       TEST_f_l (lrint, -1.4L, -1);
03313 
03314       TEST_f_l (lrint, 8388600.3L, 8388600);
03315       TEST_f_l (lrint, -8388600.3L, -8388600);
03316 
03317       TEST_f_l (lrint, 1071930.0008, 1071930);
03318 #ifndef TEST_FLOAT
03319       TEST_f_l (lrint, 1073741824.01, 1073741824);
03320 # if LONG_MAX > 281474976710656
03321       TEST_f_l (lrint, 281474976710656.025, 281474976710656);
03322 # endif
03323 #endif
03324     }
03325 
03326   fesetround (save_round_mode);
03327 
03328   END (lrint_tonearest);
03329 }
03330 
03331 
03332 static void
03333 lrint_test_towardzero (void)
03334 {
03335   int save_round_mode;
03336   START (lrint_towardzero);
03337 
03338   save_round_mode = fegetround ();
03339 
03340   if (!fesetround (FE_TOWARDZERO))
03341     {
03342       TEST_f_l (lrint, 0.0, 0);
03343       TEST_f_l (lrint, minus_zero, 0);
03344       TEST_f_l (lrint, 0.2L, 0);
03345       TEST_f_l (lrint, -0.2L, 0);
03346       TEST_f_l (lrint, 0.5L, 0);
03347       TEST_f_l (lrint, -0.5L, 0);
03348       TEST_f_l (lrint, 0.8L, 0);
03349       TEST_f_l (lrint, -0.8L, 0);
03350 
03351       TEST_f_l (lrint, 1.4L, 1);
03352       TEST_f_l (lrint, -1.4L, -1);
03353 
03354       TEST_f_l (lrint, 8388600.3L, 8388600);
03355       TEST_f_l (lrint, -8388600.3L, -8388600);
03356 
03357       TEST_f_l (lrint, 1071930.0008, 1071930);
03358 #ifndef TEST_FLOAT
03359       TEST_f_l (lrint, 1073741824.01, 1073741824);
03360 # if LONG_MAX > 281474976710656
03361       TEST_f_l (lrint, 281474976710656.025, 281474976710656);
03362 # endif
03363 #endif
03364     }
03365 
03366   fesetround (save_round_mode);
03367 
03368   END (lrint_towardzero);
03369 }
03370 
03371 
03372 static void
03373 lrint_test_downward (void)
03374 {
03375   int save_round_mode;
03376   START (lrint_downward);
03377 
03378   save_round_mode = fegetround ();
03379 
03380   if (!fesetround (FE_DOWNWARD))
03381     {
03382       TEST_f_l (lrint, 0.0, 0);
03383       TEST_f_l (lrint, minus_zero, 0);
03384       TEST_f_l (lrint, 0.2L, 0);
03385       TEST_f_l (lrint, -0.2L, -1);
03386       TEST_f_l (lrint, 0.5L, 0);
03387       TEST_f_l (lrint, -0.5L, -1);
03388       TEST_f_l (lrint, 0.8L, 0);
03389       TEST_f_l (lrint, -0.8L, -1);
03390 
03391       TEST_f_l (lrint, 1.4L, 1);
03392       TEST_f_l (lrint, -1.4L, -2);
03393 
03394       TEST_f_l (lrint, 8388600.3L, 8388600);
03395       TEST_f_l (lrint, -8388600.3L, -8388601);
03396 
03397       TEST_f_l (lrint, 1071930.0008, 1071930);
03398 #ifndef TEST_FLOAT
03399       TEST_f_l (lrint, 1073741824.01, 1073741824);
03400 # if LONG_MAX > 281474976710656
03401       TEST_f_l (lrint, 281474976710656.025, 281474976710656);
03402 # endif
03403 #endif
03404     }
03405 
03406   fesetround (save_round_mode);
03407 
03408   END (lrint_downward);
03409 }
03410 
03411 
03412 static void
03413 lrint_test_upward (void)
03414 {
03415   int save_round_mode;
03416   START (lrint_upward);
03417 
03418   save_round_mode = fegetround ();
03419 
03420   if (!fesetround (FE_UPWARD))
03421     {
03422       TEST_f_l (lrint, 0.0, 0);
03423       TEST_f_l (lrint, minus_zero, 0);
03424       TEST_f_l (lrint, 0.2L, 1);
03425       TEST_f_l (lrint, -0.2L, 0);
03426       TEST_f_l (lrint, 0.5L, 1);
03427       TEST_f_l (lrint, -0.5L, 0);
03428       TEST_f_l (lrint, 0.8L, 1);
03429       TEST_f_l (lrint, -0.8L, 0);
03430 
03431       TEST_f_l (lrint, 1.4L, 2);
03432       TEST_f_l (lrint, -1.4L, -1);
03433 
03434       TEST_f_l (lrint, 8388600.3L, 8388601);
03435       TEST_f_l (lrint, -8388600.3L, -8388600);
03436 
03437 #ifndef TEST_FLOAT
03438       TEST_f_l (lrint, 1071930.0008, 1071931);
03439       TEST_f_l (lrint, 1073741824.01, 1073741825);
03440 # if LONG_MAX > 281474976710656 && defined (TEST_LDOUBLE)
03441       TEST_f_l (lrint, 281474976710656.025, 281474976710656);
03442 # endif
03443 #endif
03444     }
03445 
03446   fesetround (save_round_mode);
03447 
03448   END (lrint_upward);
03449 }
03450 
03451 
03452 static void
03453 llrint_test (void)
03454 {
03455   /* XXX this test is incomplete.  We need to have a way to specifiy
03456      the rounding method and test the critical cases.  So far, only
03457      unproblematic numbers are tested.  */
03458 
03459   START (llrint);
03460 
03461   TEST_f_L (llrint, 0.0, 0);
03462   TEST_f_L (llrint, minus_zero, 0);
03463   TEST_f_L (llrint, 0.2L, 0);
03464   TEST_f_L (llrint, -0.2L, 0);
03465 
03466   TEST_f_L (llrint, 1.4L, 1);
03467   TEST_f_L (llrint, -1.4L, -1);
03468 
03469   TEST_f_L (llrint, 8388600.3L, 8388600);
03470   TEST_f_L (llrint, -8388600.3L, -8388600);
03471 
03472   TEST_f_l (llrint, 1071930.0008, 1071930);
03473 
03474   /* Test boundary conditions.  */
03475   /* 0x1FFFFF */
03476   TEST_f_L (llrint, 2097151.0,2097151LL);
03477   /* 0x800000 */
03478   TEST_f_L (llrint, 8388608.0, 8388608LL);
03479   /* 0x1000000 */
03480   TEST_f_L (llrint, 16777216.0, 16777216LL);
03481   /* 0x20000000000 */
03482   TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
03483   /* 0x40000000000 */
03484   TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
03485   /* 0x1000000000000 */
03486   TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
03487   /* 0x10000000000000 */
03488   TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
03489   /* 0x10000080000000 */
03490   TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
03491   /* 0x20000000000000 */
03492   TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
03493   /* 0x80000000000000 */
03494   TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
03495   /* 0x100000000000000 */
03496   TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
03497 #ifdef TEST_LDOUBLE
03498   /* The input can only be represented in long double.  */
03499   TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
03500   TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
03501   TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
03502   TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
03503   TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
03504 
03505   TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
03506   TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
03507   TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
03508   TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
03509   TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
03510 
03511 # if LDBL_MANT_DIG > 100
03512   TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
03513   TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
03514   TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
03515   TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
03516   TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
03517   TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
03518 
03519   TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
03520   TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
03521   TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
03522   TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
03523   TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
03524   TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
03525 #endif
03526 
03527   TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
03528   TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
03529   TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
03530   TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
03531   TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
03532 
03533   TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
03534   TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
03535   TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
03536   TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
03537   TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
03538 
03539 # if LDBL_MANT_DIG > 100
03540   TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
03541   TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
03542   TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
03543   TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
03544   TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
03545   TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
03546 
03547   TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
03548   TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
03549   TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
03550   TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
03551   TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
03552   TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
03553 #endif
03554 
03555   TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
03556   TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
03557   TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
03558   TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
03559   TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
03560 
03561   TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
03562   TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
03563   TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
03564   TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
03565   TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
03566 
03567 # if LDBL_MANT_DIG > 100
03568   TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
03569   TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
03570   TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
03571   TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
03572   TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
03573   TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
03574   TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
03575   TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
03576   TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
03577   TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
03578   TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
03579   TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
03580 # endif
03581 #endif
03582 
03583   END (llrint);
03584 }
03585 
03586 static void
03587 llrint_test_tonearest (void)
03588 {
03589   int save_round_mode;
03590   START (llrint_tonearest);
03591 
03592   save_round_mode = fegetround ();
03593 
03594   if (!fesetround (FE_TONEAREST))
03595     {
03596       TEST_f_L (llrint, 0.0, 0);
03597       TEST_f_L (llrint, minus_zero, 0);
03598       TEST_f_L (llrint, 0.2L, 0);
03599       TEST_f_L (llrint, -0.2L, 0);
03600 
03601       TEST_f_L (llrint, 1.4L, 1);
03602       TEST_f_L (llrint, -1.4L, -1);
03603 
03604       TEST_f_L (llrint, 8388600.3L, 8388600);
03605       TEST_f_L (llrint, -8388600.3L, -8388600);
03606 
03607       TEST_f_l (llrint, 1071930.0008, 1071930);
03608 
03609       /* Test boundary conditions.  */
03610       /* 0x1FFFFF */
03611       TEST_f_L (llrint, 2097151.0,2097151LL);
03612       /* 0x800000 */
03613       TEST_f_L (llrint, 8388608.0, 8388608LL);
03614       /* 0x1000000 */
03615       TEST_f_L (llrint, 16777216.0, 16777216LL);
03616       /* 0x20000000000 */
03617       TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
03618       /* 0x40000000000 */
03619       TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
03620       /* 0x1000000000000 */
03621       TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
03622       /* 0x10000000000000 */
03623       TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
03624       /* 0x10000080000000 */
03625       TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
03626       /* 0x20000000000000 */
03627       TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
03628       /* 0x80000000000000 */
03629       TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
03630       /* 0x100000000000000 */
03631       TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
03632 #ifdef TEST_LDOUBLE
03633       /* The input can only be represented in long double.  */
03634       TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
03635       TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
03636       TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
03637       TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
03638       TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
03639 
03640       TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
03641       TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
03642       TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
03643       TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
03644       TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
03645 
03646 # if LDBL_MANT_DIG > 100
03647       TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
03648       TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
03649       TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
03650       TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
03651       TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
03652       TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
03653 
03654       TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
03655       TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
03656       TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
03657       TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
03658       TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
03659       TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
03660 #endif
03661 
03662       TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
03663       TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
03664       TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
03665       TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
03666       TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
03667 
03668       TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
03669       TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
03670       TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
03671       TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
03672       TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
03673 
03674 # if LDBL_MANT_DIG > 100
03675       TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
03676       TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
03677       TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
03678       TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
03679       TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
03680       TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
03681 
03682       TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
03683       TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
03684       TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
03685       TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
03686       TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
03687       TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
03688 #endif
03689 
03690       TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
03691       TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
03692       TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
03693       TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
03694       TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
03695 
03696       TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
03697       TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
03698       TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
03699       TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
03700       TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
03701 
03702 # if LDBL_MANT_DIG > 100
03703       TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
03704       TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
03705       TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
03706       TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
03707       TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
03708       TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
03709       TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
03710       TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
03711       TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
03712       TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
03713       TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
03714       TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
03715 # endif
03716 #endif
03717     }
03718 
03719   fesetround (save_round_mode);
03720 
03721   END (llrint_tonearest);
03722 }
03723 
03724 static void
03725 llrint_test_towardzero (void)
03726 {
03727   int save_round_mode;
03728   START (llrint_towardzero);
03729 
03730   save_round_mode = fegetround ();
03731 
03732   if (!fesetround (FE_TOWARDZERO))
03733     {
03734       TEST_f_L (llrint, 0.0, 0);
03735       TEST_f_L (llrint, minus_zero, 0);
03736       TEST_f_L (llrint, 0.2L, 0);
03737       TEST_f_L (llrint, -0.2L, 0);
03738 
03739       TEST_f_L (llrint, 1.4L, 1);
03740       TEST_f_L (llrint, -1.4L, -1);
03741 
03742       TEST_f_L (llrint, 8388600.3L, 8388600);
03743       TEST_f_L (llrint, -8388600.3L, -8388600);
03744 
03745       TEST_f_l (llrint, 1071930.0008, 1071930);
03746 
03747       /* Test boundary conditions.  */
03748       /* 0x1FFFFF */
03749       TEST_f_L (llrint, 2097151.0,2097151LL);
03750       /* 0x800000 */
03751       TEST_f_L (llrint, 8388608.0, 8388608LL);
03752       /* 0x1000000 */
03753       TEST_f_L (llrint, 16777216.0, 16777216LL);
03754       /* 0x20000000000 */
03755       TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
03756       /* 0x40000000000 */
03757       TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
03758       /* 0x1000000000000 */
03759       TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
03760       /* 0x10000000000000 */
03761       TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
03762       /* 0x10000080000000 */
03763       TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
03764       /* 0x20000000000000 */
03765       TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
03766       /* 0x80000000000000 */
03767       TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
03768       /* 0x100000000000000 */
03769       TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
03770 #ifdef TEST_LDOUBLE
03771       /* The input can only be represented in long double.  */
03772       TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
03773       TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
03774       TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
03775       TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
03776       TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
03777 
03778       TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
03779       TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
03780       TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
03781       TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
03782       TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
03783 
03784 # if LDBL_MANT_DIG > 100
03785       TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
03786       TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
03787       TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
03788       TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
03789       TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
03790       TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
03791 
03792       TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
03793       TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
03794       TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
03795       TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
03796       TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
03797       TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
03798 #endif
03799 
03800       TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
03801       TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
03802       TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
03803       TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
03804       TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
03805 
03806       TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
03807       TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
03808       TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
03809       TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
03810       TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
03811 
03812 # if LDBL_MANT_DIG > 100
03813       TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
03814       TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
03815       TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
03816       TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
03817       TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
03818       TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
03819 
03820       TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
03821       TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
03822       TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
03823       TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
03824       TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
03825       TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
03826 #endif
03827 
03828       TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
03829       TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
03830       TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
03831       TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
03832       TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
03833 
03834       TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
03835       TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
03836       TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
03837       TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
03838       TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
03839 
03840 # if LDBL_MANT_DIG > 100
03841       TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
03842       TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
03843       TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
03844       TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
03845       TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
03846       TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
03847       TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
03848       TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
03849       TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
03850       TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
03851       TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
03852       TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
03853 # endif
03854 #endif
03855     }
03856 
03857   fesetround (save_round_mode);
03858 
03859   END (llrint_towardzero);
03860 }
03861 
03862 static void
03863 llrint_test_downward (void)
03864 {
03865   int save_round_mode;
03866   START (llrint_downward);
03867 
03868   save_round_mode = fegetround ();
03869 
03870   if (!fesetround (FE_DOWNWARD))
03871     {
03872       TEST_f_L (llrint, 0.0, 0);
03873       TEST_f_L (llrint, minus_zero, 0);
03874       TEST_f_L (llrint, 0.2L, 0);
03875       TEST_f_L (llrint, -0.2L, -1);
03876 
03877       TEST_f_L (llrint, 1.4L, 1);
03878       TEST_f_L (llrint, -1.4L, -2);
03879 
03880       TEST_f_L (llrint, 8388600.3L, 8388600);
03881       TEST_f_L (llrint, -8388600.3L, -8388601);
03882 
03883       TEST_f_l (llrint, 1071930.0008, 1071930);
03884 
03885       /* Test boundary conditions.  */
03886       /* 0x1FFFFF */
03887       TEST_f_L (llrint, 2097151.0,2097151LL);
03888       /* 0x800000 */
03889       TEST_f_L (llrint, 8388608.0, 8388608LL);
03890       /* 0x1000000 */
03891       TEST_f_L (llrint, 16777216.0, 16777216LL);
03892       /* 0x20000000000 */
03893       TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
03894       /* 0x40000000000 */
03895       TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
03896       /* 0x1000000000000 */
03897       TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
03898       /* 0x10000000000000 */
03899       TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
03900       /* 0x10000080000000 */
03901       TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
03902       /* 0x20000000000000 */
03903       TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
03904       /* 0x80000000000000 */
03905       TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
03906       /* 0x100000000000000 */
03907       TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
03908 #ifdef TEST_LDOUBLE
03909       /* The input can only be represented in long double.  */
03910       TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
03911       TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
03912       TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
03913       TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
03914       TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
03915 
03916       TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
03917       TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
03918       TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
03919       TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
03920       TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
03921       TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
03922 
03923       TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
03924       TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
03925       TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
03926       TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
03927       TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
03928 
03929       TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
03930       TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
03931       TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
03932       TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
03933       TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
03934       TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
03935 
03936       TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
03937       TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
03938       TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
03939       TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
03940       TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
03941 
03942       TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
03943       TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
03944       TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
03945       TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
03946       TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
03947       TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
03948 
03949       TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
03950       TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
03951       TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
03952       TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
03953       TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
03954 
03955       TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
03956       TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
03957       TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
03958       TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
03959       TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
03960       TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
03961 
03962       TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
03963       TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
03964       TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
03965       TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
03966       TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
03967 
03968       TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
03969       TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
03970       TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
03971       TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
03972       TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
03973 
03974 # if LDBL_MANT_DIG > 100
03975       TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
03976       TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
03977       TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
03978       TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
03979       TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
03980       TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
03981       TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
03982       TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
03983       TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
03984       TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
03985       TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
03986       TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
03987 # endif
03988 #endif
03989     }
03990 
03991   fesetround (save_round_mode);
03992 
03993   END (llrint_downward);
03994 }
03995 
03996 static void
03997 llrint_test_upward (void)
03998 {
03999   int save_round_mode;
04000   START (llrint_upward);
04001 
04002   save_round_mode = fegetround ();
04003 
04004   if (!fesetround (FE_UPWARD))
04005     {
04006       TEST_f_L (llrint, 0.0, 0);
04007       TEST_f_L (llrint, minus_zero, 0);
04008       TEST_f_L (llrint, 0.2L, 1);
04009       TEST_f_L (llrint, -0.2L, 0);
04010 
04011       TEST_f_L (llrint, 1.4L, 2);
04012       TEST_f_L (llrint, -1.4L, -1);
04013 
04014       TEST_f_L (llrint, 8388600.3L, 8388601);
04015       TEST_f_L (llrint, -8388600.3L, -8388600);
04016 #ifndef TEST_FLOAT
04017       TEST_f_l (llrint, 1071930.0008, 1071931);
04018 #endif
04019       /* Test boundary conditions.  */
04020       /* 0x1FFFFF */
04021       TEST_f_L (llrint, 2097151.0,2097151LL);
04022       /* 0x800000 */
04023       TEST_f_L (llrint, 8388608.0, 8388608LL);
04024       /* 0x1000000 */
04025       TEST_f_L (llrint, 16777216.0, 16777216LL);
04026       /* 0x20000000000 */
04027       TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
04028       /* 0x40000000000 */
04029       TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
04030       /* 0x1000000000000 */
04031       TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
04032       /* 0x10000000000000 */
04033       TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
04034       /* 0x10000080000000 */
04035       TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
04036       /* 0x20000000000000 */
04037       TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
04038       /* 0x80000000000000 */
04039       TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
04040       /* 0x100000000000000 */
04041       TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
04042 #ifdef TEST_LDOUBLE
04043       /* The input can only be represented in long double.  */
04044       TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
04045       TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
04046       TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
04047       TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
04048       TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
04049 
04050       TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
04051       TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
04052       TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
04053       TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
04054       TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
04055       TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
04056 
04057       TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
04058       TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
04059       TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
04060       TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
04061       TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
04062 
04063       TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
04064       TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
04065       TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
04066       TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
04067       TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
04068       TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
04069 
04070       TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
04071       TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
04072       TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
04073       TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
04074       TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
04075 
04076       TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
04077       TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
04078       TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
04079       TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
04080       TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
04081       TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
04082 
04083       TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
04084       TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
04085       TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
04086       TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
04087       TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
04088 
04089       TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
04090       TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
04091       TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
04092       TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
04093       TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
04094       TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
04095 
04096       TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
04097       TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
04098       TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
04099       TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
04100       TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
04101 
04102       TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
04103       TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
04104       TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
04105       TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
04106       TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
04107 
04108 # if LDBL_MANT_DIG > 100
04109       TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
04110       TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
04111       TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
04112       TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
04113       TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
04114       TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
04115       TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
04116       TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
04117       TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
04118       TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
04119       TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
04120       TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
04121 # endif
04122 #endif
04123     }
04124 
04125   fesetround (save_round_mode);
04126 
04127   END (llrint_upward);
04128 }
04129 
04130 
04131 static void
04132 log_test (void)
04133 {
04134   errno = 0;
04135   FUNC(log) (1);
04136   if (errno == ENOSYS)
04137     /* Function not implemented.  */
04138     return;
04139   START (log);
04140 
04141   TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04142   TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04143 
04144   TEST_f_f (log, 1, 0);
04145 
04146   TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
04147   TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
04148   TEST_f_f (log, plus_infty, plus_infty);
04149   TEST_f_f (log, nan_value, nan_value);
04150 
04151   TEST_f_f (log, M_El, 1);
04152   TEST_f_f (log, 1.0 / M_El, -1);
04153   TEST_f_f (log, 2, M_LN2l);
04154   TEST_f_f (log, 10, M_LN10l);
04155   TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
04156 
04157   END (log);
04158 }
04159 
04160 
04161 static void
04162 log10_test (void)
04163 {
04164   errno = 0;
04165   FUNC(log10) (1);
04166   if (errno == ENOSYS)
04167     /* Function not implemented.  */
04168     return;
04169 
04170   START (log10);
04171 
04172   TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04173   TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04174 
04175   TEST_f_f (log10, 1, 0);
04176 
04177   /* log10 (x) == NaN plus invalid exception if x < 0.  */
04178   TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
04179   TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
04180 
04181   TEST_f_f (log10, plus_infty, plus_infty);
04182   TEST_f_f (log10, nan_value, nan_value);
04183 
04184   TEST_f_f (log10, 0.1L, -1);
04185   TEST_f_f (log10, 10.0, 1);
04186   TEST_f_f (log10, 100.0, 2);
04187   TEST_f_f (log10, 10000.0, 4);
04188   TEST_f_f (log10, M_El, M_LOG10El);
04189   TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
04190 
04191   END (log10);
04192 }
04193 
04194 
04195 static void
04196 log1p_test (void)
04197 {
04198   errno = 0;
04199   FUNC(log1p) (0);
04200   if (errno == ENOSYS)
04201     /* Function not implemented.  */
04202     return;
04203 
04204   START (log1p);
04205 
04206   TEST_f_f (log1p, 0, 0);
04207   TEST_f_f (log1p, minus_zero, minus_zero);
04208 
04209   TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04210   TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
04211   TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
04212 
04213   TEST_f_f (log1p, plus_infty, plus_infty);
04214   TEST_f_f (log1p, nan_value, nan_value);
04215 
04216   TEST_f_f (log1p, M_El - 1.0, 1);
04217 
04218   TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
04219   TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
04220 
04221   END (log1p);
04222 }
04223 
04224 
04225 static void
04226 log2_test (void)
04227 {
04228   errno = 0;
04229   FUNC(log2) (1);
04230   if (errno == ENOSYS)
04231     /* Function not implemented.  */
04232     return;
04233 
04234   START (log2);
04235 
04236   TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04237   TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04238 
04239   TEST_f_f (log2, 1, 0);
04240 
04241   TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
04242   TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
04243 
04244   TEST_f_f (log2, plus_infty, plus_infty);
04245   TEST_f_f (log2, nan_value, nan_value);
04246 
04247   TEST_f_f (log2, M_El, M_LOG2El);
04248   TEST_f_f (log2, 2.0, 1);
04249   TEST_f_f (log2, 16.0, 4);
04250   TEST_f_f (log2, 256.0, 8);
04251   TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
04252 
04253   END (log2);
04254 }
04255 
04256 
04257 static void
04258 logb_test (void)
04259 {
04260   START (logb);
04261 
04262   TEST_f_f (logb, plus_infty, plus_infty);
04263   TEST_f_f (logb, minus_infty, plus_infty);
04264 
04265   TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04266 
04267   TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04268   TEST_f_f (logb, nan_value, nan_value);
04269 
04270   TEST_f_f (logb, 1, 0);
04271   TEST_f_f (logb, M_El, 1);
04272   TEST_f_f (logb, 1024, 10);
04273   TEST_f_f (logb, -2000, 10);
04274 
04275   END (logb);
04276 }
04277 
04278 
04279 static void
04280 lround_test (void)
04281 {
04282   START (lround);
04283 
04284   TEST_f_l (lround, 0, 0);
04285   TEST_f_l (lround, minus_zero, 0);
04286   TEST_f_l (lround, 0.2L, 0.0);
04287   TEST_f_l (lround, -0.2L, 0);
04288   TEST_f_l (lround, 0.5, 1);
04289   TEST_f_l (lround, -0.5, -1);
04290   TEST_f_l (lround, 0.8L, 1);
04291   TEST_f_l (lround, -0.8L, -1);
04292   TEST_f_l (lround, 1.5, 2);
04293   TEST_f_l (lround, -1.5, -2);
04294   TEST_f_l (lround, 22514.5, 22515);
04295   TEST_f_l (lround, -22514.5, -22515);
04296   TEST_f_l (lround, 1071930.0008, 1071930);
04297 #ifndef TEST_FLOAT
04298   TEST_f_l (lround, 1073741824.01, 1073741824);
04299 # if LONG_MAX > 281474976710656
04300   TEST_f_l (lround, 281474976710656.025, 281474976710656);
04301 # endif
04302   TEST_f_l (lround, 2097152.5, 2097153);
04303   TEST_f_l (lround, -2097152.5, -2097153);
04304   /* nextafter(0.5,-1)  */
04305   TEST_f_l (lround, 0x1.fffffffffffffp-2, 0);
04306   /* nextafter(-0.5,1)  */
04307   TEST_f_l (lround, -0x1.fffffffffffffp-2, 0);
04308 #else
04309   /* nextafter(0.5,-1)  */
04310   TEST_f_l (lround, 0x1.fffffp-2, 0);
04311   /* nextafter(-0.5,1)  */
04312   TEST_f_l (lround, -0x1.fffffp-2, 0);
04313   TEST_f_l (lround, 0x1.fffffep+23, 16777215);
04314   TEST_f_l (lround, -0x1.fffffep+23, -16777215);
04315 #endif
04316   END (lround);
04317 }
04318 
04319 
04320 static void
04321 llround_test (void)
04322 {
04323   START (llround);
04324 
04325   TEST_f_L (llround, 0, 0);
04326   TEST_f_L (llround, minus_zero, 0);
04327   TEST_f_L (llround, 0.2L, 0.0);
04328   TEST_f_L (llround, -0.2L, 0);
04329   TEST_f_L (llround, 0.5, 1);
04330   TEST_f_L (llround, -0.5, -1);
04331   TEST_f_L (llround, 0.8L, 1);
04332   TEST_f_L (llround, -0.8L, -1);
04333   TEST_f_L (llround, 1.5, 2);
04334   TEST_f_L (llround, -1.5, -2);
04335   TEST_f_L (llround, 22514.5, 22515);
04336   TEST_f_L (llround, -22514.5, -22515);
04337   TEST_f_l (llround, 1071930.0008, 1071930);
04338 #ifndef TEST_FLOAT
04339   TEST_f_L (llround, 2097152.5, 2097153);
04340   TEST_f_L (llround, -2097152.5, -2097153);
04341   TEST_f_L (llround, 34359738368.5, 34359738369ll);
04342   TEST_f_L (llround, -34359738368.5, -34359738369ll);
04343 #endif
04344 
04345   /* Test boundary conditions.  */
04346   /* 0x1FFFFF */
04347   TEST_f_L (llround, 2097151.0, 2097151LL);
04348   /* 0x800000 */
04349   TEST_f_L (llround, 8388608.0, 8388608LL);
04350   /* 0x1000000 */
04351   TEST_f_L (llround, 16777216.0, 16777216LL);
04352   /* 0x20000000000 */
04353   TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
04354   /* 0x40000000000 */
04355   TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
04356   /* 0x1000000000000 */
04357   TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
04358   /* 0x10000000000000 */
04359   TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
04360   /* 0x10000080000000 */
04361   TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
04362   /* 0x20000000000000 */
04363   TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
04364   /* 0x80000000000000 */
04365   TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
04366   /* 0x100000000000000 */
04367   TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
04368 
04369 #ifndef TEST_FLOAT
04370   /* 0x100000000 */
04371   TEST_f_L (llround, 4294967295.5, 4294967296LL);
04372   /* 0x200000000 */
04373   TEST_f_L (llround, 8589934591.5, 8589934592LL);
04374 
04375   /* nextafter(0.5,-1)  */
04376   TEST_f_L (llround, 0x1.fffffffffffffp-2, 0);
04377   /* nextafter(-0.5,1)  */
04378   TEST_f_L (llround, -0x1.fffffffffffffp-2, 0);
04379   /* On PowerPC an exponent of '52' is the largest incrementally
04380    * representable sequence of whole-numbers in the 'double' range.  We test
04381    * lround to make sure that a guard bit set during the lround operation
04382    * hasn't forced an erroneous shift giving us an incorrect result.  The odd
04383    * numbers between +-(2^52+1 and 2^53-1) are affected since they have the
04384    * rightmost bit set.  */
04385   /* +-(2^52+1)  */
04386   TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL);
04387   TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL);
04388   /* +-(2^53-1): Input is the last (positive and negative) incrementally
04389    * representable whole-number in the 'double' range that might round
04390    * erroneously.  */
04391   TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL);
04392   TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL);
04393 #else
04394   /* nextafter(0.5,-1)  */
04395   TEST_f_L (llround, 0x1.fffffep-2, 0);
04396   /* nextafter(-0.5,1)  */
04397   TEST_f_L (llround, -0x1.fffffep-2, 0);
04398   /* As above, on PowerPC an exponent of '23' is the largest incrementally
04399    * representable sequence of whole-numbers in the 'float' range.
04400    * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected.  */
04401   TEST_f_L (llround, 0x1.000002p+23,8388609);
04402   TEST_f_L (llround, -0x1.000002p+23,-8388609);
04403   TEST_f_L (llround, 0x1.fffffep+23, 16777215);
04404   TEST_f_L (llround, -0x1.fffffep+23, -16777215);
04405 #endif
04406 
04407 
04408 #ifdef TEST_LDOUBLE
04409   /* The input can only be represented in long double.  */
04410   TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
04411   TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
04412   TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
04413   TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
04414   TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
04415 
04416 # if LDBL_MANT_DIG > 100
04417   TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
04418   TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
04419   TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
04420   TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
04421   TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
04422   TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
04423 
04424   TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
04425   TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
04426   TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
04427   TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
04428   TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
04429   TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
04430 # endif
04431 
04432   TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
04433   TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
04434   TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
04435   TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
04436   TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
04437 
04438   TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
04439   TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
04440   TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
04441   TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
04442   TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
04443 
04444 # if LDBL_MANT_DIG > 100
04445   TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
04446   TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
04447   TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
04448   TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
04449   TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
04450   TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
04451 
04452   TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
04453   TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
04454   TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
04455   TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
04456   TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
04457   TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
04458 # endif
04459 
04460   TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
04461   TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
04462   TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
04463   TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
04464   TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
04465 
04466   TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
04467   TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
04468   TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
04469   TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
04470   TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
04471 
04472   TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
04473   TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
04474   TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
04475   TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
04476   TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
04477 
04478   TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
04479   TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
04480   TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
04481   TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
04482   TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
04483   TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
04484 #endif
04485 
04486   END (llround);
04487 }
04488 
04489 static void
04490 modf_test (void)
04491 {
04492   FLOAT x;
04493 
04494   START (modf);
04495 
04496   TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
04497   TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
04498   TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
04499   TEST_fF_f1 (modf, 0, 0, 0);
04500   TEST_fF_f1 (modf, 1.5, 0.5, 1);
04501   TEST_fF_f1 (modf, 2.5, 0.5, 2);
04502   TEST_fF_f1 (modf, -2.5, -0.5, -2);
04503   TEST_fF_f1 (modf, 20, 0, 20);
04504   TEST_fF_f1 (modf, 21, 0, 21);
04505   TEST_fF_f1 (modf, 89.5, 0.5, 89);
04506 
04507   END (modf);
04508 }
04509 
04510 
04511 static void
04512 nearbyint_test (void)
04513 {
04514   START (nearbyint);
04515 
04516   TEST_f_f (nearbyint, 0.0, 0.0);
04517   TEST_f_f (nearbyint, minus_zero, minus_zero);
04518   TEST_f_f (nearbyint, plus_infty, plus_infty);
04519   TEST_f_f (nearbyint, minus_infty, minus_infty);
04520   TEST_f_f (nearbyint, nan_value, nan_value);
04521 
04522   /* Default rounding mode is round to nearest.  */
04523   TEST_f_f (nearbyint, 0.5, 0.0);
04524   TEST_f_f (nearbyint, 1.5, 2.0);
04525   TEST_f_f (nearbyint, -0.5, minus_zero);
04526   TEST_f_f (nearbyint, -1.5, -2.0);
04527 
04528   TEST_f_f (nearbyint, 262144.75, 262145.0);
04529   TEST_f_f (nearbyint, 262142.75, 262143.0);
04530   TEST_f_f (nearbyint, 524286.75, 524287.0);
04531   TEST_f_f (nearbyint, 524288.75, 524289.0);
04532 
04533   END (nearbyint);
04534 }
04535 
04536 static void
04537 nextafter_test (void)
04538 {
04539 
04540   START (nextafter);
04541 
04542   TEST_ff_f (nextafter, 0, 0, 0);
04543   TEST_ff_f (nextafter, minus_zero, 0, 0);
04544   TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
04545   TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
04546 
04547   TEST_ff_f (nextafter, 9, 9, 9);
04548   TEST_ff_f (nextafter, -9, -9, -9);
04549   TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
04550   TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
04551 
04552   TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
04553   TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
04554   TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
04555 
04556   FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
04557                       LDBL_MAX, DBL_MAX, FLT_MAX);
04558   TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
04559   TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
04560 
04561 #ifdef TEST_LDOUBLE
04562   // XXX Enable once gcc is fixed.
04563   //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
04564 #endif
04565 
04566   /* XXX We need the hexadecimal FP number representation here for further
04567      tests.  */
04568 
04569   END (nextafter);
04570 }
04571 
04572 
04573 static void
04574 nexttoward_test (void)
04575 {
04576   START (nexttoward);
04577   TEST_ff_f (nexttoward, 0, 0, 0);
04578   TEST_ff_f (nexttoward, minus_zero, 0, 0);
04579   TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
04580   TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
04581 
04582   TEST_ff_f (nexttoward, 9, 9, 9);
04583   TEST_ff_f (nexttoward, -9, -9, -9);
04584   TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
04585   TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
04586 
04587   TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
04588   TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
04589   TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
04590 
04591   /* XXX We need the hexadecimal FP number representation here for further
04592      tests.  */
04593 
04594   END (nexttoward);
04595 }
04596 
04597 
04598 static void
04599 pow_test (void)
04600 {
04601 
04602   errno = 0;
04603   FUNC(pow) (0, 0);
04604   if (errno == ENOSYS)
04605     /* Function not implemented.  */
04606     return;
04607 
04608   START (pow);
04609 
04610   TEST_ff_f (pow, 0, 0, 1);
04611   TEST_ff_f (pow, 0, minus_zero, 1);
04612   TEST_ff_f (pow, minus_zero, 0, 1);
04613   TEST_ff_f (pow, minus_zero, minus_zero, 1);
04614 
04615   TEST_ff_f (pow, 10, 0, 1);
04616   TEST_ff_f (pow, 10, minus_zero, 1);
04617   TEST_ff_f (pow, -10, 0, 1);
04618   TEST_ff_f (pow, -10, minus_zero, 1);
04619 
04620   TEST_ff_f (pow, nan_value, 0, 1);
04621   TEST_ff_f (pow, nan_value, minus_zero, 1);
04622 
04623 
04624 #ifndef TEST_INLINE
04625   TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
04626   TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
04627   TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
04628   TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
04629 
04630   TEST_ff_f (pow, 0.9L, plus_infty, 0);
04631   TEST_ff_f (pow, 1e-7L, plus_infty, 0);
04632   TEST_ff_f (pow, -0.9L, plus_infty, 0);
04633   TEST_ff_f (pow, -1e-7L, plus_infty, 0);
04634 
04635   TEST_ff_f (pow, 1.1L, minus_infty, 0);
04636   TEST_ff_f (pow, plus_infty, minus_infty, 0);
04637   TEST_ff_f (pow, -1.1L, minus_infty, 0);
04638   TEST_ff_f (pow, minus_infty, minus_infty, 0);
04639 
04640   TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
04641   TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
04642   TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
04643   TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
04644 
04645   TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
04646   TEST_ff_f (pow, plus_infty, 1, plus_infty);
04647   TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
04648 
04649   TEST_ff_f (pow, plus_infty, -1e-7L, 0);
04650   TEST_ff_f (pow, plus_infty, -1, 0);
04651   TEST_ff_f (pow, plus_infty, -1e7L, 0);
04652 
04653   TEST_ff_f (pow, minus_infty, 1, minus_infty);
04654   TEST_ff_f (pow, minus_infty, 11, minus_infty);
04655   TEST_ff_f (pow, minus_infty, 1001, minus_infty);
04656 
04657   TEST_ff_f (pow, minus_infty, 2, plus_infty);
04658   TEST_ff_f (pow, minus_infty, 12, plus_infty);
04659   TEST_ff_f (pow, minus_infty, 1002, plus_infty);
04660   TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
04661   TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
04662   TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
04663   TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
04664 
04665   TEST_ff_f (pow, minus_infty, -1, minus_zero);
04666   TEST_ff_f (pow, minus_infty, -11, minus_zero);
04667   TEST_ff_f (pow, minus_infty, -1001, minus_zero);
04668 
04669   TEST_ff_f (pow, minus_infty, -2, 0);
04670   TEST_ff_f (pow, minus_infty, -12, 0);
04671   TEST_ff_f (pow, minus_infty, -1002, 0);
04672   TEST_ff_f (pow, minus_infty, -0.1L, 0);
04673   TEST_ff_f (pow, minus_infty, -1.1L, 0);
04674   TEST_ff_f (pow, minus_infty, -11.1L, 0);
04675   TEST_ff_f (pow, minus_infty, -1001.1L, 0);
04676 #endif
04677 
04678   TEST_ff_f (pow, nan_value, nan_value, nan_value);
04679   TEST_ff_f (pow, 0, nan_value, nan_value);
04680   TEST_ff_f (pow, 1, nan_value, 1);
04681   TEST_ff_f (pow, -1, nan_value, nan_value);
04682   TEST_ff_f (pow, nan_value, 1, nan_value);
04683   TEST_ff_f (pow, nan_value, -1, nan_value);
04684 
04685   /* pow (x, NaN) == NaN.  */
04686   TEST_ff_f (pow, 3.0, nan_value, nan_value);
04687   TEST_ff_f (pow, minus_zero, nan_value, nan_value);
04688   TEST_ff_f (pow, plus_infty, nan_value, nan_value);
04689   TEST_ff_f (pow, -3.0, nan_value, nan_value);
04690   TEST_ff_f (pow, minus_infty, nan_value, nan_value);
04691 
04692   TEST_ff_f (pow, nan_value, 3.0, nan_value);
04693   TEST_ff_f (pow, nan_value, -3.0, nan_value);
04694   TEST_ff_f (pow, nan_value, plus_infty, nan_value);
04695   TEST_ff_f (pow, nan_value, minus_infty, nan_value);
04696   TEST_ff_f (pow, nan_value, 2.5, nan_value);
04697   TEST_ff_f (pow, nan_value, -2.5, nan_value);
04698 
04699   TEST_ff_f (pow, 1, plus_infty, 1);
04700   TEST_ff_f (pow, -1, plus_infty, 1);
04701   TEST_ff_f (pow, 1, minus_infty, 1);
04702   TEST_ff_f (pow, -1, minus_infty, 1);
04703   TEST_ff_f (pow, 1, 1, 1);
04704   TEST_ff_f (pow, 1, -1, 1);
04705   TEST_ff_f (pow, 1, 1.25, 1);
04706   TEST_ff_f (pow, 1, -1.25, 1);
04707   TEST_ff_f (pow, 1, 0x1p62L, 1);
04708   TEST_ff_f (pow, 1, 0x1p63L, 1);
04709   TEST_ff_f (pow, 1, 0x1p64L, 1);
04710   TEST_ff_f (pow, 1, 0x1p72L, 1);
04711 
04712   /* pow (x, +-0) == 1.  */
04713   TEST_ff_f (pow, plus_infty, 0, 1);
04714   TEST_ff_f (pow, plus_infty, minus_zero, 1);
04715   TEST_ff_f (pow, minus_infty, 0, 1);
04716   TEST_ff_f (pow, minus_infty, minus_zero, 1);
04717   TEST_ff_f (pow, 32.75L, 0, 1);
04718   TEST_ff_f (pow, 32.75L, minus_zero, 1);
04719   TEST_ff_f (pow, -32.75L, 0, 1);
04720   TEST_ff_f (pow, -32.75L, minus_zero, 1);
04721   TEST_ff_f (pow, 0x1p72L, 0, 1);
04722   TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
04723   TEST_ff_f (pow, 0x1p-72L, 0, 1);
04724   TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
04725 
04726   TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
04727   TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
04728   TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
04729   TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
04730 
04731   TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04732   TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04733   TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04734   TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04735 
04736   TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04737   TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04738   TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04739   TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
04740 
04741   TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
04742   TEST_ff_f (pow, 10, -0x1p72L, 0);
04743   TEST_ff_f (pow, max_value, max_value, plus_infty);
04744   TEST_ff_f (pow, 10, -max_value, 0);
04745 
04746   TEST_ff_f (pow, 0, 1, 0);
04747   TEST_ff_f (pow, 0, 11, 0);
04748 
04749   TEST_ff_f (pow, minus_zero, 1, minus_zero);
04750   TEST_ff_f (pow, minus_zero, 11, minus_zero);
04751 
04752 
04753   TEST_ff_f (pow, 0, 2, 0);
04754   TEST_ff_f (pow, 0, 11.1L, 0);
04755 
04756 
04757   TEST_ff_f (pow, minus_zero, 2, 0);
04758   TEST_ff_f (pow, minus_zero, 11.1L, 0);
04759   TEST_ff_f (pow, 0, plus_infty, 0);
04760   TEST_ff_f (pow, minus_zero, plus_infty, 0);
04761 
04762 #ifndef TEST_INLINE
04763   /* pow (x, +inf) == +inf for |x| > 1.  */
04764   TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
04765 
04766   /* pow (x, +inf) == +0 for |x| < 1.  */
04767   TEST_ff_f (pow, 0.5, plus_infty, 0.0);
04768 
04769   /* pow (x, -inf) == +0 for |x| > 1.  */
04770   TEST_ff_f (pow, 1.5, minus_infty, 0.0);
04771 
04772   /* pow (x, -inf) == +inf for |x| < 1.  */
04773   TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
04774 #endif
04775 
04776   /* pow (+inf, y) == +inf for y > 0.  */
04777   TEST_ff_f (pow, plus_infty, 2, plus_infty);
04778 
04779   /* pow (+inf, y) == +0 for y < 0.  */
04780   TEST_ff_f (pow, plus_infty, -1, 0.0);
04781 
04782   /* pow (-inf, y) == -inf for y an odd integer > 0.  */
04783   TEST_ff_f (pow, minus_infty, 27, minus_infty);
04784 
04785   /* pow (-inf, y) == +inf for y > 0 and not an odd integer.  */
04786   TEST_ff_f (pow, minus_infty, 28, plus_infty);
04787 
04788   /* pow (-inf, y) == -0 for y an odd integer < 0. */
04789   TEST_ff_f (pow, minus_infty, -3, minus_zero);
04790   /* pow (-inf, y) == +0 for y < 0 and not an odd integer.  */
04791   TEST_ff_f (pow, minus_infty, -2.0, 0.0);
04792 
04793   /* pow (+0, y) == +0 for y an odd integer > 0.  */
04794   TEST_ff_f (pow, 0.0, 27, 0.0);
04795 
04796   /* pow (-0, y) == -0 for y an odd integer > 0.  */
04797   TEST_ff_f (pow, minus_zero, 27, minus_zero);
04798 
04799   /* pow (+0, y) == +0 for y > 0 and not an odd integer.  */
04800   TEST_ff_f (pow, 0.0, 4, 0.0);
04801 
04802   /* pow (-0, y) == +0 for y > 0 and not an odd integer.  */
04803   TEST_ff_f (pow, minus_zero, 4, 0.0);
04804 
04805   TEST_ff_f (pow, 16, 0.25L, 2);
04806   TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
04807   TEST_ff_f (pow, 2, 4, 16);
04808   TEST_ff_f (pow, 256, 8, 0x1p64L);
04809 
04810   TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
04811 
04812 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
04813   TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
04814 #endif
04815 
04816   END (pow);
04817 }
04818 
04819 static void
04820 remainder_test (void)
04821 {
04822   errno = 0;
04823   FUNC(remainder) (1.625, 1.0);
04824   if (errno == ENOSYS)
04825     /* Function not implemented.  */
04826     return;
04827 
04828   START (remainder);
04829 
04830   TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
04831   TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
04832   TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
04833   TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
04834   TEST_ff_f (remainder, nan_value, nan_value, nan_value);
04835 
04836   TEST_ff_f (remainder, 1.625, 1.0, -0.375);
04837   TEST_ff_f (remainder, -1.625, 1.0, 0.375);
04838   TEST_ff_f (remainder, 1.625, -1.0, -0.375);
04839   TEST_ff_f (remainder, -1.625, -1.0, 0.375);
04840   TEST_ff_f (remainder, 5.0, 2.0, 1.0);
04841   TEST_ff_f (remainder, 3.0, 2.0, -1.0);
04842 
04843   END (remainder);
04844 }
04845 
04846 static void
04847 remquo_test (void)
04848 {
04849   /* x is needed.  */
04850   int x;
04851 
04852   errno = 0;
04853   FUNC(remquo) (1.625, 1.0, &x);
04854   if (errno == ENOSYS)
04855     /* Function not implemented.  */
04856     return;
04857 
04858   START (remquo);
04859 
04860   TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
04861   TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
04862   TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
04863   TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
04864   TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
04865 
04866   TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
04867   TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
04868   TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
04869   TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
04870 
04871   TEST_ffI_f1 (remquo, 5, 2, 1, 2);
04872   TEST_ffI_f1 (remquo, 3, 2, -1, 2);
04873 
04874   END (remquo);
04875 }
04876 
04877 static void
04878 rint_test (void)
04879 {
04880   START (rint);
04881 
04882   TEST_f_f (rint, 0.0, 0.0);
04883   TEST_f_f (rint, minus_zero, minus_zero);
04884   TEST_f_f (rint, plus_infty, plus_infty);
04885   TEST_f_f (rint, minus_infty, minus_infty);
04886 
04887   /* Default rounding mode is round to even.  */
04888   TEST_f_f (rint, 0.5, 0.0);
04889   TEST_f_f (rint, 1.5, 2.0);
04890   TEST_f_f (rint, 2.5, 2.0);
04891   TEST_f_f (rint, 3.5, 4.0);
04892   TEST_f_f (rint, 4.5, 4.0);
04893   TEST_f_f (rint, -0.5, -0.0);
04894   TEST_f_f (rint, -1.5, -2.0);
04895   TEST_f_f (rint, -2.5, -2.0);
04896   TEST_f_f (rint, -3.5, -4.0);
04897   TEST_f_f (rint, -4.5, -4.0);
04898   TEST_f_f (rint, 0.1, 0.0);
04899   TEST_f_f (rint, 0.25, 0.0);
04900   TEST_f_f (rint, 0.625, 1.0);
04901   TEST_f_f (rint, -0.1, -0.0);
04902   TEST_f_f (rint, -0.25, -0.0);
04903   TEST_f_f (rint, -0.625, -1.0);
04904   TEST_f_f (rint, 262144.75, 262145.0);
04905   TEST_f_f (rint, 262142.75, 262143.0);
04906   TEST_f_f (rint, 524286.75, 524287.0);
04907   TEST_f_f (rint, 524288.75, 524289.0);
04908 #ifdef TEST_LDOUBLE
04909   /* The result can only be represented in long double.  */
04910   TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
04911   TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
04912   TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
04913   TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
04914   TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
04915 
04916 # if LDBL_MANT_DIG > 100
04917   TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
04918   TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
04919   TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
04920 # endif
04921 
04922   TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
04923   TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
04924   TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
04925   TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
04926   TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
04927 
04928 # if LDBL_MANT_DIG > 100
04929   TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
04930   TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
04931   TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
04932 
04933   TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
04934   TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
04935   TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
04936   TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
04937   TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
04938   TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
04939 
04940   TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
04941   TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
04942   TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
04943   TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
04944   TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
04945   TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
04946 # endif
04947 
04948   TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
04949   TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
04950   TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
04951   TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
04952   TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
04953 
04954   TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
04955   TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
04956   TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
04957   TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
04958   TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
04959 
04960   TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
04961   TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
04962   TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
04963   TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
04964   TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
04965 
04966   TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
04967   TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
04968   TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
04969   TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
04970   TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
04971 
04972   TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
04973   TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
04974   TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
04975   TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
04976   TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
04977 #endif
04978 
04979   END (rint);
04980 }
04981 
04982 static void
04983 rint_test_tonearest (void)
04984 {
04985   int save_round_mode;
04986   START (rint_tonearest);
04987 
04988   save_round_mode = fegetround ();
04989 
04990   if (!fesetround (FE_TONEAREST))
04991     {
04992       TEST_f_f (rint, 2.0, 2.0);
04993       TEST_f_f (rint, 1.5, 2.0);
04994       TEST_f_f (rint, 1.0, 1.0);
04995       TEST_f_f (rint, 0.5, 0.0);
04996       TEST_f_f (rint, 0.0, 0.0);
04997       TEST_f_f (rint, minus_zero, minus_zero);
04998       TEST_f_f (rint, -0.5, -0.0);
04999       TEST_f_f (rint, -1.0, -1.0);
05000       TEST_f_f (rint, -1.5, -2.0);
05001       TEST_f_f (rint, -2.0, -2.0);
05002       TEST_f_f (rint, 0.1, 0.0);
05003       TEST_f_f (rint, 0.25, 0.0);
05004       TEST_f_f (rint, 0.625, 1.0);
05005       TEST_f_f (rint, -0.1, -0.0);
05006       TEST_f_f (rint, -0.25, -0.0);
05007       TEST_f_f (rint, -0.625, -1.0);
05008 #ifdef TEST_LDOUBLE
05009       /* The result can only be represented in long double.  */
05010       TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
05011       TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
05012       TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
05013       TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
05014       TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
05015 # if LDBL_MANT_DIG > 100
05016       TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
05017       TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
05018       TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
05019 # endif
05020       TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
05021       TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
05022       TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
05023       TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
05024       TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
05025 # if LDBL_MANT_DIG > 100
05026       TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
05027       TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
05028       TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
05029 
05030       TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
05031       TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
05032       TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
05033       TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
05034       TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
05035       TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
05036 
05037       TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
05038       TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
05039       TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
05040       TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
05041       TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
05042       TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
05043 # endif
05044 #endif
05045     }
05046 
05047   fesetround (save_round_mode);
05048 
05049   END (rint_tonearest);
05050 }
05051 
05052 static void
05053 rint_test_towardzero (void)
05054 {
05055   int save_round_mode;
05056   START (rint_towardzero);
05057 
05058   save_round_mode = fegetround ();
05059 
05060   if (!fesetround (FE_TOWARDZERO))
05061     {
05062       TEST_f_f (rint, 2.0, 2.0);
05063       TEST_f_f (rint, 1.5, 1.0);
05064       TEST_f_f (rint, 1.0, 1.0);
05065       TEST_f_f (rint, 0.5, 0.0);
05066       TEST_f_f (rint, 0.0, 0.0);
05067       TEST_f_f (rint, minus_zero, minus_zero);
05068       TEST_f_f (rint, -0.5, -0.0);
05069       TEST_f_f (rint, -1.0, -1.0);
05070       TEST_f_f (rint, -1.5, -1.0);
05071       TEST_f_f (rint, -2.0, -2.0);
05072       TEST_f_f (rint, 0.1, 0.0);
05073       TEST_f_f (rint, 0.25, 0.0);
05074       TEST_f_f (rint, 0.625, 0.0);
05075       TEST_f_f (rint, -0.1, -0.0);
05076       TEST_f_f (rint, -0.25, -0.0);
05077       TEST_f_f (rint, -0.625, -0.0);
05078 #ifdef TEST_LDOUBLE
05079       /* The result can only be represented in long double.  */
05080       TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
05081       TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
05082       TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
05083       TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
05084       TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
05085 # if LDBL_MANT_DIG > 100
05086       TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
05087       TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
05088       TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
05089 # endif
05090       TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
05091       TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
05092       TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
05093       TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
05094       TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
05095 # if LDBL_MANT_DIG > 100
05096       TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
05097       TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
05098       TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
05099 
05100       TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
05101       TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
05102       TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
05103       TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
05104       TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
05105       TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
05106 
05107       TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
05108       TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
05109       TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
05110       TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
05111       TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
05112       TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
05113 # endif
05114 #endif
05115     }
05116 
05117   fesetround (save_round_mode);
05118 
05119   END (rint_towardzero);
05120 }
05121 
05122 static void
05123 rint_test_downward (void)
05124 {
05125   int save_round_mode;
05126   START (rint_downward);
05127 
05128   save_round_mode = fegetround ();
05129 
05130   if (!fesetround (FE_DOWNWARD))
05131     {
05132       TEST_f_f (rint, 2.0, 2.0);
05133       TEST_f_f (rint, 1.5, 1.0);
05134       TEST_f_f (rint, 1.0, 1.0);
05135       TEST_f_f (rint, 0.5, 0.0);
05136       TEST_f_f (rint, 0.0, 0.0);
05137       TEST_f_f (rint, minus_zero, minus_zero);
05138       TEST_f_f (rint, -0.5, -1.0);
05139       TEST_f_f (rint, -1.0, -1.0);
05140       TEST_f_f (rint, -1.5, -2.0);
05141       TEST_f_f (rint, -2.0, -2.0);
05142       TEST_f_f (rint, 0.1, 0.0);
05143       TEST_f_f (rint, 0.25, 0.0);
05144       TEST_f_f (rint, 0.625, 0.0);
05145       TEST_f_f (rint, -0.1, -1.0);
05146       TEST_f_f (rint, -0.25, -1.0);
05147       TEST_f_f (rint, -0.625, -1.0);
05148 #ifdef TEST_LDOUBLE
05149       /* The result can only be represented in long double.  */
05150       TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
05151       TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
05152       TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
05153       TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
05154       TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
05155 # if LDBL_MANT_DIG > 100
05156       TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
05157       TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
05158       TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
05159 # endif
05160       TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
05161       TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
05162       TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
05163       TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
05164       TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
05165 # if LDBL_MANT_DIG > 100
05166       TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
05167       TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
05168       TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
05169 
05170       TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
05171       TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
05172       TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
05173       TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
05174       TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
05175       TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
05176 
05177       TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
05178       TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
05179       TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
05180       TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
05181       TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
05182       TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
05183 # endif
05184 #endif
05185     }
05186 
05187   fesetround (save_round_mode);
05188 
05189   END (rint_downward);
05190 }
05191 
05192 static void
05193 rint_test_upward (void)
05194 {
05195   int save_round_mode;
05196   START (rint_upward);
05197 
05198   save_round_mode = fegetround ();
05199 
05200   if (!fesetround (FE_UPWARD))
05201     {
05202       TEST_f_f (rint, 2.0, 2.0);
05203       TEST_f_f (rint, 1.5, 2.0);
05204       TEST_f_f (rint, 1.0, 1.0);
05205       TEST_f_f (rint, 0.5, 1.0);
05206       TEST_f_f (rint, 0.0, 0.0);
05207       TEST_f_f (rint, minus_zero, minus_zero);
05208       TEST_f_f (rint, -0.5, -0.0);
05209       TEST_f_f (rint, -1.0, -1.0);
05210       TEST_f_f (rint, -1.5, -1.0);
05211       TEST_f_f (rint, -2.0, -2.0);
05212       TEST_f_f (rint, 0.1, 1.0);
05213       TEST_f_f (rint, 0.25, 1.0);
05214       TEST_f_f (rint, 0.625, 1.0);
05215       TEST_f_f (rint, -0.1, -0.0);
05216       TEST_f_f (rint, -0.25, -0.0);
05217       TEST_f_f (rint, -0.625, -0.0);
05218 #ifdef TEST_LDOUBLE
05219       /* The result can only be represented in long double.  */
05220       TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
05221       TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
05222       TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
05223       TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
05224       TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
05225 # if LDBL_MANT_DIG > 100
05226       TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
05227       TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
05228       TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
05229 # endif
05230       TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
05231       TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
05232       TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
05233       TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
05234       TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
05235 # if LDBL_MANT_DIG > 100
05236       TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
05237       TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
05238       TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
05239 
05240       TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
05241       TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
05242       TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
05243       TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
05244       TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
05245       TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
05246 
05247       TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
05248       TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
05249       TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
05250       TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
05251       TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
05252       TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
05253 # endif
05254 #endif
05255     }
05256 
05257   fesetround (save_round_mode);
05258 
05259   END (rint_upward);
05260 }
05261 
05262 static void
05263 round_test (void)
05264 {
05265   START (round);
05266 
05267   TEST_f_f (round, 0, 0);
05268   TEST_f_f (round, minus_zero, minus_zero);
05269   TEST_f_f (round, 0.2L, 0.0);
05270   TEST_f_f (round, -0.2L, minus_zero);
05271   TEST_f_f (round, 0.5, 1.0);
05272   TEST_f_f (round, -0.5, -1.0);
05273   TEST_f_f (round, 0.8L, 1.0);
05274   TEST_f_f (round, -0.8L, -1.0);
05275   TEST_f_f (round, 1.5, 2.0);
05276   TEST_f_f (round, -1.5, -2.0);
05277   TEST_f_f (round, 0.1, 0.0);
05278   TEST_f_f (round, 0.25, 0.0);
05279   TEST_f_f (round, 0.625, 1.0);
05280   TEST_f_f (round, -0.1, -0.0);
05281   TEST_f_f (round, -0.25, -0.0);
05282   TEST_f_f (round, -0.625, -1.0);
05283   TEST_f_f (round, 2097152.5, 2097153);
05284   TEST_f_f (round, -2097152.5, -2097153);
05285 
05286 #ifdef TEST_LDOUBLE
05287   /* The result can only be represented in long double.  */
05288   TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
05289   TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
05290   TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
05291   TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
05292   TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
05293 # if LDBL_MANT_DIG > 100
05294   TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L);
05295   TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L);
05296   TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
05297 # endif
05298 
05299   TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
05300   TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
05301   TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
05302   TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
05303   TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
05304 # if LDBL_MANT_DIG > 100
05305   TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
05306   TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L);
05307   TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L);
05308 # endif
05309 
05310   TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
05311   TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
05312   TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
05313   TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
05314   TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
05315 
05316   TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
05317   TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
05318   TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
05319   TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
05320   TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
05321 
05322 # if LDBL_MANT_DIG > 100
05323   TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L);
05324   TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L);
05325   TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L);
05326   TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L);
05327   TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L);
05328   TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L);
05329 
05330   TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L);
05331   TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L);
05332   TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L);
05333   TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L);
05334   TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L);
05335   TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L);
05336 # endif
05337 
05338   TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
05339   TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
05340   TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
05341   TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
05342   TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
05343 
05344   TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
05345   TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
05346   TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
05347   TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
05348   TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
05349 
05350   TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
05351   TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
05352   TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
05353   TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
05354   TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
05355 #endif
05356 
05357   END (round);
05358 }
05359 
05360 
05361 static void
05362 scalb_test (void)
05363 {
05364 
05365   START (scalb);
05366 
05367   TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
05368   TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
05369 
05370   TEST_ff_f (scalb, 0, nan_value, nan_value);
05371   TEST_ff_f (scalb, 1, nan_value, nan_value);
05372 
05373   TEST_ff_f (scalb, 1, 0, 1);
05374   TEST_ff_f (scalb, -1, 0, -1);
05375 
05376   TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
05377   TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
05378 
05379   TEST_ff_f (scalb, 0, 2, 0);
05380   TEST_ff_f (scalb, minus_zero, -4, minus_zero);
05381   TEST_ff_f (scalb, 0, 0, 0);
05382   TEST_ff_f (scalb, minus_zero, 0, minus_zero);
05383   TEST_ff_f (scalb, 0, -1, 0);
05384   TEST_ff_f (scalb, minus_zero, -10, minus_zero);
05385   TEST_ff_f (scalb, 0, minus_infty, 0);
05386   TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
05387 
05388   TEST_ff_f (scalb, plus_infty, -1, plus_infty);
05389   TEST_ff_f (scalb, minus_infty, -10, minus_infty);
05390   TEST_ff_f (scalb, plus_infty, 0, plus_infty);
05391   TEST_ff_f (scalb, minus_infty, 0, minus_infty);
05392   TEST_ff_f (scalb, plus_infty, 2, plus_infty);
05393   TEST_ff_f (scalb, minus_infty, 100, minus_infty);
05394 
05395   TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
05396   TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
05397 
05398   TEST_ff_f (scalb, 1, plus_infty, plus_infty);
05399   TEST_ff_f (scalb, -1, plus_infty, minus_infty);
05400   TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
05401   TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
05402 
05403   TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
05404   TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
05405 
05406   TEST_ff_f (scalb, nan_value, 1, nan_value);
05407   TEST_ff_f (scalb, 1, nan_value, nan_value);
05408   TEST_ff_f (scalb, nan_value, 0, nan_value);
05409   TEST_ff_f (scalb, 0, nan_value, nan_value);
05410   TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
05411   TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
05412   TEST_ff_f (scalb, nan_value, nan_value, nan_value);
05413 
05414   TEST_ff_f (scalb, 0.8L, 4, 12.8L);
05415   TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
05416 
05417   END (scalb);
05418 }
05419 
05420 
05421 static void
05422 scalbn_test (void)
05423 {
05424 
05425   START (scalbn);
05426 
05427   TEST_fi_f (scalbn, 0, 0, 0);
05428   TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
05429 
05430   TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
05431   TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
05432   TEST_fi_f (scalbn, nan_value, 1, nan_value);
05433 
05434   TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
05435   TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
05436 
05437   TEST_fi_f (scalbn, 1, 0L, 1);
05438 
05439   END (scalbn);
05440 }
05441 
05442 
05443 static void
05444 scalbln_test (void)
05445 {
05446 
05447   START (scalbln);
05448 
05449   TEST_fl_f (scalbln, 0, 0, 0);
05450   TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
05451 
05452   TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
05453   TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
05454   TEST_fl_f (scalbln, nan_value, 1, nan_value);
05455 
05456   TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
05457   TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
05458 
05459   TEST_fl_f (scalbln, 1, 0L, 1);
05460 
05461   END (scalbn);
05462 }
05463 
05464 
05465 static void
05466 signbit_test (void)
05467 {
05468 
05469   START (signbit);
05470 
05471   TEST_f_b (signbit, 0, 0);
05472   TEST_f_b (signbit, minus_zero, 1);
05473   TEST_f_b (signbit, plus_infty, 0);
05474   TEST_f_b (signbit, minus_infty, 1);
05475 
05476   /* signbit (x) != 0 for x < 0.  */
05477   TEST_f_b (signbit, -1, 1);
05478   /* signbit (x) == 0 for x >= 0.  */
05479   TEST_f_b (signbit, 1, 0);
05480 
05481   END (signbit);
05482 }
05483 
05484 
05485 static void
05486 sin_test (void)
05487 {
05488   errno = 0;
05489   FUNC(sin) (0);
05490   if (errno == ENOSYS)
05491     /* Function not implemented.  */
05492     return;
05493 
05494   START (sin);
05495 
05496   TEST_f_f (sin, 0, 0);
05497   TEST_f_f (sin, minus_zero, minus_zero);
05498   TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
05499   TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
05500   TEST_f_f (sin, nan_value, nan_value);
05501 
05502   TEST_f_f (sin, M_PI_6l, 0.5);
05503   TEST_f_f (sin, -M_PI_6l, -0.5);
05504   TEST_f_f (sin, M_PI_2l, 1);
05505   TEST_f_f (sin, -M_PI_2l, -1);
05506   TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
05507 
05508 #ifdef TEST_DOUBLE
05509   TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
05510 #endif
05511 
05512   END (sin);
05513 
05514 }
05515 
05516 
05517 static void
05518 sincos_test (void)
05519 {
05520   FLOAT sin_res, cos_res;
05521 
05522   errno = 0;
05523   FUNC(sincos) (0, &sin_res, &cos_res);
05524   if (errno == ENOSYS)
05525     /* Function not implemented.  */
05526     return;
05527 
05528   START (sincos);
05529 
05530   /* sincos is treated differently because it returns void.  */
05531   TEST_extra (sincos, 0, 0, 1);
05532 
05533   TEST_extra (sincos, minus_zero, minus_zero, 1);
05534   TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
05535   TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
05536   TEST_extra (sincos, nan_value, nan_value, nan_value);
05537 
05538   TEST_extra (sincos, M_PI_2l, 1, 0);
05539   TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
05540   TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
05541   TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
05542 
05543 #ifdef TEST_DOUBLE
05544   TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
05545 #endif
05546 
05547   END (sincos);
05548 }
05549 
05550 static void
05551 sinh_test (void)
05552 {
05553   errno = 0;
05554   FUNC(sinh) (0.7L);
05555   if (errno == ENOSYS)
05556     /* Function not implemented.  */
05557     return;
05558 
05559   START (sinh);
05560   TEST_f_f (sinh, 0, 0);
05561   TEST_f_f (sinh, minus_zero, minus_zero);
05562 
05563 #ifndef TEST_INLINE
05564   TEST_f_f (sinh, plus_infty, plus_infty);
05565   TEST_f_f (sinh, minus_infty, minus_infty);
05566 #endif
05567   TEST_f_f (sinh, nan_value, nan_value);
05568 
05569   TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
05570   TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
05571 
05572   END (sinh);
05573 }
05574 
05575 static void
05576 sqrt_test (void)
05577 {
05578   errno = 0;
05579   FUNC(sqrt) (1);
05580   if (errno == ENOSYS)
05581     /* Function not implemented.  */
05582     return;
05583 
05584   START (sqrt);
05585 
05586   TEST_f_f (sqrt, 0, 0);
05587   TEST_f_f (sqrt, nan_value, nan_value);
05588   TEST_f_f (sqrt, plus_infty, plus_infty);
05589 
05590   TEST_f_f (sqrt, minus_zero, minus_zero);
05591 
05592   /* sqrt (x) == NaN plus invalid exception for x < 0.  */
05593   TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
05594   TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
05595   TEST_f_f (sqrt, nan_value, nan_value);
05596 
05597   TEST_f_f (sqrt, 2209, 47);
05598   TEST_f_f (sqrt, 4, 2);
05599   TEST_f_f (sqrt, 2, M_SQRT2l);
05600   TEST_f_f (sqrt, 0.25, 0.5);
05601   TEST_f_f (sqrt, 6642.25, 81.5);
05602   TEST_f_f (sqrt, 15190.5625L, 123.25L);
05603   TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
05604 
05605   END (sqrt);
05606 }
05607 
05608 
05609 static void
05610 tan_test (void)
05611 {
05612   errno = 0;
05613   FUNC(tan) (0);
05614   if (errno == ENOSYS)
05615     /* Function not implemented.  */
05616     return;
05617 
05618   START (tan);
05619 
05620   TEST_f_f (tan, 0, 0);
05621   TEST_f_f (tan, minus_zero, minus_zero);
05622   TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
05623   TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
05624   TEST_f_f (tan, nan_value, nan_value);
05625 
05626   TEST_f_f (tan, M_PI_4l, 1);
05627   TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
05628 
05629   END (tan);
05630 }
05631 
05632 static void
05633 tanh_test (void)
05634 {
05635   errno = 0;
05636   FUNC(tanh) (0.7L);
05637   if (errno == ENOSYS)
05638     /* Function not implemented.  */
05639     return;
05640 
05641   START (tanh);
05642 
05643   TEST_f_f (tanh, 0, 0);
05644   TEST_f_f (tanh, minus_zero, minus_zero);
05645 
05646 #ifndef TEST_INLINE
05647   TEST_f_f (tanh, plus_infty, 1);
05648   TEST_f_f (tanh, minus_infty, -1);
05649 #endif
05650   TEST_f_f (tanh, nan_value, nan_value);
05651 
05652   TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
05653   TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
05654 
05655   TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
05656   TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
05657 
05658   /* 2^-57  */
05659   TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
05660 
05661   END (tanh);
05662 }
05663 
05664 static void
05665 tgamma_test (void)
05666 {
05667   errno = 0;
05668   FUNC(tgamma) (1);
05669   if (errno == ENOSYS)
05670     /* Function not implemented.  */
05671     return;
05672   feclearexcept (FE_ALL_EXCEPT);
05673 
05674   START (tgamma);
05675 
05676   TEST_f_f (tgamma, plus_infty, plus_infty);
05677   TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
05678   TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
05679   /* tgamma (x) == NaN plus invalid exception for integer x <= 0.  */
05680   TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
05681   TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
05682   TEST_f_f (tgamma, nan_value, nan_value);
05683 
05684   TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
05685   TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
05686 
05687   TEST_f_f (tgamma, 1, 1);
05688   TEST_f_f (tgamma, 4, 6);
05689 
05690   TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
05691   TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
05692 
05693   END (tgamma);
05694 }
05695 
05696 
05697 static void
05698 trunc_test (void)
05699 {
05700   START (trunc);
05701 
05702   TEST_f_f (trunc, plus_infty, plus_infty);
05703   TEST_f_f (trunc, minus_infty, minus_infty);
05704   TEST_f_f (trunc, nan_value, nan_value);
05705 
05706   TEST_f_f (trunc, 0, 0);
05707   TEST_f_f (trunc, minus_zero, minus_zero);
05708   TEST_f_f (trunc, 0.1, 0);
05709   TEST_f_f (trunc, 0.25, 0);
05710   TEST_f_f (trunc, 0.625, 0);
05711   TEST_f_f (trunc, -0.1, minus_zero);
05712   TEST_f_f (trunc, -0.25, minus_zero);
05713   TEST_f_f (trunc, -0.625, minus_zero);
05714   TEST_f_f (trunc, 1, 1);
05715   TEST_f_f (trunc, -1, -1);
05716   TEST_f_f (trunc, 1.625, 1);
05717   TEST_f_f (trunc, -1.625, -1);
05718 
05719   TEST_f_f (trunc, 1048580.625L, 1048580L);
05720   TEST_f_f (trunc, -1048580.625L, -1048580L);
05721 
05722   TEST_f_f (trunc, 8388610.125L, 8388610.0L);
05723   TEST_f_f (trunc, -8388610.125L, -8388610.0L);
05724 
05725   TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
05726   TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
05727 
05728 #ifdef TEST_LDOUBLE
05729   /* The result can only be represented in long double.  */
05730   TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
05731   TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
05732   TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
05733   TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
05734   TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
05735 
05736 # if LDBL_MANT_DIG > 100
05737   TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L);
05738   TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
05739   TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
05740 # endif
05741 
05742   TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
05743   TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
05744   TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
05745   TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
05746   TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
05747 
05748 # if LDBL_MANT_DIG > 100
05749   TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
05750   TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
05751   TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L);
05752 # endif
05753 
05754   TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
05755   TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
05756   TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
05757   TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
05758   TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
05759 
05760 # if LDBL_MANT_DIG > 100
05761   TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L);
05762   TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L);
05763   TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L);
05764   TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L);
05765   TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L);
05766   TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L);
05767 # endif
05768 
05769   TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
05770   TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
05771   TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
05772   TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
05773   TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
05774 
05775 # if LDBL_MANT_DIG > 100
05776   TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L);
05777   TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L);
05778   TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L);
05779   TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L);
05780   TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L);
05781   TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L);
05782 # endif
05783 
05784   TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
05785   TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
05786   TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
05787   TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
05788   TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
05789 
05790   TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
05791   TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
05792   TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
05793   TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
05794   TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
05795 
05796   TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
05797   TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
05798   TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
05799   TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
05800   TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
05801 #endif
05802 
05803   END (trunc);
05804 }
05805 
05806 static void
05807 y0_test (void)
05808 {
05809   FLOAT s, c;
05810   errno = 0;
05811   FUNC (sincos) (0, &s, &c);
05812   if (errno == ENOSYS)
05813     /* Required function not implemented.  */
05814     return;
05815   FUNC(y0) (1);
05816   if (errno == ENOSYS)
05817     /* Function not implemented.  */
05818     return;
05819 
05820   /* y0 is the Bessel function of the second kind of order 0 */
05821   START (y0);
05822 
05823   TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
05824   TEST_f_f (y0, 0.0, minus_infty);
05825   TEST_f_f (y0, nan_value, nan_value);
05826   TEST_f_f (y0, plus_infty, 0);
05827 
05828   TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
05829   TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
05830   TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
05831   TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
05832   TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
05833   TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
05834   TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
05835 
05836   END (y0);
05837 }
05838 
05839 
05840 static void
05841 y1_test (void)
05842 {
05843   FLOAT s, c;
05844   errno = 0;
05845   FUNC (sincos) (0, &s, &c);
05846   if (errno == ENOSYS)
05847     /* Required function not implemented.  */
05848     return;
05849   FUNC(y1) (1);
05850   if (errno == ENOSYS)
05851     /* Function not implemented.  */
05852     return;
05853 
05854   /* y1 is the Bessel function of the second kind of order 1 */
05855   START (y1);
05856 
05857   TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
05858   TEST_f_f (y1, 0.0, minus_infty);
05859   TEST_f_f (y1, plus_infty, 0);
05860   TEST_f_f (y1, nan_value, nan_value);
05861 
05862   TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
05863   TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
05864   TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
05865   TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
05866   TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
05867   TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
05868   TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
05869 
05870   END (y1);
05871 }
05872 
05873 
05874 static void
05875 yn_test (void)
05876 {
05877   FLOAT s, c;
05878   errno = 0;
05879   FUNC (sincos) (0, &s, &c);
05880   if (errno == ENOSYS)
05881     /* Required function not implemented.  */
05882     return;
05883   FUNC(yn) (1, 1);
05884   if (errno == ENOSYS)
05885     /* Function not implemented.  */
05886     return;
05887 
05888   /* yn is the Bessel function of the second kind of order n */
05889   START (yn);
05890 
05891   /* yn (0, x) == y0 (x)  */
05892   TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
05893   TEST_ff_f (yn, 0, 0.0, minus_infty);
05894   TEST_ff_f (yn, 0, nan_value, nan_value);
05895   TEST_ff_f (yn, 0, plus_infty, 0);
05896 
05897   TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
05898   TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
05899   TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
05900   TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
05901   TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
05902   TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
05903   TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
05904 
05905   /* yn (1, x) == y1 (x)  */
05906   TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
05907   TEST_ff_f (yn, 1, 0.0, minus_infty);
05908   TEST_ff_f (yn, 1, plus_infty, 0);
05909   TEST_ff_f (yn, 1, nan_value, nan_value);
05910 
05911   TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
05912   TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
05913   TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
05914   TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
05915   TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
05916   TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
05917   TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
05918 
05919   /* yn (3, x)  */
05920   TEST_ff_f (yn, 3, plus_infty, 0);
05921   TEST_ff_f (yn, 3, nan_value, nan_value);
05922 
05923   TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
05924   TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
05925   TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
05926   TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
05927   TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
05928 
05929   /* yn (10, x)  */
05930   TEST_ff_f (yn, 10, plus_infty, 0);
05931   TEST_ff_f (yn, 10, nan_value, nan_value);
05932 
05933   TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
05934   TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
05935   TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
05936   TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
05937   TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
05938 
05939   END (yn);
05940 
05941 }
05942 
05943 
05944 static void
05945 significand_test (void)
05946 {
05947   /* significand returns the mantissa of the exponential representation.  */
05948   START (significand);
05949 
05950   TEST_f_f (significand, 4.0, 1.0);
05951   TEST_f_f (significand, 6.0, 1.5);
05952   TEST_f_f (significand, 8.0, 1.0);
05953 
05954   END (significand);
05955 }
05956 
05957 
05958 static void
05959 initialize (void)
05960 {
05961   fpstack_test ("start *init*");
05962   plus_zero = 0.0;
05963   nan_value = plus_zero / plus_zero;      /* Suppress GCC warning */
05964 
05965   minus_zero = FUNC(copysign) (0.0, -1.0);
05966   plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
05967                      HUGE_VALL, HUGE_VAL, HUGE_VALF);
05968   minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
05969                      -HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
05970   max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
05971                     LDBL_MAX, DBL_MAX, FLT_MAX);
05972   min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
05973                     LDBL_MIN, DBL_MIN, FLT_MIN);
05974 
05975   (void) &plus_zero;
05976   (void) &nan_value;
05977   (void) &minus_zero;
05978   (void) &plus_infty;
05979   (void) &minus_infty;
05980   (void) &max_value;
05981   (void) &min_value;
05982 
05983   /* Clear all exceptions.  From now on we must not get random exceptions.  */
05984   feclearexcept (FE_ALL_EXCEPT);
05985 
05986   /* Test to make sure we start correctly.  */
05987   fpstack_test ("end *init*");
05988 }
05989 
05990 /* Definitions of arguments for argp functions.  */
05991 static const struct argp_option options[] =
05992 {
05993   { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
05994   { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
05995   { "no-max-error", 'f', NULL, 0,
05996     "Don't output maximal errors of functions"},
05997   { "no-points", 'p', NULL, 0,
05998     "Don't output results of functions invocations"},
05999   { "ignore-max-ulp", 'i', "yes/no", 0,
06000     "Ignore given maximal errors"},
06001   { NULL, 0, NULL, 0, NULL }
06002 };
06003 
06004 /* Short description of program.  */
06005 static const char doc[] = "Math test suite: " TEST_MSG ;
06006 
06007 /* Prototype for option handler.  */
06008 static error_t parse_opt (int key, char *arg, struct argp_state *state);
06009 
06010 /* Data structure to communicate with argp functions.  */
06011 static struct argp argp =
06012 {
06013   options, parse_opt, NULL, doc,
06014 };
06015 
06016 
06017 /* Handle program arguments.  */
06018 static error_t
06019 parse_opt (int key, char *arg, struct argp_state *state)
06020 {
06021   switch (key)
06022     {
06023     case 'f':
06024       output_max_error = 0;
06025       break;
06026     case 'i':
06027       if (strcmp (arg, "yes") == 0)
06028        ignore_max_ulp = 1;
06029       else if (strcmp (arg, "no") == 0)
06030        ignore_max_ulp = 0;
06031       break;
06032     case 'p':
06033       output_points = 0;
06034       break;
06035     case 'u':
06036       output_ulps = 1;
06037       break;
06038     case 'v':
06039       if (optarg)
06040        verbose = (unsigned int) strtoul (optarg, NULL, 0);
06041       else
06042        verbose = 3;
06043       break;
06044     default:
06045       return ARGP_ERR_UNKNOWN;
06046     }
06047   return 0;
06048 }
06049 
06050 #if 0
06051 /* function to check our ulp calculation.  */
06052 void
06053 check_ulp (void)
06054 {
06055   int i;
06056 
06057   FLOAT u, diff, ulp;
06058   /* This gives one ulp.  */
06059   u = FUNC(nextafter) (10, 20);
06060   check_equal (10.0, u, 1, &diff, &ulp);
06061   printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
06062 
06063   /* This gives one more ulp.  */
06064   u = FUNC(nextafter) (u, 20);
06065   check_equal (10.0, u, 2, &diff, &ulp);
06066   printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
06067 
06068   /* And now calculate 100 ulp.  */
06069   for (i = 2; i < 100; i++)
06070     u = FUNC(nextafter) (u, 20);
06071   check_equal (10.0, u, 100, &diff, &ulp);
06072   printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
06073 }
06074 #endif
06075 
06076 int
06077 main (int argc, char **argv)
06078 {
06079 
06080   int remaining;
06081 
06082   verbose = 1;
06083   output_ulps = 0;
06084   output_max_error = 1;
06085   output_points = 1;
06086   /* XXX set to 0 for releases.  */
06087   ignore_max_ulp = 0;
06088 
06089   /* Parse and process arguments.  */
06090   argp_parse (&argp, argc, argv, 0, &remaining, NULL);
06091 
06092   if (remaining != argc)
06093     {
06094       fprintf (stderr, "wrong number of arguments");
06095       argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
06096       exit (EXIT_FAILURE);
06097     }
06098 
06099   if (output_ulps)
06100     {
06101       ulps_file = fopen ("ULPs", "a");
06102       if (ulps_file == NULL)
06103        {
06104          perror ("can't open file `ULPs' for writing: ");
06105          exit (1);
06106        }
06107     }
06108 
06109 
06110   initialize ();
06111   printf (TEST_MSG);
06112 
06113 #if 0
06114   check_ulp ();
06115 #endif
06116 
06117   /* Keep the tests a wee bit ordered (according to ISO C99).  */
06118   /* Classification macros:  */
06119   fpclassify_test ();
06120   isfinite_test ();
06121   isnormal_test ();
06122   signbit_test ();
06123 
06124   /* Trigonometric functions:  */
06125   acos_test ();
06126   asin_test ();
06127   atan_test ();
06128   atan2_test ();
06129   cos_test ();
06130   sin_test ();
06131   sincos_test ();
06132   tan_test ();
06133 
06134   /* Hyperbolic functions:  */
06135   acosh_test ();
06136   asinh_test ();
06137   atanh_test ();
06138   cosh_test ();
06139   sinh_test ();
06140   tanh_test ();
06141 
06142   /* Exponential and logarithmic functions:  */
06143   exp_test ();
06144   exp10_test ();
06145   exp2_test ();
06146   expm1_test ();
06147   frexp_test ();
06148   ldexp_test ();
06149   log_test ();
06150   log10_test ();
06151   log1p_test ();
06152   log2_test ();
06153   logb_test ();
06154   modf_test ();
06155   ilogb_test ();
06156   scalb_test ();
06157   scalbn_test ();
06158   scalbln_test ();
06159   significand_test ();
06160 
06161   /* Power and absolute value functions:  */
06162   cbrt_test ();
06163   fabs_test ();
06164   hypot_test ();
06165   pow_test ();
06166   sqrt_test ();
06167 
06168   /* Error and gamma functions:  */
06169   erf_test ();
06170   erfc_test ();
06171   gamma_test ();
06172   lgamma_test ();
06173   tgamma_test ();
06174 
06175   /* Nearest integer functions:  */
06176   ceil_test ();
06177   floor_test ();
06178   nearbyint_test ();
06179   rint_test ();
06180   rint_test_tonearest ();
06181   rint_test_towardzero ();
06182   rint_test_downward ();
06183   rint_test_upward ();
06184   lrint_test ();
06185   lrint_test_tonearest ();
06186   lrint_test_towardzero ();
06187   lrint_test_downward ();
06188   lrint_test_upward ();
06189   llrint_test ();
06190   llrint_test_tonearest ();
06191   llrint_test_towardzero ();
06192   llrint_test_downward ();
06193   llrint_test_upward ();
06194   round_test ();
06195   lround_test ();
06196   llround_test ();
06197   trunc_test ();
06198 
06199   /* Remainder functions:  */
06200   fmod_test ();
06201   remainder_test ();
06202   remquo_test ();
06203 
06204   /* Manipulation functions:  */
06205   copysign_test ();
06206   nextafter_test ();
06207   nexttoward_test ();
06208 
06209   /* maximum, minimum and positive difference functions */
06210   fdim_test ();
06211   fmax_test ();
06212   fmin_test ();
06213 
06214   /* Multiply and add:  */
06215   fma_test ();
06216 
06217   /* Complex functions:  */
06218   cabs_test ();
06219   cacos_test ();
06220   cacosh_test ();
06221   carg_test ();
06222   casin_test ();
06223   casinh_test ();
06224   catan_test ();
06225   catanh_test ();
06226   ccos_test ();
06227   ccosh_test ();
06228   cexp_test ();
06229   cimag_test ();
06230   clog10_test ();
06231   clog_test ();
06232   conj_test ();
06233   cpow_test ();
06234   cproj_test ();
06235   creal_test ();
06236   csin_test ();
06237   csinh_test ();
06238   csqrt_test ();
06239   ctan_test ();
06240   ctanh_test ();
06241 
06242   /* Bessel functions:  */
06243   j0_test ();
06244   j1_test ();
06245   jn_test ();
06246   y0_test ();
06247   y1_test ();
06248   yn_test ();
06249 
06250   if (output_ulps)
06251     fclose (ulps_file);
06252 
06253   printf ("\nTest suite completed:\n");
06254   printf ("  %d test cases plus %d tests for exception flags executed.\n",
06255          noTests, noExcTests);
06256   if (noXFails)
06257     printf ("  %d expected failures occurred.\n", noXFails);
06258   if (noXPasses)
06259     printf ("  %d unexpected passes occurred.\n", noXPasses);
06260   if (noErrors)
06261     {
06262       printf ("  %d errors occurred.\n", noErrors);
06263       return 1;
06264     }
06265   printf ("  All tests passed successfully.\n");
06266 
06267   return 0;
06268 }
06269 
06270 /*
06271  * Local Variables:
06272  * mode:c
06273  * End:
06274  */