diff options
-rw-r--r-- | Makefile.in | 255 | ||||
-rw-r--r-- | aclocal.m4 | 21 | ||||
-rw-r--r-- | add.c | 8 | ||||
-rw-r--r-- | add_ui.c | 7 | ||||
-rw-r--r-- | add_ulp.c | 3 | ||||
-rw-r--r-- | agm.c | 37 | ||||
-rw-r--r-- | clear.c | 3 | ||||
-rw-r--r-- | cmp.c | 3 | ||||
-rw-r--r-- | cmp_ui.c | 3 | ||||
-rwxr-xr-x | configure | 252 | ||||
-rw-r--r-- | div.c | 11 | ||||
-rw-r--r-- | div_2exp.c | 7 | ||||
-rw-r--r-- | div_ui.c | 10 | ||||
-rw-r--r-- | dump.c | 3 | ||||
-rw-r--r-- | eq.c | 7 | ||||
-rw-r--r-- | exp.c | 5 | ||||
-rw-r--r-- | exp2.c | 23 | ||||
-rw-r--r-- | exp3.c | 35 | ||||
-rw-r--r-- | extract.c | 3 | ||||
-rw-r--r-- | generic.c | 14 | ||||
-rw-r--r-- | get_str.c | 3 | ||||
-rw-r--r-- | init.c | 3 | ||||
-rw-r--r-- | log.c | 22 | ||||
-rw-r--r-- | log2.c | 11 | ||||
-rw-r--r-- | mpfr-impl.h | 116 | ||||
-rw-r--r-- | mpfr.h | 95 | ||||
-rw-r--r-- | mpfr.texi | 1 | ||||
-rw-r--r-- | mpz_set_fr.c | 3 | ||||
-rw-r--r-- | mul.c | 3 | ||||
-rw-r--r-- | mul_2exp.c | 3 | ||||
-rw-r--r-- | mul_ui.c | 3 | ||||
-rw-r--r-- | neg.c | 6 | ||||
-rw-r--r-- | out_str.c | 3 | ||||
-rw-r--r-- | pi.c | 9 | ||||
-rw-r--r-- | pow.c | 1 | ||||
-rw-r--r-- | print_raw.c | 9 | ||||
-rw-r--r-- | random.c | 3 | ||||
-rw-r--r-- | random2.c | 28 | ||||
-rw-r--r-- | round.c | 12 | ||||
-rw-r--r-- | set.c | 7 | ||||
-rw-r--r-- | set_d.c | 13 | ||||
-rw-r--r-- | set_f.c | 3 | ||||
-rw-r--r-- | set_prc_raw.c | 3 | ||||
-rw-r--r-- | set_prec.c | 3 | ||||
-rw-r--r-- | set_q.c | 3 | ||||
-rw-r--r-- | set_si.c | 13 | ||||
-rw-r--r-- | set_str.c | 3 | ||||
-rw-r--r-- | set_str_raw.c | 7 | ||||
-rw-r--r-- | set_z.c | 3 | ||||
-rw-r--r-- | sin_cos.c | 9 | ||||
-rw-r--r-- | sqrt.c | 5 | ||||
-rw-r--r-- | sqrt_ui.c | 14 | ||||
-rw-r--r-- | sqrtrem.c | 5 | ||||
-rw-r--r-- | sub.c | 3 | ||||
-rw-r--r-- | sub_ui.c | 14 | ||||
-rw-r--r-- | swap.c | 2 | ||||
-rw-r--r-- | tests/Makefile.in | 159 | ||||
-rw-r--r-- | tests/tabs.c | 8 | ||||
-rw-r--r-- | tests/tadd.c | 4 | ||||
-rw-r--r-- | tests/tagm.c | 2 | ||||
-rw-r--r-- | tests/tcmp.c | 2 | ||||
-rw-r--r-- | tests/tdiv.c | 5 | ||||
-rw-r--r-- | tests/tdiv_ui.c | 5 | ||||
-rw-r--r-- | tests/tget_str.c | 7 | ||||
-rw-r--r-- | tests/tlog.c | 2 | ||||
-rw-r--r-- | tests/tmul.c | 6 | ||||
-rw-r--r-- | tests/tmul_2exp.c | 1 | ||||
-rw-r--r-- | tests/tmul_ui.c | 2 | ||||
-rw-r--r-- | tests/tout_str.c | 2 | ||||
-rw-r--r-- | tests/tset_d.c | 7 | ||||
-rw-r--r-- | tests/tset_si.c | 1 | ||||
-rw-r--r-- | tests/tset_str.c | 6 | ||||
-rw-r--r-- | tests/tsqrt.c | 7 | ||||
-rw-r--r-- | tests/tsqrt_ui.c | 8 | ||||
-rw-r--r-- | tests/tui_div.c | 5 | ||||
-rw-r--r-- | tests/tui_sub.c | 5 | ||||
-rw-r--r-- | trunc.c | 3 | ||||
-rw-r--r-- | ui_div.c | 14 | ||||
-rw-r--r-- | ui_sub.c | 14 | ||||
-rw-r--r-- | urandomb.c | 3 |
80 files changed, 624 insertions, 808 deletions
diff --git a/Makefile.in b/Makefile.in index afae08e69..d14f531f5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 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. @@ -11,7 +11,7 @@ # PARTICULAR PURPOSE. -SHELL = @SHELL@ +SHELL = /bin/sh srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -32,7 +32,7 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = +DISTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -46,7 +46,7 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ @@ -68,15 +68,15 @@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ -SUBDIRS = tests -EXTRA_DIST = generic.c +SUBDIRS=tests +EXTRA_DIST=generic.c include_HEADERS = mpfr.h mpf2mpfr.h lib_LIBRARIES = libmpfr.a -libmpfr_a_SOURCES = cputime.h mpfr.h mpfr-impl.h sin_cos.c extract.c add.c add_ui.c add_ulp.c agm.c clear.c cmp.c cmp_ui.c div_2exp.c div.c div_ui.c dump.c eq.c exp2.c exp3.c exp.c get_str.c init.c inp_str.c log2.c log.c mul_2exp.c mul.c mul_ui.c neg.c out_str.c pi.c pow.c print_raw.c print_rnd_mode.c random2.c random.c reldiff.c rnd_mode.c round.c set.c set_d.c set_dfl_prec.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c set_str.c set_str_raw.c set_z.c sqrt.c sqrt_ui.c sub.c sub_ui.c trunc.c ui_div.c ui_sub.c zeta.c urandomb.c sqrtrem.c mpz_set_fr.c swap.c -libmpfr_a_LIBADD = ceil.o floor.o +libmpfr_a_SOURCES= cputime.h mpfr.h mpfr-impl.h sin_cos.c extract.c add.c add_ui.c add_ulp.c agm.c clear.c cmp.c cmp_ui.c div_2exp.c div.c div_ui.c dump.c eq.c exp2.c exp3.c exp.c get_str.c init.c inp_str.c log2.c log.c mul_2exp.c mul.c mul_ui.c neg.c out_str.c pi.c pow.c print_raw.c print_rnd_mode.c random2.c random.c reldiff.c rnd_mode.c round.c set.c set_d.c set_dfl_prec.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c set_str.c set_str_raw.c set_z.c sqrt.c sqrt_ui.c sub.c sub_ui.c trunc.c ui_div.c ui_sub.c urandomb.c sqrtrem.c mpz_set_fr.c swap.c +libmpfr_a_LIBADD= ceil.o floor.o info_TEXINFOS = mpfr.texi ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -96,13 +96,13 @@ mul_ui.o neg.o out_str.o pi.o pow.o print_raw.o print_rnd_mode.o \ random2.o random.o reldiff.o rnd_mode.o round.o set.o set_d.o \ set_dfl_prec.o set_rnd.o set_f.o set_prc_raw.o set_prec.o set_q.o \ set_si.o set_str.o set_str_raw.o set_z.o sqrt.o sqrt_ui.o sub.o \ -sub_ui.o trunc.o ui_div.o ui_sub.o zeta.o urandomb.o sqrtrem.o \ -mpz_set_fr.o swap.o +sub_ui.o trunc.o ui_div.o ui_sub.o urandomb.o sqrtrem.o mpz_set_fr.o \ +swap.o AR = ar -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ TEXI2DVI = texi2dvi +TEXINFO_TEX = $(srcdir)/texinfo.tex INFO_DEPS = mpfr.info DVIS = mpfr.dvi TEXINFOS = mpfr.texi @@ -116,7 +116,7 @@ install-sh missing mkinstalldirs texinfo.tex DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar -GZIP_ENV = --best +GZIP = --best DEP_FILES = .deps/add.P .deps/add_ui.P .deps/add_ulp.P .deps/agm.P \ .deps/clear.P .deps/cmp.P .deps/cmp_ui.P .deps/div.P .deps/div_2exp.P \ .deps/div_ui.P .deps/dump.P .deps/eq.P .deps/exp.P .deps/exp2.P \ @@ -130,14 +130,15 @@ DEP_FILES = .deps/add.P .deps/add_ui.P .deps/add_ulp.P .deps/agm.P \ .deps/set_si.P .deps/set_str.P .deps/set_str_raw.P .deps/set_z.P \ .deps/sin_cos.P .deps/sqrt.P .deps/sqrt_ui.P .deps/sqrtrem.P \ .deps/sub.P .deps/sub_ui.P .deps/swap.P .deps/trunc.P .deps/ui_div.P \ -.deps/ui_sub.P .deps/urandomb.P .deps/zeta.P +.deps/ui_sub.P .deps/urandomb.P SOURCES = $(libmpfr_a_SOURCES) OBJECTS = $(libmpfr_a_OBJECTS) -all: all-redirect +all: all-recursive all-am + .SUFFIXES: .SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) @@ -147,7 +148,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) $(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +config.status: $(srcdir)/configure $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) @@ -164,7 +165,7 @@ maintainer-clean-libLIBRARIES: install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ + list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ @@ -217,7 +218,7 @@ DVIPS = dvips && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .texi.dvi: - TEXINPUTS=.:$$TEXINPUTS \ + TEXINPUTS=$(srcdir):$$TEXINPUTS \ MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< .texi: @@ -236,7 +237,7 @@ DVIPS = dvips && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .texinfo.dvi: - TEXINPUTS=.:$$TEXINPUTS \ + TEXINPUTS=$(srcdir):$$TEXINPUTS \ MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< .txi.info: @@ -245,7 +246,7 @@ DVIPS = dvips && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .txi.dvi: - TEXINPUTS=.:$$TEXINPUTS \ + TEXINPUTS=$(srcdir):$$TEXINPUTS \ MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< .txi: @@ -258,8 +259,7 @@ DVIPS = dvips install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ + @for file in $(INFO_DEPS); do \ d=$(srcdir); \ for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ if test -f $$d/$$ifile; then \ @@ -270,8 +270,7 @@ install-info-am: $(INFO_DEPS) done @$(POST_INSTALL) @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ + for file in $(INFO_DEPS); do \ echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ done; \ @@ -282,20 +281,17 @@ uninstall-info: @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ ii=yes; \ else ii=; fi; \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ + for file in $(INFO_DEPS); do \ test -z "$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) - list='$(INFO_DEPS)'; \ - for file in $$list; do \ + for file in $(INFO_DEPS); do \ (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ done dist-info: $(INFO_DEPS) - list='$(INFO_DEPS)'; \ - for base in $$list; do \ + for base in $(INFO_DEPS); do \ d=$(srcdir); \ for file in `cd $$d && eval echo $$base*`; do \ test -f $(distdir)/$$file \ @@ -314,7 +310,7 @@ clean-aminfo: distclean-aminfo: maintainer-clean-aminfo: - cd $(srcdir) && for i in $(INFO_DEPS); do \ + for i in $(INFO_DEPS); do \ rm -f $$i; \ if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ rm -f $$i-[0-9]*; \ @@ -349,65 +345,41 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ + target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + (cd $$subdir && $(MAKE) $$target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" + done && test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ + target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + (cd $$subdir && $(MAKE) $$target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + (cd $$subdir && $(MAKE) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ done; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ @@ -433,31 +405,29 @@ top_distdir = $(distdir) # tarfile. distcheck: dist -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist + && $(MAKE) \ + && $(MAKE) dvi \ + && $(MAKE) check \ + && $(MAKE) install \ + && $(MAKE) installcheck \ + && $(MAKE) dist -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" + @echo "========================"; \ + echo "$(distdir).tar.gz is ready for distribution"; \ + echo "========================" dist: distdir -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) @@ -470,25 +440,19 @@ distdir: $(DISTFILES) && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ done for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info + $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) @@ -499,93 +463,91 @@ mostlyclean-depend: clean-depend: distclean-depend: - -rm -rf .deps maintainer-clean-depend: + -rm -rf .deps %.o: %.c @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp + $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< %.lo: %.c @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: $(INFO_DEPS) -info: info-recursive -dvi-am: $(DVIS) -dvi: dvi-recursive -check-am: all-am -check: check-recursive -installcheck-am: + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p +info: $(INFO_DEPS) info-recursive +dvi: $(DVIS) dvi-recursive +check: all-am + $(MAKE) check-recursive installcheck: installcheck-recursive +all-am: Makefile $(INFO_DEPS) $(LIBRARIES) $(HEADERS) + install-exec-am: install-libLIBRARIES -install-exec: install-exec-recursive install-data-am: install-info-am install-includeHEADERS -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: uninstall-libLIBRARIES uninstall-info \ - uninstall-includeHEADERS -uninstall: uninstall-recursive -all-am: Makefile $(INFO_DEPS) $(LIBRARIES) $(HEADERS) -all-redirect: all-recursive + +uninstall-am: uninstall-libLIBRARIES uninstall-info uninstall-includeHEADERS + +install-exec: install-exec-recursive install-exec-am + @$(NORMAL_INSTALL) + +install-data: install-data-recursive install-data-am + @$(NORMAL_INSTALL) + +install: install-recursive install-exec-am install-data-am + @: + +uninstall: uninstall-recursive uninstall-am + install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ - $(DESTDIR)$(includedir) + $(mkinstalldirs) $(DATADIR)$(libdir) $(DESTDIR)$(infodir) \ + $(DATADIR)$(includedir) mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \ mostlyclean-aminfo mostlyclean-tags mostlyclean-depend \ mostlyclean-generic -mostlyclean: mostlyclean-recursive - clean-am: clean-libLIBRARIES clean-compile clean-aminfo clean-tags \ clean-depend clean-generic mostlyclean-am -clean: clean-recursive - distclean-am: distclean-libLIBRARIES distclean-compile distclean-aminfo \ distclean-tags distclean-depend distclean-generic \ clean-am -distclean: distclean-recursive - -rm -f config.status - maintainer-clean-am: maintainer-clean-libLIBRARIES \ maintainer-clean-compile maintainer-clean-aminfo \ maintainer-clean-tags maintainer-clean-depend \ maintainer-clean-generic distclean-am + +mostlyclean: mostlyclean-recursive mostlyclean-am + +clean: clean-recursive clean-am + +distclean: distclean-recursive distclean-am + -rm -f config.status + +maintainer-clean: maintainer-clean-recursive maintainer-clean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-recursive -rm -f config.status .PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ @@ -601,12 +563,11 @@ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir \ mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-depend info dvi installcheck all-am install-exec-am \ +install-data-am uninstall-am install-exec install-data install \ +uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean ceil.o: trunc.c mpfr.h diff --git a/aclocal.m4 b/aclocal.m4 index 297b0b008..d3b3bcab1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.3 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in 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. @@ -62,7 +62,7 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) +[AC_REQUIRE([AM_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -72,8 +72,8 @@ if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. @@ -85,6 +85,15 @@ AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# serial 1 + +AC_DEFUN(AM_PROG_INSTALL, +[AC_REQUIRE([AC_PROG_INSTALL]) +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl +]) + # # Check to make sure that the build environment is sane. # @@ -23,11 +23,13 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ extern void mpfr_sub1 _PROTO((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t, int)); +void mpfr_add1 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t, int); #define ONE ((mp_limb_t) 1) @@ -37,10 +39,10 @@ extern void mpfr_sub1 _PROTO((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, void #if __STDC__ -mpfr_add1(mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, - mp_rnd_t rnd_mode, int diff_exp) +mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, + mp_rnd_t rnd_mode, int diff_exp) #else -mpfr_add1(a, b, c, rnd_mode, diff_exp) +mpfr_add1 (a, b, c, rnd_mode, diff_exp) mpfr_ptr a; mpfr_srcptr b; mpfr_srcptr c; @@ -21,11 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" - -#define MON_INIT(xp, x, p, s) MPFR_PREC(x)=p; MPFR_MANT(x)=xp; MPFR_SIZE(x)=s; +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -43,7 +42,7 @@ mpfr_add_ui(y, x, u, rnd_mode) unsigned long cnt; if (u) { /* if u=0, do nothing */ - MON_INIT(up, uu, BITS_PER_MP_LIMB, 1); + MPFR_INIT1(up, uu, BITS_PER_MP_LIMB, 1); count_leading_zeros(cnt, (mp_limb_t) u); *up = (mp_limb_t) u << cnt; MPFR_EXP(uu) = BITS_PER_MP_LIMB-cnt; @@ -20,8 +20,9 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* sets x to x+sign(x)*2^(MPFR_EXP(x)-MPFR_PREC(x)) */ void @@ -22,21 +22,18 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" - -/*Memory gestion */ -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; x -> _mp_exp = 0; +#include "mpfr.h" +#include "mpfr-impl.h" void #ifdef __STDC__ mpfr_agm(mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) #else -mpfr_agm(r, a, b, rnd_mode) +mpfr_agm(r, op2, op1, rnd_mode) mpfr_ptr r; - mpfr_srcptr a; - mpfr_srcptr b; + mpfr_srcptr op2; + mpfr_srcptr op1; mp_rnd_t rnd_mode; #endif { @@ -75,14 +72,14 @@ mpfr_agm(r, a, b, rnd_mode) TMP_MARK(marker1); s=(p-1)/BITS_PER_MP_LIMB+1; - MON_INIT(ap, a, p, s); - MON_INIT(bp, b, p, s); + MPFR_INIT(ap, a, p, s); + MPFR_INIT(bp, b, p, s); TMP_MARK(marker2); - MON_INIT(up, u, p, s); - MON_INIT(vp, v, p, s); - MON_INIT(tmpup, tmpu, p, s); - MON_INIT(tmpvp, tmpv, p, s); - MON_INIT(tmpp, tmp, p, s); + MPFR_INIT(up, u, p, s); + MPFR_INIT(vp, v, p, s); + MPFR_INIT(tmpup, tmpu, p, s); + MPFR_INIT(tmpvp, tmpv, p, s); + MPFR_INIT(tmpp, tmp, p, s); @@ -145,11 +142,11 @@ mpfr_agm(r, a, b, rnd_mode) TMP_FREE(marker2); TMP_MARK(marker2); s=(p-1)/BITS_PER_MP_LIMB+1; - MON_INIT(up, u, p, s); - MON_INIT(vp, v, p, s); - MON_INIT(tmpup, tmpu, p, s); - MON_INIT(tmpvp, tmpv, p, s); - MON_INIT(tmpp, tmp, p, s); + MPFR_INIT(up, u, p, s); + MPFR_INIT(vp, v, p, s); + MPFR_INIT(tmpup, tmpu, p, s); + MPFR_INIT(tmpvp, tmpv, p, s); + MPFR_INIT(tmpp, tmp, p, s); mpfr_set(u,a,GMP_RNDN); mpfr_set(v,b,GMP_RNDN); } @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -21,9 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* returns 0 iff b = c a positive value iff b > c @@ -21,9 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* returns a positive value if b>i*2^f, a negative value if b<i*2^f, @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -57,7 +57,6 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -341,7 +340,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -511,11 +510,9 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -ac_exeext= -ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -555,30 +552,28 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:564: checking for a BSD compatible install" >&5 +echo "configure:560: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do + for ac_prog in ginstall installbsd scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -608,12 +603,13 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:617: checking whether build environment is sane" >&5 +echo "configure:613: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -670,7 +666,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:674: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -709,7 +705,7 @@ fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:713: checking for working aclocal" >&5 +echo "configure:709: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -722,7 +718,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:726: checking for working autoconf" >&5 +echo "configure:722: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -735,7 +731,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:739: checking for working automake" >&5 +echo "configure:735: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -748,7 +744,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:752: checking for working autoheader" >&5 +echo "configure:748: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -761,7 +757,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:765: checking for working makeinfo" >&5 +echo "configure:761: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -806,16 +802,15 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:810: checking for $ac_word" >&5 +echo "configure:806: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -836,17 +831,16 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:840: checking for $ac_word" >&5 +echo "configure:835: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -881,61 +875,25 @@ else echo "$ac_t""no" 1>&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:891: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:923: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext << EOF - -#line 934 "configure" +cat > conftest.$ac_ext <<EOF +#line 893 "configure" #include "confdefs.h" - main(){return(0);} EOF -if { (eval echo configure:939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -949,24 +907,18 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:965: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:917: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:970: checking whether we are using GNU C" >&5 +echo "configure:922: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -975,7 +927,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -986,15 +938,11 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:998: checking whether ${CC-cc} accepts -g" >&5 + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:946: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1009,35 +957,30 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then CFLAGS="-g -O2" else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then CFLAGS="-O2" - else - CFLAGS= fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1032: checking for $ac_word" >&5 +echo "configure:976: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -1057,13 +1000,13 @@ fi echo $ac_n "checking OS type""... $ac_c" 1>&6 -echo "configure:1061: checking OS type" >&5 +echo "configure:1004: checking OS type" >&5 OS_TYPE=`uname -a | awk '{print $ 1}' ` echo "$ac_t""$OS_TYPE" 1>&6 echo $ac_n "checking Mach type""... $ac_c" 1>&6 -echo "configure:1067: checking Mach type" >&5 +echo "configure:1010: checking Mach type" >&5 MACHTYPE=`uname -m` echo "$ac_t""$MACHTYPE" 1>&6 @@ -1076,7 +1019,7 @@ MISCFLAGS='$<' case $OS_TYPE in HP-UX*) echo $ac_n "checking for main in -lM""... $ac_c" 1>&6 -echo "configure:1080: checking for main in -lM" >&5 +echo "configure:1023: checking for main in -lM" >&5 ac_lib_var=`echo M'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1084,14 +1027,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lM $LIBS" cat > conftest.$ac_ext <<EOF -#line 1088 "configure" +#line 1031 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1121,7 +1064,7 @@ fi SunOS*) MISCFLAGS="trunc.c" echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1125: checking for main in -lm" >&5 +echo "configure:1068: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1129,14 +1072,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1133 "configure" +#line 1076 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1166,7 +1109,7 @@ fi ;; Linux*) echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1170: checking for main in -lm" >&5 +echo "configure:1113: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1174,14 +1117,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1178 "configure" +#line 1121 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1220,7 +1163,7 @@ EOF fi;; IRIX64) echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1224: checking for main in -lm" >&5 +echo "configure:1167: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1228,14 +1171,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1232 "configure" +#line 1175 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1270,7 +1213,7 @@ fi fi;; OSF*) echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1274: checking for main in -lm" >&5 +echo "configure:1217: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1278,14 +1221,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1282 "configure" +#line 1225 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1327,7 +1270,7 @@ EOF ;; *) echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1331: checking for main in -lm" >&5 +echo "configure:1274: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1335,14 +1278,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1339 "configure" +#line 1282 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1373,7 +1316,7 @@ esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1377: checking how to run the C preprocessor" >&5 +echo "configure:1320: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1388,14 +1331,14 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1392 "configure" +#line 1335 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else @@ -1405,31 +1348,14 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1409 "configure" +#line 1352 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1415: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 1426 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else @@ -1442,8 +1368,6 @@ fi rm -f conftest* fi rm -f conftest* -fi -rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" @@ -1457,18 +1381,18 @@ if test "$with_gmp_include" then ac_safe=`echo "$with_gmp_include/gmp-impl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $with_gmp_include/gmp-impl.h""... $ac_c" 1>&6 -echo "configure:1461: checking for $with_gmp_include/gmp-impl.h" >&5 +echo "configure:1385: checking for $with_gmp_include/gmp-impl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1466 "configure" +#line 1390 "configure" #include "confdefs.h" #include <$with_gmp_include/gmp-impl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -1492,18 +1416,18 @@ fi else ac_safe=`echo "gmp-impl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gmp-impl.h""... $ac_c" 1>&6 -echo "configure:1496: checking for gmp-impl.h" >&5 +echo "configure:1420: checking for gmp-impl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1501 "configure" +#line 1425 "configure" #include "confdefs.h" #include <gmp-impl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1506: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -1533,7 +1457,7 @@ fi if ` test "$with_gmp_lib" ` then echo $ac_n "checking gmp library""... $ac_c" 1>&6 -echo "configure:1537: checking gmp library" >&5 +echo "configure:1461: checking gmp library" >&5 if test -r "$with_gmp_lib/libgmp.a" then LDADD="$LDADD $with_gmp_lib/libgmp.a" @@ -1543,7 +1467,7 @@ echo "configure:1537: checking gmp library" >&5 echo "$ac_t""yes" 1>&6 else echo $ac_n "checking for main in -lgmp""... $ac_c" 1>&6 -echo "configure:1547: checking for main in -lgmp" >&5 +echo "configure:1471: checking for main in -lgmp" >&5 ac_lib_var=`echo gmp'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1551,14 +1475,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lgmp $LIBS" cat > conftest.$ac_ext <<EOF -#line 1555 "configure" +#line 1479 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1617,7 +1541,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in + case `(ac_space=' '; set) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1696,7 +1620,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1716,11 +1640,9 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub -s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -1740,8 +1662,8 @@ s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g s%@ACLOCAL@%$ACLOCAL%g @@ -23,9 +23,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ @@ -127,13 +128,11 @@ mpfr_div (r, u, v, rnd_mode) precision ; take one extra bit for rrsize in order to solve more easily the problem of rounding to nearest. */ - /* ATTENTION, UMPFR_SIZE DOIT RESTER > A VMPFR_SIZE !!!!!!!! */ - do { TMP_MARK (marker); - rexp = u->_mp_exp - v->_mp_exp; + rexp = MPFR_EXP(u) - MPFR_EXP(v); err = rsize*BITS_PER_MP_LIMB; if (rsize < vsize) { err-=2; } @@ -294,12 +293,12 @@ mpfr_div (r, u, v, rnd_mode) if (sign_quotient * MPFR_SIGN(r) < 0) { MPFR_CHANGE_SIGN(r); } - r->_mp_exp = rexp; + MPFR_EXP(r) = rexp; if (cc) { mpn_rshift(rp, rp, rrsize, 1); rp[rrsize-1] |= (mp_limb_t) 1 << (BITS_PER_MP_LIMB-1); - r->_mp_exp++; + MPFR_EXP(r)++; } rw = rrsize * BITS_PER_MP_LIMB - MPFR_PREC(r); diff --git a/div_2exp.c b/div_2exp.c index 3749706cd..e518f6518 100644 --- a/div_2exp.c +++ b/div_2exp.c @@ -21,14 +21,15 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ -mpfr_div_2exp(mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd_mode) +mpfr_div_2exp (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd_mode) #else -mpfr_div_2exp(y, x, n, rnd_mode) +mpfr_div_2exp (y, x, n, rnd_mode) mpfr_ptr y; mpfr_srcptr x; unsigned long int n; @@ -21,16 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" -#if (__GNU_MP_VERSION < 3) -/* longlong.h has to come before gmp-impl.h, - otherwise UDIV_NEEDS_NORMALIZATION is wrongly defined */ -#include "longlong.h" -#include "gmp-impl.h" -#else #include "gmp-impl.h" #include "longlong.h" -#endif +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ @@ -27,8 +27,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <strings.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -23,8 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" int #if __STDC__ @@ -41,8 +42,8 @@ mpfr_eq (u, v, n_bits) mp_exp_t uexp, vexp; int usign, k; - uexp = u->_mp_exp; - vexp = v->_mp_exp; + uexp = MPFR_EXP(u); + vexp = MPFR_EXP(v); usize = (MPFR_PREC(u)-1)/BITS_PER_MP_LIMB + 1; vsize = (MPFR_PREC(v)-1)/BITS_PER_MP_LIMB + 1; @@ -22,13 +22,12 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ -#define LOG2 0.69314718055994528622 /* log(2) rounded to zero on 53 bits */ - extern int mpfr_exp2 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); extern int mpfr_exp3 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); @@ -23,11 +23,15 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" -int mpfr_exp2_aux (mpz_t, mpfr_srcptr, int, int*); -int mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, int, int*); +int mpfr_exp2_aux (mpz_t, mpfr_srcptr, int, int*); +int mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, int, int*); +mp_exp_t mpz_normalize (mpz_t, mpz_t, int); +int mpz_normalize2 (mpz_t, mpz_t, int, int); +int mpfr_exp2 (mpfr_ptr, mpfr_srcptr, mp_rnd_t); #define SWITCH 100 /* number of bits to switch from O(n^(1/2)*M(n)) method to O(n^(1/3)*M(n)) method */ @@ -42,10 +46,11 @@ int mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, int, int*); /* if k = the number of bits of z > q, divides z by 2^(k-q) and returns k-q. Otherwise do nothing and return 0. */ +mp_exp_t #if __STDC__ -mp_exp_t mpz_normalize(mpz_t rop, mpz_t z, int q) +mpz_normalize (mpz_t rop, mpz_t z, int q) #else -mp_exp_t mpz_normalize(rop, z, q) +mpz_normalize (rop, z, q) mpz_t rop; mpz_t z; int q; @@ -70,9 +75,9 @@ mp_exp_t mpz_normalize(rop, z, q) */ int #if __STDC__ -mpz_normalize2(mpz_t rop, mpz_t z, int expz, int target) +mpz_normalize2 (mpz_t rop, mpz_t z, int expz, int target) #else -mpz_normalize2(rop, z, expz, target) +mpz_normalize2 (rop, z, expz, target) mpz_t rop; mpz_t z; int expz; @@ -91,9 +96,9 @@ mpz_normalize2(rop, z, expz, target) */ int #if __STDC__ -mpfr_exp2(mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) +mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) #else -mpfr_exp2(y, x, rnd_mode) +mpfr_exp2 (y, x, rnd_mode) mpfr_ptr y; mpfr_srcptr x; mp_rnd_t rnd_mode; @@ -22,17 +22,22 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ +int mylog2 (int); +int mpfr_exp_rational (mpfr_ptr, mpz_srcptr, int, int); +int mpfr_exp3 (mpfr_ptr, mpfr_srcptr, mp_rnd_t); + int #if __STDC__ -mylog2(int x) +mylog2 (int x) #else -mylog2(x) -int x; +mylog2 (x) + int x; #endif { int i = 0; @@ -42,13 +47,13 @@ int x; int #if __STDC__ -mpfr_exp_rational(mpfr_ptr y,mpz_srcptr p,int r,int m) +mpfr_exp_rational (mpfr_ptr y, mpz_srcptr p, int r, int m) #else -mpfr_exp_rational(y,p,r,m) -mpfr_ptr y; -mpz_srcptr p; -int r; -int m; +mpfr_exp_rational (y, p, r, m) + mpfr_ptr y; + mpz_srcptr p; + int r; + int m; #endif { int n,i,k,j,l; @@ -140,12 +145,12 @@ int m; int #if __STDC__ -mpfr_exp3(mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) +mpfr_exp3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) #else -mpfr_exp3(y,x,rnd_mode) -mpfr_ptr y; -mpfr_srcptr x; -mp_rnd_t rnd_mode; +mpfr_exp3 (y, x, rnd_mode) + mpfr_ptr y; + mpfr_srcptr x; + mp_rnd_t rnd_mode; #endif { mpfr_t t; @@ -20,8 +20,9 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* given 0 <= |p| < 1, this function extracts limbs of p and puts them in y. @@ -35,13 +35,13 @@ MA 02111-1307, USA. */ avec x = p / 2^r */ int #if __STDC__ -GENERIC(mpfr_ptr y,mpz_srcptr p,int r,int m) +GENERIC (mpfr_ptr y, mpz_srcptr p, int r, int m) #else -GENERIC(y,p,r,m) -mpfr_ptr y; -mpz_srcptr p; -int r; -int m; +GENERIC (y, p, r, m) + mpfr_ptr y; + mpz_srcptr p; + int r; + int m; #endif { int n,i,k,j,l; @@ -93,7 +93,7 @@ int m; mpz_mul_ui(ptoj[0], ptoj[0], C2); # endif #endif - is_p_one = !mpz_cmp_si(ptoj[0],1); + is_p_one = !mpz_cmp_si(ptoj[0], 1); #ifdef A # ifdef B mpz_set_ui(T[0], A1 * B1); @@ -26,9 +26,10 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include <string.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* Convert op to a string in base 'base' with 'n' digits and writes the @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -22,9 +22,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" - +#include "mpfr.h" +#include "mpfr-impl.h" /* The computation of log(a) is done using the formula : if we want p bits of the result, @@ -40,10 +40,6 @@ MA 02111-1307, USA. */ so the relative error 4/s^2 is < 4/2^p i.e. 4 ulps. */ - -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; x -> _mp_exp = 0; - /* #define DEBUG */ int @@ -117,13 +113,13 @@ mpfr_log(r, a, rnd_mode) /* All the mpfr_t needed have a precision of p */ TMP_MARK(marker); size=(p-1)/BITS_PER_MP_LIMB+1; - MON_INIT(cstp, cst, p, size); - MON_INIT(rapportp, rapport, p, size); - MON_INIT(agmp, agm, p, size); - MON_INIT(tmp1p, tmp1, p, size); - MON_INIT(tmp2p, tmp2, p, size); - MON_INIT(sp, s, p, size); - MON_INIT(mmp, mm, p, size); + MPFR_INIT(cstp, cst, p, size); + MPFR_INIT(rapportp, rapport, p, size); + MPFR_INIT(agmp, agm, p, size); + MPFR_INIT(tmp1p, tmp1, p, size); + MPFR_INIT(tmp2p, tmp2, p, size); + MPFR_INIT(sp, s, p, size); + MPFR_INIT(mmp, mm, p, size); mpfr_set_si(mm,m,GMP_RNDN); /* I have m, supposed exact */ mpfr_set_si(tmp1,1,GMP_RNDN); /* I have 1, exact */ @@ -22,14 +22,17 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" mpfr_t __mpfr_const_log2; /* stored value of log(2) */ int __mpfr_const_log2_prec=0; /* precision of stored value */ mp_rnd_t __mpfr_const_log2_rnd; /* rounding mode of stored value */ +int mpfr_aux_log2 (mpfr_ptr, mpz_srcptr, int, int); +int mpfr_const_aux_log2 (mpfr_ptr, mp_rnd_t); #define A #define A1 1 @@ -53,9 +56,11 @@ mp_rnd_t __mpfr_const_log2_rnd; /* rounding mode of stored value */ int #if __STDC__ -mpfr_const_aux_log2(mpfr_ptr mylog, mp_rnd_t rnd_mode) +mpfr_const_aux_log2 (mpfr_ptr mylog, mp_rnd_t rnd_mode) #else -mpfr_const_aux_log2(mylog, rnd_mode) mpfr_ptr mylog; mp_rnd_t rnd_mode; +mpfr_const_aux_log2 (mylog, rnd_mode) + mpfr_ptr mylog; + mp_rnd_t rnd_mode; #endif { int prec; diff --git a/mpfr-impl.h b/mpfr-impl.h index 136d5c626..8c18e98bb 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -1,6 +1,6 @@ /* Utilities for MPFR developers, not exported. -Copyright (C) 1999 Free Software Foundation. +Copyright (C) 1999-2000 Free Software Foundation. This file is part of the MPFR Library. @@ -19,45 +19,81 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <math.h> - -/* generate a random double using the whole range of possible values, - including denormalized numbers, NaN, infinities, ... */ -double drand() -{ - double d; int *i, expo; - - i = (int*) &d; - d = 1.0; - if (i[0]==0) expo=1; /* little endian, exponent in i[1] */ - else expo=0; - i[0] = lrand48(); - i[1] = lrand48(); - while (i[expo]>=2146435072) i[expo] = lrand48(); /* avoids NaNs */ - if (lrand48()%2 && !isnan(d)) d=-d; /* generates negative numbers */ - return d; -} +/* Definition of constants */ -/* returns the number of ulp's between a and b */ -int ulp(a,b) double a,b; -{ - double eps=1.1102230246251565404e-16; /* 2^(-53) */ - if (a==0.0) { - if (b==0.0) return 0; - else if (b<0.0) return 2147483647; - else return -2147483647; - } - b = (a-b)/a; - if (b>0) - return (int) floor(b/eps); - else - return (int) ceil(b/eps); -} +#define LOG2 0.69314718055994528622 /* log(2) rounded to zero on 53 bits */ + +/* macros for doubles, based on gmp union ieee_double_extract */ + +typedef union ieee_double_extract Ieee_double_extract; + +#define DOUBLE_ISNANorINF(x) (((Ieee_double_extract *)&(x))->s.exp == 0x7ff) +#define DOUBLE_ISINF(x) (DOUBLE_ISNANorINF(x) && \ + (((Ieee_double_extract *)&(x))->s.manl == 0) && \ + (((Ieee_double_extract *)&(x))->s.manh == 0)) +#define DOUBLE_ISNAN(x) (DOUBLE_ISNANorINF(x) && \ + ((((Ieee_double_extract *)&(x))->s.manl != 0) || \ + (((Ieee_double_extract *)&(x))->s.manh != 0))) + +/* bit 31 of _mpfr_size is used for sign, + bit 30 of _mpfr_size is used for Nan flag, + bit 29 of _mpfr_size is used for Inf flag, + remaining bits are used to store the number of allocated limbs */ +#define MPFR_CLEAR_FLAGS(x) (((x) -> _mpfr_size &= ~(3 << 29))) +#define MPFR_IS_NAN(x) (((x)->_mpfr_size >> 30)&1) +#define MPFR_SET_NAN(x) ((x)->_mpfr_size |= (1<<30)) +#define MPFR_IS_INF(x) (((x)->_mpfr_size >> 29)&1) +#define MPFR_SET_INF(x) ((x)->_mpfr_size |= (1<<29)) +#define MPFR_RESET_INF(x) ((x)->_mpfr_size &= (~0 - (1<<29))) +#define MPFR_IS_FP(x) ((((x) -> _mpfr_size >> 29) & 3) == 0) +#define MPFR_ABSSIZE(x) ((x)->_mpfr_size & ((1<<29)-1)) +#define MPFR_SIZE(x) ((x)->_mpfr_size) +#define MPFR_EXP(x) ((x)->_mpfr_exp) +#define MPFR_MANT(x) ((x)->_mpfr_d) +#define MPFR_SIGN(x) (((x)->_mpfr_size >> 31) ? -1 : 1) +#define MPFR_ISNONNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)>=0) +#define MPFR_ISNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)==-1) +#define MPFR_CHANGE_SIGN(x) (MPFR_SIZE(x) ^= (((mp_size_t)1)<<31)) +#define MPFR_SET_SAME_SIGN(x, y) if (MPFR_SIGN((x)) != MPFR_SIGN((y))) { MPFR_CHANGE_SIGN((x)); } +#define MPFR_PREC(x) ((x)->_mpfr_prec) +#define MPFR_NOTZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB]) +#define MPFR_IS_ZERO(x) ((MPFR_NOTZERO(x))==0) +#define MPFR_SET_ZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] = 0) +#define mpfr_sgn(x) ((MPFR_NOTZERO(x)) ? MPFR_SIGN(x) : 0) -/* return double m*2^e */ -double dbl(m,e) double m; int e; -{ - if (e>=0) while (e-->0) m *= 2.0; - else while (e++<0) m /= 2.0; - return m; +/* Memory gestion */ + +/* temporary allocate s limbs at xp, and initialize mpfr variable x */ +#define MPFR_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ + MPFR_PREC(x) = p; MPFR_MANT(x) = xp; MPFR_SIZE(x) = s; MPFR_EXP(x) = 0; +/* same when xp is already allocated */ +#define MPFR_INIT1(xp, x, p, s) \ + MPFR_PREC(x)=p; MPFR_MANT(x)=xp; MPFR_SIZE(x)=s; + +#ifndef _PROTO +#if defined (__STDC__) || defined (__cplusplus) +#define _PROTO(x) x +#else +#define _PROTO(x) () +#endif +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +int mpfr_round_raw _PROTO ((mp_limb_t *, mp_limb_t *, mp_prec_t, int, + mp_prec_t, mp_rnd_t)); +int mpfr_round_raw2 _PROTO((mp_limb_t *, mp_prec_t, int, mp_rnd_t, mp_prec_t)); +int mpfr_can_round_raw _PROTO ((mp_limb_t *, mp_prec_t, int, mp_prec_t, + mp_rnd_t, mp_rnd_t, mp_prec_t)); +double mpfr_get_d2 _PROTO ((mpfr_srcptr, long)); +mp_size_t mpn_sqrtrem_new _PROTO ((mp_limb_t *, mp_limb_t *, mp_limb_t *, mp_size_t)); +void mpfr_set4 _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t, int)); +int mpfr_cmp3 _PROTO ((mpfr_srcptr, mpfr_srcptr, long int)); +int mpfr_cmp2 _PROTO ((mpfr_srcptr, mpfr_srcptr)); + +#if defined (__cplusplus) } +#endif + @@ -21,14 +21,6 @@ MA 02111-1307, USA. */ #include <stdio.h> -/* Cygnus does not know about *rand48 functions */ -#ifdef __CYGWIN32__ -#define mrand48 rand -#define drand48 rand -#define lrand48 rand -#define srand48 srand -#endif - /* Definition of rounding modes */ #define GMP_RNDN 0 @@ -36,41 +28,37 @@ MA 02111-1307, USA. */ #define GMP_RNDU 2 #define GMP_RNDD 3 -/* Definition of constants */ - -#define LOG2 0.69314718055994528622 /* log(2) rounded to zero on 53 bits */ - /* Definitions of types and their semantics */ typedef unsigned long int mp_prec_t; /* easy to change if necessary */ typedef int mp_rnd_t; /* preferred to char */ typedef struct { - mp_prec_t _mp_prec; /* WARNING : for the mpfr type, the precision */ + mp_prec_t _mpfr_prec; /* WARNING : for the mpfr type, the precision */ /* should be understood as the number of BITS,*/ /* not the number of mp_limb_t's. This means */ /* that the corresponding number of allocated limbs is >= ceil(_mp_prec/BITS_PER_MP_LIMB) */ - mp_size_t _mp_size; /* MPFR_ABSSIZE(.) is the number of allocated + mp_size_t _mpfr_size; /* MPFR_ABSSIZE(.) is the number of allocated limbs the field _mp_d points to. - The sign is that of _mp_size. + The sign is that of _mpfr_size. The number 0 is such that _mp_d[k-1]=0 where k = ceil(_mp_prec/BITS_PER_MP_LIMB) */ - mp_exp_t _mp_exp; - mp_limb_t *_mp_d; + mp_exp_t _mpfr_exp; + mp_limb_t *_mpfr_d; } __mpfr_struct; /* The number represented is - sign(_mp_size)*(_mp_d[k-1]/B+_mp_d[k-2]/B^2+...+_mp_d[0]/B^k)*2^_mp_exp + sign(_mpfr_size)*(_mpfr_d[k-1]/B+_mpfr_d[k-2]/B^2+...+_mpfr_d[0]/B^k)*2^_mpfr_exp where k=ceil(_mp_prec/BITS_PER_MP_LIMB) and B=2^BITS_PER_MP_LIMB. For the msb (most significant bit) normalized representation, we must have - _mp_d[k-1]>=B/2, unless the number is zero (in that case its sign is still - given by sign(_mp_size)). + _mpfr_d[k-1]>=B/2, unless the number is zero (in that case its sign is still + given by sign(_mpfr_size)). We must also have the last k*BITS_PER_MP_LIMB-_mp_prec bits set to zero. */ @@ -79,18 +67,6 @@ typedef __mpfr_struct mpfr_t[1]; typedef __mpfr_struct *mpfr_ptr; typedef __gmp_const __mpfr_struct *mpfr_srcptr; -/* macros for doubles, based on gmp union ieee_double_extract */ - -typedef union ieee_double_extract Ieee_double_extract; - -#define DOUBLE_ISNANorINF(x) (((Ieee_double_extract *)&(x))->s.exp == 0x7ff) -#define DOUBLE_ISINF(x) (DOUBLE_ISNANorINF(x) && \ - (((Ieee_double_extract *)&(x))->s.manl == 0) && \ - (((Ieee_double_extract *)&(x))->s.manh == 0)) -#define DOUBLE_ISNAN(x) (DOUBLE_ISNANorINF(x) && \ - ((((Ieee_double_extract *)&(x))->s.manl != 0) || \ - (((Ieee_double_extract *)&(x))->s.manh != 0))) - /* Prototypes */ #ifndef _PROTO @@ -101,58 +77,20 @@ typedef union ieee_double_extract Ieee_double_extract; #endif #endif -/* bit 31 of _mp_size is used for sign, - bit 30 of _mp_size is used for Nan flag, - bit 29 of _mp_size is used for Inf flag, - remaining bits are used to store the number of allocated limbs */ -#define MPFR_CLEAR_FLAGS(x) (((x) -> _mp_size &= ~(3 << 29))) -#define MPFR_IS_NAN(x) (((x)->_mp_size >> 30)&1) -#define MPFR_SET_NAN(x) ((x)->_mp_size |= (1<<30)) -#define MPFR_IS_INF(x) (((x)->_mp_size >> 29)&1) -#define MPFR_SET_INF(x) ((x)->_mp_size |= (1<<29)) -#define MPFR_RESET_INF(x) ((x)->_mp_size &= (~0 - (1<<29))) -#define MPFR_IS_FP(x) ((((x) -> _mp_size >> 29) & 3) == 0) -#define MPFR_ABSSIZE(x) ((x)->_mp_size & ((1<<29)-1)) -#define MPFR_SIZE(x) ((x)->_mp_size) -#define MPFR_EXP(x) ((x)->_mp_exp) -#define MPFR_MANT(x) ((x)->_mp_d) -#define MPFR_SIGN(x) (((x)->_mp_size >> 31) ? -1 : 1) -#define MPFR_ISNONNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)>=0) -#define MPFR_ISNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x)==-1) -#define MPFR_CHANGE_SIGN(x) (MPFR_SIZE(x) ^= (((mp_size_t)1)<<31)) -#define MPFR_SET_SAME_SIGN(x, y) if (MPFR_SIGN((x)) != MPFR_SIGN((y))) { MPFR_CHANGE_SIGN((x)); } -#define MPFR_PREC(x) ((x)->_mp_prec) -#define MPFR_NOTZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB]) -#define MPFR_IS_ZERO(x) ((MPFR_NOTZERO(x))==0) -#define MPFR_SET_ZERO(x) (MPFR_MANT(x)[(MPFR_PREC(x)-1)/BITS_PER_MP_LIMB] = 0) -#define mpfr_sgn(x) ((MPFR_NOTZERO(x)) ? MPFR_SIGN(x) : 0) - -/* reallocates the mantissa of x to q bits and sets the precision to q */ -#define _mpfr_realloc(x, q) { \ - (x)->_mp_d = (mp_ptr) (*_mp_reallocate_func) \ - ((x)->_mp_d, (MPFR_PREC(x)-1)>>3, (q+7)>>3); \ - MPFR_PREC(x) = q; } - #if defined (__cplusplus) extern "C" { #endif void mpfr_init2 _PROTO ((mpfr_ptr, mp_prec_t)); void mpfr_init _PROTO ((mpfr_ptr)); -int mpfr_round_raw _PROTO ((mp_limb_t *, mp_limb_t *, mp_prec_t, int, - mp_prec_t, mp_rnd_t)); -int mpfr_round_raw2 _PROTO((mp_limb_t *, mp_prec_t, int, mp_rnd_t, mp_prec_t)); void mpfr_round _PROTO ((mpfr_ptr, mp_rnd_t, mp_prec_t)); int mpfr_can_round _PROTO ((mpfr_ptr, mp_prec_t, mp_rnd_t, mp_rnd_t, mp_prec_t)); -int mpfr_can_round_raw _PROTO ((mp_limb_t *, mp_prec_t, int, mp_prec_t, - mp_rnd_t, mp_rnd_t, mp_prec_t)); void mpfr_set_d _PROTO ((mpfr_ptr, double, mp_rnd_t)); int mpfr_set_z _PROTO ((mpfr_ptr, mpz_srcptr, mp_rnd_t)); mp_exp_t mpz_set_fr _PROTO ((mpz_ptr, mpfr_srcptr)); void mpfr_set_q _PROTO ((mpfr_ptr, mpq_srcptr, mp_rnd_t)); double mpfr_get_d _PROTO ((mpfr_srcptr)); -double mpfr_get_d2 _PROTO ((mpfr_srcptr, long)); void mpfr_set_f _PROTO ((mpfr_ptr, mpf_srcptr, mp_rnd_t)); void mpfr_set_si _PROTO ((mpfr_ptr, long, mp_rnd_t)); void mpfr_set_ui _PROTO ((mpfr_ptr, unsigned long, mp_rnd_t)); @@ -166,15 +104,12 @@ void mpfr_set_str_raw _PROTO ((mpfr_ptr, char *)); int mpfr_set_str _PROTO ((mpfr_ptr, char *, int, mp_rnd_t)); int mpfr_init_set_str _PROTO ((mpfr_ptr, char *, int, mp_rnd_t)); size_t mpfr_inp_str _PROTO ((mpfr_ptr, FILE *, int, mp_rnd_t)); -void mpfr_get_str_raw _PROTO ((char *, mpfr_srcptr)); char* mpfr_get_str _PROTO ((char *, mp_exp_t *, int, size_t, mpfr_srcptr, mp_rnd_t)); size_t mpfr_out_str _PROTO ((FILE *, int, size_t, mpfr_srcptr, mp_rnd_t)); void mpfr_mul _PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t)); int mpfr_pow_ui _PROTO ((mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t)); int mpfr_ui_pow_ui _PROTO ((mpfr_ptr, unsigned long int, unsigned long int, mp_rnd_t)); -mp_limb_t mpn_divrem_n _PROTO ((mp_limb_t *, mp_limb_t *, mp_limb_t *, mp_size_t)); -mp_size_t mpn_sqrtrem_new _PROTO ((mp_limb_t *, mp_limb_t *, mp_limb_t *, mp_size_t)); void mpfr_div _PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t)); void mpfr_agm _PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t)); int mpfr_sqrt _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); @@ -186,19 +121,15 @@ void mpfr_add_one_ulp _PROTO ((mpfr_ptr)); void mpfr_sub _PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t)); void mpfr_ui_sub _PROTO ((mpfr_ptr, unsigned long, mpfr_srcptr, mp_rnd_t)); void mpfr_reldiff _PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t)); -void mpfr_set4 _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t, int)); void mpfr_const_pi _PROTO ((mpfr_ptr, mp_rnd_t)); void mpfr_const_log2 _PROTO ((mpfr_ptr, mp_rnd_t)); int mpfr_log _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); int mpfr_exp _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); -int mpfr_zeta _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); int mpfr_sin_cos _PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr, mp_rnd_t)); void mpfr_mul_ui _PROTO((mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t)); void mpfr_set_machine_rnd_mode _PROTO ((mp_rnd_t)); -int mpfr_cmp3 _PROTO ((mpfr_srcptr, mpfr_srcptr, long int)); int mpfr_cmp_ui_2exp _PROTO ((mpfr_srcptr, unsigned long int, int)); int mpfr_cmp_si_2exp _PROTO ((mpfr_srcptr, long int, int)); -int mpfr_cmp2 _PROTO ((mpfr_srcptr, mpfr_srcptr)); void mpfr_mul_2exp _PROTO((mpfr_ptr, mpfr_srcptr, unsigned long int,mp_rnd_t)); void mpfr_div_2exp _PROTO((mpfr_ptr, mpfr_srcptr, unsigned long int,mp_rnd_t)); void mpfr_set_prec _PROTO((mpfr_ptr, mp_prec_t)); @@ -213,12 +144,13 @@ int mpfr_div_ui _PROTO((mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t)); void mpfr_ui_div _PROTO((mpfr_ptr, unsigned long int, mpfr_srcptr, mp_rnd_t)); mp_prec_t mpfr_get_prec _PROTO((mpfr_srcptr)); void mpfr_set_default_rounding_mode _PROTO((mp_rnd_t)); -int mpfr_eq(mpfr_srcptr, mpfr_srcptr, unsigned long); +int mpfr_eq _PROTO((mpfr_srcptr, mpfr_srcptr, unsigned long)); void mpfr_floor _PROTO((mpfr_ptr, mpfr_srcptr)); void mpfr_trunc _PROTO((mpfr_ptr, mpfr_srcptr)); void mpfr_ceil _PROTO((mpfr_ptr, mpfr_srcptr)); void mpfr_extract _PROTO((mpz_ptr, mpfr_srcptr, unsigned int)); void mpfr_swap _PROTO((mpfr_ptr, mpfr_ptr)); +void mpfr_dump _PROTO((mpfr_srcptr, mp_rnd_t)); #if defined (__cplusplus) } @@ -230,12 +162,6 @@ void mpfr_swap _PROTO((mpfr_ptr, mpfr_ptr)); #define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1) #define mpfr_cmp(b,c) mpfr_cmp3(b,c,1) -#if (BITS_PER_MP_LIMB==32) -#define MPFR_LIMBS_PER_DOUBLE 2 -#elif (BITS_PER_MP_LIMB==64) -#define MPFR_LIMBS_PER_DOUBLE 1 -#endif - #define mpfr_init_set_si(x, i, rnd) \ do { mpfr_init(x); mpfr_set_si((x), (i), (rnd)); } while (0) #define mpfr_init_set_ui(x, i, rnd) \ @@ -246,4 +172,3 @@ void mpfr_swap _PROTO((mpfr_ptr, mpfr_ptr)); do { mpfr_init(x); mpfr_set((x), (y), (rnd)); } while (0) #define mpfr_init_set_f(x, y, rnd) \ do { mpfr_init(x); mpfr_set_f((x), (y), (rnd)); } while (0) - @@ -1089,6 +1089,7 @@ Negative random numbers are generated when @var{max_size} is negative. These functions were mainly designed for the implementation of @code{mpfr}, but may be useful for users too. +You need to include @code{mpfr-impl.h} to use them. @deftypefun Macro int MPFR_IS_NAN (mpfr_t x) Returns a non-zero value iff its argument is @samp{Not a Number}. diff --git a/mpz_set_fr.c b/mpz_set_fr.c index 7bd61e852..480f9d41c 100644 --- a/mpz_set_fr.c +++ b/mpz_set_fr.c @@ -20,9 +20,10 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* puts the mantissa of f into z, and returns 'exp' such that f = z * 2^exp */ @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* Remains to do: - do not use all bits of b and c when MPFR_PREC(b)>MPFR_PREC(a) or MPFR_PREC(c)>MPFR_PREC(a) diff --git a/mul_2exp.c b/mul_2exp.c index 6f62cde01..e1d030751 100644 --- a/mul_2exp.c +++ b/mul_2exp.c @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -21,9 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -22,13 +22,13 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" #include "mpfr.h" -#include "gmp-impl.h" +#include "mpfr-impl.h" void #if __STDC__ -mpfr_neg(mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) +mpfr_neg (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) #else -mpfr_neg(a, b, rnd_mode) +mpfr_neg (a, b, rnd_mode) mpfr_ptr a; mpfr_srcptr b; mp_rnd_t rnd_mode; @@ -23,8 +23,9 @@ MA 02111-1307, USA. */ #include <math.h> #include <string.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" size_t #if __STDC__ @@ -22,10 +22,13 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <math.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" +int mpfr_aux_pi (mpfr_ptr, mpz_srcptr, int, int); +int mpfr_pi_machin3 (mpfr_ptr, mp_rnd_t); #define A #define A1 1 @@ -42,9 +45,9 @@ MA 02111-1307, USA. */ int #if __STDC__ -mpfr_pi_machin3(mpfr_ptr mylog, mp_rnd_t rnd_mode) +mpfr_pi_machin3 (mpfr_ptr mylog, mp_rnd_t rnd_mode) #else -mpfr_pi_machin3(mylog, rnd_mode) +mpfr_pi_machin3 (mylog, rnd_mode) mpfr_ptr mylog; mp_rnd_t rnd_mode; #endif @@ -24,6 +24,7 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" #include "mpfr.h" +#include "mpfr-impl.h" /* sets x to y^n, and returns ceil(log2(max ulp error)) */ int diff --git a/print_raw.c b/print_raw.c index e37ba56fa..38c1a4f59 100644 --- a/print_raw.c +++ b/print_raw.c @@ -22,14 +22,17 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" + +void mpfr_get_str_raw (char *, mpfr_srcptr); void #if __STDC__ -mpfr_get_str_raw(char *digit_ptr, mpfr_srcptr x) +mpfr_get_str_raw (char *digit_ptr, mpfr_srcptr x) #else -mpfr_get_str_raw(digit_ptr, x) +mpfr_get_str_raw (digit_ptr, x) char *digit_ptr; mpfr_srcptr x; #endif @@ -21,9 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* Computes a random mpfr in [0, 1[ with precision MPFR_PREC */ @@ -23,22 +23,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" - - -#if defined (__hpux) || defined (__alpha) || defined (__svr4__) || defined (__SVR4) -/* HPUX lacks random(). DEC OSF/1 1.2 random() returns a double. */ -long mrand48 (); -static long -random () -{ - return mrand48 (); -} -#else -long random (); -#endif +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -50,7 +38,9 @@ mpfr_random2 (x, size, exp) mp_exp_t exp; #endif { - mp_size_t xn; unsigned long cnt; mp_ptr xp = MPFR_MANT(x); + mp_size_t xn; + unsigned long cnt; + mp_ptr xp = MPFR_MANT(x), yp[1]; mp_size_t prec = (MPFR_PREC(x) - 1)/BITS_PER_MP_LIMB; MPFR_CLEAR_FLAGS(x); @@ -63,8 +53,12 @@ mpfr_random2 (x, size, exp) mpn_random2 (xp, xn); } - if (exp != 0) - exp = random () % (2 * exp) - exp; + if (exp != 0) { + /* use mpn_random instead of random since that function is not + available on all platforms (for example HPUX, DEC OSF, ...) */ + mpn_random ((mp_limb_t*) yp, 1); + exp = (mp_exp_t) yp[0] % (2 * exp) - exp; + } count_leading_zeros(cnt, xp[xn - 1]); if (cnt) mpn_lshift(xp, xp, xn, cnt); @@ -22,12 +22,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" - -#ifdef Exp -#include "longlong.h" -#endif +#include "mpfr.h" +#include "mpfr-impl.h" /* returns 0 if round(sign*xp[0..xn-1], prec, rnd) = round(sign*xp[0..xn-1], prec, GMP_RNDZ), 1 otherwise, @@ -133,11 +130,6 @@ mpfr_round_raw(y, xp, xprec, negative, yprec, rnd_mode) xsize = (xprec-1)/BITS_PER_MP_LIMB + 1; -#ifdef Exp - count_leading_zeros(flag, xp[xsize-1]); - yprec += flag; -#endif - nw = yprec / BITS_PER_MP_LIMB; rw = yprec & (BITS_PER_MP_LIMB - 1); if (rw) nw++; /* number of words needed to represent x */ @@ -21,14 +21,15 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ -mpfr_set4(mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode, int signb) +mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode, int signb) #else -mpfr_set4(a, b, rnd_mode, signb) +mpfr_set4 (a, b, rnd_mode, signb) mpfr_ptr a; mpfr_srcptr b; mp_rnd_t rnd_mode; @@ -21,10 +21,19 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "gmp-mparam.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" + +#if (BITS_PER_MP_LIMB==32) +#define MPFR_LIMBS_PER_DOUBLE 2 +#elif (BITS_PER_MP_LIMB==64) +#define MPFR_LIMBS_PER_DOUBLE 1 +#endif + +int __mpfr_extract_double (mp_ptr, double, int); +double __mpfr_scale2 (double, int); #define NaN (0./0.) /* ensures a machine-independent NaN */ #define Infp (1/0.) @@ -21,9 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ diff --git a/set_prc_raw.c b/set_prc_raw.c index eaf4c4723..b7a1633dd 100644 --- a/set_prc_raw.c +++ b/set_prc_raw.c @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ diff --git a/set_prec.c b/set_prec.c index 4225aa378..17adb5bb2 100644 --- a/set_prec.c +++ b/set_prec.c @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -20,9 +20,10 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* set f to the rational q */ void @@ -21,15 +21,16 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ -mpfr_set_si(mpfr_ptr x, long int i, mp_rnd_t rnd_mode) +mpfr_set_si (mpfr_ptr x, long int i, mp_rnd_t rnd_mode) #else -mpfr_set_si(x, i, rnd_mode) +mpfr_set_si (x, i, rnd_mode) mpfr_ptr x; long int i; mp_rnd_t rnd_mode; @@ -69,11 +70,11 @@ mpfr_set_si(x, i, rnd_mode) void #if __STDC__ -mpfr_set_ui(mpfr_ptr x, unsigned long int i, mp_rnd_t rnd_mode) +mpfr_set_ui (mpfr_ptr x, unsigned long int i, mp_rnd_t rnd_mode) #else -mpfr_set_ui(x, i, rnd_mode) +mpfr_set_ui (x, i, rnd_mode) mpfr_ptr x; - long int i; + unsigned long int i; mp_rnd_t rnd_mode; #endif { @@ -28,9 +28,10 @@ MA 02111-1307, USA. */ #include <strings.h> #endif #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" int #if __STDC__ diff --git a/set_str_raw.c b/set_str_raw.c index 43a62a35c..e00645cef 100644 --- a/set_str_raw.c +++ b/set_str_raw.c @@ -27,9 +27,10 @@ MA 02111-1307, USA. */ #include <strings.h> #endif #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* Currently the number should be of the form +/- xxxx.xxxxxxEyy, with decimal exponent. The mantissa of x is supposed to be large enough @@ -127,8 +128,8 @@ mpfr_set_str_raw (x, str) count_leading_zeros(cnt, xp[xsize - 1]); if (cnt) mpn_lshift(xp, xp, xsize, cnt); - x -> _mp_exp = expn - cnt; - x -> _mp_size = xsize; if (negative) MPFR_CHANGE_SIGN(x); + MPFR_EXP(x) = expn - cnt; + MPFR_SIZE(x) = xsize; if (negative) MPFR_CHANGE_SIGN(x); (*_mp_free_func) (str0, alloc); @@ -20,9 +20,10 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* set f to the integer z */ int @@ -23,8 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" int mpfr_sin_aux (mpfr_ptr, mpz_srcptr, int, int); int mpfr_cos_aux (mpfr_ptr, mpz_srcptr, int, int); @@ -100,7 +101,7 @@ mp_rnd_t rnd_mode; ((double) (MPFR_PREC(x)) / (double) BITS_PER_MP_LIMB) /LOG2); ttt = MPFR_EXP(x); - mpfr_init2(x_copy,MPFR_PREC(x)); + mpfr_init2(x_copy, MPFR_PREC(x)); mpfr_set(x_copy,x,GMP_RNDD); mpz_init(square); /* on fait le shift pour que le nombre soit inferieur a 1 */ @@ -217,8 +218,8 @@ mp_rnd_t rnd_mode; goto try_again; } } - if (mpfr_can_round(tmp_sin, realprec, GMP_RNDD, rnd_mode, PREC(sinus)) && - mpfr_can_round(tmp_cos, realprec, GMP_RNDD, rnd_mode, PREC(cosinus))) { + if (mpfr_can_round(tmp_sin, realprec, GMP_RNDD, rnd_mode, MPFR_PREC(sinus)) && + mpfr_can_round(tmp_cos, realprec, GMP_RNDD, rnd_mode, MPFR_PREC(cosinus))) { mpfr_set(sinus, tmp_sin, rnd_mode); mpfr_set(cosinus, tmp_cos, rnd_mode); good = 1; @@ -23,8 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ @@ -229,7 +230,7 @@ mpfr_sqrt (r, u, rnd_mode) if (cc) { mpn_rshift(rp, rp, rrsize, 1); rp[rrsize-1] |= (mp_limb_t) 1 << (BITS_PER_MP_LIMB-1); - r->_mp_exp++; + MPFR_EXP(r)++; } fin: @@ -19,16 +19,14 @@ along with the MPFR 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. */ -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; - #include <math.h> #include <stdio.h> #include <stdlib.h> #include "gmp.h" #include "gmp-impl.h" -#include "mpfr.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" int #if __STDC__ @@ -42,20 +40,16 @@ mpfr_sqrt_ui (r, u, rnd_mode) { int error = 0; mpfr_t uu; - mp_limb_t *up; + mp_limb_t up[1]; unsigned long cnt; - TMP_DECL(marker); if (u) { /* if u=0, do nothing */ - TMP_MARK(marker); - MON_INIT(up, uu, BITS_PER_MP_LIMB, 1); + MPFR_INIT1(up, uu, BITS_PER_MP_LIMB, 1); count_leading_zeros(cnt, (mp_limb_t) u); *up = (mp_limb_t) u << cnt; MPFR_EXP(uu) = BITS_PER_MP_LIMB-cnt; error = mpfr_sqrt(r, uu, rnd_mode); - - TMP_FREE(marker); } else { MPFR_CLEAR_FLAGS(r); @@ -25,6 +25,11 @@ MA 02111-1307, USA. */ #include "gmp-impl.h" #include "longlong.h" +mp_size_t mpn_sqrtrem1 (mp_ptr, mp_ptr, mp_srcptr); +mp_limb_t mpn_sqrtrem2 (mp_ptr, mp_ptr, mp_srcptr); +mp_limb_t mpn_dq_sqrtrem (mp_ptr, mp_ptr, mp_size_t); +mp_size_t mpn_sqrtrem_new (mp_ptr, mp_ptr, mp_srcptr, mp_size_t); + /* table generated by isqrt(2^8*i) $ i=64..255 in MuPAD */ static const unsigned char approx_tab[192] = { 128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, @@ -21,8 +21,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" /* #define DEBUG */ @@ -21,12 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" - -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -40,9 +38,8 @@ mpfr_sub_ui (y, x, u, rnd_mode) #endif { mpfr_t uu; - mp_limb_t *up; + mp_limb_t up[1]; unsigned long cnt; - TMP_DECL(marker); if (MPFR_IS_NAN(x)) { MPFR_SET_NAN(y); @@ -56,14 +53,11 @@ mpfr_sub_ui (y, x, u, rnd_mode) } if (u) { /* if u=0, do nothing */ - TMP_MARK(marker); - MON_INIT(up, uu, BITS_PER_MP_LIMB, 1); + MPFR_INIT1(up, uu, BITS_PER_MP_LIMB, 1); count_leading_zeros(cnt, (mp_limb_t) u); *up = (mp_limb_t) u << cnt; MPFR_EXP(uu) = BITS_PER_MP_LIMB-cnt; mpfr_sub (y, x, uu, rnd_mode); - - TMP_FREE(marker); } } @@ -21,7 +21,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "mpfr.h" -#include "gmp-impl.h" +#include "mpfr-impl.h" void #if __STDC__ diff --git a/tests/Makefile.in b/tests/Makefile.in index dc1509bd2..5b527527f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 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. @@ -11,7 +11,7 @@ # PARTICULAR PURPOSE. -SHELL = @SHELL@ +SHELL = /bin/sh srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -32,7 +32,7 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = +DISTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -46,7 +46,7 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ @@ -66,10 +66,10 @@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ -check_PROGRAMS = tabs tadd tagm tcan_round tcmp tcmp_ui tdiv tdiv_ui tdump texp tget_str tlog tlog2 tmul tmul_2exp tmul_ui tout_str tpi tround tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tzeta tsin_cos tswap +check_PROGRAMS= tabs tadd tagm tcan_round tcmp tcmp_ui tdiv tdiv_ui tdump texp tget_str tlog tlog2 tmul tmul_2exp tmul_ui tout_str tpi tround tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tsin_cos tswap -LDADD = $(top_builddir)/libmpfr.a @LDADD@ -INCLUDES = @INCLUDES@ -I$(top_srcdir) +LDADD= $(top_builddir)/libmpfr.a @LDADD@ +INCLUDES=@INCLUDES@ -I$(top_srcdir) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = @@ -221,11 +221,6 @@ tui_sub_OBJECTS = tui_sub.o tui_sub_LDADD = $(LDADD) tui_sub_DEPENDENCIES = $(top_builddir)/libmpfr.a tui_sub_LDFLAGS = -tzeta_SOURCES = tzeta.c -tzeta_OBJECTS = tzeta.o -tzeta_LDADD = $(LDADD) -tzeta_DEPENDENCIES = $(top_builddir)/libmpfr.a -tzeta_LDFLAGS = tsin_cos_SOURCES = tsin_cos.c tsin_cos_OBJECTS = tsin_cos.o tsin_cos_LDADD = $(LDADD) @@ -236,16 +231,15 @@ tswap_OBJECTS = tswap.o tswap_LDADD = $(LDADD) tswap_DEPENDENCIES = $(top_builddir)/libmpfr.a tswap_LDFLAGS = -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar -GZIP_ENV = --best +GZIP = --best DEP_FILES = .deps/tabs.P .deps/tadd.P .deps/tagm.P .deps/tcan_round.P \ .deps/tcmp.P .deps/tcmp_ui.P .deps/tdiv.P .deps/tdiv_ui.P .deps/tdump.P \ .deps/texp.P .deps/tget_str.P .deps/tlog.P .deps/tlog2.P .deps/tmul.P \ @@ -253,14 +247,15 @@ DEP_FILES = .deps/tabs.P .deps/tadd.P .deps/tagm.P .deps/tcan_round.P \ .deps/tround.P .deps/tset_d.P .deps/tset_f.P .deps/tset_q.P \ .deps/tset_si.P .deps/tset_str.P .deps/tset_z.P .deps/tsin_cos.P \ .deps/tsqrt.P .deps/tsqrt_ui.P .deps/tswap.P .deps/tui_div.P \ -.deps/tui_sub.P .deps/tzeta.P -SOURCES = tabs.c tadd.c tagm.c tcan_round.c tcmp.c tcmp_ui.c tdiv.c tdiv_ui.c tdump.c texp.c tget_str.c tlog.c tlog2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tpi.c tround.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c tset_z.c tsqrt.c tsqrt_ui.c tui_div.c tui_sub.c tzeta.c tsin_cos.c tswap.c -OBJECTS = tabs.o tadd.o tagm.o tcan_round.o tcmp.o tcmp_ui.o tdiv.o tdiv_ui.o tdump.o texp.o tget_str.o tlog.o tlog2.o tmul.o tmul_2exp.o tmul_ui.o tout_str.o tpi.o tround.o tset_d.o tset_f.o tset_q.o tset_si.o tset_str.o tset_z.o tsqrt.o tsqrt_ui.o tui_div.o tui_sub.o tzeta.o tsin_cos.o tswap.o +.deps/tui_sub.P +SOURCES = tabs.c tadd.c tagm.c tcan_round.c tcmp.c tcmp_ui.c tdiv.c tdiv_ui.c tdump.c texp.c tget_str.c tlog.c tlog2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tpi.c tround.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c tset_z.c tsqrt.c tsqrt_ui.c tui_div.c tui_sub.c tsin_cos.c tswap.c +OBJECTS = tabs.o tadd.o tagm.o tcan_round.o tcmp.o tcmp_ui.o tdiv.o tdiv_ui.o tdump.o texp.o tget_str.o tlog.o tlog2.o tmul.o tmul_2exp.o tmul_ui.o tout_str.o tpi.o tround.o tset_d.o tset_f.o tset_q.o tset_si.o tset_str.o tset_z.o tsqrt.o tsqrt_ui.o tui_div.o tui_sub.o tsin_cos.o tswap.o + +all: Makefile -all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) @@ -409,10 +404,6 @@ tui_sub: $(tui_sub_OBJECTS) $(tui_sub_DEPENDENCIES) @rm -f tui_sub $(LINK) $(tui_sub_LDFLAGS) $(tui_sub_OBJECTS) $(tui_sub_LDADD) $(LIBS) -tzeta: $(tzeta_OBJECTS) $(tzeta_DEPENDENCIES) - @rm -f tzeta - $(LINK) $(tzeta_LDFLAGS) $(tzeta_OBJECTS) $(tzeta_LDADD) $(LIBS) - tsin_cos: $(tsin_cos_OBJECTS) $(tsin_cos_DEPENDENCIES) @rm -f tsin_cos $(LINK) $(tsin_cos_LDFLAGS) $(tsin_cos_OBJECTS) $(tsin_cos_LDADD) $(LIBS) @@ -424,12 +415,8 @@ tswap: $(tswap_OBJECTS) $(tswap_DEPENDENCIES) tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ @@ -462,13 +449,9 @@ distdir: $(DISTFILES) && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tests/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ done DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) @@ -480,99 +463,81 @@ mostlyclean-depend: clean-depend: distclean-depend: - -rm -rf .deps maintainer-clean-depend: + -rm -rf .deps %.o: %.c @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp + $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< %.lo: %.c @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile -all-redirect: all-am + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p +info: +dvi: +check: all $(check_PROGRAMS) + $(MAKE) +installcheck: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: -mostlyclean-am: mostlyclean-checkPROGRAMS mostlyclean-compile \ + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-checkPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic -mostlyclean: mostlyclean-am - -clean-am: clean-checkPROGRAMS clean-compile clean-tags clean-depend \ - clean-generic mostlyclean-am +clean: clean-checkPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean -clean: clean-am +distclean: distclean-checkPROGRAMS distclean-compile distclean-tags \ + distclean-depend distclean-generic clean + -rm -f config.status -distclean-am: distclean-checkPROGRAMS distclean-compile distclean-tags \ - distclean-depend distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-checkPROGRAMS \ +maintainer-clean: maintainer-clean-checkPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-depend maintainer-clean-generic \ - distclean-am + distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -maintainer-clean: maintainer-clean-am - .PHONY: mostlyclean-checkPROGRAMS distclean-checkPROGRAMS \ clean-checkPROGRAMS maintainer-clean-checkPROGRAMS mostlyclean-compile \ distclean-compile clean-compile maintainer-clean-compile tags \ mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ distdir mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-depend info dvi installcheck install-exec install-data \ +install uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean ../libmpfr.a: diff --git a/tests/tabs.c b/tests/tabs.c index aa0674ba5..341ea516a 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -23,11 +23,9 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> -#endif -#define Infp 1/0. +#include "mpfr-test.h" + +#define Infp (1/0.) extern int isnan(); diff --git a/tests/tadd.c b/tests/tadd.c index 120d494f2..1f7e8249d 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -27,8 +27,8 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "mpfr.h" #include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> +#ifdef TEST +#include "mpfr-test.h" #endif extern int isnan(); diff --git a/tests/tagm.c b/tests/tagm.c index e4604d4fc..91024d252 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -26,7 +26,7 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" +#include "mpfr-test.h" extern int isnan(); diff --git a/tests/tcmp.c b/tests/tcmp.c index d8524e496..c629ad66a 100644 --- a/tests/tcmp.c +++ b/tests/tcmp.c @@ -25,7 +25,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "longlong.h" #include "mpfr.h" -#include "mpfr-impl.h" +#include "mpfr-test.h" #define Infp 1/0. #define Infm -1/0. diff --git a/tests/tdiv.c b/tests/tdiv.c index 48744ece8..eced8a415 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -26,10 +26,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> -#endif +#include "mpfr-test.h" extern int isnan(); diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index eeb5e37a3..3fb9d451f 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -25,8 +25,7 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" -#include "time.h" +#include "mpfr-test.h" extern int isnan(); @@ -54,6 +53,7 @@ void check(double d, unsigned long u, unsigned char rnd, double e) int main(int argc, char **argv) { + mpfr_t x; #ifdef TEST int i; unsigned long u; double d; @@ -64,7 +64,6 @@ main(int argc, char **argv) check(d, u, rand() % 4, 0.0); } #endif - mpfr_t x; check(1.0, 3, GMP_RNDN, 3.3333333333333331483e-1); check(1.0, 3, GMP_RNDZ, 3.3333333333333331483e-1); diff --git a/tests/tget_str.c b/tests/tget_str.c index 8437bba79..089803713 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -26,10 +26,11 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" -#include <time.h> +#ifdef TEST +#include "mpfr-test.h" +#endif -void check(d, rnd) double d; unsigned char rnd; +void check (double d, unsigned char rnd) { mpfr_t x; char *str; mp_exp_t e; diff --git a/tests/tlog.c b/tests/tlog.c index 31074e5ba..f47bedd38 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -25,7 +25,7 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" +#include "mpfr-test.h" extern int isnan(); diff --git a/tests/tmul.c b/tests/tmul.c index 315873e1f..d73d13976 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -24,14 +24,16 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" +#ifdef TEST +#include "mpfr-test.h" +#endif #define MINNORM 2.2250738585072013831e-308 /* 2^(-1022), smallest normalized */ /* checks that x*y gives the same results in double and with mpfr with 53 bits of precision */ void check(double x, double y, unsigned int rnd_mode, unsigned int px, -unsigned int py, unsigned int pz, double res) + unsigned int py, unsigned int pz, double res) { double z1, z2; mpfr_t xx, yy, zz; diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c index f00f3d3a1..f5b9490c6 100644 --- a/tests/tmul_2exp.c +++ b/tests/tmul_2exp.c @@ -24,6 +24,7 @@ MA 02111-1307, USA. */ #include <time.h> #include "gmp.h" #include "mpfr.h" +#include "mpfr-impl.h" /* checks that x*y gives the same results in double and with mpfr with 53 bits of precision */ diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index d1d662f08..4a65aab36 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -24,7 +24,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" -#include "time.h" +#include "mpfr-impl.h" int main(int argc, char **argv) diff --git a/tests/tout_str.c b/tests/tout_str.c index 33df9439d..779932b2a 100644 --- a/tests/tout_str.c +++ b/tests/tout_str.c @@ -27,7 +27,7 @@ MA 02111-1307, USA. */ #include <unistd.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" +#include "mpfr-test.h" extern int isnan(); diff --git a/tests/tset_d.c b/tests/tset_d.c index 347cc0888..2ab6eb1b2 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -22,17 +22,14 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include <time.h> -#ifdef __mips -#include <sys/fpu.h> -#endif #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" +#include "mpfr-test.h" extern int isnan(); int -main(int argc, char **argv) +main (int argc, char **argv) { mpfr_t x,y,z; unsigned long k,n; double d, dd; #ifdef __mips diff --git a/tests/tset_si.c b/tests/tset_si.c index ccb14ea48..0d20cbe4c 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -23,6 +23,7 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include "gmp.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "time.h" int diff --git a/tests/tset_str.c b/tests/tset_str.c index 905b36291..677720c93 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -23,13 +23,9 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include "gmp.h" #include "mpfr.h" +#include "mpfr-impl.h" #include <time.h> -#if defined (hpux) -#define srandom srand48 -#define random mrand48 -#endif - int main(int argc, char **argv) { diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 3e949686b..9476966ff 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -25,10 +25,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> -#endif +#include "mpfr-test.h" extern int isnan(), getpid(); @@ -36,7 +33,7 @@ extern int isnan(), getpid(); int maxulp=0; -void check3(a, rnd_mode, Q) double a; unsigned char rnd_mode; double Q; +void check3(double a, unsigned char rnd_mode, double Q) { mpfr_t q; double Q2; int ck,u; diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c index 08115bff1..699314247 100644 --- a/tests/tsqrt_ui.c +++ b/tests/tsqrt_ui.c @@ -25,17 +25,13 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> -#endif +#include "mpfr-test.h" extern int isnan(), getpid(); int maxulp=0; -void check(a, rnd_mode, Q) -unsigned long a; unsigned char rnd_mode; double Q; +void check (unsigned long a, unsigned char rnd_mode, double Q) { mpfr_t q; double Q2; int u, ck; diff --git a/tests/tui_div.c b/tests/tui_div.c index ac94e8654..61dfee92b 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -24,9 +24,8 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> +#ifdef TEST +#include "mpfr-test.h" #endif extern int isnan(); diff --git a/tests/tui_sub.c b/tests/tui_sub.c index eb0fa41ec..d21920450 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -24,9 +24,8 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include "gmp.h" #include "mpfr.h" -#include "mpfr-impl.h" -#ifdef __mips -#include <sys/fpu.h> +#ifdef TEST +#include "mpfr-test.h" #endif extern int isnan(); @@ -22,8 +22,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" +#include "mpfr.h" +#include "mpfr-impl.h" #if MPFR_FLOOR #define _MPFR_FLOOR_OR_CEIL @@ -21,12 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" - -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -40,9 +38,8 @@ mpfr_ui_div (y, u, x, rnd_mode) #endif { mpfr_t uu; - mp_limb_t *up; + mp_limb_t up[1]; unsigned long cnt; - TMP_DECL(marker); if (MPFR_IS_NAN(x)) { @@ -60,15 +57,12 @@ mpfr_ui_div (y, u, x, rnd_mode) } if (u) { - TMP_MARK(marker); - MON_INIT(up, uu, BITS_PER_MP_LIMB, 1); + MPFR_INIT1(up, uu, BITS_PER_MP_LIMB, 1); count_leading_zeros(cnt, (mp_limb_t) u); *up = (mp_limb_t) u << cnt; MPFR_EXP(uu) = BITS_PER_MP_LIMB-cnt; mpfr_div(y, uu, x, rnd_mode); - - TMP_FREE(marker); } else { if (MPFR_IS_ZERO(x)) MPFR_SET_NAN(y); /* 0/0 */ @@ -21,12 +21,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" - -#define MON_INIT(xp, x, p, s) xp = (mp_ptr) TMP_ALLOC(s*BYTES_PER_MP_LIMB); \ - MPFR_PREC(x) = p; MPFR_MANT(x) = xp; x -> _mp_size = s; +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ @@ -40,9 +38,8 @@ mpfr_ui_sub (y, u, x, rnd_mode) #endif { mpfr_t uu; - mp_limb_t *up; + mp_limb_t up[1]; unsigned long cnt; - TMP_DECL(marker); if (MPFR_IS_NAN(x)) { @@ -58,15 +55,12 @@ mpfr_ui_sub (y, u, x, rnd_mode) } if (u) { - TMP_MARK(marker); - MON_INIT(up, uu, BITS_PER_MP_LIMB, 1); + MPFR_INIT1(up, uu, BITS_PER_MP_LIMB, 1); count_leading_zeros(cnt, (mp_limb_t) u); *up = (mp_limb_t) u << cnt; MPFR_EXP(uu) = BITS_PER_MP_LIMB-cnt; mpfr_sub (y, uu, x, rnd_mode); - - TMP_FREE(marker); } else mpfr_neg (y, x, rnd_mode); /* if u=0, then set y to -x */ } diff --git a/urandomb.c b/urandomb.c index e74754211..02d909824 100644 --- a/urandomb.c +++ b/urandomb.c @@ -24,9 +24,10 @@ MA 02111-1307, USA. */ #include <stdio.h> #include "gmp.h" -#include "mpfr.h" #include "gmp-impl.h" #include "longlong.h" +#include "mpfr.h" +#include "mpfr-impl.h" void #if __STDC__ |