summaryrefslogtreecommitdiff
path: root/mpfr/tests
diff options
context:
space:
mode:
Diffstat (limited to 'mpfr/tests')
-rw-r--r--mpfr/tests/Makefile.am2
-rw-r--r--mpfr/tests/Makefile.in229
-rw-r--r--mpfr/tests/reuse.c7
-rw-r--r--mpfr/tests/tabs.c19
-rw-r--r--mpfr/tests/tacos.c95
-rw-r--r--mpfr/tests/tacosh.c6
-rw-r--r--mpfr/tests/tadd.c73
-rw-r--r--mpfr/tests/tagm.c5
-rw-r--r--mpfr/tests/tasin.c4
-rw-r--r--mpfr/tests/tasinh.c2
-rw-r--r--mpfr/tests/tatan.c39
-rw-r--r--mpfr/tests/tatanh.c2
-rw-r--r--mpfr/tests/tcmp.c25
-rw-r--r--mpfr/tests/tcmp2.c102
-rw-r--r--mpfr/tests/tconst_euler.c (renamed from mpfr/tests/teuler.c)4
-rw-r--r--mpfr/tests/tconst_log2.c116
-rw-r--r--mpfr/tests/tconst_pi.c (renamed from mpfr/tests/tpi.c)0
-rw-r--r--mpfr/tests/tcos.c17
-rw-r--r--mpfr/tests/tcosh.c2
-rw-r--r--mpfr/tests/tdiv.c75
-rw-r--r--mpfr/tests/tdiv_ui.c33
-rw-r--r--mpfr/tests/tdump.c10
-rw-r--r--mpfr/tests/teq.c5
-rw-r--r--mpfr/tests/texceptions.c4
-rw-r--r--mpfr/tests/texp.c53
-rw-r--r--mpfr/tests/texp2.c4
-rw-r--r--mpfr/tests/texpm1.c2
-rw-r--r--mpfr/tests/tfactorial.c6
-rw-r--r--mpfr/tests/tfma.c16
-rw-r--r--mpfr/tests/tgeneric.c8
-rw-r--r--mpfr/tests/tget_d.c92
-rw-r--r--mpfr/tests/tget_str.c21
-rw-r--r--mpfr/tests/thyperbolic.c36
-rw-r--r--mpfr/tests/thypot.c10
-rw-r--r--mpfr/tests/tlog.c10
-rw-r--r--mpfr/tests/tlog10.c (renamed from mpfr/tests/tlog_base_10.c)2
-rw-r--r--mpfr/tests/tlog1p.c2
-rw-r--r--mpfr/tests/tlog2.c25
-rw-r--r--mpfr/tests/tlog_base_2.c38
-rw-r--r--mpfr/tests/tmul.c146
-rw-r--r--mpfr/tests/tmul_ui.c45
-rw-r--r--mpfr/tests/tout_str.c90
-rw-r--r--mpfr/tests/tpow.c18
-rw-r--r--mpfr/tests/tpow3.c10
-rw-r--r--mpfr/tests/trint.c92
-rw-r--r--mpfr/tests/tround_prec.c (renamed from mpfr/tests/tround.c)21
-rw-r--r--mpfr/tests/tset.c10
-rw-r--r--mpfr/tests/tset_d.c39
-rw-r--r--mpfr/tests/tset_f.c16
-rw-r--r--mpfr/tests/tset_si.c18
-rw-r--r--mpfr/tests/tset_str.c8
-rw-r--r--mpfr/tests/tset_z.c2
-rw-r--r--mpfr/tests/tsin.c21
-rw-r--r--mpfr/tests/tsinh.c2
-rw-r--r--mpfr/tests/tsqrt.c32
-rw-r--r--mpfr/tests/tsub.c62
-rw-r--r--mpfr/tests/tsub_ui.c10
-rw-r--r--mpfr/tests/ttan.c6
-rw-r--r--mpfr/tests/ttanh.c2
-rw-r--r--mpfr/tests/ttrunc.c22
-rw-r--r--mpfr/tests/tui_div.c12
-rw-r--r--mpfr/tests/tui_pow.c17
-rw-r--r--mpfr/tests/tui_sub.c12
63 files changed, 1263 insertions, 651 deletions
diff --git a/mpfr/tests/Makefile.am b/mpfr/tests/Makefile.am
index 98c419dc7..9cbc3f922 100644
--- a/mpfr/tests/Makefile.am
+++ b/mpfr/tests/Makefile.am
@@ -25,7 +25,7 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/mpfr
LDADD = ../libmpfr.a $(top_builddir)/libgmp.la $(LIBM)
if WANT_MPFR
-check_PROGRAMS= reuse tabs tadd tagm tcan_round tcmp tcmp2 tcmp_ui tdiv tdiv_ui tdump teq texp tget_str tlog tlog2 tmul tmul_2exp tmul_ui tout_str tpi tpow trandom tround tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tswap ttrunc tisnan tget_d tatan tcosh tsinh ttanh tacosh tasinh tatanh thyperbolic texp2 tfactorial tsub tasin teuler tcos tsin ttan tsub_ui tset tlog1p texpm1 tlog_base_2 tui_pow tpow3 tlog_base_10 tadd_ui texceptions tfma thypot
+check_PROGRAMS= reuse tabs tadd tagm tcan_round tcmp tcmp2 tcmp_ui tdiv tdiv_ui tdump teq texp tget_str tlog tconst_log2 tmul tmul_2exp tmul_ui tout_str tconst_pi tpow trandom tround_prec tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tswap ttrunc trint tisnan tget_d tatan tcosh tsinh ttanh tacosh tasinh tatanh thyperbolic texp2 tfactorial tsub tasin tconst_euler tcos tsin ttan tsub_ui tset tlog1p texpm1 tlog2 tlog10 tui_pow tpow3 tadd_ui texceptions tfma thypot tacos
TESTS = $(check_PROGRAMS)
endif
EXTRA_DIST= tgeneric.c
diff --git a/mpfr/tests/Makefile.in b/mpfr/tests/Makefile.in
index 6672743bb..92351d1e6 100644
--- a/mpfr/tests/Makefile.in
+++ b/mpfr/tests/Makefile.in
@@ -137,7 +137,7 @@ AUTOMAKE_OPTIONS = gnu no-dependencies $(top_builddir)/ansi2knr
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/mpfr
LDADD = ../libmpfr.a $(top_builddir)/libgmp.la $(LIBM)
-@WANT_MPFR_TRUE@check_PROGRAMS = reuse tabs tadd tagm tcan_round tcmp tcmp2 tcmp_ui tdiv tdiv_ui tdump teq texp tget_str tlog tlog2 tmul tmul_2exp tmul_ui tout_str tpi tpow trandom tround tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tswap ttrunc tisnan tget_d tatan tcosh tsinh ttanh tacosh tasinh tatanh thyperbolic texp2 tfactorial tsub tasin teuler tcos tsin ttan tsub_ui tset tlog1p texpm1 tlog_base_2 tui_pow tpow3 tlog_base_10 tadd_ui texceptions tfma thypot
+@WANT_MPFR_TRUE@check_PROGRAMS = reuse tabs tadd tagm tcan_round tcmp tcmp2 tcmp_ui tdiv tdiv_ui tdump teq texp tget_str tlog tconst_log2 tmul tmul_2exp tmul_ui tout_str tconst_pi tpow trandom tround_prec tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tswap ttrunc trint tisnan tget_d tatan tcosh tsinh ttanh tacosh tasinh tatanh thyperbolic texp2 tfactorial tsub tasin tconst_euler tcos tsin ttan tsub_ui tset tlog1p texpm1 tlog2 tlog10 tui_pow tpow3 tadd_ui texceptions tfma thypot tacos
@WANT_MPFR_TRUE@TESTS = $(check_PROGRAMS)
EXTRA_DIST = tgeneric.c
subdir = mpfr/tests
@@ -149,27 +149,29 @@ CONFIG_CLEAN_FILES =
@WANT_MPFR_TRUE@ tcmp$(EXEEXT) tcmp2$(EXEEXT) tcmp_ui$(EXEEXT) \
@WANT_MPFR_TRUE@ tdiv$(EXEEXT) tdiv_ui$(EXEEXT) tdump$(EXEEXT) \
@WANT_MPFR_TRUE@ teq$(EXEEXT) texp$(EXEEXT) tget_str$(EXEEXT) \
-@WANT_MPFR_TRUE@ tlog$(EXEEXT) tlog2$(EXEEXT) tmul$(EXEEXT) \
-@WANT_MPFR_TRUE@ tmul_2exp$(EXEEXT) tmul_ui$(EXEEXT) \
-@WANT_MPFR_TRUE@ tout_str$(EXEEXT) tpi$(EXEEXT) tpow$(EXEEXT) \
-@WANT_MPFR_TRUE@ trandom$(EXEEXT) tround$(EXEEXT) \
+@WANT_MPFR_TRUE@ tlog$(EXEEXT) tconst_log2$(EXEEXT) \
+@WANT_MPFR_TRUE@ tmul$(EXEEXT) tmul_2exp$(EXEEXT) \
+@WANT_MPFR_TRUE@ tmul_ui$(EXEEXT) tout_str$(EXEEXT) \
+@WANT_MPFR_TRUE@ tconst_pi$(EXEEXT) tpow$(EXEEXT) \
+@WANT_MPFR_TRUE@ trandom$(EXEEXT) tround_prec$(EXEEXT) \
@WANT_MPFR_TRUE@ tset_d$(EXEEXT) tset_f$(EXEEXT) tset_q$(EXEEXT) \
@WANT_MPFR_TRUE@ tset_si$(EXEEXT) tset_str$(EXEEXT) \
@WANT_MPFR_TRUE@ tset_z$(EXEEXT) tsqrt$(EXEEXT) \
@WANT_MPFR_TRUE@ tsqrt_ui$(EXEEXT) tui_div$(EXEEXT) \
@WANT_MPFR_TRUE@ tui_sub$(EXEEXT) tswap$(EXEEXT) ttrunc$(EXEEXT) \
-@WANT_MPFR_TRUE@ tisnan$(EXEEXT) tget_d$(EXEEXT) tatan$(EXEEXT) \
-@WANT_MPFR_TRUE@ tcosh$(EXEEXT) tsinh$(EXEEXT) ttanh$(EXEEXT) \
-@WANT_MPFR_TRUE@ tacosh$(EXEEXT) tasinh$(EXEEXT) tatanh$(EXEEXT) \
-@WANT_MPFR_TRUE@ thyperbolic$(EXEEXT) texp2$(EXEEXT) \
-@WANT_MPFR_TRUE@ tfactorial$(EXEEXT) tsub$(EXEEXT) \
-@WANT_MPFR_TRUE@ tasin$(EXEEXT) teuler$(EXEEXT) tcos$(EXEEXT) \
+@WANT_MPFR_TRUE@ trint$(EXEEXT) tisnan$(EXEEXT) tget_d$(EXEEXT) \
+@WANT_MPFR_TRUE@ tatan$(EXEEXT) tcosh$(EXEEXT) tsinh$(EXEEXT) \
+@WANT_MPFR_TRUE@ ttanh$(EXEEXT) tacosh$(EXEEXT) tasinh$(EXEEXT) \
+@WANT_MPFR_TRUE@ tatanh$(EXEEXT) thyperbolic$(EXEEXT) \
+@WANT_MPFR_TRUE@ texp2$(EXEEXT) tfactorial$(EXEEXT) \
+@WANT_MPFR_TRUE@ tsub$(EXEEXT) tasin$(EXEEXT) \
+@WANT_MPFR_TRUE@ tconst_euler$(EXEEXT) tcos$(EXEEXT) \
@WANT_MPFR_TRUE@ tsin$(EXEEXT) ttan$(EXEEXT) tsub_ui$(EXEEXT) \
@WANT_MPFR_TRUE@ tset$(EXEEXT) tlog1p$(EXEEXT) texpm1$(EXEEXT) \
-@WANT_MPFR_TRUE@ tlog_base_2$(EXEEXT) tui_pow$(EXEEXT) \
-@WANT_MPFR_TRUE@ tpow3$(EXEEXT) tlog_base_10$(EXEEXT) \
-@WANT_MPFR_TRUE@ tadd_ui$(EXEEXT) texceptions$(EXEEXT) \
-@WANT_MPFR_TRUE@ tfma$(EXEEXT) thypot$(EXEEXT)
+@WANT_MPFR_TRUE@ tlog2$(EXEEXT) tlog10$(EXEEXT) tui_pow$(EXEEXT) \
+@WANT_MPFR_TRUE@ tpow3$(EXEEXT) tadd_ui$(EXEEXT) \
+@WANT_MPFR_TRUE@ texceptions$(EXEEXT) tfma$(EXEEXT) \
+@WANT_MPFR_TRUE@ thypot$(EXEEXT) tacos$(EXEEXT)
@WANT_MPFR_FALSE@check_PROGRAMS =
reuse_SOURCES = reuse.c
reuse_OBJECTS = reuse$U.$(OBJEXT)
@@ -181,6 +183,11 @@ tabs_OBJECTS = tabs$U.$(OBJEXT)
tabs_LDADD = $(LDADD)
tabs_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
tabs_LDFLAGS =
+tacos_SOURCES = tacos.c
+tacos_OBJECTS = tacos$U.$(OBJEXT)
+tacos_LDADD = $(LDADD)
+tacos_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tacos_LDFLAGS =
tacosh_SOURCES = tacosh.c
tacosh_OBJECTS = tacosh$U.$(OBJEXT)
tacosh_LDADD = $(LDADD)
@@ -241,6 +248,21 @@ tcmp_ui_OBJECTS = tcmp_ui$U.$(OBJEXT)
tcmp_ui_LDADD = $(LDADD)
tcmp_ui_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
tcmp_ui_LDFLAGS =
+tconst_euler_SOURCES = tconst_euler.c
+tconst_euler_OBJECTS = tconst_euler$U.$(OBJEXT)
+tconst_euler_LDADD = $(LDADD)
+tconst_euler_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tconst_euler_LDFLAGS =
+tconst_log2_SOURCES = tconst_log2.c
+tconst_log2_OBJECTS = tconst_log2$U.$(OBJEXT)
+tconst_log2_LDADD = $(LDADD)
+tconst_log2_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tconst_log2_LDFLAGS =
+tconst_pi_SOURCES = tconst_pi.c
+tconst_pi_OBJECTS = tconst_pi$U.$(OBJEXT)
+tconst_pi_LDADD = $(LDADD)
+tconst_pi_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tconst_pi_LDFLAGS =
tcos_SOURCES = tcos.c
tcos_OBJECTS = tcos$U.$(OBJEXT)
tcos_LDADD = $(LDADD)
@@ -271,11 +293,6 @@ teq_OBJECTS = teq$U.$(OBJEXT)
teq_LDADD = $(LDADD)
teq_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
teq_LDFLAGS =
-teuler_SOURCES = teuler.c
-teuler_OBJECTS = teuler$U.$(OBJEXT)
-teuler_LDADD = $(LDADD)
-teuler_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
-teuler_LDFLAGS =
texceptions_SOURCES = texceptions.c
texceptions_OBJECTS = texceptions$U.$(OBJEXT)
texceptions_LDADD = $(LDADD)
@@ -336,6 +353,11 @@ tlog_OBJECTS = tlog$U.$(OBJEXT)
tlog_LDADD = $(LDADD)
tlog_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
tlog_LDFLAGS =
+tlog10_SOURCES = tlog10.c
+tlog10_OBJECTS = tlog10$U.$(OBJEXT)
+tlog10_LDADD = $(LDADD)
+tlog10_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tlog10_LDFLAGS =
tlog1p_SOURCES = tlog1p.c
tlog1p_OBJECTS = tlog1p$U.$(OBJEXT)
tlog1p_LDADD = $(LDADD)
@@ -346,16 +368,6 @@ tlog2_OBJECTS = tlog2$U.$(OBJEXT)
tlog2_LDADD = $(LDADD)
tlog2_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
tlog2_LDFLAGS =
-tlog_base_10_SOURCES = tlog_base_10.c
-tlog_base_10_OBJECTS = tlog_base_10$U.$(OBJEXT)
-tlog_base_10_LDADD = $(LDADD)
-tlog_base_10_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
-tlog_base_10_LDFLAGS =
-tlog_base_2_SOURCES = tlog_base_2.c
-tlog_base_2_OBJECTS = tlog_base_2$U.$(OBJEXT)
-tlog_base_2_LDADD = $(LDADD)
-tlog_base_2_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
-tlog_base_2_LDFLAGS =
tmul_SOURCES = tmul.c
tmul_OBJECTS = tmul$U.$(OBJEXT)
tmul_LDADD = $(LDADD)
@@ -376,11 +388,6 @@ tout_str_OBJECTS = tout_str$U.$(OBJEXT)
tout_str_LDADD = $(LDADD)
tout_str_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
tout_str_LDFLAGS =
-tpi_SOURCES = tpi.c
-tpi_OBJECTS = tpi$U.$(OBJEXT)
-tpi_LDADD = $(LDADD)
-tpi_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
-tpi_LDFLAGS =
tpow_SOURCES = tpow.c
tpow_OBJECTS = tpow$U.$(OBJEXT)
tpow_LDADD = $(LDADD)
@@ -396,11 +403,16 @@ trandom_OBJECTS = trandom$U.$(OBJEXT)
trandom_LDADD = $(LDADD)
trandom_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
trandom_LDFLAGS =
-tround_SOURCES = tround.c
-tround_OBJECTS = tround$U.$(OBJEXT)
-tround_LDADD = $(LDADD)
-tround_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
-tround_LDFLAGS =
+trint_SOURCES = trint.c
+trint_OBJECTS = trint$U.$(OBJEXT)
+trint_LDADD = $(LDADD)
+trint_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+trint_LDFLAGS =
+tround_prec_SOURCES = tround_prec.c
+tround_prec_OBJECTS = tround_prec$U.$(OBJEXT)
+tround_prec_LDADD = $(LDADD)
+tround_prec_DEPENDENCIES = ../libmpfr.a $(top_builddir)/libgmp.la
+tround_prec_LDFLAGS =
tset_SOURCES = tset.c
tset_OBJECTS = tset$U.$(OBJEXT)
tset_LDADD = $(LDADD)
@@ -516,18 +528,19 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
-DIST_SOURCES = reuse.c tabs.c tacosh.c tadd.c tadd_ui.c tagm.c tasin.c \
- tasinh.c tatan.c tatanh.c tcan_round.c tcmp.c tcmp2.c tcmp_ui.c \
- tcos.c tcosh.c tdiv.c tdiv_ui.c tdump.c teq.c teuler.c \
- texceptions.c texp.c texp2.c texpm1.c tfactorial.c tfma.c \
- tget_d.c tget_str.c thyperbolic.c thypot.c tisnan.c tlog.c \
- tlog1p.c tlog2.c tlog_base_10.c tlog_base_2.c tmul.c \
- tmul_2exp.c tmul_ui.c tout_str.c tpi.c tpow.c tpow3.c trandom.c \
- tround.c tset.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c \
- tset_z.c tsin.c tsinh.c tsqrt.c tsqrt_ui.c tsub.c tsub_ui.c \
- tswap.c ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c
+DIST_SOURCES = reuse.c tabs.c tacos.c tacosh.c tadd.c tadd_ui.c tagm.c \
+ tasin.c tasinh.c tatan.c tatanh.c tcan_round.c tcmp.c tcmp2.c \
+ tcmp_ui.c tconst_euler.c tconst_log2.c tconst_pi.c tcos.c \
+ tcosh.c tdiv.c tdiv_ui.c tdump.c teq.c texceptions.c texp.c \
+ texp2.c texpm1.c tfactorial.c tfma.c tget_d.c tget_str.c \
+ thyperbolic.c thypot.c tisnan.c tlog.c tlog10.c tlog1p.c \
+ tlog2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tpow.c tpow3.c \
+ trandom.c trint.c tround_prec.c tset.c tset_d.c tset_f.c \
+ tset_q.c tset_si.c tset_str.c tset_z.c tsin.c tsinh.c tsqrt.c \
+ tsqrt_ui.c tsub.c tsub_ui.c tswap.c ttan.c ttanh.c ttrunc.c \
+ tui_div.c tui_pow.c tui_sub.c
DIST_COMMON = Makefile.am Makefile.in
-SOURCES = reuse.c tabs.c tacosh.c tadd.c tadd_ui.c tagm.c tasin.c tasinh.c tatan.c tatanh.c tcan_round.c tcmp.c tcmp2.c tcmp_ui.c tcos.c tcosh.c tdiv.c tdiv_ui.c tdump.c teq.c teuler.c texceptions.c texp.c texp2.c texpm1.c tfactorial.c tfma.c tget_d.c tget_str.c thyperbolic.c thypot.c tisnan.c tlog.c tlog1p.c tlog2.c tlog_base_10.c tlog_base_2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tpi.c tpow.c tpow3.c trandom.c tround.c tset.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c tset_z.c tsin.c tsinh.c tsqrt.c tsqrt_ui.c tsub.c tsub_ui.c tswap.c ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c
+SOURCES = reuse.c tabs.c tacos.c tacosh.c tadd.c tadd_ui.c tagm.c tasin.c tasinh.c tatan.c tatanh.c tcan_round.c tcmp.c tcmp2.c tcmp_ui.c tconst_euler.c tconst_log2.c tconst_pi.c tcos.c tcosh.c tdiv.c tdiv_ui.c tdump.c teq.c texceptions.c texp.c texp2.c texpm1.c tfactorial.c tfma.c tget_d.c tget_str.c thyperbolic.c thypot.c tisnan.c tlog.c tlog10.c tlog1p.c tlog2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tpow.c tpow3.c trandom.c trint.c tround_prec.c tset.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c tset_z.c tsin.c tsinh.c tsqrt.c tsqrt_ui.c tsub.c tsub_ui.c tswap.c ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c
all: all-am
@@ -558,6 +571,9 @@ reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES)
tabs$(EXEEXT): $(tabs_OBJECTS) $(tabs_DEPENDENCIES)
@rm -f tabs$(EXEEXT)
$(LINK) $(tabs_LDFLAGS) $(tabs_OBJECTS) $(tabs_LDADD) $(LIBS)
+tacos$(EXEEXT): $(tacos_OBJECTS) $(tacos_DEPENDENCIES)
+ @rm -f tacos$(EXEEXT)
+ $(LINK) $(tacos_LDFLAGS) $(tacos_OBJECTS) $(tacos_LDADD) $(LIBS)
tacosh$(EXEEXT): $(tacosh_OBJECTS) $(tacosh_DEPENDENCIES)
@rm -f tacosh$(EXEEXT)
$(LINK) $(tacosh_LDFLAGS) $(tacosh_OBJECTS) $(tacosh_LDADD) $(LIBS)
@@ -594,6 +610,15 @@ tcmp2$(EXEEXT): $(tcmp2_OBJECTS) $(tcmp2_DEPENDENCIES)
tcmp_ui$(EXEEXT): $(tcmp_ui_OBJECTS) $(tcmp_ui_DEPENDENCIES)
@rm -f tcmp_ui$(EXEEXT)
$(LINK) $(tcmp_ui_LDFLAGS) $(tcmp_ui_OBJECTS) $(tcmp_ui_LDADD) $(LIBS)
+tconst_euler$(EXEEXT): $(tconst_euler_OBJECTS) $(tconst_euler_DEPENDENCIES)
+ @rm -f tconst_euler$(EXEEXT)
+ $(LINK) $(tconst_euler_LDFLAGS) $(tconst_euler_OBJECTS) $(tconst_euler_LDADD) $(LIBS)
+tconst_log2$(EXEEXT): $(tconst_log2_OBJECTS) $(tconst_log2_DEPENDENCIES)
+ @rm -f tconst_log2$(EXEEXT)
+ $(LINK) $(tconst_log2_LDFLAGS) $(tconst_log2_OBJECTS) $(tconst_log2_LDADD) $(LIBS)
+tconst_pi$(EXEEXT): $(tconst_pi_OBJECTS) $(tconst_pi_DEPENDENCIES)
+ @rm -f tconst_pi$(EXEEXT)
+ $(LINK) $(tconst_pi_LDFLAGS) $(tconst_pi_OBJECTS) $(tconst_pi_LDADD) $(LIBS)
tcos$(EXEEXT): $(tcos_OBJECTS) $(tcos_DEPENDENCIES)
@rm -f tcos$(EXEEXT)
$(LINK) $(tcos_LDFLAGS) $(tcos_OBJECTS) $(tcos_LDADD) $(LIBS)
@@ -612,9 +637,6 @@ tdump$(EXEEXT): $(tdump_OBJECTS) $(tdump_DEPENDENCIES)
teq$(EXEEXT): $(teq_OBJECTS) $(teq_DEPENDENCIES)
@rm -f teq$(EXEEXT)
$(LINK) $(teq_LDFLAGS) $(teq_OBJECTS) $(teq_LDADD) $(LIBS)
-teuler$(EXEEXT): $(teuler_OBJECTS) $(teuler_DEPENDENCIES)
- @rm -f teuler$(EXEEXT)
- $(LINK) $(teuler_LDFLAGS) $(teuler_OBJECTS) $(teuler_LDADD) $(LIBS)
texceptions$(EXEEXT): $(texceptions_OBJECTS) $(texceptions_DEPENDENCIES)
@rm -f texceptions$(EXEEXT)
$(LINK) $(texceptions_LDFLAGS) $(texceptions_OBJECTS) $(texceptions_LDADD) $(LIBS)
@@ -651,18 +673,15 @@ tisnan$(EXEEXT): $(tisnan_OBJECTS) $(tisnan_DEPENDENCIES)
tlog$(EXEEXT): $(tlog_OBJECTS) $(tlog_DEPENDENCIES)
@rm -f tlog$(EXEEXT)
$(LINK) $(tlog_LDFLAGS) $(tlog_OBJECTS) $(tlog_LDADD) $(LIBS)
+tlog10$(EXEEXT): $(tlog10_OBJECTS) $(tlog10_DEPENDENCIES)
+ @rm -f tlog10$(EXEEXT)
+ $(LINK) $(tlog10_LDFLAGS) $(tlog10_OBJECTS) $(tlog10_LDADD) $(LIBS)
tlog1p$(EXEEXT): $(tlog1p_OBJECTS) $(tlog1p_DEPENDENCIES)
@rm -f tlog1p$(EXEEXT)
$(LINK) $(tlog1p_LDFLAGS) $(tlog1p_OBJECTS) $(tlog1p_LDADD) $(LIBS)
tlog2$(EXEEXT): $(tlog2_OBJECTS) $(tlog2_DEPENDENCIES)
@rm -f tlog2$(EXEEXT)
$(LINK) $(tlog2_LDFLAGS) $(tlog2_OBJECTS) $(tlog2_LDADD) $(LIBS)
-tlog_base_10$(EXEEXT): $(tlog_base_10_OBJECTS) $(tlog_base_10_DEPENDENCIES)
- @rm -f tlog_base_10$(EXEEXT)
- $(LINK) $(tlog_base_10_LDFLAGS) $(tlog_base_10_OBJECTS) $(tlog_base_10_LDADD) $(LIBS)
-tlog_base_2$(EXEEXT): $(tlog_base_2_OBJECTS) $(tlog_base_2_DEPENDENCIES)
- @rm -f tlog_base_2$(EXEEXT)
- $(LINK) $(tlog_base_2_LDFLAGS) $(tlog_base_2_OBJECTS) $(tlog_base_2_LDADD) $(LIBS)
tmul$(EXEEXT): $(tmul_OBJECTS) $(tmul_DEPENDENCIES)
@rm -f tmul$(EXEEXT)
$(LINK) $(tmul_LDFLAGS) $(tmul_OBJECTS) $(tmul_LDADD) $(LIBS)
@@ -675,9 +694,6 @@ tmul_ui$(EXEEXT): $(tmul_ui_OBJECTS) $(tmul_ui_DEPENDENCIES)
tout_str$(EXEEXT): $(tout_str_OBJECTS) $(tout_str_DEPENDENCIES)
@rm -f tout_str$(EXEEXT)
$(LINK) $(tout_str_LDFLAGS) $(tout_str_OBJECTS) $(tout_str_LDADD) $(LIBS)
-tpi$(EXEEXT): $(tpi_OBJECTS) $(tpi_DEPENDENCIES)
- @rm -f tpi$(EXEEXT)
- $(LINK) $(tpi_LDFLAGS) $(tpi_OBJECTS) $(tpi_LDADD) $(LIBS)
tpow$(EXEEXT): $(tpow_OBJECTS) $(tpow_DEPENDENCIES)
@rm -f tpow$(EXEEXT)
$(LINK) $(tpow_LDFLAGS) $(tpow_OBJECTS) $(tpow_LDADD) $(LIBS)
@@ -687,9 +703,12 @@ tpow3$(EXEEXT): $(tpow3_OBJECTS) $(tpow3_DEPENDENCIES)
trandom$(EXEEXT): $(trandom_OBJECTS) $(trandom_DEPENDENCIES)
@rm -f trandom$(EXEEXT)
$(LINK) $(trandom_LDFLAGS) $(trandom_OBJECTS) $(trandom_LDADD) $(LIBS)
-tround$(EXEEXT): $(tround_OBJECTS) $(tround_DEPENDENCIES)
- @rm -f tround$(EXEEXT)
- $(LINK) $(tround_LDFLAGS) $(tround_OBJECTS) $(tround_LDADD) $(LIBS)
+trint$(EXEEXT): $(trint_OBJECTS) $(trint_DEPENDENCIES)
+ @rm -f trint$(EXEEXT)
+ $(LINK) $(trint_LDFLAGS) $(trint_OBJECTS) $(trint_LDADD) $(LIBS)
+tround_prec$(EXEEXT): $(tround_prec_OBJECTS) $(tround_prec_DEPENDENCIES)
+ @rm -f tround_prec$(EXEEXT)
+ $(LINK) $(tround_prec_LDFLAGS) $(tround_prec_OBJECTS) $(tround_prec_LDADD) $(LIBS)
tset$(EXEEXT): $(tset_OBJECTS) $(tset_DEPENDENCIES)
@rm -f tset$(EXEEXT)
$(LINK) $(tset_LDFLAGS) $(tset_OBJECTS) $(tset_LDADD) $(LIBS)
@@ -776,6 +795,8 @@ reuse_.c: reuse.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reuse.c; then echo $(srcdir)/reuse.c; else echo reuse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > reuse_.c || rm -f reuse_.c
tabs_.c: tabs.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tabs.c; then echo $(srcdir)/tabs.c; else echo tabs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tabs_.c || rm -f tabs_.c
+tacos_.c: tacos.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tacos.c; then echo $(srcdir)/tacos.c; else echo tacos.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tacos_.c || rm -f tacos_.c
tacosh_.c: tacosh.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tacosh.c; then echo $(srcdir)/tacosh.c; else echo tacosh.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tacosh_.c || rm -f tacosh_.c
tadd_.c: tadd.c $(ANSI2KNR)
@@ -800,6 +821,12 @@ tcmp2_.c: tcmp2.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tcmp2.c; then echo $(srcdir)/tcmp2.c; else echo tcmp2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tcmp2_.c || rm -f tcmp2_.c
tcmp_ui_.c: tcmp_ui.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tcmp_ui.c; then echo $(srcdir)/tcmp_ui.c; else echo tcmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tcmp_ui_.c || rm -f tcmp_ui_.c
+tconst_euler_.c: tconst_euler.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tconst_euler.c; then echo $(srcdir)/tconst_euler.c; else echo tconst_euler.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tconst_euler_.c || rm -f tconst_euler_.c
+tconst_log2_.c: tconst_log2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tconst_log2.c; then echo $(srcdir)/tconst_log2.c; else echo tconst_log2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tconst_log2_.c || rm -f tconst_log2_.c
+tconst_pi_.c: tconst_pi.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tconst_pi.c; then echo $(srcdir)/tconst_pi.c; else echo tconst_pi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tconst_pi_.c || rm -f tconst_pi_.c
tcos_.c: tcos.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tcos.c; then echo $(srcdir)/tcos.c; else echo tcos.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tcos_.c || rm -f tcos_.c
tcosh_.c: tcosh.c $(ANSI2KNR)
@@ -812,8 +839,6 @@ tdump_.c: tdump.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdump.c; then echo $(srcdir)/tdump.c; else echo tdump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tdump_.c || rm -f tdump_.c
teq_.c: teq.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/teq.c; then echo $(srcdir)/teq.c; else echo teq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > teq_.c || rm -f teq_.c
-teuler_.c: teuler.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/teuler.c; then echo $(srcdir)/teuler.c; else echo teuler.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > teuler_.c || rm -f teuler_.c
texceptions_.c: texceptions.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/texceptions.c; then echo $(srcdir)/texceptions.c; else echo texceptions.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > texceptions_.c || rm -f texceptions_.c
texp_.c: texp.c $(ANSI2KNR)
@@ -838,14 +863,12 @@ tisnan_.c: tisnan.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tisnan.c; then echo $(srcdir)/tisnan.c; else echo tisnan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tisnan_.c || rm -f tisnan_.c
tlog_.c: tlog.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog.c; then echo $(srcdir)/tlog.c; else echo tlog.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog_.c || rm -f tlog_.c
+tlog10_.c: tlog10.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog10.c; then echo $(srcdir)/tlog10.c; else echo tlog10.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog10_.c || rm -f tlog10_.c
tlog1p_.c: tlog1p.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog1p.c; then echo $(srcdir)/tlog1p.c; else echo tlog1p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog1p_.c || rm -f tlog1p_.c
tlog2_.c: tlog2.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog2.c; then echo $(srcdir)/tlog2.c; else echo tlog2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog2_.c || rm -f tlog2_.c
-tlog_base_10_.c: tlog_base_10.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog_base_10.c; then echo $(srcdir)/tlog_base_10.c; else echo tlog_base_10.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog_base_10_.c || rm -f tlog_base_10_.c
-tlog_base_2_.c: tlog_base_2.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tlog_base_2.c; then echo $(srcdir)/tlog_base_2.c; else echo tlog_base_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tlog_base_2_.c || rm -f tlog_base_2_.c
tmul_.c: tmul.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tmul.c; then echo $(srcdir)/tmul.c; else echo tmul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tmul_.c || rm -f tmul_.c
tmul_2exp_.c: tmul_2exp.c $(ANSI2KNR)
@@ -854,16 +877,16 @@ tmul_ui_.c: tmul_ui.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tmul_ui.c; then echo $(srcdir)/tmul_ui.c; else echo tmul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tmul_ui_.c || rm -f tmul_ui_.c
tout_str_.c: tout_str.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tout_str.c; then echo $(srcdir)/tout_str.c; else echo tout_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tout_str_.c || rm -f tout_str_.c
-tpi_.c: tpi.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tpi.c; then echo $(srcdir)/tpi.c; else echo tpi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tpi_.c || rm -f tpi_.c
tpow_.c: tpow.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tpow.c; then echo $(srcdir)/tpow.c; else echo tpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tpow_.c || rm -f tpow_.c
tpow3_.c: tpow3.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tpow3.c; then echo $(srcdir)/tpow3.c; else echo tpow3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tpow3_.c || rm -f tpow3_.c
trandom_.c: trandom.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trandom.c; then echo $(srcdir)/trandom.c; else echo trandom.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > trandom_.c || rm -f trandom_.c
-tround_.c: tround.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tround.c; then echo $(srcdir)/tround.c; else echo tround.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tround_.c || rm -f tround_.c
+trint_.c: trint.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trint.c; then echo $(srcdir)/trint.c; else echo trint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > trint_.c || rm -f trint_.c
+tround_prec_.c: tround_prec.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tround_prec.c; then echo $(srcdir)/tround_prec.c; else echo tround_prec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tround_prec_.c || rm -f tround_prec_.c
tset_.c: tset.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tset.c; then echo $(srcdir)/tset.c; else echo tset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tset_.c || rm -f tset_.c
tset_d_.c: tset_d.c $(ANSI2KNR)
@@ -904,36 +927,38 @@ tui_pow_.c: tui_pow.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tui_pow.c; then echo $(srcdir)/tui_pow.c; else echo tui_pow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tui_pow_.c || rm -f tui_pow_.c
tui_sub_.c: tui_sub.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tui_sub.c; then echo $(srcdir)/tui_sub.c; else echo tui_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tui_sub_.c || rm -f tui_sub_.c
-reuse_.$(OBJEXT) reuse_.lo tabs_.$(OBJEXT) tabs_.lo tacosh_.$(OBJEXT) \
-tacosh_.lo tadd_.$(OBJEXT) tadd_.lo tadd_ui_.$(OBJEXT) tadd_ui_.lo \
-tagm_.$(OBJEXT) tagm_.lo tasin_.$(OBJEXT) tasin_.lo tasinh_.$(OBJEXT) \
-tasinh_.lo tatan_.$(OBJEXT) tatan_.lo tatanh_.$(OBJEXT) tatanh_.lo \
+reuse_.$(OBJEXT) reuse_.lo tabs_.$(OBJEXT) tabs_.lo tacos_.$(OBJEXT) \
+tacos_.lo tacosh_.$(OBJEXT) tacosh_.lo tadd_.$(OBJEXT) tadd_.lo \
+tadd_ui_.$(OBJEXT) tadd_ui_.lo tagm_.$(OBJEXT) tagm_.lo \
+tasin_.$(OBJEXT) tasin_.lo tasinh_.$(OBJEXT) tasinh_.lo \
+tatan_.$(OBJEXT) tatan_.lo tatanh_.$(OBJEXT) tatanh_.lo \
tcan_round_.$(OBJEXT) tcan_round_.lo tcmp_.$(OBJEXT) tcmp_.lo \
tcmp2_.$(OBJEXT) tcmp2_.lo tcmp_ui_.$(OBJEXT) tcmp_ui_.lo \
-tcos_.$(OBJEXT) tcos_.lo tcosh_.$(OBJEXT) tcosh_.lo tdiv_.$(OBJEXT) \
-tdiv_.lo tdiv_ui_.$(OBJEXT) tdiv_ui_.lo tdump_.$(OBJEXT) tdump_.lo \
-teq_.$(OBJEXT) teq_.lo teuler_.$(OBJEXT) teuler_.lo \
-texceptions_.$(OBJEXT) texceptions_.lo texp_.$(OBJEXT) texp_.lo \
-texp2_.$(OBJEXT) texp2_.lo texpm1_.$(OBJEXT) texpm1_.lo \
-tfactorial_.$(OBJEXT) tfactorial_.lo tfma_.$(OBJEXT) tfma_.lo \
-tget_d_.$(OBJEXT) tget_d_.lo tget_str_.$(OBJEXT) tget_str_.lo \
+tconst_euler_.$(OBJEXT) tconst_euler_.lo tconst_log2_.$(OBJEXT) \
+tconst_log2_.lo tconst_pi_.$(OBJEXT) tconst_pi_.lo tcos_.$(OBJEXT) \
+tcos_.lo tcosh_.$(OBJEXT) tcosh_.lo tdiv_.$(OBJEXT) tdiv_.lo \
+tdiv_ui_.$(OBJEXT) tdiv_ui_.lo tdump_.$(OBJEXT) tdump_.lo \
+teq_.$(OBJEXT) teq_.lo texceptions_.$(OBJEXT) texceptions_.lo \
+texp_.$(OBJEXT) texp_.lo texp2_.$(OBJEXT) texp2_.lo texpm1_.$(OBJEXT) \
+texpm1_.lo tfactorial_.$(OBJEXT) tfactorial_.lo tfma_.$(OBJEXT) \
+tfma_.lo tget_d_.$(OBJEXT) tget_d_.lo tget_str_.$(OBJEXT) tget_str_.lo \
thyperbolic_.$(OBJEXT) thyperbolic_.lo thypot_.$(OBJEXT) thypot_.lo \
-tisnan_.$(OBJEXT) tisnan_.lo tlog_.$(OBJEXT) tlog_.lo tlog1p_.$(OBJEXT) \
-tlog1p_.lo tlog2_.$(OBJEXT) tlog2_.lo tlog_base_10_.$(OBJEXT) \
-tlog_base_10_.lo tlog_base_2_.$(OBJEXT) tlog_base_2_.lo tmul_.$(OBJEXT) \
-tmul_.lo tmul_2exp_.$(OBJEXT) tmul_2exp_.lo tmul_ui_.$(OBJEXT) \
-tmul_ui_.lo tout_str_.$(OBJEXT) tout_str_.lo tpi_.$(OBJEXT) tpi_.lo \
+tisnan_.$(OBJEXT) tisnan_.lo tlog_.$(OBJEXT) tlog_.lo tlog10_.$(OBJEXT) \
+tlog10_.lo tlog1p_.$(OBJEXT) tlog1p_.lo tlog2_.$(OBJEXT) tlog2_.lo \
+tmul_.$(OBJEXT) tmul_.lo tmul_2exp_.$(OBJEXT) tmul_2exp_.lo \
+tmul_ui_.$(OBJEXT) tmul_ui_.lo tout_str_.$(OBJEXT) tout_str_.lo \
tpow_.$(OBJEXT) tpow_.lo tpow3_.$(OBJEXT) tpow3_.lo trandom_.$(OBJEXT) \
-trandom_.lo tround_.$(OBJEXT) tround_.lo tset_.$(OBJEXT) tset_.lo \
-tset_d_.$(OBJEXT) tset_d_.lo tset_f_.$(OBJEXT) tset_f_.lo \
-tset_q_.$(OBJEXT) tset_q_.lo tset_si_.$(OBJEXT) tset_si_.lo \
-tset_str_.$(OBJEXT) tset_str_.lo tset_z_.$(OBJEXT) tset_z_.lo \
-tsin_.$(OBJEXT) tsin_.lo tsinh_.$(OBJEXT) tsinh_.lo tsqrt_.$(OBJEXT) \
-tsqrt_.lo tsqrt_ui_.$(OBJEXT) tsqrt_ui_.lo tsub_.$(OBJEXT) tsub_.lo \
-tsub_ui_.$(OBJEXT) tsub_ui_.lo tswap_.$(OBJEXT) tswap_.lo \
-ttan_.$(OBJEXT) ttan_.lo ttanh_.$(OBJEXT) ttanh_.lo ttrunc_.$(OBJEXT) \
-ttrunc_.lo tui_div_.$(OBJEXT) tui_div_.lo tui_pow_.$(OBJEXT) \
-tui_pow_.lo tui_sub_.$(OBJEXT) tui_sub_.lo : $(ANSI2KNR)
+trandom_.lo trint_.$(OBJEXT) trint_.lo tround_prec_.$(OBJEXT) \
+tround_prec_.lo tset_.$(OBJEXT) tset_.lo tset_d_.$(OBJEXT) tset_d_.lo \
+tset_f_.$(OBJEXT) tset_f_.lo tset_q_.$(OBJEXT) tset_q_.lo \
+tset_si_.$(OBJEXT) tset_si_.lo tset_str_.$(OBJEXT) tset_str_.lo \
+tset_z_.$(OBJEXT) tset_z_.lo tsin_.$(OBJEXT) tsin_.lo tsinh_.$(OBJEXT) \
+tsinh_.lo tsqrt_.$(OBJEXT) tsqrt_.lo tsqrt_ui_.$(OBJEXT) tsqrt_ui_.lo \
+tsub_.$(OBJEXT) tsub_.lo tsub_ui_.$(OBJEXT) tsub_ui_.lo \
+tswap_.$(OBJEXT) tswap_.lo ttan_.$(OBJEXT) ttan_.lo ttanh_.$(OBJEXT) \
+ttanh_.lo ttrunc_.$(OBJEXT) ttrunc_.lo tui_div_.$(OBJEXT) tui_div_.lo \
+tui_pow_.$(OBJEXT) tui_pow_.lo tui_sub_.$(OBJEXT) tui_sub_.lo : \
+$(ANSI2KNR)
uninstall-info-am:
tags: TAGS
diff --git a/mpfr/tests/reuse.c b/mpfr/tests/reuse.c
index 879708025..3626b6e49 100644
--- a/mpfr/tests/reuse.c
+++ b/mpfr/tests/reuse.c
@@ -608,12 +608,12 @@ main (void)
testfunc = (void*) mpfr_add; test3 ("mpfr_add", 53, GMP_RNDN);
testfunc = (void*) mpfr_add_ui; test2ui ("mpfr_add_ui", 53, GMP_RNDN);
testfunc = mpfr_agm; test3 ("mpfr_agm", 53, GMP_RNDN);
- testfunc = mpfr_ceil; test2 ("mpfr_ceil", 53, GMP_RNDN);
+ testfunc = (void*) mpfr_ceil; test2 ("mpfr_ceil", 53, GMP_RNDN);
testfunc = (void*) mpfr_div; test3 ("mpfr_div", 53, GMP_RNDN);
testfunc = (void*) mpfr_div_2exp; test2ui ("mpfr_div_2exp", 53, GMP_RNDN);
testfunc = (void*) mpfr_div_ui; test2ui ("mpfr_div_ui", 53, GMP_RNDN);
testfunc = (void*) mpfr_exp; test2 ("mpfr_exp", 53, GMP_RNDN);
- testfunc = mpfr_floor; test2 ("mpfr_floor", 53, GMP_RNDN);
+ testfunc = (void*) mpfr_floor; test2 ("mpfr_floor", 53, GMP_RNDN);
testfunc = (void*) mpfr_log; test2 ("mpfr_log", 53, GMP_RNDN);
testfunc = (void*) mpfr_mul; test3 ("mpfr_mul", 53, GMP_RNDN);
testfunc = (void*) mpfr_mul_2exp; test2ui ("mpfr_mul_2exp", 53, GMP_RNDN);
@@ -626,8 +626,9 @@ main (void)
testfunc = (void*) mpfr_sqrt; test2 ("mpfr_sqrt", 53, GMP_RNDN);
testfunc = (void*) mpfr_ui_div; testui2 ("mpfr_ui_div", 53, GMP_RNDN);
testfunc = (void*) mpfr_ui_sub; testui2 ("mpfr_ui_sub", 53, GMP_RNDN);
- testfunc = mpfr_trunc; test2 ("mpfr_trunc", 53, GMP_RNDN);
+ testfunc = (void*) mpfr_trunc; test2 ("mpfr_trunc", 53, GMP_RNDN);
testfunc = (void*) mpfr_asin; test2 ("mpfr_asin", 53, GMP_RNDN);
+ testfunc = (void*) mpfr_acos; test2 ("mpfr_acos", 53, GMP_RNDN);
testfunc = (void*) mpfr_atan; test2 ("mpfr_atan", 53, GMP_RNDN);
testfunc = (void*) mpfr_sinh; test2 ("mpfr_sinh", 53, GMP_RNDN);
testfunc = (void*) mpfr_cosh; test2 ("mpfr_cosh", 53, GMP_RNDN);
diff --git a/mpfr/tests/tabs.c b/mpfr/tests/tabs.c
index 8b3a90cab..193a51f6c 100644
--- a/mpfr/tests/tabs.c
+++ b/mpfr/tests/tabs.c
@@ -1,6 +1,6 @@
/* Test file for mpfr_abs.
-Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 2000-2002 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -21,7 +21,6 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
-#include <math.h>
#include "gmp.h"
#include "mpfr.h"
#include "mpfr-test.h"
@@ -31,7 +30,7 @@ MA 02111-1307, USA. */
void check_inexact _PROTO((void));
void
-check_inexact ()
+check_inexact (void)
{
mp_prec_t p, q;
mpfr_t x, y, absx;
@@ -42,7 +41,7 @@ check_inexact ()
mpfr_init (y);
mpfr_init (absx);
- for (p=1; p<500; p++)
+ for (p=2; p<500; p++)
{
mpfr_set_prec (x, p);
mpfr_set_prec (absx, p);
@@ -54,7 +53,7 @@ check_inexact ()
}
else
mpfr_set (absx, x, GMP_RNDN);
- for (q=1; q<2*p; q++)
+ for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
for (rnd=0; rnd<4; rnd++)
@@ -66,9 +65,9 @@ check_inexact ()
((inexact < 0) && (cmp >= 0)))
{
fprintf (stderr, "Wrong inexact flag: expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("absx="); mpfr_print_raw (absx); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("absx="); mpfr_print_binary (absx); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
}
@@ -129,11 +128,11 @@ main (int argc, char *argv[])
mpfr_set_d(x, d, 0);
mpfr_abs(x, x, rnd);
dd = mpfr_get_d(x);
- if (dd != fabs(d) && !isnan(d))
+ if (!isnan(d) && dd != ABS(d))
{
fprintf(stderr,
"Mismatch on d = %1.18g\n", d);
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
exit(1);
}
}
diff --git a/mpfr/tests/tacos.c b/mpfr/tests/tacos.c
new file mode 100644
index 000000000..a8705463c
--- /dev/null
+++ b/mpfr/tests/tacos.c
@@ -0,0 +1,95 @@
+/* Test file for mpfr_acos.
+
+Copyright (C) 2001 Free Software Foundation.
+Contributed by Mathieu Dutour.
+
+This file is part of the MPFR Library.
+
+The MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the 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 <stdio.h>
+#include <stdlib.h>
+#include "gmp.h"
+#include "mpfr.h"
+#include "mpfr-impl.h"
+
+int
+main (void)
+{
+ unsigned int prec, err, yprec, n;
+ mp_rnd_t rnd;
+ mpfr_t x, y, z;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ MPFR_SET_NAN(x);
+ mpfr_acos (y, x, GMP_RNDN);
+ if (mpfr_nan_p(y) == 0)
+ {
+ fprintf (stderr, "Error: acos(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_acos (y, x, GMP_RNDN);
+ if (mpfr_nan_p(y) == 0)
+ {
+ fprintf (stderr, "Error: acos(2) != NaN\n");
+ exit (1);
+ }
+
+ for (prec = 2; prec <= 100; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (z, prec);
+ yprec = prec + 10;
+
+ for (n=0; n<10; n++)
+ {
+ mpfr_random (x);
+ rnd = random () % 4;
+ mpfr_set_prec (y, yprec);
+ mpfr_acos (y, x, rnd);
+ err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, rnd, rnd, prec))
+ {
+ mpfr_round_prec (y, rnd, prec);
+ mpfr_acos (z, x, rnd);
+ if (mpfr_cmp (y, z))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", prec,
+ mpfr_print_rnd_mode (rnd));
+ printf (" got ");
+ mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ putchar ('\n');
+ printf (" expected ");
+ mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
+ putchar ('\n');
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ return 0;
+}
diff --git a/mpfr/tests/tacosh.c b/mpfr/tests/tacosh.c
index d9d288f92..e3fcedea6 100644
--- a/mpfr/tests/tacosh.c
+++ b/mpfr/tests/tacosh.c
@@ -33,7 +33,11 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 25);
+ test_generic (2, 100, 25);
return 0;
}
+
+
+
+
diff --git a/mpfr/tests/tadd.c b/mpfr/tests/tadd.c
index 02017deaf..e540a9fbb 100644
--- a/mpfr/tests/tadd.c
+++ b/mpfr/tests/tadd.c
@@ -21,7 +21,6 @@ MA 02111-1307, USA. */
#define N 100000
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
@@ -167,12 +166,14 @@ check5 (double x, mp_rnd_t rnd_mode)
z1 = (neg) ? x-x : x+x;
z2 = mpfr_get_d(xx);
mpfr_set_d (yy, z2, GMP_RNDN);
- if (!mpfr_cmp (xx, yy) && z1!=z2 && !(isnan(z1) && isnan(z2))) {
- printf("expected result is %1.20e, got %1.20e\n",z1,z2);
- printf("mpfr_%s(x,x,x) failed for x=%1.20e with rnd_mode=%s\n",
- (neg) ? "sub" : "add", x, mpfr_print_rnd_mode (rnd_mode));
- exit(1);
- }
+ /* check NaNs first since mpfr_cmp does not like them */
+ if (!(isnan(z1) && isnan(z2)) && !mpfr_cmp (xx, yy) && z1!=z2)
+ {
+ printf ("expected result is %1.20e, got %1.20e\n",z1,z2);
+ printf ("mpfr_%s(x,x,x) failed for x=%1.20e with rnd_mode=%s\n",
+ (neg) ? "sub" : "add", x, mpfr_print_rnd_mode (rnd_mode));
+ exit (1);
+ }
mpfr_clear(xx);
mpfr_clear(yy);
}
@@ -195,7 +196,7 @@ check2 (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode)
printf("got %1.20e\n",z2);
printf("result should be %1.20e (diff=%d ulp)\n",z,u);
mpfr_set_d(zz, z, rnd_mode);
- printf("i.e."); mpfr_print_raw(zz); putchar('\n');
+ printf("i.e."); mpfr_print_binary(zz); putchar('\n');
exit(1); }
mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz);
}
@@ -216,15 +217,15 @@ check2a (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode,
if (mpfr_cmp(xx, zz)) {
printf("x=%1.20e,%d y=%1.20e,%d pz=%d,rnd=%s\n",
x,px,y,py,pz,mpfr_print_rnd_mode(rnd_mode));
- printf("got "); mpfr_print_raw(zz); putchar('\n');
- printf("instead of "); mpfr_print_raw(xx); putchar('\n');
+ printf("got "); mpfr_print_binary(zz); putchar('\n');
+ printf("instead of "); mpfr_print_binary(xx); putchar('\n');
exit(1);
}
mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz);
}
void
-check64 ()
+check64 (void)
{
mpfr_t x, t, u;
@@ -258,7 +259,7 @@ check64 ()
if (MPFR_MANT(u)[0] << 2)
{
fprintf (stderr, "result not normalized for prec=2\n");
- mpfr_print_raw (u); putchar ('\n');
+ mpfr_print_binary (u); putchar ('\n');
exit (1);
}
mpfr_set_str_raw (t, "-1.0e-1");
@@ -310,7 +311,7 @@ check64 ()
mpfr_sub(u, x, t, GMP_RNDU);
mpfr_set_str_raw(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100");
if (mpfr_cmp(u,t)) {
- printf("expect "); mpfr_print_raw(t); putchar('\n');
+ printf("expect "); mpfr_print_binary(t); putchar('\n');
fprintf (stderr, "mpfr_add failed for precisions 53-76\n"); exit(1);
}
mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108);
@@ -319,7 +320,7 @@ check64 ()
mpfr_sub(u, x, t, GMP_RNDU);
mpfr_set_str_raw(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111");
if (mpfr_cmp(u,t)) {
- printf("expect "); mpfr_print_raw(t); putchar('\n');
+ printf("expect "); mpfr_print_binary(t); putchar('\n');
fprintf(stderr, "mpfr_add failed for precisions 53-108\n"); exit(1);
}
mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97);
@@ -365,9 +366,9 @@ check64 ()
mpfr_add(u, x, t, GMP_RNDU);
if ((MPFR_MANT(u)[0] & 1) != 1) {
printf("error in mpfr_add with rnd_mode=GMP_RNDU\n");
- printf("b= "); mpfr_print_raw(x); putchar('\n');
- printf("c= "); mpfr_print_raw(t); putchar('\n');
- printf("b+c="); mpfr_print_raw(u); putchar('\n');
+ printf("b= "); mpfr_print_binary(x); putchar('\n');
+ printf("c= "); mpfr_print_binary(t); putchar('\n');
+ printf("b+c="); mpfr_print_binary(u); putchar('\n');
exit(1);
}
@@ -456,10 +457,10 @@ check_case_1b (void)
mpfr_init (b);
mpfr_init (c);
- for (prec_a = 1; prec_a <= 64; prec_a++)
+ for (prec_a = 2; prec_a <= 64; prec_a++)
{
mpfr_set_prec (a, prec_a);
- for (prec_b = prec_a + 1; prec_b <= 64; prec_b++)
+ for (prec_b = prec_a + 2; prec_b <= 64; prec_b++)
{
dif = prec_b - prec_a;
mpfr_set_prec (b, prec_b);
@@ -481,9 +482,9 @@ check_case_1b (void)
if (mpfr_cmp_ui (a, 1) != 0)
{
fprintf (stderr, "case (1b) failed for prec_a=%u, prec_b=%u, prec_c=%u\n", prec_a, prec_b, prec_c);
- printf("b="); mpfr_print_raw(b); putchar('\n');
- printf("c="); mpfr_print_raw(c); putchar('\n');
- printf("a="); mpfr_print_raw(a); putchar('\n');
+ printf("b="); mpfr_print_binary(b); putchar('\n');
+ printf("c="); mpfr_print_binary(c); putchar('\n');
+ printf("a="); mpfr_print_binary(a); putchar('\n');
exit (1);
}
}
@@ -530,7 +531,7 @@ check_case_2 (void)
/* checks when source and destination are equal */
void
-check_same ()
+check_same (void)
{
mpfr_t x;
@@ -548,7 +549,7 @@ check_same ()
#define MAX_PREC 100
void
-check_inexact ()
+check_inexact (void)
{
mpfr_t x, y, z, u;
mp_prec_t px, py, pu, pz;
@@ -560,7 +561,7 @@ check_inexact ()
mpfr_init (z);
mpfr_init (u);
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
mpfr_set_str_raw (x, "0.1E-4");
mpfr_set_prec (u, 33);
mpfr_set_str_raw (u, "0.101110100101101100000000111100000E-1");
@@ -571,7 +572,7 @@ check_inexact ()
exit (1);
}
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
mpfr_set_str_raw (x, "0.1E-4");
mpfr_set_prec (u, 33);
mpfr_set_str_raw (u, "0.101110100101101100000000111100000E-1");
@@ -582,15 +583,15 @@ check_inexact ()
exit (1);
}
- for (px=1; px<MAX_PREC; px++)
+ for (px=2; px<MAX_PREC; px++)
{
mpfr_set_prec (x, px);
mpfr_random (x);
- for (pu=1; pu<MAX_PREC; pu++)
+ for (pu=2; pu<MAX_PREC; pu++)
{
mpfr_set_prec (u, pu);
mpfr_random (u);
- for (py=1; py<MAX_PREC; py++)
+ for (py=2; py<MAX_PREC; py++)
{
mpfr_set_prec (y, py);
pz = (mpfr_cmp_abs (x, u) >= 0) ? MPFR_EXP(x)-MPFR_EXP(u)
@@ -603,9 +604,9 @@ check_inexact ()
if (mpfr_add (z, x, u, rnd))
{
fprintf (stderr, "z <- x + u should be exact\n");
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("u="); mpfr_print_raw (u); putchar ('\n');
- printf ("z="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("u="); mpfr_print_binary (u); putchar ('\n');
+ printf ("z="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
for (rnd=0; rnd<4; rnd++)
@@ -619,10 +620,10 @@ check_inexact ()
fprintf (stderr, "Wrong inexact flag for rnd=%s\n",
mpfr_print_rnd_mode(rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("u="); mpfr_print_raw (u); putchar ('\n');
- printf ("y= "); mpfr_print_raw (y); putchar ('\n');
- printf ("x+u="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("u="); mpfr_print_binary (u); putchar ('\n');
+ printf ("y= "); mpfr_print_binary (y); putchar ('\n');
+ printf ("x+u="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/tagm.c b/mpfr/tests/tagm.c
index 6e2b617be..8e5802bf0 100644
--- a/mpfr/tests/tagm.c
+++ b/mpfr/tests/tagm.c
@@ -35,7 +35,7 @@ void check_large _PROTO((void));
void slave _PROTO((int, int));
double
-drand_agm()
+drand_agm(void)
{
double d; long int *i;
@@ -109,7 +109,8 @@ if (ck==0) printf("%1.20e\n", res1);
mpfr_clear(ta); mpfr_clear(tb); mpfr_clear(tres);
}
-void check_large ()
+void
+check_large (void)
{
mpfr_t a, b, agm;
diff --git a/mpfr/tests/tasin.c b/mpfr/tests/tasin.c
index 7faf0088a..018160ce5 100644
--- a/mpfr/tests/tasin.c
+++ b/mpfr/tests/tasin.c
@@ -37,7 +37,7 @@ main (void)
mpfr_init (y);
mpfr_init (z);
- for (prec = 1; prec <= 100; prec++)
+ for (prec = 2; prec <= 100; prec++)
{
mpfr_set_prec (x, prec);
mpfr_set_prec (z, prec);
@@ -52,7 +52,7 @@ main (void)
err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
if (mpfr_can_round (y, err, rnd, rnd, prec))
{
- mpfr_round (y, rnd, prec);
+ mpfr_round_prec (y, rnd, prec);
mpfr_asin (z, x, rnd);
if (mpfr_cmp (y, z))
{
diff --git a/mpfr/tests/tasinh.c b/mpfr/tests/tasinh.c
index 1eee4e583..f41bbd8b9 100644
--- a/mpfr/tests/tasinh.c
+++ b/mpfr/tests/tasinh.c
@@ -42,7 +42,7 @@ main (int argc, char *argv[])
mpfr_set_str_raw (x, "0.111001101100000110011001010000101");
mpfr_asinh (y, x, GMP_RNDZ);
- test_generic (1, 100, 25);
+ test_generic (2, 100, 25);
mpfr_clear (x);
mpfr_clear (y);
diff --git a/mpfr/tests/tatan.c b/mpfr/tests/tatan.c
index 08c3d2148..7fb8cc365 100644
--- a/mpfr/tests/tatan.c
+++ b/mpfr/tests/tatan.c
@@ -26,15 +26,48 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-test.h"
-int mpfr_arctan_aux2 _PROTO ((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
+void worst_cases _PROTO((void));
+int mpfr_arctan_aux2 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
+
+void
+worst_cases (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (z, 53);
+
+ mpfr_set_str_raw (x, "1.0000100110000001100111100011001110101110100111011101");
+ mpfr_set_str_raw (y, "1.1001101101110100101100110011011101101000011010111110e-1");
+ mpfr_atan (z, x, GMP_RNDN);
+ if (mpfr_cmp (y, z))
+ {
+ fprintf (stderr, "Error in mpfr_atan for prec=53, rnd=GMP_RNDN\n");
+ fprintf (stderr, "x=");
+ mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
+ fprintf (stderr, "\nexpected ");
+ mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ fprintf (stderr, "\ngot ");
+ mpfr_out_str (stderr, 2, 0, z, GMP_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
int
main (int argc, char *argv[])
{
- unsigned int prec, err, yprec, n, p0 = 1, p1 = 100, N = 10;
+ unsigned int prec, err, yprec, n, p0 = 2, p1 = 100, N = 10;
mp_rnd_t rnd;
mpfr_t x, y, z, t;
+ worst_cases ();
+
mpfr_init (x);
mpfr_init (y);
mpfr_init (z);
@@ -78,7 +111,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf (" approximation was ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
diff --git a/mpfr/tests/tatanh.c b/mpfr/tests/tatanh.c
index c3c96e3d1..91469a11a 100644
--- a/mpfr/tests/tatanh.c
+++ b/mpfr/tests/tatanh.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 25);
+ test_generic (2, 100, 25);
return 0;
}
diff --git a/mpfr/tests/tcmp.c b/mpfr/tests/tcmp.c
index 98b7b4412..df6f23bdd 100644
--- a/mpfr/tests/tcmp.c
+++ b/mpfr/tests/tcmp.c
@@ -36,6 +36,7 @@ main (void)
double x, y;
mpfr_t xx, yy;
int i, c;
+ mp_prec_t p;
mpfr_init (xx);
mpfr_init (yy);
@@ -54,18 +55,30 @@ main (void)
mpfr_set_prec (yy, 65);
mpfr_set_str_raw(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
mpfr_set_str_raw(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
- if (mpfr_cmp2(xx,yy)!=64) { printf("Error (1) in mpfr_cmp\n"); exit(1); }
+ p = 0;
+ if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64)
+ {
+ printf("Error (1) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_str_raw(xx, "0.10100010001110110111000010001000010011111101000100011101000011100");
mpfr_set_str_raw(yy, "0.10100010001110110111000010001000010011111101000100011101000011011");
- if (mpfr_cmp2(xx,yy)!=64) { printf("Error (2) in mpfr_cmp\n"); exit(1); }
+ p = 0;
+ if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64)
+ {
+ printf("Error (2) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160);
mpfr_set_str_raw (xx, "0.1E1");
mpfr_set_str_raw (yy, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100");
- if (mpfr_cmp2 (xx, yy) != 144) {
- printf("Error (3) in mpfr_cmp\n");
- exit(1);
- }
+ p = 0;
+ if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 144)
+ {
+ printf("Error (3) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_prec(xx, 53); mpfr_set_prec(yy, 200);
mpfr_set_d(xx, 1.0, 0);
diff --git a/mpfr/tests/tcmp2.c b/mpfr/tests/tcmp2.c
index b8e557d58..691afa933 100644
--- a/mpfr/tests/tcmp2.c
+++ b/mpfr/tests/tcmp2.c
@@ -54,10 +54,11 @@ set_bit (mpfr_t x, unsigned int n, int b)
mpfr_cmp2 (x, y) returns 1 + |u| + |v| + k for low(x) >= low(y),
and 1 + |u| + |v| + k + 1 otherwise */
void
-worst_cases ()
+worst_cases (void)
{
mpfr_t x, y;
- unsigned int i, j, k, l, b, expected;
+ unsigned int i, j, k, b, expected;
+ mp_prec_t l;
mpfr_init2 (x, 200);
mpfr_init2 (y, 200);
@@ -68,24 +69,26 @@ worst_cases ()
mpfr_set_ui (x, 1, GMP_RNDN);
mpfr_div_2exp (y, y, 1, GMP_RNDN); /* y = 1/2^i */
- if ((l = mpfr_cmp2 (x, y)) != 1)
+ l = 0;
+ if (mpfr_cmp2 (x, y, &l) <= 0 || l != 1)
{
fprintf (stderr, "Error in mpfr_cmp2:\nx=");
mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
fprintf (stderr, "\ny=");
mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
- fprintf (stderr, "\ngot %u instead of %u\n", l, 1);
+ fprintf (stderr, "\ngot %lu instead of %u\n", l, 1);
exit(1);
}
mpfr_add (x, x, y, GMP_RNDN); /* x = 1 + 1/2^i */
- if ((l = mpfr_cmp2 (x, y)) != 0)
+ l = 0;
+ if (mpfr_cmp2 (x, y, &l) <= 0 || l != 0)
{
fprintf (stderr, "Error in mpfr_cmp2:\nx=");
mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
fprintf (stderr, "\ny=");
mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
- fprintf (stderr, "\ngot %u instead of %u\n", l, 0);
+ fprintf (stderr, "\ngot %lu instead of %u\n", l, 0);
exit(1);
}
}
@@ -110,7 +113,7 @@ worst_cases ()
set_bit (x, i + j + k + 2, 1);
set_bit (y, i + j + k + 2, 0);
- l = mpfr_cmp2 (x, y);
+ l = 0; mpfr_cmp2 (x, y, &l);
expected = i + j + k + 1;
if (l != expected)
{
@@ -118,14 +121,14 @@ worst_cases ()
mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
fprintf (stderr, "\ny=");
mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
- fprintf (stderr, "\ngot %u instead of %u\n", l, expected);
+ fprintf (stderr, "\ngot %lu instead of %u\n", l, expected);
exit(1);
}
set_bit (x, i + j + k + 2, 0);
set_bit (x, i + j + k + 3, 0);
set_bit (y, i + j + k + 3, 1);
- l = mpfr_cmp2 (x, y);
+ l = 0; mpfr_cmp2 (x, y, &l);
expected = i + j + k + 2;
if (l != expected)
{
@@ -133,7 +136,7 @@ worst_cases ()
mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
fprintf (stderr, "\ny=");
mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
- fprintf (stderr, "\ngot %u instead of %u\n", l, expected);
+ fprintf (stderr, "\ngot %lu instead of %u\n", l, expected);
exit(1);
}
}
@@ -148,7 +151,7 @@ void
tcmp2 (double x, double y, int i)
{
mpfr_t xx, yy;
- int j;
+ mp_prec_t j;
if (i==-1) {
if (x==y) i=53;
@@ -157,22 +160,35 @@ tcmp2 (double x, double y, int i)
mpfr_init2(xx, 53); mpfr_init2(yy, 53);
mpfr_set_d (xx, x, GMP_RNDN);
mpfr_set_d (yy, y, GMP_RNDN);
- j = mpfr_cmp2 (xx, yy);
- if (j != i) {
+ j = 0;
+ if (mpfr_cmp2 (xx, yy, &j) == 0)
+ {
+ if (x != y)
+ {
+ fprintf (stderr, "Error in mpfr_cmp2 for\nx=");
+ mpfr_out_str (stderr, 2, 0, xx, GMP_RNDN);
+ fprintf (stderr, "\ny=");
+ mpfr_out_str (stderr, 2, 0, yy, GMP_RNDN);
+ fprintf (stderr, "\ngot sign 0 for x != y\n");
+ exit(1);
+ }
+ }
+ else if (j != i) {
fprintf (stderr, "Error in mpfr_cmp2 for\nx=");
mpfr_out_str (stderr, 2, 0, xx, GMP_RNDN);
fprintf (stderr, "\ny=");
mpfr_out_str (stderr, 2, 0, yy, GMP_RNDN);
- fprintf (stderr, "\ngot %u instead of %u\n", j, i);
+ fprintf (stderr, "\ngot %lu instead of %u\n", j, i);
exit(1);
}
mpfr_clear(xx); mpfr_clear(yy);
}
-void special ()
+void
+special (void)
{
mpfr_t x, y;
- int j;
+ mp_prec_t j;
mpfr_init (x); mpfr_init (y);
@@ -181,37 +197,40 @@ void special ()
mpfr_set_prec (y, 65);
mpfr_set_str_raw (x, "0.10000000000000000000000000000000000001110010010110100110011110000E1");
mpfr_set_str_raw (y, "0.11100100101101001100111011111111110001101001000011101001001010010E-35");
- if ((j = mpfr_cmp2 (x, y)) != 1) {
+ j = 0;
+ if (mpfr_cmp2 (x, y, &j) <= 0 || j != 1) {
printf ("Error in mpfr_cmp2:\n");
printf ("x=");
- mpfr_print_raw (x);
+ mpfr_print_binary (x);
putchar ('\n');
printf ("y=");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
- printf ("got %d, expected 1\n", j);
+ printf ("got %lu, expected 1\n", j);
exit (1);
}
mpfr_set_prec(x, 127); mpfr_set_prec(y, 127);
mpfr_set_str_raw(x, "0.1011010000110111111000000101011110110001000101101011011110010010011110010000101101000010011001100110010000000010110000101000101E6");
mpfr_set_str_raw(y, "0.1011010000110111111000000101011011111100011101000011001111000010100010100110110100110010011001100110010000110010010110000010110E6");
- if ((j=mpfr_cmp2(x, y)) != 32) {
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 32) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_raw(x); putchar('\n');
- printf("y="); mpfr_print_raw(y); putchar('\n');
- printf("got %d, expected 32\n", j);
+ printf("x="); mpfr_print_binary(x); putchar('\n');
+ printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("got %lu, expected 32\n", j);
exit(1);
}
mpfr_set_prec (x, 128); mpfr_set_prec (y, 239);
mpfr_set_str_raw (x, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100100000000000E167");
mpfr_set_str_raw (y, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100011111111111111111111111111111111111111111111111011111100101011100011001101000100111000010000000000101100110000111111000101E167");
- if ((j=mpfr_cmp2(x, y)) != 164) {
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 164) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_raw(x); putchar('\n');
- printf("y="); mpfr_print_raw(y); putchar('\n');
- printf("got %d, expected 164\n", j);
+ printf("x="); mpfr_print_binary(x); putchar('\n');
+ printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("got %lu, expected 164\n", j);
exit(1);
}
@@ -219,11 +238,12 @@ void special ()
mpfr_set_prec (x, 130); mpfr_set_prec (y, 130);
mpfr_set_str_raw (x, "0.1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E2");
mpfr_set_str_raw (y, "0.1011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100E2");
- if ((j=mpfr_cmp2(x, y)) != 127) {
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 127) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_raw(x); putchar('\n');
- printf("y="); mpfr_print_raw(y); putchar('\n');
- printf("got %d, expected 127\n", j);
+ printf("x="); mpfr_print_binary(x); putchar('\n');
+ printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("got %lu, expected 127\n", j);
exit(1);
}
@@ -231,11 +251,12 @@ void special ()
mpfr_set_prec (x, 65); mpfr_set_prec (y, 65);
mpfr_set_ui (x, 5, GMP_RNDN);
mpfr_set_str_raw (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3");
- if ((j=mpfr_cmp2(x, y)) != 63) {
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_raw(x); putchar('\n');
- printf("y="); mpfr_print_raw(y); putchar('\n');
- printf("got %d, expected 63\n", j);
+ printf("x="); mpfr_print_binary(x); putchar('\n');
+ printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("got %lu, expected 63\n", j);
exit(1);
}
@@ -243,11 +264,12 @@ void special ()
mpfr_set_prec (x, 65); mpfr_set_prec (y, 65);
mpfr_set_str_raw (x, "0.10011011111000101001110000000000000000000000000000000000000000000E-69");
mpfr_set_str_raw (y, "0.10011011111000101001101111111111111111111111111111111111111111101E-69");
- if ((j=mpfr_cmp2(x, y)) != 63) {
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_raw(x); putchar('\n');
- printf("y="); mpfr_print_raw(y); putchar('\n');
- printf("got %d, expected 63\n", j);
+ printf("x="); mpfr_print_binary(x); putchar('\n');
+ printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("got %lu, expected 63\n", j);
exit(1);
}
diff --git a/mpfr/tests/teuler.c b/mpfr/tests/tconst_euler.c
index c1a82e00d..ab9f74321 100644
--- a/mpfr/tests/teuler.c
+++ b/mpfr/tests/tconst_euler.c
@@ -29,7 +29,7 @@ int
main (int argc, char *argv[])
{
mpfr_t gamma, y, z, t;
- unsigned int err, prec, yprec, p0 = 1, p1 = 200;
+ unsigned int err, prec, yprec, p0 = 2, p1 = 200;
mp_rnd_t rnd;
prec = (argc < 2) ? 53 : atoi(argv[1]);
@@ -74,7 +74,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf (" approximation was ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
diff --git a/mpfr/tests/tconst_log2.c b/mpfr/tests/tconst_log2.c
new file mode 100644
index 000000000..b3b120d61
--- /dev/null
+++ b/mpfr/tests/tconst_log2.c
@@ -0,0 +1,116 @@
+/* Test file for mpfr_const_log2.
+
+Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+
+This file is part of the MPFR Library.
+
+The MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the 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 <stdio.h>
+#include <stdlib.h>
+#include "gmp.h"
+#include "mpfr.h"
+
+/* tlog2 [prec] [rnd] [0 = no print] */
+
+extern mp_prec_t __mpfr_const_log2_prec;
+void check _PROTO ((mp_prec_t, mp_prec_t));
+
+void
+check (mp_prec_t p0, mp_prec_t p1)
+{
+ mpfr_t x, y, z;
+ mp_rnd_t rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init2 (z, p1 + 10);
+ mpfr_const_log2 (z, GMP_RNDN);
+ __mpfr_const_log2_prec = 1;
+
+ for (; p0<=p1; p0++)
+ {
+ mpfr_set_prec (x, p0);
+ mpfr_set_prec (y, p0);
+ for (rnd = 0; rnd < 4; rnd++)
+ {
+ mpfr_const_log2 (x, rnd);
+ mpfr_set (y, z, rnd);
+ if (mpfr_cmp (x, y) && mpfr_can_round (z, mpfr_get_prec(z), GMP_RNDN,
+ rnd, p0))
+ {
+ fprintf (stderr, "mpfr_const_log2 fails for prec=%u, rnd=%s\n",
+ (unsigned int) p0, mpfr_print_rnd_mode (rnd));
+ fprintf (stderr, "expected ");
+ mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ fprintf (stderr, "\ngot ");
+ mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ int p;
+ unsigned char rnd;
+
+ p = (argc>1) ? atoi(argv[1]) : 53;
+ rnd = (argc>2) ? atoi(argv[2]) : GMP_RNDZ;
+
+ mpfr_init (x);
+
+ check (2, 1000);
+
+ /* check precision of 2 bits */
+ mpfr_set_prec (x, 2);
+ mpfr_const_log2 (x, GMP_RNDN);
+ if (mpfr_get_d (x) != 0.75)
+ {
+ fprintf (stderr, "mpfr_const_log2 failed for prec=2, rnd=GMP_RNDN\n");
+ fprintf (stderr, "expected 0.75, got %f\n", mpfr_get_d (x));
+ exit (1);
+ }
+
+ if (argc>=2)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_const_log2 (x, rnd);
+ printf ("log(2)=");
+ mpfr_out_str (stdout, 10, 0, x, rnd);
+ putchar('\n');
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_const_log2 (x, rnd);
+ if (mpfr_get_d(x) != 6.9314718055994530941e-1)
+ {
+ fprintf (stderr, "mpfr_const_log2 failed for prec=53\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+
+ return 0;
+}
diff --git a/mpfr/tests/tpi.c b/mpfr/tests/tconst_pi.c
index 60604d3e8..60604d3e8 100644
--- a/mpfr/tests/tpi.c
+++ b/mpfr/tests/tconst_pi.c
diff --git a/mpfr/tests/tcos.c b/mpfr/tests/tcos.c
index 440c0bbdc..f50767500 100644
--- a/mpfr/tests/tcos.c
+++ b/mpfr/tests/tcos.c
@@ -60,6 +60,11 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_init (y);
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 2);
+ mpfr_set_d (x, 9.81333845856942e-1, GMP_RNDN);
+ mpfr_cos (y, x, GMP_RNDN);
+
mpfr_set_prec (x, 30);
mpfr_set_prec (y, 30);
mpfr_set_str_raw (x, "1.00001010001101110010100010101e-1");
@@ -68,8 +73,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for prec=30, rnd=GMP_RNDU\n");
- printf ("expected "); mpfr_print_raw (x); putchar ('\n');
- printf (" got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar ('\n');
+ printf (" got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
@@ -81,8 +86,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for prec=59, rnd=GMP_RNDU\n");
- printf ("expected "); mpfr_print_raw (x); putchar ('\n');
- printf (" got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar ('\n');
+ printf (" got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
@@ -94,7 +99,7 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for x=1.1100e-2, rnd=GMP_RNDD\n");
- printf ("expected 1.1100e-1, got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
@@ -114,7 +119,7 @@ main (int argc, char *argv[])
check53 (1.00591265847407274059, 0.53531755997839769456, GMP_RNDN);
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
mpfr_clear (x);
mpfr_clear (y);
diff --git a/mpfr/tests/tcosh.c b/mpfr/tests/tcosh.c
index be1789fb7..44421b380 100644
--- a/mpfr/tests/tcosh.c
+++ b/mpfr/tests/tcosh.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/tdiv.c b/mpfr/tests/tdiv.c
index fca86efb0..70bb7ca47 100644
--- a/mpfr/tests/tdiv.c
+++ b/mpfr/tests/tdiv.c
@@ -19,7 +19,6 @@ 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>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -27,6 +26,8 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-test.h"
+#define NaN (0./0.)
+
#define check53(n, d, rnd, res) check4(n, d, rnd, 53, res)
void check4 _PROTO((double, double, mp_rnd_t, int, double));
@@ -82,7 +83,7 @@ check24 (float N, float D, mp_rnd_t rnd_mode, float Q)
/* the following examples come from the paper "Number-theoretic Test
Generation for Directed Rounding" from Michael Parks, Table 2 */
void
-check_float()
+check_float(void)
{
float b=8388608.0; /* 2^23 */
@@ -128,7 +129,7 @@ check_float()
}
void
-check_convergence ()
+check_convergence (void)
{
mpfr_t x, y; int i, j;
@@ -146,8 +147,8 @@ check_convergence ()
mpfr_set_str_raw(y, "0.10010010011011010100101001010111100000101110010010101E-529");
if (mpfr_cmp(x, y)) {
fprintf(stderr, "Error in mpfr_div for prec=64, rnd=GMP_RNDN\n");
- printf("got "); mpfr_print_raw(x); putchar('\n');
- printf("instead of "); mpfr_print_raw(y); putchar('\n');
+ printf("got "); mpfr_print_binary(x); putchar('\n');
+ printf("instead of "); mpfr_print_binary(y); putchar('\n');
exit(1);
}
@@ -161,7 +162,7 @@ check_convergence ()
if (mpfr_cmp_ui(y, 1)) {
fprintf(stderr, "mpfr_div failed for x=1.0, y=1.0, prec=%u rnd=%s\n",
i, mpfr_print_rnd_mode(j));
- printf("got "); mpfr_print_raw(y); putchar('\n');
+ printf("got "); mpfr_print_binary(y); putchar('\n');
exit(1);
}
}
@@ -171,7 +172,7 @@ check_convergence ()
}
void
-check_lowr ()
+check_lowr (void)
{
mpfr_t x, y, z, z2, z3, tmp;
int k, c;
@@ -195,8 +196,8 @@ check_lowr ()
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", c);
exit(1);
}
@@ -214,33 +215,33 @@ check_lowr ()
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", c);
exit(1);
}
else if (c == 2)
{
- mpfr_add_one_ulp(z);
+ mpfr_add_one_ulp(z, GMP_RNDN);
if (mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", 1);
exit(1);
}
}
else if (c == -2)
{
- mpfr_sub_one_ulp(z);
+ mpfr_sub_one_ulp(z, GMP_RNDN);
if (mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", 1);
exit(1);
}
@@ -261,7 +262,7 @@ check_lowr ()
mpfr_random(tmp);
mpfr_mul(x, z, tmp, GMP_RNDN);
mpfr_set(y, tmp, GMP_RNDD);
- mpfr_add_one_ulp(x);
+ mpfr_add_one_ulp(x, GMP_RNDN);
c = mpfr_div(z2, x, y, GMP_RNDD);
mpfr_div(z3, x, y, GMP_RNDD);
@@ -270,8 +271,8 @@ check_lowr ()
if (c != -1 || mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDD\n");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", c);
exit(1);
}
@@ -283,8 +284,8 @@ check_lowr ()
if (c != 1 || mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDU\n");
- printf("got "); mpfr_print_raw(z2); putchar('\n');
- printf("instead of "); mpfr_print_raw(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); putchar('\n');
+ printf("instead of "); mpfr_print_binary(z); putchar('\n');
printf("inex flag = %d\n", c);
exit(1);
}
@@ -301,7 +302,7 @@ check_lowr ()
#define MAX_PREC 100
void
-check_inexact ()
+check_inexact (void)
{
mpfr_t x, y, z, u;
mp_prec_t px, py, pu;
@@ -315,7 +316,7 @@ check_inexact ()
mpfr_set_prec (x, 33);
mpfr_set_str_raw (x, "0.101111100011011101010011101100001E0");
- mpfr_set_prec (u, 1);
+ mpfr_set_prec (u, 2);
mpfr_set_str_raw (u, "0.1E0");
mpfr_set_prec (y, 28);
if ((inexact = mpfr_div (y, x, u, GMP_RNDN) >= 0))
@@ -334,19 +335,19 @@ check_inexact ()
{
fprintf (stderr, "Wrong inexact flag (1): expected 1, got %d\n",
inexact);
- mpfr_print_raw(y); putchar('\n');
+ mpfr_print_binary(y); putchar('\n');
exit (1);
}
- for (px=1; px<MAX_PREC; px++)
+ for (px=2; px<MAX_PREC; px++)
{
mpfr_set_prec (x, px);
mpfr_random (x);
- for (pu=1; pu<=MAX_PREC; pu++)
+ for (pu=2; pu<=MAX_PREC; pu++)
{
mpfr_set_prec (u, pu);
do { mpfr_random (u); } while (mpfr_cmp_ui (u, 0) == 0);
- for (py=1; py<=MAX_PREC; py++)
+ for (py=2; py<=MAX_PREC; py++)
{
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + pu);
@@ -366,10 +367,10 @@ check_inexact ()
fprintf (stderr, "Wrong inexact flag for rnd=%s\n",
mpfr_print_rnd_mode(rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("u="); mpfr_print_raw (u); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("y*u="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("u="); mpfr_print_binary (u); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("y*u="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
}
@@ -425,12 +426,12 @@ main (int argc, char *argv[])
65, 0.0);
check53(9.89438396044940256501e-134, 5.93472984109987421717e-67, GMP_RNDU,
1.6672003992376663654e-67);
- check53(1.0, sqrt(-1.0), GMP_RNDD, sqrt(-1.0));
- check53(sqrt(-1.0), 1.0, GMP_RNDD, sqrt(-1.0));
+ check53(1.0, NaN, GMP_RNDD, NaN);
+ check53(NaN, 1.0, GMP_RNDD, NaN);
check53(2.0/0.0, 1.0, GMP_RNDD, 1.0/0.0);
check53(1.0, 2.0/0.0, GMP_RNDD, 0.0);
- check53(0.0, 0.0, GMP_RNDD, sqrt(-1.0));
- check53(1.0/0.0, 1.0/0.0, GMP_RNDD, sqrt(-1.0));
+ check53(0.0, 0.0, GMP_RNDD, NaN);
+ check53(1.0/0.0, 1.0/0.0, GMP_RNDD, NaN);
check53(9.89438396044940256501e-134, -5.93472984109987421717e-67, GMP_RNDU,
-1.6672003992376663654e-67);
check53(-4.53063926135729747564e-308, 7.02293374921793516813e-84, GMP_RNDD,
@@ -445,7 +446,7 @@ main (int argc, char *argv[])
#ifdef TEST
srand48(getpid());
for (i=0;i<N;i++) {
- do { n = drand(); d = drand(); e = fabs(n)/fabs(d); }
+ do { n = drand(); d = drand(); e = ABS(n)/ABS(d); }
/* smallest normalized is 2^(-1022), largest is 2^(1023)*(2-2^(-52)) */
while (e>=MAXNORM || e<MINNORM);
check4(n, d, rand() % 4, 53, 0.0);
diff --git a/mpfr/tests/tdiv_ui.c b/mpfr/tests/tdiv_ui.c
index c89a57742..77de7e123 100644
--- a/mpfr/tests/tdiv_ui.c
+++ b/mpfr/tests/tdiv_ui.c
@@ -19,7 +19,6 @@ 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>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -84,10 +83,16 @@ special (void)
mpfr_set_prec (x, 110);
mpfr_set_prec (y, 60);
mpfr_set_str_raw (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44");
- mpfr_div_ui(y, x, 17, __gmp_default_rounding_mode);
- if (mpfr_get_d (y) != 2.8114572543455207632e-15)
+ mpfr_div_ui (y, x, 17, GMP_RNDN);
+ mpfr_set_str_raw (x, "0.11001010100101100011101110000001100001010110101001010011011E-48");
+ if (mpfr_cmp (x, y))
{
- fprintf (stderr, "Error in x / 17 for x=1/16!\n");
+ fprintf (stderr, "Error in x/17 for x=1/16!\n");
+ fprintf (stderr, "Expected ");
+ mpfr_out_str (stderr, 2, 0, x, GMP_RNDN);
+ fprintf (stderr, "\nGot ");
+ mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ fprintf (stderr, "\n");
exit (1);
}
@@ -102,8 +107,8 @@ special (void)
if (mpfr_get_d (x) != mpfr_get_d (y))
{
fprintf (stderr, "division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
- printf ("expected "); mpfr_print_raw (x); putchar ('\n');
- printf ("got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
}
@@ -114,7 +119,7 @@ special (void)
}
void
-check_inexact ()
+check_inexact (void)
{
mpfr_t x, y, z;
mp_prec_t px, py;
@@ -126,12 +131,12 @@ check_inexact ()
mpfr_init (y);
mpfr_init (z);
- for (px=1; px<300; px++)
+ for (px=2; px<300; px++)
{
mpfr_set_prec (x, px);
mpfr_random (x);
do { u = lrand48 (); } while (u == 0);
- for (py=1; py<300; py++)
+ for (py=2; py<300; py++)
{
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + mp_bits_per_limb);
@@ -141,8 +146,8 @@ check_inexact ()
if (mpfr_mul_ui (z, y, u, rnd))
{
fprintf (stderr, "z <- y * u should be exact for u=%lu\n", u);
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("z="); mpfr_print_raw (z); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("z="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
cmp = mpfr_cmp (z, x);
@@ -152,8 +157,8 @@ check_inexact ()
{
fprintf (stderr, "Wrong inexact flag for u=%lu, rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
}
@@ -175,7 +180,7 @@ main (int argc, char **argv)
srand(getpid());
for (i=0;i<1000000;i++) {
do { u = lrand48(); } while (u==0);
- do { d = drand(); } while (fabs(d/u)<2.2e-307);
+ do { d = drand(); } while (ABS(d/u)<2.2e-307);
check(d, u, rand() % 4, 0.0);
}
#endif
diff --git a/mpfr/tests/tdump.c b/mpfr/tests/tdump.c
index 8c3a51f09..8da7069f9 100644
--- a/mpfr/tests/tdump.c
+++ b/mpfr/tests/tdump.c
@@ -30,11 +30,11 @@ main (void)
{
mpfr_t z;
- mpfr_init2(z, 100);
- mpfr_set_ui(z, 0, GMP_RNDN);
- mpfr_dump(z, GMP_RNDD);
- printf(" ^--- 0.e1 printed above is ok\n");
- mpfr_clear(z);
+ mpfr_init2 (z, 2);
+ mpfr_set_ui (z, 0, GMP_RNDN);
+ mpfr_dump (z, GMP_RNDD);
+ printf (" ^--- 0.00e0 printed above is ok\n");
+ mpfr_clear (z);
return 0;
}
diff --git a/mpfr/tests/teq.c b/mpfr/tests/teq.c
index 91fe9bbcb..fbb9a82b9 100644
--- a/mpfr/tests/teq.c
+++ b/mpfr/tests/teq.c
@@ -26,6 +26,7 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-impl.h"
+void teq _PROTO ((mpfr_t));
void
teq (mpfr_t x)
@@ -47,8 +48,8 @@ teq (mpfr_t x)
!mpfr_eq(y, x, k - 1))
{
fprintf(stderr, "Error in eq.\n");
- printf("x = "); mpfr_print_raw(x); printf("\n");
- printf("y = "); mpfr_print_raw(y); printf("\n");
+ printf("x = "); mpfr_print_binary(x); printf("\n");
+ printf("y = "); mpfr_print_binary(y); printf("\n");
printf("k = %ld\n", k);
printf("mpfr_eq(y, x, k) = %d\nmpfr_eq(y, x, k - 1) = %d\n", mpfr_eq(y, x, k),mpfr_eq(y, x, k - 1));
mpfr_clear(x); mpfr_clear(y);
diff --git a/mpfr/tests/texceptions.c b/mpfr/tests/texceptions.c
index 1c84fe37f..ed981ba7a 100644
--- a/mpfr/tests/texceptions.c
+++ b/mpfr/tests/texceptions.c
@@ -92,7 +92,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error: x+x rounded to nearest for x=2^1023 should give +Inf\n");
printf ("emax = %ld\n", mpfr_get_emax ());
- printf ("got "); mpfr_print_raw (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); putchar ('\n');
exit (1);
}
@@ -112,7 +112,7 @@ main (int argc, char *argv[])
if (mpfr_cmp_ui (y, 0))
{
fprintf (stderr, "Error: y-x rounded to zero should give 0 for y=3/2*2^(-1022), x=2^(-1022)\n");
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
diff --git a/mpfr/tests/texp.c b/mpfr/tests/texp.c
index 6cff7fee8..21e19fb0c 100644
--- a/mpfr/tests/texp.c
+++ b/mpfr/tests/texp.c
@@ -102,7 +102,7 @@ check_large (double d, int n, mp_rnd_t rnd)
else printf("exp(%1.20e)=",d);
mpfr_out_str(stdout, 10, 0, y, rnd);
putchar('\n');
- printf(" ="); mpfr_print_raw(y); putchar('\n');
+ printf(" ="); mpfr_print_binary(y); putchar('\n');
if (n==53) printf(" =%1.20e\n", mpfr_get_d(y));
mpfr_clear(x); mpfr_clear(y);
@@ -124,7 +124,7 @@ check_worst_case (double X, double expx)
mpfr_exp(x, x, GMP_RNDN);
mpfr_set_d(x, X, GMP_RNDN);
mpfr_exp(x, x, GMP_RNDU);
- mpfr_add_one_ulp(y);
+ mpfr_add_one_ulp(y, GMP_RNDN);
if (mpfr_cmp(x,y)) {
fprintf(stderr, "exp(x) rounded towards +infinity is wrong\n"); exit(1);
}
@@ -134,7 +134,7 @@ check_worst_case (double X, double expx)
/* worst cases communicated by Jean-Michel Muller and Vincent Lefevre */
int
-check_worst_cases ()
+check_worst_cases (void)
{
mpfr_t x; mpfr_t y;
@@ -178,23 +178,36 @@ compare_exp2_exp3 (int n)
{
mpfr_t x, y, z; int prec; mp_rnd_t rnd;
- mpfr_init(x); mpfr_init(y); mpfr_init(z);
- for (prec=20;prec<=n;prec++) {
- mpfr_set_prec(x, prec); mpfr_set_prec(y, prec); mpfr_set_prec(z, prec);
- mpfr_random(x);
- rnd = rand() % 4;
- mpfr_exp_2 (y, x, rnd);
- mpfr_exp3 (z, x, rnd);
- if (mpfr_cmp(y,z)) {
- printf("mpfr_exp_2 and mpfr_exp3 disagree for rnd=%s and\nx=",
- mpfr_print_rnd_mode(rnd));
- mpfr_print_raw(x); putchar('\n');
- printf("mpfr_exp_2 gives "); mpfr_print_raw(y); putchar('\n');
- printf("mpfr_exp3 gives "); mpfr_print_raw(z); putchar('\n');
- exit(1);
- }
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ for (prec=20; prec<=n; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_random (x);
+ rnd = rand() % 4;
+ mpfr_exp_2 (y, x, rnd);
+ mpfr_exp3 (z, x, rnd);
+ if (mpfr_cmp (y,z))
+ {
+ printf ("mpfr_exp_2 and mpfr_exp3 disagree for rnd=%s and\nx=",
+ mpfr_print_rnd_mode (rnd));
+ mpfr_print_binary (x);
+ putchar ('\n');
+ printf ("mpfr_exp_2 gives ");
+ mpfr_print_binary (y);
+ putchar ('\n');
+ printf ("mpfr_exp3 gives ");
+ mpfr_print_binary (z);
+ putchar ('\n');
+ exit (1);
+ }
}
- mpfr_clear(x); mpfr_clear(y); mpfr_clear(z);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
}
#define TEST_FUNCTION mpfr_exp
@@ -207,7 +220,7 @@ main (int argc, char *argv[])
int i, N, s=0, e, maxe=0; double d, lo, hi;
#endif
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
if (argc == 4)
{
diff --git a/mpfr/tests/texp2.c b/mpfr/tests/texp2.c
index 27efc99b7..7b9487c45 100644
--- a/mpfr/tests/texp2.c
+++ b/mpfr/tests/texp2.c
@@ -39,7 +39,7 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_init (y);
-
+ MPFR_CLEAR_NAN(x);
MPFR_SET_INF(x);
mpfr_exp2 (y, x, GMP_RNDN);
if(!MPFR_IS_INF(y))
@@ -64,7 +64,7 @@ main (int argc, char *argv[])
exit (1);
}
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
mpfr_clear (x);
mpfr_clear (y);
diff --git a/mpfr/tests/texpm1.c b/mpfr/tests/texpm1.c
index ce1a90494..f05f7d22a 100644
--- a/mpfr/tests/texpm1.c
+++ b/mpfr/tests/texpm1.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/tfactorial.c b/mpfr/tests/tfactorial.c
index 9656f4643..4b81bb22a 100644
--- a/mpfr/tests/tfactorial.c
+++ b/mpfr/tests/tfactorial.c
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
exit (1);
}
- for (prec = 1; prec <= 100; prec++)
+ for (prec = 2; prec <= 100; prec++)
{
mpfr_set_prec (x, prec);
mpfr_set_prec (z, prec);
@@ -84,7 +84,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag: expected inexact\n");
printf ("n=%u prec=%u\n", n, prec);
- mpfr_print_raw(z); putchar('\n');
+ mpfr_print_binary(z); putchar('\n');
exit (1);
}
}
@@ -101,7 +101,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf (" approximation was ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
diff --git a/mpfr/tests/tfma.c b/mpfr/tests/tfma.c
index 4db3a26bb..d661e78a1 100644
--- a/mpfr/tests/tfma.c
+++ b/mpfr/tests/tfma.c
@@ -39,6 +39,15 @@ main (int argc, char *argv[])
mpfr_init (y);
mpfr_init (z);
+ /* check special cases */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 2);
+ mpfr_set_prec (s, 2);
+ mpfr_set_d (x, -0.75, GMP_RNDN);
+ mpfr_set_d (y, 0.5, GMP_RNDN);
+ mpfr_set_d (z, 0.375, GMP_RNDN);
+ mpfr_fma (s, x, y, z, GMP_RNDU); /* result is 0 */
MPFR_SET_NAN(x);
mpfr_random(y);
@@ -46,7 +55,7 @@ main (int argc, char *argv[])
mpfr_fma (s,x, y,z, GMP_RNDN);
if(!MPFR_IS_NAN(s))
{
- printf ("evaluation of function in x=NAN does not return NAN");
+ fprintf (stderr, "evaluation of function in x=NAN does not return NAN");
exit (1);
}
@@ -220,7 +229,7 @@ main (int argc, char *argv[])
int inexact, compare;
unsigned int n;
- int p0=1;
+ int p0=2;
int p1=200;
int N=200;
@@ -238,7 +247,6 @@ main (int argc, char *argv[])
for (n=0; n<N; n++)
{
-
mpfr_random (x);
mpfr_random (y);
mpfr_random (z);
@@ -276,7 +284,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf ("approx ");
- mpfr_print_raw (slong);
+ mpfr_print_binary (slong);
putchar ('\n');
exit (1);
}
diff --git a/mpfr/tests/tgeneric.c b/mpfr/tests/tgeneric.c
index d03e3ed9e..8ce1153cb 100644
--- a/mpfr/tests/tgeneric.c
+++ b/mpfr/tests/tgeneric.c
@@ -70,7 +70,7 @@ test_generic (int p0, int p1, int N)
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf ("approx ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
@@ -87,9 +87,9 @@ test_generic (int p0, int p1, int N)
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("t="); mpfr_print_raw (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("t="); mpfr_print_binary (t); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/tget_d.c b/mpfr/tests/tget_d.c
index 6a6bca608..56de029e2 100644
--- a/mpfr/tests/tget_d.c
+++ b/mpfr/tests/tget_d.c
@@ -1,6 +1,6 @@
/* Test file for mpfr_get_d
-Copyright (C) 1999-2001 Free Software Foundation.
+Copyright (C) 1999-2002 Free Software Foundation.
This file is part of the MPFR Library.
@@ -22,34 +22,88 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
+
+#define TEST
+#include "rnd_mode.c"
int
main (void)
{
- mpfr_t x;
+ mpfr_t half, x, y;
+ mp_rnd_t rnd_mode;
- mpfr_init2 (x, 2);
+ mpfr_init2(half, 2);
+ mpfr_set_ui(half, 1, GMP_RNDZ);
+ mpfr_div_2ui(half, half, 1, GMP_RNDZ); /* has exponent 0 */
- /* checks that rounds to nearest sets the last
- bit to zero in case of equal distance */
- mpfr_set_d (x, 5.0, GMP_RNDN);
- if (mpfr_get_d (x) != 4.0)
- {
- fprintf (stderr, "Error in tget_d: got %1.1f instead of 4.0\n",
- mpfr_get_d (x));
- exit (1);
- }
+ mpfr_init2(x, 128);
+ mpfr_init2(y, 128);
- mpfr_set_d (x, 9.84891017624509146344e-01, GMP_RNDU);
- if (mpfr_get_d (x) != 1.0)
+ for (rnd_mode = 0; rnd_mode <= 3; rnd_mode++)
{
- fprintf (stderr, "Error in tround: got %f instead of 1.0\n",
- mpfr_get_d (x));
- exit (1);
+ int i, j, si, sj;
+ double di, dj;
+
+ mpfr_set_machine_rnd_mode(rnd_mode);
+ for (i = 1, di = 0.25; i < 127; i++, di *= 0.5)
+ for (si = 0; si <= 1; si++)
+ {
+ mpfr_div_2ui(x, half, i, GMP_RNDZ);
+ (si ? mpfr_sub : mpfr_add)(x, half, x, GMP_RNDZ);
+ for (j = i+1, dj = di * 0.5; j < 128 && j < i+53; j++, dj *= 0.5)
+ for (sj = 0; sj <= 1; sj++)
+ {
+ double c, d, dd;
+ int exp;
+ char *f;
+
+ mpfr_div_2ui(y, half, j, GMP_RNDZ);
+ (sj ? mpfr_sub : mpfr_add)(y, x, y, GMP_RNDZ);
+ exp = (rand() % 47) - 23;
+ mpfr_mul_2si(y, y, exp, GMP_RNDZ);
+ if (mpfr_inexflag_p())
+ {
+ fprintf(stderr, "Error in tget_d: inexact flag for "
+ "(i,si,j,sj,rnd,exp) = (%d,%d,%d,%d,%d,%d)\n",
+ i, si, j, sj, rnd_mode, exp);
+ exit(1);
+ }
+ dd = si != sj ? di - dj : di + dj;
+ d = si ? 0.5 - dd : 0.5 + dd;
+ if ((rand() / 1024) & 1)
+ {
+ c = mpfr_get_d(y);
+ f = "mpfr_get_d";
+ }
+ else
+ {
+ exp = (rand() % 47) - 23;
+ c = mpfr_get_d2(y, exp);
+ f = "mpfr_get_d2";
+ if (si) /* then real d < 0.5 */
+ d *= sj && i == 1 ? 4 : 2; /* normalize real d */
+ }
+ if (exp > 0)
+ d *= 1 << exp;
+ if (exp < 0)
+ d /= 1 << -exp;
+ if (c != d)
+ {
+ fprintf(stderr, "Error in tget_d (%s) for "
+ "(i,si,j,sj,rnd,exp) = (%d,%d,%d,%d,%d,%d)\n"
+ "got %.17g instead of %.17g\n",
+ f, i, si, j, sj, rnd_mode, exp, c, d);
+ exit(1);
+ }
+ }
+ }
}
-
- mpfr_clear(x);
+ mpfr_clear(half);
+ mpfr_clear(x);
+ mpfr_clear(y);
return 0;
}
diff --git a/mpfr/tests/tget_str.c b/mpfr/tests/tget_str.c
index 9f6495a11..07ae5c1ae 100644
--- a/mpfr/tests/tget_str.c
+++ b/mpfr/tests/tget_str.c
@@ -51,19 +51,20 @@ check3 (double d, mp_rnd_t rnd, char *res)
{
mpfr_t x; char *str; mp_exp_t e;
- mpfr_init2(x, 53);
- mpfr_set_d(x, d, rnd);
- str = mpfr_get_str(NULL, &e, 10, 5, x, rnd);
- if (strcmp(str, res)) {
- fprintf(stderr, "Error in mpfr_get_str for x=%1.20e\n", d);
- fprintf(stderr, "got %s instead of %s\n", str, res);
- }
- mpfr_clear(x);
- free(str);
+ mpfr_init2 (x, 53);
+ mpfr_set_d (x, d, rnd);
+ str = mpfr_get_str (NULL, &e, 10, 5, x, rnd);
+ if (strcmp(str, res))
+ {
+ fprintf (stderr, "Error in mpfr_get_str for x=%1.20e\n", d);
+ fprintf (stderr, "got %s instead of %s\n", str, res);
+ }
+ mpfr_clear (x);
+ free (str);
}
void
-check_small ()
+check_small (void)
{
mpfr_t x;
char *s;
diff --git a/mpfr/tests/thyperbolic.c b/mpfr/tests/thyperbolic.c
index 5f310283b..f3f8cdcd8 100644
--- a/mpfr/tests/thyperbolic.c
+++ b/mpfr/tests/thyperbolic.c
@@ -52,7 +52,7 @@ check_NAN (void)
/******cosh********/
tester=mpfr_cosh(ch,t,GMP_RNDD);
- if (!MPFR_IS_NAN(ch) || !tester )
+ if (!MPFR_IS_NAN(ch) || tester!=0 )
{
printf("cosh NAN \n");
mpfr_clear(t);
@@ -68,7 +68,7 @@ check_NAN (void)
/******sinh********/
tester=mpfr_sinh(sh,t,GMP_RNDD);
- if (!MPFR_IS_NAN(sh) || !tester )
+ if (!MPFR_IS_NAN(sh) || tester!=0 )
{
printf("sinh NAN \n");
mpfr_clear(t);
@@ -84,7 +84,7 @@ check_NAN (void)
/******tanh********/
tester=mpfr_tanh(th,t,GMP_RNDD);
- if (!MPFR_IS_NAN(th) || !tester )
+ if (!MPFR_IS_NAN(th) || tester!=0 )
{
printf("tanh NAN \n");
mpfr_clear(t);
@@ -100,7 +100,7 @@ check_NAN (void)
/******acosh********/
tester=mpfr_acosh(ach,t,GMP_RNDD);
- if (!MPFR_IS_NAN(ach) || !tester )
+ if (!MPFR_IS_NAN(ach) || tester!=0 )
{
printf("acosh NAN \n");
return(1);
@@ -109,7 +109,7 @@ check_NAN (void)
/******asinh********/
tester=mpfr_asinh(ash,t,GMP_RNDD);
- if (!MPFR_IS_NAN(ash) || !tester )
+ if (!MPFR_IS_NAN(ash) || tester!=0 )
{
printf("asinh NAN \n");
mpfr_clear(t);
@@ -125,7 +125,7 @@ check_NAN (void)
/******atanh********/
tester=mpfr_atanh(ath,t,GMP_RNDD);
- if (!MPFR_IS_NAN(ath) || !tester )
+ if (!MPFR_IS_NAN(ath) || tester!=0 )
{
printf("atanh NAN \n");
mpfr_clear(t);
@@ -291,7 +291,7 @@ check_INF (void)
mpfr_init2(ash,200);
mpfr_init2(ath,200);
-
+ MPFR_CLEAR_NAN(t);
MPFR_SET_INF(t);
if(MPFR_SIGN(t)<0)
@@ -300,7 +300,7 @@ check_INF (void)
/******cosh********/
tester = mpfr_cosh(ch,t,GMP_RNDD);
- if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester )
+ if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0 )
{
printf("cosh(INF) \n");
mpfr_clear(t);
@@ -316,7 +316,7 @@ check_INF (void)
/******sinh********/
tester=mpfr_sinh(sh,t,GMP_RNDD);
- if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester )
+ if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0 )
{
printf("sinh(INF) \n");
mpfr_clear(t);
@@ -332,7 +332,7 @@ check_INF (void)
/******tanh********/
tester=mpfr_tanh(th,t,GMP_RNDD);
- if (mpfr_cmp_ui(th,1) != 0 || tester )
+ if (mpfr_cmp_ui(th,1) != 0 || tester!=0 )
{
printf("tanh(INF) \n");
mpfr_clear(t);
@@ -348,7 +348,7 @@ check_INF (void)
/******acosh********/
tester=mpfr_acosh(ach,t,GMP_RNDD);
- if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || !tester )
+ if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0 )
{
printf("acosh(INF) \n");
mpfr_clear(t);
@@ -364,7 +364,7 @@ check_INF (void)
/******asinh********/
tester=mpfr_asinh(ash,t,GMP_RNDD);
- if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || !tester )
+ if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0 )
{
printf("asinh(INF) \n");
mpfr_clear(t);
@@ -398,7 +398,7 @@ check_INF (void)
/******cosh********/
tester=mpfr_cosh(ch,t,GMP_RNDD);
- if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester )
+ if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0 )
{
printf("cosh(-INF) \n");
mpfr_clear(t);
@@ -414,7 +414,7 @@ check_INF (void)
/******sinh********/
tester=mpfr_sinh(sh,t,GMP_RNDD);
- if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester )
+ if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0 )
{
printf("sinh(-INF) \n");
mpfr_clear(t);
@@ -430,7 +430,7 @@ check_INF (void)
/******tanh********/
tester=mpfr_tanh(th,t,GMP_RNDD);
- if (!mpfr_cmp_ui(th,-1) || tester )
+ if (!mpfr_cmp_ui(th,-1) || tester!=0 )
{
printf("tanh(-INF) \n");
mpfr_clear(t);
@@ -446,7 +446,7 @@ check_INF (void)
/******acosh********/
tester=mpfr_acosh(ach,t,GMP_RNDD);
- if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || !tester )
+ if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0 )
{
printf("acosh(-INF) \n");
mpfr_clear(t);
@@ -462,7 +462,7 @@ check_INF (void)
/******asinh********/
tester=mpfr_asinh(ash,t,GMP_RNDD);
- if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || !tester )
+ if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0 )
{
printf("asinh(-INF) \n");
mpfr_clear(t);
@@ -594,7 +594,7 @@ check_O (void)
}
int
-main()
+main(void)
{
if (check_INF())printf("Error in evaluation of INF\n");
diff --git a/mpfr/tests/thypot.c b/mpfr/tests/thypot.c
index 38e4b0938..42621c3e6 100644
--- a/mpfr/tests/thypot.c
+++ b/mpfr/tests/thypot.c
@@ -34,7 +34,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- unsigned int prec, err, yprec, n, p0 = 1, p1 = 100, N = 100;
+ unsigned int prec, err, yprec, n, p0 = 2, p1 = 100, N = 100;
mp_rnd_t rnd;
mpfr_t x1, x2, y, z, t;
int inexact, compare, compare2;
@@ -92,7 +92,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf (" approximation was ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
@@ -109,9 +109,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x1="); mpfr_print_raw (x1); putchar ('\n');
- printf ("x2="); mpfr_print_raw (x2); putchar ('\n');
- printf ("t="); mpfr_print_raw (t); putchar ('\n');
+ printf ("x1="); mpfr_print_binary (x1); putchar ('\n');
+ printf ("x2="); mpfr_print_binary (x2); putchar ('\n');
+ printf ("t="); mpfr_print_binary (t); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/tlog.c b/mpfr/tests/tlog.c
index e386018f0..a3e2bc049 100644
--- a/mpfr/tests/tlog.c
+++ b/mpfr/tests/tlog.c
@@ -43,7 +43,7 @@ void special _PROTO((void));
double
-drand_log ()
+drand_log (void)
{
double d; INT32 *i;
@@ -107,7 +107,7 @@ check3 (double d, unsigned long prec, mp_rnd_t rnd)
mpfr_set_d(x, d, rnd);
mpfr_log(y, x, rnd);
mpfr_out_str(stdout, 10, 0, y, rnd); putchar('\n');
- mpfr_print_raw(y); putchar('\n');
+ mpfr_print_binary(y); putchar('\n');
mpfr_clear(x); mpfr_clear(y);
}
@@ -155,7 +155,7 @@ slave (int N, int p)
*/
void
-check_worst_cases ()
+check_worst_cases (void)
{
check2(1.00089971802309629645, GMP_RNDD, 8.99313519443722736088e-04);
check2(1.00089971802309629645, GMP_RNDN, 8.99313519443722844508e-04);
@@ -239,7 +239,7 @@ check_worst_cases ()
}
void
-special ()
+special (void)
{
mpfr_t x, y;
@@ -352,7 +352,7 @@ main (int argc, char *argv[])
check2(6.09969788341579732815e+00,GMP_RNDD,1.80823924264386204363e+00);
}
- test_generic (1, 100, 40);
+ test_generic (2, 100, 40);
return 0;
}
diff --git a/mpfr/tests/tlog_base_10.c b/mpfr/tests/tlog10.c
index a8e77e3d0..6d134321b 100644
--- a/mpfr/tests/tlog_base_10.c
+++ b/mpfr/tests/tlog10.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/tlog1p.c b/mpfr/tests/tlog1p.c
index 20038d2fb..9716f2e9c 100644
--- a/mpfr/tests/tlog1p.c
+++ b/mpfr/tests/tlog1p.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/tlog2.c b/mpfr/tests/tlog2.c
index 3d9dc721a..efe4f53a5 100644
--- a/mpfr/tests/tlog2.c
+++ b/mpfr/tests/tlog2.c
@@ -1,6 +1,7 @@
-/* Test file for mpfr_const_log2.
+/* Test file for mpfr_log2.
-Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+Copyright (C) 2001 Free Software Foundation.
+Adapted from tsinh.c.
This file is part of the MPFR Library.
@@ -23,27 +24,15 @@ MA 02111-1307, USA. */
#include <stdlib.h>
#include "gmp.h"
#include "mpfr.h"
+#include "mpfr-test.h"
-/* tlog2 [prec] [rnd] [0 = no print] */
+#define TEST_FUNCTION mpfr_log2
+#include "tgeneric.c"
int
main (int argc, char *argv[])
{
- mpfr_t x;
- int p;
- unsigned char rnd;
-
- p = (argc>1) ? atoi(argv[1]) : 53;
- rnd = (argc>2) ? atoi(argv[2]) : GMP_RNDZ;
- mpfr_init2(x, p);
- mpfr_const_log2(x, rnd);
- if (argc>=2) {
- printf("log(2)="); mpfr_out_str(stdout, 10, 0, x, rnd); putchar('\n');
- }
- else if (mpfr_get_d(x) != 6.9314718055994530941e-1) {
- fprintf(stderr, "mpfr_const_log2 failed for prec=53\n"); exit(1);
- }
- mpfr_clear(x);
+ test_generic (2, 100, 30);
return 0;
}
diff --git a/mpfr/tests/tlog_base_2.c b/mpfr/tests/tlog_base_2.c
deleted file mode 100644
index d0f1aa019..000000000
--- a/mpfr/tests/tlog_base_2.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Test file for mpfr_log2.
-
-Copyright (C) 2001 Free Software Foundation.
-Adapted from tsinh.c.
-
-This file is part of the MPFR Library.
-
-The MPFR Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or (at your
-option) any later version.
-
-The MPFR Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the 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 <stdio.h>
-#include <stdlib.h>
-#include "gmp.h"
-#include "mpfr.h"
-#include "mpfr-test.h"
-
-#define TEST_FUNCTION mpfr_log2
-#include "tgeneric.c"
-
-int
-main (int argc, char *argv[])
-{
- test_generic (1, 100, 30);
-
- return 0;
-}
diff --git a/mpfr/tests/tmul.c b/mpfr/tests/tmul.c
index cd7e0a2f1..5c49f869b 100644
--- a/mpfr/tests/tmul.c
+++ b/mpfr/tests/tmul.c
@@ -23,7 +23,9 @@ MA 02111-1307, USA. */
#include <stdlib.h>
#include <unistd.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
#include "mpfr-test.h"
void check _PROTO((double, double, mp_rnd_t, unsigned int,
@@ -33,6 +35,8 @@ void check24 _PROTO((float, float, mp_rnd_t, float));
void check_float _PROTO((void));
void check_sign _PROTO((void));
void check_exact _PROTO((void));
+void check_max _PROTO((void));
+void check_min _PROTO((void));
/* checks that x*y gives the same results in double
and with mpfr with 53 bits of precision */
@@ -42,9 +46,9 @@ check (double x, double y, mp_rnd_t rnd_mode, unsigned int px,
{
double z1, z2; mpfr_t xx, yy, zz;
- mpfr_init2(xx, px);
- mpfr_init2(yy, py);
- mpfr_init2(zz, pz);
+ mpfr_init2 (xx, px);
+ mpfr_init2 (yy, py);
+ mpfr_init2 (zz, pz);
mpfr_set_d(xx, x, rnd_mode);
mpfr_set_d(yy, y, rnd_mode);
mpfr_mul(zz, xx, yy, rnd_mode);
@@ -69,13 +73,13 @@ check53 (double x, double y, mp_rnd_t rnd_mode, double z1)
{
double z2; mpfr_t xx, yy, zz;
- mpfr_init2(xx, 53);
- mpfr_init2(yy, 53);
- mpfr_init2(zz, 53);
- mpfr_set_d(xx, x, rnd_mode);
- mpfr_set_d(yy, y, rnd_mode);
- mpfr_mul(zz, xx, yy, rnd_mode);
- z2 = mpfr_get_d(zz);
+ mpfr_init2 (xx, 53);
+ mpfr_init2 (yy, 53);
+ mpfr_init2 (zz, 53);
+ mpfr_set_d (xx, x, rnd_mode);
+ mpfr_set_d (yy, y, rnd_mode);
+ mpfr_mul (zz, xx, yy, rnd_mode);
+ z2 = mpfr_get_d (zz);
if (z1!=z2 && (!isnan(z1) || !isnan(z2))) {
printf("mpfr_mul failed for x=%1.20e y=%1.20e with rnd_mode=%s\n",
x, y, mpfr_print_rnd_mode(rnd_mode));
@@ -92,13 +96,13 @@ check24 (float x, float y, mp_rnd_t rnd_mode, float z1)
{
float z2; mpfr_t xx, yy, zz;
- mpfr_init2(xx, 24);
- mpfr_init2(yy, 24);
- mpfr_init2(zz, 24);
- mpfr_set_d(xx, x, rnd_mode);
- mpfr_set_d(yy, y, rnd_mode);
- mpfr_mul(zz, xx, yy, rnd_mode);
- z2 = (float) mpfr_get_d(zz);
+ mpfr_init2 (xx, 24);
+ mpfr_init2 (yy, 24);
+ mpfr_init2 (zz, 24);
+ mpfr_set_d (xx, x, rnd_mode);
+ mpfr_set_d (yy, y, rnd_mode);
+ mpfr_mul (zz, xx, yy, rnd_mode);
+ z2 = (float) mpfr_get_d (zz);
if (z1!=z2) {
printf("mpfr_mul failed for x=%1.0f y=%1.0f with prec=24 and rnd_mode=%s\n", x, y, mpfr_print_rnd_mode(rnd_mode));
printf("libm.a gives %1.0f, mpfr_mul gives %1.0f\n", z1, z2);
@@ -110,7 +114,7 @@ check24 (float x, float y, mp_rnd_t rnd_mode, float z1)
/* the following examples come from the paper "Number-theoretic Test
Generation for Directed Rounding" from Michael Parks, Table 1 */
void
-check_float ()
+check_float (void)
{
check24(8388609.0, 8388609.0, GMP_RNDN, 70368760954880.0);
check24(16777213.0, 8388609.0, GMP_RNDN, 140737479966720.0);
@@ -155,11 +159,12 @@ check_float ()
/* check sign of result */
void
-check_sign ()
+check_sign (void)
{
mpfr_t a, b;
- mpfr_init2(a, 53); mpfr_init2(b, 53);
+ mpfr_init2 (a, 53);
+ mpfr_init2 (b, 53);
mpfr_set_d(a, -1.0, GMP_RNDN);
mpfr_set_d(b, 2.0, GMP_RNDN);
mpfr_mul(a, b, b, GMP_RNDN);
@@ -171,7 +176,7 @@ check_sign ()
/* checks that the inexact return value is correct */
void
-check_exact ()
+check_exact (void)
{
mpfr_t a, b, c, d;
mp_prec_t prec;
@@ -240,6 +245,99 @@ check_exact ()
mpfr_clear (d);
}
+void
+check_max(void)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_init2(xx, 4);
+ mpfr_init2(yy, 4);
+ mpfr_init2(zz, 4);
+ mpfr_set_d(xx, 11.0/16, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, GMP_RNDN);
+ mpfr_set_d(yy, 11.0/16, GMP_RNDN);
+ mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, GMP_RNDN);
+ mpfr_clear_flags();
+ mpfr_mul(zz, xx, yy, GMP_RNDU);
+ if (!(mpfr_overflow_p() && MPFR_IS_INF(zz)))
+ {
+ printf("check_max failed (should be an overflow)\n");
+ exit(1);
+ }
+
+ mpfr_clear_flags();
+ mpfr_mul(zz, xx, yy, GMP_RNDD);
+ if (mpfr_overflow_p() || MPFR_IS_INF(zz))
+ {
+ printf("check_max failed (should NOT be an overflow)\n");
+ exit(1);
+ }
+ mpfr_set_d(xx, 15.0/16, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, GMP_RNDN);
+ if (!(MPFR_IS_FP(xx) && MPFR_IS_FP(zz)))
+ {
+ printf("check_max failed (internal error)\n");
+ exit(1);
+ }
+ if (mpfr_cmp(xx, zz) != 0)
+ {
+ printf("check_max failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ printf(" instead of ");
+ mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ);
+ printf("\n");
+ exit(1);
+ }
+
+ mpfr_clear(xx);
+ mpfr_clear(yy);
+ mpfr_clear(zz);
+}
+
+void
+check_min(void)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_init2(xx, 4);
+ mpfr_init2(yy, 4);
+ mpfr_init2(zz, 3);
+ mpfr_set_d(xx, 15.0/16, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, GMP_RNDN);
+ mpfr_set_d(yy, 15.0/16, GMP_RNDN);
+ mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, GMP_RNDN);
+ mpfr_mul(zz, xx, yy, GMP_RNDD);
+ if (mpfr_sgn(zz) != 0)
+ {
+ printf("check_min failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ printf(" instead of 0\n");
+ exit(1);
+ }
+
+ mpfr_mul(zz, xx, yy, GMP_RNDU);
+ mpfr_set_d(xx, 0.5, GMP_RNDN);
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, GMP_RNDN);
+ if (mpfr_sgn(xx) <= 0)
+ {
+ printf("check_min failed (internal error)\n");
+ exit(1);
+ }
+ if (mpfr_cmp(xx, zz) != 0)
+ {
+ printf("check_min failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ);
+ printf(" instead of ");
+ mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ);
+ printf("\n");
+ exit(1);
+ }
+
+ mpfr_clear(xx);
+ mpfr_clear(yy);
+ mpfr_clear(zz);
+}
+
int
main (int argc, char *argv[])
{
@@ -263,7 +361,7 @@ main (int argc, char *argv[])
check53(0.31869277231188065, 0.88642843322303122, GMP_RNDZ,
2.8249833483992453642e-1);
check(8.47622108205396074254e-01, 3.24039313247872939883e-01, GMP_RNDU,
- 28, 45, 1, 0.5);
+ 28, 45, 2, 0.375);
check(2.63978122803639081440e-01, 6.8378615379333496093e-1, GMP_RNDN,
34, 23, 31, 0.180504585267044603);
check(1.0, 0.11835170935876249132, GMP_RNDU, 6, 41, 36, 0.1183517093595583);
@@ -275,7 +373,9 @@ main (int argc, char *argv[])
check(3.90798504668055102229e-14, 9.85394674650308388664e-04, GMP_RNDN,
46, 22, 12, 0.385027296503914762e-16);
check(4.58687081072827851358e-01, 2.20543551472118792844e-01, GMP_RNDN,
- 49, 3, 1, 0.125);
+ 49, 3, 2, 0.09375);
+ check_max();
+ check_min();
#ifdef TEST
srand48(getpid());
prec = (argc<2) ? 53 : atoi(argv[1]);
diff --git a/mpfr/tests/tmul_ui.c b/mpfr/tests/tmul_ui.c
index 0bc0f5d14..8ca7491b6 100644
--- a/mpfr/tests/tmul_ui.c
+++ b/mpfr/tests/tmul_ui.c
@@ -23,6 +23,7 @@ MA 02111-1307, USA. */
#include <stdlib.h>
#include <math.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
#include "mpfr-impl.h"
@@ -47,7 +48,8 @@ check_inexact (mp_prec_t p)
fprintf (stderr, "Error: result should be exact\n");
exit (1);
}
- for (q=1; q<=p; q++)
+
+ for (q=2; q<=p; q++)
for (rnd=0; rnd<4; rnd++)
{
mpfr_set_prec (y, q);
@@ -63,11 +65,11 @@ check_inexact (mp_prec_t p)
}
}
- mpfr_set_prec (x, 1);
- mpfr_set_ui (x, 2, GMP_RNDN);
- if (mpfr_mul_ui (x, x, 3, GMP_RNDZ) == 0)
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 1, GMP_RNDN);
+ if (mpfr_mul_ui (x, x, 5, GMP_RNDZ) == 0)
{
- fprintf (stderr, "mul_ui(2, 3) cannot be exact with prec=1\n");
+ fprintf (stderr, "mul_ui(1, 5) cannot be exact with prec=2\n");
exit (1);
}
@@ -83,7 +85,7 @@ main (int argc, char *argv[])
unsigned int xprec, yprec, i;
mp_prec_t p;
- for (p=1; p<100; p++)
+ for (p=2; p<100; p++)
for (i=1; i<50; i++)
check_inexact (p);
@@ -101,8 +103,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mpfr_mul_ui: 1*y != y\n");
- printf ("y= "); mpfr_print_raw (y); putchar ('\n');
- printf ("1*y="); mpfr_print_raw (x); putchar ('\n');
+ printf ("y= "); mpfr_print_binary (y); putchar ('\n');
+ printf ("1*y="); mpfr_print_binary (x); putchar ('\n');
exit (1);
}
@@ -145,7 +147,7 @@ main (int argc, char *argv[])
mpfr_mul_ui(x, y, 4, GMP_RNDZ);
if (mpfr_cmp_ui(x, 0) <= 0) {
fprintf(stderr, "Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0));
exit(1);
}
@@ -158,7 +160,7 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mul_ui for 1335*(0.100001111E9)\n");
- printf ("got "); mpfr_print_raw (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); putchar ('\n');
exit(1);
}
@@ -171,7 +173,7 @@ main (int argc, char *argv[])
mpfr_set_str_raw(y, "0.1111101111010101111111100011010010111010111110110011001E67");
if (mpfr_cmp(x, y)) {
printf("Error for 121*y: expected result is:\n");
- mpfr_print_raw(y); putchar('\n');
+ mpfr_print_binary(y); putchar('\n');
}
mpfr_set_prec (x, 32);
@@ -198,8 +200,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
printf ("Error for 23 * 2143861251406875.0\n");
- printf ("expected "); mpfr_print_raw (x); putchar ('\n');
- printf ("got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
@@ -215,13 +217,26 @@ main (int argc, char *argv[])
if (mpfr_get_d (x) != mpfr_get_d (y))
{
fprintf (stderr, "multiplication by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
- printf ("expected "); mpfr_print_raw (x); putchar ('\n');
- printf ("got "); mpfr_print_raw (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
}
}
+ mpfr_set_prec (x, 128);
+ mpfr_set_ui (x, 17, GMP_RNDN);
+ mpfr_mul_ui (x, x, MP_LIMB_T_HIGHBIT, GMP_RNDN);
+ mpfr_set_prec (y, 128);
+ mpfr_set_ui (y, MP_LIMB_T_HIGHBIT, GMP_RNDN);
+ mpfr_mul_ui (y, y, 17, GMP_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for 17 * 2^MP_LIMB_T_HIGHBIT\n");
+ exit (1);
+ }
+
+
mpfr_clear(x); mpfr_clear(y);
return 0;
diff --git a/mpfr/tests/tout_str.c b/mpfr/tests/tout_str.c
index 7138ce62d..7269a5017 100644
--- a/mpfr/tests/tout_str.c
+++ b/mpfr/tests/tout_str.c
@@ -50,53 +50,57 @@ check4(double d, mp_rnd_t rnd, int base, int prec)
}
void
-check_large ()
+check_large (void)
{
mpfr_t x; mp_exp_t e; char *s;
mpfr_init(x);
- mpfr_set_prec(x, 7);
- mpfr_set_str_raw(x, "0.1010101E10");
- s = mpfr_get_str(NULL, &e, 10, 2, x, GMP_RNDU);
- free(s);
+ mpfr_set_prec (x, 7);
+ mpfr_set_str_raw (x, "0.1010101E10");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ free (s);
/* checks rounding of negative numbers */
- mpfr_set_d(x, -1.5, GMP_RNDN);
- s = mpfr_get_str(NULL, &e, 10, 1, x, GMP_RNDD);
- if (strcmp(s, "-2")) {
- fprintf(stderr, "Error in mpfr_get_str for x=-1.5 and rnd=GMP_RNDD\n");
- free(s); mpfr_clear(x);
- exit(1);
+ mpfr_set_prec (x, 7);
+ mpfr_set_d (x, -11.5, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD);
+ if (strcmp (s, "-12"))
+ {
+ fprintf (stderr, "Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDD\n");
+ free (s);
+ mpfr_clear (x);
+ exit (1);
}
- free(s);
-
- s = mpfr_get_str(NULL, &e, 10, 1, x, GMP_RNDU);
- if (strcmp(s, "-1")) {
- fprintf(stderr, "Error in mpfr_get_str for x=-1.5 and rnd=GMP_RNDU\n");
- free(s);
- mpfr_clear(x);
- exit(1);
- }
-
- free(s);
+ free (s);
+
+ s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ if (strcmp (s, "-11"))
+ {
+ fprintf (stderr, "Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDU\n");
+ free (s);
+ mpfr_clear (x);
+ exit (1);
+ }
+ free (s);
/* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */
- mpfr_set_prec(x, 128);
- mpfr_set_str_raw(x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3");
- s = mpfr_get_str(NULL, &e, 10, 0, x, GMP_RNDU);
- free(s);
+ mpfr_set_prec (x, 128);
+ mpfr_set_str_raw (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3");
+ s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDU);
+ free (s);
- mpfr_set_prec(x, 381);
- mpfr_set_str_raw(x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010");
+ mpfr_set_prec (x, 381);
+ mpfr_set_str_raw (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010");
s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDD);
- if (e != 0) {
- fprintf(stderr, "Error in mpfr_get_str for x=0.999999..., exponent is %d instead of 0\n", (int) e);
- exit(1);
- }
- free(s);
-
- mpfr_clear(x);
+ if (e != 0)
+ {
+ fprintf (stderr, "Error in mpfr_get_str for x=0.999999..., exponent is %d instead of 0\n", (int) e);
+ exit (1);
+ }
+ free (s);
+
+ mpfr_clear (x);
}
int
@@ -128,12 +132,16 @@ main (int argc, char *argv[])
/* random tests */
srand(getpid());
- for (i=0;i<N;i++) {
- do { d = drand(); } while (isnan(d));
- r = rand()%4;
- p = 2 + rand()%35;
- check(d, r, p);
- }
+ for (i=0;i<N;i++)
+ {
+ do
+ {
+ d = drand();
+ } while (isnan(d));
+ r = rand() % 4;
+ p = 2 + rand() % 35;
+ check (d, r, p);
+ }
return 0;
}
diff --git a/mpfr/tests/tpow.c b/mpfr/tests/tpow.c
index 5a8727a95..b54a53679 100644
--- a/mpfr/tests/tpow.c
+++ b/mpfr/tests/tpow.c
@@ -28,7 +28,7 @@ void check_pow_ui _PROTO ((void));
void check_inexact _PROTO ((mp_prec_t));
void
-check_pow_ui ()
+check_pow_ui (void)
{
mpfr_t a, b;
@@ -78,7 +78,7 @@ check_inexact (mp_prec_t p)
mpfr_init (t);
mpfr_random (x);
u = lrand48() % 2;
- for (q=1; q<=p; q++)
+ for (q=2; q<=p; q++)
for (rnd=0; rnd<4; rnd++)
{
mpfr_set_prec (y, q);
@@ -93,10 +93,10 @@ check_inexact (mp_prec_t p)
{
fprintf (stderr, "results differ for u=%lu rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("t="); mpfr_print_raw (t); putchar ('\n');
- printf ("z="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("t="); mpfr_print_binary (t); putchar ('\n');
+ printf ("z="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
if (((inexact == 0) && (cmp != 0)) ||
@@ -105,8 +105,8 @@ check_inexact (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
(unsigned) p, (unsigned) q, mpfr_print_rnd_mode (rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("u=%lu x=", u); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
+ printf ("u=%lu x=", u); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
}
@@ -125,7 +125,7 @@ main (void)
check_pow_ui ();
- for (p=1; p<100; p++)
+ for (p=2; p<100; p++)
check_inexact (p);
return 0;
diff --git a/mpfr/tests/tpow3.c b/mpfr/tests/tpow3.c
index 52fcba886..12b945e55 100644
--- a/mpfr/tests/tpow3.c
+++ b/mpfr/tests/tpow3.c
@@ -338,7 +338,7 @@ main (int argc, char *argv[])
int inexact, compare, compare2;
unsigned int n, err;
- int p0=1;
+ int p0=2;
int p1=100;
int N=100;
@@ -385,7 +385,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf ("approx ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
@@ -402,9 +402,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("t="); mpfr_print_raw (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("t="); mpfr_print_binary (t); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/trint.c b/mpfr/tests/trint.c
new file mode 100644
index 000000000..9c5935490
--- /dev/null
+++ b/mpfr/tests/trint.c
@@ -0,0 +1,92 @@
+/* Test file for mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round.
+
+Copyright (C) 2002 Free Software Foundation.
+
+This file is part of the MPFR Library.
+
+The MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the 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 <stdio.h>
+#include <stdlib.h>
+#include "gmp.h"
+#include "mpfr.h"
+
+int
+main (void)
+{
+ mp_size_t s;
+ mpz_t z;
+ mp_prec_t p;
+ mpfr_t x, y, t;
+ mp_rnd_t r;
+ int inexact, sign_t;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpz_init (z);
+ mpfr_init (t);
+ mpz_set_ui (z, 1);
+ for (s = 2; s < 100; s++)
+ {
+ /* z has exactly s bits */
+
+ mpz_mul_2exp (z, z, 1);
+ if (rand () % 2)
+ mpz_add_ui (z, z, 1);
+ mpfr_set_prec (x, s);
+ mpfr_set_prec (t, s);
+ if (mpfr_set_z (x, z, GMP_RNDN))
+ {
+ fprintf (stderr, "Error: mpfr_set_z should be exact (s = %u)\n",
+ (unsigned int) s);
+ exit (1);
+ }
+ for (p=2; p<100; p++)
+ {
+ mpfr_set_prec (y, p);
+ for (r=0; r<4; r++)
+ {
+ if (r == GMP_RNDN)
+ inexact = mpfr_round (y, x);
+ else if (r == GMP_RNDZ)
+ inexact = mpfr_trunc (y, x);
+ else if (r == GMP_RNDU)
+ inexact = mpfr_ceil (y, x);
+ else /* r = GMP_RNDD */
+ inexact = mpfr_floor (y, x);
+ if (mpfr_sub (t, y, x, GMP_RNDN))
+ {
+ fprintf (stderr, "Error: subtraction should be exact\n");
+ exit (1);
+ }
+ sign_t = mpfr_cmp_ui (t, 0);
+ if (((inexact == 0) && (sign_t != 0)) ||
+ ((inexact < 0) && (sign_t >= 0)) ||
+ ((inexact > 0) && (sign_t <= 0)))
+ {
+ fprintf (stderr, "Wrong inexact flag\n");
+ exit (1);
+ }
+ }
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpz_clear (z);
+ mpfr_clear (t);
+
+ return 0;
+}
diff --git a/mpfr/tests/tround.c b/mpfr/tests/tround_prec.c
index 315884ad4..72437f26a 100644
--- a/mpfr/tests/tround.c
+++ b/mpfr/tests/tround_prec.c
@@ -1,6 +1,6 @@
-/* Test file for mpfr_round.
+/* Test file for mpfr_round_prec.
-Copyright (C) 1999-2001 Free Software Foundation.
+Copyright (C) 1999-2002 Free Software Foundation.
This file is part of the MPFR Library.
@@ -32,7 +32,7 @@ main (void)
mpfr_init2 (x, 3);
mpfr_set_ui (x, 5, GMP_RNDN);
- mpfr_round (x, GMP_RNDN, 2);
+ mpfr_round_prec (x, GMP_RNDN, 2);
if (mpfr_cmp_ui(x, 4))
{
fprintf (stderr, "Error in tround: got %1.1f instead of 4\n",
@@ -43,7 +43,7 @@ main (void)
/* check case when reallocation is needed */
mpfr_set_prec (x, 3);
mpfr_set_ui (x, 5, GMP_RNDN); /* exact */
- mpfr_round (x, GMP_RNDN, mp_bits_per_limb + 1);
+ mpfr_round_prec (x, GMP_RNDN, mp_bits_per_limb + 1);
if (mpfr_cmp_ui(x, 5))
{
fprintf (stderr, "Error in tround: got %1.1f instead of 5\n",
@@ -51,10 +51,21 @@ main (void)
exit (1);
}
+ mpfr_clear(x);
+ mpfr_init2 (x, 3);
+ mpfr_set_si (x, -5, GMP_RNDN); /* exact */
+ mpfr_round_prec (x, GMP_RNDN, mp_bits_per_limb + 1);
+ if (mpfr_cmp_si(x, -5))
+ {
+ fprintf (stderr, "Error in tround: got %1.1f instead of -5\n",
+ mpfr_get_d (x));
+ exit (1);
+ }
+
/* check case when new precision needs less limbs */
mpfr_set_prec (x, mp_bits_per_limb + 1);
mpfr_set_ui (x, 5, GMP_RNDN); /* exact */
- mpfr_round (x, GMP_RNDN, 3); /* exact */
+ mpfr_round_prec (x, GMP_RNDN, 3); /* exact */
if (mpfr_cmp_ui(x, 5))
{
fprintf (stderr, "Error in tround: got %1.1f instead of 5\n",
diff --git a/mpfr/tests/tset.c b/mpfr/tests/tset.c
index cca6611e6..1ae5951d6 100644
--- a/mpfr/tests/tset.c
+++ b/mpfr/tests/tset.c
@@ -26,7 +26,7 @@ MA 02111-1307, USA. */
#include "mpfr.h"
int
-main ()
+main (void)
{
mp_prec_t p, q;
mpfr_t x, y, z, u;
@@ -41,22 +41,22 @@ main ()
mpfr_set_prec (y, 11);
mpfr_set_str_raw (y, "0.11111111100E-8");
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
mpfr_set (x, y, GMP_RNDN);
mpfr_set_str_raw (y, "1.0E-8");
if (mpfr_cmp (x, y))
{
- fprintf (stderr, "Error for y=0.11111111100E-8, prec=1, rnd=GMP_RNDN\n");
+ fprintf (stderr, "Error for y=0.11111111100E-8, prec=2, rnd=GMP_RNDN\n");
exit (1);
}
- for (p=1; p<500; p++)
+ for (p=2; p<500; p++)
{
mpfr_set_prec (x, p);
mpfr_random (x);
if (rand () % 2)
mpfr_neg (x, x, GMP_RNDN);
- for (q=1; q<2*p; q++)
+ for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
for (rnd=0; rnd<4; rnd++)
diff --git a/mpfr/tests/tset_d.c b/mpfr/tests/tset_d.c
index eae93a2c8..3a1ace898 100644
--- a/mpfr/tests/tset_d.c
+++ b/mpfr/tests/tset_d.c
@@ -1,6 +1,6 @@
/* Test file for mpfr_set_d and mpfr_get_d.
-Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+Copyright (C) 1999-2002 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -26,8 +26,6 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-test.h"
-extern int isnan();
-
int
main (int argc, char *argv[])
{
@@ -40,18 +38,43 @@ main (int argc, char *argv[])
set_fpc_csr(exp.fc_word);
#endif
- mpfr_init(x);
+ mpfr_init2 (x, 2);
+
+ /* checks that rounds to nearest sets the last
+ bit to zero in case of equal distance */
+ mpfr_set_d (x, 5.0, GMP_RNDN);
+ if (mpfr_get_d (x) != 4.0)
+ {
+ fprintf (stderr, "Error in tset_d: got %g instead of 4.0\n",
+ mpfr_get_d (x));
+ exit (1);
+ }
+ mpfr_set_d (x, -5.0, GMP_RNDN);
+ if (mpfr_get_d (x) != -4.0)
+ {
+ fprintf (stderr, "Error in tset_d: got %g instead of -4.0\n",
+ mpfr_get_d (x));
+ exit (1);
+ }
+
+ mpfr_set_d (x, 9.84891017624509146344e-01, GMP_RNDU);
+ if (mpfr_get_d (x) != 1.0)
+ {
+ fprintf (stderr, "Error in tset_d: got %g instead of 1.0\n",
+ mpfr_get_d (x));
+ exit (1);
+ }
mpfr_init2(z, 32);
mpfr_set_d(z, 1.0, 0);
if (mpfr_get_d(z) != 1.0) {
- mpfr_print_raw(z); putchar('\n');
+ mpfr_print_binary(z); putchar('\n');
printf("Error: 1.0 != 1.0\n"); exit(1);
}
mpfr_set_prec(x, 53); mpfr_init2(y, 53);
mpfr_set_d(x, d=-1.08007920352320089721e+150, 0);
if (mpfr_get_d(x) != d) {
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d,
mpfr_get_d(x)); exit(1);
}
@@ -60,7 +83,7 @@ main (int argc, char *argv[])
d = -6.72658901114033715233e-165;
mpfr_set_d(x, d, 0);
if (d != mpfr_get_d(x)) {
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d,
mpfr_get_d(x)); exit(1);
}
@@ -74,7 +97,7 @@ main (int argc, char *argv[])
{
fprintf(stderr,
"Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d(x));
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
exit(1);
}
}
diff --git a/mpfr/tests/tset_f.c b/mpfr/tests/tset_f.c
index a6d16e6f9..59af6a940 100644
--- a/mpfr/tests/tset_f.c
+++ b/mpfr/tests/tset_f.c
@@ -71,15 +71,15 @@ main (void)
for (k = 1; k <= 100000; k++)
{
- pr = 1 + (rand()&255);
- mpf_set_prec(z, pr);
- mpf_random2(z, z->_mp_prec, 0);
- mpfr_init2(x, pr);
- mpfr_set_f(x, z, 0);
- mpfr_clear(x);
+ pr = 2 + (rand()&255);
+ mpf_set_prec (z, pr);
+ mpf_random2 (z, z->_mp_prec, 0);
+ mpfr_init2 (x, pr);
+ mpfr_set_f (x, z, 0);
+ mpfr_clear (x);
}
- mpf_clear(y);
- mpf_clear(z);
+ mpf_clear (y);
+ mpf_clear (z);
return 0;
}
diff --git a/mpfr/tests/tset_si.c b/mpfr/tests/tset_si.c
index cb74a51a4..17ef0af63 100644
--- a/mpfr/tests/tset_si.c
+++ b/mpfr/tests/tset_si.c
@@ -75,14 +75,14 @@ main (int argc, char *argv[])
}
}
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
if (mpfr_set_si (x, 5, GMP_RNDZ) >= 0)
{
fprintf (stderr, "Wrong inexact flag for x=5, rnd=GMP_RNDZ\n");
exit (1);
}
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
if (mpfr_set_si (x, -5, GMP_RNDZ) <= 0)
{
fprintf (stderr, "Wrong inexact flag for x=-5, rnd=GMP_RNDZ\n");
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
|| inex >= 0)
{
fprintf(stderr, "Error in mpfr_set_si(x:3, 77617, GMP_RNDD)\n");
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
exit(1);
}
inex = mpfr_set_ui(x, 77617, GMP_RNDD); /* should be 65536 */
@@ -103,22 +103,22 @@ main (int argc, char *argv[])
|| inex >= 0)
{
fprintf(stderr, "Error in mpfr_set_ui(x:3, 77617, GMP_RNDD)\n");
- mpfr_print_raw(x); putchar('\n');
+ mpfr_print_binary(x); putchar('\n');
exit(1);
}
- mpfr_set_prec(x, 1);
+ mpfr_set_prec(x, 2);
inex = mpfr_set_si(x, 33096, GMP_RNDU);
- if (mpfr_get_d(x) != 65536.0 || inex <= 0)
+ if (mpfr_get_d(x) != 49152.0 || inex <= 0)
{
- fprintf(stderr, "Error in mpfr_set_si, expected 65536, got %lu, inex %d\n",
+ fprintf(stderr, "Error in mpfr_set_si, expected 49152, got %lu, inex %d\n",
(unsigned long) mpfr_get_d(x), inex);
exit(1);
}
inex = mpfr_set_ui(x, 33096, GMP_RNDU);
- if (mpfr_get_d(x) != 65536.0)
+ if (mpfr_get_d(x) != 49152.0)
{
- fprintf(stderr, "Error in mpfr_set_ui, expected 65536, got %lu, inex %d\n",
+ fprintf(stderr, "Error in mpfr_set_ui, expected 49152, got %lu, inex %d\n",
(unsigned long) mpfr_get_d(x), inex);
exit(1);
}
diff --git a/mpfr/tests/tset_str.c b/mpfr/tests/tset_str.c
index 18c3b5f61..0477fcef3 100644
--- a/mpfr/tests/tset_str.c
+++ b/mpfr/tests/tset_str.c
@@ -84,9 +84,9 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mpfr_set_str\n");
- mpfr_print_raw(x);
+ mpfr_print_binary(x);
putchar('\n');
- mpfr_print_raw(y);
+ mpfr_print_binary(y);
putchar('\n');
mpfr_clear(x);
mpfr_clear(y);
@@ -150,11 +150,11 @@ main (int argc, char *argv[])
fprintf (stderr, "mpfr_set_str o mpfr_get_str <> id for rnd_mode=%s\n",
mpfr_print_rnd_mode (k));
printf ("x=");
- mpfr_print_raw (x);
+ mpfr_print_binary (x);
putchar('\n');
printf ("s=%s, exp=%d, base=%d\n", str, (int) e, base);
printf ("y=");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar('\n');
mpfr_clear (x);
mpfr_clear (y);
diff --git a/mpfr/tests/tset_z.c b/mpfr/tests/tset_z.c
index 221605a3e..c76c624c5 100644
--- a/mpfr/tests/tset_z.c
+++ b/mpfr/tests/tset_z.c
@@ -44,7 +44,7 @@ check(long i, unsigned char rnd)
}
void
-check_large ()
+check_large (void)
{
mpz_t z; mpfr_t x,y;
diff --git a/mpfr/tests/tsin.c b/mpfr/tests/tsin.c
index 51cba7e62..ec063a136 100644
--- a/mpfr/tests/tsin.c
+++ b/mpfr/tests/tsin.c
@@ -71,17 +71,30 @@ main (int argc, char *argv[])
check53 (1.00591265847407274059, 8.446508805292128885e-1, GMP_RNDN);
- mpfr_init2 (x, 1);
+ mpfr_init2 (x, 2);
+
mpfr_set_d (x, 0.5, GMP_RNDN);
mpfr_sin (x, x, GMP_RNDD);
- if (mpfr_get_d(x) != 0.25)
+ if (mpfr_get_d(x) != 0.375)
+ {
+ fprintf (stderr, "mpfr_sin(0.5, GMP_RNDD) failed with precision=2\n");
+ exit (1);
+ }
+
+ /* bug found by Kevin Ryde */
+ mpfr_const_pi (x, GMP_RNDN);
+ mpfr_mul_ui (x, x, 3L, GMP_RNDN);
+ mpfr_div_ui (x, x, 2L, GMP_RNDN);
+ mpfr_sin (x, x, GMP_RNDN);
+ if (mpfr_cmp_ui (x, 0) >= 0)
{
- fprintf (stderr, "mpfr_sin(0.5, GMP_RNDD) failed\n");
+ fprintf (stderr, "Error: wrong sign for sin(3*Pi/2)\n");
exit (1);
}
+
mpfr_clear (x);
- test_generic (1, 100, 80);
+ test_generic (2, 100, 80);
return 0;
}
diff --git a/mpfr/tests/tsinh.c b/mpfr/tests/tsinh.c
index 9468585d0..d1cd127cd 100644
--- a/mpfr/tests/tsinh.c
+++ b/mpfr/tests/tsinh.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/tsqrt.c b/mpfr/tests/tsqrt.c
index 2c4df61eb..366e62c53 100644
--- a/mpfr/tests/tsqrt.c
+++ b/mpfr/tests/tsqrt.c
@@ -90,8 +90,8 @@ check4 (double a, mp_rnd_t rnd_mode, char *Q)
if (mpfr_cmp(q, res)) {
printf("mpfr_sqrt failed for a=%1.20e, rnd_mode=%s\n",
a, mpfr_print_rnd_mode(rnd_mode));
- printf("expected "); mpfr_print_raw(res); putchar('\n');
- printf("got "); mpfr_print_raw(q); putchar('\n');
+ printf("expected "); mpfr_print_binary(res); putchar('\n');
+ printf("got "); mpfr_print_binary(q); putchar('\n');
mpfr_clear(q); mpfr_clear(res);
exit(1);
}
@@ -120,7 +120,7 @@ check24 (float a, mp_rnd_t rnd_mode, float Q)
/* the following examples come from the paper "Number-theoretic Test
Generation for Directed Rounding" from Michael Parks, Table 3 */
void
-check_float ()
+check_float (void)
{
float b = 8388608.0; /* 2^23 */
@@ -170,7 +170,7 @@ check_float ()
}
void
-special ()
+special (void)
{
mpfr_t x, z;
int inexact;
@@ -187,17 +187,17 @@ special ()
exit (1);
}
- mpfr_set_prec (x, 1);
- for (p=1; p<1000; p++)
+ mpfr_set_prec (x, 2);
+ for (p=2; p<1000; p++)
{
mpfr_set_prec (z, p);
mpfr_set_ui (z, 1, GMP_RNDN);
- mpfr_add_one_ulp (z);
+ mpfr_add_one_ulp (z, GMP_RNDN);
mpfr_sqrt (x, z, GMP_RNDU);
- if (mpfr_cmp_ui (x, 2))
+ if (mpfr_get_d (x) != 1.5)
{
- fprintf (stderr, "Error: sqrt(1+ulp(1), up) should give 2 (prec=%u)\n", (unsigned) p);
- printf ("got "); mpfr_print_raw (x); putchar ('\n');
+ fprintf (stderr, "Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", (unsigned) p);
+ printf ("got "); mpfr_print_binary (x); putchar ('\n');
exit (1);
}
}
@@ -211,8 +211,8 @@ special ()
exit (1);
}
- mpfr_set_prec (x, 1);
- mpfr_set_prec (z, 1);
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (z, 2);
/* checks the sign is correctly set */
mpfr_set_d (x, 1.0, GMP_RNDN);
@@ -227,7 +227,7 @@ special ()
mpfr_set_prec (x, 192);
mpfr_set_prec (z, 160);
mpfr_set_str_raw (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1");
- mpfr_set_prec(x, 160);
+ mpfr_set_prec (x, 160);
mpfr_sqrt(x, z, GMP_RNDN);
mpfr_sqrt(z, x, GMP_RNDN);
@@ -262,9 +262,9 @@ check_inexact (mp_prec_t p)
fprintf (stderr, "Error: wrong inexact flag, expected %d, got %d\n",
sign, inexact);
printf ("x=");
- mpfr_print_raw (x);
+ mpfr_print_binary (x);
printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd));
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
exit (1);
}
mpfr_clear (x);
@@ -295,7 +295,7 @@ main (void)
check(a, rand() % 4);
}
#endif
- for (p=1; p<200; p++)
+ for (p=2; p<200; p++)
for (k=0; k<200; k++)
check_inexact (p);
special ();
diff --git a/mpfr/tests/tsub.c b/mpfr/tests/tsub.c
index a5319063d..282b1a0af 100644
--- a/mpfr/tests/tsub.c
+++ b/mpfr/tests/tsub.c
@@ -33,7 +33,7 @@ void check_two_sum _PROTO((mp_prec_t));
void check_inexact _PROTO((void));
void
-check_diverse ()
+check_diverse (void)
{
mpfr_t x, y, z;
double res, got;
@@ -53,8 +53,8 @@ check_diverse ()
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (5)\n");
- printf ("expected "); mpfr_print_raw (y); putchar ('\n');
- printf ("got "); mpfr_print_raw (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); putchar ('\n');
+ printf ("got "); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
@@ -66,8 +66,8 @@ check_diverse ()
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (7)\n");
- printf ("expected "); mpfr_print_raw (y); putchar ('\n');
- printf ("got "); mpfr_print_raw (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); putchar ('\n');
+ printf ("got "); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
@@ -79,8 +79,8 @@ check_diverse ()
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (6)\n");
- printf ("expected "); mpfr_print_raw (y); putchar ('\n');
- printf ("got "); mpfr_print_raw (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); putchar ('\n');
+ printf ("got "); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
@@ -115,8 +115,8 @@ check_diverse ()
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mpfr_sub (1 - 1E-33) with prec=33\n");
- printf ("Expected "); mpfr_print_raw (y); putchar ('\n');
- printf ("got "); mpfr_print_raw (x); putchar ('\n');
+ printf ("Expected "); mpfr_print_binary (y); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); putchar ('\n');
exit (1);
}
@@ -128,7 +128,7 @@ check_diverse ()
if (mpfr_cmp_ui (x, 1))
{
fprintf (stderr, "Error in mpfr_sub (1 - 1E-33) with prec=32\n");
- printf ("Expected 1.0, got "); mpfr_print_raw (x); putchar ('\n');
+ printf ("Expected 1.0, got "); mpfr_print_binary (x); putchar ('\n');
exit (1);
}
@@ -198,8 +198,8 @@ check_diverse ()
mpfr_sub (z, x, y, GMP_RNDN);
if (mpfr_cmp (z, x)) {
fprintf (stderr, "mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n");
- printf ("expected "); mpfr_print_raw (x); putchar('\n');
- printf ("got "); mpfr_print_raw (z); putchar('\n');
+ printf ("expected "); mpfr_print_binary (x); putchar('\n');
+ printf ("got "); mpfr_print_binary (z); putchar('\n');
exit (1);
}
@@ -232,7 +232,7 @@ check_diverse ()
exit (1);
}
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
mpfr_set_prec (y, 10);
mpfr_set_prec (z, 10);
mpfr_set_ui (y, 0, GMP_RNDN);
@@ -254,7 +254,7 @@ check_diverse ()
}
void
-bug_ddefour()
+bug_ddefour(void)
{
mpfr_t ex, ex1, ex2, ex3, tot, tot1;
@@ -276,8 +276,8 @@ bug_ddefour()
if (mpfr_cmp(ex2, ex3))
{
fprintf (stderr, "Error in ddefour test.\n");
- printf ("ex2="); mpfr_print_raw (ex2); putchar ('\n');
- printf ("ex3="); mpfr_print_raw (ex3); putchar ('\n');
+ printf ("ex2="); mpfr_print_binary (ex2); putchar ('\n');
+ printf ("ex3="); mpfr_print_binary (ex3); putchar ('\n');
exit (1);
}
@@ -318,11 +318,11 @@ check_two_sum (mp_prec_t p)
{
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
- printf ("x="); mpfr_print_raw(x); putchar('\n');
- printf ("y="); mpfr_print_raw(y); putchar('\n');
- printf ("u="); mpfr_print_raw(u); putchar('\n');
- printf ("v="); mpfr_print_raw(v); putchar('\n');
- printf ("w="); mpfr_print_raw(w); putchar('\n');
+ printf ("x="); mpfr_print_binary(x); putchar('\n');
+ printf ("y="); mpfr_print_binary(y); putchar('\n');
+ printf ("u="); mpfr_print_binary(u); putchar('\n');
+ printf ("v="); mpfr_print_binary(v); putchar('\n');
+ printf ("w="); mpfr_print_binary(w); putchar('\n');
printf ("inexact = %d\n", inexact);
exit (1);
}
@@ -336,7 +336,7 @@ check_two_sum (mp_prec_t p)
#define MAX_PREC 100
void
-check_inexact ()
+check_inexact (void)
{
mpfr_t x, y, z, u;
mp_prec_t px, py, pu, pz;
@@ -348,15 +348,15 @@ check_inexact ()
mpfr_init (z);
mpfr_init (u);
- for (px=1; px<MAX_PREC; px++)
+ for (px=2; px<MAX_PREC; px++)
{
mpfr_set_prec (x, px);
mpfr_random (x);
- for (pu=1; pu<MAX_PREC; pu++)
+ for (pu=2; pu<MAX_PREC; pu++)
{
mpfr_set_prec (u, pu);
mpfr_random (u);
- for (py=1; py<MAX_PREC; py++)
+ for (py=2; py<MAX_PREC; py++)
{
mpfr_set_prec (y, py);
pz = (mpfr_cmp_abs (x, u) >= 0) ? MPFR_EXP(x)-MPFR_EXP(u)
@@ -380,10 +380,10 @@ check_inexact ()
fprintf (stderr, "Wrong inexact flag for rnd=%s\n",
mpfr_print_rnd_mode(rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("u="); mpfr_print_raw (u); putchar ('\n');
- printf ("y= "); mpfr_print_raw (y); putchar ('\n');
- printf ("x-u="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("u="); mpfr_print_binary (u); putchar ('\n');
+ printf ("y= "); mpfr_print_binary (y); putchar ('\n');
+ printf ("x-u="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
}
@@ -398,7 +398,7 @@ check_inexact ()
}
int
-main()
+main(void)
{
mp_prec_t p;
unsigned i;
@@ -407,7 +407,7 @@ main()
check_inexact ();
bug_ddefour ();
- for (p=1; p<200; p++)
+ for (p=2; p<200; p++)
for (i=0; i<200; i++)
check_two_sum (p);
diff --git a/mpfr/tests/tsub_ui.c b/mpfr/tests/tsub_ui.c
index e0c4974e3..5436f3b17 100644
--- a/mpfr/tests/tsub_ui.c
+++ b/mpfr/tests/tsub_ui.c
@@ -99,10 +99,10 @@ check_two_sum (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
printf ("x=%u\n", x);
- printf ("y="); mpfr_print_raw(y); putchar('\n');
- printf ("u="); mpfr_print_raw(u); putchar('\n');
- printf ("v="); mpfr_print_raw(v); putchar('\n');
- printf ("w="); mpfr_print_raw(w); putchar('\n');
+ printf ("y="); mpfr_print_binary(y); putchar('\n');
+ printf ("u="); mpfr_print_binary(u); putchar('\n');
+ printf ("v="); mpfr_print_binary(v); putchar('\n');
+ printf ("w="); mpfr_print_binary(w); putchar('\n');
printf ("inexact = %d\n", inexact);
exit (1);
}
@@ -141,7 +141,7 @@ main (int argc, char *argv[])
}
#endif
- for (p=1; p<200; p++)
+ for (p=2; p<200; p++)
for (k=0; k<200; k++)
check_two_sum (p);
check3(0.9999999999, 1, GMP_RNDN, -1.000000082740370999e-10);
diff --git a/mpfr/tests/ttan.c b/mpfr/tests/ttan.c
index b74a72a7f..eb2cf3859 100644
--- a/mpfr/tests/ttan.c
+++ b/mpfr/tests/ttan.c
@@ -61,17 +61,17 @@ main(int argc, char *argv[])
check53(-1.0/0.0, 0.0/0.0, GMP_RNDN);
mpfr_init (x);
- mpfr_set_prec (x, 1);
+ mpfr_set_prec (x, 2);
mpfr_set_d (x, 0.5, GMP_RNDN);
mpfr_tan (x, x, GMP_RNDD);
- if (mpfr_get_d(x) != 0.50)
+ if (mpfr_get_d(x) != 0.5)
{
fprintf (stderr, "mpfr_tan(0.5, GMP_RNDD) failed\n");
exit (1);
}
mpfr_clear (x);
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/ttanh.c b/mpfr/tests/ttanh.c
index d89a69d5f..0a1fad746 100644
--- a/mpfr/tests/ttanh.c
+++ b/mpfr/tests/ttanh.c
@@ -32,7 +32,7 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- test_generic (1, 100, 100);
+ test_generic (2, 100, 100);
return 0;
}
diff --git a/mpfr/tests/ttrunc.c b/mpfr/tests/ttrunc.c
index 754dce02b..1f5338409 100644
--- a/mpfr/tests/ttrunc.c
+++ b/mpfr/tests/ttrunc.c
@@ -64,9 +64,9 @@ main (void)
for (j=0;j<1000;j++) {
mpfr_random(x);
- MPFR_EXP(x) = 1;
+ MPFR_EXP(x) = 2;
- for (k = 1; k <= SIZEX; k++)
+ for (k = 2; k <= SIZEX; k++)
{
mpfr_set_prec(y, k);
mpfr_set_prec(y2, k);
@@ -86,9 +86,9 @@ main (void)
if (!mpfr_eq(y, y2, k))
{
- printf("Error in floor, x = "); mpfr_print_raw(x); printf("\n");
- printf("floor(x) = "); mpfr_print_raw(y); printf("\n");
- printf("round(x, RNDD) = "); mpfr_print_raw(y2); printf("\n");
+ printf("Error in floor, x = "); mpfr_print_binary(x); printf("\n");
+ printf("floor(x) = "); mpfr_print_binary(y); printf("\n");
+ printf("round(x, RNDD) = "); mpfr_print_binary(y2); printf("\n");
mpfr_clear(x);
mpfr_clear(y);
mpfr_clear(y2);
@@ -101,9 +101,9 @@ main (void)
if (!mpfr_eq(z, z2, k))
{
- printf("Error in trunc, x = "); mpfr_print_raw(x); printf("\n");
- printf("trunc(x) = "); mpfr_print_raw(z); printf("\n");
- printf("round(x, RNDZ) = "); mpfr_print_raw(z2); printf("\n");
+ printf("Error in trunc, x = "); mpfr_print_binary(x); printf("\n");
+ printf("trunc(x) = "); mpfr_print_binary(z); printf("\n");
+ printf("round(x, RNDZ) = "); mpfr_print_binary(z2); printf("\n");
mpfr_clear(x);
mpfr_clear(y);
mpfr_clear(y2);
@@ -116,9 +116,9 @@ main (void)
if (!mpfr_eq(y, y2, k))
{
- printf("Error in ceil, x = "); mpfr_print_raw(x); printf("\n");
- printf("ceil(x) = "); mpfr_print_raw(t); printf("\n");
- printf("round(x, RNDU) = "); mpfr_print_raw(t2); printf("\n");
+ printf("Error in ceil, x = "); mpfr_print_binary(x); printf("\n");
+ printf("ceil(x) = "); mpfr_print_binary(t); printf("\n");
+ printf("round(x, RNDU) = "); mpfr_print_binary(t2); printf("\n");
mpfr_clear(x);
mpfr_clear(y);
mpfr_clear(y2);
diff --git a/mpfr/tests/tui_div.c b/mpfr/tests/tui_div.c
index e6af5f3a5..7b1df1bad 100644
--- a/mpfr/tests/tui_div.c
+++ b/mpfr/tests/tui_div.c
@@ -58,7 +58,7 @@ check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1)
}
void
-check_inexact ()
+check_inexact (void)
{
mpfr_t x, y, z;
mp_prec_t px, py;
@@ -70,12 +70,12 @@ check_inexact ()
mpfr_init (y);
mpfr_init (z);
- for (px=1; px<300; px++)
+ for (px=2; px<300; px++)
{
mpfr_set_prec (x, px);
mpfr_random (x);
u = lrand48 ();
- for (py=1; py<300; py++)
+ for (py=2; py<300; py++)
{
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + px);
@@ -95,9 +95,9 @@ check_inexact ()
fprintf (stderr, "Wrong inexact flag for u=%lu, rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("y*x="); mpfr_print_raw (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("y*x="); mpfr_print_binary (z); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/tui_pow.c b/mpfr/tests/tui_pow.c
index 6b2f023e7..058c5b1c7 100644
--- a/mpfr/tests/tui_pow.c
+++ b/mpfr/tests/tui_pow.c
@@ -38,13 +38,14 @@ main (int argc, char *argv[])
mpfr_init (x);
mpfr_init (y);
- n=abs(random());
+ n = abs(random());
+ MPFR_CLEAR_NAN(x);
MPFR_SET_INF(x);
- mpfr_ui_pow (y, n,x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, GMP_RNDN);
if(!MPFR_IS_INF(y))
{
- printf ("evaluation of function in INF does not return INF");
+ printf ("evaluation of function in INF does not return INF\n");
exit (1);
}
@@ -71,7 +72,7 @@ main (int argc, char *argv[])
int inexact, compare, compare2;
unsigned int n, err;
- int p0=1;
+ int p0=2;
int p1=100;
int N=100;
@@ -113,7 +114,7 @@ main (int argc, char *argv[])
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
putchar ('\n');
printf ("approx ");
- mpfr_print_raw (y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
@@ -130,9 +131,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_raw (x); putchar ('\n');
- printf ("y="); mpfr_print_raw (y); putchar ('\n');
- printf ("t="); mpfr_print_raw (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("t="); mpfr_print_binary (t); putchar ('\n');
exit (1);
}
}
diff --git a/mpfr/tests/tui_sub.c b/mpfr/tests/tui_sub.c
index 6e8ccbdda..c51a48207 100644
--- a/mpfr/tests/tui_sub.c
+++ b/mpfr/tests/tui_sub.c
@@ -33,7 +33,7 @@ void check _PROTO ((unsigned long, double, mp_rnd_t, double));
void check_two_sum _PROTO ((mp_prec_t));
void
-special ()
+special (void)
{
mpfr_t x, y, res;
int inexact;
@@ -186,10 +186,10 @@ check_two_sum (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
printf ("x=%u\n", x);
- printf ("y="); mpfr_print_raw(y); putchar('\n');
- printf ("u="); mpfr_print_raw(u); putchar('\n');
- printf ("v="); mpfr_print_raw(v); putchar('\n');
- printf ("w="); mpfr_print_raw(w); putchar('\n');
+ printf ("y="); mpfr_print_binary(y); putchar('\n');
+ printf ("u="); mpfr_print_binary(u); putchar('\n');
+ printf ("v="); mpfr_print_binary(v); putchar('\n');
+ printf ("w="); mpfr_print_binary(w); putchar('\n');
printf ("inexact = %d\n", inexact);
exit (1);
}
@@ -230,7 +230,7 @@ main (int argc, char *argv[])
}
#endif
special ();
- for (p=1; p<100; p++)
+ for (p=2; p<100; p++)
for (k=0; k<100; k++)
check_two_sum (p);
check(1, 1.0/0.0, GMP_RNDN, -1.0/0.0);