summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-20 10:19:54 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-20 10:19:54 +0000
commit56b37a9f04f25a2d90d7523360ebf9fd6aea2e6f (patch)
tree560e1832a46bb3ef1a6e249d85f50966928e9754 /Build
parentff2b3637ce66eb629ed6b5df7a6d10e319d94082 (diff)
MetaPost 1.999
git-svn-id: svn://tug.org/texlive/trunk@34334 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/configure3
-rwxr-xr-xBuild/source/libs/configure3
-rwxr-xr-xBuild/source/texk/configure3
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-1.7/doc/README12
-rw-r--r--Build/source/texk/web2c/Makefile.in269
-rw-r--r--Build/source/texk/web2c/ac/web2c.ac6
-rwxr-xr-xBuild/source/texk/web2c/configure3
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog9
-rw-r--r--Build/source/texk/web2c/luatexdir/am/libluatex.am9
-rw-r--r--Build/source/texk/web2c/luatexdir/am/luatex.am15
-rw-r--r--Build/source/texk/web2c/mplibdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/mplibdir/am/libmplib.am24
-rw-r--r--Build/source/texk/web2c/mplibdir/am/mplib.am3
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w17
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathbinary.w1527
-rw-r--r--Build/source/texk/web2c/mplibdir/svgout.w2
-rwxr-xr-xBuild/source/utils/configure3
17 files changed, 1761 insertions, 151 deletions
diff --git a/Build/source/configure b/Build/source/configure
index 2768dae035c..76d89b5e5f0 100755
--- a/Build/source/configure
+++ b/Build/source/configure
@@ -4557,6 +4557,7 @@ esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -4575,6 +4576,7 @@ esac
test "x$enable_web2c:$enable_luajittex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -4592,6 +4594,7 @@ case $enable_mp in #(
esac
test "x$enable_web2c:$enable_mp" = xyes:yes && {
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
}
diff --git a/Build/source/libs/configure b/Build/source/libs/configure
index 7a0d53872f9..d6e132433bc 100755
--- a/Build/source/libs/configure
+++ b/Build/source/libs/configure
@@ -3809,6 +3809,7 @@ esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3827,6 +3828,7 @@ esac
test "x$enable_web2c:$enable_luajittex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3844,6 +3846,7 @@ case $enable_mp in #(
esac
test "x$enable_web2c:$enable_mp" = xyes:yes && {
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
}
diff --git a/Build/source/texk/configure b/Build/source/texk/configure
index a8349f4ccd0..6b1ec69b869 100755
--- a/Build/source/texk/configure
+++ b/Build/source/texk/configure
@@ -3820,6 +3820,7 @@ esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3838,6 +3839,7 @@ esac
test "x$enable_web2c:$enable_luajittex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3855,6 +3857,7 @@ case $enable_mp in #(
esac
test "x$enable_web2c:$enable_mp" = xyes:yes && {
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
}
diff --git a/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/README b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/README
new file mode 100644
index 00000000000..6ecfc542aa3
--- /dev/null
+++ b/Build/source/texk/dvisvgm/dvisvgm-1.7/doc/README
@@ -0,0 +1,12 @@
+dvisvgm-1.6 (2014-04-22)
+- added option --zoom to "visually" scale the generated SVG graphics while
+ preserving the original size and position values of the graphic objects
+- extended argument syntax of option --linkmark to allow to select the
+ box/line color
+- changed default link marker from 'line' to 'box'
+- changed link markers to be only split on line breaks while extended in all
+ other cases
+- if libgs is not directly linked to the binary, dvisvgm now looks for
+ libgs.so.X instead of libgs.so (supported GS ABIs: X = 7, 8, 9)
+- removed time stamp and machine triplet from generated SVG files
+- some code improvements and refactorings
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 43e81a37e12..2678f021cc7 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -549,8 +549,7 @@ am__objects_5 = luatexdir/lua/libluajittex_a-lcallbacklib.$(OBJEXT) \
luatexdir/lua/libluajittex_a-ltexlib.$(OBJEXT) \
luatexdir/lua/libluajittex_a-ltokenlib.$(OBJEXT) \
luatexdir/utils/libluajittex_a-avl.$(OBJEXT) \
- synctexdir/libluajittex_a-synctex.$(OBJEXT) \
- mplibdir/libluajittex_a-lmplib.$(OBJEXT)
+ synctexdir/libluajittex_a-synctex.$(OBJEXT)
am__objects_6 = libluajittex_a-dvigen.$(OBJEXT) \
libluajittex_a-dofont.$(OBJEXT) \
libluajittex_a-luafont.$(OBJEXT) \
@@ -709,8 +708,7 @@ am__objects_9 = luatexdir/lua/libluatex_a-lcallbacklib.$(OBJEXT) \
luatexdir/lua/libluatex_a-ltexlib.$(OBJEXT) \
luatexdir/lua/libluatex_a-ltokenlib.$(OBJEXT) \
luatexdir/utils/libluatex_a-avl.$(OBJEXT) \
- synctexdir/libluatex_a-synctex.$(OBJEXT) \
- mplibdir/libluatex_a-lmplib.$(OBJEXT)
+ synctexdir/libluatex_a-synctex.$(OBJEXT)
am__objects_10 = libluatex_a-dvigen.$(OBJEXT) \
libluatex_a-dofont.$(OBJEXT) libluatex_a-luafont.$(OBJEXT) \
libluatex_a-mapfile.$(OBJEXT) libluatex_a-pkin.$(OBJEXT) \
@@ -794,16 +792,17 @@ am_libmplib_a_OBJECTS = mplibdir/libmplib_a-avl.$(OBJEXT) \
mplibdir/libmplib_a-decContext.$(OBJEXT)
am__objects_12 = libmplib_a-mp.$(OBJEXT)
am__objects_13 = libmplib_a-mpmath.$(OBJEXT)
-am__objects_14 = libmplib_a-mpmathdecimal.$(OBJEXT)
-am__objects_15 = libmplib_a-mpmathdouble.$(OBJEXT)
-am__objects_16 = libmplib_a-mpstrings.$(OBJEXT)
-am__objects_17 = libmplib_a-pngout.$(OBJEXT)
-am__objects_18 = libmplib_a-psout.$(OBJEXT)
-am__objects_19 = libmplib_a-svgout.$(OBJEXT)
+am__objects_14 = libmplib_a-mpmathbinary.$(OBJEXT)
+am__objects_15 = libmplib_a-mpmathdecimal.$(OBJEXT)
+am__objects_16 = libmplib_a-mpmathdouble.$(OBJEXT)
+am__objects_17 = libmplib_a-mpstrings.$(OBJEXT)
+am__objects_18 = libmplib_a-pngout.$(OBJEXT)
+am__objects_19 = libmplib_a-psout.$(OBJEXT)
+am__objects_20 = libmplib_a-svgout.$(OBJEXT)
nodist_libmplib_a_OBJECTS = libmplib_a-tfmin.$(OBJEXT) \
$(am__objects_12) $(am__objects_13) $(am__objects_14) \
$(am__objects_15) $(am__objects_16) $(am__objects_17) \
- $(am__objects_18) $(am__objects_19)
+ $(am__objects_18) $(am__objects_19) $(am__objects_20)
libmplib_a_OBJECTS = $(am_libmplib_a_OBJECTS) \
$(nodist_libmplib_a_OBJECTS)
libpdftex_a_AR = $(AR) $(ARFLAGS)
@@ -820,7 +819,7 @@ am__libpdftex_a_SOURCES_DIST = pdftexdir/avl.c pdftexdir/avl.h \
pdftexdir/writepng.c pdftexdir/writet1.c pdftexdir/writet3.c \
pdftexdir/writettf.c pdftexdir/writettf.h pdftexdir/writezip.c \
pdftexdir/regex/regex.c pdftexdir/regex/regex.h
-@MINGW32_TRUE@am__objects_20 = \
+@MINGW32_TRUE@am__objects_21 = \
@MINGW32_TRUE@ pdftexdir/regex/libpdftex_a-regex.$(OBJEXT)
am_libpdftex_a_OBJECTS = pdftexdir/libpdftex_a-avl.$(OBJEXT) \
pdftexdir/libpdftex_a-avlstuff.$(OBJEXT) \
@@ -841,7 +840,7 @@ am_libpdftex_a_OBJECTS = pdftexdir/libpdftex_a-avl.$(OBJEXT) \
pdftexdir/libpdftex_a-writet1.$(OBJEXT) \
pdftexdir/libpdftex_a-writet3.$(OBJEXT) \
pdftexdir/libpdftex_a-writettf.$(OBJEXT) \
- pdftexdir/libpdftex_a-writezip.$(OBJEXT) $(am__objects_20)
+ pdftexdir/libpdftex_a-writezip.$(OBJEXT) $(am__objects_21)
libpdftex_a_OBJECTS = $(am_libpdftex_a_OBJECTS)
libukanji_a_AR = $(AR) $(ARFLAGS)
libukanji_a_LIBADD =
@@ -882,10 +881,10 @@ am__libxetex_a_SOURCES_DIST = xetexdir/MathTable.h \
xetexdir/XeTeXFontInst_Mac.h xetexdir/XeTeXFontMgr_Mac.mm \
xetexdir/XeTeXFontMgr_Mac.h xetexdir/XeTeX_mac.c \
xetexdir/XeTeXFontMgr_FC.cpp xetexdir/XeTeXFontMgr_FC.h
-@XETEX_MACOSX_TRUE@am__objects_21 = xetexdir/libxetex_a-XeTeXFontInst_Mac.$(OBJEXT) \
+@XETEX_MACOSX_TRUE@am__objects_22 = xetexdir/libxetex_a-XeTeXFontInst_Mac.$(OBJEXT) \
@XETEX_MACOSX_TRUE@ xetexdir/libxetex_a-XeTeXFontMgr_Mac.$(OBJEXT) \
@XETEX_MACOSX_TRUE@ xetexdir/libxetex_a-XeTeX_mac.$(OBJEXT)
-@XETEX_MACOSX_FALSE@am__objects_22 = xetexdir/libxetex_a-XeTeXFontMgr_FC.$(OBJEXT)
+@XETEX_MACOSX_FALSE@am__objects_23 = xetexdir/libxetex_a-XeTeXFontMgr_FC.$(OBJEXT)
am_libxetex_a_OBJECTS = xetexdir/libxetex_a-XeTeXFontInst.$(OBJEXT) \
xetexdir/libxetex_a-XeTeXFontMgr.$(OBJEXT) \
xetexdir/libxetex_a-XeTeXLayoutInterface.$(OBJEXT) \
@@ -899,8 +898,8 @@ am_libxetex_a_OBJECTS = xetexdir/libxetex_a-XeTeXFontInst.$(OBJEXT) \
xetexdir/image/libxetex_a-jpegimage.$(OBJEXT) \
xetexdir/image/libxetex_a-mfileio.$(OBJEXT) \
xetexdir/image/libxetex_a-numbers.$(OBJEXT) \
- xetexdir/image/libxetex_a-pngimage.$(OBJEXT) $(am__objects_21) \
- $(am__objects_22)
+ xetexdir/image/libxetex_a-pngimage.$(OBJEXT) $(am__objects_22) \
+ $(am__objects_23)
libxetex_a_OBJECTS = $(am_libxetex_a_OBJECTS)
am__EXEEXT_1 = bibtex$(EXEEXT) dvicopy$(EXEEXT) dvitype$(EXEEXT) \
gftodvi$(EXEEXT) gftopk$(EXEEXT) gftype$(EXEEXT) mft$(EXEEXT) \
@@ -964,8 +963,8 @@ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
dist_aleph_OBJECTS = alephdir/aleph-aleph.$(OBJEXT) \
alephdir/aleph-alephbis.$(OBJEXT) \
alephdir/aleph-alephextra.$(OBJEXT)
-am__objects_23 = aleph-alephini.$(OBJEXT) aleph-aleph0.$(OBJEXT)
-nodist_aleph_OBJECTS = $(am__objects_23) aleph-aleph-pool.$(OBJEXT)
+am__objects_24 = aleph-alephini.$(OBJEXT) aleph-aleph0.$(OBJEXT)
+nodist_aleph_OBJECTS = $(am__objects_24) aleph-aleph-pool.$(OBJEXT)
aleph_OBJECTS = $(dist_aleph_OBJECTS) $(nodist_aleph_OBJECTS)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(proglib) $(am__DEPENDENCIES_1)
@@ -1014,22 +1013,22 @@ am__dist_eptex_SOURCES_DIST = eptexdir/eptexextra.c \
eptexdir/eptexextra.h eptexdir/eptex_version.h \
synctexdir/synctex.c synctexdir/synctex.h \
synctexdir/synctex-common.h synctexdir/synctex-eptex.h
-@EPTEX_SYNCTEX_TRUE@am__objects_24 = \
+@EPTEX_SYNCTEX_TRUE@am__objects_25 = \
@EPTEX_SYNCTEX_TRUE@ synctexdir/eptex-synctex.$(OBJEXT)
dist_eptex_OBJECTS = eptexdir/eptex-eptexextra.$(OBJEXT) \
- $(am__objects_24)
-am__objects_25 = eptex-eptexini.$(OBJEXT) eptex-eptex0.$(OBJEXT)
-nodist_eptex_OBJECTS = $(am__objects_25) eptex-eptex-pool.$(OBJEXT)
+ $(am__objects_25)
+am__objects_26 = eptex-eptexini.$(OBJEXT) eptex-eptex0.$(OBJEXT)
+nodist_eptex_OBJECTS = $(am__objects_26) eptex-eptex-pool.$(OBJEXT)
eptex_OBJECTS = $(dist_eptex_OBJECTS) $(nodist_eptex_OBJECTS)
@EPTEX_SYNCTEX_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
am__dist_etex_SOURCES_DIST = etexdir/etexextra.c etexdir/etexextra.h \
etexdir/etex_version.h synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-etex.h
-@ETEX_SYNCTEX_TRUE@am__objects_26 = synctexdir/etex-synctex.$(OBJEXT)
-dist_etex_OBJECTS = etexdir/etex-etexextra.$(OBJEXT) $(am__objects_26)
-am__objects_27 = etex-etexini.$(OBJEXT) etex-etex0.$(OBJEXT)
-nodist_etex_OBJECTS = $(am__objects_27) etex-etex-pool.$(OBJEXT)
+@ETEX_SYNCTEX_TRUE@am__objects_27 = synctexdir/etex-synctex.$(OBJEXT)
+dist_etex_OBJECTS = etexdir/etex-etexextra.$(OBJEXT) $(am__objects_27)
+am__objects_28 = etex-etexini.$(OBJEXT) etex-etex0.$(OBJEXT)
+nodist_etex_OBJECTS = $(am__objects_28) etex-etex-pool.$(OBJEXT)
etex_OBJECTS = $(dist_etex_OBJECTS) $(nodist_etex_OBJECTS)
@ETEX_SYNCTEX_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1)
etex_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
@@ -1038,12 +1037,12 @@ am__dist_euptex_SOURCES_DIST = euptexdir/euptexextra.c \
euptexdir/euptexextra.h synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-euptex.h
-@EUPTEX_SYNCTEX_TRUE@am__objects_28 = \
+@EUPTEX_SYNCTEX_TRUE@am__objects_29 = \
@EUPTEX_SYNCTEX_TRUE@ synctexdir/euptex-synctex.$(OBJEXT)
dist_euptex_OBJECTS = euptexdir/euptex-euptexextra.$(OBJEXT) \
- $(am__objects_28)
-am__objects_29 = euptex-euptexini.$(OBJEXT) euptex-euptex0.$(OBJEXT)
-nodist_euptex_OBJECTS = $(am__objects_29) euptex-euptex-pool.$(OBJEXT)
+ $(am__objects_29)
+am__objects_30 = euptex-euptexini.$(OBJEXT) euptex-euptex0.$(OBJEXT)
+nodist_euptex_OBJECTS = $(am__objects_30) euptex-euptex-pool.$(OBJEXT)
euptex_OBJECTS = $(dist_euptex_OBJECTS) $(nodist_euptex_OBJECTS)
@EUPTEX_SYNCTEX_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1)
am_gftodvi_OBJECTS =
@@ -1065,26 +1064,30 @@ inimf_DEPENDENCIES =
nodist_initex_OBJECTS = initex-callexe.$(OBJEXT)
initex_OBJECTS = $(nodist_initex_OBJECTS)
initex_DEPENDENCIES =
-am__objects_30 = luatexdir/luajittex-luatex.$(OBJEXT)
-nodist_luajittex_OBJECTS = $(am__objects_30)
+am__objects_31 = luatexdir/luajittex-luatex.$(OBJEXT) \
+ mplibdir/luajittex-lmplib.$(OBJEXT)
+nodist_luajittex_OBJECTS = $(am__objects_31)
luajittex_OBJECTS = $(nodist_luajittex_OBJECTS)
am__DEPENDENCIES_6 = libluajittex.a libjitff.a libunilib.a \
libluajitmisc.a libluajitsocket.a $(am__DEPENDENCIES_1) \
libmd5.a libmplib.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
luajittex_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(luajittex_CXXFLAGS) \
$(CXXFLAGS) $(luajittex_LDFLAGS) $(LDFLAGS) -o $@
-am__objects_31 = luatexdir/luatex-luatex.$(OBJEXT)
-nodist_luatex_OBJECTS = $(am__objects_31)
+am__objects_32 = luatexdir/luatex-luatex.$(OBJEXT) \
+ mplibdir/luatex-lmplib.$(OBJEXT)
+nodist_luatex_OBJECTS = $(am__objects_32)
luatex_OBJECTS = $(nodist_luatex_OBJECTS)
am__DEPENDENCIES_7 = $(am__DEPENDENCIES_1)
am__DEPENDENCIES_8 = libluatex.a libff.a libunilib.a libluamisc.a \
libluasocket.a $(am__DEPENDENCIES_7) libmd5.a libmplib.a \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
luatex_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(luatex_CXXFLAGS) \
@@ -1107,8 +1110,8 @@ nodist_mft_OBJECTS = mft.$(OBJEXT)
mft_OBJECTS = $(nodist_mft_OBJECTS)
mft_LDADD = $(LDADD)
mft_DEPENDENCIES = $(proglib) $(am__DEPENDENCIES_1)
-am__objects_32 = mpost-mpxout.$(OBJEXT)
-nodist_mpost_OBJECTS = mpost-mpost.$(OBJEXT) $(am__objects_32)
+am__objects_33 = mpost-mpxout.$(OBJEXT)
+nodist_mpost_OBJECTS = mpost-mpost.$(OBJEXT) $(am__objects_33)
mpost_OBJECTS = $(nodist_mpost_OBJECTS)
nodist_odvicopy_OBJECTS = odvicopy.$(OBJEXT)
odvicopy_OBJECTS = $(nodist_odvicopy_OBJECTS)
@@ -1152,12 +1155,12 @@ am__dist_pdftex_SOURCES_DIST = pdftexdir/pdftexextra.c \
pdftexdir/etex_version.h synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-pdftex.h
-@PDFTEX_SYNCTEX_TRUE@am__objects_33 = \
+@PDFTEX_SYNCTEX_TRUE@am__objects_34 = \
@PDFTEX_SYNCTEX_TRUE@ synctexdir/pdftex-synctex.$(OBJEXT)
dist_pdftex_OBJECTS = pdftexdir/pdftex-pdftexextra.$(OBJEXT) \
- $(am__objects_33)
-am__objects_34 = pdftex-pdftexini.$(OBJEXT) pdftex-pdftex0.$(OBJEXT)
-nodist_pdftex_OBJECTS = $(am__objects_34) pdftex-pdftex-pool.$(OBJEXT)
+ $(am__objects_34)
+am__objects_35 = pdftex-pdftexini.$(OBJEXT) pdftex-pdftex0.$(OBJEXT)
+nodist_pdftex_OBJECTS = $(am__objects_35) pdftex-pdftex-pool.$(OBJEXT)
pdftex_OBJECTS = $(dist_pdftex_OBJECTS) $(nodist_pdftex_OBJECTS)
am__DEPENDENCIES_11 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) libmd5.a
@@ -1195,10 +1198,10 @@ am__dist_ptex_SOURCES_DIST = ptexdir/ptexextra.c ptexdir/ptexextra.h \
ptexdir/ptex_version.h synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-ptex.h
-@PTEX_SYNCTEX_TRUE@am__objects_35 = synctexdir/ptex-synctex.$(OBJEXT)
-dist_ptex_OBJECTS = ptexdir/ptex-ptexextra.$(OBJEXT) $(am__objects_35)
-am__objects_36 = ptex-ptexini.$(OBJEXT) ptex-ptex0.$(OBJEXT)
-nodist_ptex_OBJECTS = $(am__objects_36) ptex-ptex-pool.$(OBJEXT)
+@PTEX_SYNCTEX_TRUE@am__objects_36 = synctexdir/ptex-synctex.$(OBJEXT)
+dist_ptex_OBJECTS = ptexdir/ptex-ptexextra.$(OBJEXT) $(am__objects_36)
+am__objects_37 = ptex-ptexini.$(OBJEXT) ptex-ptex0.$(OBJEXT)
+nodist_ptex_OBJECTS = $(am__objects_37) ptex-ptex-pool.$(OBJEXT)
ptex_OBJECTS = $(dist_ptex_OBJECTS) $(nodist_ptex_OBJECTS)
@PTEX_SYNCTEX_TRUE@am__DEPENDENCIES_12 = $(am__DEPENDENCIES_1)
am_ptftopl_OBJECTS =
@@ -1219,10 +1222,10 @@ tangleboot_LDADD = $(LDADD)
am__dist_tex_SOURCES_DIST = texextra.c synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-tex.h
-@TEX_SYNCTEX_TRUE@am__objects_37 = synctexdir/tex-synctex.$(OBJEXT)
-dist_tex_OBJECTS = tex-texextra.$(OBJEXT) $(am__objects_37)
-am__objects_38 = tex-texini.$(OBJEXT) tex-tex0.$(OBJEXT)
-nodist_tex_OBJECTS = $(am__objects_38) tex-tex-pool.$(OBJEXT)
+@TEX_SYNCTEX_TRUE@am__objects_38 = synctexdir/tex-synctex.$(OBJEXT)
+dist_tex_OBJECTS = tex-texextra.$(OBJEXT) $(am__objects_38)
+am__objects_39 = tex-texini.$(OBJEXT) tex-tex0.$(OBJEXT)
+nodist_tex_OBJECTS = $(am__objects_39) tex-tex-pool.$(OBJEXT)
tex_OBJECTS = $(dist_tex_OBJECTS) $(nodist_tex_OBJECTS)
@TEX_SYNCTEX_TRUE@am__DEPENDENCIES_13 = $(am__DEPENDENCIES_1)
tex_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
@@ -1256,12 +1259,12 @@ am__dist_uptex_SOURCES_DIST = uptexdir/uptexextra.c \
uptexdir/uptexextra.h uptexdir/uptex_version.h \
synctexdir/synctex.c synctexdir/synctex.h \
synctexdir/synctex-common.h synctexdir/synctex-uptex.h
-@UPTEX_SYNCTEX_TRUE@am__objects_39 = \
+@UPTEX_SYNCTEX_TRUE@am__objects_40 = \
@UPTEX_SYNCTEX_TRUE@ synctexdir/uptex-synctex.$(OBJEXT)
dist_uptex_OBJECTS = uptexdir/uptex-uptexextra.$(OBJEXT) \
- $(am__objects_39)
-am__objects_40 = uptex-uptexini.$(OBJEXT) uptex-uptex0.$(OBJEXT)
-nodist_uptex_OBJECTS = $(am__objects_40) uptex-uptex-pool.$(OBJEXT)
+ $(am__objects_40)
+am__objects_41 = uptex-uptexini.$(OBJEXT) uptex-uptex0.$(OBJEXT)
+nodist_uptex_OBJECTS = $(am__objects_41) uptex-uptex-pool.$(OBJEXT)
uptex_OBJECTS = $(dist_uptex_OBJECTS) $(nodist_uptex_OBJECTS)
@UPTEX_SYNCTEX_TRUE@am__DEPENDENCIES_15 = $(am__DEPENDENCIES_1)
am_uptftopl_OBJECTS =
@@ -1300,12 +1303,12 @@ am__dist_xetex_SOURCES_DIST = xetexdir/xetexextra.c \
xetexdir/xetex_version.h synctexdir/synctex.c \
synctexdir/synctex.h synctexdir/synctex-common.h \
synctexdir/synctex-xetex.h
-@XETEX_SYNCTEX_TRUE@am__objects_41 = \
+@XETEX_SYNCTEX_TRUE@am__objects_42 = \
@XETEX_SYNCTEX_TRUE@ synctexdir/xetex-synctex.$(OBJEXT)
dist_xetex_OBJECTS = xetexdir/xetex-xetexextra.$(OBJEXT) \
- $(am__objects_41)
-am__objects_42 = xetex-xetexini.$(OBJEXT) xetex-xetex0.$(OBJEXT)
-nodist_xetex_OBJECTS = $(am__objects_42) xetex-xetex-pool.$(OBJEXT)
+ $(am__objects_42)
+am__objects_43 = xetex-xetexini.$(OBJEXT) xetex-xetex0.$(OBJEXT)
+nodist_xetex_OBJECTS = $(am__objects_43) xetex-xetex-pool.$(OBJEXT)
xetex_OBJECTS = $(dist_xetex_OBJECTS) $(nodist_xetex_OBJECTS)
@XETEX_MACOSX_FALSE@am__DEPENDENCIES_16 = $(am__DEPENDENCIES_1)
am__DEPENDENCIES_17 = $(libxetex) $(am__DEPENDENCIES_1) \
@@ -2254,8 +2257,8 @@ DISTCLEANFILES = $(EXTRA_LIBRARIES) CXXLD.sh tangle.c tangle.h \
mf-tangle $(nodist_mpost_SOURCES) mpxout-tangle mptrap.diffs \
ptmr.mpx tests/xptmr.mpx tests/xstory.mpx \
$(nodist_libmplib_a_SOURCES) mp-tangle mpmath-tangle \
- mpmathdecimal-tangle mpmathdouble-tangle mpstrings-tangle \
- psout-tangle svgout-tangle pngout-tangle \
+ mpmathbinary-tangle mpmathdecimal-tangle mpmathdouble-tangle \
+ mpstrings-tangle psout-tangle svgout-tangle pngout-tangle \
$(nodist_etex_SOURCES) etex.web etex.ch etex-web2c etex.p \
etex.pool etex-tangle etrip.diffs ewprob.log ewprob.tex \
$(pweb_programs:=.c) $(pweb_programs:=.h) $(pweb_programs:=.p) \
@@ -2470,7 +2473,9 @@ mf_ch_src = \
mf_tests = mftraptest
mpost_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) -I$(srcdir)/mplibdir
mpost_DEPENDENCIES = libmplib.a
-mpost_LDADD = libmplib.a $(KPATHSEA_LIBS) $(CAIRO_LIBS) $(PIXMAN_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS)
+mpost_LDADD = libmplib.a $(KPATHSEA_LIBS) $(MPFR_LIBS) $(GMP_LIBS) \
+ $(CAIRO_LIBS) $(PIXMAN_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS)
+
call_mpost_CPPFLAGS = -DEXEPROG=\"mpost.exe\"
nodist_call_mpost_SOURCES = callexe.c
call_mpost_LDADD =
@@ -2483,26 +2488,28 @@ nodist_mpost_SOURCES = mpost.c $(mpxout_c_h)
mpxout_c_h = mpxout.c mpxout.h
mpost_web = mplibdir/mpost.w mplibdir/mpxout.w
mp_tests = mplibdir/dvitomp.test mplibdir/mptraptest
-libmplib_a_CPPFLAGS = $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) \
- $(AM_CPPFLAGS) -I$(srcdir)/mplibdir
+libmplib_a_CPPFLAGS = $(MPFR_INCLUDES) $(GMP_INCLUDES) $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) \
+ $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir
libmplib_a_SOURCES = mplibdir/avl.h mplibdir/avl.c mplibdir/decNumber.c mplibdir/decNumber.h \
mplibdir/decNumberLocal.h mplibdir/decContext.h mplibdir/decContext.c
-nodist_libmplib_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathdecimal_c_h) \
+nodist_libmplib_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathbinary_c_h) $(mpmathdecimal_c_h) \
$(mpmathdouble_c_h) $(mpstrings_c_h) $(pngout_c_h) $(psout_c_h) $(svgout_c_h)
mp_c_h = mp.c mplib.h mpmp.h
mpmath_c_h = mpmath.h mpmath.c
+mpmathbinary_c_h = mpmathbinary.h mpmathbinary.c
mpmathdecimal_c_h = mpmathdecimal.h mpmathdecimal.c
mpmathdouble_c_h = mpmathdouble.h mpmathdouble.c
mpstrings_c_h = mpstrings.h mpstrings.c
-psout_c_h = mppsout.h psout.c mplibps.h
+psout_c_h = mplibps.h mppsout.h psout.c
svgout_c_h = mplibsvg.h mpsvgout.h svgout.c
pngout_c_h = mplibpng.h mppngout.h pngout.c
libmplib_web = mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w \
- mplibdir/pngout.w mplibdir/mpmath.w mplibdir/mpmathdecimal.w \
- mplibdir/mpmathdouble.w mplibdir/mpstrings.w mplibdir/tfmin.w
+ mplibdir/pngout.w mplibdir/mpmath.w mplibdir/mpmathbinary.w \
+ mplibdir/mpmathdecimal.w mplibdir/mpmathdouble.w \
+ mplibdir/mpstrings.w mplibdir/tfmin.w
etex_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_90)
# With --enable-ipc, e-TeX may need to link with -lsocket.
@@ -3144,7 +3151,7 @@ dist_libluatex_sources = luatexdir/luatexcallbackids.h \
luatexdir/utils/managed-sa.h luatexdir/utils/utils.h \
luatexdir/utils/unistring.h synctexdir/synctex-common.h \
synctexdir/synctex-luatex.h synctexdir/synctex.c \
- synctexdir/synctex.h mplibdir/lmplib.c
+ synctexdir/synctex.h
luatex_dvi_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/luatexdir/dvi $(ctangle)
luatex_font_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/luatexdir/font $(ctangle)
luatex_image_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/luatexdir/image $(ctangle)
@@ -3159,21 +3166,22 @@ luatex_utils_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/luatexdir/utils $(c
nodist_EXTRA_luatex_SOURCES = dummy.cxx
nodist_EXTRA_luajittex_SOURCES = dummy.cxx
luatex_preflags = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(POPPLER_INCLUDES)
-luatex_postflags = -I$(srcdir)/libmd5 -I$(srcdir)/luatexdir \
+luatex_postflags = -I$(srcdir)/libmd5 -DpdfTeX -I$(srcdir)/luatexdir \
-I$(srcdir)/mplibdir -Dextra_version_info=`date +-%Y%m%d%H` \
-I$(srcdir)/synctexdir -DSYNCTEX_ENGINE_H='<synctex-luatex.h>'
luatex_CPPFLAGS = $(luatex_preflags) $(LUA_INCLUDES) $(luatex_postflags)
-luajittex_CPPFLAGS = $(luatex_preflags) $(LUAJIT_INCLUDES) $(luatex_postflags)
+luajittex_CPPFLAGS = $(luatex_preflags) $(LUAJIT_INCLUDES) $(LUAJIT_DEFINES) $(luatex_postflags)
luatex_CXXFLAGS = $(WARNING_CXXFLAGS)
luajittex_CXXFLAGS = $(WARNING_CXXFLAGS)
luatex_ldadd = libluatex.a libff.a libunilib.a libluamisc.a \
- libluasocket.a $(LUA_LIBS) libmd5.a libmplib.a $(CAIRO_LIBS) \
- $(PIXMAN_LIBS) $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) \
- $(POPPLER_LIBS)
+ libluasocket.a $(LUA_LIBS) libmd5.a libmplib.a $(MPFR_LIBS) \
+ $(GMP_LIBS) $(CAIRO_LIBS) $(PIXMAN_LIBS) $(ZZIPLIB_LIBS) \
+ $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)
luajittex_ldadd = libluajittex.a libjitff.a libunilib.a \
libluajitmisc.a libluajitsocket.a $(LUAJIT_LIBS) libmd5.a \
- libmplib.a $(CAIRO_LIBS) $(PIXMAN_LIBS) $(ZZIPLIB_LIBS) \
- $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)
+ libmplib.a $(MPFR_LIBS) $(GMP_LIBS) $(CAIRO_LIBS) \
+ $(PIXMAN_LIBS) $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) \
+ $(POPPLER_LIBS)
luatex_LDFLAGS = -export-dynamic
luajittex_LDFLAGS = -export-dynamic $(LUAJIT_LDEXTRA)
luatex_LDADD = $(luatex_ldadd) $(LDADD) $(LIBADD_DLOPEN) $(lua_socketlibs)
@@ -3187,7 +3195,8 @@ nodist_luajittex_SOURCES = $(luatex_sources)
luatex_sources = \
luatexdir/luatex_svnversion.h \
luatexdir/luatex.c \
- luatexdir/luatex.h
+ luatexdir/luatex.h \
+ mplibdir/lmplib.c
call_luatex_CPPFLAGS = -DEXEPROG=\"luatex.exe\"
nodist_call_luatex_SOURCES = callexe.c
@@ -4055,14 +4064,6 @@ synctexdir/$(DEPDIR)/$(am__dirstamp):
synctexdir/libluajittex_a-synctex.$(OBJEXT): \
synctexdir/$(am__dirstamp) \
synctexdir/$(DEPDIR)/$(am__dirstamp)
-mplibdir/$(am__dirstamp):
- @$(MKDIR_P) mplibdir
- @: > mplibdir/$(am__dirstamp)
-mplibdir/$(DEPDIR)/$(am__dirstamp):
- @$(MKDIR_P) mplibdir/$(DEPDIR)
- @: > mplibdir/$(DEPDIR)/$(am__dirstamp)
-mplibdir/libluajittex_a-lmplib.$(OBJEXT): mplibdir/$(am__dirstamp) \
- mplibdir/$(DEPDIR)/$(am__dirstamp)
libluajittex.a: $(libluajittex_a_OBJECTS) $(libluajittex_a_DEPENDENCIES) $(EXTRA_libluajittex_a_DEPENDENCIES)
$(AM_V_at)-rm -f libluajittex.a
@@ -4224,8 +4225,6 @@ luatexdir/utils/libluatex_a-avl.$(OBJEXT): \
luatexdir/utils/$(DEPDIR)/$(am__dirstamp)
synctexdir/libluatex_a-synctex.$(OBJEXT): synctexdir/$(am__dirstamp) \
synctexdir/$(DEPDIR)/$(am__dirstamp)
-mplibdir/libluatex_a-lmplib.$(OBJEXT): mplibdir/$(am__dirstamp) \
- mplibdir/$(DEPDIR)/$(am__dirstamp)
libluatex.a: $(libluatex_a_OBJECTS) $(libluatex_a_DEPENDENCIES) $(EXTRA_libluatex_a_DEPENDENCIES)
$(AM_V_at)-rm -f libluatex.a
@@ -4249,6 +4248,12 @@ libmf.a: $(libmf_a_OBJECTS) $(libmf_a_DEPENDENCIES) $(EXTRA_libmf_a_DEPENDENCIES
$(AM_V_at)-rm -f libmf.a
$(AM_V_AR)$(libmf_a_AR) libmf.a $(libmf_a_OBJECTS) $(libmf_a_LIBADD)
$(AM_V_at)$(RANLIB) libmf.a
+mplibdir/$(am__dirstamp):
+ @$(MKDIR_P) mplibdir
+ @: > mplibdir/$(am__dirstamp)
+mplibdir/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) mplibdir/$(DEPDIR)
+ @: > mplibdir/$(DEPDIR)/$(am__dirstamp)
mplibdir/libmplib_a-avl.$(OBJEXT): mplibdir/$(am__dirstamp) \
mplibdir/$(DEPDIR)/$(am__dirstamp)
mplibdir/libmplib_a-decNumber.$(OBJEXT): mplibdir/$(am__dirstamp) \
@@ -4638,12 +4643,16 @@ luatexdir/$(DEPDIR)/$(am__dirstamp):
@: > luatexdir/$(DEPDIR)/$(am__dirstamp)
luatexdir/luajittex-luatex.$(OBJEXT): luatexdir/$(am__dirstamp) \
luatexdir/$(DEPDIR)/$(am__dirstamp)
+mplibdir/luajittex-lmplib.$(OBJEXT): mplibdir/$(am__dirstamp) \
+ mplibdir/$(DEPDIR)/$(am__dirstamp)
luajittex$(EXEEXT): $(luajittex_OBJECTS) $(luajittex_DEPENDENCIES) $(EXTRA_luajittex_DEPENDENCIES)
@rm -f luajittex$(EXEEXT)
$(AM_V_CXXLD)$(luajittex_LINK) $(luajittex_OBJECTS) $(luajittex_LDADD) $(LIBS)
luatexdir/luatex-luatex.$(OBJEXT): luatexdir/$(am__dirstamp) \
luatexdir/$(DEPDIR)/$(am__dirstamp)
+mplibdir/luatex-lmplib.$(OBJEXT): mplibdir/$(am__dirstamp) \
+ mplibdir/$(DEPDIR)/$(am__dirstamp)
luatex$(EXEEXT): $(luatex_OBJECTS) $(luatex_DEPENDENCIES) $(EXTRA_luatex_DEPENDENCIES)
@rm -f luatex$(EXEEXT)
@@ -5122,6 +5131,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writetype2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpmath.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpmathbinary.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpmathdecimal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpmathdouble.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpstrings.Po@am__quote@
@@ -5390,11 +5400,11 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@luatexdir/unilib/$(DEPDIR)/libunilib_a-utype.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@luatexdir/utils/$(DEPDIR)/libluajittex_a-avl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@luatexdir/utils/$(DEPDIR)/libluatex_a-avl.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/libluatex_a-lmplib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/libmplib_a-avl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/libmplib_a-decContext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/libmplib_a-decNumber.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/luajittex-lmplib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@mplibdir/$(DEPDIR)/luatex-lmplib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@pdftexdir/$(DEPDIR)/libpdftex_a-avl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@pdftexdir/$(DEPDIR)/libpdftex_a-avlstuff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@pdftexdir/$(DEPDIR)/libpdftex_a-epdf.Po@am__quote@
@@ -7418,20 +7428,6 @@ synctexdir/libluajittex_a-synctex.obj: synctexdir/synctex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o synctexdir/libluajittex_a-synctex.obj `if test -f 'synctexdir/synctex.c'; then $(CYGPATH_W) 'synctexdir/synctex.c'; else $(CYGPATH_W) '$(srcdir)/synctexdir/synctex.c'; fi`
-mplibdir/libluajittex_a-lmplib.o: mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/libluajittex_a-lmplib.o -MD -MP -MF mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Tpo -c -o mplibdir/libluajittex_a-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Tpo mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/libluajittex_a-lmplib.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/libluajittex_a-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
-
-mplibdir/libluajittex_a-lmplib.obj: mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/libluajittex_a-lmplib.obj -MD -MP -MF mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Tpo -c -o mplibdir/libluajittex_a-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Tpo mplibdir/$(DEPDIR)/libluajittex_a-lmplib.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/libluajittex_a-lmplib.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/libluajittex_a-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
-
libluajittex_a-dvigen.o: dvigen.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluajittex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluajittex_a-dvigen.o -MD -MP -MF $(DEPDIR)/libluajittex_a-dvigen.Tpo -c -o libluajittex_a-dvigen.o `test -f 'dvigen.c' || echo '$(srcdir)/'`dvigen.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libluajittex_a-dvigen.Tpo $(DEPDIR)/libluajittex_a-dvigen.Po
@@ -9434,20 +9430,6 @@ synctexdir/libluatex_a-synctex.obj: synctexdir/synctex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o synctexdir/libluatex_a-synctex.obj `if test -f 'synctexdir/synctex.c'; then $(CYGPATH_W) 'synctexdir/synctex.c'; else $(CYGPATH_W) '$(srcdir)/synctexdir/synctex.c'; fi`
-mplibdir/libluatex_a-lmplib.o: mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/libluatex_a-lmplib.o -MD -MP -MF mplibdir/$(DEPDIR)/libluatex_a-lmplib.Tpo -c -o mplibdir/libluatex_a-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/libluatex_a-lmplib.Tpo mplibdir/$(DEPDIR)/libluatex_a-lmplib.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/libluatex_a-lmplib.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/libluatex_a-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
-
-mplibdir/libluatex_a-lmplib.obj: mplibdir/lmplib.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/libluatex_a-lmplib.obj -MD -MP -MF mplibdir/$(DEPDIR)/libluatex_a-lmplib.Tpo -c -o mplibdir/libluatex_a-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/libluatex_a-lmplib.Tpo mplibdir/$(DEPDIR)/libluatex_a-lmplib.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/libluatex_a-lmplib.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/libluatex_a-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
-
libluatex_a-dvigen.o: dvigen.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-dvigen.o -MD -MP -MF $(DEPDIR)/libluatex_a-dvigen.Tpo -c -o libluatex_a-dvigen.o `test -f 'dvigen.c' || echo '$(srcdir)/'`dvigen.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libluatex_a-dvigen.Tpo $(DEPDIR)/libluatex_a-dvigen.Po
@@ -10862,6 +10844,20 @@ libmplib_a-mpmath.obj: mpmath.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-mpmath.obj `if test -f 'mpmath.c'; then $(CYGPATH_W) 'mpmath.c'; else $(CYGPATH_W) '$(srcdir)/mpmath.c'; fi`
+libmplib_a-mpmathbinary.o: mpmathbinary.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mpmathbinary.o -MD -MP -MF $(DEPDIR)/libmplib_a-mpmathbinary.Tpo -c -o libmplib_a-mpmathbinary.o `test -f 'mpmathbinary.c' || echo '$(srcdir)/'`mpmathbinary.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmplib_a-mpmathbinary.Tpo $(DEPDIR)/libmplib_a-mpmathbinary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mpmathbinary.c' object='libmplib_a-mpmathbinary.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-mpmathbinary.o `test -f 'mpmathbinary.c' || echo '$(srcdir)/'`mpmathbinary.c
+
+libmplib_a-mpmathbinary.obj: mpmathbinary.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mpmathbinary.obj -MD -MP -MF $(DEPDIR)/libmplib_a-mpmathbinary.Tpo -c -o libmplib_a-mpmathbinary.obj `if test -f 'mpmathbinary.c'; then $(CYGPATH_W) 'mpmathbinary.c'; else $(CYGPATH_W) '$(srcdir)/mpmathbinary.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmplib_a-mpmathbinary.Tpo $(DEPDIR)/libmplib_a-mpmathbinary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mpmathbinary.c' object='libmplib_a-mpmathbinary.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-mpmathbinary.obj `if test -f 'mpmathbinary.c'; then $(CYGPATH_W) 'mpmathbinary.c'; else $(CYGPATH_W) '$(srcdir)/mpmathbinary.c'; fi`
+
libmplib_a-mpmathdecimal.o: mpmathdecimal.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mpmathdecimal.o -MD -MP -MF $(DEPDIR)/libmplib_a-mpmathdecimal.Tpo -c -o libmplib_a-mpmathdecimal.o `test -f 'mpmathdecimal.c' || echo '$(srcdir)/'`mpmathdecimal.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmplib_a-mpmathdecimal.Tpo $(DEPDIR)/libmplib_a-mpmathdecimal.Po
@@ -11954,6 +11950,20 @@ luatexdir/luajittex-luatex.obj: luatexdir/luatex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luajittex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o luatexdir/luajittex-luatex.obj `if test -f 'luatexdir/luatex.c'; then $(CYGPATH_W) 'luatexdir/luatex.c'; else $(CYGPATH_W) '$(srcdir)/luatexdir/luatex.c'; fi`
+mplibdir/luajittex-lmplib.o: mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luajittex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/luajittex-lmplib.o -MD -MP -MF mplibdir/$(DEPDIR)/luajittex-lmplib.Tpo -c -o mplibdir/luajittex-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/luajittex-lmplib.Tpo mplibdir/$(DEPDIR)/luajittex-lmplib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/luajittex-lmplib.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luajittex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/luajittex-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
+
+mplibdir/luajittex-lmplib.obj: mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luajittex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/luajittex-lmplib.obj -MD -MP -MF mplibdir/$(DEPDIR)/luajittex-lmplib.Tpo -c -o mplibdir/luajittex-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/luajittex-lmplib.Tpo mplibdir/$(DEPDIR)/luajittex-lmplib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/luajittex-lmplib.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luajittex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/luajittex-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
+
luatexdir/luatex-luatex.o: luatexdir/luatex.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT luatexdir/luatex-luatex.o -MD -MP -MF luatexdir/$(DEPDIR)/luatex-luatex.Tpo -c -o luatexdir/luatex-luatex.o `test -f 'luatexdir/luatex.c' || echo '$(srcdir)/'`luatexdir/luatex.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) luatexdir/$(DEPDIR)/luatex-luatex.Tpo luatexdir/$(DEPDIR)/luatex-luatex.Po
@@ -11968,6 +11978,20 @@ luatexdir/luatex-luatex.obj: luatexdir/luatex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o luatexdir/luatex-luatex.obj `if test -f 'luatexdir/luatex.c'; then $(CYGPATH_W) 'luatexdir/luatex.c'; else $(CYGPATH_W) '$(srcdir)/luatexdir/luatex.c'; fi`
+mplibdir/luatex-lmplib.o: mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/luatex-lmplib.o -MD -MP -MF mplibdir/$(DEPDIR)/luatex-lmplib.Tpo -c -o mplibdir/luatex-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/luatex-lmplib.Tpo mplibdir/$(DEPDIR)/luatex-lmplib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/luatex-lmplib.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/luatex-lmplib.o `test -f 'mplibdir/lmplib.c' || echo '$(srcdir)/'`mplibdir/lmplib.c
+
+mplibdir/luatex-lmplib.obj: mplibdir/lmplib.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mplibdir/luatex-lmplib.obj -MD -MP -MF mplibdir/$(DEPDIR)/luatex-lmplib.Tpo -c -o mplibdir/luatex-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) mplibdir/$(DEPDIR)/luatex-lmplib.Tpo mplibdir/$(DEPDIR)/luatex-lmplib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mplibdir/lmplib.c' object='mplibdir/luatex-lmplib.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(luatex_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mplibdir/luatex-lmplib.obj `if test -f 'mplibdir/lmplib.c'; then $(CYGPATH_W) 'mplibdir/lmplib.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/lmplib.c'; fi`
+
libmd5/md5main-md5main.o: libmd5/md5main.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(md5main_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmd5/md5main-md5main.o -MD -MP -MF libmd5/$(DEPDIR)/md5main-md5main.Tpo -c -o libmd5/md5main-md5main.o `test -f 'libmd5/md5main.c' || echo '$(srcdir)/'`libmd5/md5main.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libmd5/$(DEPDIR)/md5main-md5main.Tpo libmd5/$(DEPDIR)/md5main-md5main.Po
@@ -14139,6 +14163,11 @@ $(mpmath_c_h): mpmath-tangle
mpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh
@$(mp_ctangle_sh) mpmath
+$(mpmathbinary_c_h): mpmathbinary-tangle
+ @$(mp_ctangle_sh) mpmathbinary
+mpmathbinary-tangle: ctangle$(EXEEXT) mplibdir/mpmathbinary.w tangle-sh
+ @$(mp_ctangle_sh) mpmathbinary
+
$(mpmathdecimal_c_h): mpmathdecimal-tangle
@$(mp_ctangle_sh) mpmathdecimal
mpmathdecimal-tangle: ctangle$(EXEEXT) mplibdir/mpmathdecimal.w tangle-sh
@@ -14169,7 +14198,7 @@ $(svgout_c_h): svgout-tangle
svgout-tangle: ctangle$(EXEEXT) mplibdir/svgout.w tangle-sh
@$(mp_ctangle_sh) svgout
-$(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND)
+$(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND) $(MPFR_DEPEND)
$(etex_OBJECTS): $(etex_prereq)
$(etex_c_h): etex-web2c
@@ -14437,8 +14466,8 @@ $(libluajitmisc_a_OBJECTS): $(libluajitmisc_a_DEPENDENCIES)
$(libff_a_OBJECTS): $(libff_a_DEPENDENCIES)
$(libjitff_a_OBJECTS): $(libjitff_a_DEPENDENCIES)
-$(libluatex_a_OBJECTS): libff.a libmplib.a $(POPPLER_DEPEND)
-$(libluajittex_a_OBJECTS): libjitff.a libmplib.a $(POPPLER_DEPEND)
+$(libluatex_a_OBJECTS): libff.a $(POPPLER_DEPEND)
+$(libluajittex_a_OBJECTS): libjitff.a $(POPPLER_DEPEND)
dvigen.c: ctangle$(EXEEXT) luatexdir/dvi/dvigen.w
$(luatex_dvi_ctangle) dvigen.w
@@ -14655,8 +14684,8 @@ utils.c: ctangle$(EXEEXT) luatexdir/utils/utils.w
unistring.c: ctangle$(EXEEXT) luatexdir/utils/unistring.w
$(luatex_utils_ctangle) unistring.w
-$(luatex_OBJECTS): libluatex.a
-$(luajittex_OBJECTS): libluajittex.a
+$(luatex_OBJECTS): libluatex.a libmplib.a
+$(luajittex_OBJECTS): libluajittex.a libmplib.a
.PHONY: install-luatex-links uninstall-luatex-links
.PHONY: install-luajittex-links uninstall-luajittex-links
diff --git a/Build/source/texk/web2c/ac/web2c.ac b/Build/source/texk/web2c/ac/web2c.ac
index 6aa8ce15562..b4021f02a31 100644
--- a/Build/source/texk/web2c/ac/web2c.ac
+++ b/Build/source/texk/web2c/ac/web2c.ac
@@ -39,9 +39,9 @@ m4_define([kpse_tex_progs], [dnl
[[euptex], [yes], [yes], [e-upTeX], [ptexenc]],
[[aleph], [yes], [], [Aleph], []],
[[pdftex], [yes], [yes], [pdfTeX], [xpdf libpng]],
-[[luatex], [yes], [], [LuaTeX], [poppler cairo libpng zziplib lua52]],
-[[luajittex], [yes], [], [LuaJITTeX], [poppler cairo libpng zziplib luajit]],
-[[mp], [yes], [], [MetaPost], [cairo libpng]],
+[[luatex], [yes], [], [LuaTeX], [poppler mpfr cairo libpng zziplib lua52]],
+[[luajittex], [yes], [], [LuaJITTeX], [poppler mpfr cairo libpng zziplib luajit]],
+[[mp], [yes], [], [MetaPost], [mpfr cairo libpng]],
[[xetex], [yes], [yes], [XeTeX], [poppler libpng freetype2 teckit harfbuzz]],
])[]dnl
m4_foreach([Kpse_Prog], [kpse_tex_progs],
diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure
index 70cf8f8a2d6..dcf801c3384 100755
--- a/Build/source/texk/web2c/configure
+++ b/Build/source/texk/web2c/configure
@@ -18126,6 +18126,7 @@ esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -18144,6 +18145,7 @@ esac
test "x$enable_web2c:$enable_luajittex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -18161,6 +18163,7 @@ case $enable_mp in #(
esac
test "x$enable_web2c:$enable_mp" = xyes:yes && {
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
}
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index b59cc04370c..b03efd33104 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,12 @@
+2014-06-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/libluatex.am: Remove ../mplibdir/lmplib.c from sources and
+ dependency on libmplib.a.
+ * am/luatex.am: Add ../mplibdir/lmplib.c to sources, dependency
+ on libmplib.a, and -DpdfTeX to CPPFLAGS.
+
+ * am/luatex.am: Adapt to MetaPost 1.999 (libgmp and libmpfr).
+
2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de>
* font/mapfile.w, font/tounicode.w, font/writet1.w,
diff --git a/Build/source/texk/web2c/luatexdir/am/libluatex.am b/Build/source/texk/web2c/luatexdir/am/libluatex.am
index 1f48d8006f5..e414fd2bc1d 100644
--- a/Build/source/texk/web2c/luatexdir/am/libluatex.am
+++ b/Build/source/texk/web2c/luatexdir/am/libluatex.am
@@ -47,8 +47,8 @@ nodist_libluajittex_a_SOURCES = \
$(dist_libluatex_sources) \
$(nodist_libluatex_sources)
-$(libluatex_a_OBJECTS): libff.a libmplib.a $(POPPLER_DEPEND)
-$(libluajittex_a_OBJECTS): libjitff.a libmplib.a $(POPPLER_DEPEND)
+$(libluatex_a_OBJECTS): libff.a $(POPPLER_DEPEND)
+$(libluajittex_a_OBJECTS): libjitff.a $(POPPLER_DEPEND)
## from luatexdir
##
@@ -531,11 +531,6 @@ dist_libluatex_sources += \
synctexdir/synctex.c \
synctexdir/synctex.h
-## from ../mplibdir
-##
-dist_libluatex_sources += \
- mplibdir/lmplib.c
-
EXTRA_DIST += \
$(dist_libluatex_sources) \
$(libluatex_web)
diff --git a/Build/source/texk/web2c/luatexdir/am/luatex.am b/Build/source/texk/web2c/luatexdir/am/luatex.am
index a93f086185e..aa0c9b68145 100644
--- a/Build/source/texk/web2c/luatexdir/am/luatex.am
+++ b/Build/source/texk/web2c/luatexdir/am/luatex.am
@@ -34,22 +34,22 @@ nodist_EXTRA_luatex_SOURCES = dummy.cxx
nodist_EXTRA_luajittex_SOURCES = dummy.cxx
luatex_preflags = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(POPPLER_INCLUDES)
-luatex_postflags = -I$(srcdir)/libmd5 -I$(srcdir)/luatexdir -I$(srcdir)/mplibdir
+luatex_postflags = -I$(srcdir)/libmd5 -DpdfTeX -I$(srcdir)/luatexdir -I$(srcdir)/mplibdir
luatex_postflags += -Dextra_version_info=`date +-%Y%m%d%H`
luatex_postflags += -I$(srcdir)/synctexdir -DSYNCTEX_ENGINE_H='<synctex-luatex.h>'
luatex_CPPFLAGS = $(luatex_preflags) $(LUA_INCLUDES) $(luatex_postflags)
-luajittex_CPPFLAGS = $(luatex_preflags) $(LUAJIT_INCLUDES) $(luatex_postflags)
+luajittex_CPPFLAGS = $(luatex_preflags) $(LUAJIT_INCLUDES) $(LUAJIT_DEFINES) $(luatex_postflags)
luatex_CXXFLAGS = $(WARNING_CXXFLAGS)
luajittex_CXXFLAGS = $(WARNING_CXXFLAGS)
luatex_ldadd = libluatex.a libff.a libunilib.a libluamisc.a libluasocket.a $(LUA_LIBS)
-luatex_ldadd += libmd5.a libmplib.a $(CAIRO_LIBS) $(PIXMAN_LIBS)
+luatex_ldadd += libmd5.a libmplib.a $(MPFR_LIBS) $(GMP_LIBS) $(CAIRO_LIBS) $(PIXMAN_LIBS)
luatex_ldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)
luajittex_ldadd = libluajittex.a libjitff.a libunilib.a libluajitmisc.a libluajitsocket.a $(LUAJIT_LIBS)
-luajittex_ldadd += libmd5.a libmplib.a $(CAIRO_LIBS) $(PIXMAN_LIBS)
+luajittex_ldadd += libmd5.a libmplib.a $(MPFR_LIBS) $(GMP_LIBS) $(CAIRO_LIBS) $(PIXMAN_LIBS)
luajittex_ldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)
luatex_LDFLAGS = -export-dynamic
@@ -63,8 +63,8 @@ luatex_DEPENDENCIES += $(LIBPNG_DEPEND) libmd5.a libmplib.a
luajittex_DEPENDENCIES = $(proglib) $(KPATHSEA_DEPEND) libluajittex.a
luajittex_DEPENDENCIES += $(LIBPNG_DEPEND) libmd5.a libmplib.a
-$(luatex_OBJECTS): libluatex.a
-$(luajittex_OBJECTS): libluajittex.a
+$(luatex_OBJECTS): libluatex.a libmplib.a
+$(luajittex_OBJECTS): libluajittex.a libmplib.a
nodist_luatex_SOURCES = $(luatex_sources)
nodist_luajittex_SOURCES = $(luatex_sources)
@@ -72,7 +72,8 @@ nodist_luajittex_SOURCES = $(luatex_sources)
luatex_sources = \
luatexdir/luatex_svnversion.h \
luatexdir/luatex.c \
- luatexdir/luatex.h
+ luatexdir/luatex.h \
+ mplibdir/lmplib.c
EXTRA_DIST += \
$(luatex_sources) \
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog
index 83d7ee90aa2..56bfe987aa8 100644
--- a/Build/source/texk/web2c/mplibdir/ChangeLog
+++ b/Build/source/texk/web2c/mplibdir/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import metapost 1.999
+
2014-04-23 Taco Hoekwater <taco@luatex.org>
Import metapost 1.902
diff --git a/Build/source/texk/web2c/mplibdir/am/libmplib.am b/Build/source/texk/web2c/mplibdir/am/libmplib.am
index b53980128da..e8c98dfe096 100644
--- a/Build/source/texk/web2c/mplibdir/am/libmplib.am
+++ b/Build/source/texk/web2c/mplibdir/am/libmplib.am
@@ -7,20 +7,21 @@
##
EXTRA_LIBRARIES += libmplib.a
-libmplib_a_CPPFLAGS = $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) \
- $(AM_CPPFLAGS) -I$(srcdir)/mplibdir
+libmplib_a_CPPFLAGS = $(MPFR_INCLUDES) $(GMP_INCLUDES) $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) \
+ $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir
## libmplib C sources
libmplib_a_SOURCES = mplibdir/avl.h mplibdir/avl.c mplibdir/decNumber.c mplibdir/decNumber.h \
mplibdir/decNumberLocal.h mplibdir/decContext.h mplibdir/decContext.c
-nodist_libmplib_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathdecimal_c_h) \
+nodist_libmplib_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathbinary_c_h) $(mpmathdecimal_c_h) \
$(mpmathdouble_c_h) $(mpstrings_c_h) $(pngout_c_h) $(psout_c_h) $(svgout_c_h)
mp_c_h = mp.c mplib.h mpmp.h
mpmath_c_h = mpmath.h mpmath.c
+mpmathbinary_c_h = mpmathbinary.h mpmathbinary.c
mpmathdecimal_c_h = mpmathdecimal.h mpmathdecimal.c
mpmathdouble_c_h = mpmathdouble.h mpmathdouble.c
mpstrings_c_h = mpstrings.h mpstrings.c
-psout_c_h = mppsout.h psout.c mplibps.h
+psout_c_h = mplibps.h mppsout.h psout.c
svgout_c_h = mplibsvg.h mpsvgout.h svgout.c
pngout_c_h = mplibpng.h mppngout.h pngout.c
@@ -39,6 +40,11 @@ $(mpmath_c_h): mpmath-tangle
mpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh
@$(mp_ctangle_sh) mpmath
+$(mpmathbinary_c_h): mpmathbinary-tangle
+ @$(mp_ctangle_sh) mpmathbinary
+mpmathbinary-tangle: ctangle$(EXEEXT) mplibdir/mpmathbinary.w tangle-sh
+ @$(mp_ctangle_sh) mpmathbinary
+
$(mpmathdecimal_c_h): mpmathdecimal-tangle
@$(mp_ctangle_sh) mpmathdecimal
mpmathdecimal-tangle: ctangle$(EXEEXT) mplibdir/mpmathdecimal.w tangle-sh
@@ -71,14 +77,14 @@ svgout-tangle: ctangle$(EXEEXT) mplibdir/svgout.w tangle-sh
## libmplib CWeb sources
libmplib_web = mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w mplibdir/pngout.w
-libmplib_web += mplibdir/mpmath.w mplibdir/mpmathdecimal.w mplibdir/mpmathdouble.w
-libmplib_web += mplibdir/mpstrings.w mplibdir/tfmin.w
+libmplib_web += mplibdir/mpmath.w mplibdir/mpmathbinary.w mplibdir/mpmathdecimal.w
+libmplib_web += mplibdir/mpmathdouble.w mplibdir/mpstrings.w mplibdir/tfmin.w
-$(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND)
+$(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND) $(MPFR_DEPEND)
EXTRA_DIST += $(libmplib_web)
DISTCLEANFILES += $(nodist_libmplib_a_SOURCES) \
- mp-tangle mpmath-tangle mpmathdecimal-tangle mpmathdouble-tangle mpstrings-tangle \
- psout-tangle svgout-tangle pngout-tangle
+ mp-tangle mpmath-tangle mpmathbinary-tangle mpmathdecimal-tangle mpmathdouble-tangle \
+ mpstrings-tangle psout-tangle svgout-tangle pngout-tangle
diff --git a/Build/source/texk/web2c/mplibdir/am/mplib.am b/Build/source/texk/web2c/mplibdir/am/mplib.am
index 5cceff38467..7b152f20b15 100644
--- a/Build/source/texk/web2c/mplibdir/am/mplib.am
+++ b/Build/source/texk/web2c/mplibdir/am/mplib.am
@@ -19,7 +19,8 @@ EXTRA_PROGRAMS += mpost
mpost_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) -I$(srcdir)/mplibdir
mpost_DEPENDENCIES = libmplib.a
-mpost_LDADD = libmplib.a $(KPATHSEA_LIBS) $(CAIRO_LIBS) $(PIXMAN_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS)
+mpost_LDADD = libmplib.a $(KPATHSEA_LIBS) $(MPFR_LIBS) $(GMP_LIBS) \
+ $(CAIRO_LIBS) $(PIXMAN_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS)
call_mpost_CPPFLAGS = -DEXEPROG=\"mpost.exe\"
nodist_call_mpost_SOURCES = callexe.c
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index 3ac2bdff0c4..54904fd4157 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -1,4 +1,4 @@
-% $Id: mp.w 2009 2014-04-23 07:09:51Z taco $
+% $Id: mp.w 2005 2014-04-09 10:02:21Z taco $
%
% This file is part of MetaPost;
% the MetaPost program is in the public domain.
@@ -73,12 +73,12 @@ undergoes any modifications, so that it will be clear which version of
@^extensions to \MP@>
@^system dependencies@>
-@d default_banner "This is MetaPost, Version 1.902" /* printed when \MP\ starts */
+@d default_banner "This is MetaPost, Version 1.999" /* printed when \MP\ starts */
@d true 1
@d false 0
@<Metapost version header@>=
-#define metapost_version "1.902"
+#define metapost_version "1.999"
@ The external library header for \MP\ is |mplib.h|. It contains a
few typedefs and the header defintions for the externally used
@@ -156,6 +156,8 @@ typedef struct MP_instance {
#include <png.h> /* for PNG_LIBPNG_VER_STRING, png_libpng_ver */
#include <pixman.h> /* for PIXMAN_VERSION_STRING, pixman_version_string() */
#include <cairo.h> /* for CAIRO_VERSION_STRING, cairo_version_string() */
+#include <gmp.h> /* for __GNU_MP_VERSION etc., gmp_version */
+#include <mpfr.h> /* for MPFR_VERSION_STRING, mpfr_get_version() */
#include "mplib.h"
#include "mplibps.h" /* external header */
#include "mplibsvg.h" /* external header */
@@ -167,6 +169,7 @@ typedef struct MP_instance {
#include "mpmath.h" /* internal header */
#include "mpmathdouble.h" /* internal header */
#include "mpmathdecimal.h" /* internal header */
+#include "mpmathbinary.h" /* internal header */
#include "mpstrings.h" /* internal header */
extern font_number mp_read_font_info (MP mp, char *fname); /* tfmin.w */
@h @<Declarations@>;
@@ -534,6 +537,8 @@ MP mp_initialize (MP_options * opt) {
mp->math = mp_initialize_scaled_math(mp);
} else if (opt->math_mode == mp_math_decimal_mode) {
mp->math = mp_initialize_decimal_math(mp);
+ } else if (opt->math_mode == mp_math_binary_mode) {
+ mp->math = mp_initialize_binary_math(mp);
} else {
mp->math = mp_initialize_double_math(mp);
}
@@ -557,6 +562,8 @@ MP mp_initialize (MP_options * opt) {
set_internal_string (mp_number_system, mp_intern (mp, "scaled"));
} else if (opt->math_mode == mp_math_decimal_mode) {
set_internal_string (mp_number_system, mp_intern (mp, "decimal"));
+ } else if (opt->math_mode == mp_math_binary_mode) {
+ set_internal_string (mp_number_system, mp_intern (mp, "binary"));
} else {
set_internal_string (mp_number_system, mp_intern (mp, "double"));
}
@@ -570,6 +577,7 @@ MP mp_initialize (MP_options * opt) {
} else {
mp->history = mp_spotless;
}
+ set_precision();
return mp;
}
@@ -29795,6 +29803,9 @@ char *mp_metapost_version (void) {
return mp_strdup (metapost_version);
}
void mp_show_library_versions (void) {
+ fprintf(stdout, "Compiled with mpfr %s; using %s\n", MPFR_VERSION_STRING, mpfr_get_version());
+ fprintf(stdout, "Compiled with gmp %d.%d.%d; using %s\n",
+ __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL, gmp_version);
fprintf(stdout, "Compiled with cairo %s; using %s\n", CAIRO_VERSION_STRING, cairo_version_string());
fprintf(stdout, "Compiled with pixman %s; using %s\n", PIXMAN_VERSION_STRING, pixman_version_string());
fprintf(stdout, "Compiled with libpng %s; using %s\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
diff --git a/Build/source/texk/web2c/mplibdir/mpmathbinary.w b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
new file mode 100644
index 00000000000..a33fe54808b
--- /dev/null
+++ b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
@@ -0,0 +1,1527 @@
+% $Id$
+%
+% This file is part of MetaPost;
+% the MetaPost program is in the public domain.
+% See the <Show version...> code in mpost.w for more info.
+
+\def\title{Math support functions for MPFR based math}
+\pdfoutput=1
+
+@ Introduction.
+
+@c
+#include <w2c/config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "mpmathbinary.h" /* internal header */
+#define ROUND(a) floor((a)+0.5)
+@h
+
+@ @c
+@<Declarations@>;
+
+@ @(mpmathbinary.h@>=
+#ifndef MPMATHBINARY_H
+#define MPMATHBINARY_H 1
+#include "mplib.h"
+#include "mpmp.h" /* internal header */
+#include <mpfr.h>
+@<Internal library declarations@>;
+#endif
+
+@* Math initialization.
+
+First, here are some very important constants.
+
+@d ROUNDING MPFR_RNDN
+@d E_STRING "2.7182818284590452353602874713526624977572470936999595749669676277240766303535"
+@d PI_STRING "3.1415926535897932384626433832795028841971693993751058209749445923078164062862"
+@d fraction_multiplier 4096
+@d angle_multiplier 16
+
+@ Here are the functions that are static as they are not used elsewhere
+
+@<Declarations@>=
+#define DEBUG 0
+static void mp_binary_scan_fractional_token (MP mp, int n);
+static void mp_binary_scan_numeric_token (MP mp, int n);
+static void mp_ab_vs_cd (MP mp, mp_number *ret, mp_number a, mp_number b, mp_number c, mp_number d);
+static void mp_binary_crossing_point (MP mp, mp_number *ret, mp_number a, mp_number b, mp_number c);
+static void mp_binary_number_modulo (mp_number *a, mp_number b);
+static void mp_binary_print_number (MP mp, mp_number n);
+static char * mp_binary_number_tostring (MP mp, mp_number n);
+static void mp_binary_slow_add (MP mp, mp_number *ret, mp_number x_orig, mp_number y_orig);
+static void mp_binary_square_rt (MP mp, mp_number *ret, mp_number x_orig);
+static void mp_binary_sin_cos (MP mp, mp_number z_orig, mp_number *n_cos, mp_number *n_sin);
+static void mp_init_randoms (MP mp, int seed);
+static void mp_number_angle_to_scaled (mp_number *A);
+static void mp_number_fraction_to_scaled (mp_number *A);
+static void mp_number_scaled_to_fraction (mp_number *A);
+static void mp_number_scaled_to_angle (mp_number *A);
+static void mp_binary_m_exp (MP mp, mp_number *ret, mp_number x_orig);
+static void mp_binary_m_log (MP mp, mp_number *ret, mp_number x_orig);
+static void mp_binary_pyth_sub (MP mp, mp_number *r, mp_number a, mp_number b);
+static void mp_binary_pyth_add (MP mp, mp_number *r, mp_number a, mp_number b);
+static void mp_binary_n_arg (MP mp, mp_number *ret, mp_number x, mp_number y);
+static void mp_binary_velocity (MP mp, mp_number *ret, mp_number st, mp_number ct, mp_number sf, mp_number cf, mp_number t);
+static void mp_set_binary_from_int(mp_number *A, int B);
+static void mp_set_binary_from_boolean(mp_number *A, int B);
+static void mp_set_binary_from_scaled(mp_number *A, int B);
+static void mp_set_binary_from_addition(mp_number *A, mp_number B, mp_number C);
+static void mp_set_binary_from_substraction (mp_number *A, mp_number B, mp_number C);
+static void mp_set_binary_from_div(mp_number *A, mp_number B, mp_number C);
+static void mp_set_binary_from_mul(mp_number *A, mp_number B, mp_number C);
+static void mp_set_binary_from_int_div(mp_number *A, mp_number B, int C);
+static void mp_set_binary_from_int_mul(mp_number *A, mp_number B, int C);
+static void mp_set_binary_from_of_the_way(MP mp, mp_number *A, mp_number t, mp_number B, mp_number C);
+static void mp_number_negate(mp_number *A);
+static void mp_number_add(mp_number *A, mp_number B);
+static void mp_number_substract(mp_number *A, mp_number B);
+static void mp_number_half(mp_number *A);
+static void mp_number_halfp(mp_number *A);
+static void mp_number_double(mp_number *A);
+static void mp_number_add_scaled(mp_number *A, int B); /* also for negative B */
+static void mp_number_multiply_int(mp_number *A, int B);
+static void mp_number_divide_int(mp_number *A, int B);
+static void mp_binary_abs(mp_number *A);
+static void mp_number_clone(mp_number *A, mp_number B);
+static void mp_number_swap(mp_number *A, mp_number *B);
+static int mp_round_unscaled(mp_number x_orig);
+static int mp_number_to_int(mp_number A);
+static int mp_number_to_scaled(mp_number A);
+static int mp_number_to_boolean(mp_number A);
+static double mp_number_to_double(mp_number A);
+static int mp_number_odd(mp_number A);
+static int mp_number_equal(mp_number A, mp_number B);
+static int mp_number_greater(mp_number A, mp_number B);
+static int mp_number_less(mp_number A, mp_number B);
+static int mp_number_nonequalabs(mp_number A, mp_number B);
+static void mp_number_floor (mp_number *i);
+static void mp_binary_fraction_to_round_scaled (mp_number *x);
+static void mp_binary_number_make_scaled (MP mp, mp_number *r, mp_number p, mp_number q);
+static void mp_binary_number_make_fraction (MP mp, mp_number *r, mp_number p, mp_number q);
+static void mp_binary_number_take_fraction (MP mp, mp_number *r, mp_number p, mp_number q);
+static void mp_binary_number_take_scaled (MP mp, mp_number *r, mp_number p, mp_number q);
+static void mp_new_number (MP mp, mp_number *n, mp_number_type t) ;
+static void mp_free_number (MP mp, mp_number *n) ;
+static void mp_set_binary_from_double(mp_number *A, double B);
+static void mp_free_binary_math (MP mp);
+static void mp_binary_set_precision (MP mp);
+static void mp_check_mpfr_t (MP mp, mpfr_t dec);
+static int binary_number_check (mpfr_t dec);
+static char * mp_binnumber_tostring (mpfr_t n);
+static void init_binary_constants (void);
+static void free_binary_constants (void);
+static mpfr_prec_t precision_digits_to_bits(double i);
+static double precision_bits_to_digits (mpfr_prec_t i);
+
+@ We do not want special numbers as return values for functions, so:
+
+@d mpfr_negative_p(a) (mpfr_sgn((a))<0)
+@d mpfr_positive_p(a) (mpfr_sgn((a))>0)
+@d checkZero(dec) if (mpfr_zero_p(dec) && mpfr_negative_p(dec)) {
+ mpfr_set_zero(dec,1);
+ }
+
+@c
+int binary_number_check (mpfr_t dec)
+{
+ int test = false;
+ if (!mpfr_number_p(dec)) {
+ test = true;
+ if (mpfr_inf_p(dec)) {
+ mpfr_set(dec, EL_GORDO_mpfr_t, ROUNDING);
+ if (mpfr_negative_p(dec)) {
+ mpfr_neg(dec, dec, ROUNDING);
+ }
+ } else { // Nan
+ mpfr_set_zero(dec,1); /* 1 == positive */
+ }
+ }
+ checkZero(dec);
+ return test;
+}
+void mp_check_mpfr_t (MP mp, mpfr_t dec)
+{
+ mp->arith_error = binary_number_check (dec);
+}
+
+
+
+
+@ Precision IO uses |double| because |MPFR_PREC_MAX| overflows int.
+
+@c
+static double precision_bits;
+mpfr_prec_t precision_digits_to_bits (double i)
+{
+ return i/log10(2);
+}
+double precision_bits_to_digits (mpfr_prec_t d)
+{
+ return d*log10(2);
+}
+
+
+@ And these are the ones that {\it are} used elsewhere
+
+@<Internal library declarations@>=
+void * mp_initialize_binary_math (MP mp);
+
+@
+
+@d unity 1
+@d two 2
+@d three 3
+@d four 4
+@d half_unit 0.5
+@d three_quarter_unit 0.75
+@d coef_bound ((7.0/3.0)*fraction_multiplier) /* |fraction| approximation to 7/3 */
+@d fraction_threshold 0.04096 /* a |fraction| coefficient less than this is zeroed */
+@d half_fraction_threshold (fraction_threshold/2) /* half of |fraction_threshold| */
+@d scaled_threshold 0.000122 /* a |scaled| coefficient less than this is zeroed */
+@d half_scaled_threshold (scaled_threshold/2) /* half of |scaled_threshold| */
+@d near_zero_angle (0.0256*angle_multiplier) /* an angle of about 0.0256 */
+@d p_over_v_threshold 0x80000 /* TODO */
+@d equation_threshold 0.001
+@d tfm_warn_threshold 0.0625
+@d warning_limit pow(2.0,52.0) /* this is a large value that can just be expressed without loss of precision */
+@d epsilon "1E-52"
+@d epsilonf pow(2.0,-52.0)
+@d EL_GORDO "1E1000000" /* the largest value that \MP\ likes. */
+@d one_third_EL_GORDO (EL_GORDO/3.0)
+
+@<Declarations@>=
+static mpfr_t zero;
+static mpfr_t one;
+static mpfr_t minusone;
+static mpfr_t two_mpfr_t;
+static mpfr_t three_mpfr_t;
+static mpfr_t four_mpfr_t;
+static mpfr_t fraction_multiplier_mpfr_t;
+static mpfr_t angle_multiplier_mpfr_t;
+static mpfr_t fraction_one_mpfr_t;
+static mpfr_t fraction_one_plus_mpfr_t;
+static mpfr_t PI_mpfr_t;
+static mpfr_t epsilon_mpfr_t;
+static mpfr_t EL_GORDO_mpfr_t;
+
+@ @c
+void init_binary_constants (void) {
+ mpfr_inits2 (precision_bits, one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,
+ fraction_one_mpfr_t, fraction_one_plus_mpfr_t, angle_multiplier_mpfr_t, PI_mpfr_t,
+ epsilon_mpfr_t, EL_GORDO_mpfr_t, (mpfr_ptr) 0);
+ mpfr_set_si (one, 1, ROUNDING);
+ mpfr_set_si (minusone, -1, ROUNDING);
+ mpfr_set_si (zero, 0, ROUNDING);
+ mpfr_set_si (two_mpfr_t, two, ROUNDING);
+ mpfr_set_si (three_mpfr_t, three, ROUNDING);
+ mpfr_set_si (four_mpfr_t, four, ROUNDING);
+ mpfr_set_si (fraction_multiplier_mpfr_t, fraction_multiplier, ROUNDING);
+ mpfr_set_si (fraction_one_mpfr_t, fraction_one, ROUNDING);
+ mpfr_set_si (fraction_one_plus_mpfr_t, (fraction_one+1), ROUNDING);
+ mpfr_set_si (angle_multiplier_mpfr_t, angle_multiplier, ROUNDING);
+ mpfr_set_str (PI_mpfr_t, PI_STRING, 10, ROUNDING);
+ mpfr_set_str (epsilon_mpfr_t, epsilon, 10, ROUNDING);
+ mpfr_set_str (EL_GORDO_mpfr_t, EL_GORDO, 10, ROUNDING);
+}
+void free_binary_constants (void) {
+ mpfr_clears (one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,
+ fraction_one_mpfr_t, fraction_one_plus_mpfr_t, angle_multiplier_mpfr_t, PI_mpfr_t,
+ epsilon_mpfr_t, EL_GORDO_mpfr_t, (mpfr_ptr) 0);
+ mpfr_free_cache ();
+}
+
+@ |precision_max| is limited to 1000, because the precision of already initialized
+|mpfr_t| numbers cannot be raised, only lowered. The value of 1000.0 is a tradeoff
+between precision and allocation size / processing speed.
+
+@d MAX_PRECISION 1000.0
+@d DEF_PRECISION 34.0
+
+@c
+void * mp_initialize_binary_math (MP mp) {
+ math_data *math = (math_data *)mp_xmalloc(mp,1,sizeof(math_data));
+ precision_bits = precision_digits_to_bits(MAX_PRECISION);
+ init_binary_constants();
+ /* alloc */
+ math->allocate = mp_new_number;
+ math->free = mp_free_number;
+ mp_new_number (mp, &math->precision_default, mp_scaled_type);
+ mpfr_set_d(math->precision_default.data.num, DEF_PRECISION, ROUNDING);
+ mp_new_number (mp, &math->precision_max, mp_scaled_type);
+ mpfr_set_d(math->precision_max.data.num, MAX_PRECISION, ROUNDING);
+ mp_new_number (mp, &math->precision_min, mp_scaled_type);
+ /* really should be |precision_bits_to_digits(MPFR_PREC_MIN)| but that produces a horrible number */
+ mpfr_set_d(math->precision_min.data.num, 1.0 , ROUNDING);
+ /* here are the constants for |scaled| objects */
+ mp_new_number (mp, &math->epsilon_t, mp_scaled_type);
+ mpfr_set (math->epsilon_t.data.num, epsilon_mpfr_t, ROUNDING);
+ mp_new_number (mp, &math->inf_t, mp_scaled_type);
+ mpfr_set (math->inf_t.data.num, EL_GORDO_mpfr_t, ROUNDING);
+ mp_new_number (mp, &math->warning_limit_t, mp_scaled_type);
+ mpfr_set_d (math->warning_limit_t.data.num, warning_limit, ROUNDING);
+ mp_new_number (mp, &math->one_third_inf_t, mp_scaled_type);
+ mpfr_div (math->one_third_inf_t.data.num, math->inf_t.data.num, three_mpfr_t, ROUNDING);
+ mp_new_number (mp, &math->unity_t, mp_scaled_type);
+ mpfr_set (math->unity_t.data.num, one, ROUNDING);
+ mp_new_number (mp, &math->two_t, mp_scaled_type);
+ mpfr_set_si(math->two_t.data.num, two, ROUNDING);
+ mp_new_number (mp, &math->three_t, mp_scaled_type);
+ mpfr_set_si(math->three_t.data.num, three, ROUNDING);
+ mp_new_number (mp, &math->half_unit_t, mp_scaled_type);
+ mpfr_set_d(math->half_unit_t.data.num, half_unit, ROUNDING);
+ mp_new_number (mp, &math->three_quarter_unit_t, mp_scaled_type);
+ mpfr_set_d (math->three_quarter_unit_t.data.num, three_quarter_unit, ROUNDING);
+ mp_new_number (mp, &math->zero_t, mp_scaled_type);
+ mpfr_set_zero (math->zero_t.data.num, 1);
+ /* |fractions| */
+ mp_new_number (mp, &math->arc_tol_k, mp_fraction_type);
+ {
+ mpfr_div_si (math->arc_tol_k.data.num, one, 4096, ROUNDING);
+ /* quit when change in arc length estimate reaches this */
+ }
+ mp_new_number (mp, &math->fraction_one_t, mp_fraction_type);
+ mpfr_set_si(math->fraction_one_t.data.num, fraction_one, ROUNDING);
+ mp_new_number (mp, &math->fraction_half_t, mp_fraction_type);
+ mpfr_set_si(math->fraction_half_t.data.num, fraction_half, ROUNDING);
+ mp_new_number (mp, &math->fraction_three_t, mp_fraction_type);
+ mpfr_set_si(math->fraction_three_t.data.num, fraction_three, ROUNDING);
+ mp_new_number (mp, &math->fraction_four_t, mp_fraction_type);
+ mpfr_set_si(math->fraction_four_t.data.num, fraction_four, ROUNDING);
+ /* |angles| */
+ mp_new_number (mp, &math->three_sixty_deg_t, mp_angle_type);
+ mpfr_set_si(math->three_sixty_deg_t.data.num, 360 * angle_multiplier, ROUNDING);
+ mp_new_number (mp, &math->one_eighty_deg_t, mp_angle_type);
+ mpfr_set_si(math->one_eighty_deg_t.data.num, 180 * angle_multiplier, ROUNDING);
+ /* various approximations */
+ mp_new_number (mp, &math->one_k, mp_scaled_type);
+ mpfr_set_si(math->one_k.data.num, 1024, ROUNDING);
+ mp_new_number (mp, &math->sqrt_8_e_k, mp_scaled_type);
+ {
+ mpfr_set_d(math->sqrt_8_e_k.data.num, 112428.82793 / 65536.0, ROUNDING);
+ /* $2^{16}\sqrt{8/e}\approx 112428.82793$ */
+ }
+ mp_new_number (mp, &math->twelve_ln_2_k, mp_fraction_type);
+ {
+ mpfr_set_d(math->twelve_ln_2_k.data.num, 139548959.6165 / 65536.0, ROUNDING);
+ /* $2^{24}\cdot12\ln2\approx139548959.6165$ */
+ }
+ mp_new_number (mp, &math->coef_bound_k, mp_fraction_type);
+ mpfr_set_d(math->coef_bound_k.data.num,coef_bound, ROUNDING);
+ mp_new_number (mp, &math->coef_bound_minus_1, mp_fraction_type);
+ mpfr_set_d(math->coef_bound_minus_1.data.num,coef_bound - 1 / 65536.0, ROUNDING);
+ mp_new_number (mp, &math->twelvebits_3, mp_scaled_type);
+ {
+ mpfr_set_d(math->twelvebits_3.data.num, 1365 / 65536.0, ROUNDING);
+ /* $1365\approx 2^{12}/3$ */
+ }
+ mp_new_number (mp, &math->twentysixbits_sqrt2_t, mp_fraction_type);
+ {
+ mpfr_set_d(math->twentysixbits_sqrt2_t.data.num, 94906265.62 / 65536.0, ROUNDING);
+ /* $2^{26}\sqrt2\approx94906265.62$ */
+ }
+ mp_new_number (mp, &math->twentyeightbits_d_t, mp_fraction_type);
+ {
+ mpfr_set_d(math->twentyeightbits_d_t.data.num, 35596754.69 / 65536.0, ROUNDING);
+ /* $2^{28}d\approx35596754.69$ */
+ }
+ mp_new_number (mp, &math->twentysevenbits_sqrt2_d_t, mp_fraction_type);
+ {
+ mpfr_set_d(math->twentysevenbits_sqrt2_d_t.data.num, 25170706.63 / 65536.0, ROUNDING);
+ /* $2^{27}\sqrt2\,d\approx25170706.63$ */
+ }
+ /* thresholds */
+ mp_new_number (mp, &math->fraction_threshold_t, mp_fraction_type);
+ mpfr_set_d(math->fraction_threshold_t.data.num, fraction_threshold, ROUNDING);
+ mp_new_number (mp, &math->half_fraction_threshold_t, mp_fraction_type);
+ mpfr_set_d(math->half_fraction_threshold_t.data.num, half_fraction_threshold, ROUNDING);
+ mp_new_number (mp, &math->scaled_threshold_t, mp_scaled_type);
+ mpfr_set_d(math->scaled_threshold_t.data.num, scaled_threshold, ROUNDING);
+ mp_new_number (mp, &math->half_scaled_threshold_t, mp_scaled_type);
+ mpfr_set_d(math->half_scaled_threshold_t.data.num, half_scaled_threshold, ROUNDING);
+ mp_new_number (mp, &math->near_zero_angle_t, mp_angle_type);
+ mpfr_set_d(math->near_zero_angle_t.data.num, near_zero_angle, ROUNDING);
+ mp_new_number (mp, &math->p_over_v_threshold_t, mp_fraction_type);
+ mpfr_set_d(math->p_over_v_threshold_t.data.num, p_over_v_threshold, ROUNDING);
+ mp_new_number (mp, &math->equation_threshold_t, mp_scaled_type);
+ mpfr_set_d(math->equation_threshold_t.data.num, equation_threshold, ROUNDING);
+ mp_new_number (mp, &math->tfm_warn_threshold_t, mp_scaled_type);
+ mpfr_set_d(math->tfm_warn_threshold_t.data.num, tfm_warn_threshold, ROUNDING);
+ /* functions */
+ math->from_int = mp_set_binary_from_int;
+ math->from_boolean = mp_set_binary_from_boolean;
+ math->from_scaled = mp_set_binary_from_scaled;
+ math->from_double = mp_set_binary_from_double;
+ math->from_addition = mp_set_binary_from_addition;
+ math->from_substraction = mp_set_binary_from_substraction;
+ math->from_oftheway = mp_set_binary_from_of_the_way;
+ math->from_div = mp_set_binary_from_div;
+ math->from_mul = mp_set_binary_from_mul;
+ math->from_int_div = mp_set_binary_from_int_div;
+ math->from_int_mul = mp_set_binary_from_int_mul;
+ math->negate = mp_number_negate;
+ math->add = mp_number_add;
+ math->substract = mp_number_substract;
+ math->half = mp_number_half;
+ math->halfp = mp_number_halfp;
+ math->do_double = mp_number_double;
+ math->abs = mp_binary_abs;
+ math->clone = mp_number_clone;
+ math->swap = mp_number_swap;
+ math->add_scaled = mp_number_add_scaled;
+ math->multiply_int = mp_number_multiply_int;
+ math->divide_int = mp_number_divide_int;
+ math->to_boolean = mp_number_to_boolean;
+ math->to_scaled = mp_number_to_scaled;
+ math->to_double = mp_number_to_double;
+ math->to_int = mp_number_to_int;
+ math->odd = mp_number_odd;
+ math->equal = mp_number_equal;
+ math->less = mp_number_less;
+ math->greater = mp_number_greater;
+ math->nonequalabs = mp_number_nonequalabs;
+ math->round_unscaled = mp_round_unscaled;
+ math->floor_scaled = mp_number_floor;
+ math->fraction_to_round_scaled = mp_binary_fraction_to_round_scaled;
+ math->make_scaled = mp_binary_number_make_scaled;
+ math->make_fraction = mp_binary_number_make_fraction;
+ math->take_fraction = mp_binary_number_take_fraction;
+ math->take_scaled = mp_binary_number_take_scaled;
+ math->velocity = mp_binary_velocity;
+ math->n_arg = mp_binary_n_arg;
+ math->m_log = mp_binary_m_log;
+ math->m_exp = mp_binary_m_exp;
+ math->pyth_add = mp_binary_pyth_add;
+ math->pyth_sub = mp_binary_pyth_sub;
+ math->fraction_to_scaled = mp_number_fraction_to_scaled;
+ math->scaled_to_fraction = mp_number_scaled_to_fraction;
+ math->scaled_to_angle = mp_number_scaled_to_angle;
+ math->angle_to_scaled = mp_number_angle_to_scaled;
+ math->init_randoms = mp_init_randoms;
+ math->sin_cos = mp_binary_sin_cos;
+ math->slow_add = mp_binary_slow_add;
+ math->sqrt = mp_binary_square_rt;
+ math->print = mp_binary_print_number;
+ math->tostring = mp_binary_number_tostring;
+ math->modulo = mp_binary_number_modulo;
+ math->ab_vs_cd = mp_ab_vs_cd;
+ math->crossing_point = mp_binary_crossing_point;
+ math->scan_numeric = mp_binary_scan_numeric_token;
+ math->scan_fractional = mp_binary_scan_fractional_token;
+ math->free_math = mp_free_binary_math;
+ math->set_precision = mp_binary_set_precision;
+ return (void *)math;
+}
+
+void mp_binary_set_precision (MP mp) {
+ double d = mpfr_get_d(internal_value (mp_number_precision).data.num, ROUNDING);
+ precision_bits = precision_digits_to_bits(d);
+}
+
+void mp_free_binary_math (MP mp) {
+ free_number (((math_data *)mp->math)->three_sixty_deg_t);
+ free_number (((math_data *)mp->math)->one_eighty_deg_t);
+ free_number (((math_data *)mp->math)->fraction_one_t);
+ free_number (((math_data *)mp->math)->zero_t);
+ free_number (((math_data *)mp->math)->half_unit_t);
+ free_number (((math_data *)mp->math)->three_quarter_unit_t);
+ free_number (((math_data *)mp->math)->unity_t);
+ free_number (((math_data *)mp->math)->two_t);
+ free_number (((math_data *)mp->math)->three_t);
+ free_number (((math_data *)mp->math)->one_third_inf_t);
+ free_number (((math_data *)mp->math)->inf_t);
+ free_number (((math_data *)mp->math)->warning_limit_t);
+ free_number (((math_data *)mp->math)->one_k);
+ free_number (((math_data *)mp->math)->sqrt_8_e_k);
+ free_number (((math_data *)mp->math)->twelve_ln_2_k);
+ free_number (((math_data *)mp->math)->coef_bound_k);
+ free_number (((math_data *)mp->math)->coef_bound_minus_1);
+ free_number (((math_data *)mp->math)->fraction_threshold_t);
+ free_number (((math_data *)mp->math)->half_fraction_threshold_t);
+ free_number (((math_data *)mp->math)->scaled_threshold_t);
+ free_number (((math_data *)mp->math)->half_scaled_threshold_t);
+ free_number (((math_data *)mp->math)->near_zero_angle_t);
+ free_number (((math_data *)mp->math)->p_over_v_threshold_t);
+ free_number (((math_data *)mp->math)->equation_threshold_t);
+ free_number (((math_data *)mp->math)->tfm_warn_threshold_t);
+ free_binary_constants();
+ free(mp->math);
+}
+
+@ Creating an destroying |mp_number| objects
+
+@ @c
+void mp_new_number (MP mp, mp_number *n, mp_number_type t) {
+ (void)mp;
+ n->data.num = mp_xmalloc(mp,1,sizeof(mpfr_t));
+ mpfr_init2 ((mpfr_ptr)(n->data.num), precision_bits);
+ mpfr_set_zero((mpfr_ptr)(n->data.num),1); /* 1 == positive */
+ n->type = t;
+}
+
+@
+
+@c
+void mp_free_number (MP mp, mp_number *n) {
+ (void)mp;
+ if (n->data.num) {
+ mpfr_clear (n->data.num);
+ n->data.num = NULL;
+ }
+ n->type = mp_nan_type;
+}
+
+@ Here are the low-level functions on |mp_number| items, setters first.
+
+@c
+void mp_set_binary_from_int(mp_number *A, int B) {
+ mpfr_set_si(A->data.num,B, ROUNDING);
+}
+void mp_set_binary_from_boolean(mp_number *A, int B) {
+ mpfr_set_si(A->data.num,B, ROUNDING);
+}
+void mp_set_binary_from_scaled(mp_number *A, int B) {
+ mpfr_set_si(A->data.num, B, ROUNDING);
+ mpfr_div_si(A->data.num, A->data.num, 65536, ROUNDING);
+}
+void mp_set_binary_from_double(mp_number *A, double B) {
+ mpfr_set_d(A->data.num, B, ROUNDING);
+}
+void mp_set_binary_from_addition(mp_number *A, mp_number B, mp_number C) {
+ mpfr_add(A->data.num,B.data.num,C.data.num, ROUNDING);
+}
+void mp_set_binary_from_substraction (mp_number *A, mp_number B, mp_number C) {
+ mpfr_sub(A->data.num,B.data.num,C.data.num, ROUNDING);
+}
+void mp_set_binary_from_div(mp_number *A, mp_number B, mp_number C) {
+ mpfr_div(A->data.num,B.data.num,C.data.num, ROUNDING);
+}
+void mp_set_binary_from_mul(mp_number *A, mp_number B, mp_number C) {
+ mpfr_mul(A->data.num,B.data.num,C.data.num, ROUNDING);
+}
+void mp_set_binary_from_int_div(mp_number *A, mp_number B, int C) {
+ mpfr_div_si(A->data.num,B.data.num,C, ROUNDING);
+}
+void mp_set_binary_from_int_mul(mp_number *A, mp_number B, int C) {
+ mpfr_mul_si(A->data.num,B.data.num, C, ROUNDING);
+}
+void mp_set_binary_from_of_the_way(MP mp, mp_number *A, mp_number t, mp_number B, mp_number C) {
+ mpfr_t c, r1;
+ mpfr_init2(c, precision_bits);
+ mpfr_init2(r1, precision_bits);
+ mpfr_sub (c,B.data.num, C.data.num, ROUNDING);
+ mp_binary_take_fraction(mp, r1, c, t.data.num);
+ mpfr_sub (A->data.num, B.data.num, r1, ROUNDING);
+ mpfr_clear(c);
+ mpfr_clear(r1);
+ mp_check_mpfr_t(mp, A->data.num);
+}
+void mp_number_negate(mp_number *A) {
+ mpfr_neg (A->data.num, A->data.num, ROUNDING);
+ checkZero((mpfr_ptr)A->data.num);
+}
+void mp_number_add(mp_number *A, mp_number B) {
+ mpfr_add (A->data.num,A->data.num,B.data.num, ROUNDING);
+}
+void mp_number_substract(mp_number *A, mp_number B) {
+ mpfr_sub (A->data.num,A->data.num,B.data.num, ROUNDING);
+}
+void mp_number_half(mp_number *A) {
+ mpfr_div_si(A->data.num, A->data.num, 2, ROUNDING);
+}
+void mp_number_halfp(mp_number *A) {
+ mpfr_div_si(A->data.num,A->data.num, 2, ROUNDING);
+}
+void mp_number_double(mp_number *A) {
+ mpfr_mul_si(A->data.num,A->data.num, 2, ROUNDING);
+}
+void mp_number_add_scaled(mp_number *A, int B) { /* also for negative B */
+ mpfr_add_d (A->data.num,A->data.num, B/65536.0, ROUNDING);
+}
+void mp_number_multiply_int(mp_number *A, int B) {
+ mpfr_mul_si(A->data.num,A->data.num, B, ROUNDING);
+}
+void mp_number_divide_int(mp_number *A, int B) {
+ mpfr_div_si(A->data.num,A->data.num, B, ROUNDING);
+}
+void mp_binary_abs(mp_number *A) {
+ mpfr_abs(A->data.num, A->data.num, ROUNDING);
+}
+void mp_number_clone(mp_number *A, mp_number B) {
+ mpfr_prec_round (A->data.num, precision_bits, ROUNDING);
+ mpfr_set(A->data.num, (mpfr_ptr)B.data.num, ROUNDING);
+}
+void mp_number_swap(mp_number *A, mp_number *B) {
+ mpfr_swap(A->data.num, B->data.num);
+}
+void mp_number_fraction_to_scaled (mp_number *A) {
+ A->type = mp_scaled_type;
+ mpfr_div (A->data.num, A->data.num, fraction_multiplier_mpfr_t, ROUNDING);
+}
+void mp_number_angle_to_scaled (mp_number *A) {
+ A->type = mp_scaled_type;
+ mpfr_div (A->data.num, A->data.num, angle_multiplier_mpfr_t, ROUNDING);
+}
+void mp_number_scaled_to_fraction (mp_number *A) {
+ A->type = mp_fraction_type;
+ mpfr_mul (A->data.num, A->data.num, fraction_multiplier_mpfr_t, ROUNDING);
+}
+void mp_number_scaled_to_angle (mp_number *A) {
+ A->type = mp_angle_type;
+ mpfr_mul(A->data.num, A->data.num, angle_multiplier_mpfr_t, ROUNDING);
+}
+
+
+@* Query functions
+
+@ Convert a number to a scaled value. |decNumberToInt32| is not
+able to make this conversion properly, so instead we are using
+|decNumberToDouble| and a typecast. Bad!
+
+@c
+int mp_number_to_scaled(mp_number A) {
+ double v = mpfr_get_d (A.data.num, ROUNDING);
+ return (int)(v * 65536.0);
+}
+
+@
+
+@d odd(A) ((A)%2==1)
+
+@c
+int mp_number_to_int(mp_number A) {
+ int32_t result = 0;
+ if (mpfr_fits_sint_p(A.data.num, ROUNDING)) {
+ result = mpfr_get_si(A.data.num, ROUNDING);
+ }
+ return result;
+}
+int mp_number_to_boolean(mp_number A) {
+ int32_t result = 0;
+ if (mpfr_fits_sint_p(A.data.num, ROUNDING)) {
+ result = mpfr_get_si(A.data.num, ROUNDING);
+ }
+ return (result ? 1 : 0);
+}
+double mp_number_to_double(mp_number A) {
+ double res = 0.0;
+ if (mpfr_number_p (A.data.num)) {
+ res = mpfr_get_d(A.data.num, ROUNDING);
+ }
+ return res;
+}
+int mp_number_odd(mp_number A) {
+ return odd(mp_number_to_int(A));
+}
+int mp_number_equal(mp_number A, mp_number B) {
+ return mpfr_equal_p(A.data.num,B.data.num);
+}
+int mp_number_greater(mp_number A, mp_number B) {
+ return mpfr_greater_p(A.data.num,B.data.num);
+}
+int mp_number_less(mp_number A, mp_number B) {
+ return mpfr_less_p(A.data.num,B.data.num);
+}
+int mp_number_nonequalabs(mp_number A, mp_number B) {
+ return !(mpfr_cmpabs(A.data.num, B.data.num)==0);
+}
+
+@ Fixed-point arithmetic is done on {\sl scaled integers\/} that are multiples
+of $2^{-16}$. In other words, a binary point is assumed to be sixteen bit
+positions from the right end of a binary computer word.
+
+@ One of \MP's most common operations is the calculation of
+$\lfloor{a+b\over2}\rfloor$,
+the midpoint of two given integers |a| and~|b|. The most decent way to do
+this is to write `|(a+b)/2|'; but on many machines it is more efficient
+to calculate `|(a+b)>>1|'.
+
+Therefore the midpoint operation will always be denoted by `|half(a+b)|'
+in this program. If \MP\ is being implemented with languages that permit
+binary shifting, the |half| macro should be changed to make this operation
+as efficient as possible. Since some systems have shift operators that can
+only be trusted to work on positive numbers, there is also a macro |halfp|
+that is used only when the quantity being halved is known to be positive
+or zero.
+
+@ Here is a procedure analogous to |print_int|. The current version
+is fairly stupid, and it is not round-trip safe, but this is good
+enough for a beta test.
+
+@c
+char * mp_binnumber_tostring (mpfr_t n) {
+ char *str = NULL, *buffer = NULL;
+ mpfr_exp_t exp = 0;
+ int neg = 0;
+ if ((str = mpfr_get_str (NULL, &exp, 10, 0, n, ROUNDING))>0) {
+ int numprecdigits = precision_bits_to_digits(precision_bits);
+ if (*str == '-') {
+ neg = 1;
+ }
+ while (strlen(str)>0 && *(str+strlen(str)-1) == '0' ) {
+ *(str+strlen(str)-1) = '\0'; /* get rid of trailing zeroes */
+ }
+ buffer = malloc(strlen(str)+13+numprecdigits+1);
+ /* the buffer should also fit at least strlen("E+%d", exp) or (numprecdigits-2) worth of zeroes,
+ * because with numprecdigits == 33, the str for "1E32" will be "1", and needing 32 extra zeroes,
+ * and the decimal dot. To avoid miscalculations by myself, it is safer to add these
+ * three together.
+ */
+ if (buffer) {
+ int i = 0, j = 0;
+ if (neg) {
+ buffer[i++] = '-';
+ j = 1;
+ }
+ if (strlen(str+j) == 0) {
+ buffer[i++] = '0';
+ } else {
+ /* non-zero */
+ if (exp<=numprecdigits && exp > -6) {
+ if (exp>0) {
+ buffer[i++] = str[j++];
+ while (--exp>0) {
+ buffer[i++] = (str[j] ? str[j++] : '0');
+ }
+ if (str[j]) {
+ buffer[i++] = '.';
+ while (str[j]) {
+ buffer[i++] = str[j++];
+ }
+ }
+ } else {
+ int absexp;
+ buffer[i++] = '0';
+ buffer[i++] = '.';
+ absexp = -exp;
+ while (absexp-- > 0) {
+ buffer[i++] = '0';
+ }
+ while (str[j]) {
+ buffer[i++] = str[j++];
+ }
+ }
+ } else {
+ buffer[i++] = str[j++];
+ if (str[j]) {
+ buffer[i++] = '.';
+ while (str[j]) {
+ buffer[i++] = str[j++];
+ }
+ }
+ {
+ char msg[256];
+ int k = 0;
+ mp_snprintf (msg, 256, "%s%d", (exp>0?"+":""), (int)(exp>0 ? (exp-1) : (exp-1)));
+ buffer[i++] = 'E';
+ while (msg[k]) {
+ buffer[i++] = msg[k++];
+ }
+ }
+ }
+ }
+ buffer[i++] = '\0';
+ }
+ mpfr_free_str(str);
+ }
+ return buffer;
+}
+char * mp_binary_number_tostring (MP mp, mp_number n) {
+ return mp_binnumber_tostring(n.data.num);
+}
+
+
+@ @c
+void mp_binary_print_number (MP mp, mp_number n) {
+ char *str = mp_binary_number_tostring(mp, n);
+ mp_print (mp, str);
+ free (str);
+}
+
+
+
+
+@ Addition is not always checked to make sure that it doesn't overflow,
+but in places where overflow isn't too unlikely the |slow_add| routine
+is used.
+
+@c
+void mp_binary_slow_add (MP mp, mp_number *ret, mp_number A, mp_number B) {
+ mpfr_add(ret->data.num,A.data.num,B.data.num, ROUNDING);
+}
+
+@ The |make_fraction| routine produces the |fraction| equivalent of
+|p/q|, given integers |p| and~|q|; it computes the integer
+$f=\lfloor2^{28}p/q+{1\over2}\rfloor$, when $p$ and $q$ are
+positive. If |p| and |q| are both of the same scaled type |t|,
+the ``type relation'' |make_fraction(t,t)=fraction| is valid;
+and it's also possible to use the subroutine ``backwards,'' using
+the relation |make_fraction(t,fraction)=t| between scaled types.
+
+If the result would have magnitude $2^{31}$ or more, |make_fraction|
+sets |arith_error:=true|. Most of \MP's internal computations have
+been designed to avoid this sort of error.
+
+If this subroutine were programmed in assembly language on a typical
+machine, we could simply compute |(@t$2^{28}$@>*p)div q|, since a
+double-precision product can often be input to a fixed-point division
+instruction. But when we are restricted to int-eger arithmetic it
+is necessary either to resort to multiple-precision maneuvering
+or to use a simple but slow iteration. The multiple-precision technique
+would be about three times faster than the code adopted here, but it
+would be comparatively long and tricky, involving about sixteen
+additional multiplications and divisions.
+
+This operation is part of \MP's ``inner loop''; indeed, it will
+consume nearly 10\pct! of the running time (exclusive of input and output)
+if the code below is left unchanged. A machine-dependent recoding
+will therefore make \MP\ run faster. The present implementation
+is highly portable, but slow; it avoids multiplication and division
+except in the initial stage. System wizards should be careful to
+replace it with a routine that is guaranteed to produce identical
+results in all cases.
+@^system dependencies@>
+
+As noted below, a few more routines should also be replaced by machine-dependent
+code, for efficiency. But when a procedure is not part of the ``inner loop,''
+such changes aren't advisable; simplicity and robustness are
+preferable to trickery, unless the cost is too high.
+@^inner loop@>
+
+@c
+void mp_binary_make_fraction (MP mp, mpfr_t ret, mpfr_t p, mpfr_t q) {
+ mpfr_div (ret, p, q, ROUNDING);
+ mp_check_mpfr_t(mp, ret);
+ mpfr_mul (ret, ret, fraction_multiplier_mpfr_t, ROUNDING);
+}
+void mp_binary_number_make_fraction (MP mp, mp_number *ret, mp_number p, mp_number q) {
+ mp_binary_make_fraction (mp, ret->data.num, p.data.num, q.data.num);
+}
+
+@ @<Declarations@>=
+void mp_binary_make_fraction (MP mp, mpfr_t ret, mpfr_t p, mpfr_t q);
+
+@ The dual of |make_fraction| is |take_fraction|, which multiplies a
+given integer~|q| by a fraction~|f|. When the operands are positive, it
+computes $p=\lfloor qf/2^{28}+{1\over2}\rfloor$, a symmetric function
+of |q| and~|f|.
+
+This routine is even more ``inner loopy'' than |make_fraction|;
+the present implementation consumes almost 20\pct! of \MP's computation
+time during typical jobs, so a machine-language substitute is advisable.
+@^inner loop@> @^system dependencies@>
+
+@c
+void mp_binary_take_fraction (MP mp, mpfr_t ret, mpfr_t p, mpfr_t q) {
+ mpfr_mul(ret, p, q, ROUNDING);
+ mpfr_div(ret, ret, fraction_multiplier_mpfr_t, ROUNDING);
+}
+void mp_binary_number_take_fraction (MP mp, mp_number *ret, mp_number p, mp_number q) {
+ mp_binary_take_fraction (mp, ret->data.num, p.data.num, q.data.num);
+}
+
+@ @<Declarations@>=
+void mp_binary_take_fraction (MP mp, mpfr_t ret, mpfr_t p, mpfr_t q);
+
+@ When we want to multiply something by a |scaled| quantity, we use a scheme
+analogous to |take_fraction| but with a different scaling.
+Given positive operands, |take_scaled|
+computes the quantity $p=\lfloor qf/2^{16}+{1\over2}\rfloor$.
+
+Once again it is a good idea to use a machine-language replacement if
+possible; otherwise |take_scaled| will use more than 2\pct! of the running time
+when the Computer Modern fonts are being generated.
+@^inner loop@>
+
+@c
+void mp_binary_number_take_scaled (MP mp, mp_number *ret, mp_number p_orig, mp_number q_orig) {
+ mpfr_mul(ret->data.num, p_orig.data.num, q_orig.data.num, ROUNDING);
+}
+
+
+@ For completeness, there's also |make_scaled|, which computes a
+quotient as a |scaled| number instead of as a |fraction|.
+In other words, the result is $\lfloor2^{16}p/q+{1\over2}\rfloor$, if the
+operands are positive. \ (This procedure is not used especially often,
+so it is not part of \MP's inner loop.)
+
+@c
+void mp_binary_number_make_scaled (MP mp, mp_number *ret, mp_number p_orig, mp_number q_orig) {
+ mpfr_div(ret->data.num, p_orig.data.num, q_orig.data.num, ROUNDING);
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+@
+@d halfp(A) (integer)((unsigned)(A) >> 1)
+
+@* Scanning numbers in the input
+
+The definitions below are temporarily here
+
+@d set_cur_cmd(A) mp->cur_mod_->type=(A)
+@d set_cur_mod(A) mpfr_set((mpfr_ptr)(mp->cur_mod_->data.n.data.num),A, ROUNDING)
+
+@<Declarations...@>=
+static void mp_wrapup_numeric_token(MP mp, unsigned char *start, unsigned char *stop);
+
+@ Precision check is TODO
+@d too_precise(a) 0
+@c
+void mp_wrapup_numeric_token(MP mp, unsigned char *start, unsigned char *stop) {
+ int invalid = 0;
+ mpfr_t result;
+ size_t l = stop-start+1;
+ char *buf = mp_xmalloc(mp, l+1, 1);
+ buf[l] = '\0';
+ mpfr_init2(result, precision_bits);
+ (void)strncpy(buf,(const char *)start, l);
+ invalid = mpfr_set_str(result,buf, 10, ROUNDING);
+ //fprintf(stdout,"scan of [%s] produced %s, ", buf, mp_binnumber_tostring(result));
+ free(buf);
+ if (invalid == 0) {
+ set_cur_mod(result);
+ // fprintf(stdout,"mod=%s\n", mp_binary_number_tostring(mp,mp->cur_mod_->data.n));
+ if (too_precise(l)) {
+ if (mpfr_positive_p((mpfr_ptr)(internal_value (mp_warning_check).data.num)) &&
+ (mp->scanner_status != tex_flushing)) {
+ char msg[256];
+ const char *hlp[] = {"Continue and I'll try to cope",
+ "with that big value; but it might be dangerous.",
+ "(Set warningcheck:=0 to suppress this message.)",
+ NULL };
+ mp_snprintf (msg, 256, "Number is too large (%s)", mp_binary_number_tostring(mp,mp->cur_mod_->data.n));
+@.Number is too large@>;
+ mp_error (mp, msg, hlp, true);
+ }
+ }
+ } else if (mp->scanner_status != tex_flushing) {
+ const char *hlp[] = {"I could not handle this number specification",
+ "probably because it is out of range. Error:",
+ "",
+ NULL };
+ hlp[2] = strerror(errno);
+ mp_error (mp, "Enormous number has been reduced.", hlp, false);
+@.Enormous number...@>;
+ set_cur_mod((mpfr_ptr)(((math_data *)(mp->math))->inf_t.data.num));
+ }
+ set_cur_cmd((mp_variable_type)mp_numeric_token);
+ mpfr_clear(result);
+}
+
+@ @c
+static void find_exponent (MP mp) {
+ if (mp->buffer[mp->cur_input.loc_field] == 'e' ||
+ mp->buffer[mp->cur_input.loc_field] == 'E') {
+ mp->cur_input.loc_field++;
+ if (!(mp->buffer[mp->cur_input.loc_field] == '+' ||
+ mp->buffer[mp->cur_input.loc_field] == '-' ||
+ mp->char_class[mp->buffer[mp->cur_input.loc_field]] == digit_class)) {
+ mp->cur_input.loc_field--;
+ return;
+ }
+ if (mp->buffer[mp->cur_input.loc_field] == '+' ||
+ mp->buffer[mp->cur_input.loc_field] == '-') {
+ mp->cur_input.loc_field++;
+ }
+ while (mp->char_class[mp->buffer[mp->cur_input.loc_field]] == digit_class) {
+ mp->cur_input.loc_field++;
+ }
+ }
+}
+void mp_binary_scan_fractional_token (MP mp, int n) { /* n: scaled */
+ unsigned char *start = &mp->buffer[mp->cur_input.loc_field -1];
+ unsigned char *stop;
+ while (mp->char_class[mp->buffer[mp->cur_input.loc_field]] == digit_class) {
+ mp->cur_input.loc_field++;
+ }
+ find_exponent(mp);
+ stop = &mp->buffer[mp->cur_input.loc_field-1];
+ mp_wrapup_numeric_token (mp, start, stop);
+}
+
+
+@ We just have to collect bytes.
+
+@c
+void mp_binary_scan_numeric_token (MP mp, int n) { /* n: scaled */
+ unsigned char *start = &mp->buffer[mp->cur_input.loc_field -1];
+ unsigned char *stop;
+ while (mp->char_class[mp->buffer[mp->cur_input.loc_field]] == digit_class) {
+ mp->cur_input.loc_field++;
+ }
+ if (mp->buffer[mp->cur_input.loc_field] == '.' &&
+ mp->buffer[mp->cur_input.loc_field+1] != '.') {
+ mp->cur_input.loc_field++;
+ while (mp->char_class[mp->buffer[mp->cur_input.loc_field]] == digit_class) {
+ mp->cur_input.loc_field++;
+ }
+ }
+ find_exponent(mp);
+ stop = &mp->buffer[mp->cur_input.loc_field-1];
+ mp_wrapup_numeric_token (mp, start, stop);
+}
+
+@ The |scaled| quantities in \MP\ programs are generally supposed to be
+less than $2^{12}$ in absolute value, so \MP\ does much of its internal
+arithmetic with 28~significant bits of precision. A |fraction| denotes
+a scaled integer whose binary point is assumed to be 28 bit positions
+from the right.
+
+@d fraction_half (fraction_multiplier/2)
+@d fraction_one (1*fraction_multiplier)
+@d fraction_two (2*fraction_multiplier)
+@d fraction_three (3*fraction_multiplier)
+@d fraction_four (4*fraction_multiplier)
+
+@ Here is a typical example of how the routines above can be used.
+It computes the function
+$${1\over3\tau}f(\theta,\phi)=
+{\tau^{-1}\bigl(2+\sqrt2\,(\sin\theta-{1\over16}\sin\phi)
+ (\sin\phi-{1\over16}\sin\theta)(\cos\theta-\cos\phi)\bigr)\over
+3\,\bigl(1+{1\over2}(\sqrt5-1)\cos\theta+{1\over2}(3-\sqrt5\,)\cos\phi\bigr)},$$
+where $\tau$ is a |scaled| ``tension'' parameter. This is \MP's magic
+fudge factor for placing the first control point of a curve that starts
+at an angle $\theta$ and ends at an angle $\phi$ from the straight path.
+(Actually, if the stated quantity exceeds 4, \MP\ reduces it to~4.)
+
+The trigonometric quantity to be multiplied by $\sqrt2$ is less than $\sqrt2$.
+(It's a sum of eight terms whose absolute values can be bounded using
+relations such as $\sin\theta\cos\theta\L{1\over2}$.) Thus the numerator
+is positive; and since the tension $\tau$ is constrained to be at least
+$3\over4$, the numerator is less than $16\over3$. The denominator is
+nonnegative and at most~6.
+
+The angles $\theta$ and $\phi$ are given implicitly in terms of |fraction|
+arguments |st|, |ct|, |sf|, and |cf|, representing $\sin\theta$, $\cos\theta$,
+$\sin\phi$, and $\cos\phi$, respectively.
+
+@c
+void mp_binary_velocity (MP mp, mp_number *ret, mp_number st, mp_number ct, mp_number sf,
+ mp_number cf, mp_number t) {
+ mpfr_t acc, num, denom; /* registers for intermediate calculations */
+ mpfr_t r1, r2;
+ mpfr_t arg1, arg2;
+ mpfr_t i16, fone, fhalf, ftwo, sqrtfive;
+ mpfr_inits2 (precision_bits, acc, num, denom, r1, r2, arg1, arg2, i16, fone, fhalf, ftwo, sqrtfive, (mpfr_ptr)0);
+ mpfr_set_si(i16, 16, ROUNDING);
+ mpfr_set_si(fone, fraction_one, ROUNDING);
+ mpfr_set_si(fhalf, fraction_half, ROUNDING);
+ mpfr_set_si(ftwo, fraction_two, ROUNDING);
+ mpfr_set_si(sqrtfive, 5, ROUNDING);
+ mpfr_sqrt (sqrtfive, sqrtfive, ROUNDING);
+ mpfr_div (arg1,sf.data.num, i16, ROUNDING); // arg1 = sf / 16
+ mpfr_sub (arg1,st.data.num, arg1, ROUNDING); // arg1 = st - arg1
+ mpfr_div (arg2,st.data.num, i16, ROUNDING); // arg2 = st / 16
+ mpfr_sub (arg2,sf.data.num, arg2, ROUNDING); // arg2 = sf - arg2
+ mp_binary_take_fraction (mp, acc, arg1, arg2); // acc = (arg1 * arg2) / fmul
+
+ mpfr_set (arg1, acc, ROUNDING);
+ mpfr_sub (arg2, ct.data.num, cf.data.num, ROUNDING); // arg2 = ct - cf
+ mp_binary_take_fraction (mp, acc, arg1, arg2); // acc = (arg1 * arg2 ) / fmul
+
+ mpfr_sqrt(arg1, two_mpfr_t, ROUNDING); // arg1 = sqrt(2)
+ mpfr_mul(arg1, arg1, fone, ROUNDING); // arg1 = arg1 * fmul
+ mp_binary_take_fraction (mp, r1, acc, arg1); // r1 = (acc * arg1) / fmul
+ mpfr_add(num, ftwo, r1, ROUNDING); // num = ftwo + r1
+
+ mpfr_sub(arg1,sqrtfive, one, ROUNDING); // arg1 = sqrt(5) - 1
+ mpfr_mul(arg1,arg1,fhalf, ROUNDING); // arg1 = arg1 * fmul/2
+ mpfr_mul(arg1,arg1,three_mpfr_t, ROUNDING); // arg1 = arg1 * 3
+
+ mpfr_sub(arg2,three_mpfr_t, sqrtfive, ROUNDING); // arg2 = 3 - sqrt(5)
+ mpfr_mul(arg2,arg2,fhalf, ROUNDING); // arg2 = arg2 * fmul/2
+ mpfr_mul(arg2,arg2,three_mpfr_t, ROUNDING); // arg2 = arg2 * 3
+ mp_binary_take_fraction (mp, r1, ct.data.num, arg1) ; // r1 = (ct * arg1) / fmul
+ mp_binary_take_fraction (mp, r2, cf.data.num, arg2); // r2 = (cf * arg2) / fmul
+
+ mpfr_set_si(denom, fraction_three, ROUNDING); // denom = 3fmul
+ mpfr_add(denom, denom, r1, ROUNDING); // denom = denom + r1
+ mpfr_add(denom, denom, r2, ROUNDING); // denom = denom + r2
+
+ if (!mpfr_equal_p(t.data.num, one)) { // t != 1
+ mpfr_div(num, num, t.data.num, ROUNDING); // num = num / t
+ }
+ mpfr_set(r2, num, ROUNDING); // r2 = num / 4
+ mpfr_div(r2, r2, four_mpfr_t, ROUNDING);
+ if (mpfr_less_p(denom,r2)) { // num/4 >= denom => denom < num/4
+ mpfr_set_si(ret->data.num,fraction_four, ROUNDING);
+ } else {
+ mp_binary_make_fraction (mp, ret->data.num, num, denom);
+ }
+ mpfr_clears (acc, num, denom, r1, r2, arg1, arg2, i16, fone, fhalf, ftwo, sqrtfive, (mpfr_ptr)0);
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+
+@ The following somewhat different subroutine tests rigorously if $ab$ is
+greater than, equal to, or less than~$cd$,
+given integers $(a,b,c,d)$. In most cases a quick decision is reached.
+The result is $+1$, 0, or~$-1$ in the three respective cases.
+
+@c
+void mp_ab_vs_cd (MP mp, mp_number *ret, mp_number a_orig, mp_number b_orig, mp_number c_orig, mp_number d_orig) {
+ mpfr_t q, r, test; /* temporary registers */
+ mpfr_t a, b, c, d;
+ int cmp = 0;
+ (void)mp;
+ mpfr_inits2(precision_bits, q,r,test,a,b,c,d,(mpfr_ptr)0);
+ mpfr_set(a, (mpfr_ptr)a_orig.data.num, ROUNDING);
+ mpfr_set(b, (mpfr_ptr )b_orig.data.num, ROUNDING);
+ mpfr_set(c, (mpfr_ptr )c_orig.data.num, ROUNDING);
+ mpfr_set(d, (mpfr_ptr )d_orig.data.num, ROUNDING);
+ @<Reduce to the case that |a,c>=0|, |b,d>0|@>;
+ while (1) {
+ mpfr_div(q,a,d, ROUNDING);
+ mpfr_div(r,c,b, ROUNDING);
+ cmp = mpfr_cmp(q,r);
+ if (cmp) {
+ if (cmp>1) {
+ mpfr_set(ret->data.num, one, ROUNDING);
+ } else {
+ mpfr_set(ret->data.num, minusone, ROUNDING);
+ }
+ goto RETURN;
+ }
+ mpfr_remainder(q,a,d, ROUNDING);
+ mpfr_remainder(r,c,b, ROUNDING);
+ if (mpfr_zero_p(r)) {
+ if (mpfr_zero_p(q)) {
+ mpfr_set(ret->data.num, zero, ROUNDING);
+ } else {
+ mpfr_set(ret->data.num, one, ROUNDING);
+ }
+ goto RETURN;
+ }
+ if (mpfr_zero_p(q)) {
+ mpfr_set(ret->data.num, minusone, ROUNDING);
+ goto RETURN;
+ }
+ mpfr_set(a,b, ROUNDING);
+ mpfr_set(b,q, ROUNDING);
+ mpfr_set(c,d, ROUNDING);
+ mpfr_set(d,r, ROUNDING);
+ } /* now |a>d>0| and |c>b>0| */
+RETURN:
+#if DEBUG
+ fprintf(stdout, "\n%f = ab_vs_cd(%f,%f,%f,%f)", mp_number_to_double(*ret),
+mp_number_to_double(a_orig),mp_number_to_double(b_orig),
+mp_number_to_double(c_orig),mp_number_to_double(d_orig));
+#endif
+ mp_check_mpfr_t(mp, ret->data.num);
+ mpfr_clears(q,r,test,a,b,c,d,(mpfr_ptr)0);
+ return;
+}
+
+
+@ @<Reduce to the case that |a...@>=
+if (mpfr_negative_p(a)) {
+ mpfr_neg(a, a, ROUNDING);
+ mpfr_neg(b, b, ROUNDING);
+}
+if (mpfr_negative_p(c)) {
+ mpfr_neg(c, c, ROUNDING);
+ mpfr_neg(d, d, ROUNDING);
+}
+if (!mpfr_positive_p(d)) {
+ if (!mpfr_negative_p(b)) {
+ if ((mpfr_zero_p(a) || mpfr_zero_p(b)) && (mpfr_zero_p(c) || mpfr_zero_p(d)))
+ mpfr_set(ret->data.num, zero, ROUNDING);
+ else
+ mpfr_set(ret->data.num, one, ROUNDING);
+ goto RETURN;
+ }
+ if (mpfr_zero_p(d)) {
+ if (mpfr_zero_p(a))
+ mpfr_set(ret->data.num, zero, ROUNDING);
+ else
+ mpfr_set(ret->data.num, minusone, ROUNDING);
+ goto RETURN;
+ }
+ mpfr_set(q, a, ROUNDING);
+ mpfr_set(a, c, ROUNDING);
+ mpfr_set(c, q, ROUNDING);
+ mpfr_neg(q, b, ROUNDING);
+ mpfr_neg(b, d, ROUNDING);
+ mpfr_set(d, q, ROUNDING);
+} else if (!mpfr_positive_p(b)) {
+ if (mpfr_negative_p(b) && mpfr_positive_p(a)) {
+ mpfr_set(ret->data.num, minusone, ROUNDING);
+ goto RETURN;
+ }
+ if (mpfr_zero_p(c))
+ mpfr_set(ret->data.num, zero, ROUNDING);
+ else
+ mpfr_set(ret->data.num, minusone, ROUNDING);
+ goto RETURN;
+}
+
+@ Now here's a subroutine that's handy for all sorts of path computations:
+Given a quadratic polynomial $B(a,b,c;t)$, the |crossing_point| function
+returns the unique |fraction| value |t| between 0 and~1 at which
+$B(a,b,c;t)$ changes from positive to negative, or returns
+|t=fraction_one+1| if no such value exists. If |a<0| (so that $B(a,b,c;t)$
+is already negative at |t=0|), |crossing_point| returns the value zero.
+
+The general bisection method is quite simple when $n=2$, hence
+|crossing_point| does not take much time. At each stage in the
+recursion we have a subinterval defined by |l| and~|j| such that
+$B(a,b,c;2^{-l}(j+t))=B(x_0,x_1,x_2;t)$, and we want to ``zero in'' on
+the subinterval where $x_0\G0$ and $\min(x_1,x_2)<0$.
+
+It is convenient for purposes of calculation to combine the values
+of |l| and~|j| in a single variable $d=2^l+j$, because the operation
+of bisection then corresponds simply to doubling $d$ and possibly
+adding~1. Furthermore it proves to be convenient to modify
+our previous conventions for bisection slightly, maintaining the
+variables $X_0=2^lx_0$, $X_1=2^l(x_0-x_1)$, and $X_2=2^l(x_1-x_2)$.
+With these variables the conditions $x_0\ge0$ and $\min(x_1,x_2)<0$ are
+equivalent to $\max(X_1,X_1+X_2)>X_0\ge0$.
+
+The following code maintains the invariant relations
+$0\L|x0|<\max(|x1|,|x1|+|x2|)$,
+$\vert|x1|\vert<2^{30}$, $\vert|x2|\vert<2^{30}$;
+it has been constructed in such a way that no arithmetic overflow
+will occur if the inputs satisfy
+$a<2^{30}$, $\vert a-b\vert<2^{30}$, and $\vert b-c\vert<2^{30}$.
+
+@d no_crossing { mpfr_set(ret->data.num, fraction_one_plus_mpfr_t, ROUNDING); goto RETURN; }
+@d one_crossing { mpfr_set(ret->data.num, fraction_one_mpfr_t, ROUNDING); goto RETURN; }
+@d zero_crossing { mpfr_set(ret->data.num, zero, ROUNDING); goto RETURN; }
+
+@c
+static void mp_binary_crossing_point (MP mp, mp_number *ret, mp_number aa, mp_number bb, mp_number cc) {
+ mpfr_t a,b,c;
+ double d; /* recursive counter */
+ mpfr_t x, xx, x0, x1, x2; /* temporary registers for bisection */
+ mpfr_t scratch;
+ mpfr_inits2 (precision_bits, a,b,c, x,xx,x0,x1,x2, scratch,(mpfr_ptr)0);
+ mpfr_set(a, (mpfr_ptr )aa.data.num, ROUNDING);
+ mpfr_set(b, (mpfr_ptr )bb.data.num, ROUNDING);
+ mpfr_set(c, (mpfr_ptr )cc.data.num, ROUNDING);
+ if (mpfr_negative_p(a))
+ zero_crossing;
+ if (!mpfr_negative_p(c)) {
+ if (!mpfr_negative_p(b)) {
+ if (mpfr_positive_p(c)) {
+ no_crossing;
+ } else if (mpfr_zero_p(a) && mpfr_zero_p(b)) {
+ no_crossing;
+ } else {
+ one_crossing;
+ }
+ }
+ if (mpfr_zero_p(a))
+ zero_crossing;
+ } else if (mpfr_zero_p(a)) {
+ if (!mpfr_positive_p(b))
+ zero_crossing;
+ }
+
+ /* Use bisection to find the crossing point... */
+ d = epsilonf;
+ mpfr_set(x0, a, ROUNDING);
+ mpfr_sub(x1,a, b, ROUNDING);
+ mpfr_sub(x2,b, c, ROUNDING);
+ do {
+ /* not sure why the error correction has to be >= 1E-12 */
+ mpfr_add(x, x1, x2, ROUNDING);
+ mpfr_div(x, x, two_mpfr_t, ROUNDING);
+ mpfr_add_d (x, x, 1E-12, ROUNDING);
+ mpfr_sub(scratch, x1, x0, ROUNDING);
+ if (mpfr_greater_p(scratch, x0)) {
+ mpfr_set(x2, x, ROUNDING);
+ mpfr_add(x0, x0, x0, ROUNDING);
+ d += d;
+ } else {
+ mpfr_add(xx, scratch, x, ROUNDING);
+ if (mpfr_greater_p(xx,x0)) {
+ mpfr_set(x2,x, ROUNDING);
+ mpfr_add(x0, x0, x0, ROUNDING);
+ d += d;
+ } else {
+ mpfr_sub(x0, x0, xx, ROUNDING);
+ if (!mpfr_greater_p(x,x0)) {
+ mpfr_add(scratch, x, x2, ROUNDING);
+ if (!mpfr_greater_p(scratch, x0))
+ no_crossing;
+ }
+ mpfr_set(x1,x, ROUNDING);
+ d = d + d + epsilonf;
+ }
+ }
+ } while (d < fraction_one);
+ mpfr_set_d(scratch, d, ROUNDING);
+ mpfr_sub(ret->data.num,scratch, fraction_one_mpfr_t, ROUNDING);
+RETURN:
+#if DEBUG
+ fprintf(stdout, "\n%f = crossing_point(%f,%f,%f)", mp_number_to_double(*ret),
+mp_number_to_double(aa),mp_number_to_double(bb),mp_number_to_double(cc));
+#endif
+ mpfr_clears (a,b,c, x,xx,x0,x1,x2, scratch, (mpfr_ptr)0);
+ mp_check_mpfr_t(mp, ret->data.num);
+ return;
+}
+
+
+@ We conclude this set of elementary routines with some simple rounding
+and truncation operations.
+
+
+@ |round_unscaled| rounds a |scaled| and converts it to |int|
+@c
+int mp_round_unscaled(mp_number x_orig) {
+ double xx = mp_number_to_double(x_orig);
+ int x = (int)ROUND(xx);
+ return x;
+}
+
+@ |number_floor| floors a number
+
+@c
+void mp_number_floor (mp_number *i) {
+ mpfr_rint_floor(i->data.num, i->data.num, MPFR_RNDD);
+}
+
+@ |fraction_to_scaled| rounds a |fraction| and converts it to |scaled|
+@c
+void mp_binary_fraction_to_round_scaled (mp_number *x_orig) {
+ x_orig->type = mp_scaled_type;
+ mpfr_div(x_orig->data.num, x_orig->data.num, fraction_multiplier_mpfr_t, ROUNDING);
+}
+
+
+
+@* Algebraic and transcendental functions.
+\MP\ computes all of the necessary special functions from scratch, without
+relying on |real| arithmetic or system subroutines for sines, cosines, etc.
+
+@
+
+@c
+void mp_binary_square_rt (MP mp, mp_number *ret, mp_number x_orig) { /* return, x: scaled */
+ if (!mpfr_positive_p((mpfr_ptr)x_orig.data.num)) {
+ @<Handle square root of zero or negative argument@>;
+ } else {
+ mpfr_sqrt(ret->data.num, x_orig.data.num, ROUNDING);
+ }
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+
+@ @<Handle square root of zero...@>=
+{
+ if (mpfr_negative_p((mpfr_ptr)x_orig.data.num)) {
+ char msg[256];
+ const char *hlp[] = {
+ "Since I don't take square roots of negative numbers,",
+ "I'm zeroing this one. Proceed, with fingers crossed.",
+ NULL };
+ char *xstr = mp_binary_number_tostring (mp, x_orig);
+ mp_snprintf(msg, 256, "Square root of %s has been replaced by 0", xstr);
+ free(xstr);
+@.Square root...replaced by 0@>;
+ mp_error (mp, msg, hlp, true);
+ }
+ mpfr_set_zero(ret->data.num,1); /* 1 == positive */
+ return;
+}
+
+
+@ Pythagorean addition $\psqrt{a^2+b^2}$ is implemented by a quick hack
+
+@c
+void mp_binary_pyth_add (MP mp, mp_number *ret, mp_number a_orig, mp_number b_orig) {
+ mpfr_t a, b, asq, bsq;
+ mpfr_inits2(precision_bits, a,b, asq, bsq, (mpfr_ptr)0);
+ mpfr_set(a, (mpfr_ptr)a_orig.data.num, ROUNDING);
+ mpfr_set(b, (mpfr_ptr)b_orig.data.num, ROUNDING);
+ mpfr_mul(asq, a, a, ROUNDING);
+ mpfr_mul(bsq, b, b, ROUNDING);
+ mpfr_add(a, asq, bsq, ROUNDING);
+ mpfr_sqrt(ret->data.num, a, ROUNDING);
+ mp_check_mpfr_t(mp, ret->data.num);
+ mpfr_clears(a,b, asq, bsq, (mpfr_ptr)0);
+}
+
+@ Here is a similar algorithm for $\psqrt{a^2-b^2}$. Same quick hack, also.
+
+@c
+void mp_binary_pyth_sub (MP mp, mp_number *ret, mp_number a_orig, mp_number b_orig) {
+ mpfr_t a, b, asq, bsq;
+ mpfr_inits2(precision_bits, a,b, asq, bsq, (mpfr_ptr)0);
+ mpfr_set(a, (mpfr_ptr)a_orig.data.num, ROUNDING);
+ mpfr_set(b, (mpfr_ptr)b_orig.data.num, ROUNDING);
+ if (!mpfr_greater_p(a,b)) {
+ @<Handle erroneous |pyth_sub| and set |a:=0|@>;
+ } else {
+ mpfr_mul(asq, a, a, ROUNDING);
+ mpfr_mul(bsq, b, b, ROUNDING);
+ mpfr_sub(a, asq, bsq, ROUNDING);
+ mpfr_sqrt(a, a, ROUNDING);
+ }
+ mpfr_set(ret->data.num, a, ROUNDING);
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+
+@ @<Handle erroneous |pyth_sub| and set |a:=0|@>=
+{
+ if (mpfr_less_p(a, b)) {
+ char msg[256];
+ const char *hlp[] = {
+ "Since I don't take square roots of negative numbers,",
+ "I'm zeroing this one. Proceed, with fingers crossed.",
+ NULL };
+ char *astr = mp_binary_number_tostring (mp, a_orig);
+ char *bstr = mp_binary_number_tostring (mp, b_orig);
+ mp_snprintf (msg, 256, "Pythagorean subtraction %s+-+%s has been replaced by 0", astr, bstr);
+ free(astr);
+ free(bstr);
+@.Pythagorean...@>;
+ mp_error (mp, msg, hlp, true);
+ }
+ mpfr_set_zero(a,1); /* 1 == positive */
+}
+
+
+@ Here is the routine that calculates $2^8$ times the natural logarithm
+of a |scaled| quantity;
+
+@c
+void mp_binary_m_log (MP mp, mp_number *ret, mp_number x_orig) {
+ if (!mpfr_positive_p((mpfr_ptr)x_orig.data.num)) {
+ @<Handle non-positive logarithm@>;
+ } else {
+ mpfr_log(ret->data.num, x_orig.data.num, ROUNDING);
+ mp_check_mpfr_t(mp, ret->data.num);
+ mpfr_mul_si(ret->data.num, ret->data.num, 256, ROUNDING);
+ }
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+@ @<Handle non-positive logarithm@>=
+{
+ char msg[256];
+ const char *hlp[] = {
+ "Since I don't take logs of non-positive numbers,",
+ "I'm zeroing this one. Proceed, with fingers crossed.",
+ NULL };
+ char *xstr = mp_binary_number_tostring (mp, x_orig);
+ mp_snprintf (msg, 256, "Logarithm of %s has been replaced by 0", xstr);
+ free (xstr);
+@.Logarithm...replaced by 0@>;
+ mp_error (mp, msg, hlp, true);
+ mpfr_set_zero(ret->data.num,1); /* 1 == positive */
+}
+
+
+@ Conversely, the exponential routine calculates $\exp(x/2^8)$,
+when |x| is |scaled|.
+
+@c
+void mp_binary_m_exp (MP mp, mp_number *ret, mp_number x_orig) {
+ mpfr_t temp;
+ mpfr_init2(temp, precision_bits);
+ mpfr_div_si(temp, x_orig.data.num, 256, ROUNDING);
+ mpfr_exp(ret->data.num, temp, ROUNDING);
+ mp_check_mpfr_t(mp, ret->data.num);
+ mpfr_clear (temp);
+}
+
+
+@ Given integers |x| and |y|, not both zero, the |n_arg| function
+returns the |angle| whose tangent points in the direction $(x,y)$.
+
+@c
+void mp_binary_n_arg (MP mp, mp_number *ret, mp_number x_orig, mp_number y_orig) {
+ if (mpfr_zero_p((mpfr_ptr )x_orig.data.num) && mpfr_zero_p((mpfr_ptr )y_orig.data.num)) {
+ @<Handle undefined arg@>;
+ } else {
+ mpfr_t atan2val, oneeighty_angle;
+ mpfr_init2(atan2val, precision_bits);
+ mpfr_init2(oneeighty_angle, precision_bits);
+ ret->type = mp_angle_type;
+ mpfr_set_si(oneeighty_angle, 180 * angle_multiplier, ROUNDING);
+ mpfr_div(oneeighty_angle, oneeighty_angle, PI_mpfr_t, ROUNDING);
+ checkZero((mpfr_ptr)y_orig.data.num);
+ checkZero((mpfr_ptr)x_orig.data.num);
+ mpfr_atan2(atan2val, y_orig.data.num, x_orig.data.num, ROUNDING);
+ mpfr_mul(ret->data.num, atan2val, oneeighty_angle, ROUNDING);
+ checkZero((mpfr_ptr)ret->data.num);
+ mpfr_clear(atan2val);
+ mpfr_clear(oneeighty_angle);
+ }
+ mp_check_mpfr_t(mp, ret->data.num);
+}
+
+
+@ @<Handle undefined arg@>=
+{
+ const char *hlp[] = {
+ "The `angle' between two identical points is undefined.",
+ "I'm zeroing this one. Proceed, with fingers crossed.",
+ NULL };
+ mp_error (mp, "angle(0,0) is taken as zero", hlp, true);
+@.angle(0,0)...zero@>;
+ mpfr_set_zero(ret->data.num,1); /* 1 == positive */
+}
+
+
+@ Conversely, the |n_sin_cos| routine takes an |angle| and produces the sine
+and cosine of that angle. The results of this routine are
+stored in global integer variables |n_sin| and |n_cos|.
+
+@ Calculate sines and cosines.
+
+@c
+void mp_binary_sin_cos (MP mp, mp_number z_orig, mp_number *n_cos, mp_number *n_sin) {
+ mpfr_t rad;
+ mpfr_t one_eighty;
+ mpfr_init2(rad, precision_bits);
+ mpfr_init2(one_eighty, precision_bits);
+ mpfr_set_si(one_eighty, 180 * 16, ROUNDING);
+ mpfr_mul (rad, z_orig.data.num, PI_mpfr_t, ROUNDING);
+ mpfr_div (rad, rad, one_eighty, ROUNDING);
+
+ mpfr_sin (n_sin->data.num, rad, ROUNDING);
+ mpfr_cos (n_cos->data.num, rad, ROUNDING);
+
+ mpfr_mul (n_cos->data.num,n_cos->data.num, fraction_multiplier_mpfr_t, ROUNDING);
+ mpfr_mul (n_sin->data.num,n_sin->data.num, fraction_multiplier_mpfr_t, ROUNDING);
+ mp_check_mpfr_t(mp, n_cos->data.num);
+ mp_check_mpfr_t(mp, n_sin->data.num);
+ mpfr_clear (rad);
+ mpfr_clear (one_eighty);
+}
+
+@ To initialize the |randoms| table, we call the following routine.
+
+@c
+void mp_init_randoms (MP mp, int seed) {
+ int j, jj, k; /* more or less random integers */
+ int i; /* index into |randoms| */
+ j = abs (seed);
+ while (j >= fraction_one) {
+ j = j/2;
+ }
+ k = 1;
+ for (i = 0; i <= 54; i++) {
+ jj = k;
+ k = j - k;
+ j = jj;
+ if (k<0)
+ k += fraction_one;
+ mpfr_set_si(mp->randoms[(i * 21) % 55].data.num, j, ROUNDING);
+ }
+ mp_new_randoms (mp);
+ mp_new_randoms (mp);
+ mp_new_randoms (mp); /* ``warm up'' the array */
+}
+
+@ @c
+void mp_binary_number_modulo (mp_number *a, mp_number b) {
+ mpfr_remainder (a->data.num, a->data.num, b.data.num, ROUNDING);
+} \ No newline at end of file
diff --git a/Build/source/texk/web2c/mplibdir/svgout.w b/Build/source/texk/web2c/mplibdir/svgout.w
index a3760007305..ecc81972124 100644
--- a/Build/source/texk/web2c/mplibdir/svgout.w
+++ b/Build/source/texk/web2c/mplibdir/svgout.w
@@ -1,4 +1,4 @@
-% $Id: svgout.w 1999 2014-04-09 08:20:05Z taco $
+% $Id: svgout.w 2003 2014-04-09 09:48:26Z taco $
%
% Copyright 2008-2009 Taco Hoekwater.
%
diff --git a/Build/source/utils/configure b/Build/source/utils/configure
index 7485fbc5498..05691c09d38 100755
--- a/Build/source/utils/configure
+++ b/Build/source/utils/configure
@@ -3799,6 +3799,7 @@ esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3817,6 +3818,7 @@ esac
test "x$enable_web2c:$enable_luajittex" = xyes:yes && {
need_poppler=yes
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
need_zziplib=yes
@@ -3834,6 +3836,7 @@ case $enable_mp in #(
esac
test "x$enable_web2c:$enable_mp" = xyes:yes && {
+ need_mpfr=yes
need_cairo=yes
need_libpng=yes
}