diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-29 17:32:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-29 17:32:35 +0000 |
commit | 993b3242cdc37152fbbc7fbd5ce22b2734b04b23 (patch) | |
tree | d3c4fc94e027728055d96a370d034b6fb685cf85 /math | |
parent | e7fd8a39abd3a9c9d2139e686b17efb5dc3bf444 (diff) | |
download | glibc-993b3242cdc37152fbbc7fbd5ce22b2734b04b23.zip glibc-993b3242cdc37152fbbc7fbd5ce22b2734b04b23.tar.gz glibc-993b3242cdc37152fbbc7fbd5ce22b2734b04b23.tar.bz2 |
Update.
1997-03-29 17:39 Ulrich Drepper <drepper@cygnus.com>
* math/Makefile (routines): Add carg, s_ccosh and s_csinh.
* math/complex.h: Add C++ protection.
* math/libm-test.c (cexp_test): Correct a few bugs.
(csinh_test): New function.
(ccosh_test): New function.
(cacos_test): New function.
(cacosh_test): New function.
(casinh_test): New function.
(catanh_test): New function.
(main): Add calls to csinh_test and ccosh_test.
* misc/Makefile (tests): Add tst-tsearch.
Add rule to link tst-tsearch against libm.
* misc/tsearch.c: Rewritten to use Red-Black-Tree algorithm by
Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>.
* misc/tst-tsearch.c: New file.
* stdio-common/bug5.c: Clear LD_LIBRARY_PATH environment variable
before using system.
* stdio-common/test-popen.c: Clear LD_LIBRARY_PATH environment variable
before using popen.
* sysdeps/libm-ieee754/s_cexp.c: Correct handling of special cases.
* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
* sysdeps/libm-i387/s_cexp.S: New file. ix87 specific implementation
of complex exponential function.
* sysdeps/libm-i387/s_cexpf.S: New file.
* sysdeps/libm-i387/s_cexpl.S: New file.
* sysdeps/libm-ieee754/s_ccosh.c: New file. Implementation of
complex cosh function.
* sysdeps/libm-ieee754/s_ccoshf.c: New file.
* sysdeps/libm-ieee754/s_ccoshl.c: New file.
* sysdeps/libm-ieee754/s_csinh.c: New file. Implementation of
complex sinh function.
* sysdeps/libm-ieee754/s_csinhf.c: New file.
* sysdeps/libm-ieee754/s_csinhl.c: New file.
* math/carg.c: New file. Generic implementatio of carg function.
* math/cargf.c: New file.
* math/cargl.c: New file.
1997-03-29 16:07 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/posix/system.c: Update copyright.
1997-03-29 04:18 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-error.c (_dl_catch_error): Add another argument which is
passed to OPERATE.
(_dl_receive_error): Likewise.
* elf/link.h: Change prototypes for _dl_catch_error and
_dl_receive_error to reflect above change.
* elf/dl-deps.c: Don't use nested function. Call _dl_catch_error
with additional argument with pointer to data.
* elf/dlclose.c: Likewise.
* elf/dlerror.c: Likewise.
* elf/dlopen.c: Likewise.
* elf/dlsym.c: Likewise.
* elf/dlvsym.c: Likewise.
* elf/rtld.c: Likewise.
* nss/nsswitch.c: Likewise.
Patch by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>.
1997-03-28 21:14 Miguel de Icaza <miguel@nuclecu.unam.mx>
* elf/dl-error.c: Manually set up the values of "c", this avoids a
call to memcpy and a zero 152 bytes structure.
* sysdeps/sparc/dl-machine.h (elf_machine_rela): Test
RTLD_BOOTSTRAP to avoid performing relative relocs on a second
pass.
* sysdeps/sparc/udiv_qrnnd.S: Make the code PIC aware.
* sysdeps/unix/sysv/linux/sparc/Dist: Add kernel_stat.h and
kernel_sigaction.h
Add Linux/SPARC specific definitions.
* sysdeps/unix/sysv/linux/sparc/fcntlbits.h: New file.
* sysdeps/unix/sysv/linux/sparc/ioctls.h: New file.
* sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/sparc/kernel_stat.h: New file.
* sysdeps/unix/sysv/linux/sparc/sigaction.h: New file.
* sysdeps/unix/sysv/linux/sparc/signum.h: New file.
* sysdeps/unix/sysv/linux/sparc/termbits.h: New file.
1997-03-28 13:06 Philip Blundell <pjb27@cam.ac.uk>
* sysdeps/posix/getaddrinfo.c (gaih_inet_serv): Use
__getservbyname_r() not getservbyname().
(BROKEN_LIKE_POSIX): Define to 1 so we get strict POSIX behaviour.
Diffstat (limited to 'math')
-rw-r--r-- | math/Makefile | 2 | ||||
-rw-r--r-- | math/carg.c | 29 | ||||
-rw-r--r-- | math/cargf.c | 29 | ||||
-rw-r--r-- | math/cargl.c | 29 | ||||
-rw-r--r-- | math/complex.h | 8 | ||||
-rw-r--r-- | math/libm-test.c | 768 |
6 files changed, 857 insertions, 8 deletions
diff --git a/math/Makefile b/math/Makefile index 2578dbf..12967ff 100644 --- a/math/Makefile +++ b/math/Makefile @@ -49,7 +49,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \ 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 s_cexp + conj cimag creal cabs carg s_cexp s_csinh s_ccosh libm-routines = $(libm-support) $(libm-calls) \ $(patsubst %_rf,%f_r,$(libm-calls:=f)) \ $(long-m-$(long-double-fcts)) diff --git a/math/carg.c b/math/carg.c new file mode 100644 index 0000000..fb4dc8e5 --- /dev/null +++ b/math/carg.c @@ -0,0 +1,29 @@ +/* Compute argument of complex double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + 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. */ + +#include <complex.h> +#include <math.h> + +double +__carg (__complex__ double x) +{ + return __atan2 (__imag__ x, __real__ x); +} +weak_alias (__carg, carg) diff --git a/math/cargf.c b/math/cargf.c new file mode 100644 index 0000000..4b3c9f6 --- /dev/null +++ b/math/cargf.c @@ -0,0 +1,29 @@ +/* Compute argument of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + 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. */ + +#include <complex.h> +#include <math.h> + +float +__cargf (__complex__ float x) +{ + return __atan2f (__imag__ x, __real__ x); +} +weak_alias (__cargf, cargf) diff --git a/math/cargl.c b/math/cargl.c new file mode 100644 index 0000000..4482da9 --- /dev/null +++ b/math/cargl.c @@ -0,0 +1,29 @@ +/* Compute argument of complex long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + 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. */ + +#include <complex.h> +#include <math.h> + +long double +__cargl (__complex__ long double x) +{ + return __atan2l (__imag__ x, __real__ x); +} +weak_alias (__cargl, cargl) diff --git a/math/complex.h b/math/complex.h index 6fc5c19..4214353 100644 --- a/math/complex.h +++ b/math/complex.h @@ -21,7 +21,11 @@ */ #ifndef _COMPLEX_H + #define _COMPLEX_H 1 +#include <features.h> + +__BEGIN_DECLS /* We might need to add support for more compilers here. But once ISO C 9X is out hopefully all maintained compilers will provide the data @@ -41,7 +45,7 @@ #define I _Imaginary_I -/* Optimization aids. This is not yet implemented in gcc and yonce it +/* Optimization aids. This is not yet implemented in gcc and once it is this will probably be available in a gcc header. */ #define CX_LIMITED_RANGE_ON #define CX_LIMITED_RANGE_OFF @@ -99,4 +103,6 @@ #undef __MATHDECL #undef __MATHCALL +__END_DECLS + #endif /* complex.h */ diff --git a/math/libm-test.c b/math/libm-test.c index a575cc6..85e4a4b 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -1550,7 +1550,7 @@ cexp_test (void) check ("imag(cexp(+inf + 0i)) = 0", __imag__ result, 0); result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_zero)); check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result); - check ("imag(cexp(+inf - 0i)) = 0", __imag__ result, 0); + check ("imag(cexp(+inf - 0i)) = -0", __imag__ result, minus_zero); result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, plus_zero)); check ("real(cexp(-inf + 0i)) = 0", __real__ result, 0); @@ -1574,11 +1574,11 @@ cexp_test (void) check ("imag(cexp(-inf + 4.0i)) = -0", __imag__ result, minus_zero); result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 2.0)); - check_isinfn ("real(cexp(+inf + 2.0i)) = -0", __real__ result); - check_isinfp ("imag(cexp(+inf + 2.0i)) = 0", __imag__ result); + check_isinfn ("real(cexp(+inf + 2.0i)) = -inf", __real__ result); + check_isinfp ("imag(cexp(+inf + 2.0i)) = +inf", __imag__ result); result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, 4.0)); - check_isinfn ("real(cexp(+inf + 4.0i)) = -0", __real__ result); - check_isinfn ("imag(cexp(+inf + 4.0i)) = -0", __imag__ result); + check_isinfn ("real(cexp(+inf + 4.0i)) = -inf", __real__ result); + check_isinfn ("imag(cexp(+inf + 4.0i)) = -inf", __imag__ result); result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty)); check_isinfp ("real(cexp(+inf + i inf)) = +inf", __real__ result); @@ -1592,7 +1592,7 @@ cexp_test (void) check ("imag(cexp(-inf + i inf)) = 0", __imag__ result, 0); result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, minus_infty)); check ("real(cexp(-inf - i inf)) = 0", __real__ result, 0); - check ("imag(cexp(-inf - i inf)) = 0", __imag__ result, 0); + check ("imag(cexp(-inf - i inf)) = -0", __imag__ result, minus_zero); result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, nan_value)); check ("real(cexp(-inf + i NaN)) = 0", __real__ result, 0); @@ -1622,6 +1622,760 @@ cexp_test (void) static void +csinh_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(csinh) (BUILD_COMPLEX (0.0, 0.0)); + check ("real(csinh(0 + 0i)) = 0", __real__ result, 0); + check ("imag(csinh(0 + 0i)) = 0", __imag__ result, 0); + result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, 0.0)); + check ("real(csinh(-0 + 0i)) = -0", __real__ result, minus_zero); + check ("imag(csinh(-0 + 0i)) = 0", __imag__ result, 0); + result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_zero)); + check ("real(csinh(0 - 0i)) = 0", __real__ result, 0); + check ("imag(csinh(0 - 0i)) = -0", __imag__ result, minus_zero); + result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(csinh(-0 - 0i)) = -0", __real__ result, minus_zero); + 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_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_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_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_isnan ("imag(csinh(-0 - i Inf)) = NaN", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0)); + check_isinfp ("real(csinh(+Inf + 0i)) = +Inf", __real__ result); + check ("imag(csinh(+Inf + 0i)) = 0", __imag__ result, 0); + result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 0.0)); + check_isinfn ("real(csinh(-Inf + 0i)) = -Inf", __real__ result); + check ("imag(csinh(-Inf + 0i)) = 0", __imag__ result, 0); + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_zero)); + check_isinfp ("real(csinh(+Inf - 0i)) = +Inf", __real__ result); + check ("imag(csinh(+Inf - 0i)) = -0", __imag__ result, minus_zero); + result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_zero)); + check_isinfn ("real(csinh(-Inf - 0i)) = -Inf", __real__ result); + check ("imag(csinh(-Inf - 0i)) = -0", __imag__ result, minus_zero); + + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty)); + check_isinfp ("real(csinh(+Inf + i Inf)) = +-Inf", + FUNC(fabs) (__real__ result)); + check_isnan ("imag(csinh(+Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty)); + check_isinfp ("real(csinh(-Inf + i Inf)) = +-Inf", + FUNC(fabs) (__real__ result)); + check_isnan ("imag(csinh(-Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty)); + check_isinfp ("real(csinh(Inf - i Inf)) = +-Inf", + 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", + FUNC(fabs) (__real__ result)); + check_isnan ("imag(csinh(-Inf - i Inf)) = NaN", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 4.625)); + check_isinfn ("real(csinh(+Inf + i4.625)) = -Inf", __real__ result); + check_isinfn ("imag(csinh(+Inf + i4.625)) = -Inf", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, 4.625)); + check_isinfp ("real(csinh(-Inf + i4.625)) = +Inf", __real__ result); + check_isinfn ("imag(csinh(-Inf + i4.625)) = -Inf", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, -4.625)); + check_isinfn ("real(csinh(+Inf - i4.625)) = -Inf", __real__ result); + check_isinfp ("imag(csinh(+Inf - i4.625)) = +Inf", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, -4.625)); + check_isinfp ("real(csinh(-Inf - i4.625)) = +Inf", __real__ result); + check_isinfp ("imag(csinh(-Inf - i4.625)) = +Inf", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty)); + check_isnan ("real(csinh(6.75 + i Inf)) = NaN", __real__ result); + check_isnan ("imag(csinh(6.75 + i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty)); + check_isnan ("real(csinh(-6.75 + i Inf)) = NaN", __real__ result); + check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty)); + check_isnan ("real(csinh(6.75 - i Inf)) = NaN", __real__ result); + check_isnan ("imag(csinh(6.75 - i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty)); + check_isnan ("real(csinh(-6.75 - i Inf)) = NaN", __real__ result); + 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_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_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isinfp ("real(csinh(+Inf + i NaN)) = +-Inf", + FUNC(fabs) (__real__ result)); + check_isnan ("imag(csinh(+Inf + i NaN)) = NaN", __imag__ result); + 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); + + result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value)); + check_isnan ("real(csinh(9.0 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(csinh(9.0 + 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); + check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN", __imag__ result); + + 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); + 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); + + result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0)); + check_isnan ("real(csinh(NaN + i10)) = NaN", __real__ result); + check_isnan ("imag(csinh(NaN + i10)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0)); + check_isnan ("real(csinh(NaN - i10)) = NaN", __real__ result); + check_isnan ("imag(csinh(NaN - i10)) = NaN", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isnan ("real(csinh(NaN + i Inf)) = NaN", __real__ result); + check_isnan ("imag(csinh(NaN + i Inf)) = NaN", __imag__ result); + result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isnan ("real(csinh(NaN - i Inf)) = NaN", __real__ result); + check_isnan ("imag(csinh(NaN - i Inf)) = NaN", __imag__ result); + + result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(csinh(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 ("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 ("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 ("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 ("imag(ccosh(-0 - 0i)) = -0", __imag__ result, minus_zero); + + result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty)); + check_isnan ("real(ccosh(0 + i Inf)) = NaN", __real__ result); + 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); + 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); + 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); + + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0)); + check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result); + check ("imag(ccosh(+Inf + 0i)) = 0", __imag__ result, 0); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 0.0)); + check_isinfp ("real(ccosh(-Inf + 0i)) = +Inf", __real__ result); + check ("imag(ccosh(-Inf + 0i)) = 0", __imag__ result, 0); + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_zero)); + check_isinfp ("real(ccosh(+Inf - 0i)) = +Inf", __real__ result); + check ("imag(ccosh(+Inf - 0i)) = -0", __imag__ result, minus_zero); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_zero)); + check_isinfp ("real(ccosh(-Inf - 0i)) = +Inf", __real__ result); + check ("imag(ccosh(-Inf - 0i)) = -0", __imag__ result, minus_zero); + + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty)); + check_isinfp ("real(ccosh(+Inf + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty)); + check_isinfp ("real(ccosh(-Inf + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty)); + check_isinfp ("real(ccosh(Inf - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccosh(Inf - i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty)); + check_isinfp ("real(ccosh(-Inf - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN", __imag__ result); + + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 4.625)); + check_isinfn ("real(ccosh(+Inf + i4.625)) = -Inf", __real__ result); + check_isinfn ("imag(ccosh(+Inf + i4.625)) = -Inf", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, 4.625)); + check_isinfn ("real(ccosh(-Inf + i4.625)) = -Inf", __real__ result); + check_isinfn ("imag(ccosh(-Inf + i4.625)) = -Inf", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, -4.625)); + check_isinfn ("real(ccosh(+Inf - i4.625)) = -Inf", __real__ result); + check_isinfp ("imag(ccosh(+Inf - i4.625)) = +Inf", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, -4.625)); + check_isinfn ("real(ccosh(-Inf - i4.625)) = -Inf", __real__ result); + check_isinfp ("imag(ccosh(-Inf - i4.625)) = +Inf", __imag__ result); + + result = FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty)); + check_isnan ("real(ccosh(6.75 + i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty)); + check_isnan ("real(ccosh(-6.75 + i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty)); + check_isnan ("real(ccosh(6.75 - i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty)); + check_isnan ("real(ccosh(-6.75 - i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN", __imag__ result); + + result = FUNC(ccosh) (BUILD_COMPLEX (0.0, nan_value)); + check_isnan ("real(ccosh(0 + i NaN)) = NaN", __real__ result); + check ("imag(ccosh(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0); + result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, nan_value)); + check_isnan ("real(ccosh(-0 + i NaN)) = NaN", __real__ result); + check ("imag(ccosh(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0); + + result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isinfp ("real(ccosh(+Inf + i NaN)) = +Inf", __real__ result); + 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); + + result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value)); + check_isnan ("real(ccosh(9.0 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccosh(9.0 + 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); + check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN", __imag__ result); + + 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); + 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); + + result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0)); + check_isnan ("real(ccosh(NaN + i10)) = NaN", __real__ result); + check_isnan ("imag(ccosh(NaN + i10)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0)); + check_isnan ("real(ccosh(NaN - i10)) = NaN", __real__ result); + check_isnan ("imag(ccosh(NaN - i10)) = NaN", __imag__ result); + + result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isnan ("real(ccosh(NaN + i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(NaN + i Inf)) = NaN", __imag__ result); + result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isnan ("real(ccosh(NaN - i Inf)) = NaN", __real__ result); + check_isnan ("imag(ccosh(NaN - i Inf)) = NaN", __imag__ result); + + result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result); +} + + +#if 0 +/* Enable these tests as soon as the functions are available. */ +static void +cacos_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(cacos) (BUILD_COMPLEX (0, 0)); + check ("real(cacos(0 + i0)) = pi/2", __real__ result, M_PI_2); + check ("imag(cacos(0 + i0)) = -0", __imag__ result, minus_zero); + result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(cacos(-0 + i0)) = pi/2", __real__ result, M_PI_2); + check ("imag(cacos(-0 + i0)) = -0", __imag__ result, minus_zero); + result = FUNC(cacos) (BUILD_COMPLEX (0, minus_zero)); + check ("real(cacos(0 - i0)) = pi/2", __real__ result, M_PI_2); + check ("imag(cacos(0 - i0)) = 0", __imag__ result, 0); + result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(cacos(-0 - i0)) = pi/2", __real__ result, M_PI_2); + check ("imag(cacos(-0 - i0)) = 0", __imag__ result, 0); + + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, plus_infty)); + check ("real(cacos(-Inf + i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4); + check_isinfn ("imag(cacos(-Inf + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_infty)); + check ("real(cacos(-Inf - i Inf)) = 3*pi/4", __real__ result, M_PI - M_PI_4); + check_isinfp ("imag(cacos(-Inf - i Inf)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, plus_infty)); + check ("real(cacos(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4); + check_isinfn ("imag(cacos(+Inf + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_infty)); + check ("real(cacos(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4); + check_isinfp ("imag(cacos(+Inf - i Inf)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (-10.0, plus_infty)); + check ("real(cacos(-10.0 + i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfn ("imag(cacos(-10.0 + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (-10.0, minus_infty)); + check ("real(cacos(-10.0 - i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfp ("imag(cacos(-10.0 - i Inf)) = +Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (0, plus_infty)); + check ("real(cacos(0 + i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfn ("imag(cacos(0 + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (0, minus_infty)); + check ("real(cacos(0 - i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfp ("imag(cacos(0 - i Inf)) = +Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (0.1, plus_infty)); + check ("real(cacos(0.1 + i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfn ("imag(cacos(0.1 + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (0.1, minus_infty)); + check ("real(cacos(0.1 - i Inf)) = pi/2", __real__ result, M_PI_2); + check_isinfp ("imag(cacos(0.1 - i Inf)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 0)); + check ("real(cacos(-Inf + i0)) = pi", __real__ result, M_PI); + check_isinfn ("imag(cacos(-Inf + i0)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, minus_zero)); + check ("real(cacos(-Inf - i0)) = pi", __real__ result, M_PI); + check_isinfp ("imag(cacos(-Inf - i0)) = +Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, 100)); + check ("real(cacos(-Inf + i100)) = pi", __real__ result, M_PI); + check_isinfn ("imag(cacos(-Inf + i100)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, -100)); + check ("real(cacos(-Inf - i100)) = pi", __real__ result, M_PI); + check_isinfp ("imag(cacos(-Inf - i100)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0)); + check ("real(cacos(+Inf + i0)) = 0", __real__ result, 0); + check_isinfn ("imag(cacos(+Inf + i0)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, minus_zero)); + check ("real(cacos(+Inf - i0)) = 0", __real__ result, 0); + check_isinfp ("imag(cacos(+Inf - i0)) = +Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, 0.5)); + check ("real(cacos(+Inf + i0.5)) = 0", __real__ result, 0); + check_isinfn ("imag(cacos(+Inf + i0.5)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, -0.5)); + check ("real(cacos(+Inf - i0.5)) = 0", __real__ result, 0); + check_isinfp ("imag(cacos(+Inf - i0.5)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isnan ("real(cacos(+Inf + i NaN)) = NaN", __real__ result); + check_isinfp ("imag(cacos(+Inf + i NaN)) = +-Inf", + FUNC(fabs) (__imag__ result)); + result = FUNC(cacos) (BUILD_COMPLEX (minus_infty, nan_value)); + check_isnan ("real(cacos(-Inf + i NaN)) = NaN", __real__ result); + check_isinfp ("imag(cacos(-Inf + i NaN)) = +-Inf", + FUNC(fabs) (__imag__ result)); + + result = FUNC(cacos) (BUILD_COMPLEX (0, nan_value)); + check ("real(cacos(0 + i NaN)) = pi/2", __real__ result, M_PI_2); + check_isnan ("imag(cacos(0 + i NaN)) = NaN", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (minus_zero, nan_value)); + check ("real(cacos(-0 + i NaN)) = pi/2", __real__ result, M_PI_2); + check_isnan ("imag(cacos(-0 + i NaN)) = NaN", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isnan ("real(cacos(NaN + i Inf)) = NaN", __real__ result); + check_isinfn ("imag(cacos(NaN + i Inf)) = -Inf", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isnan ("real(cacos(NaN - i Inf)) = NaN", __real__ result); + check_isinfp ("imag(cacos(NaN - i Inf)) = +Inf", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (10.5, nan_value)); + check_isnan ("real(cacos(10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacos(10.5 + i NaN)) = NaN", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(cacos(-10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (nan_value, 0.75)); + check_isnan ("real(cacos(NaN + i0.75)) = NaN", __real__ result); + check_isnan ("imag(cacos(NaN + i0.75)) = NaN", __imag__ result); + result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(cacos(NaN - i0.75)) = NaN", __real__ result); + check_isnan ("imag(cacos(NaN - i0.75)) = NaN", __imag__ result); + + result = FUNC(cacos) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result); +} + + +static void +cacosh_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(cacosh) (BUILD_COMPLEX (0, 0)); + check ("real(cacosh(0 + i0)) = 0", __real__ result, 0); + check ("imag(cacosh(0 + i0)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(cacosh(-0 + i0)) = 0", __real__ result, 0); + check ("imag(cacosh(-0 + i0)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_zero)); + check ("real(cacosh(0 - i0)) = 0", __real__ result, 0); + check ("imag(cacosh(0 - i0)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(cacosh(-0 - i0)) = 0", __real__ result, 0); + check ("imag(cacosh(-0 - i0)) = -pi/2", __imag__ result, -M_PI_2); + + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, plus_infty)); + check_isinfp ("real(cacosh(-Inf + i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf + i Inf)) = 3*pi/4", __imag__ result, + M_PI - M_PI_4); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_infty)); + check_isinfp ("real(cacosh(-Inf - i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf - i Inf)) = -3*pi/4", __imag__ result, + M_PI_4 - M_PI); + + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, plus_infty)); + check_isinfp ("real(cacosh(+Inf + i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4); + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_infty)); + check_isinfp ("real(cacosh(+Inf - i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4); + + result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, plus_infty)); + check_isinfp ("real(cacosh(-10.0 + i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (-10.0, minus_infty)); + check_isinfp ("real(cacosh(-10.0 - i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (0, plus_infty)); + check_isinfp ("real(cacosh(0 + i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (0, minus_infty)); + check_isinfp ("real(cacosh(0 - i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (0.1, plus_infty)); + check_isinfp ("real(cacosh(0.1 + i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(cacosh) (BUILD_COMPLEX (0.1, minus_infty)); + check_isinfp ("real(cacosh(0.1 - i Inf)) = +Inf", __real__ result); + check ("imag(cacosh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 0)); + check_isinfp ("real(cacosh(-Inf + i0)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf + i0)) = pi", __imag__ result, M_PI); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, minus_zero)); + check_isinfp ("real(cacosh(-Inf - i0)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf - i0)) = -pi", __imag__ result, -M_PI); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, 100)); + check_isinfp ("real(cacosh(-Inf + i100)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf + i100)) = pi", __imag__ result, M_PI); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, -100)); + check_isinfp ("real(cacosh(-Inf - i100)) = +Inf", __real__ result); + check ("imag(cacosh(-Inf - i100)) = -pi", __imag__ result, -M_PI); + + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0)); + check_isinfp ("real(cacosh(+Inf + i0)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf + i0)) = 0", __imag__ result, 0); + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, minus_zero)); + check_isinfp ("real(cacosh(+Inf - i0)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, 0.5)); + check_isinfp ("real(cacosh(+Inf + i0.5)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf + i0.5)) = 0", __imag__ result, 0); + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, -0.5)); + check_isinfp ("real(cacosh(+Inf - i0.5)) = +Inf", __real__ result); + check ("imag(cacosh(+Inf - i0.5)) = -0", __imag__ result, minus_zero); + + result = FUNC(cacosh) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isinfp ("real(cacosh(+Inf + i NaN)) = +Inf", __real__ result); + check_isnan ("imag(cacosh(+Inf + i NaN)) = NaN", __imag__ result); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_infty, nan_value)); + check_isinfp ("real(cacosh(-Inf + i NaN)) = +Inf", __real__ result); + check_isnan ("imag(cacosh(-Inf + i NaN)) = NaN", __imag__ result); + + result = FUNC(cacosh) (BUILD_COMPLEX (0, nan_value)); + check_isnan ("real(cacosh(0 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacosh(0 + i NaN)) = NaN", __imag__ result); + result = FUNC(cacosh) (BUILD_COMPLEX (minus_zero, nan_value)); + check_isnan ("real(cacosh(-0 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacosh(-0 + i NaN)) = NaN", __imag__ result); + + result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isinfp ("real(cacosh(NaN + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(cacosh(NaN + i Inf)) = NaN", __imag__ result); + result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isinfp ("real(cacosh(NaN - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(cacosh(NaN - i Inf)) = NaN", __imag__ result); + + result = FUNC(cacosh) (BUILD_COMPLEX (10.5, nan_value)); + check_isnan ("real(cacosh(10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN", __imag__ result); + result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(cacosh(-10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN", __imag__ result); + + result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, 0.75)); + check_isnan ("real(cacosh(NaN + i0.75)) = NaN", __real__ result); + check_isnan ("imag(cacosh(NaN + i0.75)) = NaN", __imag__ result); + result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(cacosh(NaN - i0.75)) = NaN", __real__ result); + check_isnan ("imag(cacosh(NaN - i0.75)) = NaN", __imag__ result); + + result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result); +} + + +static void +casinh_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(casinh) (BUILD_COMPLEX (0, 0)); + check ("real(casinh(0 + i0)) = 0", __real__ result, 0); + check ("imag(casinh(0 + i0)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(casinh(-0 + i0)) = -0", __real__ result, minus_zero); + check ("imag(casinh(-0 + i0)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (0, minus_zero)); + check ("real(casinh(0 - i0)) = 0", __real__ result, 0); + check ("imag(casinh(0 - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(casinh(-0 - i0)) = -0", __real__ result, minus_zero); + check ("imag(casinh(-0 - i0)) = -0", __imag__ result, minus_zero); + + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, plus_infty)); + check_isinfp ("real(casinh(+Inf + i Inf)) = +Inf", __real__ result); + check ("imag(casinh(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4); + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_infty)); + check_isinfp ("real(casinh(+Inf - i Inf)) = +Inf", __real__ result); + check ("imag(casinh(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, plus_infty)); + check_isinfn ("real(casinh(-Inf + i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-Inf + i Inf)) = pi/4", __imag__ result, M_PI_4); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_infty)); + check_isinfn ("real(casinh(-Inf - i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4); + + result = FUNC(casinh) (BUILD_COMPLEX (-10.0, plus_infty)); + check_isinfn ("real(casinh(-10.0 + i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(casinh) (BUILD_COMPLEX (-10.0, minus_infty)); + check_isinfn ("real(casinh(-10.0 - i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(casinh) (BUILD_COMPLEX (0, plus_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 (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 (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); + result = FUNC(casinh) (BUILD_COMPLEX (0.1, minus_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); + + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 0)); + check_isinfn ("real(casinh(-Inf + i0)) = -Inf", __real__ result); + check ("imag(casinh(-Inf + i0)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, minus_zero)); + check_isinfn ("real(casinh(-Inf - i0)) = -Inf", __real__ result); + check ("imag(casinh(-Inf - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, 100)); + check_isinfn ("real(casinh(-Inf + i100)) = -Inf", __real__ result); + check ("imag(casinh(-Inf + i100)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, -100)); + check_isinfn ("real(casinh(-Inf - i100)) = -Inf", __real__ result); + check ("imag(casinh(-Inf - i100)) = -0", __imag__ result, minus_zero); + + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0)); + check_isinfp ("real(casinh(+Inf + i0)) = +Inf", __real__ result); + check ("imag(casinh(+Inf + i0)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, minus_zero)); + check_isinfp ("real(casinh(+Inf - i0)) = +Inf", __real__ result); + check ("imag(casinh(+Inf - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, 0.5)); + check_isinfp ("real(casinh(+Inf + i0.5)) = +Inf", __real__ result); + check ("imag(casinh(+Inf + i0.5)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, -0.5)); + check_isinfp ("real(casinh(+Inf - i0.5)) = +Inf", __real__ result); + check ("imag(casinh(+Inf - i0.5)) = -0", __imag__ result, minus_zero); + + result = FUNC(casinh) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isinfp ("real(casinh(+Inf + i NaN)) = +Inf", __real__ result); + check_isnan ("imag(casinh(+Inf + i NaN)) = NaN", __imag__ result); + result = FUNC(casinh) (BUILD_COMPLEX (minus_infty, nan_value)); + check_isinfn ("real(casinh(-Inf + i NaN)) = -Inf", __real__ result); + check_isnan ("imag(casinh(-Inf + i NaN)) = NaN", __imag__ result); + + 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_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", + 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", + FUNC(fabs) (__real__ result)); + check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result); + + result = FUNC(casinh) (BUILD_COMPLEX (10.5, nan_value)); + check_isnan ("real(casinh(10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casinh(10.5 + i NaN)) = NaN", __imag__ result); + result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(casinh(-10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN", __imag__ result); + + 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)); + 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 (nan_value, nan_value)); + check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result); +} + + +static void +catanh_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(catanh) (BUILD_COMPLEX (0, 0)); + check ("real(catanh(0 + i0)) = 0", __real__ result, 0); + check ("imag(catanh(0 + i0)) = 0", __imag__ result, 0); + result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(catanh(-0 + i0)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-0 + i0)) = 0", __imag__ result, 0); + result = FUNC(catanh) (BUILD_COMPLEX (0, minus_zero)); + check ("real(catanh(0 - i0)) = 0", __real__ result, 0); + check ("imag(catanh(0 - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(catanh(-0 - i0)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-0 - i0)) = -0", __imag__ result, minus_zero); + + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, plus_infty)); + check ("real(catanh(+Inf + i Inf)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_infty)); + check ("real(catanh(+Inf - i Inf)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, plus_infty)); + check ("real(catanh(-Inf + i Inf)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-Inf + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_infty)); + check ("real(catanh(-Inf - i Inf)) = -0", __real__ result, minus_zero); + 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 ("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 ("imag(catanh(-10.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); + result = FUNC(catanh) (BUILD_COMPLEX (0, minus_infty)); + check ("real(catanh(0 - i Inf)) = 0", __real__ result, 0); + check ("imag(catanh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (0.1, plus_infty)); + check ("real(catanh(0.1 + i Inf)) = 0", __real__ result, 0); + check ("imag(catanh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (0.1, minus_infty)); + check ("real(catanh(0.1 - i Inf)) = 0", __real__ result, 0); + check ("imag(catanh(0.1 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 0)); + check ("real(catanh(-Inf + i0)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-Inf + i0)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, minus_zero)); + check ("real(catanh(-Inf - i0)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-Inf - i0)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, 100)); + check ("real(catanh(-Inf + i100)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-Inf + i100)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, -100)); + check ("real(catanh(-Inf - i100)) = -0", __real__ result, minus_zero); + check ("imag(catanh(-Inf - i100)) = -pi/2", __imag__ result, -M_PI_2); + + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0)); + check ("real(catanh(+Inf + i0)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf + i0)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, minus_zero)); + check ("real(catanh(+Inf - i0)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf - i0)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, 0.5)); + check ("real(catanh(+Inf + i0.5)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf + i0.5)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, -0.5)); + check ("real(catanh(+Inf - i0.5)) = 0", __real__ result, 0); + check ("imag(catanh(+Inf - i0.5)) = -pi/2", __imag__ result, -M_PI_2); + + 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); + 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); + + result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value)); + check ("real(catanh(+Inf + i NaN)) = 0", __real__ result, 0); + check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result); + result = FUNC(catanh) (BUILD_COMPLEX (minus_infty, nan_value)); + check ("real(catanh(-Inf + i NaN)) = -0", __real__ result, minus_zero); + check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result); + + 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 ("real(catanh(NaN - i0)) = NaN", __real__ result); + check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result); + + result = FUNC(catanh) (BUILD_COMPLEX (nan_value, plus_infty)); + check ("real(catanh(NaN + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); + check ("imag(catanh(NaN + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_infty)); + check ("real(catanh(NaN - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); + check ("imag(catanh(NaN - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + + result = FUNC(catanh) (BUILD_COMPLEX (10.5, nan_value)); + check_isnan ("real(catanh(10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(catanh(10.5 + i NaN)) = NaN", __imag__ result); + result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value)); + check_isnan ("real(catanh(-10.5 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN", __imag__ result); + + 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)); + 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 (nan_value, nan_value)); + check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result); +} +#endif + + +static void inverse_func_pair_test (const char *test_name, mathfunc f1, mathfunc inverse, MATHTYPE x, MATHTYPE epsilon) @@ -1943,6 +2697,8 @@ main (int argc, char *argv[]) remquo_test (); #endif cexp_test (); + csinh_test (); + ccosh_test (); identities (); inverse_functions (); |