summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-12 23:41:36 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-12 23:41:36 +0000
commit6355131153fd618d50286f0f24ac49b405d03ee5 (patch)
tree4927449e56ae721b2ddb0d42efcce211b6068004 /math
parentc131718ccc1db101df54fb04f34f5611c3678450 (diff)
downloadglibc-6355131153fd618d50286f0f24ac49b405d03ee5.tar.gz
glibc-6355131153fd618d50286f0f24ac49b405d03ee5.tar.xz
glibc-6355131153fd618d50286f0f24ac49b405d03ee5.zip
Update.
1997-04-13 01:06  Ulrich Drepper  <drepper@cygnus.com>

	* isomac.c: Improve messages.

	* math/Makefile (libm-calls): Add s_nearbyint, s_catan, s_casin,
	s_ccos, s_csin, s_ctan, s_ctanh, s_cacos, s_casinh, s_cacosh,
	s_catanh, s_csqrt, and s_cpow.
	* math/libm-test.c: New functions ccos_test, cacos_test, cacosh_test,
	casin_test, casinh_test, catan_test, catanh_test, ctanh_test,
	csqrt_test, cpow_test, rint_test.
	* math/math.h: Include new header mathbits.h which defines some
	more (system dependent) types and some macros.
	(isfinite): Use __finite instead of fpclassify.
	* sysdeps/generic/mathbits.h: New file.
	* sysdeps/i386/fpu/mathbits.h: New file.
	* sysdeps/i386/huge_val.h: Don't define INFINITY.
	* sysdeps/ieee754/huge_val.h: Likewise.
	* sysdeps/m68k/huge_val.h: Likewise.

	* sysdeps/i386/fpu/fenvbits.h: Define FE_NOMASK_ENV.
	* sysdeps/i386/fpu/fesetenv.c: Handle FE_NOMASK_ENV.

	* math/complex.h (_Imaginary_I): Define correctly.  I misread the
	standard first.

	* sysdeps/libm-i387/s_finite.S: Optimized rewrite.
	* sysdeps/libm-i387/s_finitef.S: Likewise.
	* sysdeps/libm-i387/s_finitel.S: Likewise.
	Provided by Joe Keane <jgk@jgk.org>.

	* sysdeps/libm-i387/s_nearbyint.S: New file.
	* sysdeps/libm-i387/s_nearbyintf.S: New file.
	* sysdeps/libm-i387/s_nearbyintl.S: New file.
	* sysdeps/libm-ieee754/s_nearbyint.S: New file.
	* sysdeps/libm-ieee754/s_nearbyintf.S: New file.
	* sysdeps/libm-ieee754/s_nearbyintl.S: New file.

	* sysdeps/libm-ieee754/s_cacos.c: New file.
	* sysdeps/libm-ieee754/s_cacosf.c: New file.
	* sysdeps/libm-ieee754/s_cacosl.c: New file.
	* sysdeps/libm-ieee754/s_cacosh.c: New file.
	* sysdeps/libm-ieee754/s_cacoshf.c: New file.
	* sysdeps/libm-ieee754/s_cacoshl.c: New file.
	* sysdeps/libm-ieee754/s_casin.c: New file.
	* sysdeps/libm-ieee754/s_casinf.c: New file.
	* sysdeps/libm-ieee754/s_casinl.c: New file.
	* sysdeps/libm-ieee754/s_casinh.c: New file.
	* sysdeps/libm-ieee754/s_casinhf.c: New file.
	* sysdeps/libm-ieee754/s_casinhl.c: New file.
	* sysdeps/libm-ieee754/s_catan.c: New file.
	* sysdeps/libm-ieee754/s_catanf.c: New file.
	* sysdeps/libm-ieee754/s_catanl.c: New file.
	* sysdeps/libm-ieee754/s_catanh.c: New file.
	* sysdeps/libm-ieee754/s_catanhf.c: New file.
	* sysdeps/libm-ieee754/s_catanhl.c: New file.
	* sysdeps/libm-ieee754/s_ccos.c: New file.
	* sysdeps/libm-ieee754/s_ccosf.c: New file.
	* sysdeps/libm-ieee754/s_ccosl.c: New file.
	* sysdeps/libm-ieee754/s_cpow.c: New file.
	* sysdeps/libm-ieee754/s_cpowf.c: New file.
	* sysdeps/libm-ieee754/s_cpowl.c: New file.
	* sysdeps/libm-ieee754/s_csin.c: New file.
	* sysdeps/libm-ieee754/s_csinf.c: New file.
	* sysdeps/libm-ieee754/s_csinl.c: New file.
	* sysdeps/libm-ieee754/s_csqrt.c: New file.
	* sysdeps/libm-ieee754/s_csqrtf.c: New file.
	* sysdeps/libm-ieee754/s_csqrtl.c: New file.
	* sysdeps/libm-ieee754/s_ctan.c: New file.
	* sysdeps/libm-ieee754/s_ctanf.c: New file.
	* sysdeps/libm-ieee754/s_ctanl.c: New file.
	* sysdeps/libm-ieee754/s_ctanh.c: New file.
	* sysdeps/libm-ieee754/s_ctanhf.c: New file.
	* sysdeps/libm-ieee754/s_ctanhl.c: New file.

	* time/strftime.c (memset_space): Increment pointer.
	* time/strptime.c: Interpret year number 00-59 as 2000--2059.
	Patches by Karl Heuer <kwzh@gnu.ai.mit.edu>.

1997-04-11 11:57  Miguel de Icaza <miguel@nuclecu.unam.mx>

	* sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove fork,
	pipe, syscall.

1997-04-05 00:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
	probably still wrong.
	* sysdeps/libm-ieee754/s_remquof.c: Likewise.
	* sysdeps/libm-ieee754/s_remquol.c: Likewise.

	* math/libm-test.c (remquo_test): Corrected.

1997-04-11 00:01  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/fpu/__math.h (__rinttol, rinttol): New inline.
	* sysdeps/m68k/fpu/s_rinttol.c: New file.
	* sysdeps/m68k/fpu/s_rinttoll.c: New file.

	* math/libm-test.c (remquo_test): Use check_long to test the
	quotient.
	(cbrt_test): Add epsilons for long double.

1997-04-10 18:48  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/localeinfo.h: Update declaration of _nl_current.

1997-04-11 11:27  Ulrich Drepper  <drepper@cygnus.com>

	* rellnsh-sh: Use explicitely /bin/pwd to find the external program.

	* math/Makefile (headers): Add fenv.h and fenvbits.h.
	(libm-support): Add s_rountol, s_roundtoll, fclrexcpt, fgetexcptflg,
	fraiseexcpt, fsetexcptflg, ftestexcept, fegetround, fesetround,
	fegetenv, feholdexcpt, fesetenv, feupdateenv.
	(libm-calls): Add s_round.
	* math/fenv.h: New file.
	* math/libm-test.c: Correct tests for s_rinttol and s_rinttoll.
	Add roundtol_check and roundtoll_check.
	* math/math.h: Pretty printing.
	* sysdeps/i386/fpu/fclrexcpt.c: New file.
	* sysdeps/i386/fpu/fegetenv.c: New file.
	* sysdeps/i386/fpu/fegetround.c: New file.
	* sysdeps/i386/fpu/feholdexcpt.c: New file.
	* sysdeps/i386/fpu/fenvbits.h: New file.
	* sysdeps/i386/fpu/fesetenv.c: New file.
	* sysdeps/i386/fpu/fesetround.c: New file.
	* sysdeps/i386/fpu/fgetexcptflg.c: New file.
	* sysdeps/i386/fpu/fraiseexcpt.c: New file.
	* sysdeps/i386/fpu/fsetexcptflg.c: New file.
	* sysdeps/i386/fpu/ftestexcept.c: New file.
	* sysdeps/stub/fclrexcpt.c: New file.
	* sysdeps/stub/fegetenv.c: New file.
	* sysdeps/stub/fegetround.c: New file.
	* sysdeps/stub/feholdexcpt.c: New file.
	* sysdeps/stub/fenvbits.h: New file.
	* sysdeps/stub/fesetenv.c: New file.
	* sysdeps/stub/fesetround.c: New file.
	* sysdeps/stub/fgetexcptflg.c: New file.
	* sysdeps/stub/fraiseexcpt.c: New file.
	* sysdeps/stub/fsetexcptflg.c: New file.
	* sysdeps/stub/ftestexcept.c: New file.

	* sysdeps/libm-i387/s_trunc.S: New file.
	* sysdeps/libm-i387/s_truncf.S: New file.
	* sysdeps/libm-i387/s_truncl.S: New file.

	* sysdeps/libm-ieee754/s_round.c: New file.
	* sysdeps/libm-ieee754/s_roundf.c: New file.
	* sysdeps/libm-ieee754/s_roundl.c: New file.

	* sysdeps/libm-ieee754/s_ccosh.c: Rewritten to use fpclassify.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
	* sysdeps/libm-ieee754/s_cexp.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
	* sysdeps/libm-ieee754/s_clog.c: Likewise.
	* sysdeps/libm-ieee754/s_clogf.c: Likewise.
	* sysdeps/libm-ieee754/s_clogl.c: Likewise.
	* sysdeps/libm-ieee754/s_csinh.c. Likewise.
	* sysdeps/libm-ieee754/s_csinhf.c. Likewise.
	* sysdeps/libm-ieee754/s_csinhl.c. Likewise.

	* sysdeps/libm-ieee754/s_ceill.c: Corrected.  The mantissa has only
	63 bits.
	* sysdeps/libm-ieee754/s_floorl.c: Likewise.

	* po/pl.po: Updated.

	* string/swab.c: Correctly handle array of odd length.

	* sysdeps/generic/memmem.c: Update copyright.

1997-04-10 20:22  Ulrich Drepper  <drepper@cygnus.com>

	* hurd/Makefile (sunrpc-headers): Add clnt.h.
	Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>.

1997-04-09 14:21  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* sysdeps/sparc/dl-machine.h: Bug fix: I was not loading
	the proper value from the GOT.  Pass argument block to
	init function.

	* sysdeps/sparc/elf/start.c: Call atexit (_fini) after calling
	_init ().

	* sysdeps/sparc/fpu_control.h: Fix the FPU constants.  I got them
	wrong the first time.

	* sysdeps/sparc/setjmp.S: PIC code was clobbering a callee saved
	register.

	* sysdeps/sparc/udiv_qrnnd.S: Add type @function.

	* sysdeps/unix/sysv/linux/sparc/init-first.h: Linux/SPARC specific
	SYSDEP_CALL_INIT.

	* sysdeps/unix/sysv/linux/sparc/signum.h: Remove definition for
	NSIG and duplicated SIGIOT.

1997-04-05 00:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
	probably still wrong.
	* sysdeps/libm-ieee754/s_remquof.c: Likewise.
	* sysdeps/libm-ieee754/s_remquol.c: Likewise.

	* math/libm-test.c (remquo_test): Corrected.

1997-04-03 18:35  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile (parent-tests): New target to run the tests to that
	they are executed even if some subdir tests have failed.
	(tests): Depend on parent-tests instead of running the tests
	directly.

1997-04-03 12:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	Clean up name space pollution in libnss_*.so:
	* nis/nss_compat/compat-pwd.c, resolv/mapv4v6addr.h,
	resolv/nss_dns/dns-host.c: Replace bzero by memset, bcopy by
	memcpy and bcmp by memcmp to clean up namespace.
	* nss/nss_db/db-XXX.c (internal_setent): Use __dbopen instead of
	dbopen.
	* nss/nss_db/db-alias.c (internal_setent): Likewise.
	* nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Likewise.
	* db/db/db.c [_LIBC]: Define __dbopen instead of dbopen and make
	the latter a weak alias.
	* db/db.h: Declare __dbopen.
	* db/btree/btree.h [_LIBC]: Prepend __ to all mpool functions.
	* db/mpool/mpool.c [_LIBC]: Define all external functions with __
	prefix and make the old names weak aliases.
	* db/mpool.h: Declare the new internal names.

1997-04-04 23:57  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio-common/vfscanf.c: Fix scanning of hexadecimal fp number.
	* stdio-common/tstscanf.c: Add test case for this.

1997-04-04 17:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/libm-test.c: Fix more typos.

1997-04-03 17:15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/libm-test.c (csinh_test): Fix test names.
	(ccosh_test): Likewise.

	* sysdeps/libm-ieee754/s_csinh.c: Use sinh function instead of
	computing it directly.
	* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
	* sysdeps/libm-ieee754/s_csinhl.c: Likewise.

	* sysdeps/libm-ieee754/s_ccosh.c:  Use cosh function instead of
	computing it directly.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.

	* sysdeps/libm-ieee754/s_cexp.c: Use internal exp function instead
	of wrapper.
	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
	* sysdeps/m68k/fpu/s_cexp.c: Likewise.  Correct handling of
	special values.  Avoid use of fsincos if all that is needed is the
	quadrant.

	* sysdeps/m68k/fpu/s_ccosh.c: New file.
	* sysdeps/m68k/fpu/s_ccoshf.c: New file.
	* sysdeps/m68k/fpu/s_ccoshl.c: New file.
	* sysdeps/m68k/fpu/s_csinh.c: New file.
	* sysdeps/m68k/fpu/s_csinhl.c: New file.
	* sysdeps/m68k/fpu/s_csinhf.c: New file.

1997-04-03 10:18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* manual/Makefile (dir-add.texi): Simplify.

	* libio/genops.c (_IO_flush_all_linebuffered): Don't flush on
Diffstat (limited to 'math')
-rw-r--r--math/Makefile14
-rw-r--r--math/complex.h2
-rw-r--r--math/fenv.h114
-rw-r--r--math/libm-test.c635
-rw-r--r--math/math.h27
5 files changed, 712 insertions, 80 deletions
diff --git a/math/Makefile b/math/Makefile
index 64803a345c..86418b003a 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -22,7 +22,8 @@ subdir		:= math
 
 # Installed header files.
 headers		:= math.h mathcalls.h __math.h huge_val.h nan.h		\
-		   fpu_control.h complex.h cmathcalls.h
+		   fpu_control.h complex.h cmathcalls.h fenv.h		\
+		   fenvbits.h
 
 # Internal header files.
 distribute	:= math_private.h machine/asm.h machine/endian.h
@@ -36,7 +37,10 @@ extra-libs	:= libm
 extra-libs-others = $(extra-libs)
 
 libm-support = k_standard s_lib_version s_matherr s_signgam		\
-	       s_rinttol s_rinttoll
+	       s_rinttol s_rinttoll s_roundtol s_roundtoll		\
+	       fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg		\
+	       ftestexcept fegetround fesetround fegetenv feholdexcpt	\
+	       fesetenv feupdateenv
 libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     e_hypot e_j0 e_j1 e_jn e_lgamma_r e_log e_log10 e_pow	\
 	     e_rem_pio2 e_remainder e_scalb e_sinh e_sqrt k_cos		\
@@ -49,8 +53,10 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r	\
 	     w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt	\
 	     s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc	\
-	     s_remquo s_log2 s_exp2					\
-	     conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog
+	     s_remquo s_log2 s_exp2 s_round s_nearbyint			\
+	     conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog	\
+	     s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos	\
+	     s_casinh s_cacosh s_catanh s_csqrt s_cpow
 libm-routines = $(libm-support) $(libm-calls) \
 		$(patsubst %_rf,%f_r,$(libm-calls:=f))	\
 		$(long-m-$(long-double-fcts))
diff --git a/math/complex.h b/math/complex.h
index 42143531dc..938823b5fb 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
 /* Narrowest imaginary unit.  This depends on the floating-point
    evaluation method.
    XXX This probably has to go into a gcc related file.  */
-#define _Imaginary_I	(DBL_EPSISON * 1.0i)
+#define _Imaginary_I	(1.0iF)
 
 /* Another more descriptive name is `I'.  */
 #undef I
diff --git a/math/fenv.h b/math/fenv.h
new file mode 100644
index 0000000000..c9a8a5c94b
--- /dev/null
+++ b/math/fenv.h
@@ -0,0 +1,114 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * ISO C 9X 7.6: Floating-point environment	<fenv.h>
+ */
+
+#ifndef _FENV_H
+
+#define __FENV_H	1
+#include <features.h>
+
+/* Get the architecture dependend definitions.  The following definitions
+   are expected to be done:
+
+   fenv_t	type for object representing an entire floating-point
+		environment
+
+   FE_DFL_ENV	macro of type pointer to fenv_t to be used as the argument
+		to functions taking an argument of type fenv_t; in this
+		case the default environment will be used
+
+   fexcept_t	type for object representing the floating-point exception
+		flags including status associated with the flags
+
+   The following macros are defined iff the implementation supports this
+   kind of exception.
+   FE_INEXACT		inxeact result
+   FE_DIVBYZERO		devision by zero
+   FE_UNDERFLOW		result not representable due to underflow
+   FE_OVERFLOW		result not representable due to overflow
+   FE_INVALID		invalid operation
+
+   FE_ALL_EXCEPT	bitwise OR of all supported exceptions
+
+   The next macros are defined iff the appropriate rounding mode is
+   supported by the implementation.
+   FE_TONEAREST		round to nearest
+   FE_UPWARD		round toward +Inf
+   FE_DOWNWARD		round toward -Inf
+   FE_TOWARDZERO	round toward 0
+*/
+#include <fenvbits.h>
+
+__BEGIN_DECLS
+
+/* Floating-point exception handling.  */
+
+/* Clear the supported exceptions represented by EXCEPTS.  */
+extern void feclearexcept __P ((int __excepts));
+
+/* Store implementation-defined representation of the exception flags
+   indicated by EXCEPTS in the object pointed to by FLAGP.  */
+extern void fegetexceptflag __P ((fexcept_t *__flagp, int __excepts));
+
+/* Raise the supported exceptions represented by EXCEPTS.  */
+extern void feraiseexcept __P ((int __excepts));
+
+/* Set complete status for exceptions inidicated by EXCEPTS according to
+   the representation in the object pointed to by FLAGP.  */
+extern void fesetexceptflag __P ((__const fexcept_t *__flagp, int __excepts));
+
+/* Determine which of subset of the exceptions specified by EXCEPTS are
+   currently set.  */
+extern int fetestexcept __P ((int __excepts));
+
+
+/* Rounding control.  */
+
+/* Get current rounding direction.  */
+extern int fegetround __P ((void));
+
+/* Establish the rounding direction represented by ROUND.  */
+extern int fesetround __P ((int __round));
+
+
+/* Floating-point environment.  */
+
+/* Store the current floating-point environment in the object pointed
+   to by ENVP.  */
+extern void fegetenv __P ((fenv_t *__envp));
+
+/* Save the current environment in the object pointed to by ENVP, clear
+   exception flags and install a non-stop mode (if available) for all
+   exceptions.  */
+extern int feholdexcept __P ((fenv_t *__envp));
+
+/* Establish the floating-point environment represented by the object
+   pointed to by ENVP.  */
+extern void fesetenv __P ((__const fenv_t *__envp));
+
+/* Save current exceptions in temporary storage, install environment
+   represented by object pointed to by ENVP and raise exceptions
+   according to saved exceptions.  */
+extern void feupdateenv __P ((__const fenv_t *__envp));
+
+__END_DECLS
+
+#endif /* fenv.h */
diff --git a/math/libm-test.c b/math/libm-test.c
index 5171d0fc5e..356cc91a16 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -633,8 +633,9 @@ cbrt_test (void)
   check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty));
   check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value));
 
-  check ("cbrt (8) == 2", FUNC(cbrt) (8), 2);
-  check ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0);
+  check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0));
+  check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0,
+	     CHOOSE (3e-16L, 0, 0));
 }
 
 
@@ -1573,19 +1574,19 @@ remquo_test (void)
 
   result = FUNC(remquo) (1.625, 1.0, &quo);
   check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
-  check ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
+  check_long ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
 
   result = FUNC(remquo) (-1.625, 1.0, &quo);
   check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
-  check ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
+  check_long ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
 
   result = FUNC(remquo) (1.625, -1.0, &quo);
-  check ("remquo(1.125, -1.0, &x) == 0.125", result, 0.125);
-  check ("remquo(1.125, -1.0, &x) puts -1 in x", quo, -1);
+  check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
+  check_long ("remquo(1.625, -1.0, &x) puts -1 in x", quo, -1);
 
   result = FUNC(remquo) (-1.625, -1.0, &quo);
-  check ("remquo(-1.125, -1.0, &x) == 0.125", result, 0.125);
-  check ("remquo(-1.125, -1.0, &x) puts 1 in x", quo, 1);
+  check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
+  check_long ("remquo(-1.625, -1.0, &x) puts 1 in x", quo, 1);
 }
 
 
@@ -1667,10 +1668,10 @@ cexp_test (void)
   result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
   check_isnan ("real(cexp(NaN + 1i)) = NaN", __real__ result);
   check_isnan ("imag(cexp(NaN + 1i)) = NaN", __imag__ result);
-  result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
+  result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
   check_isnan ("real(cexp(NaN + i inf)) = NaN", __real__ result);
   check_isnan ("imag(cexp(NaN + i inf)) = NaN", __imag__ result);
-  result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
+  result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
 
@@ -1702,16 +1703,16 @@ csinh_test (void)
   check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
-  check ("real(csinh(0 + i Inf)) = 0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(0 + i Inf)) = NaN", __imag__ result);
   result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
-  check ("real(csinh(-0 + i Inf)) = -0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(-0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(-0 + i Inf)) = NaN", __imag__ result);
   result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
-  check ("real(csinh(0 - i Inf)) = 0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(0 - i Inf)) = NaN", __imag__ result);
   result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
-  check ("real(csinh(-0 - i Inf)) = -0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(-0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(-0 - i Inf)) = NaN", __imag__ result);
 
   result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0));
@@ -1740,7 +1741,7 @@ csinh_test (void)
 		FUNC(fabs) (__real__ result));
   check_isnan ("imag(csinh(Inf - i Inf)) = NaN", __imag__ result);
   result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
-  check_isinfp ("real(csinh(-Inf - i Inf)) = -Inf",
+  check_isinfp ("real(csinh(-Inf - i Inf)) = +-Inf",
 		FUNC(fabs) (__real__ result));
   check_isnan ("imag(csinh(-Inf - i Inf)) = NaN", __imag__ result);
 
@@ -1771,10 +1772,10 @@ csinh_test (void)
   check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN", __imag__ result);
 
   result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value));
-  check ("real(csinh(0 + i NaN)) = 0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result);
   result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value));
-  check ("real(csinh(-0 + i NaN)) = -0", FUNC(fabs) (__real__ result), 0);
+  check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
   check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
 
   result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value));
@@ -1784,7 +1785,7 @@ csinh_test (void)
   result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value));
   check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
 		FUNC(fabs) (__real__ result));
-  check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
+  check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result);
 
   result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
   check_isnan ("real(csinh(9.0 + i NaN)) = NaN", __real__ result);
@@ -1795,10 +1796,10 @@ csinh_test (void)
 
   result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0));
   check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result);
-  check ("imag(csinh(NaN + i0)) = NaN", __imag__ result, 0.0);
+  check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0);
   result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero));
   check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result);
-  check ("imag(csinh(NaN - i0)) = NaN", __imag__ result, minus_zero);
+  check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
   check_isnan ("real(csinh(NaN + i10)) = NaN", __real__ result);
@@ -1821,21 +1822,152 @@ csinh_test (void)
 
 
 static void
+ccos_test (void)
+{
+  __complex__ MATHTYPE result;
+
+  result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0));
+  check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0);
+  check ("imag(ccos(0 + 0i)) = 0", __imag__ result, 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0));
+  check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0);
+  check ("imag(ccos(-0 + 0i)) = -0", __imag__ result, minus_zero);
+  result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero));
+  check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0);
+  check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero));
+  check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0);
+  check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
+  check_isnan ("real(ccos(+Inf + i0)) = NaN", __real__ result);
+  check ("imag(ccos(Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
+  check_isnan ("real(ccos(Inf - i0)) = NaN", __real__ result);
+  check ("imag(ccos(Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
+  check_isnan ("real(ccos(-Inf + i0)) = NaN", __real__ result);
+  check ("imag(ccos(-Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
+  check_isnan ("real(ccos(-Inf - i0)) = NaN", __real__ result);
+  check ("imag(ccos(-Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty));
+  check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result);
+  check ("imag(ccos(0 + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty));
+  check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result);
+  check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty));
+  check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result);
+  check ("imag(ccos(-0 + i Inf)) = -0", __imag__ result, minus_zero);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty));
+  check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result);
+  check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
+  check_isinfp ("real(ccos(+Inf + i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(+Inf + i Inf)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
+  check_isinfp ("real(ccos(-Inf + i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(-Inf + i Inf)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
+  check_isinfp ("real(ccos(Inf - i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(Inf - i Inf)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
+  check_isinfp ("real(ccos(-Inf - i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(-Inf - i Inf)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty));
+  check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result);
+  check_isinfn ("imag(ccos(4.625 + i Inf)) = -Inf", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty));
+  check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result);
+  check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty));
+  check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result);
+  check_isinfp ("imag(ccos(-4.625 + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty));
+  check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result);
+  check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
+  check_isnan ("real(ccos(+Inf + i6.75)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(+Inf + i6.75)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
+  check_isnan ("real(ccos(+Inf - i6.75)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(+Inf - i6.75)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
+  check_isnan ("real(ccos(-Inf + i6.75)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(-Inf + i6.75)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
+  check_isnan ("real(ccos(-Inf - i6.75)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(-Inf - i6.75)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0));
+  check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result);
+  check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero));
+  check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result);
+  check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty));
+  check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty));
+  check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result);
+  check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
+  check_isnan ("real(ccos(NaN + i9.0)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(NaN + i9.0)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
+  check_isnan ("real(ccos(NaN - i9.0)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(NaN - i9.0)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value));
+  check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result);
+  check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value));
+  check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result);
+  check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
+  check_isnan ("real(ccos(10 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(10 + i NaN)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
+  check_isnan ("real(ccos(-10 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(-10 + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
+  check_isnan ("real(ccos(+Inf + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(+Inf + i NaN)) = NaN", __imag__ result);
+  result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
+  check_isnan ("real(ccos(-Inf + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(-Inf + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
+  check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
+}
+
+
+static void
 ccosh_test (void)
 {
   __complex__ MATHTYPE result;
 
   result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0));
-  check ("real(ccosh(0 + 0i)) = 0", __real__ result, 1.0);
+  check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0);
   check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0);
   result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0));
-  check ("real(ccosh(-0 + 0i)) = -0", __real__ result, 1.0);
+  check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0);
   check ("imag(ccosh(-0 + 0i)) = 0", __imag__ result, 0);
   result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero));
-  check ("real(ccosh(0 - 0i)) = 0", __real__ result, 1.0);
+  check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0);
   check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero);
   result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero));
-  check ("real(ccosh(-0 - 0i)) = -0", __real__ result, 1.0);
+  check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0);
   check ("imag(ccosh(-0 - 0i)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
@@ -1843,13 +1975,13 @@ ccosh_test (void)
   check ("imag(ccosh(0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
   result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
   check_isnan ("real(ccosh(-0 + i Inf)) = NaN", __real__ result);
-  check ("imag(ccosh(-0 + i Inf)) = -0", FUNC(fabs) (__imag__ result), 0);
+  check ("imag(ccosh(-0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
   result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
   check_isnan ("real(ccosh(0 - i Inf)) = NaN", __real__ result);
-  check ("imag(ccosh(0 - i Inf)) = 0", FUNC(fabs) (__imag__ result), 0);
+  check ("imag(ccosh(0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
   result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
   check_isnan ("real(ccosh(-0 - i Inf)) = NaN", __real__ result);
-  check ("imag(ccosh(-0 - i Inf)) = -0", FUNC(fabs) (__imag__ result), 0);
+  check ("imag(ccosh(-0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
 
   result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0));
   check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result);
@@ -1915,7 +2047,7 @@ ccosh_test (void)
   check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result);
   result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value));
   check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result);
-  check_isnan ("imag(ccosh(-0 + i NaN)) = NaN", __imag__ result);
+  check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result);
 
   result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
   check_isnan ("real(ccosh(9.0 + i NaN)) = NaN", __real__ result);
@@ -1926,10 +2058,10 @@ ccosh_test (void)
 
   result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0));
   check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result);
-  check ("imag(ccosh(NaN + i0)) = NaN", __imag__ result, 0.0);
+  check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
   result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero));
   check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result);
-  check ("imag(ccosh(NaN - i0)) = NaN", __imag__ result, minus_zero);
+  check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
 
   result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
   check_isnan ("real(ccosh(NaN + i10)) = NaN", __real__ result);
@@ -1951,8 +2083,6 @@ ccosh_test (void)
 }
 
 
-#if 0
-/* Enable these tests as soon as the functions are available.  */
 static void
 cacos_test (void)
 {
@@ -2194,6 +2324,131 @@ cacosh_test (void)
 
 
 static void
+casin_test (void)
+{
+  __complex__ MATHTYPE result;
+
+  result = FUNC(casin) (BUILD_COMPLEX (0, 0));
+  check ("real(casin(0 + i0)) = 0", __real__ result, 0);
+  check ("imag(casin(0 + i0)) = 0", __imag__ result, 0);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_zero, 0));
+  check ("real(casin(-0 + i0)) = -0", __real__ result, minus_zero);
+  check ("imag(casin(-0 + i0)) = 0", __imag__ result, 0);
+  result = FUNC(casin) (BUILD_COMPLEX (0, minus_zero));
+  check ("real(casin(0 - i0)) = 0", __real__ result, 0);
+  check ("imag(casin(0 - i0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero));
+  check ("real(casin(-0 - i0)) = -0", __real__ result, minus_zero);
+  check ("imag(casin(-0 - i0)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty));
+  check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
+  check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty));
+  check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
+  check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty));
+  check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result, -M_PI_4);
+  check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty));
+  check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result, -M_PI_4);
+  check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty));
+  check ("real(casin(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
+  check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty));
+  check ("real(casin(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
+  check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (0, plus_infty));
+  check ("real(casin(0 + i Inf)) = 0", __real__ result, 0.0);
+  check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (0, minus_infty));
+  check ("real(casin(0 - i Inf)) = 0", __real__ result, 0.0);
+  check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty));
+  check ("real(casin(-0 + i Inf)) = -0", __real__ result, minus_zero);
+  check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty));
+  check ("real(casin(-0 - i Inf)) = -0", __real__ result, minus_zero);
+  check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (0.1, plus_infty));
+  check ("real(casin(0.1 + i Inf)) = 0", __real__ result, 0);
+  check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (0.1, minus_infty));
+  check ("real(casin(0.1 - i Inf)) = 0", __real__ result, 0);
+  check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 0));
+  check ("real(casin(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
+  check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero));
+  check ("real(casin(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
+  check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 100));
+  check ("real(casin(-Inf + i100)) = -pi/2", __real__ result, -M_PI_2);
+  check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, -100));
+  check ("real(casin(-Inf - i100)) = -pi/2", __real__ result, -M_PI_2);
+  check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0));
+  check ("real(casin(+Inf + i0)) = pi/2", __real__ result, M_PI_2);
+  check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero));
+  check ("real(casin(+Inf - i0)) = pi/2", __real__ result, M_PI_2);
+  check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5));
+  check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result, M_PI_2);
+  check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5));
+  check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result, M_PI_2);
+  check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty));
+  check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result);
+  check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty));
+  check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result);
+  check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (0.0, nan_value));
+  check ("real(casin(0 + i NaN)) = 0", __real__ result, 0.0);
+  check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value));
+  check ("real(casin(-0 + i NaN)) = -0", __real__ result, minus_zero);
+  check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value));
+  check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result);
+  check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
+		FUNC(fabs) (__imag__ result));
+  result = FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value));
+  check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result);
+  check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
+		FUNC(fabs) (__imag__ result));
+
+  result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5));
+  check_isnan ("real(casin(NaN + i10.5)) = NaN", __real__ result);
+  check_isnan ("imag(casin(NaN + i10.5)) = NaN", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5));
+  check_isnan ("real(casin(NaN - i10.5)) = NaN", __real__ result);
+  check_isnan ("imag(casin(NaN - i10.5)) = NaN", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value));
+  check_isnan ("real(casin(0.75 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(casin(0.75 + i NaN)) = NaN", __imag__ result);
+  result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value));
+  check_isnan ("real(casin(-0.75 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(casin(-0.75 + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value));
+  check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result);
+}
+
+
+static void
 casinh_test (void)
 {
   __complex__ MATHTYPE result;
@@ -2236,6 +2491,12 @@ casinh_test (void)
   result = FUNC(casinh) (BUILD_COMPLEX (0, minus_infty));
   check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result);
   check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty));
+  check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result);
+  check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty));
+  check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result);
+  check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
   result = FUNC(casinh) (BUILD_COMPLEX (0.1, plus_infty));
   check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result);
   check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
@@ -2278,17 +2539,17 @@ casinh_test (void)
 
   result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0));
   check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result);
-  check ("imag(casinh(NaN + i0)) = 0", __imag__ resul, 0);
-  result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, nan_value));
+  check ("imag(casinh(NaN + i0)) = 0", __imag__ result, 0);
+  result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero));
   check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result);
   check ("imag(casinh(NaN - i0)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty));
-  check_isinfp ("real(casinh(NaN + i Inf)) = +Inf",
+  check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
 		FUNC(fabs) (__real__ result));
   check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result);
   result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty));
-  check_isinfp ("real(casinh(NaN - i Inf)) = +Inf",
+  check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
 		FUNC(fabs) (__real__ result));
   check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result);
 
@@ -2302,7 +2563,7 @@ casinh_test (void)
   result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75));
   check_isnan ("real(casinh(NaN + i0.75)) = NaN", __real__ result);
   check_isnan ("imag(casinh(NaN + i0.75)) = NaN", __imag__ result);
-  result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value));
+  result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value));
   check_isnan ("real(casinh(NaN - i0.75)) = NaN", __real__ result);
   check_isnan ("imag(casinh(NaN - i0.75)) = NaN", __imag__ result);
 
@@ -2313,6 +2574,136 @@ casinh_test (void)
 
 
 static void
+catan_test (void)
+{
+  __complex__ MATHTYPE result;
+
+  result = FUNC(catan) (BUILD_COMPLEX (0, 0));
+  check ("real(catan(0 + i0)) = 0", __real__ result, 0);
+  check ("imag(catan(0 + i0)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_zero, 0));
+  check ("real(catan(-0 + i0)) = -0", __real__ result, minus_zero);
+  check ("imag(catan(-0 + i0)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (0, minus_zero));
+  check ("real(catan(0 - i0)) = 0", __real__ result, 0);
+  check ("imag(catan(0 - i0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero));
+  check ("real(catan(-0 - i0)) = -0", __real__ result, minus_zero);
+  check ("imag(catan(-0 - i0)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty));
+  check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty));
+  check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty));
+  check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result, 0.0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty));
+  check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0));
+  check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, -10.0));
+  check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_zero));
+  check ("real(catan(Inf - i0)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(Inf - i0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_zero));
+  check ("real(catan(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf - i0)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.0));
+  check ("real(catan(Inf + i0)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(Inf + i0)) = 0", __imag__ result, 0.0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.0));
+  check ("real(catan(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf + i0)) = 0", __imag__ result, 0.0);
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.1));
+  check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.1));
+  check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result, 0);
+
+  result = FUNC(catan) (BUILD_COMPLEX (0.0, minus_infty));
+  check ("real(catan(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(0 - i Inf)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_infty));
+  check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-0 - i Inf)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (100.0, minus_infty));
+  check ("real(catan(100 - i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(100 - i Inf)) = -0", __imag__ result, minus_zero);
+  result = FUNC(catan) (BUILD_COMPLEX (-100.0, minus_infty));
+  check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-100 - i Inf)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(catan) (BUILD_COMPLEX (0.0, plus_infty));
+  check ("real(catan(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(0 + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_zero, plus_infty));
+  check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-0 + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (0.5, plus_infty));
+  check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (-0.5, plus_infty));
+  check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result, 0);
+
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, 0.0));
+  check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result);
+  check ("imag(catan(NaN + i0)) = 0", __imag__ result, 0.0);
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_zero));
+  check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result);
+  check ("imag(catan(NaN - i0)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, plus_infty));
+  check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result);
+  check ("imag(catan(NaN + i Inf)) = 0", __imag__ result, 0);
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_infty));
+  check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result);
+  check ("imag(catan(NaN - i Inf)) = -0", __imag__ result, minus_zero);
+
+  result = FUNC(catan) (BUILD_COMPLEX (0.0, nan_value));
+  check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_zero, nan_value));
+  check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(catan) (BUILD_COMPLEX (plus_infty, nan_value));
+  check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result, M_PI_2);
+  check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
+  result = FUNC(catan) (BUILD_COMPLEX (minus_infty, nan_value));
+  check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result, -M_PI_2);
+  check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
+
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5));
+  check_isnan ("real(catan(NaN + i10.5)) = NaN", __real__ result);
+  check_isnan ("imag(catan(NaN + i10.5)) = NaN", __imag__ result);
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5));
+  check_isnan ("real(catan(NaN - i10.5)) = NaN", __real__ result);
+  check_isnan ("imag(catan(NaN - i10.5)) = NaN", __imag__ result);
+
+  result = FUNC(catan) (BUILD_COMPLEX (0.75, nan_value));
+  check_isnan ("real(catan(0.75 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(catan(0.75 + i NaN)) = NaN", __imag__ result);
+  result = FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value));
+  check_isnan ("real(catan(-0.75 + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(catan(-0.75 + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value));
+  check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result);
+  check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result);
+}
+
+
+static void
 catanh_test (void)
 {
   __complex__ MATHTYPE result;
@@ -2344,11 +2735,17 @@ catanh_test (void)
   check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
 
   result = FUNC(catanh) (BUILD_COMPLEX (-10.0, plus_infty));
-  check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, -minus_zero);
+  check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
   check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
   result = FUNC(catanh) (BUILD_COMPLEX (-10.0, minus_infty));
-  check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_infty);
+  check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
   check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, plus_infty));
+  check ("real(catanh(-0 + i Inf)) = -0", __real__ result, minus_zero);
+  check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_infty));
+  check ("real(catanh(-0 - i Inf)) = -0", __real__ result, minus_zero);
+  check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
   result = FUNC(catanh) (BUILD_COMPLEX (0, plus_infty));
   check ("real(catanh(0 + i Inf)) = 0", __real__ result, 0);
   check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
@@ -2390,10 +2787,10 @@ catanh_test (void)
 
   result = FUNC(catanh) (BUILD_COMPLEX (0, nan_value));
   check ("real(catanh(0 + i NaN)) = 0", __real__ result, 0);
-  check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result);
+  check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result);
   result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
   check ("real(catanh(-0 + i NaN)) = -0", __real__ result, minus_zero);
-  check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result);
+  check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result);
 
   result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value));
   check ("real(catanh(+Inf + i NaN)) = 0", __real__ result, 0);
@@ -2404,8 +2801,8 @@ catanh_test (void)
 
   result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0));
   check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result);
-  check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ resul);
-  result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
+  check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result);
+  result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_zero));
   check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result);
   check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result);
 
@@ -2426,7 +2823,7 @@ catanh_test (void)
   result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75));
   check_isnan ("real(catanh(NaN + i0.75)) = NaN", __real__ result);
   check_isnan ("imag(catanh(NaN + i0.75)) = NaN", __imag__ result);
-  result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value));
+  result = FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75));
   check_isnan ("real(catanh(NaN - i0.75)) = NaN", __real__ result);
   check_isnan ("imag(catanh(NaN - i0.75)) = NaN", __imag__ result);
 
@@ -2449,7 +2846,7 @@ ctanh_test (void)
   check ("imag(ctanh(0 - i0)) = -0", __imag__ result, minus_zero);
   result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, 0));
   check ("real(ctanh(-0 + i0)) = -0", __real__ result, minus_zero);
-  check ("imag(ctanh(-0 + i0)) = -0", __imag__ result, 0);
+  check ("imag(ctanh(-0 + i0)) = 0", __imag__ result, 0);
   result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_zero));
   check ("real(ctanh(-0 - i0)) = -0", __real__ result, minus_zero);
   check ("imag(ctanh(-0 - i0)) = -0", __imag__ result, minus_zero);
@@ -2472,7 +2869,7 @@ ctanh_test (void)
   result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 1));
   check ("real(ctanh(-Inf + i1)) = -1", __real__ result, -1);
   check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result, 0);
-  result = FUNC(ctanh) (BUILD_COMPLEX (pminus_infty, minus_zero));
+  result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, minus_zero));
   check ("real(ctanh(-Inf - i0)) = -1", __real__ result, -1);
   check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result, minus_zero);
   result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, -1));
@@ -2514,9 +2911,9 @@ ctanh_test (void)
   result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0));
   check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result);
   check ("imag(ctanh(NaN + i0)) = 0", __imag__ result, 0);
-  result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_infty));
+  result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_zero));
   check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result);
-  check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_infty);
+  check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5));
   check_isnan ("real(ctanh(NaN + i0.5)) = NaN", __real__ result);
@@ -2542,7 +2939,6 @@ ctanh_test (void)
   check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result);
 }
-#endif
 
 
 static void
@@ -2639,7 +3035,7 @@ clog_test (void)
   result = FUNC(clog) (BUILD_COMPLEX (nan_value, plus_infty));
   check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result);
   check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result);
-  result = FUNC(clog) (BUILD_COMPLEX (minus_infty, nan_value));
+  result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_infty));
   check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result);
   check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result);
 
@@ -2675,7 +3071,6 @@ clog_test (void)
 }
 
 
-#if 0
 static void
 csqrt_test (void)
 {
@@ -2709,16 +3104,16 @@ csqrt_test (void)
 
   result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 0));
   check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result);
-  check ("imag(csqrt(-Inf + i0)) = 0", __imag__ result, 0);
+  check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result, 0);
   result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 6));
   check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result);
-  check ("imag(csqrt(-Inf + i6)) = 0", __imag__ result, 0);
+  check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result, 0);
   result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_zero));
   check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result);
-  check ("imag(csqrt(-Inf - i0)) = -0", __imag__ result, minus_zero);
+  check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result, minus_zero);
   result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, -6));
   check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result);
-  check ("imag(csqrt(-Inf - i6)) = -0", __imag__ result, minus_zero);
+  check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result, minus_zero);
 
   result = FUNC(csqrt) (BUILD_COMPLEX (0, plus_infty));
   check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result);
@@ -2796,7 +3191,23 @@ csqrt_test (void)
   check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result);
 }
-#endif
+
+
+static void
+cpow_test (void)
+{
+  __complex__ MATHTYPE result;
+}
+
+
+static void
+rint_test (void)
+{
+  check ("rint(0) = 0", FUNC(rint) (0.0), 0.0);
+  check ("rint(-0) = -0", FUNC(rint) (minus_zero), minus_zero);
+  check_isinfp ("rint(+Inf) = +Inf", FUNC(rint) (plus_infty));
+  check_isinfn ("rint(-Inf) = -Inf", FUNC(rint) (minus_infty));
+}
 
 
 static void
@@ -2806,16 +3217,17 @@ rinttol_test (void)
      the rounding method and test the critical cases.  So far, only
      unproblematic numbers are tested.  */
 
-  check_long ("rinttol(0) = 0", 0.0, 0);
-  check_long ("rinttol(-0) = 0", minus_zero, 0);
-  check_long ("rinttol(0.2) = 0", 0.2, 0);
-  check_long ("rinttol(-0.2) = 0", -0.2, 0);
+  check_long ("rinttol(0) = 0", rinttol (0.0), 0);
+  check_long ("rinttol(-0) = 0", rinttol (minus_zero), 0);
+  check_long ("rinttol(0.2) = 0", rinttol (0.2), 0);
+  check_long ("rinttol(-0.2) = 0", rinttol (-0.2), 0);
 
-  check_long ("rinttol(1.4) = 1", 1.4, 1);
-  check_long ("rinttol(-1.4) = -1", -1.4, -1);
+  check_long ("rinttol(1.4) = 1", rinttol (1.4), 1);
+  check_long ("rinttol(-1.4) = -1", rinttol (-1.4), -1);
 
-  check_long ("rinttol(8388600.3) = 8388600", 8388600.3, 8388600);
-  check_long ("rinttol(-8388600.3) = -8388600", -8388600.3, -8388600);
+  check_long ("rinttol(8388600.3) = 8388600", rinttol (8388600.3), 8388600);
+  check_long ("rinttol(-8388600.3) = -8388600", rinttol (-8388600.3),
+	      -8388600);
 }
 
 
@@ -2826,16 +3238,79 @@ rinttoll_test (void)
      the rounding method and test the critical cases.  So far, only
      unproblematic numbers are tested.  */
 
-  check_longlong ("rinttoll(0) = 0", 0.0, 0);
-  check_longlong ("rinttoll(-0) = 0", minus_zero, 0);
-  check_longlong ("rinttoll(0.2) = 0", 0.2, 0);
-  check_longlong ("rinttoll(-0.2) = 0", -0.2, 0);
+  check_longlong ("rinttoll(0) = 0", rinttoll (0.0), 0);
+  check_longlong ("rinttoll(-0) = 0", rinttoll (minus_zero), 0);
+  check_longlong ("rinttoll(0.2) = 0", rinttoll (0.2), 0);
+  check_longlong ("rinttoll(-0.2) = 0", rinttoll (-0.2), 0);
 
-  check_longlong ("rinttoll(1.4) = 1", 1.4, 1);
-  check_longlong ("rinttoll(-1.4) = -1", -1.4, -1);
+  check_longlong ("rinttoll(1.4) = 1", rinttoll (1.4), 1);
+  check_longlong ("rinttoll(-1.4) = -1", rinttoll (-1.4), -1);
 
-  check_longlong ("rinttoll(8388600.3) = 8388600", 8388600.3, 8388600);
-  check_longlong ("rinttoll(-8388600.3) = -8388600", -8388600.3, -8388600);
+  check_longlong ("rinttoll(8388600.3) = 8388600", rinttoll (8388600.3),
+		  8388600);
+  check_longlong ("rinttoll(-8388600.3) = -8388600", rinttoll (-8388600.3),
+		  -8388600);
+}
+
+
+static void
+round_test (void)
+{
+  check ("round(0) = 0", FUNC(round) (0), 0);
+  check ("round(-0) = -0", FUNC(round) (minus_zero), minus_zero);
+  check ("round(0.2) = 0", FUNC(round) (0.2), 0.0);
+  check ("round(-0.2) = -0", FUNC(round) (-0.2), minus_zero);
+  check ("round(0.5) = 1", FUNC(round) (0.5), 1.0);
+  check ("round(-0.5) = -1", FUNC(round) (-0.5), -1.0);
+  check ("round(0.8) = 1", FUNC(round) (0.8), 1.0);
+  check ("round(-0.8) = -1", FUNC(round) (-0.8), -1.0);
+  check ("round(1.5) = 2", FUNC(round) (1.5), 2.0);
+  check ("round(-1.5) = -2", FUNC(round) (-1.5), -2.0);
+  check ("round(2097152.5) = 2097153", FUNC(round) (2097152.5), 2097153);
+  check ("round(-2097152.5) = -2097153", FUNC(round) (-2097152.5), -2097153);
+}
+
+
+static void
+roundtol_test (void)
+{
+  check_long ("roundtol(0) = 0", roundtol (0), 0);
+  check_long ("roundtol(-0) = 0", roundtol (minus_zero), 0);
+  check_long ("roundtol(0.2) = 0", roundtol (0.2), 0.0);
+  check_long ("roundtol(-0.2) = 0", roundtol (-0.2), 0);
+  check_long ("roundtol(0.5) = 1", roundtol (0.5), 1);
+  check_long ("roundtol(-0.5) = -1", roundtol (-0.5), -1);
+  check_long ("roundtol(0.8) = 1", roundtol (0.8), 1);
+  check_long ("roundtol(-0.8) = -1", roundtol (-0.8), -1);
+  check_long ("roundtol(1.5) = 2", roundtol (1.5), 2);
+  check_long ("roundtol(-1.5) = -2", roundtol (-1.5), -2);
+  check_long ("roundtol(2097152.5) = 2097153", roundtol (2097152.5), 2097153);
+  check_long ("roundtol(-2097152.5) = -2097153", roundtol (-2097152.5),
+	      -2097153);
+}
+
+
+static void
+roundtoll_test (void)
+{
+  check_longlong ("roundtoll(0) = 0", roundtoll (0), 0);
+  check_longlong ("roundtoll(-0) = 0", roundtoll (minus_zero), 0);
+  check_longlong ("roundtoll(0.2) = 0", roundtoll (0.2), 0.0);
+  check_longlong ("roundtoll(-0.2) = 0", roundtoll (-0.2), 0);
+  check_longlong ("roundtoll(0.5) = 1", roundtoll (0.5), 1);
+  check_longlong ("roundtoll(-0.5) = -1", roundtoll (-0.5), -1);
+  check_longlong ("roundtoll(0.8) = 1", roundtoll (0.8), 1);
+  check_longlong ("roundtoll(-0.8) = -1", roundtoll (-0.8), -1);
+  check_longlong ("roundtoll(1.5) = 2", roundtoll (1.5), 2);
+  check_longlong ("roundtoll(-1.5) = -2", roundtoll (-1.5), -2);
+  check_longlong ("roundtoll(2097152.5) = 2097153",
+		  roundtoll (2097152.5), 2097153);
+  check_longlong ("roundtoll(-2097152.5) = -2097153",
+		  roundtoll (-2097152.5), -2097153);
+  check_longlong ("roundtoll(34359738368.5) = 34359738369",
+		  roundtoll (34359738368.5), 34359738369ll);
+  check_longlong ("roundtoll(-34359738368.5) = -34359738369",
+		  roundtoll (-34359738368.5), -34359738369ll);
 }
 
 
@@ -3168,11 +3643,25 @@ main (int argc, char *argv[])
 #endif
   cexp_test ();
   csinh_test ();
+  ccos_test ();
   ccosh_test ();
   clog_test ();
-
+  cacos_test ();
+  cacosh_test ();
+  casin_test ();
+  casinh_test ();
+  catan_test ();
+  catanh_test ();
+  ctanh_test ();
+  csqrt_test ();
+  cpow_test ();
+
+  rint_test ();
   rinttol_test ();
   rinttoll_test ();
+  round_test ();
+  roundtol_test ();
+  roundtoll_test ();
 
   identities ();
   inverse_functions ();
diff --git a/math/math.h b/math/math.h
index ce4f4867fa..bf3ef9bcee 100644
--- a/math/math.h
+++ b/math/math.h
@@ -115,6 +115,25 @@ extern int signgam;
 /* ISO C 9X defines some generic macros which work on any data type.  */
 #if __USE_ISOC9X
 
+/* Get the architecture specific values describing the floating-point
+   evaluation.  The following symbols will get defined:
+
+     float_t	floating-point type at least as wide as `float' used
+		to evaluate `float' expressions
+     double_t	floating-point type at least as wide as `double' used
+		to evaluate `double' expressions
+
+     FLT_EVAL_METHOD
+		Defined to
+		  0	if `float_t' is `float' and `double_t' is `double'
+		  1	if `float_t' and `double_t' are `double'
+		  2	if `float_t' and `double_t' are `long double'
+		  else	`float_t' and `double_t' are unspecified
+
+     INFINITY	representation of the infinity value of type `float_t'
+*/
+#include <mathbits.h>
+
 /* All floating-point numbers can be put in one of these categories.  */
 enum
   {
@@ -133,7 +152,7 @@ enum
 /* Return number of classification appropriate for X.  */
 #define fpclassify(x) \
      (sizeof (x) == sizeof (float) ?					      \
-        __fpclassifyf (x)							      \
+        __fpclassifyf (x)						      \
       : sizeof (x) == sizeof (double) ?					      \
         __fpclassify (x) : __fpclassifyl (x))
 
@@ -145,7 +164,11 @@ enum
         __signbit (x) : __signbitl (x))
 
 /* Return nonzero value if X is not +-Inf or NaN.  */
-#define isfinite(x) (fpclassify (x) >= FP_ZERO)
+#define isfinite(x) \
+     (sizeof (x) == sizeof (float) ?					      \
+        __finitef (x)							      \
+      : sizeof (x) == sizeof (double) ?					      \
+        __finite (x) : __finitel (x))
 
 /* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN.  */
 #define isnormal(x) (fpclassify (x) == FP_NORMAL)