initial import of MPC 1.0.1 package. changes since 0.9:
Changes in version 1.0.1: - Switched to automake 1.11.6, see https://lists.gnu.org/archive/html/automake/2012-07/msg00023.html - #14669: Fixed extraction of CC from gmp.h - Fixed case of intermediate zero real or imaginary part in mpc_fma, found by hydra with GMP_CHECK_RANDOMIZE=1346362345 Changes in version 1.0: - First release as a GNU package - License change: LGPLv3+ for code, GFDLv1.3+ (with no invariant sections) for documentation - 100% of all lines are covered by tests - Functions renamed: mpc_mul_2exp to mpc_mul_2ui, mpc_div_2exp to mpc_div_2ui - 0^0, which returned (NaN,NaN) previously, now returns (1,+0) - Removed compatibility with K&R compilers, untestable due to lack of such compilers - New functions: mpc_log10, mpc_mul_2si, mpc_div_2si - Speed-ups: - mpc_fma - Bug fixes: - mpc_div and mpc_norm now return a value indicating the effective rounding direction, as the other functions - mpc_mul, mpc_sqr and mpc_norm now return correct results even if there are over- or underflows during the computation - mpc_asin, mpc_proj, mpc_sqr: Wrong result when input variable has infinite part and equals output variable is corrected - mpc_fr_sub: Wrong return value for imaginary part is corrected
This commit is contained in:
parent
9a784854f0
commit
8fa80f2961
|
@ -0,0 +1,6 @@
|
|||
Main authors:
|
||||
Andreas Enge
|
||||
Philippe Théveny
|
||||
Paul Zimmermann
|
||||
|
||||
Mickaël Gastineau has contributed the file Makefile.vc.
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -0,0 +1,101 @@
|
|||
Copyright (C) INRIA 2003, 2005, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without any warranty.
|
||||
|
||||
|
||||
Installing GNU MPC
|
||||
==================
|
||||
|
||||
This is for the impatient, for deeper explanations see the chapter
|
||||
"Installing GNU MPC" in the Texinfo documentation (type 'info mpc.info').
|
||||
|
||||
0. You first need to install GMP, the GNU Multiprecision Arithmetic Library,
|
||||
see <http://gmplib.org/>, and GNU MPFR, see <http://www.mpfr.org>.
|
||||
GNU MPC requires GMP version 4.3.2 or later
|
||||
and GNU MPFR version 2.4.2 or later.
|
||||
|
||||
1. In the directory of the GNU MPC archive, type
|
||||
|
||||
tar xzf mpc-1.0.1.tar.gz
|
||||
cd mpc-1.0.1
|
||||
./configure
|
||||
make
|
||||
|
||||
This assumes that GMP and GNU MPFR are installed in a directory searched
|
||||
by default by the compiler. Otherwise, use --with-gmp=DIR or
|
||||
--with-mpfr=DIR with ./configure (see the Texinfo documentation).
|
||||
|
||||
2. You should run the test suite, type
|
||||
|
||||
make check
|
||||
|
||||
If any error occurs, please report it on the mailing list
|
||||
<mpc-discuss@lists.gforge.inria.fr>, or file a bug at the bug tracker
|
||||
<https://gforge.inria.fr/tracker/?atid=607&group_id=131&func=browse> .
|
||||
|
||||
3. To install the GNU MPC library, type
|
||||
|
||||
make install
|
||||
|
||||
By default, the files are copied into subdirectories of /usr/local.
|
||||
You need write permissions on these directories, or pass an alternative
|
||||
installation directory using the --prefix option to ./configure.
|
||||
|
||||
4. You can optionally create documentation, type
|
||||
|
||||
make dvi
|
||||
|
||||
or
|
||||
|
||||
make ps
|
||||
|
||||
This requires the Texinfo package (version 4.2 at least).
|
||||
|
||||
In case of difficulties, please send a description of the problem to
|
||||
<mpc-discuss@lists.gforge.inria.fr>.
|
||||
|
||||
##############################################################################
|
||||
|
||||
Note for AIX users:
|
||||
===================
|
||||
|
||||
If GMP was built with the 64-bit ABI, before building and testing GNU MPC,
|
||||
it might be necessary to set the OBJECT_MODE environment variable to 64
|
||||
by, e.g.,
|
||||
export OBJECT_MODE=64
|
||||
This has been tested with the C compiler IBM XL C/C++ Enterprise Edition
|
||||
V8.0 for AIX, version: 08.00.0000.0021, GMP 4.2.4 and GNU MPFR 2.4.1.
|
||||
|
||||
##############################################################################
|
||||
|
||||
Note for Windows users:
|
||||
=======================
|
||||
|
||||
There is a special file Makefile.vc for Windows, contributed by Mickaël
|
||||
Gastineau. This file works both for the Windows Server 2003 R2 Platform SDK,
|
||||
and for the Windows SDK of Vista. To use it, simply replace "make" by
|
||||
"nmake /f makefile.vc" in the above instructions:
|
||||
|
||||
compilation :
|
||||
nmake /f makefile.vc GMP=<gmp_install_dir> MPFR=<mpfr_install_dir>
|
||||
|
||||
clean :
|
||||
nmake /f makefile.vc GMP=<gmp_install_dir> MPFR=<mpfr_install_dir> clean
|
||||
|
||||
check :
|
||||
nmake /f makefile.vc GMP=<gmp_install_dir> MPFR=<mpfr_install_dir> check
|
||||
|
||||
If you want to compile mpc with mingw in the msys shell, you might need to
|
||||
add the following to the configure command (or in your environment):
|
||||
|
||||
LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include
|
||||
|
||||
In addition, you might need to give the following additional argument to
|
||||
configure (reported for mpc-0.9):
|
||||
|
||||
CPP="x86_64-w64-mingw32-gcc -E"
|
||||
|
||||
(reported by Sisyphus)
|
|
@ -0,0 +1,29 @@
|
|||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## Copyright (C) 2008, 2010, 2011 INRIA
|
||||
##
|
||||
## This file is part of GNU MPC.
|
||||
##
|
||||
## GNU MPC 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 3 of the License, or (at your
|
||||
## option) any later version.
|
||||
##
|
||||
## GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# version number for distribution tarball
|
||||
VERSION = @VERSION@@SVNVERSION@
|
||||
|
||||
SUBDIRS = src tests doc
|
||||
|
||||
EXTRA_HEADERS = src/mpc-log.h
|
||||
include_HEADERS = src/mpc.h @MPC_LOG_H@
|
||||
EXTRA_DIST = doc/fdl-1.3.texi src/mpc-log.h tests/tgeneric.c Makefile.vc
|
|
@ -0,0 +1,832 @@
|
|||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS \
|
||||
COPYING.LESSER ChangeLog INSTALL NEWS TODO ar-lib config.guess \
|
||||
config.sub depcomp install-sh ltmain.sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c_check_flag.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_option.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_version.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/mpc.m4 $(top_srcdir)/m4/valgrind-tests.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(includedir)"
|
||||
HEADERS = $(include_HEADERS)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
GREP = @GREP@
|
||||
HASSVNVERSION = @HASSVNVERSION@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MPC_LDFLAGS = @MPC_LDFLAGS@
|
||||
MPC_LOG_H = @MPC_LOG_H@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SVNVERSION = @SVNVERSION@
|
||||
VALGRIND = @VALGRIND@
|
||||
|
||||
# version number for distribution tarball
|
||||
VERSION = @VERSION@@SVNVERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src tests doc
|
||||
EXTRA_HEADERS = src/mpc-log.h
|
||||
include_HEADERS = src/mpc.h @MPC_LOG_H@
|
||||
EXTRA_DIST = doc/fdl-1.3.texi src/mpc-log.h tests/tgeneric.c Makefile.vc
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then rm -f stamp-h1; else :; fi
|
||||
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(HEADERS) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
|
||||
dist-zip distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-includeHEADERS install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-includeHEADERS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,426 @@
|
|||
# Makefile for the MPC library (Windows version).
|
||||
#
|
||||
# Copyright (C) INRIA - CNRS, 2002, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# usage:
|
||||
# nmake /f Makefile.vc clean
|
||||
# clean the temporaries objects
|
||||
#
|
||||
# nmake /f Makefile.vc STATIC=0|1 GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
|
||||
# compile MPC
|
||||
#
|
||||
# nmake /f Makefile.vc STATIC=0|1 install GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory DESTDIR=installdirectory
|
||||
# install MPC to installdirectory
|
||||
#
|
||||
# nmake /f Makefile.vc STATIC=0|1 check GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
|
||||
# perform tests on MPC
|
||||
#
|
||||
# GMPDIR : specify the location where GMP is installed
|
||||
# MPFRDIR : specify the location where MPFR is installed
|
||||
# DESTDIR : specify the location where MPC will be installed
|
||||
# STATIC : specify if a static or dynamic library of MPC will be created
|
||||
# STATIC=1 : build a static library
|
||||
# STATIC=0 : build a dynamic library (DLL)
|
||||
# A dynamic library is created by default if STATIC is omitted (STATIC=0)
|
||||
# ENABLELOGGING : specify if MPC functions calls are logged
|
||||
# ENABLELOGGING=1 : MPC functions calls are logged
|
||||
# ENABLELOGGING=0 : MPC functions calls are not logged (default)
|
||||
# Functions calls are not logged by default if ENABLELOGGING is omitted (ENABLELOGGING=0)
|
||||
|
||||
|
||||
CPP = cl.exe
|
||||
CC = cl.exe
|
||||
CDEFAULTFLAGS=/O2 /GR- /MD /nologo /EHs
|
||||
|
||||
VERSION=1.0.1
|
||||
|
||||
######################## do not edit below this line ##########################
|
||||
|
||||
DIRMPC=.\src
|
||||
DIRMPCTESTS=.\tests\\
|
||||
|
||||
!if "$(STATIC)" == "0"
|
||||
LIBRARY = libmpc.dll
|
||||
LINKER = link.exe /DLL
|
||||
GMPMUSTBEDLL=/D__GMP_LIBGMP_DLL
|
||||
!else
|
||||
LIBRARY = libmpc.lib
|
||||
LINKER = lib.exe
|
||||
GMPMUSTBEDLL=
|
||||
!endif
|
||||
|
||||
#check for logging. if yes then add logging.c to the library
|
||||
!if "$(ENABLELOGGING)" == "1"
|
||||
CPPOBJECTS_LOGGING = $(DIRMPC)\logging.obj
|
||||
CPPLINKOBJECTS_LOGGING = logging.obj
|
||||
LIBS_LOGGING = kernel32.lib
|
||||
!else
|
||||
CPPOBJECTS_LOGGING =
|
||||
CPPLINKOBJECTS_LOGGING =
|
||||
LIBS_LOGGING =
|
||||
!endif
|
||||
|
||||
|
||||
INCLUDES = /I$(DIRMPC) /I$(GMPDIR)\include /I$(MPFR)\include
|
||||
CKERNELFLAGS = $(CDEFAULTFLAGS) $(GMPMUSTBEDLL) $(INCLUDES)
|
||||
CFLAGS = $(CKERNELFLAGS) /D__MPC_WITHIN_MPC /D_GMP_IEEE_FLOATS /DHAVE_CONFIG_H
|
||||
|
||||
TESTCOMPILE=$(CC) $(CKERNELFLAGS) $(DIRMPCTESTS)\tgeneric.c $(DIRMPCTESTS)\comparisons.c $(DIRMPCTESTS)\read_data.c $(DIRMPCTESTS)\random.c $(DIRMPCTESTS)
|
||||
MIDTESTCOMPILE=/link /out:$(DIRMPCTESTS)
|
||||
ENDTESTCOMPILE=/LIBPATH:"$(GMPDIR)\lib" libmpc.lib libmpfr.lib libgmp.lib $(LIBS_LOGGING)
|
||||
|
||||
|
||||
#generate the CPPOBJECTS : goto src and execute
|
||||
# ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("$(DIRMPC)\\%s \\\n",$1); } '
|
||||
#generate the CPPLINKOBJECTS : goto src and execute
|
||||
# ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("%s \\\n",$1); } '
|
||||
#generate the list for tests : goto tests and execute
|
||||
# ls t*.c | sed "s/\.c//" | grep -v tgeneric| grep -v comparisons | grep -v read_data | grep -v random | awk ' { printf("\t$(TESTCOMPILE)%s.c $(MIDTESTCOMPILE)%s.exe $(ENDTESTCOMPILE)\n\tcd $(DIRMPCTESTS) && %s.exe && cd ..\n",$1,$1,$1,$1); } '
|
||||
|
||||
LIBRARYLIB = libmpc.lib
|
||||
|
||||
CPPOBJECTS =$(DIRMPC)\abs.obj \
|
||||
$(DIRMPC)\acos.obj \
|
||||
$(DIRMPC)\acosh.obj \
|
||||
$(DIRMPC)\add.obj \
|
||||
$(DIRMPC)\add_fr.obj \
|
||||
$(DIRMPC)\add_si.obj \
|
||||
$(DIRMPC)\add_ui.obj \
|
||||
$(DIRMPC)\arg.obj \
|
||||
$(DIRMPC)\asin.obj \
|
||||
$(DIRMPC)\asinh.obj \
|
||||
$(DIRMPC)\atan.obj \
|
||||
$(DIRMPC)\atanh.obj \
|
||||
$(DIRMPC)\clear.obj \
|
||||
$(DIRMPC)\cmp.obj \
|
||||
$(DIRMPC)\cmp_si_si.obj \
|
||||
$(DIRMPC)\conj.obj \
|
||||
$(DIRMPC)\cos.obj \
|
||||
$(DIRMPC)\cosh.obj \
|
||||
$(DIRMPC)\div.obj \
|
||||
$(DIRMPC)\div_2ui.obj \
|
||||
$(DIRMPC)\div_fr.obj \
|
||||
$(DIRMPC)\div_ui.obj \
|
||||
$(DIRMPC)\exp.obj \
|
||||
$(DIRMPC)\fma.obj \
|
||||
$(DIRMPC)\fr_div.obj \
|
||||
$(DIRMPC)\fr_sub.obj \
|
||||
$(DIRMPC)\get_prec.obj \
|
||||
$(DIRMPC)\get_prec2.obj \
|
||||
$(DIRMPC)\get_version.obj \
|
||||
$(DIRMPC)\get_x.obj \
|
||||
$(DIRMPC)\imag.obj \
|
||||
$(DIRMPC)\init2.obj \
|
||||
$(DIRMPC)\init3.obj \
|
||||
$(DIRMPC)\inp_str.obj \
|
||||
$(DIRMPC)\log.obj \
|
||||
$(DIRMPC)\log10.obj \
|
||||
$(DIRMPC)\mem.obj \
|
||||
$(DIRMPC)\mul.obj \
|
||||
$(DIRMPC)\mul_2ui.obj \
|
||||
$(DIRMPC)\mul_fr.obj \
|
||||
$(DIRMPC)\mul_i.obj \
|
||||
$(DIRMPC)\mul_si.obj \
|
||||
$(DIRMPC)\mul_ui.obj \
|
||||
$(DIRMPC)\neg.obj \
|
||||
$(DIRMPC)\norm.obj \
|
||||
$(DIRMPC)\out_str.obj \
|
||||
$(DIRMPC)\pow.obj \
|
||||
$(DIRMPC)\pow_d.obj \
|
||||
$(DIRMPC)\pow_fr.obj \
|
||||
$(DIRMPC)\pow_ld.obj \
|
||||
$(DIRMPC)\pow_si.obj \
|
||||
$(DIRMPC)\pow_ui.obj \
|
||||
$(DIRMPC)\pow_z.obj \
|
||||
$(DIRMPC)\proj.obj \
|
||||
$(DIRMPC)\real.obj \
|
||||
$(DIRMPC)\set.obj \
|
||||
$(DIRMPC)\set_prec.obj \
|
||||
$(DIRMPC)\set_str.obj \
|
||||
$(DIRMPC)\set_x.obj \
|
||||
$(DIRMPC)\set_x_x.obj \
|
||||
$(DIRMPC)\sin.obj \
|
||||
$(DIRMPC)\sin_cos.obj \
|
||||
$(DIRMPC)\sinh.obj \
|
||||
$(DIRMPC)\sqr.obj \
|
||||
$(DIRMPC)\sqrt.obj \
|
||||
$(DIRMPC)\strtoc.obj \
|
||||
$(DIRMPC)\sub.obj \
|
||||
$(DIRMPC)\sub_fr.obj \
|
||||
$(DIRMPC)\sub_ui.obj \
|
||||
$(DIRMPC)\swap.obj \
|
||||
$(DIRMPC)\tan.obj \
|
||||
$(DIRMPC)\tanh.obj \
|
||||
$(DIRMPC)\uceil_log2.obj \
|
||||
$(DIRMPC)\ui_div.obj \
|
||||
$(DIRMPC)\ui_ui_sub.obj $(CPPOBJECTS_LOGGING) \
|
||||
$(DIRMPC)\urandom.obj
|
||||
|
||||
CPPLINKOBJECTS = abs.obj \
|
||||
acos.obj \
|
||||
acosh.obj \
|
||||
add.obj \
|
||||
add_fr.obj \
|
||||
add_si.obj \
|
||||
add_ui.obj \
|
||||
arg.obj \
|
||||
asin.obj \
|
||||
asinh.obj \
|
||||
atan.obj \
|
||||
atanh.obj \
|
||||
clear.obj \
|
||||
cmp.obj \
|
||||
cmp_si_si.obj \
|
||||
conj.obj \
|
||||
cos.obj \
|
||||
cosh.obj \
|
||||
div.obj \
|
||||
div_2ui.obj \
|
||||
div_fr.obj \
|
||||
div_ui.obj \
|
||||
exp.obj \
|
||||
fma.obj \
|
||||
fr_div.obj \
|
||||
fr_sub.obj \
|
||||
get_prec.obj \
|
||||
get_prec2.obj \
|
||||
get_version.obj \
|
||||
get_x.obj \
|
||||
imag.obj \
|
||||
init2.obj \
|
||||
init3.obj \
|
||||
inp_str.obj \
|
||||
log.obj \
|
||||
log10.obj \
|
||||
mem.obj \
|
||||
mul.obj \
|
||||
mul_2ui.obj \
|
||||
mul_fr.obj \
|
||||
mul_i.obj \
|
||||
mul_si.obj \
|
||||
mul_ui.obj \
|
||||
neg.obj \
|
||||
norm.obj \
|
||||
out_str.obj \
|
||||
pow.obj \
|
||||
pow_d.obj \
|
||||
pow_fr.obj \
|
||||
pow_ld.obj \
|
||||
pow_si.obj \
|
||||
pow_ui.obj \
|
||||
pow_z.obj \
|
||||
proj.obj \
|
||||
real.obj \
|
||||
set.obj \
|
||||
set_prec.obj \
|
||||
set_str.obj \
|
||||
set_x.obj \
|
||||
set_x_x.obj \
|
||||
sin.obj \
|
||||
sin_cos.obj \
|
||||
sinh.obj \
|
||||
sqr.obj \
|
||||
sqrt.obj \
|
||||
strtoc.obj \
|
||||
sub.obj \
|
||||
sub_fr.obj \
|
||||
sub_ui.obj \
|
||||
swap.obj \
|
||||
tan.obj \
|
||||
tanh.obj \
|
||||
uceil_log2.obj \
|
||||
ui_div.obj \
|
||||
ui_ui_sub.obj $(CPPLINKOBJECTS_LOGGING) \
|
||||
urandom.obj
|
||||
|
||||
#
|
||||
# Link target: automatically builds its object dependencies before
|
||||
# executing its link command.
|
||||
#
|
||||
|
||||
$(LIBRARY): $(DIRMPC)config.h $(CPPOBJECTS)
|
||||
$(LINKER) /out:$@ $(CPPLINKOBJECTS) /LIBPATH:"$(GMPDIR)\lib" libmpfr.lib libgmp.lib $(LIBS_LOGGING)
|
||||
|
||||
$(DIRMPC)config.h :
|
||||
echo #define PACKAGE_STRING "mpc" >$(DIRMPC)\config.h
|
||||
echo #define PACKAGE_VERSION "$(VERSION)" >>$(DIRMPC)\config.h
|
||||
echo #define STDC_HEADERS 1 >>$(DIRMPC)\config.h
|
||||
echo #define dlsym(handle, name) GetProcAddress(GetModuleHandle(handle), name) >>$(DIRMPC)\config.h
|
||||
echo #include "windows.h" >>$(DIRMPC)\config.h
|
||||
|
||||
|
||||
#
|
||||
# Clean target: "nmake /f Makefile.vc clean" to remove unwanted
|
||||
# objects and executables.
|
||||
#
|
||||
|
||||
clean:
|
||||
del *.obj $(CPPLINKOBJECTS) $(LIBRARY) *.tlh $(DIRMPC)config.h *.dll *.lib *.exe
|
||||
|
||||
|
||||
|
||||
#
|
||||
# install target: "nmake /f Makefile.vc install DESTDIR=xxx" to perform the installation.
|
||||
#
|
||||
|
||||
install: $(LIBRARY)
|
||||
-mkdir $(DESTDIR)
|
||||
-mkdir $(DESTDIR)\include
|
||||
copy $(DIRMPC)\mpc.h $(DESTDIR)\include
|
||||
-mkdir $(DESTDIR)\lib
|
||||
copy $(LIBRARY) $(DESTDIR)\lib
|
||||
copy $(LIBRARYLIB) $(DESTDIR)\lib
|
||||
|
||||
#
|
||||
# check target: "nmake /f Makefile.vc check GMPDIR=xxx MPFRDIR=xxx" to perform the installation.
|
||||
#
|
||||
check : test
|
||||
test :
|
||||
-copy $(GMPDIR)\lib\*gmp*.dll $(DIRMPCTESTS)
|
||||
-copy $(MPFRDIR)\lib\*mpfr*.dll $(DIRMPCTESTS)
|
||||
copy $(LIBRARY) $(DIRMPCTESTS)
|
||||
$(TESTCOMPILE)tabs.c $(MIDTESTCOMPILE)tabs.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tabs.exe && cd ..
|
||||
$(TESTCOMPILE)tacos.c $(MIDTESTCOMPILE)tacos.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tacos.exe && cd ..
|
||||
$(TESTCOMPILE)tacosh.c $(MIDTESTCOMPILE)tacosh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tacosh.exe && cd ..
|
||||
$(TESTCOMPILE)tadd.c $(MIDTESTCOMPILE)tadd.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tadd.exe && cd ..
|
||||
$(TESTCOMPILE)tadd_fr.c $(MIDTESTCOMPILE)tadd_fr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tadd_fr.exe && cd ..
|
||||
$(TESTCOMPILE)tadd_si.c $(MIDTESTCOMPILE)tadd_si.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tadd_si.exe && cd ..
|
||||
$(TESTCOMPILE)tadd_ui.c $(MIDTESTCOMPILE)tadd_ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tadd_ui.exe && cd ..
|
||||
$(TESTCOMPILE)targ.c $(MIDTESTCOMPILE)targ.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && targ.exe && cd ..
|
||||
$(TESTCOMPILE)tasin.c $(MIDTESTCOMPILE)tasin.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tasin.exe && cd ..
|
||||
$(TESTCOMPILE)tasinh.c $(MIDTESTCOMPILE)tasinh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tasinh.exe && cd ..
|
||||
$(TESTCOMPILE)tatan.c $(MIDTESTCOMPILE)tatan.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tatan.exe && cd ..
|
||||
$(TESTCOMPILE)tatanh.c $(MIDTESTCOMPILE)tatanh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tatanh.exe && cd ..
|
||||
$(TESTCOMPILE)tconj.c $(MIDTESTCOMPILE)tconj.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tconj.exe && cd ..
|
||||
$(TESTCOMPILE)tcos.c $(MIDTESTCOMPILE)tcos.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tcos.exe && cd ..
|
||||
$(TESTCOMPILE)tcosh.c $(MIDTESTCOMPILE)tcosh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tcosh.exe && cd ..
|
||||
$(TESTCOMPILE)tdiv.c $(MIDTESTCOMPILE)tdiv.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tdiv.exe && cd ..
|
||||
$(TESTCOMPILE)tdiv_2ui.c $(MIDTESTCOMPILE)tdiv_2ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tdiv_2ui.exe && cd ..
|
||||
$(TESTCOMPILE)tdiv_fr.c $(MIDTESTCOMPILE)tdiv_fr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tdiv_fr.exe && cd ..
|
||||
$(TESTCOMPILE)tdiv_ui.c $(MIDTESTCOMPILE)tdiv_ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tdiv_ui.exe && cd ..
|
||||
$(TESTCOMPILE)texp.c $(MIDTESTCOMPILE)texp.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && texp.exe && cd ..
|
||||
$(TESTCOMPILE)tfma.c $(MIDTESTCOMPILE)tfma.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tfma.exe && cd ..
|
||||
$(TESTCOMPILE)tfr_div.c $(MIDTESTCOMPILE)tfr_div.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tfr_div.exe && cd ..
|
||||
$(TESTCOMPILE)tfr_sub.c $(MIDTESTCOMPILE)tfr_sub.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tfr_sub.exe && cd ..
|
||||
$(TESTCOMPILE)tget_version.c $(MIDTESTCOMPILE)tget_version.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tget_version.exe && cd ..
|
||||
$(TESTCOMPILE)timag.c $(MIDTESTCOMPILE)timag.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && timag.exe && cd ..
|
||||
$(TESTCOMPILE)tio_str.c $(MIDTESTCOMPILE)tio_str.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tio_str.exe && cd ..
|
||||
$(TESTCOMPILE)tlog.c $(MIDTESTCOMPILE)tlog.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tlog.exe && cd ..
|
||||
$(TESTCOMPILE)tlog10.c $(MIDTESTCOMPILE)tlog10.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tlog10.exe && cd ..
|
||||
$(TESTCOMPILE)tmul.c $(MIDTESTCOMPILE)tmul.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul.exe && cd ..
|
||||
$(TESTCOMPILE)tmul_2ui.c $(MIDTESTCOMPILE)tmul_2ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul_2ui.exe && cd ..
|
||||
$(TESTCOMPILE)tmul_fr.c $(MIDTESTCOMPILE)tmul_fr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul_fr.exe && cd ..
|
||||
$(TESTCOMPILE)tmul_i.c $(MIDTESTCOMPILE)tmul_i.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul_i.exe && cd ..
|
||||
$(TESTCOMPILE)tmul_si.c $(MIDTESTCOMPILE)tmul_si.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul_si.exe && cd ..
|
||||
$(TESTCOMPILE)tmul_ui.c $(MIDTESTCOMPILE)tmul_ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tmul_ui.exe && cd ..
|
||||
$(TESTCOMPILE)tneg.c $(MIDTESTCOMPILE)tneg.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tneg.exe && cd ..
|
||||
$(TESTCOMPILE)tnorm.c $(MIDTESTCOMPILE)tnorm.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tnorm.exe && cd ..
|
||||
$(TESTCOMPILE)tpow.c $(MIDTESTCOMPILE)tpow.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_d.c $(MIDTESTCOMPILE)tpow_d.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_d.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_fr.c $(MIDTESTCOMPILE)tpow_fr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_fr.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_ld.c $(MIDTESTCOMPILE)tpow_ld.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_ld.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_si.c $(MIDTESTCOMPILE)tpow_si.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_si.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_ui.c $(MIDTESTCOMPILE)tpow_ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_ui.exe && cd ..
|
||||
$(TESTCOMPILE)tpow_z.c $(MIDTESTCOMPILE)tpow_z.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tpow_z.exe && cd ..
|
||||
$(TESTCOMPILE)tprec.c $(MIDTESTCOMPILE)tprec.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tprec.exe && cd ..
|
||||
$(TESTCOMPILE)tproj.c $(MIDTESTCOMPILE)tproj.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tproj.exe && cd ..
|
||||
$(TESTCOMPILE)treal.c $(MIDTESTCOMPILE)treal.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && treal.exe && cd ..
|
||||
$(TESTCOMPILE)treimref.c $(MIDTESTCOMPILE)treimref.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && treimref.exe && cd ..
|
||||
$(TESTCOMPILE)tset.c $(MIDTESTCOMPILE)tset.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tset.exe && cd ..
|
||||
$(TESTCOMPILE)tsin.c $(MIDTESTCOMPILE)tsin.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsin.exe && cd ..
|
||||
$(TESTCOMPILE)tsin_cos.c $(MIDTESTCOMPILE)tsin_cos.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsin_cos.exe && cd ..
|
||||
$(TESTCOMPILE)tsinh.c $(MIDTESTCOMPILE)tsinh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsinh.exe && cd ..
|
||||
$(TESTCOMPILE)tsqr.c $(MIDTESTCOMPILE)tsqr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsqr.exe && cd ..
|
||||
$(TESTCOMPILE)tsqrt.c $(MIDTESTCOMPILE)tsqrt.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsqrt.exe && cd ..
|
||||
$(TESTCOMPILE)tstrtoc.c $(MIDTESTCOMPILE)tstrtoc.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tstrtoc.exe && cd ..
|
||||
$(TESTCOMPILE)tsub.c $(MIDTESTCOMPILE)tsub.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsub.exe && cd ..
|
||||
$(TESTCOMPILE)tsub_fr.c $(MIDTESTCOMPILE)tsub_fr.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsub_fr.exe && cd ..
|
||||
$(TESTCOMPILE)tsub_ui.c $(MIDTESTCOMPILE)tsub_ui.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tsub_ui.exe && cd ..
|
||||
$(TESTCOMPILE)tswap.c $(MIDTESTCOMPILE)tswap.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tswap.exe && cd ..
|
||||
$(TESTCOMPILE)ttan.c $(MIDTESTCOMPILE)ttan.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && ttan.exe && cd ..
|
||||
$(TESTCOMPILE)ttanh.c $(MIDTESTCOMPILE)ttanh.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && ttanh.exe && cd ..
|
||||
$(TESTCOMPILE)tui_div.c $(MIDTESTCOMPILE)tui_div.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tui_div.exe && cd ..
|
||||
$(TESTCOMPILE)tui_ui_sub.c $(MIDTESTCOMPILE)tui_ui_sub.exe $(ENDTESTCOMPILE)
|
||||
cd $(DIRMPCTESTS) && tui_ui_sub.exe && cd ..
|
||||
@echo --------------------------------------------------
|
||||
@echo All tests passed
|
||||
@echo --------------------------------------------------
|
|
@ -0,0 +1,148 @@
|
|||
Changes in version 1.0.1:
|
||||
- Switched to automake 1.11.6, see
|
||||
https://lists.gnu.org/archive/html/automake/2012-07/msg00023.html
|
||||
- #14669: Fixed extraction of CC from gmp.h
|
||||
- Fixed case of intermediate zero real or imaginary part in mpc_fma,
|
||||
found by hydra with GMP_CHECK_RANDOMIZE=1346362345
|
||||
|
||||
Changes in version 1.0:
|
||||
- First release as a GNU package
|
||||
- License change: LGPLv3+ for code, GFDLv1.3+ (with no invariant sections)
|
||||
for documentation
|
||||
- 100% of all lines are covered by tests
|
||||
- Functions renamed:
|
||||
mpc_mul_2exp to mpc_mul_2ui, mpc_div_2exp to mpc_div_2ui
|
||||
- 0^0, which returned (NaN,NaN) previously, now returns (1,+0)
|
||||
- Removed compatibility with K&R compilers, untestable due to lack of
|
||||
such compilers
|
||||
- New functions: mpc_log10, mpc_mul_2si, mpc_div_2si
|
||||
- Speed-ups:
|
||||
- mpc_fma
|
||||
- Bug fixes:
|
||||
- mpc_div and mpc_norm now return a value indicating the effective
|
||||
rounding direction, as the other functions
|
||||
- mpc_mul, mpc_sqr and mpc_norm now return correct results even if there
|
||||
are over- or underflows during the computation
|
||||
- mpc_asin, mpc_proj, mpc_sqr: Wrong result when input variable has
|
||||
infinite part and equals output variable is corrected
|
||||
- mpc_fr_sub: Wrong return value for imaginary part is corrected
|
||||
|
||||
Changes in version 0.9:
|
||||
- New functions:
|
||||
- mpc_set_dc, mpc_set_ldc, mpc_get_dc, mpc_get_ldc for converting
|
||||
between mpc type variables and C variables of type double _Complex
|
||||
or long double _Complex
|
||||
- mpc_sin_cos, computing simultaneously the sine and cosine
|
||||
- Speed-ups:
|
||||
- mpc_pow_si through binary exponentiation
|
||||
- mpc_pow_z when the exponent fits in a long
|
||||
- mpc_tan through the use of mpc_sin_cos
|
||||
- Bug fixes:
|
||||
- trigonometric functions: infinite loop due to overflow for large
|
||||
arguments
|
||||
- mpc_exp: close to infinite loop for argument close to 0
|
||||
- mpc_sqrt: close to infinite loop for argument close to 1
|
||||
- mpc_add_si: replaced macro by function, since the macro evaluated the
|
||||
same expression twice
|
||||
- Logging feature for debugging:
|
||||
./configure --enable-logging
|
||||
#include "mpc-log.h" instead of #include "mpc.h"
|
||||
- Minimally required library versions: gmp 4.3.2, mpfr 2.4.2
|
||||
|
||||
Changes in version 0.8.2:
|
||||
- Speed-up of mpc_pow_ui through binary exponentiation
|
||||
|
||||
Changes in version 0.8.1:
|
||||
- Bug fixes:
|
||||
- mpc_acosh, mpc_asinh, mpc_atanh: swap of precisions between real and
|
||||
imaginary parts
|
||||
- mpc_atan: memory leak
|
||||
- mpc_log: wrong ternary value in data file; masked by bug in mpfr-2.4.1
|
||||
|
||||
Changes in version 0.8 ("Dianthus deltoides"):
|
||||
- New functions:
|
||||
- mpc_asin, mpc_acos, mpc_atan, mpc_asinh, mpc_acosh, mpc_atanh,
|
||||
mpc_pow_d, mpc_pow_ld, mpc_pow_si, mpc_pow_ui, mpc_pow_z, mpc_pow_fr
|
||||
- Bug fixes:
|
||||
- mpc_ui_div: real divisor
|
||||
|
||||
Changes in version 0.7 ("Campanula uniflora"):
|
||||
- New functions: mpc_pow, mpc_set_nan, mpc_swap
|
||||
- Bug fixes:
|
||||
- mpc_log: along branch cut
|
||||
- mpc_norm: infinite loop in case of overflow
|
||||
- mpc_ui_div, mpc_div, mpc_fr_div: handling of division by 0 and
|
||||
infinities following the example code of the C99 standard
|
||||
- compilation with g++
|
||||
- Makefile.vc updated (thanks to Mickael Gastineau)
|
||||
- Minimal gmp version is 4.2
|
||||
- Changed MPC_SET_X_Y macro
|
||||
- Functions mpc_random and mpc_random2 removed
|
||||
|
||||
Changes in version 0.6 ("Bellis perennis"):
|
||||
- New functions: mpc_get_str, mpc_set_str, mpc_strtoc, mpc_set_uj,
|
||||
mpc_set_sj, mpc_set_ld, mpc_set_ld_ld, mpc_set_si_si, mpc_set_uj_uj,
|
||||
mpc_set_sj_sj, mpc_set_f, mpc_set_f_f, mpc_set_q, mpc_set_q_q, mpc_set_z,
|
||||
mpc_set_z_z and mpc_free_str
|
||||
- New macro: MPC_SET_X_Y
|
||||
- mpc_set_ui_fr removed
|
||||
- Default precision removed, as well as mpc_init and all mpc_init_set*
|
||||
combinations; use mpc_init2 or mpc_init3, followed by mpc_set, instead
|
||||
- mpc_exp, mpc_log, mpc_cos, mpc_sin, mpc_tan, mpc_cosh, mpc_sinh,
|
||||
mpc_tanh and mpc_sqrt return inexact value
|
||||
- inp_str returns inexact value and the number of read characters
|
||||
in an additional parameter
|
||||
- Get default $CC and $CFLAGS from gmp.h (__GMP_CC / __GMP_CFLAGS,
|
||||
which are available as of GMP 4.2.3)
|
||||
- Bug fixes:
|
||||
- mpc_get_version and MPC_VERSION_STRING agree
|
||||
- Compilation on i686-pc-cygwin and i686-pc-mingw32 fixed
|
||||
|
||||
Changes in version 0.5.2:
|
||||
- New macros:
|
||||
- version number: MPC_VERSION_NUM, MPC_VERSION
|
||||
- Makefile.vc updated (thanks to Mickael Gastineau)
|
||||
- Compilation on Debian-Gnu-Linux-PowerPC and MacOsX
|
||||
fixed (thanks to Laurent Fousse and Mickael Gastineau)
|
||||
|
||||
Changes in version 0.5.1:
|
||||
- New functions:
|
||||
- mpc_set_fr_fr
|
||||
- mpc_real, mpc_imag
|
||||
- mpc_arg, mpc_proj
|
||||
- New macros:
|
||||
- version number: MPC_VERSION_MAJOR, MPC_VERSION_MINOR,
|
||||
MPC_VERSION_PATCHLEVEL, MPC_VERSION_STRING
|
||||
- references to number parts: mpc_realref and mpc_imagref
|
||||
- Test framework rewritten
|
||||
- Configure checks for recent gmp (>= 4.2) and mpfr (>= 2.3.1)
|
||||
libraries
|
||||
- New configure options: --with-gmp-lib, --with-gmp-include,
|
||||
--with-mpfr-lib, and --with-mpfr-include
|
||||
- Export declarations for MSWindows, makefile.vc updated (thanks to
|
||||
Mickael Gastineau)
|
||||
- Optimisations:
|
||||
- cmp_mul_fr, cmp_sin, cmp_cos
|
||||
- Bug fixes:
|
||||
- configure looks for gmp first, then for mpfr
|
||||
- mpc_cos, mpc_div, mpc_div_fr, mpc_fr_sub, mpc_mul_fr, mpc_set_fr,
|
||||
mpc_sqr
|
||||
- fix handling of special values: mpc_exp, mpc_log, mpc_mul, mpc_norm,
|
||||
mpc_sqr, mpc_sqrt
|
||||
|
||||
Changes in version 0.5 ("Aconitum neomontanum"):
|
||||
- Support for autotools
|
||||
- New functions:
|
||||
- logarithm
|
||||
- trigonometric functions: mpc_cos, mpc_tan
|
||||
- hyperbolic functions: mpc_cosh, mpc_sinh, mpc_tanh
|
||||
- Bug fixes:
|
||||
- mpc_sqrt with directed rounding
|
||||
|
||||
|
||||
Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without any warranty.
|
|
@ -0,0 +1,11 @@
|
|||
Copyright (C) INRIA 2003, 2005, 2008, 2009, 2011
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without any warranty.
|
||||
|
||||
|
||||
GNU MPC is a complex floating-point library with exact rounding.
|
||||
It is based on the GNU MPFR floating-point library (http://www.mpfr.org/),
|
||||
which is itself based on the GNU MP library (http://gmplib.org/).
|
|
@ -0,0 +1,40 @@
|
|||
From Andreas Enge 31 August 2011:
|
||||
implement mul_karatsuba with three multiplications at precision around p,
|
||||
instead of two at precision 2*p and one at precision p
|
||||
requires analysis of error propagation
|
||||
|
||||
From Andreas Enge 30 August 2011:
|
||||
As soon as dependent on mpfr>=3, remove auxiliary functions from
|
||||
get_version.c and update mpc.h.
|
||||
Use MPFR_RND? instead of GMP_RND?, and remove workarounds for MPFR_RNDA from
|
||||
mpc-impl.h.
|
||||
|
||||
From Andreas Enge 05 July 2012:
|
||||
Add support for rounding mode MPFR_RNDA.
|
||||
|
||||
From Andreas Enge and Paul Zimmermann 6 July 2012:
|
||||
Improve speed of Im (atan) for x+i*y with small y, for instance by using
|
||||
the Taylor series directly.
|
||||
|
||||
Bench:
|
||||
- from Andreas Enge 9 June 2009:
|
||||
Scripts and web page comparing timings with different systems,
|
||||
as done for mpfr at http://www.mpfr.org/mpfr-2.4.0/timings.html
|
||||
|
||||
New functions to implement:
|
||||
- from Joseph S. Myers <joseph at codesourcery dot com> 19 Mar 2012: mpc_erf,
|
||||
mpc_erfc, mpc_exp2, mpc_expm1, mpc_log1p, mpc_log2, mpc_lgamma, mpc_tgamma
|
||||
http://lists.gforge.inria.fr/pipermail/mpc-discuss/2012-March/001090.html
|
||||
- from Andreas Enge and Philippe Théveny 17 July 2008
|
||||
agm (and complex logarithm with agm ?)
|
||||
- from Andreas Enge 25 June 2009:
|
||||
correctly rounded roots of unity zeta_n^i
|
||||
- implement a root-finding algorithm using the Durand-Kerner method
|
||||
(cf http://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method)
|
||||
See also the CEVAL algorithm from Yap and Sagraloff:
|
||||
http://www.mpi-inf.mpg.de/~msagralo/ceval.pdf
|
||||
|
||||
New tests to add:
|
||||
- from Andreas Enge and Philippe Théveny 9 April 2008
|
||||
correct handling of Nan and infinities in the case of
|
||||
intermediate overflows while the result may fit (we need special code)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,270 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010, 2012 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv in
|
||||
mingw)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,123 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* complex.h present and usable */
|
||||
#undef HAVE_COMPLEX_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `dup' function. */
|
||||
#undef HAVE_DUP
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if the system has the type `intptr_t'. */
|
||||
#undef HAVE_INTPTR_T
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Library dl present */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the `localeconv' function. */
|
||||
#undef HAVE_LOCALECONV
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* C compiler */
|
||||
#undef MPC_CC
|
||||
|
||||
/* Gcc yes or no */
|
||||
#undef MPC_GCC
|
||||
|
||||
/* Version of gcc */
|
||||
#undef MPC_GCC_VERSION
|
||||
|
||||
/* Do not check mpc_out_str on stdout */
|
||||
#undef MPC_NO_STREAM_REDIRECTION
|
||||
|
||||
/* Use valgrind for make check */
|
||||
#undef MPC_USE_VALGRIND
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to the type of a signed integer type wide enough to hold a pointer,
|
||||
if such a type exists, and if the system does not define it. */
|
||||
#undef intptr_t
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,242 @@
|
|||
# Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
#
|
||||
# This file is part of GNU MPC.
|
||||
#
|
||||
# GNU MPC 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 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT(mpc, 1.0.1, mpc-discuss@lists.gforge.inria.fr)
|
||||
AC_CONFIG_SRCDIR([src/mpc-impl.h])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 -Wall -Werror])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
USER_CC=$CC
|
||||
USER_CFLAGS=$CFLAGS
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
|
||||
# Extra arguments to configure
|
||||
AC_ARG_WITH([mpfr_include],
|
||||
[AC_HELP_STRING([--with-mpfr-include=DIR],
|
||||
[MPFR include directory])],
|
||||
[CPPFLAGS="-I$withval $CPPFLAGS"])
|
||||
AC_ARG_WITH([mpfr_lib],
|
||||
[AC_HELP_STRING([--with-mpfr-lib=DIR],
|
||||
[MPFR lib directory])],
|
||||
[LDFLAGS="-L$withval $LDFLAGS"])
|
||||
AC_ARG_WITH([mpfr],
|
||||
[AC_HELP_STRING([--with-mpfr=DIR],
|
||||
[MPFR install directory])],
|
||||
[
|
||||
if test -z "$with_mpfr_include" -a -z "$with_mpfr_lib" ; then
|
||||
CPPFLAGS="-I$withval/include $CPPFLAGS"
|
||||
LDFLAGS="-L$withval/lib $LDFLAGS"
|
||||
else
|
||||
AC_MSG_FAILURE([Do not use --with-mpfr and --with-mpfr-include/--with-mpfr-lib options simultaneously.])
|
||||
fi
|
||||
])
|
||||
AC_ARG_WITH([gmp_include],
|
||||
[AC_HELP_STRING([--with-gmp-include=DIR],
|
||||
[GMP include directory])],
|
||||
[CPPFLAGS="-I$withval $CPPFLAGS"])
|
||||
AC_ARG_WITH([gmp_lib],
|
||||
[AC_HELP_STRING([--with-gmp-lib=DIR],
|
||||
[GMP lib directory])],
|
||||
[LDFLAGS="-L$withval $LDFLAGS"])
|
||||
AC_ARG_WITH([gmp],
|
||||
[AC_HELP_STRING([--with-gmp=DIR],
|
||||
[GMP install directory])],
|
||||
[
|
||||
if test -z "$with_gmp_lib" -a -z "$with_gmp_include" ; then
|
||||
CPPFLAGS="-I$withval/include $CPPFLAGS"
|
||||
LDFLAGS="-L$withval/lib $LDFLAGS"
|
||||
else
|
||||
AC_MSG_FAILURE([Do not use --with-gmp and --with-gmp-include/--with-gmp-lib options simultaneously.])
|
||||
fi
|
||||
])
|
||||
AC_ARG_ENABLE([logging],
|
||||
[AC_HELP_STRING([--enable-logging],
|
||||
[enable logging of function calls to stderr (default = no)])],
|
||||
[case $enableval in
|
||||
yes) AS_IF([test "x$enable_shared" = "xno"],
|
||||
AC_MSG_ERROR([Logging works only with shared libraries; do not mix --enable-logging and --disable-shared])) ;;
|
||||
no) ;;
|
||||
*) AC_MSG_ERROR([Bad value for --enable-logging: Use yes or no]) ;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
AC_ARG_ENABLE([valgrind-tests],
|
||||
[AC_HELP_STRING([--enable-valgrind-tests],
|
||||
[run checks through valgrind (default = no)])],
|
||||
[case $enableval in
|
||||
yes) gl_VALGRIND_TESTS ;;
|
||||
no) ;;
|
||||
*) AC_MSG_ERROR([Bad value for --enable-valgrind-tests: Use yes or no]) ;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
|
||||
# Check for CC and CFLAGS in gmp.h unless the user specified one of them
|
||||
# look for EGREP and SED here, see continued problem
|
||||
# at http://lists.gforge.inria.fr/pipermail/mpc-discuss/2012-January/001056.html
|
||||
AC_PROG_EGREP
|
||||
AC_PROG_SED
|
||||
if test -z "$USER_CC" && test -z "$USER_CFLAGS"; then
|
||||
MPC_GMP_CC_CFLAGS
|
||||
fi
|
||||
|
||||
# Setup CC and CFLAGS
|
||||
AC_PROG_CC
|
||||
AC_LANG(C)
|
||||
|
||||
# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
|
||||
# Set up LibTool
|
||||
LT_INIT
|
||||
|
||||
# Check GMP Header
|
||||
AC_MSG_CHECKING(for gmp.h)
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include "gmp.h"
|
||||
]])],[AC_MSG_RESULT(yes)],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([gmp.h cannot be found or is unusable.])
|
||||
])
|
||||
|
||||
# Check (only in development versions) if the compiler accepts warning
|
||||
# flags and add them to CFLAGS
|
||||
# Note: don't do this if the user defined CFLAGS, since adding new flags
|
||||
# might override the user's settings, see
|
||||
# http://lists.gforge.inria.fr/pipermail/mpc-discuss/2012-May/001115.html
|
||||
if test -z "$USER_CFLAGS"; then
|
||||
MPC_C_CHECK_WARNINGCFLAGS
|
||||
fi
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([locale.h inttypes.h stdint.h limits.h unistd.h sys/time.h])
|
||||
AC_HEADER_TIME
|
||||
MPC_COMPLEX_H
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_FUNCS([gettimeofday localeconv setlocale])
|
||||
AC_CHECK_FUNCS([dup dup2],,
|
||||
[AC_DEFINE([MPC_NO_STREAM_REDIRECTION],1,[Do not check mpc_out_str on stdout])])
|
||||
|
||||
AC_CHECK_LIB([gmp], [__gmpz_init],
|
||||
[LIBS="-lgmp $LIBS"],
|
||||
[AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).])])
|
||||
|
||||
AC_MSG_CHECKING(for MPFR)
|
||||
LIBS="-lmpfr $LIBS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include "mpfr.h"]],
|
||||
[[mpfr_t x; mpfr_init(x) ; mpfr_clear(x);]]
|
||||
)],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([libmpfr not found or uses a different ABI (including static vs shared).])
|
||||
])
|
||||
|
||||
# Check for a recent GMP
|
||||
# We only guarantee that with a *functional* and recent enough GMP version,
|
||||
# MPC will compile; we do not guarantee that GMP will compile.
|
||||
# In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0
|
||||
# (at least on 64-bit Core 2 under GNU/Linux),
|
||||
# see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html.
|
||||
AC_MSG_CHECKING(for recent GMP)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE(
|
||||
[[
|
||||
#include "gmp.h"
|
||||
#if (__GNU_MP_VERSION*100 + __GNU_MP_VERSION_MINOR*10 + __GNU_MP_VERSION_PATCHLEVEL < 432)
|
||||
# error "Minimal GMP version is 4.3.2"
|
||||
error
|
||||
#endif
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([GMP version >= 4.3.2 required])
|
||||
])
|
||||
|
||||
# Check for a recent MPFR: we require MPFR 2.4.2 so that the tests
|
||||
# in log.dat pass
|
||||
# The same remark as above for GMP applies.
|
||||
AC_MSG_CHECKING(for recent MPFR)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE(
|
||||
[[
|
||||
#include "mpfr.h"
|
||||
#if (MPFR_VERSION < MPFR_VERSION_NUM (2,4,2))
|
||||
# error "Minimal MPFR version is 2.4.2"
|
||||
error
|
||||
#endif
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([MPFR version >= 2.4.2 required])
|
||||
])
|
||||
|
||||
# Check for logging feature
|
||||
AS_IF([test "x$enable_logging" = "xyes"],
|
||||
[AC_CHECK_HEADERS([dlfcn.h])
|
||||
AC_CHECK_LIB([dl],[dlsym],
|
||||
[
|
||||
AC_DEFINE(HAVE_LIBDL, 1, [Library dl present])
|
||||
LIBS="-ldl $LIBS"
|
||||
AC_TYPE_INTPTR_T
|
||||
AC_LIBOBJ([logging])
|
||||
AC_SUBST([MPC_LOG_H],[src/mpc-log.h])
|
||||
],
|
||||
[AC_MSG_ERROR([Library dl not found, logging impossible])])
|
||||
]
|
||||
)
|
||||
|
||||
# Configs for Windows DLLs
|
||||
AC_SUBST(MPC_LDFLAGS)
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
||||
MPC_WINDOWS
|
||||
esac
|
||||
|
||||
# Checks for gcc version, result in variables MPC_GCC etc. inside config.log
|
||||
AX_GCC_VERSION
|
||||
AC_DEFINE_UNQUOTED([MPC_GCC], ["$GCC"], [Gcc yes or no])
|
||||
AC_DEFINE_UNQUOTED([MPC_CC], ["$CC"], [C compiler])
|
||||
AC_DEFINE_UNQUOTED([MPC_GCC_VERSION], ["$GCC_VERSION"], [Version of gcc])
|
||||
|
||||
# Looks for svn version if the version string contains "dev"
|
||||
MPC_SVNVERSION
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])
|
||||
AC_OUTPUT
|
|
@ -0,0 +1,708 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2012-03-27.16; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
|
||||
# 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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 General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' "$nl" < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
|
||||
# However on
|
||||
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\':
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
# tcc 0.9.26 (FIXME still under development at the moment of writing)
|
||||
# will emit a similar output, but also prepend the continuation lines
|
||||
# with horizontal tabulation characters.
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form 'foo.o: dependent.h',
|
||||
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
|
||||
< "$tmpdepfile" > "$depfile"
|
||||
sed '
|
||||
s/[ '"$tab"'][ '"$tab"']*/ /g
|
||||
s/^ *//
|
||||
s/ *\\*$//
|
||||
s/^[^:]*: *//
|
||||
/^$/d
|
||||
/:$/d
|
||||
s/$/ :/
|
||||
' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test "$stat" = 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,20 @@
|
|||
## doc/Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## Copyright (C) 2008 INRIA
|
||||
##
|
||||
## This file is part of GNU MPC.
|
||||
##
|
||||
## GNU MPC 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 3 of the License, or (at your
|
||||
## option) any later version.
|
||||
##
|
||||
## GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
info_TEXINFOS = mpc.texi
|
|
@ -0,0 +1,701 @@
|
|||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/stamp-vti $(srcdir)/version.texi mdate-sh \
|
||||
texinfo.tex
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c_check_flag.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_option.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_version.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/mpc.m4 $(top_srcdir)/m4/valgrind-tests.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
INFO_DEPS = $(srcdir)/mpc.info
|
||||
am__TEXINFO_TEX_DIR = $(srcdir)
|
||||
DVIS = mpc.dvi
|
||||
PDFS = mpc.pdf
|
||||
PSS = mpc.ps
|
||||
HTMLS = mpc.html
|
||||
TEXINFOS = mpc.texi
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXI2PDF = $(TEXI2DVI) --pdf --batch
|
||||
MAKEINFOHTML = $(MAKEINFO) --html
|
||||
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
|
||||
DVIPS = dvips
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__installdirs = "$(DESTDIR)$(infodir)"
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
GREP = @GREP@
|
||||
HASSVNVERSION = @HASSVNVERSION@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MPC_LDFLAGS = @MPC_LDFLAGS@
|
||||
MPC_LOG_H = @MPC_LOG_H@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SVNVERSION = @SVNVERSION@
|
||||
VALGRIND = @VALGRIND@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
info_TEXINFOS = mpc.texi
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .html .info .pdf .ps .texi
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu doc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
.texi.info:
|
||||
restore=: && backupdir="$(am__leading_dot)am$$$$" && \
|
||||
am__cwd=`pwd` && $(am__cd) $(srcdir) && \
|
||||
rm -rf $$backupdir && mkdir $$backupdir && \
|
||||
if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
|
||||
for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
|
||||
if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
|
||||
done; \
|
||||
else :; fi && \
|
||||
cd "$$am__cwd"; \
|
||||
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
|
||||
-o $@ $<; \
|
||||
then \
|
||||
rc=0; \
|
||||
$(am__cd) $(srcdir); \
|
||||
else \
|
||||
rc=$$?; \
|
||||
$(am__cd) $(srcdir) && \
|
||||
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
|
||||
fi; \
|
||||
rm -rf $$backupdir; exit $$rc
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
|
||||
$(TEXI2DVI) $<
|
||||
|
||||
.texi.pdf:
|
||||
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
|
||||
$(TEXI2PDF) $<
|
||||
|
||||
.texi.html:
|
||||
rm -rf $(@:.html=.htp)
|
||||
if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
|
||||
-o $(@:.html=.htp) $<; \
|
||||
then \
|
||||
rm -rf $@; \
|
||||
if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
|
||||
mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
|
||||
else \
|
||||
if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
|
||||
rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(srcdir)/mpc.info: mpc.texi $(srcdir)/version.texi
|
||||
mpc.dvi: mpc.texi $(srcdir)/version.texi
|
||||
mpc.pdf: mpc.texi $(srcdir)/version.texi
|
||||
mpc.html: mpc.texi $(srcdir)/version.texi
|
||||
$(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti
|
||||
$(srcdir)/stamp-vti: mpc.texi $(top_srcdir)/configure
|
||||
@(dir=.; test -f ./mpc.texi || dir=$(srcdir); \
|
||||
set `$(SHELL) $(srcdir)/mdate-sh $$dir/mpc.texi`; \
|
||||
echo "@set UPDATED $$1 $$2 $$3"; \
|
||||
echo "@set UPDATED-MONTH $$2 $$3"; \
|
||||
echo "@set EDITION $(VERSION)"; \
|
||||
echo "@set VERSION $(VERSION)") > vti.tmp
|
||||
@cmp -s vti.tmp $(srcdir)/version.texi \
|
||||
|| (echo "Updating $(srcdir)/version.texi"; \
|
||||
cp vti.tmp $(srcdir)/version.texi)
|
||||
-@rm -f vti.tmp
|
||||
@cp $(srcdir)/version.texi $@
|
||||
|
||||
mostlyclean-vti:
|
||||
-rm -f vti.tmp
|
||||
|
||||
maintainer-clean-vti:
|
||||
@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
.dvi.ps:
|
||||
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
|
||||
$(DVIPS) -o $@ $<
|
||||
|
||||
uninstall-dvi-am:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(dvidir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-html-am:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
|
||||
rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-info-am:
|
||||
@$(PRE_UNINSTALL)
|
||||
@if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
|
||||
if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
|
||||
then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
|
||||
done; \
|
||||
else :; fi
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
(if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
|
||||
echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
|
||||
rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
|
||||
else :; fi); \
|
||||
done
|
||||
|
||||
uninstall-pdf-am:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-ps-am:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(PSS)'; test -n "$(psdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(psdir)/$$f"; \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
case $$base in \
|
||||
$(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
esac; \
|
||||
if test -f $$base; then d=.; else d=$(srcdir); fi; \
|
||||
base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
|
||||
if test -f $$file; then \
|
||||
relfile=`expr "$$file" : "$$d/\(.*\)"`; \
|
||||
test -f "$(distdir)/$$relfile" || \
|
||||
cp -p $$file "$(distdir)/$$relfile"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -rf mpc.aux mpc.cp mpc.cps mpc.fn mpc.fns mpc.ky mpc.kys mpc.log mpc.pg \
|
||||
mpc.pgs mpc.tmp mpc.toc mpc.tp mpc.vr mpc.vrs
|
||||
|
||||
clean-aminfo:
|
||||
-test -z "mpc.dvi mpc.pdf mpc.ps mpc.html" \
|
||||
|| rm -rf mpc.dvi mpc.pdf mpc.ps mpc.html
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
@list='$(INFO_DEPS)'; for i in $$list; do \
|
||||
i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
|
||||
rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-info
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(INFO_DEPS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(infodir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am: $(DVIS)
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am: $(HTMLS)
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am: $(INFO_DEPS)
|
||||
|
||||
install-data-am: install-info-am
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am: $(DVIS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
|
||||
done
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am: $(HTMLS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
$(am__strip_dir) \
|
||||
d2=$$d$$p; \
|
||||
if test -d "$$d2"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
|
||||
echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
|
||||
$(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
|
||||
else \
|
||||
list2="$$list2 $$d2"; \
|
||||
fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
|
||||
done; }
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
|
||||
fi; \
|
||||
for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
esac; \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
|
||||
for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
|
||||
$$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
|
||||
if test -f $$ifile; then \
|
||||
echo "$$ifile"; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
|
||||
@$(POST_INSTALL)
|
||||
@if $(am__can_run_installinfo); then \
|
||||
list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
|
||||
for file in $$list; do \
|
||||
relfile=`echo "$$file" | sed 's|^.*/||'`; \
|
||||
echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am: $(PDFS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am: $(PSS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(PSS)'; test -n "$(psdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
|
||||
maintainer-clean-generic maintainer-clean-vti
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
|
||||
mostlyclean-libtool mostlyclean-vti
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am: $(PDFS)
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am: $(PSS)
|
||||
|
||||
uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
|
||||
uninstall-pdf-am uninstall-ps-am
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
|
||||
clean-libtool dist-info distclean distclean-generic \
|
||||
distclean-libtool distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-aminfo \
|
||||
maintainer-clean-generic maintainer-clean-vti mostlyclean \
|
||||
mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool \
|
||||
mostlyclean-vti pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-dvi-am uninstall-html-am uninstall-info-am \
|
||||
uninstall-pdf-am uninstall-ps-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,506 @@
|
|||
@c The GNU Free Documentation License.
|
||||
@center Version 1.3, 3 November 2008
|
||||
|
||||
@c This file is intended to be included within another document,
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
@uref{http://fsf.org/}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document @dfn{free} in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft'', which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The ``Document'', below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as ``you''. You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, La@TeX{} input
|
||||
format, SGML or XML using a publicly available
|
||||
DTD, and standard-conforming simple HTML,
|
||||
PostScript or PDF designed for human modification. Examples
|
||||
of transparent image formats include PNG, XCF and
|
||||
JPG. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, SGML or
|
||||
XML for which the DTD and/or processing tools are
|
||||
not generally available, and the machine-generated HTML,
|
||||
PostScript or PDF produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
The ``publisher'' means any person or entity that distributes copies
|
||||
of the Document to the public.
|
||||
|
||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as ``Acknowledgements'',
|
||||
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section ``Entitled XYZ'' according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
@enumerate A
|
||||
@item
|
||||
Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
|
||||
@item
|
||||
List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
|
||||
@item
|
||||
State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
@item
|
||||
Preserve all the copyright notices of the Document.
|
||||
|
||||
@item
|
||||
Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
@item
|
||||
Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
|
||||
@item
|
||||
Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
|
||||
@item
|
||||
Include an unaltered copy of this License.
|
||||
|
||||
@item
|
||||
Preserve the section Entitled ``History'', Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
|
||||
@item
|
||||
Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
|
||||
@item
|
||||
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
|
||||
the Title of the section, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements and/or
|
||||
dedications given therein.
|
||||
|
||||
@item
|
||||
Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
|
||||
@item
|
||||
Delete any section Entitled ``Endorsements''. Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
@item
|
||||
Do not retitle any existing section to be Entitled ``Endorsements'' or
|
||||
to conflict in title with any Invariant Section.
|
||||
|
||||
@item
|
||||
Preserve any Warranty Disclaimers.
|
||||
@end enumerate
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled ``Endorsements'', provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties---for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled ``History''
|
||||
in the various original documents, forming one section Entitled
|
||||
``History''; likewise combine any sections Entitled ``Acknowledgements'',
|
||||
and any sections Entitled ``Dedications''. You must delete all
|
||||
sections Entitled ``Endorsements.''
|
||||
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an ``aggregate'' if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled ``Acknowledgements'',
|
||||
``Dedications'', or ``History'', the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
@uref{http://www.gnu.org/copyleft/}.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
@item
|
||||
RELICENSING
|
||||
|
||||
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
|
||||
site means any set of copyrightable works thus published on the MMC
|
||||
site.
|
||||
|
||||
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
``Incorporate'' means to publish or republish a Document, in whole or
|
||||
in part, as part of another Document.
|
||||
|
||||
An MMC is ``eligible for relicensing'' if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole
|
||||
or in part into the MMC, (1) had no cover texts or invariant sections,
|
||||
and (2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@page
|
||||
@heading ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with@dots{}Texts.'' line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
with the Invariant Sections being @var{list their titles}, with
|
||||
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
|
||||
being @var{list}.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
@c Local Variables:
|
||||
@c ispell-local-pdict: "ispell-dict"
|
||||
@c End:
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No file. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: mdate-sh [--help] [--version] FILE
|
||||
|
||||
Pretty-print the modification time of FILE.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "mdate-sh $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# GNU ls changes its time format in response to the TIME_STYLE
|
||||
# variable. Since we cannot assume `unset' works, revert this
|
||||
# variable to its documented default.
|
||||
if test "${TIME_STYLE+set}" = set; then
|
||||
TIME_STYLE=posix-long-iso
|
||||
export TIME_STYLE
|
||||
fi
|
||||
|
||||
save_arg1=$1
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
# Avoid user/group names that might have spaces, when possible.
|
||||
if ls -n /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command="$ls_command -n"
|
||||
fi
|
||||
|
||||
# A `ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named `Jan', or `Feb', etc. However, it's unlikely that `/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set x`$ls_command /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set dummy x`eval "$ls_command \"\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Because of the dummy argument above, month is in $2.
|
||||
#
|
||||
# On a POSIX system, we should have
|
||||
#
|
||||
# $# = 5
|
||||
# $1 = file size
|
||||
# $2 = month
|
||||
# $3 = day
|
||||
# $4 = year or time
|
||||
# $5 = filename
|
||||
#
|
||||
# On Darwin 7.7.0 and 7.6.0, we have
|
||||
#
|
||||
# $# = 4
|
||||
# $1 = day
|
||||
# $2 = month
|
||||
# $3 = year or time
|
||||
# $4 = filename
|
||||
|
||||
# Get the month.
|
||||
case $2 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
case $3 in
|
||||
???*) day=$1;;
|
||||
*) day=$3; shift;;
|
||||
esac
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
@set UPDATED 6 September 2012
|
||||
@set UPDATED-MONTH September 2012
|
||||
@set EDITION 1.0.1
|
||||
@set VERSION 1.0.1
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
@set UPDATED 6 September 2012
|
||||
@set UPDATED-MONTH September 2012
|
||||
@set EDITION 1.0.1
|
||||
@set VERSION 1.0.1
|
|
@ -0,0 +1,527 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-01-19.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,86 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_c_check_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_C_CHECK_FLAG(FLAG-TO-CHECK,[PROLOGUE],[BODY],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro tests if the C compiler supports the flag FLAG-TO-CHECK. If
|
||||
# successfull execute ACTION-IF-SUCCESS otherwise ACTION-IF-FAILURE.
|
||||
# PROLOGUE and BODY are optional and should be used as in AC_LANG_PROGRAM
|
||||
# macro.
|
||||
#
|
||||
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
|
||||
# Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program 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 General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_C_CHECK_FLAG],[
|
||||
AC_PREREQ([2.61])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
|
||||
flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
|
||||
|
||||
AC_CACHE_CHECK([whether the C compiler accepts the $1 flag],
|
||||
[ax_cv_c_check_flag_$flag],[
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([$2],[$3])
|
||||
],[
|
||||
eval "ax_cv_c_check_flag_$flag=yes"
|
||||
],[
|
||||
eval "ax_cv_c_check_flag_$flag=no"
|
||||
])
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_LANG_POP
|
||||
|
||||
])
|
||||
|
||||
AS_IF([eval "test \"`echo '$ax_cv_c_check_flag_'$flag`\" = yes"],[
|
||||
:
|
||||
$4
|
||||
],[
|
||||
:
|
||||
$5
|
||||
])
|
||||
])
|
|
@ -0,0 +1,130 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_gcc_option.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# OBSOLETE MACRO
|
||||
#
|
||||
# Deprecated in favor of AX_C_CHECK_FLAG, AX_CXX_CHECK_FLAG,
|
||||
# AX_CPP_CHECK_FLAG, AX_CXXCPP_CHECK_FLAG and AX_LD_CHECK_FLAG.
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_GCC_OPTION(OPTION,EXTRA-OPTIONS,TEST-PROGRAM,ACTION-IF-SUCCESSFUL,ACTION-IF-NOT-SUCCESFUL)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_GCC_OPTION checks wheter gcc accepts the passed OPTION. If it accepts
|
||||
# the OPTION then ACTION-IF-SUCCESSFUL will be executed, otherwise
|
||||
# ACTION-IF-UNSUCCESSFUL.
|
||||
#
|
||||
# A typical usage should be the following one:
|
||||
#
|
||||
# AX_GCC_OPTION([-fomit-frame-pointer],[],[],[
|
||||
# AC_MSG_NOTICE([The option is supported])],[
|
||||
# AC_MSG_NOTICE([No luck this time])
|
||||
# ])
|
||||
#
|
||||
# The macro doesn't discriminate between languages so, if you are testing
|
||||
# for an option that works for C++ but not for C you should use '-x c++'
|
||||
# as EXTRA-OPTIONS:
|
||||
#
|
||||
# AX_GCC_OPTION([-fno-rtti],[-x c++],[],[ ... ],[ ... ])
|
||||
#
|
||||
# OPTION is tested against the following code:
|
||||
#
|
||||
# int main()
|
||||
# {
|
||||
# return 0;
|
||||
# }
|
||||
#
|
||||
# The optional TEST-PROGRAM comes handy when the default main() is not
|
||||
# suited for the option being checked
|
||||
#
|
||||
# So, if you need to test for -fstrict-prototypes option you should
|
||||
# probably use the macro as follows:
|
||||
#
|
||||
# AX_GCC_OPTION([-fstrict-prototypes],[-x c++],[
|
||||
# int main(int argc, char ** argv)
|
||||
# {
|
||||
# (void) argc;
|
||||
# (void) argv;
|
||||
#
|
||||
# return 0;
|
||||
# }
|
||||
# ],[ ... ],[ ... ])
|
||||
#
|
||||
# Note that the macro compiles but doesn't link the test program so it is
|
||||
# not suited for checking options that are passed to the linker, like:
|
||||
#
|
||||
# -Wl,-L<a-library-path>
|
||||
#
|
||||
# In order to avoid such kind of problems you should think about usinguse
|
||||
# the AX_*_CHECK_FLAG family macros
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
|
||||
# Copyright (c) 2008 Bogdan Drozdowski <bogdandr@op.pl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program 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 General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 13
|
||||
|
||||
AC_DEFUN([AX_GCC_OPTION], [
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
|
||||
AC_MSG_CHECKING([if gcc accepts $1 option])
|
||||
|
||||
AS_IF([ test "x$GCC" = "xyes" ],[
|
||||
AS_IF([ test -z "$3" ],[
|
||||
ax_gcc_option_test="int main()
|
||||
{
|
||||
return 0;
|
||||
}"
|
||||
],[
|
||||
ax_gcc_option_test="$3"
|
||||
])
|
||||
|
||||
# Dump the test program to file
|
||||
cat <<EOF > conftest.c
|
||||
$ax_gcc_option_test
|
||||
EOF
|
||||
|
||||
# Dump back the file to the log, useful for debugging purposes
|
||||
AC_TRY_COMMAND(cat conftest.c 1>&AS_MESSAGE_LOG_FD)
|
||||
|
||||
AS_IF([ AC_TRY_COMMAND($CC $2 $1 -c conftest.c 1>&AS_MESSAGE_LOG_FD) ],[
|
||||
AC_MSG_RESULT([yes])
|
||||
$4
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
$5
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT([no gcc available])
|
||||
])
|
||||
])
|
|
@ -0,0 +1,65 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_gcc_version.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_GCC_VERSION
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro retrieves the gcc version and returns it in the GCC_VERSION
|
||||
# variable if available, an empty string otherwise.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program 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 General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_GCC_VERSION], [
|
||||
GCC_VERSION=""
|
||||
AX_GCC_OPTION([-dumpversion],[],[],[
|
||||
ax_gcc_version_option=yes
|
||||
],[
|
||||
ax_gcc_version_option=no
|
||||
])
|
||||
AS_IF([test "x$GCC" = "xyes"],[
|
||||
AS_IF([test "x$ax_gcc_version_option" != "xno"],[
|
||||
AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
|
||||
ax_cv_gcc_version="`$CC -dumpversion`"
|
||||
AS_IF([test "x$ax_cv_gcc_version" = "x"],[
|
||||
ax_cv_gcc_version=""
|
||||
])
|
||||
])
|
||||
GCC_VERSION=$ax_cv_gcc_version
|
||||
])
|
||||
])
|
||||
AC_SUBST([GCC_VERSION])
|
||||
])
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,369 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[pic_mode="$withval"],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
|
@ -0,0 +1,123 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
|
@ -0,0 +1,23 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 3337 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.2])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3337])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.2'
|
||||
macro_revision='1.3337'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
|
@ -0,0 +1,98 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
|
@ -0,0 +1,242 @@
|
|||
# mpc.m4
|
||||
#
|
||||
# Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
#
|
||||
# This file is part of GNU MPC.
|
||||
#
|
||||
# GNU MPC 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 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_COMPLEX_H
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether complex.h is usable; if yes, define HAVE_COMPLEX_H.
|
||||
#
|
||||
AC_DEFUN([MPC_COMPLEX_H], [
|
||||
AC_CHECK_HEADER(
|
||||
[complex.h],
|
||||
[
|
||||
m4_define(
|
||||
[MPC_CONFTEST],
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[[#include <complex.h>]],
|
||||
[[complex double x = 1.0 + 2.0 * I; return (creal (x) + cimag (x));]]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
AC_SEARCH_LIBS([creal], [m])
|
||||
# needed on Solaris
|
||||
AC_MSG_CHECKING([whether creal, cimag and I can be used])
|
||||
AC_LINK_IFELSE(
|
||||
[MPC_CONFTEST],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h present and usable])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no, build without support for C complex numbers])
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_C_CHECK_FLAG([FLAG,ACCUMULATOR])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Checks if the C compiler accepts the flag FLAG
|
||||
# If yes, adds it to CFLAGS.
|
||||
|
||||
AC_DEFUN([MPC_C_CHECK_FLAG], [
|
||||
AX_C_CHECK_FLAG($1,,,[CFLAGS="$CFLAGS $1"])
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_C_CHECK_WARNINGFLAGS
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For development version only: Checks if gcc accepts warning flags.
|
||||
# Adds accepted ones to CFLAGS.
|
||||
#
|
||||
AC_DEFUN([MPC_C_CHECK_WARNINGCFLAGS], [
|
||||
AC_REQUIRE([AC_PROG_GREP])
|
||||
if echo $VERSION | grep -c dev >/dev/null 2>&1 ; then
|
||||
if test "x$GCC" = "xyes" -a "x$compiler" != "xicc" -a "x$compiler" != "xg++"; then
|
||||
# enable -Werror for myself (Andreas Enge)
|
||||
if test "x$USER" = "xenge"; then
|
||||
MPC_C_CHECK_FLAG(-Werror)
|
||||
fi
|
||||
MPC_C_CHECK_FLAG(-g)
|
||||
MPC_C_CHECK_FLAG(-std=c99)
|
||||
MPC_C_CHECK_FLAG(-pedantic)
|
||||
MPC_C_CHECK_FLAG(-Wno-long-long)
|
||||
MPC_C_CHECK_FLAG(-Wall)
|
||||
MPC_C_CHECK_FLAG(-Wextra)
|
||||
MPC_C_CHECK_FLAG(-Wdeclaration-after-statement)
|
||||
MPC_C_CHECK_FLAG(-Wundef)
|
||||
MPC_C_CHECK_FLAG(-Wshadow)
|
||||
MPC_C_CHECK_FLAG(-Wstrict-prototypes)
|
||||
MPC_C_CHECK_FLAG(-Wmissing-prototypes)
|
||||
MPC_C_CHECK_FLAG(-Wno-unused-value)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_GMP_CC_CFLAGS
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Checks if CC and CFLAGS can be extracted from gmp.h
|
||||
# essentially copied from mpfr
|
||||
#
|
||||
AC_DEFUN([MPC_GMP_CC_CFLAGS], [
|
||||
AC_MSG_CHECKING(for CC and CFLAGS in gmp.h)
|
||||
# AC_PROG_CPP triggers the search for a C compiler; use hack instead
|
||||
for cpp in /lib/cpp gcc cc c99
|
||||
do
|
||||
test $cpp = /lib/cpp || cpp="$cpp -E"
|
||||
echo foo > conftest.c
|
||||
if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then
|
||||
# Get CC
|
||||
echo "#include \"gmp.h\"" > conftest.c
|
||||
echo "MPFR_OPTION __GMP_CC" >> conftest.c
|
||||
GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
|
||||
# Get CFLAGS
|
||||
echo "#include \"gmp.h\"" > conftest.c
|
||||
echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c
|
||||
GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" -o "x$GMP_CC" = "x__GMP_CC" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
GMP_CC=
|
||||
GMP_CFLAGS=
|
||||
else
|
||||
AC_MSG_RESULT(yes [CC=$GMP_CC CFLAGS=$GMP_CFLAGS])
|
||||
fi
|
||||
|
||||
# Check for validity of CC and CFLAGS obtained from gmp.h
|
||||
if test -n "$GMP_CC$GMP_CFLAGS" ; then
|
||||
AC_MSG_CHECKING(for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS)
|
||||
echo "int main (void) { return 0; }" > conftest.c
|
||||
if $GMP_CC $GMP_CFLAGS -o conftest conftest.c 2> /dev/null ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CC=$GMP_CC
|
||||
CFLAGS=$GMP_CFLAGS
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f conftest*
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_WINDOWS
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Additional checks on windows
|
||||
# libtool requires "-no-undefined" for win32 dll
|
||||
# It also disables the tests involving the linking with LIBGMP if DLL
|
||||
#
|
||||
AC_DEFUN([MPC_WINDOWS], [
|
||||
if test "$enable_shared" = yes; then
|
||||
MPC_LDFLAGS="$MPC_LDFLAGS -no-undefined"
|
||||
AC_MSG_CHECKING(for DLL/static gmp)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "gmp.h"
|
||||
#if !__GMP_LIBGMP_DLL
|
||||
#error
|
||||
error
|
||||
#endif
|
||||
]], [[]])],[AC_MSG_RESULT(DLL)],[
|
||||
AC_MSG_RESULT(static)
|
||||
AC_MSG_ERROR([gmp is not available as a DLL: use --enable-static --disable-shared]) ])
|
||||
AC_MSG_CHECKING(for DLL/static mpfr)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "mpfr.h"
|
||||
#if !__GMP_LIBGMP_DLL
|
||||
#error
|
||||
error
|
||||
#endif
|
||||
]], [[]])],[AC_MSG_RESULT(DLL)],[
|
||||
AC_MSG_RESULT(static)
|
||||
AC_MSG_ERROR([mpfr is not available as a DLL: use --enable-static --disable-shared]) ])
|
||||
else
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "gmp.h"
|
||||
#if __GMP_LIBGMP_DLL
|
||||
#error
|
||||
error
|
||||
#endif
|
||||
]], [[]])],[AC_MSG_RESULT(static)],[
|
||||
AC_MSG_RESULT(DLL)
|
||||
AC_MSG_ERROR([gmp is only available as a DLL: use --disable-static --enable-shared]) ])
|
||||
fi
|
||||
;;
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
#
|
||||
# MPC_SVNVERSION
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# If current version string contains "dev", substitutes svn version into
|
||||
# SVNVERSION
|
||||
#
|
||||
AC_DEFUN([MPC_SVNVERSION], [
|
||||
if echo $VERSION | grep -c dev >/dev/null 2>&1 ; then
|
||||
AC_CHECK_PROG([HASSVNVERSION], [svnversion], [yes], [no])
|
||||
AS_IF([test "x$HASSVNVERSION" = "xyes"], [
|
||||
AC_MSG_CHECKING([for current svn version])
|
||||
SVNVERSION=esyscmd([svnversion -n])
|
||||
AC_SUBST([SVNVERSION])
|
||||
AC_MSG_RESULT([$SVNVERSION])
|
||||
])
|
||||
fi
|
||||
])
|
|
@ -0,0 +1,40 @@
|
|||
# valgrind-tests.m4 serial 2
|
||||
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Simon Josefsson
|
||||
dnl with adaptations to MPC
|
||||
|
||||
# gl_VALGRIND_TESTS()
|
||||
# -------------------
|
||||
# Check if valgrind is available, and set VALGRIND to it if available.
|
||||
AC_DEFUN([gl_VALGRIND_TESTS],
|
||||
[
|
||||
# Run self-tests under valgrind?
|
||||
if test "$cross_compiling" = no; then
|
||||
AC_CHECK_PROGS(VALGRIND, valgrind)
|
||||
fi
|
||||
|
||||
if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
|
||||
opt_valgrind_tests=yes
|
||||
VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
|
||||
# Addition AE: enable suppression file through a shell variable
|
||||
AC_MSG_CHECKING([for valgrind suppression file])
|
||||
if test -n "$VALGRIND_SUPPRESSION"; then
|
||||
AC_MSG_RESULT($VALGRIND_SUPPRESSION)
|
||||
VALGRIND="$VALGRIND --suppressions=$VALGRIND_SUPPRESSION"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
AC_DEFINE([MPC_USE_VALGRIND], 1, [Use valgrind for make check])
|
||||
else
|
||||
opt_valgrind_tests=no
|
||||
VALGRIND=
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether self tests are run under valgrind])
|
||||
AC_MSG_RESULT($opt_valgrind_tests)
|
||||
])
|
||||
|
|
@ -0,0 +1,331 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2012-01-06.13; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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 General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG=\${$#}
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG=\${$#}
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,34 @@
|
|||
## src/Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
##
|
||||
## This file is part of GNU MPC.
|
||||
##
|
||||
## GNU MPC 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 3 of the License, or (at your
|
||||
## option) any later version.
|
||||
##
|
||||
## GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
|
||||
lib_LTLIBRARIES = libmpc.la
|
||||
libmpc_la_LDFLAGS = $(MPC_LDFLAGS) -version-info 3:0:0
|
||||
libmpc_la_SOURCES = mpc-impl.h abs.c acos.c acosh.c add.c add_fr.c \
|
||||
add_si.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_2si.c div_2ui.c div.c div_fr.c \
|
||||
div_ui.c exp.c fma.c fr_div.c fr_sub.c get_prec2.c get_prec.c \
|
||||
get_version.c get_x.c imag.c init2.c init3.c inp_str.c log.c log10.c \
|
||||
mem.c mul_2si.c mul_2ui.c mul.c mul_fr.c mul_i.c mul_si.c mul_ui.c \
|
||||
neg.c norm.c out_str.c pow.c pow_fr.c \
|
||||
pow_ld.c pow_d.c pow_si.c pow_ui.c pow_z.c proj.c real.c urandom.c set.c \
|
||||
set_prec.c set_str.c set_x.c set_x_x.c sin.c sin_cos.c sinh.c sqr.c \
|
||||
sqrt.c strtoc.c sub.c sub_fr.c sub_ui.c swap.c tan.c tanh.c uceil_log2.c \
|
||||
ui_div.c ui_ui_sub.c
|
||||
|
||||
libmpc_la_LIBADD = @LTLIBOBJS@
|
|
@ -0,0 +1,667 @@
|
|||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in logging.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c_check_flag.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_option.m4 \
|
||||
$(top_srcdir)/m4/ax_gcc_version.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/mpc.m4 $(top_srcdir)/m4/valgrind-tests.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libmpc_la_DEPENDENCIES = @LTLIBOBJS@
|
||||
am_libmpc_la_OBJECTS = abs.lo acos.lo acosh.lo add.lo add_fr.lo \
|
||||
add_si.lo add_ui.lo arg.lo asin.lo asinh.lo atan.lo atanh.lo \
|
||||
clear.lo cmp.lo cmp_si_si.lo conj.lo cos.lo cosh.lo div_2si.lo \
|
||||
div_2ui.lo div.lo div_fr.lo div_ui.lo exp.lo fma.lo fr_div.lo \
|
||||
fr_sub.lo get_prec2.lo get_prec.lo get_version.lo get_x.lo \
|
||||
imag.lo init2.lo init3.lo inp_str.lo log.lo log10.lo mem.lo \
|
||||
mul_2si.lo mul_2ui.lo mul.lo mul_fr.lo mul_i.lo mul_si.lo \
|
||||
mul_ui.lo neg.lo norm.lo out_str.lo pow.lo pow_fr.lo pow_ld.lo \
|
||||
pow_d.lo pow_si.lo pow_ui.lo pow_z.lo proj.lo real.lo \
|
||||
urandom.lo set.lo set_prec.lo set_str.lo set_x.lo set_x_x.lo \
|
||||
sin.lo sin_cos.lo sinh.lo sqr.lo sqrt.lo strtoc.lo sub.lo \
|
||||
sub_fr.lo sub_ui.lo swap.lo tan.lo tanh.lo uceil_log2.lo \
|
||||
ui_div.lo ui_ui_sub.lo
|
||||
libmpc_la_OBJECTS = $(am_libmpc_la_OBJECTS)
|
||||
libmpc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libmpc_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libmpc_la_SOURCES)
|
||||
DIST_SOURCES = $(libmpc_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
GREP = @GREP@
|
||||
HASSVNVERSION = @HASSVNVERSION@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MPC_LDFLAGS = @MPC_LDFLAGS@
|
||||
MPC_LOG_H = @MPC_LOG_H@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SVNVERSION = @SVNVERSION@
|
||||
VALGRIND = @VALGRIND@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libmpc.la
|
||||
libmpc_la_LDFLAGS = $(MPC_LDFLAGS) -version-info 3:0:0
|
||||
libmpc_la_SOURCES = mpc-impl.h abs.c acos.c acosh.c add.c add_fr.c \
|
||||
add_si.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_2si.c div_2ui.c div.c div_fr.c \
|
||||
div_ui.c exp.c fma.c fr_div.c fr_sub.c get_prec2.c get_prec.c \
|
||||
get_version.c get_x.c imag.c init2.c init3.c inp_str.c log.c log10.c \
|
||||
mem.c mul_2si.c mul_2ui.c mul.c mul_fr.c mul_i.c mul_si.c mul_ui.c \
|
||||
neg.c norm.c out_str.c pow.c pow_fr.c \
|
||||
pow_ld.c pow_d.c pow_si.c pow_ui.c pow_z.c proj.c real.c urandom.c set.c \
|
||||
set_prec.c set_str.c set_x.c set_x_x.c sin.c sin_cos.c sinh.c sqr.c \
|
||||
sqrt.c strtoc.c sub.c sub_fr.c sub_ui.c swap.c tan.c tanh.c uceil_log2.c \
|
||||
ui_div.c ui_ui_sub.c
|
||||
|
||||
libmpc_la_LIBADD = @LTLIBOBJS@
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libmpc.la: $(libmpc_la_OBJECTS) $(libmpc_la_DEPENDENCIES) $(EXTRA_libmpc_la_DEPENDENCIES)
|
||||
$(libmpc_la_LINK) -rpath $(libdir) $(libmpc_la_OBJECTS) $(libmpc_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/logging.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acos.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acosh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_fr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asinh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atanh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_si_si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conj.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cos.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cosh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_fr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fr_div.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fr_sub.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_prec.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_prec2.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_version.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_x.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imag.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init2.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init3.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inp_str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log10.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_fr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_i.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norm.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/out_str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_d.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_fr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_ld.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_si.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_z.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proj.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/real.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prec.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_x.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_x_x.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin_cos.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoc.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_fr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_ui.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tan.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tanh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_log2.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_div.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_ui_sub.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandom.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,28 @@
|
|||
/* mpc_abs -- Absolute value of a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* the rounding mode is mpfr_rnd_t here since we return an mpfr number */
|
||||
int
|
||||
mpc_abs (mpfr_ptr a, mpc_srcptr b, mpfr_rnd_t rnd)
|
||||
{
|
||||
return mpfr_hypot (a, mpc_realref(b), mpc_imagref(b), rnd);
|
||||
}
|
|
@ -0,0 +1,228 @@
|
|||
/* mpc_acos -- arccosine of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_acos (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im, inex;
|
||||
mpfr_prec_t p_re, p_im, p;
|
||||
mpc_t z1;
|
||||
mpfr_t pi_over_2;
|
||||
mpfr_exp_t e1, e2;
|
||||
mpfr_rnd_t rnd_im;
|
||||
mpc_rnd_t rnd1;
|
||||
|
||||
inex_re = 0;
|
||||
inex_im = 0;
|
||||
|
||||
/* special values */
|
||||
if (mpfr_nan_p (mpc_realref (op)) || mpfr_nan_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_realref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
mpfr_set_inf (mpc_imagref (rop), mpfr_signbit (mpc_imagref (op)) ? +1 : -1);
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
}
|
||||
else if (mpfr_zero_p (mpc_realref (op)))
|
||||
{
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), +1, MPC_RND_RE (rnd));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
if (mpfr_inf_p (mpc_realref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_sgn (mpc_realref (op)) > 0)
|
||||
{
|
||||
inex_re =
|
||||
set_pi_over_2 (mpc_realref (rop), +1, MPC_RND_RE (rnd));
|
||||
mpfr_div_2ui (mpc_realref (rop), mpc_realref (rop), 1, GMP_RNDN);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* the real part of the result is 3*pi/4
|
||||
a = o(pi) error(a) < 1 ulp(a)
|
||||
b = o(3*a) error(b) < 2 ulp(b)
|
||||
c = b/4 exact
|
||||
thus 1 bit is lost */
|
||||
mpfr_t x;
|
||||
mpfr_prec_t prec;
|
||||
int ok;
|
||||
mpfr_init (x);
|
||||
prec = mpfr_get_prec (mpc_realref (rop));
|
||||
p = prec;
|
||||
|
||||
do
|
||||
{
|
||||
p += mpc_ceil_log2 (p);
|
||||
mpfr_set_prec (x, p);
|
||||
mpfr_const_pi (x, GMP_RNDD);
|
||||
mpfr_mul_ui (x, x, 3, GMP_RNDD);
|
||||
ok =
|
||||
mpfr_can_round (x, p - 1, GMP_RNDD, MPC_RND_RE (rnd),
|
||||
prec+(MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
|
||||
} while (ok == 0);
|
||||
inex_re =
|
||||
mpfr_div_2ui (mpc_realref (rop), x, 2, MPC_RND_RE (rnd));
|
||||
mpfr_clear (x);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mpfr_sgn (mpc_realref (op)) > 0)
|
||||
mpfr_set_ui (mpc_realref (rop), 0, GMP_RNDN);
|
||||
else
|
||||
inex_re = mpfr_const_pi (mpc_realref (rop), MPC_RND_RE (rnd));
|
||||
}
|
||||
}
|
||||
else
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), +1, MPC_RND_RE (rnd));
|
||||
|
||||
mpfr_set_inf (mpc_imagref (rop), mpfr_signbit (mpc_imagref (op)) ? +1 : -1);
|
||||
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
/* pure real argument */
|
||||
if (mpfr_zero_p (mpc_imagref (op)))
|
||||
{
|
||||
int s_im;
|
||||
s_im = mpfr_signbit (mpc_imagref (op));
|
||||
|
||||
if (mpfr_cmp_ui (mpc_realref (op), 1) > 0)
|
||||
{
|
||||
if (s_im)
|
||||
inex_im = mpfr_acosh (mpc_imagref (rop), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
else
|
||||
inex_im = -mpfr_acosh (mpc_imagref (rop), mpc_realref (op),
|
||||
INV_RND (MPC_RND_IM (rnd)));
|
||||
|
||||
mpfr_set_ui (mpc_realref (rop), 0, GMP_RNDN);
|
||||
}
|
||||
else if (mpfr_cmp_si (mpc_realref (op), -1) < 0)
|
||||
{
|
||||
mpfr_t minus_op_re;
|
||||
minus_op_re[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (minus_op_re);
|
||||
|
||||
if (s_im)
|
||||
inex_im = mpfr_acosh (mpc_imagref (rop), minus_op_re,
|
||||
MPC_RND_IM (rnd));
|
||||
else
|
||||
inex_im = -mpfr_acosh (mpc_imagref (rop), minus_op_re,
|
||||
INV_RND (MPC_RND_IM (rnd)));
|
||||
inex_re = mpfr_const_pi (mpc_realref (rop), MPC_RND_RE (rnd));
|
||||
}
|
||||
else
|
||||
{
|
||||
inex_re = mpfr_acos (mpc_realref (rop), mpc_realref (op), MPC_RND_RE (rnd));
|
||||
mpfr_set_ui (mpc_imagref (rop), 0, MPC_RND_IM (rnd));
|
||||
}
|
||||
|
||||
if (!s_im)
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* pure imaginary argument */
|
||||
if (mpfr_zero_p (mpc_realref (op)))
|
||||
{
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), +1, MPC_RND_RE (rnd));
|
||||
inex_im = -mpfr_asinh (mpc_imagref (rop), mpc_imagref (op),
|
||||
INV_RND (MPC_RND_IM (rnd)));
|
||||
mpc_conj (rop,rop, MPC_RNDNN);
|
||||
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* regular complex argument: acos(z) = Pi/2 - asin(z) */
|
||||
p_re = mpfr_get_prec (mpc_realref(rop));
|
||||
p_im = mpfr_get_prec (mpc_imagref(rop));
|
||||
p = p_re;
|
||||
mpc_init3 (z1, p, p_im); /* we round directly the imaginary part to p_im,
|
||||
with rounding mode opposite to rnd_im */
|
||||
rnd_im = MPC_RND_IM(rnd);
|
||||
/* the imaginary part of asin(z) has the same sign as Im(z), thus if
|
||||
Im(z) > 0 and rnd_im = RNDZ, we want to round the Im(asin(z)) to -Inf
|
||||
so that -Im(asin(z)) is rounded to zero */
|
||||
if (rnd_im == GMP_RNDZ)
|
||||
rnd_im = mpfr_sgn (mpc_imagref(op)) > 0 ? GMP_RNDD : GMP_RNDU;
|
||||
else
|
||||
rnd_im = rnd_im == GMP_RNDU ? GMP_RNDD
|
||||
: rnd_im == GMP_RNDD ? GMP_RNDU
|
||||
: rnd_im; /* both RNDZ and RNDA map to themselves for -asin(z) */
|
||||
rnd1 = MPC_RND (GMP_RNDN, rnd_im);
|
||||
mpfr_init2 (pi_over_2, p);
|
||||
for (;;)
|
||||
{
|
||||
p += mpc_ceil_log2 (p) + 3;
|
||||
|
||||
mpfr_set_prec (mpc_realref(z1), p);
|
||||
mpfr_set_prec (pi_over_2, p);
|
||||
|
||||
set_pi_over_2 (pi_over_2, +1, GMP_RNDN);
|
||||
e1 = 1; /* Exp(pi_over_2) */
|
||||
inex = mpc_asin (z1, op, rnd1); /* asin(z) */
|
||||
MPC_ASSERT (mpfr_sgn (mpc_imagref(z1)) * mpfr_sgn (mpc_imagref(op)) > 0);
|
||||
inex_im = MPC_INEX_IM(inex); /* inex_im is in {-1, 0, 1} */
|
||||
e2 = mpfr_get_exp (mpc_realref(z1));
|
||||
mpfr_sub (mpc_realref(z1), pi_over_2, mpc_realref(z1), GMP_RNDN);
|
||||
if (!mpfr_zero_p (mpc_realref(z1)))
|
||||
{
|
||||
/* the error on x=Re(z1) is bounded by 1/2 ulp(x) + 2^(e1-p-1) +
|
||||
2^(e2-p-1) */
|
||||
e1 = e1 >= e2 ? e1 + 1 : e2 + 1;
|
||||
/* the error on x is bounded by 1/2 ulp(x) + 2^(e1-p-1) */
|
||||
e1 -= mpfr_get_exp (mpc_realref(z1));
|
||||
/* the error on x is bounded by 1/2 ulp(x) [1 + 2^e1] */
|
||||
e1 = e1 <= 0 ? 0 : e1;
|
||||
/* the error on x is bounded by 2^e1 * ulp(x) */
|
||||
mpfr_neg (mpc_imagref(z1), mpc_imagref(z1), GMP_RNDN); /* exact */
|
||||
inex_im = -inex_im;
|
||||
if (mpfr_can_round (mpc_realref(z1), p - e1, GMP_RNDN, GMP_RNDZ,
|
||||
p_re + (MPC_RND_RE(rnd) == GMP_RNDN)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
inex = mpc_set (rop, z1, rnd);
|
||||
inex_re = MPC_INEX_RE(inex);
|
||||
mpc_clear (z1);
|
||||
mpfr_clear (pi_over_2);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/* mpc_acosh -- inverse hyperbolic cosine of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_acosh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
/* acosh(z) =
|
||||
NaN + i*NaN, if z=0+i*NaN
|
||||
-i*acos(z), if sign(Im(z)) = -
|
||||
i*acos(z), if sign(Im(z)) = +
|
||||
http://functions.wolfram.com/ElementaryFunctions/ArcCosh/27/02/03/01/01/
|
||||
*/
|
||||
mpc_t a;
|
||||
mpfr_t tmp;
|
||||
int inex;
|
||||
|
||||
if (mpfr_zero_p (mpc_realref (op)) && mpfr_nan_p (mpc_imagref (op)))
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Note reversal of precisions due to later multiplication by i or -i */
|
||||
mpc_init3 (a, MPC_PREC_IM(rop), MPC_PREC_RE(rop));
|
||||
|
||||
if (mpfr_signbit (mpc_imagref (op)))
|
||||
{
|
||||
inex = mpc_acos (a, op,
|
||||
MPC_RND (INV_RND (MPC_RND_IM (rnd)), MPC_RND_RE (rnd)));
|
||||
|
||||
/* change a to -i*a, i.e., -y+i*x to x+i*y */
|
||||
tmp[0] = mpc_realref (a)[0];
|
||||
mpc_realref (a)[0] = mpc_imagref (a)[0];
|
||||
mpc_imagref (a)[0] = tmp[0];
|
||||
MPFR_CHANGE_SIGN (mpc_imagref (a));
|
||||
inex = MPC_INEX (MPC_INEX_IM (inex), -MPC_INEX_RE (inex));
|
||||
}
|
||||
else
|
||||
{
|
||||
inex = mpc_acos (a, op,
|
||||
MPC_RND (MPC_RND_IM (rnd), INV_RND(MPC_RND_RE (rnd))));
|
||||
|
||||
/* change a to i*a, i.e., y-i*x to x+i*y */
|
||||
tmp[0] = mpc_realref (a)[0];
|
||||
mpc_realref (a)[0] = mpc_imagref (a)[0];
|
||||
mpc_imagref (a)[0] = tmp[0];
|
||||
MPFR_CHANGE_SIGN (mpc_realref (a));
|
||||
inex = MPC_INEX (-MPC_INEX_IM (inex), MPC_INEX_RE (inex));
|
||||
}
|
||||
|
||||
mpc_set (rop, a, rnd);
|
||||
|
||||
mpc_clear (a);
|
||||
|
||||
return inex;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mpc_add -- Add two complex numbers.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff both the real and imaginary parts are exact */
|
||||
int
|
||||
mpc_add (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_add (mpc_realref(a), mpc_realref(b), mpc_realref(c), MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_add (mpc_imagref(a), mpc_imagref(b), mpc_imagref(c), MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mpc_add_fr -- Add a complex number and a floating-point number.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff both the real and imaginary parts are exact */
|
||||
int
|
||||
mpc_add_fr (mpc_ptr a, mpc_srcptr b, mpfr_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_add (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_set (mpc_imagref(a), mpc_imagref(b), MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_add_si -- Add a complex number and a signed long int.
|
||||
|
||||
Copyright (C) 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_add_si (mpc_ptr rop, mpc_srcptr op1, long int op2, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_add_si (mpc_realref (rop), mpc_realref (op1), op2, MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (rop), mpc_imagref (op1), MPC_RND_IM (rnd));
|
||||
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mpc_add_ui -- Add a complex number and an unsigned long int.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff both the real and imaginary parts are exact */
|
||||
int
|
||||
mpc_add_ui (mpc_ptr a, mpc_srcptr b, unsigned long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_add_ui (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_set (mpc_imagref(a), mpc_imagref(b), MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* mpc_arg -- Get the argument of a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_arg (mpfr_ptr a, mpc_srcptr b, mpfr_rnd_t rnd)
|
||||
{
|
||||
return mpfr_atan2 (a, mpc_imagref (b), mpc_realref (b), rnd);
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
/* mpc_asin -- arcsine of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_asin (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
mpfr_prec_t p, p_re, p_im, incr_p = 0;
|
||||
mpfr_rnd_t rnd_re, rnd_im;
|
||||
mpc_t z1;
|
||||
int inex;
|
||||
|
||||
/* special values */
|
||||
if (mpfr_nan_p (mpc_realref (op)) || mpfr_nan_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_realref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_inf (mpc_imagref (rop), mpfr_signbit (mpc_imagref (op)) ? -1 : +1);
|
||||
}
|
||||
else if (mpfr_zero_p (mpc_realref (op)))
|
||||
{
|
||||
mpfr_set (mpc_realref (rop), mpc_realref (op), GMP_RNDN);
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mpfr_inf_p (mpc_realref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
int inex_re;
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
{
|
||||
int inf_im = mpfr_inf_p (mpc_imagref (op));
|
||||
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop),
|
||||
(mpfr_signbit (mpc_realref (op)) ? -1 : 1), MPC_RND_RE (rnd));
|
||||
mpfr_set_inf (mpc_imagref (rop), (mpfr_signbit (mpc_imagref (op)) ? -1 : 1));
|
||||
|
||||
if (inf_im)
|
||||
mpfr_div_2ui (mpc_realref (rop), mpc_realref (rop), 1, GMP_RNDN);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfr_set_zero (mpc_realref (rop), (mpfr_signbit (mpc_realref (op)) ? -1 : 1));
|
||||
inex_re = 0;
|
||||
mpfr_set_inf (mpc_imagref (rop), (mpfr_signbit (mpc_imagref (op)) ? -1 : 1));
|
||||
}
|
||||
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
/* pure real argument */
|
||||
if (mpfr_zero_p (mpc_imagref (op)))
|
||||
{
|
||||
int inex_re;
|
||||
int inex_im;
|
||||
int s_im;
|
||||
s_im = mpfr_signbit (mpc_imagref (op));
|
||||
|
||||
if (mpfr_cmp_ui (mpc_realref (op), 1) > 0)
|
||||
{
|
||||
if (s_im)
|
||||
inex_im = -mpfr_acosh (mpc_imagref (rop), mpc_realref (op),
|
||||
INV_RND (MPC_RND_IM (rnd)));
|
||||
else
|
||||
inex_im = mpfr_acosh (mpc_imagref (rop), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop),
|
||||
(mpfr_signbit (mpc_realref (op)) ? -1 : 1), MPC_RND_RE (rnd));
|
||||
if (s_im)
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
}
|
||||
else if (mpfr_cmp_si (mpc_realref (op), -1) < 0)
|
||||
{
|
||||
mpfr_t minus_op_re;
|
||||
minus_op_re[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (minus_op_re);
|
||||
|
||||
if (s_im)
|
||||
inex_im = -mpfr_acosh (mpc_imagref (rop), minus_op_re,
|
||||
INV_RND (MPC_RND_IM (rnd)));
|
||||
else
|
||||
inex_im = mpfr_acosh (mpc_imagref (rop), minus_op_re,
|
||||
MPC_RND_IM (rnd));
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop),
|
||||
(mpfr_signbit (mpc_realref (op)) ? -1 : 1), MPC_RND_RE (rnd));
|
||||
if (s_im)
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
}
|
||||
else
|
||||
{
|
||||
inex_im = mpfr_set_ui (mpc_imagref (rop), 0, MPC_RND_IM (rnd));
|
||||
if (s_im)
|
||||
mpfr_neg (mpc_imagref (rop), mpc_imagref (rop), GMP_RNDN);
|
||||
inex_re = mpfr_asin (mpc_realref (rop), mpc_realref (op), MPC_RND_RE (rnd));
|
||||
}
|
||||
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* pure imaginary argument */
|
||||
if (mpfr_zero_p (mpc_realref (op)))
|
||||
{
|
||||
int inex_im;
|
||||
int s;
|
||||
s = mpfr_signbit (mpc_realref (op));
|
||||
mpfr_set_ui (mpc_realref (rop), 0, GMP_RNDN);
|
||||
if (s)
|
||||
mpfr_neg (mpc_realref (rop), mpc_realref (rop), GMP_RNDN);
|
||||
inex_im = mpfr_asinh (mpc_imagref (rop), mpc_imagref (op), MPC_RND_IM (rnd));
|
||||
|
||||
return MPC_INEX (0, inex_im);
|
||||
}
|
||||
|
||||
/* regular complex: asin(z) = -i*log(i*z+sqrt(1-z^2)) */
|
||||
p_re = mpfr_get_prec (mpc_realref(rop));
|
||||
p_im = mpfr_get_prec (mpc_imagref(rop));
|
||||
rnd_re = MPC_RND_RE(rnd);
|
||||
rnd_im = MPC_RND_IM(rnd);
|
||||
p = p_re >= p_im ? p_re : p_im;
|
||||
mpc_init2 (z1, p);
|
||||
while (1)
|
||||
{
|
||||
mpfr_exp_t ex, ey, err;
|
||||
|
||||
p += mpc_ceil_log2 (p) + 3 + incr_p; /* incr_p is zero initially */
|
||||
incr_p = p / 2;
|
||||
mpfr_set_prec (mpc_realref(z1), p);
|
||||
mpfr_set_prec (mpc_imagref(z1), p);
|
||||
|
||||
/* z1 <- z^2 */
|
||||
mpc_sqr (z1, op, MPC_RNDNN);
|
||||
/* err(x) <= 1/2 ulp(x), err(y) <= 1/2 ulp(y) */
|
||||
/* z1 <- 1-z1 */
|
||||
ex = mpfr_get_exp (mpc_realref(z1));
|
||||
mpfr_ui_sub (mpc_realref(z1), 1, mpc_realref(z1), GMP_RNDN);
|
||||
mpfr_neg (mpc_imagref(z1), mpc_imagref(z1), GMP_RNDN);
|
||||
ex = ex - mpfr_get_exp (mpc_realref(z1));
|
||||
ex = (ex <= 0) ? 0 : ex;
|
||||
/* err(x) <= 2^ex * ulp(x) */
|
||||
ex = ex + mpfr_get_exp (mpc_realref(z1)) - p;
|
||||
/* err(x) <= 2^ex */
|
||||
ey = mpfr_get_exp (mpc_imagref(z1)) - p - 1;
|
||||
/* err(y) <= 2^ey */
|
||||
ex = (ex >= ey) ? ex : ey; /* err(x), err(y) <= 2^ex, i.e., the norm
|
||||
of the error is bounded by |h|<=2^(ex+1/2) */
|
||||
/* z1 <- sqrt(z1): if z1 = z + h, then sqrt(z1) = sqrt(z) + h/2/sqrt(t) */
|
||||
ey = mpfr_get_exp (mpc_realref(z1)) >= mpfr_get_exp (mpc_imagref(z1))
|
||||
? mpfr_get_exp (mpc_realref(z1)) : mpfr_get_exp (mpc_imagref(z1));
|
||||
/* we have |z1| >= 2^(ey-1) thus 1/|z1| <= 2^(1-ey) */
|
||||
mpc_sqrt (z1, z1, MPC_RNDNN);
|
||||
ex = (2 * ex + 1) - 2 - (ey - 1); /* |h^2/4/|t| <= 2^ex */
|
||||
ex = (ex + 1) / 2; /* ceil(ex/2) */
|
||||
/* express ex in terms of ulp(z1) */
|
||||
ey = mpfr_get_exp (mpc_realref(z1)) <= mpfr_get_exp (mpc_imagref(z1))
|
||||
? mpfr_get_exp (mpc_realref(z1)) : mpfr_get_exp (mpc_imagref(z1));
|
||||
ex = ex - ey + p;
|
||||
/* take into account the rounding error in the mpc_sqrt call */
|
||||
err = (ex <= 0) ? 1 : ex + 1;
|
||||
/* err(x) <= 2^err * ulp(x), err(y) <= 2^err * ulp(y) */
|
||||
/* z1 <- i*z + z1 */
|
||||
ex = mpfr_get_exp (mpc_realref(z1));
|
||||
ey = mpfr_get_exp (mpc_imagref(z1));
|
||||
mpfr_sub (mpc_realref(z1), mpc_realref(z1), mpc_imagref(op), GMP_RNDN);
|
||||
mpfr_add (mpc_imagref(z1), mpc_imagref(z1), mpc_realref(op), GMP_RNDN);
|
||||
if (mpfr_cmp_ui (mpc_realref(z1), 0) == 0 || mpfr_cmp_ui (mpc_imagref(z1), 0) == 0)
|
||||
continue;
|
||||
ex -= mpfr_get_exp (mpc_realref(z1)); /* cancellation in x */
|
||||
ey -= mpfr_get_exp (mpc_imagref(z1)); /* cancellation in y */
|
||||
ex = (ex >= ey) ? ex : ey; /* maximum cancellation */
|
||||
err += ex;
|
||||
err = (err <= 0) ? 1 : err + 1; /* rounding error in sub/add */
|
||||
/* z1 <- log(z1): if z1 = z + h, then log(z1) = log(z) + h/t with
|
||||
|t| >= min(|z1|,|z|) */
|
||||
ex = mpfr_get_exp (mpc_realref(z1));
|
||||
ey = mpfr_get_exp (mpc_imagref(z1));
|
||||
ex = (ex >= ey) ? ex : ey;
|
||||
err += ex - p; /* revert to absolute error <= 2^err */
|
||||
mpc_log (z1, z1, GMP_RNDN);
|
||||
err -= ex - 1; /* 1/|t| <= 1/|z| <= 2^(1-ex) */
|
||||
/* express err in terms of ulp(z1) */
|
||||
ey = mpfr_get_exp (mpc_realref(z1)) <= mpfr_get_exp (mpc_imagref(z1))
|
||||
? mpfr_get_exp (mpc_realref(z1)) : mpfr_get_exp (mpc_imagref(z1));
|
||||
err = err - ey + p;
|
||||
/* take into account the rounding error in the mpc_log call */
|
||||
err = (err <= 0) ? 1 : err + 1;
|
||||
/* z1 <- -i*z1 */
|
||||
mpfr_swap (mpc_realref(z1), mpc_imagref(z1));
|
||||
mpfr_neg (mpc_imagref(z1), mpc_imagref(z1), GMP_RNDN);
|
||||
if (mpfr_can_round (mpc_realref(z1), p - err, GMP_RNDN, GMP_RNDZ,
|
||||
p_re + (rnd_re == GMP_RNDN)) &&
|
||||
mpfr_can_round (mpc_imagref(z1), p - err, GMP_RNDN, GMP_RNDZ,
|
||||
p_im + (rnd_im == GMP_RNDN)))
|
||||
break;
|
||||
}
|
||||
|
||||
inex = mpc_set (rop, z1, rnd);
|
||||
mpc_clear (z1);
|
||||
|
||||
return inex;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/* mpc_asinh -- inverse hyperbolic sine of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#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, a;
|
||||
mpfr_t tmp;
|
||||
|
||||
/* z = i*op */
|
||||
mpc_realref (z)[0] = mpc_imagref (op)[0];
|
||||
mpc_imagref (z)[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (mpc_realref (z));
|
||||
|
||||
/* Note reversal of precisions due to later multiplication by -i */
|
||||
mpc_init3 (a, MPC_PREC_IM(rop), MPC_PREC_RE(rop));
|
||||
|
||||
inex = mpc_asin (a, z,
|
||||
MPC_RND (INV_RND (MPC_RND_IM (rnd)), MPC_RND_RE (rnd)));
|
||||
|
||||
/* if a = asin(i*op) = x+i*y, and we want y-i*x */
|
||||
|
||||
/* change a to -i*a */
|
||||
tmp[0] = mpc_realref (a)[0];
|
||||
mpc_realref (a)[0] = mpc_imagref (a)[0];
|
||||
mpc_imagref (a)[0] = tmp[0];
|
||||
MPFR_CHANGE_SIGN (mpc_imagref (a));
|
||||
|
||||
mpc_set (rop, a, MPC_RNDNN); /* exact */
|
||||
|
||||
mpc_clear (a);
|
||||
|
||||
return MPC_INEX (MPC_INEX_IM (inex), -MPC_INEX_RE (inex));
|
||||
}
|
|
@ -0,0 +1,367 @@
|
|||
/* mpc_atan -- arctangent of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* set rop to
|
||||
-pi/2 if s < 0
|
||||
+pi/2 else
|
||||
rounded in the direction rnd
|
||||
*/
|
||||
int
|
||||
set_pi_over_2 (mpfr_ptr rop, int s, mpfr_rnd_t rnd)
|
||||
{
|
||||
int inex;
|
||||
|
||||
inex = mpfr_const_pi (rop, s < 0 ? INV_RND (rnd) : rnd);
|
||||
mpfr_div_2ui (rop, rop, 1, GMP_RNDN);
|
||||
if (s < 0)
|
||||
{
|
||||
inex = -inex;
|
||||
mpfr_neg (rop, rop, GMP_RNDN);
|
||||
}
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
int
|
||||
mpc_atan (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
int s_re;
|
||||
int s_im;
|
||||
int inex_re;
|
||||
int inex_im;
|
||||
int inex;
|
||||
|
||||
inex_re = 0;
|
||||
inex_im = 0;
|
||||
s_re = mpfr_signbit (mpc_realref (op));
|
||||
s_im = mpfr_signbit (mpc_imagref (op));
|
||||
|
||||
/* special values */
|
||||
if (mpfr_nan_p (mpc_realref (op)) || mpfr_nan_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_nan_p (mpc_realref (op)))
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
if (mpfr_zero_p (mpc_imagref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
mpfr_set_ui (mpc_imagref (rop), 0, GMP_RNDN);
|
||||
if (s_im)
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
}
|
||||
else
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
{
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), -s_re, MPC_RND_RE (rnd));
|
||||
mpfr_set_ui (mpc_imagref (rop), 0, GMP_RNDN);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
}
|
||||
}
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
if (mpfr_inf_p (mpc_realref (op)) || mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), -s_re, MPC_RND_RE (rnd));
|
||||
|
||||
mpfr_set_ui (mpc_imagref (rop), 0, GMP_RNDN);
|
||||
if (s_im)
|
||||
mpc_conj (rop, rop, GMP_RNDN);
|
||||
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
/* pure real argument */
|
||||
if (mpfr_zero_p (mpc_imagref (op)))
|
||||
{
|
||||
inex_re = mpfr_atan (mpc_realref (rop), mpc_realref (op), MPC_RND_RE (rnd));
|
||||
|
||||
mpfr_set_ui (mpc_imagref (rop), 0, GMP_RNDN);
|
||||
if (s_im)
|
||||
mpc_conj (rop, rop, GMP_RNDN);
|
||||
|
||||
return MPC_INEX (inex_re, 0);
|
||||
}
|
||||
|
||||
/* pure imaginary argument */
|
||||
if (mpfr_zero_p (mpc_realref (op)))
|
||||
{
|
||||
int cmp_1;
|
||||
|
||||
if (s_im)
|
||||
cmp_1 = -mpfr_cmp_si (mpc_imagref (op), -1);
|
||||
else
|
||||
cmp_1 = mpfr_cmp_ui (mpc_imagref (op), +1);
|
||||
|
||||
if (cmp_1 < 0)
|
||||
{
|
||||
/* atan(+0+iy) = +0 +i*atanh(y), if |y| < 1
|
||||
atan(-0+iy) = -0 +i*atanh(y), if |y| < 1 */
|
||||
|
||||
mpfr_set_ui (mpc_realref (rop), 0, GMP_RNDN);
|
||||
if (s_re)
|
||||
mpfr_neg (mpc_realref (rop), mpc_realref (rop), GMP_RNDN);
|
||||
|
||||
inex_im = mpfr_atanh (mpc_imagref (rop), mpc_imagref (op), MPC_RND_IM (rnd));
|
||||
}
|
||||
else if (cmp_1 == 0)
|
||||
{
|
||||
/* atan(+/-0+i) = NaN +i*inf
|
||||
atan(+/-0-i) = NaN -i*inf */
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_inf (mpc_imagref (rop), s_im ? -1 : +1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* atan(+0+iy) = +pi/2 +i*atanh(1/y), if |y| > 1
|
||||
atan(-0+iy) = -pi/2 +i*atanh(1/y), if |y| > 1 */
|
||||
mpfr_rnd_t rnd_im, rnd_away;
|
||||
mpfr_t y;
|
||||
mpfr_prec_t p, p_im;
|
||||
int ok;
|
||||
|
||||
rnd_im = MPC_RND_IM (rnd);
|
||||
mpfr_init (y);
|
||||
p_im = mpfr_get_prec (mpc_imagref (rop));
|
||||
p = p_im;
|
||||
|
||||
/* a = o(1/y) with error(a) < 1 ulp(a)
|
||||
b = o(atanh(a)) with error(b) < (1+2^{1+Exp(a)-Exp(b)}) ulp(b)
|
||||
|
||||
As |atanh (1/y)| > |1/y| we have Exp(a)-Exp(b) <=0 so, at most,
|
||||
2 bits of precision are lost.
|
||||
|
||||
We round atanh(1/y) away from 0.
|
||||
*/
|
||||
do
|
||||
{
|
||||
p += mpc_ceil_log2 (p) + 2;
|
||||
mpfr_set_prec (y, p);
|
||||
rnd_away = s_im == 0 ? GMP_RNDU : GMP_RNDD;
|
||||
inex_im = mpfr_ui_div (y, 1, mpc_imagref (op), rnd_away);
|
||||
/* FIXME: should we consider the case with unreasonably huge
|
||||
precision prec(y)>3*exp_min, where atanh(1/Im(op)) could be
|
||||
representable while 1/Im(op) underflows ?
|
||||
This corresponds to |y| = 0.5*2^emin, in which case the
|
||||
result may be wrong. */
|
||||
|
||||
/* atanh cannot underflow: |atanh(x)| > |x| for |x| < 1 */
|
||||
inex_im |= mpfr_atanh (y, y, rnd_away);
|
||||
|
||||
ok = inex_im == 0
|
||||
|| mpfr_can_round (y, p - 2, rnd_away, GMP_RNDZ,
|
||||
p_im + (rnd_im == GMP_RNDN));
|
||||
} while (ok == 0);
|
||||
|
||||
inex_re = set_pi_over_2 (mpc_realref (rop), -s_re, MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (rop), y, rnd_im);
|
||||
mpfr_clear (y);
|
||||
}
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* regular number argument */
|
||||
{
|
||||
mpfr_t a, b, x, y;
|
||||
mpfr_prec_t prec, p;
|
||||
mpfr_exp_t err, expo;
|
||||
int ok = 0;
|
||||
mpfr_t minus_op_re;
|
||||
mpfr_exp_t op_re_exp, op_im_exp;
|
||||
mpfr_rnd_t rnd1, rnd2;
|
||||
|
||||
mpfr_inits2 (MPFR_PREC_MIN, a, b, x, y, (mpfr_ptr) 0);
|
||||
|
||||
/* real part: Re(arctan(x+i*y)) = [arctan2(x,1-y) - arctan2(-x,1+y)]/2 */
|
||||
minus_op_re[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (minus_op_re);
|
||||
op_re_exp = mpfr_get_exp (mpc_realref (op));
|
||||
op_im_exp = mpfr_get_exp (mpc_imagref (op));
|
||||
|
||||
prec = mpfr_get_prec (mpc_realref (rop)); /* result precision */
|
||||
|
||||
/* a = o(1-y) error(a) < 1 ulp(a)
|
||||
b = o(atan2(x,a)) error(b) < [1+2^{3+Exp(x)-Exp(a)-Exp(b)}] ulp(b)
|
||||
= kb ulp(b)
|
||||
c = o(1+y) error(c) < 1 ulp(c)
|
||||
d = o(atan2(-x,c)) error(d) < [1+2^{3+Exp(x)-Exp(c)-Exp(d)}] ulp(d)
|
||||
= kd ulp(d)
|
||||
e = o(b - d) error(e) < [1 + kb*2^{Exp(b}-Exp(e)}
|
||||
+ kd*2^{Exp(d)-Exp(e)}] ulp(e)
|
||||
error(e) < [1 + 2^{4+Exp(x)-Exp(a)-Exp(e)}
|
||||
+ 2^{4+Exp(x)-Exp(c)-Exp(e)}] ulp(e)
|
||||
because |atan(u)| < |u|
|
||||
< [1 + 2^{5+Exp(x)-min(Exp(a),Exp(c))
|
||||
-Exp(e)}] ulp(e)
|
||||
f = e/2 exact
|
||||
*/
|
||||
|
||||
/* p: working precision */
|
||||
p = (op_im_exp > 0 || prec > SAFE_ABS (mpfr_prec_t, op_im_exp)) ? prec
|
||||
: (prec - op_im_exp);
|
||||
rnd1 = mpfr_sgn (mpc_realref (op)) > 0 ? GMP_RNDD : GMP_RNDU;
|
||||
rnd2 = mpfr_sgn (mpc_realref (op)) < 0 ? GMP_RNDU : GMP_RNDD;
|
||||
|
||||
do
|
||||
{
|
||||
p += mpc_ceil_log2 (p) + 2;
|
||||
mpfr_set_prec (a, p);
|
||||
mpfr_set_prec (b, p);
|
||||
mpfr_set_prec (x, p);
|
||||
|
||||
/* x = upper bound for atan (x/(1-y)). Since atan is increasing, we
|
||||
need an upper bound on x/(1-y), i.e., a lower bound on 1-y for
|
||||
x positive, and an upper bound on 1-y for x negative */
|
||||
mpfr_ui_sub (a, 1, mpc_imagref (op), rnd1);
|
||||
if (mpfr_sgn (a) == 0) /* y is near 1, thus 1+y is near 2, and
|
||||
expo will be 1 or 2 below */
|
||||
{
|
||||
MPC_ASSERT (mpfr_cmp_ui (mpc_imagref(op), 1) == 0);
|
||||
/* check for intermediate underflow */
|
||||
err = 2; /* ensures err will be expo below */
|
||||
}
|
||||
else
|
||||
err = mpfr_get_exp (a); /* err = Exp(a) with the notations above */
|
||||
mpfr_atan2 (x, mpc_realref (op), a, GMP_RNDU);
|
||||
|
||||
/* b = lower bound for atan (-x/(1+y)): for x negative, we need a
|
||||
lower bound on -x/(1+y), i.e., an upper bound on 1+y */
|
||||
mpfr_add_ui (a, mpc_imagref(op), 1, rnd2);
|
||||
/* if a is exactly zero, i.e., Im(op) = -1, then the error on a is 0,
|
||||
and we can simply ignore the terms involving Exp(a) in the error */
|
||||
if (mpfr_sgn (a) == 0)
|
||||
{
|
||||
MPC_ASSERT (mpfr_cmp_si (mpc_imagref(op), -1) == 0);
|
||||
/* check for intermediate underflow */
|
||||
expo = err; /* will leave err unchanged below */
|
||||
}
|
||||
else
|
||||
expo = mpfr_get_exp (a); /* expo = Exp(c) with the notations above */
|
||||
mpfr_atan2 (b, minus_op_re, a, GMP_RNDD);
|
||||
|
||||
err = err < expo ? err : expo; /* err = min(Exp(a),Exp(c)) */
|
||||
mpfr_sub (x, x, b, GMP_RNDU);
|
||||
|
||||
err = 5 + op_re_exp - err - mpfr_get_exp (x);
|
||||
/* error is bounded by [1 + 2^err] ulp(e) */
|
||||
err = err < 0 ? 1 : err + 1;
|
||||
|
||||
mpfr_div_2ui (x, x, 1, GMP_RNDU);
|
||||
|
||||
/* Note: using RND2=RNDD guarantees that if x is exactly representable
|
||||
on prec + ... bits, mpfr_can_round will return 0 */
|
||||
ok = mpfr_can_round (x, p - err, GMP_RNDU, GMP_RNDD,
|
||||
prec + (MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
} while (ok == 0);
|
||||
|
||||
/* Imaginary part
|
||||
Im(atan(x+I*y)) = 1/4 * [log(x^2+(1+y)^2) - log (x^2 +(1-y)^2)] */
|
||||
prec = mpfr_get_prec (mpc_imagref (rop)); /* result precision */
|
||||
|
||||
/* a = o(1+y) error(a) < 1 ulp(a)
|
||||
b = o(a^2) error(b) < 5 ulp(b)
|
||||
c = o(x^2) error(c) < 1 ulp(c)
|
||||
d = o(b+c) error(d) < 7 ulp(d)
|
||||
e = o(log(d)) error(e) < [1 + 7*2^{2-Exp(e)}] ulp(e) = ke ulp(e)
|
||||
f = o(1-y) error(f) < 1 ulp(f)
|
||||
g = o(f^2) error(g) < 5 ulp(g)
|
||||
h = o(c+f) error(h) < 7 ulp(h)
|
||||
i = o(log(h)) error(i) < [1 + 7*2^{2-Exp(i)}] ulp(i) = ki ulp(i)
|
||||
j = o(e-i) error(j) < [1 + ke*2^{Exp(e)-Exp(j)}
|
||||
+ ki*2^{Exp(i)-Exp(j)}] ulp(j)
|
||||
error(j) < [1 + 2^{Exp(e)-Exp(j)} + 2^{Exp(i)-Exp(j)}
|
||||
+ 7*2^{3-Exp(j)}] ulp(j)
|
||||
< [1 + 2^{max(Exp(e),Exp(i))-Exp(j)+1}
|
||||
+ 7*2^{3-Exp(j)}] ulp(j)
|
||||
k = j/4 exact
|
||||
*/
|
||||
err = 2;
|
||||
p = prec; /* working precision */
|
||||
|
||||
do
|
||||
{
|
||||
p += mpc_ceil_log2 (p) + err;
|
||||
mpfr_set_prec (a, p);
|
||||
mpfr_set_prec (b, p);
|
||||
mpfr_set_prec (y, p);
|
||||
|
||||
/* a = upper bound for log(x^2 + (1+y)^2) */
|
||||
ROUND_AWAY (mpfr_add_ui (a, mpc_imagref (op), 1, MPFR_RNDA), a);
|
||||
mpfr_sqr (a, a, GMP_RNDU);
|
||||
mpfr_sqr (y, mpc_realref (op), GMP_RNDU);
|
||||
mpfr_add (a, a, y, GMP_RNDU);
|
||||
mpfr_log (a, a, GMP_RNDU);
|
||||
|
||||
/* b = lower bound for log(x^2 + (1-y)^2) */
|
||||
mpfr_ui_sub (b, 1, mpc_imagref (op), GMP_RNDZ); /* round to zero */
|
||||
mpfr_sqr (b, b, GMP_RNDZ);
|
||||
/* we could write mpfr_sqr (y, mpc_realref (op), GMP_RNDZ) but it is
|
||||
more efficient to reuse the value of y (x^2) above and subtract
|
||||
one ulp */
|
||||
mpfr_nextbelow (y);
|
||||
mpfr_add (b, b, y, GMP_RNDZ);
|
||||
mpfr_log (b, b, GMP_RNDZ);
|
||||
|
||||
mpfr_sub (y, a, b, GMP_RNDU);
|
||||
|
||||
if (mpfr_zero_p (y))
|
||||
/* FIXME: happens when x and y have very different magnitudes;
|
||||
could be handled more efficiently */
|
||||
ok = 0;
|
||||
else
|
||||
{
|
||||
expo = MPC_MAX (mpfr_get_exp (a), mpfr_get_exp (b));
|
||||
expo = expo - mpfr_get_exp (y) + 1;
|
||||
err = 3 - mpfr_get_exp (y);
|
||||
/* error(j) <= [1 + 2^expo + 7*2^err] ulp(j) */
|
||||
if (expo <= err) /* error(j) <= [1 + 2^{err+1}] ulp(j) */
|
||||
err = (err < 0) ? 1 : err + 2;
|
||||
else
|
||||
err = (expo < 0) ? 1 : expo + 2;
|
||||
|
||||
mpfr_div_2ui (y, y, 2, GMP_RNDN);
|
||||
MPC_ASSERT (!mpfr_zero_p (y));
|
||||
/* FIXME: underflow. Since the main term of the Taylor series
|
||||
in y=0 is 1/(x^2+1) * y, this means that y is very small
|
||||
and/or x very large; but then the mpfr_zero_p (y) above
|
||||
should be true. This needs a proof, or better yet,
|
||||
special code. */
|
||||
|
||||
ok = mpfr_can_round (y, p - err, GMP_RNDU, GMP_RNDD,
|
||||
prec + (MPC_RND_IM (rnd) == GMP_RNDN));
|
||||
}
|
||||
} while (ok == 0);
|
||||
|
||||
inex = mpc_set_fr_fr (rop, x, y, rnd);
|
||||
|
||||
mpfr_clears (a, b, x, y, (mpfr_ptr) 0);
|
||||
return inex;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* mpc_atanh -- inverse hyperbolic tangent of a complex number.
|
||||
|
||||
Copyright (C) 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#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, a;
|
||||
|
||||
mpc_realref (z)[0] = mpc_imagref (op)[0];
|
||||
mpc_imagref (z)[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (mpc_realref (z));
|
||||
|
||||
/* Note reversal of precisions due to later multiplication by -i */
|
||||
mpc_init3 (a, MPC_PREC_IM(rop), MPC_PREC_RE(rop));
|
||||
|
||||
inex = mpc_atan (a, z,
|
||||
MPC_RND (INV_RND (MPC_RND_IM (rnd)), MPC_RND_RE (rnd)));
|
||||
|
||||
/* change a to -i*a, i.e., x+i*y to y-i*x */
|
||||
tmp[0] = mpc_realref (a)[0];
|
||||
mpc_realref (a)[0] = mpc_imagref (a)[0];
|
||||
mpc_imagref (a)[0] = tmp[0];
|
||||
MPFR_CHANGE_SIGN (mpc_imagref (a));
|
||||
|
||||
mpc_set (rop, a, rnd);
|
||||
|
||||
mpc_clear (a);
|
||||
|
||||
return MPC_INEX (MPC_INEX_IM (inex), -MPC_INEX_RE (inex));
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* mpc_clear -- Clear a complex variable.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
void
|
||||
mpc_clear (mpc_t x)
|
||||
{
|
||||
mpfr_clear (mpc_realref(x));
|
||||
mpfr_clear (mpc_imagref(x));
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mpc_cmp -- Compare two complex numbers.
|
||||
|
||||
Copyright (C) 2002, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff a = b */
|
||||
int
|
||||
mpc_cmp (mpc_srcptr a, mpc_srcptr b)
|
||||
{
|
||||
int cmp_re, cmp_im;
|
||||
|
||||
cmp_re = mpfr_cmp (mpc_realref(a), mpc_realref(b));
|
||||
cmp_im = mpfr_cmp (mpc_imagref(a), mpc_imagref(b));
|
||||
|
||||
return MPC_INEX(cmp_re, cmp_im);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* mpc_cmp_si_si -- Compare a complex number to a number of the form
|
||||
b+c*i with b and c signed integers.
|
||||
|
||||
Copyright (C) 2005, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff a = b */
|
||||
int
|
||||
mpc_cmp_si_si (mpc_srcptr a, long int b, long int c)
|
||||
{
|
||||
int cmp_re, cmp_im;
|
||||
|
||||
cmp_re = mpfr_cmp_si (mpc_realref(a), b);
|
||||
cmp_im = mpfr_cmp_si (mpc_imagref(a), c);
|
||||
|
||||
return MPC_INEX(cmp_re, cmp_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_conj -- Conjugate of a complex number.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_conj (mpc_ptr a, mpc_srcptr b, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_set (mpc_realref(a), mpc_realref(b), MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_neg (mpc_imagref(a), mpc_imagref(b), MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* mpc_cos -- cosine of a complex number.
|
||||
|
||||
Copyright (C) 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_cos (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
return MPC_INEX2 (mpc_sin_cos (NULL, rop, op, 0, rnd));
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* mpc_cosh -- hyperbolic cosine of a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_cosh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
/* cosh(op) = cos(i*op) */
|
||||
mpc_t z;
|
||||
|
||||
/* z = i*op without copying significand */
|
||||
mpc_realref (z)[0] = mpc_imagref (op)[0];
|
||||
mpc_imagref (z)[0] = mpc_realref (op)[0];
|
||||
MPFR_CHANGE_SIGN (mpc_realref (z));
|
||||
|
||||
return mpc_cos (rop, z, rnd);
|
||||
}
|
|
@ -0,0 +1,449 @@
|
|||
/* mpc_div -- Divide two complex numbers.
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* this routine deals with the case where w is zero */
|
||||
static int
|
||||
mpc_div_zero (mpc_ptr a, mpc_srcptr z, mpc_srcptr w, mpc_rnd_t rnd)
|
||||
/* Assumes w==0, implementation according to C99 G.5.1.8 */
|
||||
{
|
||||
int sign = MPFR_SIGNBIT (mpc_realref (w));
|
||||
mpfr_t infty;
|
||||
|
||||
mpfr_init2 (infty, MPFR_PREC_MIN);
|
||||
mpfr_set_inf (infty, sign);
|
||||
mpfr_mul (mpc_realref (a), infty, mpc_realref (z), MPC_RND_RE (rnd));
|
||||
mpfr_mul (mpc_imagref (a), infty, mpc_imagref (z), MPC_RND_IM (rnd));
|
||||
mpfr_clear (infty);
|
||||
return MPC_INEX (0, 0); /* exact */
|
||||
}
|
||||
|
||||
/* this routine deals with the case where z is infinite and w finite */
|
||||
static int
|
||||
mpc_div_inf_fin (mpc_ptr rop, mpc_srcptr z, mpc_srcptr w)
|
||||
/* Assumes w finite and non-zero and z infinite; implementation
|
||||
according to C99 G.5.1.8 */
|
||||
{
|
||||
int a, b, x, y;
|
||||
|
||||
a = (mpfr_inf_p (mpc_realref (z)) ? MPFR_SIGNBIT (mpc_realref (z)) : 0);
|
||||
b = (mpfr_inf_p (mpc_imagref (z)) ? MPFR_SIGNBIT (mpc_imagref (z)) : 0);
|
||||
|
||||
/* a is -1 if Re(z) = -Inf, 1 if Re(z) = +Inf, 0 if Re(z) is finite
|
||||
b is -1 if Im(z) = -Inf, 1 if Im(z) = +Inf, 0 if Im(z) is finite */
|
||||
|
||||
/* x = MPC_MPFR_SIGN (a * mpc_realref (w) + b * mpc_imagref (w)) */
|
||||
/* y = MPC_MPFR_SIGN (b * mpc_realref (w) - a * mpc_imagref (w)) */
|
||||
if (a == 0 || b == 0) {
|
||||
/* only one of a or b can be zero, since z is infinite */
|
||||
x = a * MPC_MPFR_SIGN (mpc_realref (w)) + b * MPC_MPFR_SIGN (mpc_imagref (w));
|
||||
y = b * MPC_MPFR_SIGN (mpc_realref (w)) - a * MPC_MPFR_SIGN (mpc_imagref (w));
|
||||
}
|
||||
else {
|
||||
/* Both parts of z are infinite; x could be determined by sign
|
||||
considerations and comparisons. Since operations with non-finite
|
||||
numbers are not considered time-critical, we let mpfr do the work. */
|
||||
mpfr_t sign;
|
||||
|
||||
mpfr_init2 (sign, 2);
|
||||
/* This is enough to determine the sign of sums and differences. */
|
||||
|
||||
if (a == 1)
|
||||
if (b == 1) {
|
||||
mpfr_add (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
x = MPC_MPFR_SIGN (sign);
|
||||
mpfr_sub (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
y = MPC_MPFR_SIGN (sign);
|
||||
}
|
||||
else { /* b == -1 */
|
||||
mpfr_sub (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
x = MPC_MPFR_SIGN (sign);
|
||||
mpfr_add (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
y = -MPC_MPFR_SIGN (sign);
|
||||
}
|
||||
else /* a == -1 */
|
||||
if (b == 1) {
|
||||
mpfr_sub (sign, mpc_imagref (w), mpc_realref (w), GMP_RNDN);
|
||||
x = MPC_MPFR_SIGN (sign);
|
||||
mpfr_add (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
y = MPC_MPFR_SIGN (sign);
|
||||
}
|
||||
else { /* b == -1 */
|
||||
mpfr_add (sign, mpc_realref (w), mpc_imagref (w), GMP_RNDN);
|
||||
x = -MPC_MPFR_SIGN (sign);
|
||||
mpfr_sub (sign, mpc_imagref (w), mpc_realref (w), GMP_RNDN);
|
||||
y = MPC_MPFR_SIGN (sign);
|
||||
}
|
||||
mpfr_clear (sign);
|
||||
}
|
||||
|
||||
if (x == 0)
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
else
|
||||
mpfr_set_inf (mpc_realref (rop), x);
|
||||
if (y == 0)
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
else
|
||||
mpfr_set_inf (mpc_imagref (rop), y);
|
||||
|
||||
return MPC_INEX (0, 0); /* exact */
|
||||
}
|
||||
|
||||
|
||||
/* this routine deals with the case where z if finite and w infinite */
|
||||
static int
|
||||
mpc_div_fin_inf (mpc_ptr rop, mpc_srcptr z, mpc_srcptr w)
|
||||
/* Assumes z finite and w infinite; implementation according to
|
||||
C99 G.5.1.8 */
|
||||
{
|
||||
mpfr_t c, d, a, b, x, y, zero;
|
||||
|
||||
mpfr_init2 (c, 2); /* needed to hold a signed zero, +1 or -1 */
|
||||
mpfr_init2 (d, 2);
|
||||
mpfr_init2 (x, 2);
|
||||
mpfr_init2 (y, 2);
|
||||
mpfr_init2 (zero, 2);
|
||||
mpfr_set_ui (zero, 0ul, GMP_RNDN);
|
||||
mpfr_init2 (a, mpfr_get_prec (mpc_realref (z)));
|
||||
mpfr_init2 (b, mpfr_get_prec (mpc_imagref (z)));
|
||||
|
||||
mpfr_set_ui (c, (mpfr_inf_p (mpc_realref (w)) ? 1 : 0), GMP_RNDN);
|
||||
MPFR_COPYSIGN (c, c, mpc_realref (w), GMP_RNDN);
|
||||
mpfr_set_ui (d, (mpfr_inf_p (mpc_imagref (w)) ? 1 : 0), GMP_RNDN);
|
||||
MPFR_COPYSIGN (d, d, mpc_imagref (w), GMP_RNDN);
|
||||
|
||||
mpfr_mul (a, mpc_realref (z), c, GMP_RNDN); /* exact */
|
||||
mpfr_mul (b, mpc_imagref (z), d, GMP_RNDN);
|
||||
mpfr_add (x, a, b, GMP_RNDN);
|
||||
|
||||
mpfr_mul (b, mpc_imagref (z), c, GMP_RNDN);
|
||||
mpfr_mul (a, mpc_realref (z), d, GMP_RNDN);
|
||||
mpfr_sub (y, b, a, GMP_RNDN);
|
||||
|
||||
MPFR_COPYSIGN (mpc_realref (rop), zero, x, GMP_RNDN);
|
||||
MPFR_COPYSIGN (mpc_imagref (rop), zero, y, GMP_RNDN);
|
||||
|
||||
mpfr_clear (c);
|
||||
mpfr_clear (d);
|
||||
mpfr_clear (x);
|
||||
mpfr_clear (y);
|
||||
mpfr_clear (zero);
|
||||
mpfr_clear (a);
|
||||
mpfr_clear (b);
|
||||
|
||||
return MPC_INEX (0, 0); /* exact */
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mpc_div_real (mpc_ptr rop, mpc_srcptr z, mpc_srcptr w, mpc_rnd_t rnd)
|
||||
/* Assumes z finite and w finite and non-zero, with imaginary part
|
||||
of w a signed zero. */
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
/* save signs of operands in case there are overlaps */
|
||||
int zrs = MPFR_SIGNBIT (mpc_realref (z));
|
||||
int zis = MPFR_SIGNBIT (mpc_imagref (z));
|
||||
int wrs = MPFR_SIGNBIT (mpc_realref (w));
|
||||
int wis = MPFR_SIGNBIT (mpc_imagref (w));
|
||||
|
||||
/* warning: rop may overlap with z,w so treat the imaginary part first */
|
||||
inex_im = mpfr_div (mpc_imagref(rop), mpc_imagref(z), mpc_realref(w), MPC_RND_IM(rnd));
|
||||
inex_re = mpfr_div (mpc_realref(rop), mpc_realref(z), mpc_realref(w), MPC_RND_RE(rnd));
|
||||
|
||||
/* correct signs of zeroes if necessary, which does not affect the
|
||||
inexact flags */
|
||||
if (mpfr_zero_p (mpc_realref (rop)))
|
||||
mpfr_setsign (mpc_realref (rop), mpc_realref (rop), (zrs != wrs && zis != wis),
|
||||
GMP_RNDN); /* exact */
|
||||
if (mpfr_zero_p (mpc_imagref (rop)))
|
||||
mpfr_setsign (mpc_imagref (rop), mpc_imagref (rop), (zis != wrs && zrs == wis),
|
||||
GMP_RNDN);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mpc_div_imag (mpc_ptr rop, mpc_srcptr z, mpc_srcptr w, mpc_rnd_t rnd)
|
||||
/* Assumes z finite and w finite and non-zero, with real part
|
||||
of w a signed zero. */
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
int overlap = (rop == z) || (rop == w);
|
||||
int imag_z = mpfr_zero_p (mpc_realref (z));
|
||||
mpfr_t wloc;
|
||||
mpc_t tmprop;
|
||||
mpc_ptr dest = (overlap) ? tmprop : rop;
|
||||
/* save signs of operands in case there are overlaps */
|
||||
int zrs = MPFR_SIGNBIT (mpc_realref (z));
|
||||
int zis = MPFR_SIGNBIT (mpc_imagref (z));
|
||||
int wrs = MPFR_SIGNBIT (mpc_realref (w));
|
||||
int wis = MPFR_SIGNBIT (mpc_imagref (w));
|
||||
|
||||
if (overlap)
|
||||
mpc_init3 (tmprop, MPC_PREC_RE (rop), MPC_PREC_IM (rop));
|
||||
|
||||
wloc[0] = mpc_imagref(w)[0]; /* copies mpfr struct IM(w) into wloc */
|
||||
inex_re = mpfr_div (mpc_realref(dest), mpc_imagref(z), wloc, MPC_RND_RE(rnd));
|
||||
mpfr_neg (wloc, wloc, GMP_RNDN);
|
||||
/* changes the sign only in wloc, not in w; no need to correct later */
|
||||
inex_im = mpfr_div (mpc_imagref(dest), mpc_realref(z), wloc, MPC_RND_IM(rnd));
|
||||
|
||||
if (overlap) {
|
||||
/* Note: we could use mpc_swap here, but this might cause problems
|
||||
if rop and tmprop have been allocated using different methods, since
|
||||
it will swap the significands of rop and tmprop. See
|
||||
http://lists.gforge.inria.fr/pipermail/mpc-discuss/2009-August/000504.html */
|
||||
mpc_set (rop, tmprop, MPC_RNDNN); /* exact */
|
||||
mpc_clear (tmprop);
|
||||
}
|
||||
|
||||
/* correct signs of zeroes if necessary, which does not affect the
|
||||
inexact flags */
|
||||
if (mpfr_zero_p (mpc_realref (rop)))
|
||||
mpfr_setsign (mpc_realref (rop), mpc_realref (rop), (zrs != wrs && zis != wis),
|
||||
GMP_RNDN); /* exact */
|
||||
if (imag_z)
|
||||
mpfr_setsign (mpc_imagref (rop), mpc_imagref (rop), (zis != wrs && zrs == wis),
|
||||
GMP_RNDN);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_div (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int ok_re = 0, ok_im = 0;
|
||||
mpc_t res, c_conj;
|
||||
mpfr_t q;
|
||||
mpfr_prec_t prec;
|
||||
int inex, inexact_prod, inexact_norm, inexact_re, inexact_im, loops = 0;
|
||||
int underflow_norm, overflow_norm, underflow_prod, overflow_prod;
|
||||
int underflow_re = 0, overflow_re = 0, underflow_im = 0, overflow_im = 0;
|
||||
mpfr_rnd_t rnd_re = MPC_RND_RE (rnd), rnd_im = MPC_RND_IM (rnd);
|
||||
int saved_underflow, saved_overflow;
|
||||
int tmpsgn;
|
||||
|
||||
/* According to the C standard G.3, there are three types of numbers: */
|
||||
/* finite (both parts are usual real numbers; contains 0), infinite */
|
||||
/* (at least one part is a real infinity) and all others; the latter */
|
||||
/* are numbers containing a nan, but no infinity, and could reasonably */
|
||||
/* be called nan. */
|
||||
/* By G.5.1.4, infinite/finite=infinite; finite/infinite=0; */
|
||||
/* all other divisions that are not finite/finite return nan+i*nan. */
|
||||
/* Division by 0 could be handled by the following case of division by */
|
||||
/* a real; we handle it separately instead. */
|
||||
if (mpc_zero_p (c))
|
||||
return mpc_div_zero (a, b, c, rnd);
|
||||
else if (mpc_inf_p (b) && mpc_fin_p (c))
|
||||
return mpc_div_inf_fin (a, b, c);
|
||||
else if (mpc_fin_p (b) && mpc_inf_p (c))
|
||||
return mpc_div_fin_inf (a, b, c);
|
||||
else if (!mpc_fin_p (b) || !mpc_fin_p (c)) {
|
||||
mpc_set_nan (a);
|
||||
return MPC_INEX (0, 0);
|
||||
}
|
||||
else if (mpfr_zero_p(mpc_imagref(c)))
|
||||
return mpc_div_real (a, b, c, rnd);
|
||||
else if (mpfr_zero_p(mpc_realref(c)))
|
||||
return mpc_div_imag (a, b, c, rnd);
|
||||
|
||||
prec = MPC_MAX_PREC(a);
|
||||
|
||||
mpc_init2 (res, 2);
|
||||
mpfr_init (q);
|
||||
|
||||
/* create the conjugate of c in c_conj without allocating new memory */
|
||||
mpc_realref (c_conj)[0] = mpc_realref (c)[0];
|
||||
mpc_imagref (c_conj)[0] = mpc_imagref (c)[0];
|
||||
MPFR_CHANGE_SIGN (mpc_imagref (c_conj));
|
||||
|
||||
/* save the underflow or overflow flags from MPFR */
|
||||
saved_underflow = mpfr_underflow_p ();
|
||||
saved_overflow = mpfr_overflow_p ();
|
||||
|
||||
do {
|
||||
loops ++;
|
||||
prec += loops <= 2 ? mpc_ceil_log2 (prec) + 5 : prec / 2;
|
||||
|
||||
mpc_set_prec (res, prec);
|
||||
mpfr_set_prec (q, prec);
|
||||
|
||||
/* first compute norm(c) */
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_norm = mpc_norm (q, c, GMP_RNDU);
|
||||
underflow_norm = mpfr_underflow_p ();
|
||||
overflow_norm = mpfr_overflow_p ();
|
||||
if (underflow_norm)
|
||||
mpfr_set_ui (q, 0ul, GMP_RNDN);
|
||||
/* to obtain divisions by 0 later on */
|
||||
|
||||
/* now compute b*conjugate(c) */
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_prod = mpc_mul (res, b, c_conj, MPC_RNDZZ);
|
||||
inexact_re = MPC_INEX_RE (inexact_prod);
|
||||
inexact_im = MPC_INEX_IM (inexact_prod);
|
||||
underflow_prod = mpfr_underflow_p ();
|
||||
overflow_prod = mpfr_overflow_p ();
|
||||
/* unfortunately, does not distinguish between under-/overflow
|
||||
in real or imaginary parts
|
||||
hopefully, the side-effects of mpc_mul do indeed raise the
|
||||
mpfr exceptions */
|
||||
if (overflow_prod) {
|
||||
int isinf = 0;
|
||||
tmpsgn = mpfr_sgn (mpc_realref(res));
|
||||
if (tmpsgn > 0)
|
||||
{
|
||||
mpfr_nextabove (mpc_realref(res));
|
||||
isinf = mpfr_inf_p (mpc_realref(res));
|
||||
mpfr_nextbelow (mpc_realref(res));
|
||||
}
|
||||
else if (tmpsgn < 0)
|
||||
{
|
||||
mpfr_nextbelow (mpc_realref(res));
|
||||
isinf = mpfr_inf_p (mpc_realref(res));
|
||||
mpfr_nextabove (mpc_realref(res));
|
||||
}
|
||||
if (isinf)
|
||||
{
|
||||
mpfr_set_inf (mpc_realref(res), tmpsgn);
|
||||
overflow_re = 1;
|
||||
}
|
||||
tmpsgn = mpfr_sgn (mpc_imagref(res));
|
||||
isinf = 0;
|
||||
if (tmpsgn > 0)
|
||||
{
|
||||
mpfr_nextabove (mpc_imagref(res));
|
||||
isinf = mpfr_inf_p (mpc_imagref(res));
|
||||
mpfr_nextbelow (mpc_imagref(res));
|
||||
}
|
||||
else if (tmpsgn < 0)
|
||||
{
|
||||
mpfr_nextbelow (mpc_imagref(res));
|
||||
isinf = mpfr_inf_p (mpc_imagref(res));
|
||||
mpfr_nextabove (mpc_imagref(res));
|
||||
}
|
||||
if (isinf)
|
||||
{
|
||||
mpfr_set_inf (mpc_imagref(res), tmpsgn);
|
||||
overflow_im = 1;
|
||||
}
|
||||
mpc_set (a, res, rnd);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* divide the product by the norm */
|
||||
if (inexact_norm == 0 && (inexact_re == 0 || inexact_im == 0)) {
|
||||
/* The division has good chances to be exact in at least one part. */
|
||||
/* Since this can cause problems when not rounding to the nearest, */
|
||||
/* we use the division code of mpfr, which handles the situation. */
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_re |= mpfr_div (mpc_realref (res), mpc_realref (res), q, GMP_RNDZ);
|
||||
underflow_re = mpfr_underflow_p ();
|
||||
overflow_re = mpfr_overflow_p ();
|
||||
ok_re = !inexact_re || underflow_re || overflow_re
|
||||
|| mpfr_can_round (mpc_realref (res), prec - 4, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_RE(a) + (rnd_re == GMP_RNDN));
|
||||
|
||||
if (ok_re) /* compute imaginary part */ {
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_im |= mpfr_div (mpc_imagref (res), mpc_imagref (res), q, GMP_RNDZ);
|
||||
underflow_im = mpfr_underflow_p ();
|
||||
overflow_im = mpfr_overflow_p ();
|
||||
ok_im = !inexact_im || underflow_im || overflow_im
|
||||
|| mpfr_can_round (mpc_imagref (res), prec - 4, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_IM(a) + (rnd_im == GMP_RNDN));
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The division is inexact, so for efficiency reasons we invert q */
|
||||
/* only once and multiply by the inverse. */
|
||||
if (mpfr_ui_div (q, 1ul, q, GMP_RNDZ) || inexact_norm) {
|
||||
/* if 1/q is inexact, the approximations of the real and
|
||||
imaginary part below will be inexact, unless RE(res)
|
||||
or IM(res) is zero */
|
||||
inexact_re |= ~mpfr_zero_p (mpc_realref (res));
|
||||
inexact_im |= ~mpfr_zero_p (mpc_imagref (res));
|
||||
}
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_re |= mpfr_mul (mpc_realref (res), mpc_realref (res), q, GMP_RNDZ);
|
||||
underflow_re = mpfr_underflow_p ();
|
||||
overflow_re = mpfr_overflow_p ();
|
||||
ok_re = !inexact_re || underflow_re || overflow_re
|
||||
|| mpfr_can_round (mpc_realref (res), prec - 4, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_RE(a) + (rnd_re == GMP_RNDN));
|
||||
|
||||
if (ok_re) /* compute imaginary part */ {
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
inexact_im |= mpfr_mul (mpc_imagref (res), mpc_imagref (res), q, GMP_RNDZ);
|
||||
underflow_im = mpfr_underflow_p ();
|
||||
overflow_im = mpfr_overflow_p ();
|
||||
ok_im = !inexact_im || underflow_im || overflow_im
|
||||
|| mpfr_can_round (mpc_imagref (res), prec - 4, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_IM(a) + (rnd_im == GMP_RNDN));
|
||||
}
|
||||
}
|
||||
} while ((!ok_re || !ok_im) && !underflow_norm && !overflow_norm
|
||||
&& !underflow_prod && !overflow_prod);
|
||||
|
||||
inex = mpc_set (a, res, rnd);
|
||||
inexact_re = MPC_INEX_RE (inex);
|
||||
inexact_im = MPC_INEX_IM (inex);
|
||||
|
||||
end:
|
||||
/* fix values and inexact flags in case of overflow/underflow */
|
||||
/* FIXME: heuristic, certainly does not cover all cases */
|
||||
if (overflow_re || (underflow_norm && !underflow_prod)) {
|
||||
mpfr_set_inf (mpc_realref (a), mpfr_sgn (mpc_realref (res)));
|
||||
inexact_re = mpfr_sgn (mpc_realref (res));
|
||||
}
|
||||
else if (underflow_re || (overflow_norm && !overflow_prod)) {
|
||||
inexact_re = mpfr_signbit (mpc_realref (res)) ? 1 : -1;
|
||||
mpfr_set_zero (mpc_realref (a), -inexact_re);
|
||||
}
|
||||
if (overflow_im || (underflow_norm && !underflow_prod)) {
|
||||
mpfr_set_inf (mpc_imagref (a), mpfr_sgn (mpc_imagref (res)));
|
||||
inexact_im = mpfr_sgn (mpc_imagref (res));
|
||||
}
|
||||
else if (underflow_im || (overflow_norm && !overflow_prod)) {
|
||||
inexact_im = mpfr_signbit (mpc_imagref (res)) ? 1 : -1;
|
||||
mpfr_set_zero (mpc_imagref (a), -inexact_im);
|
||||
}
|
||||
|
||||
mpc_clear (res);
|
||||
mpfr_clear (q);
|
||||
|
||||
/* restore underflow and overflow flags from MPFR */
|
||||
if (saved_underflow)
|
||||
mpfr_set_underflow ();
|
||||
if (saved_overflow)
|
||||
mpfr_set_overflow ();
|
||||
|
||||
return MPC_INEX (inexact_re, inexact_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_div_2si -- Divide a complex number by 2^e.
|
||||
|
||||
Copyright (C) 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_div_2si (mpc_ptr a, mpc_srcptr b, long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_div_2si (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_div_2si (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_div_2ui -- Divide a complex number by 2^e.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_div_2ui (mpc_ptr a, mpc_srcptr b, unsigned long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_div_2ui (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_div_2ui (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* mpc_div_fr -- Divide a complex number by a floating-point number.
|
||||
|
||||
Copyright (C) 2002, 2008, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_div_fr (mpc_ptr a, mpc_srcptr b, mpfr_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
mpfr_t real;
|
||||
|
||||
/* We have to use temporary variable in case c=mpc_realref (a). */
|
||||
mpfr_init2 (real, MPC_PREC_RE (a));
|
||||
|
||||
inex_re = mpfr_div (real, mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_div (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
mpfr_set (mpc_realref (a), real, GMP_RNDN);
|
||||
|
||||
mpfr_clear (real);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_div_ui -- Divide a complex number by a nonnegative integer.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_div_ui (mpc_ptr a, mpc_srcptr b, unsigned long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_div_ui (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_div_ui (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
/* mpc_exp -- exponential of a complex number.
|
||||
|
||||
Copyright (C) 2002, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_exp (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
mpfr_t x, y, z;
|
||||
mpfr_prec_t prec;
|
||||
int ok = 0;
|
||||
int inex_re, inex_im;
|
||||
int saved_underflow, saved_overflow;
|
||||
|
||||
/* special values */
|
||||
if (mpfr_nan_p (mpc_realref (op)) || mpfr_nan_p (mpc_imagref (op)))
|
||||
/* NaNs
|
||||
exp(nan +i*y) = nan -i*0 if y = -0,
|
||||
nan +i*0 if y = +0,
|
||||
nan +i*nan otherwise
|
||||
exp(x+i*nan) = +/-0 +/-i*0 if x=-inf,
|
||||
+/-inf +i*nan if x=+inf,
|
||||
nan +i*nan otherwise */
|
||||
{
|
||||
if (mpfr_zero_p (mpc_imagref (op)))
|
||||
return mpc_set (rop, op, MPC_RNDNN);
|
||||
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
{
|
||||
if (mpfr_signbit (mpc_realref (op)))
|
||||
return mpc_set_ui_ui (rop, 0, 0, MPC_RNDNN);
|
||||
else
|
||||
{
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
return MPC_INEX(0, 0); /* Inf/NaN are exact */
|
||||
}
|
||||
}
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
return MPC_INEX(0, 0); /* NaN is exact */
|
||||
}
|
||||
|
||||
|
||||
if (mpfr_zero_p (mpc_imagref(op)))
|
||||
/* special case when the input is real
|
||||
exp(x-i*0) = exp(x) -i*0, even if x is NaN
|
||||
exp(x+i*0) = exp(x) +i*0, even if x is NaN */
|
||||
{
|
||||
inex_re = mpfr_exp (mpc_realref(rop), mpc_realref(op), MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_set (mpc_imagref(rop), mpc_imagref(op), MPC_RND_IM(rnd));
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
if (mpfr_zero_p (mpc_realref (op)))
|
||||
/* special case when the input is imaginary */
|
||||
{
|
||||
inex_re = mpfr_cos (mpc_realref (rop), mpc_imagref (op), MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_sin (mpc_imagref (rop), mpc_imagref (op), MPC_RND_IM(rnd));
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
/* real part is an infinity,
|
||||
exp(-inf +i*y) = 0*(cos y +i*sin y)
|
||||
exp(+inf +i*y) = +/-inf +i*nan if y = +/-inf
|
||||
+inf*(cos y +i*sin y) if 0 < |y| < inf */
|
||||
{
|
||||
mpfr_t n;
|
||||
|
||||
mpfr_init2 (n, 2);
|
||||
if (mpfr_signbit (mpc_realref (op)))
|
||||
mpfr_set_ui (n, 0, GMP_RNDN);
|
||||
else
|
||||
mpfr_set_inf (n, +1);
|
||||
|
||||
if (mpfr_inf_p (mpc_imagref (op)))
|
||||
{
|
||||
inex_re = mpfr_set (mpc_realref (rop), n, GMP_RNDN);
|
||||
if (mpfr_signbit (mpc_realref (op)))
|
||||
inex_im = mpfr_set (mpc_imagref (rop), n, GMP_RNDN);
|
||||
else
|
||||
{
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
inex_im = 0; /* NaN is exact */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfr_t c, s;
|
||||
mpfr_init2 (c, 2);
|
||||
mpfr_init2 (s, 2);
|
||||
|
||||
mpfr_sin_cos (s, c, mpc_imagref (op), GMP_RNDN);
|
||||
inex_re = mpfr_copysign (mpc_realref (rop), n, c, GMP_RNDN);
|
||||
inex_im = mpfr_copysign (mpc_imagref (rop), n, s, GMP_RNDN);
|
||||
|
||||
mpfr_clear (s);
|
||||
mpfr_clear (c);
|
||||
}
|
||||
|
||||
mpfr_clear (n);
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
if (mpfr_inf_p (mpc_imagref (op)))
|
||||
/* real part is finite non-zero number, imaginary part is an infinity */
|
||||
{
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
return MPC_INEX(0, 0); /* NaN is exact */
|
||||
}
|
||||
|
||||
|
||||
/* from now on, both parts of op are regular numbers */
|
||||
|
||||
prec = MPC_MAX_PREC(rop)
|
||||
+ MPC_MAX (MPC_MAX (-mpfr_get_exp (mpc_realref (op)), 0),
|
||||
-mpfr_get_exp (mpc_imagref (op)));
|
||||
/* When op is close to 0, then exp is close to 1+Re(op), while
|
||||
cos is close to 1-Im(op); to decide on the ternary value of exp*cos,
|
||||
we need a high enough precision so that none of exp or cos is
|
||||
computed as 1. */
|
||||
mpfr_init2 (x, 2);
|
||||
mpfr_init2 (y, 2);
|
||||
mpfr_init2 (z, 2);
|
||||
|
||||
/* save the underflow or overflow flags from MPFR */
|
||||
saved_underflow = mpfr_underflow_p ();
|
||||
saved_overflow = mpfr_overflow_p ();
|
||||
|
||||
do
|
||||
{
|
||||
prec += mpc_ceil_log2 (prec) + 5;
|
||||
|
||||
mpfr_set_prec (x, prec);
|
||||
mpfr_set_prec (y, prec);
|
||||
mpfr_set_prec (z, prec);
|
||||
|
||||
/* FIXME: x may overflow so x.y does overflow too, while Re(exp(op))
|
||||
could be represented in the precision of rop. */
|
||||
mpfr_clear_overflow ();
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_exp (x, mpc_realref(op), GMP_RNDN); /* error <= 0.5ulp */
|
||||
mpfr_sin_cos (z, y, mpc_imagref(op), GMP_RNDN); /* errors <= 0.5ulp */
|
||||
mpfr_mul (y, y, x, GMP_RNDN); /* error <= 2ulp */
|
||||
ok = mpfr_overflow_p () || mpfr_zero_p (x)
|
||||
|| mpfr_can_round (y, prec - 2, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_RE(rop) + (MPC_RND_RE(rnd) == GMP_RNDN));
|
||||
if (ok) /* compute imaginary part */
|
||||
{
|
||||
mpfr_mul (z, z, x, GMP_RNDN);
|
||||
ok = mpfr_overflow_p () || mpfr_zero_p (x)
|
||||
|| mpfr_can_round (z, prec - 2, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_IM(rop) + (MPC_RND_IM(rnd) == GMP_RNDN));
|
||||
}
|
||||
}
|
||||
while (ok == 0);
|
||||
|
||||
inex_re = mpfr_set (mpc_realref(rop), y, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_set (mpc_imagref(rop), z, MPC_RND_IM(rnd));
|
||||
if (mpfr_overflow_p ()) {
|
||||
/* overflow in real exponential, inex is sign of infinite result */
|
||||
inex_re = mpfr_sgn (y);
|
||||
inex_im = mpfr_sgn (z);
|
||||
}
|
||||
else if (mpfr_underflow_p ()) {
|
||||
/* underflow in real exponential, inex is opposite of sign of 0 result */
|
||||
inex_re = (mpfr_signbit (y) ? +1 : -1);
|
||||
inex_im = (mpfr_signbit (z) ? +1 : -1);
|
||||
}
|
||||
|
||||
mpfr_clear (x);
|
||||
mpfr_clear (y);
|
||||
mpfr_clear (z);
|
||||
|
||||
/* restore underflow and overflow flags from MPFR */
|
||||
if (saved_underflow)
|
||||
mpfr_set_underflow ();
|
||||
if (saved_overflow)
|
||||
mpfr_set_overflow ();
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
/* mpc_fma -- Fused multiply-add of three complex numbers
|
||||
|
||||
Copyright (C) 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return a bound on the precision needed to add or subtract x and y exactly */
|
||||
static mpfr_prec_t
|
||||
bound_prec_addsub (mpfr_srcptr x, mpfr_srcptr y)
|
||||
{
|
||||
if (!mpfr_regular_p (x))
|
||||
return mpfr_get_prec (y);
|
||||
else if (!mpfr_regular_p (y))
|
||||
return mpfr_get_prec (x);
|
||||
else /* neither x nor y are NaN, Inf or zero */
|
||||
{
|
||||
mpfr_exp_t ex = mpfr_get_exp (x);
|
||||
mpfr_exp_t ey = mpfr_get_exp (y);
|
||||
mpfr_exp_t ulpx = ex - mpfr_get_prec (x);
|
||||
mpfr_exp_t ulpy = ey - mpfr_get_prec (y);
|
||||
return ((ex >= ey) ? ex : ey) + 1 - ((ulpx <= ulpy) ? ulpx : ulpy);
|
||||
}
|
||||
}
|
||||
|
||||
/* r <- a*b+c */
|
||||
int
|
||||
mpc_fma_naive (mpc_ptr r, mpc_srcptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
mpfr_t rea_reb, rea_imb, ima_reb, ima_imb, tmp;
|
||||
mpfr_prec_t pre12, pre13, pre23, pim12, pim13, pim23;
|
||||
int inex_re, inex_im;
|
||||
|
||||
mpfr_init2 (rea_reb, mpfr_get_prec (mpc_realref(a)) + mpfr_get_prec (mpc_realref(b)));
|
||||
mpfr_init2 (rea_imb, mpfr_get_prec (mpc_realref(a)) + mpfr_get_prec (mpc_imagref(b)));
|
||||
mpfr_init2 (ima_reb, mpfr_get_prec (mpc_imagref(a)) + mpfr_get_prec (mpc_realref(b)));
|
||||
mpfr_init2 (ima_imb, mpfr_get_prec (mpc_imagref(a)) + mpfr_get_prec (mpc_imagref(b)));
|
||||
|
||||
mpfr_mul (rea_reb, mpc_realref(a), mpc_realref(b), GMP_RNDZ); /* exact */
|
||||
mpfr_mul (rea_imb, mpc_realref(a), mpc_imagref(b), GMP_RNDZ); /* exact */
|
||||
mpfr_mul (ima_reb, mpc_imagref(a), mpc_realref(b), GMP_RNDZ); /* exact */
|
||||
mpfr_mul (ima_imb, mpc_imagref(a), mpc_imagref(b), GMP_RNDZ); /* exact */
|
||||
|
||||
/* Re(r) <- rea_reb - ima_imb + Re(c) */
|
||||
|
||||
pre12 = bound_prec_addsub (rea_reb, ima_imb); /* bound on exact precision for
|
||||
rea_reb - ima_imb */
|
||||
pre13 = bound_prec_addsub (rea_reb, mpc_realref(c));
|
||||
/* bound for rea_reb + Re(c) */
|
||||
pre23 = bound_prec_addsub (ima_imb, mpc_realref(c));
|
||||
/* bound for ima_imb - Re(c) */
|
||||
if (pre12 <= pre13 && pre12 <= pre23) /* (rea_reb - ima_imb) + Re(c) */
|
||||
{
|
||||
mpfr_init2 (tmp, pre12);
|
||||
mpfr_sub (tmp, rea_reb, ima_imb, GMP_RNDZ); /* exact */
|
||||
inex_re = mpfr_add (mpc_realref(r), tmp, mpc_realref(c), MPC_RND_RE(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the real part of both, it is ok */
|
||||
}
|
||||
else if (pre13 <= pre23) /* (rea_reb + Re(c)) - ima_imb */
|
||||
{
|
||||
mpfr_init2 (tmp, pre13);
|
||||
mpfr_add (tmp, rea_reb, mpc_realref(c), GMP_RNDZ); /* exact */
|
||||
inex_re = mpfr_sub (mpc_realref(r), tmp, ima_imb, MPC_RND_RE(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the real part of both, it is ok */
|
||||
}
|
||||
else /* rea_reb + (Re(c) - ima_imb) */
|
||||
{
|
||||
mpfr_init2 (tmp, pre23);
|
||||
mpfr_sub (tmp, mpc_realref(c), ima_imb, GMP_RNDZ); /* exact */
|
||||
inex_re = mpfr_add (mpc_realref(r), tmp, rea_reb, MPC_RND_RE(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the real part of both, it is ok */
|
||||
}
|
||||
|
||||
/* Im(r) <- rea_imb + ima_reb + Im(c) */
|
||||
pim12 = bound_prec_addsub (rea_imb, ima_reb); /* bound on exact precision for
|
||||
rea_imb + ima_reb */
|
||||
pim13 = bound_prec_addsub (rea_imb, mpc_imagref(c));
|
||||
/* bound for rea_imb + Im(c) */
|
||||
pim23 = bound_prec_addsub (ima_reb, mpc_imagref(c));
|
||||
/* bound for ima_reb + Im(c) */
|
||||
if (pim12 <= pim13 && pim12 <= pim23) /* (rea_imb + ima_reb) + Im(c) */
|
||||
{
|
||||
mpfr_set_prec (tmp, pim12);
|
||||
mpfr_add (tmp, rea_imb, ima_reb, GMP_RNDZ); /* exact */
|
||||
inex_im = mpfr_add (mpc_imagref(r), tmp, mpc_imagref(c), MPC_RND_IM(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the imaginary part of both, it is ok */
|
||||
}
|
||||
else if (pim13 <= pim23) /* (rea_imb + Im(c)) + ima_reb */
|
||||
{
|
||||
mpfr_set_prec (tmp, pim13);
|
||||
mpfr_add (tmp, rea_imb, mpc_imagref(c), GMP_RNDZ); /* exact */
|
||||
inex_im = mpfr_add (mpc_imagref(r), tmp, ima_reb, MPC_RND_IM(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the imaginary part of both, it is ok */
|
||||
}
|
||||
else /* rea_imb + (Im(c) + ima_reb) */
|
||||
{
|
||||
mpfr_set_prec (tmp, pre23);
|
||||
mpfr_add (tmp, mpc_imagref(c), ima_reb, GMP_RNDZ); /* exact */
|
||||
inex_im = mpfr_add (mpc_imagref(r), tmp, rea_imb, MPC_RND_IM(rnd));
|
||||
/* the only possible bad overlap is between r and c, but since we are
|
||||
only touching the imaginary part of both, it is ok */
|
||||
}
|
||||
|
||||
mpfr_clear (rea_reb);
|
||||
mpfr_clear (rea_imb);
|
||||
mpfr_clear (ima_reb);
|
||||
mpfr_clear (ima_imb);
|
||||
mpfr_clear (tmp);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* The algorithm is as follows:
|
||||
- in a first pass, we use the target precision + some extra bits
|
||||
- if it fails, we add the number of cancelled bits when adding
|
||||
Re(a*b) and Re(c) [similarly for the imaginary part]
|
||||
- it is fails again, we call the mpc_fma_naive function, which also
|
||||
deals with the special cases */
|
||||
int
|
||||
mpc_fma (mpc_ptr r, mpc_srcptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
mpc_t ab;
|
||||
mpfr_prec_t pre, pim, wpre, wpim;
|
||||
mpfr_exp_t diffre, diffim;
|
||||
int i, inex = 0, okre = 0, okim = 0;
|
||||
|
||||
if (mpc_fin_p (a) == 0 || mpc_fin_p (b) == 0 || mpc_fin_p (c) == 0)
|
||||
return mpc_fma_naive (r, a, b, c, rnd);
|
||||
|
||||
pre = mpfr_get_prec (mpc_realref(r));
|
||||
pim = mpfr_get_prec (mpc_imagref(r));
|
||||
wpre = pre + mpc_ceil_log2 (pre) + 10;
|
||||
wpim = pim + mpc_ceil_log2 (pim) + 10;
|
||||
mpc_init3 (ab, wpre, wpim);
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
mpc_mul (ab, a, b, MPC_RNDZZ);
|
||||
if (mpfr_zero_p (mpc_realref(ab)) || mpfr_zero_p (mpc_imagref(ab)))
|
||||
break;
|
||||
diffre = mpfr_get_exp (mpc_realref(ab));
|
||||
diffim = mpfr_get_exp (mpc_imagref(ab));
|
||||
mpc_add (ab, ab, c, MPC_RNDZZ);
|
||||
if (mpfr_zero_p (mpc_realref(ab)) || mpfr_zero_p (mpc_imagref(ab)))
|
||||
break;
|
||||
diffre -= mpfr_get_exp (mpc_realref(ab));
|
||||
diffim -= mpfr_get_exp (mpc_imagref(ab));
|
||||
diffre = (diffre > 0 ? diffre + 1 : 1);
|
||||
diffim = (diffim > 0 ? diffim + 1 : 1);
|
||||
okre = diffre > (mpfr_exp_t) wpre ? 0 : mpfr_can_round (mpc_realref(ab),
|
||||
wpre - diffre, GMP_RNDN, GMP_RNDZ,
|
||||
pre + (MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
okim = diffim > (mpfr_exp_t) wpim ? 0 : mpfr_can_round (mpc_imagref(ab),
|
||||
wpim - diffim, GMP_RNDN, GMP_RNDZ,
|
||||
pim + (MPC_RND_IM (rnd) == GMP_RNDN));
|
||||
if (okre && okim)
|
||||
{
|
||||
inex = mpc_set (r, ab, rnd);
|
||||
break;
|
||||
}
|
||||
if (i == 1)
|
||||
break;
|
||||
if (okre == 0 && diffre > 1)
|
||||
wpre += diffre;
|
||||
if (okim == 0 && diffim > 1)
|
||||
wpim += diffim;
|
||||
mpfr_set_prec (mpc_realref(ab), wpre);
|
||||
mpfr_set_prec (mpc_imagref(ab), wpim);
|
||||
}
|
||||
mpc_clear (ab);
|
||||
return okre && okim ? inex : mpc_fma_naive (r, a, b, c, rnd);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* mpc_fr_div -- Divide a floating-point number by a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_fr_div (mpc_ptr a, mpfr_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
mpc_t bc;
|
||||
int inexact;
|
||||
|
||||
mpc_realref (bc)[0] = b [0];
|
||||
mpfr_init (mpc_imagref (bc));
|
||||
/* we consider the operand b to have imaginary part +0 */
|
||||
mpfr_set_ui (mpc_imagref (bc), 0, GMP_RNDN);
|
||||
|
||||
inexact = mpc_div (a, bc, c, rnd);
|
||||
|
||||
mpfr_clear (mpc_imagref (bc));
|
||||
|
||||
return inexact;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mpc_fr_sub -- Substract a complex number from a floating-point number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* return 0 iff both the real and imaginary parts are exact */
|
||||
int
|
||||
mpc_fr_sub (mpc_ptr a, mpfr_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_sub (mpc_realref (a), b, mpc_realref (c), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_neg (mpc_imagref (a), mpc_imagref (c), MPC_RND_IM (rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* mpc_get_prec -- returns the common precision of real and imaginary part, or 0 if they differ
|
||||
|
||||
Copyright (C) 2007, 2009, 2010 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
mpfr_prec_t
|
||||
mpc_get_prec (mpc_srcptr x)
|
||||
{
|
||||
mpfr_prec_t precre = MPC_PREC_RE (x);
|
||||
return (MPC_PREC_IM (x) == precre ? precre : 0);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* mpc_get_prec2 -- returns the precisions of the real and of the imaginary
|
||||
part through the first two arguments
|
||||
|
||||
Copyright (C) 2007, 2009, 2010 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
void
|
||||
mpc_get_prec2 (mpfr_prec_t *pr, mpfr_prec_t *pi, mpc_srcptr x)
|
||||
{
|
||||
*pr = MPC_PREC_RE (x);
|
||||
*pi = MPC_PREC_IM (x);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* mpc_get_version -- MPC version
|
||||
|
||||
Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
#if MPFR_VERSION_MAJOR < 3
|
||||
/* The following are functions defined for compatibility with mpfr < 3;
|
||||
logically, they should be defined in a separate file, but then gcc
|
||||
complains about an empty translation unit with mpfr >= 3. */
|
||||
|
||||
void
|
||||
mpfr_set_zero (mpfr_ptr z, int s)
|
||||
{
|
||||
mpfr_set_ui (z, 0ul, GMP_RNDN);
|
||||
if (s < 0)
|
||||
mpfr_neg (z, z, GMP_RNDN);
|
||||
}
|
||||
|
||||
int
|
||||
mpfr_regular_p (mpfr_srcptr z)
|
||||
{
|
||||
return (mpfr_number_p (z) && !mpfr_zero_p (z));
|
||||
}
|
||||
#endif /* mpfr < 3 */
|
||||
|
||||
|
||||
const char *
|
||||
mpc_get_version (void)
|
||||
{
|
||||
return "1.0.1";
|
||||
}
|
|
@ -0,0 +1,236 @@
|
|||
/* mpc_get_dc, mpc_get_ldc -- Transform mpc number into C complex number
|
||||
mpc_get_str -- Convert a complex number into a string.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_COMPLEX_H
|
||||
#include <complex.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* for sprintf, fprintf */
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "mpc-impl.h"
|
||||
|
||||
#ifdef HAVE_COMPLEX_H
|
||||
double _Complex
|
||||
mpc_get_dc (mpc_srcptr op, mpc_rnd_t rnd) {
|
||||
return I * mpfr_get_d (mpc_imagref (op), MPC_RND_IM (rnd))
|
||||
+ mpfr_get_d (mpc_realref (op), MPC_RND_RE (rnd));
|
||||
}
|
||||
|
||||
long double _Complex
|
||||
mpc_get_ldc (mpc_srcptr op, mpc_rnd_t rnd) {
|
||||
return I * mpfr_get_ld (mpc_imagref (op), MPC_RND_IM (rnd))
|
||||
+ mpfr_get_ld (mpc_realref (op), MPC_RND_RE (rnd));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Code for mpc_get_str. The output format is "(real imag)", the decimal point
|
||||
of the locale is used. */
|
||||
|
||||
/* mpfr_prec_t can be either int or long int */
|
||||
#if (__GMP_MP_SIZE_T_INT == 1)
|
||||
#define MPC_EXP_FORMAT_SPEC "i"
|
||||
#elif (__GMP_MP_SIZE_T_INT == 0)
|
||||
#define MPC_EXP_FORMAT_SPEC "li"
|
||||
#else
|
||||
#error "mpfr_exp_t size not supported"
|
||||
#endif
|
||||
|
||||
static char *
|
||||
pretty_zero (mpfr_srcptr zero)
|
||||
{
|
||||
char *pretty;
|
||||
|
||||
pretty = mpc_alloc_str (3);
|
||||
|
||||
pretty[0] = mpfr_signbit (zero) ? '-' : '+';
|
||||
pretty[1] = '0';
|
||||
pretty[2] = '\0';
|
||||
|
||||
return pretty;
|
||||
}
|
||||
|
||||
static char *
|
||||
prettify (const char *str, const mp_exp_t expo, int base, int special)
|
||||
{
|
||||
size_t sz;
|
||||
char *pretty;
|
||||
char *p;
|
||||
const char *s;
|
||||
mp_exp_t x;
|
||||
int sign;
|
||||
|
||||
sz = strlen (str) + 1; /* + terminal '\0' */
|
||||
|
||||
if (special)
|
||||
{
|
||||
/* special number: nan or inf */
|
||||
pretty = mpc_alloc_str (sz);
|
||||
strcpy (pretty, str);
|
||||
|
||||
return pretty;
|
||||
}
|
||||
|
||||
/* regular number */
|
||||
|
||||
sign = (str[0] == '-' || str[0] == '+');
|
||||
|
||||
x = expo - 1; /* expo is the exponent value with decimal point BEFORE
|
||||
the first digit, we wants decimal point AFTER the first
|
||||
digit */
|
||||
if (base == 16)
|
||||
x <<= 2; /* the output exponent is a binary exponent */
|
||||
|
||||
++sz; /* + decimal point */
|
||||
|
||||
if (x != 0)
|
||||
{
|
||||
/* augment sz with the size needed for an exponent written in base
|
||||
ten */
|
||||
mp_exp_t xx;
|
||||
|
||||
sz += 3; /* + exponent char + sign + 1 digit */
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
/* avoid overflow when changing sign (assuming that, for the
|
||||
mp_exp_t type, (max value) is greater than (- min value / 10)) */
|
||||
if (x < -10)
|
||||
{
|
||||
xx = - (x / 10);
|
||||
sz++;
|
||||
}
|
||||
else
|
||||
xx = -x;
|
||||
}
|
||||
else
|
||||
xx = x;
|
||||
|
||||
/* compute sz += floor(log(expo)/log(10)) without using libm
|
||||
functions */
|
||||
while (xx > 9)
|
||||
{
|
||||
sz++;
|
||||
xx /= 10;
|
||||
}
|
||||
}
|
||||
|
||||
pretty = mpc_alloc_str (sz);
|
||||
p = pretty;
|
||||
|
||||
/* 1. optional sign plus first digit */
|
||||
s = str;
|
||||
*p++ = *s++;
|
||||
if (sign)
|
||||
*p++ = *s++;
|
||||
|
||||
/* 2. decimal point */
|
||||
#ifdef HAVE_LOCALECONV
|
||||
*p++ = *localeconv ()->decimal_point;
|
||||
#else
|
||||
*p++ = '.';
|
||||
#endif
|
||||
*p = '\0';
|
||||
|
||||
/* 3. other significant digits */
|
||||
strcat (pretty, s);
|
||||
|
||||
/* 4. exponent (in base ten) */
|
||||
if (x == 0)
|
||||
return pretty;
|
||||
|
||||
p = pretty + strlen (str) + 1;
|
||||
|
||||
switch (base)
|
||||
{
|
||||
case 10:
|
||||
*p++ = 'e';
|
||||
break;
|
||||
case 2:
|
||||
case 16:
|
||||
*p++ = 'p';
|
||||
break;
|
||||
default:
|
||||
*p++ = '@';
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
|
||||
sprintf (p, "%+"MPC_EXP_FORMAT_SPEC, x);
|
||||
|
||||
return pretty;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_pretty_str (const int base, const size_t n, mpfr_srcptr x, mpfr_rnd_t rnd)
|
||||
{
|
||||
mp_exp_t expo;
|
||||
char *ugly;
|
||||
char *pretty;
|
||||
|
||||
if (mpfr_zero_p (x))
|
||||
return pretty_zero (x);
|
||||
|
||||
ugly = mpfr_get_str (NULL, &expo, base, n, x, rnd);
|
||||
MPC_ASSERT (ugly != NULL);
|
||||
pretty = prettify (ugly, expo, base, !mpfr_number_p (x));
|
||||
mpfr_free_str (ugly);
|
||||
|
||||
return pretty;
|
||||
}
|
||||
|
||||
char *
|
||||
mpc_get_str (int base, size_t n, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
size_t needed_size;
|
||||
char *real_str;
|
||||
char *imag_str;
|
||||
char *complex_str = NULL;
|
||||
|
||||
if (base < 2 || base > 36)
|
||||
return NULL;
|
||||
|
||||
real_str = get_pretty_str (base, n, mpc_realref (op), MPC_RND_RE (rnd));
|
||||
imag_str = get_pretty_str (base, n, mpc_imagref (op), MPC_RND_IM (rnd));
|
||||
|
||||
needed_size = strlen (real_str) + strlen (imag_str) + 4;
|
||||
|
||||
complex_str = mpc_alloc_str (needed_size);
|
||||
MPC_ASSERT (complex_str != NULL);
|
||||
|
||||
strcpy (complex_str, "(");
|
||||
strcat (complex_str, real_str);
|
||||
strcat (complex_str, " ");
|
||||
strcat (complex_str, imag_str);
|
||||
strcat (complex_str, ")");
|
||||
|
||||
mpc_free_str (real_str);
|
||||
mpc_free_str (imag_str);
|
||||
|
||||
return complex_str;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* mpc_imag -- Get the imaginary part of a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_imag (mpfr_ptr a, mpc_srcptr b, mpfr_rnd_t rnd)
|
||||
{
|
||||
return mpfr_set (a, mpc_imagref (b), rnd);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* mpc_init2 -- Initialize a complex variable with a given precision.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
void
|
||||
mpc_init2 (mpc_t x, mpfr_prec_t prec)
|
||||
{
|
||||
mpfr_init2 (mpc_realref(x), prec);
|
||||
mpfr_init2 (mpc_imagref(x), prec);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* mpc_init3 -- Initialize a complex variable with given precisions.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
void
|
||||
mpc_init3 (mpc_t x, mpfr_prec_t prec_re, mpfr_prec_t prec_im)
|
||||
{
|
||||
mpfr_init2 (mpc_realref(x), prec_re);
|
||||
mpfr_init2 (mpc_imagref(x), prec_im);
|
||||
}
|
|
@ -0,0 +1,239 @@
|
|||
/* mpc_inp_str -- Input a complex number from a given stream.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "mpc-impl.h"
|
||||
|
||||
static size_t
|
||||
skip_whitespace (FILE *stream)
|
||||
{
|
||||
int c = getc (stream);
|
||||
size_t size = 0;
|
||||
while (c != EOF && isspace ((unsigned char) c)) {
|
||||
c = getc (stream);
|
||||
size++;
|
||||
}
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Extract from stream the longest string made up of alphanumeric char and
|
||||
'_' (i.e. n-char-sequence).
|
||||
The user must free the returned string. */
|
||||
static char *
|
||||
extract_suffix (FILE *stream)
|
||||
{
|
||||
int c;
|
||||
size_t nread = 0;
|
||||
size_t strsize = 100;
|
||||
char *str = mpc_alloc_str (strsize);
|
||||
|
||||
c = getc (stream);
|
||||
while (isalnum ((unsigned char) c) || c == '_') {
|
||||
str [nread] = (char) c;
|
||||
nread++;
|
||||
if (nread == strsize) {
|
||||
str = mpc_realloc_str (str, strsize, 2 * strsize);
|
||||
strsize *= 2;
|
||||
}
|
||||
c = getc (stream);
|
||||
}
|
||||
|
||||
str = mpc_realloc_str (str, strsize, nread + 1);
|
||||
strsize = nread + 1;
|
||||
str [nread] = '\0';
|
||||
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/* Extract from the stream the longest string of characters which are neither
|
||||
whitespace nor brackets (except for an optional bracketed n-char_sequence
|
||||
directly following nan or @nan@ independently of case).
|
||||
The user must free the returned string. */
|
||||
static char *
|
||||
extract_string (FILE *stream)
|
||||
{
|
||||
int c;
|
||||
size_t nread = 0;
|
||||
size_t strsize = 100;
|
||||
char *str = mpc_alloc_str (strsize);
|
||||
size_t lenstr;
|
||||
|
||||
c = getc (stream);
|
||||
while (c != EOF && c != '\n'
|
||||
&& !isspace ((unsigned char) c)
|
||||
&& c != '(' && c != ')') {
|
||||
str [nread] = (char) c;
|
||||
nread++;
|
||||
if (nread == strsize) {
|
||||
str = mpc_realloc_str (str, strsize, 2 * strsize);
|
||||
strsize *= 2;
|
||||
}
|
||||
c = getc (stream);
|
||||
}
|
||||
|
||||
str = mpc_realloc_str (str, strsize, nread + 1);
|
||||
strsize = nread + 1;
|
||||
str [nread] = '\0';
|
||||
|
||||
if (nread == 0)
|
||||
return str;
|
||||
|
||||
lenstr = nread;
|
||||
|
||||
if (c == '(') {
|
||||
size_t n;
|
||||
char *suffix;
|
||||
int ret;
|
||||
|
||||
/* (n-char-sequence) only after a NaN */
|
||||
if ((nread != 3
|
||||
|| tolower ((unsigned char) (str[0])) != 'n'
|
||||
|| tolower ((unsigned char) (str[1])) != 'a'
|
||||
|| tolower ((unsigned char) (str[2])) != 'n')
|
||||
&& (nread != 5
|
||||
|| str[0] != '@'
|
||||
|| tolower ((unsigned char) (str[1])) != 'n'
|
||||
|| tolower ((unsigned char) (str[2])) != 'a'
|
||||
|| tolower ((unsigned char) (str[3])) != 'n'
|
||||
|| str[4] != '@')) {
|
||||
ungetc (c, stream);
|
||||
return str;
|
||||
}
|
||||
|
||||
suffix = extract_suffix (stream);
|
||||
nread += strlen (suffix) + 1;
|
||||
if (nread >= strsize) {
|
||||
str = mpc_realloc_str (str, strsize, nread + 1);
|
||||
strsize = nread + 1;
|
||||
}
|
||||
|
||||
/* Warning: the sprintf does not allow overlap between arguments. */
|
||||
ret = sprintf (str + lenstr, "(%s", suffix);
|
||||
MPC_ASSERT (ret >= 0);
|
||||
n = lenstr + (size_t) ret;
|
||||
MPC_ASSERT (n == nread);
|
||||
|
||||
c = getc (stream);
|
||||
if (c == ')') {
|
||||
str = mpc_realloc_str (str, strsize, nread + 2);
|
||||
strsize = nread + 2;
|
||||
str [nread] = (char) c;
|
||||
str [nread+1] = '\0';
|
||||
nread++;
|
||||
}
|
||||
else if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
|
||||
mpc_free_str (suffix);
|
||||
}
|
||||
else if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_inp_str (mpc_ptr rop, FILE *stream, size_t *read, int base,
|
||||
mpc_rnd_t rnd_mode)
|
||||
{
|
||||
size_t white, nread = 0;
|
||||
int inex = -1;
|
||||
int c;
|
||||
char *str;
|
||||
|
||||
if (stream == NULL)
|
||||
stream = stdin;
|
||||
|
||||
white = skip_whitespace (stream);
|
||||
c = getc (stream);
|
||||
if (c != EOF) {
|
||||
if (c == '(') {
|
||||
char *real_str;
|
||||
char *imag_str;
|
||||
size_t n;
|
||||
int ret;
|
||||
|
||||
nread++; /* the opening parenthesis */
|
||||
white = skip_whitespace (stream);
|
||||
real_str = extract_string (stream);
|
||||
nread += strlen(real_str);
|
||||
|
||||
c = getc (stream);
|
||||
if (!isspace ((unsigned int) c)) {
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
mpc_free_str (real_str);
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
ungetc (c, stream);
|
||||
|
||||
white += skip_whitespace (stream);
|
||||
imag_str = extract_string (stream);
|
||||
nread += strlen (imag_str);
|
||||
|
||||
str = mpc_alloc_str (nread + 2);
|
||||
ret = sprintf (str, "(%s %s", real_str, imag_str);
|
||||
MPC_ASSERT (ret >= 0);
|
||||
n = (size_t) ret;
|
||||
MPC_ASSERT (n == nread + 1);
|
||||
mpc_free_str (real_str);
|
||||
mpc_free_str (imag_str);
|
||||
|
||||
white += skip_whitespace (stream);
|
||||
c = getc (stream);
|
||||
if (c == ')') {
|
||||
str = mpc_realloc_str (str, nread +2, nread + 3);
|
||||
str [nread+1] = (char) c;
|
||||
str [nread+2] = '\0';
|
||||
nread++;
|
||||
}
|
||||
else if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
}
|
||||
else {
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
str = extract_string (stream);
|
||||
nread += strlen (str);
|
||||
}
|
||||
|
||||
inex = mpc_set_str (rop, str, base, rnd_mode);
|
||||
|
||||
mpc_free_str (str);
|
||||
}
|
||||
|
||||
error:
|
||||
if (inex == -1) {
|
||||
mpfr_set_nan (mpc_realref(rop));
|
||||
mpfr_set_nan (mpc_imagref(rop));
|
||||
}
|
||||
if (read != NULL)
|
||||
*read = white + nread;
|
||||
return inex;
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
/* mpc_log -- Take the logarithm of a complex number.
|
||||
|
||||
Copyright (C) 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_log (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd){
|
||||
int ok, underflow = 0;
|
||||
mpfr_srcptr x, y;
|
||||
mpfr_t v, w;
|
||||
mpfr_prec_t prec;
|
||||
int loops;
|
||||
int re_cmp, im_cmp;
|
||||
int inex_re, inex_im;
|
||||
int err;
|
||||
mpfr_exp_t expw;
|
||||
int sgnw;
|
||||
|
||||
/* special values: NaN and infinities */
|
||||
if (!mpc_fin_p (op)) {
|
||||
if (mpfr_nan_p (mpc_realref (op))) {
|
||||
if (mpfr_inf_p (mpc_imagref (op)))
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
else
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
inex_im = 0; /* Inf/NaN is exact */
|
||||
}
|
||||
else if (mpfr_nan_p (mpc_imagref (op))) {
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
else
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
inex_im = 0; /* Inf/NaN is exact */
|
||||
}
|
||||
else /* We have an infinity in at least one part. */ {
|
||||
inex_im = mpfr_atan2 (mpc_imagref (rop), mpc_imagref (op), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
}
|
||||
return MPC_INEX(0, inex_im);
|
||||
}
|
||||
|
||||
/* special cases: real and purely imaginary numbers */
|
||||
re_cmp = mpfr_cmp_ui (mpc_realref (op), 0);
|
||||
im_cmp = mpfr_cmp_ui (mpc_imagref (op), 0);
|
||||
if (im_cmp == 0) {
|
||||
if (re_cmp == 0) {
|
||||
inex_im = mpfr_atan2 (mpc_imagref (rop), mpc_imagref (op), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
mpfr_set_inf (mpc_realref (rop), -1);
|
||||
inex_re = 0; /* -Inf is exact */
|
||||
}
|
||||
else if (re_cmp > 0) {
|
||||
inex_re = mpfr_log (mpc_realref (rop), mpc_realref (op), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (rop), mpc_imagref (op), MPC_RND_IM (rnd));
|
||||
}
|
||||
else {
|
||||
/* op = x + 0*y; let w = -x = |x| */
|
||||
int negative_zero;
|
||||
mpfr_rnd_t rnd_im;
|
||||
|
||||
negative_zero = mpfr_signbit (mpc_imagref (op));
|
||||
if (negative_zero)
|
||||
rnd_im = INV_RND (MPC_RND_IM (rnd));
|
||||
else
|
||||
rnd_im = MPC_RND_IM (rnd);
|
||||
w [0] = *mpc_realref (op);
|
||||
MPFR_CHANGE_SIGN (w);
|
||||
inex_re = mpfr_log (mpc_realref (rop), w, MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_const_pi (mpc_imagref (rop), rnd_im);
|
||||
if (negative_zero) {
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
inex_im = -inex_im;
|
||||
}
|
||||
}
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
else if (re_cmp == 0) {
|
||||
if (im_cmp > 0) {
|
||||
inex_re = mpfr_log (mpc_realref (rop), mpc_imagref (op), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_const_pi (mpc_imagref (rop), MPC_RND_IM (rnd));
|
||||
/* division by 2 does not change the ternary flag */
|
||||
mpfr_div_2ui (mpc_imagref (rop), mpc_imagref (rop), 1, GMP_RNDN);
|
||||
}
|
||||
else {
|
||||
w [0] = *mpc_imagref (op);
|
||||
MPFR_CHANGE_SIGN (w);
|
||||
inex_re = mpfr_log (mpc_realref (rop), w, MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_const_pi (mpc_imagref (rop), INV_RND (MPC_RND_IM (rnd)));
|
||||
/* division by 2 does not change the ternary flag */
|
||||
mpfr_div_2ui (mpc_imagref (rop), mpc_imagref (rop), 1, GMP_RNDN);
|
||||
mpfr_neg (mpc_imagref (rop), mpc_imagref (rop), GMP_RNDN);
|
||||
inex_im = -inex_im; /* negate the ternary flag */
|
||||
}
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
prec = MPC_PREC_RE(rop);
|
||||
mpfr_init2 (w, 2);
|
||||
/* let op = x + iy; log = 1/2 log (x^2 + y^2) + i atan2 (y, x) */
|
||||
/* loop for the real part: 1/2 log (x^2 + y^2), fast, but unsafe */
|
||||
/* implementation */
|
||||
ok = 0;
|
||||
for (loops = 1; !ok && loops <= 2; loops++) {
|
||||
prec += mpc_ceil_log2 (prec) + 4;
|
||||
mpfr_set_prec (w, prec);
|
||||
|
||||
mpc_abs (w, op, GMP_RNDN);
|
||||
/* error 0.5 ulp */
|
||||
if (mpfr_inf_p (w))
|
||||
/* intermediate overflow; the logarithm may be representable.
|
||||
Intermediate underflow is impossible. */
|
||||
break;
|
||||
|
||||
mpfr_log (w, w, GMP_RNDN);
|
||||
/* generic error of log: (2^(- exp(w)) + 0.5) ulp */
|
||||
|
||||
if (mpfr_zero_p (w))
|
||||
/* impossible to round, switch to second algorithm */
|
||||
break;
|
||||
|
||||
err = MPC_MAX (-mpfr_get_exp (w), 0) + 1;
|
||||
/* number of lost digits */
|
||||
ok = mpfr_can_round (w, prec - err, GMP_RNDN, GMP_RNDZ,
|
||||
mpfr_get_prec (mpc_realref (rop)) + (MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
prec = MPC_PREC_RE(rop);
|
||||
mpfr_init2 (v, 2);
|
||||
/* compute 1/2 log (x^2 + y^2) = log |x| + 1/2 * log (1 + (y/x)^2)
|
||||
if |x| >= |y|; otherwise, exchange x and y */
|
||||
if (mpfr_cmpabs (mpc_realref (op), mpc_imagref (op)) >= 0) {
|
||||
x = mpc_realref (op);
|
||||
y = mpc_imagref (op);
|
||||
}
|
||||
else {
|
||||
x = mpc_imagref (op);
|
||||
y = mpc_realref (op);
|
||||
}
|
||||
|
||||
do {
|
||||
prec += mpc_ceil_log2 (prec) + 4;
|
||||
mpfr_set_prec (v, prec);
|
||||
mpfr_set_prec (w, prec);
|
||||
|
||||
mpfr_div (v, y, x, GMP_RNDD); /* error 1 ulp */
|
||||
mpfr_sqr (v, v, GMP_RNDD);
|
||||
/* generic error of multiplication:
|
||||
1 + 2*1*(2+1*2^(1-prec)) <= 5.0625 since prec >= 6 */
|
||||
mpfr_log1p (v, v, GMP_RNDD);
|
||||
/* error 1 + 4*5.0625 = 21.25 , see algorithms.tex */
|
||||
mpfr_div_2ui (v, v, 1, GMP_RNDD);
|
||||
/* If the result is 0, then there has been an underflow somewhere. */
|
||||
|
||||
mpfr_abs (w, x, GMP_RNDN); /* exact */
|
||||
mpfr_log (w, w, GMP_RNDN); /* error 0.5 ulp */
|
||||
expw = mpfr_get_exp (w);
|
||||
sgnw = mpfr_signbit (w);
|
||||
|
||||
mpfr_add (w, w, v, GMP_RNDN);
|
||||
if (!sgnw) /* v is positive, so no cancellation;
|
||||
error 22.25 ulp; error counts lost bits */
|
||||
err = 5;
|
||||
else
|
||||
err = MPC_MAX (5 + mpfr_get_exp (v),
|
||||
/* 21.25 ulp (v) rewritten in ulp (result, now in w) */
|
||||
-1 + expw - mpfr_get_exp (w)
|
||||
/* 0.5 ulp (previous w), rewritten in ulp (result) */
|
||||
) + 2;
|
||||
|
||||
/* handle one special case: |x|=1, and (y/x)^2 underflows;
|
||||
then 1/2*log(x^2+y^2) \approx 1/2*y^2 also underflows. */
|
||||
if ( (mpfr_cmp_si (x, -1) == 0 || mpfr_cmp_ui (x, 1) == 0)
|
||||
&& mpfr_zero_p (w))
|
||||
underflow = 1;
|
||||
|
||||
} while (!underflow &&
|
||||
!mpfr_can_round (w, prec - err, GMP_RNDN, GMP_RNDZ,
|
||||
mpfr_get_prec (mpc_realref (rop)) + (MPC_RND_RE (rnd) == GMP_RNDN)));
|
||||
mpfr_clear (v);
|
||||
}
|
||||
|
||||
/* imaginary part */
|
||||
inex_im = mpfr_atan2 (mpc_imagref (rop), mpc_imagref (op), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
|
||||
/* set the real part; cannot be done before if rop==op */
|
||||
if (underflow)
|
||||
/* create underflow in result */
|
||||
inex_re = mpfr_set_ui_2exp (mpc_realref (rop), 1,
|
||||
mpfr_get_emin_min () - 2, MPC_RND_RE (rnd));
|
||||
else
|
||||
inex_re = mpfr_set (mpc_realref (rop), w, MPC_RND_RE (rnd));
|
||||
mpfr_clear (w);
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,297 @@
|
|||
/* mpc_log10 -- Take the base-10 logarithm of a complex number.
|
||||
|
||||
Copyright (C) 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <limits.h> /* for CHAR_BIT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* Auxiliary functions which implement Ziv's strategy for special cases.
|
||||
if flag = 0: compute only real part
|
||||
if flag = 1: compute only imaginary
|
||||
Exact cases should be dealt with separately. */
|
||||
static int
|
||||
mpc_log10_aux (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd, int flag, int nb)
|
||||
{
|
||||
mp_prec_t prec = (MPFR_PREC_MIN > 4) ? MPFR_PREC_MIN : 4;
|
||||
mpc_t tmp;
|
||||
mpfr_t log10;
|
||||
int ok = 0, ret;
|
||||
|
||||
prec = mpfr_get_prec ((flag == 0) ? mpc_realref (rop) : mpc_imagref (rop));
|
||||
prec += 10;
|
||||
mpc_init2 (tmp, prec);
|
||||
mpfr_init2 (log10, prec);
|
||||
while (ok == 0)
|
||||
{
|
||||
mpfr_set_ui (log10, 10, GMP_RNDN); /* exact since prec >= 4 */
|
||||
mpfr_log (log10, log10, GMP_RNDN);
|
||||
/* In each case we have two roundings, thus the final value is
|
||||
x * (1+u)^2 where x is the exact value, and |u| <= 2^(-prec-1).
|
||||
Thus the error is always less than 3 ulps. */
|
||||
switch (nb)
|
||||
{
|
||||
case 0: /* imag <- atan2(y/x) */
|
||||
mpfr_atan2 (mpc_imagref (tmp), mpc_imagref (op), mpc_realref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
mpfr_div (mpc_imagref (tmp), mpc_imagref (tmp), log10, GMP_RNDN);
|
||||
ok = mpfr_can_round (mpc_imagref (tmp), prec - 2, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_IM(rop) +
|
||||
(MPC_RND_IM (rnd) == GMP_RNDN));
|
||||
if (ok)
|
||||
ret = mpfr_set (mpc_imagref (rop), mpc_imagref (tmp),
|
||||
MPC_RND_IM (rnd));
|
||||
break;
|
||||
case 1: /* real <- log(x) */
|
||||
mpfr_log (mpc_realref (tmp), mpc_realref (op), MPC_RND_RE (rnd));
|
||||
mpfr_div (mpc_realref (tmp), mpc_realref (tmp), log10, GMP_RNDN);
|
||||
ok = mpfr_can_round (mpc_realref (tmp), prec - 2, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_RE(rop) +
|
||||
(MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
if (ok)
|
||||
ret = mpfr_set (mpc_realref (rop), mpc_realref (tmp),
|
||||
MPC_RND_RE (rnd));
|
||||
break;
|
||||
case 2: /* imag <- pi */
|
||||
mpfr_const_pi (mpc_imagref (tmp), MPC_RND_IM (rnd));
|
||||
mpfr_div (mpc_imagref (tmp), mpc_imagref (tmp), log10, GMP_RNDN);
|
||||
ok = mpfr_can_round (mpc_imagref (tmp), prec - 2, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_IM(rop) +
|
||||
(MPC_RND_IM (rnd) == GMP_RNDN));
|
||||
if (ok)
|
||||
ret = mpfr_set (mpc_imagref (rop), mpc_imagref (tmp),
|
||||
MPC_RND_IM (rnd));
|
||||
break;
|
||||
case 3: /* real <- log(y) */
|
||||
mpfr_log (mpc_realref (tmp), mpc_imagref (op), MPC_RND_RE (rnd));
|
||||
mpfr_div (mpc_realref (tmp), mpc_realref (tmp), log10, GMP_RNDN);
|
||||
ok = mpfr_can_round (mpc_realref (tmp), prec - 2, GMP_RNDN,
|
||||
GMP_RNDZ, MPC_PREC_RE(rop) +
|
||||
(MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
if (ok)
|
||||
ret = mpfr_set (mpc_realref (rop), mpc_realref (tmp),
|
||||
MPC_RND_RE (rnd));
|
||||
break;
|
||||
}
|
||||
prec += prec / 2;
|
||||
mpc_set_prec (tmp, prec);
|
||||
mpfr_set_prec (log10, prec);
|
||||
}
|
||||
mpc_clear (tmp);
|
||||
mpfr_clear (log10);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
mpc_log10 (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
|
||||
{
|
||||
int ok = 0, loops = 0, re_cmp, im_cmp, inex_re, inex_im, negative_zero;
|
||||
mpfr_t w;
|
||||
mpfr_prec_t prec;
|
||||
mpfr_rnd_t rnd_im;
|
||||
mpc_t ww;
|
||||
mpc_rnd_t invrnd;
|
||||
|
||||
/* special values: NaN and infinities: same as mpc_log */
|
||||
if (!mpc_fin_p (op)) /* real or imaginary parts are NaN or Inf */
|
||||
{
|
||||
if (mpfr_nan_p (mpc_realref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_imagref (op)))
|
||||
/* (NaN, Inf) -> (+Inf, NaN) */
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
else
|
||||
/* (NaN, xxx) -> (NaN, NaN) */
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
inex_im = 0; /* Inf/NaN is exact */
|
||||
}
|
||||
else if (mpfr_nan_p (mpc_imagref (op)))
|
||||
{
|
||||
if (mpfr_inf_p (mpc_realref (op)))
|
||||
/* (Inf, NaN) -> (+Inf, NaN) */
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
else
|
||||
/* (xxx, NaN) -> (NaN, NaN) */
|
||||
mpfr_set_nan (mpc_realref (rop));
|
||||
mpfr_set_nan (mpc_imagref (rop));
|
||||
inex_im = 0; /* Inf/NaN is exact */
|
||||
}
|
||||
else /* We have an infinity in at least one part. */
|
||||
{
|
||||
/* (+Inf, y) -> (+Inf, 0) for finite positive-signed y */
|
||||
if (mpfr_inf_p (mpc_realref (op)) && mpfr_signbit (mpc_realref (op))
|
||||
== 0 && mpfr_number_p (mpc_imagref (op)))
|
||||
inex_im = mpfr_atan2 (mpc_imagref (rop), mpc_imagref (op),
|
||||
mpc_realref (op), MPC_RND_IM (rnd));
|
||||
else
|
||||
/* (xxx, Inf) -> (+Inf, atan2(Inf/xxx))
|
||||
(Inf, yyy) -> (+Inf, atan2(yyy/Inf)) */
|
||||
inex_im = mpc_log10_aux (rop, op, rnd, 1, 0);
|
||||
mpfr_set_inf (mpc_realref (rop), +1);
|
||||
}
|
||||
return MPC_INEX(0, inex_im);
|
||||
}
|
||||
|
||||
/* special cases: real and purely imaginary numbers */
|
||||
re_cmp = mpfr_cmp_ui (mpc_realref (op), 0);
|
||||
im_cmp = mpfr_cmp_ui (mpc_imagref (op), 0);
|
||||
if (im_cmp == 0) /* Im(op) = 0 */
|
||||
{
|
||||
if (re_cmp == 0) /* Re(op) = 0 */
|
||||
{
|
||||
if (mpfr_signbit (mpc_realref (op)) == 0)
|
||||
inex_im = mpfr_atan2 (mpc_imagref (rop), mpc_imagref (op),
|
||||
mpc_realref (op), MPC_RND_IM (rnd));
|
||||
else
|
||||
inex_im = mpc_log10_aux (rop, op, rnd, 1, 0);
|
||||
mpfr_set_inf (mpc_realref (rop), -1);
|
||||
inex_re = 0; /* -Inf is exact */
|
||||
}
|
||||
else if (re_cmp > 0)
|
||||
{
|
||||
inex_re = mpfr_log10 (mpc_realref (rop), mpc_realref (op),
|
||||
MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (rop), mpc_imagref (op),
|
||||
MPC_RND_IM (rnd));
|
||||
}
|
||||
else /* log10(x + 0*i) for negative x */
|
||||
{ /* op = x + 0*i; let w = -x = |x| */
|
||||
negative_zero = mpfr_signbit (mpc_imagref (op));
|
||||
if (negative_zero)
|
||||
rnd_im = INV_RND (MPC_RND_IM (rnd));
|
||||
else
|
||||
rnd_im = MPC_RND_IM (rnd);
|
||||
ww->re[0] = *mpc_realref (op);
|
||||
MPFR_CHANGE_SIGN (ww->re);
|
||||
ww->im[0] = *mpc_imagref (op);
|
||||
if (mpfr_cmp_ui (ww->re, 1) == 0)
|
||||
inex_re = mpfr_set_ui (mpc_realref (rop), 0, MPC_RND_RE (rnd));
|
||||
else
|
||||
inex_re = mpc_log10_aux (rop, ww, rnd, 0, 1);
|
||||
inex_im = mpc_log10_aux (rop, op, MPC_RND (0,rnd_im), 1, 2);
|
||||
if (negative_zero)
|
||||
{
|
||||
mpc_conj (rop, rop, MPC_RNDNN);
|
||||
inex_im = -inex_im;
|
||||
}
|
||||
}
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
else if (re_cmp == 0)
|
||||
{
|
||||
if (im_cmp > 0)
|
||||
{
|
||||
inex_re = mpc_log10_aux (rop, op, rnd, 0, 3);
|
||||
inex_im = mpc_log10_aux (rop, op, rnd, 1, 2);
|
||||
/* division by 2 does not change the ternary flag */
|
||||
mpfr_div_2ui (mpc_imagref (rop), mpc_imagref (rop), 1, GMP_RNDN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ww->re[0] = *mpc_realref (op);
|
||||
ww->im[0] = *mpc_imagref (op);
|
||||
MPFR_CHANGE_SIGN (ww->im);
|
||||
inex_re = mpc_log10_aux (rop, ww, rnd, 0, 3);
|
||||
invrnd = MPC_RND (0, INV_RND (MPC_RND_IM (rnd)));
|
||||
inex_im = mpc_log10_aux (rop, op, invrnd, 1, 2);
|
||||
/* division by 2 does not change the ternary flag */
|
||||
mpfr_div_2ui (mpc_imagref (rop), mpc_imagref (rop), 1, GMP_RNDN);
|
||||
mpfr_neg (mpc_imagref (rop), mpc_imagref (rop), GMP_RNDN);
|
||||
inex_im = -inex_im; /* negate the ternary flag */
|
||||
}
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
||||
|
||||
/* generic case: neither Re(op) nor Im(op) is NaN, Inf or zero */
|
||||
prec = MPC_PREC_RE(rop);
|
||||
mpfr_init2 (w, prec);
|
||||
mpc_init2 (ww, prec);
|
||||
/* let op = x + iy; compute log(op)/log(10) */
|
||||
while (ok == 0)
|
||||
{
|
||||
loops ++;
|
||||
prec += (loops <= 2) ? mpc_ceil_log2 (prec) + 4 : prec / 2;
|
||||
mpfr_set_prec (w, prec);
|
||||
mpc_set_prec (ww, prec);
|
||||
|
||||
mpc_log (ww, op, MPC_RNDNN);
|
||||
mpfr_set_ui (w, 10, GMP_RNDN); /* exact since prec >= 4 */
|
||||
mpfr_log (w, w, GMP_RNDN);
|
||||
mpc_div_fr (ww, ww, w, MPC_RNDNN);
|
||||
|
||||
ok = mpfr_can_round (mpc_realref (ww), prec - 2, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_RE(rop) + (MPC_RND_RE (rnd) == GMP_RNDN));
|
||||
|
||||
/* Special code to deal with cases where the real part of log10(x+i*y)
|
||||
is exact, like x=3 and y=1. Since Re(log10(x+i*y)) = log10(x^2+y^2)/2
|
||||
this happens whenever x^2+y^2 is a nonnegative power of 10.
|
||||
Indeed x^2+y^2 cannot equal 10^(a/2^b) for a, b integers, a odd, b>0,
|
||||
since x^2+y^2 is rational, and 10^(a/2^b) is irrational.
|
||||
Similarly, for b=0, x^2+y^2 cannot equal 10^a for a < 0 since x^2+y^2
|
||||
is a rational with denominator a power of 2.
|
||||
Now let x^2+y^2 = 10^s. Without loss of generality we can assume
|
||||
x = u/2^e and y = v/2^e with u, v, e integers: u^2+v^2 = 10^s*2^(2e)
|
||||
thus u^2+v^2 = 0 mod 2^(2e). By recurrence on e, necessarily
|
||||
u = v = 0 mod 2^e, thus x and y are necessarily integers.
|
||||
*/
|
||||
if ((ok == 0) && (loops == 1) && mpfr_integer_p (mpc_realref (op)) &&
|
||||
mpfr_integer_p (mpc_imagref (op)))
|
||||
{
|
||||
mpz_t x, y;
|
||||
unsigned long s, v;
|
||||
|
||||
mpz_init (x);
|
||||
mpz_init (y);
|
||||
mpfr_get_z (x, mpc_realref (op), GMP_RNDN); /* exact */
|
||||
mpfr_get_z (y, mpc_imagref (op), GMP_RNDN); /* exact */
|
||||
mpz_mul (x, x, x);
|
||||
mpz_mul (y, y, y);
|
||||
mpz_add (x, x, y); /* x^2+y^2 */
|
||||
v = mpz_scan1 (x, 0);
|
||||
/* if x = 10^s then necessarily s = v */
|
||||
s = mpz_sizeinbase (x, 10);
|
||||
/* since s is either the number of digits of x or one more,
|
||||
then x = 10^(s-1) or 10^(s-2) */
|
||||
if (s == v + 1 || s == v + 2)
|
||||
{
|
||||
mpz_div_2exp (x, x, v);
|
||||
mpz_ui_pow_ui (y, 5, v);
|
||||
if (mpz_cmp (y, x) == 0) /* Re(log10(x+i*y)) is exactly v/2 */
|
||||
{
|
||||
/* we reset the precision of Re(ww) so that v can be
|
||||
represented exactly */
|
||||
mpfr_set_prec (mpc_realref (ww), sizeof(unsigned long)*CHAR_BIT);
|
||||
mpfr_set_ui_2exp (mpc_realref (ww), v, -1, GMP_RNDN); /* exact */
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
mpz_clear (x);
|
||||
mpz_clear (y);
|
||||
}
|
||||
|
||||
ok = ok && mpfr_can_round (mpc_imagref (ww), prec-2, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_IM(rop) + (MPC_RND_IM (rnd) == GMP_RNDN));
|
||||
}
|
||||
|
||||
inex_re = mpfr_set (mpc_realref(rop), mpc_realref (ww), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref(rop), mpc_imagref (ww), MPC_RND_IM (rnd));
|
||||
mpfr_clear (w);
|
||||
mpc_clear (ww);
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
/* logging.c -- "Dummy" functions logging calls to real mpc functions.
|
||||
|
||||
Copyright (C) 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define __MPC_LIBRARY_BUILD
|
||||
/* to indicate we are inside the library build; needed here since mpc-log.h
|
||||
includes mpc.h and not mpc-impl.h */
|
||||
#include "mpc-log.h"
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
typedef int (*c_c_func_ptr) (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
typedef int (*c_cc_func_ptr) (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
typedef int (*c_ccc_func_ptr) (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
typedef int (*cc_c_func_ptr) (mpc_ptr, mpc_ptr, mpc_srcptr, mpc_rnd_t, mpc_rnd_t);
|
||||
|
||||
#define MPC_LOGGING_OUT_PREC(z) \
|
||||
do { \
|
||||
fprintf (stderr, " %li %li", (long) mpfr_get_prec (mpc_realref (z)), \
|
||||
(long) mpfr_get_prec (mpc_imagref (z))); \
|
||||
} while (0);
|
||||
|
||||
#define MPC_LOGGING_OUT_C(z) \
|
||||
do { \
|
||||
MPC_LOGGING_OUT_PREC (z); \
|
||||
fprintf (stderr, " "); \
|
||||
mpc_out_str (stderr, 16, 0, z, MPC_RNDNN); \
|
||||
} while (0);
|
||||
|
||||
#define MPC_LOGGING_FUNC_TYPE(funcname, type) \
|
||||
do { \
|
||||
fprintf (stderr, "mpc_"#funcname" "#type); \
|
||||
} while (0);
|
||||
|
||||
#define MPC_LOGGING_C_C(funcname) \
|
||||
__MPC_DECLSPEC int mpc_log_##funcname (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) \
|
||||
{ \
|
||||
static c_c_func_ptr func = NULL; \
|
||||
if (func == NULL) \
|
||||
func = (c_c_func_ptr) (intptr_t) dlsym (NULL, "mpc_"#funcname); \
|
||||
MPC_LOGGING_FUNC_TYPE (funcname, c_c); \
|
||||
MPC_LOGGING_OUT_PREC (rop); \
|
||||
MPC_LOGGING_OUT_C (op); \
|
||||
fprintf (stderr, "\n"); \
|
||||
return func (rop, op, rnd); \
|
||||
}
|
||||
|
||||
#define MPC_LOGGING_C_CC(funcname) \
|
||||
__MPC_DECLSPEC int mpc_log_##funcname (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd) \
|
||||
{ \
|
||||
static c_cc_func_ptr func = NULL; \
|
||||
if (func == NULL) \
|
||||
func = (c_cc_func_ptr) (intptr_t) dlsym (NULL, "mpc_"#funcname); \
|
||||
MPC_LOGGING_FUNC_TYPE (funcname, c_cc); \
|
||||
MPC_LOGGING_OUT_PREC (rop); \
|
||||
MPC_LOGGING_OUT_C (op1); \
|
||||
MPC_LOGGING_OUT_C (op2); \
|
||||
fprintf (stderr, "\n"); \
|
||||
return func (rop, op1, op2, rnd); \
|
||||
}
|
||||
|
||||
#define MPC_LOGGING_C_CCC(funcname) \
|
||||
__MPC_DECLSPEC int mpc_log_##funcname (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_srcptr op3, mpc_rnd_t rnd) \
|
||||
{ \
|
||||
static c_ccc_func_ptr func = NULL; \
|
||||
if (func == NULL) \
|
||||
func = (c_ccc_func_ptr) (intptr_t) dlsym (NULL, "mpc_"#funcname); \
|
||||
MPC_LOGGING_FUNC_TYPE (funcname, c_ccc); \
|
||||
MPC_LOGGING_OUT_PREC (rop); \
|
||||
MPC_LOGGING_OUT_C (op1); \
|
||||
MPC_LOGGING_OUT_C (op2); \
|
||||
MPC_LOGGING_OUT_C (op3); \
|
||||
fprintf (stderr, "\n"); \
|
||||
return func (rop, op1, op2, op3, rnd); \
|
||||
}
|
||||
|
||||
#define MPC_LOGGING_CC_C(funcname) \
|
||||
__MPC_DECLSPEC int mpc_log_##funcname (mpc_ptr rop1, mpc_ptr rop2, mpc_srcptr op, mpc_rnd_t rnd1, mpc_rnd_t rnd2) \
|
||||
{ \
|
||||
static cc_c_func_ptr func = NULL; \
|
||||
if (func == NULL) \
|
||||
func = (cc_c_func_ptr) (intptr_t) dlsym (NULL, "mpc_"#funcname); \
|
||||
MPC_LOGGING_FUNC_TYPE (funcname, cc_c); \
|
||||
MPC_LOGGING_OUT_PREC (rop1); \
|
||||
MPC_LOGGING_OUT_PREC (rop2); \
|
||||
MPC_LOGGING_OUT_C (op); \
|
||||
fprintf (stderr, "\n"); \
|
||||
return func (rop1, rop2, op, rnd1, rnd2); \
|
||||
}
|
||||
|
||||
MPC_LOGGING_C_C (sqr)
|
||||
MPC_LOGGING_C_C (conj)
|
||||
MPC_LOGGING_C_C (neg)
|
||||
MPC_LOGGING_C_C (sqrt)
|
||||
MPC_LOGGING_C_C (proj)
|
||||
MPC_LOGGING_C_C (exp)
|
||||
MPC_LOGGING_C_C (log)
|
||||
MPC_LOGGING_C_C (sin)
|
||||
MPC_LOGGING_C_C (cos)
|
||||
MPC_LOGGING_C_C (tan)
|
||||
MPC_LOGGING_C_C (sinh)
|
||||
MPC_LOGGING_C_C (cosh)
|
||||
MPC_LOGGING_C_C (tanh)
|
||||
MPC_LOGGING_C_C (asin)
|
||||
MPC_LOGGING_C_C (acos)
|
||||
MPC_LOGGING_C_C (atan)
|
||||
MPC_LOGGING_C_C (asinh)
|
||||
MPC_LOGGING_C_C (acosh)
|
||||
MPC_LOGGING_C_C (atanh)
|
||||
|
||||
MPC_LOGGING_C_CC (add)
|
||||
MPC_LOGGING_C_CC (sub)
|
||||
MPC_LOGGING_C_CC (mul)
|
||||
MPC_LOGGING_C_CC (div)
|
||||
MPC_LOGGING_C_CC (pow)
|
||||
|
||||
MPC_LOGGING_C_CCC (fma)
|
||||
|
||||
MPC_LOGGING_CC_C (sin_cos)
|
|
@ -0,0 +1,46 @@
|
|||
/* wrapper functions to allocate, reallocate and free memory
|
||||
|
||||
Copyright (C) 2009 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <string.h> /* for strlen */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
char *
|
||||
mpc_alloc_str (size_t len)
|
||||
{
|
||||
void * (*allocfunc) (size_t);
|
||||
mp_get_memory_functions (&allocfunc, NULL, NULL);
|
||||
return (char *) ((*allocfunc) (len));
|
||||
}
|
||||
|
||||
char *
|
||||
mpc_realloc_str (char * str, size_t oldlen, size_t newlen)
|
||||
{
|
||||
void * (*reallocfunc) (void *, size_t, size_t);
|
||||
mp_get_memory_functions (NULL, &reallocfunc, NULL);
|
||||
return (char *) ((*reallocfunc) (str, oldlen, newlen));
|
||||
}
|
||||
|
||||
void
|
||||
mpc_free_str (char *str)
|
||||
{
|
||||
void (*freefunc) (void *, size_t);
|
||||
mp_get_memory_functions (NULL, NULL, &freefunc);
|
||||
(*freefunc) (str, strlen (str) + 1);
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
/* mpc-impl.h -- Internal include file for mpc.
|
||||
|
||||
Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#ifndef __MPC_IMPL_H
|
||||
#define __MPC_IMPL_H
|
||||
#define __MPC_LIBRARY_BUILD
|
||||
/* to indicate we are inside the library build */
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "mpc.h"
|
||||
|
||||
/*
|
||||
* Miscellaneous useful macros
|
||||
*/
|
||||
|
||||
#define MPC_MIN(h,i) ((h) < (i) ? (h) : (i))
|
||||
#define MPC_MAX(h,i) ((h) > (i) ? (h) : (i))
|
||||
|
||||
/* Safe absolute value (to avoid possible integer overflow) */
|
||||
/* type is the target (unsigned) type (copied from mpfr-impl.h) */
|
||||
#ifdef SAFE_ABS
|
||||
#undef SAFE_ABS
|
||||
#endif
|
||||
#define SAFE_ABS(type,x) ((x) >= 0 ? (type)(x) : -(type)(x))
|
||||
|
||||
|
||||
/*
|
||||
* MPFR constants and macros
|
||||
*/
|
||||
|
||||
#ifndef BITS_PER_MP_LIMB
|
||||
#define BITS_PER_MP_LIMB mp_bits_per_limb
|
||||
#endif
|
||||
|
||||
#define MPFR_SIGNBIT(x) (mpfr_signbit (x) ? -1 : 1)
|
||||
#define MPC_MPFR_SIGN(x) (mpfr_zero_p (x) ? 0 : MPFR_SIGNBIT (x))
|
||||
/* should be called MPFR_SIGN, but this is taken in mpfr.h */
|
||||
#define MPFR_CHANGE_SIGN(x) mpfr_neg(x,x,GMP_RNDN)
|
||||
#define MPFR_COPYSIGN(x,y,z,rnd) (mpfr_nan_p (z) ? \
|
||||
mpfr_setsign (x, y, 0, rnd) : \
|
||||
mpfr_copysign (x, y, z, rnd))
|
||||
/* work around spurious signs in nan */
|
||||
#define MPFR_ADD_ONE_ULP(x) mpfr_add_one_ulp (x, GMP_RNDN)
|
||||
#define MPFR_SUB_ONE_ULP(x) mpfr_sub_one_ulp (x, GMP_RNDN)
|
||||
/* drop unused rounding mode from macroes */
|
||||
#define MPFR_SWAP(a,b) do { mpfr_srcptr tmp; tmp = a; a = b; b = tmp; } while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Macro implementing rounding away from zero, to ease compatibility with
|
||||
* mpfr < 3. f is the complete function call with a rounding mode of
|
||||
* MPFR_RNDA, rop the name of the variable containing the result; it is
|
||||
* already contained in f, but needs to be repeated so that the macro can
|
||||
* modify the variable.
|
||||
* Usage: replace each call to a function such as
|
||||
* mpfr_add (rop, a, b, MPFR_RNDA)
|
||||
* by
|
||||
* ROUND_AWAY (mpfr_add (rop, a, b, MPFR_RNDA), rop)
|
||||
*/
|
||||
#if MPFR_VERSION_MAJOR < 3
|
||||
/* round towards zero, add 1 ulp if not exact */
|
||||
#define MPFR_RNDA GMP_RNDZ
|
||||
#define ROUND_AWAY(f,rop) \
|
||||
((f) ? MPFR_ADD_ONE_ULP (rop), MPFR_SIGNBIT (rop) : 0)
|
||||
#else
|
||||
#define ROUND_AWAY(f,rop) \
|
||||
(f)
|
||||
#endif /* mpfr < 3 */
|
||||
|
||||
#if MPFR_VERSION_MAJOR < 3
|
||||
/* declare missing functions, defined in get_version.c */
|
||||
__MPC_DECLSPEC void mpfr_set_zero (mpfr_ptr, int);
|
||||
__MPC_DECLSPEC int mpfr_regular_p (mpfr_srcptr);
|
||||
#endif /* mpfr < 3 */
|
||||
|
||||
|
||||
/*
|
||||
* MPC macros
|
||||
*/
|
||||
|
||||
#define MPC_PREC_RE(x) (mpfr_get_prec(mpc_realref(x)))
|
||||
#define MPC_PREC_IM(x) (mpfr_get_prec(mpc_imagref(x)))
|
||||
#define MPC_MAX_PREC(x) MPC_MAX(MPC_PREC_RE(x), MPC_PREC_IM(x))
|
||||
|
||||
#define INV_RND(r) \
|
||||
(((r) == GMP_RNDU) ? GMP_RNDD : (((r) == GMP_RNDD) ? GMP_RNDU : (r)))
|
||||
|
||||
#define mpc_inf_p(z) (mpfr_inf_p(mpc_realref(z))||mpfr_inf_p(mpc_imagref(z)))
|
||||
/* Convention in C99 (G.3): z is regarded as an infinity if at least one of
|
||||
its parts is infinite */
|
||||
#define mpc_zero_p(z) (mpfr_zero_p(mpc_realref(z))&&mpfr_zero_p(mpc_imagref(z)))
|
||||
/* Convention in C99 (G.3): z is regarded as a zero if each of its parts is
|
||||
a zero */
|
||||
#define mpc_fin_p(z) (mpfr_number_p(mpc_realref(z))&&mpfr_number_p(mpc_imagref(z)))
|
||||
/* Convention in C99 (G.3): z is regarded as finite if both its parts are */
|
||||
#define mpc_nan_p(z) ((mpfr_nan_p(mpc_realref(z)) && !mpfr_inf_p(mpc_imagref(z))) || (mpfr_nan_p(mpc_imagref(z)) && !mpfr_inf_p(mpc_realref(z))))
|
||||
/* Consider as NaN all other numbers containing at least one NaN */
|
||||
|
||||
|
||||
/*
|
||||
* ASSERT macros
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define MPC_ASSERT(expr) \
|
||||
do { \
|
||||
} while (0)
|
||||
#else
|
||||
#define MPC_ASSERT(expr) \
|
||||
do { \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: MPC assertion failed: %s\n", \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Debug macros
|
||||
*/
|
||||
|
||||
#define MPC_OUT(x) \
|
||||
do { \
|
||||
printf (#x "[%lu,%lu]=", (unsigned long int) MPC_PREC_RE (x), \
|
||||
(unsigned long int) MPC_PREC_IM (x)); \
|
||||
mpc_out_str (stdout, 2, 0, x, MPC_RNDNN); \
|
||||
printf ("\n"); \
|
||||
} while (0)
|
||||
|
||||
#define MPFR_OUT(x) \
|
||||
do { \
|
||||
printf (#x "[%lu]=", (unsigned long int) mpfr_get_prec (x)); \
|
||||
mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); \
|
||||
printf ("\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#ifndef MUL_KARATSUBA_THRESHOLD
|
||||
#define MUL_KARATSUBA_THRESHOLD 23
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Define internal functions
|
||||
*/
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
__MPC_DECLSPEC int mpc_mul_naive (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_karatsuba (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_fma_naive (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_usi (mpc_ptr, mpc_srcptr, unsigned long, int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC char* mpc_alloc_str (size_t);
|
||||
__MPC_DECLSPEC char* mpc_realloc_str (char*, size_t, size_t);
|
||||
__MPC_DECLSPEC void mpc_free_str (char*);
|
||||
__MPC_DECLSPEC mpfr_prec_t mpc_ceil_log2 (mpfr_prec_t);
|
||||
__MPC_DECLSPEC int set_pi_over_2 (mpfr_ptr, int, mpfr_rnd_t);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,51 @@
|
|||
/* mpc-log.h -- Include file to enable function call logging; replaces mpc.h.
|
||||
|
||||
Copyright (C) 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#define mpc_sqr mpc_log_sqr
|
||||
#define mpc_conj mpc_log_conj
|
||||
#define mpc_neg mpc_log_neg
|
||||
#define mpc_sqrt mpc_log_sqrt
|
||||
#define mpc_proj mpc_log_proj
|
||||
#define mpc_exp mpc_log_exp
|
||||
#define mpc_log mpc_log_log
|
||||
#define mpc_sin mpc_log_sin
|
||||
#define mpc_cos mpc_log_cos
|
||||
#define mpc_tan mpc_log_tan
|
||||
#define mpc_sinh mpc_log_sinh
|
||||
#define mpc_cosh mpc_log_cosh
|
||||
#define mpc_tanh mpc_log_tanh
|
||||
#define mpc_asin mpc_log_asin
|
||||
#define mpc_acos mpc_log_acos
|
||||
#define mpc_atan mpc_log_atan
|
||||
#define mpc_asinh mpc_log_asinh
|
||||
#define mpc_acosh mpc_log_acosh
|
||||
#define mpc_atanh mpc_log_atanh
|
||||
|
||||
#define mpc_add mpc_log_add
|
||||
#define mpc_sub mpc_log_sub
|
||||
#define mpc_mul mpc_log_mul
|
||||
#define mpc_div mpc_log_div
|
||||
#define mpc_pow mpc_log_pow
|
||||
|
||||
#define mpc_fma mpc_log_fma
|
||||
|
||||
#define mpc_sin_cos mpc_log_sin_cos
|
||||
|
||||
#include "mpc.h"
|
|
@ -0,0 +1,269 @@
|
|||
/* mpc.h -- Include file for mpc.
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#ifndef __MPC_H
|
||||
#define __MPC_H
|
||||
|
||||
#include "gmp.h"
|
||||
#include "mpfr.h"
|
||||
|
||||
/* Backwards compatibility with mpfr<3.0.0 */
|
||||
#ifndef mpfr_exp_t
|
||||
#define mpfr_exp_t mp_exp_t
|
||||
#endif
|
||||
|
||||
/* Define MPC version number */
|
||||
#define MPC_VERSION_MAJOR 1
|
||||
#define MPC_VERSION_MINOR 0
|
||||
#define MPC_VERSION_PATCHLEVEL 1
|
||||
#define MPC_VERSION_STRING "1.0.1"
|
||||
|
||||
/* Macros dealing with MPC VERSION */
|
||||
#define MPC_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
||||
#define MPC_VERSION \
|
||||
MPC_VERSION_NUM(MPC_VERSION_MAJOR,MPC_VERSION_MINOR,MPC_VERSION_PATCHLEVEL)
|
||||
|
||||
/* Check if stdint.h/inttypes.h is included */
|
||||
#if defined (INTMAX_C) && defined (UINTMAX_C)
|
||||
#define _MPC_H_HAVE_INTMAX_T 1
|
||||
#endif
|
||||
|
||||
/* Return values */
|
||||
|
||||
/* Transform negative to 2, positive to 1, leave 0 unchanged */
|
||||
#define MPC_INEX_POS(inex) (((inex) < 0) ? 2 : ((inex) == 0) ? 0 : 1)
|
||||
/* Transform 2 to negative, 1 to positive, leave 0 unchanged */
|
||||
#define MPC_INEX_NEG(inex) (((inex) == 2) ? -1 : ((inex) == 0) ? 0 : 1)
|
||||
|
||||
/* The global inexact flag is made of (real flag) + 4 * (imaginary flag), where
|
||||
each of the real and imaginary inexact flag are:
|
||||
0 when the result is exact (no rounding error)
|
||||
1 when the result is larger than the exact value
|
||||
2 when the result is smaller than the exact value */
|
||||
#define MPC_INEX(inex_re, inex_im) \
|
||||
(MPC_INEX_POS(inex_re) | (MPC_INEX_POS(inex_im) << 2))
|
||||
#define MPC_INEX_RE(inex) MPC_INEX_NEG((inex) & 3)
|
||||
#define MPC_INEX_IM(inex) MPC_INEX_NEG((inex) >> 2)
|
||||
|
||||
/* For functions computing two results, the return value is
|
||||
inexact1+16*inexact2, which is 0 iif both results are exact. */
|
||||
#define MPC_INEX12(inex1, inex2) (inex1 | (inex2 << 4))
|
||||
#define MPC_INEX1(inex) (inex & 15)
|
||||
#define MPC_INEX2(inex) (inex >> 4)
|
||||
|
||||
/* Definition of rounding modes */
|
||||
|
||||
/* a complex rounding mode is just a pair of two real rounding modes
|
||||
we reserve four bits for a real rounding mode. */
|
||||
typedef int mpc_rnd_t;
|
||||
|
||||
#define MPC_RND(r1,r2) (((int)(r1)) + ((int)(r2) << 4))
|
||||
#define MPC_RND_RE(x) ((mpfr_rnd_t)((x) & 0x0F))
|
||||
#define MPC_RND_IM(x) ((mpfr_rnd_t)((x) >> 4))
|
||||
|
||||
#define MPC_RNDNN MPC_RND (GMP_RNDN,GMP_RNDN)
|
||||
#define MPC_RNDNZ MPC_RND (GMP_RNDN,GMP_RNDZ)
|
||||
#define MPC_RNDNU MPC_RND (GMP_RNDN,GMP_RNDU)
|
||||
#define MPC_RNDND MPC_RND (GMP_RNDN,GMP_RNDD)
|
||||
|
||||
#define MPC_RNDZN MPC_RND (GMP_RNDZ,GMP_RNDN)
|
||||
#define MPC_RNDZZ MPC_RND (GMP_RNDZ,GMP_RNDZ)
|
||||
#define MPC_RNDZU MPC_RND (GMP_RNDZ,GMP_RNDU)
|
||||
#define MPC_RNDZD MPC_RND (GMP_RNDZ,GMP_RNDD)
|
||||
|
||||
#define MPC_RNDUN MPC_RND (GMP_RNDU,GMP_RNDN)
|
||||
#define MPC_RNDUZ MPC_RND (GMP_RNDU,GMP_RNDZ)
|
||||
#define MPC_RNDUU MPC_RND (GMP_RNDU,GMP_RNDU)
|
||||
#define MPC_RNDUD MPC_RND (GMP_RNDU,GMP_RNDD)
|
||||
|
||||
#define MPC_RNDDN MPC_RND (GMP_RNDD,GMP_RNDN)
|
||||
#define MPC_RNDDZ MPC_RND (GMP_RNDD,GMP_RNDZ)
|
||||
#define MPC_RNDDU MPC_RND (GMP_RNDD,GMP_RNDU)
|
||||
#define MPC_RNDDD MPC_RND (GMP_RNDD,GMP_RNDD)
|
||||
|
||||
|
||||
/* Definitions of types and their semantics */
|
||||
|
||||
typedef struct {
|
||||
mpfr_t re;
|
||||
mpfr_t im;
|
||||
}
|
||||
__mpc_struct;
|
||||
|
||||
typedef __mpc_struct mpc_t[1];
|
||||
typedef __mpc_struct *mpc_ptr;
|
||||
typedef const __mpc_struct *mpc_srcptr;
|
||||
|
||||
/* Support for WINDOWS DLL, see
|
||||
http://lists.gforge.inria.fr/pipermail/mpc-discuss/2011-November/000990.html;
|
||||
when building the DLL, export symbols, otherwise behave as GMP */
|
||||
#if defined (__MPC_LIBRARY_BUILD) && __GMP_LIBGMP_DLL
|
||||
#define __MPC_DECLSPEC __GMP_DECLSPEC_EXPORT
|
||||
#else
|
||||
#define __MPC_DECLSPEC __GMP_DECLSPEC
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__MPC_DECLSPEC int mpc_add (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_add_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_add_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_add_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sub (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sub_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_fr_sub (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sub_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_ui_ui_sub (mpc_ptr, unsigned long int, unsigned long int, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_i (mpc_ptr, mpc_srcptr, int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sqr (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_div (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_ld (mpc_ptr, mpc_srcptr, long double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_d (mpc_ptr, mpc_srcptr, double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_si (mpc_ptr, mpc_srcptr, long, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_ui (mpc_ptr, mpc_srcptr, unsigned long, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_pow_z (mpc_ptr, mpc_srcptr, mpz_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_div_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_fr_div (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_div_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_ui_div (mpc_ptr, unsigned long int, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_div_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_div_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_mul_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_conj (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_neg (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_norm (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_abs (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sqrt (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_d (mpc_ptr, double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_d_d (mpc_ptr, double, double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_ld (mpc_ptr, long double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_ld_ld (mpc_ptr, long double, long double, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_f (mpc_ptr, mpf_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_f_f (mpc_ptr, mpf_srcptr, mpf_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_fr (mpc_ptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_fr_fr (mpc_ptr, mpfr_srcptr, mpfr_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_q (mpc_ptr, mpq_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_q_q (mpc_ptr, mpq_srcptr, mpq_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_si (mpc_ptr, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_si_si (mpc_ptr, long int, long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_ui (mpc_ptr, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_ui_ui (mpc_ptr, unsigned long int, unsigned long int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_z (mpc_ptr, mpz_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_z_z (mpc_ptr, mpz_srcptr, mpz_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC void mpc_swap (mpc_ptr, mpc_ptr);
|
||||
__MPC_DECLSPEC int mpc_fma (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
|
||||
|
||||
__MPC_DECLSPEC void mpc_set_nan (mpc_ptr);
|
||||
|
||||
__MPC_DECLSPEC int mpc_real (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_imag (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_arg (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_proj (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_cmp (mpc_srcptr, mpc_srcptr);
|
||||
__MPC_DECLSPEC int mpc_cmp_si_si (mpc_srcptr, long int, long int);
|
||||
__MPC_DECLSPEC int mpc_exp (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_log (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_log10 (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sin (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_cos (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sin_cos (mpc_ptr, mpc_ptr, mpc_srcptr, mpc_rnd_t, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_tan (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_sinh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_cosh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_tanh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_asin (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_acos (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_atan (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_asinh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_acosh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_atanh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC void mpc_clear (mpc_ptr);
|
||||
__MPC_DECLSPEC int mpc_urandom (mpc_ptr, gmp_randstate_t);
|
||||
__MPC_DECLSPEC void mpc_init2 (mpc_ptr, mpfr_prec_t);
|
||||
__MPC_DECLSPEC void mpc_init3 (mpc_ptr, mpfr_prec_t, mpfr_prec_t);
|
||||
__MPC_DECLSPEC mpfr_prec_t mpc_get_prec (mpc_srcptr x);
|
||||
__MPC_DECLSPEC void mpc_get_prec2 (mpfr_prec_t *pr, mpfr_prec_t *pi, mpc_srcptr x);
|
||||
__MPC_DECLSPEC void mpc_set_prec (mpc_ptr, mpfr_prec_t);
|
||||
__MPC_DECLSPEC const char * mpc_get_version (void);
|
||||
|
||||
__MPC_DECLSPEC int mpc_strtoc (mpc_ptr, const char *, char **, int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_str (mpc_ptr, const char *, int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC char * mpc_get_str (int, size_t, mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC void mpc_free_str (char *);
|
||||
|
||||
/* declare certain functions only if appropriate headers have been included */
|
||||
#ifdef _MPC_H_HAVE_INTMAX_T
|
||||
__MPC_DECLSPEC int mpc_set_sj (mpc_ptr, intmax_t, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_uj (mpc_ptr, uintmax_t, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_sj_sj (mpc_ptr, intmax_t, intmax_t, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_uj_uj (mpc_ptr, uintmax_t, uintmax_t, mpc_rnd_t);
|
||||
#endif
|
||||
|
||||
#ifdef _Complex_I
|
||||
__MPC_DECLSPEC int mpc_set_dc (mpc_ptr, double _Complex, mpc_rnd_t);
|
||||
__MPC_DECLSPEC int mpc_set_ldc (mpc_ptr, long double _Complex, mpc_rnd_t);
|
||||
__MPC_DECLSPEC double _Complex mpc_get_dc (mpc_srcptr, mpc_rnd_t);
|
||||
__MPC_DECLSPEC long double _Complex mpc_get_ldc (mpc_srcptr, mpc_rnd_t);
|
||||
#endif
|
||||
|
||||
#ifdef _GMP_H_HAVE_FILE
|
||||
__MPC_DECLSPEC int mpc_inp_str (mpc_ptr, FILE *, size_t *, int, mpc_rnd_t);
|
||||
__MPC_DECLSPEC size_t mpc_out_str (FILE *, int, size_t, mpc_srcptr, mpc_rnd_t);
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define mpc_realref(x) ((x)->re)
|
||||
#define mpc_imagref(x) ((x)->im)
|
||||
|
||||
#define mpc_cmp_si(x, y) \
|
||||
( mpc_cmp_si_si ((x), (y), 0l) )
|
||||
#define mpc_ui_sub(x, y, z, r) mpc_ui_ui_sub (x, y, 0ul, z, r)
|
||||
|
||||
/*
|
||||
Define a fake mpfr_set_fr so that, for instance, mpc_set_fr_z would
|
||||
be defined as follows:
|
||||
mpc_set_fr_z (mpc_t rop, mpfr_t x, mpz_t y, mpc_rnd_t rnd)
|
||||
MPC_SET_X_Y (fr, z, rop, x, y, rnd)
|
||||
*/
|
||||
#ifndef mpfr_set_fr
|
||||
#define mpfr_set_fr mpfr_set
|
||||
#endif
|
||||
#define MPC_SET_X_Y(real_t, imag_t, z, real_value, imag_value, rnd) \
|
||||
{ \
|
||||
int _inex_re, _inex_im; \
|
||||
_inex_re = (mpfr_set_ ## real_t) (mpc_realref (z), (real_value), MPC_RND_RE (rnd)); \
|
||||
_inex_im = (mpfr_set_ ## imag_t) (mpc_imagref (z), (imag_value), MPC_RND_IM (rnd)); \
|
||||
return MPC_INEX (_inex_re, _inex_im); \
|
||||
}
|
||||
|
||||
#endif /* ifndef __MPC_H */
|
|
@ -0,0 +1,639 @@
|
|||
/* mpc_mul -- Multiply two complex numbers
|
||||
|
||||
Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
#define mpz_add_si(z,x,y) do { \
|
||||
if (y >= 0) \
|
||||
mpz_add_ui (z, x, (long int) y); \
|
||||
else \
|
||||
mpz_sub_ui (z, x, (long int) (-y)); \
|
||||
} while (0);
|
||||
|
||||
/* compute z=x*y when x has an infinite part */
|
||||
static int
|
||||
mul_infinite (mpc_ptr z, mpc_srcptr x, mpc_srcptr y)
|
||||
{
|
||||
/* Let x=xr+i*xi and y=yr+i*yi; extract the signs of the operands */
|
||||
int xrs = mpfr_signbit (mpc_realref (x)) ? -1 : 1;
|
||||
int xis = mpfr_signbit (mpc_imagref (x)) ? -1 : 1;
|
||||
int yrs = mpfr_signbit (mpc_realref (y)) ? -1 : 1;
|
||||
int yis = mpfr_signbit (mpc_imagref (y)) ? -1 : 1;
|
||||
|
||||
int u, v;
|
||||
|
||||
/* compute the sign of
|
||||
u = xrs * yrs * xr * yr - xis * yis * xi * yi
|
||||
v = xrs * yis * xr * yi + xis * yrs * xi * yr
|
||||
+1 if positive, -1 if negatiye, 0 if NaN */
|
||||
if ( mpfr_nan_p (mpc_realref (x)) || mpfr_nan_p (mpc_imagref (x))
|
||||
|| mpfr_nan_p (mpc_realref (y)) || mpfr_nan_p (mpc_imagref (y))) {
|
||||
u = 0;
|
||||
v = 0;
|
||||
}
|
||||
else if (mpfr_inf_p (mpc_realref (x))) {
|
||||
/* x = (+/-inf) xr + i*xi */
|
||||
u = ( mpfr_zero_p (mpc_realref (y))
|
||||
|| (mpfr_inf_p (mpc_imagref (x)) && mpfr_zero_p (mpc_imagref (y)))
|
||||
|| (mpfr_zero_p (mpc_imagref (x)) && mpfr_inf_p (mpc_imagref (y)))
|
||||
|| ( (mpfr_inf_p (mpc_imagref (x)) || mpfr_inf_p (mpc_imagref (y)))
|
||||
&& xrs*yrs == xis*yis)
|
||||
? 0 : xrs * yrs);
|
||||
v = ( mpfr_zero_p (mpc_imagref (y))
|
||||
|| (mpfr_inf_p (mpc_imagref (x)) && mpfr_zero_p (mpc_realref (y)))
|
||||
|| (mpfr_zero_p (mpc_imagref (x)) && mpfr_inf_p (mpc_realref (y)))
|
||||
|| ( (mpfr_inf_p (mpc_imagref (x)) || mpfr_inf_p (mpc_imagref (x)))
|
||||
&& xrs*yis != xis*yrs)
|
||||
? 0 : xrs * yis);
|
||||
}
|
||||
else {
|
||||
/* x = xr + i*(+/-inf) with |xr| != inf */
|
||||
u = ( mpfr_zero_p (mpc_imagref (y))
|
||||
|| (mpfr_zero_p (mpc_realref (x)) && mpfr_inf_p (mpc_realref (y)))
|
||||
|| (mpfr_inf_p (mpc_realref (y)) && xrs*yrs == xis*yis)
|
||||
? 0 : -xis * yis);
|
||||
v = ( mpfr_zero_p (mpc_realref (y))
|
||||
|| (mpfr_zero_p (mpc_realref (x)) && mpfr_inf_p (mpc_imagref (y)))
|
||||
|| (mpfr_inf_p (mpc_imagref (y)) && xrs*yis != xis*yrs)
|
||||
? 0 : xis * yrs);
|
||||
}
|
||||
|
||||
if (u == 0 && v == 0) {
|
||||
/* Naive result is NaN+i*NaN. Obtain an infinity using the algorithm
|
||||
given in Annex G.5.1 of the ISO C99 standard */
|
||||
int xr = (mpfr_zero_p (mpc_realref (x)) || mpfr_nan_p (mpc_realref (x)) ? 0
|
||||
: (mpfr_inf_p (mpc_realref (x)) ? 1 : 0));
|
||||
int xi = (mpfr_zero_p (mpc_imagref (x)) || mpfr_nan_p (mpc_imagref (x)) ? 0
|
||||
: (mpfr_inf_p (mpc_imagref (x)) ? 1 : 0));
|
||||
int yr = (mpfr_zero_p (mpc_realref (y)) || mpfr_nan_p (mpc_realref (y)) ? 0 : 1);
|
||||
int yi = (mpfr_zero_p (mpc_imagref (y)) || mpfr_nan_p (mpc_imagref (y)) ? 0 : 1);
|
||||
if (mpc_inf_p (y)) {
|
||||
yr = mpfr_inf_p (mpc_realref (y)) ? 1 : 0;
|
||||
yi = mpfr_inf_p (mpc_imagref (y)) ? 1 : 0;
|
||||
}
|
||||
|
||||
u = xrs * xr * yrs * yr - xis * xi * yis * yi;
|
||||
v = xrs * xr * yis * yi + xis * xi * yrs * yr;
|
||||
}
|
||||
|
||||
if (u == 0)
|
||||
mpfr_set_nan (mpc_realref (z));
|
||||
else
|
||||
mpfr_set_inf (mpc_realref (z), u);
|
||||
|
||||
if (v == 0)
|
||||
mpfr_set_nan (mpc_imagref (z));
|
||||
else
|
||||
mpfr_set_inf (mpc_imagref (z), v);
|
||||
|
||||
return MPC_INEX (0, 0); /* exact */
|
||||
}
|
||||
|
||||
|
||||
/* compute z = x*y for Im(y) == 0 */
|
||||
static int
|
||||
mul_real (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
|
||||
{
|
||||
int xrs, xis, yrs, yis;
|
||||
int inex;
|
||||
|
||||
/* save signs of operands */
|
||||
xrs = MPFR_SIGNBIT (mpc_realref (x));
|
||||
xis = MPFR_SIGNBIT (mpc_imagref (x));
|
||||
yrs = MPFR_SIGNBIT (mpc_realref (y));
|
||||
yis = MPFR_SIGNBIT (mpc_imagref (y));
|
||||
|
||||
inex = mpc_mul_fr (z, x, mpc_realref (y), rnd);
|
||||
/* Signs of zeroes may be wrong. Their correction does not change the
|
||||
inexact flag. */
|
||||
if (mpfr_zero_p (mpc_realref (z)))
|
||||
mpfr_setsign (mpc_realref (z), mpc_realref (z), MPC_RND_RE(rnd) == GMP_RNDD
|
||||
|| (xrs != yrs && xis == yis), GMP_RNDN);
|
||||
if (mpfr_zero_p (mpc_imagref (z)))
|
||||
mpfr_setsign (mpc_imagref (z), mpc_imagref (z), MPC_RND_IM (rnd) == GMP_RNDD
|
||||
|| (xrs != yis && xis != yrs), GMP_RNDN);
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
|
||||
/* compute z = x*y for Re(y) == 0, and Im(x) != 0 and Im(y) != 0 */
|
||||
static int
|
||||
mul_imag (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
|
||||
{
|
||||
int sign;
|
||||
int inex_re, inex_im;
|
||||
int overlap = z == x || z == y;
|
||||
mpc_t rop;
|
||||
|
||||
if (overlap)
|
||||
mpc_init3 (rop, MPC_PREC_RE (z), MPC_PREC_IM (z));
|
||||
else
|
||||
rop [0] = z[0];
|
||||
|
||||
sign = (MPFR_SIGNBIT (mpc_realref (y)) != MPFR_SIGNBIT (mpc_imagref (x)))
|
||||
&& (MPFR_SIGNBIT (mpc_imagref (y)) != MPFR_SIGNBIT (mpc_realref (x)));
|
||||
|
||||
inex_re = -mpfr_mul (mpc_realref (rop), mpc_imagref (x), mpc_imagref (y),
|
||||
INV_RND (MPC_RND_RE (rnd)));
|
||||
mpfr_neg (mpc_realref (rop), mpc_realref (rop), GMP_RNDN); /* exact */
|
||||
inex_im = mpfr_mul (mpc_imagref (rop), mpc_realref (x), mpc_imagref (y),
|
||||
MPC_RND_IM (rnd));
|
||||
mpc_set (z, rop, MPC_RNDNN);
|
||||
|
||||
/* Sign of zeroes may be wrong (note that Re(z) cannot be zero) */
|
||||
if (mpfr_zero_p (mpc_imagref (z)))
|
||||
mpfr_setsign (mpc_imagref (z), mpc_imagref (z), MPC_RND_IM (rnd) == GMP_RNDD
|
||||
|| sign, GMP_RNDN);
|
||||
|
||||
if (overlap)
|
||||
mpc_clear (rop);
|
||||
|
||||
return MPC_INEX (inex_re, inex_im);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
|
||||
mpfr_srcptr d, int sign, mpfr_rnd_t rnd)
|
||||
{
|
||||
/* Computes z = ab+cd if sign >= 0, or z = ab-cd if sign < 0.
|
||||
Assumes that a, b, c, d are finite and non-zero; so any multiplication
|
||||
of two of them yielding an infinity is an overflow, and a
|
||||
multiplication yielding 0 is an underflow.
|
||||
Assumes further that z is distinct from a, b, c, d. */
|
||||
|
||||
int inex;
|
||||
mpfr_t u, v;
|
||||
|
||||
/* u=a*b, v=sign*c*d exactly */
|
||||
mpfr_init2 (u, mpfr_get_prec (a) + mpfr_get_prec (b));
|
||||
mpfr_init2 (v, mpfr_get_prec (c) + mpfr_get_prec (d));
|
||||
mpfr_mul (u, a, b, GMP_RNDN);
|
||||
mpfr_mul (v, c, d, GMP_RNDN);
|
||||
if (sign < 0)
|
||||
mpfr_neg (v, v, GMP_RNDN);
|
||||
|
||||
/* tentatively compute z as u+v; here we need z to be distinct
|
||||
from a, b, c, d to not lose the latter */
|
||||
inex = mpfr_add (z, u, v, rnd);
|
||||
|
||||
if (mpfr_inf_p (z)) {
|
||||
/* replace by "correctly rounded overflow" */
|
||||
mpfr_set_si (z, (mpfr_signbit (z) ? -1 : 1), GMP_RNDN);
|
||||
inex = mpfr_mul_2ui (z, z, mpfr_get_emax (), rnd);
|
||||
}
|
||||
else if (mpfr_zero_p (u) && !mpfr_zero_p (v)) {
|
||||
/* exactly u underflowed, determine inexact flag */
|
||||
inex = (mpfr_signbit (u) ? 1 : -1);
|
||||
}
|
||||
else if (mpfr_zero_p (v) && !mpfr_zero_p (u)) {
|
||||
/* exactly v underflowed, determine inexact flag */
|
||||
inex = (mpfr_signbit (v) ? 1 : -1);
|
||||
}
|
||||
else if (mpfr_nan_p (z) || (mpfr_zero_p (u) && mpfr_zero_p (v))) {
|
||||
/* In the first case, u and v are infinities with opposite signs.
|
||||
In the second case, u and v are zeroes; their sum may be 0 or the
|
||||
least representable number, with a sign to be determined.
|
||||
Redo the computations with mpz_t exponents */
|
||||
mpfr_exp_t ea, eb, ec, ed;
|
||||
mpz_t eu, ev;
|
||||
/* cheat to work around the const qualifiers */
|
||||
|
||||
/* Normalise the input by shifting and keep track of the shifts in
|
||||
the exponents of u and v */
|
||||
ea = mpfr_get_exp (a);
|
||||
eb = mpfr_get_exp (b);
|
||||
ec = mpfr_get_exp (c);
|
||||
ed = mpfr_get_exp (d);
|
||||
|
||||
mpfr_set_exp ((mpfr_ptr) a, (mpfr_prec_t) 0);
|
||||
mpfr_set_exp ((mpfr_ptr) b, (mpfr_prec_t) 0);
|
||||
mpfr_set_exp ((mpfr_ptr) c, (mpfr_prec_t) 0);
|
||||
mpfr_set_exp ((mpfr_ptr) d, (mpfr_prec_t) 0);
|
||||
|
||||
mpz_init (eu);
|
||||
mpz_init (ev);
|
||||
mpz_set_si (eu, (long int) ea);
|
||||
mpz_add_si (eu, eu, (long int) eb);
|
||||
mpz_set_si (ev, (long int) ec);
|
||||
mpz_add_si (ev, ev, (long int) ed);
|
||||
|
||||
/* recompute u and v and move exponents to eu and ev */
|
||||
mpfr_mul (u, a, b, GMP_RNDN);
|
||||
/* exponent of u is non-positive */
|
||||
mpz_sub_ui (eu, eu, (unsigned long int) (-mpfr_get_exp (u)));
|
||||
mpfr_set_exp (u, (mpfr_prec_t) 0);
|
||||
mpfr_mul (v, c, d, GMP_RNDN);
|
||||
if (sign < 0)
|
||||
mpfr_neg (v, v, GMP_RNDN);
|
||||
mpz_sub_ui (ev, ev, (unsigned long int) (-mpfr_get_exp (v)));
|
||||
mpfr_set_exp (v, (mpfr_prec_t) 0);
|
||||
|
||||
if (mpfr_nan_p (z)) {
|
||||
mpfr_exp_t emax = mpfr_get_emax ();
|
||||
int overflow;
|
||||
/* We have a = ma * 2^ea with 1/2 <= |ma| < 1 and ea <= emax, and
|
||||
analogously for b. So eu <= 2*emax, and eu > emax since we have
|
||||
an overflow. The same holds for ev. Shift u and v by as much as
|
||||
possible so that one of them has exponent emax and the
|
||||
remaining exponents in eu and ev are the same. Then carry out
|
||||
the addition. Shifting u and v prevents an underflow. */
|
||||
if (mpz_cmp (eu, ev) >= 0) {
|
||||
mpfr_set_exp (u, emax);
|
||||
mpz_sub_ui (eu, eu, (long int) emax);
|
||||
mpz_sub (ev, ev, eu);
|
||||
mpfr_set_exp (v, (mpfr_exp_t) mpz_get_ui (ev));
|
||||
/* remaining common exponent is now in eu */
|
||||
}
|
||||
else {
|
||||
mpfr_set_exp (v, emax);
|
||||
mpz_sub_ui (ev, ev, (long int) emax);
|
||||
mpz_sub (eu, eu, ev);
|
||||
mpfr_set_exp (u, (mpfr_exp_t) mpz_get_ui (eu));
|
||||
mpz_set (eu, ev);
|
||||
/* remaining common exponent is now also in eu */
|
||||
}
|
||||
inex = mpfr_add (z, u, v, rnd);
|
||||
/* Result is finite since u and v have different signs. */
|
||||
overflow = mpfr_mul_2ui (z, z, mpz_get_ui (eu), rnd);
|
||||
if (overflow)
|
||||
inex = overflow;
|
||||
}
|
||||
else {
|
||||
int underflow;
|
||||
/* Addition of two zeroes with same sign. We have a = ma * 2^ea
|
||||
with 1/2 <= |ma| < 1 and ea >= emin and similarly for b.
|
||||
So 2*emin < 2*emin+1 <= eu < emin < 0, and analogously for v. */
|
||||
mpfr_exp_t emin = mpfr_get_emin ();
|
||||
if (mpz_cmp (eu, ev) <= 0) {
|
||||
mpfr_set_exp (u, emin);
|
||||
mpz_add_ui (eu, eu, (unsigned long int) (-emin));
|
||||
mpz_sub (ev, ev, eu);
|
||||
mpfr_set_exp (v, (mpfr_exp_t) mpz_get_si (ev));
|
||||
}
|
||||
else {
|
||||
mpfr_set_exp (v, emin);
|
||||
mpz_add_ui (ev, ev, (unsigned long int) (-emin));
|
||||
mpz_sub (eu, eu, ev);
|
||||
mpfr_set_exp (u, (mpfr_exp_t) mpz_get_si (eu));
|
||||
mpz_set (eu, ev);
|
||||
}
|
||||
inex = mpfr_add (z, u, v, rnd);
|
||||
mpz_neg (eu, eu);
|
||||
underflow = mpfr_div_2ui (z, z, mpz_get_ui (eu), rnd);
|
||||
if (underflow)
|
||||
inex = underflow;
|
||||
}
|
||||
|
||||
mpz_clear (eu);
|
||||
mpz_clear (ev);
|
||||
|
||||
mpfr_set_exp ((mpfr_ptr) a, ea);
|
||||
mpfr_set_exp ((mpfr_ptr) b, eb);
|
||||
mpfr_set_exp ((mpfr_ptr) c, ec);
|
||||
mpfr_set_exp ((mpfr_ptr) d, ed);
|
||||
/* works also when some of a, b, c, d are not all distinct */
|
||||
}
|
||||
|
||||
mpfr_clear (u);
|
||||
mpfr_clear (v);
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_mul_naive (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
|
||||
{
|
||||
/* computes z=x*y by the schoolbook method, where x and y are assumed
|
||||
to be finite and without zero parts */
|
||||
int overlap, inex;
|
||||
mpc_t rop;
|
||||
|
||||
MPC_ASSERT ( mpfr_regular_p (mpc_realref (x)) && mpfr_regular_p (mpc_imagref (x))
|
||||
&& mpfr_regular_p (mpc_realref (y)) && mpfr_regular_p (mpc_imagref (y)));
|
||||
overlap = (z == x) || (z == y);
|
||||
if (overlap)
|
||||
mpc_init3 (rop, MPC_PREC_RE (z), MPC_PREC_IM (z));
|
||||
else
|
||||
rop [0] = z [0];
|
||||
|
||||
inex = MPC_INEX (mpfr_fmma (mpc_realref (rop), mpc_realref (x), mpc_realref (y), mpc_imagref (x),
|
||||
mpc_imagref (y), -1, MPC_RND_RE (rnd)),
|
||||
mpfr_fmma (mpc_imagref (rop), mpc_realref (x), mpc_imagref (y), mpc_imagref (x),
|
||||
mpc_realref (y), +1, MPC_RND_IM (rnd)));
|
||||
|
||||
mpc_set (z, rop, MPC_RNDNN);
|
||||
if (overlap)
|
||||
mpc_clear (rop);
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd)
|
||||
{
|
||||
/* computes rop=op1*op2 by a Karatsuba algorithm, where op1 and op2
|
||||
are assumed to be finite and without zero parts */
|
||||
mpfr_srcptr a, b, c, d;
|
||||
int mul_i, ok, inexact, mul_a, mul_c, inex_re = 0, inex_im = 0, sign_x, sign_u;
|
||||
mpfr_t u, v, w, x;
|
||||
mpfr_prec_t prec, prec_re, prec_u, prec_v, prec_w;
|
||||
mpfr_rnd_t rnd_re, rnd_u;
|
||||
int overlap;
|
||||
/* true if rop == op1 or rop == op2 */
|
||||
mpc_t result;
|
||||
/* overlap is quite difficult to handle, because we have to tentatively
|
||||
round the variable u in the end to either the real or the imaginary
|
||||
part of rop (it is not possible to tell now whether the real or
|
||||
imaginary part is used). If this fails, we have to start again and
|
||||
need the correct values of op1 and op2.
|
||||
So we just create a new variable for the result in this case. */
|
||||
int loop;
|
||||
const int MAX_MUL_LOOP = 1;
|
||||
|
||||
overlap = (rop == op1) || (rop == op2);
|
||||
if (overlap)
|
||||
mpc_init3 (result, MPC_PREC_RE (rop), MPC_PREC_IM (rop));
|
||||
else
|
||||
result [0] = rop [0];
|
||||
|
||||
a = mpc_realref(op1);
|
||||
b = mpc_imagref(op1);
|
||||
c = mpc_realref(op2);
|
||||
d = mpc_imagref(op2);
|
||||
|
||||
/* (a + i*b) * (c + i*d) = [ac - bd] + i*[ad + bc] */
|
||||
|
||||
mul_i = 0; /* number of multiplications by i */
|
||||
mul_a = 1; /* implicit factor for a */
|
||||
mul_c = 1; /* implicit factor for c */
|
||||
|
||||
if (mpfr_cmp_abs (a, b) < 0)
|
||||
{
|
||||
MPFR_SWAP (a, b);
|
||||
mul_i ++;
|
||||
mul_a = -1; /* consider i * (a+i*b) = -b + i*a */
|
||||
}
|
||||
|
||||
if (mpfr_cmp_abs (c, d) < 0)
|
||||
{
|
||||
MPFR_SWAP (c, d);
|
||||
mul_i ++;
|
||||
mul_c = -1; /* consider -d + i*c instead of c + i*d */
|
||||
}
|
||||
|
||||
/* find the precision and rounding mode for the new real part */
|
||||
if (mul_i % 2)
|
||||
{
|
||||
prec_re = MPC_PREC_IM(rop);
|
||||
rnd_re = MPC_RND_IM(rnd);
|
||||
}
|
||||
else /* mul_i = 0 or 2 */
|
||||
{
|
||||
prec_re = MPC_PREC_RE(rop);
|
||||
rnd_re = MPC_RND_RE(rnd);
|
||||
}
|
||||
|
||||
if (mul_i)
|
||||
rnd_re = INV_RND(rnd_re);
|
||||
|
||||
/* now |a| >= |b| and |c| >= |d| */
|
||||
prec = MPC_MAX_PREC(rop);
|
||||
|
||||
mpfr_init2 (v, prec_v = mpfr_get_prec (a) + mpfr_get_prec (d));
|
||||
mpfr_init2 (w, prec_w = mpfr_get_prec (b) + mpfr_get_prec (c));
|
||||
mpfr_init2 (u, 2);
|
||||
mpfr_init2 (x, 2);
|
||||
|
||||
inexact = mpfr_mul (v, a, d, GMP_RNDN);
|
||||
if (inexact) {
|
||||
/* over- or underflow */
|
||||
ok = 0;
|
||||
goto clear;
|
||||
}
|
||||
if (mul_a == -1)
|
||||
mpfr_neg (v, v, GMP_RNDN);
|
||||
|
||||
inexact = mpfr_mul (w, b, c, GMP_RNDN);
|
||||
if (inexact) {
|
||||
/* over- or underflow */
|
||||
ok = 0;
|
||||
goto clear;
|
||||
}
|
||||
if (mul_c == -1)
|
||||
mpfr_neg (w, w, GMP_RNDN);
|
||||
|
||||
/* compute sign(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)
|
||||
sign_x = mpfr_sgn (v) - mpfr_sgn (w);
|
||||
else
|
||||
sign_x = mpfr_sgn (v) - 2 * mpfr_sgn (w);
|
||||
|
||||
sign_u = mul_a * mpfr_sgn (a) * mul_c * mpfr_sgn (c);
|
||||
|
||||
if (sign_x * sign_u < 0)
|
||||
{ /* swap inputs */
|
||||
MPFR_SWAP (a, c);
|
||||
MPFR_SWAP (b, d);
|
||||
mpfr_swap (v, w);
|
||||
{ int tmp; tmp = mul_a; mul_a = mul_c; mul_c = tmp; }
|
||||
sign_x = - sign_x;
|
||||
}
|
||||
|
||||
/* now sign_x * sign_u >= 0 */
|
||||
loop = 0;
|
||||
do
|
||||
{
|
||||
loop++;
|
||||
/* the following should give failures with prob. <= 1/prec */
|
||||
prec += mpc_ceil_log2 (prec) + 3;
|
||||
|
||||
mpfr_set_prec (u, prec_u = prec);
|
||||
mpfr_set_prec (x, prec);
|
||||
|
||||
/* first compute away(b +/- a) and store it in u */
|
||||
inexact = (mul_a == -1 ?
|
||||
ROUND_AWAY (mpfr_sub (u, b, a, MPFR_RNDA), u) :
|
||||
ROUND_AWAY (mpfr_add (u, b, a, MPFR_RNDA), u));
|
||||
|
||||
/* then compute away(+/-c - d) and store it in x */
|
||||
inexact |= (mul_c == -1 ?
|
||||
ROUND_AWAY (mpfr_add (x, c, d, MPFR_RNDA), x) :
|
||||
ROUND_AWAY (mpfr_sub (x, c, d, MPFR_RNDA), x));
|
||||
if (mul_c == -1)
|
||||
mpfr_neg (x, x, GMP_RNDN);
|
||||
|
||||
if (inexact == 0)
|
||||
mpfr_prec_round (u, prec_u = 2 * prec, GMP_RNDN);
|
||||
|
||||
/* compute away(u*x) and store it in u */
|
||||
inexact |= ROUND_AWAY (mpfr_mul (u, u, x, MPFR_RNDA), u);
|
||||
/* (a+b)*(c-d) */
|
||||
|
||||
/* if all computations are exact up to here, it may be that
|
||||
the real part is exact, thus we need if possible to
|
||||
compute v - w exactly */
|
||||
if (inexact == 0)
|
||||
{
|
||||
mpfr_prec_t prec_x;
|
||||
/* v and w are different from 0, so mpfr_get_exp is safe to use */
|
||||
prec_x = SAFE_ABS (mpfr_exp_t, mpfr_get_exp (v) - mpfr_get_exp (w))
|
||||
+ MPC_MAX (prec_v, prec_w) + 1;
|
||||
/* +1 is necessary for a potential carry */
|
||||
/* ensure we do not use a too large precision */
|
||||
if (prec_x > prec_u)
|
||||
prec_x = prec_u;
|
||||
if (prec_x > prec)
|
||||
mpfr_prec_round (x, prec_x, GMP_RNDN);
|
||||
}
|
||||
|
||||
rnd_u = (sign_u > 0) ? GMP_RNDU : GMP_RNDD;
|
||||
inexact |= mpfr_sub (x, v, w, rnd_u); /* ad - bc */
|
||||
|
||||
/* in case u=0, ensure that rnd_u rounds x away from zero */
|
||||
if (mpfr_sgn (u) == 0)
|
||||
rnd_u = (mpfr_sgn (x) > 0) ? GMP_RNDU : GMP_RNDD;
|
||||
inexact |= mpfr_add (u, u, x, rnd_u); /* ac - bd */
|
||||
|
||||
ok = inexact == 0 ||
|
||||
mpfr_can_round (u, prec_u - 3, rnd_u, GMP_RNDZ,
|
||||
prec_re + (rnd_re == GMP_RNDN));
|
||||
/* this ensures both we can round correctly and determine the correct
|
||||
inexact flag (for rounding to nearest) */
|
||||
}
|
||||
while (!ok && loop <= MAX_MUL_LOOP);
|
||||
/* after MAX_MUL_LOOP rounds, use mpc_naive instead */
|
||||
|
||||
if (ok) {
|
||||
/* if inexact is zero, then u is exactly ac-bd, otherwise fix the sign
|
||||
of the inexact flag for u, which was rounded away from ac-bd */
|
||||
if (inexact != 0)
|
||||
inexact = mpfr_sgn (u);
|
||||
|
||||
if (mul_i == 0)
|
||||
{
|
||||
inex_re = mpfr_set (mpc_realref(result), u, MPC_RND_RE(rnd));
|
||||
if (inex_re == 0)
|
||||
{
|
||||
inex_re = inexact; /* u is rounded away from 0 */
|
||||
inex_im = mpfr_add (mpc_imagref(result), v, w, MPC_RND_IM(rnd));
|
||||
}
|
||||
else
|
||||
inex_im = mpfr_add (mpc_imagref(result), v, w, MPC_RND_IM(rnd));
|
||||
}
|
||||
else if (mul_i == 1) /* (x+i*y)/i = y - i*x */
|
||||
{
|
||||
inex_im = mpfr_neg (mpc_imagref(result), u, MPC_RND_IM(rnd));
|
||||
if (inex_im == 0)
|
||||
{
|
||||
inex_im = -inexact; /* u is rounded away from 0 */
|
||||
inex_re = mpfr_add (mpc_realref(result), v, w, MPC_RND_RE(rnd));
|
||||
}
|
||||
else
|
||||
inex_re = mpfr_add (mpc_realref(result), v, w, MPC_RND_RE(rnd));
|
||||
}
|
||||
else /* mul_i = 2, z/i^2 = -z */
|
||||
{
|
||||
inex_re = mpfr_neg (mpc_realref(result), u, MPC_RND_RE(rnd));
|
||||
if (inex_re == 0)
|
||||
{
|
||||
inex_re = -inexact; /* u is rounded away from 0 */
|
||||
inex_im = -mpfr_add (mpc_imagref(result), v, w,
|
||||
INV_RND(MPC_RND_IM(rnd)));
|
||||
mpfr_neg (mpc_imagref(result), mpc_imagref(result), MPC_RND_IM(rnd));
|
||||
}
|
||||
else
|
||||
{
|
||||
inex_im = -mpfr_add (mpc_imagref(result), v, w,
|
||||
INV_RND(MPC_RND_IM(rnd)));
|
||||
mpfr_neg (mpc_imagref(result), mpc_imagref(result), MPC_RND_IM(rnd));
|
||||
}
|
||||
}
|
||||
|
||||
mpc_set (rop, result, MPC_RNDNN);
|
||||
}
|
||||
|
||||
clear:
|
||||
mpfr_clear (u);
|
||||
mpfr_clear (v);
|
||||
mpfr_clear (w);
|
||||
mpfr_clear (x);
|
||||
if (overlap)
|
||||
mpc_clear (result);
|
||||
|
||||
if (ok)
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
else
|
||||
return mpc_mul_naive (rop, op1, op2, rnd);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_mul (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
/* Conforming to ISO C99 standard (G.5.1 multiplicative operators),
|
||||
infinities are treated specially if both parts are NaN when computed
|
||||
naively. */
|
||||
if (mpc_inf_p (b))
|
||||
return mul_infinite (a, b, c);
|
||||
if (mpc_inf_p (c))
|
||||
return mul_infinite (a, c, b);
|
||||
|
||||
/* NaN contamination of both parts in result */
|
||||
if (mpfr_nan_p (mpc_realref (b)) || mpfr_nan_p (mpc_imagref (b))
|
||||
|| mpfr_nan_p (mpc_realref (c)) || mpfr_nan_p (mpc_imagref (c))) {
|
||||
mpfr_set_nan (mpc_realref (a));
|
||||
mpfr_set_nan (mpc_imagref (a));
|
||||
return MPC_INEX (0, 0);
|
||||
}
|
||||
|
||||
/* check for real multiplication */
|
||||
if (mpfr_zero_p (mpc_imagref (b)))
|
||||
return mul_real (a, c, b, rnd);
|
||||
if (mpfr_zero_p (mpc_imagref (c)))
|
||||
return mul_real (a, b, c, rnd);
|
||||
|
||||
/* check for purely imaginary multiplication */
|
||||
if (mpfr_zero_p (mpc_realref (b)))
|
||||
return mul_imag (a, c, b, rnd);
|
||||
if (mpfr_zero_p (mpc_realref (c)))
|
||||
return mul_imag (a, b, c, rnd);
|
||||
|
||||
/* If the real and imaginary part of one argument have a very different */
|
||||
/* exponent, it is not reasonable to use Karatsuba multiplication. */
|
||||
if ( SAFE_ABS (mpfr_exp_t,
|
||||
mpfr_get_exp (mpc_realref (b)) - mpfr_get_exp (mpc_imagref (b)))
|
||||
> (mpfr_exp_t) MPC_MAX_PREC (b) / 2
|
||||
|| SAFE_ABS (mpfr_exp_t,
|
||||
mpfr_get_exp (mpc_realref (c)) - mpfr_get_exp (mpc_imagref (c)))
|
||||
> (mpfr_exp_t) MPC_MAX_PREC (c) / 2)
|
||||
return mpc_mul_naive (a, b, c, rnd);
|
||||
else
|
||||
return ((MPC_MAX_PREC(a)
|
||||
<= (mpfr_prec_t) MUL_KARATSUBA_THRESHOLD * BITS_PER_MP_LIMB)
|
||||
? mpc_mul_naive : mpc_mul_karatsuba) (a, b, c, rnd);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_mul_2si -- Multiply a complex number by 2^e.
|
||||
|
||||
Copyright (C) 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_2si (mpc_ptr a, mpc_srcptr b, long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_mul_2si (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_mul_2si (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_mul_2ui -- Multiply a complex number by 2^e.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_2ui (mpc_ptr a, mpc_srcptr b, unsigned long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_mul_2ui (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_mul_2ui (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* mpc_mul_fr -- Multiply a complex number by a floating-point number.
|
||||
|
||||
Copyright (C) 2002, 2008, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_fr (mpc_ptr a, mpc_srcptr b, mpfr_srcptr c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
mpfr_t real;
|
||||
|
||||
if (c == mpc_realref (a))
|
||||
/* We have to use a temporary variable. */
|
||||
mpfr_init2 (real, MPC_PREC_RE (a));
|
||||
else
|
||||
real [0] = mpc_realref (a) [0];
|
||||
|
||||
inex_re = mpfr_mul (real, mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_mul (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
mpfr_set (mpc_realref (a), real, GMP_RNDN); /* exact */
|
||||
|
||||
if (c == mpc_realref (a))
|
||||
mpfr_clear (real);
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/* mpc_mul_i -- Multiply a complex number by plus or minus i.
|
||||
|
||||
Copyright (C) 2005, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_i (mpc_ptr a, mpc_srcptr b, int sign, mpc_rnd_t rnd)
|
||||
/* if sign is >= 0, multiply by i, otherwise by -i */
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
mpfr_t tmp;
|
||||
|
||||
/* Treat the most probable case of compatible precisions first */
|
||||
if ( MPC_PREC_RE (b) == MPC_PREC_IM (a)
|
||||
&& MPC_PREC_IM (b) == MPC_PREC_RE (a))
|
||||
{
|
||||
if (a == b)
|
||||
mpfr_swap (mpc_realref (a), mpc_imagref (a));
|
||||
else
|
||||
{
|
||||
mpfr_set (mpc_realref (a), mpc_imagref (b), GMP_RNDN);
|
||||
mpfr_set (mpc_imagref (a), mpc_realref (b), GMP_RNDN);
|
||||
}
|
||||
if (sign >= 0)
|
||||
MPFR_CHANGE_SIGN (mpc_realref (a));
|
||||
else
|
||||
MPFR_CHANGE_SIGN (mpc_imagref (a));
|
||||
inex_re = 0;
|
||||
inex_im = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a == b)
|
||||
{
|
||||
mpfr_init2 (tmp, MPC_PREC_RE (a));
|
||||
if (sign >= 0)
|
||||
{
|
||||
inex_re = mpfr_neg (tmp, mpc_imagref (b), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (a), mpc_realref (b), MPC_RND_IM (rnd));
|
||||
}
|
||||
else
|
||||
{
|
||||
inex_re = mpfr_set (tmp, mpc_imagref (b), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_neg (mpc_imagref (a), mpc_realref (b), MPC_RND_IM (rnd));
|
||||
}
|
||||
mpfr_clear (mpc_realref (a));
|
||||
mpc_realref (a)[0] = tmp [0];
|
||||
}
|
||||
else
|
||||
if (sign >= 0)
|
||||
{
|
||||
inex_re = mpfr_neg (mpc_realref (a), mpc_imagref (b), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_set (mpc_imagref (a), mpc_realref (b), MPC_RND_IM (rnd));
|
||||
}
|
||||
else
|
||||
{
|
||||
inex_re = mpfr_set (mpc_realref (a), mpc_imagref (b), MPC_RND_RE (rnd));
|
||||
inex_im = mpfr_neg (mpc_imagref (a), mpc_realref (b), MPC_RND_IM (rnd));
|
||||
}
|
||||
}
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_mul_si -- Multiply a complex number by a signed integer.
|
||||
|
||||
Copyright (C) 2005, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_si (mpc_ptr a, mpc_srcptr b, long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_mul_si (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_mul_si (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_mul_ui -- Multiply a complex number by a nonnegative integer.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_mul_ui (mpc_ptr a, mpc_srcptr b, unsigned long int c, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_mul_ui (mpc_realref(a), mpc_realref(b), c, MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_mul_ui (mpc_imagref(a), mpc_imagref(b), c, MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* mpc_neg -- Negate a complex number.
|
||||
|
||||
Copyright (C) 2002, 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_neg (mpc_ptr a, mpc_srcptr b, mpc_rnd_t rnd)
|
||||
{
|
||||
int inex_re, inex_im;
|
||||
|
||||
inex_re = mpfr_neg (mpc_realref(a), mpc_realref(b), MPC_RND_RE(rnd));
|
||||
inex_im = mpfr_neg (mpc_imagref(a), mpc_imagref(b), MPC_RND_IM(rnd));
|
||||
|
||||
return MPC_INEX(inex_re, inex_im);
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
/* mpc_norm -- Square of the norm of a complex number.
|
||||
|
||||
Copyright (C) 2002, 2005, 2008, 2009, 2010, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* a <- norm(b) = b * conj(b)
|
||||
(the rounding mode is mpfr_rnd_t here since we return an mpfr number) */
|
||||
int
|
||||
mpc_norm (mpfr_ptr a, mpc_srcptr b, mpfr_rnd_t rnd)
|
||||
{
|
||||
int inexact;
|
||||
int saved_underflow, saved_overflow;
|
||||
|
||||
/* handling of special values; consistent with abs in that
|
||||
norm = abs^2; so norm (+-inf, xxx) = norm (xxx, +-inf) = +inf */
|
||||
if (!mpc_fin_p (b))
|
||||
return mpc_abs (a, b, rnd);
|
||||
else if (mpfr_zero_p (mpc_realref (b))) {
|
||||
if (mpfr_zero_p (mpc_imagref (b)))
|
||||
return mpfr_set_ui (a, 0, rnd); /* +0 */
|
||||
else
|
||||
return mpfr_sqr (a, mpc_imagref (b), rnd);
|
||||
}
|
||||
else if (mpfr_zero_p (mpc_imagref (b)))
|
||||
return mpfr_sqr (a, mpc_realref (b), rnd); /* Re(b) <> 0 */
|
||||
|
||||
else /* everything finite and non-zero */ {
|
||||
mpfr_t u, v, res;
|
||||
mpfr_prec_t prec, prec_u, prec_v;
|
||||
int loops;
|
||||
const int max_loops = 2;
|
||||
/* switch to exact squarings when loops==max_loops */
|
||||
|
||||
prec = mpfr_get_prec (a);
|
||||
|
||||
mpfr_init (u);
|
||||
mpfr_init (v);
|
||||
mpfr_init (res);
|
||||
|
||||
/* save the underflow or overflow flags from MPFR */
|
||||
saved_underflow = mpfr_underflow_p ();
|
||||
saved_overflow = mpfr_overflow_p ();
|
||||
|
||||
loops = 0;
|
||||
mpfr_clear_underflow ();
|
||||
mpfr_clear_overflow ();
|
||||
do {
|
||||
loops++;
|
||||
prec += mpc_ceil_log2 (prec) + 3;
|
||||
if (loops >= max_loops) {
|
||||
prec_u = 2 * MPC_PREC_RE (b);
|
||||
prec_v = 2 * MPC_PREC_IM (b);
|
||||
}
|
||||
else {
|
||||
prec_u = MPC_MIN (prec, 2 * MPC_PREC_RE (b));
|
||||
prec_v = MPC_MIN (prec, 2 * MPC_PREC_IM (b));
|
||||
}
|
||||
|
||||
mpfr_set_prec (u, prec_u);
|
||||
mpfr_set_prec (v, prec_v);
|
||||
|
||||
inexact = mpfr_sqr (u, mpc_realref(b), GMP_RNDD); /* err <= 1 ulp in prec */
|
||||
inexact |= mpfr_sqr (v, mpc_imagref(b), GMP_RNDD); /* err <= 1 ulp in prec */
|
||||
|
||||
/* If loops = max_loops, inexact should be 0 here, except in case
|
||||
of underflow or overflow.
|
||||
If loops < max_loops and inexact is zero, we can exit the
|
||||
while-loop since it only remains to add u and v into a. */
|
||||
if (inexact) {
|
||||
mpfr_set_prec (res, prec);
|
||||
mpfr_add (res, u, v, GMP_RNDD); /* err <= 3 ulp in prec */
|
||||
}
|
||||
|
||||
} while (loops < max_loops && inexact != 0
|
||||
&& !mpfr_can_round (res, prec - 2, GMP_RNDD, GMP_RNDU,
|
||||
mpfr_get_prec (a) + (rnd == GMP_RNDN)));
|
||||
|
||||
if (!inexact)
|
||||
/* squarings were exact, neither underflow nor overflow */
|
||||
inexact = mpfr_add (a, u, v, rnd);
|
||||
/* if there was an overflow in Re(b)^2 or Im(b)^2 or their sum,
|
||||
since the norm is larger, there is an overflow for the norm */
|
||||
else if (mpfr_overflow_p ()) {
|
||||
/* replace by "correctly rounded overflow" */
|
||||
mpfr_set_ui (a, 1ul, GMP_RNDN);
|
||||
inexact = mpfr_mul_2ui (a, a, mpfr_get_emax (), rnd);
|
||||
}
|
||||
else if (mpfr_underflow_p ()) {
|
||||
/* necessarily one of the squarings did underflow (otherwise their
|
||||
sum could not underflow), thus one of u, v is zero. */
|
||||
mpfr_exp_t emin = mpfr_get_emin ();
|
||||
|
||||
/* Now either both u and v are zero, or u is zero and v exact,
|
||||
or v is zero and u exact.
|
||||
In the latter case, Im(b)^2 < 2^(emin-1).
|
||||
If ulp(u) >= 2^(emin+1) and norm(b) is not exactly
|
||||
representable at the target precision, then rounding u+Im(b)^2
|
||||
is equivalent to rounding u+2^(emin-1).
|
||||
For instance, if exp(u)>0 and the target precision is smaller
|
||||
than about |emin|, the norm is not representable. To make the
|
||||
scaling in the "else" case work without underflow, we test
|
||||
whether exp(u) is larger than a small negative number instead.
|
||||
The second case is handled analogously. */
|
||||
if (!mpfr_zero_p (u)
|
||||
&& mpfr_get_exp (u) - 2 * (mpfr_exp_t) prec_u > emin
|
||||
&& mpfr_get_exp (u) > -10) {
|
||||
mpfr_set_prec (v, MPFR_PREC_MIN);
|
||||
mpfr_set_ui_2exp (v, 1, emin - 1, GMP_RNDZ);
|
||||
inexact = mpfr_add (a, u, v, rnd);
|
||||
}
|
||||
else if (!mpfr_zero_p (v)
|
||||
&& mpfr_get_exp (v) - 2 * (mpfr_exp_t) prec_v > emin
|
||||
&& mpfr_get_exp (v) > -10) {
|
||||
mpfr_set_prec (u, MPFR_PREC_MIN);
|
||||
mpfr_set_ui_2exp (u, 1, emin - 1, GMP_RNDZ);
|
||||
inexact = mpfr_add (a, u, v, rnd);
|
||||
}
|
||||
else {
|
||||
unsigned long int scale, exp_re, exp_im;
|
||||
int inex_underflow;
|
||||
|
||||
/* scale the input to an average exponent close to 0 */
|
||||
exp_re = (unsigned long int) (-mpfr_get_exp (mpc_realref (b)));
|
||||
exp_im = (unsigned long int) (-mpfr_get_exp (mpc_imagref (b)));
|
||||
scale = exp_re / 2 + exp_im / 2 + (exp_re % 2 + exp_im % 2) / 2;
|
||||
/* (exp_re + exp_im) / 2, computed in a way avoiding
|
||||
integer overflow */
|
||||
if (mpfr_zero_p (u)) {
|
||||
/* recompute the scaled value exactly */
|
||||
mpfr_mul_2ui (u, mpc_realref (b), scale, GMP_RNDN);
|
||||
mpfr_sqr (u, u, GMP_RNDN);
|
||||
}
|
||||
else /* just scale */
|
||||
mpfr_mul_2ui (u, u, 2*scale, GMP_RNDN);
|
||||
if (mpfr_zero_p (v)) {
|
||||
mpfr_mul_2ui (v, mpc_imagref (b), scale, GMP_RNDN);
|
||||
mpfr_sqr (v, v, GMP_RNDN);
|
||||
}
|
||||
else
|
||||
mpfr_mul_2ui (v, v, 2*scale, GMP_RNDN);
|
||||
|
||||
inexact = mpfr_add (a, u, v, rnd);
|
||||
mpfr_clear_underflow ();
|
||||
inex_underflow = mpfr_div_2ui (a, a, 2*scale, rnd);
|
||||
if (mpfr_underflow_p ())
|
||||
inexact = inex_underflow;
|
||||
}
|
||||
}
|
||||
else /* no problems, ternary value due to mpfr_can_round trick */
|
||||
inexact = mpfr_set (a, res, rnd);
|
||||
|
||||
/* restore underflow and overflow flags from MPFR */
|
||||
if (saved_underflow)
|
||||
mpfr_set_underflow ();
|
||||
if (saved_overflow)
|
||||
mpfr_set_overflow ();
|
||||
|
||||
mpfr_clear (u);
|
||||
mpfr_clear (v);
|
||||
mpfr_clear (res);
|
||||
}
|
||||
|
||||
return inexact;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* mpc_out_str -- Output a complex number on a given stream.
|
||||
|
||||
Copyright (C) 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include <ctype.h>
|
||||
#include "mpc-impl.h"
|
||||
|
||||
size_t
|
||||
mpc_out_str (FILE *stream, int base, size_t n, mpc_srcptr op, mpc_rnd_t rnd) {
|
||||
size_t size = 3; /* for '(', ' ' and ')' */
|
||||
|
||||
if (stream == NULL)
|
||||
stream = stdout; /* fprintf does not allow NULL as first argument */
|
||||
|
||||
fprintf (stream, "(");
|
||||
size += mpfr_out_str (stream, base, n, mpc_realref(op), MPC_RND_RE(rnd));
|
||||
fprintf (stream, " ");
|
||||
size += mpfr_out_str (stream, base, n, mpc_imagref(op), MPC_RND_RE(rnd));
|
||||
fprintf (stream, ")");
|
||||
|
||||
return size;
|
||||
}
|
|
@ -0,0 +1,819 @@
|
|||
/* mpc_pow -- Raise a complex number to the power of another complex number.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
/* Return non-zero iff c+i*d is an exact square (a+i*b)^2,
|
||||
with a, b both of the form m*2^e with m, e integers.
|
||||
If so, returns in a+i*b the corresponding square root, with a >= 0.
|
||||
The variables a, b must not overlap with c, d.
|
||||
|
||||
We have c = a^2 - b^2 and d = 2*a*b.
|
||||
|
||||
If one of a, b is exact, then both are (see algorithms.tex).
|
||||
|
||||
Case 1: a <> 0 and b <> 0.
|
||||
Let a = m*2^e and b = n*2^f with m, e, n, f integers, m and n odd
|
||||
(we will treat apart the case a = 0 or b = 0).
|
||||
Then 2*a*b = m*n*2^(e+f+1), thus necessarily e+f >= -1.
|
||||
Assume e < 0, then f >= 0, then a^2 - b^2 = m^2*2^(2e) - n^2*2^(2f) cannot
|
||||
be an integer, since n^2*2^(2f) is an integer, and m^2*2^(2e) is not.
|
||||
Similarly when f < 0 (and thus e >= 0).
|
||||
Thus we have e, f >= 0, and a, b are both integers.
|
||||
Let A = 2a^2, then eliminating b between c = a^2 - b^2 and d = 2*a*b
|
||||
gives A^2 - 2c*A - d^2 = 0, which has solutions c +/- sqrt(c^2+d^2).
|
||||
We thus need c^2+d^2 to be a square, and c + sqrt(c^2+d^2) --- the solution
|
||||
we are interested in --- to be two times a square. Then b = d/(2a) is
|
||||
necessarily an integer.
|
||||
|
||||
Case 2: a = 0. Then d is necessarily zero, thus it suffices to check
|
||||
whether c = -b^2, i.e., if -c is a square.
|
||||
|
||||
Case 3: b = 0. Then d is necessarily zero, thus it suffices to check
|
||||
whether c = a^2, i.e., if c is a square.
|
||||
*/
|
||||
static int
|
||||
mpc_perfect_square_p (mpz_t a, mpz_t b, mpz_t c, mpz_t d)
|
||||
{
|
||||
if (mpz_cmp_ui (d, 0) == 0) /* case a = 0 or b = 0 */
|
||||
{
|
||||
/* necessarily c < 0 here, since we have already considered the case
|
||||
where x is real non-negative and y is real */
|
||||
MPC_ASSERT (mpz_cmp_ui (c, 0) < 0);
|
||||
mpz_neg (b, c);
|
||||
if (mpz_perfect_square_p (b)) /* case 2 above */
|
||||
{
|
||||
mpz_sqrt (b, b);
|
||||
mpz_set_ui (a, 0);
|
||||
return 1; /* c + i*d = (0 + i*b)^2 */
|
||||
}
|
||||
}
|
||||
else /* both a and b are non-zero */
|
||||
{
|
||||
if (mpz_divisible_2exp_p (d, 1) == 0)
|
||||
return 0; /* d must be even */
|
||||
mpz_mul (a, c, c);
|
||||
mpz_addmul (a, d, d); /* c^2 + d^2 */
|
||||
if (mpz_perfect_square_p (a))
|
||||
{
|
||||
mpz_sqrt (a, a);
|
||||
mpz_add (a, c, a); /* c + sqrt(c^2+d^2) */
|
||||
if (mpz_divisible_2exp_p (a, 1))
|
||||
{
|
||||
mpz_tdiv_q_2exp (a, a, 1);
|
||||
if (mpz_perfect_square_p (a))
|
||||
{
|
||||
mpz_sqrt (a, a);
|
||||
mpz_tdiv_q_2exp (b, d, 1); /* d/2 */
|
||||
mpz_divexact (b, b, a); /* d/(2a) */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; /* not a square */
|
||||
}
|
||||
|
||||
/* fix the sign of Re(z) or Im(z) in case it is zero,
|
||||
and Re(x) is zero.
|
||||
sign_eps is 0 if Re(x) = +0, 1 if Re(x) = -0
|
||||
sign_a is the sign bit of Im(x).
|
||||
Assume y is an integer (does nothing otherwise).
|
||||
*/
|
||||
static void
|
||||
fix_sign (mpc_ptr z, int sign_eps, int sign_a, mpfr_srcptr y)
|
||||
{
|
||||
int ymod4 = -1;
|
||||
mpfr_exp_t ey;
|
||||
mpz_t my;
|
||||
unsigned long int t;
|
||||
|
||||
mpz_init (my);
|
||||
|
||||
ey = mpfr_get_z_exp (my, y);
|
||||
/* normalize so that my is odd */
|
||||
t = mpz_scan1 (my, 0);
|
||||
ey += (mpfr_exp_t) t;
|
||||
mpz_tdiv_q_2exp (my, my, t);
|
||||
/* y = my*2^ey */
|
||||
|
||||
/* compute y mod 4 (in case y is an integer) */
|
||||
if (ey >= 2)
|
||||
ymod4 = 0;
|
||||
else if (ey == 1)
|
||||
ymod4 = mpz_tstbit (my, 0) * 2; /* correct if my < 0 */
|
||||
else if (ey == 0)
|
||||
{
|
||||
ymod4 = mpz_tstbit (my, 1) * 2 + mpz_tstbit (my, 0);
|
||||
if (mpz_cmp_ui (my , 0) < 0)
|
||||
ymod4 = 4 - ymod4;
|
||||
}
|
||||
else /* y is not an integer */
|
||||
goto end;
|
||||
|
||||
if (mpfr_zero_p (mpc_realref(z)))
|
||||
{
|
||||
/* we assume y is always integer in that case (FIXME: prove it):
|
||||
(eps+I*a)^y = +0 + I*a^y for y = 1 mod 4 and sign_eps = 0
|
||||
(eps+I*a)^y = -0 - I*a^y for y = 3 mod 4 and sign_eps = 0 */
|
||||
MPC_ASSERT (ymod4 == 1 || ymod4 == 3);
|
||||
if ((ymod4 == 3 && sign_eps == 0) ||
|
||||
(ymod4 == 1 && sign_eps == 1))
|
||||
mpfr_neg (mpc_realref(z), mpc_realref(z), GMP_RNDZ);
|
||||
}
|
||||
else if (mpfr_zero_p (mpc_imagref(z)))
|
||||
{
|
||||
/* we assume y is always integer in that case (FIXME: prove it):
|
||||
(eps+I*a)^y = a^y - 0*I for y = 0 mod 4 and sign_a = sign_eps
|
||||
(eps+I*a)^y = -a^y +0*I for y = 2 mod 4 and sign_a = sign_eps */
|
||||
MPC_ASSERT (ymod4 == 0 || ymod4 == 2);
|
||||
if ((ymod4 == 0 && sign_a == sign_eps) ||
|
||||
(ymod4 == 2 && sign_a != sign_eps))
|
||||
mpfr_neg (mpc_imagref(z), mpc_imagref(z), GMP_RNDZ);
|
||||
}
|
||||
|
||||
end:
|
||||
mpz_clear (my);
|
||||
}
|
||||
|
||||
/* If x^y is exactly representable (with maybe a larger precision than z),
|
||||
round it in z and return the (mpc) inexact flag in [0, 10].
|
||||
|
||||
If x^y is not exactly representable, return -1.
|
||||
|
||||
If intermediate computations lead to numbers of more than maxprec bits,
|
||||
then abort and return -2 (in that case, to avoid loops, mpc_pow_exact
|
||||
should be called again with a larger value of maxprec).
|
||||
|
||||
Assume one of Re(x) or Im(x) is non-zero, and y is non-zero (y is real).
|
||||
|
||||
Warning: z and x might be the same variable, same for Re(z) or Im(z) and y.
|
||||
|
||||
In case -1 or -2 is returned, z is not modified.
|
||||
*/
|
||||
static int
|
||||
mpc_pow_exact (mpc_ptr z, mpc_srcptr x, mpfr_srcptr y, mpc_rnd_t rnd,
|
||||
mpfr_prec_t maxprec)
|
||||
{
|
||||
mpfr_exp_t ec, ed, ey;
|
||||
mpz_t my, a, b, c, d, u;
|
||||
unsigned long int t;
|
||||
int ret = -2;
|
||||
int sign_rex = mpfr_signbit (mpc_realref(x));
|
||||
int sign_imx = mpfr_signbit (mpc_imagref(x));
|
||||
int x_imag = mpfr_zero_p (mpc_realref(x));
|
||||
int z_is_y = 0;
|
||||
mpfr_t copy_of_y;
|
||||
|
||||
if (mpc_realref (z) == y || mpc_imagref (z) == y)
|
||||
{
|
||||
z_is_y = 1;
|
||||
mpfr_init2 (copy_of_y, mpfr_get_prec (y));
|
||||
mpfr_set (copy_of_y, y, GMP_RNDN);
|
||||
}
|
||||
|
||||
mpz_init (my);
|
||||
mpz_init (a);
|
||||
mpz_init (b);
|
||||
mpz_init (c);
|
||||
mpz_init (d);
|
||||
mpz_init (u);
|
||||
|
||||
ey = mpfr_get_z_exp (my, y);
|
||||
/* normalize so that my is odd */
|
||||
t = mpz_scan1 (my, 0);
|
||||
ey += (mpfr_exp_t) t;
|
||||
mpz_tdiv_q_2exp (my, my, t);
|
||||
/* y = my*2^ey with my odd */
|
||||
|
||||
if (x_imag)
|
||||
{
|
||||
mpz_set_ui (c, 0);
|
||||
ec = 0;
|
||||
}
|
||||
else
|
||||
ec = mpfr_get_z_exp (c, mpc_realref(x));
|
||||
if (mpfr_zero_p (mpc_imagref(x)))
|
||||
{
|
||||
mpz_set_ui (d, 0);
|
||||
ed = ec;
|
||||
}
|
||||
else
|
||||
{
|
||||
ed = mpfr_get_z_exp (d, mpc_imagref(x));
|
||||
if (x_imag)
|
||||
ec = ed;
|
||||
}
|
||||
/* x = c*2^ec + I * d*2^ed */
|
||||
/* equalize the exponents of x */
|
||||
if (ec < ed)
|
||||
{
|
||||
mpz_mul_2exp (d, d, (unsigned long int) (ed - ec));
|
||||
if ((mpfr_prec_t) mpz_sizeinbase (d, 2) > maxprec)
|
||||
goto end;
|
||||
}
|
||||
else if (ed < ec)
|
||||
{
|
||||
mpz_mul_2exp (c, c, (unsigned long int) (ec - ed));
|
||||
if ((mpfr_prec_t) mpz_sizeinbase (c, 2) > maxprec)
|
||||
goto end;
|
||||
ec = ed;
|
||||
}
|
||||
/* now ec=ed and x = (c + I * d) * 2^ec */
|
||||
|
||||
/* divide by two if possible */
|
||||
if (mpz_cmp_ui (c, 0) == 0)
|
||||
{
|
||||
t = mpz_scan1 (d, 0);
|
||||
mpz_tdiv_q_2exp (d, d, t);
|
||||
ec += (mpfr_exp_t) t;
|
||||
}
|
||||
else if (mpz_cmp_ui (d, 0) == 0)
|
||||
{
|
||||
t = mpz_scan1 (c, 0);
|
||||
mpz_tdiv_q_2exp (c, c, t);
|
||||
ec += (mpfr_exp_t) t;
|
||||
}
|
||||
else /* neither c nor d is zero */
|
||||
{
|
||||
unsigned long v;
|
||||
t = mpz_scan1 (c, 0);
|
||||
v = mpz_scan1 (d, 0);
|
||||
if (v < t)
|
||||
t = v;
|
||||
mpz_tdiv_q_2exp (c, c, t);
|
||||
mpz_tdiv_q_2exp (d, d, t);
|
||||
ec += (mpfr_exp_t) t;
|
||||
}
|
||||
|
||||
/* now either one of c, d is odd */
|
||||
|
||||
while (ey < 0)
|
||||
{
|
||||
/* check if x is a square */
|
||||
if (ec & 1)
|
||||
{
|
||||
mpz_mul_2exp (c, c, 1);
|
||||
mpz_mul_2exp (d, d, 1);
|
||||
ec --;
|
||||
}
|
||||
/* now ec is even */
|
||||
if (mpc_perfect_square_p (a, b, c, d) == 0)
|
||||
break;
|
||||
mpz_swap (a, c);
|
||||
mpz_swap (b, d);
|
||||
ec /= 2;
|
||||
ey ++;
|
||||
}
|
||||
|
||||
if (ey < 0)
|
||||
{
|
||||
ret = -1; /* not representable */
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Now ey >= 0, it thus suffices to check that x^my is representable.
|
||||
If my > 0, this is always true. If my < 0, we first try to invert
|
||||
(c+I*d)*2^ec.
|
||||
*/
|
||||
if (mpz_cmp_ui (my, 0) < 0)
|
||||
{
|
||||
/* If my < 0, 1 / (c + I*d) = (c - I*d)/(c^2 + d^2), thus a sufficient
|
||||
condition is that c^2 + d^2 is a power of two, assuming |c| <> |d|.
|
||||
Assume a prime p <> 2 divides c^2 + d^2,
|
||||
then if p does not divide c or d, 1 / (c + I*d) cannot be exact.
|
||||
If p divides both c and d, then we can write c = p*c', d = p*d',
|
||||
and 1 / (c + I*d) = 1/p * 1/(c' + I*d'). This shows that if 1/(c+I*d)
|
||||
is exact, then 1/(c' + I*d') is exact too, and we are back to the
|
||||
previous case. In conclusion, a necessary and sufficient condition
|
||||
is that c^2 + d^2 is a power of two.
|
||||
*/
|
||||
/* FIXME: we could first compute c^2+d^2 mod a limb for example */
|
||||
mpz_mul (a, c, c);
|
||||
mpz_addmul (a, d, d);
|
||||
t = mpz_scan1 (a, 0);
|
||||
if (mpz_sizeinbase (a, 2) != 1 + t) /* a is not a power of two */
|
||||
{
|
||||
ret = -1; /* not representable */
|
||||
goto end;
|
||||
}
|
||||
/* replace (c,d) by (c/(c^2+d^2), -d/(c^2+d^2)) */
|
||||
mpz_neg (d, d);
|
||||
ec = -ec - (mpfr_exp_t) t;
|
||||
mpz_neg (my, my);
|
||||
}
|
||||
|
||||
/* now ey >= 0 and my >= 0, and we want to compute
|
||||
[(c + I * d) * 2^ec] ^ (my * 2^ey).
|
||||
|
||||
We first compute [(c + I * d) * 2^ec]^my, then square ey times. */
|
||||
t = mpz_sizeinbase (my, 2) - 1;
|
||||
mpz_set (a, c);
|
||||
mpz_set (b, d);
|
||||
ed = ec;
|
||||
/* invariant: (a + I*b) * 2^ed = ((c + I*d) * 2^ec)^trunc(my/2^t) */
|
||||
while (t-- > 0)
|
||||
{
|
||||
unsigned long int v, w;
|
||||
/* square a + I*b */
|
||||
mpz_mul (u, a, b);
|
||||
mpz_mul (a, a, a);
|
||||
mpz_submul (a, b, b);
|
||||
mpz_mul_2exp (b, u, 1);
|
||||
ed *= 2;
|
||||
if (mpz_tstbit (my, t)) /* multiply by c + I*d */
|
||||
{
|
||||
mpz_mul (u, a, c);
|
||||
mpz_submul (u, b, d); /* ac-bd */
|
||||
mpz_mul (b, b, c);
|
||||
mpz_addmul (b, a, d); /* bc+ad */
|
||||
mpz_swap (a, u);
|
||||
ed += ec;
|
||||
}
|
||||
/* remove powers of two in (a,b) */
|
||||
if (mpz_cmp_ui (a, 0) == 0)
|
||||
{
|
||||
w = mpz_scan1 (b, 0);
|
||||
mpz_tdiv_q_2exp (b, b, w);
|
||||
ed += (mpfr_exp_t) w;
|
||||
}
|
||||
else if (mpz_cmp_ui (b, 0) == 0)
|
||||
{
|
||||
w = mpz_scan1 (a, 0);
|
||||
mpz_tdiv_q_2exp (a, a, w);
|
||||
ed += (mpfr_exp_t) w;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = mpz_scan1 (a, 0);
|
||||
v = mpz_scan1 (b, 0);
|
||||
if (v < w)
|
||||
w = v;
|
||||
mpz_tdiv_q_2exp (a, a, w);
|
||||
mpz_tdiv_q_2exp (b, b, w);
|
||||
ed += (mpfr_exp_t) w;
|
||||
}
|
||||
if ( (mpfr_prec_t) mpz_sizeinbase (a, 2) > maxprec
|
||||
|| (mpfr_prec_t) mpz_sizeinbase (b, 2) > maxprec)
|
||||
goto end;
|
||||
}
|
||||
/* now a+I*b = (c+I*d)^my */
|
||||
|
||||
while (ey-- > 0)
|
||||
{
|
||||
unsigned long sa, sb;
|
||||
|
||||
/* square a + I*b */
|
||||
mpz_mul (u, a, b);
|
||||
mpz_mul (a, a, a);
|
||||
mpz_submul (a, b, b);
|
||||
mpz_mul_2exp (b, u, 1);
|
||||
ed *= 2;
|
||||
|
||||
/* divide by largest 2^n possible, to avoid many loops for e.g.,
|
||||
(2+2*I)^16777216 */
|
||||
sa = mpz_scan1 (a, 0);
|
||||
sb = mpz_scan1 (b, 0);
|
||||
sa = (sa <= sb) ? sa : sb;
|
||||
mpz_tdiv_q_2exp (a, a, sa);
|
||||
mpz_tdiv_q_2exp (b, b, sa);
|
||||
ed += (mpfr_exp_t) sa;
|
||||
|
||||
if ( (mpfr_prec_t) mpz_sizeinbase (a, 2) > maxprec
|
||||
|| (mpfr_prec_t) mpz_sizeinbase (b, 2) > maxprec)
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = mpfr_set_z (mpc_realref(z), a, MPC_RND_RE(rnd));
|
||||
ret = MPC_INEX(ret, mpfr_set_z (mpc_imagref(z), b, MPC_RND_IM(rnd)));
|
||||
mpfr_mul_2si (mpc_realref(z), mpc_realref(z), ed, MPC_RND_RE(rnd));
|
||||
mpfr_mul_2si (mpc_imagref(z), mpc_imagref(z), ed, MPC_RND_IM(rnd));
|
||||
|
||||
end:
|
||||
mpz_clear (my);
|
||||
mpz_clear (a);
|
||||
mpz_clear (b);
|
||||
mpz_clear (c);
|
||||
mpz_clear (d);
|
||||
mpz_clear (u);
|
||||
|
||||
if (ret >= 0 && x_imag)
|
||||
fix_sign (z, sign_rex, sign_imx, (z_is_y) ? copy_of_y : y);
|
||||
|
||||
if (z_is_y)
|
||||
mpfr_clear (copy_of_y);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Return 1 if y*2^k is an odd integer, 0 otherwise.
|
||||
Adapted from MPFR, file pow.c.
|
||||
|
||||
Examples: with k=0, check if y is an odd integer,
|
||||
with k=1, check if y is half-an-integer,
|
||||
with k=-1, check if y/2 is an odd integer.
|
||||
*/
|
||||
#define MPFR_LIMB_HIGHBIT ((mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1))
|
||||
static int
|
||||
is_odd (mpfr_srcptr y, mpfr_exp_t k)
|
||||
{
|
||||
mpfr_exp_t expo;
|
||||
mpfr_prec_t prec;
|
||||
mp_size_t yn;
|
||||
mp_limb_t *yp;
|
||||
|
||||
expo = mpfr_get_exp (y) + k;
|
||||
if (expo <= 0)
|
||||
return 0; /* |y| < 1 and not 0 */
|
||||
|
||||
prec = mpfr_get_prec (y);
|
||||
if ((mpfr_prec_t) expo > prec)
|
||||
return 0; /* y is a multiple of 2^(expo-prec), thus not odd */
|
||||
|
||||
/* 0 < expo <= prec:
|
||||
y = 1xxxxxxxxxt.zzzzzzzzzzzzzzzzzz[000]
|
||||
expo bits (prec-expo) bits
|
||||
|
||||
We have to check that:
|
||||
(a) the bit 't' is set
|
||||
(b) all the 'z' bits are zero
|
||||
*/
|
||||
|
||||
prec = ((prec - 1) / BITS_PER_MP_LIMB + 1) * BITS_PER_MP_LIMB - expo;
|
||||
/* number of z+0 bits */
|
||||
|
||||
yn = prec / BITS_PER_MP_LIMB;
|
||||
/* yn is the index of limb containing the 't' bit */
|
||||
|
||||
yp = y->_mpfr_d;
|
||||
/* if expo is a multiple of BITS_PER_MP_LIMB, t is bit 0 */
|
||||
if (expo % BITS_PER_MP_LIMB == 0 ? (yp[yn] & 1) == 0
|
||||
: yp[yn] << ((expo % BITS_PER_MP_LIMB) - 1) != MPFR_LIMB_HIGHBIT)
|
||||
return 0;
|
||||
while (--yn >= 0)
|
||||
if (yp[yn] != 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Put in z the value of x^y, rounded according to 'rnd'.
|
||||
Return the inexact flag in [0, 10]. */
|
||||
int
|
||||
mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
|
||||
{
|
||||
int ret = -2, loop, x_real, x_imag, y_real, z_real = 0, z_imag = 0;
|
||||
mpc_t t, u;
|
||||
mpfr_prec_t p, pr, pi, maxprec;
|
||||
int saved_underflow, saved_overflow;
|
||||
|
||||
/* save the underflow or overflow flags from MPFR */
|
||||
saved_underflow = mpfr_underflow_p ();
|
||||
saved_overflow = mpfr_overflow_p ();
|
||||
|
||||
x_real = mpfr_zero_p (mpc_imagref(x));
|
||||
y_real = mpfr_zero_p (mpc_imagref(y));
|
||||
|
||||
if (y_real && mpfr_zero_p (mpc_realref(y))) /* case y zero */
|
||||
{
|
||||
if (x_real && mpfr_zero_p (mpc_realref(x)))
|
||||
{
|
||||
/* we define 0^0 to be (1, +0) since the real part is
|
||||
coherent with MPFR where 0^0 gives 1, and the sign of the
|
||||
imaginary part cannot be determined */
|
||||
mpc_set_ui_ui (z, 1, 0, MPC_RNDNN);
|
||||
return 0;
|
||||
}
|
||||
else /* x^0 = 1 +/- i*0 even for x=NaN see algorithms.tex for the
|
||||
sign of zero */
|
||||
{
|
||||
mpfr_t n;
|
||||
int inex, cx1;
|
||||
int sign_zi;
|
||||
/* cx1 < 0 if |x| < 1
|
||||
cx1 = 0 if |x| = 1
|
||||
cx1 > 0 if |x| > 1
|
||||
*/
|
||||
mpfr_init (n);
|
||||
inex = mpc_norm (n, x, GMP_RNDN);
|
||||
cx1 = mpfr_cmp_ui (n, 1);
|
||||
if (cx1 == 0 && inex != 0)
|
||||
cx1 = -inex;
|
||||
|
||||
sign_zi = (cx1 < 0 && mpfr_signbit (mpc_imagref (y)) == 0)
|
||||
|| (cx1 == 0
|
||||
&& mpfr_signbit (mpc_imagref (x)) != mpfr_signbit (mpc_realref (y)))
|
||||
|| (cx1 > 0 && mpfr_signbit (mpc_imagref (y)));
|
||||
|
||||
/* warning: mpc_set_ui_ui does not set Im(z) to -0 if Im(rnd)=RNDD */
|
||||
ret = mpc_set_ui_ui (z, 1, 0, rnd);
|
||||
|
||||
if (MPC_RND_IM (rnd) == GMP_RNDD || sign_zi)
|
||||
mpc_conj (z, z, MPC_RNDNN);
|
||||
|
||||
mpfr_clear (n);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mpc_fin_p (x) || !mpc_fin_p (y))
|
||||
{
|
||||
/* special values: exp(y*log(x)) */
|
||||
mpc_init2 (u, 2);
|
||||
mpc_log (u, x, MPC_RNDNN);
|
||||
mpc_mul (u, u, y, MPC_RNDNN);
|
||||
ret = mpc_exp (z, u, rnd);
|
||||
mpc_clear (u);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (x_real) /* case x real */
|
||||
{
|
||||
if (mpfr_zero_p (mpc_realref(x))) /* x is zero */
|
||||
{
|
||||
/* special values: exp(y*log(x)) */
|
||||
mpc_init2 (u, 2);
|
||||
mpc_log (u, x, MPC_RNDNN);
|
||||
mpc_mul (u, u, y, MPC_RNDNN);
|
||||
ret = mpc_exp (z, u, rnd);
|
||||
mpc_clear (u);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Special case 1^y = 1 */
|
||||
if (mpfr_cmp_ui (mpc_realref(x), 1) == 0)
|
||||
{
|
||||
int s1, s2;
|
||||
s1 = mpfr_signbit (mpc_realref (y));
|
||||
s2 = mpfr_signbit (mpc_imagref (x));
|
||||
|
||||
ret = mpc_set_ui (z, +1, rnd);
|
||||
/* the sign of the zero imaginary part is known in some cases (see
|
||||
algorithm.tex). In such cases we have
|
||||
(x +s*0i)^(y+/-0i) = x^y + s*sign(y)*0i
|
||||
where s = +/-1. We extend here this rule to fix the sign of the
|
||||
zero part.
|
||||
|
||||
Note that the sign must also be set explicitly when rnd=RNDD
|
||||
because mpfr_set_ui(z_i, 0, rnd) always sets z_i to +0.
|
||||
*/
|
||||
if (MPC_RND_IM (rnd) == GMP_RNDD || s1 != s2)
|
||||
mpc_conj (z, z, MPC_RNDNN);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* x^y is real when:
|
||||
(a) x is real and y is integer
|
||||
(b) x is real non-negative and y is real */
|
||||
if (y_real && (mpfr_integer_p (mpc_realref(y)) ||
|
||||
mpfr_cmp_ui (mpc_realref(x), 0) >= 0))
|
||||
{
|
||||
int s1, s2;
|
||||
s1 = mpfr_signbit (mpc_realref (y));
|
||||
s2 = mpfr_signbit (mpc_imagref (x));
|
||||
|
||||
ret = mpfr_pow (mpc_realref(z), mpc_realref(x), mpc_realref(y), MPC_RND_RE(rnd));
|
||||
ret = MPC_INEX(ret, mpfr_set_ui (mpc_imagref(z), 0, MPC_RND_IM(rnd)));
|
||||
|
||||
/* the sign of the zero imaginary part is known in some cases
|
||||
(see algorithm.tex). In such cases we have (x +s*0i)^(y+/-0i)
|
||||
= x^y + s*sign(y)*0i where s = +/-1.
|
||||
We extend here this rule to fix the sign of the zero part.
|
||||
|
||||
Note that the sign must also be set explicitly when rnd=RNDD
|
||||
because mpfr_set_ui(z_i, 0, rnd) always sets z_i to +0.
|
||||
*/
|
||||
if (MPC_RND_IM(rnd) == GMP_RNDD || s1 != s2)
|
||||
mpfr_neg (mpc_imagref(z), mpc_imagref(z), MPC_RND_IM(rnd));
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* (-1)^(n+I*t) is real for n integer and t real */
|
||||
if (mpfr_cmp_si (mpc_realref(x), -1) == 0 && mpfr_integer_p (mpc_realref(y)))
|
||||
z_real = 1;
|
||||
|
||||
/* for x real, x^y is imaginary when:
|
||||
(a) x is negative and y is half-an-integer
|
||||
(b) x = -1 and Re(y) is half-an-integer
|
||||
*/
|
||||
if ((mpfr_cmp_ui (mpc_realref(x), 0) < 0) && is_odd (mpc_realref(y), 1)
|
||||
&& (y_real || mpfr_cmp_si (mpc_realref(x), -1) == 0))
|
||||
z_imag = 1;
|
||||
}
|
||||
else /* x non real */
|
||||
/* I^(t*I) and (-I)^(t*I) are real for t real,
|
||||
I^(n+t*I) and (-I)^(n+t*I) are real for n even and t real, and
|
||||
I^(n+t*I) and (-I)^(n+t*I) are imaginary for n odd and t real
|
||||
(s*I)^n is real for n even and imaginary for n odd */
|
||||
if ((mpc_cmp_si_si (x, 0, 1) == 0 || mpc_cmp_si_si (x, 0, -1) == 0 ||
|
||||
(mpfr_cmp_ui (mpc_realref(x), 0) == 0 && y_real)) &&
|
||||
mpfr_integer_p (mpc_realref(y)))
|
||||
{ /* x is I or -I, and Re(y) is an integer */
|
||||
if (is_odd (mpc_realref(y), 0))
|
||||
z_imag = 1; /* Re(y) odd: z is imaginary */
|
||||
else
|
||||
z_real = 1; /* Re(y) even: z is real */
|
||||
}
|
||||
else /* (t+/-t*I)^(2n) is imaginary for n odd and real for n even */
|
||||
if (mpfr_cmpabs (mpc_realref(x), mpc_imagref(x)) == 0 && y_real &&
|
||||
mpfr_integer_p (mpc_realref(y)) && is_odd (mpc_realref(y), 0) == 0)
|
||||
{
|
||||
if (is_odd (mpc_realref(y), -1)) /* y/2 is odd */
|
||||
z_imag = 1;
|
||||
else
|
||||
z_real = 1;
|
||||
}
|
||||
|
||||
pr = mpfr_get_prec (mpc_realref(z));
|
||||
pi = mpfr_get_prec (mpc_imagref(z));
|
||||
p = (pr > pi) ? pr : pi;
|
||||
p += 12; /* experimentally, seems to give less than 10% of failures in
|
||||
Ziv's strategy; probably wrong now since q is not computed */
|
||||
if (p < 64)
|
||||
p = 64;
|
||||
mpc_init2 (u, p);
|
||||
mpc_init2 (t, p);
|
||||
pr += MPC_RND_RE(rnd) == GMP_RNDN;
|
||||
pi += MPC_RND_IM(rnd) == GMP_RNDN;
|
||||
maxprec = MPC_MAX_PREC (z);
|
||||
x_imag = mpfr_zero_p (mpc_realref(x));
|
||||
for (loop = 0;; loop++)
|
||||
{
|
||||
int ret_exp;
|
||||
mpfr_exp_t dr, di;
|
||||
mpfr_prec_t q=0;
|
||||
/* to avoid warning message, real initialisation below */
|
||||
|
||||
mpc_log (t, x, MPC_RNDNN);
|
||||
mpc_mul (t, t, y, MPC_RNDNN);
|
||||
|
||||
if (loop == 0) {
|
||||
/* compute q such that |Re (y log x)|, |Im (y log x)| < 2^q */
|
||||
q = mpfr_get_exp (mpc_realref(t)) > 0 ? mpfr_get_exp (mpc_realref(t)) : 0;
|
||||
if (mpfr_get_exp (mpc_imagref(t)) > (mpfr_exp_t) q)
|
||||
q = mpfr_get_exp (mpc_imagref(t));
|
||||
}
|
||||
|
||||
mpfr_clear_overflow ();
|
||||
mpfr_clear_underflow ();
|
||||
ret_exp = mpc_exp (u, t, MPC_RNDNN);
|
||||
if (mpfr_underflow_p () || mpfr_overflow_p ()) {
|
||||
/* under- and overflow flags are set by mpc_exp */
|
||||
mpc_set (z, u, MPC_RNDNN);
|
||||
ret = ret_exp;
|
||||
goto exact;
|
||||
}
|
||||
|
||||
/* Since the error bound is global, we have to take into account the
|
||||
exponent difference between the real and imaginary parts. We assume
|
||||
either the real or the imaginary part of u is not zero.
|
||||
*/
|
||||
dr = mpfr_zero_p (mpc_realref(u)) ? mpfr_get_exp (mpc_imagref(u))
|
||||
: mpfr_get_exp (mpc_realref(u));
|
||||
di = mpfr_zero_p (mpc_imagref(u)) ? dr : mpfr_get_exp (mpc_imagref(u));
|
||||
if (dr > di)
|
||||
{
|
||||
di = dr - di;
|
||||
dr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dr = di - dr;
|
||||
di = 0;
|
||||
}
|
||||
/* the term -3 takes into account the factor 4 in the complex error
|
||||
(see algorithms.tex) plus one due to the exponent difference: if
|
||||
z = a + I*b, where the relative error on z is at most 2^(-p), and
|
||||
EXP(a) = EXP(b) + k, the relative error on b is at most 2^(k-p) */
|
||||
if ((z_imag || (p > q + 3 + dr && mpfr_can_round (mpc_realref(u), p - q - 3 - dr, GMP_RNDN, GMP_RNDZ, pr))) &&
|
||||
(z_real || (p > q + 3 + di && mpfr_can_round (mpc_imagref(u), p - q - 3 - di, GMP_RNDN, GMP_RNDZ, pi))))
|
||||
break;
|
||||
|
||||
/* if Re(u) is not known to be zero, assume it is a normal number, i.e.,
|
||||
neither zero, Inf or NaN, otherwise we might enter an infinite loop */
|
||||
MPC_ASSERT (z_imag || mpfr_number_p (mpc_realref(u)));
|
||||
/* idem for Im(u) */
|
||||
MPC_ASSERT (z_real || mpfr_number_p (mpc_imagref(u)));
|
||||
|
||||
if (ret == -2) /* we did not yet call mpc_pow_exact, or it aborted
|
||||
because intermediate computations had > maxprec bits */
|
||||
{
|
||||
/* check exact cases (see algorithms.tex) */
|
||||
if (y_real)
|
||||
{
|
||||
maxprec *= 2;
|
||||
ret = mpc_pow_exact (z, x, mpc_realref(y), rnd, maxprec);
|
||||
if (ret != -1 && ret != -2)
|
||||
goto exact;
|
||||
}
|
||||
p += dr + di + 64;
|
||||
}
|
||||
else
|
||||
p += p / 2;
|
||||
mpc_set_prec (t, p);
|
||||
mpc_set_prec (u, p);
|
||||
}
|
||||
|
||||
if (z_real)
|
||||
{
|
||||
/* When the result is real (see algorithm.tex for details),
|
||||
Im(x^y) =
|
||||
+ sign(imag(y))*0i, if |x| > 1
|
||||
+ sign(imag(x))*sign(real(y))*0i, if |x| = 1
|
||||
- sign(imag(y))*0i, if |x| < 1
|
||||
*/
|
||||
mpfr_t n;
|
||||
int inex, cx1;
|
||||
int sign_zi, sign_rex, sign_imx;
|
||||
/* cx1 < 0 if |x| < 1
|
||||
cx1 = 0 if |x| = 1
|
||||
cx1 > 0 if |x| > 1
|
||||
*/
|
||||
|
||||
sign_rex = mpfr_signbit (mpc_realref (x));
|
||||
sign_imx = mpfr_signbit (mpc_imagref (x));
|
||||
mpfr_init (n);
|
||||
inex = mpc_norm (n, x, GMP_RNDN);
|
||||
cx1 = mpfr_cmp_ui (n, 1);
|
||||
if (cx1 == 0 && inex != 0)
|
||||
cx1 = -inex;
|
||||
|
||||
sign_zi = (cx1 < 0 && mpfr_signbit (mpc_imagref (y)) == 0)
|
||||
|| (cx1 == 0 && sign_imx != mpfr_signbit (mpc_realref (y)))
|
||||
|| (cx1 > 0 && mpfr_signbit (mpc_imagref (y)));
|
||||
|
||||
/* copy RE(y) to n since if z==y we will destroy Re(y) below */
|
||||
mpfr_set_prec (n, mpfr_get_prec (mpc_realref (y)));
|
||||
mpfr_set (n, mpc_realref (y), GMP_RNDN);
|
||||
ret = mpfr_set (mpc_realref(z), mpc_realref(u), MPC_RND_RE(rnd));
|
||||
if (y_real && (x_real || x_imag))
|
||||
{
|
||||
/* FIXME: with y_real we assume Im(y) is really 0, which is the case
|
||||
for example when y comes from pow_fr, but in case Im(y) is +0 or
|
||||
-0, we might get different results */
|
||||
mpfr_set_ui (mpc_imagref (z), 0, MPC_RND_IM (rnd));
|
||||
fix_sign (z, sign_rex, sign_imx, n);
|
||||
ret = MPC_INEX(ret, 0); /* imaginary part is exact */
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = MPC_INEX (ret, mpfr_set_ui (mpc_imagref (z), 0, MPC_RND_IM (rnd)));
|
||||
/* warning: mpfr_set_ui does not set Im(z) to -0 if Im(rnd) = RNDD */
|
||||
if (MPC_RND_IM (rnd) == GMP_RNDD || sign_zi)
|
||||
mpc_conj (z, z, MPC_RNDNN);
|
||||
}
|
||||
|
||||
mpfr_clear (n);
|
||||
}
|
||||
else if (z_imag)
|
||||
{
|
||||
ret = mpfr_set (mpc_imagref(z), mpc_imagref(u), MPC_RND_IM(rnd));
|
||||
/* if z is imaginary and y real, then x cannot be real */
|
||||
if (y_real && x_imag)
|
||||
{
|
||||
int sign_rex = mpfr_signbit (mpc_realref (x));
|
||||
|
||||
/* If z overlaps with y we set Re(z) before checking Re(y) below,
|
||||
but in that case y=0, which was dealt with above. */
|
||||
mpfr_set_ui (mpc_realref (z), 0, MPC_RND_RE (rnd));
|
||||
/* Note: fix_sign only does something when y is an integer,
|
||||
then necessarily y = 1 or 3 (mod 4), and in that case the
|
||||
sign of Im(x) is irrelevant. */
|
||||
fix_sign (z, sign_rex, 0, mpc_realref (y));
|
||||
ret = MPC_INEX(0, ret);
|
||||
}
|
||||
else
|
||||
ret = MPC_INEX(mpfr_set_ui (mpc_realref(z), 0, MPC_RND_RE(rnd)), ret);
|
||||
}
|
||||
else
|
||||
ret = mpc_set (z, u, rnd);
|
||||
exact:
|
||||
mpc_clear (t);
|
||||
mpc_clear (u);
|
||||
|
||||
/* restore underflow and overflow flags from MPFR */
|
||||
if (saved_underflow)
|
||||
mpfr_set_underflow ();
|
||||
if (saved_overflow)
|
||||
mpfr_set_overflow ();
|
||||
|
||||
end:
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* mpc_pow_d -- Raise a complex number to a double-precision power.
|
||||
|
||||
Copyright (C) 2009 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include <float.h> /* for DBL_MANT_DIG */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_pow_d (mpc_ptr z, mpc_srcptr x, double y, mpc_rnd_t rnd)
|
||||
{
|
||||
mpc_t yy;
|
||||
int inex;
|
||||
|
||||
MPC_ASSERT(FLT_RADIX == 2);
|
||||
mpc_init3 (yy, DBL_MANT_DIG, MPFR_PREC_MIN);
|
||||
mpc_set_d (yy, y, MPC_RNDNN); /* exact */
|
||||
inex = mpc_pow (z, x, yy, rnd);
|
||||
mpc_clear (yy);
|
||||
return inex;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* mpc_pow_fr -- Raise a complex number to a floating-point power.
|
||||
|
||||
Copyright (C) 2009, 2011 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_pow_fr (mpc_ptr z, mpc_srcptr x, mpfr_srcptr y, mpc_rnd_t rnd)
|
||||
{
|
||||
mpc_t yy;
|
||||
int inex;
|
||||
|
||||
/* avoid copying the significand of y by copying only the struct */
|
||||
mpc_realref(yy)[0] = y[0];
|
||||
mpfr_init2 (mpc_imagref(yy), MPFR_PREC_MIN);
|
||||
mpfr_set_ui (mpc_imagref(yy), 0, GMP_RNDN);
|
||||
inex = mpc_pow (z, x, yy, rnd);
|
||||
mpfr_clear (mpc_imagref(yy));
|
||||
return inex;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/* mpc_pow_ld -- Raise a complex number to a long double power.
|
||||
|
||||
Copyright (C) 2009 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for MPC_ASSERT */
|
||||
#include <float.h> /* for LDBL_MANT_DIG */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_pow_ld (mpc_ptr z, mpc_srcptr x, long double y, mpc_rnd_t rnd)
|
||||
{
|
||||
mpc_t yy;
|
||||
int inex;
|
||||
|
||||
MPC_ASSERT(FLT_RADIX == 2);
|
||||
mpc_init3 (yy, LDBL_MANT_DIG, MPFR_PREC_MIN);
|
||||
mpc_set_ld (yy, y, MPC_RNDNN); /* exact */
|
||||
inex = mpc_pow (z, x, yy, rnd);
|
||||
mpc_clear (yy);
|
||||
return inex;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/* mpc_pow_si -- Raise a complex number to an integer power.
|
||||
|
||||
Copyright (C) 2009, 2010 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include "mpc-impl.h"
|
||||
|
||||
int
|
||||
mpc_pow_si (mpc_ptr z, mpc_srcptr x, long y, mpc_rnd_t rnd)
|
||||
{
|
||||
if (y >= 0)
|
||||
return mpc_pow_usi (z, x, (unsigned long) y, 1, rnd);
|
||||
else
|
||||
return mpc_pow_usi (z, x, (unsigned long) (-y), -1, rnd);
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/* mpc_pow_ui -- Raise a complex number to an integer power.
|
||||
|
||||
Copyright (C) 2009, 2010, 2011, 2012 INRIA
|
||||
|
||||
This file is part of GNU MPC.
|
||||
|
||||
GNU MPC 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 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
GNU MPC 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 this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*/
|
||||
|
||||
#include <limits.h> /* for CHAR_BIT */
|
||||
#include "mpc-impl.h"
|
||||
|
||||
static int
|
||||
mpc_pow_usi_naive (mpc_ptr z, mpc_srcptr x, unsigned long y, int sign,
|
||||
mpc_rnd_t rnd)
|
||||
{
|
||||
int inex;
|
||||
mpc_t t;
|
||||
|
||||
mpc_init3 (t, sizeof (unsigned long) * CHAR_BIT, MPFR_PREC_MIN);
|
||||
if (sign > 0)
|
||||
mpc_set_ui (t, y, MPC_RNDNN); /* exact */
|
||||
else
|
||||
mpc_set_si (t, - (signed long) y, MPC_RNDNN);
|
||||
inex = mpc_pow (z, x, t, rnd);
|
||||
mpc_clear (t);
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_pow_usi (mpc_ptr z, mpc_srcptr x, unsigned long y, int sign,
|
||||
mpc_rnd_t rnd)
|
||||
/* computes z = x^(sign*y) */
|
||||
{
|
||||
int inex;
|
||||
mpc_t t, x3;
|
||||
mpfr_prec_t p, l, l0;
|
||||
long unsigned int u;
|
||||
int has3; /* non-zero if y has '11' in its binary representation */
|
||||
int loop, done;
|
||||
|
||||
/* let mpc_pow deal with special values */
|
||||
if (!mpc_fin_p (x) || mpfr_zero_p (mpc_realref (x)) || mpfr_zero_p (mpc_imagref(x))
|
||||
|| y == 0)
|
||||
return mpc_pow_usi_naive (z, x, y, sign, rnd);
|
||||
/* easy special cases */
|
||||
else if (y == 1) {
|
||||
if (sign > 0)
|
||||
return mpc_set (z, x, rnd);
|
||||
else
|
||||
return mpc_ui_div (z, 1ul, x, rnd);
|
||||
}
|
||||
else if (y == 2 && sign > 0)
|
||||
return mpc_sqr (z, x, rnd);
|
||||
/* let mpc_pow treat potential over- and underflows */
|
||||
else {
|
||||
mpfr_exp_t exp_r = mpfr_get_exp (mpc_realref (x)),
|
||||
exp_i = mpfr_get_exp (mpc_imagref (x));
|
||||
if ( MPC_MAX (exp_r, exp_i) > mpfr_get_emax () / (mpfr_exp_t) y
|
||||
/* heuristic for overflow */
|
||||
|| MPC_MAX (-exp_r, -exp_i) > (-mpfr_get_emin ()) / (mpfr_exp_t) y
|
||||
/* heuristic for underflow */
|
||||
)
|
||||
return mpc_pow_usi_naive (z, x, y, sign, rnd);
|
||||
}
|
||||
|
||||
has3 = (y & (y >> 1)) != 0;
|
||||
for (l = 0, u = y; u > 3; l ++, u >>= 1);
|
||||
/* l>0 is the number of bits of y, minus 2, thus y has bits:
|
||||
y_{l+1} y_l y_{l-1} ... y_1 y_0 */
|
||||
l0 = l + 2;
|
||||
p = MPC_MAX_PREC(z) + l0 + 32; /* l0 ensures that y*2^{-p} <= 1 below */
|
||||
mpc_init2 (t, p);
|
||||
if (has3)
|
||||
mpc_init2 (x3, p);
|
||||
|
||||
loop = 0;
|
||||
done = 0;
|
||||
while (!done) {
|
||||
loop++;
|
||||
|
||||
mpc_sqr (t, x, MPC_RNDNN);
|
||||
if (has3) {
|
||||
mpc_mul (x3, t, x, MPC_RNDNN);
|
||||
if ((y >> l) & 1) /* y starts with 11... */
|
||||
mpc_set (t, x3, MPC_RNDNN);
|
||||
}
|
||||
while (l-- > 0) {
|
||||
mpc_sqr (t, t, MPC_RNDNN);
|
||||
if ((y >> l) & 1) {
|
||||
if ((l > 0) && ((y >> (l-1)) & 1)) /* implies has3 <> 0 */ {
|
||||
l--;
|
||||
mpc_sqr (t, t, MPC_RNDNN);
|
||||
mpc_mul (t, t, x3, MPC_RNDNN);
|
||||
}
|
||||
else
|
||||
mpc_mul (t, t, x, MPC_RNDNN);
|
||||
}
|
||||
}
|
||||
if (sign < 0)
|
||||
mpc_ui_div (t, 1ul, t, MPC_RNDNN);
|
||||
|
||||
if (mpfr_zero_p (mpc_realref(t)) || mpfr_zero_p (mpc_imagref(t))) {
|
||||
inex = mpc_pow_usi_naive (z, x, y, sign, rnd);
|
||||
/* since mpfr_get_exp() is not defined for zero */
|
||||
done = 1;
|
||||
}
|
||||
else {
|
||||
/* see error bound in algorithms.tex; we use y<2^l0 instead of y-1
|
||||
also when sign>0 */
|
||||
mpfr_exp_t diff;
|
||||
mpfr_prec_t er, ei;
|
||||
|
||||
diff = mpfr_get_exp (mpc_realref(t)) - mpfr_get_exp (mpc_imagref(t));
|
||||
/* the factor on the real part is 2+2^(-diff+2) <= 4 for diff >= 1
|
||||
and < 2^(-diff+3) for diff <= 0 */
|
||||
er = (diff >= 1) ? l0 + 3 : l0 + (-diff) + 3;
|
||||
/* the factor on the imaginary part is 2+2^(diff+2) <= 4 for diff <= -1
|
||||
and < 2^(diff+3) for diff >= 0 */
|
||||
ei = (diff <= -1) ? l0 + 3 : l0 + diff + 3;
|
||||
if (mpfr_can_round (mpc_realref(t), p - er, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_RE(z) + (MPC_RND_RE(rnd) == GMP_RNDN))
|
||||
&& mpfr_can_round (mpc_imagref(t), p - ei, GMP_RNDN, GMP_RNDZ,
|
||||
MPC_PREC_IM(z) + (MPC_RND_IM(rnd) == GMP_RNDN))) {
|
||||
inex = mpc_set (z, t, rnd);
|
||||
done = 1;
|
||||
}
|
||||
else if (loop == 1 && SAFE_ABS(mpfr_prec_t, diff) < MPC_MAX_PREC(z)) {
|
||||
/* common case, make a second trial at higher precision */
|
||||
p += MPC_MAX_PREC(x);
|
||||
mpc_set_prec (t, p);
|
||||
if (has3)
|
||||
mpc_set_prec (x3, p);
|
||||
l = l0 - 2;
|
||||
}
|
||||
else {
|
||||
/* stop the loop and use mpc_pow */
|
||||
inex = mpc_pow_usi_naive (z, x, y, sign, rnd);
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mpc_clear (t);
|
||||
if (has3)
|
||||
mpc_clear (x3);
|
||||
|
||||
return inex;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mpc_pow_ui (mpc_ptr z, mpc_srcptr x, unsigned long y, mpc_rnd_t rnd)
|
||||
{
|
||||
return mpc_pow_usi (z, x, y, 1, rnd);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue