summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2005-12-06 15:59:51 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2005-12-06 15:59:51 +0000
commit8412635524d67c04b46d9a3bbbd07f3ba103d16b (patch)
treef1c228ec836eea99f91b9138c23c4da6d0add118
parent553c0f8f60dc1e04246a8b289416001a0fe92d87 (diff)
downloadmpc-8412635524d67c04b46d9a3bbbd07f3ba103d16b.tar.gz
new release 0.4.5, require mpfr 2.2.0 or higher
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@42 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r--INSTALL28
-rw-r--r--makefile10
-rw-r--r--mpc-impl.h77
-rw-r--r--mpc.texi16
-rw-r--r--mul.c8
5 files changed, 20 insertions, 119 deletions
diff --git a/INSTALL b/INSTALL
index 487cff3..a1c6aba 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,31 +1,25 @@
Installing MPC
==============
-0. You first need to install GMP. See <http://www.swox.com/gmp/>.
- MPC requires GMP version 4.1 or later.
-
- You need to configure GMP with --enable-mpfr, to install the MPFR
- library, too.
+0. You first need to install GMP and MPFR. See <http://www.swox.com/gmp/>
+ and <http://www.mpfr.org>.
+ MPC requires GMP version 4.1 or later and MPFR version 2.2.0 or later.
1. In the MPC build directory, type
make
- This assumes that GMP is installed into /usr/local.
+ This assumes that GMP and MPFR are installed into /usr/local.
Otherwise, type
- make GMP=<gmp_install_dir>
-
- where <gmp_install_dir> is the directory where you installed GMP. The GMP
- header files like gmp.h are then expected to be in <gmp_install_dir>/include,
- and the GMP library files like libgmp.a in <gmp_install_dir>/lib.
-
- It is also possible to specify a separate directory for MPFR by
-
make GMP=<gmp_install_dir> MPFR=<mpfr_install_dir>
- which allows to use a newer version of MPFR.
+ where <gmp_install_dir> is the directory where you installed GMP and
+ <mpfr_install_dir> is the directory where you installed MPFR. The GMP
+ header files like gmp.h are then expected to be in <gmp_install_dir>/include,
+ the GMP library files like libgmp.a in <gmp_install_dir>/lib, and likewise
+ for MPFR.
2. Type
@@ -33,10 +27,6 @@
resp.
- make check GMP=<gmp_install_dir>
-
- resp.
-
make check GMP=<gmp_install_dir> MPFR=<mpfr_install_dir>
to produce and run the test files (please check that <gmp_install_dir>/lib
diff --git a/makefile b/makefile
index 1915b60..6c5ee2f 100644
--- a/makefile
+++ b/makefile
@@ -1,6 +1,6 @@
# Makefile for the MPC library.
#
-# Copyright (C) 2002, 2004 Andreas Enge, Paul Zimmermann
+# Copyright (C) 2002, 2004, 2005 Andreas Enge, Paul Zimmermann
#
# This file is part of the MPC Library.
#
@@ -19,10 +19,6 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
-# directory where GMP is installed (you need GMP 4.1 or later, configured
-# with MPFR installed, i.e. ./configure --enable-mpfr):
-# headers are expected in $(GMP)/include, lib in $(GMP)/lib
-
AR=ar
CC=gcc
RANLIB=ranlib
@@ -30,7 +26,7 @@ CFLAGS= -g -O2 -Wall -Wmissing-prototypes -ansi -pedantic
RM=rm -f
GMP=/usr/local
-MPFR=$(GMP)
+MPFR=/usr/local
######################## do not edit below this line ##########################
@@ -43,7 +39,7 @@ LIBS=$(MPFR)/lib/libmpfr.a $(GMP)/lib/libgmp.a
OBJECTS= abs.o add.o add_fr.o add_ui.o clear.o cmp.o cmp_si_si.o conj.o div.o div_2exp.o div_fr.o div_ui.o exp.o init.o init2.o init3.o inp_str.o mul.o mul_2exp.o mul_fr.o mul_ui.o mul_si.o mul_i.o neg.o norm.o out_str.o random.o random2.o set.o set_d_d.o set_dfl_prec.o set_prec.o set_ui_fr.o set_si_si.o set_ui_ui.o sqr.o sqrt.o sub.o sub_ui.o ui_div.o uceil_log2.o ui_ui_sub.o
SOURCES= abs.c add.c add_fr.c add_ui.c clear.c cmp.c cmp_si_si.c conj.c div.c div_2exp.c div_fr.c div_ui.c exp.c init.c init2.c init3.c inp_str.c mul.c mul_2exp.c mul_fr.c mul_ui.c mul_si.c mul_i.c neg.c norm.c out_str.c random.c random2.c set.c set_d_d.c set_dfl_prec.c set_prec.c set_ui_fr.c set_si_si.c set_ui_ui.c sqr.c sqrt.c sub.c sub_ui.c ui_div.c uceil_log2.c ui_ui_sub.c
-TESTS= test.c tmul.c tsqr.c tdiv.c texp.c
+TESTS= test.c tmul.c tsqr.c tdiv.c texp.c tabs.c
DIST= $(SOURCES) $(TESTS) makefile mpc.h mpc-impl.h COPYING.LIB mpc.texi INSTALL
.c.o:
diff --git a/mpc-impl.h b/mpc-impl.h
index 719d91c..058c4c8 100644
--- a/mpc-impl.h
+++ b/mpc-impl.h
@@ -22,83 +22,11 @@ MA 02111-1307, USA. */
#ifndef __MPC_IMPL_H
#define __MPC_IMPL_H
-/* Check version of MPFR:
- + 2.0.1:
- Define mpfr_cmp_abs and check for zero.
- Format.
- ceil_log2
- IS_ZERO
- Change_sign
- + 2.0.2 / 2.0.3:
- Format.
- ceil_log2
- IS_ZERO
- Change_sign
- + 2.1.0:
- Format
- ceil_log2
- IS_ZERO
- Change_sign
- + Generic:
-
-*/
-#if !defined(mpfr_round_prec) /* MPFR 2.0.1 */
-
-#define MPFR_CMP_ABS(a,b) \
- ((MPFR_IS_ZERO (a)) ? 0 : ((MPFR_IS_ZERO (b)) ? 1 : mpfr_cmp_abs(a, b)))
-#define NEED_CMP_ABS_PROTO
-#if defined (_CRAY) && ! defined (_CRAYMPP)
-typedef unsigned int mp_size_unsigned_t;
-#else
-typedef unsigned long int mp_size_unsigned_t;
-#endif
-#define MPFR_PREC(x) ((x)->_mpfr_prec)
-#define MPFR_SIZE(x) ((x)->_mpfr_size)
-#define MPFR_MANT(x) ((x)->_mpfr_d)
-#define MPFR_EXP(x) ((x)->_mpfr_exp)
-#define MPFR_CHANGE_SIGN(x) (MPFR_SIZE(x) ^= (((mp_size_unsigned_t) 1) << 31))
-#define MPFR_IS_ZERO(x) \
- (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] == (mp_limb_t) 0)
-
-#elif !defined(MPFR_VERSION) /* MPFR 2.0.2 / 2.0.3 */
-
-#if defined (_CRAY) && ! defined (_CRAYMPP)
-typedef unsigned int mp_size_unsigned_t;
-#else
-typedef unsigned long int mp_size_unsigned_t;
-#endif
-#define MPFR_CMP_ABS mpfr_cmp_abs
-#define MPFR_PREC(x) ((x)->_mpfr_prec)
-#define MPFR_SIZE(x) ((x)->_mpfr_size)
-#define MPFR_MANT(x) ((x)->_mpfr_d)
-#define MPFR_EXP(x) ((x)->_mpfr_exp)
-#define MPFR_CHANGE_SIGN(x) (MPFR_SIZE(x) ^= (((mp_size_unsigned_t) 1) << 31))
-#define MPFR_IS_ZERO(x) \
- (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] == (mp_limb_t) 0)
-
-#elif (MPFR_VERSION == MPFR_VERSION_NUM(2,1,0)) /* MPFR 2.1.0 */
-
-#define MPFR_CMP_ABS mpfr_cmp_abs
-#define MPFR_PREC(x) ((x)->_mpfr_prec)
-#define MPFR_EXP(x) ((x)->_mpfr_exp)
-#define MPFR_CHANGE_SIGN(x) (MPFR_SIGN (x) = - MPFR_SIGN (x))
-#if __GMP_MP_SIZE_T_INT
-# define MPFR_EXP_ZERO ((mp_exp_t)((~((~(unsigned int)0)>>1))+1))
-#else
-# define MPFR_EXP_ZERO ((mp_exp_t)((~((~(unsigned long)0)>>1))+1))
-#endif
-#define MPFR_IS_ZERO(x) (MPFR_EXP(x) == MPFR_EXP_ZERO)
-
-#else /* Generic MPFR code */
-
-#define MPFR_CMP_ABS mpfr_cmp_abs
#define MPFR_PREC(x) mpfr_get_prec(x)
#define MPFR_EXP(x) mpfr_get_exp(x)
#define MPFR_CHANGE_SIGN(x) mpfr_neg(x,x,GMP_RNDN)
#define MPFR_IS_ZERO(x) (mpfr_cmp_ui(x,0) == 0)
-#endif
-
#define MAX(h,i) ((h) > (i) ? (h) : (i))
#ifndef MUL_KARATSUBA_THRESHOLD
@@ -129,11 +57,6 @@ extern "C" {
unsigned long mpc_ceil_log2 __MPC_PROTO ((unsigned long));
int mpc_abs_basic __MPC_PROTO ((mpfr_ptr, mpc_srcptr, mpc_rnd_t));
- /* forgotten in mpfr.h from GMP 4.1 */
-#ifdef NEED_CMP_ABS_PROTO
- extern int mpfr_cmp_abs __MPC_PROTO ((mpfr_srcptr, mpfr_srcptr));
-#endif
-
#if defined (__cplusplus)
}
#endif
diff --git a/mpc.texi b/mpc.texi
index 0732f64..beef498 100644
--- a/mpc.texi
+++ b/mpc.texi
@@ -10,7 +10,7 @@
@comment %**end of header
@set VERSION 0.4.5
-@set DATE {February 2005}
+@set DATE {December 2005}
@ifinfo
@format
@@ -186,9 +186,7 @@ probably a good idea to glance through it.
@cindex Installation
To build MPC, you first have to install GNU MP
-(version 4.1 or higher) on your computer.
-You need to configure GNU MP with @code{--enable-mpfr}, to install
-also the MPFR sub-library.
+(version 4.1 or higher) and MPFR (version 2.2.0 or higher) on your computer.
You need a C compiler, preferably GCC, but any reasonable compiler should
work. And you need a standard Unix @samp{make} program, plus some other
standard Unix utility programs.
@@ -199,24 +197,18 @@ Here are the steps needed to install the library on Unix systems:
@item
@samp{make}
-if GMP is installed into the standard directory @samp{/usr/local}.
+if GMP and MPFR are installed into the standard directory @samp{/usr/local}.
This will compile MPC, and create a library archive file @file{libmpc.a}
in the working directory.
-@samp{make GMP=<gmp_install_dir>}.
-
-is used to indicate a different location of GMP.
-
@samp{make GMP=<gmp_install_dir> MPFR=<mpfr_install_dir>}.
-allows to use a different version of MPFR than that provided with GMP.
+is used to indicate different locations of GMP and MPFR.
@item
@samp{make check} resp.
-@samp {make check GMP=<gmp_install_dir>} resp.
-
@samp {make check GMP=<gmp_install_dir> MPFR=<mpfr_install_dir>}
This will make sure MPC was built correctly.
diff --git a/mul.c b/mul.c
index 90b35a6..0afd0db 100644
--- a/mul.c
+++ b/mul.c
@@ -1,6 +1,6 @@
/* mpc_mul -- Multiply two complex numbers.
-Copyright (C) 2002, 2004 Andreas Enge, Paul Zimmermann
+Copyright (C) 2002, 2004, 2005 Andreas Enge, Paul Zimmermann
This file is part of the MPC Library.
@@ -188,14 +188,14 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd)
mul_a = 1; /* implicit factor for a */
mul_c = 1; /* implicit factor for c */
- if (MPFR_CMP_ABS (a, b) < 0)
+ if (mpfr_cmp_abs (a, b) < 0)
{
SWAP(a, b);
mul_i ++;
mul_a = -1; /* consider i * (a+i*b) = -b + i*a */
}
- if (MPFR_CMP_ABS (c, d) < 0)
+ if (mpfr_cmp_abs (c, d) < 0)
{
SWAP(c, d);
mul_i ++;
@@ -235,7 +235,7 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd)
mpfr_neg (w, w, GMP_RNDN);
/* compute sign(v-w) */
- sign_x = MPFR_CMP_ABS (v, w);
+ sign_x = mpfr_cmp_abs (v, w);
if (sign_x > 0)
sign_x = 2 * mpfr_sgn (v) - mpfr_sgn (w);
else if (sign_x == 0)