
答案1
這就是您可以在 Linux 中執行的操作。在其他作業系統中,它不應該有太大的不同。
較新版本的 LuaTeX 允許您做到這一點。首先,假設您已經安裝了 Lua 5.x,請建立檔案.so
並安裝它們(可選,但首選):
cd /path/to/qd/or/mapm
make
sudo make install
然後使用 載入您的庫到您的.tex
文件中require
。這是庫中包含的測試的一個很好的例子,拉馬努金常數:
%!TEX program = lualatex
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{luacode}
\begin{document}
\begin{luacode*}
--The same in case you use lmapm
qd = require "qd"
tex.print([==[Is $\exp(\pi\sqrt{163})$ an integer?]==])
tex.print("")
a=math.exp(math.pi*math.sqrt(163))
tex.print("fp",string.format("%.64e",a),"\nfrac",a-math.floor(a))
tex.print("")
a=qd.exp(qd.pi*qd.sqrt(163))
tex.print("qd",tostring(a),"\nfrac",tostring(a-qd.floor(a)))
tex.print("")
R=qd.new"2.625374126407687439999999999992500725971981856888793538563373369908627075374103782106479101186073129511813461e17"
tex.print("exact",tostring(R))
\end{luacode*}
\end{document}