summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-30 17:03:56 +0000
committerKarl Berry <karl@freefriends.org>2018-04-30 17:03:56 +0000
commitae8b34f2a6cf05f2d12a7a0d4bb28f5643b00e41 (patch)
treeb74f7fb27ad11452d721a0804f3d27ac726bcb3d /Master/texmf-dist/tex/generic
parentdacf576055f59aefcd2c687d90bc7145338738b9 (diff)
apnum (23apr18)
git-svn-id: svn://tug.org/texlive/trunk@47510 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/apnum/apnum.tex66
1 files changed, 38 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/generic/apnum/apnum.tex b/Master/texmf-dist/tex/generic/apnum/apnum.tex
index 4c2e885904f..91fc3bfde2e 100644
--- a/Master/texmf-dist/tex/generic/apnum/apnum.tex
+++ b/Master/texmf-dist/tex/generic/apnum/apnum.tex
@@ -1,10 +1,10 @@
% Arbitrary precision numbers
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% 2014, 2015, 2016 Petr Olsak
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 2014, 2015, 2016, 2018 Petr Olsak
% See the documentation apnum.pdf or apnum.d for more information
-\def\apVERSION{1.6 <Feb 2016>}
+\def\apVERSION{1.7 <Apr 2018>}
\message{The Arbitrary Precision Numbers, \apVERSION}
%%%%%%%%%%%% Internal registers, sec. 2.1 in apnum.pdf
@@ -1033,7 +1033,7 @@
\advance\apFRAC by-3
\do\denom=\COS\X;%
\ifnum\apSIGN=0 \apERR{\string\TAN: argument {\X} is out of range}\apRETURN\fi
- \SIN\X\message{\OUT/\denom}%
+ \SIN\X
\apDIV{\SIN\X}\denom
\apEND
}
@@ -1082,6 +1082,7 @@
}
\def\ACOS#1{\relax \apPIexec \apPLUS\apPIhalf{-\ASIN{#1}}}
+
%%%%%%%%%%%% Printing expressions, sec 2.11 in apnum.pdf
\def\eprint#1#2{\bgroup \apnumA=0 \apnumE=1 \apEVALb#1\limits
@@ -1096,41 +1097,48 @@
\let\ABS=\apEPabs \let\FAC=\apEPfac \let\BINOM=\apEPbinom
\let\SGN=\apEPsgn \let\iDIV=\apEPidiv \let\iMOD=\apEPimod
\let\iFLOOR=\apEPifloor \let\iFRAC=\apEPifrac
+ \let\apEPk=\empty \let\apEPy=\empty \def\apEPx{.}%
\let\apEPi=\relax \apEPj
}
\def\apEPj{}
-\def\apEPplus#1#2{{#1}+{#2}}
-\def\apEPminus#1#2{{#1}-\apEPp#2\empty\end!!...}
+\def\apEPplus#1#2{\apEPp{#1}{?...}+\apEPp{#2}{!...}}
+\def\apEPminus#1#2{\apEPp{#1}{?...}-\apEPp{#2}{!!..}}
\def\apEPmul#1#2{\def\tmpa{#1}\def\tmpb{-1}%
- \ifx\tmpa\tmpb -\else \apEPp#1\empty\end!!...\apMULop\fi
- \apEPp#2\empty\end!!!..}
-\def\apEPdiv#1#2{{#1}\over{#2}}
+ \ifx\tmpa\tmpb \if\apEPx!\left(-\apEPp{#2}{!!..}\right)\else
+ -\apEPp{#2}{!!..}\fi
+ \else \apEPp{#1}{?!..}\apMULop \apEPp{#2}{!!..}\fi
+}
+\def\apEPdiv#1#2{{\def\apEPx{.}#1}\over{\def\apEPx{.}#2}}
\def\apEPpow#1#2{%
\let\apEPy=\empty \apEPpowa{#1}\end{#2}%
- \ifx\apEPy\empty \apEPp#1\empty\end!!!!!^{#2}\else#1\fi
+ \ifx\apEPy\empty \apEPp{#1}{!!!!}^{\def\apEPx{.}#2}\else#1\fi
}
\def\apEPpowa#1{\expandafter\apEPpowb#1;}
-\def\apEPpowb#1#2;\end#3{\ifx#1\apEPf \def\apEPy{\let\apEPy=\empty #3}\fi}
-\let\apEPy=\empty
-\def\apEPf#1#2{\mathop{\rm#1}\nolimits
+\def\apEPpowb#1#2;\end#3{\ifx#1\apEPf \def\apEPy{\let\apEPy=\empty\def\apEPx{.}#3}\fi}
+\def\apEPf#1#2{\begingroup
+ \mathop{\rm#1}\nolimits
\ifx\apEPy\empty \else ^{\apEPy}\let\apEPy=\empty \fi
- \eprint{#2}{\expandafter\apEPb}%
+ \def\apEPk{\mskip-\thinmuskip}%
+ \def\apEPx{.}%
+ \eprint{#2}{\expandafter\apEPb}\endgroup
}
-\def\apEPb#1{\def\next{\left(\def\apEPe{\right)}}%
- \ifx\apPPn#1\let\next=\relax \fi
+\def\apEPb#1#2{\def\next{\apEPk\left(\def\apEPe{\right)}}%
+ \ifx\apPPn#1\expandafter\apEPd#2.\end{}{\let\next=\relax}.\fi
\ifx\apDIV#1\let\next=\relax \fi
- \next#1%
-}
-\def\apEPp#1#2\end#3#4#5#6#7{%
- \apEPa#1\bgroup{\left(}#3#4#5#6#7#1#2\apEPa#1\egroup{\right)}#3#4#5#6#7}
-\def\apEPa#1#2#3#4#5#6#7#8{%
- \ifx#1\apEPplus \ifx#4.#2\else#3\fi\fi
- \ifx#1\apEPminus \ifx#5.#2\else#3\fi\fi
- \ifx#1\apEPmul \ifx#6.#2\else#3\fi\fi
- \ifx#1\apEPdiv \ifx#7.#2\else#3\fi\fi
- \ifx#1\apEPpow \ifx#8.#2\else#3\fi\fi
- \ifx#1-\empty \ifx#6.#2\else#3\fi\fi
-}
+ \next\let\apEPk=\empty #1{#2}%
+}
+\def\apEPp#1#2{\apEPq#1\end\bgroup{\left(\def\apEPx{.}}#2#1\apEPq#1\end\egroup{\right)}#2}
+\def\apEPq#1#2\end#3#4#5#6#7#8{
+ \ifx#5!\def\apEPx{!}\fi
+ \ifx#1\apEPplus \ifx#6!#4\else#3\fi\else
+ \ifx#1\apEPminus \ifx#6!#4\else#3\fi\else
+ \ifx#1\apEPmul \ifx#7!#4\else#3\fi\else
+ \ifx#1\apEPdiv \ifx#8!#4\else#3\fi\else
+ \ifx#1\apEPpow \ifx#8!#4\else#3\fi\else
+ \expandafter\apEPd#1.\end#3{}\apEPx\fi\fi\fi\fi\fi
+}
+\def\apEPd#1#2\end#3#4#5{\ifx-#1\if#5!\ifx#3\bgroup\left(\else\right)\fi\fi\else#4\fi}
+
\let\apMULop=\cdot
\def\apEPabs#1{\left|\eprint{#1}{}\right|}
\def\apEPfac#1{\eprint{#1}{\expandafter\apEPb}\,!}
@@ -1191,3 +1199,5 @@
1.6 <Feb 2016>
- \evalmdef introduced
- \EXP for arg>=4 rewritten, \apEX register introduced
+1.7 <Apr 2018>
+ - \eprint: bug removed (round brackets around negative constants)