xref: /relibc/openlibm/test/libm-test.c (revision b5245817743e08d84f68f0e88cfa26bef8d9504b)
1 /* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19 
20 /* Part of testsuite for libm.
21 
22    This file is processed by a perl script.  The resulting file has to
23    be included by a master file that defines:
24 
25    Makros:
26    FUNC(function): converts general function name (like cos) to
27    name with correct suffix (e.g. cosl or cosf)
28    MATHCONST(x):   like FUNC but for constants (e.g convert 0.0 to 0.0L)
29    FLOAT:	   floating point type to test
30    - TEST_MSG:	   informal message to be displayed
31    CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
32    chooses one of the parameters as delta for testing
33    equality
34    PRINTF_EXPR	   Floating point conversion specification to print a variable
35    of type FLOAT with printf.  PRINTF_EXPR just contains
36    the specifier, not the percent and width arguments,
37    e.g. "f".
38    PRINTF_XEXPR	   Like PRINTF_EXPR, but print in hexadecimal format.
39    PRINTF_NEXPR Like PRINTF_EXPR, but print nice.  */
40 
41 /* This testsuite has currently tests for:
42    acos, acosh, asin, asinh, atan, atan2, atanh,
43    cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
44    fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
45    frexp, gamma, hypot,
46    ilogb, isfinite, isinf, isnan, isnormal,
47    isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
48    j0, j1, jn,
49    ldexp, lgamma, log, log10, log1p, log2, logb,
50    modf, nearbyint, nextafter,
51    pow, remainder, remquo, rint, lrint, llrint,
52    round, lround, llround,
53    scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
54    y0, y1, yn
55 
56    and for the following complex math functions:
57    cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
58    ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
59 
60    At the moment the following functions aren't tested:
61    drem, significand, nan
62 
63    Parameter handling is primitive in the moment:
64    --verbose=[0..3] for different levels of output:
65    0: only error count
66    1: basic report on failed tests (default)
67    2: full report on all tests
68    -v for full output (equals --verbose=3)
69    -u for generation of an ULPs file
70  */
71 
72 /* "Philosophy":
73 
74    This suite tests some aspects of the correct implementation of
75    mathematical functions in libm.  Some simple, specific parameters
76    are tested for correctness but there's no exhaustive
77    testing.  Handling of specific inputs (e.g. infinity, not-a-number)
78    is also tested.  Correct handling of exceptions is checked
79    against.  These implemented tests should check all cases that are
80    specified in ISO C99.
81 
82    Exception testing: At the moment only divide-by-zero and invalid
83    exceptions are tested.  Overflow/underflow and inexact exceptions
84    aren't checked at the moment.
85 
86    NaN values: There exist signalling and quiet NaNs.  This implementation
87    only uses signalling NaN as parameter but does not differenciate
88    between the two kinds of NaNs as result.
89 
90    Inline functions: Inlining functions should give an improvement in
91    speed - but not in precission.  The inlined functions return
92    reasonable values for a reasonable range of input values.  The
93    result is not necessarily correct for all values and exceptions are
94    not correctly raised in all cases.  Problematic input and return
95    values are infinity, not-a-number and minus zero.  This suite
96    therefore does not check these specific inputs and the exception
97    handling for inlined mathematical functions - just the "reasonable"
98    values are checked.
99 
100    Beware: The tests might fail for any of the following reasons:
101    - Tests are wrong
102    - Functions are wrong
103    - Floating Point Unit not working properly
104    - Compiler has errors
105 
106    With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
107 
108 
109    To Do: All parameter should be numbers that can be represented as
110    exact floating point values.  Currently some values cannot be represented
111    exactly and therefore the result is not the expected result.
112 */
113 
114 #ifndef _GNU_SOURCE
115 # define _GNU_SOURCE
116 #endif
117 
118 #include "libm-test-ulps.h"
119 #include <float.h>
120 #ifdef SYS_MATH_H
121 #include <math.h>
122 #include <fenv.h>
123 #else
124 #include <openlibm.h>
125 #endif
126 
127 #if 0 /* XXX scp XXX */
128 #define FE_INEXACT FE_INEXACT
129 #define FE_DIVBYZERO FE_DIVBYZERO
130 #define FE_UNDERFLOW FE_UNDERFLOW
131 #define FE_OVERFLOW FE_OVERFLOW
132 #define FE_INVALID FE_INVALID
133 #endif
134 
135 #include <limits.h>
136 
137 #include <errno.h>
138 #include <stdlib.h>
139 #include <stdio.h>
140 #include <string.h>
141 #if 0 /* XXX scp XXX */
142 #include <argp.h>
143 #endif
144 
145 // Some native libm implementations don't have sincos defined, so we have to do it ourselves
146 void FUNC(sincos) (FLOAT x, FLOAT * s, FLOAT * c);
147 
148 #ifdef __APPLE__
149 #ifdef SYS_MATH_H
150 void sincos(FLOAT x, FLOAT * s, FLOAT * c)
151 {
152     *s = sin(x);
153     *c = cos(x);
154 }
155 #endif
156 #endif
157 
158 /* Possible exceptions */
159 #define NO_EXCEPTION			0x0
160 #define INVALID_EXCEPTION		0x1
161 #define DIVIDE_BY_ZERO_EXCEPTION	0x2
162 /* The next flags signals that those exceptions are allowed but not required.   */
163 #define INVALID_EXCEPTION_OK		0x4
164 #define DIVIDE_BY_ZERO_EXCEPTION_OK	0x8
165 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
166 /* Some special test flags, passed togther with exceptions.  */
167 #define IGNORE_ZERO_INF_SIGN		0x10
168 
169 /* Various constants (we must supply them precalculated for accuracy).  */
170 #define M_PI_6l			.52359877559829887307710723054658383L
171 #define M_E2l			7.389056098930650227230427460575008L
172 #define M_E3l			20.085536923187667740928529654581719L
173 #define M_2_SQRT_PIl		3.5449077018110320545963349666822903L	/* 2 sqrt (M_PIl)  */
174 #define M_SQRT_PIl		1.7724538509055160272981674833411451L	/* sqrt (M_PIl)  */
175 #define M_LOG_SQRT_PIl		0.57236494292470008707171367567652933L	/* log(sqrt(M_PIl))  */
176 #define M_LOG_2_SQRT_PIl	1.265512123484645396488945797134706L	/* log(2*sqrt(M_PIl))  */
177 #define M_PI_34l		(M_PIl - M_PI_4l)		/* 3*pi/4 */
178 #define M_PI_34_LOG10El		(M_PIl - M_PI_4l) * M_LOG10El
179 #define M_PI2_LOG10El		M_PI_2l * M_LOG10El
180 #define M_PI4_LOG10El		M_PI_4l * M_LOG10El
181 #define M_PI_LOG10El		M_PIl * M_LOG10El
182 
183 #if 1 /* XXX scp XXX */
184 # define M_El		2.7182818284590452353602874713526625L  /* e */
185 # define M_LOG2El	1.4426950408889634073599246810018922L  /* log_2 e */
186 # define M_LOG10El	0.4342944819032518276511289189166051L  /* log_10 e */
187 # define M_LN2l		0.6931471805599453094172321214581766L  /* log_e 2 */
188 # define M_LN10l	2.3025850929940456840179914546843642L  /* log_e 10 */
189 # define M_PIl		3.1415926535897932384626433832795029L  /* pi */
190 # define M_PI_2l	1.5707963267948966192313216916397514L  /* pi/2 */
191 # define M_PI_4l	0.7853981633974483096156608458198757L  /* pi/4 */
192 # define M_1_PIl	0.3183098861837906715377675267450287L  /* 1/pi */
193 # define M_2_PIl	0.6366197723675813430755350534900574L  /* 2/pi */
194 # define M_2_SQRTPIl	1.1283791670955125738961589031215452L  /* 2/sqrt(pi) */
195 # define M_SQRT2l	1.4142135623730950488016887242096981L  /* sqrt(2) */
196 # define M_SQRT1_2l	0.7071067811865475244008443621048490L  /* 1/sqrt(2) */
197 #endif
198 
199 static FILE *ulps_file;	/* File to document difference.  */
200 static int output_ulps;	/* Should ulps printed?  */
201 
202 static int noErrors;	/* number of errors */
203 static int noTests;	/* number of tests (without testing exceptions) */
204 static int noExcTests;	/* number of tests for exception flags */
205 static int noXFails;	/* number of expected failures.  */
206 static int noXPasses;	/* number of unexpected passes.  */
207 
208 static int verbose;
209 static int output_max_error;	/* Should the maximal errors printed?  */
210 static int output_points;	/* Should the single function results printed?  */
211 static int ignore_max_ulp;	/* Should we ignore max_ulp?  */
212 
213 static FLOAT minus_zero, plus_zero;
214 static FLOAT plus_infty, minus_infty, nan_value;
215 
216 static FLOAT max_error, real_max_error, imag_max_error;
217 
218 
219 #if 0 /* XXX scp XXX */
220 #define BUILD_COMPLEX(real, imag) \
221   ({ __complex__ FLOAT __retval;					      \
222      __real__ __retval = (real);					      \
223      __imag__ __retval = (imag);					      \
224      __retval; })
225 
226 #define BUILD_COMPLEX_INT(real, imag) \
227   ({ __complex__ int __retval;						      \
228      __real__ __retval = (real);					      \
229      __imag__ __retval = (imag);					      \
230      __retval; })
231 #endif
232 
233 
234 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
235                          (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
236 
237 
238 static void
239 init_max_error (void)
240 {
241   max_error = 0;
242   real_max_error = 0;
243   imag_max_error = 0;
244   feclearexcept (FE_ALL_EXCEPT);
245 }
246 
247 static void
248 set_max_error (FLOAT current, FLOAT *curr_max_error)
249 {
250   if (current > *curr_max_error)
251     *curr_max_error = current;
252 }
253 
254 
255 /* Should the message print to screen?  This depends on the verbose flag,
256    and the test status.  */
257 static int
258 print_screen (int ok, int xfail)
259 {
260   if (output_points
261       && (verbose > 1
262 	  || (verbose == 1 && ok == xfail)))
263     return 1;
264   return 0;
265 }
266 
267 
268 /* Should the message print to screen?  This depends on the verbose flag,
269    and the test status.  */
270 static int
271 print_screen_max_error (int ok, int xfail)
272 {
273   if (output_max_error
274       && (verbose > 1
275 	  || ((verbose == 1) && (ok == xfail))))
276     return 1;
277   return 0;
278 }
279 
280 /* Update statistic counters.  */
281 static void
282 update_stats (int ok, int xfail)
283 {
284   ++noTests;
285   if (ok && xfail)
286     ++noXPasses;
287   else if (!ok && xfail)
288     ++noXFails;
289   else if (!ok && !xfail)
290     ++noErrors;
291 }
292 
293 static void
294 print_ulps (const char *test_name, FLOAT ulp)
295 {
296   if (output_ulps)
297     {
298       fprintf (ulps_file, "Test \"%s\":\n", test_name);
299       fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
300 	       CHOOSE("ldouble", "double", "float",
301 		      "ildouble", "idouble", "ifloat"), ulp);
302     }
303 }
304 
305 static void
306 print_function_ulps (const char *function_name, FLOAT ulp)
307 {
308   if (output_ulps)
309     {
310       fprintf (ulps_file, "Function: \"%s\":\n", function_name);
311       fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
312 	       CHOOSE("ldouble", "double", "float",
313 		      "ildouble", "idouble", "ifloat"), ulp);
314     }
315 }
316 
317 
318 #if 0 /* XXX scp XXX */
319 static void
320 print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
321 			     FLOAT imag_ulp)
322 {
323   if (output_ulps)
324     {
325       if (real_ulp != 0.0)
326 	{
327 	  fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
328 	  fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
329 		   CHOOSE("ldouble", "double", "float",
330 			  "ildouble", "idouble", "ifloat"), real_ulp);
331 	}
332       if (imag_ulp != 0.0)
333 	{
334 	  fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
335 	  fprintf (ulps_file, "%s: % .4" PRINTF_NEXPR "\n",
336 		   CHOOSE("ldouble", "double", "float",
337 			  "ildouble", "idouble", "ifloat"), imag_ulp);
338 	}
339 
340 
341     }
342 }
343 #endif
344 
345 
346 static void
347 print_max_error (const char *func_name, FLOAT allowed, int xfail)
348 {
349   int ok = 0;
350 
351   if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
352     {
353       ok = 1;
354     }
355 
356   if (!ok)
357     print_function_ulps (func_name, max_error);
358 
359 
360   if (print_screen_max_error (ok, xfail))
361     {
362       printf ("Maximal error of `%s'\n", func_name);
363       printf (" is      : % .4" PRINTF_NEXPR " ulp\n", max_error);
364       printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", allowed);
365     }
366 
367   update_stats (ok, xfail);
368 }
369 
370 
371 #if 0 /* XXX scp XXX */
372 static void
373 print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
374 			 __complex__ int xfail)
375 {
376   int ok = 0;
377 
378   if ((real_max_error <= __real__ allowed)
379       && (imag_max_error <= __imag__ allowed))
380     {
381       ok = 1;
382     }
383 
384   if (!ok)
385     print_complex_function_ulps (func_name, real_max_error, imag_max_error);
386 
387 
388   if (print_screen_max_error (ok, xfail))
389     {
390       printf ("Maximal error of real part of: %s\n", func_name);
391       printf (" is      : % .4" PRINTF_NEXPR " ulp\n", real_max_error);
392       printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __real__ allowed);
393       printf ("Maximal error of imaginary part of: %s\n", func_name);
394       printf (" is      : % .4" PRINTF_NEXPR " ulp\n", imag_max_error);
395       printf (" accepted: % .4" PRINTF_NEXPR " ulp\n", __imag__ allowed);
396     }
397 
398   update_stats (ok, xfail);
399 }
400 #endif
401 
402 
403 /* Test whether a given exception was raised.  */
404 static void
405 test_single_exception (const char *test_name,
406 		       int exception,
407 		       int exc_flag,
408 		       int fe_flag,
409 		       const char *flag_name)
410 {
411 /* Don't perform these checks if we're compiling with clang, because clang
412    doesn't bother to set floating-point exceptions properly */
413 #ifndef __clang__
414 #ifndef TEST_INLINE
415   int ok = 1;
416   if (exception & exc_flag)
417     {
418       if (fetestexcept (fe_flag))
419 	{
420 	  if (print_screen (1, 0))
421 	    printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
422 	}
423       else
424 	{
425 	  ok = 0;
426 	  if (print_screen (0, 0))
427 	    printf ("Failure: %s: Exception \"%s\" not set\n",
428 		    test_name, flag_name);
429 	}
430     }
431   else
432     {
433       if (fetestexcept (fe_flag))
434 	{
435 	  ok = 0;
436 	  if (print_screen (0, 0))
437 	    printf ("Failure: %s: Exception \"%s\" set\n",
438 		    test_name, flag_name);
439 	}
440       else
441 	{
442 	  if (print_screen (1, 0))
443 	    printf ("%s: Exception \"%s\" not set\n", test_name,
444 		    flag_name);
445 	}
446     }
447   if (!ok)
448     ++noErrors;
449 
450 #endif
451 #endif // __clang__
452 }
453 
454 
455 /* Test whether exceptions given by EXCEPTION are raised.  Ignore thereby
456    allowed but not required exceptions.
457 */
458 static void
459 test_exceptions (const char *test_name, int exception)
460 {
461   ++noExcTests;
462 #ifdef FE_DIVBYZERO
463   if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
464     test_single_exception (test_name, exception,
465 			   DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
466 			   "Divide by zero");
467 #endif
468 #ifdef FE_INVALID
469   if ((exception & INVALID_EXCEPTION_OK) == 0)
470     test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
471 			 "Invalid operation");
472 #endif
473   feclearexcept (FE_ALL_EXCEPT);
474 }
475 
476 
477 static void
478 check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
479 		      FLOAT max_ulp, int xfail, int exceptions,
480 		      FLOAT *curr_max_error)
481 {
482   int ok = 0;
483   int print_diff = 0;
484   FLOAT diff = 0;
485   FLOAT ulp = 0;
486 
487   test_exceptions (test_name, exceptions);
488   if (isnan (computed) && isnan (expected))
489     ok = 1;
490   else if (isinf (computed) && isinf (expected))
491     {
492       /* Test for sign of infinities.  */
493       if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
494 	  && signbit (computed) != signbit (expected))
495 	{
496 	  ok = 0;
497 	  printf ("infinity has wrong sign.\n");
498 	}
499       else
500 	ok = 1;
501     }
502   /* Don't calc ulp for NaNs or infinities.  */
503   else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
504     ok = 0;
505   else
506     {
507       diff = FUNC(fabs) (computed - expected);
508       /* ilogb (0) isn't allowed.  */
509       if (expected == 0.0)
510 	ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
511       else
512 	ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
513       set_max_error (ulp, curr_max_error);
514       print_diff = 1;
515       if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
516 	  && computed == 0.0 && expected == 0.0
517 	  && signbit(computed) != signbit (expected))
518 	ok = 0;
519       else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
520 	ok = 1;
521       else
522 	{
523 	  ok = 0;
524 	  print_ulps (test_name, ulp);
525 	}
526 
527     }
528   if (print_screen (ok, xfail))
529     {
530       if (!ok)
531 	printf ("Failure: ");
532       printf ("Test: %s\n", test_name);
533       printf ("Result:\n");
534       printf (" is:         % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
535 	      computed, computed);
536       printf (" should be:  % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
537 	      expected, expected);
538       if (print_diff)
539 	{
540 	  printf (" difference: % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR
541 		  "\n", diff, diff);
542 	  printf (" ulp       : % .4" PRINTF_NEXPR "\n", ulp);
543 	  printf (" max.ulp   : % .4" PRINTF_NEXPR "\n", max_ulp);
544 	}
545     }
546   update_stats (ok, xfail);
547 }
548 
549 
550 static void
551 check_float (const char *test_name, FLOAT computed, FLOAT expected,
552 	     FLOAT max_ulp, int xfail, int exceptions)
553 {
554   check_float_internal (test_name, computed, expected, max_ulp, xfail,
555 			exceptions, &max_error);
556 }
557 
558 #if 0 /* XXX scp XXX */
559 static void
560 check_complex (const char *test_name, __complex__ FLOAT computed,
561 	       __complex__ FLOAT expected,
562 	       __complex__ FLOAT max_ulp, __complex__ int xfail,
563 	       int exception)
564 {
565   FLOAT part_comp, part_exp, part_max_ulp;
566   int part_xfail;
567   char str[200];
568 
569   sprintf (str, "Real part of: %s", test_name);
570   part_comp = __real__ computed;
571   part_exp = __real__ expected;
572   part_max_ulp = __real__ max_ulp;
573   part_xfail = __real__ xfail;
574 
575   check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
576 			exception, &real_max_error);
577 
578   sprintf (str, "Imaginary part of: %s", test_name);
579   part_comp = __imag__ computed;
580   part_exp = __imag__ expected;
581   part_max_ulp = __imag__ max_ulp;
582   part_xfail = __imag__ xfail;
583 
584   /* Don't check again for exceptions, just pass through the
585      zero/inf sign test.  */
586   check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
587 			exception & IGNORE_ZERO_INF_SIGN,
588 			&imag_max_error);
589 }
590 #endif
591 
592 /* Check that computed and expected values are equal (int values).  */
593 static void
594 check_int (const char *test_name, int computed, int expected, int max_ulp,
595 	   int xfail, int exceptions)
596 {
597   int diff = computed - expected;
598   int ok = 0;
599 
600   test_exceptions (test_name, exceptions);
601   noTests++;
602   if (abs (diff) <= max_ulp)
603     ok = 1;
604 
605   if (!ok)
606     print_ulps (test_name, diff);
607 
608   if (print_screen (ok, xfail))
609     {
610       if (!ok)
611 	printf ("Failure: ");
612       printf ("Test: %s\n", test_name);
613       printf ("Result:\n");
614       printf (" is:         %d\n", computed);
615       printf (" should be:  %d\n", expected);
616     }
617 
618   update_stats (ok, xfail);
619 }
620 
621 
622 /* Check that computed and expected values are equal (long int values).  */
623 static void
624 check_long (const char *test_name, long int computed, long int expected,
625 	    long int max_ulp, int xfail, int exceptions)
626 {
627   long int diff = computed - expected;
628   int ok = 0;
629 
630   test_exceptions (test_name, exceptions);
631   noTests++;
632   if (labs (diff) <= max_ulp)
633     ok = 1;
634 
635   if (!ok)
636     print_ulps (test_name, diff);
637 
638   if (print_screen (ok, xfail))
639     {
640       if (!ok)
641 	printf ("Failure: ");
642       printf ("Test: %s\n", test_name);
643       printf ("Result:\n");
644       printf (" is:         %ld\n", computed);
645       printf (" should be:  %ld\n", expected);
646     }
647 
648   update_stats (ok, xfail);
649 }
650 
651 
652 /* Check that computed value is true/false.  */
653 static void
654 check_bool (const char *test_name, int computed, int expected,
655 	    long int max_ulp, int xfail, int exceptions)
656 {
657   int ok = 0;
658 
659   test_exceptions (test_name, exceptions);
660   noTests++;
661   if ((computed == 0) == (expected == 0))
662     ok = 1;
663 
664   if (print_screen (ok, xfail))
665     {
666       if (!ok)
667 	printf ("Failure: ");
668       printf ("Test: %s\n", test_name);
669       printf ("Result:\n");
670       printf (" is:         %d\n", computed);
671       printf (" should be:  %d\n", expected);
672     }
673 
674   update_stats (ok, xfail);
675 }
676 
677 
678 /* check that computed and expected values are equal (long int values) */
679 static void
680 check_longlong (const char *test_name, long long int computed,
681 		long long int expected,
682 		long long int max_ulp, int xfail,
683 		int exceptions)
684 {
685   long long int diff = computed - expected;
686   int ok = 0;
687 
688   test_exceptions (test_name, exceptions);
689   noTests++;
690   if (llabs (diff) <= max_ulp)
691     ok = 1;
692 
693   if (!ok)
694     print_ulps (test_name, diff);
695 
696   if (print_screen (ok, xfail))
697     {
698       if (!ok)
699 	printf ("Failure:");
700       printf ("Test: %s\n", test_name);
701       printf ("Result:\n");
702       printf (" is:         %lld\n", computed);
703       printf (" should be:  %lld\n", expected);
704     }
705 
706   update_stats (ok, xfail);
707 }
708 
709 
710 #if 0  /* XXX scp XXX */
711 /* This is to prevent messages from the SVID libm emulation.  */
712 int
713 matherr (struct exception *x __attribute__ ((unused)))
714 {
715   return 1;
716 }
717 #endif
718 
719 /****************************************************************************
720   Tests for single functions of libm.
721   Please keep them alphabetically sorted!
722 ****************************************************************************/
723 
724 static void
725 acos_test (void)
726 {
727   errno = 0;
728   FUNC(acos) (0);
729   if (errno == ENOSYS)
730     /* Function not implemented.  */
731     return;
732 
733   init_max_error ();
734 
735   check_float ("acos (inf) == NaN plus invalid exception",  FUNC(acos) (plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
736   check_float ("acos (-inf) == NaN plus invalid exception",  FUNC(acos) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
737   check_float ("acos (NaN) == NaN",  FUNC(acos) (nan_value), nan_value, 0, 0, 0);
738 
739   /* |x| > 1: */
740   check_float ("acos (1.1) == NaN plus invalid exception",  FUNC(acos) (1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
741   check_float ("acos (-1.1) == NaN plus invalid exception",  FUNC(acos) (-1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
742 
743   check_float ("acos (0) == pi/2",  FUNC(acos) (0), M_PI_2l, 0, 0, 0);
744   check_float ("acos (-0) == pi/2",  FUNC(acos) (minus_zero), M_PI_2l, 0, 0, 0);
745   check_float ("acos (1) == 0",  FUNC(acos) (1), 0, 0, 0, 0);
746   check_float ("acos (-1) == pi",  FUNC(acos) (-1), M_PIl, 0, 0, 0);
747   check_float ("acos (0.5) == M_PI_6l*2.0",  FUNC(acos) (0.5), M_PI_6l*2.0, 1, 0, 0);
748   check_float ("acos (-0.5) == M_PI_6l*4.0",  FUNC(acos) (-0.5), M_PI_6l*4.0, 0, 0, 0);
749   check_float ("acos (0.7) == 0.79539883018414355549096833892476432",  FUNC(acos) (0.7L), 0.79539883018414355549096833892476432L, 0, 0, 0);
750 
751   print_max_error ("acos", DELTAacos, 0);
752 }
753 
754 static void
755 acosh_test (void)
756 {
757   errno = 0;
758   FUNC(acosh) (7);
759   if (errno == ENOSYS)
760     /* Function not implemented.  */
761     return;
762 
763   init_max_error ();
764 
765   check_float ("acosh (inf) == inf",  FUNC(acosh) (plus_infty), plus_infty, 0, 0, 0);
766   check_float ("acosh (-inf) == NaN plus invalid exception",  FUNC(acosh) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
767 
768   /* x < 1:  */
769   check_float ("acosh (-1.1) == NaN plus invalid exception",  FUNC(acosh) (-1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
770 
771   check_float ("acosh (1) == 0",  FUNC(acosh) (1), 0, 0, 0, 0);
772   check_float ("acosh (7) == 2.633915793849633417250092694615937",  FUNC(acosh) (7), 2.633915793849633417250092694615937L, DELTA16, 0, 0);
773 
774   print_max_error ("acosh", DELTAacosh, 0);
775 }
776 
777 static void
778 asin_test (void)
779 {
780   errno = 0;
781   FUNC(asin) (0);
782   if (errno == ENOSYS)
783     /* Function not implemented.  */
784     return;
785 
786   init_max_error ();
787 
788   check_float ("asin (inf) == NaN plus invalid exception",  FUNC(asin) (plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
789   check_float ("asin (-inf) == NaN plus invalid exception",  FUNC(asin) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
790   check_float ("asin (NaN) == NaN",  FUNC(asin) (nan_value), nan_value, 0, 0, 0);
791 
792   /* asin x == NaN plus invalid exception for |x| > 1.  */
793   check_float ("asin (1.1) == NaN plus invalid exception",  FUNC(asin) (1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
794   check_float ("asin (-1.1) == NaN plus invalid exception",  FUNC(asin) (-1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
795 
796   check_float ("asin (0) == 0",  FUNC(asin) (0), 0, 0, 0, 0);
797   check_float ("asin (-0) == -0",  FUNC(asin) (minus_zero), minus_zero, 0, 0, 0);
798   check_float ("asin (0.5) == pi/6",  FUNC(asin) (0.5), M_PI_6l, DELTA24, 0, 0);
799   check_float ("asin (-0.5) == -pi/6",  FUNC(asin) (-0.5), -M_PI_6l, DELTA25, 0, 0);
800   check_float ("asin (1.0) == pi/2",  FUNC(asin) (1.0), M_PI_2l, DELTA26, 0, 0);
801   check_float ("asin (-1.0) == -pi/2",  FUNC(asin) (-1.0), -M_PI_2l, DELTA27, 0, 0);
802   check_float ("asin (0.7) == 0.77539749661075306374035335271498708",  FUNC(asin) (0.7L), 0.77539749661075306374035335271498708L, DELTA28, 0, 0);
803 
804   print_max_error ("asin", DELTAasin, 0);
805 }
806 
807 static void
808 asinh_test (void)
809 {
810   errno = 0;
811   FUNC(asinh) (0.7L);
812   if (errno == ENOSYS)
813     /* Function not implemented.  */
814     return;
815 
816   init_max_error ();
817 
818   check_float ("asinh (0) == 0",  FUNC(asinh) (0), 0, 0, 0, 0);
819   check_float ("asinh (-0) == -0",  FUNC(asinh) (minus_zero), minus_zero, 0, 0, 0);
820 #ifndef TEST_INLINE
821   check_float ("asinh (inf) == inf",  FUNC(asinh) (plus_infty), plus_infty, 0, 0, 0);
822   check_float ("asinh (-inf) == -inf",  FUNC(asinh) (minus_infty), minus_infty, 0, 0, 0);
823 #endif
824   check_float ("asinh (NaN) == NaN",  FUNC(asinh) (nan_value), nan_value, 0, 0, 0);
825   check_float ("asinh (0.7) == 0.652666566082355786",  FUNC(asinh) (0.7L), 0.652666566082355786L, DELTA34, 0, 0);
826 
827   print_max_error ("asinh", DELTAasinh, 0);
828 }
829 
830 static void
831 atan_test (void)
832 {
833   errno = 0;
834   FUNC(atan) (0);
835   if (errno == ENOSYS)
836     /* Function not implemented.  */
837     return;
838 
839   init_max_error ();
840 
841   check_float ("atan (0) == 0",  FUNC(atan) (0), 0, 0, 0, 0);
842   check_float ("atan (-0) == -0",  FUNC(atan) (minus_zero), minus_zero, 0, 0, 0);
843 
844   check_float ("atan (inf) == pi/2",  FUNC(atan) (plus_infty), M_PI_2l, 0, 0, 0);
845   check_float ("atan (-inf) == -pi/2",  FUNC(atan) (minus_infty), -M_PI_2l, 0, 0, 0);
846   check_float ("atan (NaN) == NaN",  FUNC(atan) (nan_value), nan_value, 0, 0, 0);
847 
848   check_float ("atan (1) == pi/4",  FUNC(atan) (1), M_PI_4l, 0, 0, 0);
849   check_float ("atan (-1) == -pi/4",  FUNC(atan) (-1), -M_PI_4l, 0, 0, 0);
850 
851   check_float ("atan (0.7) == 0.61072596438920861654375887649023613",  FUNC(atan) (0.7L), 0.61072596438920861654375887649023613L, DELTA42, 0, 0);
852 
853   print_max_error ("atan", DELTAatan, 0);
854 }
855 
856 
857 
858 static void
859 atanh_test (void)
860 {
861   errno = 0;
862   FUNC(atanh) (0.7L);
863   if (errno == ENOSYS)
864     /* Function not implemented.  */
865     return;
866 
867   init_max_error ();
868 
869 
870   check_float ("atanh (0) == 0",  FUNC(atanh) (0), 0, 0, 0, 0);
871   check_float ("atanh (-0) == -0",  FUNC(atanh) (minus_zero), minus_zero, 0, 0, 0);
872 
873   check_float ("atanh (1) == inf plus division by zero exception",  FUNC(atanh) (1), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
874   check_float ("atanh (-1) == -inf plus division by zero exception",  FUNC(atanh) (-1), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
875   check_float ("atanh (NaN) == NaN",  FUNC(atanh) (nan_value), nan_value, 0, 0, 0);
876 
877   /* atanh (x) == NaN plus invalid exception if |x| > 1.  */
878   check_float ("atanh (1.1) == NaN plus invalid exception",  FUNC(atanh) (1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
879   check_float ("atanh (-1.1) == NaN plus invalid exception",  FUNC(atanh) (-1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
880 
881   check_float ("atanh (0.7) == 0.8673005276940531944",  FUNC(atanh) (0.7L), 0.8673005276940531944L, DELTA50, 0, 0);
882 
883   print_max_error ("atanh", DELTAatanh, 0);
884 }
885 
886 static void
887 atan2_test (void)
888 {
889   errno = 0;
890   FUNC(atan2) (-0, 1);
891   if (errno == ENOSYS)
892     /* Function not implemented.  */
893     return;
894 
895   init_max_error ();
896 
897   /* atan2 (0,x) == 0 for x > 0.  */
898   check_float ("atan2 (0, 1) == 0",  FUNC(atan2) (0, 1), 0, 0, 0, 0);
899 
900   /* atan2 (-0,x) == -0 for x > 0.  */
901   check_float ("atan2 (-0, 1) == -0",  FUNC(atan2) (minus_zero, 1), minus_zero, 0, 0, 0);
902 
903   check_float ("atan2 (0, 0) == 0",  FUNC(atan2) (0, 0), 0, 0, 0, 0);
904   check_float ("atan2 (-0, 0) == -0",  FUNC(atan2) (minus_zero, 0), minus_zero, 0, 0, 0);
905 
906   /* atan2 (+0,x) == +pi for x < 0.  */
907   check_float ("atan2 (0, -1) == pi",  FUNC(atan2) (0, -1), M_PIl, 0, 0, 0);
908 
909   /* atan2 (-0,x) == -pi for x < 0.  */
910   check_float ("atan2 (-0, -1) == -pi",  FUNC(atan2) (minus_zero, -1), -M_PIl, 0, 0, 0);
911 
912   check_float ("atan2 (0, -0) == pi",  FUNC(atan2) (0, minus_zero), M_PIl, 0, 0, 0);
913   check_float ("atan2 (-0, -0) == -pi",  FUNC(atan2) (minus_zero, minus_zero), -M_PIl, 0, 0, 0);
914 
915   /* atan2 (y,+0) == pi/2 for y > 0.  */
916   check_float ("atan2 (1, 0) == pi/2",  FUNC(atan2) (1, 0), M_PI_2l, 0, 0, 0);
917 
918   /* atan2 (y,-0) == pi/2 for y > 0.  */
919   check_float ("atan2 (1, -0) == pi/2",  FUNC(atan2) (1, minus_zero), M_PI_2l, 0, 0, 0);
920 
921   /* atan2 (y,+0) == -pi/2 for y < 0.  */
922   check_float ("atan2 (-1, 0) == -pi/2",  FUNC(atan2) (-1, 0), -M_PI_2l, 0, 0, 0);
923 
924   /* atan2 (y,-0) == -pi/2 for y < 0.  */
925   check_float ("atan2 (-1, -0) == -pi/2",  FUNC(atan2) (-1, minus_zero), -M_PI_2l, 0, 0, 0);
926 
927   /* atan2 (y,inf) == +0 for finite y > 0.  */
928   check_float ("atan2 (1, inf) == 0",  FUNC(atan2) (1, plus_infty), 0, 0, 0, 0);
929 
930   /* atan2 (y,inf) == -0 for finite y < 0.  */
931   check_float ("atan2 (-1, inf) == -0",  FUNC(atan2) (-1, plus_infty), minus_zero, 0, 0, 0);
932 
933   /* atan2(+inf, x) == pi/2 for finite x.  */
934   check_float ("atan2 (inf, -1) == pi/2",  FUNC(atan2) (plus_infty, -1), M_PI_2l, 0, 0, 0);
935 
936   /* atan2(-inf, x) == -pi/2 for finite x.  */
937   check_float ("atan2 (-inf, 1) == -pi/2",  FUNC(atan2) (minus_infty, 1), -M_PI_2l, 0, 0, 0);
938 
939   /* atan2 (y,-inf) == +pi for finite y > 0.  */
940   check_float ("atan2 (1, -inf) == pi",  FUNC(atan2) (1, minus_infty), M_PIl, 0, 0, 0);
941 
942   /* atan2 (y,-inf) == -pi for finite y < 0.  */
943   check_float ("atan2 (-1, -inf) == -pi",  FUNC(atan2) (-1, minus_infty), -M_PIl, 0, 0, 0);
944 
945   check_float ("atan2 (inf, inf) == pi/4",  FUNC(atan2) (plus_infty, plus_infty), M_PI_4l, 0, 0, 0);
946   check_float ("atan2 (-inf, inf) == -pi/4",  FUNC(atan2) (minus_infty, plus_infty), -M_PI_4l, 0, 0, 0);
947   check_float ("atan2 (inf, -inf) == 3/4 pi",  FUNC(atan2) (plus_infty, minus_infty), M_PI_34l, 0, 0, 0);
948   check_float ("atan2 (-inf, -inf) == -3/4 pi",  FUNC(atan2) (minus_infty, minus_infty), -M_PI_34l, 0, 0, 0);
949   check_float ("atan2 (NaN, NaN) == NaN",  FUNC(atan2) (nan_value, nan_value), nan_value, 0, 0, 0);
950 
951   check_float ("atan2 (0.7, 1) == 0.61072596438920861654375887649023613",  FUNC(atan2) (0.7L, 1), 0.61072596438920861654375887649023613L, DELTA74, 0, 0);
952   check_float ("atan2 (-0.7, 1.0) == -0.61072596438920861654375887649023613",  FUNC(atan2) (-0.7L, 1.0L), -0.61072596438920861654375887649023613L, 0, 0, 0);
953   check_float ("atan2 (0.7, -1.0) == 2.530866689200584621918884506789267",  FUNC(atan2) (0.7L, -1.0L), 2.530866689200584621918884506789267L, 0, 0, 0);
954   check_float ("atan2 (-0.7, -1.0) == -2.530866689200584621918884506789267",  FUNC(atan2) (-0.7L, -1.0L), -2.530866689200584621918884506789267L, 0, 0, 0);
955   check_float ("atan2 (0.4, 0.0003) == 1.5700463269355215717704032607580829",  FUNC(atan2) (0.4L, 0.0003L), 1.5700463269355215717704032607580829L, DELTA78, 0, 0);
956   check_float ("atan2 (1.4, -0.93) == 2.1571487668237843754887415992772736",  FUNC(atan2) (1.4L, -0.93L), 2.1571487668237843754887415992772736L, 0, 0, 0);
957 
958   print_max_error ("atan2", DELTAatan2, 0);
959 }
960 
961 
962 #if 0 /* XXX scp XXX */
963 static void
964 cabs_test (void)
965 {
966   errno = 0;
967   FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
968   if (errno == ENOSYS)
969     /* Function not implemented.  */
970     return;
971 
972   init_max_error ();
973 
974   /* cabs (x + iy) is specified as hypot (x,y) */
975 
976   /* cabs (+inf + i x) == +inf.  */
977   check_float ("cabs (inf + 1.0 i) == inf",  FUNC(cabs) (BUILD_COMPLEX (plus_infty, 1.0)), plus_infty, 0, 0, 0);
978   /* cabs (-inf + i x) == +inf.  */
979   check_float ("cabs (-inf + 1.0 i) == inf",  FUNC(cabs) (BUILD_COMPLEX (minus_infty, 1.0)), plus_infty, 0, 0, 0);
980 
981   check_float ("cabs (-inf + NaN i) == inf",  FUNC(cabs) (BUILD_COMPLEX (minus_infty, nan_value)), plus_infty, 0, 0, 0);
982   check_float ("cabs (-inf + NaN i) == inf",  FUNC(cabs) (BUILD_COMPLEX (minus_infty, nan_value)), plus_infty, 0, 0, 0);
983 
984   check_float ("cabs (NaN + NaN i) == NaN",  FUNC(cabs) (BUILD_COMPLEX (nan_value, nan_value)), nan_value, 0, 0, 0);
985 
986   /* cabs (x,y) == cabs (y,x).  */
987   check_float ("cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271",  FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L)), 12.419742348374220601176836866763271L, DELTA85, 0, 0);
988   /* cabs (x,y) == cabs (-x,y).  */
989   check_float ("cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271",  FUNC(cabs) (BUILD_COMPLEX (-12.4L, 0.7L)), 12.419742348374220601176836866763271L, DELTA86, 0, 0);
990   /* cabs (x,y) == cabs (-y,x).  */
991   check_float ("cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271",  FUNC(cabs) (BUILD_COMPLEX (-0.7L, 12.4L)), 12.419742348374220601176836866763271L, DELTA87, 0, 0);
992   /* cabs (x,y) == cabs (-x,-y).  */
993   check_float ("cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271",  FUNC(cabs) (BUILD_COMPLEX (-12.4L, -0.7L)), 12.419742348374220601176836866763271L, DELTA88, 0, 0);
994   /* cabs (x,y) == cabs (-y,-x).  */
995   check_float ("cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271",  FUNC(cabs) (BUILD_COMPLEX (-0.7L, -12.4L)), 12.419742348374220601176836866763271L, DELTA89, 0, 0);
996   /* cabs (x,0) == fabs (x).  */
997   check_float ("cabs (-0.7 + 0 i) == 0.7",  FUNC(cabs) (BUILD_COMPLEX (-0.7L, 0)), 0.7L, 0, 0, 0);
998   check_float ("cabs (0.7 + 0 i) == 0.7",  FUNC(cabs) (BUILD_COMPLEX (0.7L, 0)), 0.7L, 0, 0, 0);
999   check_float ("cabs (-1.0 + 0 i) == 1.0",  FUNC(cabs) (BUILD_COMPLEX (-1.0L, 0)), 1.0L, 0, 0, 0);
1000   check_float ("cabs (1.0 + 0 i) == 1.0",  FUNC(cabs) (BUILD_COMPLEX (1.0L, 0)), 1.0L, 0, 0, 0);
1001   check_float ("cabs (-5.7e7 + 0 i) == 5.7e7",  FUNC(cabs) (BUILD_COMPLEX (-5.7e7L, 0)), 5.7e7L, 0, 0, 0);
1002   check_float ("cabs (5.7e7 + 0 i) == 5.7e7",  FUNC(cabs) (BUILD_COMPLEX (5.7e7L, 0)), 5.7e7L, 0, 0, 0);
1003 
1004   check_float ("cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554",  FUNC(cabs) (BUILD_COMPLEX (0.7L, 1.2L)), 1.3892443989449804508432547041028554L, DELTA96, 0, 0);
1005 
1006   print_max_error ("cabs", DELTAcabs, 0);
1007 }
1008 
1009 static void
1010 cacos_test (void)
1011 {
1012   errno = 0;
1013   FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
1014   if (errno == ENOSYS)
1015     /* Function not implemented.  */
1016     return;
1017 
1018   init_max_error ();
1019 
1020 
1021   check_complex ("cacos (0 + 0 i) == pi/2 - 0 i",  FUNC(cacos) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1022   check_complex ("cacos (-0 + 0 i) == pi/2 - 0 i",  FUNC(cacos) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1023   check_complex ("cacos (-0 - 0 i) == pi/2 + 0.0 i",  FUNC(cacos) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (M_PI_2l, 0.0), 0, 0, 0);
1024   check_complex ("cacos (0 - 0 i) == pi/2 + 0.0 i",  FUNC(cacos) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (M_PI_2l, 0.0), 0, 0, 0);
1025 
1026   check_complex ("cacos (-inf + inf i) == 3/4 pi - inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (M_PI_34l, minus_infty), 0, 0, 0);
1027   check_complex ("cacos (-inf - inf i) == 3/4 pi + inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (M_PI_34l, plus_infty), 0, 0, 0);
1028 
1029   check_complex ("cacos (inf + inf i) == pi/4 - inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (M_PI_4l, minus_infty), 0, 0, 0);
1030   check_complex ("cacos (inf - inf i) == pi/4 + inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (M_PI_4l, plus_infty), 0, 0, 0);
1031 
1032   check_complex ("cacos (-10.0 + inf i) == pi/2 - inf i",  FUNC(cacos) (BUILD_COMPLEX (-10.0, plus_infty)), BUILD_COMPLEX (M_PI_2l, minus_infty), 0, 0, 0);
1033   check_complex ("cacos (-10.0 - inf i) == pi/2 + inf i",  FUNC(cacos) (BUILD_COMPLEX (-10.0, minus_infty)), BUILD_COMPLEX (M_PI_2l, plus_infty), 0, 0, 0);
1034   check_complex ("cacos (0 + inf i) == pi/2 - inf i",  FUNC(cacos) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (M_PI_2l, minus_infty), 0, 0, 0);
1035   check_complex ("cacos (0 - inf i) == pi/2 + inf i",  FUNC(cacos) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (M_PI_2l, plus_infty), 0, 0, 0);
1036   check_complex ("cacos (0.1 + inf i) == pi/2 - inf i",  FUNC(cacos) (BUILD_COMPLEX (0.1L, plus_infty)), BUILD_COMPLEX (M_PI_2l, minus_infty), 0, 0, 0);
1037   check_complex ("cacos (0.1 - inf i) == pi/2 + inf i",  FUNC(cacos) (BUILD_COMPLEX (0.1L, minus_infty)), BUILD_COMPLEX (M_PI_2l, plus_infty), 0, 0, 0);
1038 
1039   check_complex ("cacos (-inf + 0 i) == pi - inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (M_PIl, minus_infty), 0, 0, 0);
1040   check_complex ("cacos (-inf - 0 i) == pi + inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (M_PIl, plus_infty), 0, 0, 0);
1041   check_complex ("cacos (-inf + 100 i) == pi - inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, 100)), BUILD_COMPLEX (M_PIl, minus_infty), 0, 0, 0);
1042   check_complex ("cacos (-inf - 100 i) == pi + inf i",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, -100)), BUILD_COMPLEX (M_PIl, plus_infty), 0, 0, 0);
1043 
1044   check_complex ("cacos (inf + 0 i) == 0.0 - inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
1045   check_complex ("cacos (inf - 0 i) == 0.0 + inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
1046   check_complex ("cacos (inf + 0.5 i) == 0.0 - inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0.5)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
1047   check_complex ("cacos (inf - 0.5 i) == 0.0 + inf i",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, -0.5)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
1048 
1049   check_complex ("cacos (inf + NaN i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(cacos) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
1050   check_complex ("cacos (-inf + NaN i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(cacos) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
1051 
1052   check_complex ("cacos (0 + NaN i) == pi/2 + NaN i",  FUNC(cacos) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (M_PI_2l, nan_value), 0, 0, 0);
1053   check_complex ("cacos (-0 + NaN i) == pi/2 + NaN i",  FUNC(cacos) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (M_PI_2l, nan_value), 0, 0, 0);
1054 
1055   check_complex ("cacos (NaN + inf i) == NaN - inf i",  FUNC(cacos) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, minus_infty), 0, 0, 0);
1056   check_complex ("cacos (NaN - inf i) == NaN + inf i",  FUNC(cacos) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, 0);
1057 
1058   check_complex ("cacos (10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacos) (BUILD_COMPLEX (10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1059   check_complex ("cacos (-10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1060 
1061   check_complex ("cacos (NaN + 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacos) (BUILD_COMPLEX (nan_value, 0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1062   check_complex ("cacos (NaN - 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacos) (BUILD_COMPLEX (nan_value, -0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1063 
1064   check_complex ("cacos (NaN + NaN i) == NaN + NaN i",  FUNC(cacos) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1065 
1066   check_complex ("cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i",  FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.1351827477151551088992008271819053L, -1.0927647857577371459105272080819308L), DELTA130, 0, 0);
1067   check_complex ("cacos (-2 - 3 i) == 2.1414491111159960199416055713254211 + 1.9833870299165354323470769028940395 i",  FUNC(cacos) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L), DELTA131, 0, 0);
1068 
1069   print_complex_max_error ("cacos", DELTAcacos, 0);
1070 }
1071 
1072 
1073 static void
1074 cacosh_test (void)
1075 {
1076   errno = 0;
1077   FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
1078   if (errno == ENOSYS)
1079     /* Function not implemented.  */
1080     return;
1081 
1082   init_max_error ();
1083 
1084 
1085   check_complex ("cacosh (0 + 0 i) == 0.0 + pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1086   check_complex ("cacosh (-0 + 0 i) == 0.0 + pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1087   check_complex ("cacosh (0 - 0 i) == 0.0 - pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1088   check_complex ("cacosh (-0 - 0 i) == 0.0 - pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1089   check_complex ("cacosh (-inf + inf i) == inf + 3/4 pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_34l), 0, 0, 0);
1090   check_complex ("cacosh (-inf - inf i) == inf - 3/4 pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_34l), 0, 0, 0);
1091 
1092   check_complex ("cacosh (inf + inf i) == inf + pi/4 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_4l), 0, 0, 0);
1093   check_complex ("cacosh (inf - inf i) == inf - pi/4 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_4l), 0, 0, 0);
1094 
1095   check_complex ("cacosh (-10.0 + inf i) == inf + pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (-10.0, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1096   check_complex ("cacosh (-10.0 - inf i) == inf - pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (-10.0, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1097   check_complex ("cacosh (0 + inf i) == inf + pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1098   check_complex ("cacosh (0 - inf i) == inf - pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1099   check_complex ("cacosh (0.1 + inf i) == inf + pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0.1L, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1100   check_complex ("cacosh (0.1 - inf i) == inf - pi/2 i",  FUNC(cacosh) (BUILD_COMPLEX (0.1L, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1101 
1102   check_complex ("cacosh (-inf + 0 i) == inf + pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (plus_infty, M_PIl), 0, 0, 0);
1103   check_complex ("cacosh (-inf - 0 i) == inf - pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, -M_PIl), 0, 0, 0);
1104   check_complex ("cacosh (-inf + 100 i) == inf + pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 100)), BUILD_COMPLEX (plus_infty, M_PIl), 0, 0, 0);
1105   check_complex ("cacosh (-inf - 100 i) == inf - pi i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, -100)), BUILD_COMPLEX (plus_infty, -M_PIl), 0, 0, 0);
1106 
1107   check_complex ("cacosh (inf + 0 i) == inf + 0.0 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1108   check_complex ("cacosh (inf - 0 i) == inf - 0 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1109   check_complex ("cacosh (inf + 0.5 i) == inf + 0.0 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0.5)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1110   check_complex ("cacosh (inf - 0.5 i) == inf - 0 i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, -0.5)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1111 
1112   check_complex ("cacosh (inf + NaN i) == inf + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1113   check_complex ("cacosh (-inf + NaN i) == inf + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1114 
1115   check_complex ("cacosh (0 + NaN i) == NaN + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1116   check_complex ("cacosh (-0 + NaN i) == NaN + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1117 
1118   check_complex ("cacosh (NaN + inf i) == inf + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1119   check_complex ("cacosh (NaN - inf i) == inf + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1120 
1121   check_complex ("cacosh (10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacosh) (BUILD_COMPLEX (10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1122   check_complex ("cacosh (-10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1123 
1124   check_complex ("cacosh (NaN + 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacosh) (BUILD_COMPLEX (nan_value, 0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1125   check_complex ("cacosh (NaN - 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cacosh) (BUILD_COMPLEX (nan_value, -0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1126 
1127   check_complex ("cacosh (NaN + NaN i) == NaN + NaN i",  FUNC(cacosh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1128 
1129   check_complex ("cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i",  FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.0927647857577371459105272080819308L, 1.1351827477151551088992008271819053L), DELTA165, 0, 0);
1130   check_complex ("cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i",  FUNC(cacosh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L), DELTA166, 0, 0);
1131 
1132   print_complex_max_error ("cacosh", DELTAcacosh, 0);
1133 }
1134 
1135 static void
1136 carg_test (void)
1137 {
1138   init_max_error ();
1139 
1140   /* carg (x + iy) is specified as atan2 (y, x) */
1141 
1142   /* carg (x + i 0) == 0 for x > 0.  */
1143   check_float ("carg (2.0 + 0 i) == 0",  FUNC(carg) (BUILD_COMPLEX (2.0, 0)), 0, 0, 0, 0);
1144   /* carg (x - i 0) == -0 for x > 0.  */
1145   check_float ("carg (2.0 - 0 i) == -0",  FUNC(carg) (BUILD_COMPLEX (2.0, minus_zero)), minus_zero, 0, 0, 0);
1146 
1147   check_float ("carg (0 + 0 i) == 0",  FUNC(carg) (BUILD_COMPLEX (0, 0)), 0, 0, 0, 0);
1148   check_float ("carg (0 - 0 i) == -0",  FUNC(carg) (BUILD_COMPLEX (0, minus_zero)), minus_zero, 0, 0, 0);
1149 
1150   /* carg (x + i 0) == +pi for x < 0.  */
1151   check_float ("carg (-2.0 + 0 i) == pi",  FUNC(carg) (BUILD_COMPLEX (-2.0, 0)), M_PIl, 0, 0, 0);
1152 
1153   /* carg (x - i 0) == -pi for x < 0.  */
1154   check_float ("carg (-2.0 - 0 i) == -pi",  FUNC(carg) (BUILD_COMPLEX (-2.0, minus_zero)), -M_PIl, 0, 0, 0);
1155 
1156   check_float ("carg (-0 + 0 i) == pi",  FUNC(carg) (BUILD_COMPLEX (minus_zero, 0)), M_PIl, 0, 0, 0);
1157   check_float ("carg (-0 - 0 i) == -pi",  FUNC(carg) (BUILD_COMPLEX (minus_zero, minus_zero)), -M_PIl, 0, 0, 0);
1158 
1159   /* carg (+0 + i y) == pi/2 for y > 0.  */
1160   check_float ("carg (0 + 2.0 i) == pi/2",  FUNC(carg) (BUILD_COMPLEX (0, 2.0)), M_PI_2l, 0, 0, 0);
1161 
1162   /* carg (-0 + i y) == pi/2 for y > 0.  */
1163   check_float ("carg (-0 + 2.0 i) == pi/2",  FUNC(carg) (BUILD_COMPLEX (minus_zero, 2.0)), M_PI_2l, 0, 0, 0);
1164 
1165   /* carg (+0 + i y) == -pi/2 for y < 0.  */
1166   check_float ("carg (0 - 2.0 i) == -pi/2",  FUNC(carg) (BUILD_COMPLEX (0, -2.0)), -M_PI_2l, 0, 0, 0);
1167 
1168   /* carg (-0 + i y) == -pi/2 for y < 0.  */
1169   check_float ("carg (-0 - 2.0 i) == -pi/2",  FUNC(carg) (BUILD_COMPLEX (minus_zero, -2.0)), -M_PI_2l, 0, 0, 0);
1170 
1171   /* carg (inf + i y) == +0 for finite y > 0.  */
1172   check_float ("carg (inf + 2.0 i) == 0",  FUNC(carg) (BUILD_COMPLEX (plus_infty, 2.0)), 0, 0, 0, 0);
1173 
1174   /* carg (inf + i y) == -0 for finite y < 0.  */
1175   check_float ("carg (inf - 2.0 i) == -0",  FUNC(carg) (BUILD_COMPLEX (plus_infty, -2.0)), minus_zero, 0, 0, 0);
1176 
1177   /* carg(x + i inf) == pi/2 for finite x.  */
1178   check_float ("carg (10.0 + inf i) == pi/2",  FUNC(carg) (BUILD_COMPLEX (10.0, plus_infty)), M_PI_2l, 0, 0, 0);
1179 
1180   /* carg(x - i inf) == -pi/2 for finite x.  */
1181   check_float ("carg (10.0 - inf i) == -pi/2",  FUNC(carg) (BUILD_COMPLEX (10.0, minus_infty)), -M_PI_2l, 0, 0, 0);
1182 
1183   /* carg (-inf + i y) == +pi for finite y > 0.  */
1184   check_float ("carg (-inf + 10.0 i) == pi",  FUNC(carg) (BUILD_COMPLEX (minus_infty, 10.0)), M_PIl, 0, 0, 0);
1185 
1186   /* carg (-inf + i y) == -pi for finite y < 0.  */
1187   check_float ("carg (-inf - 10.0 i) == -pi",  FUNC(carg) (BUILD_COMPLEX (minus_infty, -10.0)), -M_PIl, 0, 0, 0);
1188 
1189   check_float ("carg (inf + inf i) == pi/4",  FUNC(carg) (BUILD_COMPLEX (plus_infty, plus_infty)), M_PI_4l, 0, 0, 0);
1190 
1191   check_float ("carg (inf - inf i) == -pi/4",  FUNC(carg) (BUILD_COMPLEX (plus_infty, minus_infty)), -M_PI_4l, 0, 0, 0);
1192 
1193   check_float ("carg (-inf + inf i) == 3 * M_PI_4l",  FUNC(carg) (BUILD_COMPLEX (minus_infty, plus_infty)), 3 * M_PI_4l, 0, 0, 0);
1194 
1195   check_float ("carg (-inf - inf i) == -3 * M_PI_4l",  FUNC(carg) (BUILD_COMPLEX (minus_infty, minus_infty)), -3 * M_PI_4l, 0, 0, 0);
1196 
1197   check_float ("carg (NaN + NaN i) == NaN",  FUNC(carg) (BUILD_COMPLEX (nan_value, nan_value)), nan_value, 0, 0, 0);
1198 
1199   print_max_error ("carg", 0, 0);
1200 }
1201 
1202 static void
1203 casin_test (void)
1204 {
1205   errno = 0;
1206   FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
1207   if (errno == ENOSYS)
1208     /* Function not implemented.  */
1209     return;
1210 
1211   init_max_error ();
1212 
1213   check_complex ("casin (0 + 0 i) == 0.0 + 0.0 i",  FUNC(casin) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1214   check_complex ("casin (-0 + 0 i) == -0 + 0.0 i",  FUNC(casin) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
1215   check_complex ("casin (0 - 0 i) == 0.0 - 0 i",  FUNC(casin) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1216   check_complex ("casin (-0 - 0 i) == -0 - 0 i",  FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1217 
1218   check_complex ("casin (inf + inf i) == pi/4 + inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (M_PI_4l, plus_infty), 0, 0, 0);
1219   check_complex ("casin (inf - inf i) == pi/4 - inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (M_PI_4l, minus_infty), 0, 0, 0);
1220   check_complex ("casin (-inf + inf i) == -pi/4 + inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (-M_PI_4l, plus_infty), 0, 0, 0);
1221   check_complex ("casin (-inf - inf i) == -pi/4 - inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (-M_PI_4l, minus_infty), 0, 0, 0);
1222 
1223   check_complex ("casin (-10.0 + inf i) == -0 + inf i",  FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty)), BUILD_COMPLEX (minus_zero, plus_infty), 0, 0, 0);
1224   check_complex ("casin (-10.0 - inf i) == -0 - inf i",  FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty)), BUILD_COMPLEX (minus_zero, minus_infty), 0, 0, 0);
1225   check_complex ("casin (0 + inf i) == 0.0 + inf i",  FUNC(casin) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
1226   check_complex ("casin (0 - inf i) == 0.0 - inf i",  FUNC(casin) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
1227   check_complex ("casin (-0 + inf i) == -0 + inf i",  FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (minus_zero, plus_infty), 0, 0, 0);
1228   check_complex ("casin (-0 - inf i) == -0 - inf i",  FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (minus_zero, minus_infty), 0, 0, 0);
1229   check_complex ("casin (0.1 + inf i) == 0.0 + inf i",  FUNC(casin) (BUILD_COMPLEX (0.1L, plus_infty)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
1230   check_complex ("casin (0.1 - inf i) == 0.0 - inf i",  FUNC(casin) (BUILD_COMPLEX (0.1L, minus_infty)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
1231 
1232   check_complex ("casin (-inf + 0 i) == -pi/2 + inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (-M_PI_2l, plus_infty), 0, 0, 0);
1233   check_complex ("casin (-inf - 0 i) == -pi/2 - inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (-M_PI_2l, minus_infty), 0, 0, 0);
1234   check_complex ("casin (-inf + 100 i) == -pi/2 + inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, 100)), BUILD_COMPLEX (-M_PI_2l, plus_infty), 0, 0, 0);
1235   check_complex ("casin (-inf - 100 i) == -pi/2 - inf i",  FUNC(casin) (BUILD_COMPLEX (minus_infty, -100)), BUILD_COMPLEX (-M_PI_2l, minus_infty), 0, 0, 0);
1236 
1237   check_complex ("casin (inf + 0 i) == pi/2 + inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (M_PI_2l, plus_infty), 0, 0, 0);
1238   check_complex ("casin (inf - 0 i) == pi/2 - inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (M_PI_2l, minus_infty), 0, 0, 0);
1239   check_complex ("casin (inf + 0.5 i) == pi/2 + inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5)), BUILD_COMPLEX (M_PI_2l, plus_infty), 0, 0, 0);
1240   check_complex ("casin (inf - 0.5 i) == pi/2 - inf i",  FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5)), BUILD_COMPLEX (M_PI_2l, minus_infty), 0, 0, 0);
1241 
1242   check_complex ("casin (NaN + inf i) == NaN + inf i",  FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, 0);
1243   check_complex ("casin (NaN - inf i) == NaN - inf i",  FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, minus_infty), 0, 0, 0);
1244 
1245   check_complex ("casin (0.0 + NaN i) == 0.0 + NaN i",  FUNC(casin) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, 0);
1246   check_complex ("casin (-0 + NaN i) == -0 + NaN i",  FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (minus_zero, nan_value), 0, 0, 0);
1247 
1248   check_complex ("casin (inf + NaN i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
1249   check_complex ("casin (-inf + NaN i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
1250 
1251   check_complex ("casin (NaN + 10.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1252   check_complex ("casin (NaN - 10.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1253 
1254   check_complex ("casin (0.75 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(casin) (BUILD_COMPLEX (0.75, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1255   check_complex ("casin (-0.75 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1256 
1257   check_complex ("casin (NaN + NaN i) == NaN + NaN i",  FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1258 
1259   check_complex ("casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i",  FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.4356135790797415103321208644578462L, 1.0927647857577371459105272080819308L), DELTA225, 0, 0);
1260   check_complex ("casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i",  FUNC(casin) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L), DELTA226, 0, 0);
1261 
1262   print_complex_max_error ("casin", DELTAcasin, 0);
1263 }
1264 
1265 
1266 static void
1267 casinh_test (void)
1268 {
1269   errno = 0;
1270   FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
1271   if (errno == ENOSYS)
1272     /* Function not implemented.  */
1273     return;
1274 
1275   init_max_error ();
1276 
1277   check_complex ("casinh (0 + 0 i) == 0.0 + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1278   check_complex ("casinh (-0 + 0 i) == -0 + 0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0), 0, 0, 0);
1279   check_complex ("casinh (0 - 0 i) == 0.0 - 0 i",  FUNC(casinh) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1280   check_complex ("casinh (-0 - 0 i) == -0 - 0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1281 
1282   check_complex ("casinh (inf + inf i) == inf + pi/4 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_4l), 0, 0, 0);
1283   check_complex ("casinh (inf - inf i) == inf - pi/4 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_4l), 0, 0, 0);
1284   check_complex ("casinh (-inf + inf i) == -inf + pi/4 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (minus_infty, M_PI_4l), 0, 0, 0);
1285   check_complex ("casinh (-inf - inf i) == -inf - pi/4 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (minus_infty, -M_PI_4l), 0, 0, 0);
1286 
1287   check_complex ("casinh (-10.0 + inf i) == -inf + pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (-10.0, plus_infty)), BUILD_COMPLEX (minus_infty, M_PI_2l), 0, 0, 0);
1288   check_complex ("casinh (-10.0 - inf i) == -inf - pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (-10.0, minus_infty)), BUILD_COMPLEX (minus_infty, -M_PI_2l), 0, 0, 0);
1289   check_complex ("casinh (0 + inf i) == inf + pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1290   check_complex ("casinh (0 - inf i) == inf - pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1291   check_complex ("casinh (-0 + inf i) == -inf + pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (minus_infty, M_PI_2l), 0, 0, 0);
1292   check_complex ("casinh (-0 - inf i) == -inf - pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (minus_infty, -M_PI_2l), 0, 0, 0);
1293   check_complex ("casinh (0.1 + inf i) == inf + pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (0.1L, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1294   check_complex ("casinh (0.1 - inf i) == inf - pi/2 i",  FUNC(casinh) (BUILD_COMPLEX (0.1L, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1295 
1296   check_complex ("casinh (-inf + 0 i) == -inf + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (minus_infty, 0.0), 0, 0, 0);
1297   check_complex ("casinh (-inf - 0 i) == -inf - 0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (minus_infty, minus_zero), 0, 0, 0);
1298   check_complex ("casinh (-inf + 100 i) == -inf + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, 100)), BUILD_COMPLEX (minus_infty, 0.0), 0, 0, 0);
1299   check_complex ("casinh (-inf - 100 i) == -inf - 0 i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, -100)), BUILD_COMPLEX (minus_infty, minus_zero), 0, 0, 0);
1300 
1301   check_complex ("casinh (inf + 0 i) == inf + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1302   check_complex ("casinh (inf - 0 i) == inf - 0 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1303   check_complex ("casinh (inf + 0.5 i) == inf + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0.5)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1304   check_complex ("casinh (inf - 0.5 i) == inf - 0 i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, -0.5)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1305 
1306   check_complex ("casinh (inf + NaN i) == inf + NaN i",  FUNC(casinh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1307   check_complex ("casinh (-inf + NaN i) == -inf + NaN i",  FUNC(casinh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (minus_infty, nan_value), 0, 0, 0);
1308 
1309   check_complex ("casinh (NaN + 0 i) == NaN + 0.0 i",  FUNC(casinh) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, 0);
1310   check_complex ("casinh (NaN - 0 i) == NaN - 0 i",  FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, minus_zero), 0, 0, 0);
1311 
1312   check_complex ("casinh (NaN + inf i) == inf + NaN i plus sign of zero/inf not specified",  FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
1313   check_complex ("casinh (NaN - inf i) == inf + NaN i plus sign of zero/inf not specified",  FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
1314 
1315   check_complex ("casinh (10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(casinh) (BUILD_COMPLEX (10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1316   check_complex ("casinh (-10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1317 
1318   check_complex ("casinh (NaN + 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1319   check_complex ("casinh (-0.75 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1320 
1321   check_complex ("casinh (NaN + NaN i) == NaN + NaN i",  FUNC(casinh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1322 
1323   check_complex ("casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i",  FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.97865459559367387689317593222160964L, 0.91135418953156011567903546856170941L), DELTA262, 0, 0);
1324   check_complex ("casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i",  FUNC(casinh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L), DELTA263, 0, 0);
1325 
1326   print_complex_max_error ("casinh", DELTAcasinh, 0);
1327 }
1328 
1329 
1330 static void
1331 catan_test (void)
1332 {
1333   errno = 0;
1334   FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
1335   if (errno == ENOSYS)
1336     /* Function not implemented.  */
1337     return;
1338 
1339   init_max_error ();
1340 
1341   check_complex ("catan (0 + 0 i) == 0 + 0 i",  FUNC(catan) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0, 0), 0, 0, 0);
1342   check_complex ("catan (-0 + 0 i) == -0 + 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0), 0, 0, 0);
1343   check_complex ("catan (0 - 0 i) == 0 - 0 i",  FUNC(catan) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0, minus_zero), 0, 0, 0);
1344   check_complex ("catan (-0 - 0 i) == -0 - 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1345 
1346   check_complex ("catan (inf + inf i) == pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, 0);
1347   check_complex ("catan (inf - inf i) == pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1348   check_complex ("catan (-inf + inf i) == -pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, 0);
1349   check_complex ("catan (-inf - inf i) == -pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (-M_PI_2l, minus_zero), 0, 0, 0);
1350 
1351 
1352   check_complex ("catan (inf - 10.0 i) == pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1353   check_complex ("catan (-inf - 10.0 i) == -pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, -10.0)), BUILD_COMPLEX (-M_PI_2l, minus_zero), 0, 0, 0);
1354   check_complex ("catan (inf - 0 i) == pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1355   check_complex ("catan (-inf - 0 i) == -pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (-M_PI_2l, minus_zero), 0, 0, 0);
1356   check_complex ("catan (inf + 0.0 i) == pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.0)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, 0);
1357   check_complex ("catan (-inf + 0.0 i) == -pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.0)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, 0);
1358   check_complex ("catan (inf + 0.1 i) == pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.1L)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, 0);
1359   check_complex ("catan (-inf + 0.1 i) == -pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.1L)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, 0);
1360 
1361   check_complex ("catan (0.0 - inf i) == pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1362   check_complex ("catan (-0 - inf i) == -pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (-M_PI_2l, minus_zero), 0, 0, 0);
1363   check_complex ("catan (100.0 - inf i) == pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (100.0, minus_infty)), BUILD_COMPLEX (M_PI_2l, minus_zero), 0, 0, 0);
1364   check_complex ("catan (-100.0 - inf i) == -pi/2 - 0 i",  FUNC(catan) (BUILD_COMPLEX (-100.0, minus_infty)), BUILD_COMPLEX (-M_PI_2l, minus_zero), 0, 0, 0);
1365 
1366   check_complex ("catan (0.0 + inf i) == pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, 0);
1367   check_complex ("catan (-0 + inf i) == -pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, 0);
1368   check_complex ("catan (0.5 + inf i) == pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (0.5, plus_infty)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, 0);
1369   check_complex ("catan (-0.5 + inf i) == -pi/2 + 0 i",  FUNC(catan) (BUILD_COMPLEX (-0.5, plus_infty)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, 0);
1370 
1371   check_complex ("catan (NaN + 0.0 i) == NaN + 0 i",  FUNC(catan) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, 0), 0, 0, 0);
1372   check_complex ("catan (NaN - 0 i) == NaN - 0 i",  FUNC(catan) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, minus_zero), 0, 0, 0);
1373 
1374   check_complex ("catan (NaN + inf i) == NaN + 0 i",  FUNC(catan) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, 0), 0, 0, 0);
1375   check_complex ("catan (NaN - inf i) == NaN - 0 i",  FUNC(catan) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, minus_zero), 0, 0, 0);
1376 
1377   check_complex ("catan (0.0 + NaN i) == NaN + NaN i",  FUNC(catan) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1378   check_complex ("catan (-0 + NaN i) == NaN + NaN i",  FUNC(catan) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1379 
1380   check_complex ("catan (inf + NaN i) == pi/2 + 0 i plus sign of zero/inf not specified",  FUNC(catan) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (M_PI_2l, 0), 0, 0, IGNORE_ZERO_INF_SIGN);
1381   check_complex ("catan (-inf + NaN i) == -pi/2 + 0 i plus sign of zero/inf not specified",  FUNC(catan) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (-M_PI_2l, 0), 0, 0, IGNORE_ZERO_INF_SIGN);
1382 
1383   check_complex ("catan (NaN + 10.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1384   check_complex ("catan (NaN - 10.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1385 
1386   check_complex ("catan (0.75 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(catan) (BUILD_COMPLEX (0.75, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1387   check_complex ("catan (-0.75 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1388 
1389   check_complex ("catan (NaN + NaN i) == NaN + NaN i",  FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1390 
1391   check_complex ("catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i",  FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.0785743834118921877443707996386368L, 0.57705737765343067644394541889341712L), DELTA301, 0, 0);
1392 
1393   check_complex ("catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i",  FUNC(catan) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L), DELTA302, 0, 0);
1394 
1395   print_complex_max_error ("catan", DELTAcatan, 0);
1396 }
1397 
1398 static void
1399 catanh_test (void)
1400 {
1401   errno = 0;
1402   FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
1403   if (errno == ENOSYS)
1404     /* Function not implemented.  */
1405     return;
1406 
1407   init_max_error ();
1408 
1409   check_complex ("catanh (0 + 0 i) == 0.0 + 0.0 i",  FUNC(catanh) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1410   check_complex ("catanh (-0 + 0 i) == -0 + 0.0 i",  FUNC(catanh) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
1411   check_complex ("catanh (0 - 0 i) == 0.0 - 0 i",  FUNC(catanh) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1412   check_complex ("catanh (-0 - 0 i) == -0 - 0 i",  FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1413 
1414   check_complex ("catanh (inf + inf i) == 0.0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1415   check_complex ("catanh (inf - inf i) == 0.0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1416   check_complex ("catanh (-inf + inf i) == -0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (minus_zero, M_PI_2l), 0, 0, 0);
1417   check_complex ("catanh (-inf - inf i) == -0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (minus_zero, -M_PI_2l), 0, 0, 0);
1418 
1419   check_complex ("catanh (-10.0 + inf i) == -0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (-10.0, plus_infty)), BUILD_COMPLEX (minus_zero, M_PI_2l), 0, 0, 0);
1420   check_complex ("catanh (-10.0 - inf i) == -0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (-10.0, minus_infty)), BUILD_COMPLEX (minus_zero, -M_PI_2l), 0, 0, 0);
1421   check_complex ("catanh (-0 + inf i) == -0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (minus_zero, M_PI_2l), 0, 0, 0);
1422   check_complex ("catanh (-0 - inf i) == -0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (minus_zero, -M_PI_2l), 0, 0, 0);
1423   check_complex ("catanh (0 + inf i) == 0.0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1424   check_complex ("catanh (0 - inf i) == 0.0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1425   check_complex ("catanh (0.1 + inf i) == 0.0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (0.1L, plus_infty)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1426   check_complex ("catanh (0.1 - inf i) == 0.0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (0.1L, minus_infty)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1427 
1428   check_complex ("catanh (-inf + 0 i) == -0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (minus_zero, M_PI_2l), 0, 0, 0);
1429   check_complex ("catanh (-inf - 0 i) == -0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (minus_zero, -M_PI_2l), 0, 0, 0);
1430   check_complex ("catanh (-inf + 100 i) == -0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, 100)), BUILD_COMPLEX (minus_zero, M_PI_2l), 0, 0, 0);
1431   check_complex ("catanh (-inf - 100 i) == -0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, -100)), BUILD_COMPLEX (minus_zero, -M_PI_2l), 0, 0, 0);
1432 
1433   check_complex ("catanh (inf + 0 i) == 0.0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1434   check_complex ("catanh (inf - 0 i) == 0.0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1435   check_complex ("catanh (inf + 0.5 i) == 0.0 + pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0.5)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, 0);
1436   check_complex ("catanh (inf - 0.5 i) == 0.0 - pi/2 i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, -0.5)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, 0);
1437 
1438   check_complex ("catanh (0 + NaN i) == 0.0 + NaN i",  FUNC(catanh) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, 0);
1439   check_complex ("catanh (-0 + NaN i) == -0 + NaN i",  FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (minus_zero, nan_value), 0, 0, 0);
1440 
1441   check_complex ("catanh (inf + NaN i) == 0.0 + NaN i",  FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, 0);
1442   check_complex ("catanh (-inf + NaN i) == -0 + NaN i",  FUNC(catanh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (minus_zero, nan_value), 0, 0, 0);
1443 
1444   check_complex ("catanh (NaN + 0 i) == NaN + NaN i",  FUNC(catanh) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1445   check_complex ("catanh (NaN - 0 i) == NaN + NaN i",  FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1446 
1447   check_complex ("catanh (NaN + inf i) == 0.0 + pi/2 i plus sign of zero/inf not specified",  FUNC(catanh) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (0.0, M_PI_2l), 0, 0, IGNORE_ZERO_INF_SIGN);
1448   check_complex ("catanh (NaN - inf i) == 0.0 - pi/2 i plus sign of zero/inf not specified",  FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (0.0, -M_PI_2l), 0, 0, IGNORE_ZERO_INF_SIGN);
1449 
1450   check_complex ("catanh (10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(catanh) (BUILD_COMPLEX (10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1451   check_complex ("catanh (-10.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1452 
1453   check_complex ("catanh (NaN + 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1454   check_complex ("catanh (NaN - 0.75 i) == NaN + NaN i plus invalid exception allowed",  FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1455 
1456   check_complex ("catanh (NaN + NaN i) == NaN + NaN i",  FUNC(catanh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1457 
1458   check_complex ("catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i",  FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.2600749516525135959200648705635915L, 0.97024030779509898497385130162655963L), DELTA340, 0, 0);
1459   check_complex ("catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i",  FUNC(catanh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L), DELTA341, 0, 0);
1460 
1461   print_complex_max_error ("catanh", DELTAcatanh, 0);
1462 }
1463 #endif
1464 
1465 static void
1466 cbrt_test (void)
1467 {
1468   errno = 0;
1469   FUNC(cbrt) (8);
1470   if (errno == ENOSYS)
1471     /* Function not implemented.  */
1472     return;
1473 
1474   init_max_error ();
1475 
1476   check_float ("cbrt (0.0) == 0.0",  FUNC(cbrt) (0.0), 0.0, 0, 0, 0);
1477   check_float ("cbrt (-0) == -0",  FUNC(cbrt) (minus_zero), minus_zero, 0, 0, 0);
1478 
1479   check_float ("cbrt (inf) == inf",  FUNC(cbrt) (plus_infty), plus_infty, 0, 0, 0);
1480   check_float ("cbrt (-inf) == -inf",  FUNC(cbrt) (minus_infty), minus_infty, 0, 0, 0);
1481   check_float ("cbrt (NaN) == NaN",  FUNC(cbrt) (nan_value), nan_value, 0, 0, 0);
1482 
1483   check_float ("cbrt (-0.001) == -0.1",  FUNC(cbrt) (-0.001L), -0.1L, DELTA347, 0, 0);
1484   check_float ("cbrt (8) == 2",  FUNC(cbrt) (8), 2, 0, 0, 0);
1485   check_float ("cbrt (-27.0) == -3.0",  FUNC(cbrt) (-27.0), -3.0, DELTA349, 0, 0);
1486   check_float ("cbrt (0.970299) == 0.99",  FUNC(cbrt) (0.970299L), 0.99L, DELTA350, 0, 0);
1487   check_float ("cbrt (0.7) == 0.8879040017426007084",  FUNC(cbrt) (0.7L), 0.8879040017426007084L, DELTA351, 0, 0);
1488 
1489   print_max_error ("cbrt", DELTAcbrt, 0);
1490 }
1491 
1492 #if 0 /* XXX scp XXX */
1493 static void
1494 ccos_test (void)
1495 {
1496   errno = 0;
1497   FUNC(ccos) (BUILD_COMPLEX (0, 0));
1498   if (errno == ENOSYS)
1499     /* Function not implemented.  */
1500     return;
1501 
1502   init_max_error ();
1503 
1504   check_complex ("ccos (0.0 + 0.0 i) == 1.0 - 0 i",  FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
1505   check_complex ("ccos (-0 + 0.0 i) == 1.0 + 0.0 i",  FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1506   check_complex ("ccos (0.0 - 0 i) == 1.0 + 0.0 i",  FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1507   check_complex ("ccos (-0 - 0 i) == 1.0 - 0 i",  FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
1508 
1509   check_complex ("ccos (inf + 0.0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1510   check_complex ("ccos (inf - 0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1511   check_complex ("ccos (-inf + 0.0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1512   check_complex ("ccos (-inf - 0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1513 
1514   check_complex ("ccos (0.0 + inf i) == inf - 0 i",  FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1515   check_complex ("ccos (0.0 - inf i) == inf + 0.0 i",  FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1516   check_complex ("ccos (-0 + inf i) == inf + 0.0 i",  FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1517   check_complex ("ccos (-0 - inf i) == inf - 0 i",  FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1518 
1519   check_complex ("ccos (inf + inf i) == inf + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1520   check_complex ("ccos (-inf + inf i) == inf + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1521   check_complex ("ccos (inf - inf i) == inf + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1522   check_complex ("ccos (-inf - inf i) == inf + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1523 
1524   check_complex ("ccos (4.625 + inf i) == -inf + inf i",  FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
1525   check_complex ("ccos (4.625 - inf i) == -inf - inf i",  FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
1526   check_complex ("ccos (-4.625 + inf i) == -inf - inf i",  FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
1527   check_complex ("ccos (-4.625 - inf i) == -inf + inf i",  FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
1528 
1529   check_complex ("ccos (inf + 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1530   check_complex ("ccos (inf - 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1531   check_complex ("ccos (-inf + 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1532   check_complex ("ccos (-inf - 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1533 
1534   check_complex ("ccos (NaN + 0.0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1535   check_complex ("ccos (NaN - 0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1536 
1537   check_complex ("ccos (NaN + inf i) == inf + NaN i",  FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1538   check_complex ("ccos (NaN - inf i) == inf + NaN i",  FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1539 
1540   check_complex ("ccos (NaN + 9.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1541   check_complex ("ccos (NaN - 9.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1542 
1543   check_complex ("ccos (0.0 + NaN i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1544   check_complex ("ccos (-0 + NaN i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1545 
1546   check_complex ("ccos (10.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1547   check_complex ("ccos (-10.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1548 
1549   check_complex ("ccos (inf + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1550   check_complex ("ccos (-inf + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1551 
1552   check_complex ("ccos (NaN + NaN i) == NaN + NaN i",  FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1553 
1554   check_complex ("ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i",  FUNC(ccos) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.3848657645312111080L, -0.97242170335830028619L), DELTA389, 0, 0);
1555 
1556   check_complex ("ccos (-2 - 3 i) == -4.1896256909688072301 - 9.1092278937553365979 i",  FUNC(ccos) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-4.1896256909688072301L, -9.1092278937553365979L), DELTA390, 0, 0);
1557 
1558   print_complex_max_error ("ccos", DELTAccos, 0);
1559 }
1560 
1561 
1562 static void
1563 ccosh_test (void)
1564 {
1565   errno = 0;
1566   FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
1567   if (errno == ENOSYS)
1568     /* Function not implemented.  */
1569     return;
1570 
1571   init_max_error ();
1572 
1573   check_complex ("ccosh (0.0 + 0.0 i) == 1.0 + 0.0 i",  FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1574   check_complex ("ccosh (-0 + 0.0 i) == 1.0 - 0 i",  FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
1575   check_complex ("ccosh (0.0 - 0 i) == 1.0 - 0 i",  FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
1576   check_complex ("ccosh (-0 - 0 i) == 1.0 + 0.0 i",  FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1577 
1578   check_complex ("ccosh (0.0 + inf i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1579   check_complex ("ccosh (-0 + inf i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1580   check_complex ("ccosh (0.0 - inf i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1581   check_complex ("ccosh (-0 - inf i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1582 
1583   check_complex ("ccosh (inf + 0.0 i) == inf + 0.0 i",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1584   check_complex ("ccosh (-inf + 0.0 i) == inf - 0 i",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 0.0)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1585   check_complex ("ccosh (inf - 0 i) == inf - 0 i",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1586   check_complex ("ccosh (-inf - 0 i) == inf + 0.0 i",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1587 
1588   check_complex ("ccosh (inf + inf i) == inf + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1589   check_complex ("ccosh (-inf + inf i) == inf + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1590   check_complex ("ccosh (inf - inf i) == inf + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1591   check_complex ("ccosh (-inf - inf i) == inf + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION);
1592 
1593   check_complex ("ccosh (inf + 4.625 i) == -inf - inf i",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 4.625)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
1594   check_complex ("ccosh (-inf + 4.625 i) == -inf + inf i",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 4.625)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
1595   check_complex ("ccosh (inf - 4.625 i) == -inf + inf i",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, -4.625)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
1596   check_complex ("ccosh (-inf - 4.625 i) == -inf - inf i",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, -4.625)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
1597 
1598   check_complex ("ccosh (6.75 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1599   check_complex ("ccosh (-6.75 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1600   check_complex ("ccosh (6.75 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1601   check_complex ("ccosh (-6.75 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1602 
1603   check_complex ("ccosh (0.0 + NaN i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1604   check_complex ("ccosh (-0 + NaN i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1605 
1606   check_complex ("ccosh (inf + NaN i) == inf + NaN i",  FUNC(ccosh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1607   check_complex ("ccosh (-inf + NaN i) == inf + NaN i",  FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1608 
1609   check_complex ("ccosh (9.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1610   check_complex ("ccosh (-9.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (-9.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1611 
1612   check_complex ("ccosh (NaN + 0.0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1613   check_complex ("ccosh (NaN - 0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1614 
1615   check_complex ("ccosh (NaN + 10.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1616   check_complex ("ccosh (NaN - 10.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1617 
1618   check_complex ("ccosh (NaN + inf i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1619   check_complex ("ccosh (NaN - inf i) == NaN + NaN i plus invalid exception allowed",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1620 
1621   check_complex ("ccosh (NaN + NaN i) == NaN + NaN i",  FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1622 
1623   check_complex ("ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i",  FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.4548202223691477654L, 0.7070296600921537682L), DELTA428, 0, 0);
1624 
1625   check_complex ("ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i",  FUNC(ccosh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-3.7245455049153225654L, 0.5118225699873846088L), DELTA429, 0, 0);
1626 
1627   print_complex_max_error ("ccosh", DELTAccosh, 0);
1628 }
1629 #endif
1630 
1631 
1632 static void
1633 ceil_test (void)
1634 {
1635   init_max_error ();
1636 
1637   check_float ("ceil (0.0) == 0.0",  FUNC(ceil) (0.0), 0.0, 0, 0, 0);
1638   check_float ("ceil (-0) == -0",  FUNC(ceil) (minus_zero), minus_zero, 0, 0, 0);
1639   check_float ("ceil (inf) == inf",  FUNC(ceil) (plus_infty), plus_infty, 0, 0, 0);
1640   check_float ("ceil (-inf) == -inf",  FUNC(ceil) (minus_infty), minus_infty, 0, 0, 0);
1641   check_float ("ceil (NaN) == NaN",  FUNC(ceil) (nan_value), nan_value, 0, 0, 0);
1642 
1643   check_float ("ceil (pi) == 4.0",  FUNC(ceil) (M_PIl), 4.0, 0, 0, 0);
1644   check_float ("ceil (-pi) == -3.0",  FUNC(ceil) (-M_PIl), -3.0, 0, 0, 0);
1645 
1646   print_max_error ("ceil", 0, 0);
1647 }
1648 
1649 
1650 #if 0 /* XXX scp XXX */
1651 static void
1652 cexp_test (void)
1653 {
1654   errno = 0;
1655   FUNC(cexp) (BUILD_COMPLEX (0, 0));
1656   if (errno == ENOSYS)
1657     /* Function not implemented.  */
1658     return;
1659 
1660   init_max_error ();
1661 
1662   check_complex ("cexp (+0 + +0 i) == 1 + 0.0 i",  FUNC(cexp) (BUILD_COMPLEX (plus_zero, plus_zero)), BUILD_COMPLEX (1, 0.0), 0, 0, 0);
1663   check_complex ("cexp (-0 + +0 i) == 1 + 0.0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_zero)), BUILD_COMPLEX (1, 0.0), 0, 0, 0);
1664   check_complex ("cexp (+0 - 0 i) == 1 - 0 i",  FUNC(cexp) (BUILD_COMPLEX (plus_zero, minus_zero)), BUILD_COMPLEX (1, minus_zero), 0, 0, 0);
1665   check_complex ("cexp (-0 - 0 i) == 1 - 0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (1, minus_zero), 0, 0, 0);
1666 
1667   check_complex ("cexp (inf + +0 i) == inf + 0.0 i",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_zero)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1668   check_complex ("cexp (inf - 0 i) == inf - 0 i",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1669 
1670   check_complex ("cexp (-inf + +0 i) == 0.0 + 0.0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_zero)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1671   check_complex ("cexp (-inf - 0 i) == 0.0 - 0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1672 
1673   check_complex ("cexp (0.0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1674   check_complex ("cexp (-0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1675 
1676   check_complex ("cexp (0.0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1677   check_complex ("cexp (-0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1678 
1679   check_complex ("cexp (100.0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1680   check_complex ("cexp (-100.0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1681 
1682   check_complex ("cexp (100.0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1683   check_complex ("cexp (-100.0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
1684 
1685   check_complex ("cexp (-inf + 2.0 i) == -0 + 0.0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, 2.0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
1686   check_complex ("cexp (-inf + 4.0 i) == -0 - 0 i",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, 4.0)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1687   check_complex ("cexp (inf + 2.0 i) == -inf + inf i",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, 2.0)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
1688   check_complex ("cexp (inf + 4.0 i) == -inf - inf i",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, 4.0)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
1689 
1690   check_complex ("cexp (inf + inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1691   check_complex ("cexp (inf - inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
1692 
1693   check_complex ("cexp (-inf + inf i) == 0.0 + 0.0 i plus sign of zero/inf not specified",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (0.0, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
1694   check_complex ("cexp (-inf - inf i) == 0.0 - 0 i plus sign of zero/inf not specified",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, IGNORE_ZERO_INF_SIGN);
1695 
1696   check_complex ("cexp (-inf + NaN i) == 0 + 0 i plus sign of zero/inf not specified",  FUNC(cexp) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (0, 0), 0, 0, IGNORE_ZERO_INF_SIGN);
1697 
1698   check_complex ("cexp (inf + NaN i) == inf + NaN i",  FUNC(cexp) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1699 
1700   check_complex ("cexp (NaN + 0.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cexp) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1701   check_complex ("cexp (NaN + 1.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1702 
1703   check_complex ("cexp (NaN + inf i) == NaN + NaN i plus invalid exception allowed",  FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1704   check_complex ("cexp (0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cexp) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1705   check_complex ("cexp (1 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(cexp) (BUILD_COMPLEX (1, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1706   check_complex ("cexp (NaN + NaN i) == NaN + NaN i",  FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1707 
1708   check_complex ("cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i",  FUNC(cexp) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.72969890915032360123451688642930727L, 1.8768962328348102821139467908203072L), DELTA469, 0, 0);
1709   check_complex ("cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i",  FUNC(cexp) (BUILD_COMPLEX (-2.0, -3.0)), BUILD_COMPLEX (-0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L), DELTA470, 0, 0);
1710 
1711   print_complex_max_error ("cexp", DELTAcexp, 0);
1712 }
1713 
1714 static void
1715 cimag_test (void)
1716 {
1717   init_max_error ();
1718   check_float ("cimag (1.0 + 0.0 i) == 0.0",  FUNC(cimag) (BUILD_COMPLEX (1.0, 0.0)), 0.0, 0, 0, 0);
1719   check_float ("cimag (1.0 - 0 i) == -0",  FUNC(cimag) (BUILD_COMPLEX (1.0, minus_zero)), minus_zero, 0, 0, 0);
1720   check_float ("cimag (1.0 + NaN i) == NaN",  FUNC(cimag) (BUILD_COMPLEX (1.0, nan_value)), nan_value, 0, 0, 0);
1721   check_float ("cimag (NaN + NaN i) == NaN",  FUNC(cimag) (BUILD_COMPLEX (nan_value, nan_value)), nan_value, 0, 0, 0);
1722   check_float ("cimag (1.0 + inf i) == inf",  FUNC(cimag) (BUILD_COMPLEX (1.0, plus_infty)), plus_infty, 0, 0, 0);
1723   check_float ("cimag (1.0 - inf i) == -inf",  FUNC(cimag) (BUILD_COMPLEX (1.0, minus_infty)), minus_infty, 0, 0, 0);
1724   check_float ("cimag (2.0 + 3.0 i) == 3.0",  FUNC(cimag) (BUILD_COMPLEX (2.0, 3.0)), 3.0, 0, 0, 0);
1725 
1726   print_max_error ("cimag", 0, 0);
1727 }
1728 
1729 static void
1730 clog_test (void)
1731 {
1732   errno = 0;
1733   FUNC(clog) (BUILD_COMPLEX (-2, -3));
1734   if (errno == ENOSYS)
1735     /* Function not implemented.  */
1736     return;
1737 
1738   init_max_error ();
1739 
1740   check_complex ("clog (-0 + 0 i) == -inf + pi i plus division by zero exception",  FUNC(clog) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_infty, M_PIl), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1741   check_complex ("clog (-0 - 0 i) == -inf - pi i plus division by zero exception",  FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_infty, -M_PIl), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1742 
1743   check_complex ("clog (0 + 0 i) == -inf + 0.0 i plus division by zero exception",  FUNC(clog) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (minus_infty, 0.0), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1744   check_complex ("clog (0 - 0 i) == -inf - 0 i plus division by zero exception",  FUNC(clog) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (minus_infty, minus_zero), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1745 
1746   check_complex ("clog (-inf + inf i) == inf + 3/4 pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_34l), 0, 0, 0);
1747   check_complex ("clog (-inf - inf i) == inf - 3/4 pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_34l), 0, 0, 0);
1748 
1749   check_complex ("clog (inf + inf i) == inf + pi/4 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_4l), 0, 0, 0);
1750   check_complex ("clog (inf - inf i) == inf - pi/4 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_4l), 0, 0, 0);
1751 
1752   check_complex ("clog (0 + inf i) == inf + pi/2 i",  FUNC(clog) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1753   check_complex ("clog (3 + inf i) == inf + pi/2 i",  FUNC(clog) (BUILD_COMPLEX (3, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1754   check_complex ("clog (-0 + inf i) == inf + pi/2 i",  FUNC(clog) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1755   check_complex ("clog (-3 + inf i) == inf + pi/2 i",  FUNC(clog) (BUILD_COMPLEX (-3, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_2l), 0, 0, 0);
1756   check_complex ("clog (0 - inf i) == inf - pi/2 i",  FUNC(clog) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1757   check_complex ("clog (3 - inf i) == inf - pi/2 i",  FUNC(clog) (BUILD_COMPLEX (3, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1758   check_complex ("clog (-0 - inf i) == inf - pi/2 i",  FUNC(clog) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1759   check_complex ("clog (-3 - inf i) == inf - pi/2 i",  FUNC(clog) (BUILD_COMPLEX (-3, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI_2l), 0, 0, 0);
1760 
1761   check_complex ("clog (-inf + 0 i) == inf + pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (plus_infty, M_PIl), 0, 0, 0);
1762   check_complex ("clog (-inf + 1 i) == inf + pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, 1)), BUILD_COMPLEX (plus_infty, M_PIl), 0, 0, 0);
1763   check_complex ("clog (-inf - 0 i) == inf - pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, -M_PIl), 0, 0, 0);
1764   check_complex ("clog (-inf - 1 i) == inf - pi i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, -1)), BUILD_COMPLEX (plus_infty, -M_PIl), 0, 0, 0);
1765 
1766   check_complex ("clog (inf + 0 i) == inf + 0.0 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1767   check_complex ("clog (inf + 1 i) == inf + 0.0 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, 1)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1768   check_complex ("clog (inf - 0 i) == inf - 0 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1769   check_complex ("clog (inf - 1 i) == inf - 0 i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, -1)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1770 
1771   check_complex ("clog (inf + NaN i) == inf + NaN i",  FUNC(clog) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1772   check_complex ("clog (-inf + NaN i) == inf + NaN i",  FUNC(clog) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1773 
1774   check_complex ("clog (NaN + inf i) == inf + NaN i",  FUNC(clog) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1775   check_complex ("clog (NaN - inf i) == inf + NaN i",  FUNC(clog) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1776 
1777   check_complex ("clog (0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1778   check_complex ("clog (3 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (3, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1779   check_complex ("clog (-0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1780   check_complex ("clog (-3 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (-3, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1781 
1782   check_complex ("clog (NaN + 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1783   check_complex ("clog (NaN + 5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (nan_value, 5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1784   check_complex ("clog (NaN - 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1785   check_complex ("clog (NaN - 5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog) (BUILD_COMPLEX (nan_value, -5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1786 
1787   check_complex ("clog (NaN + NaN i) == NaN + NaN i",  FUNC(clog) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1788   check_complex ("clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i",  FUNC(clog) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L), DELTA515, 0, 0);
1789 
1790   print_complex_max_error ("clog", DELTAclog, 0);
1791 }
1792 
1793 
1794 static void
1795 clog10_test (void)
1796 {
1797   errno = 0;
1798   FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
1799   if (errno == ENOSYS)
1800     /* Function not implemented.  */
1801     return;
1802 
1803   init_max_error ();
1804 
1805   check_complex ("clog10 (-0 + 0 i) == -inf + pi i plus division by zero exception",  FUNC(clog10) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_infty, M_PIl), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1806   check_complex ("clog10 (-0 - 0 i) == -inf - pi i plus division by zero exception",  FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_infty, -M_PIl), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1807 
1808   check_complex ("clog10 (0 + 0 i) == -inf + 0.0 i plus division by zero exception",  FUNC(clog10) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (minus_infty, 0.0), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1809   check_complex ("clog10 (0 - 0 i) == -inf - 0 i plus division by zero exception",  FUNC(clog10) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (minus_infty, minus_zero), 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
1810 
1811   check_complex ("clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI_34_LOG10El), DELTA520, 0, 0);
1812 
1813   check_complex ("clog10 (inf + inf i) == inf + pi/4*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI4_LOG10El), DELTA521, 0, 0);
1814   check_complex ("clog10 (inf - inf i) == inf - pi/4*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI4_LOG10El), DELTA522, 0, 0);
1815 
1816   check_complex ("clog10 (0 + inf i) == inf + pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI2_LOG10El), DELTA523, 0, 0);
1817   check_complex ("clog10 (3 + inf i) == inf + pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (3, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI2_LOG10El), DELTA524, 0, 0);
1818   check_complex ("clog10 (-0 + inf i) == inf + pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI2_LOG10El), DELTA525, 0, 0);
1819   check_complex ("clog10 (-3 + inf i) == inf + pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (-3, plus_infty)), BUILD_COMPLEX (plus_infty, M_PI2_LOG10El), DELTA526, 0, 0);
1820   check_complex ("clog10 (0 - inf i) == inf - pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI2_LOG10El), DELTA527, 0, 0);
1821   check_complex ("clog10 (3 - inf i) == inf - pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (3, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI2_LOG10El), DELTA528, 0, 0);
1822   check_complex ("clog10 (-0 - inf i) == inf - pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI2_LOG10El), DELTA529, 0, 0);
1823   check_complex ("clog10 (-3 - inf i) == inf - pi/2*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (-3, minus_infty)), BUILD_COMPLEX (plus_infty, -M_PI2_LOG10El), DELTA530, 0, 0);
1824 
1825   check_complex ("clog10 (-inf + 0 i) == inf + pi*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (plus_infty, M_PI_LOG10El), DELTA531, 0, 0);
1826   check_complex ("clog10 (-inf + 1 i) == inf + pi*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, 1)), BUILD_COMPLEX (plus_infty, M_PI_LOG10El), DELTA532, 0, 0);
1827   check_complex ("clog10 (-inf - 0 i) == inf - pi*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, -M_PI_LOG10El), DELTA533, 0, 0);
1828   check_complex ("clog10 (-inf - 1 i) == inf - pi*log10(e) i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, -1)), BUILD_COMPLEX (plus_infty, -M_PI_LOG10El), DELTA534, 0, 0);
1829 
1830   check_complex ("clog10 (inf + 0 i) == inf + 0.0 i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1831   check_complex ("clog10 (inf + 1 i) == inf + 0.0 i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, 1)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1832   check_complex ("clog10 (inf - 0 i) == inf - 0 i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1833   check_complex ("clog10 (inf - 1 i) == inf - 0 i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, -1)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1834 
1835   check_complex ("clog10 (inf + NaN i) == inf + NaN i",  FUNC(clog10) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1836   check_complex ("clog10 (-inf + NaN i) == inf + NaN i",  FUNC(clog10) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1837 
1838   check_complex ("clog10 (NaN + inf i) == inf + NaN i",  FUNC(clog10) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1839   check_complex ("clog10 (NaN - inf i) == inf + NaN i",  FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
1840 
1841   check_complex ("clog10 (0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1842   check_complex ("clog10 (3 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (3, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1843   check_complex ("clog10 (-0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1844   check_complex ("clog10 (-3 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (-3, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1845 
1846   check_complex ("clog10 (NaN + 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1847   check_complex ("clog10 (NaN + 5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (nan_value, 5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1848   check_complex ("clog10 (NaN - 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1849   check_complex ("clog10 (NaN - 5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(clog10) (BUILD_COMPLEX (nan_value, -5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
1850 
1851   check_complex ("clog10 (NaN + NaN i) == NaN + NaN i",  FUNC(clog10) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1852 
1853   check_complex ("clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i",  FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.1427786545038868803L, 0.4528483579352493248L), DELTA552, 0, 0);
1854   check_complex ("clog10 (-2 - 3 i) == 0.5569716761534183846 - 0.9375544629863747085 i",  FUNC(clog10) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (0.5569716761534183846L, -0.9375544629863747085L), DELTA553, 0, 0);
1855 
1856   print_complex_max_error ("clog10", DELTAclog10, 0);
1857 }
1858 
1859 static void
1860 conj_test (void)
1861 {
1862   init_max_error ();
1863   check_complex ("conj (0.0 + 0.0 i) == 0.0 - 0 i",  FUNC(conj) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1864   check_complex ("conj (0.0 - 0 i) == 0.0 + 0.0 i",  FUNC(conj) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1865   check_complex ("conj (NaN + NaN i) == NaN + NaN i",  FUNC(conj) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1866   check_complex ("conj (inf - inf i) == inf + inf i",  FUNC(conj) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
1867   check_complex ("conj (inf + inf i) == inf - inf i",  FUNC(conj) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
1868   check_complex ("conj (1.0 + 2.0 i) == 1.0 - 2.0 i",  FUNC(conj) (BUILD_COMPLEX (1.0, 2.0)), BUILD_COMPLEX (1.0, -2.0), 0, 0, 0);
1869   check_complex ("conj (3.0 - 4.0 i) == 3.0 + 4.0 i",  FUNC(conj) (BUILD_COMPLEX (3.0, -4.0)), BUILD_COMPLEX (3.0, 4.0), 0, 0, 0);
1870 
1871   print_complex_max_error ("conj", 0, 0);
1872 }
1873 #endif
1874 
1875 
1876 static void
1877 copysign_test (void)
1878 {
1879   init_max_error ();
1880 
1881   check_float ("copysign (0, 4) == 0",  FUNC(copysign) (0, 4), 0, 0, 0, 0);
1882   check_float ("copysign (0, -4) == -0",  FUNC(copysign) (0, -4), minus_zero, 0, 0, 0);
1883   check_float ("copysign (-0, 4) == 0",  FUNC(copysign) (minus_zero, 4), 0, 0, 0, 0);
1884   check_float ("copysign (-0, -4) == -0",  FUNC(copysign) (minus_zero, -4), minus_zero, 0, 0, 0);
1885 
1886   check_float ("copysign (inf, 0) == inf",  FUNC(copysign) (plus_infty, 0), plus_infty, 0, 0, 0);
1887   check_float ("copysign (inf, -0) == -inf",  FUNC(copysign) (plus_infty, minus_zero), minus_infty, 0, 0, 0);
1888   check_float ("copysign (-inf, 0) == inf",  FUNC(copysign) (minus_infty, 0), plus_infty, 0, 0, 0);
1889   check_float ("copysign (-inf, -0) == -inf",  FUNC(copysign) (minus_infty, minus_zero), minus_infty, 0, 0, 0);
1890 
1891   check_float ("copysign (0, inf) == 0",  FUNC(copysign) (0, plus_infty), 0, 0, 0, 0);
1892   check_float ("copysign (0, -0) == -0",  FUNC(copysign) (0, minus_zero), minus_zero, 0, 0, 0);
1893   check_float ("copysign (-0, inf) == 0",  FUNC(copysign) (minus_zero, plus_infty), 0, 0, 0, 0);
1894   check_float ("copysign (-0, -0) == -0",  FUNC(copysign) (minus_zero, minus_zero), minus_zero, 0, 0, 0);
1895 
1896   /* XXX More correctly we would have to check the sign of the NaN.  */
1897   check_float ("copysign (NaN, 0) == NaN",  FUNC(copysign) (nan_value, 0), nan_value, 0, 0, 0);
1898   check_float ("copysign (NaN, -0) == NaN",  FUNC(copysign) (nan_value, minus_zero), nan_value, 0, 0, 0);
1899   check_float ("copysign (-NaN, 0) == NaN",  FUNC(copysign) (-nan_value, 0), nan_value, 0, 0, 0);
1900   check_float ("copysign (-NaN, -0) == NaN",  FUNC(copysign) (-nan_value, minus_zero), nan_value, 0, 0, 0);
1901 
1902   print_max_error ("copysign", 0, 0);
1903 }
1904 
1905 static void
1906 cos_test (void)
1907 {
1908   errno = 0;
1909   FUNC(cos) (0);
1910   if (errno == ENOSYS)
1911     /* Function not implemented.  */
1912     return;
1913 
1914   init_max_error ();
1915 
1916   check_float ("cos (0) == 1",  FUNC(cos) (0), 1, 0, 0, 0);
1917   check_float ("cos (-0) == 1",  FUNC(cos) (minus_zero), 1, 0, 0, 0);
1918   check_float ("cos (inf) == NaN plus invalid exception",  FUNC(cos) (plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
1919   check_float ("cos (-inf) == NaN plus invalid exception",  FUNC(cos) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
1920   check_float ("cos (NaN) == NaN",  FUNC(cos) (nan_value), nan_value, 0, 0, 0);
1921 
1922   check_float ("cos (M_PI_6l * 2.0) == 0.5",  FUNC(cos) (M_PI_6l * 2.0), 0.5, DELTA582, 0, 0);
1923   check_float ("cos (M_PI_6l * 4.0) == -0.5",  FUNC(cos) (M_PI_6l * 4.0), -0.5, DELTA583, 0, 0);
1924   check_float ("cos (pi/2) == 0",  FUNC(cos) (M_PI_2l), 0, DELTA584, 0, 0);
1925 
1926   check_float ("cos (0.7) == 0.76484218728448842625585999019186495",  FUNC(cos) (0.7L), 0.76484218728448842625585999019186495L, DELTA585, 0, 0);
1927 
1928   print_max_error ("cos", DELTAcos, 0);
1929 }
1930 
1931 static void
1932 cosh_test (void)
1933 {
1934   errno = 0;
1935   FUNC(cosh) (0.7L);
1936   if (errno == ENOSYS)
1937     /* Function not implemented.  */
1938     return;
1939 
1940   init_max_error ();
1941   check_float ("cosh (0) == 1",  FUNC(cosh) (0), 1, 0, 0, 0);
1942   check_float ("cosh (-0) == 1",  FUNC(cosh) (minus_zero), 1, 0, 0, 0);
1943 
1944 #ifndef TEST_INLINE
1945   check_float ("cosh (inf) == inf",  FUNC(cosh) (plus_infty), plus_infty, 0, 0, 0);
1946   check_float ("cosh (-inf) == inf",  FUNC(cosh) (minus_infty), plus_infty, 0, 0, 0);
1947 #endif
1948   check_float ("cosh (NaN) == NaN",  FUNC(cosh) (nan_value), nan_value, 0, 0, 0);
1949 
1950   check_float ("cosh (0.7) == 1.255169005630943018",  FUNC(cosh) (0.7L), 1.255169005630943018L, DELTA591, 0, 0);
1951   print_max_error ("cosh", DELTAcosh, 0);
1952 }
1953 
1954 
1955 #if 0 /* XXX scp XXX */
1956 static void
1957 cpow_test (void)
1958 {
1959   errno = 0;
1960   FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
1961   if (errno == ENOSYS)
1962     /* Function not implemented.  */
1963     return;
1964 
1965   init_max_error ();
1966 
1967   check_complex ("cpow (1 + 0 i, 0 + 0 i) == 1.0 + 0.0 i",  FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1968   check_complex ("cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i",  FUNC(cpow) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0)), BUILD_COMPLEX (1024.0, 0.0), 0, 0, 0);
1969 
1970   check_complex ("cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i",  FUNC(cpow) (BUILD_COMPLEX (M_El, 0), BUILD_COMPLEX (0, 2 * M_PIl)), BUILD_COMPLEX (1.0, 0.0), DELTA594, 0, 0);
1971   check_complex ("cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i",  FUNC(cpow) (BUILD_COMPLEX (2, 3), BUILD_COMPLEX (4, 0)), BUILD_COMPLEX (-119.0, -120.0), DELTA595, 0, 0);
1972 
1973   check_complex ("cpow (NaN + NaN i, NaN + NaN i) == NaN + NaN i",  FUNC(cpow) (BUILD_COMPLEX (nan_value, nan_value), BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1974 
1975   print_complex_max_error ("cpow", DELTAcpow, 0);
1976 }
1977 
1978 static void
1979 cproj_test (void)
1980 {
1981   init_max_error ();
1982   check_complex ("cproj (0.0 + 0.0 i) == 0.0 + 0.0 i",  FUNC(cproj) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
1983   check_complex ("cproj (-0 - 0 i) == -0 - 0 i",  FUNC(cproj) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
1984   check_complex ("cproj (0.0 - 0 i) == 0.0 - 0 i",  FUNC(cproj) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
1985   check_complex ("cproj (-0 + 0.0 i) == -0 + 0.0 i",  FUNC(cproj) (BUILD_COMPLEX (minus_zero, 0.0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
1986 
1987   check_complex ("cproj (NaN + NaN i) == NaN + NaN i",  FUNC(cproj) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
1988 
1989   check_complex ("cproj (inf + inf i) == inf + 0.0 i",  FUNC(cproj) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1990   check_complex ("cproj (inf - inf i) == inf - 0 i",  FUNC(cproj) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1991   check_complex ("cproj (-inf + inf i) == inf + 0.0 i",  FUNC(cproj) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
1992   check_complex ("cproj (-inf - inf i) == inf - 0 i",  FUNC(cproj) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
1993 
1994   check_complex ("cproj (1.0 + 0.0 i) == 1.0 + 0.0 i",  FUNC(cproj) (BUILD_COMPLEX (1.0, 0.0)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
1995   check_complex ("cproj (2.0 + 3.0 i) == 0.2857142857142857142857142857142857 + 0.42857142857142857142857142857142855 i",  FUNC(cproj) (BUILD_COMPLEX (2.0, 3.0)), BUILD_COMPLEX (0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L), 0, 0, 0);
1996 
1997   print_complex_max_error ("cproj", 0, 0);
1998 }
1999 
2000 static void
2001 creal_test (void)
2002 {
2003   init_max_error ();
2004   check_float ("creal (0.0 + 1.0 i) == 0.0",  FUNC(creal) (BUILD_COMPLEX (0.0, 1.0)), 0.0, 0, 0, 0);
2005   check_float ("creal (-0 + 1.0 i) == -0",  FUNC(creal) (BUILD_COMPLEX (minus_zero, 1.0)), minus_zero, 0, 0, 0);
2006   check_float ("creal (NaN + 1.0 i) == NaN",  FUNC(creal) (BUILD_COMPLEX (nan_value, 1.0)), nan_value, 0, 0, 0);
2007   check_float ("creal (NaN + NaN i) == NaN",  FUNC(creal) (BUILD_COMPLEX (nan_value, nan_value)), nan_value, 0, 0, 0);
2008   check_float ("creal (inf + 1.0 i) == inf",  FUNC(creal) (BUILD_COMPLEX (plus_infty, 1.0)), plus_infty, 0, 0, 0);
2009   check_float ("creal (-inf + 1.0 i) == -inf",  FUNC(creal) (BUILD_COMPLEX (minus_infty, 1.0)), minus_infty, 0, 0, 0);
2010   check_float ("creal (2.0 + 3.0 i) == 2.0",  FUNC(creal) (BUILD_COMPLEX (2.0, 3.0)), 2.0, 0, 0, 0);
2011 
2012   print_max_error ("creal", 0, 0);
2013 }
2014 
2015 static void
2016 csin_test (void)
2017 {
2018   errno = 0;
2019   FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
2020   if (errno == ENOSYS)
2021     /* Function not implemented.  */
2022     return;
2023 
2024   init_max_error ();
2025 
2026   check_complex ("csin (0.0 + 0.0 i) == 0.0 + 0.0 i",  FUNC(csin) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2027   check_complex ("csin (-0 + 0.0 i) == -0 + 0.0 i",  FUNC(csin) (BUILD_COMPLEX (minus_zero, 0.0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
2028   check_complex ("csin (0.0 - 0 i) == 0 - 0 i",  FUNC(csin) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (0, minus_zero), 0, 0, 0);
2029   check_complex ("csin (-0 - 0 i) == -0 - 0 i",  FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
2030 
2031   check_complex ("csin (0.0 + inf i) == 0.0 + inf i",  FUNC(csin) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
2032   check_complex ("csin (-0 + inf i) == -0 + inf i",  FUNC(csin) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (minus_zero, plus_infty), 0, 0, 0);
2033   check_complex ("csin (0.0 - inf i) == 0.0 - inf i",  FUNC(csin) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
2034   check_complex ("csin (-0 - inf i) == -0 - inf i",  FUNC(csin) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (minus_zero, minus_infty), 0, 0, 0);
2035 
2036   check_complex ("csin (inf + 0.0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (plus_infty, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2037   check_complex ("csin (-inf + 0.0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (minus_infty, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2038   check_complex ("csin (inf - 0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2039   check_complex ("csin (-inf - 0 i) == NaN + 0.0 i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2040 
2041   check_complex ("csin (inf + inf i) == NaN + inf i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2042   check_complex ("csin (-inf + inf i) == NaN + inf i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2043   check_complex ("csin (inf - inf i) == NaN + inf i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2044   check_complex ("csin (-inf - inf i) == NaN + inf i plus invalid exception and sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2045 
2046   check_complex ("csin (inf + 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(csin) (BUILD_COMPLEX (plus_infty, 6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2047   check_complex ("csin (inf - 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(csin) (BUILD_COMPLEX (plus_infty, -6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2048   check_complex ("csin (-inf + 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(csin) (BUILD_COMPLEX (minus_infty, 6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2049   check_complex ("csin (-inf - 6.75 i) == NaN + NaN i plus invalid exception",  FUNC(csin) (BUILD_COMPLEX (minus_infty, -6.75)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2050 
2051   check_complex ("csin (4.625 + inf i) == -inf - inf i",  FUNC(csin) (BUILD_COMPLEX (4.625, plus_infty)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
2052   check_complex ("csin (4.625 - inf i) == -inf + inf i",  FUNC(csin) (BUILD_COMPLEX (4.625, minus_infty)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
2053   check_complex ("csin (-4.625 + inf i) == inf - inf i",  FUNC(csin) (BUILD_COMPLEX (-4.625, plus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2054   check_complex ("csin (-4.625 - inf i) == inf + inf i",  FUNC(csin) (BUILD_COMPLEX (-4.625, minus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2055 
2056   check_complex ("csin (NaN + 0.0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2057   check_complex ("csin (NaN - 0 i) == NaN + 0.0 i plus sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2058 
2059   check_complex ("csin (NaN + inf i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
2060   check_complex ("csin (NaN - inf i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(csin) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
2061 
2062   check_complex ("csin (NaN + 9.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (nan_value, 9.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2063   check_complex ("csin (NaN - 9.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (nan_value, -9.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2064 
2065   check_complex ("csin (0.0 + NaN i) == 0.0 + NaN i",  FUNC(csin) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, 0);
2066   check_complex ("csin (-0 + NaN i) == -0 + NaN i",  FUNC(csin) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (minus_zero, nan_value), 0, 0, 0);
2067 
2068   check_complex ("csin (10.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (10.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2069   check_complex ("csin (NaN - 10.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (nan_value, -10.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2070 
2071   check_complex ("csin (inf + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2072   check_complex ("csin (-inf + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csin) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2073 
2074   check_complex ("csin (NaN + NaN i) == NaN + NaN i",  FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
2075 
2076   check_complex ("csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i",  FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.1664563419657581376L, 1.1544997246948547371L), DELTA652, 0, 0);
2077 
2078   check_complex ("csin (-2 - 3 i) == -9.1544991469114295734 + 4.1689069599665643507 i",  FUNC(csin) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-9.1544991469114295734L, 4.1689069599665643507L), 0, 0, 0);
2079 
2080   print_complex_max_error ("csin", DELTAcsin, 0);
2081 }
2082 
2083 
2084 static void
2085 csinh_test (void)
2086 {
2087   errno = 0;
2088   FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
2089   if (errno == ENOSYS)
2090     /* Function not implemented.  */
2091     return;
2092 
2093   init_max_error ();
2094 
2095   check_complex ("csinh (0.0 + 0.0 i) == 0.0 + 0.0 i",  FUNC(csinh) (BUILD_COMPLEX (0.0, 0.0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2096   check_complex ("csinh (-0 + 0.0 i) == -0 + 0.0 i",  FUNC(csinh) (BUILD_COMPLEX (minus_zero, 0.0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
2097   check_complex ("csinh (0.0 - 0 i) == 0.0 - 0 i",  FUNC(csinh) (BUILD_COMPLEX (0.0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
2098   check_complex ("csinh (-0 - 0 i) == -0 - 0 i",  FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
2099 
2100   check_complex ("csinh (0.0 + inf i) == 0.0 + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty)), BUILD_COMPLEX (0.0, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2101   check_complex ("csinh (-0 + inf i) == 0.0 + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (0.0, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2102   check_complex ("csinh (0.0 - inf i) == 0.0 + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty)), BUILD_COMPLEX (0.0, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2103   check_complex ("csinh (-0 - inf i) == 0.0 + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (0.0, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2104 
2105   check_complex ("csinh (inf + 0.0 i) == inf + 0.0 i",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
2106   check_complex ("csinh (-inf + 0.0 i) == -inf + 0.0 i",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, 0.0)), BUILD_COMPLEX (minus_infty, 0.0), 0, 0, 0);
2107   check_complex ("csinh (inf - 0 i) == inf - 0 i",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
2108   check_complex ("csinh (-inf - 0 i) == -inf - 0 i",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (minus_infty, minus_zero), 0, 0, 0);
2109 
2110   check_complex ("csinh (inf + inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2111   check_complex ("csinh (-inf + inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2112   check_complex ("csinh (inf - inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2113   check_complex ("csinh (-inf - inf i) == inf + NaN i plus invalid exception and sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
2114 
2115   check_complex ("csinh (inf + 4.625 i) == -inf - inf i",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, 4.625)), BUILD_COMPLEX (minus_infty, minus_infty), 0, 0, 0);
2116   check_complex ("csinh (-inf + 4.625 i) == inf - inf i",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, 4.625)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2117   check_complex ("csinh (inf - 4.625 i) == -inf + inf i",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, -4.625)), BUILD_COMPLEX (minus_infty, plus_infty), 0, 0, 0);
2118   check_complex ("csinh (-inf - 4.625 i) == inf + inf i",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, -4.625)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2119 
2120   check_complex ("csinh (6.75 + inf i) == NaN + NaN i plus invalid exception",  FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2121   check_complex ("csinh (-6.75 + inf i) == NaN + NaN i plus invalid exception",  FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2122   check_complex ("csinh (6.75 - inf i) == NaN + NaN i plus invalid exception",  FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2123   check_complex ("csinh (-6.75 - inf i) == NaN + NaN i plus invalid exception",  FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2124 
2125   check_complex ("csinh (0.0 + NaN i) == 0.0 + NaN i plus sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
2126   check_complex ("csinh (-0 + NaN i) == 0.0 + NaN i plus sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
2127 
2128   check_complex ("csinh (inf + NaN i) == inf + NaN i plus sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
2129   check_complex ("csinh (-inf + NaN i) == inf + NaN i plus sign of zero/inf not specified",  FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, IGNORE_ZERO_INF_SIGN);
2130 
2131   check_complex ("csinh (9.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2132   check_complex ("csinh (-9.0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (-9.0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2133 
2134   check_complex ("csinh (NaN + 0.0 i) == NaN + 0.0 i",  FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, 0);
2135   check_complex ("csinh (NaN - 0 i) == NaN - 0 i",  FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, minus_zero), 0, 0, 0);
2136 
2137   check_complex ("csinh (NaN + 10.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2138   check_complex ("csinh (NaN - 10.0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2139 
2140   check_complex ("csinh (NaN + inf i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2141   check_complex ("csinh (NaN - inf i) == NaN + NaN i plus invalid exception allowed",  FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2142 
2143   check_complex ("csinh (NaN + NaN i) == NaN + NaN i",  FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
2144 
2145   check_complex ("csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i",  FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.27487868678117583582L, 1.1698665727426565139L), DELTA691, 0, 0);
2146   check_complex ("csinh (-2 - 3 i) == 3.5905645899857799520 - 0.5309210862485198052 i",  FUNC(csinh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (3.5905645899857799520L, -0.5309210862485198052L), DELTA692, 0, 0);
2147 
2148   print_complex_max_error ("csinh", DELTAcsinh, 0);
2149 }
2150 
2151 static void
2152 csqrt_test (void)
2153 {
2154   errno = 0;
2155   FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
2156   if (errno == ENOSYS)
2157     /* Function not implemented.  */
2158     return;
2159 
2160   init_max_error ();
2161 
2162   check_complex ("csqrt (0 + 0 i) == 0.0 + 0.0 i",  FUNC(csqrt) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2163   check_complex ("csqrt (0 - 0 i) == 0 - 0 i",  FUNC(csqrt) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0, minus_zero), 0, 0, 0);
2164   check_complex ("csqrt (-0 + 0 i) == 0.0 + 0.0 i",  FUNC(csqrt) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2165   check_complex ("csqrt (-0 - 0 i) == 0.0 - 0 i",  FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
2166 
2167   check_complex ("csqrt (-inf + 0 i) == 0.0 + inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
2168   check_complex ("csqrt (-inf + 6 i) == 0.0 + inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, 6)), BUILD_COMPLEX (0.0, plus_infty), 0, 0, 0);
2169   check_complex ("csqrt (-inf - 0 i) == 0.0 - inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
2170   check_complex ("csqrt (-inf - 6 i) == 0.0 - inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, -6)), BUILD_COMPLEX (0.0, minus_infty), 0, 0, 0);
2171 
2172   check_complex ("csqrt (inf + 0 i) == inf + 0.0 i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
2173   check_complex ("csqrt (inf + 6 i) == inf + 0.0 i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 6)), BUILD_COMPLEX (plus_infty, 0.0), 0, 0, 0);
2174   check_complex ("csqrt (inf - 0 i) == inf - 0 i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
2175   check_complex ("csqrt (inf - 6 i) == inf - 0 i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, -6)), BUILD_COMPLEX (plus_infty, minus_zero), 0, 0, 0);
2176 
2177   check_complex ("csqrt (0 + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2178   check_complex ("csqrt (4 + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (4, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2179   check_complex ("csqrt (inf + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2180   check_complex ("csqrt (-0 + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2181   check_complex ("csqrt (-4 + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (-4, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2182   check_complex ("csqrt (-inf + inf i) == inf + inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, plus_infty)), BUILD_COMPLEX (plus_infty, plus_infty), 0, 0, 0);
2183   check_complex ("csqrt (0 - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2184   check_complex ("csqrt (4 - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (4, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2185   check_complex ("csqrt (inf - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2186   check_complex ("csqrt (-0 - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2187   check_complex ("csqrt (-4 - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (-4, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2188   check_complex ("csqrt (-inf - inf i) == inf - inf i",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, minus_infty)), BUILD_COMPLEX (plus_infty, minus_infty), 0, 0, 0);
2189 
2190   check_complex ("csqrt (-inf + NaN i) == NaN + inf i plus sign of zero/inf not specified",  FUNC(csqrt) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (nan_value, plus_infty), 0, 0, IGNORE_ZERO_INF_SIGN);
2191 
2192   check_complex ("csqrt (inf + NaN i) == inf + NaN i",  FUNC(csqrt) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (plus_infty, nan_value), 0, 0, 0);
2193 
2194   check_complex ("csqrt (0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2195   check_complex ("csqrt (1 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (1, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2196   check_complex ("csqrt (-0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2197   check_complex ("csqrt (-1 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (-1, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2198 
2199   check_complex ("csqrt (NaN + 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2200   check_complex ("csqrt (NaN + 8 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (nan_value, 8)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2201   check_complex ("csqrt (NaN - 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2202   check_complex ("csqrt (NaN - 8 i) == NaN + NaN i plus invalid exception allowed",  FUNC(csqrt) (BUILD_COMPLEX (nan_value, -8)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2203 
2204   check_complex ("csqrt (NaN + NaN i) == NaN + NaN i",  FUNC(csqrt) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
2205 
2206   check_complex ("csqrt (16.0 - 30.0 i) == 5.0 - 3.0 i",  FUNC(csqrt) (BUILD_COMPLEX (16.0, -30.0)), BUILD_COMPLEX (5.0, -3.0), 0, 0, 0);
2207   check_complex ("csqrt (-1 + 0 i) == 0.0 + 1.0 i",  FUNC(csqrt) (BUILD_COMPLEX (-1, 0)), BUILD_COMPLEX (0.0, 1.0), 0, 0, 0);
2208   check_complex ("csqrt (0 + 2 i) == 1.0 + 1.0 i",  FUNC(csqrt) (BUILD_COMPLEX (0, 2)), BUILD_COMPLEX (1.0, 1.0), 0, 0, 0);
2209   check_complex ("csqrt (119 + 120 i) == 12.0 + 5.0 i",  FUNC(csqrt) (BUILD_COMPLEX (119, 120)), BUILD_COMPLEX (12.0, 5.0), 0, 0, 0);
2210   check_complex ("csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i",  FUNC(csqrt) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.022067610030026450706487883081139L, 0.58704531296356521154977678719838035L), DELTA732, 0, 0);
2211   check_complex ("csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i",  FUNC(csqrt) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L), DELTA733, 0, 0);
2212   check_complex ("csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i",  FUNC(csqrt) (BUILD_COMPLEX (-2, 3)), BUILD_COMPLEX (0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L), DELTA734, 0, 0);
2213 
2214   print_complex_max_error ("csqrt", DELTAcsqrt, 0);
2215 }
2216 
2217 static void
2218 ctan_test (void)
2219 {
2220   errno = 0;
2221   FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
2222   if (errno == ENOSYS)
2223     /* Function not implemented.  */
2224     return;
2225 
2226   init_max_error ();
2227 
2228   check_complex ("ctan (0 + 0 i) == 0.0 + 0.0 i",  FUNC(ctan) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2229   check_complex ("ctan (0 - 0 i) == 0.0 - 0 i",  FUNC(ctan) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
2230   check_complex ("ctan (-0 + 0 i) == -0 + 0.0 i",  FUNC(ctan) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
2231   check_complex ("ctan (-0 - 0 i) == -0 - 0 i",  FUNC(ctan) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
2232 
2233   check_complex ("ctan (0 + inf i) == 0.0 + 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (0.0, 1.0), 0, 0, 0);
2234   check_complex ("ctan (1 + inf i) == 0.0 + 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (1, plus_infty)), BUILD_COMPLEX (0.0, 1.0), 0, 0, 0);
2235   check_complex ("ctan (-0 + inf i) == -0 + 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (minus_zero, 1.0), 0, 0, 0);
2236   check_complex ("ctan (-1 + inf i) == -0 + 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (-1, plus_infty)), BUILD_COMPLEX (minus_zero, 1.0), 0, 0, 0);
2237 
2238   check_complex ("ctan (0 - inf i) == 0.0 - 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (0.0, -1.0), 0, 0, 0);
2239   check_complex ("ctan (1 - inf i) == 0.0 - 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (1, minus_infty)), BUILD_COMPLEX (0.0, -1.0), 0, 0, 0);
2240   check_complex ("ctan (-0 - inf i) == -0 - 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (minus_zero, -1.0), 0, 0, 0);
2241   check_complex ("ctan (-1 - inf i) == -0 - 1.0 i",  FUNC(ctan) (BUILD_COMPLEX (-1, minus_infty)), BUILD_COMPLEX (minus_zero, -1.0), 0, 0, 0);
2242 
2243   check_complex ("ctan (inf + 0 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2244   check_complex ("ctan (inf + 2 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (plus_infty, 2)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2245   check_complex ("ctan (-inf + 0 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2246   check_complex ("ctan (-inf + 2 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (minus_infty, 2)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2247   check_complex ("ctan (inf - 0 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2248   check_complex ("ctan (inf - 2 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (plus_infty, -2)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2249   check_complex ("ctan (-inf - 0 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2250   check_complex ("ctan (-inf - 2 i) == NaN + NaN i plus invalid exception",  FUNC(ctan) (BUILD_COMPLEX (minus_infty, -2)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2251 
2252   check_complex ("ctan (NaN + inf i) == 0.0 + 1.0 i plus sign of zero/inf not specified",  FUNC(ctan) (BUILD_COMPLEX (nan_value, plus_infty)), BUILD_COMPLEX (0.0, 1.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2253   check_complex ("ctan (NaN - inf i) == 0.0 - 1.0 i plus sign of zero/inf not specified",  FUNC(ctan) (BUILD_COMPLEX (nan_value, minus_infty)), BUILD_COMPLEX (0.0, -1.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2254 
2255   check_complex ("ctan (0 + NaN i) == 0.0 + NaN i",  FUNC(ctan) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (0.0, nan_value), 0, 0, 0);
2256   check_complex ("ctan (-0 + NaN i) == -0 + NaN i",  FUNC(ctan) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (minus_zero, nan_value), 0, 0, 0);
2257 
2258   check_complex ("ctan (0.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (0.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2259   check_complex ("ctan (-4.5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (-4.5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2260 
2261   check_complex ("ctan (NaN + 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2262   check_complex ("ctan (NaN + 5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (nan_value, 5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2263   check_complex ("ctan (NaN - 0 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2264   check_complex ("ctan (NaN - 0.25 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctan) (BUILD_COMPLEX (nan_value, -0.25)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2265 
2266   check_complex ("ctan (NaN + NaN i) == NaN + NaN i",  FUNC(ctan) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
2267 
2268   check_complex ("ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i",  FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (0.1720734197630349001L, 0.9544807059989405538L), DELTA766, 0, 0);
2269   check_complex ("ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i",  FUNC(ctan) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (0.0037640256415042482L, -1.0032386273536098014L), DELTA767, 0, 0);
2270 
2271   print_complex_max_error ("ctan", DELTActan, 0);
2272 }
2273 
2274 
2275 static void
2276 ctanh_test (void)
2277 {
2278   errno = 0;
2279   FUNC(ctanh) (BUILD_COMPLEX (0, 0));
2280   if (errno == ENOSYS)
2281     /* Function not implemented.  */
2282     return;
2283 
2284   init_max_error ();
2285 
2286   check_complex ("ctanh (0 + 0 i) == 0.0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (0, 0)), BUILD_COMPLEX (0.0, 0.0), 0, 0, 0);
2287   check_complex ("ctanh (0 - 0 i) == 0.0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (0, minus_zero)), BUILD_COMPLEX (0.0, minus_zero), 0, 0, 0);
2288   check_complex ("ctanh (-0 + 0 i) == -0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_zero, 0)), BUILD_COMPLEX (minus_zero, 0.0), 0, 0, 0);
2289   check_complex ("ctanh (-0 - 0 i) == -0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_zero)), BUILD_COMPLEX (minus_zero, minus_zero), 0, 0, 0);
2290 
2291   check_complex ("ctanh (inf + 0 i) == 1.0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 0)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
2292   check_complex ("ctanh (inf + 1 i) == 1.0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (plus_infty, 1)), BUILD_COMPLEX (1.0, 0.0), 0, 0, 0);
2293   check_complex ("ctanh (inf - 0 i) == 1.0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (plus_infty, minus_zero)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
2294   check_complex ("ctanh (inf - 1 i) == 1.0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (plus_infty, -1)), BUILD_COMPLEX (1.0, minus_zero), 0, 0, 0);
2295   check_complex ("ctanh (-inf + 0 i) == -1.0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 0)), BUILD_COMPLEX (-1.0, 0.0), 0, 0, 0);
2296   check_complex ("ctanh (-inf + 1 i) == -1.0 + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 1)), BUILD_COMPLEX (-1.0, 0.0), 0, 0, 0);
2297   check_complex ("ctanh (-inf - 0 i) == -1.0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_infty, minus_zero)), BUILD_COMPLEX (-1.0, minus_zero), 0, 0, 0);
2298   check_complex ("ctanh (-inf - 1 i) == -1.0 - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (minus_infty, -1)), BUILD_COMPLEX (-1.0, minus_zero), 0, 0, 0);
2299 
2300   check_complex ("ctanh (0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (0, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2301   check_complex ("ctanh (2 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (2, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2302   check_complex ("ctanh (0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (0, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2303   check_complex ("ctanh (2 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (2, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2304   check_complex ("ctanh (-0 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (minus_zero, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2305   check_complex ("ctanh (-2 + inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (-2, plus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2306   check_complex ("ctanh (-0 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2307   check_complex ("ctanh (-2 - inf i) == NaN + NaN i plus invalid exception",  FUNC(ctanh) (BUILD_COMPLEX (-2, minus_infty)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION);
2308 
2309   check_complex ("ctanh (inf + NaN i) == 1.0 + 0.0 i plus sign of zero/inf not specified",  FUNC(ctanh) (BUILD_COMPLEX (plus_infty, nan_value)), BUILD_COMPLEX (1.0, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2310   check_complex ("ctanh (-inf + NaN i) == -1.0 + 0.0 i plus sign of zero/inf not specified",  FUNC(ctanh) (BUILD_COMPLEX (minus_infty, nan_value)), BUILD_COMPLEX (-1.0, 0.0), 0, 0, IGNORE_ZERO_INF_SIGN);
2311 
2312   check_complex ("ctanh (NaN + 0 i) == NaN + 0.0 i",  FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0)), BUILD_COMPLEX (nan_value, 0.0), 0, 0, 0);
2313   check_complex ("ctanh (NaN - 0 i) == NaN - 0 i",  FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_zero)), BUILD_COMPLEX (nan_value, minus_zero), 0, 0, 0);
2314 
2315   check_complex ("ctanh (NaN + 0.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2316   check_complex ("ctanh (NaN - 4.5 i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (nan_value, -4.5)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2317 
2318   check_complex ("ctanh (0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (0, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2319   check_complex ("ctanh (5 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (5, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2320   check_complex ("ctanh (-0 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (minus_zero, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2321   check_complex ("ctanh (-0.25 + NaN i) == NaN + NaN i plus invalid exception allowed",  FUNC(ctanh) (BUILD_COMPLEX (-0.25, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, INVALID_EXCEPTION_OK);
2322 
2323   check_complex ("ctanh (NaN + NaN i) == NaN + NaN i",  FUNC(ctanh) (BUILD_COMPLEX (nan_value, nan_value)), BUILD_COMPLEX (nan_value, nan_value), 0, 0, 0);
2324 
2325   check_complex ("ctanh (0 + pi/4 i) == 0.0 + 1.0 i",  FUNC(ctanh) (BUILD_COMPLEX (0, M_PI_4l)), BUILD_COMPLEX (0.0, 1.0), DELTA799, 0, 0);
2326 
2327   check_complex ("ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i",  FUNC(ctanh) (BUILD_COMPLEX (0.7L, 1.2L)), BUILD_COMPLEX (1.3472197399061191630L, 0.4778641038326365540L), DELTA800, 0, 0);
2328   check_complex ("ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i",  FUNC(ctanh) (BUILD_COMPLEX (-2, -3)), BUILD_COMPLEX (-0.9653858790221331242L, 0.0098843750383224937L), DELTA801, 0, 0);
2329 
2330   print_complex_max_error ("ctanh", DELTActanh, 0);
2331 }
2332 #endif
2333 
2334 static void
2335 erf_test (void)
2336 {
2337   errno = 0;
2338   FUNC(erf) (0);
2339   if (errno == ENOSYS)
2340     /* Function not implemented.  */
2341     return;
2342 
2343   init_max_error ();
2344 
2345   check_float ("erf (0) == 0",  FUNC(erf) (0), 0, 0, 0, 0);
2346   check_float ("erf (-0) == -0",  FUNC(erf) (minus_zero), minus_zero, 0, 0, 0);
2347   check_float ("erf (inf) == 1",  FUNC(erf) (plus_infty), 1, 0, 0, 0);
2348   check_float ("erf (-inf) == -1",  FUNC(erf) (minus_infty), -1, 0, 0, 0);
2349   check_float ("erf (NaN) == NaN",  FUNC(erf) (nan_value), nan_value, 0, 0, 0);
2350 
2351   check_float ("erf (0.7) == 0.67780119383741847297",  FUNC(erf) (0.7L), 0.67780119383741847297L, 0, 0, 0);
2352 
2353   check_float ("erf (1.2) == 0.91031397822963538024",  FUNC(erf) (1.2L), 0.91031397822963538024L, 0, 0, 0);
2354   check_float ("erf (2.0) == 0.99532226501895273416",  FUNC(erf) (2.0), 0.99532226501895273416L, 0, 0, 0);
2355   check_float ("erf (4.1) == 0.99999999329997234592",  FUNC(erf) (4.1L), 0.99999999329997234592L, 0, 0, 0);
2356   check_float ("erf (27) == 1.0",  FUNC(erf) (27), 1.0L, 0, 0, 0);
2357 
2358   print_max_error ("erf", 0, 0);
2359 }
2360 
2361 
2362 static void
2363 erfc_test (void)
2364 {
2365   errno = 0;
2366   FUNC(erfc) (0);
2367   if (errno == ENOSYS)
2368     /* Function not implemented.  */
2369     return;
2370 
2371   init_max_error ();
2372 
2373   check_float ("erfc (inf) == 0.0",  FUNC(erfc) (plus_infty), 0.0, 0, 0, 0);
2374   check_float ("erfc (-inf) == 2.0",  FUNC(erfc) (minus_infty), 2.0, 0, 0, 0);
2375   check_float ("erfc (0.0) == 1.0",  FUNC(erfc) (0.0), 1.0, 0, 0, 0);
2376   check_float ("erfc (-0) == 1.0",  FUNC(erfc) (minus_zero), 1.0, 0, 0, 0);
2377   check_float ("erfc (NaN) == NaN",  FUNC(erfc) (nan_value), nan_value, 0, 0, 0);
2378 
2379   check_float ("erfc (0.7) == 0.32219880616258152702",  FUNC(erfc) (0.7L), 0.32219880616258152702L, DELTA817, 0, 0);
2380 
2381   check_float ("erfc (1.2) == 0.089686021770364619762",  FUNC(erfc) (1.2L), 0.089686021770364619762L, DELTA818, 0, 0);
2382   check_float ("erfc (2.0) == 0.0046777349810472658379",  FUNC(erfc) (2.0), 0.0046777349810472658379L, DELTA819, 0, 0);
2383   check_float ("erfc (4.1) == 0.67000276540848983727e-8",  FUNC(erfc) (4.1L), 0.67000276540848983727e-8L, DELTA820, 0, 0);
2384   check_float ("erfc (9) == 0.41370317465138102381e-36",  FUNC(erfc) (9), 0.41370317465138102381e-36L, DELTA821, 0, 0);
2385 
2386   print_max_error ("erfc", DELTAerfc, 0);
2387 }
2388 
2389 static void
2390 exp_test (void)
2391 {
2392   errno = 0;
2393   FUNC(exp) (0);
2394   if (errno == ENOSYS)
2395     /* Function not implemented.  */
2396     return;
2397 
2398   init_max_error ();
2399 
2400   check_float ("exp (0) == 1",  FUNC(exp) (0), 1, 0, 0, 0);
2401   check_float ("exp (-0) == 1",  FUNC(exp) (minus_zero), 1, 0, 0, 0);
2402 
2403 #ifndef TEST_INLINE
2404   check_float ("exp (inf) == inf",  FUNC(exp) (plus_infty), plus_infty, 0, 0, 0);
2405   check_float ("exp (-inf) == 0",  FUNC(exp) (minus_infty), 0, 0, 0, 0);
2406 #endif
2407   check_float ("exp (NaN) == NaN",  FUNC(exp) (nan_value), nan_value, 0, 0, 0);
2408   check_float ("exp (1) == e",  FUNC(exp) (1), M_El, 0, 0, 0);
2409 
2410   check_float ("exp (2) == e^2",  FUNC(exp) (2), M_E2l, 0, 0, 0);
2411   check_float ("exp (3) == e^3",  FUNC(exp) (3), M_E3l, 0, 0, 0);
2412   check_float ("exp (0.7) == 2.0137527074704765216",  FUNC(exp) (0.7L), 2.0137527074704765216L, DELTA830, 0, 0);
2413   check_float ("exp (50.0) == 5184705528587072464087.45332293348538",  FUNC(exp) (50.0L), 5184705528587072464087.45332293348538L, DELTA831, 0, 0);
2414 #ifdef TEST_LDOUBLE
2415   /* The result can only be represented in long double.  */
2416   check_float ("exp (1000.0) == 0.197007111401704699388887935224332313e435",  FUNC(exp) (1000.0L), 0.197007111401704699388887935224332313e435L, DELTA832, 0, 0);
2417 #endif
2418   print_max_error ("exp", DELTAexp, 0);
2419 }
2420 
2421 
2422 #if 0 /* XXX scp XXX */
2423 static void
2424 exp10_test (void)
2425 {
2426   errno = 0;
2427   FUNC(exp10) (0);
2428   if (errno == ENOSYS)
2429     /* Function not implemented.  */
2430     return;
2431 
2432   init_max_error ();
2433 
2434   check_float ("exp10 (0) == 1",  FUNC(exp10) (0), 1, 0, 0, 0);
2435   check_float ("exp10 (-0) == 1",  FUNC(exp10) (minus_zero), 1, 0, 0, 0);
2436 
2437   check_float ("exp10 (inf) == inf",  FUNC(exp10) (plus_infty), plus_infty, 0, 0, 0);
2438   check_float ("exp10 (-inf) == 0",  FUNC(exp10) (minus_infty), 0, 0, 0, 0);
2439   check_float ("exp10 (NaN) == NaN",  FUNC(exp10) (nan_value), nan_value, 0, 0, 0);
2440   check_float ("exp10 (3) == 1000",  FUNC(exp10) (3), 1000, DELTA838, 0, 0);
2441   check_float ("exp10 (-1) == 0.1",  FUNC(exp10) (-1), 0.1L, DELTA839, 0, 0);
2442   check_float ("exp10 (1e6) == inf",  FUNC(exp10) (1e6), plus_infty, 0, 0, 0);
2443   check_float ("exp10 (-1e6) == 0",  FUNC(exp10) (-1e6), 0, 0, 0, 0);
2444   check_float ("exp10 (0.7) == 5.0118723362727228500155418688494574",  FUNC(exp10) (0.7L), 5.0118723362727228500155418688494574L, DELTA842, 0, 0);
2445 
2446   print_max_error ("exp10", DELTAexp10, 0);
2447 }
2448 #endif
2449 
2450 static void
2451 exp2_test (void)
2452 {
2453   errno = 0;
2454   FUNC(exp2) (0);
2455   if (errno == ENOSYS)
2456     /* Function not implemented.  */
2457     return;
2458 
2459   init_max_error ();
2460 
2461   check_float ("exp2 (0) == 1",  FUNC(exp2) (0), 1, 0, 0, 0);
2462   check_float ("exp2 (-0) == 1",  FUNC(exp2) (minus_zero), 1, 0, 0, 0);
2463   check_float ("exp2 (inf) == inf",  FUNC(exp2) (plus_infty), plus_infty, 0, 0, 0);
2464   check_float ("exp2 (-inf) == 0",  FUNC(exp2) (minus_infty), 0, 0, 0, 0);
2465   check_float ("exp2 (NaN) == NaN",  FUNC(exp2) (nan_value), nan_value, 0, 0, 0);
2466 
2467   check_float ("exp2 (10) == 1024",  FUNC(exp2) (10), 1024, 0, 0, 0);
2468   check_float ("exp2 (-1) == 0.5",  FUNC(exp2) (-1), 0.5, 0, 0, 0);
2469   check_float ("exp2 (1e6) == inf",  FUNC(exp2) (1e6), plus_infty, 0, 0, 0);
2470   check_float ("exp2 (-1e6) == 0",  FUNC(exp2) (-1e6), 0, 0, 0, 0);
2471   check_float ("exp2 (0.7) == 1.6245047927124710452",  FUNC(exp2) (0.7L), 1.6245047927124710452L, DELTA852, 0, 0);
2472 
2473   print_max_error ("exp2", DELTAexp2, 0);
2474 }
2475 
2476 static void
2477 expm1_test (void)
2478 {
2479   errno = 0;
2480   FUNC(expm1) (0);
2481   if (errno == ENOSYS)
2482     /* Function not implemented.  */
2483     return;
2484 
2485   init_max_error ();
2486 
2487   check_float ("expm1 (0) == 0",  FUNC(expm1) (0), 0, 0, 0, 0);
2488   check_float ("expm1 (-0) == -0",  FUNC(expm1) (minus_zero), minus_zero, 0, 0, 0);
2489 
2490 #ifndef TEST_INLINE
2491   check_float ("expm1 (inf) == inf",  FUNC(expm1) (plus_infty), plus_infty, 0, 0, 0);
2492   check_float ("expm1 (-inf) == -1",  FUNC(expm1) (minus_infty), -1, 0, 0, 0);
2493 #endif
2494   check_float ("expm1 (NaN) == NaN",  FUNC(expm1) (nan_value), nan_value, 0, 0, 0);
2495 
2496   check_float ("expm1 (1) == M_El - 1.0",  FUNC(expm1) (1), M_El - 1.0, 1, 0, 0);
2497   check_float ("expm1 (0.7) == 1.0137527074704765216",  FUNC(expm1) (0.7L), 1.0137527074704765216L, DELTA859, 0, 0);
2498 
2499   print_max_error ("expm1", DELTAexpm1, 0);
2500 }
2501 
2502 static void
2503 fabs_test (void)
2504 {
2505   init_max_error ();
2506 
2507   check_float ("fabs (0) == 0",  FUNC(fabs) ((FLOAT)0.0), 0, 0, 0, 0);
2508   check_float ("fabs (-0) == 0",  FUNC(fabs) (minus_zero), 0, 0, 0, 0);
2509 
2510   check_float ("fabs (inf) == inf",  FUNC(fabs) (plus_infty), plus_infty, 0, 0, 0);
2511   check_float ("fabs (-inf) == inf",  FUNC(fabs) (minus_infty), plus_infty, 0, 0, 0);
2512   check_float ("fabs (NaN) == NaN",  FUNC(fabs) (nan_value), nan_value, 0, 0, 0);
2513 
2514   check_float ("fabs (38.0) == 38.0",  FUNC(fabs) ((FLOAT)38.0), 38.0, 0, 0, 0);
2515   check_float ("fabs (-e) == e",  FUNC(fabs) ((FLOAT)-M_El), M_El, 0, 0, 0);
2516 
2517   print_max_error ("fabs", 0, 0);
2518 }
2519 
2520 static void
2521 fdim_test (void)
2522 {
2523   init_max_error ();
2524 
2525   check_float ("fdim (0, 0) == 0",  FUNC(fdim) (0, 0), 0, 0, 0, 0);
2526   check_float ("fdim (9, 0) == 9",  FUNC(fdim) (9, 0), 9, 0, 0, 0);
2527   check_float ("fdim (0, 9) == 0",  FUNC(fdim) (0, 9), 0, 0, 0, 0);
2528   check_float ("fdim (-9, 0) == 0",  FUNC(fdim) (-9, 0), 0, 0, 0, 0);
2529   check_float ("fdim (0, -9) == 9",  FUNC(fdim) (0, -9), 9, 0, 0, 0);
2530 
2531   check_float ("fdim (inf, 9) == inf",  FUNC(fdim) (plus_infty, 9), plus_infty, 0, 0, 0);
2532   check_float ("fdim (inf, -9) == inf",  FUNC(fdim) (plus_infty, -9), plus_infty, 0, 0, 0);
2533   check_float ("fdim (-inf, 9) == 0",  FUNC(fdim) (minus_infty, 9), 0, 0, 0, 0);
2534   check_float ("fdim (-inf, -9) == 0",  FUNC(fdim) (minus_infty, -9), 0, 0, 0, 0);
2535   check_float ("fdim (9, -inf) == inf",  FUNC(fdim) (9, minus_infty), plus_infty, 0, 0, 0);
2536   check_float ("fdim (-9, -inf) == inf",  FUNC(fdim) (-9, minus_infty), plus_infty, 0, 0, 0);
2537   check_float ("fdim (9, inf) == 0",  FUNC(fdim) (9, plus_infty), 0, 0, 0, 0);
2538   check_float ("fdim (-9, inf) == 0",  FUNC(fdim) (-9, plus_infty), 0, 0, 0, 0);
2539 
2540   check_float ("fdim (0, NaN) == NaN",  FUNC(fdim) (0, nan_value), nan_value, 0, 0, 0);
2541   check_float ("fdim (9, NaN) == NaN",  FUNC(fdim) (9, nan_value), nan_value, 0, 0, 0);
2542   check_float ("fdim (-9, NaN) == NaN",  FUNC(fdim) (-9, nan_value), nan_value, 0, 0, 0);
2543   check_float ("fdim (NaN, 9) == NaN",  FUNC(fdim) (nan_value, 9), nan_value, 0, 0, 0);
2544   check_float ("fdim (NaN, -9) == NaN",  FUNC(fdim) (nan_value, -9), nan_value, 0, 0, 0);
2545   check_float ("fdim (inf, NaN) == NaN",  FUNC(fdim) (plus_infty, nan_value), nan_value, 0, 0, 0);
2546   check_float ("fdim (-inf, NaN) == NaN",  FUNC(fdim) (minus_infty, nan_value), nan_value, 0, 0, 0);
2547   check_float ("fdim (NaN, inf) == NaN",  FUNC(fdim) (nan_value, plus_infty), nan_value, 0, 0, 0);
2548   check_float ("fdim (NaN, -inf) == NaN",  FUNC(fdim) (nan_value, minus_infty), nan_value, 0, 0, 0);
2549   check_float ("fdim (NaN, NaN) == NaN",  FUNC(fdim) (nan_value, nan_value), nan_value, 0, 0, 0);
2550 
2551   print_max_error ("fdim", 0, 0);
2552 }
2553 
2554 static void
2555 floor_test (void)
2556 {
2557   init_max_error ();
2558 
2559   check_float ("floor (0.0) == 0.0",  FUNC(floor) (0.0), 0.0, 0, 0, 0);
2560   check_float ("floor (-0) == -0",  FUNC(floor) (minus_zero), minus_zero, 0, 0, 0);
2561   check_float ("floor (inf) == inf",  FUNC(floor) (plus_infty), plus_infty, 0, 0, 0);
2562   check_float ("floor (-inf) == -inf",  FUNC(floor) (minus_infty), minus_infty, 0, 0, 0);
2563   check_float ("floor (NaN) == NaN",  FUNC(floor) (nan_value), nan_value, 0, 0, 0);
2564 
2565   check_float ("floor (pi) == 3.0",  FUNC(floor) (M_PIl), 3.0, 0, 0, 0);
2566   check_float ("floor (-pi) == -4.0",  FUNC(floor) (-M_PIl), -4.0, 0, 0, 0);
2567 
2568   print_max_error ("floor", 0, 0);
2569 }
2570 
2571 static void
2572 fma_test (void)
2573 {
2574   init_max_error ();
2575 
2576   check_float ("fma (1.0, 2.0, 3.0) == 5.0",  FUNC(fma) (1.0, 2.0, 3.0), 5.0, 0, 0, 0);
2577   check_float ("fma (NaN, 2.0, 3.0) == NaN",  FUNC(fma) (nan_value, 2.0, 3.0), nan_value, 0, 0, 0);
2578   check_float ("fma (1.0, NaN, 3.0) == NaN",  FUNC(fma) (1.0, nan_value, 3.0), nan_value, 0, 0, 0);
2579   check_float ("fma (1.0, 2.0, NaN) == NaN plus invalid exception allowed",  FUNC(fma) (1.0, 2.0, nan_value), nan_value, 0, 0, INVALID_EXCEPTION_OK);
2580   check_float ("fma (inf, 0.0, NaN) == NaN plus invalid exception allowed",  FUNC(fma) (plus_infty, 0.0, nan_value), nan_value, 0, 0, INVALID_EXCEPTION_OK);
2581   check_float ("fma (-inf, 0.0, NaN) == NaN plus invalid exception allowed",  FUNC(fma) (minus_infty, 0.0, nan_value), nan_value, 0, 0, INVALID_EXCEPTION_OK);
2582   check_float ("fma (0.0, inf, NaN) == NaN plus invalid exception allowed",  FUNC(fma) (0.0, plus_infty, nan_value), nan_value, 0, 0, INVALID_EXCEPTION_OK);
2583   check_float ("fma (0.0, -inf, NaN) == NaN plus invalid exception allowed",  FUNC(fma) (0.0, minus_infty, nan_value), nan_value, 0, 0, INVALID_EXCEPTION_OK);
2584   check_float ("fma (inf, 0.0, 1.0) == NaN plus invalid exception",  FUNC(fma) (plus_infty, 0.0, 1.0), nan_value, 0, 0, INVALID_EXCEPTION);
2585   check_float ("fma (-inf, 0.0, 1.0) == NaN plus invalid exception",  FUNC(fma) (minus_infty, 0.0, 1.0), nan_value, 0, 0, INVALID_EXCEPTION);
2586   check_float ("fma (0.0, inf, 1.0) == NaN plus invalid exception",  FUNC(fma) (0.0, plus_infty, 1.0), nan_value, 0, 0, INVALID_EXCEPTION);
2587   check_float ("fma (0.0, -inf, 1.0) == NaN plus invalid exception",  FUNC(fma) (0.0, minus_infty, 1.0), nan_value, 0, 0, INVALID_EXCEPTION);
2588 
2589   check_float ("fma (inf, inf, -inf) == NaN plus invalid exception",  FUNC(fma) (plus_infty, plus_infty, minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
2590   check_float ("fma (-inf, inf, inf) == NaN plus invalid exception",  FUNC(fma) (minus_infty, plus_infty, plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
2591   check_float ("fma (inf, -inf, inf) == NaN plus invalid exception",  FUNC(fma) (plus_infty, minus_infty, plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
2592   check_float ("fma (-inf, -inf, -inf) == NaN plus invalid exception",  FUNC(fma) (minus_infty, minus_infty, minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
2593 
2594   print_max_error ("fma", 0, 0);
2595 }
2596 
2597 
2598 static void
2599 fmax_test (void)
2600 {
2601   init_max_error ();
2602 
2603   check_float ("fmax (0, 0) == 0",  FUNC(fmax) (0, 0), 0, 0, 0, 0);
2604   check_float ("fmax (-0, -0) == -0",  FUNC(fmax) (minus_zero, minus_zero), minus_zero, 0, 0, 0);
2605   check_float ("fmax (9, 0) == 9",  FUNC(fmax) (9, 0), 9, 0, 0, 0);
2606   check_float ("fmax (0, 9) == 9",  FUNC(fmax) (0, 9), 9, 0, 0, 0);
2607   check_float ("fmax (-9, 0) == 0",  FUNC(fmax) (-9, 0), 0, 0, 0, 0);
2608   check_float ("fmax (0, -9) == 0",  FUNC(fmax) (0, -9), 0, 0, 0, 0);
2609 
2610   check_float ("fmax (inf, 9) == inf",  FUNC(fmax) (plus_infty, 9), plus_infty, 0, 0, 0);
2611   check_float ("fmax (0, inf) == inf",  FUNC(fmax) (0, plus_infty), plus_infty, 0, 0, 0);
2612   check_float ("fmax (-9, inf) == inf",  FUNC(fmax) (-9, plus_infty), plus_infty, 0, 0, 0);
2613   check_float ("fmax (inf, -9) == inf",  FUNC(fmax) (plus_infty, -9), plus_infty, 0, 0, 0);
2614 
2615   check_float ("fmax (-inf, 9) == 9",  FUNC(fmax) (minus_infty, 9), 9, 0, 0, 0);
2616   check_float ("fmax (-inf, -9) == -9",  FUNC(fmax) (minus_infty, -9), -9, 0, 0, 0);
2617   check_float ("fmax (9, -inf) == 9",  FUNC(fmax) (9, minus_infty), 9, 0, 0, 0);
2618   check_float ("fmax (-9, -inf) == -9",  FUNC(fmax) (-9, minus_infty), -9, 0, 0, 0);
2619 
2620   check_float ("fmax (0, NaN) == 0",  FUNC(fmax) (0, nan_value), 0, 0, 0, 0);
2621   check_float ("fmax (9, NaN) == 9",  FUNC(fmax) (9, nan_value), 9, 0, 0, 0);
2622   check_float ("fmax (-9, NaN) == -9",  FUNC(fmax) (-9, nan_value), -9, 0, 0, 0);
2623   check_float ("fmax (NaN, 0) == 0",  FUNC(fmax) (nan_value, 0), 0, 0, 0, 0);
2624   check_float ("fmax (NaN, 9) == 9",  FUNC(fmax) (nan_value, 9), 9, 0, 0, 0);
2625   check_float ("fmax (NaN, -9) == -9",  FUNC(fmax) (nan_value, -9), -9, 0, 0, 0);
2626   check_float ("fmax (inf, NaN) == inf",  FUNC(fmax) (plus_infty, nan_value), plus_infty, 0, 0, 0);
2627   check_float ("fmax (-inf, NaN) == -inf",  FUNC(fmax) (minus_infty, nan_value), minus_infty, 0, 0, 0);
2628   check_float ("fmax (NaN, inf) == inf",  FUNC(fmax) (nan_value, plus_infty), plus_infty, 0, 0, 0);
2629   check_float ("fmax (NaN, -inf) == -inf",  FUNC(fmax) (nan_value, minus_infty), minus_infty, 0, 0, 0);
2630   check_float ("fmax (NaN, NaN) == NaN",  FUNC(fmax) (nan_value, nan_value), nan_value, 0, 0, 0);
2631 
2632   print_max_error ("fmax", 0, 0);
2633 }
2634 
2635 
2636 static void
2637 fmin_test (void)
2638 {
2639   init_max_error ();
2640 
2641   check_float ("fmin (0, 0) == 0",  FUNC(fmin) (0, 0), 0, 0, 0, 0);
2642   check_float ("fmin (-0, -0) == -0",  FUNC(fmin) (minus_zero, minus_zero), minus_zero, 0, 0, 0);
2643   check_float ("fmin (9, 0) == 0",  FUNC(fmin) (9, 0), 0, 0, 0, 0);
2644   check_float ("fmin (0, 9) == 0",  FUNC(fmin) (0, 9), 0, 0, 0, 0);
2645   check_float ("fmin (-9, 0) == -9",  FUNC(fmin) (-9, 0), -9, 0, 0, 0);
2646   check_float ("fmin (0, -9) == -9",  FUNC(fmin) (0, -9), -9, 0, 0, 0);
2647 
2648   check_float ("fmin (inf, 9) == 9",  FUNC(fmin) (plus_infty, 9), 9, 0, 0, 0);
2649   check_float ("fmin (9, inf) == 9",  FUNC(fmin) (9, plus_infty), 9, 0, 0, 0);
2650   check_float ("fmin (inf, -9) == -9",  FUNC(fmin) (plus_infty, -9), -9, 0, 0, 0);
2651   check_float ("fmin (-9, inf) == -9",  FUNC(fmin) (-9, plus_infty), -9, 0, 0, 0);
2652   check_float ("fmin (-inf, 9) == -inf",  FUNC(fmin) (minus_infty, 9), minus_infty, 0, 0, 0);
2653   check_float ("fmin (-inf, -9) == -inf",  FUNC(fmin) (minus_infty, -9), minus_infty, 0, 0, 0);
2654   check_float ("fmin (9, -inf) == -inf",  FUNC(fmin) (9, minus_infty), minus_infty, 0, 0, 0);
2655   check_float ("fmin (-9, -inf) == -inf",  FUNC(fmin) (-9, minus_infty), minus_infty, 0, 0, 0);
2656 
2657   check_float ("fmin (0, NaN) == 0",  FUNC(fmin) (0, nan_value), 0, 0, 0, 0);
2658   check_float ("fmin (9, NaN) == 9",  FUNC(fmin) (9, nan_value), 9, 0, 0, 0);
2659   check_float ("fmin (-9, NaN) == -9",  FUNC(fmin) (-9, nan_value), -9, 0, 0, 0);
2660   check_float ("fmin (NaN, 0) == 0",  FUNC(fmin) (nan_value, 0), 0, 0, 0, 0);
2661   check_float ("fmin (NaN, 9) == 9",  FUNC(fmin) (nan_value, 9), 9, 0, 0, 0);
2662   check_float ("fmin (NaN, -9) == -9",  FUNC(fmin) (nan_value, -9), -9, 0, 0, 0);
2663   check_float ("fmin (inf, NaN) == inf",  FUNC(fmin) (plus_infty, nan_value), plus_infty, 0, 0, 0);
2664   check_float ("fmin (-inf, NaN) == -inf",  FUNC(fmin) (minus_infty, nan_value), minus_infty, 0, 0, 0);
2665   check_float ("fmin (NaN, inf) == inf",  FUNC(fmin) (nan_value, plus_infty), plus_infty, 0, 0, 0);
2666   check_float ("fmin (NaN, -inf) == -inf",  FUNC(fmin) (nan_value, minus_infty), minus_infty, 0, 0, 0);
2667   check_float ("fmin (NaN, NaN) == NaN",  FUNC(fmin) (nan_value, nan_value), nan_value, 0, 0, 0);
2668 
2669   print_max_error ("fmin", 0, 0);
2670 }
2671 
2672 
2673 static void
2674 fmod_test (void)
2675 {
2676   errno = 0;
2677   FUNC(fmod) (6.5, 2.3L);
2678   if (errno == ENOSYS)
2679     /* Function not implemented.  */
2680     return;
2681 
2682   init_max_error ();
2683 
2684   /* fmod (+0, y) == +0 for y != 0.  */
2685   check_float ("fmod (0, 3) == 0",  FUNC(fmod) (0, 3), 0, 0, 0, 0);
2686 
2687   /* fmod (-0, y) == -0 for y != 0.  */
2688   check_float ("fmod (-0, 3) == -0",  FUNC(fmod) (minus_zero, 3), minus_zero, 0, 0, 0);
2689 
2690   /* fmod (+inf, y) == NaN plus invalid exception.  */
2691   check_float ("fmod (inf, 3) == NaN plus invalid exception",  FUNC(fmod) (plus_infty, 3), nan_value, 0, 0, INVALID_EXCEPTION);
2692   /* fmod (-inf, y) == NaN plus invalid exception.  */
2693   check_float ("fmod (-inf, 3) == NaN plus invalid exception",  FUNC(fmod) (minus_infty, 3), nan_value, 0, 0, INVALID_EXCEPTION);
2694   /* fmod (x, +0) == NaN plus invalid exception.  */
2695   check_float ("fmod (3, 0) == NaN plus invalid exception",  FUNC(fmod) (3, 0), nan_value, 0, 0, INVALID_EXCEPTION);
2696   /* fmod (x, -0) == NaN plus invalid exception.  */
2697   check_float ("fmod (3, -0) == NaN plus invalid exception",  FUNC(fmod) (3, minus_zero), nan_value, 0, 0, INVALID_EXCEPTION);
2698 
2699   /* fmod (x, +inf) == x for x not infinite.  */
2700   check_float ("fmod (3.0, inf) == 3.0",  FUNC(fmod) (3.0, plus_infty), 3.0, 0, 0, 0);
2701   /* fmod (x, -inf) == x for x not infinite.  */
2702   check_float ("fmod (3.0, -inf) == 3.0",  FUNC(fmod) (3.0, minus_infty), 3.0, 0, 0, 0);
2703 
2704   check_float ("fmod (NaN, NaN) == NaN",  FUNC(fmod) (nan_value, nan_value), nan_value, 0, 0, 0);
2705 
2706   check_float ("fmod (6.5, 2.3) == 1.9",  FUNC(fmod) (6.5, 2.3L), 1.9L, DELTA972, 0, 0);
2707   check_float ("fmod (-6.5, 2.3) == -1.9",  FUNC(fmod) (-6.5, 2.3L), -1.9L, DELTA973, 0, 0);
2708   check_float ("fmod (6.5, -2.3) == 1.9",  FUNC(fmod) (6.5, -2.3L), 1.9L, DELTA974, 0, 0);
2709   check_float ("fmod (-6.5, -2.3) == -1.9",  FUNC(fmod) (-6.5, -2.3L), -1.9L, DELTA975, 0, 0);
2710 
2711   print_max_error ("fmod", DELTAfmod, 0);
2712 }
2713 
2714 static void
2715 fpclassify_test (void)
2716 {
2717   init_max_error ();
2718 
2719   check_int ("fpclassify (NaN) == FP_NAN", fpclassify (nan_value), FP_NAN, 0, 0, 0);
2720   check_int ("fpclassify (inf) == FP_INFINITE", fpclassify (plus_infty), FP_INFINITE, 0, 0, 0);
2721   check_int ("fpclassify (-inf) == FP_INFINITE", fpclassify (minus_infty), FP_INFINITE, 0, 0, 0);
2722   check_int ("fpclassify (+0) == FP_ZERO", fpclassify (plus_zero), FP_ZERO, 0, 0, 0);
2723   check_int ("fpclassify (-0) == FP_ZERO", fpclassify (minus_zero), FP_ZERO, 0, 0, 0);
2724   check_int ("fpclassify (1000) == FP_NORMAL", fpclassify (1000.0), FP_NORMAL, 0, 0, 0);
2725 
2726   print_max_error ("fpclassify", 0, 0);
2727 }
2728 
2729 
2730 static void
2731 frexp_test (void)
2732 {
2733   int x;
2734 
2735   init_max_error ();
2736 
2737   check_float ("frexp (inf, &x) == inf",  FUNC(frexp) (plus_infty, &x), plus_infty, 0, 0, 0);
2738   check_float ("frexp (-inf, &x) == -inf",  FUNC(frexp) (minus_infty, &x), minus_infty, 0, 0, 0);
2739   check_float ("frexp (NaN, &x) == NaN",  FUNC(frexp) (nan_value, &x), nan_value, 0, 0, 0);
2740 
2741   check_float ("frexp (0.0, &x) == 0.0",  FUNC(frexp) (0.0, &x), 0.0, 0, 0, 0);
2742   check_int ("frexp (0.0, &x) sets x to 0.0", x, 0.0, 0, 0, 0);
2743   check_float ("frexp (-0, &x) == -0",  FUNC(frexp) (minus_zero, &x), minus_zero, 0, 0, 0);
2744   check_int ("frexp (-0, &x) sets x to 0.0", x, 0.0, 0, 0, 0);
2745 
2746   check_float ("frexp (12.8, &x) == 0.8",  FUNC(frexp) (12.8L, &x), 0.8L, 0, 0, 0);
2747   check_int ("frexp (12.8, &x) sets x to 4", x, 4, 0, 0, 0);
2748   check_float ("frexp (-27.34, &x) == -0.854375",  FUNC(frexp) (-27.34L, &x), -0.854375L, 0, 0, 0);
2749   check_int ("frexp (-27.34, &x) sets x to 5", x, 5, 0, 0, 0);
2750 
2751   print_max_error ("frexp", 0, 0);
2752 }
2753 
2754 #define gamma lgamma /* XXX scp XXX */
2755 #define gammaf lgammaf /* XXX scp XXX */
2756 static void
2757 gamma_test (void)
2758 {
2759   errno = 0;
2760   FUNC(gamma) (1);
2761 
2762   if (errno == ENOSYS)
2763     /* Function not implemented.  */
2764     return;
2765   feclearexcept (FE_ALL_EXCEPT);
2766 
2767   init_max_error ();
2768 
2769   signgam = 0;
2770   check_float ("gamma (inf) == inf",  FUNC(gamma) (plus_infty), plus_infty, 0, 0, 0);
2771   signgam = 0;
2772   check_float ("gamma (0) == inf plus division by zero exception",  FUNC(gamma) (0), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
2773   signgam = 0;
2774   check_float ("gamma (-3) == inf plus division by zero exception",  FUNC(gamma) (-3), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
2775   signgam = 0;
2776   check_float ("gamma (-inf) == inf",  FUNC(gamma) (minus_infty), plus_infty, 0, 0, 0);
2777   signgam = 0;
2778   check_float ("gamma (NaN) == NaN",  FUNC(gamma) (nan_value), nan_value, 0, 0, 0);
2779 
2780   signgam = 0;
2781   check_float ("gamma (1) == 0",  FUNC(gamma) (1), 0, 0, 0, 0);
2782   check_int ("gamma (1) sets signgam to 1", signgam, 1, 0, 0, 0);
2783   signgam = 0;
2784   check_float ("gamma (3) == M_LN2l",  FUNC(gamma) (3), M_LN2l, 0, 0, 0);
2785   check_int ("gamma (3) sets signgam to 1", signgam, 1, 0, 0, 0);
2786 
2787   signgam = 0;
2788   check_float ("gamma (0.5) == log(sqrt(pi))",  FUNC(gamma) (0.5), M_LOG_SQRT_PIl, 0, 0, 0);
2789   check_int ("gamma (0.5) sets signgam to 1", signgam, 1, 0, 0, 0);
2790   signgam = 0;
2791   check_float ("gamma (-0.5) == log(2*sqrt(pi))",  FUNC(gamma) (-0.5), M_LOG_2_SQRT_PIl, DELTA1004, 0, 0);
2792   check_int ("gamma (-0.5) sets signgam to -1", signgam, -1, 0, 0, 0);
2793 
2794   print_max_error ("gamma", DELTAgamma, 0);
2795 }
2796 #undef gamma /* XXX scp XXX */
2797 #undef gammaf /* XXX scp XXX */
2798 
2799 static void
2800 hypot_test (void)
2801 {
2802   errno = 0;
2803   FUNC(hypot) (0.7L, 12.4L);
2804   if (errno == ENOSYS)
2805     /* Function not implemented.  */
2806     return;
2807 
2808   init_max_error ();
2809 
2810   check_float ("hypot (inf, 1) == inf plus sign of zero/inf not specified",  FUNC(hypot) (plus_infty, 1), plus_infty, 0, 0, IGNORE_ZERO_INF_SIGN);
2811   check_float ("hypot (-inf, 1) == inf plus sign of zero/inf not specified",  FUNC(hypot) (minus_infty, 1), plus_infty, 0, 0, IGNORE_ZERO_INF_SIGN);
2812 
2813 #ifndef TEST_INLINE
2814   check_float ("hypot (inf, NaN) == inf",  FUNC(hypot) (plus_infty, nan_value), plus_infty, 0, 0, 0);
2815   check_float ("hypot (-inf, NaN) == inf",  FUNC(hypot) (minus_infty, nan_value), plus_infty, 0, 0, 0);
2816   check_float ("hypot (NaN, inf) == inf",  FUNC(hypot) (nan_value, plus_infty), plus_infty, 0, 0, 0);
2817   check_float ("hypot (NaN, -inf) == inf",  FUNC(hypot) (nan_value, minus_infty), plus_infty, 0, 0, 0);
2818 #endif
2819 
2820   check_float ("hypot (NaN, NaN) == NaN",  FUNC(hypot) (nan_value, nan_value), nan_value, 0, 0, 0);
2821 
2822   /* hypot (x,y) == hypot (+-x, +-y)  */
2823   check_float ("hypot (0.7, 12.4) == 12.419742348374220601176836866763271",  FUNC(hypot) (0.7L, 12.4L), 12.419742348374220601176836866763271L, DELTA1013, 0, 0);
2824   check_float ("hypot (-0.7, 12.4) == 12.419742348374220601176836866763271",  FUNC(hypot) (-0.7L, 12.4L), 12.419742348374220601176836866763271L, DELTA1014, 0, 0);
2825   check_float ("hypot (0.7, -12.4) == 12.419742348374220601176836866763271",  FUNC(hypot) (0.7L, -12.4L), 12.419742348374220601176836866763271L, DELTA1015, 0, 0);
2826   check_float ("hypot (-0.7, -12.4) == 12.419742348374220601176836866763271",  FUNC(hypot) (-0.7L, -12.4L), 12.419742348374220601176836866763271L, DELTA1016, 0, 0);
2827   check_float ("hypot (12.4, 0.7) == 12.419742348374220601176836866763271",  FUNC(hypot) (12.4L, 0.7L), 12.419742348374220601176836866763271L, DELTA1017, 0, 0);
2828   check_float ("hypot (-12.4, 0.7) == 12.419742348374220601176836866763271",  FUNC(hypot) (-12.4L, 0.7L), 12.419742348374220601176836866763271L, DELTA1018, 0, 0);
2829   check_float ("hypot (12.4, -0.7) == 12.419742348374220601176836866763271",  FUNC(hypot) (12.4L, -0.7L), 12.419742348374220601176836866763271L, DELTA1019, 0, 0);
2830   check_float ("hypot (-12.4, -0.7) == 12.419742348374220601176836866763271",  FUNC(hypot) (-12.4L, -0.7L), 12.419742348374220601176836866763271L, DELTA1020, 0, 0);
2831 
2832   /*  hypot (x,0) == fabs (x)  */
2833   check_float ("hypot (0.7, 0) == 0.7",  FUNC(hypot) (0.7L, 0), 0.7L, 0, 0, 0);
2834   check_float ("hypot (-0.7, 0) == 0.7",  FUNC(hypot) (-0.7L, 0), 0.7L, 0, 0, 0);
2835   check_float ("hypot (-5.7e7, 0) == 5.7e7",  FUNC(hypot) (-5.7e7, 0), 5.7e7L, 0, 0, 0);
2836 
2837   check_float ("hypot (0.7, 1.2) == 1.3892443989449804508432547041028554",  FUNC(hypot) (0.7L, 1.2L), 1.3892443989449804508432547041028554L, DELTA1024, 0, 0);
2838 
2839   print_max_error ("hypot", DELTAhypot, 0);
2840 }
2841 
2842 
2843 static void
2844 ilogb_test (void)
2845 {
2846   init_max_error ();
2847 
2848   check_int ("ilogb (1) == 0",  FUNC(ilogb) (1), 0, 0, 0, 0);
2849   check_int ("ilogb (e) == 1",  FUNC(ilogb) (M_El), 1, 0, 0, 0);
2850   check_int ("ilogb (1024) == 10",  FUNC(ilogb) (1024), 10, 0, 0, 0);
2851   check_int ("ilogb (-2000) == 10",  FUNC(ilogb) (-2000), 10, 0, 0, 0);
2852 
2853   /* XXX We have a problem here: the standard does not tell us whether
2854      exceptions are allowed/required.  ignore them for now.  */
2855 
2856   check_int ("ilogb (0.0) == FP_ILOGB0 plus exceptions allowed",  FUNC(ilogb) (0.0), FP_ILOGB0, 0, 0, EXCEPTIONS_OK);
2857   check_int ("ilogb (NaN) == FP_ILOGBNAN plus exceptions allowed",  FUNC(ilogb) (nan_value), FP_ILOGBNAN, 0, 0, EXCEPTIONS_OK);
2858   check_int ("ilogb (inf) == INT_MAX plus exceptions allowed",  FUNC(ilogb) (plus_infty), INT_MAX, 0, 0, EXCEPTIONS_OK);
2859   check_int ("ilogb (-inf) == INT_MAX plus exceptions allowed",  FUNC(ilogb) (minus_infty), INT_MAX, 0, 0, EXCEPTIONS_OK);
2860 
2861   print_max_error ("ilogb", 0, 0);
2862 }
2863 
2864 static void
2865 isfinite_test (void)
2866 {
2867   init_max_error ();
2868 
2869   check_bool ("isfinite (0) == true", isfinite (0.0), 1, 0, 0, 0);
2870   check_bool ("isfinite (-0) == true", isfinite (minus_zero), 1, 0, 0, 0);
2871   check_bool ("isfinite (10) == true", isfinite (10.0), 1, 0, 0, 0);
2872   check_bool ("isfinite (inf) == false", isfinite (plus_infty), 0, 0, 0, 0);
2873   check_bool ("isfinite (-inf) == false", isfinite (minus_infty), 0, 0, 0, 0);
2874   check_bool ("isfinite (NaN) == false", isfinite (nan_value), 0, 0, 0, 0);
2875 
2876   print_max_error ("isfinite", 0, 0);
2877 }
2878 
2879 static void
2880 isnormal_test (void)
2881 {
2882   init_max_error ();
2883 
2884   check_bool ("isnormal (0) == false", isnormal (0.0), 0, 0, 0, 0);
2885   check_bool ("isnormal (-0) == false", isnormal (minus_zero), 0, 0, 0, 0);
2886   check_bool ("isnormal (10) == true", isnormal (10.0), 1, 0, 0, 0);
2887   check_bool ("isnormal (inf) == false", isnormal (plus_infty), 0, 0, 0, 0);
2888   check_bool ("isnormal (-inf) == false", isnormal (minus_infty), 0, 0, 0, 0);
2889   check_bool ("isnormal (NaN) == false", isnormal (nan_value), 0, 0, 0, 0);
2890 
2891   print_max_error ("isnormal", 0, 0);
2892 }
2893 
2894 static void
2895 j0_test (void)
2896 {
2897   FLOAT s, c;
2898   errno = 0;
2899   FUNC (sincos) (0, &s, &c);
2900   if (errno == ENOSYS)
2901     /* Required function not implemented.  */
2902     return;
2903   FUNC(j0) (0);
2904   if (errno == ENOSYS)
2905     /* Function not implemented.  */
2906     return;
2907 
2908   init_max_error ();
2909 
2910   /* j0 is the Bessel function of the first kind of order 0 */
2911   check_float ("j0 (NaN) == NaN",  FUNC(j0) (nan_value), nan_value, 0, 0, 0);
2912   check_float ("j0 (inf) == 0",  FUNC(j0) (plus_infty), 0, 0, 0, 0);
2913   check_float ("j0 (-1.0) == 0.76519768655796655145",  FUNC(j0) (-1.0), 0.76519768655796655145L, 0, 0, 0);
2914   check_float ("j0 (0.0) == 1.0",  FUNC(j0) (0.0), 1.0, 0, 0, 0);
2915   check_float ("j0 (0.1) == 0.99750156206604003228",  FUNC(j0) (0.1L), 0.99750156206604003228L, 0, 0, 0);
2916   check_float ("j0 (0.7) == 0.88120088860740528084",  FUNC(j0) (0.7L), 0.88120088860740528084L, 0, 0, 0);
2917   check_float ("j0 (1.0) == 0.76519768655796655145",  FUNC(j0) (1.0), 0.76519768655796655145L, 0, 0, 0);
2918   check_float ("j0 (1.5) == 0.51182767173591812875",  FUNC(j0) (1.5), 0.51182767173591812875L, 0, 0, 0);
2919   check_float ("j0 (2.0) == 0.22389077914123566805",  FUNC(j0) (2.0), 0.22389077914123566805L, DELTA1053, 0, 0);
2920   check_float ("j0 (8.0) == 0.17165080713755390609",  FUNC(j0) (8.0), 0.17165080713755390609L, DELTA1054, 0, 0);
2921   check_float ("j0 (10.0) == -0.24593576445134833520",  FUNC(j0) (10.0), -0.24593576445134833520L, DELTA1055, 0, 0);
2922 
2923   print_max_error ("j0", DELTAj0, 0);
2924 }
2925 
2926 
2927 static void
2928 j1_test (void)
2929 {
2930   FLOAT s, c;
2931   errno = 0;
2932   FUNC (sincos) (0, &s, &c);
2933   if (errno == ENOSYS)
2934     /* Required function not implemented.  */
2935     return;
2936   FUNC(j1) (0);
2937   if (errno == ENOSYS)
2938     /* Function not implemented.  */
2939     return;
2940 
2941   /* j1 is the Bessel function of the first kind of order 1 */
2942 
2943   init_max_error ();
2944 
2945   check_float ("j1 (NaN) == NaN",  FUNC(j1) (nan_value), nan_value, 0, 0, 0);
2946   check_float ("j1 (inf) == 0",  FUNC(j1) (plus_infty), 0, 0, 0, 0);
2947 
2948   check_float ("j1 (-1.0) == -0.44005058574493351596",  FUNC(j1) (-1.0), -0.44005058574493351596L, 0, 0, 0);
2949   check_float ("j1 (0.0) == 0.0",  FUNC(j1) (0.0), 0.0, 0, 0, 0);
2950   check_float ("j1 (0.1) == 0.049937526036241997556",  FUNC(j1) (0.1L), 0.049937526036241997556L, 0, 0, 0);
2951   check_float ("j1 (0.7) == 0.32899574154005894785",  FUNC(j1) (0.7L), 0.32899574154005894785L, 0, 0, 0);
2952   check_float ("j1 (1.0) == 0.44005058574493351596",  FUNC(j1) (1.0), 0.44005058574493351596L, 0, 0, 0);
2953   check_float ("j1 (1.5) == 0.55793650791009964199",  FUNC(j1) (1.5), 0.55793650791009964199L, 0, 0, 0);
2954   check_float ("j1 (2.0) == 0.57672480775687338720",  FUNC(j1) (2.0), 0.57672480775687338720L, DELTA1064, 0, 0);
2955   check_float ("j1 (8.0) == 0.23463634685391462438",  FUNC(j1) (8.0), 0.23463634685391462438L, DELTA1065, 0, 0);
2956   check_float ("j1 (10.0) == 0.043472746168861436670",  FUNC(j1) (10.0), 0.043472746168861436670L, DELTA1066, 0, 0);
2957 
2958   print_max_error ("j1", DELTAj1, 0);
2959 }
2960 
2961 static void
2962 jn_test (void)
2963 {
2964   FLOAT s, c;
2965   errno = 0;
2966   FUNC (sincos) (0, &s, &c);
2967   if (errno == ENOSYS)
2968     /* Required function not implemented.  */
2969     return;
2970   FUNC(jn) (1, 1);
2971   if (errno == ENOSYS)
2972     /* Function not implemented.  */
2973     return;
2974 
2975   /* jn is the Bessel function of the first kind of order n.  */
2976   init_max_error ();
2977 
2978   /* jn (0, x) == j0 (x)  */
2979   check_float ("jn (0, NaN) == NaN",  FUNC(jn) (0, nan_value), nan_value, 0, 0, 0);
2980   check_float ("jn (0, inf) == 0",  FUNC(jn) (0, plus_infty), 0, 0, 0, 0);
2981   check_float ("jn (0, -1.0) == 0.76519768655796655145",  FUNC(jn) (0, -1.0), 0.76519768655796655145L, 0, 0, 0);
2982   check_float ("jn (0, 0.0) == 1.0",  FUNC(jn) (0, 0.0), 1.0, 0, 0, 0);
2983   check_float ("jn (0, 0.1) == 0.99750156206604003228",  FUNC(jn) (0, 0.1L), 0.99750156206604003228L, 0, 0, 0);
2984   check_float ("jn (0, 0.7) == 0.88120088860740528084",  FUNC(jn) (0, 0.7L), 0.88120088860740528084L, 0, 0, 0);
2985   check_float ("jn (0, 1.0) == 0.76519768655796655145",  FUNC(jn) (0, 1.0), 0.76519768655796655145L, 0, 0, 0);
2986   check_float ("jn (0, 1.5) == 0.51182767173591812875",  FUNC(jn) (0, 1.5), 0.51182767173591812875L, 0, 0, 0);
2987   check_float ("jn (0, 2.0) == 0.22389077914123566805",  FUNC(jn) (0, 2.0), 0.22389077914123566805L, DELTA1075, 0, 0);
2988   check_float ("jn (0, 8.0) == 0.17165080713755390609",  FUNC(jn) (0, 8.0), 0.17165080713755390609L, DELTA1076, 0, 0);
2989   check_float ("jn (0, 10.0) == -0.24593576445134833520",  FUNC(jn) (0, 10.0), -0.24593576445134833520L, DELTA1077, 0, 0);
2990 
2991   /* jn (1, x) == j1 (x)  */
2992   check_float ("jn (1, NaN) == NaN",  FUNC(jn) (1, nan_value), nan_value, 0, 0, 0);
2993   check_float ("jn (1, inf) == 0",  FUNC(jn) (1, plus_infty), 0, 0, 0, 0);
2994 
2995   check_float ("jn (1, -1.0) == -0.44005058574493351596",  FUNC(jn) (1, -1.0), -0.44005058574493351596L, 0, 0, 0);
2996   check_float ("jn (1, 0.0) == 0.0",  FUNC(jn) (1, 0.0), 0.0, 0, 0, 0);
2997   check_float ("jn (1, 0.1) == 0.049937526036241997556",  FUNC(jn) (1, 0.1L), 0.049937526036241997556L, 0, 0, 0);
2998   check_float ("jn (1, 0.7) == 0.32899574154005894785",  FUNC(jn) (1, 0.7L), 0.32899574154005894785L, 0, 0, 0);
2999   check_float ("jn (1, 1.0) == 0.44005058574493351596",  FUNC(jn) (1, 1.0), 0.44005058574493351596L, 0, 0, 0);
3000   check_float ("jn (1, 1.5) == 0.55793650791009964199",  FUNC(jn) (1, 1.5), 0.55793650791009964199L, 0, 0, 0);
3001   check_float ("jn (1, 2.0) == 0.57672480775687338720",  FUNC(jn) (1, 2.0), 0.57672480775687338720L, DELTA1086, 0, 0);
3002   check_float ("jn (1, 8.0) == 0.23463634685391462438",  FUNC(jn) (1, 8.0), 0.23463634685391462438L, DELTA1087, 0, 0);
3003   check_float ("jn (1, 10.0) == 0.043472746168861436670",  FUNC(jn) (1, 10.0), 0.043472746168861436670L, DELTA1088, 0, 0);
3004 
3005   /* jn (3, x)  */
3006   check_float ("jn (3, NaN) == NaN",  FUNC(jn) (3, nan_value), nan_value, 0, 0, 0);
3007   check_float ("jn (3, inf) == 0",  FUNC(jn) (3, plus_infty), 0, 0, 0, 0);
3008 
3009   check_float ("jn (3, -1.0) == -0.019563353982668405919",  FUNC(jn) (3, -1.0), -0.019563353982668405919L, DELTA1091, 0, 0);
3010   check_float ("jn (3, 0.0) == 0.0",  FUNC(jn) (3, 0.0), 0.0, 0, 0, 0);
3011   check_float ("jn (3, 0.1) == 0.000020820315754756261429",  FUNC(jn) (3, 0.1L), 0.000020820315754756261429L, DELTA1093, 0, 0);
3012   check_float ("jn (3, 0.7) == 0.0069296548267508408077",  FUNC(jn) (3, 0.7L), 0.0069296548267508408077L, DELTA1094, 0, 0);
3013   check_float ("jn (3, 1.0) == 0.019563353982668405919",  FUNC(jn) (3, 1.0), 0.019563353982668405919L, DELTA1095, 0, 0);
3014   check_float ("jn (3, 2.0) == 0.12894324947440205110",  FUNC(jn) (3, 2.0), 0.12894324947440205110L, DELTA1096, 0, 0);
3015   check_float ("jn (3, 10.0) == 0.058379379305186812343",  FUNC(jn) (3, 10.0), 0.058379379305186812343L, DELTA1097, 0, 0);
3016 
3017   /*  jn (10, x)  */
3018   check_float ("jn (10, NaN) == NaN",  FUNC(jn) (10, nan_value), nan_value, 0, 0, 0);
3019   check_float ("jn (10, inf) == 0",  FUNC(jn) (10, plus_infty), 0, 0, 0, 0);
3020 
3021   check_float ("jn (10, -1.0) == 0.26306151236874532070e-9",  FUNC(jn) (10, -1.0), 0.26306151236874532070e-9L, DELTA1100, 0, 0);
3022   check_float ("jn (10, 0.0) == 0.0",  FUNC(jn) (10, 0.0), 0.0, 0, 0, 0);
3023   check_float ("jn (10, 0.1) == 0.26905328954342155795e-19",  FUNC(jn) (10, 0.1L), 0.26905328954342155795e-19L, DELTA1102, 0, 0);
3024   check_float ("jn (10, 0.7) == 0.75175911502153953928e-11",  FUNC(jn) (10, 0.7L), 0.75175911502153953928e-11L, DELTA1103, 0, 0);
3025   check_float ("jn (10, 1.0) == 0.26306151236874532070e-9",  FUNC(jn) (10, 1.0), 0.26306151236874532070e-9L, DELTA1104, 0, 0);
3026   check_float ("jn (10, 2.0) == 0.25153862827167367096e-6",  FUNC(jn) (10, 2.0), 0.25153862827167367096e-6L, DELTA1105, 0, 0);
3027   check_float ("jn (10, 10.0) == 0.20748610663335885770",  FUNC(jn) (10, 10.0), 0.20748610663335885770L, DELTA1106, 0, 0);
3028 
3029   print_max_error ("jn", DELTAjn, 0);
3030 }
3031 
3032 
3033 static void
3034 ldexp_test (void)
3035 {
3036   check_float ("ldexp (0, 0) == 0",  FUNC(ldexp) (0, 0), 0, 0, 0, 0);
3037   check_float ("ldexp (-0, 0) == -0",  FUNC(ldexp) (minus_zero, 0), minus_zero, 0, 0, 0);
3038 
3039   check_float ("ldexp (inf, 1) == inf",  FUNC(ldexp) (plus_infty, 1), plus_infty, 0, 0, 0);
3040   check_float ("ldexp (-inf, 1) == -inf",  FUNC(ldexp) (minus_infty, 1), minus_infty, 0, 0, 0);
3041   check_float ("ldexp (NaN, 1) == NaN",  FUNC(ldexp) (nan_value, 1), nan_value, 0, 0, 0);
3042 
3043   check_float ("ldexp (0.8, 4) == 12.8",  FUNC(ldexp) (0.8L, 4), 12.8L, 0, 0, 0);
3044   check_float ("ldexp (-0.854375, 5) == -27.34",  FUNC(ldexp) (-0.854375L, 5), -27.34L, 0, 0, 0);
3045 
3046   /* ldexp (x, 0) == x.  */
3047   check_float ("ldexp (1.0, 0) == 1.0",  FUNC(ldexp) (1.0L, 0L), 1.0L, 0, 0, 0);
3048 }
3049 
3050 static void
3051 lgamma_test (void)
3052 {
3053   errno = 0;
3054   FUNC(lgamma) (0);
3055   if (errno == ENOSYS)
3056     /* Function not implemented.  */
3057     return;
3058   feclearexcept (FE_ALL_EXCEPT);
3059 
3060   init_max_error ();
3061 
3062   signgam = 0;
3063   check_float ("lgamma (inf) == inf",  FUNC(lgamma) (plus_infty), plus_infty, 0, 0, 0);
3064   signgam = 0;
3065   check_float ("lgamma (0) == inf plus division by zero exception",  FUNC(lgamma) (0), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3066   signgam = 0;
3067   check_float ("lgamma (NaN) == NaN",  FUNC(lgamma) (nan_value), nan_value, 0, 0, 0);
3068 
3069   /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0.  */
3070   signgam = 0;
3071   check_float ("lgamma (-3) == inf plus division by zero exception",  FUNC(lgamma) (-3), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3072   signgam = 0;
3073   check_float ("lgamma (-inf) == inf",  FUNC(lgamma) (minus_infty), plus_infty, 0, 0, 0);
3074 
3075   signgam = 0;
3076   check_float ("lgamma (1) == 0",  FUNC(lgamma) (1), 0, 0, 0, 0);
3077   check_int ("lgamma (1) sets signgam to 1", signgam, 1, 0, 0, 0);
3078 
3079   signgam = 0;
3080   check_float ("lgamma (3) == M_LN2l",  FUNC(lgamma) (3), M_LN2l, 0, 0, 0);
3081   check_int ("lgamma (3) sets signgam to 1", signgam, 1, 0, 0, 0);
3082 
3083   signgam = 0;
3084   check_float ("lgamma (0.5) == log(sqrt(pi))",  FUNC(lgamma) (0.5), M_LOG_SQRT_PIl, 0, 0, 0);
3085   check_int ("lgamma (0.5) sets signgam to 1", signgam, 1, 0, 0, 0);
3086   signgam = 0;
3087   check_float ("lgamma (-0.5) == log(2*sqrt(pi))",  FUNC(lgamma) (-0.5), M_LOG_2_SQRT_PIl, DELTA1126, 0, 0);
3088   check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1, 0, 0, 0);
3089   signgam = 0;
3090   check_float ("lgamma (0.7) == 0.26086724653166651439",  FUNC(lgamma) (0.7L), 0.26086724653166651439L, DELTA1128, 0, 0);
3091   check_int ("lgamma (0.7) sets signgam to 1", signgam, 1, 0, 0, 0);
3092   signgam = 0;
3093   check_float ("lgamma (1.2) == -0.853740900033158497197e-1",  FUNC(lgamma) (1.2L), -0.853740900033158497197e-1L, DELTA1130, 0, 0);
3094   check_int ("lgamma (1.2) sets signgam to 1", signgam, 1, 0, 0, 0);
3095 
3096   print_max_error ("lgamma", DELTAlgamma, 0);
3097 }
3098 
3099 static void
3100 lrint_test (void)
3101 {
3102   /* XXX this test is incomplete.  We need to have a way to specifiy
3103      the rounding method and test the critical cases.  So far, only
3104      unproblematic numbers are tested.  */
3105 
3106   init_max_error ();
3107 
3108   check_long ("lrint (0.0) == 0",  FUNC(lrint) (0.0), 0, 0, 0, 0);
3109   check_long ("lrint (-0) == 0",  FUNC(lrint) (minus_zero), 0, 0, 0, 0);
3110   check_long ("lrint (0.2) == 0",  FUNC(lrint) (0.2L), 0, 0, 0, 0);
3111   check_long ("lrint (-0.2) == 0",  FUNC(lrint) (-0.2L), 0, 0, 0, 0);
3112 
3113   check_long ("lrint (1.4) == 1",  FUNC(lrint) (1.4L), 1, 0, 0, 0);
3114   check_long ("lrint (-1.4) == -1",  FUNC(lrint) (-1.4L), -1, 0, 0, 0);
3115 
3116   check_long ("lrint (8388600.3) == 8388600",  FUNC(lrint) (8388600.3L), 8388600, 0, 0, 0);
3117   check_long ("lrint (-8388600.3) == -8388600",  FUNC(lrint) (-8388600.3L), -8388600, 0, 0, 0);
3118 
3119   print_max_error ("lrint", 0, 0);
3120 }
3121 
3122 static void
3123 llrint_test (void)
3124 {
3125   /* XXX this test is incomplete.  We need to have a way to specifiy
3126      the rounding method and test the critical cases.  So far, only
3127      unproblematic numbers are tested.  */
3128 
3129   init_max_error ();
3130 
3131   check_longlong ("llrint (0.0) == 0",  FUNC(llrint) (0.0), 0, 0, 0, 0);
3132   check_longlong ("llrint (-0) == 0",  FUNC(llrint) (minus_zero), 0, 0, 0, 0);
3133   check_longlong ("llrint (0.2) == 0",  FUNC(llrint) (0.2L), 0, 0, 0, 0);
3134   check_longlong ("llrint (-0.2) == 0",  FUNC(llrint) (-0.2L), 0, 0, 0, 0);
3135 
3136   check_longlong ("llrint (1.4) == 1",  FUNC(llrint) (1.4L), 1, 0, 0, 0);
3137   check_longlong ("llrint (-1.4) == -1",  FUNC(llrint) (-1.4L), -1, 0, 0, 0);
3138 
3139   check_longlong ("llrint (8388600.3) == 8388600",  FUNC(llrint) (8388600.3L), 8388600, 0, 0, 0);
3140   check_longlong ("llrint (-8388600.3) == -8388600",  FUNC(llrint) (-8388600.3L), -8388600, 0, 0, 0);
3141 
3142   /* Test boundary conditions.  */
3143   /* 0x1FFFFF */
3144   check_longlong ("llrint (2097151.0) == 2097151LL",  FUNC(llrint) (2097151.0), 2097151LL, 0, 0, 0);
3145   /* 0x800000 */
3146   check_longlong ("llrint (8388608.0) == 8388608LL",  FUNC(llrint) (8388608.0), 8388608LL, 0, 0, 0);
3147   /* 0x1000000 */
3148   check_longlong ("llrint (16777216.0) == 16777216LL",  FUNC(llrint) (16777216.0), 16777216LL, 0, 0, 0);
3149   /* 0x20000000000 */
3150   check_longlong ("llrint (2199023255552.0) == 2199023255552LL",  FUNC(llrint) (2199023255552.0), 2199023255552LL, 0, 0, 0);
3151   /* 0x40000000000 */
3152   check_longlong ("llrint (4398046511104.0) == 4398046511104LL",  FUNC(llrint) (4398046511104.0), 4398046511104LL, 0, 0, 0);
3153   /* 0x10000000000000 */
3154   check_longlong ("llrint (4503599627370496.0) == 4503599627370496LL",  FUNC(llrint) (4503599627370496.0), 4503599627370496LL, 0, 0, 0);
3155   /* 0x10000080000000 */
3156   check_longlong ("llrint (4503601774854144.0) == 4503601774854144LL",  FUNC(llrint) (4503601774854144.0), 4503601774854144LL, 0, 0, 0);
3157   /* 0x20000000000000 */
3158   check_longlong ("llrint (9007199254740992.0) == 9007199254740992LL",  FUNC(llrint) (9007199254740992.0), 9007199254740992LL, 0, 0, 0);
3159   /* 0x80000000000000 */
3160   check_longlong ("llrint (36028797018963968.0) == 36028797018963968LL",  FUNC(llrint) (36028797018963968.0), 36028797018963968LL, 0, 0, 0);
3161   /* 0x100000000000000 */
3162   check_longlong ("llrint (72057594037927936.0) == 72057594037927936LL",  FUNC(llrint) (72057594037927936.0), 72057594037927936LL, 0, 0, 0);
3163 
3164   print_max_error ("llrint", 0, 0);
3165 }
3166 
3167 static void
3168 log_test (void)
3169 {
3170   errno = 0;
3171   FUNC(log) (1);
3172   if (errno == ENOSYS)
3173     /* Function not implemented.  */
3174     return;
3175   init_max_error ();
3176 
3177   check_float ("log (0) == -inf plus division by zero exception",  FUNC(log) (0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3178   check_float ("log (-0) == -inf plus division by zero exception",  FUNC(log) (minus_zero), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3179 
3180   check_float ("log (1) == 0",  FUNC(log) (1), 0, 0, 0, 0);
3181 
3182   check_float ("log (-1) == NaN plus invalid exception",  FUNC(log) (-1), nan_value, 0, 0, INVALID_EXCEPTION);
3183   check_float ("log (inf) == inf",  FUNC(log) (plus_infty), plus_infty, 0, 0, 0);
3184 
3185   check_float ("log (e) == 1",  FUNC(log) (M_El), 1, DELTA1163, 0, 0);
3186   check_float ("log (1.0 / M_El) == -1",  FUNC(log) (1.0 / M_El), -1, DELTA1164, 0, 0);
3187   check_float ("log (2) == M_LN2l",  FUNC(log) (2), M_LN2l, 0, 0, 0);
3188   check_float ("log (10) == M_LN10l",  FUNC(log) (10), M_LN10l, 0, 0, 0);
3189   check_float ("log (0.7) == -0.35667494393873237891263871124118447",  FUNC(log) (0.7L), -0.35667494393873237891263871124118447L, DELTA1167, 0, 0);
3190 
3191   print_max_error ("log", DELTAlog, 0);
3192 }
3193 
3194 
3195 static void
3196 log10_test (void)
3197 {
3198   errno = 0;
3199   FUNC(log10) (1);
3200   if (errno == ENOSYS)
3201     /* Function not implemented.  */
3202     return;
3203 
3204   init_max_error ();
3205 
3206   check_float ("log10 (0) == -inf plus division by zero exception",  FUNC(log10) (0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3207   check_float ("log10 (-0) == -inf plus division by zero exception",  FUNC(log10) (minus_zero), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3208 
3209   check_float ("log10 (1) == 0",  FUNC(log10) (1), 0, 0, 0, 0);
3210 
3211   /* log10 (x) == NaN plus invalid exception if x < 0.  */
3212   check_float ("log10 (-1) == NaN plus invalid exception",  FUNC(log10) (-1), nan_value, 0, 0, INVALID_EXCEPTION);
3213 
3214   check_float ("log10 (inf) == inf",  FUNC(log10) (plus_infty), plus_infty, 0, 0, 0);
3215   check_float ("log10 (NaN) == NaN",  FUNC(log10) (nan_value), nan_value, 0, 0, 0);
3216 
3217   check_float ("log10 (0.1) == -1",  FUNC(log10) (0.1L), -1, 0, 0, 0);
3218   check_float ("log10 (10.0) == 1",  FUNC(log10) (10.0), 1, 0, 0, 0);
3219   check_float ("log10 (100.0) == 2",  FUNC(log10) (100.0), 2, 0, 0, 0);
3220   check_float ("log10 (10000.0) == 4",  FUNC(log10) (10000.0), 4, 0, 0, 0);
3221   check_float ("log10 (e) == log10(e)",  FUNC(log10) (M_El), M_LOG10El, DELTA1178, 0, 0);
3222   check_float ("log10 (0.7) == -0.15490195998574316929",  FUNC(log10) (0.7L), -0.15490195998574316929L, DELTA1179, 0, 0);
3223 
3224   print_max_error ("log10", DELTAlog10, 0);
3225 }
3226 
3227 
3228 static void
3229 log1p_test (void)
3230 {
3231   errno = 0;
3232   FUNC(log1p) (0);
3233   if (errno == ENOSYS)
3234     /* Function not implemented.  */
3235     return;
3236 
3237   init_max_error ();
3238 
3239   check_float ("log1p (0) == 0",  FUNC(log1p) (0), 0, 0, 0, 0);
3240   check_float ("log1p (-0) == -0",  FUNC(log1p) (minus_zero), minus_zero, 0, 0, 0);
3241 
3242   check_float ("log1p (-1) == -inf plus division by zero exception",  FUNC(log1p) (-1), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3243   check_float ("log1p (-2) == NaN plus invalid exception",  FUNC(log1p) (-2), nan_value, 0, 0, INVALID_EXCEPTION);
3244 
3245   check_float ("log1p (inf) == inf",  FUNC(log1p) (plus_infty), plus_infty, 0, 0, 0);
3246   check_float ("log1p (NaN) == NaN",  FUNC(log1p) (nan_value), nan_value, 0, 0, 0);
3247 
3248   check_float ("log1p (M_El - 1.0) == 1",  FUNC(log1p) (M_El - 1.0), 1, DELTA1186, 0, 0);
3249 
3250   check_float ("log1p (-0.3) == -0.35667494393873237891263871124118447",  FUNC(log1p) (-0.3L), -0.35667494393873237891263871124118447L, DELTA1187, 0, 0);
3251 
3252   print_max_error ("log1p", DELTAlog1p, 0);
3253 }
3254 
3255 
3256 static void
3257 log2_test (void)
3258 {
3259   errno = 0;
3260   FUNC(log2) (1);
3261   if (errno == ENOSYS)
3262     /* Function not implemented.  */
3263     return;
3264 
3265   init_max_error ();
3266 
3267   check_float ("log2 (0) == -inf plus division by zero exception",  FUNC(log2) (0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3268   check_float ("log2 (-0) == -inf plus division by zero exception",  FUNC(log2) (minus_zero), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3269 
3270   check_float ("log2 (1) == 0",  FUNC(log2) (1), 0, 0, 0, 0);
3271 
3272   check_float ("log2 (-1) == NaN plus invalid exception",  FUNC(log2) (-1), nan_value, 0, 0, INVALID_EXCEPTION);
3273 
3274   check_float ("log2 (inf) == inf",  FUNC(log2) (plus_infty), plus_infty, 0, 0, 0);
3275   check_float ("log2 (NaN) == NaN",  FUNC(log2) (nan_value), nan_value, 0, 0, 0);
3276 
3277   check_float ("log2 (e) == M_LOG2El",  FUNC(log2) (M_El), M_LOG2El, 0, 0, 0);
3278   check_float ("log2 (2.0) == 1",  FUNC(log2) (2.0), 1, 0, 0, 0);
3279   check_float ("log2 (16.0) == 4",  FUNC(log2) (16.0), 4, 0, 0, 0);
3280   check_float ("log2 (256.0) == 8",  FUNC(log2) (256.0), 8, 0, 0, 0);
3281   check_float ("log2 (0.7) == -0.51457317282975824043",  FUNC(log2) (0.7L), -0.51457317282975824043L, DELTA1198, 0, 0);
3282 
3283   print_max_error ("log2", DELTAlog2, 0);
3284 }
3285 
3286 
3287 static void
3288 logb_test (void)
3289 {
3290   init_max_error ();
3291 
3292   check_float ("logb (inf) == inf",  FUNC(logb) (plus_infty), plus_infty, 0, 0, 0);
3293   check_float ("logb (-inf) == inf",  FUNC(logb) (minus_infty), plus_infty, 0, 0, 0);
3294 
3295   check_float ("logb (0) == -inf plus division by zero exception",  FUNC(logb) (0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3296 
3297   check_float ("logb (-0) == -inf plus division by zero exception",  FUNC(logb) (minus_zero), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3298   check_float ("logb (NaN) == NaN",  FUNC(logb) (nan_value), nan_value, 0, 0, 0);
3299 
3300   check_float ("logb (1) == 0",  FUNC(logb) (1), 0, 0, 0, 0);
3301   check_float ("logb (e) == 1",  FUNC(logb) (M_El), 1, 0, 0, 0);
3302   check_float ("logb (1024) == 10",  FUNC(logb) (1024), 10, 0, 0, 0);
3303   check_float ("logb (-2000) == 10",  FUNC(logb) (-2000), 10, 0, 0, 0);
3304 
3305   print_max_error ("logb", 0, 0);
3306 }
3307 
3308 static void
3309 lround_test (void)
3310 {
3311   init_max_error ();
3312 
3313   check_long ("lround (0) == 0",  FUNC(lround) (0), 0, 0, 0, 0);
3314   check_long ("lround (-0) == 0",  FUNC(lround) (minus_zero), 0, 0, 0, 0);
3315   check_long ("lround (0.2) == 0.0",  FUNC(lround) (0.2L), 0.0, 0, 0, 0);
3316   check_long ("lround (-0.2) == 0",  FUNC(lround) (-0.2L), 0, 0, 0, 0);
3317   check_long ("lround (0.5) == 1",  FUNC(lround) (0.5), 1, 0, 0, 0);
3318   check_long ("lround (-0.5) == -1",  FUNC(lround) (-0.5), -1, 0, 0, 0);
3319   check_long ("lround (0.8) == 1",  FUNC(lround) (0.8L), 1, 0, 0, 0);
3320   check_long ("lround (-0.8) == -1",  FUNC(lround) (-0.8L), -1, 0, 0, 0);
3321   check_long ("lround (1.5) == 2",  FUNC(lround) (1.5), 2, 0, 0, 0);
3322   check_long ("lround (-1.5) == -2",  FUNC(lround) (-1.5), -2, 0, 0, 0);
3323   check_long ("lround (22514.5) == 22515",  FUNC(lround) (22514.5), 22515, 0, 0, 0);
3324   check_long ("lround (-22514.5) == -22515",  FUNC(lround) (-22514.5), -22515, 0, 0, 0);
3325 #ifndef TEST_FLOAT
3326   check_long ("lround (2097152.5) == 2097153",  FUNC(lround) (2097152.5), 2097153, 0, 0, 0);
3327   check_long ("lround (-2097152.5) == -2097153",  FUNC(lround) (-2097152.5), -2097153, 0, 0, 0);
3328 #endif
3329   print_max_error ("lround", 0, 0);
3330 }
3331 
3332 
3333 static void
3334 llround_test (void)
3335 {
3336   init_max_error ();
3337 
3338   check_longlong ("llround (0) == 0",  FUNC(llround) (0), 0, 0, 0, 0);
3339   check_longlong ("llround (-0) == 0",  FUNC(llround) (minus_zero), 0, 0, 0, 0);
3340   check_longlong ("llround (0.2) == 0.0",  FUNC(llround) (0.2L), 0.0, 0, 0, 0);
3341   check_longlong ("llround (-0.2) == 0",  FUNC(llround) (-0.2L), 0, 0, 0, 0);
3342   check_longlong ("llround (0.5) == 1",  FUNC(llround) (0.5), 1, 0, 0, 0);
3343   check_longlong ("llround (-0.5) == -1",  FUNC(llround) (-0.5), -1, 0, 0, 0);
3344   check_longlong ("llround (0.8) == 1",  FUNC(llround) (0.8L), 1, 0, 0, 0);
3345   check_longlong ("llround (-0.8) == -1",  FUNC(llround) (-0.8L), -1, 0, 0, 0);
3346   check_longlong ("llround (1.5) == 2",  FUNC(llround) (1.5), 2, 0, 0, 0);
3347   check_longlong ("llround (-1.5) == -2",  FUNC(llround) (-1.5), -2, 0, 0, 0);
3348   check_longlong ("llround (22514.5) == 22515",  FUNC(llround) (22514.5), 22515, 0, 0, 0);
3349   check_longlong ("llround (-22514.5) == -22515",  FUNC(llround) (-22514.5), -22515, 0, 0, 0);
3350 #ifndef TEST_FLOAT
3351   check_longlong ("llround (2097152.5) == 2097153",  FUNC(llround) (2097152.5), 2097153, 0, 0, 0);
3352   check_longlong ("llround (-2097152.5) == -2097153",  FUNC(llround) (-2097152.5), -2097153, 0, 0, 0);
3353   check_longlong ("llround (34359738368.5) == 34359738369ll",  FUNC(llround) (34359738368.5), 34359738369ll, 0, 0, 0);
3354   check_longlong ("llround (-34359738368.5) == -34359738369ll",  FUNC(llround) (-34359738368.5), -34359738369ll, 0, 0, 0);
3355 #endif
3356 
3357   /* Test boundary conditions.  */
3358   /* 0x1FFFFF */
3359   check_longlong ("llround (2097151.0) == 2097151LL",  FUNC(llround) (2097151.0), 2097151LL, 0, 0, 0);
3360   /* 0x800000 */
3361   check_longlong ("llround (8388608.0) == 8388608LL",  FUNC(llround) (8388608.0), 8388608LL, 0, 0, 0);
3362   /* 0x1000000 */
3363   check_longlong ("llround (16777216.0) == 16777216LL",  FUNC(llround) (16777216.0), 16777216LL, 0, 0, 0);
3364   /* 0x20000000000 */
3365   check_longlong ("llround (2199023255552.0) == 2199023255552LL",  FUNC(llround) (2199023255552.0), 2199023255552LL, 0, 0, 0);
3366   /* 0x40000000000 */
3367   check_longlong ("llround (4398046511104.0) == 4398046511104LL",  FUNC(llround) (4398046511104.0), 4398046511104LL, 0, 0, 0);
3368   /* 0x10000000000000 */
3369   check_longlong ("llround (4503599627370496.0) == 4503599627370496LL",  FUNC(llround) (4503599627370496.0), 4503599627370496LL, 0, 0, 0);
3370   /* 0x10000080000000 */
3371   check_longlong ("llrint (4503601774854144.0) == 4503601774854144LL",  FUNC(llrint) (4503601774854144.0), 4503601774854144LL, 0, 0, 0);
3372   /* 0x20000000000000 */
3373   check_longlong ("llround (9007199254740992.0) == 9007199254740992LL",  FUNC(llround) (9007199254740992.0), 9007199254740992LL, 0, 0, 0);
3374   /* 0x80000000000000 */
3375   check_longlong ("llround (36028797018963968.0) == 36028797018963968LL",  FUNC(llround) (36028797018963968.0), 36028797018963968LL, 0, 0, 0);
3376   /* 0x100000000000000 */
3377   check_longlong ("llround (72057594037927936.0) == 72057594037927936LL",  FUNC(llround) (72057594037927936.0), 72057594037927936LL, 0, 0, 0);
3378 
3379 #ifndef TEST_FLOAT
3380   /* 0x100000000 */
3381   check_longlong ("llround (4294967295.5) == 4294967296LL",  FUNC(llround) (4294967295.5), 4294967296LL, 0, 0, 0);
3382   /* 0x200000000 */
3383   check_longlong ("llround (8589934591.5) == 8589934592LL",  FUNC(llround) (8589934591.5), 8589934592LL, 0, 0, 0);
3384 #endif
3385 
3386   print_max_error ("llround", 0, 0);
3387 }
3388 
3389 static void
3390 modf_test (void)
3391 {
3392   FLOAT x;
3393 
3394   init_max_error ();
3395 
3396   check_float ("modf (inf, &x) == 0",  FUNC(modf) (plus_infty, &x), 0, 0, 0, 0);
3397   check_float ("modf (inf, &x) sets x to plus_infty", x, plus_infty, 0, 0, 0);
3398   check_float ("modf (-inf, &x) == -0",  FUNC(modf) (minus_infty, &x), minus_zero, 0, 0, 0);
3399   check_float ("modf (-inf, &x) sets x to minus_infty", x, minus_infty, 0, 0, 0);
3400   check_float ("modf (NaN, &x) == NaN",  FUNC(modf) (nan_value, &x), nan_value, 0, 0, 0);
3401   check_float ("modf (NaN, &x) sets x to nan_value", x, nan_value, 0, 0, 0);
3402   check_float ("modf (0, &x) == 0",  FUNC(modf) (0, &x), 0, 0, 0, 0);
3403   check_float ("modf (0, &x) sets x to 0", x, 0, 0, 0, 0);
3404   check_float ("modf (1.5, &x) == 0.5",  FUNC(modf) (1.5, &x), 0.5, 0, 0, 0);
3405   check_float ("modf (1.5, &x) sets x to 1", x, 1, 0, 0, 0);
3406   check_float ("modf (2.5, &x) == 0.5",  FUNC(modf) (2.5, &x), 0.5, 0, 0, 0);
3407   check_float ("modf (2.5, &x) sets x to 2", x, 2, 0, 0, 0);
3408   check_float ("modf (-2.5, &x) == -0.5",  FUNC(modf) (-2.5, &x), -0.5, 0, 0, 0);
3409   check_float ("modf (-2.5, &x) sets x to -2", x, -2, 0, 0, 0);
3410   check_float ("modf (20, &x) == 0",  FUNC(modf) (20, &x), 0, 0, 0, 0);
3411   check_float ("modf (20, &x) sets x to 20", x, 20, 0, 0, 0);
3412   check_float ("modf (21, &x) == 0",  FUNC(modf) (21, &x), 0, 0, 0, 0);
3413   check_float ("modf (21, &x) sets x to 21", x, 21, 0, 0, 0);
3414   check_float ("modf (89.5, &x) == 0.5",  FUNC(modf) (89.5, &x), 0.5, 0, 0, 0);
3415   check_float ("modf (89.5, &x) sets x to 89", x, 89, 0, 0, 0);
3416 
3417   print_max_error ("modf", 0, 0);
3418 }
3419 
3420 static void
3421 nearbyint_test (void)
3422 {
3423   init_max_error ();
3424 
3425   check_float ("nearbyint (0.0) == 0.0",  FUNC(nearbyint) (0.0), 0.0, 0, 0, 0);
3426   check_float ("nearbyint (-0) == -0",  FUNC(nearbyint) (minus_zero), minus_zero, 0, 0, 0);
3427   check_float ("nearbyint (inf) == inf",  FUNC(nearbyint) (plus_infty), plus_infty, 0, 0, 0);
3428   check_float ("nearbyint (-inf) == -inf",  FUNC(nearbyint) (minus_infty), minus_infty, 0, 0, 0);
3429   check_float ("nearbyint (NaN) == NaN",  FUNC(nearbyint) (nan_value), nan_value, 0, 0, 0);
3430 
3431   /* Default rounding mode is round to nearest.  */
3432   check_float ("nearbyint (0.5) == 0.0",  FUNC(nearbyint) (0.5), 0.0, 0, 0, 0);
3433   check_float ("nearbyint (1.5) == 2.0",  FUNC(nearbyint) (1.5), 2.0, 0, 0, 0);
3434   check_float ("nearbyint (-0.5) == -0",  FUNC(nearbyint) (-0.5), minus_zero, 0, 0, 0);
3435   check_float ("nearbyint (-1.5) == -2.0",  FUNC(nearbyint) (-1.5), -2.0, 0, 0, 0);
3436 
3437   print_max_error ("nearbyint", 0, 0);
3438 }
3439 
3440 static void
3441 nextafter_test (void)
3442 {
3443 
3444   init_max_error ();
3445 
3446   check_float ("nextafter (0, 0) == 0",  FUNC(nextafter) (0, 0), 0, 0, 0, 0);
3447   check_float ("nextafter (-0, 0) == 0",  FUNC(nextafter) (minus_zero, 0), 0, 0, 0, 0);
3448   check_float ("nextafter (0, -0) == -0",  FUNC(nextafter) (0, minus_zero), minus_zero, 0, 0, 0);
3449   check_float ("nextafter (-0, -0) == -0",  FUNC(nextafter) (minus_zero, minus_zero), minus_zero, 0, 0, 0);
3450 
3451   check_float ("nextafter (9, 9) == 9",  FUNC(nextafter) (9, 9), 9, 0, 0, 0);
3452   check_float ("nextafter (-9, -9) == -9",  FUNC(nextafter) (-9, -9), -9, 0, 0, 0);
3453   check_float ("nextafter (inf, inf) == inf",  FUNC(nextafter) (plus_infty, plus_infty), plus_infty, 0, 0, 0);
3454   check_float ("nextafter (-inf, -inf) == -inf",  FUNC(nextafter) (minus_infty, minus_infty), minus_infty, 0, 0, 0);
3455 
3456   check_float ("nextafter (NaN, 1.1) == NaN",  FUNC(nextafter) (nan_value, 1.1L), nan_value, 0, 0, 0);
3457   check_float ("nextafter (1.1, NaN) == NaN",  FUNC(nextafter) (1.1L, nan_value), nan_value, 0, 0, 0);
3458   check_float ("nextafter (NaN, NaN) == NaN",  FUNC(nextafter) (nan_value, nan_value), nan_value, 0, 0, 0);
3459 
3460   /* XXX We need the hexadecimal FP number representation here for further
3461      tests.  */
3462 
3463   print_max_error ("nextafter", 0, 0);
3464 }
3465 
3466 
3467 #if 0 /* XXX scp XXX */
3468 static void
3469 nexttoward_test (void)
3470 {
3471   init_max_error ();
3472   check_float ("nexttoward (0, 0) == 0",  FUNC(nexttoward) (0, 0), 0, 0, 0, 0);
3473   check_float ("nexttoward (-0, 0) == 0",  FUNC(nexttoward) (minus_zero, 0), 0, 0, 0, 0);
3474   check_float ("nexttoward (0, -0) == -0",  FUNC(nexttoward) (0, minus_zero), minus_zero, 0, 0, 0);
3475   check_float ("nexttoward (-0, -0) == -0",  FUNC(nexttoward) (minus_zero, minus_zero), minus_zero, 0, 0, 0);
3476 
3477   check_float ("nexttoward (9, 9) == 9",  FUNC(nexttoward) (9, 9), 9, 0, 0, 0);
3478   check_float ("nexttoward (-9, -9) == -9",  FUNC(nexttoward) (-9, -9), -9, 0, 0, 0);
3479   check_float ("nexttoward (inf, inf) == inf",  FUNC(nexttoward) (plus_infty, plus_infty), plus_infty, 0, 0, 0);
3480   check_float ("nexttoward (-inf, -inf) == -inf",  FUNC(nexttoward) (minus_infty, minus_infty), minus_infty, 0, 0, 0);
3481 
3482   check_float ("nexttoward (NaN, 1.1) == NaN",  FUNC(nexttoward) (nan_value, 1.1L), nan_value, 0, 0, 0);
3483   check_float ("nexttoward (1.1, NaN) == NaN",  FUNC(nexttoward) (1.1L, nan_value), nan_value, 0, 0, 0);
3484   check_float ("nexttoward (NaN, NaN) == NaN",  FUNC(nexttoward) (nan_value, nan_value), nan_value, 0, 0, 0);
3485 
3486   /* XXX We need the hexadecimal FP number representation here for further
3487      tests.  */
3488 
3489   print_max_error ("nexttoward", 0, 0);
3490 }
3491 #endif
3492 
3493 
3494 static void
3495 pow_test (void)
3496 {
3497 
3498   errno = 0;
3499   FUNC(pow) (0, 0);
3500   if (errno == ENOSYS)
3501     /* Function not implemented.  */
3502     return;
3503 
3504   init_max_error ();
3505 
3506   check_float ("pow (0, 0) == 1",  FUNC(pow) (0, 0), 1, 0, 0, 0);
3507   check_float ("pow (0, -0) == 1",  FUNC(pow) (0, minus_zero), 1, 0, 0, 0);
3508   check_float ("pow (-0, 0) == 1",  FUNC(pow) (minus_zero, 0), 1, 0, 0, 0);
3509   check_float ("pow (-0, -0) == 1",  FUNC(pow) (minus_zero, minus_zero), 1, 0, 0, 0);
3510 
3511   check_float ("pow (10, 0) == 1",  FUNC(pow) (10, 0), 1, 0, 0, 0);
3512   check_float ("pow (10, -0) == 1",  FUNC(pow) (10, minus_zero), 1, 0, 0, 0);
3513   check_float ("pow (-10, 0) == 1",  FUNC(pow) (-10, 0), 1, 0, 0, 0);
3514   check_float ("pow (-10, -0) == 1",  FUNC(pow) (-10, minus_zero), 1, 0, 0, 0);
3515 
3516   check_float ("pow (NaN, 0) == 1",  FUNC(pow) (nan_value, 0), 1, 0, 0, 0);
3517   check_float ("pow (NaN, -0) == 1",  FUNC(pow) (nan_value, minus_zero), 1, 0, 0, 0);
3518 
3519 
3520 #ifndef TEST_INLINE
3521   check_float ("pow (1.1, inf) == inf",  FUNC(pow) (1.1L, plus_infty), plus_infty, 0, 0, 0);
3522   check_float ("pow (inf, inf) == inf",  FUNC(pow) (plus_infty, plus_infty), plus_infty, 0, 0, 0);
3523   check_float ("pow (-1.1, inf) == inf",  FUNC(pow) (-1.1L, plus_infty), plus_infty, 0, 0, 0);
3524   check_float ("pow (-inf, inf) == inf",  FUNC(pow) (minus_infty, plus_infty), plus_infty, 0, 0, 0);
3525 
3526   check_float ("pow (0.9, inf) == 0",  FUNC(pow) (0.9L, plus_infty), 0, 0, 0, 0);
3527   check_float ("pow (1e-7, inf) == 0",  FUNC(pow) (1e-7L, plus_infty), 0, 0, 0, 0);
3528   check_float ("pow (-0.9, inf) == 0",  FUNC(pow) (-0.9L, plus_infty), 0, 0, 0, 0);
3529   check_float ("pow (-1e-7, inf) == 0",  FUNC(pow) (-1e-7L, plus_infty), 0, 0, 0, 0);
3530 
3531   check_float ("pow (1.1, -inf) == 0",  FUNC(pow) (1.1L, minus_infty), 0, 0, 0, 0);
3532   check_float ("pow (inf, -inf) == 0",  FUNC(pow) (plus_infty, minus_infty), 0, 0, 0, 0);
3533   check_float ("pow (-1.1, -inf) == 0",  FUNC(pow) (-1.1L, minus_infty), 0, 0, 0, 0);
3534   check_float ("pow (-inf, -inf) == 0",  FUNC(pow) (minus_infty, minus_infty), 0, 0, 0, 0);
3535 
3536   check_float ("pow (0.9, -inf) == inf",  FUNC(pow) (0.9L, minus_infty), plus_infty, 0, 0, 0);
3537   check_float ("pow (1e-7, -inf) == inf",  FUNC(pow) (1e-7L, minus_infty), plus_infty, 0, 0, 0);
3538   check_float ("pow (-0.9, -inf) == inf",  FUNC(pow) (-0.9L, minus_infty), plus_infty, 0, 0, 0);
3539   check_float ("pow (-1e-7, -inf) == inf",  FUNC(pow) (-1e-7L, minus_infty), plus_infty, 0, 0, 0);
3540 
3541   check_float ("pow (inf, 1e-7) == inf",  FUNC(pow) (plus_infty, 1e-7L), plus_infty, 0, 0, 0);
3542   check_float ("pow (inf, 1) == inf",  FUNC(pow) (plus_infty, 1), plus_infty, 0, 0, 0);
3543   check_float ("pow (inf, 1e7) == inf",  FUNC(pow) (plus_infty, 1e7L), plus_infty, 0, 0, 0);
3544 
3545   check_float ("pow (inf, -1e-7) == 0",  FUNC(pow) (plus_infty, -1e-7L), 0, 0, 0, 0);
3546   check_float ("pow (inf, -1) == 0",  FUNC(pow) (plus_infty, -1), 0, 0, 0, 0);
3547   check_float ("pow (inf, -1e7) == 0",  FUNC(pow) (plus_infty, -1e7L), 0, 0, 0, 0);
3548 
3549   check_float ("pow (-inf, 1) == -inf",  FUNC(pow) (minus_infty, 1), minus_infty, 0, 0, 0);
3550   check_float ("pow (-inf, 11) == -inf",  FUNC(pow) (minus_infty, 11), minus_infty, 0, 0, 0);
3551   check_float ("pow (-inf, 1001) == -inf",  FUNC(pow) (minus_infty, 1001), minus_infty, 0, 0, 0);
3552 
3553   check_float ("pow (-inf, 2) == inf",  FUNC(pow) (minus_infty, 2), plus_infty, 0, 0, 0);
3554   check_float ("pow (-inf, 12) == inf",  FUNC(pow) (minus_infty, 12), plus_infty, 0, 0, 0);
3555   check_float ("pow (-inf, 1002) == inf",  FUNC(pow) (minus_infty, 1002), plus_infty, 0, 0, 0);
3556   check_float ("pow (-inf, 0.1) == inf",  FUNC(pow) (minus_infty, 0.1L), plus_infty, 0, 0, 0);
3557   check_float ("pow (-inf, 1.1) == inf",  FUNC(pow) (minus_infty, 1.1L), plus_infty, 0, 0, 0);
3558   check_float ("pow (-inf, 11.1) == inf",  FUNC(pow) (minus_infty, 11.1L), plus_infty, 0, 0, 0);
3559   check_float ("pow (-inf, 1001.1) == inf",  FUNC(pow) (minus_infty, 1001.1L), plus_infty, 0, 0, 0);
3560 
3561   check_float ("pow (-inf, -1) == -0",  FUNC(pow) (minus_infty, -1), minus_zero, 0, 0, 0);
3562   check_float ("pow (-inf, -11) == -0",  FUNC(pow) (minus_infty, -11), minus_zero, 0, 0, 0);
3563   check_float ("pow (-inf, -1001) == -0",  FUNC(pow) (minus_infty, -1001), minus_zero, 0, 0, 0);
3564 
3565   check_float ("pow (-inf, -2) == 0",  FUNC(pow) (minus_infty, -2), 0, 0, 0, 0);
3566   check_float ("pow (-inf, -12) == 0",  FUNC(pow) (minus_infty, -12), 0, 0, 0, 0);
3567   check_float ("pow (-inf, -1002) == 0",  FUNC(pow) (minus_infty, -1002), 0, 0, 0, 0);
3568   check_float ("pow (-inf, -0.1) == 0",  FUNC(pow) (minus_infty, -0.1L), 0, 0, 0, 0);
3569   check_float ("pow (-inf, -1.1) == 0",  FUNC(pow) (minus_infty, -1.1L), 0, 0, 0, 0);
3570   check_float ("pow (-inf, -11.1) == 0",  FUNC(pow) (minus_infty, -11.1L), 0, 0, 0, 0);
3571   check_float ("pow (-inf, -1001.1) == 0",  FUNC(pow) (minus_infty, -1001.1L), 0, 0, 0, 0);
3572 #endif
3573 
3574   check_float ("pow (NaN, NaN) == NaN",  FUNC(pow) (nan_value, nan_value), nan_value, 0, 0, 0);
3575   check_float ("pow (0, NaN) == NaN",  FUNC(pow) (0, nan_value), nan_value, 0, 0, 0);
3576   check_float ("pow (1, NaN) == 1",  FUNC(pow) (1, nan_value), 1, 0, 0, 0);
3577   check_float ("pow (-1, NaN) == NaN",  FUNC(pow) (-1, nan_value), nan_value, 0, 0, 0);
3578   check_float ("pow (NaN, 1) == NaN",  FUNC(pow) (nan_value, 1), nan_value, 0, 0, 0);
3579   check_float ("pow (NaN, -1) == NaN",  FUNC(pow) (nan_value, -1), nan_value, 0, 0, 0);
3580 
3581   /* pow (x, NaN) == NaN.  */
3582   check_float ("pow (3.0, NaN) == NaN",  FUNC(pow) (3.0, nan_value), nan_value, 0, 0, 0);
3583 
3584   check_float ("pow (1, inf) == 1",  FUNC(pow) (1, plus_infty), 1, 0, 0, 0);
3585   check_float ("pow (-1, inf) == 1",  FUNC(pow) (-1, plus_infty), 1, 0, 0, 0);
3586   check_float ("pow (1, -inf) == 1",  FUNC(pow) (1, minus_infty), 1, 0, 0, 0);
3587   check_float ("pow (-1, -inf) == 1",  FUNC(pow) (-1, minus_infty), 1, 0, 0, 0);
3588 
3589   check_float ("pow (-0.1, 1.1) == NaN plus invalid exception",  FUNC(pow) (-0.1L, 1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
3590   check_float ("pow (-0.1, -1.1) == NaN plus invalid exception",  FUNC(pow) (-0.1L, -1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
3591   check_float ("pow (-10.1, 1.1) == NaN plus invalid exception",  FUNC(pow) (-10.1L, 1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
3592   check_float ("pow (-10.1, -1.1) == NaN plus invalid exception",  FUNC(pow) (-10.1L, -1.1L), nan_value, 0, 0, INVALID_EXCEPTION);
3593 
3594   check_float ("pow (0, -1) == inf plus division by zero exception",  FUNC(pow) (0, -1), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3595   check_float ("pow (0, -11) == inf plus division by zero exception",  FUNC(pow) (0, -11), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3596   check_float ("pow (-0, -1) == -inf plus division by zero exception",  FUNC(pow) (minus_zero, -1), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3597   check_float ("pow (-0, -11) == -inf plus division by zero exception",  FUNC(pow) (minus_zero, -11), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3598 
3599   check_float ("pow (0, -2) == inf plus division by zero exception",  FUNC(pow) (0, -2), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3600   check_float ("pow (0, -11.1) == inf plus division by zero exception",  FUNC(pow) (0, -11.1L), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3601   check_float ("pow (-0, -2) == inf plus division by zero exception",  FUNC(pow) (minus_zero, -2), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3602   check_float ("pow (-0, -11.1) == inf plus division by zero exception",  FUNC(pow) (minus_zero, -11.1L), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
3603 
3604 
3605   check_float ("pow (0, 1) == 0",  FUNC(pow) (0, 1), 0, 0, 0, 0);
3606   check_float ("pow (0, 11) == 0",  FUNC(pow) (0, 11), 0, 0, 0, 0);
3607 
3608   check_float ("pow (-0, 1) == -0",  FUNC(pow) (minus_zero, 1), minus_zero, 0, 0, 0);
3609   check_float ("pow (-0, 11) == -0",  FUNC(pow) (minus_zero, 11), minus_zero, 0, 0, 0);
3610 
3611 
3612   check_float ("pow (0, 2) == 0",  FUNC(pow) (0, 2), 0, 0, 0, 0);
3613   check_float ("pow (0, 11.1) == 0",  FUNC(pow) (0, 11.1L), 0, 0, 0, 0);
3614 
3615 
3616   check_float ("pow (-0, 2) == 0",  FUNC(pow) (minus_zero, 2), 0, 0, 0, 0);
3617   check_float ("pow (-0, 11.1) == 0",  FUNC(pow) (minus_zero, 11.1L), 0, 0, 0, 0);
3618 
3619 #ifndef TEST_INLINE
3620   /* pow (x, +inf) == +inf for |x| > 1.  */
3621   check_float ("pow (1.5, inf) == inf",  FUNC(pow) (1.5, plus_infty), plus_infty, 0, 0, 0);
3622 
3623   /* pow (x, +inf) == +0 for |x| < 1.  */
3624   check_float ("pow (0.5, inf) == 0.0",  FUNC(pow) (0.5, plus_infty), 0.0, 0, 0, 0);
3625 
3626   /* pow (x, -inf) == +0 for |x| > 1.  */
3627   check_float ("pow (1.5, -inf) == 0.0",  FUNC(pow) (1.5, minus_infty), 0.0, 0, 0, 0);
3628 
3629   /* pow (x, -inf) == +inf for |x| < 1.  */
3630   check_float ("pow (0.5, -inf) == inf",  FUNC(pow) (0.5, minus_infty), plus_infty, 0, 0, 0);
3631 #endif
3632 
3633   /* pow (+inf, y) == +inf for y > 0.  */
3634   check_float ("pow (inf, 2) == inf",  FUNC(pow) (plus_infty, 2), plus_infty, 0, 0, 0);
3635 
3636   /* pow (+inf, y) == +0 for y < 0.  */
3637   check_float ("pow (inf, -1) == 0.0",  FUNC(pow) (plus_infty, -1), 0.0, 0, 0, 0);
3638 
3639   /* pow (-inf, y) == -inf for y an odd integer > 0.  */
3640   check_float ("pow (-inf, 27) == -inf",  FUNC(pow) (minus_infty, 27), minus_infty, 0, 0, 0);
3641 
3642   /* pow (-inf, y) == +inf for y > 0 and not an odd integer.  */
3643   check_float ("pow (-inf, 28) == inf",  FUNC(pow) (minus_infty, 28), plus_infty, 0, 0, 0);
3644 
3645   /* pow (-inf, y) == -0 for y an odd integer < 0. */
3646   check_float ("pow (-inf, -3) == -0",  FUNC(pow) (minus_infty, -3), minus_zero, 0, 0, 0);
3647   /* pow (-inf, y) == +0 for y < 0 and not an odd integer.  */
3648   check_float ("pow (-inf, -2.0) == 0.0",  FUNC(pow) (minus_infty, -2.0), 0.0, 0, 0, 0);
3649 
3650   /* pow (+0, y) == +0 for y an odd integer > 0.  */
3651   check_float ("pow (0.0, 27) == 0.0",  FUNC(pow) (0.0, 27), 0.0, 0, 0, 0);
3652 
3653   /* pow (-0, y) == -0 for y an odd integer > 0.  */
3654   check_float ("pow (-0, 27) == -0",  FUNC(pow) (minus_zero, 27), minus_zero, 0, 0, 0);
3655 
3656   /* pow (+0, y) == +0 for y > 0 and not an odd integer.  */
3657   check_float ("pow (0.0, 4) == 0.0",  FUNC(pow) (0.0, 4), 0.0, 0, 0, 0);
3658 
3659   /* pow (-0, y) == +0 for y > 0 and not an odd integer.  */
3660   check_float ("pow (-0, 4) == 0.0",  FUNC(pow) (minus_zero, 4), 0.0, 0, 0, 0);
3661 
3662   check_float ("pow (0.7, 1.2) == 0.65180494056638638188",  FUNC(pow) (0.7L, 1.2L), 0.65180494056638638188L, DELTA1398, 0, 0);
3663 
3664 #if defined TEST_DOUBLE || defined TEST_LDOUBLE
3665   check_float ("pow (-7.49321e+133, -9.80818e+16) == 0",  FUNC(pow) (-7.49321e+133, -9.80818e+16), 0, 0, 0, 0);
3666 #endif
3667 
3668   print_max_error ("pow", DELTApow, 0);
3669 }
3670 
3671 static void
3672 remainder_test (void)
3673 {
3674   errno = 0;
3675   FUNC(remainder) (1.625, 1.0);
3676   if (errno == ENOSYS)
3677     /* Function not implemented.  */
3678     return;
3679 
3680   init_max_error ();
3681 
3682   check_float ("remainder (1, 0) == NaN plus invalid exception",  FUNC(remainder) (1, 0), nan_value, 0, 0, INVALID_EXCEPTION);
3683   check_float ("remainder (1, -0) == NaN plus invalid exception",  FUNC(remainder) (1, minus_zero), nan_value, 0, 0, INVALID_EXCEPTION);
3684   check_float ("remainder (inf, 1) == NaN plus invalid exception",  FUNC(remainder) (plus_infty, 1), nan_value, 0, 0, INVALID_EXCEPTION);
3685   check_float ("remainder (-inf, 1) == NaN plus invalid exception",  FUNC(remainder) (minus_infty, 1), nan_value, 0, 0, INVALID_EXCEPTION);
3686   check_float ("remainder (NaN, NaN) == NaN",  FUNC(remainder) (nan_value, nan_value), nan_value, 0, 0, 0);
3687 
3688   check_float ("remainder (1.625, 1.0) == -0.375",  FUNC(remainder) (1.625, 1.0), -0.375, 0, 0, 0);
3689   check_float ("remainder (-1.625, 1.0) == 0.375",  FUNC(remainder) (-1.625, 1.0), 0.375, 0, 0, 0);
3690   check_float ("remainder (1.625, -1.0) == -0.375",  FUNC(remainder) (1.625, -1.0), -0.375, 0, 0, 0);
3691   check_float ("remainder (-1.625, -1.0) == 0.375",  FUNC(remainder) (-1.625, -1.0), 0.375, 0, 0, 0);
3692   check_float ("remainder (5.0, 2.0) == 1.0",  FUNC(remainder) (5.0, 2.0), 1.0, 0, 0, 0);
3693   check_float ("remainder (3.0, 2.0) == -1.0",  FUNC(remainder) (3.0, 2.0), -1.0, 0, 0, 0);
3694 
3695   print_max_error ("remainder", 0, 0);
3696 }
3697 
3698 static void
3699 remquo_test (void)
3700 {
3701   /* x is needed.  */
3702   int x;
3703 
3704   errno = 0;
3705   FUNC(remquo) (1.625, 1.0, &x);
3706   if (errno == ENOSYS)
3707     /* Function not implemented.  */
3708     return;
3709 
3710   init_max_error ();
3711 
3712   check_float ("remquo (1, 0, &x) == NaN plus invalid exception",  FUNC(remquo) (1, 0, &x), nan_value, 0, 0, INVALID_EXCEPTION);
3713   check_float ("remquo (1, -0, &x) == NaN plus invalid exception",  FUNC(remquo) (1, minus_zero, &x), nan_value, 0, 0, INVALID_EXCEPTION);
3714   check_float ("remquo (inf, 1, &x) == NaN plus invalid exception",  FUNC(remquo) (plus_infty, 1, &x), nan_value, 0, 0, INVALID_EXCEPTION);
3715   check_float ("remquo (-inf, 1, &x) == NaN plus invalid exception",  FUNC(remquo) (minus_infty, 1, &x), nan_value, 0, 0, INVALID_EXCEPTION);
3716   check_float ("remquo (NaN, NaN, &x) == NaN",  FUNC(remquo) (nan_value, nan_value, &x), nan_value, 0, 0, 0);
3717 
3718   check_float ("remquo (1.625, 1.0, &x) == -0.375",  FUNC(remquo) (1.625, 1.0, &x), -0.375, 0, 0, 0);
3719   check_int ("remquo (1.625, 1.0, &x) sets x to 2", x, 2, 0, 0, 0);
3720   check_float ("remquo (-1.625, 1.0, &x) == 0.375",  FUNC(remquo) (-1.625, 1.0, &x), 0.375, 0, 0, 0);
3721   check_int ("remquo (-1.625, 1.0, &x) sets x to -2", x, -2, 0, 0, 0);
3722   check_float ("remquo (1.625, -1.0, &x) == -0.375",  FUNC(remquo) (1.625, -1.0, &x), -0.375, 0, 0, 0);
3723   check_int ("remquo (1.625, -1.0, &x) sets x to -2", x, -2, 0, 0, 0);
3724   check_float ("remquo (-1.625, -1.0, &x) == 0.375",  FUNC(remquo) (-1.625, -1.0, &x), 0.375, 0, 0, 0);
3725   check_int ("remquo (-1.625, -1.0, &x) sets x to 2", x, 2, 0, 0, 0);
3726 
3727   check_float ("remquo (5, 2, &x) == 1",  FUNC(remquo) (5, 2, &x), 1, 0, 0, 0);
3728   check_int ("remquo (5, 2, &x) sets x to 2", x, 2, 0, 0, 0);
3729   check_float ("remquo (3, 2, &x) == -1",  FUNC(remquo) (3, 2, &x), -1, 0, 0, 0);
3730   check_int ("remquo (3, 2, &x) sets x to 2", x, 2, 0, 0, 0);
3731 
3732   print_max_error ("remquo", 0, 0);
3733 }
3734 
3735 static void
3736 rint_test (void)
3737 {
3738   init_max_error ();
3739 
3740   check_float ("rint (0.0) == 0.0",  FUNC(rint) (0.0), 0.0, 0, 0, 0);
3741   check_float ("rint (-0) == -0",  FUNC(rint) (minus_zero), minus_zero, 0, 0, 0);
3742   check_float ("rint (inf) == inf",  FUNC(rint) (plus_infty), plus_infty, 0, 0, 0);
3743   check_float ("rint (-inf) == -inf",  FUNC(rint) (minus_infty), minus_infty, 0, 0, 0);
3744 
3745   /* Default rounding mode is round to even.  */
3746   check_float ("rint (0.5) == 0.0",  FUNC(rint) (0.5), 0.0, 0, 0, 0);
3747   check_float ("rint (1.5) == 2.0",  FUNC(rint) (1.5), 2.0, 0, 0, 0);
3748   check_float ("rint (2.5) == 2.0",  FUNC(rint) (2.5), 2.0, 0, 0, 0);
3749   check_float ("rint (3.5) == 4.0",  FUNC(rint) (3.5), 4.0, 0, 0, 0);
3750   check_float ("rint (4.5) == 4.0",  FUNC(rint) (4.5), 4.0, 0, 0, 0);
3751   check_float ("rint (-0.5) == -0.0",  FUNC(rint) (-0.5), -0.0, 0, 0, 0);
3752   check_float ("rint (-1.5) == -2.0",  FUNC(rint) (-1.5), -2.0, 0, 0, 0);
3753   check_float ("rint (-2.5) == -2.0",  FUNC(rint) (-2.5), -2.0, 0, 0, 0);
3754   check_float ("rint (-3.5) == -4.0",  FUNC(rint) (-3.5), -4.0, 0, 0, 0);
3755   check_float ("rint (-4.5) == -4.0",  FUNC(rint) (-4.5), -4.0, 0, 0, 0);
3756 
3757   print_max_error ("rint", 0, 0);
3758 }
3759 
3760 static void
3761 round_test (void)
3762 {
3763   init_max_error ();
3764 
3765   check_float ("round (0) == 0",  FUNC(round) (0), 0, 0, 0, 0);
3766   check_float ("round (-0) == -0",  FUNC(round) (minus_zero), minus_zero, 0, 0, 0);
3767   check_float ("round (0.2) == 0.0",  FUNC(round) (0.2L), 0.0, 0, 0, 0);
3768   check_float ("round (-0.2) == -0",  FUNC(round) (-0.2L), minus_zero, 0, 0, 0);
3769   check_float ("round (0.5) == 1.0",  FUNC(round) (0.5), 1.0, 0, 0, 0);
3770   check_float ("round (-0.5) == -1.0",  FUNC(round) (-0.5), -1.0, 0, 0, 0);
3771   check_float ("round (0.8) == 1.0",  FUNC(round) (0.8L), 1.0, 0, 0, 0);
3772   check_float ("round (-0.8) == -1.0",  FUNC(round) (-0.8L), -1.0, 0, 0, 0);
3773   check_float ("round (1.5) == 2.0",  FUNC(round) (1.5), 2.0, 0, 0, 0);
3774   check_float ("round (-1.5) == -2.0",  FUNC(round) (-1.5), -2.0, 0, 0, 0);
3775   check_float ("round (2097152.5) == 2097153",  FUNC(round) (2097152.5), 2097153, 0, 0, 0);
3776   check_float ("round (-2097152.5) == -2097153",  FUNC(round) (-2097152.5), -2097153, 0, 0, 0);
3777 
3778   print_max_error ("round", 0, 0);
3779 }
3780 
3781 
3782 static void
3783 scalbn_test (void)
3784 {
3785 
3786   init_max_error ();
3787 
3788   check_float ("scalbn (0, 0) == 0",  FUNC(scalbn) (0, 0), 0, 0, 0, 0);
3789   check_float ("scalbn (-0, 0) == -0",  FUNC(scalbn) (minus_zero, 0), minus_zero, 0, 0, 0);
3790 
3791   check_float ("scalbn (inf, 1) == inf",  FUNC(scalbn) (plus_infty, 1), plus_infty, 0, 0, 0);
3792   check_float ("scalbn (-inf, 1) == -inf",  FUNC(scalbn) (minus_infty, 1), minus_infty, 0, 0, 0);
3793   check_float ("scalbn (NaN, 1) == NaN",  FUNC(scalbn) (nan_value, 1), nan_value, 0, 0, 0);
3794 
3795   check_float ("scalbn (0.8, 4) == 12.8",  FUNC(scalbn) (0.8L, 4), 12.8L, 0, 0, 0);
3796   check_float ("scalbn (-0.854375, 5) == -27.34",  FUNC(scalbn) (-0.854375L, 5), -27.34L, 0, 0, 0);
3797 
3798   check_float ("scalbn (1, 0) == 1",  FUNC(scalbn) (1, 0L), 1, 0, 0, 0);
3799 
3800   print_max_error ("scalbn", 0, 0);
3801 }
3802 
3803 static void
3804 scalbln_test (void)
3805 {
3806 
3807   init_max_error ();
3808 
3809   check_float ("scalbln (0, 0) == 0",  FUNC(scalbln) (0, 0), 0, 0, 0, 0);
3810   check_float ("scalbln (-0, 0) == -0",  FUNC(scalbln) (minus_zero, 0), minus_zero, 0, 0, 0);
3811 
3812   check_float ("scalbln (inf, 1) == inf",  FUNC(scalbln) (plus_infty, 1), plus_infty, 0, 0, 0);
3813   check_float ("scalbln (-inf, 1) == -inf",  FUNC(scalbln) (minus_infty, 1), minus_infty, 0, 0, 0);
3814   check_float ("scalbln (NaN, 1) == NaN",  FUNC(scalbln) (nan_value, 1), nan_value, 0, 0, 0);
3815 
3816   check_float ("scalbln (0.8, 4) == 12.8",  FUNC(scalbln) (0.8L, 4), 12.8L, 0, 0, 0);
3817   check_float ("scalbln (-0.854375, 5) == -27.34",  FUNC(scalbln) (-0.854375L, 5), -27.34L, 0, 0, 0);
3818 
3819   check_float ("scalbln (1, 0) == 1",  FUNC(scalbln) (1, 0L), 1, 0, 0, 0);
3820 
3821   print_max_error ("scalbn", 0, 0);
3822 }
3823 
3824 static void
3825 signbit_test (void)
3826 {
3827 
3828   init_max_error ();
3829 
3830   check_bool ("signbit (0) == false", signbit (0.0), 0, 0, 0, 0);
3831   check_bool ("signbit (-0) == true", signbit (minus_zero), 1, 0, 0, 0);
3832   check_bool ("signbit (inf) == false", signbit (plus_infty), 0, 0, 0, 0);
3833   check_bool ("signbit (-inf) == true", signbit (minus_infty), 1, 0, 0, 0);
3834 
3835   /* signbit (x) != 0 for x < 0.  */
3836   check_bool ("signbit (-1) == true", signbit (-1.0), 1, 0, 0, 0);
3837   /* signbit (x) == 0 for x >= 0.  */
3838   check_bool ("signbit (1) == false", signbit (1.0), 0, 0, 0, 0);
3839 
3840   print_max_error ("signbit", 0, 0);
3841 }
3842 
3843 static void
3844 sin_test (void)
3845 {
3846   errno = 0;
3847   FUNC(sin) (0);
3848   if (errno == ENOSYS)
3849     /* Function not implemented.  */
3850     return;
3851 
3852   init_max_error ();
3853 
3854   check_float ("sin (0) == 0",  FUNC(sin) (0), 0, 0, 0, 0);
3855   check_float ("sin (-0) == -0",  FUNC(sin) (minus_zero), minus_zero, 0, 0, 0);
3856   check_float ("sin (inf) == NaN plus invalid exception",  FUNC(sin) (plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
3857   check_float ("sin (-inf) == NaN plus invalid exception",  FUNC(sin) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
3858   check_float ("sin (NaN) == NaN",  FUNC(sin) (nan_value), nan_value, 0, 0, 0);
3859 
3860   check_float ("sin (pi/6) == 0.5",  FUNC(sin) (M_PI_6l), 0.5, 0, 0, 0);
3861   check_float ("sin (-pi/6) == -0.5",  FUNC(sin) (-M_PI_6l), -0.5, 0, 0, 0);
3862   check_float ("sin (pi/2) == 1",  FUNC(sin) (M_PI_2l), 1, 0, 0, 0);
3863   check_float ("sin (-pi/2) == -1",  FUNC(sin) (-M_PI_2l), -1, 0, 0, 0);
3864   check_float ("sin (0.7) == 0.64421768723769105367261435139872014",  FUNC(sin) (0.7L), 0.64421768723769105367261435139872014L, DELTA1524, 0, 0);
3865 
3866   print_max_error ("sin", DELTAsin, 0);
3867 
3868 }
3869 
3870 
3871 static void
3872 sincos_test (void)
3873 {
3874   FLOAT sin_res, cos_res;
3875 
3876   errno = 0;
3877   FUNC(sincos) (0, &sin_res, &cos_res);
3878   if (errno == ENOSYS)
3879     /* Function not implemented.  */
3880     return;
3881 
3882   init_max_error ();
3883 
3884   /* sincos is treated differently because it returns void.  */
3885   FUNC (sincos) (0, &sin_res, &cos_res);
3886   check_float ("sincos (0, &sin_res, &cos_res) puts 0 in sin_res", sin_res, 0, 0, 0, 0);
3887   check_float ("sincos (0, &sin_res, &cos_res) puts 1 in cos_res", cos_res, 1, 0, 0, 0);
3888 
3889   FUNC (sincos) (minus_zero, &sin_res, &cos_res);
3890   check_float ("sincos (-0, &sin_res, &cos_res) puts -0 in sin_res", sin_res, minus_zero, 0, 0, 0);
3891   check_float ("sincos (-0, &sin_res, &cos_res) puts 1 in cos_res", cos_res, 1, 0, 0, 0);
3892   FUNC (sincos) (plus_infty, &sin_res, &cos_res);
3893   check_float ("sincos (inf, &sin_res, &cos_res) puts NaN in sin_res plus invalid exception", sin_res, nan_value, 0, 0, INVALID_EXCEPTION);
3894   check_float ("sincos (inf, &sin_res, &cos_res) puts NaN in cos_res", cos_res, nan_value, 0, 0, 0);
3895   FUNC (sincos) (minus_infty, &sin_res, &cos_res);
3896   check_float ("sincos (-inf, &sin_res, &cos_res) puts NaN in sin_res plus invalid exception", sin_res, nan_value, 0, 0, INVALID_EXCEPTION);
3897   check_float ("sincos (-inf, &sin_res, &cos_res) puts NaN in cos_res", cos_res, nan_value, 0, 0, 0);
3898   FUNC (sincos) (nan_value, &sin_res, &cos_res);
3899   check_float ("sincos (NaN, &sin_res, &cos_res) puts NaN in sin_res", sin_res, nan_value, 0, 0, 0);
3900   check_float ("sincos (NaN, &sin_res, &cos_res) puts NaN in cos_res", cos_res, nan_value, 0, 0, 0);
3901 
3902   FUNC (sincos) (M_PI_2l, &sin_res, &cos_res);
3903   check_float ("sincos (pi/2, &sin_res, &cos_res) puts 1 in sin_res", sin_res, 1, 0, 0, 0);
3904   check_float ("sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res", cos_res, 0, DELTA1536, 0, 0);
3905   FUNC (sincos) (M_PI_6l, &sin_res, &cos_res);
3906   check_float ("sincos (pi/6, &sin_res, &cos_res) puts 0.5 in sin_res", sin_res, 0.5, 0, 0, 0);
3907   check_float ("sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res", cos_res, 0.86602540378443864676372317075293616L, 0, 0, 0);
3908   FUNC (sincos) (M_PI_6l*2.0, &sin_res, &cos_res);
3909   check_float ("sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res", sin_res, 0.86602540378443864676372317075293616L, DELTA1539, 0, 0);
3910   check_float ("sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res", cos_res, 0.5, DELTA1540, 0, 0);
3911   FUNC (sincos) (0.7L, &sin_res, &cos_res);
3912   check_float ("sincos (0.7, &sin_res, &cos_res) puts 0.64421768723769105367261435139872014 in sin_res", sin_res, 0.64421768723769105367261435139872014L, DELTA1541, 0, 0);
3913   check_float ("sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842625585999019186495 in cos_res", cos_res, 0.76484218728448842625585999019186495L, DELTA1542, 0, 0);
3914 
3915   print_max_error ("sincos", DELTAsincos, 0);
3916 }
3917 
3918 static void
3919 sinh_test (void)
3920 {
3921   errno = 0;
3922   FUNC(sinh) (0.7L);
3923   if (errno == ENOSYS)
3924     /* Function not implemented.  */
3925     return;
3926 
3927   init_max_error ();
3928   check_float ("sinh (0) == 0",  FUNC(sinh) (0), 0, 0, 0, 0);
3929   check_float ("sinh (-0) == -0",  FUNC(sinh) (minus_zero), minus_zero, 0, 0, 0);
3930 
3931 #ifndef TEST_INLINE
3932   check_float ("sinh (inf) == inf",  FUNC(sinh) (plus_infty), plus_infty, 0, 0, 0);
3933   check_float ("sinh (-inf) == -inf",  FUNC(sinh) (minus_infty), minus_infty, 0, 0, 0);
3934 #endif
3935   check_float ("sinh (NaN) == NaN",  FUNC(sinh) (nan_value), nan_value, 0, 0, 0);
3936 
3937   check_float ("sinh (0.7) == 0.75858370183953350346",  FUNC(sinh) (0.7L), 0.75858370183953350346L, DELTA1548, 0, 0);
3938 #if 0  /* XXX scp XXX */
3939   check_float ("sinh (0x8p-32) == 1.86264514923095703232705808926175479e-9",  FUNC(sinh) (0x8p-32L), 1.86264514923095703232705808926175479e-9L, 0, 0, 0);
3940 #endif
3941 
3942   print_max_error ("sinh", DELTAsinh, 0);
3943 }
3944 
3945 static void
3946 sqrt_test (void)
3947 {
3948   errno = 0;
3949   FUNC(sqrt) (1);
3950   if (errno == ENOSYS)
3951     /* Function not implemented.  */
3952     return;
3953 
3954   init_max_error ();
3955 
3956   check_float ("sqrt (0) == 0",  FUNC(sqrt) (0), 0, 0, 0, 0);
3957   check_float ("sqrt (NaN) == NaN",  FUNC(sqrt) (nan_value), nan_value, 0, 0, 0);
3958   check_float ("sqrt (inf) == inf",  FUNC(sqrt) (plus_infty), plus_infty, 0, 0, 0);
3959 
3960   check_float ("sqrt (-0) == -0",  FUNC(sqrt) (minus_zero), minus_zero, 0, 0, 0);
3961 
3962   /* sqrt (x) == NaN plus invalid exception for x < 0.  */
3963   check_float ("sqrt (-1) == NaN plus invalid exception",  FUNC(sqrt) (-1), nan_value, 0, 0, INVALID_EXCEPTION);
3964   check_float ("sqrt (-inf) == NaN plus invalid exception",  FUNC(sqrt) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
3965   check_float ("sqrt (NaN) == NaN",  FUNC(sqrt) (nan_value), nan_value, 0, 0, 0);
3966 
3967   check_float ("sqrt (2209) == 47",  FUNC(sqrt) (2209), 47, 0, 0, 0);
3968   check_float ("sqrt (4) == 2",  FUNC(sqrt) (4), 2, 0, 0, 0);
3969   check_float ("sqrt (2) == M_SQRT2l",  FUNC(sqrt) (2), M_SQRT2l, 0, 0, 0);
3970   check_float ("sqrt (0.25) == 0.5",  FUNC(sqrt) (0.25), 0.5, 0, 0, 0);
3971   check_float ("sqrt (6642.25) == 81.5",  FUNC(sqrt) (6642.25), 81.5, 0, 0, 0);
3972   check_float ("sqrt (15239.9025) == 123.45",  FUNC(sqrt) (15239.9025L), 123.45L, DELTA1562, 0, 0);
3973   check_float ("sqrt (0.7) == 0.83666002653407554797817202578518747",  FUNC(sqrt) (0.7L), 0.83666002653407554797817202578518747L, 0, 0, 0);
3974 
3975   print_max_error ("sqrt", DELTAsqrt, 0);
3976 }
3977 
3978 static void
3979 tan_test (void)
3980 {
3981   errno = 0;
3982   FUNC(tan) (0);
3983   if (errno == ENOSYS)
3984     /* Function not implemented.  */
3985     return;
3986 
3987   init_max_error ();
3988 
3989   check_float ("tan (0) == 0",  FUNC(tan) (0), 0, 0, 0, 0);
3990   check_float ("tan (-0) == -0",  FUNC(tan) (minus_zero), minus_zero, 0, 0, 0);
3991   check_float ("tan (inf) == NaN plus invalid exception",  FUNC(tan) (plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
3992   check_float ("tan (-inf) == NaN plus invalid exception",  FUNC(tan) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
3993   check_float ("tan (NaN) == NaN",  FUNC(tan) (nan_value), nan_value, 0, 0, 0);
3994 
3995   check_float ("tan (pi/4) == 1",  FUNC(tan) (M_PI_4l), 1, DELTA1569, 0, 0);
3996   check_float ("tan (0.7) == 0.84228838046307944812813500221293775",  FUNC(tan) (0.7L), 0.84228838046307944812813500221293775L, DELTA1570, 0, 0);
3997 
3998   print_max_error ("tan", DELTAtan, 0);
3999 }
4000 
4001 static void
4002 tanh_test (void)
4003 {
4004   errno = 0;
4005   FUNC(tanh) (0.7L);
4006   if (errno == ENOSYS)
4007     /* Function not implemented.  */
4008     return;
4009 
4010   init_max_error ();
4011 
4012   check_float ("tanh (0) == 0",  FUNC(tanh) (0), 0, 0, 0, 0);
4013   check_float ("tanh (-0) == -0",  FUNC(tanh) (minus_zero), minus_zero, 0, 0, 0);
4014 
4015 #ifndef TEST_INLINE
4016   check_float ("tanh (inf) == 1",  FUNC(tanh) (plus_infty), 1, 0, 0, 0);
4017   check_float ("tanh (-inf) == -1",  FUNC(tanh) (minus_infty), -1, 0, 0, 0);
4018 #endif
4019   check_float ("tanh (NaN) == NaN",  FUNC(tanh) (nan_value), nan_value, 0, 0, 0);
4020 
4021   check_float ("tanh (0.7) == 0.60436777711716349631",  FUNC(tanh) (0.7L), 0.60436777711716349631L, DELTA1576, 0, 0);
4022   check_float ("tanh (-0.7) == -0.60436777711716349631",  FUNC(tanh) (-0.7L), -0.60436777711716349631L, DELTA1577, 0, 0);
4023 
4024   check_float ("tanh (1.0) == 0.7615941559557648881194582826047935904",  FUNC(tanh) (1.0L), 0.7615941559557648881194582826047935904L, 0, 0, 0);
4025   check_float ("tanh (-1.0) == -0.7615941559557648881194582826047935904",  FUNC(tanh) (-1.0L), -0.7615941559557648881194582826047935904L, 0, 0, 0);
4026 
4027   /* 2^-57  */
4028   check_float ("tanh (6.938893903907228377647697925567626953125e-18) == 6.938893903907228377647697925567626953125e-18",  FUNC(tanh) (6.938893903907228377647697925567626953125e-18L), 6.938893903907228377647697925567626953125e-18L, 0, 0, 0);
4029 
4030   print_max_error ("tanh", DELTAtanh, 0);
4031 }
4032 
4033 static void
4034 tgamma_test (void)
4035 {
4036   errno = 0;
4037   FUNC(tgamma) (1);
4038   if (errno == ENOSYS)
4039     /* Function not implemented.  */
4040     return;
4041   feclearexcept (FE_ALL_EXCEPT);
4042 
4043   init_max_error ();
4044 
4045   check_float ("tgamma (inf) == inf",  FUNC(tgamma) (plus_infty), plus_infty, 0, 0, 0);
4046   check_float ("tgamma (0) == inf plus divide-by-zero",  FUNC(tgamma) (0), plus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4047   check_float ("tgamma (-0) == inf plus divide-by-zero",  FUNC(tgamma) (minus_zero), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4048   /* tgamma (x) == NaN plus invalid exception for integer x <= 0.  */
4049   check_float ("tgamma (-2) == NaN plus invalid exception",  FUNC(tgamma) (-2), nan_value, 0, 0, INVALID_EXCEPTION);
4050   check_float ("tgamma (-inf) == NaN plus invalid exception",  FUNC(tgamma) (minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
4051   check_float ("tgamma (NaN) == NaN",  FUNC(tgamma) (nan_value), nan_value, 0, 0, 0);
4052 
4053   check_float ("tgamma (0.5) == sqrt (pi)",  FUNC(tgamma) (0.5), M_SQRT_PIl, DELTA1587, 0, 0);
4054   check_float ("tgamma (-0.5) == -2 sqrt (pi)",  FUNC(tgamma) (-0.5), -M_2_SQRT_PIl, DELTA1588, 0, 0);
4055 
4056   check_float ("tgamma (1) == 1",  FUNC(tgamma) (1), 1, 0, 0, 0);
4057   check_float ("tgamma (4) == 6",  FUNC(tgamma) (4), 6, DELTA1590, 0, 0);
4058 
4059   check_float ("tgamma (0.7) == 1.29805533264755778568",  FUNC(tgamma) (0.7L), 1.29805533264755778568L, DELTA1591, 0, 0);
4060   check_float ("tgamma (1.2) == 0.91816874239976061064",  FUNC(tgamma) (1.2L), 0.91816874239976061064L, 0, 0, 0);
4061 
4062   print_max_error ("tgamma", DELTAtgamma, 0);
4063 }
4064 
4065 static void
4066 trunc_test (void)
4067 {
4068   init_max_error ();
4069 
4070   check_float ("trunc (inf) == inf",  FUNC(trunc) (plus_infty), plus_infty, 0, 0, 0);
4071   check_float ("trunc (-inf) == -inf",  FUNC(trunc) (minus_infty), minus_infty, 0, 0, 0);
4072   check_float ("trunc (NaN) == NaN",  FUNC(trunc) (nan_value), nan_value, 0, 0, 0);
4073 
4074   check_float ("trunc (0) == 0",  FUNC(trunc) (0), 0, 0, 0, 0);
4075   check_float ("trunc (-0) == -0",  FUNC(trunc) (minus_zero), minus_zero, 0, 0, 0);
4076   check_float ("trunc (0.625) == 0",  FUNC(trunc) (0.625), 0, 0, 0, 0);
4077   check_float ("trunc (-0.625) == -0",  FUNC(trunc) (-0.625), minus_zero, 0, 0, 0);
4078   check_float ("trunc (1) == 1",  FUNC(trunc) (1), 1, 0, 0, 0);
4079   check_float ("trunc (-1) == -1",  FUNC(trunc) (-1), -1, 0, 0, 0);
4080   check_float ("trunc (1.625) == 1",  FUNC(trunc) (1.625), 1, 0, 0, 0);
4081   check_float ("trunc (-1.625) == -1",  FUNC(trunc) (-1.625), -1, 0, 0, 0);
4082 
4083   check_float ("trunc (1048580.625) == 1048580",  FUNC(trunc) (1048580.625L), 1048580L, 0, 0, 0);
4084   check_float ("trunc (-1048580.625) == -1048580",  FUNC(trunc) (-1048580.625L), -1048580L, 0, 0, 0);
4085 
4086   check_float ("trunc (8388610.125) == 8388610.0",  FUNC(trunc) (8388610.125L), 8388610.0L, 0, 0, 0);
4087   check_float ("trunc (-8388610.125) == -8388610.0",  FUNC(trunc) (-8388610.125L), -8388610.0L, 0, 0, 0);
4088 
4089   check_float ("trunc (4294967296.625) == 4294967296.0",  FUNC(trunc) (4294967296.625L), 4294967296.0L, 0, 0, 0);
4090   check_float ("trunc (-4294967296.625) == -4294967296.0",  FUNC(trunc) (-4294967296.625L), -4294967296.0L, 0, 0, 0);
4091 
4092 
4093   print_max_error ("trunc", 0, 0);
4094 }
4095 
4096 static void
4097 y0_test (void)
4098 {
4099   FLOAT s, c;
4100   errno = 0;
4101   FUNC (sincos) (0, &s, &c);
4102   if (errno == ENOSYS)
4103     /* Required function not implemented.  */
4104     return;
4105   FUNC(y0) (1);
4106   if (errno == ENOSYS)
4107     /* Function not implemented.  */
4108     return;
4109 
4110   /* y0 is the Bessel function of the second kind of order 0 */
4111   init_max_error ();
4112 
4113   check_float ("y0 (-1.0) == NaN",  FUNC(y0) (-1.0), nan_value, 0, 0, INVALID_EXCEPTION);
4114   check_float ("y0 (0.0) == -inf",  FUNC(y0) (0.0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4115   check_float ("y0 (NaN) == NaN",  FUNC(y0) (nan_value), nan_value, 0, 0, 0);
4116   check_float ("y0 (inf) == 0",  FUNC(y0) (plus_infty), 0, 0, 0, 0);
4117 
4118   check_float ("y0 (0.1) == -1.5342386513503668441",  FUNC(y0) (0.1L), -1.5342386513503668441L, DELTA1614, 0, 0);
4119   check_float ("y0 (0.7) == -0.19066492933739506743",  FUNC(y0) (0.7L), -0.19066492933739506743L, DELTA1615, 0, 0);
4120   check_float ("y0 (1.0) == 0.088256964215676957983",  FUNC(y0) (1.0), 0.088256964215676957983L, DELTA1616, 0, 0);
4121   check_float ("y0 (1.5) == 0.38244892379775884396",  FUNC(y0) (1.5), 0.38244892379775884396L, DELTA1617, 0, 0);
4122   check_float ("y0 (2.0) == 0.51037567264974511960",  FUNC(y0) (2.0), 0.51037567264974511960L, DELTA1618, 0, 0);
4123   check_float ("y0 (8.0) == 0.22352148938756622053",  FUNC(y0) (8.0), 0.22352148938756622053L, DELTA1619, 0, 0);
4124   check_float ("y0 (10.0) == 0.055671167283599391424",  FUNC(y0) (10.0), 0.055671167283599391424L, DELTA1620, 0, 0);
4125 
4126   print_max_error ("y0", DELTAy0, 0);
4127 }
4128 
4129 
4130 static void
4131 y1_test (void)
4132 {
4133   FLOAT s, c;
4134   errno = 0;
4135   FUNC (sincos) (0, &s, &c);
4136   if (errno == ENOSYS)
4137     /* Required function not implemented.  */
4138     return;
4139   FUNC(y1) (1);
4140   if (errno == ENOSYS)
4141     /* Function not implemented.  */
4142     return;
4143 
4144   /* y1 is the Bessel function of the second kind of order 1 */
4145   init_max_error ();
4146 
4147   check_float ("y1 (-1.0) == NaN",  FUNC(y1) (-1.0), nan_value, 0, 0, INVALID_EXCEPTION);
4148   check_float ("y1 (0.0) == -inf",  FUNC(y1) (0.0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4149   check_float ("y1 (inf) == 0",  FUNC(y1) (plus_infty), 0, 0, 0, 0);
4150   check_float ("y1 (NaN) == NaN",  FUNC(y1) (nan_value), nan_value, 0, 0, 0);
4151 
4152   check_float ("y1 (0.1) == -6.4589510947020269877",  FUNC(y1) (0.1L), -6.4589510947020269877L, DELTA1625, 0, 0);
4153   check_float ("y1 (0.7) == -1.1032498719076333697",  FUNC(y1) (0.7L), -1.1032498719076333697L, DELTA1626, 0, 0);
4154   check_float ("y1 (1.0) == -0.78121282130028871655",  FUNC(y1) (1.0), -0.78121282130028871655L, DELTA1627, 0, 0);
4155   check_float ("y1 (1.5) == -0.41230862697391129595",  FUNC(y1) (1.5), -0.41230862697391129595L, DELTA1628, 0, 0);
4156   check_float ("y1 (2.0) == -0.10703243154093754689",  FUNC(y1) (2.0), -0.10703243154093754689L, DELTA1629, 0, 0);
4157   check_float ("y1 (8.0) == -0.15806046173124749426",  FUNC(y1) (8.0), -0.15806046173124749426L, DELTA1630, 0, 0);
4158   check_float ("y1 (10.0) == 0.24901542420695388392",  FUNC(y1) (10.0), 0.24901542420695388392L, DELTA1631, 0, 0);
4159 
4160   print_max_error ("y1", DELTAy1, 0);
4161 }
4162 
4163 static void
4164 yn_test (void)
4165 {
4166   FLOAT s, c;
4167   errno = 0;
4168   FUNC (sincos) (0, &s, &c);
4169   if (errno == ENOSYS)
4170     /* Required function not implemented.  */
4171     return;
4172   FUNC(yn) (1, 1);
4173   if (errno == ENOSYS)
4174     /* Function not implemented.  */
4175     return;
4176 
4177   /* yn is the Bessel function of the second kind of order n */
4178   init_max_error ();
4179 
4180   /* yn (0, x) == y0 (x)  */
4181   check_float ("yn (0, -1.0) == NaN",  FUNC(yn) (0, -1.0), nan_value, 0, 0, INVALID_EXCEPTION);
4182   check_float ("yn (0, 0.0) == -inf",  FUNC(yn) (0, 0.0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4183   check_float ("yn (0, NaN) == NaN",  FUNC(yn) (0, nan_value), nan_value, 0, 0, 0);
4184   check_float ("yn (0, inf) == 0",  FUNC(yn) (0, plus_infty), 0, 0, 0, 0);
4185 
4186   check_float ("yn (0, 0.1) == -1.5342386513503668441",  FUNC(yn) (0, 0.1L), -1.5342386513503668441L, DELTA1636, 0, 0);
4187   check_float ("yn (0, 0.7) == -0.19066492933739506743",  FUNC(yn) (0, 0.7L), -0.19066492933739506743L, DELTA1637, 0, 0);
4188   check_float ("yn (0, 1.0) == 0.088256964215676957983",  FUNC(yn) (0, 1.0), 0.088256964215676957983L, DELTA1638, 0, 0);
4189   check_float ("yn (0, 1.5) == 0.38244892379775884396",  FUNC(yn) (0, 1.5), 0.38244892379775884396L, DELTA1639, 0, 0);
4190   check_float ("yn (0, 2.0) == 0.51037567264974511960",  FUNC(yn) (0, 2.0), 0.51037567264974511960L, DELTA1640, 0, 0);
4191   check_float ("yn (0, 8.0) == 0.22352148938756622053",  FUNC(yn) (0, 8.0), 0.22352148938756622053L, DELTA1641, 0, 0);
4192   check_float ("yn (0, 10.0) == 0.055671167283599391424",  FUNC(yn) (0, 10.0), 0.055671167283599391424L, DELTA1642, 0, 0);
4193 
4194   /* yn (1, x) == y1 (x)  */
4195   check_float ("yn (1, -1.0) == NaN",  FUNC(yn) (1, -1.0), nan_value, 0, 0, INVALID_EXCEPTION);
4196   check_float ("yn (1, 0.0) == -inf",  FUNC(yn) (1, 0.0), minus_infty, 0, 0, DIVIDE_BY_ZERO_EXCEPTION);
4197   check_float ("yn (1, inf) == 0",  FUNC(yn) (1, plus_infty), 0, 0, 0, 0);
4198   check_float ("yn (1, NaN) == NaN",  FUNC(yn) (1, nan_value), nan_value, 0, 0, 0);
4199 
4200   check_float ("yn (1, 0.1) == -6.4589510947020269877",  FUNC(yn) (1, 0.1L), -6.4589510947020269877L, DELTA1647, 0, 0);
4201   check_float ("yn (1, 0.7) == -1.1032498719076333697",  FUNC(yn) (1, 0.7L), -1.1032498719076333697L, DELTA1648, 0, 0);
4202   check_float ("yn (1, 1.0) == -0.78121282130028871655",  FUNC(yn) (1, 1.0), -0.78121282130028871655L, DELTA1649, 0, 0);
4203   check_float ("yn (1, 1.5) == -0.41230862697391129595",  FUNC(yn) (1, 1.5), -0.41230862697391129595L, DELTA1650, 0, 0);
4204   check_float ("yn (1, 2.0) == -0.10703243154093754689",  FUNC(yn) (1, 2.0), -0.10703243154093754689L, DELTA1651, 0, 0);
4205   check_float ("yn (1, 8.0) == -0.15806046173124749426",  FUNC(yn) (1, 8.0), -0.15806046173124749426L, DELTA1652, 0, 0);
4206   check_float ("yn (1, 10.0) == 0.24901542420695388392",  FUNC(yn) (1, 10.0), 0.24901542420695388392L, DELTA1653, 0, 0);
4207 
4208   /* yn (3, x)  */
4209   check_float ("yn (3, inf) == 0",  FUNC(yn) (3, plus_infty), 0, 0, 0, 0);
4210   check_float ("yn (3, NaN) == NaN",  FUNC(yn) (3, nan_value), nan_value, 0, 0, 0);
4211 
4212   check_float ("yn (3, 0.1) == -5099.3323786129048894",  FUNC(yn) (3, 0.1L), -5099.3323786129048894L, DELTA1656, 0, 0);
4213   check_float ("yn (3, 0.7) == -15.819479052819633505",  FUNC(yn) (3, 0.7L), -15.819479052819633505L, DELTA1657, 0, 0);
4214   check_float ("yn (3, 1.0) == -5.8215176059647288478",  FUNC(yn) (3, 1.0), -5.8215176059647288478L, 0, 0, 0);
4215   check_float ("yn (3, 2.0) == -1.1277837768404277861",  FUNC(yn) (3, 2.0), -1.1277837768404277861L, DELTA1659, 0, 0);
4216   check_float ("yn (3, 10.0) == -0.25136265718383732978",  FUNC(yn) (3, 10.0), -0.25136265718383732978L, DELTA1660, 0, 0);
4217 
4218   /* yn (10, x)  */
4219   check_float ("yn (10, inf) == 0",  FUNC(yn) (10, plus_infty), 0, 0, 0, 0);
4220   check_float ("yn (10, NaN) == NaN",  FUNC(yn) (10, nan_value), nan_value, 0, 0, 0);
4221 
4222   check_float ("yn (10, 0.1) == -0.11831335132045197885e19",  FUNC(yn) (10, 0.1L), -0.11831335132045197885e19L, DELTA1663, 0, 0);
4223   check_float ("yn (10, 0.7) == -0.42447194260703866924e10",  FUNC(yn) (10, 0.7L), -0.42447194260703866924e10L, DELTA1664, 0, 0);
4224   check_float ("yn (10, 1.0) == -0.12161801427868918929e9",  FUNC(yn) (10, 1.0), -0.12161801427868918929e9L, DELTA1665, 0, 0);
4225   check_float ("yn (10, 2.0) == -129184.54220803928264",  FUNC(yn) (10, 2.0), -129184.54220803928264L, DELTA1666, 0, 0);
4226   check_float ("yn (10, 10.0) == -0.35981415218340272205",  FUNC(yn) (10, 10.0), -0.35981415218340272205L, DELTA1667, 0, 0);
4227 
4228   print_max_error ("yn", DELTAyn, 0);
4229 
4230 }
4231 
4232 
4233 
4234 static void
4235 initialize (void)
4236 {
4237   plus_zero = 0.0;
4238   nan_value = plus_zero / plus_zero;	/* Suppress GCC warning */
4239 
4240   minus_zero = FUNC(copysign) (0.0, -1.0);
4241   plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
4242 		       HUGE_VALL, HUGE_VAL, HUGE_VALF);
4243   minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
4244 			-HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
4245 
4246   (void) &plus_zero;
4247   (void) &nan_value;
4248   (void) &minus_zero;
4249   (void) &plus_infty;
4250   (void) &minus_infty;
4251 
4252   /* Clear all exceptions.  From now on we must not get random exceptions.  */
4253   feclearexcept (FE_ALL_EXCEPT);
4254 }
4255 
4256 #if 0 /* XXX scp XXX */
4257 /* Definitions of arguments for argp functions.  */
4258 static const struct argp_option options[] =
4259 {
4260   { "verbose", 'v', "NUMBER", 0, "Level of verbosity (0..3)"},
4261   { "ulps-file", 'u', NULL, 0, "Output ulps to file ULPs"},
4262   { "no-max-error", 'f', NULL, 0,
4263     "Don't output maximal errors of functions"},
4264   { "no-points", 'p', NULL, 0,
4265     "Don't output results of functions invocations"},
4266   { "ignore-max-ulp", 'i', "yes/no", 0,
4267     "Ignore given maximal errors"},
4268   { NULL, 0, NULL, 0, NULL }
4269 };
4270 
4271 /* Short description of program.  */
4272 static const char doc[] = "Math test suite: " TEST_MSG ;
4273 
4274 /* Prototype for option handler.  */
4275 static error_t parse_opt (int key, char *arg, struct argp_state *state);
4276 
4277 /* Data structure to communicate with argp functions.  */
4278 static struct argp argp =
4279 {
4280   options, parse_opt, NULL, doc,
4281 };
4282 
4283 
4284 /* Handle program arguments.  */
4285 static error_t
4286 parse_opt (int key, char *arg, struct argp_state *state)
4287 {
4288   switch (key)
4289     {
4290     case 'f':
4291       output_max_error = 0;
4292       break;
4293     case 'i':
4294       if (strcmp (arg, "yes") == 0)
4295 	ignore_max_ulp = 1;
4296       else if (strcmp (arg, "no") == 0)
4297 	ignore_max_ulp = 0;
4298       break;
4299     case 'p':
4300       output_points = 0;
4301       break;
4302     case 'u':
4303       output_ulps = 1;
4304       break;
4305     case 'v':
4306       if (optarg)
4307 	verbose = (unsigned int) strtoul (optarg, NULL, 0);
4308       else
4309 	verbose = 3;
4310       break;
4311     default:
4312       return ARGP_ERR_UNKNOWN;
4313     }
4314   return 0;
4315 }
4316 #endif
4317 
4318 #if 0
4319 /* function to check our ulp calculation.  */
4320 void
4321 check_ulp (void)
4322 {
4323   int i;
4324 
4325   FLOAT u, diff, ulp;
4326   /* This gives one ulp.  */
4327   u = FUNC(nextafter) (10, 20);
4328   check_equal (10.0, u, 1, &diff, &ulp);
4329   printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
4330 
4331   /* This gives one more ulp.  */
4332   u = FUNC(nextafter) (u, 20);
4333   check_equal (10.0, u, 2, &diff, &ulp);
4334   printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
4335 
4336   /* And now calculate 100 ulp.  */
4337   for (i = 2; i < 100; i++)
4338     u = FUNC(nextafter) (u, 20);
4339   check_equal (10.0, u, 100, &diff, &ulp);
4340   printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
4341 }
4342 #endif
4343 
4344 int
4345 main (int argc, char **argv)
4346 {
4347 #if 0 /* XXX scp XXX */
4348   int remaining;
4349 #endif
4350 
4351   verbose = 1;
4352   output_ulps = 0;
4353   output_max_error = 1;
4354   output_points = 1;
4355   /* XXX set to 0 for releases.  */
4356   ignore_max_ulp = 0;
4357 
4358 #if 0 /* XXX scp XXX */
4359   /* Parse and process arguments.  */
4360   argp_parse (&argp, argc, argv, 0, &remaining, NULL);
4361 
4362   if (remaining != argc)
4363     {
4364       fprintf (stderr, "wrong number of arguments");
4365       argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
4366       exit (EXIT_FAILURE);
4367     }
4368 #endif
4369 
4370   if (output_ulps)
4371     {
4372       ulps_file = fopen ("ULPs", "a");
4373       if (ulps_file == NULL)
4374 	{
4375 	  perror ("can't open file `ULPs' for writing: ");
4376 	  exit (1);
4377 	}
4378     }
4379 
4380 
4381   initialize ();
4382   printf (TEST_MSG);
4383 
4384 #if 0
4385   check_ulp ();
4386 #endif
4387 
4388   /* Keep the tests a wee bit ordered (according to ISO C99).  */
4389   /* Classification macros:  */
4390   fpclassify_test ();
4391   isfinite_test ();
4392   isnormal_test ();
4393   signbit_test ();
4394 
4395   /* Trigonometric functions:  */
4396   acos_test ();
4397   asin_test ();
4398   atan_test ();
4399   atan2_test ();
4400   cos_test ();
4401   sin_test ();
4402   sincos_test ();
4403   tan_test ();
4404 
4405   /* Hyperbolic functions:  */
4406   acosh_test ();
4407   asinh_test ();
4408   atanh_test ();
4409   cosh_test ();
4410   sinh_test ();
4411   tanh_test ();
4412 
4413   /* Exponential and logarithmic functions:  */
4414   exp_test ();
4415 #if 0 /* XXX scp XXX */
4416   exp10_test ();
4417 #endif
4418   exp2_test ();
4419   expm1_test ();
4420   frexp_test ();
4421   ldexp_test ();
4422   log_test ();
4423   log10_test ();
4424   log1p_test ();
4425   log2_test ();
4426   logb_test ();
4427   modf_test ();
4428   ilogb_test ();
4429   scalbn_test ();
4430   scalbln_test ();
4431 
4432   /* Power and absolute value functions:  */
4433   cbrt_test ();
4434   fabs_test ();
4435   hypot_test ();
4436   pow_test ();
4437   sqrt_test ();
4438 
4439   /* Error and gamma functions:  */
4440   erf_test ();
4441   erfc_test ();
4442   gamma_test ();
4443   lgamma_test ();
4444   tgamma_test ();
4445 
4446   /* Nearest integer functions:  */
4447   ceil_test ();
4448   floor_test ();
4449   nearbyint_test ();
4450   rint_test ();
4451   lrint_test ();
4452   llrint_test ();
4453   round_test ();
4454   lround_test ();
4455   llround_test ();
4456   trunc_test ();
4457 
4458   /* Remainder functions:  */
4459   fmod_test ();
4460   remainder_test ();
4461   remquo_test ();
4462 
4463   /* Manipulation functions:  */
4464   copysign_test ();
4465   nextafter_test ();
4466 #if 0 /* XXX scp XXX */
4467   nexttoward_test ();
4468 #endif
4469 
4470   /* maximum, minimum and positive difference functions */
4471   fdim_test ();
4472   fmax_test ();
4473   fmin_test ();
4474 
4475   /* Multiply and add:  */
4476   fma_test ();
4477 
4478 #if 0 /* XXX scp XXX */
4479   /* Complex functions:  */
4480   cabs_test ();
4481   cacos_test ();
4482   cacosh_test ();
4483   carg_test ();
4484   casin_test ();
4485   casinh_test ();
4486   catan_test ();
4487   catanh_test ();
4488   ccos_test ();
4489   ccosh_test ();
4490   cexp_test ();
4491   cimag_test ();
4492   clog10_test ();
4493   clog_test ();
4494   conj_test ();
4495   cpow_test ();
4496   cproj_test ();
4497   creal_test ();
4498   csin_test ();
4499   csinh_test ();
4500   csqrt_test ();
4501   ctan_test ();
4502   ctanh_test ();
4503 #endif
4504 
4505   /* Bessel functions:  */
4506   j0_test ();
4507   j1_test ();
4508   jn_test ();
4509   y0_test ();
4510   y1_test ();
4511   yn_test ();
4512 
4513   if (output_ulps)
4514     fclose (ulps_file);
4515 
4516   printf ("\nTest suite completed:\n");
4517   printf ("  %d test cases plus %d tests for exception flags executed.\n",
4518 	  noTests, noExcTests);
4519   if (noXFails)
4520     printf ("  %d expected failures occurred.\n", noXFails);
4521   if (noXPasses)
4522     printf ("  %d unexpected passes occurred.\n", noXPasses);
4523   if (noErrors)
4524     {
4525       printf ("  %d errors occurred.\n", noErrors);
4526       return 1;
4527     }
4528   printf ("  All tests passed successfully.\n");
4529 
4530   return 0;
4531 }
4532 
4533 /*
4534  * Local Variables:
4535  * mode:c
4536  * End:
4537  */
4538