diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-08-03 11:13:51 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-08-03 11:13:51 +0000 |
commit | fdf2cea0dd9a239bcb2c4b66fd9fa862422ea2fc (patch) | |
tree | ebf0af527c2aeb1081f58519c30d08fe6bb16649 | |
parent | 1014a63bb24d18118b55cbc8437dd3fd10352bd1 (diff) | |
download | mpc-fdf2cea0dd9a239bcb2c4b66fd9fa862422ea2fc.tar.gz |
tests/Makefile.am doc/mpc.texi NEWS src/mpc.h src/Makefile.am: Add inverse trigonometric functions.
src/acos.c src/asin.c src/atan.c: Skeletons for inverse trigonometric functions.
tests/Makefile.am tests/tacos.c tests/acos.dat tests/tasin.c tests/asin.dat tests/tatan.c tests/atan.dat: Add tests for special values.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/branches/feature-inverse-trigo@635 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/mpc.texi | 15 | ||||
-rw-r--r-- | src/Makefile.am | 17 | ||||
-rw-r--r-- | src/acos.c | 30 | ||||
-rw-r--r-- | src/asin.c | 30 | ||||
-rw-r--r-- | src/atan.c | 30 | ||||
-rw-r--r-- | src/mpc.h | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 24 | ||||
-rw-r--r-- | tests/acos.dat | 103 | ||||
-rw-r--r-- | tests/asin.dat | 102 | ||||
-rw-r--r-- | tests/atan.dat | 96 | ||||
-rw-r--r-- | tests/tacos.c | 37 | ||||
-rw-r--r-- | tests/tasin.c | 37 | ||||
-rw-r--r-- | tests/tatan.c | 37 |
14 files changed, 543 insertions, 20 deletions
@@ -1,5 +1,5 @@ Recent Changes: - - New functions: mpc_pow, mpc_set_nan + - New functions: mpc_pow, mpc_set_nan, mpc_acos, mpc_asin, mpc_atan - Bug fixes: - log: along branch cut - norm: infinite loop in case of overflow diff --git a/doc/mpc.texi b/doc/mpc.texi index faea4af..4ae2ac0 100644 --- a/doc/mpc.texi +++ b/doc/mpc.texi @@ -973,6 +973,21 @@ Set @var{rop} to the hyperbolic tangent of @var{op}, rounded according to @var{rnd} with the precision of @var{rop}. @end deftypefun +@deftypefun int mpc_asin (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse sine of @var{op}, +rounded according to @var{rnd} with the precision of @var{rop}. +@end deftypefun + +@deftypefun int mpc_acos (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse cosine of @var{op}, +rounded according to @var{rnd} with the precision of @var{rop}. +@end deftypefun + +@deftypefun int mpc_atan (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd}) +Set @var{rop} to the inverse 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 e36d26f..208695d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,11 +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 add.c add_fr.c add_ui.c arg.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 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 diff --git a/src/acos.c b/src/acos.c new file mode 100644 index 0000000..879fa45 --- /dev/null +++ b/src/acos.c @@ -0,0 +1,30 @@ +/* mpc_acos -- arccosine 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_acos (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + mpfr_set_nan (MPC_RE (rop)); + mpfr_set_nan (MPC_RE (rop)); + return 0; +} diff --git a/src/asin.c b/src/asin.c new file mode 100644 index 0000000..84fda2f --- /dev/null +++ b/src/asin.c @@ -0,0 +1,30 @@ +/* mpc_asin -- arcsine 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_asin (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + mpfr_set_nan (MPC_RE (rop)); + mpfr_set_nan (MPC_RE (rop)); + return 0; +} diff --git a/src/atan.c b/src/atan.c new file mode 100644 index 0000000..60d6c6c --- /dev/null +++ b/src/atan.c @@ -0,0 +1,30 @@ +/* mpc_atan -- arctangent 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_atan (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) +{ + mpfr_set_nan (MPC_RE (rop)); + mpfr_set_nan (MPC_RE (rop)); + return 0; +} @@ -196,6 +196,9 @@ __MPC_DECLSPEC int mpc_tan __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC int mpc_sinh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __MPC_DECLSPEC int mpc_cosh __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_rnd_t)); __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 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 d9e8394..1e6f511 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,20 +4,22 @@ 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 tadd tadd_fr tadd_ui targ 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 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_LTLIBRARIES=libmpc-tests.la -libmpc_tests_la_SOURCES=mpc-tests.h random.c tgeneric.c read_data.c \ -comparisons.c +libmpc_tests_la_SOURCES=mpc-tests.h random.c tgeneric.c read_data.c \ + comparisons.c -EXTRA_DIST = abs.dat add.dat add_fr.dat arg.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 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 TESTS = $(check_PROGRAMS) CLEANFILES = mpc_test diff --git a/tests/acos.dat b/tests/acos.dat new file mode 100644 index 0000000..b2f9300 --- /dev/null +++ b/tests/acos.dat @@ -0,0 +1,103 @@ +# Data file for mpc_acos. +# +# 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 0x12D97C7F3321D2p-51 53 +inf 53 -inf 53 -inf N N +- 0 53 0x1921FB54442D18p-51 53 +inf 53 -inf 53 -1 N N +- 0 53 0x1921FB54442D18p-51 53 +inf 53 -inf 53 -0 N N +- 0 53 0x1921FB54442D18p-51 53 -inf 53 -inf 53 +0 N N +- 0 53 0x1921FB54442D18p-51 53 -inf 53 -inf 53 +1 N N +- 0 53 0x12D97C7F3321D2p-51 53 -inf 53 -inf 53 +inf N N +0 0 53 nan 53 inf 53 -inf 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 -6 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 -0.5 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 -0.5 53 +inf N N +0 0 53 nan 53 nan 53 -0.5 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 -0 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 +0 53 -0 53 -0 N N +- 0 53 0x1921FB54442D18p-52 53 -0 53 -0 53 +0 N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 -0 53 +inf N N +- 0 53 0x1921FB54442D18p-52 53 nan 53 -0 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 +0 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 +0 53 +0 53 -0 N N +- 0 53 0x1921FB54442D18p-52 53 -0 53 +0 53 +0 N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 +0 53 +inf N N +- 0 53 0x1921FB54442D18p-52 53 nan 53 +0 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 +0.5 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 +0.5 53 +inf N N +0 0 53 nan 53 nan 53 +0.5 53 nan N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 +6 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N +- 0 53 0x1921FB54442D18p-53 53 +inf 53 +inf 53 -inf N N +0 0 53 +0 53 +inf 53 +inf 53 -1 N N +0 0 53 +0 53 -inf 53 +inf 53 -0 N N +0 0 53 +0 53 -inf 53 +inf 53 +0 N N +0 0 53 +0 53 -inf 53 +inf 53 +1 N N +- 0 53 0x1921FB54442D18p-53 53 -inf 53 +inf 53 +inf N N +0 0 53 nan 53 -inf 53 +inf 53 nan N N + +0 0 53 nan 53 +inf 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 nan 53 -inf 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/asin.dat b/tests/asin.dat new file mode 100644 index 0000000..0eba451 --- /dev/null +++ b/tests/asin.dat @@ -0,0 +1,102 @@ +# Data file for mpc_asin. +# +# 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 -0x1921FB54442D18p-53 53 -inf 53 -inf 53 -inf N N ++ 0 53 -0x1921FB54442D18p-52 53 -inf 53 -inf 53 -1 N N ++ 0 53 -0x1921FB54442D18p-52 53 -inf 53 -inf 53 -0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf 53 +0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf 53 +1 N N ++ 0 53 -0x1921FB54442D18p-53 53 +inf 53 -inf 53 +inf N N +0 0 53 nan 53 inf 53 -inf 53 nan N N +0 0 53 -0 53 -inf 53 -6 53 -inf N N +0 0 53 -0 53 +inf 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N +0 0 53 -0 53 -inf 53 -0.5 53 -inf N N +0 0 53 -0 53 +inf 53 -0.5 53 +inf N N +0 0 53 nan 53 nan 53 -0.5 53 nan N N +0 0 53 -0 53 -inf 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 0 53 -0 53 +inf 53 -0 53 +inf N N +0 0 53 -0 53 nan 53 -0 53 nan N N +0 0 53 +0 53 -inf 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 0 53 +0 53 +inf 53 +0 53 +inf N N +0 0 53 +0 53 nan 53 +0 53 nan N N +0 0 53 +0 53 -inf 53 +0.5 53 -inf N N +0 0 53 +0 53 +inf 53 +0.5 53 +inf N N +0 0 53 nan 53 nan 53 +0.5 53 nan N N +0 0 53 +0 53 -inf 53 +6 53 -inf N N +0 0 53 +0 53 +inf 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N +- 0 53 0x1921FB54442D18p-53 53 -inf 53 +inf 53 -inf N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 +inf 53 -1 N N +- 0 53 0x1921FB54442D18p-52 53 -inf 53 +inf 53 -0 N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 +inf 53 +0 N N +- 0 53 0x1921FB54442D18p-52 53 +inf 53 +inf 53 +1 N N +- 0 53 0x1921FB54442D18p-53 53 +inf 53 +inf 53 +inf N N +0 0 53 nan 53 inf 53 +inf 53 nan N N +0 0 53 nan 53 -inf 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 nan 53 +inf 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/atan.dat b/tests/atan.dat new file mode 100644 index 0000000..c0029b3 --- /dev/null +++ b/tests/atan.dat @@ -0,0 +1,96 @@ +# Data file for mpc_atan. +# +# 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 -0x1921FB54442D18p-52 53 -inf 53 -inf 53 -inf N N ++ 0 53 -0x1921FB54442D18p-52 53 -inf 53 -inf 53 -1 N N ++ 0 53 -0x1921FB54442D18p-52 53 -inf 53 -inf 53 -0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf 53 +0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf 53 +1 N N ++ 0 53 -0x1921FB54442D18p-52 53 +inf 53 -inf 53 +inf N N ++ 0 53 -0x1921FB54442D18p-52 53 inf 53 -inf 53 nan N N ++ 0 53 -0x1921FB54442D18p-52 53 -0 53 -6 53 -inf N N ++ 0 53 -0x1921FB54442D18p-52 53 +0 53 -6 53 +inf N N +0 0 53 nan 53 nan 53 -6 53 nan N N ++ 0 53 -0x1921FB54442D18p-52 53 -0 53 -0 53 -inf N N ++ 0 53 -0x1921FB54442D18p-52 53 -0 53 -0 53 -0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +0 53 -0 53 +0 N N ++ 0 53 -0x1921FB54442D18p-52 53 +0 53 -0 53 +inf N N +0 0 53 nan 53 nan 53 -0 53 nan N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +0 53 -inf N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +0 53 -0 N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +0 53 +0 N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +0 53 +inf N N +0 0 53 nan 53 nan 53 +0 53 nan N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +6 53 -inf N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +6 53 +inf N N +0 0 53 nan 53 nan 53 +6 53 nan N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +inf 53 -inf N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +inf 53 -1 N N ++ 0 53 +0x1921FB54442D18p-52 53 -0 53 +inf 53 -0 N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +inf 53 +0 N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +inf 53 +1 N N ++ 0 53 +0x1921FB54442D18p-52 53 +0 53 +inf 53 +inf N N +0 0 53 +0x1921FB54442D18p-52 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/tacos.c b/tests/tacos.c new file mode 100644 index 0000000..3f1faa9 --- /dev/null +++ b/tests/tacos.c @@ -0,0 +1,37 @@ +/* test file for mpc_acos. + +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_acos); + + test_start (); + + data_check (f, "acos.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} diff --git a/tests/tasin.c b/tests/tasin.c new file mode 100644 index 0000000..847e9b3 --- /dev/null +++ b/tests/tasin.c @@ -0,0 +1,37 @@ +/* test file for mpc_asin. + +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_asin); + + test_start (); + + data_check (f, "asin.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} diff --git a/tests/tatan.c b/tests/tatan.c new file mode 100644 index 0000000..b65ef7e --- /dev/null +++ b/tests/tatan.c @@ -0,0 +1,37 @@ +/* test file for mpc_atan. + +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_atan); + + test_start (); + + data_check (f, "atan.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} |