summaryrefslogtreecommitdiff
path: root/tests/tlog.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-17 17:23:41 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-17 17:23:41 +0000
commit960f02dc3261c73558e179af2d0be839a75aa885 (patch)
treec4a9e61ccc5c6e4577f7c9a619813ddea86b8f76 /tests/tlog.c
parent07f353af30b60f3adf1aa55418a1fa185b937b07 (diff)
downloadmpc-960f02dc3261c73558e179af2d0be839a75aa885.tar.gz
Modify #include chain so as to support DLL creation on Cygwin
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@457 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tlog.c')
-rw-r--r--tests/tlog.c211
1 files changed, 105 insertions, 106 deletions
diff --git a/tests/tlog.c b/tests/tlog.c
index 04f955a..be74508 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -1,106 +1,105 @@
-/* test file for mpc_log.
-
-Copyright (C) 2008 Andreas Enge, Philippe Th\'eveny, Paul Zimmermann
-
-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 <stdlib.h>
-#include "mpc-tests.h"
-#include "mpc-impl.h"
-
-static void
-check_exp_log (void)
-{
- mpc_t z, z2, tmp;
- mpfr_t twopi;
- mp_prec_t prec;
-
- mpc_init2 (z, 1000);
- mpc_init2 (z2, 1000);
- mpc_init2 (tmp, 4000);
- mpfr_init2 (twopi, 1000);
- mpfr_const_pi (twopi, GMP_RNDD);
- mpfr_div_2ui (twopi, twopi, 1, GMP_RNDN);
-
- for (prec = 4; prec <= 1000; prec = prec*1.1 + 1)
- {
- mpc_set_prec (z, prec);
- mpc_set_prec (z2, prec);
- mpc_set_prec (tmp, 4*prec);
-
- /* Test whether exp (log (z)) = z, where z is no pure real
- and no pure imaginary. */
- test_default_random (z, 0, 10, 128, 0);
-
- mpc_log (tmp, z, MPC_RNDNN);
- mpc_exp (z2, tmp, MPC_RNDNN);
-
- if (mpc_cmp (z, z2) != 0)
- {
- printf ("Possible error in log; difference between z and "\
- "z2=exp(log(z)):\n");
- OUT (z);
- OUT (tmp);
- OUT (z2);
- exit (1);
- }
-
-
- /* Test whether log (exp (z)) = z for purely imaginary z; then exp (x) */
- /* lies on the unit cercle, a critical case for the logarithm. */
- mpfr_set_ui (MPC_RE (z), 0, GMP_RNDN);
-
- mpfr_remainder (MPC_IM (z), MPC_IM (z), twopi, GMP_RNDZ);
- mpc_exp (tmp, z, MPC_RNDNN);
- mpc_log (z2, tmp, MPC_RNDNN);
-
- /* There is a tiny real part, do not care if it si sufficiently small. */
- if (mpfr_cmp (MPC_IM (z), MPC_IM (z2)) != 0
- || MPFR_EXP (MPC_RE (z)) > -4 * (mp_exp_t) prec)
- {
- printf ("Possible error in purely imaginary log; difference "\
- "between z and z2=log(exp(z)):\n");
- OUT (z);
- OUT (tmp);
- OUT (z2);
- exit (1);
- }
- }
-
- mpc_clear (z);
- mpc_clear (z2);
- mpc_clear (tmp);
- mpfr_clear (twopi);
-}
-
-int
-main (void)
-{
- DECL_FUNC (CC, f, mpc_log);
-
- test_start ();
-
- data_check (f, "log.dat");
- tgeneric (f, 2, 512, 7, 128);
-
- check_exp_log ();
-
- test_end ();
-
- return 0;
-}
+/* test file for mpc_log.
+
+Copyright (C) 2008, 2009 Andreas Enge, Philippe Th\'eveny, Paul Zimmermann
+
+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 <stdlib.h>
+#include "mpc-tests.h"
+
+static void
+check_exp_log (void)
+{
+ mpc_t z, z2, tmp;
+ mpfr_t twopi;
+ mp_prec_t prec;
+
+ mpc_init2 (z, 1000);
+ mpc_init2 (z2, 1000);
+ mpc_init2 (tmp, 4000);
+ mpfr_init2 (twopi, 1000);
+ mpfr_const_pi (twopi, GMP_RNDD);
+ mpfr_div_2ui (twopi, twopi, 1, GMP_RNDN);
+
+ for (prec = 4; prec <= 1000; prec = prec*1.1 + 1)
+ {
+ mpc_set_prec (z, prec);
+ mpc_set_prec (z2, prec);
+ mpc_set_prec (tmp, 4*prec);
+
+ /* Test whether exp (log (z)) = z, where z is no pure real
+ and no pure imaginary. */
+ test_default_random (z, 0, 10, 128, 0);
+
+ mpc_log (tmp, z, MPC_RNDNN);
+ mpc_exp (z2, tmp, MPC_RNDNN);
+
+ if (mpc_cmp (z, z2) != 0)
+ {
+ printf ("Possible error in log; difference between z and "\
+ "z2=exp(log(z)):\n");
+ OUT (z);
+ OUT (tmp);
+ OUT (z2);
+ exit (1);
+ }
+
+
+ /* Test whether log (exp (z)) = z for purely imaginary z; then exp (x) */
+ /* lies on the unit cercle, a critical case for the logarithm. */
+ mpfr_set_ui (MPC_RE (z), 0, GMP_RNDN);
+
+ mpfr_remainder (MPC_IM (z), MPC_IM (z), twopi, GMP_RNDZ);
+ mpc_exp (tmp, z, MPC_RNDNN);
+ mpc_log (z2, tmp, MPC_RNDNN);
+
+ /* There is a tiny real part, do not care if it si sufficiently small. */
+ if (mpfr_cmp (MPC_IM (z), MPC_IM (z2)) != 0
+ || MPFR_EXP (MPC_RE (z)) > -4 * (mp_exp_t) prec)
+ {
+ printf ("Possible error in purely imaginary log; difference "\
+ "between z and z2=log(exp(z)):\n");
+ OUT (z);
+ OUT (tmp);
+ OUT (z2);
+ exit (1);
+ }
+ }
+
+ mpc_clear (z);
+ mpc_clear (z2);
+ mpc_clear (tmp);
+ mpfr_clear (twopi);
+}
+
+int
+main (void)
+{
+ DECL_FUNC (CC, f, mpc_log);
+
+ test_start ();
+
+ data_check (f, "log.dat");
+ tgeneric (f, 2, 512, 7, 128);
+
+ check_exp_log ();
+
+ test_end ();
+
+ return 0;
+}