diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-08-03 14:16:59 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-08-03 14:16:59 +0000 |
commit | 7acac37449cdb6a7eb48240c6fb6a842fb7ca724 (patch) | |
tree | 321bfc3d7b7e3fe6f1d361f9374f0f122b7033f1 | |
parent | fdf2cea0dd9a239bcb2c4b66fd9fa862422ea2fc (diff) | |
download | mpc-7acac37449cdb6a7eb48240c6fb6a842fb7ca724.tar.gz |
NEWS doc/mpc.texi src/mpc.h src/Makefile.am: Add inverse hyperbolic functions.
src/acosh.c src/asinh.c src/atanh.c: Add inverse hyperbolic functions (calling inverse trigonometric functions).
tests/Makefile.am tests/tacosh.c tests/acosh.dat tests/tasinh.c tests/asinh.dat tests/tatanh.c tests/atanh.dat: Test inverse hyperbolic functions on special values.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/branches/feature-inverse-trigo@638 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/mpc.texi | 15 | ||||
-rw-r--r-- | src/Makefile.am | 18 | ||||
-rw-r--r-- | src/acosh.c | 60 | ||||
-rw-r--r-- | src/asinh.c | 46 | ||||
-rw-r--r-- | src/atanh.c | 46 | ||||
-rw-r--r-- | src/mpc.h | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 23 | ||||
-rw-r--r-- | tests/acosh.dat | 99 | ||||
-rw-r--r-- | tests/asinh.dat | 96 | ||||
-rw-r--r-- | tests/atanh.dat | 96 | ||||
-rw-r--r-- | tests/tacosh.c | 37 | ||||
-rw-r--r-- | tests/tasinh.c | 37 | ||||
-rw-r--r-- | tests/tatanh.c | 37 |
14 files changed, 595 insertions, 21 deletions
@@ -1,5 +1,6 @@ Recent Changes: - - New functions: mpc_pow, mpc_set_nan, mpc_acos, mpc_asin, mpc_atan + - New functions: mpc_pow, mpc_set_nan, mpc_acos, mpc_asin, mpc_atan, + mpc_acosh, mpc_asinh, mpc_atanh - Bug fixes: - log: along branch cut - norm: infinite loop in case of overflow diff --git a/doc/mpc.texi b/doc/mpc.texi index 4ae2ac0..cf24732 100644 --- a/doc/mpc.texi +++ b/doc/mpc.texi @@ -988,6 +988,21 @@ Set @var{rop} to the inverse tangent of @var{op}, rounded according to @var{rnd} with the precision of @var{rop}. @end deftypefun +@deftypefun int mpc_asinh (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse hyperbolic sine of @var{op}, +rounded according to @var{rnd} with the precision of @var{rop}. +@end deftypefun + +@deftypefun int mpc_acosh (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse hyperbolic cosine of @var{op}, +rounded according to @var{rnd} with the precision of @var{rop}. +@end deftypefun + +@deftypefun int mpc_atanh (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse hyperbolic tangent of @var{op}, +rounded according to @var{rnd} with the precision of @var{rop}. +@end deftypefun + @node Miscellaneous Complex Functions, Advanced Functions, Trigonometric Functions, Complex Functions @comment node-name, next, previous, up diff --git a/src/Makefile.am b/src/Makefile.am index 208695d..fb54f50 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,12 +3,12 @@ AM_CFLAGS=@WARNINGCFLAGS@ lib_LTLIBRARIES = libmpc.la libmpc_la_LDFLAGS = -version-info 1:0:0 -libmpc_la_SOURCES = mpc-impl.h abs.c acos.c add.c add_fr.c add_ui.c \ - arg.c asin.c atan.c clear.c cmp.c cmp_si_si.c conj.c cos.c cosh.c \ - div_2exp.c div.c div_fr.c div_ui.c exp.c fr_div.c fr_sub.c \ - get_prec2.c get_prec.c get_str.c get_version.c imag.c init2.c \ - init3.c inp_str.c log.c mem.c mul_2exp.c mul.c mul_fr.c mul_i.c \ - mul_si.c mul_ui.c neg.c norm.c out_str.c pow.c proj.c real.c \ - urandom.c set.c set_prec.c set_str.c set_x.c set_x_x.c sin.c sinh.c \ - sqr.c sqrt.c strtoc.c sub.c sub_fr.c sub_ui.c tan.c tanh.c \ - uceil_log2.c ui_div.c ui_ui_sub.c +libmpc_la_SOURCES = mpc-impl.h abs.c acos.c acosh.c add.c add_fr.c \ + add_ui.c arg.c asin.c asinh.c atan.c atanh.c clear.c cmp.c \ + cmp_si_si.c conj.c cos.c cosh.c div_2exp.c div.c div_fr.c div_ui.c \ + exp.c fr_div.c fr_sub.c get_prec2.c get_prec.c get_str.c \ + get_version.c imag.c init2.c init3.c inp_str.c log.c mem.c \ + mul_2exp.c mul.c mul_fr.c mul_i.c mul_si.c mul_ui.c neg.c norm.c \ + out_str.c pow.c proj.c real.c urandom.c set.c set_prec.c set_str.c \ + set_x.c set_x_x.c sin.c sinh.c sqr.c sqrt.c strtoc.c sub.c sub_fr.c \ + sub_ui.c tan.c tanh.c uceil_log2.c ui_div.c ui_ui_sub.c diff --git a/src/acosh.c b/src/acosh.c new file mode 100644 index 0000000..fdaf990 --- /dev/null +++ b/src/acosh.c @@ -0,0 +1,60 @@ +/* mpc_acosh -- inverse hyperbolic cosine of a complex number. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-impl.h" + +int +mpc_acosh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + /* acosh(z) = + i*acos(z), if sign(Im(z)) = + + -i*acos(z), if sign(Im(z)) = - + */ + mpfr_t tmp; + int inex; + + if (mpfr_signbit (MPC_IM (op))) + { + inex = mpc_cos (rop, op, + RNDC (MPC_RND_IM (rnd), INV_RND (MPC_RND_RE (rnd)))); + + /* change rop to -i*rop */ + tmp[0] = MPC_RE (rop)[0]; + MPC_RE (rop)[0] = MPC_IM (rop)[0]; + MPC_IM (rop)[0] = tmp[0]; + MPFR_CHANGE_SIGN (MPC_IM (rop)); + inex = MPC_INEX (-MPC_INEX_IM (inex), MPC_INEX_RE (inex)); + } + else + { + inex = mpc_cos (rop, op, + RNDC (INV_RND (MPC_RND_IM (rnd)), MPC_RND_RE (rnd))); + + /* change rop to i*rop */ + tmp[0] = MPC_RE (rop)[0]; + MPC_RE (rop)[0] = MPC_IM (rop)[0]; + MPC_IM (rop)[0] = tmp[0]; + MPFR_CHANGE_SIGN (MPC_RE (rop)); + inex = MPC_INEX (MPC_INEX_IM (inex), -MPC_INEX_RE (inex)); + } + + return inex; +} diff --git a/src/asinh.c b/src/asinh.c new file mode 100644 index 0000000..003d6c9 --- /dev/null +++ b/src/asinh.c @@ -0,0 +1,46 @@ +/* mpc_asinh -- inverse hyperbolic sine of a complex number. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-impl.h" + +int +mpc_asinh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + /* asinh(op) = -i*asin(i*op) */ + int inex; + mpc_t z; + mpfr_t tmp; + + MPC_RE (z)[0] = MPC_IM (op)[0]; + MPC_IM (z)[0] = MPC_RE (op)[0]; + MPFR_CHANGE_SIGN (MPC_RE (z)); + + inex = mpc_asin (rop, z, + RNDC (MPC_RND_IM (rnd), INV_RND (MPC_RND_RE (rnd)))); + + /* change rop to -i*rop */ + tmp[0] = MPC_RE (rop)[0]; + MPC_RE (rop)[0] = MPC_IM (rop)[0]; + MPC_IM (rop)[0] = tmp[0]; + MPFR_CHANGE_SIGN (MPC_IM (rop)); + + return MPC_INEX (-MPC_INEX_IM (inex), MPC_INEX_RE (inex)); +} diff --git a/src/atanh.c b/src/atanh.c new file mode 100644 index 0000000..057462a --- /dev/null +++ b/src/atanh.c @@ -0,0 +1,46 @@ +/* mpc_atanh -- inverse hyperbolic tangent of a complex number. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-impl.h" + +int +mpc_atanh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + /* atanh(op) = -i*atan(i*op) */ + int inex; + mpfr_t tmp; + mpc_t z; + + MPC_RE (z)[0] = MPC_IM (op)[0]; + MPC_IM (z)[0] = MPC_RE (op)[0]; + MPFR_CHANGE_SIGN (MPC_RE (z)); + + inex = mpc_atan (rop, z, + RNDC (MPC_RND_IM (rnd), INV_RND (MPC_RND_RE (rnd)))); + + /* change rop to -i*rop */ + tmp[0] = MPC_RE (rop)[0]; + MPC_RE (rop)[0] = MPC_IM (rop)[0]; + MPC_IM (rop)[0] = tmp[0]; + MPFR_CHANGE_SIGN (MPC_IM (rop)); + + return MPC_INEX (-MPC_INEX_IM (inex), MPC_INEX_RE (inex)); +} @@ -199,6 +199,9 @@ __MPC_DECLSPEC int mpc_tanh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC int mpc_asin __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC int mpc_acos __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC int mpc_atan __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC int mpc_asinh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC int mpc_acosh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC int mpc_atanh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC void mpc_clear __MPC_PROTO ((mpc_ptr)); __MPC_DECLSPEC int mpc_urandom __MPC_PROTO ((mpc_ptr, gmp_randstate_t)); __MPC_DECLSPEC void mpc_init2 __MPC_PROTO ((mpc_ptr, mp_prec_t)); diff --git a/tests/Makefile.am b/tests/Makefile.am index 1e6f511..6c8704a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,22 +4,23 @@ AM_CPPFLAGS = -I$(top_srcdir)/src LDADD = libmpc-tests.la $(top_builddir)/src/libmpc.la LOADLIBES=$(DEFS) -I$(top_srcdir)/src $(CPPFLAGS) $(CFLAGS) $(top_builddir)/src/.libs/libmpc.a $(LIBS) -check_PROGRAMS = tabs tacos tadd tadd_fr tadd_ui targ tasin tatan \ - tconj tcos tcosh tdiv tdiv_2exp tdiv_fr tdiv_ui texp tfr_div \ - tfr_sub tget_version timag tio_str tlog tmul tmul_2exp tmul_fr \ - tmul_i tmul_si tmul_ui tneg tnorm tpow tprec tproj treal treimref \ - tset tsin tsinh tsqr tsqrt tstrtoc tsub tsub_fr tsub_ui ttan ttanh \ - tui_div tui_ui_sub +check_PROGRAMS = tabs tacos tacosh tadd tadd_fr tadd_ui targ tasin \ + tasinh tatan tatanh tconj tcos tcosh tdiv tdiv_2exp tdiv_fr \ + tdiv_ui texp tfr_div tfr_sub tget_version timag tio_str tlog tmul \ + tmul_2exp tmul_fr tmul_i tmul_si tmul_ui tneg tnorm tpow tprec \ + tproj treal treimref tset tsin tsinh tsqr tsqrt tstrtoc tsub \ + tsub_fr tsub_ui ttan ttanh tui_div tui_ui_sub check_LTLIBRARIES=libmpc-tests.la libmpc_tests_la_SOURCES=mpc-tests.h random.c tgeneric.c read_data.c \ comparisons.c -EXTRA_DIST = abs.dat acos.dat add.dat add_fr.dat arg.dat asin.dat \ - atan.dat conj.dat cos.dat cosh.dat div.dat div_fr.dat exp.dat \ - fr_div.dat fr_sub.dat inp_str.dat log.dat mul.dat mul_fr.dat \ - neg.dat norm.dat pow.dat proj.dat sin.dat sinh.dat sqr.dat \ - sqrt.dat strtoc.dat sub.dat sub_fr.dat tan.dat tanh.dat +EXTRA_DIST = abs.dat acos.dat acosh.dat add.dat add_fr.dat arg.dat \ + asin.dat asinh.dat atan.dat atanh.dat conj.dat cos.dat cosh.dat \ + div.dat div_fr.dat exp.dat fr_div.dat fr_sub.dat inp_str.dat \ + log.dat mul.dat mul_fr.dat neg.dat norm.dat pow.dat proj.dat \ + sin.dat sinh.dat sqr.dat sqrt.dat strtoc.dat sub.dat sub_fr.dat \ + tan.dat tanh.dat TESTS = $(check_PROGRAMS) CLEANFILES = mpc_test diff --git a/tests/acosh.dat b/tests/acosh.dat new file mode 100644 index 0000000..1b65729 --- /dev/null +++ b/tests/acosh.dat @@ -0,0 +1,99 @@ +# Data file for mpc_acosh. +# +# Copyright (C) 2009 Philippe Th\'eveny +# +# This file is part of the MPC Library. +# +# The MPC Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at your +# option) any later version. +# +# The MPC 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 Lesser General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with the MPC 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. +# +# The line format respects the parameter order in function prototype as +# follow: +# +# INEX_RE INEX_IM PREC_ROP_RE ROP_RE PREC_ROP_IM ROP_IM PREC_OP_RE OP_RE PREC_OP_IM OP_IM RND_RE RND_IM +# +# where op = op_re + i * op_im, rop = rop_re + i * rop_im, +# rop_re is ROP_RE rounded to nearest to the precision of PREC_ROP_RE +# rop_im is ROP_IM rounded to nearest to the precision of PREC_ROP_IM +# op_re is OP_RE rounded to nearest to the precision of PREC_OP_RE +# op_im is OP_IM rounded to nearest to the precision of PREC_OP_IM +# ROP_RE is checked against Re(acos op) rounded to the precision PREC_ROP_RE +# in the direction RND_RE +# ROP_IM is checked against Im(acos op) rounded to the precision PREC_ROP_IM +# in the direction RND_IM +# INEX_RE is the ternary value for the real part with the following notation: +# "?" ternary value not checked +# "+" if ROP_RE is greater than the exact mathematical result +# "0" if ROP_RE is exactly the mathematical result +# "-" if ROP_RE is less than the exact mathematical result +# (m.m. INEX_IM) +# rounding modes notation: +# "N" is rounding to nearest +# "Z" is rounding towards zero +# "U" is rounding towards plus infinity +# "D" is rounding towards minus infinity +# Use prefixes "0b" for values in base two, "0x" for values in base sixteen, +# no prefix for value in base ten. +# In all bases, "nan" is NaN, "inf" is infinity; +# The sign of the result is checked with "+inf", "-inf", "-0", or "+0". + +# special values (following ISO C99 standard) +0 + 53 +inf 53 -0x12D97C7F3321D2p-51 53 -inf 53 -inf N N +0 + 53 +inf 53 -0x1921FB54442D18p-51 53 -inf 53 -1 N N +0 + 53 +inf 53 -0x1921FB54442D18p-51 53 -inf 53 -0 N N +0 - 53 +inf 53 0x1921FB54442D18p-51 53 -inf 53 +0 N N +0 - 53 +inf 53 0x1921FB54442D18p-51 53 -inf 53 +1 N N +0 - 53 +inf 53 0x12D97C7F3321D2p-51 53 -inf 53 +inf N N +0 0 53 +inf 53 nan 53 -inf 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 -6 53 -inf N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 -0.5 53 -inf N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 -0.5 53 +inf N N +0 0 53 nan 53 nan 53 -0.5 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 -0 53 -inf N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 -0 53 -0 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 -0 53 +0 N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 -0 53 +inf N N +0 0 53 nan 53 nan 53 -0 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 +0 53 -inf N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +0 53 -0 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 +0 53 +0 N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 +0 53 +inf N N +0 0 53 nan 53 nan 53 +0 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 +6 53 -inf N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-53 53 +inf 53 -inf N N +0 0 53 +inf 53 -0 53 +inf 53 -1 N N +0 0 53 +inf 53 -0 53 +inf 53 -0 N N +0 0 53 +inf 53 +0 53 +inf 53 +0 N N +0 0 53 +inf 53 +0 53 +inf 53 +1 N N +0 - 53 +inf 53 0x1921FB54442D18p-53 53 +inf 53 +inf N N +0 0 53 +inf 53 nan 53 +inf 53 nan N N +0 0 53 +inf 53 nan 53 nan 53 -inf N N +0 0 53 nan 53 nan 53 nan 53 -1 N N +0 0 53 nan 53 nan 53 nan 53 -0 N N +0 0 53 nan 53 nan 53 nan 53 +0 N N +0 0 53 nan 53 nan 53 nan 53 +1 N N +0 0 53 +inf 53 nan 53 nan 53 +inf N N +0 0 53 nan 53 nan 53 nan 53 nan N N + +# pure real argument + +# pure imaginary argument + +# IEEE-754 double precision + diff --git a/tests/asinh.dat b/tests/asinh.dat new file mode 100644 index 0000000..68efe35 --- /dev/null +++ b/tests/asinh.dat @@ -0,0 +1,96 @@ +# Data file for mpc_asinh. +# +# Copyright (C) 2009 Philippe Th\'eveny +# +# This file is part of the MPC Library. +# +# The MPC Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at your +# option) any later version. +# +# The MPC 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 Lesser General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with the MPC 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. +# +# The line format respects the parameter order in function prototype as +# follow: +# +# INEX_RE INEX_IM PREC_ROP_RE ROP_RE PREC_ROP_IM ROP_IM PREC_OP_RE OP_RE PREC_OP_IM OP_IM RND_RE RND_IM +# +# where op = op_re + i * op_im, rop = rop_re + i * rop_im, +# rop_re is ROP_RE rounded to nearest to the precision of PREC_ROP_RE +# rop_im is ROP_IM rounded to nearest to the precision of PREC_ROP_IM +# op_re is OP_RE rounded to nearest to the precision of PREC_OP_RE +# op_im is OP_IM rounded to nearest to the precision of PREC_OP_IM +# ROP_RE is checked against Re(asin op) rounded to the precision PREC_ROP_RE +# in the direction RND_RE +# ROP_IM is checked against Im(asin op) rounded to the precision PREC_ROP_IM +# in the direction RND_IM +# INEX_RE is the ternary value for the real part with the following notation: +# "?" ternary value not checked +# "+" if ROP_RE is greater than the exact mathematical result +# "0" if ROP_RE is exactly the mathematical result +# "-" if ROP_RE is less than the exact mathematical result +# (m.m. INEX_IM) +# rounding modes notation: +# "N" is rounding to nearest +# "Z" is rounding towards zero +# "U" is rounding towards plus infinity +# "D" is rounding towards minus infinity +# Use prefixes "0b" for values in base two, "0x" for values in base sixteen, +# no prefix for value in base ten. +# In all bases, "nan" is NaN, "inf" is infinity; +# The sign of the result is checked with "+inf", "-inf", "-0", or "+0". + +# special values (following ISO C99 standard) +0 + 53 -inf 53 -0x1921FB54442D18p-53 53 -inf 53 -inf N N +0 0 53 -inf 53 -0 53 -inf 53 -1 N N +0 0 53 -inf 53 -0 53 -inf 53 -0 N N +0 0 53 -inf 53 +0 53 -inf 53 +0 N N +0 0 53 -inf 53 +0 53 -inf 53 +1 N N +0 - 53 -inf 53 0x1921FB54442D18p-53 53 -inf 53 +inf N N +0 0 53 -inf 53 nan 53 -inf 53 nan N N +0 + 53 -inf 53 -0x1921FB54442D18p-52 53 -6 53 -inf N N +0 - 53 -inf 53 0x1921FB54442D18p-52 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N +0 + 53 -inf 53 -0x1921FB54442D18p-52 53 -0 53 -inf N N +0 0 53 -0 53 -0 53 -0 53 -0 N N +0 0 53 -0 53 +0 53 -0 53 +0 N N +0 - 53 -inf 53 0x1921FB54442D18p-52 53 -0 53 +inf N N +0 0 53 -0 53 nan 53 -0 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 +0 53 -inf N N +0 0 53 +0 53 -0 53 +0 53 -0 N N +0 0 53 +0 53 +0 53 +0 53 +0 N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 +0 53 +inf N N +0 0 53 nan 53 nan 53 +0 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-52 53 +6 53 -inf N N +0 - 53 +inf 53 0x1921FB54442D18p-52 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N +0 + 53 +inf 53 -0x1921FB54442D18p-53 53 +inf 53 -inf N N +0 0 53 +inf 53 -0 53 +inf 53 -1 N N +0 0 53 +inf 53 -0 53 +inf 53 -0 N N +0 0 53 +inf 53 +0 53 +inf 53 +0 N N +0 0 53 +inf 53 +0 53 +inf 53 +1 N N +0 - 53 +inf 53 0x1921FB54442D18p-53 53 +inf 53 +inf N N +0 0 53 +inf 53 nan 53 +inf 53 nan N N +0 0 53 inf 53 nan 53 nan 53 -inf N N +0 0 53 nan 53 nan 53 nan 53 -1 N N +0 0 53 nan 53 nan 53 nan 53 -0 N N +0 0 53 nan 53 nan 53 nan 53 +0 N N +0 0 53 nan 53 nan 53 nan 53 +1 N N +0 0 53 inf 53 nan 53 nan 53 +inf N N +0 0 53 nan 53 nan 53 nan 53 nan N N + +# pure real argument + +# pure imaginary argument + +# IEEE-754 double precision + diff --git a/tests/atanh.dat b/tests/atanh.dat new file mode 100644 index 0000000..ad075c2 --- /dev/null +++ b/tests/atanh.dat @@ -0,0 +1,96 @@ +# Data file for mpc_atanh. +# +# Copyright (C) 2009 Philippe Th\'eveny +# +# This file is part of the MPC Library. +# +# The MPC Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at your +# option) any later version. +# +# The MPC 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 Lesser General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with the MPC 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. +# +# The line format respects the parameter order in function prototype as +# follow: +# +# INEX_RE INEX_IM PREC_ROP_RE ROP_RE PREC_ROP_IM ROP_IM PREC_OP_RE OP_RE PREC_OP_IM OP_IM RND_RE RND_IM +# +# where op = op_re + i * op_im, rop = rop_re + i * rop_im, +# rop_re is ROP_RE rounded to nearest to the precision of PREC_ROP_RE +# rop_im is ROP_IM rounded to nearest to the precision of PREC_ROP_IM +# op_re is OP_RE rounded to nearest to the precision of PREC_OP_RE +# op_im is OP_IM rounded to nearest to the precision of PREC_OP_IM +# ROP_RE is checked against Re(atan op) rounded to the precision PREC_ROP_RE +# in the direction RND_RE +# ROP_IM is checked against Im(atan op) rounded to the precision PREC_ROP_IM +# in the direction RND_IM +# INEX_RE is the ternary value for the real part with the following notation: +# "?" ternary value not checked +# "+" if ROP_RE is greater than the exact mathematical result +# "0" if ROP_RE is exactly the mathematical result +# "-" if ROP_RE is less than the exact mathematical result +# (m.m. INEX_IM) +# rounding modes notation: +# "N" is rounding to nearest +# "Z" is rounding towards zero +# "U" is rounding towards plus infinity +# "D" is rounding towards minus infinity +# Use prefixes "0b" for values in base two, "0x" for values in base sixteen, +# no prefix for value in base ten. +# In all bases, "nan" is NaN, "inf" is infinity; +# The sign of the result is checked with "+inf", "-inf", "-0", or "+0". + +# special values (following ISO C99 standard) +0 + 53 -0 53 -0x1921FB54442D18p-52 53 -inf 53 -inf N N +0 + 53 -0 53 -0x1921FB54442D18p-52 53 -inf 53 -1 N N +0 + 53 -0 53 -0x1921FB54442D18p-52 53 -inf 53 -0 N N +0 - 53 -0 53 +0x1921FB54442D18p-52 53 -inf 53 +0 N N +0 - 53 -0 53 +0x1921FB54442D18p-52 53 -inf 53 +1 N N +0 - 53 -0 53 +0x1921FB54442D18p-52 53 -inf 53 +inf N N +0 0 53 -0 53 nan 53 -inf 53 nan N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 -6 53 -inf N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N +0 + 53 -0 53 -0x1921FB54442D18p-52 53 -0 53 -inf N N +0 0 53 -0 53 -0 53 -0 53 -0 N N +0 0 53 -0 53 +0 53 -0 53 +0 N N +0 - 53 -0 53 0x1921FB54442D18p-52 53 -0 53 +inf N N +0 0 53 -0 53 nan 53 -0 53 nan N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +0 53 -inf N N +0 0 53 +0 53 -0 53 +0 53 -0 N N +0 0 53 +0 53 +0 53 +0 53 +0 N N +0 - 53 +0 53 +0x1921FB54442D18p-52 53 +0 53 +inf N N +0 0 53 +0 53 nan 53 +0 53 nan N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +6 53 -inf N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +inf 53 -1 N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 +inf 53 -0 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 +inf 53 +0 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 +inf 53 +1 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 +inf 53 +inf N N +0 0 53 +0 53 nan 53 +inf 53 nan N N +0 + 53 +0 53 -0x1921FB54442D18p-52 53 nan 53 -inf N N +0 0 53 nan 53 nan 53 nan 53 -1 N N +0 0 53 nan 53 nan 53 nan 53 -0 N N +0 0 53 nan 53 nan 53 nan 53 +0 N N +0 0 53 nan 53 nan 53 nan 53 +1 N N +0 - 53 +0 53 0x1921FB54442D18p-52 53 nan 53 +inf N N +0 0 53 nan 53 nan 53 nan 53 nan N N + +# pure real argument + +# pure imaginary argument + +# IEEE-754 double precision + diff --git a/tests/tacosh.c b/tests/tacosh.c new file mode 100644 index 0000000..022610d --- /dev/null +++ b/tests/tacosh.c @@ -0,0 +1,37 @@ +/* test file for mpc_acosh. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-tests.h" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_acosh); + + test_start (); + + data_check (f, "acosh.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} diff --git a/tests/tasinh.c b/tests/tasinh.c new file mode 100644 index 0000000..9b13220 --- /dev/null +++ b/tests/tasinh.c @@ -0,0 +1,37 @@ +/* test file for mpc_asinh. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-tests.h" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_asinh); + + test_start (); + + data_check (f, "asinh.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} diff --git a/tests/tatanh.c b/tests/tatanh.c new file mode 100644 index 0000000..7599db3 --- /dev/null +++ b/tests/tatanh.c @@ -0,0 +1,37 @@ +/* test file for mpc_atanh. + +Copyright (C) 2009 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The MPC 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the MPC 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 "mpc-tests.h" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_atanh); + + test_start (); + + data_check (f, "atanh.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} |