summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/generic/xint/README2
-rw-r--r--Master/texmf-dist/doc/generic/xint/xint.pdfbin505972 -> 922559 bytes
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.dtx3795
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.ins2
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.tex28
-rw-r--r--Master/texmf-dist/tex/generic/xint/xint.sty644
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintbinhex.sty62
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcfrac.sty24
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty670
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty457
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintgcd.sty79
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintseries.sty4
-rw-r--r--Master/texmf-dist/tex/generic/xint/xinttools.sty96
13 files changed, 3509 insertions, 2354 deletions
diff --git a/Master/texmf-dist/doc/generic/xint/README b/Master/texmf-dist/doc/generic/xint/README
index 2233e47be38..a6ea3305df6 100644
--- a/Master/texmf-dist/doc/generic/xint/README
+++ b/Master/texmf-dist/doc/generic/xint/README
@@ -1,5 +1,5 @@
The xint bundle
-Release 1.09h (2013/11/28). Documentation date: 2013/12/05
+Release 1.09i (2013/12/18). Documentation date: 2013/12/18
Copyright (C) 2013 by Jean-Francois Burnol
License: LaTeX Project Public License 1.3c or later.
diff --git a/Master/texmf-dist/doc/generic/xint/xint.pdf b/Master/texmf-dist/doc/generic/xint/xint.pdf
index af9062f9e21..f0c798aa08f 100644
--- a/Master/texmf-dist/doc/generic/xint/xint.pdf
+++ b/Master/texmf-dist/doc/generic/xint/xint.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx
index 1fc1a7dc46a..2148abb6c4e 100644
--- a/Master/texmf-dist/source/generic/xint/xint.dtx
+++ b/Master/texmf-dist/source/generic/xint/xint.dtx
@@ -1,16 +1,16 @@
% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y %02H:%02M:%02S %Z" -*-
-% File: xint.dtx, package: 1.09h (2013/11/28), documentation: 2013/12/05
+% File: xint.dtx, package: 1.09i (2013/12/18), documentation: 2013/12/18
% License: LaTeX Project Public License 1.3c or later.
% Copyright (C) 2013 by Jean-Francois Burnol <jfbu at free dot fr>
%<*dtx>
-\def\lasttimestamp{Time-stamp: <05-12-2013 17:08:06 CET>}
+\def\lasttimestamp{Time-stamp: <18-12-2013 11:32:32 CET>}
%</dtx>
%<*drv>
-\def\xintdate {2013/11/28}
-\def\xintversion {1.09h}
+\def\xintdate {2013/12/18}
+\def\xintversion {1.09i}
%</drv>
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%<xinttools>%% xinttools: Expandable and non-expandable utilities
%<xint>%% xint: Expandable operations on long numbers
%<xintfrac>%% xintfrac: Expandable operations on fractions
@@ -149,7 +149,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{xint.tex}%
[\xintdate\space v\xintversion\space driver file for xint documentation (jfB)]%
-\PassOptionsToClass{a4paper,11pt}{scrdoc}
+\PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}
\chardef\Withdvipdfmx 1 % replace 1<space> by 0<space> for using latex/pdflatex
\chardef\NoSourceCode 0 % replace 0<space> by 1<space> for no source code
\input xint.dtx
@@ -302,6 +302,7 @@
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
+%\usepackage{array}
\usepackage{multicol}
%---- GEOMETRY WILL BE CHANGED FOR SOURCE CODE SECTIONS
@@ -331,11 +332,12 @@
\def\sectioncouleur{{cyan}}
% attention à ce 22 hard codé. 23 maintenant,... 24; et 31 non 32...
+% et ça continue de changer
\etocsetstyle{section}{}
{}
- {\ifnum\etocthenumber=25 \gdef\sectioncouleur{{joli}}\fi
- \ifnum\etocthenumber=33 \gdef\sectioncouleur{[named]{RoyalPurple}}\fi
+ {\ifnum\etocthenumber=26 \gdef\sectioncouleur{{joli}}\fi
+ \ifnum\etocthenumber=34 \gdef\sectioncouleur{[named]{RoyalPurple}}\fi
\savedsectionline{\numberline{\expandafter\textcolor\sectioncouleur
{\etocnumber}}\etocname}
{{\mdseries\etocpage}}%
@@ -882,7 +884,8 @@ deep to construct complicated (and still completely expandable) formulas.
But one will presumably prefer to use the (expandable!) \csbxint{expr}| ...
\relax| parser as it allows infix notations, function names
(corresponding to some of the package macros), comparison operators,
-boolean operators, 2way and 3way conditionals.
+boolean operators, 2way and 3way conditionals, unpacking of count and dimen
+registers or variables...
\footnotesize
When producing very long numbers there is the question of printing them on
@@ -923,23 +926,54 @@ Some other computational examples are \hyperref[ssec:Machin]{the
\section{Recent changes}
\footnotesize
+
+\noindent Release |1.09i| (|[2013/12/18]|)
+\begin{itemize}
+\item \csbxint{iiexpr} is a variant of \csbxint{expr} which is optimized to deal
+ only with (long) integers, |/| does a euclidean quotient.
+\item |\xintnumexpr|, |\xintthenumexpr|, |\xintNewNumExpr| are renamed,
+ respectively, \csbxint{iexpr}, \csbxint{theiexpr}, \csbxint{NewIExpr}. The
+ earlier denominations are kept but to be removed at some point.
+\item it is now possible within |\xintexpr...\relax| and its variants to use
+ count, dimen, and skip registers or variables without explicit |\the/\number|:
+ the parser inserts automatically |\number| and a tacit multiplication is
+ implied when a register or variable immediately follows a number or fraction.
+ Regarding dimensions and |\number|, see the further discussion in
+ \autoref{sec:Dimensions}.
+\item new conditional \csbxint{ifOne}; |\xintifTrueFalse| renamed to
+ \csbxint{ifTrueAelseB}; new macros \csbxint{TFrac} (`fractional part', mapped
+ to function |frac| in |\xintexpr|-essions), \csbxint{FloatE}.
+\item \csbxint{Assign} admits an optional argument to specify the expansion type
+ to be used: |[]| (none), |[o]| (once), |[oo]| (twice), |[f]| (full), others,
+ to
+ define the macros (the default is |[e]| which means to use |\edef|).
+\item related to the previous item, \xinttoolsname defines (only if the names
+ have not already been assigned) \hyperref[odef]{\ttfamily\char92odef},
+ \hyperref[oodef]{\ttfamily\char92oodef},
+ \hyperref[fdef]{\ttfamily\char92fdef}. These tools are provided for the case
+ one uses the package macros in a non-expandable context, particularly
+ \hyperref[oodef]{\ttfamily\char92oodef} which expands twice the macro
+ replacement text and is thus a faster alternative to |\edef| taking into
+ account that the \xintname bundle macros expand already completely in only two
+ steps. This can be significant when repeatedly making (re)-definitions
+ expanding to hundreds of digits.
+\item some across the board slight efficiency improvement as a result of
+ modifications of various types to ``fork'' macros and ``branching
+ conditionals'' which are used internally.
+\item bug-fix: |\xintAND| and |\xintOR| inserted a space token in some cases and
+ did not expand as promised in two steps (bug dating back to |1.09a| I think;
+ this bug was without consequences when using |&| and \verb+|+ in
+ \csa{xintexpr-}essions, it affected only the macro form)
+ |:-((|.
+\item bug-fix: \csbxint{FtoCCv} still ended fractions with the |[0]|'s which
+ were supposed to have been removed since release |1.09b|.
+\end{itemize}
+
+For a more detailed change history, see \autoref{sec:releases}. Main recent
+additions:
+
\noindent Release |1.09h| (|[2013/11/28]|):
\begin{itemize}
-\item parts of the documentation have been re-written or re-organized,
- particularly the discussion of expansion issues and of input and
- output formats.
-\item the expansion types of macro arguments are documented in the margin of the
- macro descriptions, with conventions mainly taken over from those in the
- \LaTeX3 documentation.
-\item a dependency of \xinttoolsname on \xintname (inside \csbxint{Seq}) has
- been removed.
-\item \csbxint{TypesetEuclideAlgorithm} and \csbxint{TypesetBezoutAlgorithm}
- have been slightly modified (regarding indentation).
-\item macros \csa{xintiSum} and \csa{xintiPrd} are renamed to \csbxint{iiSum}
- and \csbxint{iiPrd}.
-\item a count register used in |1.09g| in the \csbxint{For} loops for parsing
- purposes has been removed and replaced by use of a |\numexpr|.
-\item the few uses of |\loop| have been replaced by |\xintloop/\xintiloop|.
\item all macros of \xinttoolsname for which it makes sense are now
declared |\long|.
\end{itemize}
@@ -950,8 +984,6 @@ Some other computational examples are \hyperref[ssec:Machin]{the
\csbxint{For}, \csbxint{ApplyUnbraced}, and \csbxint{iloop} available without
the \xintname overhead.
\item new expandable nestable loops \csbxint{loop} and \csbxint{iloop}.
-\item bugfix: \csbxint{For} and \csbxint{For*} do not modify anymore the value
- of |\count 255|.
\end{itemize}
\noindent Release |1.09f| (|[2013/11/04]|):
@@ -965,19 +997,7 @@ Some other computational examples are \hyperref[ssec:Machin]{the
the start and the end of its list argument; and similarly for
\csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour}.
\item \csbxint{For} \emph{et al.} accept all macro parameters
- from
- |#1| to |#9|.
-\item for reasons of inner coherence some macros previously with one extra `|i|'
- in their names (e.g. \csa{xint\-iMON}) now have a doubled `|ii|'
- (\csbxint{iiMON}) to indicate that they skip the overhead of parsing their
- inputs via \csbxint{Num}. Macros with a \emph{single} `|i|' such as
- \csbxint{iAdd} are those which maintain the non-\xintfracname output format
- for big integers, but do parse their inputs via \csbxint{Num} (since release
- |1.09a|). They too may have doubled-|i| variants for matters of programming
- optimization when working only with (big) integers and not fractions or
- decimal numbers, interested advanced users should check the code source.
-% \item bug fix: |1.09a| added inadvertently some unnecessary overhead (not
-% changing outputs) to some inner macros.
+ from |#1| to |#9|.
\end{itemize}
@@ -990,31 +1010,11 @@ Some other computational examples are \hyperref[ssec:Machin]{the
\csa{xintFor*} loops,
\item the \csa{xintFor} and \csa{xintFor*} loops are now |\long|, the
replacement text and the items may contain explicit |\par|'s.
-\item bug fix, the \csbxint{For} loop (not \csbxint{For*}) did not correctly
- detect an
- empty list.
\item new conditionals \csbxint{ifCmp}, \csbxint{ifInt}, \csbxint{ifOdd}.
-\item bug fix, |\xintiSqrt {0}| crashed. |:-((|
\item the documentation has been enriched with various additional examples,
such as the \hyperref[ssec:quicksort]{the quick sort algorithm illustrated} or
the computation of prime numbers (\autoref{ssec:primesI},
\autoref{ssec:primesII}, \autoref{ssec:primesIII}).
-\item the documentation explains with more details various expansion related
- issues, particularly in relation to conditionals.
-\end{itemize}
-
-\noindent Release |1.09d| (|[2013/10/22]|):\nobreak
-\begin{itemize}
-\item \csbxint{For*} is modified to gracefully handle a space token (or
- more than one) located at the
- very end of its list argument (as in for example |\xintFor* #1 in
- {{a}{b}{c}<space>} \do {stuff}|;
- spaces at other locations were already harmless). Furthermore this new
-version \fexpan ds the un-braced list items. After
-|\def\x{{1}{2}}| and |\def\y{{a}\x {b}{c}\x }|, |\y| will appear to
-\csbxint{For*} exactly as if it had been defined as
-|\def\y{{a}{1}{2}{b}{c}{1}{2}}|.
-\item same bug fix in \csbxint{ApplyInline}.
\end{itemize}
\noindent Release |1.09c| (|[2013/10/09]|):
@@ -1022,34 +1022,15 @@ version \fexpan ds the un-braced list items. After
\item added \hyperlink{item:bool}{|bool|} and \hyperlink{item:bool}{|togl|} to
the
\csbxint{expr} syntax; also added \csbxint{boolexpr} and \csbxint{ifboolexpr}.
-\item added \csbxint{NewNumExpr} and \csbxint{NewBoolExpr},
\item \csbxint{For} is a new type of loop, whose replacement text inserts the
comma separated values or list items via macro parameters, rather than
encapsulated in macros; the loops are nestable up to four levels,
and their replacement texts are allowed to close groups as happens with the
tabulation in alignments,
-\item \csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour} are experimental
- variants of \csbxint{For},
\item \csbxint{ApplyInline} has been enhanced in order to be usable for
generating rows (partially or completely) in an alignment,
\item new command \csbxint{Seq} to generate (expandably) arithmetic sequences of
(short) integers,
-\item the factorial |!| and branching |?|, |:|, operators (in
- \csbxint{expr}|...\relax|) have now less precedence than a function name
- located just before: |func(x)!| is the factorial of |func(x)|, not |func(x!)|,
-\item again various improvements and changes in the documentation.
-\end{itemize}
-
-\noindent Release |1.09b| (|[2013/10/03]|):
-\begin{itemize}
-\item various improvements in the documentation,
-\item more economical catcode management and re-loading handling,
-\item removal of all those |[0]|'s previously forcefully added at the end of
- fractions by various macros of \xintcfracname,
-\item \csbxint{NthElt} with a negative index returns from the tail of the list,
-\item new macro \csbxint{PRaw} to have something like what |\xintFrac| does in
- math
- mode; i.e. a |\xintRaw| which does not print the denominator if it is one.
\end{itemize}
@@ -1061,15 +1042,6 @@ version \fexpan ds the un-braced list items. After
sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm,
max, min, sum, prd, add, mul, not, all, any, xor}.
\item comparison (|<|, |>|, |=|) and logical (\verb$|$, |&|) operators.
-\item the command |\xintthe| which converts |\xintexpr|essions into printable
- format (like |\the| with |\numexpr|) is more efficient, for example one can do
- |\xintthe\x| if |\x| was def'ined to be an |\xintexpr..\relax|:
-\centeredline{|\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}|}
-\centeredline{|\def\z{\xintexpr
- \y-3^-114\relax}|\hspace{1cm}|\xintthe\z=|\begingroup
-\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}%
-\def\z{\xintexpr \y-3^-114\relax}\digitstt{\xintthe\z}\endgroup}
-\item \csbxint{numexpr}| .. \relax| is |\xintexpr round( .. ) \relax|.
\item \csbxint{NewExpr} now works with the standard macro parameter character
|#|.
\item both regular |\xintexpr|-essions and commands defined by |\xintNewExpr|
@@ -1082,87 +1054,13 @@ version \fexpan ds the un-braced list items. After
\csbxint{Num} which means that they may use directly count registers and
|\numexpr|-essions without having to prefix them by |\the|. This is thus
similar to the situation holding previously but with \xintfracname loaded.
-\item a bug introduced in |1.08b| made \csbxint{Cmp} crash when one of its
- arguments was zero. |:-((|
\end{itemize}
-
-\noindent Release |1.08b| (|[2013/06/14]|):
-\begin{itemize}
-\item Correction of a problem with spaces inside |\xintexpr|-essions.
-\item Additional improvements to the handling of floating point numbers.
-\item The macros of \xintfracname allow to use count registers in their
- arguments in ways which were not previously documented. See
- \hyperref[sec:useofcount]{Use of count registers}.
-\end{itemize}
-
-\noindent Release |1.08a| (|[2013/06/11]|):
-\begin{itemize}
-\item Improved efficiency of the basic conversion from exact
- fractions to floating point numbers,
- with ensuing speed gains especially for the power function macros
- \csbxint{FloatPow} and \csbxint{FloatPower},
-\item Better management by the \xintfracname macros \csbxint{Cmp},
- \csbxint{Max}, \csbxint{Min} and \csbxint{Geq} of inputs having big powers
- of ten in them.
-\item Macros for floating point numbers added to the \xintseriesname package.
-\end{itemize}
-
-\noindent Release |1.08| (|[2013/06/07]|):
-\begin{itemize}
-\item Extraction of square roots, for floating point numbers
- (\csbxint{FloatSqrt}), and also in
- a version adapted to integers (\csbxint{iSqrt}).
-\item New package \xintbinhexname providing \hyperref[sec:binhex]{conversion
- routines} to and from binary and hexadecimal bases.
-\end{itemize}
-
-\noindent Release |1.07| (|[2013/05/25)]|):
-\begin{itemize}
-\item The \xintfracname macros accept numbers written in scientific notation,
- the \csbxint{Float} command serves to output its argument with a given number
- |D| of significant figures. The value of |D| is either given as optional
- argument to \csbxint{Float} or set with |\xintDigits := D;|. The default value
- is |16|.
-\item The \xintexprname package is a new core constituent (which loads
- automatically \xintfracname and \xintname) and implements the expandable
- expanding parsers \centeredline{\csbxint{expr}| . . . \relax|,
- and its variant
- \csbxint{floatexpr}| . . . \relax|} allowing on input formulas using the
- standard form with infix
- operators |+|, |-|, |*|, |/|, and |^|, and arbitrary levels of
- parenthesizing. Within a float expression the operations are executed
- according to the current value of \csbxint{Digits}. Within an
- |\xintexpr|-ession the binary operators are computed exactly.
-\item The floating point precision |D| is set (this is a
-local assignment to a |\mathchar| variable) with |\xintDigits := D;| and queried
-with |\xinttheDigits|. It may be set to anything up to |32767|.\footnote{but
- values higher than 100 or 200 will presumably give too slow evaluations.} The
-macro incarnations of the binary operations admit an optional argument which
-will replace pointwise |D|; this argument may exceed the |32767| bound.
-\item To write the |\xintexpr| parser I benefited from the commented source of
- the
-\LaTeX3 parser; the |\xintexpr| parser has its own features and peculiarities.
-See \hyperref[sec:expr]{its documentation}.
-\end{itemize}
-
-% The |\xintexpr..\relax| and |\xintfloatexpr..\relax| are usable as
-% sub-expressions but not directly printable; for this one has |\xinttheexpr|
-% and
-% |\xintthefloatexpr|, or equivalently |\xintthe\xintexpr| and
-% |\xintthe\xintfloatexpr|.
-
-
-\noindent Release |1.0| (|[2013/03/28]|): initial release.
-
-
+See \autoref{sec:releases} for more.
\normalsize
-%\section{Presentation} % je transforme les sous-sections en sections le
-%9 octobre
-
\section{Overview}
The main characteristics are:
@@ -1292,12 +1190,12 @@ of the \xintexprname package.
Computation of a Bezout identity with |7^200-3^200| and |2^200-1|:}\par
{\color[named]{Purple}
\dverb|@
-\xintAssign\xintBezout {\xintthenumexpr 7^200-3^200\relax}
- {\xintthenumexpr 2^200-1\relax}\to\A\B\U\V\D|%
+\xintAssign [oo]\xintBezout {\xinttheiexpr 7^200-3^200\relax}
+ {\xinttheiexpr 2^200-1\relax}\to\A\B\U\V\D|%
\centeredline {|\U$\times$(7^200-3^200)+\xintiOpp\V$\times$(2^200-1)=\D|}}%
%
-\xintAssign\xintBezout {\xintthenumexpr 7^200-3^200\relax}
- {\xintthenumexpr 2^200-1\relax}\to\A\B\U\V\D
+\xintAssign [oo]\xintBezout {\xinttheiexpr 7^200-3^200\relax}
+ {\xinttheiexpr 2^200-1\relax}\to\A\B\U\V\D
\digitstt
{\printnumber\U$\times$(@7^200-3^200@)+%
\printnumber{\xintiOpp\V}$\times$(@2^200-1@)=\printnumber\D}
@@ -1317,7 +1215,7 @@ of the \xintexprname package.
|\def\coeff #1%|\\
| {\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}|\\
|\xintRound {9}{\xintiSeries {1}{500}{\coeff}[-12]}|:} \def\coeff #1%
-{\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}
+{\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}
\digitstt{\xintRound {9}{\xintiSeries {1}{500}{\coeff}[-12]}}\endgraf
The complete series, extended to
@@ -1327,7 +1225,7 @@ $\frac{\pi^2}{144}-\frac1{162}={}$%
\footnote{\label{fn:np}This number is typeset using the
\href{http://www.ctan.org/pkg/numprint}{numprint} package, with
\texttt{\detokenize{\npthousandsep{,\hskip 1pt plus .5pt minus .5pt}}}.
- But the breaking accross
+ But the breaking across
lines works only in text mode. The number itself was (of course...) computed
initially with \xintname, with 30 digits of $\pi$ as input.
See
@@ -1349,9 +1247,9 @@ was:
{\color{magenta}Computation of $2^{\np{999999999}}$ with |24| significant
figures:}\\
-{\color[named]{Purple}|\xintFloatPow [24] {2}{999999999}|} expands to:
+|\numprint{|{\color[named]{Purple}|\xintFloatPow [24] {2}{999999999}|}|}| expands to:
\centeredline{\digitstt{\np{\xintFloatPow [24] {2}{999999999}}}} where the
-|\numprint| macro from package \hyperref[fn:np]{|numprint|} was used.
+|\numprint| macro from the \hyperref[fn:np]{eponym package} was used.
\edef\x{\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}
\edef\y{\xintLen{\x}}
@@ -1535,28 +1433,12 @@ macros.
Conversely, wherever the package expects on input a ``big'' integers, or a
``fraction'', \fexpan sion of the argument \emph{must result in a complete
- expansion} for this argument to be acceptable. \footnote{this is not quite as
- stringent as claimed here, see \autoref{sec:useofcount} for more details.}\,%
-\footnote{\label{fn:expansions}this is particularly important when one tries to
- insert \csa{if}|...|\csa{fi}'s inside such arguments; suitable
- \csa{expandafter}'s or swapping techniques \emph{must be employed} else the
- expansion from a \csa{romannumeral-`0} will not absorb the \csa{else} or
- closing \csa{fi}, and some error will probably arise in further processing.
- Therefore it is highly recommended to use the package provided conditionals
- such as \csbxint{ifEq}, \csbxint{ifGt}, \dots, or, for \LaTeX{} users and when
- dealing with short integers the \href{http://ctan.org/pkg/etoolbox}{etoolbox}
- expandable conditionals such as \texttt{\char92 ifnumequal}, \texttt{\char92
- ifnumgreater}, \dots . Use of \emph{non-expandable} things such as
- \csa{ifthenelse} is impossible inside the arguments of \xintname macros.} The
+ expansion} for this argument to be acceptable.\footnote{this is not quite as
+ stringent as claimed here, see \autoref{sec:useofcount} for more details.}
+The
main exception is inside \csbxint{expr}|...\relax| where everything will be
expanded from left to right, completely.
-% However, when the argument is of a type a
-% priori restricted to obey the \TeX{} bound of
-% \digitstt{\number"7FFFFFFF} (in absolute value), then it is fed into a
-% |\numexpr..\relax| and the expansion will be a complete one, not
-% limited to what comes first only.
-
Summary of important expansion aspects:
\begin{enumerate}
\item the macros \fexpan d their arguments, this means that they expand
@@ -1575,19 +1457,25 @@ Summary of important expansion aspects:
|\xintAdd\x{\xinttheexpr\x\y\relax}|.\hfill
\endgroup
-\item using |\if...\fi| constructs inside macro arguments requires
- suitably mastering |\expandafter|'s and other techniques; it is much
- easier to use the package pre-defined conditionals such as
- \csbxint{ifSgn}, \csbxint{ifGt}, or \csbxint{ifOdd} for example, or
- the
- \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
- conditionals (for small integers only).
+\item\label{fn:expansions} using |\if...\fi| constructs \emph{inside}
+ the package macro arguments requires suitably mastering \TeX niques
+ (|\expandafter|'s and/or swapping techniques) to
+ ensure that the \fexpan sion will indeed absorb the \csa{else} or closing
+ \csa{fi}, else some error will arise in further processing. Therefore it is
+ highly recommended to use the package provided conditionals such as
+ \csbxint{ifEq}, \csbxint{ifGt}, \csbxint{ifSgn}, \csbxint{ifOdd}\dots, or, for
+ \LaTeX{} users and when dealing with short integers the
+ \href{http://ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
+ expandable conditionals (for small integers only) such as \texttt{\char92
+ ifnumequal}, \texttt{\char92 ifnumgreater}, \dots . Use of
+ \emph{non-expandable} things such as \csa{ifthenelse} is impossible inside the
+ arguments of \xintname macros.
\begingroup\slshape
One can use naive |\if..\fi| things inside an \csbxint{theexpr}-ession
and cousins, as long as the test is
expandable, for example\upshape
-\centeredline{|\xintthenumexpr\ifnum3>2 143\else 33\fi 0^2\relax|$\to$\digitstt{\xintthenumexpr \ifnum3>2 143\else 33\fi 0^2\relax =1430\char`\^2}}
+\centeredline{|\xinttheiexpr\ifnum3>2 143\else 33\fi 0^2\relax|$\to$\digitstt{\xinttheiexpr \ifnum3>2 143\else 33\fi 0^2\relax =1430\char`\^2}}
\endgroup
\item after the definition |\def\x {12}|, one can not use
@@ -1795,7 +1683,7 @@ Summary of the input formats for the bundle macros dealing with numbers
described in the next item; they may then have a `strict' variant for
optimizing purposes with a `\textcolor{blue}{ii}' in their names, this variant
remains available even with \xintfracname loaded. A count register can
- serve as argument only if prefixed by |\the| or |\number|.
+ serve as argument of such a macro only if prefixed by |\the| or |\number|.
\item `long' integers automatically parsed by
\csbxint{Num}\ntype{\Numf}, they may have leading signs followed by
leading zeros, and they may be count registers with no need of being
@@ -1812,23 +1700,6 @@ Summary of the input formats for the bundle macros dealing with numbers
avoided.
\end{enumerate}
-% \begin{framed}
-% With only package \xintname loaded \TeX{}'s count registers must be prefixed
-% by |\the| or |\number| inside the arguments to the package macros, except in
-% places (argument of the factorial, exponent of the power function, ...) where
-% the documentation of the macro says otherwise.
-
-% With the macros\MyMarginNote[\kern\FrameSep\kern\FrameRule]{Not previously
-% documented} of \xintfracname (including those of \xintname extended to
-% fractions) a count register is \emph{accepted} on input, with no need to be
-% prefixed by |\the| or |\number|.
-
-% Inside |\xinttheexpr...\relax|, count registers must again be prefixed by
-% |\the| or
-% |\number| (if they are not arguments to macros of \xintfracname).
-% \end{framed}
-
-
Regarding fractions, the \xintfracname macros generally output in
|A/B[n]| format, representing the fraction |A/B| times |10^n|.
@@ -2021,8 +1892,8 @@ such outputs.
Another type of multiple outputs is when using commas inside
\csbxint{expr}|..\relax|:
-\centeredline{|\xintthenumexpr 10!,2^20,lcm(1000,725)\relax|%
- $\to$\digitstt{\xintthenumexpr 10!,2^20,lcm(1000,725)\relax}}
+\centeredline{|\xinttheiexpr 10!,2^20,lcm(1000,725)\relax|%
+ $\to$\digitstt{\xinttheiexpr 10!,2^20,lcm(1000,725)\relax}}
% See the \autoref{xintDecSplit} for a rare example of a bundle macro which may
% return an empty string, or a number prefixed by a chain of zeros.
@@ -2032,12 +1903,21 @@ Another type of multiple outputs is when using commas inside
% which could require parsing through \csa{xintNum} before further processing by
% the other (integer-only) package macros from \xintname.
+
\section{Use of count registers}\label{sec:useofcount}
-When an argument
-to a macro is said in the documentation to have to obey the \TeX{} bound, this
-means that it is fed to a |\numexpr...\relax|, hence it is submitted to a
-complete expansion which must delivers an integer, and count registers and even
+Inside |\xintexpr..\relax| and its variants, a count register or count control
+sequence is automatically unpacked using |\number|, with tacit multiplication:
+|1.23\counta| is like |1.23*\counta|. We use |\number| which is slightly slower
+on count registers than |\the|, because the parser does not discriminate between
+a count and a dimen control sequence. And |\the| on a dimen variable produces
+only an approximate representation in points of the internal value in |sp|
+units. See the next section for more.
+
+Regarding now the package macros, there is first the case of an argument
+said in the documentation to have to obey the \TeX{} bound: this means that it
+is fed to a |\numexpr...\relax|, hence it is submitted to a \emph{complete
+ expansion} which must deliver an integer, and count registers and even
algebraic expressions with them like
|\mycountA+\mycountB*17-\mycountC/12+\mycountD| are admissible arguments (the
slash stands here for the rounded integer division done by |\numexpr|). This
@@ -2088,6 +1968,7 @@ The braces would not be accepted
\section{Dimensions}
+\label{sec:Dimensions}
\meta{dimen} variables can be converted into (short) integers suitable for the
\xintname macros by prefixing them with |\number|. This transforms a dimension
@@ -2101,11 +1982,162 @@ length command defined by \csa{newlength} with \csa{number} will thus discard
the |plus| and |minus| glue components and return the dimension component as
described above, and usable in the \xintname bundle macros.
+This conversion\MyMarginNote{New!} is done automatically inside an
+|\xintexpr|-essions, with tacit multiplication implied if prefixed by some
+(integral or decimal) number.
+
One may thus compute areas or volumes with no limitations, in units of |sp^2|
respectively |sp^3|, do arithmetic with them, compare them, etc..., and possibly
express some final result back in another unit, with the suitable conversion
factor and a rounding to a given number of decimal places.
+A \hyperref[tableofdimensions]{table of dimensions} illustrates that the
+internal values used by \TeX{} do not correspond always to the closest rounding.
+For example a millimeter exact value in terms of |sp| units is
+\digitstt{72.27/10/2.54*65536=\xinttheexpr trunc(72.27/10/2.54*65536,3)\relax
+ ...} and \TeX{} uses internally \digitstt{\number\dimexpr 1mm\relax}|sp| (it
+thus appears that \TeX{} truncates to get an integral multiple of the |sp|
+unit).
+
+
+% impossible avec le \ignorespaces mis par LaTeX de faire \number\dimexpr
+% idem à la fin avec \unskip, si je veux xinttheexpr
+\begin{figure*}[ht!]
+\centering\phantomsection\label{tableofdimensions}
+\begingroup\let\ignorespaces\empty
+ \let\unskip\empty
+ \def\T{\expandafter\TT\number\dimexpr}
+ \def\TT#1!{\gdef\tempT{#1}}
+ \def\E{\expandafter\expandafter\expandafter
+ \EE\xintexpr reduce(}
+ \def\EE#1!{\gdef\tempE{#1}}
+\begin{tabular}{%
+ >{\bfseries\strut}c%
+ c%
+ >{\E}c<{)\relax!}@{}%
+ >{\xintthe\tempE}r@{${}={}$}%
+ >{\xinttheexpr trunc(\tempE,3)\relax...}l%
+ >{\T}c<{!}@{}%
+ >{\tempT}r%
+ >{\xinttheexpr round(100*(\tempT-\tempE)/\tempE,4)\relax\%}c}
+ \hline
+ Unit&%
+ definition&%
+ \omit &%
+ \multicolumn{2}{c}{Exact value in \texttt{sp} units\strut}&%
+ \omit &%
+ \omit\parbox{2cm}{\centering\strut\TeX's value in \texttt{sp} units\strut}&%
+ \omit\parbox{2cm}{\centering\strut Relative error\strut}\\\hline
+ cm&0.01 m&72.27/2.54*65536&&&1cm&&\\
+ mm&0.001 m&72.27/10/2.54*65536&&&1mm&&\\
+ in&2.54 cm&72.27*65536&&&1in&&\\
+ pc&12 pt&12*65536&&&1pc&&\\
+ pt&1/72.27 in&65536&&&1pt&&\\
+ bp&1/72 in&72.27*65536/72&&&1bp&&\\
+ \omit\hfil\llap{3}bp\hfil&1/24 in&72.27*65536/24&&&3bp&&\\
+ \omit\hfil\llap{12}bp\hfil&1/2 in&72.27*65536/6&&&12bp&&\\
+ \omit\hfil\llap{72}bp\hfil&3 in&72.27*65536&&&72bp&&\\
+ dd&1238/1157 pt&1238/1157*65536&&&1dd&&\\
+ \omit\hfil\llap{11}dd\hfil&11*1238/1157 pt&11*1238/1157*65536&&&11dd&&\\
+ \omit\hfil\llap{12}dd\hfil&12*1238/1157 pt&12*1238/1157*65536&&&12dd&&\\
+ sp&1/65536 pt&1&&&1sp&&\\\hline
+ \multicolumn{8}{c}{\bfseries\large\TeX{} \strut dimensions}\\\hline
+\end{tabular}
+\endgroup
+\end{figure*}
+
+There is something quite amusing with the Didot point. According to the \TeX
+Book, @1157@\,|dd|=@1238@\,|pt|. The actual internal value of @1@\,|dd| in \TeX{} is @70124@\,|sp|. We can use \xintcfracname to display the list of
+centered convergents of the fraction @70124/65536@:
+\centeredline{|\xintListWithSep{, }{\xintFtoCCv{70124/65536}}|}
+%
+\xintFor* #1 in {\xintFtoCCv{70124/65536}}\do {@#1@, }and we don't find
+@1238/1157@ therein, but another approximant @1452/1357@!
+
+And indeed multiplying @70124/65536@ by @1157@, and respectively @1357@, we find
+the approximations (wait for more, later):
+\centeredline{``@1157@\,|dd|''\digitstt{=\xinttheexpr trunc(1157\dimexpr
+ 1dd\relax/\dimexpr 1pt\relax,12)\relax}\dots|pt|}
+\centeredline{``@1357@\,|dd|''\digitstt{=\xinttheexpr trunc(1357\dimexpr
+ 1dd\relax/\dimexpr 1pt\relax,12)\relax}\dots|pt|}
+and we seemingly discover that @1357@\,|dd|=@1452@\,|pt| is \emph{far more
+ accurate} than
+the \TeX Book formula @1157@\,|dd|=@1238@\,|pt|~!
+The formula to compute @N@\,|dd| was
+%
+\centeredline{|\xinttheexpr trunc(N\dimexpr 1dd\relax/\dimexpr
+ 1pt\relax,12)\relax}|}
+%
+
+What's the catch? The catch is that \TeX{} \emph{does not} compute @1157@\,|dd|
+like we just did:
+\centeredline{@1157@\,|dd|=|\number\dimexpr 1157dd\relax/65536|%
+ \digitstt{=\xintTrunc{12}{\number\dimexpr 1157dd\relax/65536}}\dots|pt|}
+\centeredline{@1357@\,|dd|=|\number\dimexpr 1357dd\relax/65536|%
+ \digitstt{=\xintTrunc{12}{\number\dimexpr 1357dd\relax/65536}}\dots|pt|}
+We thus discover that \TeX{} (or rather here, e-\TeX{}, but one can check that
+this works the same in \TeX82), uses indeed @1238/1157@ as a conversion factor,
+and necessarily intermediate computations are done with more precision than is
+possible with only integers less than @2^31@ (or @2^30@ for dimensions). Hence
+the @1452/1357@ ratio is irrelevant, a misleading artefact of the necessary
+rounding (or, as we see, truncating) for one |bp| as an integral number of
+|sp|'s.
+
+Let us now
+use |\xintexpr| to compute the value of the Didot point in millimeters, if
+the above rule is exactly verified: \centeredline{|\xinttheexpr
+ trunc(1238/1157*25.4/72.27,12)\relax|%
+ \digitstt{=\xinttheexpr trunc(1238/1157*25.4/72.27,12)\relax}|...mm|} This
+fits very well with the possible values of the Didot point as listed in the
+\href{http://en.wikipedia.org/wiki/Point_%28typography%29#Didot}{Wikipedia Article}.
+%
+The value @0.376065@\,|mm| is said to be the \emph{the traditional value in
+ European printers' offices}. So the @1157@\,|dd|=@1238@\,|pt| rule refers to
+this Didot point, or more precisely to the \emph{conversion factor} to be used
+between this Didot and \TeX{} points.
+
+The actual value in millimeters of exactly one Didot point as implemented in
+\TeX{} is
+%
+\centeredline
+{|\xinttheexpr trunc(\dimexpr 1dd\relax/65536/72.27*25.4,12)\relax|}
+\centeredline{%
+\digitstt{=\xinttheexpr trunc(\dimexpr
+ 1dd\relax/65536/72.27*25.4,12)\relax}|...mm|}
+The difference of circa @5@\AA\ is arguably tiny!
+
+% 543564351/508000000
+
+By the way the \emph{European printers' offices \emph{(dixit Wikipedia)} Didot} is thus exactly
+\centeredline{|\xinttheexpr reduce(.376065/(25.4/72.27))\relax|%
+ \digitstt{=\xinttheexpr reduce(.376065/(25.4/72.27))\relax}\,|pt|}
+and the centered convergents of this fraction are \xintFor* #1 in
+{\xintFtoCCv{543564351/508000000}}\do {@#1@\xintifForLast{.}{, }} We do recover
+the @1238/1157@ therein!
+
+% As a final comment on the \hyperref[tableofdimensions]{table of dimensions}, we
+% conclude that the ``Relative Error'' column is misleading as these relative
+% errors by necessity decrease for integer multiples of the given dimension units.
+% This was already indicated by the \textbf{72bp} row.
+
+% To conclude our comments on the
+% \hyperref[tableofdimensions]{table of dimensions}, the big point, now known as
+% \emph{Desktop Publishing Point} is less accurately implemented in \TeX{} than
+% other units. Let us test for example the relation @1@\,|in|@=72@\,|bp|, the difference is
+% %
+% \centeredline{|\number\numexpr\dimexpr1in\relax-72*\dimexpr1bp\relax\relax|%
+% \digitstt{=\number\numexpr\dimexpr1in\relax-72*\dimexpr1bp\relax\relax}\,|sp|}
+% \centeredline{|\number\dimexpr1in-72bp\relax|%
+% \digitstt{=\number\dimexpr1in-72bp\relax}\,|sp|}
+% on the other hand
+% \centeredline{|\xinttheexpr reduce(\dimexpr1in\relax-72.27*\dimexpr1pt\relax)\relax|}
+% \centeredline
+% \digitstt{=\xinttheexpr reduce(\dimexpr1in\relax-72.27*\dimexpr1pt\relax)\relax}\,|sp|=@-0.72@\,|sp|}
+% \centeredline
+% {\digitstt{=\number\dimexpr1in-72.27pt\relax}\,|sp|=@-0.72@\,|sp|}
+
+
+
\section{\csh{ifcase}, \csh{ifnum}, ... constructs}\label{sec:ifcase}
When using things such as |\ifcase \xintSgn{\A}| one has to make sure to leave
@@ -2126,18 +2158,18 @@ With |\def\A{1}|:
% \ifcase \xintSgn{\A} 0\or OK\else ERROR\fi
In order to use successfully |\if...\fi| constructions either as arguments to
-the
-\xintname bundle expandable macros, or when building up a completely expandable
-macro of one's own, one needs some \TeX nical expertise (this is briefly
-commented upon in \autoref{fn:expansions}).
+the \xintname bundle expandable macros, or when building up a completely
+expandable macro of one's own, one needs some \TeX nical expertise (see also
+\autoref{fn:expansions} on page~\pageref{fn:expansions}).
It is thus much to be recommended to opt rather for already existing expandable
branching macros, such as the ones which are provided by \xintname:
-\csbxint{SgnFork}, \csbxint{ifSgn}, \csbxint{ifZero}, \csbxint{ifNotZero},
-\csbxint{ifTrueFalse}, \csbxint{ifCmp}, \csbxint{ifGt}, \csbxint{ifLt},
-\csbxint{ifEq}, \csbxint{ifOdd}, and \csbxint{ifInt}. See their respective
-documentations. All these conditionals always have either two or three branches,
-and empty brace pairs |{}| for unused branches should not be forgotten.
+\csbxint{SgnFork}, \csbxint{ifSgn}, \csbxint{ifZero}, \csbxint{ifOne},
+\csbxint{ifNotZero}, \csbxint{ifTrueAelseB}, \csbxint{ifCmp}, \csbxint{ifGt},
+\csbxint{ifLt}, \csbxint{ifEq}, \csbxint{ifOdd}, and \csbxint{ifInt}. See their
+respective documentations. All these conditionals always have either two or
+three branches, and empty brace pairs |{}| for unused branches should not be
+forgotten.
If these tests are to be applied to standard \TeX{} short integers, it is more
efficient to use (under \LaTeX{}) the equivalent conditional tests from the
@@ -2148,7 +2180,7 @@ package.
\section{Assignments}\label{sec:assign}
-\xintAssign\xintBezout{357}{323}\to\tmpA\tmpB\tmpU\tmpV\tmpD
+\xintAssign [oo]\xintBezout{357}{323}\to\tmpA\tmpB\tmpU\tmpV\tmpD
It might not be necessary to maintain at all times complete
expandability. For example why not allow oneself the two definitions
@@ -2164,87 +2196,96 @@ expandability. For example why not allow oneself the two definitions
|\meaning\A|\digitstt{: \expandafter\allowsplits\meaning\A\relax} and
|\meaning\B|\digitstt{: \expandafter\allowsplits\meaning\B\relax}.
+%
+Another example (which uses a macro from the \xintgcdname package):
+\centeredline{\csbxint{Assign}\csa{xintBezout}|{357}{323}|%
+\csbnolk{to}|\A\B\U\V\D|} is equivalent to setting |\A| to \digitstt{\tmpA},
+|\B| to \digitstt{\tmpB}, |\U| to \digitstt{\tmpU}, |\V| to \digitstt{\tmpV},
+and |\D| to \digitstt{\tmpD}. And indeed
+\digitstt{(\tmpU)$\times$\tmpA-(\tmpV)$\times$\tmpB$=$%
+\xintiSub{\xintiMul\tmpU\tmpA}{\xintiMul\tmpV\tmpB}} is a Bezout Identity.
+
+Thus, what |\xintAssign| does is to first apply an
+\hyperref[sec:expansions]{\fexpan sion} to what comes next; it then defines one
+after the other (using |\edef|; an optional argument allows to modify the
+expansion type, see \autoref{xintAssign} for details), the macros found after
+|\to| to correspond to the successive braced contents (or single tokens) located
+prior to |\to|.
+
+\xintAssign
+[oo]\xintBezout{3570902836026}{200467139463}\to\tmpA\tmpB\tmpU\tmpV\tmpD
- Another example (which uses a macro from the \xintgcdname
- package):
- \centeredline{\csbxint{Assign}\csa{xintBezout}|{357}{323}|%
- \csbnolk{to}|\A\B\U\V\D|} is equivalent to setting |\A| to
- \digitstt{\tmpA}, |\B| to \digitstt{\tmpB}, |\U| to \digitstt{\tmpU},
- |\V| to \digitstt{\tmpV}, and |\D| to \digitstt{\tmpD}. And indeed
- \digitstt{(\tmpU)$\times$\tmpA-(\tmpV)$\times$\tmpB$=$%
- \xintiSub{\xintiMul\tmpU\tmpA}{\xintiMul\tmpV\tmpB}}
- is a Bezout Identity.
-
-\xintAssign\xintBezout{3570902836026}{200467139463}\to\tmpA\tmpB\tmpU\tmpV\tmpD
\centeredline{\csbxint{Assign}\csa{xintBezout}|{3570902836026}{200467139463}|%
- \csbnolk{to}|\A\B\U\V\D|} gives then |\U|\digitstt{:
+ \csbnolk{to}|\A\B\U\V\D|}
+\noindent
+gives then |\U|\digitstt{:
\expandafter\allowsplits\meaning\tmpU\relax},
|\V|\digitstt{:
\expandafter\allowsplits\meaning\tmpV\relax} and |\D|\digitstt{=\tmpD}.
- When one does not know in advance the number of tokens, one can use
- \csbxint{AssignArray} or its synonym \csbxint{DigitsOf}:
- \centeredline{\csbxint{DigitsOf}\csa{xintiPow}|{2}{100}|\csbnolk{to}\csa{Out}}
- This defines \csa{Out} to be macro with one parameter, \csa{Out}|{0}| gives
- the size |N| of the array and \csa{Out}|{n}|, for |n| from |1| to |N| then
- gives the |n|th element of the array, here the |n|th digit of @2^{100}@, from
- the most significant to the least significant. As usual, the generated macro
- \csa{Out} is completely expandable (in two steps). As it wouldn't make much
- sense to allow indices exceeding the \TeX{} bounds, the macros created by
- \csbxint{AssignArray} put their argument inside a
- \csa{numexpr},
- so it is completely expanded and
-may be a count register, not necessarily prefixed by |\the| or |\number|.
-Consider the following code snippet:
+%
+In situations when one does not know in advance the number of items, one has
+\csbxint{AssignArray} or its synonym \csbxint{DigitsOf}:
+\centeredline{\csbxint{DigitsOf}\csa{xintiPow}|{2}{100}|\csbnolk{to}\csa{DIGITS}}
+This defines \csa{DIGITS} to be macro with one parameter, \csa{DIGITS}|{0}|
+gives the size |N| of the array and \csa{DIGITS}|{n}|, for |n| from |1| to |N|
+then gives the |n|th element of the array, here the |n|th digit of @2^{100}@,
+from the most significant to the least significant. As usual, the generated
+macro \csa{DIGITS} is completely expandable (in two steps). As it wouldn't make
+much sense to allow indices exceeding the \TeX{} bounds, the macros created by
+\csbxint{AssignArray} put their argument inside a \csa{numexpr}, so it is
+completely expanded and may be a count register, not necessarily prefixed by
+|\the| or |\number|. Consider the following code snippet:
+%
\dverb+@
\newcount\cnta
\newcount\cntb
\begingroup
-\xintDigitsOf\xintiPow{2}{100}\to\Out
+\xintDigitsOf\xintiPow{2}{100}\to\DIGITS
\cnta = 1
\cntb = 0
\loop
-\advance \cntb \xintiSqr{\Out{\cnta}}
-\ifnum \cnta < \Out{0}
+\advance \cntb \xintiSqr{\DIGITS{\cnta}}
+\ifnum \cnta < \DIGITS{0}
\advance\cnta 1
\repeat
-|2^{100}| (=\xintiPow {2}{100}) has \Out{0} digits and the sum of
+|2^{100}| (=\xintiPow {2}{100}) has \DIGITS{0} digits and the sum of
their squares is \the\cntb. These digits are, from the least to
-the most significant: \cnta = \Out{0}
-\loop \Out{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
+the most significant: \cnta = \DIGITS{0}
+\loop \DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
\endgroup
+
\edef\z{\xintiPow {2}{100}}
\begingroup
-\xintDigitsOf\z\to\Out
+\xintDigitsOf\z\to\DIGITS
\cnta = 1
\cntb = 0
\loop
-\advance \cntb \xintiSqr{\Out{\cnta}}
-\ifnum \cnta < \Out{0}
+\advance \cntb \xintiSqr{\DIGITS{\cnta}}
+\ifnum \cnta < \DIGITS{0}
\advance\cnta 1
\repeat
-@2^{100}@ (=\z) has \Out{0} digits and the sum of
+@2^{100}@ (=\z) has \DIGITS{0} digits and the sum of
their squares is \the\cntb. These digits are, from the least to
-the most significant: \cnta = \Out{0}
-\loop \Out{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
+the most significant: \cnta = \DIGITS{0}
+\loop \DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
\endgroup
-We used a group in order to release the memory taken by the
-\csa{Out} array: indeed internally, besides \csa{Out} itself,
-additional macros are defined which are \csa{Out0}, \csa{Out00},
-\csa{Out1}, \csa{Out2}, ..., \csa{OutN}, where |N| is the size of
-the array (which is the value returned by |\Out{0}|; the digits
-are parts of the names not arguments).
+% We used a group in order to release the memory taken by the
+% \csa{DIGITS} array: indeed internally, besides \csa{DIGITS} itself,
+% additional macros are defined which are \csa{DIGITS0}, \csa{DIGITS00},
+% \csa{DIGITS1}, \csa{DIGITS2}, ..., \csa{DIGITSN}, where |N| is the size of
+% the array (which is the value returned by |\DIGITS{0}|; the digits
+% are parts of the names not arguments).
-The command \csbxint{RelaxArray}\csa{Out} sets all these macros to
-\csa{relax}, but it was simpler to put everything withing a group.
+% The command \csbxint{RelaxArray}\csa{DIGITS} sets all these macros to
+% \csa{relax}, but it was simpler to put everything withing a group.
-Warning: macros \csbxint{Assign}, \csbxint{AssignArray} and \csbxint{DigitsOf}
+Warning: \csbxint{Assign}, \csbxint{AssignArray} and \csbxint{DigitsOf}
\emph{do not do any check} on whether the macros they define are already
defined.
@@ -2256,30 +2297,30 @@ we could just have written: \csbxint{iiSum}|{\xintiPow{2}{100}}|\digitstt{=%
\csbxint{iiSum}|{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}|%
\digitstt{=%
\xintiiSum{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}}} but
-in the previous example each digit of @2^{100}@ was treated as one item due to the
-rules of \TeX{} for parsing macro arguments.
+in the previous example each digit of @2^{100}@ was treated as one item due to
+the rules of \TeX{} for parsing macro arguments.
-Note that |{-\xintRem{3347}{591}}| is not a valid input, because
+Note: |{-\xintRem{3347}{591}}| would not be a valid input, because
the expansion will apply only to the minus sign and leave
unaffected the |\xintRem|. So we used \csa{xint}\-|iOpp| which replaces
a number with its opposite.
-As a last example with \csa{xintAssignArray} here is one line
-extracted from the source code of the \xintgcdname macro
-\csbxint{TypesetEuclideAlgorithm}:
-\centeredline{|\xintAssignArray\xintEuclideAlgorithm
- {#1}{#2}\to\U|}
-This is done inside a group. After this command |\U{1}| contains
-the number |N| of steps of the algorithm (not to be confused with
-|\U{0}=2N+4| which is the number of elements in the |\U| array),
-and the GCD is to be found in |\U{3}|, a convenient location
-between |\U{2}| and |\U{4}| which are (absolute values of the
-expansion of) the
-initial inputs. Then follow |N| quotients and remainders
-from the first to the last step of the algorithm. The
-\csa{xintTypesetEuclideAlgorithm} macro organizes this data
-for typesetting: this is just an example of one way to do it.
+% As a last example with \csa{xintAssignArray} here is one line
+% extracted from the source code of the \xintgcdname macro
+% \csbxint{TypesetEuclideAlgorithm}:
+% \centeredline{|\xintAssignArray\xintEuclideAlgorithm
+% {#1}{#2}\to\U|}
+% This is done inside a group. After this command |\U{1}| contains
+% the number |N| of steps of the algorithm (not to be confused with
+% |\U{0}=2N+4| which is the number of elements in the |\U| array),
+% and the GCD is to be found in |\U{3}|, a convenient location
+% between |\U{2}| and |\U{4}| which are (absolute values of the
+% expansion of) the
+% initial inputs. Then follow |N| quotients and remainders
+% from the first to the last step of the algorithm. The
+% \csa{xintTypesetEuclideAlgorithm} macro organizes this data
+% for typesetting: this is just an example of one way to do it.
\section{Utilities for expandable manipulations}\label{sec:utils}
@@ -2399,7 +2440,7 @@ others are more annoying as they may pass through unsignaled.
\item generally speaking, using in a context expecting an integer (possibly
restricted to the \TeX{} bound) a macro or expression which returns a
fraction: |\xinttheexpr 4/2\relax| outputs \digitstt{\xinttheexpr 4/2\relax},
- not @2@. Use |\xintNum {\xinttheexpr 4/2\relax}| or |\xintthenumexpr
+ not @2@. Use |\xintNum {\xinttheexpr 4/2\relax}| or |\xinttheiexpr
4/2\relax|.
\end{itemize}
@@ -2418,6 +2459,11 @@ either with |\XINT_| or with |\xint_|.\footnote{starting with release |1.06b|
undefined, they may have been defined elsewhere, their meaning doesn't matter
and is not touched.
+\xinttoolsname defines \hyperref[odef]{\ttfamily\char92odef},
+\hyperref[oodef]{\ttfamily\char92oodef}, \hyperref[fdef]{\ttfamily\char92fdef},
+but only if macros with these names do not already exist (|\XINT_oodef| etc...
+are defined anyhow for use in \csbxint{Assign} and \csbxint{AssignArray}).
+
\section{Loading and usage}
\dverb|@
@@ -2470,18 +2516,19 @@ All of those requirements are relaxed for tokens parsed inside an
expression must obey the rules, as it is the macro and not the parser which will
get the tokens). In an |\xintexpr|-ession, the `e' may be uppercased: `E'.
-The \xintname bundle packages presuppose that the usual
-\csa{space} and \csa{empty} macros are pre-defined, as is the case in
-Plain \TeX{} as well as in \LaTeX.
+
+
+\makeatother The \xintname packages presuppose that the \csa{space},
+\csa{empty}, |\m@ne|, |\z@|\MyMarginNote{New!} and |\@ne| control sequences
+have their meanings as in Plain \TeX{} or \LaTeX2e.
+
+\catcode`@ \active
\section{Installation}\label{sec:install}
\begingroup
\def\MacroFont {\ttfamily\small\baselineskip11pt\relax\catcode`\"=12 }
\dverb!@
-Installation
-============
-
A. Installation using xint.tds.zip:
-----------------------------------
@@ -2622,15 +2669,15 @@ with @8@ digits after the decimal mark, and printed.
This does the same thing as the hand-written version from the previous item. The
use even thousands of times of such an |\xintNewExpr|-generated |\formula|
has no memory impact.
-\item count registers and |\numexpr|-essions \emph{must} be prefixed by |\the|
- (or |\number|) when used inside |\xintexpr|. However, they may be used
- directly as arguments to most package macros, without being prefixed by
- |\the|. See \hyperref[sec:useofcount]{Use of count registers}. With release
- |1.09a| this functionality has been
- added to many macros of the integer only \xintname (with the cost of a
- small extra overhead; earlier, this overhead was added through the loading
- of
- \xintfracname).
+\item count registers\MyMarginNote{New!} and |\numexpr|-essions are accepted
+ (LaTeX{}'s counters can be inserted using |\value|) without needing |\the| or
+ |\number| as prefix. Also dimen registers and
+ control sequences, skip registers and control sequences (\LaTeX{}'s
+ lengths), |\dimexpr|-essions, |\glueexpr|-essions are automatically unpacked
+ using |\number|, discarding the stretch and shrink components and giving the
+ dimension value in |sp| units (@1/65536@th of a \TeX{} point). Furthermore,
+ tacit multiplication is implied, when immediately prefixed by a (decimal)
+ number.
\item like a |\numexpr|, an |\xintexpr| is not directly printable, one
uses equivalently |\xintthe\xintexpr| or \csbxint{theexpr}. One may
for example define: \centeredline{|\def\x {\xintexpr \a + \b \relax}
@@ -2640,9 +2687,13 @@ has no memory impact.
\item sometimes one needs an integer, not a fraction or decimal number. The
|round| function rounds to the nearest integer (half-integers are rounded
towards $\pm\infty$), and |\xintexpr round(...)\relax| has an alternative
- syntax as \csbxint{numexpr}| ... \relax|. There is also
- \csbxint{thenumexpr}. The
+ syntax as \csbxint{iexpr}| ... \relax|. There is also
+ \csbxint{theiexpr}. The
rounding is applied to the final result only.
+\item \csbxint{iiexpr}| ... \relax|\MyMarginNote{New!} (\csbxint{theiiexpr}) is
+ another variant which deals only with (long) integers and skips the overhead
+ of the fraction internal format. The infix operator |/| does euclidean
+ division.
\item there is also \csbxint{boolexpr}| ... \relax| and \csbxint{theboolexpr}|
... \relax|. Same as regular expression but the final result is converted to
@1@
@@ -2656,26 +2707,24 @@ has no memory impact.
\xintNewBoolExpr \AssertionA[3]{ #1 & (#2|#3) }
\xintNewBoolExpr \AssertionB[3]{ #1 | (#2&#3) }
\xintNewBoolExpr \AssertionC[3]{ xor(#1,#2,#3) }
-\begin{tabular}{ccc}
\xintFor #1 in {0,1} \do {%
\xintFor #2 in {0,1} \do {%
\xintFor #3 in {0,1} \do {%
- #1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}&
- #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}&
- #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}\\ }}}
-\end{tabular}!%
+ \centerline{#1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}\hfil
+ #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}\hfil
+ #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}}}}}
+!%
\endgroup
\xintNewBoolExpr \AssertionA[3]{ #1 & (#2|#3) }
\xintNewBoolExpr \AssertionB[3]{ #1 | (#2&#3) }
\xintNewBoolExpr \AssertionC[3]{ xor(#1,#2,#3) }
-\centeredline{\begin{tabular}{ccc}
\xintFor #1 in {0,1} \do {%
\xintFor #2 in {0,1} \do {%
\xintFor #3 in {0,1} \do {%
- #1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}&
- #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}&
- #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}\\ }}}
-\end{tabular}}
+ \centeredline{#1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}\hfil
+ #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}\hfil
+ #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}}}}}
+
\item there is also \csbxint{floatexpr}| ... \relax| where the algebra is done
in
floating point approximation (also for each intermediate result). Use the
@@ -2706,15 +2755,16 @@ has no memory impact.
\label{sec:exprsummaryII}
An expression is built with infix operators (including comparison and boolean
-operators) and parentheses, and functions. And there are two special branching
-constructs. The parser expands everything from the left to the right and
-everything may thus be revealed step by step by expansion of macros. Spaces
-anywhere are allowed.
+operators), parentheses, functions, and the two branching operators |?| and |:|.
+The parser expands everything from the left to the right and everything may thus
+be revealed step by step by expansion of macros. Spaces anywhere are allowed.
-Note that |2^-10| is perfectly accepted input, no need for parentheses. And
-|-2^-10^-5*3| does |(-((2^(-10))^(-5)))*3|.
+Note that |2^-10| is perfectly accepted input, no need for parentheses, as welle
+as |2^4^8| (which is evaluated as |(2^4)^8|). The minus sign as prefix has
+various precedence levels: |\xintexpr -3-4*-5^-7\relax| evaluates as
+|(-3)-(4*(-(5^(-7))))| and |-3^-4*-5-7| as |(-((3^(-4))*(-5)))-7|.
-The characters used in the syntax should not have been made active. Use
+The characters used in the syntax should not be active. Use
\csbxint{exprSafeCatcodes}, \csbxint{exprRestoreCatcodes} if need be (these
commands must be exercised out of expansion only context). Apart from that infix
operators may be of catcode letter or other, it does not matter, or even of
@@ -2725,7 +2775,8 @@ inside the expression.
The |A/B[N]| notation is the output format of most \xintfracname
macros,\footnote{this format is convenient for nesting macros; when displaying
the final result of a computation one has \csbxint{Frac} in math mode, or
- \csbxint{Irr} and also \csbxint{PRaw} for inline text mode.} but for user input in an |\xintexpr..\relax| such
+ \csbxint{Irr} and also \csbxint{PRaw} for inline text mode.} but for user
+input in an |\xintexpr..\relax| such
a fraction should be written with the scientific notation |AeN/B| (possibly within
parentheses) or \emph{braces} must be used: |{A/B[N]}|. The square brackets are
\emph{not parsable} if not enclosed in braces together with the fraction.
@@ -2746,10 +2797,8 @@ use |\xinttheexpr| inside an |\xintexpr|: this gives a number in |A/B[n]|
format which requires protection by braces. Do not put within braces numbers in
scientific notation.
-
-The minus sign as prefix has various precedence levels: |\xintexpr
--3-4*-5^-7\relax| evaluates as |(-3)-(4*(-(5^(-7))))| and |-3^-4*-5-7| as
-|(-((3^(-4))*(-5)))-7|.
+See \autoref{xintiiexpr}\MyMarginNote{New!} for the speed-optimized variant
+\csbxint{iiexpr} which deals only with long integers.
Here is, listed from the highest priority to the lowest, the complete
list of operators and functions. Functions are at the top level of priority.
@@ -2782,14 +2831,17 @@ The |\relax| at the end of an expression is absolutely \emph{mandatory}.
\item
Functions are at the same top level of priority.
\begin{description}
- \item[functions with one (numeric) argument]
- \ctexttt{floor, ceil, reduce, sqr, abs, sgn, ?, !, not}. The |?(x)| function
- returns
- the truth value, @1@ if |x<>0|, @0@ if |x=0|. The |!(x)| is the logical
- not. The |reduce| function puts the fraction in irreducible form.
- \item[functions with one named argument] \hypertarget{item:bool}
- {\ctexttt{bool,togl}}.
-
+ \item[functions with one (numeric) argument] (numeric: any expression leading
+ to an integer, decimal number, fraction, or floating number in scientific
+ notation) \ctexttt{floor, ceil, frac, reduce, sqr, abs, sgn, ?, !, not}. The
+ |?(x)| function returns the truth value, @1@ if |x<>0|, @0@ if |x=0|. The
+ |!(x)| is the logical not. The |reduce| function puts the fraction in
+ irreducible form. The |frac|\MyMarginNote{New} function is fractional part
+ (same sign as the number, complements truncation towards zero). Like the
+ other functions |!| and |?| \emph{must} use parentheses.
+
+ \item[functions with one (alphabetical) argument] \hypertarget{item:bool}
+ {\ctexttt{bool,togl}}.
|bool(name)| returns @1@ if the \TeX{} conditional |\ifname| would
act as |\iftrue| and @0@ otherwise. This works with conditionals
defined by |\newif| (in \TeX{} or \LaTeX{}) or with primitive
@@ -2857,7 +2909,7 @@ The |\relax| at the end of an expression is absolutely \emph{mandatory}.
\item[functions with two arguments]
\ctexttt{quo, rem}. These functions are integer only, they give the quotient
and remainder in Euclidean division (more generally one can use
- the |floor| function).
+ the |floor| function; related: the |frac| function).
\item[the if conditional (twofold way)] \ctexttt{if}|(cond,yes,no)| checks if
|cond| is true or false and takes the corresponding branch. Any non zero
number or fraction is logical true. The zero value is logical false. Both
@@ -2887,8 +2939,8 @@ The |\relax| at the end of an expression is absolutely \emph{mandatory}.
the parser scope, the braces can not be hidden in a macro), chooses the
correct branch \emph{without evaluating the wrong one}. Once the braces are
removed, the parser scans and expands the uncovered material so for example
- \centeredline{|\xintthenumexpr (3>2)?{5+6}{7-1}2^3\relax|} is legal and
- computes |5+62^3=|\digitstt{\xintthenumexpr(3>2)?{5+(6}{7-(1}2^3)\relax}. Note
+ \centeredline{|\xinttheiexpr (3>2)?{5+6}{7-1}2^3\relax|} is legal and
+ computes |5+62^3=|\digitstt{\xinttheiexpr(3>2)?{5+(6}{7-(1}2^3)\relax}. Note
though that it would be better practice to include here the |2^3| inside the
branches. The contents of the branches may be arbitrary as long as once glued
to what is next the syntax is respected: {|\xintexpr
@@ -2907,26 +2959,280 @@ The |\relax| at the end of an expression is absolutely \emph{mandatory}.
(\x-\y):{sqrt}{0}{1/}(\y-\x)\relax }}
\end{description}
\item
- \renewcommand{\MicroFont}{\color[named]{DarkOrchid}\ttfamily\bfseries}%
+ \def\MicroFont{\color[named]{DarkOrchid}\ttfamily\bfseries}%
The |e| and |E| of the scientific notation. They are treated as infix
- operators of highest priority.\renewcommand{\MicroFont}{\ttfamily}
+ operators of highest priority.
+ \begingroup
+ \def\MicroFont{\ttfamily}%
The decimal mark is scanned in a special
direct way: in |1.12e3| first |1.12| is formed then only |e| is found. |1e3-1|
- is
- |999|.\renewcommand{\MicroFont}{\color[named]{DarkOrchid}\ttfamily\bfseries}
-\item The power operator |^|.
-\item Multiplication and division \raisebox{-.3\height}{|*|}, |/|.
-\item Addition and subtraction |+|, |-|.
+ is |999|.\endgroup
+\item The power operator |^|. It is left associative:
+\begingroup\def\MicroFont{\ttfamily}%
+ |\xinttheiexpr 2^2^3\relax| evaluates to
+ \xinttheiexpr 2^2^3\relax, not \xinttheiexpr 2^(2^3)\relax.\endgroup
+\item Multiplication and division \raisebox{-.3\height}{|*|}, |/|. The division
+ is left associative, too: \begingroup\def\MicroFont{\ttfamily}%
+ |\xinttheiexpr 100/50/2\relax| evaluates to
+ \xinttheiexpr 100/50/2\relax, not \xinttheiexpr 100/(50/2)\relax.\endgroup
+\item Addition and subtraction |+|, |-|. Again, |-| is left
+ associative: \begingroup\def\MicroFont{\ttfamily}%
+ |\xinttheiexpr 100-50-2\relax| evaluates to
+ \xinttheiexpr 100-50-2\relax, not \xinttheiexpr 100-(50-2)\relax.\endgroup
\item Comparison operators |<|, |>|, |=|.
\item Conjunction (logical and): |&|.
\item Inclusive disjunction (logical or): \verb$|$.
-\item The comma |,|. \renewcommand{\MicroFont}{\ttfamily}%
- One can thus do |\xintthenumexpr 2^3,3^4,5^6\relax|:
- \xintthenumexpr 2^3,3^4,5^6\relax.
+\item The comma |,|. \def\MicroFont{\ttfamily}%
+ One can thus do |\xinttheiexpr 2^3,3^4,5^6\relax| and obtain as output
+ \xinttheiexpr 2^3,3^4,5^6\relax.
\item The parentheses.
\endlist
\endgroup
+See \autoref{ssec:countinexpr} for count and dimen registers and variables.
+
+
+\section{Change log for earlier releases}
+\label{sec:releases}
+
+% peut-être je devrais mettre ici le dernier aussi?
+
+\footnotesize
+
+\noindent Release |1.09h| (|[2013/11/28]|):
+\begin{itemize}
+\item parts of the documentation have been re-written or re-organized,
+ particularly the discussion of expansion issues and of input and
+ output formats.
+\item the expansion types of macro arguments are documented in the margin of the
+ macro descriptions, with conventions mainly taken over from those in the
+ \LaTeX3 documentation.
+\item a dependency of \xinttoolsname on \xintname (inside \csbxint{Seq}) has
+ been removed.
+\item \csbxint{TypesetEuclideAlgorithm} and \csbxint{TypesetBezoutAlgorithm}
+ have been slightly modified (regarding indentation).
+\item macros \csa{xintiSum} and \csa{xintiPrd} are renamed to \csbxint{iiSum}
+ and \csbxint{iiPrd}.
+\item a count register used in |1.09g| in the \csbxint{For} loops for parsing
+ purposes has been removed and replaced by use of a |\numexpr|.
+\item the few uses of |\loop| have been replaced by |\xintloop/\xintiloop|.
+\item all macros of \xinttoolsname for which it makes sense are now
+ declared |\long|.
+\end{itemize}
+
+\noindent Release |1.09g| (|[2013/11/22]|):
+\begin{itemize}
+\item package \xinttoolsname is detached from \xintname, to make tools such as
+ \csbxint{For}, \csbxint{ApplyUnbraced}, and \csbxint{iloop} available without
+ the \xintname overhead.
+\item new expandable nestable loops \csbxint{loop} and \csbxint{iloop}.
+\item bugfix: \csbxint{For} and \csbxint{For*} do not modify anymore the value
+ of |\count 255|.
+\end{itemize}
+
+\noindent Release |1.09f| (|[2013/11/04]|):
+\begin{itemize}
+\item new \csbxint{ZapFirstSpaces}, \csbxint{ZapLastSpaces},
+ \csbxint{ZapSpaces}, \csbxint{ZapSpacesB}, for expandably stripping away
+ leading and/or ending spaces.
+\item \csbxint{CSVtoList} by default uses \csbxint{ZapSpacesB} to strip away
+ spaces around commas (or at the start and end of the comma separated list).
+\item also the \csbxint{For} loop will strip out all spaces around commas and at
+ the start and the end of its list argument; and similarly for
+ \csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour}.
+\item \csbxint{For} \emph{et al.} accept all macro parameters
+ from
+ |#1| to |#9|.
+\item for reasons of inner coherence some macros previously with one extra `|i|'
+ in their names (e.g. \csa{xint\-iMON}) now have a doubled `|ii|'
+ (\csbxint{iiMON}) to indicate that they skip the overhead of parsing their
+ inputs via \csbxint{Num}. Macros with a \emph{single} `|i|' such as
+ \csbxint{iAdd} are those which maintain the non-\xintfracname output format
+ for big integers, but do parse their inputs via \csbxint{Num} (since release
+ |1.09a|). They too may have doubled-|i| variants for matters of programming
+ optimization when working only with (big) integers and not fractions or
+ decimal numbers, interested advanced users should check the code source.
+\end{itemize}
+
+
+\noindent Release |1.09e| (|[2013/10/29]|):
+\begin{itemize}
+\item new \csbxint{integers}, \csbxint{dimensions}, \csbxint{rationals} for
+ infinite \csbxint{For} loops, interrupted with \csbxint{BreakFor} and
+ \csbxint{BreakForAndDo}.
+\item new \csbxint{ifForFirst}, \csbxint{ifForLast} for the \csa{xintFor} and
+ \csa{xintFor*} loops,
+\item the \csa{xintFor} and \csa{xintFor*} loops are now |\long|, the
+ replacement text and the items may contain explicit |\par|'s.
+\item bug fix, the \csbxint{For} loop (not \csbxint{For*}) did not correctly
+ detect an
+ empty list.
+\item new conditionals \csbxint{ifCmp}, \csbxint{ifInt}, \csbxint{ifOdd}.
+\item bug fix, |\xintiSqrt {0}| crashed. |:-((|
+\item the documentation has been enriched with various additional examples,
+ such as the \hyperref[ssec:quicksort]{the quick sort algorithm illustrated} or
+ the computation of prime numbers (\autoref{ssec:primesI},
+ \autoref{ssec:primesII}, \autoref{ssec:primesIII}).
+\item the documentation explains with more details various expansion related
+ issues, particularly in relation to conditionals.
+\end{itemize}
+
+\noindent Release |1.09d| (|[2013/10/22]|):\nobreak
+\begin{itemize}
+\item \csbxint{For*} is modified to gracefully handle a space token (or
+ more than one) located at the
+ very end of its list argument (as in for example |\xintFor* #1 in
+ {{a}{b}{c}<space>} \do {stuff}|;
+ spaces at other locations were already harmless). Furthermore this new
+version \fexpan ds the un-braced list items. After
+|\def\x{{1}{2}}| and |\def\y{{a}\x {b}{c}\x }|, |\y| will appear to
+\csbxint{For*} exactly as if it had been defined as
+|\def\y{{a}{1}{2}{b}{c}{1}{2}}|.
+\item same bug fix in \csbxint{ApplyInline}.
+\end{itemize}
+
+\noindent Release |1.09c| (|[2013/10/09]|):
+\begin{itemize}
+\item added \hyperlink{item:bool}{|bool|} and \hyperlink{item:bool}{|togl|} to
+ the
+ \csbxint{expr} syntax; also added \csbxint{boolexpr} and \csbxint{ifboolexpr}.
+\item added |\xintNewNumExpr| (now \csbxint{NewIExpr} and \csbxint{NewBoolExpr},
+\item \csbxint{For} is a new type of loop, whose replacement text inserts the
+ comma separated values or list items via macro parameters, rather than
+ encapsulated in macros; the loops are nestable up to four levels,
+ and their replacement texts are allowed to close groups as happens with the
+ tabulation in alignments,
+\item \csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour} are experimental
+ variants of \csbxint{For},
+\item \csbxint{ApplyInline} has been enhanced in order to be usable for
+ generating rows (partially or completely) in an alignment,
+\item new command \csbxint{Seq} to generate (expandably) arithmetic sequences of
+ (short) integers,
+\item the factorial |!| and branching |?|, |:|, operators (in
+ \csbxint{expr}|...\relax|) have now less precedence than a function name
+ located just before: |func(x)!| is the factorial of |func(x)|, not |func(x!)|,
+\item again various improvements and changes in the documentation.
+\end{itemize}
+
+\noindent Release |1.09b| (|[2013/10/03]|):
+\begin{itemize}
+\item various improvements in the documentation,
+\item more economical catcode management and re-loading handling,
+\item removal of all those |[0]|'s previously forcefully added at the end of
+ fractions by various macros of \xintcfracname,
+\item \csbxint{NthElt} with a negative index returns from the tail of the list,
+\item new macro \csbxint{PRaw} to have something like what |\xintFrac| does in
+ math
+ mode; i.e. a |\xintRaw| which does not print the denominator if it is one.
+\end{itemize}
+
+\noindent Release |1.09a| (|[2013/09/24]|):
+\begin{itemize}
+\item \csbxint{expr}|..\relax| and
+ \csbxint{floatexpr}|..\relax| admit functions in their
+ syntax, with comma separated values as arguments, among them \texttt{reduce,
+ sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm,
+ max, min, sum, prd, add, mul, not, all, any, xor}.
+\item comparison (|<|, |>|, |=|) and logical (\verb$|$, |&|) operators.
+\item the command |\xintthe| which converts |\xintexpr|essions into printable
+ format (like |\the| with |\numexpr|) is more efficient, for example one can do
+ |\xintthe\x| if |\x| was def'ined to be an |\xintexpr..\relax|:
+\centeredline{|\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}|}
+\centeredline{|\def\z{\xintexpr
+ \y-3^-114\relax}|\hspace{1cm}|\xintthe\z=|\begingroup
+\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}%
+\def\z{\xintexpr \y-3^-114\relax}\digitstt{\xintthe\z}\endgroup}
+\item |\xintnumexpr .. \relax| (now renamed \csbxint{iexpr}) is |\xintexpr
+ round( .. ) \relax|.
+\item \csbxint{NewExpr} now works with the standard macro parameter character
+ |#|.
+\item both regular |\xintexpr|-essions and commands defined by |\xintNewExpr|
+ will work with comma separated lists of expressions,
+\item new commands \csbxint{Floor}, \csbxint{Ceil}, \csbxint{Maxof},
+ \csbxint{Minof} (package \xintfracname), \csbxint{GCDof}, \csbxint{LCM},
+ \csbxint{LCMof} (package \xintgcdname), \csbxint{ifLt}, \csbxint{ifGt},
+ \csbxint{ifSgn}, \csbxint{ANDof}, ...
+\item The arithmetic macros from package \xintname now filter their operands via
+ \csbxint{Num} which means that they may use directly count registers and
+ |\numexpr|-essions without having to prefix them by |\the|. This is thus
+ similar to the situation holding previously but with \xintfracname loaded.
+\item a bug introduced in |1.08b| made \csbxint{Cmp} crash when one of its
+ arguments was zero. |:-((|
+\end{itemize}
+
+
+\noindent Release |1.08b| (|[2013/06/14]|):
+\begin{itemize}
+\item Correction of a problem with spaces inside |\xintexpr|-essions.
+\item Additional improvements to the handling of floating point numbers.
+\item The macros of \xintfracname allow to use count registers in their
+ arguments in ways which were not previously documented. See
+ \hyperref[sec:useofcount]{Use of count registers}.
+\end{itemize}
+
+\noindent Release |1.08a| (|[2013/06/11]|):
+\begin{itemize}
+\item Improved efficiency of the basic conversion from exact
+ fractions to floating point numbers,
+ with ensuing speed gains especially for the power function macros
+ \csbxint{FloatPow} and \csbxint{FloatPower},
+\item Better management by the \xintfracname macros \csbxint{Cmp},
+ \csbxint{Max}, \csbxint{Min} and \csbxint{Geq} of inputs having big powers
+ of ten in them.
+\item Macros for floating point numbers added to the \xintseriesname package.
+\end{itemize}
+
+\noindent Release |1.08| (|[2013/06/07]|):
+\begin{itemize}
+\item Extraction of square roots, for floating point numbers
+ (\csbxint{FloatSqrt}), and also in
+ a version adapted to integers (\csbxint{iSqrt}).
+\item New package \xintbinhexname providing \hyperref[sec:binhex]{conversion
+ routines} to and from binary and hexadecimal bases.
+\end{itemize}
+
+\noindent Release |1.07| (|[2013/05/25)]|):
+\begin{itemize}
+\item The \xintfracname macros accept numbers written in scientific notation,
+ the \csbxint{Float} command serves to output its argument with a given number
+ |D| of significant figures. The value of |D| is either given as optional
+ argument to \csbxint{Float} or set with |\xintDigits := D;|. The default value
+ is |16|.
+\item The \xintexprname package is a new core constituent (which loads
+ automatically \xintfracname and \xintname) and implements the expandable
+ expanding parsers \centeredline{\csbxint{expr}| . . . \relax|,
+ and its variant
+ \csbxint{floatexpr}| . . . \relax|} allowing on input formulas using the
+ standard form with infix
+ operators |+|, |-|, |*|, |/|, and |^|, and arbitrary levels of
+ parenthesizing. Within a float expression the operations are executed
+ according to the current value of \csbxint{Digits}. Within an
+ |\xintexpr|-ession the binary operators are computed exactly.
+\item The floating point precision |D| is set (this is a
+local assignment to a |\mathchar| variable) with |\xintDigits := D;| and queried
+with |\xinttheDigits|. It may be set to anything up to |32767|.\footnote{but
+ values higher than 100 or 200 will presumably give too slow evaluations.} The
+macro incarnations of the binary operations admit an optional argument which
+will replace pointwise |D|; this argument may exceed the |32767| bound.
+\item To write the |\xintexpr| parser I benefited from the commented source of
+ the
+\LaTeX3 parser; the |\xintexpr| parser has its own features and peculiarities.
+See \hyperref[sec:expr]{its documentation}.
+\end{itemize}
+
+Initial release |1.0| was on |2013/03/28|.
+
+
+% \noindent Historians debate the early history of the \xintname bundle, whose
+% details will need patient reconstruction from the scattered archeological
+% remnants. It has been established that the initial release |1.0| was on
+% |2013/03/28|, although only closer scrutiny of the CTAN logs could help
+% completely exclude possibility of an earlier |0.9|.
+
+
+
+\normalsize
+
\etocdepthtag.toc {commandsA}
@@ -2952,6 +3258,7 @@ This section contains various concrete examples and ends with a
\localtableofcontents
+
\subsection{\csbh{xintReverseOrder}}\label{xintReverseOrder}
\csa{xintReverseOrder}\marg{list}\etype{n} does not do any expansion of its
@@ -3485,12 +3792,14 @@ which is still expandable and another one (\autoref{ssec:primesIII}) which is a
close variant of the |\IsPrime| code above but with the \csbxint{For} loop, thus
breaking expandability. The \hyperref[ssec:primesII]{xintiloop variant} does not
first evaluate the integer square root, the \hyperref[ssec:primesIII]{xintFor
- variant} still does. I did not compare their efficiencies. Hmm, if one really
-needs to compute primes fast, sure I do applaud using \xintname, but, well,
-there is some slight overhead\MyMarginNoteWithBrace{funny private joke} in using
-\TeX{} for these things (something like a factor @1000@? not tested\dots)
-compared to accessing to the |CPU| ressources via standard compiled code from a
-standard programming language\dots
+ variant} still does. I did not compare their efficiencies.
+
+% Hmm, if one really needs to compute primes fast, sure I do applaud using
+% \xintname, but, well, there is some slight
+% overhead\MyMarginNoteWithBrace{funny private joke} in using \TeX{} for these
+% things (something like a factor @1000@? not tested\dots) compared to accessing
+% to the |CPU| ressources via standard compiled code from a standard programming
+% language\dots
Let us construct with this expandable primality test a table of the prime
numbers up to @1000@. We need to count how many we have in order to know how
@@ -4372,7 +4681,7 @@ which encapsulate the item in a macro expanding to that item.
\begin{framed}
The starred variant \csbxint{For*} deals with token lists (\emph{spaces
between braced items or single tokens are not significant}) and
- \hyperref[fn:expansions]{\fexpan ds} each \emph{unbraced} list item. This
+ \hyperref[sec:expansions]{\fexpan ds} each \emph{unbraced} list item. This
makes it easy to simulate concatenation of various list macros |\x|, |\y|, ...
If |\x| expands to |{1}{2}{3}| and |\y| expands to |{4}{5}{6}| then |{\x\y}|
as argument to |\xintFor*| has the same effect as |{{1}{2}{3}{4}{5}{6}}|%
@@ -4600,14 +4909,12 @@ points at each step.
\begin{figure*}[ht!]
\phantomsection\hypertarget{graphic}{}%
\centeredline{%
-\begingroup
\raisebox{-1cm}{\xintFor #1 in {\xintdimensions [0pt+.25pt]} \do
{\ifdim #1>2cm \expandafter\xintBreakFor\fi
- \color [rgb]{\Ratio {2cm}{#1},0,0}%
- \vrule width .25pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp
+ {\color [rgb]{\Ratio {2cm}{#1},0,0}%
+ \vrule width .25pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp }%
}% end of For iterated text
}%
-\endgroup
\hspace{1cm}%
\scriptsize\def\MacroFont {\ttfamily\baselineskip8pt\relax}
\begin{minipage}{\dimexpr\linewidth-3cm-\parindent\relax}
@@ -4616,13 +4923,12 @@ points at each step.
\xintNewNumExpr \FA [2] {{_DimToNum {$2}}^3/{_DimToNum {$1}}^2} % cube
\xintNewNumExpr \FB [2] {sqrt ({_DimToNum {$2}}*{_DimToNum {$1}})} % sqrt
\xintNewExpr \Ratio [2] {trunc({_DimToNum {$2}}/{_DimToNum{$1}},3)}
-\begingroup % to limit the scope of color changes
\xintFor #1 in {\xintdimensions [0pt+.1pt]} \do
{\ifdim #1>2cm \expandafter\xintBreakFor\fi
- \color [rgb]{\Ratio {2cm}{#1},0,0}%
- \vrule width .1pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp
+ {\color [rgb]{\Ratio {2cm}{#1},0,0}%
+ \vrule width .1pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp }%
}% end of For iterated text
-\endgroup|\par
+|\par
\end{minipage}}
\end{figure*}
@@ -4661,13 +4967,11 @@ drawing by a factor of five, but the boundary is then visibly ragged.
\def\FA #1#2{\xintDSH {-4}{\xintQuo {\xintiPow {\DimToNum {#2}}{3}}{\xintiSqr {\DimToNum{#1}}}}}
\def\FB #1#2{\xintDSH {-4}{\xintiSqrt {\xintiMul {\DimToNum {#2}}{\DimToNum{#1}}}}}
\def\Ratio #1#2{\xintTrunc {2}{\DimToNum {#2}/\DimToNum{#1}}}
-\begingroup
\xintFor #1 in {\xintdimensions [0pt+.25pt]} \do
{\ifdim #1>2cm \expandafter\xintBreakFor\fi
- \color [rgb]{\Ratio {2cm}{#1},0,0}%
- \vrule width .25pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp
+ {\color [rgb]{\Ratio {2cm}{#1},0,0}%
+ \vrule width .25pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp }%
}% end of For iterated text
-\endgroup
|%
\endgroup
\footnote{to tell the whole truth we cheated and divided by |10| the
@@ -4857,6 +5161,8 @@ been put in a \hyperref[primes]{float}, which appears
\end{tabular}
\end{figure*}?
+
+
\subsection{\csbh{xintForpair}, \csbh{xintForthree}, \csbh{xintForfour}}\label{xintForpair}\label{xintForthree}\label{xintForfour}
% {\small New in |1.09c|. The \csa{xintifForFirst}
% |1.09e| mechanism was missing and has been added for |1.09f|. The |1.09f|
@@ -4897,6 +5203,7 @@ separated list and the replacement text.
% substantially modified at some later stage.
\subsection{\csbh{xintAssign}}\label{xintAssign}
+%\small{ |1.09i| adds optional parameter.\par}
\csa{xintAssign}\meta{braced things}\csa{to}%
\meta{as many cs as they are things}\ntype{{(f$\to$\lowast x)}{\lowast N}}
@@ -4908,31 +5215,40 @@ the left of \csa{to}. It is not expandable.
A `full' expansion is first applied to the material in front of
\csa{xintAssign}, which may thus be a macro expanding to a list of braced items.
-\xintAssign\xintiPow {7}{13}\to\SevenToThePowerThirteen
-\xintAssign\xintDivision{1000000000000}{133333333}\to\Q\R
+\xintAssign [oo]\xintiPow {7}{13}\to\SevenToThePowerThirteen
+\xintAssign [oo]\xintDivision{1000000000000}{133333333}\to\Q\R
Special case: if after this initial expansion no brace is found immediately
after \csa{xintAssign}, it is assumed that there is only one control sequence
following |\to|, and this control sequence is then defined via
|\edef|\ntype{xN} as the complete expansion of the material between
\csa{xintAssign} and \csa{to}.
-\centeredline{|\xintAssign\xintDivision{1000000000000}{133333333}\to\Q\R|}
+\centeredline{|\xintAssign [oo]\xintDivision{1000000000000}{133333333}\to\Q\R|}
\centeredline{|\meaning\Q: |\digitstt{\meaning\Q}, |\meaning\R:|
- \digitstt{\meaning\R}} \centeredline{|\xintAssign\xintiPow
+ \digitstt{\meaning\R}} \centeredline{|\xintAssign [oo]\xintiPow
{7}{13}\to\SevenToThePowerThirteen|}
\centeredline{|\SevenToThePowerThirteen|\digitstt{=\SevenToThePowerThirteen}}
\centeredline{(same as |\edef\SevenToThePowerThirteen{\xintiPow {7}{13}}|)}
+\noindent\csa{xintAssign}\MyMarginNote{New!} admits now an optional parameter,
+for example |\xintAssign [oo]...|. This means that the definitions of the macros
+initially on the right of |\to| will be made with
+\hyperref[oodef]{\ttfamily\char92oodef} which expands twice the replacement
+text. The default is |[e]|, which makes the definitions with |\edef|. Other
+possibilities: |[], [x], [g], [o], [go], [oo], [goo], [f], [gf]|.
+
+
% This
% macro uses various \csa{edef}'s, thus is incompatible with expansion-only
% contexts.
\subsection{\csbh{xintAssignArray}}\label{xintAssignArray}
% {\small Changed in release |1.06| to let the defined macro pass its
-% argument through a |\numexpr...\relax|.\par}
+% argument through a |\numexpr...\relax|. |1.09i| adds optional
+% parameter. \par}
-\xintAssignArray\xintBezout {1000}{113}\to\Bez
+\xintAssignArray [oo]\xintBezout {1000}{113}\to\Bez
\csa{xintAssignArray}\meta{braced
things}\csa{to}\csa{myArray}\ntype{{(f$\to$\lowast x)}N} first expands
@@ -4944,13 +5260,22 @@ completely expanded |x|th braced thing of this original list (the argument
in two steps to its output). With |0| as parameter, \csa{myArray}|{0}| returns
the number |M| of elements of the array so that the successive elements are
\csa{myArray}|{1}|, \dots, \csa{myArray}|{M}|.
-\centeredline{|\xintAssignArray\xintBezout {1000}{113}\to\Bez|} will set
+\centeredline{|\xintAssignArray [oo]\xintBezout {1000}{113}\to\Bez|} will set
|\Bez{0}| to \digitstt{\Bez0}, |\Bez{1}| to \digitstt{\Bez1}, |\Bez{2}| to
\digitstt{\Bez2}, |\Bez{3}| to \digitstt{\Bez3}, |\Bez{4}| to \digitstt{\Bez4},
and |\Bez{5}| to \digitstt{\Bez5}:
\digitstt{(\Bez3)${}\times{}$\Bez1${}-{}$(\Bez4)${}\times{}$\Bez2${}={}$\Bez5.}
This macro is incompatible with expansion-only contexts.
+\csa{xintAssignArray}\MyMarginNote{New!} admits now an optional parameter, for
+example |\xintAssignArray [oo]...|. This means that the definitions of the
+macros will be made with \hyperref[oodef]{\ttfamily\char92oodef} (defined
+\emph{infra}), which expands twice the replacement text. This is more
+efficient in terms of speed compared to an |\edef|. The default is |[e]|, which
+makes the definitions with |\edef|. Other possibilities: |[], [o], [oo], [f]|.
+Contrarily to \csbxint{Assign} one can not use the |g| here to make the
+definitions global. For this, one should rather do |\xintAssignArray| within a
+group starting with |\globaldefs 1|.
\subsection{\csbh{xintRelaxArray}}\label{xintRelaxArray}
@@ -4958,6 +5283,46 @@ This macro is incompatible with expansion-only contexts.
macros which were defined by the previous \csa{xintAssignArray}
with \csa{myArray} as array macro.
+\subsection{\csbh{odef}, \csbh{oodef}, \csbh{fdef}}
+\label{odef}
+\label{oodef}
+\label{fdef}
+
+\csa{oodef}|\controlsequence {<stuff>}|\MyMarginNote{New!} does
+\dverb|@
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\controlsequence
+ \expandafter\expandafter\expandafter{<stuff>}|
+
+%
+This works only for a single
+|\controlsequence|, with no parameter text, even without parameters. An
+alternative would be:
+\dverb|@
+\def\oodef #1#{\def\oodefparametertext{#1}%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\oodefparametertext
+ \expandafter\expandafter\expandafter }|
+%
+
+\noindent
+but it does not allow |\global| as prefix, and, besides, would have anyhow its
+use (almost) limited to parameter texts without macro parameter tokens
+(except if the expanded thing does not see them, or is designed to deal with
+them).
+
+There is a similar macro |\odef| with only one expansion of the replacement text
+|<stuff>|, and |\fdef| which expands fully |<stuff>| using |\romannumeral-`0|.
+
+These tools are provided as it is sometimes wasteful (from the point of view of
+running time) to do an |\edef| when one knows that the contents expand in only
+two steps for example, as is the case with all (except \csbxint{loop} and
+\csbxint{iloop}) the expandable macros of the \xintname packages.
+Each will be defined only if \xinttoolsname finds them currently undefined. They
+can be prefixed with |\global|.
+
+
\subsection{The Quick Sort algorithm illustrated}\label{ssec:quicksort}
First a completely expandable macro which sorts a list of numbers. The |\QSfull|
@@ -5673,7 +6038,7 @@ compilation fail. On the other hand |\xintiiPrd {1234}|\digitstt{=\xintiiPrd
{7}{100}}}|} \digitstt{=\printnumber{\xintNum {\xinttheexpr
2^200*3^100*7^100\relax }}}
With \xintexprname, the above would be coded simply as \centeredline
-{|\xintthenumexpr 2^200*3^100*7^100\relax |}
+{|\xinttheiexpr 2^200*3^100*7^100\relax |}
Extended by \xintfracname to fractions. The original, which accepts (after
\fexpan sion) only (big) integers in the strict format and produces a (big)
@@ -5738,8 +6103,8 @@ overhead.\etype{f\numx}
\csa{xintSgnFork}\verb+{-1|0|1}+\marg{A}\marg{B}\marg{C}\etype{xnnn} expandably
chooses to execute either the \meta{A}, \meta{B} or \meta{C} code,
depending on its first argument. This first argument should be anything
-expanding to either |-1|, |0| or |1| (a count register should be
-prefixed by |\the| and a |\numexpr...\relax| also should be prefixed by
+expanding to either |-1|, |0| or |1| (a count register must be
+prefixed by |\the| and a |\numexpr...\relax| also must be prefixed by
|\the|). This utility is provided to help construct expandable macros
choosing depending on a condition which one of the package macros to
use, or which values to confer to their arguments.
@@ -5758,7 +6123,8 @@ first argument may be a count register, with no |\the| or |\number| prefix.
\csa{xintifZero}\marg{N}\marg{IsZero}\marg{IsNotZero}\etype{\Numf nn} expandably
checks if the first mandatory argument |N| (a number, possibly a fraction if
\xintfracname is loaded, or a macro expanding to one such) is zero or not. It
-then either executes the first or the second branch.
+then either executes the first or the second branch. Beware that both branches
+must be present.
\subsection{\csbh{xintifNotZero}}\label{xintifNotZero}
%{\small New with release |1.09a|.\par}
@@ -5766,15 +6132,41 @@ then either executes the first or the second branch.
\csa{xintifNotZero}\marg{N}\marg{IsNotZero}\marg{IsZero}\etype{\Numf nn}
expandably checks if the first mandatory argument |N| (a number, possibly a
fraction if \xintfracname is loaded, or a macro expanding to one such) is not
-zero or is zero. It then either executes the first or the second branch.
+zero or is zero. It then either executes the first or the second branch. Beware
+that both branches must be present.
+
+\subsection{\csbh{xintifOne}}\label{xintifOne}
+%{\small New with release |1.09i|.\par}
+
+\csa{xintifOne}\marg{N}\marg{IsOne}\marg{IsNotOne}\etype{\Numf nn} expandably
+checks if the first mandatory argument |N| (a number, possibly a fraction if
+\xintfracname is loaded, or a macro expanding to one such) is one or not. It
+then either executes the first or the second branch. Beware that both branches
+must be present.
+
+
+\subsection{\csbh{xintifTrueAelseB}, \csbh{xint\-ifFalseAelseB}}
+\label{xintifTrueAelseB}
+\label{xintifFalseAelseB}
-\subsection{\csbh{xintifTrueFalse}}\label{xintifTrueFalse}
+%\label{xintifFalseTrue}
%{\small New with release |1.09c|, renamed in |1.09e|.\par}
-\csa{xintifTrueFalse}\marg{N}\marg{true branch}\marg{false branch}\etype{\Numf
- nn} is a synonym for \csbxint{ifNotZero}. It is also available as
-\csa{xintifTrue} but this later name is a bit misleading as the macro must
-always have a |false| branch, possibly an empty brace pair |{}|.
+\csa{xintifTrueAelseB}\marg{N}\marg{true branch}\marg{false branch}\etype{\Numf
+ nn} is a synonym for \csbxint{ifNotZero}.
+
+{\small
+\noindent 1. with |1.09i|, the synonyms |\xintifTrueFalse| and |\xintifTrue| are
+ deprecated
+ and will be removed in next release.\par
+\noindent 2. These macros have no lowercase versions, use |\xintifzero|,
+|\xintifnotzero|.\par }
+
+\csa{xintifFalseAelseB}\marg{N}\marg{false branch}\marg{true branch}\etype{\Numf
+ nn} is a synonym for \csbxint{ifZero}.
+
+
+
\subsection{\csbh{xintifCmp}}\label{xintifCmp}
%{\small New with release |1.09e|.\par}
@@ -6417,6 +6809,24 @@ zeros.)
{2.13}|\digitstt{=\xintCeil {2.13}}%
}
+\subsection{\csbh{xintTFrac}}\label{xintTFrac}
+
+\csa{xintTFrac}|{f}|\etype{\Ff} returns the fractional part,
+|f=trunc(f)+frac(f)|.
+The |T| stands for `Trunc', and there could similar macros associated to
+`Round', `Floor', and `Ceil'. Inside |\xintexpr..\relax|, the function |frac| is
+mapped to \csa{xintTFrac}. Inside |\xint|\-|floatexpr..\relax|, |frac| first
+applies
+\csa{xintTFrac} to its argument (which may be in float format, or
+an exact fraction), and only next makes the float conversion.
+\centeredline{|\xintTFrac {1235/97}|\digitstt{=\xintTFrac {1235/97}}\quad
+ |\xintTFrac {-1235/97}|\digitstt{=\xintTFrac {-1235/97}}}
+\centeredline{|\xintTFrac {1235.973}|\digitstt{=\xintTFrac {1235.973}}\quad
+ |\xintTFrac {-1235.973}|\digitstt{=\xintTFrac {-1235.973}}}
+\centeredline{|\xintTFrac {1.122435727e5}|%
+ \digitstt{=\xintTFrac {1.122435727e5}}}
+
+
\subsection{\csbh{xintE}}\label{xintE}
%{\small New with |1.07|.}
@@ -6430,6 +6840,15 @@ works to get the \emph{exact} result. There is \emph{no problem} using them for
\emph{float} operations:\centeredline{|\xintFloatAdd
{1e1234567890}{1}|\digitstt{=\xintFloatAdd {1e1234567890}{1}}}
+\subsection{\csbh{xintFloatE}}\label{xintFloatE}
+%{\small New with |1.097|.}
+
+|\xintFloatE [P]{f}{x}|\etype{{\upshape[\numx]}\Ff\numx} multiplies the input
+|f| by @10^x@, and
+converts it to float format according to the optional first argument or current
+value of |\xintDigits|.
+\centeredline{|\xintFloatE {1.23e37}{53}|\digitstt{=\xintFloatE {1.23e37}{53}}}
+
\subsection{\csbh{xintDigits}, \csbh{xinttheDigits}}\label{xintDigits}
%{\small New with release |1.07|.\par}
@@ -6857,31 +7276,59 @@ through the use of one of the functions |round|, |trunc|, |float|,
% choice between parentheses or |\xintexpr...\relax|: |\def\x {(\a+\b)}| or
% |\def\x {\xintexpr \a+\b\relax}|. The latter is better as it allows |\xintthe|.
-\subsection{\texorpdfstring{\texttt{\protect\string\numexpr}}{\textbackslash numexpr} expressions, count and dimension registers}
-
-They can not be used directly but must be prefixed by |\the| or |\number| for
-the count registers and by |\number| for the dimension registers. The dimension
-is then converted to its value in scalable points |sp|, which are |1/65536|th of
-a point.
-
-One may thus compute exactly and expandably with dimensions even exceeding
-temporarily the \TeX{} limits and then convert back approximately to points by
-division by |65536| and rounding to |4|,|5| or |6| decimal digits after the
-decimal point.
-
+\subsection{\texorpdfstring{\texttt{\protect\string\numexpr}}{\textbackslash
+ numexpr} or \texorpdfstring{\texttt{\protect\string\dimexpr}}{\textbackslash
+ dimexpr} expressions, count and dimension registers and variables}
+\label{ssec:countinexpr}
+
+Count registers,\MyMarginNote{New!} count control sequences, dimen registers,
+dimen control sequences, skips and skip control sequences, |\numexpr|,
+|\dimexpr|, |\glueexpr| can be inserted directly, they will be unpacked using
+|\number| (which gives the internal value in terms of scaled points for the
+dimensional variables: @1@\,|pt|${}={}$@65536@\,|sp|; stretch and shrink
+components are thus discarded). Tacit multiplication is implied, when a
+number or decimal number prefixes such a register or control sequence.
+
+\LaTeX{} lengths are skip control sequences and \LaTeX{} counters should be
+inserted using |\value|.
+
+In the case of numbered registers like |\count255| or |\dimen0|, the resulting
+digits will be re-parsed, so for example |\count255 0| is like |100| if
+|\the\count255| would give |10|. Control sequences define complete numbers, thus
+cannot be extended that way with more digits, on the other hand they are more
+efficient as they avoid the re-parsing of their unpacked contents.
+
+A token list variable must be prefixed by |\the|, it will not be unpacked
+automatically (the parser will actually try |\number|, and thus fail). Do not
+use |\the| but only |\number| with a dimen or skip, as the |\xintexpr| parser
+doesn't understand |pt| and its presence is a syntax error. To use a dimension
+expressed in terms of points or other \TeX{} recognized units, incorporate it in
+|\dimexpr...\relax|.
+
+If one needs to optimize, |1.72\dimexpr 3.2pt\relax| is less efficient
+than |1.72*{\number\dimexpr 3.2pt\relax}| as the latter avoids re-parsing the
+digits of the representation of the dimension as scaled points.
+\centeredline{|\xinttheexpr 1.72\dimexpr 3.2pt\relax/2.71828\relax=|}
+\centeredline{|\xinttheexpr 1.72*{\number\dimexpr 3.2pt\relax}/2.71828\relax|}
+\centeredline{\digitstt{\xinttheexpr 1.72\dimexpr
+ 3.2pt\relax/2.71828\relax=\xinttheexpr 1.72*{\number\dimexpr
+ 3.2pt\relax}/2.71828\relax}}
+Regarding how dimensional expressions are converted by \TeX{} into scaled points
+see \autoref{sec:Dimensions}.
\subsection{Catcodes and spaces}
-
-
-\subsubsection{\csbh{xintexprSafeCatcodes}}\label{xintexprSafeCatcodes}
+\subsubsection{\csbh{xintexprSafeCatcodes}}
+\label{xintexprSafeCatcodes}
%{\small New with release |1.09a|.\par}
Active characters will interfere with |\xintexpr|-essions. One may prefix them
-with |\string| or use the command \csa{xintexprSafeCatcodes} before the
-|\xintexpr|-essions. This sets (not globally) the catcodes of the relevant
-characters to safe values. The command \csbxint{NewExpr} does it by itself
-internally (restoring the catcodes on exit).
+with |\string| within |\xintexpr..\relax|, thus preserving expandability, or
+there is the non-expandable \csa{xintexprSafeCatcodes} which can be issued
+before the use of |\xintexpr|. This command sets (not globally) the catcodes of
+the relevant characters to safe values. This is used internally by
+\csbxint{NewExpr} (restoring the catcodes on exit), hence \csbxint{NewExpr} does
+not have to be protected against active characters.
\subsubsection{\csbh{xintexprRestoreCatcodes}}\label{xintexprRestoreCatcodes}
%{\small New with release |1.09a|.\par}
@@ -6893,14 +7340,16 @@ Restores the catcodes to the earlier state.
Unbraced spaces inside an |\xinttheexpr...\relax| should mostly be
innocuous (except inside macro arguments).
-|\xintexpr| and |\xintthexpr| are very agnostic regarding catcodes: (unbraced)
-digits, binary operators, minus and plus signs as prefixes, parentheses, decimal
-point, may be indifferently of catcode letter or other or subscript or
-superscript, ..., it does not matter.
+|\xintexpr| and |\xinttheexpr| are for the most part agnostic regarding
+catcodes:
+(unbraced) digits, binary operators, minus and plus signs as prefixes, dot as
+decimal mark, parentheses, may be indifferently of catcode letter or other or
+subscript or superscript, ..., it doesn't matter.\footnote{Furthermore, although
+ \csbxint{expr} uses \csa{string}, it is (we hope) escape-char agnostic.}
-The characters \verb[+,-,*,/,^,!,&,|,?,:,<,>,=,(,)[ and the comma should not be
-active as everything is expanded along the way. If one of them is active, it
-can be prefixed with |\string|.
+The characters \verb[+,-,*,/,^,!,&,|,?,:,<,>,=,(,)[, the dot and the comma
+should not be active as everything is expanded along the way. If one of them is
+active, it should be prefixed with |\string|.
% In the case of the factorial, the macro
% |\xintFac| may be used rather than the postfix |!|, preferably within braces as
@@ -6915,7 +7364,8 @@ can be prefixed with |\string|.
% five operations.
Digits, slash, square brackets, minus sign, in the output from an |\xinttheexpr|
-are all of catcode 12. For |\xintthefloatexpr| the `e' in output is of catcode
+are all of catcode 12. For |\xintthefloatexpr| the `e' in the output is of
+catcode
11.
A macro with arguments will expand and grab its arguments before the
@@ -6929,13 +7379,6 @@ square brackets).
As is the case with all other package macros |\xintexpr| expands in two steps to
its final (non-printable) result; and similarly for |\xinttheexpr|.
-% The
-% `lowercase' form are a bit unusual as these macros are already in lowercase... :
-% |\xinteval| for |\xintexpr| and |\xinttheeval| for |\xinttheexpr|.
-
-% Similarly,
-% there are |\xintfloateval| and |\xintthefloateval|.
-
As explained above the expressions should contain only expandable material,
except that braces are allowed when they enclose either a fraction (or decimal
number) or something arbitrarily complicated but expanding (in a manner
@@ -7141,53 +7584,103 @@ obscure package macros of \xintname dealing with integers do not have functions
pre-defined to be in correspondance with them):
\dverb|@
-\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }|
+\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }
+\meaning\myformI:|
\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }
\ttfamily
-\noindent|\meaning\myformI:|\printnumber{\meaning\myformI}\endgraf
+\centeredline{\meaning\myformI}
+
+\dverb|@
+\xintNewIIExpr\formula [3]{rem(#1,quo({_the_numexpr $2_relax},#3))}
+\meaning\formula:|%$
+
+\xintNewIIExpr\formula [3]{rem(#1,quo({_the_numexpr $2_relax},#3))}%$
+\noindent{\meaning\formula}\endgraf
\rmfamily
-\subsection{\csbh{xintnumexpr},
- \csbh{xintthenumexpr}}\label{xintnumexpr}\label{xintthenumexpr}
+\subsection{\csbh{xintiexpr}, \csbh{xinttheiexpr}}
+\label{xintiexpr}\label{xinttheiexpr}
+% \label{xintnumexpr}\label{xintthenumexpr}
Equivalent\etype{x} to doing |\xintexpr round(...)\relax|. Thus, only the final
-result is rounded to an integer. The rounding is towards $+\infty$ for positive
-numbers and towards $-\infty$ for negative ones. Can be used on comma separated
-lists of expressions.
+result is rounded to an integer. Half integers are rounded towards $+\infty$ for
+positive numbers and towards $-\infty$ for negative ones. Can be used on comma
+separated lists of expressions.
+
+Initially\MyMarginNote{|1.09i| warning} baptized |\xintnumexpr|,
+|\xintthenumexpr| but
+I am not too happy about this choice of name; one should keep in mind that
+|\numexpr|'s integer division rounds, whereas in |\xintiexpr|, the |/| is an
+exact fractional operation, and only the final result is rounded to an integer.
+
+So |\xintnumexpr|, |\xintthenumexpr| are deprecated, and although still provided
+for the time being this might change in the future.
+
+\subsection{\csbh{xintiiexpr}, \csbh{xinttheiiexpr}}
+\label{xintiiexpr}\label{xinttheiiexpr}
+
+This variant\etype{x} maps |/| to the euclidean quotient and deals almost only
+with (long) integers. It uses the `ii' macros for addition, subtraction,
+multiplication, power, square, sums, products, euclidean quotient and remainder.
+The |round| and |trunc|, in the presence of the second optional argument, are
+mapped to \csbxint{iRound}, respectively \csbxint{iTrunc}, hence they always
+produce (long) integers.
+
+To input a fraction to |round|, |trunc|, |floor| or |ceil| one can
+use braces, else the |/| will do the euclidean quotient.
+The minus sign should be put together with the fraction: |round(-{30/78})| is
+illegal (even if the fraction had been an integer), use
+|round({-30/18})|\digitstt{=\xinttheiiexpr round({-30/18})\relax}.
+
+Decimal numbers are allowed only if postfixed immediately with |e| or |E|, the
+number will then be truncated to an integer after multiplication by the power of
+ten with exponent the number following |e| or |E|.
+\centeredline{|\xinttheiiexpr 13.4567e3+10000123e-3\relax|%
+ \digitstt{=\xinttheiiexpr 13.4567e3+10000123e-3\relax}}
+%
+
+A fraction within braces should be followed immediately by an |e| (or inside a
+|round|, |trunc|, etc...) to convert it
+into an integer as expected by the main operations. The truncation is only done
+after the |e| action.
+
+The |reduce| function is not available and will raise un error. The |frac|
+function also. The |sqrt| function is mapped to \csbxint{iSqrt}.
+
+Numbers in float notation, obtained via a macro like \csbxint{FloatSqrt}, are a
+bit of a challenge: they can not be within braces (this has been mentioned
+already, |e| is not legal within braces) and if not braced they will be
+truncated when the parser meets the |e|. The way out of the dilemma is to use a
+sub-expression:
+\centeredline{|\xinttheiiexpr \xintFloatSqrt{2}\relax|%
+ \digitstt{=\xinttheiiexpr \xintFloatSqrt{2}\relax}}
+\centeredline{|\xinttheiiexpr \xintexpr\xintFloatSqrt{2}\relax e10\relax|%
+ \digitstt{=\xinttheiiexpr \xintexpr\xintFloatSqrt{2}\relax e10\relax}}
+\centeredline{|\xinttheiiexpr round(\xintexpr\xintFloatSqrt{2}\relax,10)\relax|%
+ \digitstt{=\xinttheiiexpr round(\xintexpr\xintFloatSqrt{2}\relax,10)\relax}}
+(recall that |round| is mapped within |\xintiiexpr..\relax| to \csbxint{iRound}
+which always outputs an integer).
+
+The whole point of \csbxint{iiexpr} is to gain some speed in integer only
+algorithms, and the above explanations related to how to use fractions therein
+are a bit peripheral. We observed of the order of @30@\% speed gain when dealing
+with numbers with circa one hundred digits, but this gain decreases the longer
+the manipulated numbers become and becomes negligible for numbers with thousand
+digits: the overhead from parsing fraction format is little compared
+to other expensive aspects of the expandable shuffling of tokens.
+
\subsection{\csbh{xintboolexpr},
\csbh{xinttheboolexpr}}\label{xintboolexpr}\label{xinttheboolexpr}
%{\small New in |1.09c|.\par}
Equivalent\etype{x} to doing |\xintexpr ...\relax| and returning @1@ if the
-result does not vanish, and @0@ is the result is zero (as is the case with
-|\xintexpr|, this can be used on comma separated lists of expressions, and will
-then return a comma separated list of @0@'s and @1@'s)).
-
-\subsection{\csbh{xintifboolexpr}}\label{xintifboolexpr}
-%{\small New in |1.09c|.\par}
+result does not vanish, and @0@ is the result is zero. As |\xintexpr|, this
+can be used on comma separated lists of expressions, and will return a
+comma separated list of @0@'s and @1@'s.
-\csh{xintifboolexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xinttheexpr
-<expr>\relax| and then executes the |YES| or the |NO| branch depending on
-whether the outcome was non-zero or zero. The |<expr>| can be a pure logic
-expression using various |&| and \verb+|+, with parentheses, the logic functions
-|all|, |any|, |xor|, the |bool| or |togl| operators, but it is not limited to
-them: the most general computation can be done, as we have here just a wrapper
-which tests if the outcome of the computation vanishes or not.
-
-This will crash if used on an
-expression which is a comma separated list: the expression must return a single
-number/fraction.
-
-\subsection{\csbh{xintifboolfloatexpr}}\label{xintifboolfloatexpr}
-%{\small New in |1.09c|.\par}
-
-\csh{xintifboolfloatexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xintthefloatexpr
-<expr>\relax| and then executes the |YES| or the |NO| branch depending on
-whether the outcome was non zero or zero. This will crash if used on an
-expression which is a comma separated list.
\subsection{\csbh{xintfloatexpr},
\csbh{xintthe\-float\-expr}}\label{xintfloatexpr}\label{xintthefloatexpr}
@@ -7268,6 +7761,32 @@ setting of \csa{xintDigits}; it would have been if we had input it as
\xintDigits := 16; % mais en fait \centeredline crée un groupe.
+\subsection{\csbh{xintifboolexpr}}\label{xintifboolexpr}
+%{\small New in |1.09c|.\par}
+
+\csh{xintifboolexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xinttheexpr
+<expr>\relax| and then executes the |YES| or the |NO| branch depending on
+whether the outcome was non-zero or zero. |<expr>| can involove various |&| and
+\verb+|+, parentheses, |all|, |any|, |xor|, the |bool| or |togl| operators, but
+is not limited to them: the most general computation can be done, the test is on
+whether the outcome of the computation vanishes or not.
+
+Will not work on an expression composed of comma separated sub-expressions.
+
+\subsection{\csbh{xintifboolfloatexpr}}\label{xintifboolfloatexpr}
+%{\small New in |1.09c|.\par}
+
+\csh{xintifboolfloatexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xintthefloatexpr
+<expr>\relax| and then executes the |YES| or the |NO| branch depending on
+whether the outcome was non zero or zero.
+
+\subsection{\csbh{xintifbooliiexpr}}\label{xintifbooliiexpr}
+%{\small New in |1.09i|.\par}
+
+\csh{xintifbooliiexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xinttheiiexpr
+<expr>\relax| and then executes the |YES| or the |NO| branch depending on
+whether the outcome was non zero or zero.
+
\subsection{\csbh{xintNewFloatExpr}}\label{xintNewFloatExpr}
This is exactly like \csbxint{NewExpr} except that the created formulas are
@@ -7277,10 +7796,11 @@ the created formulas, not |\xintNewFloatExpr|. However, the numbers hard-wired
in the original expression will have been evaluated with the then current
setting for |\xintDigits|.
-\subsection{\csbh{xintNewNumExpr}}\label{xintNewNumExpr}
+\subsection{\csbh{xintNewIExpr}}\label{xintNewIExpr}
%{\small New in |1.09c|.\par }
-Like \csbxint{NewExpr} but using |\xintthenumexpr|.
+Like \csbxint{NewExpr} but using |\xinttheiexpr|. Former denomination was
+|\xintNewNumExpr| which is deprecated and should not be used.
\subsection{\csbh{xintNewBoolExpr}}\label{xintNewBoolExpr}
%{\small New in |1.09c|.\par }
@@ -7299,12 +7819,15 @@ to the number of parameters in the expression.
Obviously I should mention that \csa{xintNewExpr} itself can not be used in an
expansion-only context, as it creates a macro.
+The |\escapechar| setting may be arbitrary when using
+|\xintexpr|.\MyMarginNote{New!}
+
The format of the output of |\xintexpr|\meta{stuff}|\relax| is a |!| (with
catcode 11) followed by |\XINT_expr_usethe| which prints an error message in
the document and in the log file if it is executed, then a token doing the
-actual printing and finally a token |\.A/B[n]|. Using |\xinttheexpr| means
+actual printing and finally a token |\.=A/B[n]|. Using |\xinttheexpr| means
zapping the first two things, the third one will then recover |A/B[n]| from the
-(presumably undefined, but it does not matter) control sequence |\.A/B[n]|.
+(presumably undefined, but it does not matter) control sequence |\.=A/B[n]|.
I decided to put all intermediate results (from each evaluation of an infix
operators, or of a parenthesized subpart of the expression, or from application
@@ -9139,13 +9662,6 @@ fractions, but otherwise it is not necessarily the case.
\centeredline{|\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}|}%
\centeredline{\digitstt{\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}}}
% j'ai retiré les [0] à partir de la version 1.09b, le 3 octobre 2013.
-% I
-% know that these |[0]| are a bit annoying\footnote{and the awful truth is that
-% it
-% is added forcefully by \csa{xintCstoCv} at the last step\dots } but this is
-% the way \xintfracname likes to reception fractions: this format is best for
-% further processing by the bundle macros. For `inline' printing, one may apply
-% \csbxint{Raw} and for display in math mode \csbxint{Frac}.
\centeredline{|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv|}%
\centeredline{|{\xintPow {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]|}%
\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv
@@ -9482,7 +9998,7 @@ first place.
\catcode40=12 % (
\catcode41=12 % )
\catcode47=12 % /
- \catcode96=12 % `
+ \catcode96=12 % ` (for ubiquitous \romannumeral-`0 and some \catcode )
\catcode94=11 % ^
\catcode36=3 % $
\catcode91=12 % [
@@ -9523,7 +10039,7 @@ first place.
\fi
\XINT_providespackage
\ProvidesPackage {xinttools}%
- [2013/11/28 v1.09h Expandable and non-expandable utilities (jfB)]%
+ [2013/12/18 v1.09i Expandable and non-expandable utilities (jfB)]%
% \end{macrocode}
% \subsection{Token management, constants}
% \lverb|In 1.09e \xint_undef replaced everywhere by \xint_bye.
@@ -9542,9 +10058,9 @@ first place.
\xint_firstofone{\let\XINT_sptoken= } %<- space here!
\long\def\xint_firstoftwo #1#2{#1}%
\long\def\xint_secondoftwo #1#2{#2}%
-\long\def\xint_firstoftwo_andstop #1#2{ #1}%
-\long\def\xint_secondoftwo_andstop #1#2{ #2}%
-\def\xint_minus_andstop { -}%
+\long\def\xint_firstoftwo_afterstop #1#2{ #1}%
+\long\def\xint_secondoftwo_afterstop #1#2{ #2}%
+\def\xint_minus_afterstop { -}%
\long\def\xint_gob_til_R #1\R {}%
\long\def\xint_gob_til_W #1\W {}%
\long\def\xint_gob_til_Z #1\Z {}%
@@ -9557,6 +10073,38 @@ first place.
\chardef\xint_c_viii 8
\newtoks\XINT_toks
% \end{macrocode}
+% \subsection{ \csh{XINT\_odef}, \csh{XINT\_godef}, \csh{odef}}
+% \lverb|1.09i. Can be prefixed with \global. No parameter text. The alternative
+% $\
+% $null \def\oodef #1#{\def\XINT_tmpa{#1}%$\
+% $null $quad $quad $quad \expandafter\expandafter\expandafter\expandafter$\
+% $null $quad $quad $quad \expandafter\expandafter\expandafter\def$\
+% $null $quad $quad $quad \expandafter\expandafter\expandafter\XINT_tmpa$\
+% $null $quad $quad $quad \expandafter\expandafter\expandafter }%$\
+% could not be prefixed by \global. Anyhow, macro parameter tokens would have to
+% somehow not be seen by expanded stuff, except if designed for it.|
+% \begin{macrocode}
+\def\XINT_odef #1{\expandafter\def\expandafter#1\expandafter }%
+\ifdefined\odef\else\let\odef\XINT_odef\fi
+\def\XINT_godef {\global\XINT_odef }%
+% \end{macrocode}
+% \subsection{ \csh{XINT\_oodef}, \csh{XINT\_goodef}, \csh{oodef}}
+% \lverb|1.09i. For use in \xintAssign. No parameter text!|
+% \begin{macrocode}
+\def\XINT_oodef #1{\expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter }%
+\ifdefined\oodef\else\let\oodef\XINT_oodef\fi
+\def\XINT_goodef {\global\XINT_oodef }%
+% \end{macrocode}
+% \subsection{ \csh{XINT\_fdef}, \csh{XINT\_gfdef}, \csh{fdef}}
+% \lverb|1.09i. No parameter text! |
+% \begin{macrocode}
+\def\XINT_fdef #1#2{\expandafter\def\expandafter#1\expandafter
+ {\romannumeral-`0#2}}%
+\ifdefined\fdef\else\let\fdef\XINT_fdef\fi
+\def\XINT_gfdef {\global\XINT_fdef }%
+% \end{macrocode}
% \subsection{ \csh{xintReverseOrder}}
% \lverb|\xintReverseOrder: does NOT expand its argument.|
% \begin{macrocode}
@@ -9574,9 +10122,9 @@ first place.
\xint_bye #9\XINT_rord_cleanup\xint_bye
\XINT_rord_main {#9#8#7#6#5#4#3#2#1}%
}%
-\long\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
{%
- \expandafter\space\xint_gob_til_xint_relax #1%
+ \noexpand\expandafter\space\noexpand\xint_gob_til_xint_relax #1%
}%
% \end{macrocode}
% \subsection{\csh{xintRevWithBraces}}
@@ -9669,7 +10217,8 @@ first place.
#7\XINT_length_finish_c 2%
\W\XINT_length_finish_c 1\Z
}%
-\def\XINT_length_finish_c #1#2\Z #3{\expandafter\space\the\numexpr #3-#1\relax}%
+\edef\XINT_length_finish_c #1#2\Z #3%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #3-#1\relax}%
% \end{macrocode}
% \subsection{\csh{xintZapFirstSpaces}}
% \lverb|1.09f, written [2013/11/01].|
@@ -10021,9 +10570,9 @@ first place.
\expandafter\expandafter\expandafter\XINT_nthelt_finish
\csname xint_gobble_\romannumeral\numexpr#1-1\endcsname
}%
-\long\def\XINT_nthelt_finish #1#2\xint_bye
- {\xint_gob_til_xint_relax #1\expandafter\space
- \xint_gobble_iii\xint_relax\space #1}%
+\long\edef\XINT_nthelt_finish #1#2\xint_bye
+ {\noexpand\xint_gob_til_xint_relax #1\noexpand\expandafter\space
+ \noexpand\xint_gobble_iii\xint_relax\space #1}%
% \end{macrocode}
% \subsection{\csh{xintApply}}
% \lverb|&
@@ -10107,7 +10656,7 @@ first place.
\def\XINT_seq #1#2%
{%
\ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\or
\expandafter\XINT_seq_p
\else
@@ -10694,29 +11243,48 @@ first place.
%
% 1.09h simplifies the coding of \xintAssignArray (no more _end_a, _end_b,
% etc...), and no use of a \count register anymore, and uses \xintiloop in
-% \xintRelaxArray. Furthermore, macros are made long.|
+% \xintRelaxArray. Furthermore, macros are made long.
+%
+% 1.09i allows an optional parameter \xintAssign [oo] for example, then \oodef
+% rather than \edef is used. Idem for \xintAssignArray. However in the latter
+% case, the global variant is not available, one should use \globaldefs for
+% that. |
% \begin{macrocode}
-\long\def\xintAssign #1\to
+\def\xintAssign{\def\XINT_flet_macro {\XINT_assign_fork}\XINT_flet_zapsp }%
+\def\XINT_assign_fork
+{%
+ \let\XINT_assign_def\edef
+ \ifx\XINT_token[\expandafter\XINT_assign_opt
+ \else\expandafter\XINT_assign_a
+ \fi
+}%
+\def\XINT_assign_opt [#1]%
+{%
+ \expandafter\let\expandafter\XINT_assign_def \csname XINT_#1def\endcsname
+ \XINT_assign_a
+}%
+\long\def\XINT_assign_a #1\to
{%
- \expandafter\XINT_assign_a\romannumeral-`0#1{}\to
+ \expandafter\XINT_assign_b\romannumeral-`0#1{}\to
}%
-\long\def\XINT_assign_a #1% attention to the # at the beginning of next line
+\long\def\XINT_assign_b #1% attention to the # at the beginning of next line
#{%
\def\xint_temp {#1}%
\ifx\empty\xint_temp
- \expandafter\XINT_assign_b
+ \expandafter\XINT_assign_c
\else
- \expandafter\XINT_assign_B
+ \expandafter\XINT_assign_d
\fi
}%
-\long\def\XINT_assign_b #1#2\to #3%
+\long\def\XINT_assign_c #1#2\to #3%
{%
- \edef #3{#1}\def\xint_temp {#2}%
- \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_a #2\to }\fi
+ \XINT_assign_def #3{#1}%
+ \def\xint_temp {#2}%
+ \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_b #2\to }\fi
}%
-\def\XINT_assign_B #1\to #2%
+\def\XINT_assign_d #1\to #2% normally #1 is {} here.
{%
- \edef #2{\xint_temp}%
+ \expandafter\XINT_assign_def\expandafter #2\expandafter{\xint_temp}%
}%
\def\xintRelaxArray #1%
{%
@@ -10732,7 +11300,22 @@ first place.
\global\expandafter\let\csname\xint_arrayname 00\endcsname\relax
\global\let #1\relax
}%
-\long\def\xintAssignArray #1\to #2%
+\def\xintAssignArray{\def\XINT_flet_macro {\XINT_assignarray_fork}%
+ \XINT_flet_zapsp }%
+\def\XINT_assignarray_fork
+{%
+ \let\XINT_assignarray_def\edef
+ \ifx\XINT_token[\expandafter\XINT_assignarray_opt
+ \else\expandafter\XINT_assignarray
+ \fi
+}%
+\def\XINT_assignarray_opt [#1]%
+{%
+ \expandafter\let\expandafter\XINT_assignarray_def
+ \csname XINT_#1def\endcsname
+ \XINT_assignarray
+}%
+\long\def\XINT_assignarray #1\to #2%
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }%
\escapechar -1
@@ -10754,8 +11337,9 @@ first place.
\else
\expandafter\def\expandafter\xint_itemcount\expandafter
{\the\numexpr\xint_itemcount+\xint_c_i}%
- \expandafter\edef
- \csname\xint_arrayname\xint_itemcount\endcsname {\xint_temp }%
+ \expandafter\XINT_assignarray_def
+ \csname\xint_arrayname\xint_itemcount\expandafter\endcsname
+ \expandafter{\xint_temp }%
\expandafter\XINT_assignarray_loop
\fi
}%
@@ -10780,6 +11364,7 @@ first place.
}%
}%
\let\xintDigitsOf\xintAssignArray
+\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -10898,13 +11483,16 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xint}%
- [2013/11/28 v1.09h Expandable operations on long numbers (jfB)]%
+ [2013/12/18 v1.09i Expandable operations on long numbers (jfB)]%
% \end{macrocode}
% \subsection{Token management, constants}
% \begin{macrocode}
\long\def\xint_firstofthree #1#2#3{#1}%
\long\def\xint_secondofthree #1#2#3{#2}%
\long\def\xint_thirdofthree #1#2#3{#3}%
+\long\def\xint_firstofthree_afterstop #1#2#3{ #1}% 1.09i
+\long\def\xint_secondofthree_afterstop #1#2#3{ #2}%
+\long\def\xint_thirdofthree_afterstop #1#2#3{ #3}%
\def\xint_gob_til_zero #10{}%
\def\xint_gob_til_zeros_iii #1000{}%
\def\xint_gob_til_zeros_iv #10000{}%
@@ -10912,19 +11500,24 @@ first place.
\def\xint_gob_til_G #1G{}%
\def\xint_gob_til_minus #1-{}%
\def\xint_gob_til_relax #1\relax {}%
-\def\xint_exchangetwo_keepbraces_andstop #1#2{ {#2}{#1}}%
-\def\xint_UDzerofork #10\dummy #2#3\krof {#2}%
-\def\xint_UDsignfork #1-\dummy #2#3\krof {#2}%
-\def\xint_UDwfork #1\W\dummy #2#3\krof {#2}%
-\def\xint_UDzerosfork #100\dummy #2#3\krof {#2}%
-\def\xint_UDonezerofork #110\dummy #2#3\krof {#2}%
-\def\xint_UDzerominusfork #10-\dummy #2#3\krof {#2}%
-\def\xint_UDsignsfork #1--\dummy #2#3\krof {#2}%
-\chardef\xint_c_i 1 % 0 and 8 in xinttools
+\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
+\def\xint_exchangetwo_keepbraces_afterstop #1#2{ {#2}{#1}}%
+\def\xint_UDzerofork #10#2#3\krof {#2}%
+\def\xint_UDsignfork #1-#2#3\krof {#2}%
+\def\xint_UDwfork #1\W#2#3\krof {#2}%
+\def\xint_UDzerosfork #100#2#3\krof {#2}%
+\def\xint_UDonezerofork #110#2#3\krof {#2}%
+\def\xint_UDzerominusfork #10-#2#3\krof {#2}%
+\def\xint_UDsignsfork #1--#2#3\krof {#2}%
+% \chardef\xint_c_ 0 % done in xinttools
+\chardef\xint_c_i 1
\chardef\xint_c_ii 2
\chardef\xint_c_iii 3
\chardef\xint_c_iv 4
\chardef\xint_c_v 5
+% \chardef\xint_c_vi 6 % done in xintfrac
+% \chardef\xinf_c_vii 7 % done in xintfrac
+% \chardef\xint_c_viii 8 % done in xinttools
\chardef\xint_c_ix 9
\chardef\xint_c_x 10
\newcount\xint_c_x^viii \xint_c_x^viii 100000000
@@ -10949,8 +11542,8 @@ first place.
\def\XINT_rev_fork #1%
{%
\xint_UDsignfork
- #1\dummy {\expandafter\xint_minus_andstop\romannumeral0\XINT_rord_main {}}%
- -\dummy {\XINT_rord_main {}#1}%
+ #1{\expandafter\xint_minus_afterstop\romannumeral0\XINT_rord_main {}}%
+ -{\XINT_rord_main {}#1}%
\krof
}%
% \end{macrocode}
@@ -10975,8 +11568,8 @@ first place.
{%
\expandafter\XINT_length_loop
\xint_UDsignfork
- #1\dummy {{0}}%
- -\dummy {{0}#1}%
+ #1{{0}}%
+ -{{0}#1}%
\krof
}%
% \end{macrocode}
@@ -11077,9 +11670,9 @@ first place.
% \end{macrocode}
% \subsection{\csh{XINT\_cuz}}
% \begin{macrocode}
-\def\xint_cleanupzeros_andstop #1#2#3#4%
+\edef\xint_cleanupzeros_andstop #1#2#3#4%
{%
- \expandafter\space\the\numexpr #1#2#3#4\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
\def\xint_cleanupzeros_nospace #1#2#3#4%
{%
@@ -11117,9 +11710,9 @@ first place.
{%
\xint_cuz_end_b #2%
}%
-\def\xint_cuz_end_b #1#2#3#4#5\Z
+\edef\xint_cuz_end_b #1#2#3#4#5\Z
{%
- \expandafter\space\the\numexpr #1#2#3#4\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
\def\xint_cuz_end_A \Z\XINT_cuz_check_a #1{ 0}%
\def\XINT_cuz_check_a #1%
@@ -11136,11 +11729,11 @@ first place.
% \subsection{\csh{xintIsOne}}
% \lverb|&
% Added in 1.03. Attention: \XINT_isOne does not do any expansion. Release 1.09a
-% defines \xintIsOne which is more user-friendly. Will be modified if xintfracis
-% loaded. |
+% defines \xintIsOne which is more user-friendly. Will be modified if xintfrac
+% is loaded. |
% \begin{macrocode}
-\def\xintIsOne {\romannumeral0\xintisone }%
-\def\xintisone #1{\expandafter\XINT_isone \romannumeral0\xintnum{#1}\W\Z }%
+\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
\def\XINT_isone #1#2%
{%
@@ -11185,9 +11778,9 @@ first place.
\xint_gob_til_xint_relax #8\XINT_num_end\xint_relax
\XINT_num_NumEight #1#2#3#4#5#6#7#8%
}%
-\def\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
+\edef\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
{%
- \expandafter\space\the\numexpr #1+0\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1+0\relax
}%
\def\XINT_num_NumEight #1#2#3#4#5#6#7#8%
{%
@@ -11207,9 +11800,11 @@ first place.
\def\XINT_num_keepsign_b #1{\XINT_num_loop -}%
\def\XINT_num_finish #1\xint_relax #2\Z { #1}%
% \end{macrocode}
-% \subsection{\csh{xintSgn}}
+% \subsection{\csh{xintSgn}, \csh{xintiiSgn}, \csh{XINT\_Sgn}, \csh{XINT\_\_Sgn}}
% \lverb|&
-% Changed in 1.05. Earlier code was unnecessarily strange. 1.09a with \xintnum|
+% Changed in 1.05. Earlier code was unnecessarily strange. 1.09a with \xintnum
+%
+% 1.09i defines \XINT_Sgn and \XINT__Sgn for reasons of internal optimizations|
% \begin{macrocode}
\def\xintiiSgn {\romannumeral0\xintiisgn }%
\def\xintiisgn #1%
@@ -11221,13 +11816,28 @@ first place.
{%
\expandafter\XINT_sgn \romannumeral0\xintnum{#1}\Z%
}%
-\def\XINT_Sgn #1{\romannumeral0\XINT_sgn #1\Z }%
\def\XINT_sgn #1#2\Z
{%
\xint_UDzerominusfork
- #1-\dummy { 0}%
- 0#1\dummy { -1}%
- 0-\dummy { 1}%
+ #1-{ 0}%
+ 0#1{ -1}%
+ 0-{ 1}%
+ \krof
+}%
+\def\XINT_Sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-{0}%
+ 0#1{-1}%
+ 0-{1}%
+ \krof
+}%
+\def\XINT__Sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-\z@
+ 0#1\m@ne
+ 0-\@ne
\krof
}%
% \end{macrocode}
@@ -11241,128 +11851,162 @@ first place.
% \subsection{\csh{xintSgnFork}}
% \lverb|&
% Expandable three-way fork added in 1.07. The argument #1
-% must expand to -1,0 or 1. A \count should be put within a \numexpr..\relax.|
+% must expand to -1,0 or 1. 1.09i has _afterstop things for efficiency|
% \begin{macrocode}
\def\xintSgnFork {\romannumeral0\xintsgnfork }%
\def\xintsgnfork #1%
{%
- \ifcase #1 \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \ifcase #1 \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{XINT\_\_SgnFork}}
+% \lverb|1.09i. Used internally, #1 must expand to \m@ne, \z@, or \@ne or
+% equivalent. Does not insert a \romannumeral0 stopping space token.|
+% \begin{macrocode}
+\def\XINT__SgnFork #1%
+{%
+ \ifcase #1\expandafter\xint_secondofthree
+ \or\expandafter\xint_thirdofthree
+ \else\expandafter\xint_firstofthree
\fi
}%
% \end{macrocode}
% \subsection{\csh{xintifSgn}}
-% \lverb|&
-% Expandable three-way fork added in 1.09a. Branches expandably depending on
-% whether if <0, =0, >0. The use of
-% \romannumeral0\xintsgn rather than \xintSgn for matters related of the
-% transformation of the ternary operator : in \xintNewExpr |
+% \lverb|Expandable three-way fork added in 1.09a. Branches expandably
+% depending on whether <0, =0, >0. Choice of branch guaranteed in two steps.
+%
+% The use of \romannumeral0\xintsgn rather than \xintSgn is for matters related
+% to the transformation of the ternary operator : in \xintNewExpr. I hope I have
+% explained there the details because right now off hand I can't recall why.
+%
+% 1.09i has \xint_firstofthreeafterstop etc for faster expansion.|
% \begin{macrocode}
\def\xintifSgn {\romannumeral0\xintifsgn }%
\def\xintifsgn #1%
{%
\ifcase \romannumeral0\xintsgn{#1}
- \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
\fi
}%
% \end{macrocode}
% \subsection{\csh{xintifZero}, \csh{xintifNotZero}}
% \lverb|&
% Expandable two-way fork added in 1.09a. Branches expandably depending on
-% whether the argument is zero (branch A) or not (branch B). |
+% whether the argument is zero (branch A) or not (branch B). 1.09i restyling. By
+% the way it appears (not thoroughly tested, though) that \if tests are faster
+% than \ifnum tests. |
% \begin{macrocode}
\def\xintifZero {\romannumeral0\xintifzero }%
\def\xintifzero #1%
{%
- \if\xintSgn{\xintAbs{#1}}0%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintifNotZero {\romannumeral0\xintifnotzero }%
\def\xintifnotzero #1%
{%
- \if\xintSgn{\xintAbs{#1}}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_secondoftwo_afterstop
+ \else
+ \expandafter\xint_firstoftwo_afterstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifOne}}
+% \lverb|added in 1.09i.|
+% \begin{macrocode}
+\def\xintifOne {\romannumeral0\xintifone }%
+\def\xintifone #1%
+{%
+ \if1\xintIsOne{#1}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
-% \subsection{\csh{xintifTrueFalse}}
+% \subsection{\csh{xintifTrueAelseB}, \csh{xint\-ifFalseAelseB}}
+% \lverb|1.09i. Warning, \xintifTrueFalse, \xintifTrue deprecated, to be
+% removed|
% \begin{macrocode}
+\let\xintifTrueAelseB\xintifNotZero
+\let\xintifFalseAelseB\xintifZero
\let\xintifTrue\xintifNotZero
\let\xintifTrueFalse\xintifNotZero
% \end{macrocode}
% \subsection{\csh{xintifCmp}}
% \lverb|&
% 1.09e
-% \xintifCmp {n}{m}{if n<m}{if n=m}{if n>m}. |
+% \xintifCmp {n}{m}{if n<m}{if n=m}{if n>m}. _afterstop in 1.09i.|
% \begin{macrocode}
\def\xintifCmp {\romannumeral0\xintifcmp }%
\def\xintifcmp #1#2%
{%
- \ifcase \xintCmp {#1}{#2}
- \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \ifcase\xintCmp {#1}{#2}
+ \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
\fi
}%
% \end{macrocode}
% \subsection{\csh{xintifEq}}
% \lverb|&
% 1.09a
-% \xintifEq {n}{m}{YES if n=m}{NO if n<>m}. |
+% \xintifEq {n}{m}{YES if n=m}{NO if n<>m}. _afterstop in 1.09i.|
% \begin{macrocode}
\def\xintifEq {\romannumeral0\xintifeq }%
\def\xintifeq #1#2%
{%
- \if\xintCmp{#1}{#2}0%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
- \else\xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \if0\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_afterstop
+ \else\expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
% \subsection{\csh{xintifGt}}
% \lverb|&
-% 1.09a \xintifGt {n}{m}{YES if n>m}{NO if n<=m}.|
+% 1.09a \xintifGt {n}{m}{YES if n>m}{NO if n<=m}. _afterstop style in 1.09i|
% \begin{macrocode}
\def\xintifGt {\romannumeral0\xintifgt }%
\def\xintifgt #1#2%
{%
- \if\xintCmp{#1}{#2}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
- \else\xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \if1\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_afterstop
+ \else\expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
% \subsection{\csh{xintifLt}}
% \lverb|&
-% 1.09a \xintifLt {n}{m}{YES if n<m}{NO if n>=m}.|
+% 1.09a \xintifLt {n}{m}{YES if n<m}{NO if n>=m}. Restyled in 1.09i|
% \begin{macrocode}
\def\xintifLt {\romannumeral0\xintiflt }%
\def\xintiflt #1#2%
{%
- \xintSgnFork{\xintCmp{#1}{#2}}%
- {\expandafter\space\xint_firstoftwo}%
- {\expandafter\space\xint_secondoftwo}%
- {\expandafter\space\xint_secondoftwo}%
+ \ifnum\xintCmp{#1}{#2}<\xint_c_
+ \expandafter\xint_firstoftwo_afterstop
+ \else \expandafter\xint_secondoftwo_afterstop
+ \fi
}%
% \end{macrocode}
% \subsection{\csh{xintifOdd}}
-% \lverb|1.09e|
+% \lverb|1.09e. Restyled in 1.09i.|
% \begin{macrocode}
\def\xintifOdd {\romannumeral0\xintifodd }%
\def\xintifodd #1%
{%
\if\xintOdd{#1}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -11384,9 +12028,9 @@ first place.
\def\XINT_opp #1%
{%
\xint_UDzerominusfork
- #1-\dummy { 0}% zero
- 0#1\dummy { }% negative
- 0-\dummy { -#1}% positive
+ #1-{ 0}% zero
+ 0#1{ }% negative
+ 0-{ -#1}% positive
\krof
}%
% \end{macrocode}
@@ -11410,8 +12054,8 @@ first place.
\def\XINT_abs #1%
{%
\xint_UDsignfork
- #1\dummy { }%
- -\dummy { #1}%
+ #1{ }%
+ -{ #1}%
\krof
}%
% \end{macrocode}
@@ -11677,8 +12321,8 @@ first place.
\XINT_addm_end #1#3%
}%
\def\xint_addm_cz\W\XINT_addm_CD #1#2#3{\XINT_addm_end #1#3}%
-\def\XINT_addm_end #1#2#3#4#5%
- {\expandafter\space\the\numexpr #1#2#3#4#5\relax}%
+\edef\XINT_addm_end #1#2#3#4#5%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5\relax}%
% \end{macrocode}
% \lverb|ADDITION IV, variante \XINT_addp_A$\
% INPUT:
@@ -11854,14 +12498,14 @@ first place.
\def\XINT_add_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_add_secondiszero
- #3\dummy \XINT_add_firstiszero
- 0\dummy
+ #1\XINT_add_secondiszero
+ #3\XINT_add_firstiszero
+ 0
{\xint_UDsignsfork
- #1#3\dummy \XINT_add_minusminus % #1 = #3 = -
- #1-\dummy \XINT_add_minusplus % #1 = -
- #3-\dummy \XINT_add_plusminus % #3 = -
- --\dummy \XINT_add_plusplus
+ #1#3\XINT_add_minusminus % #1 = #3 = -
+ #1-\XINT_add_minusplus % #1 = -
+ #3-\XINT_add_plusminus % #3 = -
+ --\XINT_add_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -11873,7 +12517,7 @@ first place.
% \begin{macrocode}
\def\XINT_add_minusminus #1#2#3#4%
{%
- \expandafter\xint_minus_andstop%
+ \expandafter\xint_minus_afterstop%
\romannumeral0\XINT_add_pre {#2}{#1}%
}%
\def\XINT_add_minusplus #1#2#3#4%
@@ -11935,13 +12579,13 @@ first place.
\def\XINT_sub_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_sub_minusminus
- #1-\dummy \XINT_sub_minusplus % attention, #3=0 possible
- #3-\dummy \XINT_sub_plusminus % attention, #1=0 possible
- --\dummy {\xint_UDzerofork
- #1\dummy \XINT_sub_secondiszero
- #3\dummy \XINT_sub_firstiszero
- 0\dummy \XINT_sub_plusplus
+ #1#3\XINT_sub_minusminus
+ #1-\XINT_sub_minusplus % attention, #3=0 possible
+ #3-\XINT_sub_plusminus % attention, #1=0 possible
+ --{\xint_UDzerofork
+ #1\XINT_sub_secondiszero
+ #3\XINT_sub_firstiszero
+ 0\XINT_sub_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -11963,7 +12607,7 @@ first place.
\def\xint_sub_mp0\XINT_add_pre #1#2{ #2}%
\def\XINT_sub_plusminus #1#2#3#4%
{%
- \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_andstop%
+ \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_afterstop%
\romannumeral0\XINT_add_pre {#2}{#3#1}%
}%
\def\xint_sub_pm #1\XINT_add_pre #2#3{ -#2}%
@@ -12022,8 +12666,8 @@ first place.
\W\XINT_sub_onestep #1#2#3#4#5#6#7%
{%
\xint_UDzerofork
- #1\dummy \XINT_sub_C % une retenue
- 0\dummy \XINT_sub_D % pas de retenue
+ #1\XINT_sub_C % une retenue
+ 0\XINT_sub_D % pas de retenue
\krof
{#7}#2#3#4#5%
}%
@@ -12110,13 +12754,13 @@ first place.
\def\xint_sub_F\W\XINT_sub_Eonestep #1#2#3#4%
{%
\xint_UDonezerofork
- #4#1\dummy {\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
- #1#4\dummy {\XINT_sub_Finc 1}% additionner 1. Et faire signe -
- 10\dummy \XINT_sub_DD % terminer. Mais avec signe -
+ #4#1{\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
+ #1#4{\XINT_sub_Finc 1}% additionner 1. Et faire signe -
+ 10\XINT_sub_DD % terminer. Mais avec signe -
\krof
{#3}%
}%
-\def\XINT_sub_DD {\expandafter\xint_minus_andstop\romannumeral0\XINT_sub_D }%
+\def\XINT_sub_DD {\expandafter\xint_minus_afterstop\romannumeral0\XINT_sub_D }%
\def\XINT_sub_Fdec #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_sub_Fdec_finish\W
@@ -12132,7 +12776,7 @@ first place.
}%
\def\xint_sub_Fdec_finish\W\XINT_sub_Fdec_onestep #1#2%
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_cuz
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_cuz
}%
\def\XINT_sub_Finc #1#2#3#4#5#6%
{%
@@ -12150,16 +12794,16 @@ first place.
\def\xint_sub_Finc_finish\W\XINT_sub_Finc_onestep #1#2#3%
{%
\xint_UDzerofork
- #1\dummy {\expandafter\xint_minus_andstop\xint_cleanupzeros_nospace}%
- 0\dummy { -1}%
+ #1{\expandafter\xint_minus_afterstop\xint_cleanupzeros_nospace}%
+ 0{ -1}%
\krof
#3%
}%
\def\xint_sub_ez\W\XINT_sub_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy \XINT_sub_K % il y a une retenue
- 0\dummy \XINT_sub_L % pas de retenue
+ #1\XINT_sub_K % il y a une retenue
+ 0\XINT_sub_L % pas de retenue
\krof
}%
\def\XINT_sub_L #1\W\X\Y\Z {\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z }%
@@ -12189,7 +12833,7 @@ first place.
}%
\def\xint_sub_KK_finish\W\XINT_sub_KK_onestep #1#2#3%
{%
- \expandafter\xint_minus_andstop
+ \expandafter\xint_minus_afterstop
\romannumeral0\XINT_cuz_loop #3\W\W\W\W\W\W\W\Z
}%
% \end{macrocode}
@@ -12217,14 +12861,14 @@ first place.
\def\XINT_cmp_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_cmp_minusminus
- #1-\dummy \XINT_cmp_minusplus
- #3-\dummy \XINT_cmp_plusminus
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_cmp_zerozero
- #10\dummy \XINT_cmp_zeroplus
- #30\dummy \XINT_cmp_pluszero
- 00\dummy \XINT_cmp_plusplus
+ #1#3\XINT_cmp_minusminus
+ #1-\XINT_cmp_minusplus
+ #3-\XINT_cmp_plusminus
+ --{\xint_UDzerosfork
+ #1#3\XINT_cmp_zerozero
+ #10\XINT_cmp_zeroplus
+ #30\XINT_cmp_pluszero
+ 00\XINT_cmp_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -12292,8 +12936,8 @@ first place.
\def\xint_cmp_ez\W\XINT_cmp_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy \XINT_cmp_K % il y a une retenue
- 0\dummy \XINT_cmp_L % pas de retenue
+ #1\XINT_cmp_K % il y a une retenue
+ 0\XINT_cmp_L % pas de retenue
\krof
}%
\def\XINT_cmp_K #1\Z { -1}%
@@ -12332,18 +12976,20 @@ first place.
\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
% \end{macrocode}
% \subsection{\csh{xintIsZero}, \csh{xintIsNotZero}}
-% \lverb|1.09a.|
+% \lverb|1.09a. restyled in 1.09i.|
% \begin{macrocode}
\def\xintIsZero {\romannumeral0\xintiszero }%
-\def\xintiszero #1{\xintifsgn {#1}{0}{1}{0}}%
+\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
-\def\xintisnotzero #1{\xintifsgn {#1}{1}{0}{1}}%
+\def\xintisnotzero
+ #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
% \end{macrocode}
-% \subsection{\csh{xintIsTrue}, \csh{xintNot}}
+% \subsection{\csh{xintIsTrue}, \csh{xintNot}, \csh{xintIsFalse}}
% \lverb|1.09c|
% \begin{macrocode}
\let\xintIsTrue\xintIsNotZero
\let\xintNot\xintIsZero
+\let\xintIsFalse\xintIsZero
% \end{macrocode}
% \subsection{\csh{xintIsTrue:csv}}
% \lverb|1.09c. For use by \xinttheboolexpr.|
@@ -12352,29 +12998,31 @@ first place.
\def\XINT_istrue:_a {\XINT_istrue:_b {}}%
\def\XINT_istrue:_b #1#2,%
{\expandafter\XINT_istrue:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_istrue:_f
+\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_istrue:_d\fi #1}%
\def\XINT_istrue:_d #1,%
{\expandafter\XINT_istrue:_e\romannumeral0\xintisnotzero {#1},}%
\def\XINT_istrue:_e #1,#2{\XINT_istrue:_b {#2,#1}}%
-\def\XINT_istrue:_f ,#1#2^{\xint_gobble_i #1}%
+\def\XINT_:_f ,#1#2^{\xint_gobble_i #1}%
% \end{macrocode}
% \subsection{\csh{xintAND}, \csh{xintOR}, \csh{xintXOR}}
-% \lverb|1.09a.|
+% \lverb|1.09a. Embarrasing bugs in \xintAND and \xintOR which inserted a space
+% token corrected in 1.09i. \xintxor restyled with \if (faster) in 1.09i|
% \begin{macrocode}
\def\xintAND {\romannumeral0\xintand }%
-\def\xintand #1#2{\xintifzero {#1}{0}{\xintifzero {#2}{0}{1}}}%
+\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ { 0}{\xintisnotzero{#2}}}%
\def\xintOR {\romannumeral0\xintor }%
-\def\xintor #1#2{\xintifzero {#1}{\xintifzero {#2}{0}{1}}{1}}%
+\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ {\xintisnotzero{#2}}{ 1}}%
\def\xintXOR {\romannumeral0\xintxor }%
-\def\xintxor #1#2{\ifcase \numexpr\xintIsZero{#1}+\xintIsZero{#2}\relax
- \xint_afterfi{ 0}%
- \or\xint_afterfi{ 1}%
- \else\xint_afterfi { 0}%
- \fi }%
+\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}%
+ \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }%
% \end{macrocode}
% \subsection{\csh{xintANDof}}
-% \lverb|New with 1.09a. \xintANDof works with an empty list.|
+% \lverb|New with 1.09a. \xintANDof works also with an empty list.|
% \begin{macrocode}
\def\xintANDof {\romannumeral0\xintandof }%
\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral-`0#1\relax }%
@@ -12382,7 +13030,7 @@ first place.
\def\XINT_andof_b #1%
{\xint_gob_til_relax #1\XINT_andof_e\relax\XINT_andof_c #1}%
\def\XINT_andof_c #1\Z
- {\xintifZero{#1}{\XINT_andof_no}{\XINT_andof_a}}%
+ {\xintifTrueAelseB {#1}{\XINT_andof_a}{\XINT_andof_no}}%
\def\XINT_andof_no #1\relax { 0}%
\def\XINT_andof_e #1\Z { 1}%
% \end{macrocode}
@@ -12393,7 +13041,7 @@ first place.
\def\XINT_andof:_a {\expandafter\XINT_andof:_b\romannumeral-`0}%
\def\XINT_andof:_b #1{\if #1,\expandafter\XINT_andof:_e
\else\expandafter\XINT_andof:_c\fi #1}%
-\def\XINT_andof:_c #1,{\xintifZero{#1}{\XINT_andof:_no}{\XINT_andof:_a}}%
+\def\XINT_andof:_c #1,{\xintifTrueAelseB {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
\def\XINT_andof:_no #1^{0}%
\def\XINT_andof:_e #1^{1}%
% \end{macrocode}
@@ -12406,7 +13054,7 @@ first place.
\def\XINT_orof_b #1%
{\xint_gob_til_relax #1\XINT_orof_e\relax\XINT_orof_c #1}%
\def\XINT_orof_c #1\Z
- {\xintifZero{#1}{\XINT_orof_a}{\XINT_orof_yes}}%
+ {\xintifTrueAelseB {#1}{\XINT_orof_yes}{\XINT_orof_a}}%
\def\XINT_orof_yes #1\relax { 1}%
\def\XINT_orof_e #1\Z { 0}%
% \end{macrocode}
@@ -12417,12 +13065,13 @@ first place.
\def\XINT_orof:_a {\expandafter\XINT_orof:_b\romannumeral-`0}%
\def\XINT_orof:_b #1{\if #1,\expandafter\XINT_orof:_e
\else\expandafter\XINT_orof:_c\fi #1}%
-\def\XINT_orof:_c #1,{\xintifZero{#1}{\XINT_orof:_a}{\XINT_orof:_yes}}%
+\def\XINT_orof:_c #1,{\xintifTrueAelseB{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
\def\XINT_orof:_yes #1^{1}%
\def\XINT_orof:_e #1^{0}%
% \end{macrocode}
% \subsection{\csh{xintXORof}}
-% \lverb|New with 1.09a. Works with an empty list, too.|
+% \lverb|New with 1.09a. Works with an empty list, too. \XINT_xorof_c more
+% efficient in 1.09i|
% \begin{macrocode}
\def\xintXORof {\romannumeral0\xintxorof }%
\def\xintxorof #1{\expandafter\XINT_xorof_a\expandafter
@@ -12431,11 +13080,9 @@ first place.
\def\XINT_xorof_b #1%
{\xint_gob_til_relax #1\XINT_xorof_e\relax\XINT_xorof_c #1}%
\def\XINT_xorof_c #1\Z #2%
- {\xintifZero {#1}{\XINT_xorof_a #2}{\ifcase #2
- \xint_afterfi{\XINT_xorof_a 1}%
- \else
- \xint_afterfi{\XINT_xorof_a 0}%
- \fi }%
+ {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof_a 1}%
+ \else\xint_afterfi{\XINT_xorof_a 0}\fi}%
+ {\XINT_xorof_a #2}%
}%
\def\XINT_xorof_e #1\Z #2{ #2}%
% \end{macrocode}
@@ -12445,16 +13092,14 @@ first place.
\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter
0\romannumeral-`0#1,,^}%
\def\XINT_xorof:_a #1#2,{\expandafter\XINT_xorof:_b\romannumeral-`0#2,#1}%
-\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_xorof:_e
+\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_xorof:_c\fi #1}%
\def\XINT_xorof:_c #1,#2%
- {\xintifZero {#1}{\XINT_xorof:_a #2}{\ifcase #2
- \xint_afterfi{\XINT_xorof:_a 1}%
- \else
- \xint_afterfi{\XINT_xorof:_a 0}%
- \fi }%
+ {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
+ \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
+ {\XINT_xorof:_a #2}%
}%
-\def\XINT_xorof:_e ,#1#2^{#1}% allows empty list
+\def\XINT_:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
% \subsection{\csh{xintGeq}}
% \lverb|&
@@ -12481,13 +13126,13 @@ first place.
\def\XINT_geq_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_geq_secondiszero % |#1#2|=0
- #3\dummy \XINT_geq_firstiszero % |#1#2|>0
- 0\dummy {\xint_UDsignsfork
- #1#3\dummy \XINT_geq_minusminus
- #1-\dummy \XINT_geq_minusplus
- #3-\dummy \XINT_geq_plusminus
- --\dummy \XINT_geq_plusplus
+ #1\XINT_geq_secondiszero % |#1#2|=0
+ #3\XINT_geq_firstiszero % |#1#2|>0
+ 0{\xint_UDsignsfork
+ #1#3\XINT_geq_minusminus
+ #1-\XINT_geq_minusplus
+ #3-\XINT_geq_plusminus
+ --\XINT_geq_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -12548,8 +13193,8 @@ first place.
\def\xint_geq_ez\W\XINT_geq_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy { 0} % il y a une retenue
- 0\dummy { 1} % pas de retenue
+ #1{ 0} % il y a une retenue
+ 0{ 1} % pas de retenue
\krof
}%
% \end{macrocode}
@@ -12581,14 +13226,14 @@ first place.
\def\XINT_max_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_max_minusminus % A < 0, B < 0
- #1-\dummy \XINT_max_minusplus % B < 0, A >= 0
- #3-\dummy \XINT_max_plusminus % A < 0, B >= 0
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_max_zerozero % A = B = 0
- #10\dummy \XINT_max_zeroplus % B = 0, A > 0
- #30\dummy \XINT_max_pluszero % A = 0, B > 0
- 00\dummy \XINT_max_plusplus % A, B > 0
+ #1#3\XINT_max_minusminus % A < 0, B < 0
+ #1-\XINT_max_minusplus % B < 0, A >= 0
+ #3-\XINT_max_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_max_zerozero % A = B = 0
+ #10\XINT_max_zeroplus % B = 0, A > 0
+ #30\XINT_max_pluszero % A = 0, B > 0
+ 00\XINT_max_plusplus % A, B > 0
\krof }%
\krof
{#2}{#4}#1#3%
@@ -12597,17 +13242,17 @@ first place.
% \lverb|&
% A = #4#2, B = #3#1|
% \begin{macrocode}
-\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_andstop }%
+\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_afterstop }%
\def\XINT_max_plusplus #1#2#3#4%
{%
\ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\else
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -12616,9 +13261,9 @@ first place.
\def\XINT_max_minusminus #1#2#3#4%
{%
\ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\else
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -12637,6 +13282,16 @@ first place.
\def\XINT_imaxof_e #1\Z #2\Z { #2}%
\let\xintMaxof\xintiMaxof \let\xintmaxof\xintimaxof
% \end{macrocode}
+% \subsection{\csh{xintiMaxof:csv}}
+% \lverb|1.09i. For use by \xintiiexpr.|
+% \begin{macrocode}
+\def\xintiMaxof:csv #1{\expandafter\XINT_imaxof:_b\romannumeral-`0#1,,}%
+\def\XINT_imaxof:_b #1,#2,{\expandafter\XINT_imaxof:_c\romannumeral-`0#2,{#1},}%
+\def\XINT_imaxof:_c #1{\if #1,\expandafter\XINT_of:_e
+ \else\expandafter\XINT_imaxof:_d\fi #1}%
+\def\XINT_imaxof:_d #1,{\expandafter\XINT_imaxof:_b\romannumeral0\xintimax {#1}}%
+\def\XINT_of:_e ,#1,{#1}%
+% \end{macrocode}
% \subsection{\csh{xintMin}}
% \lverb|\xintnum added New with 1.09a.|
% \begin{macrocode}
@@ -12660,14 +13315,14 @@ first place.
\def\XINT_min_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_min_minusminus % A < 0, B < 0
- #1-\dummy \XINT_min_minusplus % B < 0, A >= 0
- #3-\dummy \XINT_min_plusminus % A < 0, B >= 0
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_min_zerozero % A = B = 0
- #10\dummy \XINT_min_zeroplus % B = 0, A > 0
- #30\dummy \XINT_min_pluszero % A = 0, B > 0
- 00\dummy \XINT_min_plusplus % A, B > 0
+ #1#3\XINT_min_minusminus % A < 0, B < 0
+ #1-\XINT_min_minusplus % B < 0, A >= 0
+ #3-\XINT_min_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_min_zerozero % A = B = 0
+ #10\XINT_min_zeroplus % B = 0, A > 0
+ #30\XINT_min_pluszero % A = 0, B > 0
+ 00\XINT_min_plusplus % A, B > 0
\krof }%
\krof
{#2}{#4}#1#3%
@@ -12676,17 +13331,17 @@ first place.
% \lverb|&
% A = #4#2, B = #3#1|
% \begin{macrocode}
-\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_andstop }%
+\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_afterstop }%
\def\XINT_min_plusplus #1#2#3#4%
{%
\ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\else
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -12695,9 +13350,9 @@ first place.
\def\XINT_min_minusminus #1#2#3#4%
{%
\ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\else
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -12716,6 +13371,15 @@ first place.
\def\XINT_iminof_e #1\Z #2\Z { #2}%
\let\xintMinof\xintiMinof \let\xintminof\xintiminof
% \end{macrocode}
+% \subsection{\csh{xintiMinof:csv}}
+% \lverb|1.09i. For use by \xintiiexpr.|
+% \begin{macrocode}
+\def\xintiMinof:csv #1{\expandafter\XINT_iminof:_b\romannumeral-`0#1,,}%
+\def\XINT_iminof:_b #1,#2,{\expandafter\XINT_iminof:_c\romannumeral-`0#2,{#1},}%
+\def\XINT_iminof:_c #1{\if #1,\expandafter\XINT_of:_e
+ \else\expandafter\XINT_iminof:_d\fi #1}%
+\def\XINT_iminof:_d #1,{\expandafter\XINT_iminof:_b\romannumeral0\xintimin {#1}}%
+% \end{macrocode}
% \subsection{\csh{xintSum}, \csh{xintSumExpr}}
% \lverb|&
% \xintSum {{a}{b}...{z}}$\
@@ -12745,8 +13409,8 @@ first place.
\xint_gob_til_relax #1\XINT_sum_finished\relax
\xint_gob_til_zero #1\XINT_sum_skipzeroinput0%
\xint_UDsignfork
- #1\dummy \XINT_sum_N
- -\dummy {\XINT_sum_P #1}%
+ #1\XINT_sum_N
+ -{\XINT_sum_P #1}%
\krof
}%
\def\XINT_sum_finished #1\Z #2#3%
@@ -12772,6 +13436,17 @@ first place.
}%
\def\XINT_sum_NN #1#2{\XINT_sum_loop {#2}{#1}}%
% \end{macrocode}
+% \subsection{\csh{xintiiSum:csv}}
+% \lverb|1.09i. For use by \xintiiexpr.|
+% \begin{macrocode}
+\def\xintiiSum:csv #1{\expandafter\XINT_iisum:_a\romannumeral-`0#1,,^}%
+\def\XINT_iisum:_a {\XINT_iisum:_b {0}}%
+\def\XINT_iisum:_b #1#2,{\expandafter\XINT_iisum:_c\romannumeral-`0#2,{#1}}%
+\def\XINT_iisum:_c #1{\if #1,\expandafter\XINT_:_e
+ \else\expandafter\XINT_iisum:_d\fi #1}%
+\def\XINT_iisum:_d #1,#2{\expandafter\XINT_iisum:_b\expandafter
+ {\romannumeral0\xintiiadd {#2}{#1}}}%
+% \end{macrocode}
% \subsection{\csh{xintMul}}
% \lverb|1.09a adds \xintnum|
% \begin{macrocode}
@@ -12812,14 +13487,13 @@ first place.
\def\XINT_mul_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_mul_zero
- #3\dummy \XINT_mul_zero
- 0\dummy
- {\xint_UDsignsfork
- #1#3\dummy \XINT_mul_minusminus % #1 = #3 = -
- #1-\dummy {\XINT_mul_minusplus #3}% % #1 = -
- #3-\dummy {\XINT_mul_plusminus #1}% % #3 = -
- --\dummy {\XINT_mul_plusplus #1#3}%
+ #1\XINT_mul_zero
+ #3\XINT_mul_zero
+ 0{\xint_UDsignsfork
+ #1#3\XINT_mul_minusminus % #1 = #3 = -
+ #1-{\XINT_mul_minusplus #3}% % #1 = -
+ #3-{\XINT_mul_plusminus #1}% % #3 = -
+ --{\XINT_mul_plusplus #1#3}%
\krof }%
\krof
{#2}{#4}%
@@ -12833,14 +13507,14 @@ first place.
}%
\def\XINT_mul_minusplus #1#2#3%
{%
- \expandafter\xint_minus_andstop\romannumeral0\expandafter
+ \expandafter\xint_minus_afterstop\romannumeral0\expandafter
\XINT_mul_choice_a
\expandafter{\romannumeral0\xintlength {#1#3}}%
{\romannumeral0\xintlength {#2}}{#2}{#1#3}%
}%
\def\XINT_mul_plusminus #1#2#3%
{%
- \expandafter\xint_minus_andstop\romannumeral0\expandafter
+ \expandafter\xint_minus_afterstop\romannumeral0\expandafter
\XINT_mul_choice_a
\expandafter{\romannumeral0\xintlength {#3}}%
{\romannumeral0\xintlength {#1#2}}{#1#2}{#3}%
@@ -13032,9 +13706,9 @@ first place.
{%
\XINT_mul_M_end #1#4%
}%
-\def\XINT_mul_M_end #1#2#3#4#5#6#7#8%
+\edef\XINT_mul_M_end #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
% \end{macrocode}
% \lverb|&
@@ -13308,6 +13982,17 @@ first place.
}%
\def\XINT_prod_finished #1\Z #2\Z \Z { #2}%
% \end{macrocode}
+% \subsection{\csh{xintiiPrd:csv}}
+% \lverb|1.09i. For use by \xintiiexpr.|
+% \begin{macrocode}
+\def\xintiiPrd:csv #1{\expandafter\XINT_iiprd:_a\romannumeral-`0#1,,^}%
+\def\XINT_iiprd:_a {\XINT_iiprd:_b {1}}%
+\def\XINT_iiprd:_b #1#2,{\expandafter\XINT_iiprd:_c\romannumeral-`0#2,{#1}}%
+\def\XINT_iiprd:_c #1{\if #1,\expandafter\XINT_:_e
+ \else\expandafter\XINT_iiprd:_d\fi #1}%
+\def\XINT_iiprd:_d #1,#2{\expandafter\XINT_iiprd:_b\expandafter
+ {\romannumeral0\xintiimul {#2}{#1}}}%
+% \end{macrocode}
% \subsection{\csh{xintFac}}
% \lverb|&
% Modified with 1.02 and again in 1.03 for greater efficiency. I am
@@ -13327,7 +14012,7 @@ first place.
\let\xintFac\xintiFac \let\xintfac\xintifac
\def\XINT_fac_fork #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\xint_afterfi{\expandafter\space\expandafter 1\xint_gobble_i }%
\or
\expandafter\XINT_fac_checklength
@@ -13430,8 +14115,8 @@ first place.
\def\xint_pow #1#2\Z
{%
\xint_UDsignfork
- #1\dummy \XINT_pow_Aneg
- -\dummy \XINT_pow_Anonneg
+ #1\XINT_pow_Aneg
+ -\XINT_pow_Anonneg
\krof
#1{#2}%
}%
@@ -13479,7 +14164,7 @@ first place.
% \begin{macrocode}
\def\XINT_pow_AisZero #1#2%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\xint_afterfi { 1}%
\or
\xint_afterfi { 0}%
@@ -13489,7 +14174,7 @@ first place.
}%
\def\XINT_pow_AatleastTwo #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_pow_BisZero
\or
\expandafter\XINT_pow_checkBsize
@@ -13498,7 +14183,7 @@ first place.
\fi
{#1}%
}%
-\def\XINT_pow_BisNegative #1#2{\xintError:FractionRoundedToZero\space 0}%
+\edef\XINT_pow_BisNegative #1#2{\noexpand\xintError:FractionRoundedToZero\space 0}%
\def\XINT_pow_BisZero #1#2{ 1}%
% \end{macrocode}
% \lverb|&
@@ -13520,8 +14205,8 @@ first place.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_pow_BtooBig #1\xint_relax #2\xint_relax
- {\xintError:ExponentTooBig\space 0}%
+\edef\XINT_pow_BtooBig #1\xint_relax #2\xint_relax
+ {\noexpand\xintError:ExponentTooBig\space 0}%
\def\XINT_pow_loop #1#2%
{%
\ifnum #1 = 1
@@ -13600,15 +14285,15 @@ first place.
% \begin{macrocode}
\def\xintiiQuo {\romannumeral0\xintiiquo }%
\def\xintiiRem {\romannumeral0\xintiirem }%
-\def\xintiiquo {\expandafter\xint_firstoftwo_andstop
+\def\xintiiquo {\expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintiidivision }%
-\def\xintiirem {\expandafter\xint_secondoftwo_andstop
+\def\xintiirem {\expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintiidivision }%
\def\xintQuo {\romannumeral0\xintquo }%
\def\xintRem {\romannumeral0\xintrem }%
-\def\xintquo {\expandafter\xint_firstoftwo_andstop
+\def\xintquo {\expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintdivision }%
-\def\xintrem {\expandafter\xint_secondoftwo_andstop
+\def\xintrem {\expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintdivision }%
% \end{macrocode}
% \lverb|&
@@ -13641,18 +14326,17 @@ first place.
\def\XINT_div_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_div_BisZero
- #3\dummy \XINT_div_AisZero
- 0\dummy
- {\xint_UDsignfork
- #1\dummy \XINT_div_BisNegative % B < 0
- #3\dummy \XINT_div_AisNegative % A < 0, B > 0
- -\dummy \XINT_div_plusplus % B > 0, A > 0
+ #1\XINT_div_BisZero
+ #3\XINT_div_AisZero
+ 0{\xint_UDsignfork
+ #1\XINT_div_BisNegative % B < 0
+ #3\XINT_div_AisNegative % A < 0, B > 0
+ -\XINT_div_plusplus % B > 0, A > 0
\krof }%
\krof
{#2}{#4}#1#3% #1#2=B, #3#4=A
}%
-\def\XINT_div_BisZero #1#2#3#4{\xintError:DivisionByZero\space {0}{0}}%
+\edef\XINT_div_BisZero #1#2#3#4{\noexpand\xintError:DivisionByZero\space {0}{0}}%
\def\XINT_div_AisZero #1#2#3#4{ {0}{0}}%
% \end{macrocode}
% \lverb|&
@@ -13678,9 +14362,10 @@ first place.
\expandafter\XINT_div_BisNegative_post
\romannumeral0\XINT_div_fork #1\Z #4#2\Z
}%
-\def\XINT_div_BisNegative_post #1%
+\edef\XINT_div_BisNegative_post #1%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_opp #1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_opp #1}%
}%
% \end{macrocode}
% \lverb|&
@@ -13693,9 +14378,9 @@ first place.
}%
\def\XINT_div_AisNegative_post #1#2%
{%
- \ifcase\XINT_Sgn {#2}
+ \if0\XINT_Sgn #2\Z
\expandafter \XINT_div_AisNegative_zerorem
- \or
+ \else
\expandafter \XINT_div_AisNegative_posrem
\fi
{#1}{#2}%
@@ -13704,9 +14389,10 @@ first place.
% \lverb|&
% en #3 on a une copie de B (à l'endroit)|
% \begin{macrocode}
-\def\XINT_div_AisNegative_zerorem #1#2#3%
+\edef\XINT_div_AisNegative_zerorem #1#2#3%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_opp #1}{0}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_opp #1}{0}%
}%
% \end{macrocode}
% \lverb!#1 = quotient, #2 = reste, #3 = diviseur initial (à l'endroit)
@@ -13720,7 +14406,7 @@ first place.
}%
\def\XINT_div_AisNegative_posrem_b #1#2#3%
{%
- \expandafter \xint_exchangetwo_keepbraces_andstop \expandafter
+ \expandafter \xint_exchangetwo_keepbraces_afterstop \expandafter
{\romannumeral0\XINT_sub {#3}{#2}}{#1}%
}%
% \end{macrocode}
@@ -13882,18 +14568,19 @@ first place.
% \begin{macrocode}
\def\XINT_div_finished_b #1#2#3#4#5%
{%
- \ifcase \XINT_Sgn {#1}
+ \if0\XINT_Sgn #1\Z
\xint_afterfi {\XINT_div_finished_c {0}}%
- \or
+ \else
\xint_afterfi {\expandafter\XINT_div_finished_c\expandafter
{\romannumeral0\XINT_dsh_checksignx #5\Z {#1}}%
}%
\fi
{#2}%
}%
-\def\XINT_div_finished_c #1#2%
+\edef\XINT_div_finished_c #1#2%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_rev_andcuz {#2}}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_rev_andcuz {#2}}{#1}%
}%
% \end{macrocode}
% \lverb|&
@@ -13957,33 +14644,35 @@ first place.
{\romannumeral0\XINT_mul_M {#1}#5\Z\Z\Z\Z }}%
{#1}{#2}{#3}{#4}{#5}%
}%
-\def\XINT_div_final_dc #1#2%
+\def\XINT_div_final_dc #1#2% 1.09i re-styles the conditional here
{%
- \ifnum\XINT_Sgn{#1}<\xint_c_
- \xint_afterfi
- {\expandafter\XINT_div_final_dP\the\numexpr #2-\xint_c_i\relax}%
- \else \xint_afterfi {\XINT_div_final_e {#1}#2}%
+ \ifnum\XINT__Sgn #1\Z<\xint_c_
+ \expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo
\fi
+ {\expandafter\XINT_div_final_dP\the\numexpr #2-\xint_c_i\relax}%
+ {\XINT_div_final_e {#1}#2}%
}%
\def\XINT_div_final_e #1#2#3#4#5#6% A final, q, trash, Q, L, B
{%
\XINT_div_final_f {#1}%
{\romannumeral0\XINT_add_A 0{}#2000\W\X\Y\Z #4\W\X\Y\Z }%
}%
-\def\XINT_div_final_f #1#2#3% R,Q \`a d\'evelopper,c
+\def\XINT_div_final_f #1#2#3% R,Q \`a d\'evelopper,c. re-styled in 1.09i
{%
- \ifcase \XINT_Sgn {#1}
- \xint_afterfi {\XINT_div_final_end {0}}%
- \or
- \xint_afterfi {\expandafter\XINT_div_final_end\expandafter
+ \if0\XINT_Sgn #1\Z
+ \expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo
+ \fi
+ {\XINT_div_final_end {0}}%
+ {\expandafter\XINT_div_final_end\expandafter
{\romannumeral0\XINT_dsh_checksignx #3\Z {#1}}%
}%
- \fi
{#2}%
}%
-\def\XINT_div_final_end #1#2%
+\edef\XINT_div_final_end #1#2%
{%
- \expandafter\space\expandafter {#2}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter {#2}{#1}%
}%
% \end{macrocode}
% \lverb|&
@@ -14037,8 +14726,8 @@ first place.
\def\XINT_div_body_gg #1#2#3#4#5#6%
{%
\xint_UDzerofork
- #2\dummy \XINT_div_body_gk
- 0\dummy {\XINT_div_body_ggk #2}%
+ #2\XINT_div_body_gk
+ 0{\XINT_div_body_ggk #2}%
\krof
{#3#4#5#6}%
}%
@@ -14231,8 +14920,8 @@ first place.
\def\xint_div_sub_bz\W\XINT_div_sub_onestep #1#2#3#4#5#6#7%
{%
\xint_UDzerofork
- #1\dummy \XINT_div_sub_C %
- 0\dummy \XINT_div_sub_D % pas de retenue
+ #1\XINT_div_sub_C %
+ 0\XINT_div_sub_D % pas de retenue
\krof
{#7}#2#3#4#5%
}%
@@ -14305,9 +14994,9 @@ first place.
\def\XINT_fdg #1#2#3\Z
{%
\xint_UDzerominusfork
- #1-\dummy { 0}% zero
- 0#1\dummy { #2}% negative
- 0-\dummy { #1}% positive
+ #1-{ 0}% zero
+ 0#1{ #2}% negative
+ 0-{ #1}% positive
\krof
}%
% \end{macrocode}
@@ -14464,15 +15153,15 @@ first place.
\def\XINT_dshr_checkxpositive #1%
{%
\xint_UDzerominusfork
- 0#1\dummy \XINT_dshr_xzeroorneg
- #1-\dummy \XINT_dshr_xzeroorneg
- 0-\dummy \XINT_dshr_xpositive
+ 0#1\XINT_dshr_xzeroorneg
+ #1-\XINT_dshr_xzeroorneg
+ 0-\XINT_dshr_xpositive
\krof #1%
}%
\def\XINT_dshr_xzeroorneg #1\Z #2{ 0}%
\def\XINT_dshr_xpositive #1\Z
{%
- \expandafter\xint_secondoftwo_andstop\romannumeral0\xintdsx {#1}%
+ \expandafter\xint_secondoftwo_afterstop\romannumeral0\xintdsx {#1}%
}%
\def\xintDSH {\romannumeral0\xintdsh }%
\def\xintdsh #1#2%
@@ -14486,15 +15175,15 @@ first place.
\def\XINT_dsh_checksignx #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsh_xiszero
- 0#1\dummy \XINT_dsx_xisNeg_checkA % on passe direct dans DSx
- 0-\dummy {\XINT_dsh_xisPos #1}%
+ #1-\XINT_dsh_xiszero
+ 0#1\XINT_dsx_xisNeg_checkA % on passe direct dans DSx
+ 0-{\XINT_dsh_xisPos #1}%
\krof
}%
\def\XINT_dsh_xiszero #1\Z #2{ #2}%
\def\XINT_dsh_xisPos #1\Z #2%
{%
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\romannumeral0\XINT_dsx_checksignA #2\Z {#1}% via DSx
}%
% \end{macrocode}
@@ -14542,9 +15231,9 @@ first place.
\def\XINT_dsx_checksignx #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsx_xisZero
- 0#1\dummy \XINT_dsx_xisNeg_checkA
- 0-\dummy {\XINT_dsx_xisPos #1}%
+ #1-\XINT_dsx_xisZero
+ 0#1\XINT_dsx_xisNeg_checkA
+ 0-{\XINT_dsx_xisPos #1}%
\krof
}%
\def\XINT_dsx_xisZero #1\Z #2{ {#2}{0}}% attention comme x > 0
@@ -14591,9 +15280,9 @@ first place.
\def\XINT_dsx_checksignA #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsx_AisZero
- 0#1\dummy \XINT_dsx_AisNeg
- 0-\dummy {\XINT_dsx_AisPos #1}%
+ #1-\XINT_dsx_AisZero
+ 0#1\XINT_dsx_AisNeg
+ 0-{\XINT_dsx_AisPos #1}%
\krof
}%
\def\XINT_dsx_AisZero #1\Z #2{ {0}{0}}%
@@ -14633,9 +15322,9 @@ first place.
\expandafter {\romannumeral0\XINT_num {#2}}%
{\romannumeral0\XINT_num {#1}}%
}%
-\def\XINT_dsx_end #1#2%
+\edef\XINT_dsx_end #1#2%
{%
- \expandafter\space\expandafter{#2}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter{#2}{#1}%
}%
% \end{macrocode}
% \subsection{\csh{xintDecSplit}, \csh{xintDecSplitL}, \csh{xintDecSplitR}}
@@ -14670,12 +15359,12 @@ first place.
\def\xintDecSplitR {\romannumeral0\xintdecsplitr }%
\def\xintdecsplitl
{%
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintdecsplit
}%
\def\xintdecsplitr
{%
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintdecsplit
}%
\def\xintDecSplit {\romannumeral0\xintdecsplit }%
@@ -14699,7 +15388,7 @@ first place.
}%
\def\XINT_split_bigx #1\Z #2%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\or \xint_afterfi { {}{#2}}% positive big x
\else
\xint_afterfi { {#2}{}}% negative big x
@@ -14708,9 +15397,9 @@ first place.
\def\XINT_split_xfork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_split_zerosplit
- 0#1\dummy \XINT_split_fromleft
- 0-\dummy {\XINT_split_fromright #1}%
+ #1-\XINT_split_zerosplit
+ 0#1\XINT_split_fromleft
+ 0-{\XINT_split_fromright #1}%
\krof
}%
\def\XINT_split_zerosplit #1\Z #2{ {#2}{}}%
@@ -14796,9 +15485,10 @@ first place.
{%
\csname XINT_split_fromright_endsplit_\romannumeral #1\endcsname
}%
-\def\XINT_split_fromright_endsplit_ #1#2\W #3\Z #4%
+\edef\XINT_split_fromright_endsplit_ #1#2\W #3\Z #4%
{%
- \expandafter\space\expandafter {\romannumeral0\xintreverseorder {#2}}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\xintreverseorder {#2}}{#1}%
}%
\def\XINT_split_fromright_endsplit_i #1#2%
{\XINT_split_fromright_checkiftoofar #2{#2#1}}%
@@ -14834,14 +15524,14 @@ first place.
\def\XINT_dbl #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dbl_zero
- 0#1\dummy \XINT_dbl_neg
- 0-\dummy {\XINT_dbl_pos #1}%
+ #1-\XINT_dbl_zero
+ 0#1\XINT_dbl_neg
+ 0-{\XINT_dbl_pos #1}%
\krof
}%
\def\XINT_dbl_zero #1\Z \W\W\W\W\W\W\W { 0}%
\def\XINT_dbl_neg
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_dbl_pos }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dbl_pos }%
\def\XINT_dbl_pos
{%
\expandafter\XINT_dbl_a \expandafter{\expandafter}\expandafter 0%
@@ -14861,9 +15551,9 @@ first place.
{%
\expandafter\XINT_dbl_end_b #2#4%
}%
-\def\XINT_dbl_end_b #1#2#3#4#5#6#7#8%
+\edef\XINT_dbl_end_b #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
% \end{macrocode}
% \subsection{\csh{xintHalf}}
@@ -14878,9 +15568,9 @@ first place.
\def\XINT_half #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_half_zero
- 0#1\dummy \XINT_half_neg
- 0-\dummy {\XINT_half_pos #1}%
+ #1-\XINT_half_zero
+ 0#1\XINT_half_neg
+ 0-{\XINT_half_pos #1}%
\krof
}%
\def\XINT_half_zero #1\Z \W\W\W\W\W\W\W { 0}%
@@ -14892,11 +15582,11 @@ first place.
\expandafter\XINT_half_b
\the\numexpr \xint_c_x^viii+\xint_c_v*#7#6#5#4#3#2#1\relax #8%
}%
-\def\XINT_half_dont\W\expandafter\XINT_half_b
+\edef\XINT_half_dont\W\expandafter\XINT_half_b
\the\numexpr \xint_c_x^viii+\xint_c_v*#1#2#3#4#5#6#7\relax \W\W\W\W\W\W\W
{%
- \expandafter\space
- \the\numexpr (#1#2#3#4#5#6#7+\xint_c_i)/\xint_c_ii-\xint_c_i \relax
+ \noexpand\expandafter\space
+ \noexpand\the\numexpr (#1#2#3#4#5#6#7+\xint_c_i)/\xint_c_ii-\xint_c_i \relax
}%
\def\XINT_half_b 1#1#2#3#4#5#6#7#8%
{%
@@ -14916,9 +15606,9 @@ first place.
{%
\xint_gob_til_zero #1\XINT_half_end_b 0\space #1#3%
}%
-\def\XINT_half_end_b 0\space 0#1#2#3#4#5#6#7%
+\edef\XINT_half_end_b 0\space 0#1#2#3#4#5#6#7%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7\relax
}%
% \end{macrocode}
% \subsection{\csh{xintDec}}
@@ -14933,14 +15623,14 @@ first place.
\def\XINT_dec #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dec_zero
- 0#1\dummy \XINT_dec_neg
- 0-\dummy {\XINT_dec_pos #1}%
+ #1-\XINT_dec_zero
+ 0#1\XINT_dec_neg
+ 0-{\XINT_dec_pos #1}%
\krof
}%
\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
\def\XINT_dec_neg
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_inc_pos }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_inc_pos }%
\def\XINT_dec_pos
{%
\expandafter\XINT_dec_a \expandafter{\expandafter}%
@@ -14968,8 +15658,8 @@ first place.
\xint_relax
#1%
}%
-\def\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
-{\expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax }%
+\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
% \end{macrocode}
% \subsection{\csh{xintInc}}
% \lverb!v1.08!
@@ -14983,9 +15673,9 @@ first place.
\def\XINT_inc #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_inc_zero
- 0#1\dummy \XINT_inc_neg
- 0-\dummy {\XINT_inc_pos #1}%
+ #1-\XINT_inc_zero
+ 0#1\XINT_inc_neg
+ 0-{\XINT_inc_pos #1}%
\krof
}%
\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
@@ -15030,13 +15720,13 @@ first place.
\def\XINT_sqrt_checkin #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_sqrt_iszero
- 0#1\dummy \XINT_sqrt_isneg
- 0-\dummy {\XINT_sqrt #1}%
+ #1-\XINT_sqrt_iszero
+ 0#1\XINT_sqrt_isneg
+ 0-{\XINT_sqrt #1}%
\krof
}%
\def\XINT_sqrt_iszero #1\Z { 1.}% 1.09e was wrong from inception in 1.08 :-((
-\def\XINT_sqrt_isneg #1\Z {\xintError:RootOfNegative\space 1.}%
+\edef\XINT_sqrt_isneg #1\Z {\noexpand\xintError:RootOfNegative\space 1.}%
\def\XINT_sqrt #1\Z
{%
\expandafter\XINT_sqrt_start\expandafter
@@ -15199,9 +15889,9 @@ first place.
}%
\def\XINT_sqrt_big_j #1%
{%
- \ifcase\XINT_Sgn {#1}
- \expandafter \XINT_sqrt_big_end
- \or \expandafter \XINT_sqrt_big_k
+ \if0\XINT_Sgn #1\Z
+ \expandafter \XINT_sqrt_big_end
+ \else \expandafter \XINT_sqrt_big_k
\fi {#1}%
}%
\def\XINT_sqrt_big_k #1#2#3%
@@ -15216,7 +15906,6 @@ first place.
{#2}{#1}%
}%
\def\XINT_sqrt_big_end #1#2#3#4{ {#3}{#2}}%
-\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -15330,7 +16019,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2013/11/28 v1.09h Expandable binary and hexadecimal conversions (jfB)]%
+ [2013/12/18 v1.09i Expandable binary and hexadecimal conversions (jfB)]%
% \end{macrocode}
% \subsection{Constants, etc...}
% \lverb!v1.08!
@@ -15448,11 +16137,11 @@ first place.
\def\XINT_dth_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_dth_N
- -\dummy {\XINT_dth_P #1}%
+ #1\XINT_dth_N
+ -{\XINT_dth_P #1}%
\krof
}%
-\def\XINT_dth_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_dth_P }%
+\def\XINT_dth_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dth_P }%
\def\XINT_dth_P {\expandafter\XINT_dth_III\romannumeral-`0\XINT_dtbh_I {0.}}%
\def\xintDecToBin {\romannumeral0\xintdectobin }%
\def\xintdectobin #1%
@@ -15460,11 +16149,11 @@ first place.
\def\XINT_dtb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_dtb_N
- -\dummy {\XINT_dtb_P #1}%
+ #1\XINT_dtb_N
+ -{\XINT_dtb_P #1}%
\krof
}%
-\def\XINT_dtb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_dtb_P }%
+\def\XINT_dtb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dtb_P }%
\def\XINT_dtb_P {\expandafter\XINT_dtb_III\romannumeral-`0\XINT_dtbh_I {0.}}%
\def\XINT_dtbh_I #1#2#3#4#5%
{%
@@ -15586,9 +16275,9 @@ first place.
{%
\expandafter\XINT_dtb_end_d\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
-\def\XINT_dtb_end_d #1#2#3#4#5#6#7#8#9%
+\edef\XINT_dtb_end_d #1#2#3#4#5#6#7#8#9%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8#9\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8#9\relax
}%
% \end{macrocode}
% \subsection{\csh{xintHexToDec}}
@@ -15600,11 +16289,11 @@ first place.
\def\XINT_htd_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_htd_neg
- -\dummy {\XINT_htd_I {0000}#1}%
+ #1\XINT_htd_neg
+ -{\XINT_htd_I {0000}#1}%
\krof
}%
-\def\XINT_htd_neg {\expandafter\xint_minus_andstop
+\def\XINT_htd_neg {\expandafter\xint_minus_afterstop
\romannumeral0\XINT_htd_I {0000}}%
\def\XINT_htd_I #1#2#3#4#5%
{%
@@ -15674,9 +16363,9 @@ first place.
{%
\XINT_htd_II_end_b #1#3%
}%
-\def\XINT_htd_II_end_b #1#2#3#4#5#6#7#8%
+\edef\XINT_htd_II_end_b #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
% \end{macrocode}
% \subsection{\csh{xintBinToDec}}
@@ -15688,11 +16377,11 @@ first place.
\def\XINT_btd_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_btd_neg
- -\dummy {\XINT_btd_I {000000}#1}%
+ #1\XINT_btd_neg
+ -{\XINT_btd_I {000000}#1}%
\krof
}%
-\def\XINT_btd_neg {\expandafter\xint_minus_andstop
+\def\XINT_btd_neg {\expandafter\xint_minus_afterstop
\romannumeral0\XINT_btd_I {000000}}%
\def\XINT_btd_I #1#2#3#4#5#6#7#8#9%
{%
@@ -15723,9 +16412,9 @@ first place.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_btd_II_c_end #1#2#3#4#5#6%
+\edef\XINT_btd_II_c_end #1#2#3#4#5#6%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6\relax
}%
\def\XINT_btd_II_ci #1\XINT_btd_II_cvii #2\W\W\W\W\W\W\W
{\XINT_btd_II_d {}{#2}{\xint_c_ii }}%
@@ -15763,9 +16452,9 @@ first place.
{%
\XINT_btd_II_end_b #1#3%
}%
-\def\XINT_btd_II_end_b #1#2#3#4#5#6#7#8#9%
+\edef\XINT_btd_II_end_b #1#2#3#4#5#6#7#8#9%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8#9\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8#9\relax
}%
\def\XINT_btd_I_a #1#2#3#4#5#6#7#8%
{%
@@ -15804,11 +16493,11 @@ first place.
\def\XINT_bth_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_bth_N
- -\dummy {\XINT_bth_P #1}%
+ #1\XINT_bth_N
+ -{\XINT_bth_P #1}%
\krof
}%
-\def\XINT_bth_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_bth_P }%
+\def\XINT_bth_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_bth_P }%
\def\XINT_bth_P {\expandafter\XINT_bth_I\expandafter{\expandafter}%
\romannumeral0\XINT_OQ {}}%
\def\XINT_bth_I #1#2#3#4#5#6#7#8#9%
@@ -15842,11 +16531,11 @@ first place.
\def\XINT_htb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_htb_N
- -\dummy {\XINT_htb_P #1}%
+ #1\XINT_htb_N
+ -{\XINT_htb_P #1}%
\krof
}%
-\def\XINT_htb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_htb_P }%
+\def\XINT_htb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_htb_P }%
\def\XINT_htb_P {\XINT_htb_I_a {}}%
\def\XINT_htb_I_a #1#2#3#4#5#6#7#8#9%
{%
@@ -15887,11 +16576,11 @@ first place.
\def\XINT_chtb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_chtb_N
- -\dummy {\XINT_chtb_P #1}%
+ #1\XINT_chtb_N
+ -{\XINT_chtb_P #1}%
\krof
}%
-\def\XINT_chtb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_chtb_P }%
+\def\XINT_chtb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_chtb_P }%
\def\XINT_chtb_P {\expandafter\XINT_chtb_I\expandafter{\expandafter}%
\romannumeral0\XINT_OQ {}}%
\def\XINT_chtb_I #1#2#3#4#5#6#7#8#9%
@@ -16038,7 +16727,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2013/11/28 v1.09h Euclide algorithm with xint package (jfB)]%
+ [2013/12/18 v1.09i Euclide algorithm with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintGCD}}
% The macros of |1.09a| benefits from the |\xintnum| which has been inserted
@@ -16062,9 +16751,9 @@ first place.
\def\XINT_gcd_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_gcd_BisZero
- #3\dummy \XINT_gcd_AisZero
- 0\dummy \XINT_gcd_loop
+ #1\XINT_gcd_BisZero
+ #3\XINT_gcd_AisZero
+ 0\XINT_gcd_loop
\krof
{#1#2}{#3#4}%
}%
@@ -16105,10 +16794,9 @@ first place.
% \begin{macrocode}
\def\xintGCDof:csv #1{\expandafter\XINT_gcdof:_b\romannumeral-`0#1,,}%
\def\XINT_gcdof:_b #1,#2,{\expandafter\XINT_gcdof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_gcdof:_e
+\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_gcdof:_d\fi #1}%
\def\XINT_gcdof:_d #1,{\expandafter\XINT_gcdof:_b\romannumeral0\xintgcd {#1}}%
-\def\XINT_gcdof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{xintLCM}}
% \lverb|New with 1.09a. Inadvertent use of \xintiQuo which was promoted at the
@@ -16127,9 +16815,9 @@ first place.
\def\XINT_lcm_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_lcm_BisZero
- #3\dummy \XINT_lcm_AisZero
- 0\dummy \expandafter
+ #1\XINT_lcm_BisZero
+ #3\XINT_lcm_AisZero
+ 0\expandafter
\krof
\XINT_lcm_notzero\expandafter{\romannumeral0\XINT_gcd_loop {#1#2}{#3#4}}%
{#1#2}{#3#4}%
@@ -16154,10 +16842,9 @@ first place.
% \begin{macrocode}
\def\xintLCMof:csv #1{\expandafter\XINT_lcmof:_a\romannumeral-`0#1,,}%
\def\XINT_lcmof:_a #1,#2,{\expandafter\XINT_lcmof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_lcmof:_e
+\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_of:_e
\else\expandafter\XINT_lcmof:_d\fi #1}%
\def\XINT_lcmof:_d #1,{\expandafter\XINT_lcmof:_a\romannumeral0\xintlcm {#1}}%
-\def\XINT_lcmof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{xintBezout}}
% \lverb|1.09a inserts use of \xintnum|
@@ -16177,22 +16864,21 @@ first place.
\def\XINT_bezout_fork #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #1#3\dummy \XINT_bezout_botharezero
- #10\dummy \XINT_bezout_secondiszero
- #30\dummy \XINT_bezout_firstiszero
- 00\dummy
- {\xint_UDsignsfork
- #1#3\dummy \XINT_bezout_minusminus % A < 0, B < 0
- #1-\dummy \XINT_bezout_minusplus % A > 0, B < 0
- #3-\dummy \XINT_bezout_plusminus % A < 0, B > 0
- --\dummy \XINT_bezout_plusplus % A > 0, B > 0
+ #1#3\XINT_bezout_botharezero
+ #10\XINT_bezout_secondiszero
+ #30\XINT_bezout_firstiszero
+ 00{\xint_UDsignsfork
+ #1#3\XINT_bezout_minusminus % A < 0, B < 0
+ #1-\XINT_bezout_minusplus % A > 0, B < 0
+ #3-\XINT_bezout_plusminus % A < 0, B > 0
+ --\XINT_bezout_plusplus % A > 0, B > 0
\krof }%
\krof
{#2}{#4}#1#3{#3#4}{#1#2}% #1#2=B, #3#4=A
}%
-\def\XINT_bezout_botharezero #1#2#3#4#5#6%
+\edef\XINT_bezout_botharezero #1#2#3#4#5#6%
{%
- \xintError:NoBezoutForZeros
+ \noexpand\xintError:NoBezoutForZeros
\space {0}{0}{0}{0}{0}%
}%
% \end{macrocode}
@@ -16203,8 +16889,8 @@ first place.
\def\XINT_bezout_firstiszero #1#2#3#4#5#6%
{%
\xint_UDsignfork
- #3\dummy { {0}{#3#1}{0}{1}{#1}}%
- -\dummy { {0}{#3#1}{0}{-1}{#1}}%
+ #3{ {0}{#3#1}{0}{1}{#1}}%
+ -{ {0}{#3#1}{0}{-1}{#1}}%
\krof
}%
% \end{macrocode}
@@ -16213,8 +16899,8 @@ first place.
\def\XINT_bezout_secondiszero #1#2#3#4#5#6%
{%
\xint_UDsignfork
- #4\dummy{ {#4#2}{0}{-1}{0}{#2}}%
- -\dummy{ {#4#2}{0}{1}{0}{#2}}%
+ #4{ {#4#2}{0}{-1}{0}{#2}}%
+ -{ {#4#2}{0}{1}{0}{#2}}%
\krof
}%
% \end{macrocode}
@@ -16234,7 +16920,7 @@ first place.
{%
\expandafter\XINT_bezout_mm_postc\expandafter {#2}{#1}%
}%
-\def\XINT_bezout_mm_postc #1#2#3#4#5%
+\edef\XINT_bezout_mm_postc #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -16251,7 +16937,7 @@ first place.
\expandafter\XINT_bezout_mp_postb\expandafter
{\romannumeral0\xintiiopp {#2}}{#1}%
}%
-\def\XINT_bezout_mp_postb #1#2#3#4#5%
+\edef\XINT_bezout_mp_postb #1#2#3#4#5%
{%
\space {#4}{#5}{#2}{#1}{#3}%
}%
@@ -16268,7 +16954,7 @@ first place.
\expandafter \XINT_bezout_pm_postb \expandafter
{\romannumeral0\xintiiopp{#1}}%
}%
-\def\XINT_bezout_pm_postb #1#2#3#4#5%
+\edef\XINT_bezout_pm_postb #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -16283,7 +16969,7 @@ first place.
% \end{macrocode}
% \lverb|la parité (-1)^N est en #1, et on la jette ici.|
% \begin{macrocode}
-\def\XINT_bezout_pp_post #1#2#3#4#5%
+\edef\XINT_bezout_pp_post #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -16356,11 +17042,11 @@ first place.
\else\expandafter\XINT_bezout_exitodd
\fi
}%
-\def\XINT_bezout_exiteven #1#2#3#4#5%
+\edef\XINT_bezout_exiteven #1#2#3#4#5%
{%
\space {#5}{#4}{#1}%
}%
-\def\XINT_bezout_exitodd #1#2#3#4#5%
+\edef\XINT_bezout_exitodd #1#2#3#4#5%
{%
\space {-#5}{-#4}{#1}%
}%
@@ -16386,9 +17072,9 @@ first place.
\def\XINT_euc_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_euc_BisZero
- #3\dummy \XINT_euc_AisZero
- 0\dummy \XINT_euc_a
+ #1\XINT_euc_BisZero
+ #3\XINT_euc_AisZero
+ 0\XINT_euc_a
\krof
{0}{#1#2}{#3#4}{{#3#4}{#1#2}}{}\Z
}%
@@ -16445,7 +17131,7 @@ first place.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\xint_euc_end_ #1#2#3%
+\edef\xint_euc_end_ #1#2#3%
{%
\space {#1}{#3}{#2}%
}%
@@ -16472,9 +17158,9 @@ first place.
\def\XINT_bezalg_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_bezalg_BisZero
- #3\dummy \XINT_bezalg_AisZero
- 0\dummy \XINT_bezalg_a
+ #1\XINT_bezalg_BisZero
+ #3\XINT_bezalg_AisZero
+ 0\XINT_bezalg_a
\krof
0{#1#2}{#3#4}1001{{#3#4}{#1#2}}{}\Z
}%
@@ -16555,7 +17241,7 @@ first place.
% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}|
% \begin{macrocode}
-\def\xint_bezalg_end_ #1#2#3#4%
+\edef\xint_bezalg_end_ #1#2#3#4%
{%
\space {#1}{#3}{0}{1}{#2}{#4}{1}{0}%
}%
@@ -16762,7 +17448,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2013/11/28 v1.09h Expandable operations on fractions (jfB)]%
+ [2013/12/18 v1.09i Expandable operations on fractions (jfB)]%
\chardef\xint_c_vi 6
\chardef\xint_c_vii 7
\chardef\xint_c_xviii 18
@@ -16818,11 +17504,14 @@ first place.
% 1.06a version now outputs 0/1[0] and not 0[0] in case of zero. More generally
% all macros have been checked in xintfrac, xintseries, xintcfrac, to make sure
% the output format for fractions was always A/B[n]. (except \xintIrr,
-% \xintJrr, \xintRawWithZeros)|
+% \xintJrr, \xintRawWithZeros)
+%
+% The problem with statements like those in the previous paragraph is that it is
+% hard to maintain consistencies across relases. |
% \begin{macrocode}
\def\XINT_outfrac #1#2#3%
{%
- \ifcase\XINT_Sgn{#3}
+ \ifcase\XINT__Sgn #3\Z
\expandafter \XINT_outfrac_divisionbyzero
\or
\expandafter \XINT_outfrac_P
@@ -16832,11 +17521,11 @@ first place.
{#2}{#3}[#1]%
}%
\def\XINT_outfrac_divisionbyzero #1#2{\xintError:DivisionByZero\space #1/0}%
-\def\XINT_outfrac_P #1#2%
+\edef\XINT_outfrac_P #1#2%
{%
- \ifcase\XINT_Sgn{#1}
- \expandafter\XINT_outfrac_Zero
- \fi
+ \noexpand\if0\noexpand\XINT_Sgn #1\noexpand\Z
+ \noexpand\expandafter\noexpand\XINT_outfrac_Zero
+ \noexpand\fi
\space #1/#2%
}%
\def\XINT_outfrac_Zero #1[#2]{ 0/1[0]}%
@@ -16862,8 +17551,8 @@ first place.
\def\XINT_infrac_ #1[#2#3]#4\Z
{%
\xint_UDwfork
- #2\dummy \XINT_infrac_A
- \W\dummy \XINT_infrac_B
+ #2\XINT_infrac_A
+ \W\XINT_infrac_B
\krof
#1[#2#3]#4%
}%
@@ -16879,8 +17568,8 @@ first place.
\def\XINT_infrac_BC #1/#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_infrac_BCa
- \W\dummy {\expandafter\XINT_infrac_BCb \romannumeral-`0#2}%
+ #2\XINT_infrac_BCa
+ \W{\expandafter\XINT_infrac_BCb \romannumeral-`0#2}%
\krof
#3\Z #1\Z
}%
@@ -16896,16 +17585,16 @@ first place.
\def\XINT_frac #1/#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_A
- \W\dummy {\expandafter\XINT_frac_U \romannumeral-`0#2}%
+ #2\XINT_frac_A
+ \W{\expandafter\XINT_frac_U \romannumeral-`0#2}%
\krof
#3e\W\Z #1e\W\Z
}%
\def\XINT_frac_U #1e#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ua
- \W\dummy {\XINT_frac_Ub #2}%
+ #2\XINT_frac_Ua
+ \W{\XINT_frac_Ub #2}%
\krof
#3\Z #1\Z
}%
@@ -16914,8 +17603,8 @@ first place.
\def\XINT_frac_B #1.#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ba
- \W\dummy {\XINT_frac_Bb #2}%
+ #2\XINT_frac_Ba
+ \W{\XINT_frac_Bb #2}%
\krof
#3\Z #1\Z
}%
@@ -16929,8 +17618,8 @@ first place.
\def\XINT_frac_T #1#2#3#4e#5#6\Z
{%
\xint_UDwfork
- #5\dummy \XINT_frac_Ta
- \W\dummy {\XINT_frac_Tb #5}%
+ #5\XINT_frac_Ta
+ \W{\XINT_frac_Tb #5}%
\krof
#6\Z #4\Z {#1}{#2}{#3}%
}%
@@ -16939,8 +17628,8 @@ first place.
\def\XINT_frac_C #1.#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ca
- \W\dummy {\XINT_frac_Cb #2}%
+ #2\XINT_frac_Ca
+ \W{\XINT_frac_Cb #2}%
\krof
#3\Z #1\Z
}%
@@ -16968,14 +17657,14 @@ first place.
\def\XINT_frac_F #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_frac_Gdivisionbyzero
- 0#1\dummy \XINT_frac_Gneg
- 0-\dummy {\XINT_frac_Gpos #1}%
+ #1-\XINT_frac_Gdivisionbyzero
+ 0#1\XINT_frac_Gneg
+ 0-{\XINT_frac_Gpos #1}%
\krof
}%
-\def\XINT_frac_Gdivisionbyzero #1\Z #2#3%
+\edef\XINT_frac_Gdivisionbyzero #1\Z #2#3%
{%
- \xintError:DivisionByZero\space {0}{#2}{0}%
+ \noexpand\xintError:DivisionByZero\space {0}{#2}{0}%
}%
\def\XINT_frac_Gneg #1\Z #2#3%
{%
@@ -17131,7 +17820,7 @@ first place.
}%
\def\XINT_rawz #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_rawz_Ba
\or
\expandafter\XINT_rawz_A
@@ -17168,7 +17857,7 @@ first place.
}%
\def\XINT_numer #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_numer_B
\or
\expandafter\XINT_numer_A
@@ -17189,7 +17878,7 @@ first place.
}%
\def\XINT_denom #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_denom_B
\or
\expandafter\XINT_denom_A
@@ -17214,23 +17903,21 @@ first place.
{%
\xint_gob_til_zero #1\XINT_fracfrac_C 0\XINT_fracfrac_D {10^{#1#2}}%
}%
-\def\XINT_fracfrac_C #1#2#3#4#5%
+\def\XINT_fracfrac_C 0\XINT_fracfrac_D #1#2#3%
{%
- \ifcase\XINT_isOne {#5}
- \or \xint_afterfi {\expandafter\xint_firstoftwo_andstop\xint_gobble_ii }%
+ \if1\XINT_isOne {#3}%
+ \xint_afterfi {\expandafter\xint_firstoftwo_afterstop\xint_gobble_ii }%
\fi
\space
- \frac {#4}{#5}%
+ \frac {#2}{#3}%
}%
\def\XINT_fracfrac_D #1#2#3%
{%
- \ifcase\XINT_isOne {#3}
- \or \XINT_fracfrac_E
- \fi
+ \if1\XINT_isOne {#3}\XINT_fracfrac_E\fi
\space
\frac {#2}{#3}#1%
}%
-\def\XINT_fracfrac_E \fi #1#2#3#4{\fi \space #3\cdot }%
+\def\XINT_fracfrac_E \fi\space\frac #1#2{\fi \space #1\cdot }%
% \end{macrocode}
% \subsection{\csh{xintSignedFrac}}
% \begin{macrocode}
@@ -17246,8 +17933,8 @@ first place.
\def\XINT_sgnfrac_b #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_sgnfrac_N
- -\dummy {\XINT_sgnfrac_P #1}%
+ #1\XINT_sgnfrac_N
+ -{\XINT_sgnfrac_P #1}%
\krof
}%
\def\XINT_sgnfrac_P #1\Z #2%
@@ -17256,7 +17943,7 @@ first place.
}%
\def\XINT_sgnfrac_N
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_sgnfrac_P
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_sgnfrac_P
}%
% \end{macrocode}
% \subsection{\csh{xintFwOver}}
@@ -17274,18 +17961,14 @@ first place.
\catcode`^=11
\def\XINT_fwover_C #1#2#3#4#5%
{%
- \ifcase\XINT_isOne {#5}
- \xint_afterfi { {#4\over #5}}%
- \or
- \xint_afterfi { #4}%
+ \if0\XINT_isOne {#5}\xint_afterfi { {#4\over #5}}%
+ \else\xint_afterfi { #4}%
\fi
}%
\def\XINT_fwover_D #1#2#3%
{%
- \ifcase\XINT_isOne {#3}
- \xint_afterfi { {#2\over #3}}%
- \or
- \xint_afterfi { #2\cdot }%
+ \if0\XINT_isOne {#3}\xint_afterfi { {#2\over #3}}%
+ \else\xint_afterfi { #2\cdot }%
\fi
#1%
}%
@@ -17304,8 +17987,8 @@ first place.
\def\XINT_sgnfwover_b #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_sgnfwover_N
- -\dummy {\XINT_sgnfwover_P #1}%
+ #1\XINT_sgnfwover_N
+ -{\XINT_sgnfwover_P #1}%
\krof
}%
\def\XINT_sgnfwover_P #1\Z #2%
@@ -17314,7 +17997,7 @@ first place.
}%
\def\XINT_sgnfwover_N
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_sgnfwover_P
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_sgnfwover_P
}%
% \end{macrocode}
% \subsection{\csh{xintREZ}}
@@ -17331,13 +18014,13 @@ first place.
\def\XINT_rez_AB #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_rez_zero
- 0#1\dummy \XINT_rez_neg
- 0-\dummy {\XINT_rez_B #1}%
+ #1-\XINT_rez_zero
+ 0#1\XINT_rez_neg
+ 0-{\XINT_rez_B #1}%
\krof
}%
\def\XINT_rez_zero #1\Z #2#3{ 0/1[0]}%
-\def\XINT_rez_neg {\expandafter\xint_minus_andstop\romannumeral0\XINT_rez_B }%
+\def\XINT_rez_neg {\expandafter\xint_minus_afterstop\romannumeral0\XINT_rez_B }%
\def\XINT_rez_B #1\Z
{%
\expandafter\XINT_rez_C\romannumeral0\XINT_factortens {#1}%
@@ -17355,7 +18038,20 @@ first place.
% \end{macrocode}
% \subsection{\csh{xintE}}
% \lverb|added with with 1.07, together with support for `floats'. The fraction
-% comes first here, contrarily to \xintTrunc and \xintRound.|
+% comes first here, contrarily to \xintTrunc and \xintRound.
+%
+% \xintfE (1.07) and \xintiE (1.09i) for \xintexpr and cousins. It is quite
+% annoying that \numexpr does not know how to deal correctly with - : \numexpr
+% -(1)\relax is illegal!
+%
+% the 1.07 \xintE put directly its second argument in a \numexpr. The \xintfE
+% first uses \xintNum on it, this necessary for use in \xintexpr. (but then one
+% cannot use directly infix notation in the second argument of \xintfE)
+%
+% 1.09i also adds \xintFloatE and modifies \XINTinFloatfE, although currently
+% the latter is only used from
+% \xintfloatexpr hence always with \XINTdigits, it comes equipped with its first
+% argument withing brackets as the other \XINTinFloat... macros. |
% \begin{macrocode}
\def\xintE {\romannumeral0\xinte }%
\def\xinte #1%
@@ -17366,6 +18062,7 @@ first place.
{%
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+#4}{#2}{#3}%
}%
+\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
\def\xintfE {\romannumeral0\xintfe }%
\def\xintfe #1%
{%
@@ -17375,8 +18072,51 @@ first place.
{%
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+\xintNum{#4}}{#2}{#3}%
}%
-\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
-\let\XINTinFloatfE\xintfE
+\def\xintFloatE {\romannumeral0\xintfloate }%
+\def\xintfloate #1{\XINT_floate_chkopt #1\Z }%
+\def\XINT_floate_chkopt #1%
+{%
+ \ifx [#1\expandafter\XINT_floate_opt
+ \else\expandafter\XINT_floate_noopt
+ \fi #1%
+}%
+\def\XINT_floate_noopt #1\Z
+{%
+ \expandafter\XINT_floate_a\expandafter\XINTdigits
+ \romannumeral0\XINT_infrac {#1}%
+}%
+\def\XINT_floate_opt [\Z #1]#2%
+{%
+ \expandafter\XINT_floate_a\expandafter
+ {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
+}%
+\def\XINT_floate_a #1#2#3#4#5%
+{%
+ \expandafter\expandafter\expandafter\XINT_float_a
+ \expandafter\xint_exchangetwo_keepbraces\expandafter
+ {\the\numexpr #2+#5}{#1}{#3}{#4}\XINT_float_Q
+}%
+\def\XINTinFloatfE {\romannumeral0\XINT_inFloatfE }%
+\def\XINT_inFloatfE [#1]#2%
+{%
+ \expandafter\XINT_infloatfe_a\expandafter
+ {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
+}%
+\def\XINT_infloatfe_a #1#2#3#4#5%
+{%
+ \expandafter\expandafter\expandafter\XINT_infloat_a
+ \expandafter\xint_exchangetwo_keepbraces\expandafter
+ {\the\numexpr #2+\xintNum{#5}}{#1}{#3}{#4}\XINT_infloat_Q
+}%
+\def\xintiE {\romannumeral0\xintie }% for \xintiiexpr only
+\def\xintie #1%
+{%
+ \expandafter\XINT_ie \romannumeral0\XINT_infrac {#1}% allows 3.123e3
+}%
+\def\XINT_ie #1#2#3#4% assumes #3=1 and uses \xint_dsh with its \numexpr
+{%
+ \xint_dsh {#2}{0-(#1+#4)}% could have \xintNum{#4} for a bit more general
+}%
% \end{macrocode}
% \subsection{\csh{xintIrr}}
% \lverb|&
@@ -17393,27 +18133,27 @@ first place.
}%
\def\XINT_irr_start #1#2/#3\Z
{%
- \ifcase\XINT_isOne {#3}
+ \if0\XINT_isOne {#3}%
\xint_afterfi
{\xint_UDsignfork
- #1\dummy \XINT_irr_negative
- -\dummy {\XINT_irr_nonneg #1}%
+ #1\XINT_irr_negative
+ -{\XINT_irr_nonneg #1}%
\krof}%
- \or
+ \else
\xint_afterfi{\XINT_irr_denomisone #1}%
\fi
#2\Z {#3}%
}%
\def\XINT_irr_denomisone #1\Z #2{ #1/1}% changed in 1.08
-\def\XINT_irr_negative #1\Z #2{\XINT_irr_D #1\Z #2\Z \xint_minus_andstop}%
+\def\XINT_irr_negative #1\Z #2{\XINT_irr_D #1\Z #2\Z \xint_minus_afterstop}%
\def\XINT_irr_nonneg #1\Z #2{\XINT_irr_D #1\Z #2\Z \space}%
\def\XINT_irr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\dummy \XINT_irr_indeterminate
- #30\dummy \XINT_irr_divisionbyzero
- #10\dummy \XINT_irr_zero
- 00\dummy \XINT_irr_loop_a
+ #3#1\XINT_irr_indeterminate
+ #30\XINT_irr_divisionbyzero
+ #10\XINT_irr_zero
+ 00\XINT_irr_loop_a
\krof
{#3#4}{#1#2}{#3#4}{#1#2}%
}%
@@ -17459,24 +18199,23 @@ first place.
% \begin{macrocode}
\def\xintNum {\romannumeral0\xintnum }%
\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}\Z }%
-\def\XINT_intcheck #1/#2\Z
+\edef\XINT_intcheck #1/#2\Z
{%
- \ifcase\XINT_isOne {#2}
- \xintError:NotAnInteger
- \fi\space #1%
+ \noexpand\if 0\noexpand\XINT_isOne {#2}\noexpand\xintError:NotAnInteger
+ \noexpand\fi\space #1%
}%
% \end{macrocode}
% \subsection{\csh{xintifInt}}
-% \lverb|1.09e. xintfrac.sty only|
+% \lverb|1.09e. xintfrac.sty only. 1.09i uses _afterstop|
% \begin{macrocode}
\def\xintifInt {\romannumeral0\xintifint }%
\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintirr {#1}\Z }%
\def\XINT_ifint #1/#2\Z
{%
\if\XINT_isOne {#2}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
% \end{macrocode}
@@ -17492,27 +18231,26 @@ first place.
}%
\def\XINT_jrr_start #1#2/#3\Z
{%
- \ifcase\XINT_isOne {#3}
- \xint_afterfi
+ \if0\XINT_isOne {#3}\xint_afterfi
{\xint_UDsignfork
- #1\dummy \XINT_jrr_negative
- -\dummy {\XINT_jrr_nonneg #1}%
+ #1\XINT_jrr_negative
+ -{\XINT_jrr_nonneg #1}%
\krof}%
- \or
+ \else
\xint_afterfi{\XINT_jrr_denomisone #1}%
\fi
#2\Z {#3}%
}%
\def\XINT_jrr_denomisone #1\Z #2{ #1/1}% changed in 1.08
-\def\XINT_jrr_negative #1\Z #2{\XINT_jrr_D #1\Z #2\Z \xint_minus_andstop }%
+\def\XINT_jrr_negative #1\Z #2{\XINT_jrr_D #1\Z #2\Z \xint_minus_afterstop }%
\def\XINT_jrr_nonneg #1\Z #2{\XINT_jrr_D #1\Z #2\Z \space}%
\def\XINT_jrr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\dummy \XINT_jrr_indeterminate
- #30\dummy \XINT_jrr_divisionbyzero
- #10\dummy \XINT_jrr_zero
- 00\dummy \XINT_jrr_loop_a
+ #3#1\XINT_jrr_indeterminate
+ #30\XINT_jrr_divisionbyzero
+ #10\XINT_jrr_zero
+ 00\XINT_jrr_loop_a
\krof
{#3#4}{#1#2}1001%
}%
@@ -17548,11 +18286,51 @@ first place.
\XINT_irr_finish {#3}{#4}%
}%
% \end{macrocode}
+% \subsection{\csh{xintTFrac}}
+% \lverb|1.09i, for frac in \xintexpr. And \xintFrac is already assigned. T for
+% truncation. However, potentially not very efficient with numbers in scientific
+% notations, with big exponents. Will have to think it again some day. I
+% hesitated how to call the macro. Same convention as in maple, but some people
+% reserve fractional part to x - floor(x). Also, not clear if I had to make it
+% negative (or zero) if x < 0, or rather always positive. There should be in
+% fact such a thing for each rounding function, trunc, round, floor, ceil. |
+% \begin{macrocode}
+\def\xintTFrac {\romannumeral0\xinttfrac }%
+\def\xinttfrac #1%
+ {\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
+\def\XINT_tfrac_fork #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_tfrac_zero
+ 0#1\XINT_tfrac_N
+ 0-{\XINT_tfrac_P #1}%
+ \krof
+}%
+\def\XINT_tfrac_zero #1\Z { 0/1[0]}%
+\def\XINT_tfrac_N {\expandafter\XINT_opp\romannumeral0\XINT_tfrac_P }%
+\def\XINT_tfrac_P #1/#2\Z
+{%
+ \expandafter\XINT_rez_AB\romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}%
+}%
+% \end{macrocode}
+% \subsection{\csh{XINTinFloatFrac}}
+% \lverb|1.09i, for frac in \xintfloatexpr. Will have to think it again some
+% day. This version first computes with exact precision the fractional part then
+% only converts it into a float with the asked for number of digits. |
+% \begin{macrocode}
+\def\XINTinFloatFrac {\romannumeral0\XINT_inFloatFrac }%
+\def\XINT_inFloatFrac [#1]#2%
+{%
+ \expandafter\XINT_infloatfrac_a\expandafter
+ {\romannumeral0\xinttfrac{#2}}{#1}%
+}%
+\def\XINT_infloatfrac_a #1#2{\XINT_inFloat [#2]{#1}}%
+% \end{macrocode}
% \subsection{\csh{xintTrunc}, \csh{xintiTrunc}}
% \lverb|&
% Modified in 1.06 to give the first argument to a \numexpr. 1.09f fixes the
% overhead added in 1.09a to some inner routines when \xintiquo was redefined to
-% use \xintnum, whereas it should not. Now called \xintiiquo, by the way.|
+% use \xintnum, whereas it should not. Now uses \xintiiquo.|
% \begin{macrocode}
\def\xintTrunc {\romannumeral0\xinttrunc }%
\def\xintiTrunc {\romannumeral0\xintitrunc }%
@@ -17588,7 +18366,7 @@ first place.
\def\XINT_trunc_iszero #1#2#3#4#5{ 0\Z 0}%
\def\XINT_trunc_B #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_trunc_D
\or
\expandafter\XINT_trunc_D
@@ -17611,16 +18389,16 @@ first place.
\def\XINT_trunc_E #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_trunc_minusminus
- #1-\dummy {\XINT_trunc_minusplus #3}%
- #3-\dummy {\XINT_trunc_plusminus #1}%
- --\dummy {\XINT_trunc_plusplus #3#1}%
+ #1#3\XINT_trunc_minusminus
+ #1-{\XINT_trunc_minusplus #3}%
+ #3-{\XINT_trunc_plusminus #1}%
+ --{\XINT_trunc_plusplus #3#1}%
\krof
{#4}{#2}%
}%
\def\XINT_trunc_minusminus #1#2{\xintiiquo {#1}{#2}\Z \space}%
-\def\XINT_trunc_minusplus #1#2#3{\xintiiquo {#1#2}{#3}\Z \xint_minus_andstop}%
-\def\XINT_trunc_plusminus #1#2#3{\xintiiquo {#2}{#1#3}\Z \xint_minus_andstop}%
+\def\XINT_trunc_minusplus #1#2#3{\xintiiquo {#1#2}{#3}\Z \xint_minus_afterstop}%
+\def\XINT_trunc_plusminus #1#2#3{\xintiiquo {#2}{#1#3}\Z \xint_minus_afterstop}%
\def\XINT_trunc_plusplus #1#2#3#4{\xintiiquo {#1#3}{#2#4}\Z \space}%
\def\XINT_itrunc_G #1#2\Z #3#4%
{%
@@ -17725,18 +18503,17 @@ first place.
}%
% \end{macrocode}
% \subsection{\csh{xintRound:csv}}
-% \lverb|1.09a. For use by \xintthenumexpr.|
+% \lverb|1.09a. For use by \xinttheiexpr.|
% \begin{macrocode}
\def\xintRound:csv #1{\expandafter\XINT_round:_a\romannumeral-`0#1,,^}%
\def\XINT_round:_a {\XINT_round:_b {}}%
\def\XINT_round:_b #1#2,%
{\expandafter\XINT_round:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_round:_c #1{\if #1,\expandafter\XINT_round:_f
+\def\XINT_round:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_round:_d\fi #1}%
\def\XINT_round:_d #1,%
{\expandafter\XINT_round:_e\romannumeral0\xintiround 0{#1},}%
\def\XINT_round:_e #1,#2{\XINT_round:_b {#2,#1}}%
-\def\XINT_round:_f ,#1#2^{\xint_gobble_i #1}%
% \end{macrocode}
% \subsection{\csh{xintDigits}}
% \lverb|&
@@ -17783,13 +18560,13 @@ first place.
\def\XINT_float_fork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_float_zero
- 0#1\dummy \XINT_float_J
- 0-\dummy {\XINT_float_K #1}%
+ #1-\XINT_float_zero
+ 0#1\XINT_float_J
+ 0-{\XINT_float_K #1}%
\krof
}%
\def\XINT_float_zero #1\Z #2#3#4#5{ 0.e0}%
-\def\XINT_float_J {\expandafter\xint_minus_andstop\romannumeral0\XINT_float_K }%
+\def\XINT_float_J {\expandafter\xint_minus_afterstop\romannumeral0\XINT_float_K }%
\def\XINT_float_K #1\Z #2% #1=A, #2=P, #3=n, #4=B
{%
\expandafter\XINT_float_L\expandafter
@@ -17938,12 +18715,11 @@ first place.
\def\XINT_float:_a {\XINT_float:_b {}}%
\def\XINT_float:_b #1#2,%
{\expandafter\XINT_float:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_float:_c #1{\if #1,\expandafter\XINT_float:_f
+\def\XINT_float:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_float:_d\fi #1}%
\def\XINT_float:_d #1,%
{\expandafter\XINT_float:_e\romannumeral0\xintfloat {#1},}%
\def\XINT_float:_e #1,#2{\XINT_float:_b {#2,#1}}%
-\def\XINT_float:_f ,#1#2^{\xint_gobble_i #1}%
% \end{macrocode}
% \subsection{\csh{XINT\_inFloat}}
% \lverb|1.07. Completely rewritten in 1.08a for immensely greater efficiency
@@ -17977,12 +18753,12 @@ first place.
\def\XINT_infloat_fork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_infloat_zero
- 0#1\dummy \XINT_infloat_J
- 0-\dummy {\XINT_float_K #1}%
+ #1-\XINT_infloat_zero
+ 0#1\XINT_infloat_J
+ 0-{\XINT_float_K #1}%
\krof
}%
-\def\XINT_infloat_zero #1\Z #2#3#4#5{ 0[0]}%
+\def\XINT_infloat_zero #1\Z #2#3#4#5{ 0/1[0]}%
\def\XINT_infloat_J {\expandafter-\romannumeral0\XINT_float_K }%
\def\XINT_infloat_Q #1%
{%
@@ -18148,11 +18924,10 @@ first place.
\def\xintSum:csv #1{\expandafter\XINT_sum:_a\romannumeral-`0#1,,^}%
\def\XINT_sum:_a {\XINT_sum:_b {0/1[0]}}%
\def\XINT_sum:_b #1#2,{\expandafter\XINT_sum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_sum:_e
+\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_sum:_d\fi #1}%
\def\XINT_sum:_d #1,#2{\expandafter\XINT_sum:_b\expandafter
{\romannumeral0\xintadd {#2}{#1}}}%
-\def\XINT_sum:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
% \subsection{\csh{xintMul}}
% \begin{macrocode}
@@ -18208,16 +18983,13 @@ first place.
\def\XINT_fpow_fork #1#2\Z
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_fpow_zero
- 0#1\dummy \XINT_fpow_neg
- 0-\dummy {\XINT_fpow_pos #1}%
+ #1-\XINT_fpow_zero
+ 0#1\XINT_fpow_neg
+ 0-{\XINT_fpow_pos #1}%
\krof
{#2}%
}%
-\def\XINT_fpow_zero #1#2#3#4%
-{%
- \space 1/1[0]%
-}%
+\def\XINT_fpow_zero #1#2#3#4{ 1/1[0]}%
\def\XINT_fpow_pos #1#2#3#4#5%
{%
\expandafter\XINT_fpow_pos_A\expandafter
@@ -18280,11 +19052,10 @@ first place.
\def\xintPrd:csv #1{\expandafter\XINT_prd:_a\romannumeral-`0#1,,^}%
\def\XINT_prd:_a {\XINT_prd:_b {1/1[0]}}%
\def\XINT_prd:_b #1#2,{\expandafter\XINT_prd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_prd:_e
+\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_prd:_d\fi #1}%
\def\XINT_prd:_d #1,#2{\expandafter\XINT_prd:_b\expandafter
{\romannumeral0\xintmul {#2}{#1}}}%
-\def\XINT_prd:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
% \subsection{\csh{xintDiv}}
% \begin{macrocode}
@@ -18312,12 +19083,13 @@ first place.
% \subsection{\csh{xintIsOne}}
% \lverb|&
% New with 1.09a. Could be more efficient. For fractions with big powers of
-% tens, it is better to use \xintCmp{f}{1}.|
+% tens, it is better to use \xintCmp{f}{1}. Restyled in 1.09i.|
% \begin{macrocode}
\def\xintIsOne {\romannumeral0\xintisone }%
\def\xintisone #1{\expandafter\XINT_fracisone
- \romannumeral0\xintrawwithzeros{#1}\Z }%
-\def\XINT_fracisone #1/#2\Z{\xintsgnfork{\XINT_Cmp {#1}{#2}}{0}{1}{0}}%
+ \romannumeral0\xintrawwithzeros{#1}\Z }%
+\def\XINT_fracisone #1/#2\Z
+ {\if0\XINT_Cmp {#1}{#2}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
% \end{macrocode}
% \subsection{\csh{xintGeq}}
% \lverb|&
@@ -18355,15 +19127,15 @@ first place.
}%
\def\XINT_fgeq_D #1#2#3%
{%
- \xintSgnFork
- {\xintiiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+ \expandafter\XINT__SgnFork\romannumeral-`0\expandafter\XINT__Sgn
+ \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
{ 0}{\XINT_fgeq_E #2\Z {#3}{#1}}{ 1}%
}%
\def\XINT_fgeq_E #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_fgeq_Fd
- -\dummy {\XINT_fgeq_Fn #1}%
+ #1\XINT_fgeq_Fd
+ -{\XINT_fgeq_Fn #1}%
\krof
}%
\def\XINT_fgeq_Fd #1\Z #2#3%
@@ -18394,15 +19166,15 @@ first place.
\def\XINT_fmax_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fmax_minusminus
- -#5\dummy \XINT_fmax_firstneg
- #1-\dummy \XINT_fmax_secondneg
- --\dummy \XINT_fmax_nonneg_a
+ #1#5\XINT_fmax_minusminus
+ -#5\XINT_fmax_firstneg
+ #1-\XINT_fmax_secondneg
+ --\XINT_fmax_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
\def\XINT_fmax_minusminus --%
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmin_nonneg_b }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_fmin_nonneg_b }%
\def\XINT_fmax_firstneg #1-#2#3{ #1#2}%
\def\XINT_fmax_secondneg -#1#2#3{ #1#3}%
\def\XINT_fmax_nonneg_a #1#2#3#4%
@@ -18411,9 +19183,9 @@ first place.
}%
\def\XINT_fmax_nonneg_b #1#2%
{%
- \ifcase\romannumeral0\XINT_fgeq_A #1#2
- \xint_afterfi{ #1}%
- \or \xint_afterfi{ #2}%
+ \if0\romannumeral0\XINT_fgeq_A #1#2%
+ \xint_afterfi{ #1}%
+ \else \xint_afterfi{ #2}%
\fi
}%
% \end{macrocode}
@@ -18437,10 +19209,9 @@ first place.
% \begin{macrocode}
\def\xintMaxof:csv #1{\expandafter\XINT_maxof:_b\romannumeral-`0#1,,}%
\def\XINT_maxof:_b #1,#2,{\expandafter\XINT_maxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_maxof:_e
+\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_maxof:_d\fi #1}%
\def\XINT_maxof:_d #1,{\expandafter\XINT_maxof:_b\romannumeral0\xintmax {#1}}%
-\def\XINT_maxof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{XINTinFloatMaxof}}
% \lverb|1.09a, for use by \xintNewFloatExpr. Name changed in 1.09h|
@@ -18466,12 +19237,11 @@ first place.
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flmaxof:_b #1,#2,%
{\expandafter\XINT_flmaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_flmaxof:_e
+\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_flmaxof:_d\fi #1}%
\def\XINT_flmaxof:_d #1,%
{\expandafter\XINT_flmaxof:_b\romannumeral0\xintmax
{\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINT_flmaxof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{xintMin}}
% \lverb|&
@@ -18489,15 +19259,15 @@ first place.
\def\XINT_fmin_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fmin_minusminus
- -#5\dummy \XINT_fmin_firstneg
- #1-\dummy \XINT_fmin_secondneg
- --\dummy \XINT_fmin_nonneg_a
+ #1#5\XINT_fmin_minusminus
+ -#5\XINT_fmin_firstneg
+ #1-\XINT_fmin_secondneg
+ --\XINT_fmin_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
\def\XINT_fmin_minusminus --%
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmax_nonneg_b }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_fmax_nonneg_b }%
\def\XINT_fmin_firstneg #1-#2#3{ -#3}%
\def\XINT_fmin_secondneg -#1#2#3{ -#2}%
\def\XINT_fmin_nonneg_a #1#2#3#4%
@@ -18506,9 +19276,9 @@ first place.
}%
\def\XINT_fmin_nonneg_b #1#2%
{%
- \ifcase\romannumeral0\XINT_fgeq_A #1#2
- \xint_afterfi{ #2}%
- \or \xint_afterfi{ #1}%
+ \if0\romannumeral0\XINT_fgeq_A #1#2%
+ \xint_afterfi{ #2}%
+ \else \xint_afterfi{ #1}%
\fi
}%
% \end{macrocode}
@@ -18530,10 +19300,9 @@ first place.
% \begin{macrocode}
\def\xintMinof:csv #1{\expandafter\XINT_minof:_b\romannumeral-`0#1,,}%
\def\XINT_minof:_b #1,#2,{\expandafter\XINT_minof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_minof:_e
+\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_minof:_d\fi #1}%
\def\XINT_minof:_d #1,{\expandafter\XINT_minof:_b\romannumeral0\xintmin {#1}}%
-\def\XINT_minof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{XINTinFloatMinof}}
% \lverb|1.09a, for use by \xintNewFloatExpr. Name changed in 1.09h|
@@ -18559,12 +19328,11 @@ first place.
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flminof:_b #1,#2,%
{\expandafter\XINT_flminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_flminof:_e
+\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_flminof:_d\fi #1}%
\def\XINT_flminof:_d #1,%
{\expandafter\XINT_flminof:_b\romannumeral0\xintmin
{\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINT_flminof:_e ,#1,{#1}%
% \end{macrocode}
% \subsection{\csh{xintCmp}}
% \lverb|&
@@ -18588,10 +19356,10 @@ first place.
\def\XINT_fcmp_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fcmp_minusminus
- -#5\dummy \XINT_fcmp_firstneg
- #1-\dummy \XINT_fcmp_secondneg
- --\dummy \XINT_fcmp_nonneg_a
+ #1#5\XINT_fcmp_minusminus
+ -#5\XINT_fcmp_firstneg
+ #1-\XINT_fcmp_secondneg
+ --\XINT_fcmp_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
@@ -18601,10 +19369,10 @@ first place.
\def\XINT_fcmp_nonneg_a #1#2%
{%
\xint_UDzerosfork
- #1#2\dummy \XINT_fcmp_zerozero
- 0#2\dummy \XINT_fcmp_firstzero
- #10\dummy \XINT_fcmp_secondzero
- 00\dummy \XINT_fcmp_pos
+ #1#2\XINT_fcmp_zerozero
+ 0#2\XINT_fcmp_firstzero
+ #10\XINT_fcmp_secondzero
+ 00\XINT_fcmp_pos
\krof
#1#2%
}%
@@ -18629,15 +19397,15 @@ first place.
}%
\def\XINT_fcmp_D #1#2#3%
{%
- \xintSgnFork
- {\xintiiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+ \expandafter\XINT__SgnFork\romannumeral-`0\expandafter\XINT__Sgn
+ \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
{ -1}{\XINT_fcmp_E #2\Z {#3}{#1}}{ 1}%
}%
\def\XINT_fcmp_E #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_fcmp_Fd
- -\dummy {\XINT_fcmp_Fn #1}%
+ #1\XINT_fcmp_Fd
+ -{\XINT_fcmp_Fn #1}%
\krof
}%
\def\XINT_fcmp_Fd #1\Z #2#3%
@@ -18653,41 +19421,23 @@ first place.
}%
% \end{macrocode}
% \subsection{\csh{xintAbs}}
+% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
-\def\xintAbs {\romannumeral0\xintabs }%
-\def\xintabs #1%
-{%
- \expandafter\xint_fabs\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fabs #1#2%
-{%
- \expandafter\XINT_outfrac\expandafter
- {\the\numexpr #1\expandafter}\expandafter
- {\romannumeral0\XINT_abs #2}%
-}%
+\def\xintAbs {\romannumeral0\xintabs }%
+\def\xintabs #1{\expandafter\XINT_abs\romannumeral0\xintraw {#1}}%
% \end{macrocode}
% \subsection{\csh{xintOpp}}
+% \lverb|caution that -#1 would not be ok if #1 has [n]
+% stuff. Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
-\def\xintOpp {\romannumeral0\xintopp }%
-\def\xintopp #1%
-{%
- \expandafter\xint_fopp\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fopp #1#2%
-{%
- \expandafter\XINT_outfrac\expandafter
- {\the\numexpr #1\expandafter}\expandafter
- {\romannumeral0\XINT_opp #2}%
-}%
+\def\xintOpp {\romannumeral0\xintopp }%
+\def\xintopp #1{\expandafter\XINT_opp\romannumeral0\xintraw {#1}}%
% \end{macrocode}
% \subsection{\csh{xintSgn}}
+% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
-\def\xintSgn {\romannumeral0\xintsgn }%
-\def\xintsgn #1%
-{%
- \expandafter\xint_fsgn\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fsgn #1#2#3{\xintiisgn {#2}}%
+\def\xintSgn {\romannumeral0\xintsgn }%
+\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\Z }%
% \end{macrocode}
% \subsection{\csh{xintFloatAdd}}
% \lverb|1.07|
@@ -18847,14 +19597,13 @@ first place.
% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
% \begin{macrocode}
\def\XINTinFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0[0]}}% was 0/1[0] prior to 1.09h
+\def\XINT_floatsum:_a {\XINT_floatsum:_b {0/1[0]}}%
\def\XINT_floatsum:_b #1#2,%
{\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_floatsum:_e
+\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_floatsum:_d\fi #1}%
\def\XINT_floatsum:_d #1,#2{\expandafter\XINT_floatsum:_b\expandafter
{\romannumeral0\XINTinfloatadd {#2}{#1}}}%
-\def\XINT_floatsum:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
% \subsection{\csh{XINTinFloatPrd}}
% \lverb|1.09a: quick write-up, for use by \xintfloatexpr, will need to be
@@ -18877,14 +19626,13 @@ first place.
% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
% \begin{macrocode}
\def\XINTinFloatPred:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1[0]}}% was 1/1[0] prior to 1.09h
+\def\XINT_floatprd:_a {\XINT_floatprd:_b {1/1[0]}}%
\def\XINT_floatprd:_b #1#2,%
{\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_floatprd:_e
+\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_floatprd:_d\fi #1}%
\def\XINT_floatprd:_d #1,#2{\expandafter\XINT_floatprd:_b\expandafter
{\romannumeral0\XINTinfloatmul {#2}{#1}}}%
-\def\XINT_floatprd:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
% \subsection{\csh{xintFloatPow}}
% \lverb|1.07|
@@ -18916,9 +19664,9 @@ first place.
\def\XINT_flpow_checkB_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpow_BisZero
- 0#1\dummy {\XINT_flpow_checkB_b 1}%
- 0-\dummy {\XINT_flpow_checkB_b 0#1}%
+ #1-\XINT_flpow_BisZero
+ 0#1{\XINT_flpow_checkB_b 1}%
+ 0-{\XINT_flpow_checkB_b 0#1}%
\krof
}%
\def\XINT_flpow_BisZero \Z #1#2#3{#3{1/1[0]}}%
@@ -18941,9 +19689,9 @@ first place.
\def\XINT_flpow_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpow_zero
- 0#1\dummy {\XINT_flpow_b 1}%
- 0-\dummy {\XINT_flpow_b 0#1}%
+ #1-\XINT_flpow_zero
+ 0#1{\XINT_flpow_b 1}%
+ 0-{\XINT_flpow_b 0#1}%
\krof
}%
\def\XINT_flpow_zero [#1]#2#3#4#5%
@@ -19017,15 +19765,15 @@ first place.
\expandafter\XINT_flpow_conclude_really\expandafter
{\the\numexpr\if #41 -\fi#3\expandafter}%
\xint_UDzerofork
- #4\dummy {{#2}}%
- 0\dummy {{1/#2}}%
+ #4{{#2}}%
+ 0{{1/#2}}%
\krof #1%
}%
\def\XINT_flpow_conclude_really #1#2#3#4%
{%
\xint_UDzerofork
- #3\dummy {#4{#2[#1]}}%
- 0\dummy {#4{-#2[#1]}}%
+ #3{#4{#2[#1]}}%
+ 0{#4{-#2[#1]}}%
\krof
}%
% \end{macrocode}
@@ -19059,9 +19807,9 @@ first place.
\def\XINT_flpower_checkB_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpower_BisZero
- 0#1\dummy {\XINT_flpower_checkB_b 1}%
- 0-\dummy {\XINT_flpower_checkB_b 0#1}%
+ #1-\XINT_flpower_BisZero
+ 0#1{\XINT_flpower_checkB_b 1}%
+ 0-{\XINT_flpower_checkB_b 0#1}%
\krof
}%
\def\XINT_flpower_BisZero \Z #1#2#3{#3{1/1[0]}}%
@@ -19084,9 +19832,9 @@ first place.
\def\XINT_flpower_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpower_zero
- 0#1\dummy {\XINT_flpower_b 1}%
- 0-\dummy {\XINT_flpower_b 0#1}%
+ #1-\XINT_flpower_zero
+ 0#1{\XINT_flpower_b 1}%
+ 0-{\XINT_flpower_b 0#1}%
\krof
}%
\def\XINT_flpower_zero [#1]#2#3#4#5%
@@ -19109,11 +19857,12 @@ first place.
}%
\def\XINT_flpower_loop #1#2#3%
{%
- \ifcase\XINT_isOne {#2}
- \xint_afterfi{\expandafter\XINT_flpower_loop_x\expandafter
+ \if0\XINT_isOne {#2}\xint_afterfi
+ {\expandafter\XINT_flpower_loop_x\expandafter
{\romannumeral0\XINTinfloatmul [#1]{#3}{#3}}%
- {\romannumeral0\xintdivision {#2}{2}}}%
- \or \expandafter\XINT_flpow_loop_end
+ {\romannumeral0\xintdivision {#2}{2}}%
+ }%
+ \else\expandafter\XINT_flpow_loop_end
\fi
{#1}{{#3}}%
}%
@@ -19169,13 +19918,13 @@ first place.
\def\XINT_FL_sqrt_checkifzeroorneg #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_FL_sqrt_iszero
- 0#1\dummy \XINT_FL_sqrt_isneg
- 0-\dummy {\XINT_FL_sqrt_b #1}%
+ #1-\XINT_FL_sqrt_iszero
+ 0#1\XINT_FL_sqrt_isneg
+ 0-{\XINT_FL_sqrt_b #1}%
\krof
}%
-\def\XINT_FL_sqrt_iszero #1[#2]{0[0]}%
-\def\XINT_FL_sqrt_isneg #1[#2]{\xintError:RootOfNegative 0[0]}%
+\def\XINT_FL_sqrt_iszero #1[#2]{0/1[0]}%
+\def\XINT_FL_sqrt_isneg #1[#2]{\xintError:RootOfNegative 0/1[0]}%
\def\XINT_FL_sqrt_b #1[#2]%
{%
\ifodd #2
@@ -19288,9 +20037,9 @@ first place.
}%
\def\XINT_flsqrt_big_j #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \if0\XINT_Sgn #1\Z
\expandafter \XINT_flsqrt_big_end_a
- \or \expandafter \XINT_flsqrt_big_k
+ \else \expandafter \XINT_flsqrt_big_k
\fi {#1}%
}%
\def\XINT_flsqrt_big_k #1#2#3%
@@ -19426,7 +20175,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2013/11/28 v1.09h Expandable partial sums with xint package (jfB)]%
+ [2013/12/18 v1.09i Expandable partial sums with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintSeries}}
% \lverb|&
@@ -19963,7 +20712,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2013/11/28 v1.09h Expandable continued fractions with xint package (jfB)]%
+ [2013/12/18 v1.09i Expandable continued fractions with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintCFrac}}
% \begin{macrocode}
@@ -20224,9 +20973,9 @@ first place.
\def\XINT_ftcc_D #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_ftcc_integer
- 0#1\dummy \XINT_ftcc_En
- 0-\dummy {\XINT_ftcc_Ep #1}%
+ #1-\XINT_ftcc_integer
+ 0#1\XINT_ftcc_En
+ 0-{\XINT_ftcc_Ep #1}%
\krof
}%
\def\XINT_ftcc_Ep #1\Z #2%
@@ -20258,9 +21007,9 @@ first place.
\def\XINT_ftcc_loop_d #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_ftcc_end
- 0#1\dummy \XINT_ftcc_loop_N
- 0-\dummy {\XINT_ftcc_loop_P #1}%
+ #1-\XINT_ftcc_end
+ 0#1\XINT_ftcc_loop_N
+ 0-{\XINT_ftcc_loop_P #1}%
\krof
}%
\def\XINT_ftcc_end #1\Z #2#3{ #3#2}%
@@ -20678,7 +21427,7 @@ first place.
\expandafter\XINT_igctcv_loop_l\expandafter
{\romannumeral0\xintrawwithzeros {#1/#2}}%
}%
-\def\XINT_igctcv_loop_l #1#2#3{\XINT_igctcv_loop_a {#3{#1[0]}}#2}%
+\def\XINT_igctcv_loop_l #1#2#3{\XINT_igctcv_loop_a {#3{#1}}#2}%1.09i removes [0]
\def\XINT_igctcv_end_a #1.#2#3#4#5%
{%
\expandafter\XINT_igctcv_end_b\expandafter
@@ -20777,7 +21526,7 @@ first place.
\def\XINT_cntcs #1#2%
{%
\ifnum #1<0
- \xint_afterfi { 0/1[0]}%
+ \xint_afterfi { }% 1.09i: a 0/1[0] was strangely here, removed
\else
\xint_afterfi {\expandafter\XINT_cntcs_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
@@ -20812,7 +21561,7 @@ first place.
\def\XINT_cntgc #1#2%
{%
\ifnum #1<0
- \xint_afterfi { 0/1[0]}%
+ \xint_afterfi { }% 1.09i there was as strange 0/1[0] here, removed
\else
\xint_afterfi {\expandafter\XINT_cntgc_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
@@ -20847,7 +21596,7 @@ first place.
\def\XINT_gcntgc #1#2#3%
{%
\ifnum #1<0
- \xint_afterfi { {0/1[0]}}%
+ \xint_afterfi { }% 1.09i now returns nothing
\else
\xint_afterfi {\expandafter\XINT_gcntgc_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
@@ -20943,7 +21692,7 @@ first place.
% technique
% of storing and retrieving data expandably as \emph{names} of control
% sequences. Intermediate computation results are stored as control sequences
-% |\.a/b[n]|.
+% |\.=a/b[n]|.
%
% Another peculiarity is that the input is allowed to contain (but only
% where the scanner looks for a
@@ -20958,7 +21707,7 @@ first place.
%
% These two things are a bit \emph{experimental} and perhaps I will opt for
% another approach at a later stage. To circumvent the potential hash-table
-% impact of the |\.a/b[n]| I
+% impact of the |\.=a/b[n]| I
% have provided the macro creators |\xintNewExpr| and |\xintNewFloatExpr|.
%
% Roughly speaking, the parser mechanism is as follows: at any given time the
@@ -20994,7 +21743,7 @@ first place.
% the final result is output as four tokens: the first one a catcode 11
% exclamation mark, the second one an error generating macro, the third one a
% printing macro and
-% the fourth is |\.a/b[n]|. The prefix
+% the fourth is |\.=a/b[n]|. The prefix
% |\xintthe| makes the output printable by killing the first two tokens.
%
% Version |1.08b| |[2013/06/14]| corrected a problem originating in the
@@ -21018,6 +21767,15 @@ first place.
% precedence level of the postfix operators |!|, |?| and |:| has been made lower
% than the one of functions.
%
+% Version |1.09i| |[2013/12/18]| unpacks count and dimen registers and control
+% squences, with tacit multiplication. It has also made small improvements
+% (speed gains in macro expansions in quite a few places.
+%
+% Also, |1.09i| implements |\xintiiexpr|, |\xinttheiiexpr|. New function |frac|.
+% And encapsulation in |\csname..\endcsname| is done with |.=| as first tokens,
+% so unpacking with |\string| can be done in a completely escape char agnostic
+% way.
+%
% \localtableofcontents
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
@@ -21116,172 +21874,211 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2013/11/28 v1.09h Expandable expression parser (jfB)]%
-% \end{macrocode}
-% \subsection{Helper macros}
-% \begin{macrocode}
-\def\xint_gob_til_dot #1.{}%
-\def\xint_gob_til_dot_andstop #1.{ }%
-\def\xint_gob_til_! #1!{}% nota bene: ! is of catcode 11
+ [2013/12/18 v1.09i Expandable expression parser (jfB)]%
+% \end{macrocode}
+% \subsection{Encapsulation in pseudo cs names, helper macros}
+% \lverb|1.09i uses .= for encapsulation, thus allowing \escapechar to be
+% anything (all previous releases were with ., so \escapechar 46 was forbidden).
+% Besides, the \edef definition has \space already expanded, perhaps this will
+% compensate a tiny bit the time penalty of `.=' viz `.' in unlocking... well
+% not really, I guess.|
+% \begin{macrocode}
+\def\xint_gob_til_! #1!{}% nota bene: ! is of catcode 11
+\edef\XINT_expr_lock #1!%
+ {\noexpand\expandafter\space\noexpand\csname .=#1\noexpand\endcsname }%
+\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }%
+\def\XINT_expr_unlock_a #1.={}%
\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
-\def\XINT_newexpr_stripprefix #1>{\noexpand\romannumeral-`0}%
+\def\XINT_newexpr_setprefix #1>{\noexpand\romannumeral-`0}%
+\def\xint_UDxintrelaxfork #1\xint_relax #2#3\krof {#2}%
% \end{macrocode}
-% \subsection{Encapsulation in pseudo names}
+% \subsection{\csh{xintexpr}, \csh{xinttheexpr}, \csh{xintthe}, ...}
+% \lverb|\xintthe is defined with a parameter, I guess I wanted to make sure no
+% stray space tokens could cause a problem.
+%
+% With 1.09i, \xintiexpr replaces
+% \xintnumexpr which is kept for compatibility but will be removed at some
+% point. Should perhaps issue a warning, but well, people can also read the
+% documentation. Also 1.09i removes \xinttheeval.
+%
+% 1.09i has re-organized the material here.|
% \begin{macrocode}
-\def\XINT_expr_lock #1!{\expandafter\space\csname .#1\endcsname }%
-\def\XINT_expr_unlock {\expandafter\xint_gob_til_dot\string }%
-\def\XINT_expr_usethe {use_xintthe!\xintError:use_xintthe! }%
\def\XINT_expr_done {!\XINT_expr_usethe\XINT_expr_print }%
-\def\XINT_expr_print #1{\XINT_expr_unlock #1}%
-\def\XINT_flexpr_done {!\XINT_expr_usethe\XINT_flexpr_print }%
-\def\XINT_flexpr_print #1{\xintFloat:csv{\XINT_expr_unlock #1}}%
-\def\XINT_numexpr_print #1{\xintRound:csv{\XINT_expr_unlock #1}}%
+\let\XINT_iiexpr_done \XINT_expr_done
+\def\XINT_iexpr_done {!\XINT_expr_usethe\XINT_iexpr_print }%
+\def\XINT_flexpr_done {!\XINT_expr_usethe\XINT_flexpr_print }%
+\def\XINT_boolexpr_done{!\XINT_expr_usethe\XINT_boolexpr_print }%
+\def\XINT_expr_usethe {use_xintthe!\xintError:use_xintthe! }%
+\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral-`0#1}%
+\let\XINT_expr_print \XINT_expr_unlock
+\def\XINT_iexpr_print #1{\xintRound:csv {\XINT_expr_unlock #1}}%
+\def\XINT_flexpr_print #1{\xintFloat:csv {\XINT_expr_unlock #1}}%
\def\XINT_boolexpr_print #1{\xintIsTrue:csv{\XINT_expr_unlock #1}}%
-% \end{macrocode}
-% \subsection{\csh{xintifboolexpr}, \csh{xintifboolfloatexpr}}
-% \lverb|1.09c. Not to be used on comma separated expressions. I could
-% perhaps use \xintORof:csv (or AND, or XOR) to allow it?|
-% \begin{macrocode}
-\def\xintifboolexpr #1{\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
-\def\xintifboolfloatexpr #1{\romannumeral0\xintifnotzero
- {\xintthefloatexpr #1\relax}}%
-% \end{macrocode}
-% \subsection{\csh{xintexpr}, \csh{xinttheexpr}, \csh{xintthe}}
-% \begin{macrocode}
-\def\xintexpr {\romannumeral0\xinteval }%
-\def\xinteval
-{%
- \expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext
-}%
-\def\xinttheeval {\expandafter\xint_gobble_ii\romannumeral0\xinteval }%
-\def\xinttheexpr {\romannumeral-`0\xinttheeval }%
-\def\XINT_numexpr_post !\XINT_expr_usethe\XINT_expr_print%
- { !\XINT_expr_usethe\XINT_numexpr_print }%
-\def\xintnumexpr {\romannumeral0\expandafter\XINT_numexpr_post
- \romannumeral0\xinteval }%
-\def\xintthenumexpr {\romannumeral-`0\xintthe\xintnumexpr }%
-\def\XINT_boolexpr_post !\XINT_expr_usethe\XINT_expr_print%
- { !\XINT_expr_usethe\XINT_boolexpr_print }%
-\def\xintboolexpr {\romannumeral0\expandafter\XINT_boolexpr_post
- \romannumeral0\xinteval }%
-\def\xinttheboolexpr {\romannumeral-`0\xintthe\xintboolexpr }%
-\def\xintfloatexpr {\romannumeral0\xintfloateval }%
+\def\xintexpr {\romannumeral0\xinteval }%
+\def\xintfloatexpr {\romannumeral0\xintfloateval }%
+\def\xintiiexpr {\romannumeral0\xintiieval }%
+\def\xinteval
+ {\expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext }%
\def\xintfloateval
-{%
- \expandafter\XINT_flexpr_until_end_a \romannumeral-`0\XINT_expr_getnext
-}%
-\def\xintthefloatexpr {\romannumeral-`0\xintthe\xintfloatexpr }%
-\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral-`0#1}%
+ {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintiieval
+ {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xinttheexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xinteval }%
+\def\xintthefloatexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintfloateval }%
+\def\xinttheiiexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintiieval }%
+\def\xintiexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_iexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xinttheiexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_iexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\let\xintnumexpr \xintiexpr % deprecated
+\let\xintthenumexpr\xinttheiexpr % deprecated
+% \end{macrocode}
+% \subsection{\csh{xintifboolexpr}, \csh{xintifboolfloatexpr}, csh{xintifbooliiexpr}}
+% \lverb|1.09c. Does not work with comma separated expressions. I could
+% make use \xintORof:csv (or AND, or XOR) to allow it, but don't know it the
+% overhead is worth it.
+%
+% 1.09i adds \xintifbooliiexpr |
+% \begin{macrocode}
+\def\xintifboolexpr #1%
+ {\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
+\def\xintifboolfloatexpr #1%
+ {\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
+\def\xintifbooliiexpr #1%
+ {\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
% \end{macrocode}
% \subsection{\csh{XINT\_get\_next}: looking for a number}
% \lverb|June 14: 1.08b adds a second \romannumeral-`0 to \XINT_expr_getnext in
-% an attempt to solve a problem with space tokens stopping the \romannumeral
-% and thus preventing expansion of the following token. For example: 1+
-% \the\cnta caused a problem, as `\the' was not expanded. I did not define
+% an attempt to solve a problem with space tokens stopping the \romannumeral and
+% thus preventing expansion of the following token. For example: 1+ \the\cnta
+% caused a problem, as `\the' was not expanded. I did not define
% \XINT_expr_getnext as a macro with parameter (which would have cured
% preventively this), precisely to try to recognize brace pairs. The second
% \romannumeral-`0 is added for the same reason in other places.
%
-% The get-next scans forward to find a number: after expansion of what
-% comes next, an opening parenthesis signals a parenthesized
-% sub-expression, a ! with catcode 11 signals there was there an
-% \xintexpr.. \relax sub-expression (now evaluated), a minus is a prefix
-% operator, a plus
-% is silently ignored, a digit or decimal point signals to start gathering
-% a number, braced material {...} is allowed and will be directly fed
-% into a \csname..\endcsname for complete expansion which must delivers a
-% (fractional) number, possibly ending in [n]; explicit square brackets
-% must be enclosed into such braces. Once a number issues from the
-% previous procedures, it is a locked into a \csname...\endcsname, and the
-% flow then proceeds with \XINT_expr_getop which will scan for an infix
-% or postfix operator following the number.
+% The get-next scans forward to find a number: after expansion of what comes
+% next, an opening parenthesis signals a parenthesized sub-expression, a ! with
+% catcode 11 signals there was there an \xintexpr.. \relax sub-expression (now
+% evaluated), a minus is a prefix operator, a plus is silently ignored, a digit
+% or decimal point signals to start gathering a number, braced material {...} is
+% allowed and will be directly fed into a \csname..\endcsname for complete
+% expansion which must delivers a (fractional) number, possibly ending in [n];
+% explicit square brackets must be enclosed into such braces. Once a number
+% issues from the previous procedures, it is a locked into a
+% \csname...\endcsname, and the flow then proceeds with \XINT_expr_getop which
+% will scan for an infix or postfix operator following the number.
%
% A special r\^ole is played by underscores _ for use with \xintNewExpr
% to input macro parameters.
%
-% Release 1.09a implements functions; the idea is that a letter
-% (actually, anything not otherwise recognized!)
-% triggers the function name gatherer, the comma is
-% promoted to a binary operator of
-% priority intermediate between parentheses and infix operators. The code had
-% some other revisions in order for all the _getnext and _getop macros to now be
-% shared by \xintexpr and \xintflexpr. Perhaps some of the comments are now
-% obsolete.
-% |
+% Release 1.09a implements functions; the idea is that a letter (actually,
+% anything not otherwise recognized!) triggers the function name gatherer, the
+% comma is promoted to a binary operator of priority intermediate between
+% parentheses and infix operators. The code had some other revisions in order
+% for all the _getnext and _getop macros to now be shared by \xintexpr and
+% \xintflexpr.
+%
+% 1.09i now allows direct insertion of \count's, \dimen's and \skip's which will
+% be unpacked using \number.
+%
+% 1.09i speeds up a bit the recognition of a braced thing: the case of a single
+% braced control sequence makes a third expansion mandatory, let's do it
+% immediately and not wait. So macros got shuffled and modified a bit.
+%
+% \XINT_expr_unpackvariable does not insert a [0] for compatibility with
+% \xintiiexpr. A [0] would have made a bit faster \xintexpr macros when dealing
+% with an unpacked count control sequence, as without it the \xintnum will be
+% used in the parsing by xintfrac macros when the number is used. But [0] is not
+% accepted by most macros ultimately called by \xintiiexpr.|
% \begin{macrocode}
\def\XINT_expr_getnext
{%
\expandafter\XINT_expr_getnext_checkforbraced_a
\romannumeral-`0\romannumeral-`0%
}%
-\def\XINT_expr_getnext_checkforbraced_a #1%
-{%
- \XINT_expr_getnext_checkforbraced_b #1\W\Z {#1}%
-}%
-\def\XINT_expr_getnext_checkforbraced_b #1#2%
+\def\XINT_expr_getnext_checkforbraced_a #1% was done later in <1.09i
{%
- \xint_UDwfork
- #1\dummy \XINT_expr_getnext_emptybracepair
- #2\dummy \XINT_expr_getnext_onetoken_perhaps
- \W\dummy \XINT_expr_getnext_gotbracedstuff
- \krof
-}%
-\def\XINT_expr_getnext_onetoken_perhaps\Z #1%
-{%
- \expandafter\XINT_expr_getnext_checkforbraced_c\expandafter
+ \expandafter\XINT_expr_getnext_checkforbraced_b\expandafter
{\romannumeral-`0#1}%
}%
-\def\XINT_expr_getnext_checkforbraced_c #1%
+\def\XINT_expr_getnext_checkforbraced_b #1%
{%
- \XINT_expr_getnext_checkforbraced_d #1\W\Z {#1}%
+ \XINT_expr_getnext_checkforbraced_c #1\xint_relax\Z {#1}%
}%
-\def\XINT_expr_getnext_checkforbraced_d #1#2%
+\def\XINT_expr_getnext_checkforbraced_c #1#2%
{%
- \xint_UDwfork
- #1\dummy \XINT_expr_getnext_emptybracepair
- #2\dummy \XINT_expr_getnext_onetoken_wehope
- \W\dummy \XINT_expr_getnext_gotbracedstuff
+ \xint_UDxintrelaxfork
+ #1\XINT_expr_getnext_wasemptyorspace
+ #2\XINT_expr_getnext_gotonetoken_wehope
+ \xint_relax\XINT_expr_getnext_gotbracedstuff
\krof
}% doubly braced things are not acceptable, will cause errors.
-\def\XINT_expr_getnext_emptybracepair #1{\XINT_expr_getnext }%
-\def\XINT_expr_getnext_gotbracedstuff #1\W\Z #2% {..} -> number/fraction
+\def\XINT_expr_getnext_wasemptyorspace #1{\XINT_expr_getnext }%
+\def\XINT_expr_getnext_gotbracedstuff #1\xint_relax\Z #2%
{%
- \expandafter\XINT_expr_getop\csname .#2\endcsname
+ \expandafter\XINT_expr_getop\csname .=#2\endcsname
}%
-\def\XINT_expr_getnext_onetoken_wehope\Z #1% #1 isn't a control sequence!
-{%
+\def\XINT_expr_getnext_gotonetoken_wehope\Z #1%
+{% screens out sub-expressions and \count or \dimen registers/variables
\xint_gob_til_! #1\XINT_expr_subexpr !%
- \expandafter\XINT_expr_getnext_onetoken_fork\string #1%
-}% after this #1 should be now a catcode 12 token.
-\def\XINT_expr_subexpr !#1!{\expandafter\XINT_expr_getop\xint_gobble_ii }%
+ \ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs
+ \expandafter\XINT_expr_countdimenetc_fork
+ \else
+ \expandafter\expandafter\expandafter
+ \XINT_expr_getnext_onetoken_fork\expandafter\string
+ \fi
+ #1%
+}%
+\def\XINT_expr_subexpr !#1\fi {\expandafter\XINT_expr_getop\xint_gobble_iii }%
+\def\XINT_expr_countdimenetc_fork #1%
+{%
+ \ifx\count#1\else\ifx#1\dimen\else\ifx#1\numexpr\else\ifx#1\dimexpr\else
+ \ifx\skip#1\else\ifx\glueexpr#1\else
+ \XINT_expr_unpackvariable
+ \fi\fi\fi\fi\fi\fi
+ \expandafter\XINT_expr_getnext\number #1%
+}%
+\def\XINT_expr_unpackvariable\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext
+ \number #1{\fi\fi\fi\fi\fi\fi
+ \expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
% \end{macrocode}
% \lverb|1.09a: In order to have this code shared by \xintexpr and
-% \xintfloatexpr, I
-% have moved to the until macros the responsability to choose expr or floatexpr,
-% hence here, the opening parenthesis for example can not be triggered directly
-% as it would not know in which context it works. Hence the \xint_c_xviii ({}. And
-% also the mechanism of \xintNewExpr has been modified to allow use of #. |
+% \xintfloatexpr, I have moved to the until macros the responsability to choose
+% expr or floatexpr, hence here, the opening parenthesis for example can not be
+% triggered directly as it would not know in which context it works. Hence the
+% \xint_c_xviii ({}. And also the mechanism of \xintNewExpr has been modified to
+% allow use of #.
+%
+% 1.09i also has \xintiiexpr. |
% \begin{macrocode}
\begingroup
\lccode`*=`#
\lowercase{\endgroup
-\def\XINT_expr_sixwayfork #1(-.+*\dummy #2#3\krof {#2}%
+\def\XINT_expr_sixwayfork #1(-.+*#2#3\krof {#2}%
\def\XINT_expr_getnext_onetoken_fork #1%
-{% The * is in truth catcode 12 #. For (clever!) use with \xintNewExpr.
+{% The * is in truth catcode 12 #. For (hacking) use with \xintNewExpr.
\XINT_expr_sixwayfork
- #1-.+*\dummy {\xint_c_xviii ({}}% back to until to trigger oparen
- (#1.+*\dummy -%
- (-#1+*\dummy {\XINT_expr_scandec_II.}%
- (-.#1*\dummy \XINT_expr_getnext%
- (-.+#1\dummy {\XINT_expr_scandec_II}%
- (-.+*\dummy {\XINT_expr_scan_dec_or_func #1}%
+ #1-.+*{\xint_c_xviii ({}}% back to until for oparen triggering
+ (#1.+*-%
+ (-#1+*{\XINT_expr_scandec_II.}%
+ (-.#1*\XINT_expr_getnext%
+ (-.+#1{\XINT_expr_scandec_II}%
+ (-.+*{\XINT_expr_scan_dec_or_func #1}%
\krof
}}%
% \end{macrocode}
% \subsection{\csh{XINT\_expr\_scan\_dec\_or\_func}: collecting an integer or
% decimal number or function name}
+% \lverb|\XINT_expr_scanfunc_b rewritten in 1.09i|
% \begin{macrocode}
-\def\XINT_expr_scan_dec_or_func #1% this #1 of catcode 12
+\def\XINT_expr_scan_dec_or_func #1% this #1 has necessarily here catcode 12
{%
\ifnum \xint_c_ix<1#1
\expandafter\XINT_expr_scandec_I
@@ -21306,24 +22103,26 @@ first place.
\xint_afterfi{\expandafter\XINT_expr_scanfunc_b \string #1}%
\fi
}%
+\def\xint_UDparenfork #1()#2#3\krof {#2}%
\def\XINT_expr_scanfunc_b #1%
{%
- \if #1(\expandafter \xint_gobble_iii\fi
- \xint_firstofone
- {% added in 1.09c for bool and togl
- \if #1)\expandafter \xint_gobble_i
- \else \expandafter \xint_firstoftwo
- \fi }%
- {\XINT_expr_scanfunc_c #1}(%
+ \xint_UDparenfork
+ #1){(}% and then \XINT_expr_func
+ (#1{(}% and then \XINT_expr_func (this is for bool/toggle names)
+ (){\XINT_expr_scanfunc_c #1}%
+ \krof
}%
\def\XINT_expr_scanfunc_panic {\xintError:bigtroubleahead(0\relax }%
-\def\XINT_expr_func #1(% common to expr and flexpr
+\def\XINT_expr_func #1(% common to expr and flexpr and iiexpr
{%
\xint_c_xviii @{#1}% functions have the highest priority.
}%
% \end{macrocode}
% \lverb|Scanning for a number of fraction. Once gathered, lock it and do
-% _getop.|
+% _getop. 1.09i modifies \XINT_expr_scanintpart_a (splits _aa) and also
+% \XINT_expr_scanfracpart_a in
+% order for the tacit multiplication of \count's and \dimen's to be compatible
+% with escape-char=a digit|
% \begin{macrocode}
\def\XINT_expr_scandec_I
{%
@@ -21335,17 +22134,24 @@ first place.
\expandafter\XINT_expr_getop\romannumeral-`0\expandafter
\XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b
}%
-\def\XINT_expr_scanintpart_a #1%
+\def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN}
+{%
+ \ifcat #1\relax
+ \expandafter !%
+ \else \expandafter\expandafter\expandafter
+ \XINT_expr_scanintpart_aa\expandafter\string
+ \fi #1%
+}%
+\def\XINT_expr_scanintpart_aa #1%
{%
- \ifnum \xint_c_ix<1\string#1
- \expandafter\expandafter\expandafter\XINT_expr_scanintpart_b
- \expandafter\string
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanintpart_b
\else
- \if #1.%
+ \if .#1%
\expandafter\expandafter\expandafter
\XINT_expr_scandec_transition
- \else
- \expandafter\expandafter\expandafter !% ! of catcode 11...
+ \else % gather what we got so far, leave catcode 12 #1 in stream
+ \expandafter\expandafter\expandafter !% ! of catcode 11 ...
\fi
\fi
#1%
@@ -21361,10 +22167,17 @@ first place.
\XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0%
}%
\def\XINT_expr_scanfracpart_a #1%
+{%
+ \ifcat #1\relax
+ \expandafter !%
+ \else \expandafter\expandafter\expandafter
+ \XINT_expr_scanfracpart_aa\expandafter\string
+ \fi #1%
+}%
+\def\XINT_expr_scanfracpart_aa #1%
{%
- \ifnum \xint_c_ix<1\string#1
- \expandafter\expandafter\expandafter\XINT_expr_scanfracpart_b
- \expandafter\string
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanfracpart_b
\else
\expandafter !%
\fi
@@ -21394,8 +22207,10 @@ first place.
%
% In versions earlier than 1.09a the <operator> was already made in to a control
% sequence; but now it is a left as a token and will be (generally) converted by
-% the until
-% macro which knows if it is in a \xintexpr or an \xintfloatexpr.
+% the until macro which knows if it is in a \xintexpr or an \xintfloatexpr. (or
+% an \xintiiexpr, since 1.09i)
+%
+% 1.09i allows \count's, \dimen's, \skip's with tacit multiplication.
%
% |
% \begin{macrocode}
@@ -21405,23 +22220,18 @@ first place.
\romannumeral-`0\romannumeral-`0%
}%
\def\XINT_expr_getop_a #1#2%
-{% if an un-expandable control sequence is found, must be the ending \relax
- \ifcat #2\relax
- \ifx #2\relax
- \expandafter\expandafter\expandafter
- \XINT_expr_foundend
- \else
- \XINT_expr_unexpectedtoken
- \expandafter\expandafter\expandafter
- \XINT_expr_getop
- \fi
- \else
- \expandafter\XINT_expr_foundop\expandafter #2%
+{% if a control sequence is found, must be either \relax or register|variable
+ \ifcat #2\relax\expandafter\xint_firstoftwo
+ \else \expandafter\xint_secondoftwo
\fi
- #1%
+ {\ifx #2\relax\expandafter\XINT_expr_foundend\expandafter#1%
+ \else
+ \xint_afterfi{\XINT_expr_foundop *#1#2}%
+ \fi }%
+ {\XINT_expr_foundop #2#1}%
}%
\def\XINT_expr_foundend {\xint_c_ \relax }% \relax is a place holder here.
-\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.f>
+\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.=f>
{% 1.09a: no control sequence \XINT_expr_op_#1, code common to expr/flexpr
\ifcsname XINT_expr_precedence_#1\endcsname
\expandafter\xint_afterfi\expandafter
@@ -21441,43 +22251,38 @@ first place.
\def#1##1%
{%
\xint_UDsignfork
- ##1\dummy {\expandafter#1\romannumeral-`0#3}%
- -\dummy {#2##1}%
+ ##1{\expandafter#1\romannumeral-`0#3}%
+ -{#2##1}%
\krof
}%
\def#2##1##2%
{%
\ifcase ##1\expandafter #4%
- \or \xint_afterfi{%
- \XINT_expr_extra_closing_paren
- \expandafter #1\romannumeral-`0\XINT_expr_getop
- }%
- \else \xint_afterfi{%
- \expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname
- }%
+ \or\xint_afterfi{%
+ \XINT_expr_extra_closing_paren
+ \expandafter #1\romannumeral-`0\XINT_expr_getop
+ }%
+ \else
+ \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname }%
\fi
}%
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_until_end_a\expandafter\endcsname
- \csname XINT_expr_until_end_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\expandafter\endcsname
- \csname XINT_expr_done\endcsname
- {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_until_end_a\expandafter\endcsname
- \csname XINT_flexpr_until_end_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\expandafter\endcsname
- \csname XINT_flexpr_done\endcsname
- {flexpr}%
+ \csname XINT_#1_until_end_a\expandafter\endcsname
+ \csname XINT_#1_until_end_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_#1_done\endcsname
+ {#1}%
+}%
\def\XINT_expr_extra_closing_paren {\xintError:removed }%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
\def #1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
\let #2#1%
\def #3##1{\xint_UDsignfork
- ##1\dummy {\expandafter #3\romannumeral-`0#5}%
- -\dummy {#4##1}%
+ ##1{\expandafter #3\romannumeral-`0#5}%
+ -{#4##1}%
\krof }%
\def #4##1##2%
{%
@@ -21488,31 +22293,31 @@ first place.
\fi
}%
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_op_(\expandafter\endcsname
- \csname XINT_expr_oparen\expandafter\endcsname
- \csname XINT_expr_until_)_a\expandafter\endcsname
- \csname XINT_expr_until_)_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\endcsname
- {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_op_(\expandafter\endcsname
- \csname XINT_flexpr_oparen\expandafter\endcsname
- \csname XINT_flexpr_until_)_a\expandafter\endcsname
- \csname XINT_flexpr_until_)_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\endcsname
- {flexpr}%
+ \csname XINT_#1_op_(\expandafter\endcsname
+ \csname XINT_#1_oparen\expandafter\endcsname
+ \csname XINT_#1_until_)_a\expandafter\endcsname
+ \csname XINT_#1_until_)_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\endcsname
+ {#1}%
+}%
\def\XINT_expr_missing_cparen {\xintError:inserted \xint_c_ \XINT_expr_done }%
-\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_expr_op_)\endcsname\XINT_expr_getop
+\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
\expandafter\let\csname XINT_flexpr_precedence_)\endcsname \xint_c_i
+\expandafter\let\csname XINT_iiexpr_precedence_)\endcsname \xint_c_i
+\expandafter\let\csname XINT_expr_op_)\endcsname \XINT_expr_getop
\expandafter\let\csname XINT_flexpr_op_)\endcsname\XINT_expr_getop
+\expandafter\let\csname XINT_iiexpr_op_)\endcsname\XINT_expr_getop
% \end{macrocode}
% \subsection{The \csh{XINT\_expr\_until\_<op>} macros for boolean operators,
% comparison operators, arithmetic operators, scientfic notation.}
-% \lverb|Extended in 1.09a with comparison and boolean operators.|
+% \lverb|Extended in 1.09a with comparison and boolean operators.
+% 1.09i adds \xintiiexpr and incorporates optional part [\XINTdigits] for a tiny
+% bit faster float operations now already equipped with their optional
+% argument|.
% \begin{macrocode}
-\def\XINT_tmpb #1#2#3#4#5#6%
+\def\XINT_tmpb #1#2#3#4#5#6%#7%
{%
\expandafter\XINT_tmpc
\csname XINT_#1_op_#3\expandafter\endcsname
@@ -21521,9 +22326,9 @@ first place.
\csname XINT_#1_op_-#5\expandafter\endcsname
\csname xint_c_#4\expandafter\endcsname
\csname #2#6\expandafter\endcsname
- \csname XINT_expr_precedence_#3\endcsname {#1}%
+ \csname XINT_expr_precedence_#3\endcsname {#1}%{#7}%
}%
-\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+\def\XINT_tmpc #1#2#3#4#5#6#7#8#9%
{%
\def #1##1% \XINT_expr_op_<op>
{% keep value, get next number and operator, then do until
@@ -21532,8 +22337,8 @@ first place.
}%
\def #2##1##2% \XINT_expr_until_<op>_a
{\xint_UDsignfork
- ##2\dummy {\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -\dummy {#3##1##2}%
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
\krof }%
\def #3##1##2##3##4% \XINT_expr_until_<op>_b
{% either execute next operation now, or first do next (possibly unary)
@@ -21543,12 +22348,12 @@ first place.
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3%
- \csname .#6{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
+ \csname .=#6#9{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
\fi
}%
\let #7#5%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1{}}%
\xintApplyInline {\XINT_tmpa }{%
{|{iii}{vi}{OR}}%
{&{iv}{vi}{AND}}%
@@ -21563,7 +22368,7 @@ first place.
{e{ix}{ix}{fE}}%
{E{ix}{ix}{fE}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1{}}%
\xintApplyInline {\XINT_tmpa }{%
{|{iii}{vi}{OR}}%
{&{iv}{vi}{AND}}%
@@ -21571,7 +22376,7 @@ first place.
{>{v}{vi}{Gt}}%
{={v}{vi}{Eq}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1{[\XINTdigits]}}%
\xintApplyInline {\XINT_tmpa }{%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
@@ -21581,6 +22386,21 @@ first place.
{e{ix}{ix}{fE}}%
{E{ix}{ix}{fE}}%
}%
+\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1{}}%
+\xintApplyInline {\XINT_tmpa }{%
+ {|{iii}{vi}{OR}}%
+ {&{iv}{vi}{AND}}%
+ {<{v}{vi}{Lt}}%
+ {>{v}{vi}{Gt}}%
+ {={v}{vi}{Eq}}%
+ {+{vi}{vi}{iiAdd}}%
+ {-{vi}{vi}{iiSub}}%
+ {*{vii}{vii}{iiMul}}%
+ {/{vii}{vii}{iiQuo}}%
+ {^{viii}{viii}{iiPow}}%
+ {e{ix}{ix}{iE}}%
+ {E{ix}{ix}{iE}}%
+}%
% \end{macrocode}
% \subsection{The comma as binary operator}
% \lverb|New with 1.09a.|
@@ -21593,8 +22413,8 @@ first place.
}%
\def #2##1##2% \XINT_expr_until_,_a
{\xint_UDsignfork
- ##2\dummy {\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -\dummy {#3##1##2}%
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
\krof }%
\def #3##1##2##3##4% \XINT_expr_until_,_b
{%
@@ -21604,35 +22424,34 @@ first place.
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3%
- \csname .\XINT_expr_unlock ##1,\XINT_expr_unlock ##4\endcsname }%
+ \csname .=\XINT_expr_unlock ##1,\XINT_expr_unlock ##4\endcsname }%
\fi
}%
\let #5\xint_c_ii
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_op_,\expandafter\endcsname
- \csname XINT_expr_until_,_a\expandafter\endcsname
- \csname XINT_expr_until_,_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\expandafter\endcsname
- \csname XINT_expr_precedence_,\endcsname {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_op_,\expandafter\endcsname
- \csname XINT_flexpr_until_,_a\expandafter\endcsname
- \csname XINT_flexpr_until_,_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\expandafter\endcsname
- \csname XINT_expr_precedence_,\endcsname {flexpr}%
+ \csname XINT_#1_op_,\expandafter\endcsname
+ \csname XINT_#1_until_,_a\expandafter\endcsname
+ \csname XINT_#1_until_,_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_,\endcsname {#1}%
+}%
% \end{macrocode}
-% \subsection{\csh{XINT\_expr\_op\_-<level>}: minus as prefix inherits its precedence level}
+% \subsection{\csh{XINT\_expr\_op\_-<level>}: minus as prefix inherits its
+% precedence level}
+% \lverb|1.09i: \xintiiexpr must use \xintiiOpp (or at least \xintiOpp, but that
+% would be a waste; however impacts round and trunc as I allow them).|
% \begin{macrocode}
-\def\XINT_tmpa #1#2%
+\def\XINT_tmpa #1#2#3%
{%
\expandafter\XINT_tmpb
- \csname XINT_#1_op_-#2\expandafter\endcsname
- \csname XINT_#1_until_-#2_a\expandafter\endcsname
- \csname XINT_#1_until_-#2_b\expandafter\endcsname
- \csname xint_c_#2\endcsname {#1}%
+ \csname XINT_#1_op_-#3\expandafter\endcsname
+ \csname XINT_#1_until_-#3_a\expandafter\endcsname
+ \csname XINT_#1_until_-#3_b\expandafter\endcsname
+ \csname xint_c_#3\endcsname {#1}#2%
}%
-\def\XINT_tmpb #1#2#3#4#5%
+\def\XINT_tmpb #1#2#3#4#5#6%
{%
\def #1% \XINT_expr_op_-<level>
{% get next number+operator then switch to _until macro
@@ -21640,8 +22459,8 @@ first place.
}%
\def #2##1% \XINT_expr_until_-<l>_a
{\xint_UDsignfork
- ##1\dummy {\expandafter #2\romannumeral-`0#1}%
- -\dummy {#3##1}%
+ ##1{\expandafter #2\romannumeral-`0#1}%
+ -{#3##1}%
\krof }%
\def #3##1##2##3% \XINT_expr_until_-<l>_b
{% _until tests precedence level with next op, executes now or postpones
@@ -21650,12 +22469,13 @@ first place.
\csname XINT_#5_op_##2\endcsname {##3}}%
\else
\xint_afterfi {\expandafter ##1\expandafter ##2%
- \csname .\xintOpp{\XINT_expr_unlock ##3}\endcsname }%
+ \csname .=#6{\XINT_expr_unlock ##3}\endcsname }%
\fi
}%
}%
-\xintApplyInline{\XINT_tmpa {expr}}{{vi}{vii}{viii}{ix}}%
-\xintApplyInline{\XINT_tmpa {flexpr}}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {expr}\xintOpp}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {flexpr}\xintOpp}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {iiexpr}\xintiiOpp}{{vi}{vii}{viii}{ix}}%
% \end{macrocode}
% \subsection{? as two-way conditional}
% \lverb|New with 1.09a. Modified in 1.09c to have less precedence than
@@ -21671,6 +22491,7 @@ first place.
{\XINT_expr_getnext #2}%
}%
\let\XINT_flexpr_op_?\XINT_expr_op_?
+\let\XINT_iiexpr_op_?\XINT_expr_op_?
% \end{macrocode}
% \subsection{: as three-way conditional}
% \lverb|New with 1.09a. Modified in 1.09c to have less precedence than
@@ -21685,6 +22506,7 @@ first place.
{\XINT_expr_getnext #4}%
}%
\let\XINT_flexpr_op_:\XINT_expr_op_:
+\let\XINT_iiexpr_op_:\XINT_expr_op_:
% \end{macrocode}
% \subsection{! as postfix factorial operator}
% \lverb|The factorial is currently the exact one, there is no float version.
@@ -21695,269 +22517,361 @@ first place.
% \begin{macrocode}
\let\XINT_expr_precedence_! \xint_c_x
\def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop
- \csname .\xintFac{\XINT_expr_unlock #1}\endcsname }% [0] removed in 1.09c
+ \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
\let\XINT_flexpr_op_!\XINT_expr_op_!
+\def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop
+ \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
% \end{macrocode}
% \subsection{Functions}
% \lverb|New with 1.09a. Names of ..Float..:csv macros have been changed in
% 1.09h |
% \begin{macrocode}
-\def\XINT_expr_op_@ #1%
-{%
- \ifcsname XINT_expr_onlitteral_#1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter\XINT_expr_op_@@
- \fi {#1}%
+\def\XINT_tmpa #1#2#3#4{%
+ \def #1##1%
+ {%
+ \ifcsname XINT_expr_onlitteral_##1\endcsname
+ \expandafter\XINT_expr_funcoflitteral
+ \else
+ \expandafter #2%
+ \fi {##1}%
+ }%
+ \def #2##1%
+ {%
+ \ifcsname XINT_#4_func_##1\endcsname
+ \xint_afterfi
+ {\expandafter\expandafter\csname XINT_#4_func_##1\endcsname}%
+ \else \csname xintError:unknown `##1\string'\endcsname
+ \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
+ \fi
+ \romannumeral-`0#3%
+ }%
}%
-\def\XINT_flexpr_op_@ #1%
-{%
- \ifcsname XINT_expr_onlitteral_#1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter\XINT_flexpr_op_@@
- \fi {#1}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+ \expandafter\XINT_tmpa
+ \csname XINT_#1_op_@\expandafter\endcsname
+ \csname XINT_#1_op_@@\expandafter\endcsname
+ \csname XINT_#1_oparen\endcsname {#1}%
}%
\def\XINT_expr_funcoflitteral #1%
{%
\expandafter\expandafter\csname XINT_expr_onlitteral_#1\endcsname
\romannumeral-`0\XINT_expr_scanfunc
}%
-\def\XINT_expr_op_@@ #1%
-{%
- \ifcsname XINT_expr_func_#1\endcsname
- \xint_afterfi{\expandafter\expandafter\csname XINT_expr_func_#1\endcsname}%
- \else \xintError:unknownfunction
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0\XINT_expr_oparen
-}%
-\def\XINT_flexpr_op_@@ #1%
-{%
- \ifcsname XINT_flexpr_func_#1\endcsname
- \xint_afterfi{\expandafter\expandafter\csname XINT_flexpr_func_#1\endcsname}%
- \else \xintError:unknownfunction
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0\XINT_flexpr_oparen
-}%
\def\XINT_expr_onlitteral_bool #1#2#3{\expandafter\XINT_expr_getop
- \csname .\xintBool{#3}\endcsname }%
+ \csname .=\xintBool{#3}\endcsname }%
\def\XINT_expr_onlitteral_togl #1#2#3{\expandafter\XINT_expr_getop
- \csname .\xintToggle{#3}\endcsname }%
-\def\XINT_expr_func_unknown #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .0[0]\endcsname
-}%
+ \csname .=\xintToggle{#3}\endcsname }%
+\def\XINT_expr_func_unknown #1#2#3% 1.09i removes [0], because \xintiiexpr
+ {\expandafter #1\expandafter #2\csname .=0\endcsname }%
\def\XINT_expr_func_reduce #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIrr {\XINT_expr_unlock #3}\endcsname
+ .=\xintIrr {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
+% \XINT_iiexpr_func_reduce not defined
+\def\XINT_expr_func_frac #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintTFrac {\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_flexpr_func_frac #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\XINTinFloatFrac [\XINTdigits]{\XINT_expr_unlock #3}\endcsname
+}%
+% \XINT_iiexpr_func_frac not defined
\def\XINT_expr_func_sqr #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSqr {\XINT_expr_unlock #3}\endcsname
+ .=\xintSqr {\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_sqr #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMul {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMul [\XINTdigits]%
+ {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_sqr #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSqr {\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_abs #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintAbs {\XINT_expr_unlock #3}\endcsname
+ .=\xintAbs {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_abs\XINT_expr_func_abs
+\def\XINT_iiexpr_func_abs #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiAbs {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_sgn #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSgn {\XINT_expr_unlock #3}\endcsname
+ .=\xintSgn {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_sgn\XINT_expr_func_sgn
+\def\XINT_iiexpr_func_sgn #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSgn {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_floor #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloor {\XINT_expr_unlock #3}\endcsname
+ .=\xintFloor {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_floor\XINT_expr_func_floor
+\let\XINT_iiexpr_func_floor\XINT_expr_func_floor
\def\XINT_expr_func_ceil #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintCeil {\XINT_expr_unlock #3}\endcsname
+ .=\xintCeil {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_ceil\XINT_expr_func_ceil
+\let\XINT_iiexpr_func_ceil\XINT_expr_func_ceil
\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
\def\XINT_expr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\expandafter\expandafter\xintQuo
\expandafter\XINT_expr_twoargs
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_quo\XINT_expr_func_quo
+\def\XINT_iiexpr_func_quo #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+}%
\def\XINT_expr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\expandafter\expandafter\xintRem
\expandafter\XINT_expr_twoargs
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_rem\XINT_expr_func_rem
+\def\XINT_iiexpr_func_rem #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+}%
\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
{%
\if\relax#5\relax\expandafter\xint_firstoftwo\else
\expandafter\xint_secondoftwo\fi
- {#1{0}{#3}}{#2{\xintNum {#4}}{#3}}%
+ {#1{0}}{#2{\xintNum {#4}}}{#3}%
}%
\def\XINT_expr_func_round #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
\expandafter\xintiRound\expandafter\xintRound
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_round\XINT_expr_func_round
+\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
+{%
+ \if\relax#4\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#1{#3}}{#2}%
+}%
+\def\XINT_iiexpr_func_round #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINT_iiexpr_oneortwo\expandafter\xintiRound
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+}%
\def\XINT_expr_func_trunc #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
\expandafter\xintiTrunc\expandafter\xintTrunc
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_trunc\XINT_expr_func_trunc
+\def\XINT_iiexpr_func_trunc #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINT_iiexpr_oneortwo\expandafter\xintiTrunc
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+}%
\def\XINT_expr_argandopt #1,#2,#3.%
{%
\if\relax#3\relax\expandafter\xint_firstoftwo\else
\expandafter\xint_secondoftwo\fi
- {[\XINTdigits]{#1}}{[\xintNum {#2}]{#1}}%
+ {[\XINTdigits]}{[\xintNum {#2}]}{#1}%
}%
\def\XINT_expr_func_float #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINTinFloat
\romannumeral-`0\expandafter\XINT_expr_argandopt
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_float\XINT_expr_func_float
+% \XINT_iiexpr_func_float not defined
\def\XINT_expr_func_sqrt #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINTinFloatSqrt
\romannumeral-`0\expandafter\XINT_expr_argandopt
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
+\def\XINT_iiexpr_func_sqrt #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiSqrt {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_gcd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
+\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
\def\XINT_expr_func_lcm #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
+\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
\def\XINT_expr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_max #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_min #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSum:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_sum #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_prd #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_expr_func_add\XINT_expr_func_sum
\let\XINT_expr_func_mul\XINT_expr_func_prd
\let\XINT_flexpr_func_add\XINT_flexpr_func_sum
\let\XINT_flexpr_func_mul\XINT_flexpr_func_prd
+\let\XINT_iiexpr_func_add\XINT_iiexpr_func_sum
+\let\XINT_iiexpr_func_mul\XINT_iiexpr_func_prd
\def\XINT_expr_func_? #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_? \XINT_expr_func_?
+\let\XINT_iiexpr_func_? \XINT_expr_func_?
\def\XINT_expr_func_! #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_! \XINT_expr_func_!
+\let\XINT_iiexpr_func_! \XINT_expr_func_!
\def\XINT_expr_func_not #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_not \XINT_expr_func_not
+\let\XINT_iiexpr_func_not \XINT_expr_func_not
\def\XINT_expr_func_all #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_all\XINT_expr_func_all
+\let\XINT_iiexpr_func_all\XINT_expr_func_all
\def\XINT_expr_func_any #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintORof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_any\XINT_expr_func_any
+\let\XINT_iiexpr_func_any\XINT_expr_func_any
\def\XINT_expr_func_xor #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_xor\XINT_expr_func_xor
+\let\XINT_iiexpr_func_xor\XINT_expr_func_xor
\def\xintifNotZero:: #1,#2,#3,{\xintifNotZero{#1}{#2}{#3}}%
\def\XINT_expr_func_if #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\expandafter\xintifNotZero::
+ .=\expandafter\xintifNotZero::
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_if\XINT_expr_func_if
+\let\XINT_iiexpr_func_if\XINT_expr_func_if
\def\xintifSgn:: #1,#2,#3,#4,{\xintifSgn{#1}{#2}{#3}{#4}}%
\def\XINT_expr_func_ifsgn #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\expandafter\xintifSgn::
+ .=\expandafter\xintifSgn::
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_ifsgn\XINT_expr_func_ifsgn
+\let\XINT_iiexpr_func_ifsgn\XINT_expr_func_ifsgn
% \end{macrocode}
% \subsection{\csh{xintNewExpr}, \csh{xintNewFloatExpr}\dots}
% \lverb|&
@@ -21967,7 +22881,8 @@ first place.
% (on numeric data; if use with macro parameters, should be coded with the
% functionn ifsgn , rather)
%
-% Code unified in 1.09c, and \xintNewNumExpr, \xintNewBoolExpr added.|
+% Code unified in 1.09c, and \xintNewNumExpr, \xintNewBoolExpr added. 1.09i
+% renames \xintNewNumExpr to \xintNewIExpr, and defines \xintNewIIExpr.|
% \begin{macrocode}
\def\XINT_newexpr_print #1{\ifnum\xintNthElt{0}{#1}>1
\expandafter\xint_firstoftwo
@@ -21975,7 +22890,7 @@ first place.
\expandafter\xint_secondoftwo
\fi
{_xintListWithSep,{#1}}{\xint_firstofone#1}}%
-\xintForpair #1#2 in {(fl,Float),(num,iRound0),(bool,IsTrue)}\do {%
+\xintForpair #1#2 in {(fl,Float),(i,iRound0),(bool,IsTrue)}\do {%
\expandafter\def\csname XINT_new#1expr_print\endcsname
##1{\ifnum\xintNthElt{0}{##1}>1
\expandafter\xint_firstoftwo
@@ -21985,12 +22900,18 @@ first place.
{_xintListWithSep,{\xintApply{_xint#2}{##1}}}
{_xint#2##1}}}%
\toks0 {}%
-\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,%
+\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,TFrac,%
Lt,Gt,Eq,AND,OR,IsNotZero,IsZero,ifNotZero,ifSgn,%
- Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE}\do
+ Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE,iSqrt,%
+ iiAdd,iiSub,iiMul,iiSqr,iiPow,iiQuo,iiRem,iiSgn,iiAbs,iiOpp,iE}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd}\do
+\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE,Frac}\do
+ {\toks0
+ \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
+ {_XINTinFloat#1}}}%
+\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd,%
+ iMaxof,iMinof,iiSum,iiPrd}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
@@ -21998,17 +22919,13 @@ first place.
{\toks0
\expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1:csv\endcsname
####1{_XINTinFloat#1{\xintCSVtoListNonStripped {####1}}}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
- {_XINTinFloat#1}}}%
\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
\def\XINTdigits {_XINTdigits}%
\def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
\def\XINT_flexpr_print ##1{\expandafter\XINT_newflexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_numexpr_print ##1{\expandafter\XINT_newnumexpr_print\expandafter
+ \def\XINT_iexpr_print ##1{\expandafter\XINT_newiexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
\def\XINT_boolexpr_print ##1{\expandafter\XINT_newboolexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
@@ -22016,8 +22933,15 @@ first place.
\toks0 {}%
\def\xintNewExpr {\xint_NewExpr\xinttheexpr }%
\def\xintNewFloatExpr {\xint_NewExpr\xintthefloatexpr }%
-\def\xintNewNumExpr {\xint_NewExpr\xintthenumexpr }%
+\def\xintNewIExpr {\xint_NewExpr\xinttheiexpr }%
+\let\xintNewNumExpr\xintNewIExpr
+\def\xintNewIIExpr {\xint_NewExpr\xinttheiiexpr }%
\def\xintNewBoolExpr {\xint_NewExpr\xinttheboolexpr }%
+% \end{macrocode}
+% \lverb|1.09i has added \escapechar 92, as \meaning is used in \XINT_NewExpr,
+% and a non existent escape-char would be a problem with \scantokens. Also
+% \catcode32 is set to 10 in \xintexprSafeCatcodes for being extra-safe.|
+% \begin{macrocode}
\def\xint_NewExpr #1#2[#3]%
{%
\begingroup
@@ -22034,31 +22958,32 @@ first place.
\or \toks0 {\xdef #2##1##2##3##4##5##6##7##8##9}%
\fi
\xintexprSafeCatcodes
+ \escapechar92
\XINT_NewExpr #1%
}%
\catcode`* 13
\def\XINT_NewExpr #1#2%
{%
- \def\xintTmp ##1##2##3##4##5##6##7##8##9{#2}%
+ \def\XINT_tmpa ##1##2##3##4##5##6##7##8##9{#2}%
\XINT_expr_protect
- \lccode`\*=`_ \lowercase {\def*}{!noexpand!}%
- \catcode`_ 13 \catcode`: 11 \endlinechar -1
+ \lccode`*=`_ \lowercase {\def*}{!noexpand!}%
+ \catcode`_ 13 \catcode`: 11 %\endlinechar -1 %not sure why I had that, \par?
\everyeof {\noexpand }%
- \edef\XINTtmp ##1##2##3##4##5##6##7##8##9%
+ \edef\XINT_tmpb ##1##2##3##4##5##6##7##8##9%
{\scantokens
\expandafter{\romannumeral-`0#1%
- \xintTmp {####1}{####2}{####3}%
- {####4}{####5}{####6}%
- {####7}{####8}{####9}%
+ \XINT_tmpa {####1}{####2}{####3}%
+ {####4}{####5}{####6}%
+ {####7}{####8}{####9}%
\relax}}%
- \lccode`\*=`\$ \lowercase {\def*}{####}%
+ \lccode`*=`\$ \lowercase {\def*}{####}%
\catcode`\$ 13 \catcode`! 0 \catcode`_ 11 %
\the\toks0
{\scantokens\expandafter{\expandafter
- \XINT_newexpr_stripprefix\meaning\XINTtmp}}%
+ \XINT_newexpr_setprefix\meaning\XINT_tmpb}}%
\endgroup
}%
-\let\xintexprRestoreCatcodes\relax
+\let\xintexprRestoreCatcodes\empty
\def\xintexprSafeCatcodes
{% for end user.
\edef\xintexprRestoreCatcodes {%
@@ -22081,8 +23006,9 @@ first place.
\catcode46=\the\catcode46 % .
\catcode45=\the\catcode45 % -
\catcode44=\the\catcode44 % ,
- \catcode61=\the\catcode61\relax % =
- }% this is just for some standard situation with a few made active by Babel
+ \catcode61=\the\catcode61 % =
+ \catcode32=\the\catcode32\relax % space
+ }% it's hard to know where to stop...
\catcode63=12 % ?
\catcode124=12 % |
\catcode38=4 % &
@@ -22103,6 +23029,7 @@ first place.
\catcode45=12 % -
\catcode44=12 % ,
\catcode61=12 % =
+ \catcode32=10 % space
}%
\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
@@ -22144,7 +23071,7 @@ first place.
Right bracket \] Circumflex \^ Underscore \_
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum {20277}
+\CheckSum {20743}
\makeatletter\check@checksum\makeatother
\Finale
%% End of file xint.dtx
diff --git a/Master/texmf-dist/source/generic/xint/xint.ins b/Master/texmf-dist/source/generic/xint/xint.ins
index 45c1dd97d1d..80eccbc9509 100644
--- a/Master/texmf-dist/source/generic/xint/xint.ins
+++ b/Master/texmf-dist/source/generic/xint/xint.ins
@@ -1,5 +1,5 @@
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
%% This is a generated file.
diff --git a/Master/texmf-dist/source/generic/xint/xint.tex b/Master/texmf-dist/source/generic/xint/xint.tex
deleted file mode 100644
index 74e330e65bd..00000000000
--- a/Master/texmf-dist/source/generic/xint/xint.tex
+++ /dev/null
@@ -1,28 +0,0 @@
-\def\xintdate {2013/11/28}
-\def\xintversion {1.09h}
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
-%% Copyright (C) 2013 by Jean-Francois Burnol
-%%----------------------------------------------------------------
-%% This is a generated file. Run latex thrice on this file xint.tex then
-%% run dvipdfmx on xint.dvi to produce the documentation xint.pdf, with
-%% source code included. (ignore the dvipdfmx warnings)
-%%
-%% Customize as desired the class options and the two toggles below.
-%%
-%% See xint.dtx for the copyright and the conditions for distribution
-%% and/or modification of this work.
-%%
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{xint.tex}%
-[\xintdate\space v\xintversion\space driver file for xint documentation (jfB)]%
-\PassOptionsToClass{a4paper,11pt}{scrdoc}
-\chardef\Withdvipdfmx 1 % replace 1<space> by 0<space> for using latex/pdflatex
-\chardef\NoSourceCode 0 % replace 0<space> by 1<space> for no source code
-\input xint.dtx
-%%% Local Variables:
-%%% mode: latex
-%%% End:
-\endinput
-%%
-%% End of file `xint.tex'.
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index 96aa0c6fcad..d51548b4f59 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xint: Expandable operations on long numbers
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,10 +103,13 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xint}%
- [2013/11/28 v1.09h Expandable operations on long numbers (jfB)]%
+ [2013/12/18 v1.09i Expandable operations on long numbers (jfB)]%
\long\def\xint_firstofthree #1#2#3{#1}%
\long\def\xint_secondofthree #1#2#3{#2}%
\long\def\xint_thirdofthree #1#2#3{#3}%
+\long\def\xint_firstofthree_afterstop #1#2#3{ #1}% 1.09i
+\long\def\xint_secondofthree_afterstop #1#2#3{ #2}%
+\long\def\xint_thirdofthree_afterstop #1#2#3{ #3}%
\def\xint_gob_til_zero #10{}%
\def\xint_gob_til_zeros_iii #1000{}%
\def\xint_gob_til_zeros_iv #10000{}%
@@ -114,15 +117,16 @@
\def\xint_gob_til_G #1G{}%
\def\xint_gob_til_minus #1-{}%
\def\xint_gob_til_relax #1\relax {}%
-\def\xint_exchangetwo_keepbraces_andstop #1#2{ {#2}{#1}}%
-\def\xint_UDzerofork #10\dummy #2#3\krof {#2}%
-\def\xint_UDsignfork #1-\dummy #2#3\krof {#2}%
-\def\xint_UDwfork #1\W\dummy #2#3\krof {#2}%
-\def\xint_UDzerosfork #100\dummy #2#3\krof {#2}%
-\def\xint_UDonezerofork #110\dummy #2#3\krof {#2}%
-\def\xint_UDzerominusfork #10-\dummy #2#3\krof {#2}%
-\def\xint_UDsignsfork #1--\dummy #2#3\krof {#2}%
-\chardef\xint_c_i 1 % 0 and 8 in xinttools
+\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
+\def\xint_exchangetwo_keepbraces_afterstop #1#2{ {#2}{#1}}%
+\def\xint_UDzerofork #10#2#3\krof {#2}%
+\def\xint_UDsignfork #1-#2#3\krof {#2}%
+\def\xint_UDwfork #1\W#2#3\krof {#2}%
+\def\xint_UDzerosfork #100#2#3\krof {#2}%
+\def\xint_UDonezerofork #110#2#3\krof {#2}%
+\def\xint_UDzerominusfork #10-#2#3\krof {#2}%
+\def\xint_UDsignsfork #1--#2#3\krof {#2}%
+\chardef\xint_c_i 1
\chardef\xint_c_ii 2
\chardef\xint_c_iii 3
\chardef\xint_c_iv 4
@@ -142,8 +146,8 @@
\def\XINT_rev_fork #1%
{%
\xint_UDsignfork
- #1\dummy {\expandafter\xint_minus_andstop\romannumeral0\XINT_rord_main {}}%
- -\dummy {\XINT_rord_main {}#1}%
+ #1{\expandafter\xint_minus_afterstop\romannumeral0\XINT_rord_main {}}%
+ -{\XINT_rord_main {}#1}%
\krof
}%
\def\xintLen {\romannumeral0\xintlen }%
@@ -163,8 +167,8 @@
{%
\expandafter\XINT_length_loop
\xint_UDsignfork
- #1\dummy {{0}}%
- -\dummy {{0}#1}%
+ #1{{0}}%
+ -{{0}#1}%
\krof
}%
\def\XINT_RQ #1#2#3#4#5#6#7#8#9%
@@ -252,9 +256,9 @@
\def\XINT_OQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
\def\XINT_OQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
\def\XINT_OQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
-\def\xint_cleanupzeros_andstop #1#2#3#4%
+\edef\xint_cleanupzeros_andstop #1#2#3#4%
{%
- \expandafter\space\the\numexpr #1#2#3#4\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
\def\xint_cleanupzeros_nospace #1#2#3#4%
{%
@@ -283,9 +287,9 @@
{%
\xint_cuz_end_b #2%
}%
-\def\xint_cuz_end_b #1#2#3#4#5\Z
+\edef\xint_cuz_end_b #1#2#3#4#5\Z
{%
- \expandafter\space\the\numexpr #1#2#3#4\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
\def\xint_cuz_end_A \Z\XINT_cuz_check_a #1{ 0}%
\def\XINT_cuz_check_a #1%
@@ -298,8 +302,8 @@
}%
\def\XINT_cuz_stop #1\W #2\Z{ #1}%
\def\xint_cuz_backtoloop 0\XINT_cuz_stop 0{\XINT_cuz_loop }%
-\def\xintIsOne {\romannumeral0\xintisone }%
-\def\xintisone #1{\expandafter\XINT_isone \romannumeral0\xintnum{#1}\W\Z }%
+\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
\def\XINT_isone #1#2%
{%
@@ -330,9 +334,9 @@
\xint_gob_til_xint_relax #8\XINT_num_end\xint_relax
\XINT_num_NumEight #1#2#3#4#5#6#7#8%
}%
-\def\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
+\edef\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
{%
- \expandafter\space\the\numexpr #1+0\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1+0\relax
}%
\def\XINT_num_NumEight #1#2#3#4#5#6#7#8%
{%
@@ -361,13 +365,28 @@
{%
\expandafter\XINT_sgn \romannumeral0\xintnum{#1}\Z%
}%
-\def\XINT_Sgn #1{\romannumeral0\XINT_sgn #1\Z }%
\def\XINT_sgn #1#2\Z
{%
\xint_UDzerominusfork
- #1-\dummy { 0}%
- 0#1\dummy { -1}%
- 0-\dummy { 1}%
+ #1-{ 0}%
+ 0#1{ -1}%
+ 0-{ 1}%
+ \krof
+}%
+\def\XINT_Sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-{0}%
+ 0#1{-1}%
+ 0-{1}%
+ \krof
+}%
+\def\XINT__Sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-\z@
+ 0#1\m@ne
+ 0-\@ne
\krof
}%
\def\xintBool #1{\romannumeral-`0%
@@ -376,80 +395,98 @@
\def\xintSgnFork {\romannumeral0\xintsgnfork }%
\def\xintsgnfork #1%
{%
- \ifcase #1 \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \ifcase #1 \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
+ \fi
+}%
+\def\XINT__SgnFork #1%
+{%
+ \ifcase #1\expandafter\xint_secondofthree
+ \or\expandafter\xint_thirdofthree
+ \else\expandafter\xint_firstofthree
\fi
}%
\def\xintifSgn {\romannumeral0\xintifsgn }%
\def\xintifsgn #1%
{%
\ifcase \romannumeral0\xintsgn{#1}
- \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
\fi
}%
\def\xintifZero {\romannumeral0\xintifzero }%
\def\xintifzero #1%
{%
- \if\xintSgn{\xintAbs{#1}}0%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintifNotZero {\romannumeral0\xintifnotzero }%
\def\xintifnotzero #1%
{%
- \if\xintSgn{\xintAbs{#1}}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_secondoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_firstoftwo_afterstop
\fi
}%
+\def\xintifOne {\romannumeral0\xintifone }%
+\def\xintifone #1%
+{%
+ \if1\xintIsOne{#1}%
+ \expandafter\xint_firstoftwo_afterstop
+ \else
+ \expandafter\xint_secondoftwo_afterstop
+ \fi
+}%
+\let\xintifTrueAelseB\xintifNotZero
+\let\xintifFalseAelseB\xintifZero
\let\xintifTrue\xintifNotZero
\let\xintifTrueFalse\xintifNotZero
\def\xintifCmp {\romannumeral0\xintifcmp }%
\def\xintifcmp #1#2%
{%
- \ifcase \xintCmp {#1}{#2}
- \xint_afterfi{\expandafter\space\xint_secondofthree}%
- \or\xint_afterfi{\expandafter\space\xint_thirdofthree}%
- \else\xint_afterfi{\expandafter\space\xint_firstofthree}%
+ \ifcase\xintCmp {#1}{#2}
+ \expandafter\xint_secondofthree_afterstop
+ \or\expandafter\xint_thirdofthree_afterstop
+ \else\expandafter\xint_firstofthree_afterstop
\fi
}%
\def\xintifEq {\romannumeral0\xintifeq }%
\def\xintifeq #1#2%
{%
- \if\xintCmp{#1}{#2}0%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
- \else\xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \if0\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_afterstop
+ \else\expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintifGt {\romannumeral0\xintifgt }%
\def\xintifgt #1#2%
{%
- \if\xintCmp{#1}{#2}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
- \else\xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \if1\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_afterstop
+ \else\expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintifLt {\romannumeral0\xintiflt }%
\def\xintiflt #1#2%
{%
- \xintSgnFork{\xintCmp{#1}{#2}}%
- {\expandafter\space\xint_firstoftwo}%
- {\expandafter\space\xint_secondoftwo}%
- {\expandafter\space\xint_secondoftwo}%
+ \ifnum\xintCmp{#1}{#2}<\xint_c_
+ \expandafter\xint_firstoftwo_afterstop
+ \else \expandafter\xint_secondoftwo_afterstop
+ \fi
}%
\def\xintifOdd {\romannumeral0\xintifodd }%
\def\xintifodd #1%
{%
\if\xintOdd{#1}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintiiOpp {\romannumeral0\xintiiopp }%
@@ -467,9 +504,9 @@
\def\XINT_opp #1%
{%
\xint_UDzerominusfork
- #1-\dummy { 0}% zero
- 0#1\dummy { }% negative
- 0-\dummy { -#1}% positive
+ #1-{ 0}% zero
+ 0#1{ }% negative
+ 0-{ -#1}% positive
\krof
}%
\def\xintiiAbs {\romannumeral0\xintiiabs }%
@@ -487,8 +524,8 @@
\def\XINT_abs #1%
{%
\xint_UDsignfork
- #1\dummy { }%
- -\dummy { #1}%
+ #1{ }%
+ -{ #1}%
\krof
}%
\def\XINT_add_A #1#2#3#4#5#6%
@@ -680,8 +717,8 @@
\XINT_addm_end #1#3%
}%
\def\xint_addm_cz\W\XINT_addm_CD #1#2#3{\XINT_addm_end #1#3}%
-\def\XINT_addm_end #1#2#3#4#5%
- {\expandafter\space\the\numexpr #1#2#3#4#5\relax}%
+\edef\XINT_addm_end #1#2#3#4#5%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5\relax}%
\def\XINT_addp_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_addp_az\W
@@ -837,14 +874,14 @@
\def\XINT_add_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_add_secondiszero
- #3\dummy \XINT_add_firstiszero
- 0\dummy
+ #1\XINT_add_secondiszero
+ #3\XINT_add_firstiszero
+ 0
{\xint_UDsignsfork
- #1#3\dummy \XINT_add_minusminus % #1 = #3 = -
- #1-\dummy \XINT_add_minusplus % #1 = -
- #3-\dummy \XINT_add_plusminus % #3 = -
- --\dummy \XINT_add_plusplus
+ #1#3\XINT_add_minusminus % #1 = #3 = -
+ #1-\XINT_add_minusplus % #1 = -
+ #3-\XINT_add_plusminus % #3 = -
+ --\XINT_add_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -853,7 +890,7 @@
\def\XINT_add_firstiszero #1#2#3#4{ #3#1}%
\def\XINT_add_minusminus #1#2#3#4%
{%
- \expandafter\xint_minus_andstop%
+ \expandafter\xint_minus_afterstop%
\romannumeral0\XINT_add_pre {#2}{#1}%
}%
\def\XINT_add_minusplus #1#2#3#4%
@@ -904,13 +941,13 @@
\def\XINT_sub_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_sub_minusminus
- #1-\dummy \XINT_sub_minusplus % attention, #3=0 possible
- #3-\dummy \XINT_sub_plusminus % attention, #1=0 possible
- --\dummy {\xint_UDzerofork
- #1\dummy \XINT_sub_secondiszero
- #3\dummy \XINT_sub_firstiszero
- 0\dummy \XINT_sub_plusplus
+ #1#3\XINT_sub_minusminus
+ #1-\XINT_sub_minusplus % attention, #3=0 possible
+ #3-\XINT_sub_plusminus % attention, #1=0 possible
+ --{\xint_UDzerofork
+ #1\XINT_sub_secondiszero
+ #3\XINT_sub_firstiszero
+ 0\XINT_sub_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -932,7 +969,7 @@
\def\xint_sub_mp0\XINT_add_pre #1#2{ #2}%
\def\XINT_sub_plusminus #1#2#3#4%
{%
- \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_andstop%
+ \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_afterstop%
\romannumeral0\XINT_add_pre {#2}{#3#1}%
}%
\def\xint_sub_pm #1\XINT_add_pre #2#3{ -#2}%
@@ -972,8 +1009,8 @@
\W\XINT_sub_onestep #1#2#3#4#5#6#7%
{%
\xint_UDzerofork
- #1\dummy \XINT_sub_C % une retenue
- 0\dummy \XINT_sub_D % pas de retenue
+ #1\XINT_sub_C % une retenue
+ 0\XINT_sub_D % pas de retenue
\krof
{#7}#2#3#4#5%
}%
@@ -1057,13 +1094,13 @@
\def\xint_sub_F\W\XINT_sub_Eonestep #1#2#3#4%
{%
\xint_UDonezerofork
- #4#1\dummy {\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
- #1#4\dummy {\XINT_sub_Finc 1}% additionner 1. Et faire signe -
- 10\dummy \XINT_sub_DD % terminer. Mais avec signe -
+ #4#1{\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
+ #1#4{\XINT_sub_Finc 1}% additionner 1. Et faire signe -
+ 10\XINT_sub_DD % terminer. Mais avec signe -
\krof
{#3}%
}%
-\def\XINT_sub_DD {\expandafter\xint_minus_andstop\romannumeral0\XINT_sub_D }%
+\def\XINT_sub_DD {\expandafter\xint_minus_afterstop\romannumeral0\XINT_sub_D }%
\def\XINT_sub_Fdec #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_sub_Fdec_finish\W
@@ -1079,7 +1116,7 @@
}%
\def\xint_sub_Fdec_finish\W\XINT_sub_Fdec_onestep #1#2%
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_cuz
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_cuz
}%
\def\XINT_sub_Finc #1#2#3#4#5#6%
{%
@@ -1097,16 +1134,16 @@
\def\xint_sub_Finc_finish\W\XINT_sub_Finc_onestep #1#2#3%
{%
\xint_UDzerofork
- #1\dummy {\expandafter\xint_minus_andstop\xint_cleanupzeros_nospace}%
- 0\dummy { -1}%
+ #1{\expandafter\xint_minus_afterstop\xint_cleanupzeros_nospace}%
+ 0{ -1}%
\krof
#3%
}%
\def\xint_sub_ez\W\XINT_sub_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy \XINT_sub_K % il y a une retenue
- 0\dummy \XINT_sub_L % pas de retenue
+ #1\XINT_sub_K % il y a une retenue
+ 0\XINT_sub_L % pas de retenue
\krof
}%
\def\XINT_sub_L #1\W\X\Y\Z {\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z }%
@@ -1136,7 +1173,7 @@
}%
\def\xint_sub_KK_finish\W\XINT_sub_KK_onestep #1#2#3%
{%
- \expandafter\xint_minus_andstop
+ \expandafter\xint_minus_afterstop
\romannumeral0\XINT_cuz_loop #3\W\W\W\W\W\W\W\Z
}%
\def\xintCmp {\romannumeral0\xintcmp }%
@@ -1152,14 +1189,14 @@
\def\XINT_cmp_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_cmp_minusminus
- #1-\dummy \XINT_cmp_minusplus
- #3-\dummy \XINT_cmp_plusminus
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_cmp_zerozero
- #10\dummy \XINT_cmp_zeroplus
- #30\dummy \XINT_cmp_pluszero
- 00\dummy \XINT_cmp_plusplus
+ #1#3\XINT_cmp_minusminus
+ #1-\XINT_cmp_minusplus
+ #3-\XINT_cmp_plusminus
+ --{\xint_UDzerosfork
+ #1#3\XINT_cmp_zerozero
+ #10\XINT_cmp_zeroplus
+ #30\XINT_cmp_pluszero
+ 00\XINT_cmp_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -1217,8 +1254,8 @@
\def\xint_cmp_ez\W\XINT_cmp_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy \XINT_cmp_K % il y a une retenue
- 0\dummy \XINT_cmp_L % pas de retenue
+ #1\XINT_cmp_K % il y a une retenue
+ 0\XINT_cmp_L % pas de retenue
\krof
}%
\def\XINT_cmp_K #1\Z { -1}%
@@ -1252,45 +1289,48 @@
\def\xintLt {\romannumeral0\xintlt }%
\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
\def\xintIsZero {\romannumeral0\xintiszero }%
-\def\xintiszero #1{\xintifsgn {#1}{0}{1}{0}}%
+\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
-\def\xintisnotzero #1{\xintifsgn {#1}{1}{0}{1}}%
+\def\xintisnotzero
+ #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
\let\xintIsTrue\xintIsNotZero
\let\xintNot\xintIsZero
+\let\xintIsFalse\xintIsZero
\def\xintIsTrue:csv #1{\expandafter\XINT_istrue:_a\romannumeral-`0#1,,^}%
\def\XINT_istrue:_a {\XINT_istrue:_b {}}%
\def\XINT_istrue:_b #1#2,%
{\expandafter\XINT_istrue:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_istrue:_f
+\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_istrue:_d\fi #1}%
\def\XINT_istrue:_d #1,%
{\expandafter\XINT_istrue:_e\romannumeral0\xintisnotzero {#1},}%
\def\XINT_istrue:_e #1,#2{\XINT_istrue:_b {#2,#1}}%
-\def\XINT_istrue:_f ,#1#2^{\xint_gobble_i #1}%
+\def\XINT_:_f ,#1#2^{\xint_gobble_i #1}%
\def\xintAND {\romannumeral0\xintand }%
-\def\xintand #1#2{\xintifzero {#1}{0}{\xintifzero {#2}{0}{1}}}%
+\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ { 0}{\xintisnotzero{#2}}}%
\def\xintOR {\romannumeral0\xintor }%
-\def\xintor #1#2{\xintifzero {#1}{\xintifzero {#2}{0}{1}}{1}}%
+\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ {\xintisnotzero{#2}}{ 1}}%
\def\xintXOR {\romannumeral0\xintxor }%
-\def\xintxor #1#2{\ifcase \numexpr\xintIsZero{#1}+\xintIsZero{#2}\relax
- \xint_afterfi{ 0}%
- \or\xint_afterfi{ 1}%
- \else\xint_afterfi { 0}%
- \fi }%
+\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}%
+ \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }%
\def\xintANDof {\romannumeral0\xintandof }%
\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral-`0#1\relax }%
\def\XINT_andof_a #1{\expandafter\XINT_andof_b\romannumeral-`0#1\Z }%
\def\XINT_andof_b #1%
{\xint_gob_til_relax #1\XINT_andof_e\relax\XINT_andof_c #1}%
\def\XINT_andof_c #1\Z
- {\xintifZero{#1}{\XINT_andof_no}{\XINT_andof_a}}%
+ {\xintifTrueAelseB {#1}{\XINT_andof_a}{\XINT_andof_no}}%
\def\XINT_andof_no #1\relax { 0}%
\def\XINT_andof_e #1\Z { 1}%
\def\xintANDof:csv #1{\expandafter\XINT_andof:_a\romannumeral-`0#1,,^}%
\def\XINT_andof:_a {\expandafter\XINT_andof:_b\romannumeral-`0}%
\def\XINT_andof:_b #1{\if #1,\expandafter\XINT_andof:_e
\else\expandafter\XINT_andof:_c\fi #1}%
-\def\XINT_andof:_c #1,{\xintifZero{#1}{\XINT_andof:_no}{\XINT_andof:_a}}%
+\def\XINT_andof:_c #1,{\xintifTrueAelseB {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
\def\XINT_andof:_no #1^{0}%
\def\XINT_andof:_e #1^{1}%
\def\xintORof {\romannumeral0\xintorof }%
@@ -1299,14 +1339,14 @@
\def\XINT_orof_b #1%
{\xint_gob_til_relax #1\XINT_orof_e\relax\XINT_orof_c #1}%
\def\XINT_orof_c #1\Z
- {\xintifZero{#1}{\XINT_orof_a}{\XINT_orof_yes}}%
+ {\xintifTrueAelseB {#1}{\XINT_orof_yes}{\XINT_orof_a}}%
\def\XINT_orof_yes #1\relax { 1}%
\def\XINT_orof_e #1\Z { 0}%
\def\xintORof:csv #1{\expandafter\XINT_orof:_a\romannumeral-`0#1,,^}%
\def\XINT_orof:_a {\expandafter\XINT_orof:_b\romannumeral-`0}%
\def\XINT_orof:_b #1{\if #1,\expandafter\XINT_orof:_e
\else\expandafter\XINT_orof:_c\fi #1}%
-\def\XINT_orof:_c #1,{\xintifZero{#1}{\XINT_orof:_a}{\XINT_orof:_yes}}%
+\def\XINT_orof:_c #1,{\xintifTrueAelseB{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
\def\XINT_orof:_yes #1^{1}%
\def\XINT_orof:_e #1^{0}%
\def\xintXORof {\romannumeral0\xintxorof }%
@@ -1316,26 +1356,22 @@
\def\XINT_xorof_b #1%
{\xint_gob_til_relax #1\XINT_xorof_e\relax\XINT_xorof_c #1}%
\def\XINT_xorof_c #1\Z #2%
- {\xintifZero {#1}{\XINT_xorof_a #2}{\ifcase #2
- \xint_afterfi{\XINT_xorof_a 1}%
- \else
- \xint_afterfi{\XINT_xorof_a 0}%
- \fi }%
+ {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof_a 1}%
+ \else\xint_afterfi{\XINT_xorof_a 0}\fi}%
+ {\XINT_xorof_a #2}%
}%
\def\XINT_xorof_e #1\Z #2{ #2}%
\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter
0\romannumeral-`0#1,,^}%
\def\XINT_xorof:_a #1#2,{\expandafter\XINT_xorof:_b\romannumeral-`0#2,#1}%
-\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_xorof:_e
+\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_xorof:_c\fi #1}%
\def\XINT_xorof:_c #1,#2%
- {\xintifZero {#1}{\XINT_xorof:_a #2}{\ifcase #2
- \xint_afterfi{\XINT_xorof:_a 1}%
- \else
- \xint_afterfi{\XINT_xorof:_a 0}%
- \fi }%
+ {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
+ \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
+ {\XINT_xorof:_a #2}%
}%
-\def\XINT_xorof:_e ,#1#2^{#1}% allows empty list
+\def\XINT_:_e ,#1#2^{#1}% allows empty list
\def\xintGeq {\romannumeral0\xintgeq }%
\def\xintgeq #1%
{%
@@ -1349,13 +1385,13 @@
\def\XINT_geq_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_geq_secondiszero % |#1#2|=0
- #3\dummy \XINT_geq_firstiszero % |#1#2|>0
- 0\dummy {\xint_UDsignsfork
- #1#3\dummy \XINT_geq_minusminus
- #1-\dummy \XINT_geq_minusplus
- #3-\dummy \XINT_geq_plusminus
- --\dummy \XINT_geq_plusplus
+ #1\XINT_geq_secondiszero % |#1#2|=0
+ #3\XINT_geq_firstiszero % |#1#2|>0
+ 0{\xint_UDsignsfork
+ #1#3\XINT_geq_minusminus
+ #1-\XINT_geq_minusplus
+ #3-\XINT_geq_plusminus
+ --\XINT_geq_plusplus
\krof }%
\krof
{#2}{#4}#1#3%
@@ -1406,8 +1442,8 @@
\def\xint_geq_ez\W\XINT_geq_Eenter #1%
{%
\xint_UDzerofork
- #1\dummy { 0} % il y a une retenue
- 0\dummy { 1} % pas de retenue
+ #1{ 0} % il y a une retenue
+ 0{ 1} % pas de retenue
\krof
}%
\def\xintiMax {\romannumeral0\xintimax }%
@@ -1425,37 +1461,37 @@
\def\XINT_max_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_max_minusminus % A < 0, B < 0
- #1-\dummy \XINT_max_minusplus % B < 0, A >= 0
- #3-\dummy \XINT_max_plusminus % A < 0, B >= 0
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_max_zerozero % A = B = 0
- #10\dummy \XINT_max_zeroplus % B = 0, A > 0
- #30\dummy \XINT_max_pluszero % A = 0, B > 0
- 00\dummy \XINT_max_plusplus % A, B > 0
+ #1#3\XINT_max_minusminus % A < 0, B < 0
+ #1-\XINT_max_minusplus % B < 0, A >= 0
+ #3-\XINT_max_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_max_zerozero % A = B = 0
+ #10\XINT_max_zeroplus % B = 0, A > 0
+ #30\XINT_max_pluszero % A = 0, B > 0
+ 00\XINT_max_plusplus % A, B > 0
\krof }%
\krof
{#2}{#4}#1#3%
}%
-\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_andstop }%
+\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_afterstop }%
\def\XINT_max_plusplus #1#2#3#4%
{%
\ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\else
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\XINT_max_minusminus #1#2#3#4%
{%
\ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\else
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintiMaxof {\romannumeral0\xintimaxof }%
@@ -1469,6 +1505,12 @@
{\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}%
\def\XINT_imaxof_e #1\Z #2\Z { #2}%
\let\xintMaxof\xintiMaxof \let\xintmaxof\xintimaxof
+\def\xintiMaxof:csv #1{\expandafter\XINT_imaxof:_b\romannumeral-`0#1,,}%
+\def\XINT_imaxof:_b #1,#2,{\expandafter\XINT_imaxof:_c\romannumeral-`0#2,{#1},}%
+\def\XINT_imaxof:_c #1{\if #1,\expandafter\XINT_of:_e
+ \else\expandafter\XINT_imaxof:_d\fi #1}%
+\def\XINT_imaxof:_d #1,{\expandafter\XINT_imaxof:_b\romannumeral0\xintimax {#1}}%
+\def\XINT_of:_e ,#1,{#1}%
\def\xintiMin {\romannumeral0\xintimin }%
\def\xintimin #1%
{%
@@ -1484,37 +1526,37 @@
\def\XINT_min_fork #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_min_minusminus % A < 0, B < 0
- #1-\dummy \XINT_min_minusplus % B < 0, A >= 0
- #3-\dummy \XINT_min_plusminus % A < 0, B >= 0
- --\dummy {\xint_UDzerosfork
- #1#3\dummy \XINT_min_zerozero % A = B = 0
- #10\dummy \XINT_min_zeroplus % B = 0, A > 0
- #30\dummy \XINT_min_pluszero % A = 0, B > 0
- 00\dummy \XINT_min_plusplus % A, B > 0
+ #1#3\XINT_min_minusminus % A < 0, B < 0
+ #1-\XINT_min_minusplus % B < 0, A >= 0
+ #3-\XINT_min_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_min_zerozero % A = B = 0
+ #10\XINT_min_zeroplus % B = 0, A > 0
+ #30\XINT_min_pluszero % A = 0, B > 0
+ 00\XINT_min_plusplus % A, B > 0
\krof }%
\krof
{#2}{#4}#1#3%
}%
-\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_andstop }%
-\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_andstop }%
-\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_andstop }%
+\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_afterstop }%
+\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_afterstop }%
+\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_afterstop }%
\def\XINT_min_plusplus #1#2#3#4%
{%
\ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\else
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\fi
}%
\def\XINT_min_minusminus #1#2#3#4%
{%
\ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\else
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\fi
}%
\def\xintiMinof {\romannumeral0\xintiminof }%
@@ -1528,6 +1570,11 @@
{\expandafter\XINT_iminof_b\romannumeral0\xintimin {#1}}%
\def\XINT_iminof_e #1\Z #2\Z { #2}%
\let\xintMinof\xintiMinof \let\xintminof\xintiminof
+\def\xintiMinof:csv #1{\expandafter\XINT_iminof:_b\romannumeral-`0#1,,}%
+\def\XINT_iminof:_b #1,#2,{\expandafter\XINT_iminof:_c\romannumeral-`0#2,{#1},}%
+\def\XINT_iminof:_c #1{\if #1,\expandafter\XINT_of:_e
+ \else\expandafter\XINT_iminof:_d\fi #1}%
+\def\XINT_iminof:_d #1,{\expandafter\XINT_iminof:_b\romannumeral0\xintimin {#1}}%
\def\xintiiSum {\romannumeral0\xintiisum }%
\def\xintiisum #1{\xintiisumexpr #1\relax }%
\def\xintiiSumExpr {\romannumeral0\xintiisumexpr }%
@@ -1544,8 +1591,8 @@
\xint_gob_til_relax #1\XINT_sum_finished\relax
\xint_gob_til_zero #1\XINT_sum_skipzeroinput0%
\xint_UDsignfork
- #1\dummy \XINT_sum_N
- -\dummy {\XINT_sum_P #1}%
+ #1\XINT_sum_N
+ -{\XINT_sum_P #1}%
\krof
}%
\def\XINT_sum_finished #1\Z #2#3%
@@ -1570,6 +1617,13 @@
\W\X\Y\Z #3\W\X\Y\Z }{#2}%
}%
\def\XINT_sum_NN #1#2{\XINT_sum_loop {#2}{#1}}%
+\def\xintiiSum:csv #1{\expandafter\XINT_iisum:_a\romannumeral-`0#1,,^}%
+\def\XINT_iisum:_a {\XINT_iisum:_b {0}}%
+\def\XINT_iisum:_b #1#2,{\expandafter\XINT_iisum:_c\romannumeral-`0#2,{#1}}%
+\def\XINT_iisum:_c #1{\if #1,\expandafter\XINT_:_e
+ \else\expandafter\XINT_iisum:_d\fi #1}%
+\def\XINT_iisum:_d #1,#2{\expandafter\XINT_iisum:_b\expandafter
+ {\romannumeral0\xintiiadd {#2}{#1}}}%
\def\xintiiMul {\romannumeral0\xintiimul }%
\def\xintiimul #1%
{%
@@ -1593,14 +1647,13 @@
\def\XINT_mul_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_mul_zero
- #3\dummy \XINT_mul_zero
- 0\dummy
- {\xint_UDsignsfork
- #1#3\dummy \XINT_mul_minusminus % #1 = #3 = -
- #1-\dummy {\XINT_mul_minusplus #3}% % #1 = -
- #3-\dummy {\XINT_mul_plusminus #1}% % #3 = -
- --\dummy {\XINT_mul_plusplus #1#3}%
+ #1\XINT_mul_zero
+ #3\XINT_mul_zero
+ 0{\xint_UDsignsfork
+ #1#3\XINT_mul_minusminus % #1 = #3 = -
+ #1-{\XINT_mul_minusplus #3}% % #1 = -
+ #3-{\XINT_mul_plusminus #1}% % #3 = -
+ --{\XINT_mul_plusplus #1#3}%
\krof }%
\krof
{#2}{#4}%
@@ -1614,14 +1667,14 @@
}%
\def\XINT_mul_minusplus #1#2#3%
{%
- \expandafter\xint_minus_andstop\romannumeral0\expandafter
+ \expandafter\xint_minus_afterstop\romannumeral0\expandafter
\XINT_mul_choice_a
\expandafter{\romannumeral0\xintlength {#1#3}}%
{\romannumeral0\xintlength {#2}}{#2}{#1#3}%
}%
\def\XINT_mul_plusminus #1#2#3%
{%
- \expandafter\xint_minus_andstop\romannumeral0\expandafter
+ \expandafter\xint_minus_afterstop\romannumeral0\expandafter
\XINT_mul_choice_a
\expandafter{\romannumeral0\xintlength {#3}}%
{\romannumeral0\xintlength {#1#2}}{#1#2}{#3}%
@@ -1789,9 +1842,9 @@
{%
\XINT_mul_M_end #1#4%
}%
-\def\XINT_mul_M_end #1#2#3#4#5#6#7#8%
+\edef\XINT_mul_M_end #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
\def\XINT_mul_enter #1\Z\Z\Z\Z #2#3#4#5%
{%
@@ -1989,6 +2042,13 @@
\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork
}%
\def\XINT_prod_finished #1\Z #2\Z \Z { #2}%
+\def\xintiiPrd:csv #1{\expandafter\XINT_iiprd:_a\romannumeral-`0#1,,^}%
+\def\XINT_iiprd:_a {\XINT_iiprd:_b {1}}%
+\def\XINT_iiprd:_b #1#2,{\expandafter\XINT_iiprd:_c\romannumeral-`0#2,{#1}}%
+\def\XINT_iiprd:_c #1{\if #1,\expandafter\XINT_:_e
+ \else\expandafter\XINT_iiprd:_d\fi #1}%
+\def\XINT_iiprd:_d #1,#2{\expandafter\XINT_iiprd:_b\expandafter
+ {\romannumeral0\xintiimul {#2}{#1}}}%
\def\xintiFac {\romannumeral0\xintifac }%
\def\xintifac #1%
{%
@@ -1997,7 +2057,7 @@
\let\xintFac\xintiFac \let\xintfac\xintifac
\def\XINT_fac_fork #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\xint_afterfi{\expandafter\space\expandafter 1\xint_gobble_i }%
\or
\expandafter\XINT_fac_checklength
@@ -2086,8 +2146,8 @@
\def\xint_pow #1#2\Z
{%
\xint_UDsignfork
- #1\dummy \XINT_pow_Aneg
- -\dummy \XINT_pow_Anonneg
+ #1\XINT_pow_Aneg
+ -\XINT_pow_Anonneg
\krof
#1{#2}%
}%
@@ -2124,7 +2184,7 @@
\def\XINT_pow_AisOne #1#2{ 1}%
\def\XINT_pow_AisZero #1#2%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\xint_afterfi { 1}%
\or
\xint_afterfi { 0}%
@@ -2134,7 +2194,7 @@
}%
\def\XINT_pow_AatleastTwo #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_pow_BisZero
\or
\expandafter\XINT_pow_checkBsize
@@ -2143,7 +2203,7 @@
\fi
{#1}%
}%
-\def\XINT_pow_BisNegative #1#2{\xintError:FractionRoundedToZero\space 0}%
+\edef\XINT_pow_BisNegative #1#2{\noexpand\xintError:FractionRoundedToZero\space 0}%
\def\XINT_pow_BisZero #1#2{ 1}%
\def\XINT_pow_checkBsize #1#2%
{%
@@ -2158,8 +2218,8 @@
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_pow_BtooBig #1\xint_relax #2\xint_relax
- {\xintError:ExponentTooBig\space 0}%
+\edef\XINT_pow_BtooBig #1\xint_relax #2\xint_relax
+ {\noexpand\xintError:ExponentTooBig\space 0}%
\def\XINT_pow_loop #1#2%
{%
\ifnum #1 = 1
@@ -2221,15 +2281,15 @@
}%
\def\xintiiQuo {\romannumeral0\xintiiquo }%
\def\xintiiRem {\romannumeral0\xintiirem }%
-\def\xintiiquo {\expandafter\xint_firstoftwo_andstop
+\def\xintiiquo {\expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintiidivision }%
-\def\xintiirem {\expandafter\xint_secondoftwo_andstop
+\def\xintiirem {\expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintiidivision }%
\def\xintQuo {\romannumeral0\xintquo }%
\def\xintRem {\romannumeral0\xintrem }%
-\def\xintquo {\expandafter\xint_firstoftwo_andstop
+\def\xintquo {\expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintdivision }%
-\def\xintrem {\expandafter\xint_secondoftwo_andstop
+\def\xintrem {\expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintdivision }%
\def\xintiidivision #1%
{%
@@ -2252,18 +2312,17 @@
\def\XINT_div_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_div_BisZero
- #3\dummy \XINT_div_AisZero
- 0\dummy
- {\xint_UDsignfork
- #1\dummy \XINT_div_BisNegative % B < 0
- #3\dummy \XINT_div_AisNegative % A < 0, B > 0
- -\dummy \XINT_div_plusplus % B > 0, A > 0
+ #1\XINT_div_BisZero
+ #3\XINT_div_AisZero
+ 0{\xint_UDsignfork
+ #1\XINT_div_BisNegative % B < 0
+ #3\XINT_div_AisNegative % A < 0, B > 0
+ -\XINT_div_plusplus % B > 0, A > 0
\krof }%
\krof
{#2}{#4}#1#3% #1#2=B, #3#4=A
}%
-\def\XINT_div_BisZero #1#2#3#4{\xintError:DivisionByZero\space {0}{0}}%
+\edef\XINT_div_BisZero #1#2#3#4{\noexpand\xintError:DivisionByZero\space {0}{0}}%
\def\XINT_div_AisZero #1#2#3#4{ {0}{0}}%
\def\XINT_div_plusplus #1#2#3#4%
{%
@@ -2274,9 +2333,10 @@
\expandafter\XINT_div_BisNegative_post
\romannumeral0\XINT_div_fork #1\Z #4#2\Z
}%
-\def\XINT_div_BisNegative_post #1%
+\edef\XINT_div_BisNegative_post #1%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_opp #1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_opp #1}%
}%
\def\XINT_div_AisNegative #1#2#3#4%
{%
@@ -2285,16 +2345,17 @@
}%
\def\XINT_div_AisNegative_post #1#2%
{%
- \ifcase\XINT_Sgn {#2}
+ \if0\XINT_Sgn #2\Z
\expandafter \XINT_div_AisNegative_zerorem
- \or
+ \else
\expandafter \XINT_div_AisNegative_posrem
\fi
{#1}{#2}%
}%
-\def\XINT_div_AisNegative_zerorem #1#2#3%
+\edef\XINT_div_AisNegative_zerorem #1#2#3%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_opp #1}{0}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_opp #1}{0}%
}%
\def\XINT_div_AisNegative_posrem #1%
{%
@@ -2303,7 +2364,7 @@
}%
\def\XINT_div_AisNegative_posrem_b #1#2#3%
{%
- \expandafter \xint_exchangetwo_keepbraces_andstop \expandafter
+ \expandafter \xint_exchangetwo_keepbraces_afterstop \expandafter
{\romannumeral0\XINT_sub {#3}{#2}}{#1}%
}%
\def\XINT_div_prepare #1%
@@ -2409,18 +2470,19 @@
}%
\def\XINT_div_finished_b #1#2#3#4#5%
{%
- \ifcase \XINT_Sgn {#1}
+ \if0\XINT_Sgn #1\Z
\xint_afterfi {\XINT_div_finished_c {0}}%
- \or
+ \else
\xint_afterfi {\expandafter\XINT_div_finished_c\expandafter
{\romannumeral0\XINT_dsh_checksignx #5\Z {#1}}%
}%
\fi
{#2}%
}%
-\def\XINT_div_finished_c #1#2%
+\edef\XINT_div_finished_c #1#2%
{%
- \expandafter\space\expandafter {\romannumeral0\XINT_rev_andcuz {#2}}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\XINT_rev_andcuz {#2}}{#1}%
}%
\def\XINT_div_final_a #1%
{%
@@ -2470,33 +2532,35 @@
{\romannumeral0\XINT_mul_M {#1}#5\Z\Z\Z\Z }}%
{#1}{#2}{#3}{#4}{#5}%
}%
-\def\XINT_div_final_dc #1#2%
+\def\XINT_div_final_dc #1#2% 1.09i re-styles the conditional here
{%
- \ifnum\XINT_Sgn{#1}<\xint_c_
- \xint_afterfi
- {\expandafter\XINT_div_final_dP\the\numexpr #2-\xint_c_i\relax}%
- \else \xint_afterfi {\XINT_div_final_e {#1}#2}%
+ \ifnum\XINT__Sgn #1\Z<\xint_c_
+ \expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo
\fi
+ {\expandafter\XINT_div_final_dP\the\numexpr #2-\xint_c_i\relax}%
+ {\XINT_div_final_e {#1}#2}%
}%
\def\XINT_div_final_e #1#2#3#4#5#6% A final, q, trash, Q, L, B
{%
\XINT_div_final_f {#1}%
{\romannumeral0\XINT_add_A 0{}#2000\W\X\Y\Z #4\W\X\Y\Z }%
}%
-\def\XINT_div_final_f #1#2#3% R,Q \`a d\'evelopper,c
+\def\XINT_div_final_f #1#2#3% R,Q \`a d\'evelopper,c. re-styled in 1.09i
{%
- \ifcase \XINT_Sgn {#1}
- \xint_afterfi {\XINT_div_final_end {0}}%
- \or
- \xint_afterfi {\expandafter\XINT_div_final_end\expandafter
+ \if0\XINT_Sgn #1\Z
+ \expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo
+ \fi
+ {\XINT_div_final_end {0}}%
+ {\expandafter\XINT_div_final_end\expandafter
{\romannumeral0\XINT_dsh_checksignx #3\Z {#1}}%
}%
- \fi
{#2}%
}%
-\def\XINT_div_final_end #1#2%
+\edef\XINT_div_final_end #1#2%
{%
- \expandafter\space\expandafter {#2}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter {#2}{#1}%
}%
\def\XINT_div_body_a #1%
{%
@@ -2533,8 +2597,8 @@
\def\XINT_div_body_gg #1#2#3#4#5#6%
{%
\xint_UDzerofork
- #2\dummy \XINT_div_body_gk
- 0\dummy {\XINT_div_body_ggk #2}%
+ #2\XINT_div_body_gk
+ 0{\XINT_div_body_ggk #2}%
\krof
{#3#4#5#6}%
}%
@@ -2672,8 +2736,8 @@
\def\xint_div_sub_bz\W\XINT_div_sub_onestep #1#2#3#4#5#6#7%
{%
\xint_UDzerofork
- #1\dummy \XINT_div_sub_C %
- 0\dummy \XINT_div_sub_D % pas de retenue
+ #1\XINT_div_sub_C %
+ 0\XINT_div_sub_D % pas de retenue
\krof
{#7}#2#3#4#5%
}%
@@ -2732,9 +2796,9 @@
\def\XINT_fdg #1#2#3\Z
{%
\xint_UDzerominusfork
- #1-\dummy { 0}% zero
- 0#1\dummy { #2}% negative
- 0-\dummy { #1}% positive
+ #1-{ 0}% zero
+ 0#1{ #2}% negative
+ 0-{ #1}% positive
\krof
}%
\def\xintiiLDg {\romannumeral0\xintiildg }%
@@ -2846,15 +2910,15 @@
\def\XINT_dshr_checkxpositive #1%
{%
\xint_UDzerominusfork
- 0#1\dummy \XINT_dshr_xzeroorneg
- #1-\dummy \XINT_dshr_xzeroorneg
- 0-\dummy \XINT_dshr_xpositive
+ 0#1\XINT_dshr_xzeroorneg
+ #1-\XINT_dshr_xzeroorneg
+ 0-\XINT_dshr_xpositive
\krof #1%
}%
\def\XINT_dshr_xzeroorneg #1\Z #2{ 0}%
\def\XINT_dshr_xpositive #1\Z
{%
- \expandafter\xint_secondoftwo_andstop\romannumeral0\xintdsx {#1}%
+ \expandafter\xint_secondoftwo_afterstop\romannumeral0\xintdsx {#1}%
}%
\def\xintDSH {\romannumeral0\xintdsh }%
\def\xintdsh #1#2%
@@ -2868,15 +2932,15 @@
\def\XINT_dsh_checksignx #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsh_xiszero
- 0#1\dummy \XINT_dsx_xisNeg_checkA % on passe direct dans DSx
- 0-\dummy {\XINT_dsh_xisPos #1}%
+ #1-\XINT_dsh_xiszero
+ 0#1\XINT_dsx_xisNeg_checkA % on passe direct dans DSx
+ 0-{\XINT_dsh_xisPos #1}%
\krof
}%
\def\XINT_dsh_xiszero #1\Z #2{ #2}%
\def\XINT_dsh_xisPos #1\Z #2%
{%
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\romannumeral0\XINT_dsx_checksignA #2\Z {#1}% via DSx
}%
\def\xintDSx {\romannumeral0\xintdsx }%
@@ -2893,9 +2957,9 @@
\def\XINT_dsx_checksignx #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsx_xisZero
- 0#1\dummy \XINT_dsx_xisNeg_checkA
- 0-\dummy {\XINT_dsx_xisPos #1}%
+ #1-\XINT_dsx_xisZero
+ 0#1\XINT_dsx_xisNeg_checkA
+ 0-{\XINT_dsx_xisPos #1}%
\krof
}%
\def\XINT_dsx_xisZero #1\Z #2{ {#2}{0}}% attention comme x > 0
@@ -2942,9 +3006,9 @@
\def\XINT_dsx_checksignA #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dsx_AisZero
- 0#1\dummy \XINT_dsx_AisNeg
- 0-\dummy {\XINT_dsx_AisPos #1}%
+ #1-\XINT_dsx_AisZero
+ 0#1\XINT_dsx_AisNeg
+ 0-{\XINT_dsx_AisPos #1}%
\krof
}%
\def\XINT_dsx_AisZero #1\Z #2{ {0}{0}}%
@@ -2984,20 +3048,20 @@
\expandafter {\romannumeral0\XINT_num {#2}}%
{\romannumeral0\XINT_num {#1}}%
}%
-\def\XINT_dsx_end #1#2%
+\edef\XINT_dsx_end #1#2%
{%
- \expandafter\space\expandafter{#2}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter{#2}{#1}%
}%
\def\xintDecSplitL {\romannumeral0\xintdecsplitl }%
\def\xintDecSplitR {\romannumeral0\xintdecsplitr }%
\def\xintdecsplitl
{%
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\romannumeral0\xintdecsplit
}%
\def\xintdecsplitr
{%
- \expandafter\xint_secondoftwo_andstop
+ \expandafter\xint_secondoftwo_afterstop
\romannumeral0\xintdecsplit
}%
\def\xintDecSplit {\romannumeral0\xintdecsplit }%
@@ -3021,7 +3085,7 @@
}%
\def\XINT_split_bigx #1\Z #2%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\or \xint_afterfi { {}{#2}}% positive big x
\else
\xint_afterfi { {#2}{}}% negative big x
@@ -3030,9 +3094,9 @@
\def\XINT_split_xfork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_split_zerosplit
- 0#1\dummy \XINT_split_fromleft
- 0-\dummy {\XINT_split_fromright #1}%
+ #1-\XINT_split_zerosplit
+ 0#1\XINT_split_fromleft
+ 0-{\XINT_split_fromright #1}%
\krof
}%
\def\XINT_split_zerosplit #1\Z #2{ {#2}{}}%
@@ -3118,9 +3182,10 @@
{%
\csname XINT_split_fromright_endsplit_\romannumeral #1\endcsname
}%
-\def\XINT_split_fromright_endsplit_ #1#2\W #3\Z #4%
+\edef\XINT_split_fromright_endsplit_ #1#2\W #3\Z #4%
{%
- \expandafter\space\expandafter {\romannumeral0\xintreverseorder {#2}}{#1}%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\xintreverseorder {#2}}{#1}%
}%
\def\XINT_split_fromright_endsplit_i #1#2%
{\XINT_split_fromright_checkiftoofar #2{#2#1}}%
@@ -3152,14 +3217,14 @@
\def\XINT_dbl #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dbl_zero
- 0#1\dummy \XINT_dbl_neg
- 0-\dummy {\XINT_dbl_pos #1}%
+ #1-\XINT_dbl_zero
+ 0#1\XINT_dbl_neg
+ 0-{\XINT_dbl_pos #1}%
\krof
}%
\def\XINT_dbl_zero #1\Z \W\W\W\W\W\W\W { 0}%
\def\XINT_dbl_neg
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_dbl_pos }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dbl_pos }%
\def\XINT_dbl_pos
{%
\expandafter\XINT_dbl_a \expandafter{\expandafter}\expandafter 0%
@@ -3179,9 +3244,9 @@
{%
\expandafter\XINT_dbl_end_b #2#4%
}%
-\def\XINT_dbl_end_b #1#2#3#4#5#6#7#8%
+\edef\XINT_dbl_end_b #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
\def\xintHalf {\romannumeral0\xinthalf }%
\def\xinthalf #1%
@@ -3192,9 +3257,9 @@
\def\XINT_half #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_half_zero
- 0#1\dummy \XINT_half_neg
- 0-\dummy {\XINT_half_pos #1}%
+ #1-\XINT_half_zero
+ 0#1\XINT_half_neg
+ 0-{\XINT_half_pos #1}%
\krof
}%
\def\XINT_half_zero #1\Z \W\W\W\W\W\W\W { 0}%
@@ -3206,11 +3271,11 @@
\expandafter\XINT_half_b
\the\numexpr \xint_c_x^viii+\xint_c_v*#7#6#5#4#3#2#1\relax #8%
}%
-\def\XINT_half_dont\W\expandafter\XINT_half_b
+\edef\XINT_half_dont\W\expandafter\XINT_half_b
\the\numexpr \xint_c_x^viii+\xint_c_v*#1#2#3#4#5#6#7\relax \W\W\W\W\W\W\W
{%
- \expandafter\space
- \the\numexpr (#1#2#3#4#5#6#7+\xint_c_i)/\xint_c_ii-\xint_c_i \relax
+ \noexpand\expandafter\space
+ \noexpand\the\numexpr (#1#2#3#4#5#6#7+\xint_c_i)/\xint_c_ii-\xint_c_i \relax
}%
\def\XINT_half_b 1#1#2#3#4#5#6#7#8%
{%
@@ -3230,9 +3295,9 @@
{%
\xint_gob_til_zero #1\XINT_half_end_b 0\space #1#3%
}%
-\def\XINT_half_end_b 0\space 0#1#2#3#4#5#6#7%
+\edef\XINT_half_end_b 0\space 0#1#2#3#4#5#6#7%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7\relax
}%
\def\xintDec {\romannumeral0\xintdec }%
\def\xintdec #1%
@@ -3243,14 +3308,14 @@
\def\XINT_dec #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_dec_zero
- 0#1\dummy \XINT_dec_neg
- 0-\dummy {\XINT_dec_pos #1}%
+ #1-\XINT_dec_zero
+ 0#1\XINT_dec_neg
+ 0-{\XINT_dec_pos #1}%
\krof
}%
\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
\def\XINT_dec_neg
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_inc_pos }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_inc_pos }%
\def\XINT_dec_pos
{%
\expandafter\XINT_dec_a \expandafter{\expandafter}%
@@ -3278,8 +3343,8 @@
\xint_relax
#1%
}%
-\def\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
-{\expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax }%
+\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
\def\xintInc {\romannumeral0\xintinc }%
\def\xintinc #1%
{%
@@ -3289,9 +3354,9 @@
\def\XINT_inc #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_inc_zero
- 0#1\dummy \XINT_inc_neg
- 0-\dummy {\XINT_inc_pos #1}%
+ #1-\XINT_inc_zero
+ 0#1\XINT_inc_neg
+ 0-{\XINT_inc_pos #1}%
\krof
}%
\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
@@ -3327,13 +3392,13 @@
\def\XINT_sqrt_checkin #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_sqrt_iszero
- 0#1\dummy \XINT_sqrt_isneg
- 0-\dummy {\XINT_sqrt #1}%
+ #1-\XINT_sqrt_iszero
+ 0#1\XINT_sqrt_isneg
+ 0-{\XINT_sqrt #1}%
\krof
}%
\def\XINT_sqrt_iszero #1\Z { 1.}% 1.09e was wrong from inception in 1.08 :-((
-\def\XINT_sqrt_isneg #1\Z {\xintError:RootOfNegative\space 1.}%
+\edef\XINT_sqrt_isneg #1\Z {\noexpand\xintError:RootOfNegative\space 1.}%
\def\XINT_sqrt #1\Z
{%
\expandafter\XINT_sqrt_start\expandafter
@@ -3496,9 +3561,9 @@
}%
\def\XINT_sqrt_big_j #1%
{%
- \ifcase\XINT_Sgn {#1}
- \expandafter \XINT_sqrt_big_end
- \or \expandafter \XINT_sqrt_big_k
+ \if0\XINT_Sgn #1\Z
+ \expandafter \XINT_sqrt_big_end
+ \else \expandafter \XINT_sqrt_big_k
\fi {#1}%
}%
\def\XINT_sqrt_big_k #1#2#3%
@@ -3513,7 +3578,6 @@
{#2}{#1}%
}%
\def\XINT_sqrt_big_end #1#2#3#4{ {#3}{#2}}%
-\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
\endinput
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
index ce347a79ba9..d1b8229163d 100644
--- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintbinhex: Expandable binary and hexadecimal conversions
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,7 +103,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2013/11/28 v1.09h Expandable binary and hexadecimal conversions (jfB)]%
+ [2013/12/18 v1.09i Expandable binary and hexadecimal conversions (jfB)]%
\chardef\xint_c_xvi 16
\chardef\xint_c_ii^v 32
\chardef\xint_c_ii^vi 64
@@ -213,11 +213,11 @@
\def\XINT_dth_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_dth_N
- -\dummy {\XINT_dth_P #1}%
+ #1\XINT_dth_N
+ -{\XINT_dth_P #1}%
\krof
}%
-\def\XINT_dth_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_dth_P }%
+\def\XINT_dth_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dth_P }%
\def\XINT_dth_P {\expandafter\XINT_dth_III\romannumeral-`0\XINT_dtbh_I {0.}}%
\def\xintDecToBin {\romannumeral0\xintdectobin }%
\def\xintdectobin #1%
@@ -225,11 +225,11 @@
\def\XINT_dtb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_dtb_N
- -\dummy {\XINT_dtb_P #1}%
+ #1\XINT_dtb_N
+ -{\XINT_dtb_P #1}%
\krof
}%
-\def\XINT_dtb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_dtb_P }%
+\def\XINT_dtb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_dtb_P }%
\def\XINT_dtb_P {\expandafter\XINT_dtb_III\romannumeral-`0\XINT_dtbh_I {0.}}%
\def\XINT_dtbh_I #1#2#3#4#5%
{%
@@ -351,9 +351,9 @@
{%
\expandafter\XINT_dtb_end_d\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
-\def\XINT_dtb_end_d #1#2#3#4#5#6#7#8#9%
+\edef\XINT_dtb_end_d #1#2#3#4#5#6#7#8#9%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8#9\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8#9\relax
}%
\def\xintHexToDec {\romannumeral0\xinthextodec }%
\def\xinthextodec #1%
@@ -361,11 +361,11 @@
\def\XINT_htd_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_htd_neg
- -\dummy {\XINT_htd_I {0000}#1}%
+ #1\XINT_htd_neg
+ -{\XINT_htd_I {0000}#1}%
\krof
}%
-\def\XINT_htd_neg {\expandafter\xint_minus_andstop
+\def\XINT_htd_neg {\expandafter\xint_minus_afterstop
\romannumeral0\XINT_htd_I {0000}}%
\def\XINT_htd_I #1#2#3#4#5%
{%
@@ -435,9 +435,9 @@
{%
\XINT_htd_II_end_b #1#3%
}%
-\def\XINT_htd_II_end_b #1#2#3#4#5#6#7#8%
+\edef\XINT_htd_II_end_b #1#2#3#4#5#6#7#8%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
}%
\def\xintBinToDec {\romannumeral0\xintbintodec }%
\def\xintbintodec #1{\expandafter\XINT_btd_checkin
@@ -445,11 +445,11 @@
\def\XINT_btd_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_btd_neg
- -\dummy {\XINT_btd_I {000000}#1}%
+ #1\XINT_btd_neg
+ -{\XINT_btd_I {000000}#1}%
\krof
}%
-\def\XINT_btd_neg {\expandafter\xint_minus_andstop
+\def\XINT_btd_neg {\expandafter\xint_minus_afterstop
\romannumeral0\XINT_btd_I {000000}}%
\def\XINT_btd_I #1#2#3#4#5#6#7#8#9%
{%
@@ -480,9 +480,9 @@
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_btd_II_c_end #1#2#3#4#5#6%
+\edef\XINT_btd_II_c_end #1#2#3#4#5#6%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6\relax
}%
\def\XINT_btd_II_ci #1\XINT_btd_II_cvii #2\W\W\W\W\W\W\W
{\XINT_btd_II_d {}{#2}{\xint_c_ii }}%
@@ -520,9 +520,9 @@
{%
\XINT_btd_II_end_b #1#3%
}%
-\def\XINT_btd_II_end_b #1#2#3#4#5#6#7#8#9%
+\edef\XINT_btd_II_end_b #1#2#3#4#5#6#7#8#9%
{%
- \expandafter\space\the\numexpr #1#2#3#4#5#6#7#8#9\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8#9\relax
}%
\def\XINT_btd_I_a #1#2#3#4#5#6#7#8%
{%
@@ -557,11 +557,11 @@
\def\XINT_bth_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_bth_N
- -\dummy {\XINT_bth_P #1}%
+ #1\XINT_bth_N
+ -{\XINT_bth_P #1}%
\krof
}%
-\def\XINT_bth_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_bth_P }%
+\def\XINT_bth_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_bth_P }%
\def\XINT_bth_P {\expandafter\XINT_bth_I\expandafter{\expandafter}%
\romannumeral0\XINT_OQ {}}%
\def\XINT_bth_I #1#2#3#4#5#6#7#8#9%
@@ -591,11 +591,11 @@
\def\XINT_htb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_htb_N
- -\dummy {\XINT_htb_P #1}%
+ #1\XINT_htb_N
+ -{\XINT_htb_P #1}%
\krof
}%
-\def\XINT_htb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_htb_P }%
+\def\XINT_htb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_htb_P }%
\def\XINT_htb_P {\XINT_htb_I_a {}}%
\def\XINT_htb_I_a #1#2#3#4#5#6#7#8#9%
{%
@@ -632,11 +632,11 @@
\def\XINT_chtb_checkin #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_chtb_N
- -\dummy {\XINT_chtb_P #1}%
+ #1\XINT_chtb_N
+ -{\XINT_chtb_P #1}%
\krof
}%
-\def\XINT_chtb_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_chtb_P }%
+\def\XINT_chtb_N {\expandafter\xint_minus_afterstop\romannumeral0\XINT_chtb_P }%
\def\XINT_chtb_P {\expandafter\XINT_chtb_I\expandafter{\expandafter}%
\romannumeral0\XINT_OQ {}}%
\def\XINT_chtb_I #1#2#3#4#5#6#7#8#9%
diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
index 345cfc7a203..776210f4ea8 100644
--- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintcfrac: Expandable continued fractions with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,7 +103,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2013/11/28 v1.09h Expandable continued fractions with xint package (jfB)]%
+ [2013/12/18 v1.09i Expandable continued fractions with xint package (jfB)]%
\def\xintCFrac {\romannumeral0\xintcfrac }%
\def\xintcfrac #1%
{%
@@ -343,9 +343,9 @@
\def\XINT_ftcc_D #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_ftcc_integer
- 0#1\dummy \XINT_ftcc_En
- 0-\dummy {\XINT_ftcc_Ep #1}%
+ #1-\XINT_ftcc_integer
+ 0#1\XINT_ftcc_En
+ 0-{\XINT_ftcc_Ep #1}%
\krof
}%
\def\XINT_ftcc_Ep #1\Z #2%
@@ -377,9 +377,9 @@
\def\XINT_ftcc_loop_d #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_ftcc_end
- 0#1\dummy \XINT_ftcc_loop_N
- 0-\dummy {\XINT_ftcc_loop_P #1}%
+ #1-\XINT_ftcc_end
+ 0#1\XINT_ftcc_loop_N
+ 0-{\XINT_ftcc_loop_P #1}%
\krof
}%
\def\XINT_ftcc_end #1\Z #2#3{ #3#2}%
@@ -767,7 +767,7 @@
\expandafter\XINT_igctcv_loop_l\expandafter
{\romannumeral0\xintrawwithzeros {#1/#2}}%
}%
-\def\XINT_igctcv_loop_l #1#2#3{\XINT_igctcv_loop_a {#3{#1[0]}}#2}%
+\def\XINT_igctcv_loop_l #1#2#3{\XINT_igctcv_loop_a {#3{#1}}#2}%1.09i removes [0]
\def\XINT_igctcv_end_a #1.#2#3#4#5%
{%
\expandafter\XINT_igctcv_end_b\expandafter
@@ -848,7 +848,7 @@
\def\XINT_cntcs #1#2%
{%
\ifnum #1<0
- \xint_afterfi { 0/1[0]}%
+ \xint_afterfi { }% 1.09i: a 0/1[0] was strangely here, removed
\else
\xint_afterfi {\expandafter\XINT_cntcs_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
@@ -877,7 +877,7 @@
\def\XINT_cntgc #1#2%
{%
\ifnum #1<0
- \xint_afterfi { 0/1[0]}%
+ \xint_afterfi { }% 1.09i there was as strange 0/1[0] here, removed
\else
\xint_afterfi {\expandafter\XINT_cntgc_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
@@ -906,7 +906,7 @@
\def\XINT_gcntgc #1#2#3%
{%
\ifnum #1<0
- \xint_afterfi { {0/1[0]}}%
+ \xint_afterfi { }% 1.09i now returns nothing
\else
\xint_afterfi {\expandafter\XINT_gcntgc_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 409b7c83fe5..0565e1d0212 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintexpr: Expandable expression parser
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,109 +103,123 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2013/11/28 v1.09h Expandable expression parser (jfB)]%
-\def\xint_gob_til_dot #1.{}%
-\def\xint_gob_til_dot_andstop #1.{ }%
-\def\xint_gob_til_! #1!{}% nota bene: ! is of catcode 11
+ [2013/12/18 v1.09i Expandable expression parser (jfB)]%
+\def\xint_gob_til_! #1!{}% nota bene: ! is of catcode 11
+\edef\XINT_expr_lock #1!%
+ {\noexpand\expandafter\space\noexpand\csname .=#1\noexpand\endcsname }%
+\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }%
+\def\XINT_expr_unlock_a #1.={}%
\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
-\def\XINT_newexpr_stripprefix #1>{\noexpand\romannumeral-`0}%
-\def\XINT_expr_lock #1!{\expandafter\space\csname .#1\endcsname }%
-\def\XINT_expr_unlock {\expandafter\xint_gob_til_dot\string }%
-\def\XINT_expr_usethe {use_xintthe!\xintError:use_xintthe! }%
+\def\XINT_newexpr_setprefix #1>{\noexpand\romannumeral-`0}%
+\def\xint_UDxintrelaxfork #1\xint_relax #2#3\krof {#2}%
\def\XINT_expr_done {!\XINT_expr_usethe\XINT_expr_print }%
-\def\XINT_expr_print #1{\XINT_expr_unlock #1}%
-\def\XINT_flexpr_done {!\XINT_expr_usethe\XINT_flexpr_print }%
-\def\XINT_flexpr_print #1{\xintFloat:csv{\XINT_expr_unlock #1}}%
-\def\XINT_numexpr_print #1{\xintRound:csv{\XINT_expr_unlock #1}}%
+\let\XINT_iiexpr_done \XINT_expr_done
+\def\XINT_iexpr_done {!\XINT_expr_usethe\XINT_iexpr_print }%
+\def\XINT_flexpr_done {!\XINT_expr_usethe\XINT_flexpr_print }%
+\def\XINT_boolexpr_done{!\XINT_expr_usethe\XINT_boolexpr_print }%
+\def\XINT_expr_usethe {use_xintthe!\xintError:use_xintthe! }%
+\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral-`0#1}%
+\let\XINT_expr_print \XINT_expr_unlock
+\def\XINT_iexpr_print #1{\xintRound:csv {\XINT_expr_unlock #1}}%
+\def\XINT_flexpr_print #1{\xintFloat:csv {\XINT_expr_unlock #1}}%
\def\XINT_boolexpr_print #1{\xintIsTrue:csv{\XINT_expr_unlock #1}}%
-\def\xintifboolexpr #1{\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
-\def\xintifboolfloatexpr #1{\romannumeral0\xintifnotzero
- {\xintthefloatexpr #1\relax}}%
-\def\xintexpr {\romannumeral0\xinteval }%
+\def\xintexpr {\romannumeral0\xinteval }%
+\def\xintfloatexpr {\romannumeral0\xintfloateval }%
+\def\xintiiexpr {\romannumeral0\xintiieval }%
\def\xinteval
-{%
- \expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext
-}%
-\def\xinttheeval {\expandafter\xint_gobble_ii\romannumeral0\xinteval }%
-\def\xinttheexpr {\romannumeral-`0\xinttheeval }%
-\def\XINT_numexpr_post !\XINT_expr_usethe\XINT_expr_print%
- { !\XINT_expr_usethe\XINT_numexpr_print }%
-\def\xintnumexpr {\romannumeral0\expandafter\XINT_numexpr_post
- \romannumeral0\xinteval }%
-\def\xintthenumexpr {\romannumeral-`0\xintthe\xintnumexpr }%
-\def\XINT_boolexpr_post !\XINT_expr_usethe\XINT_expr_print%
- { !\XINT_expr_usethe\XINT_boolexpr_print }%
-\def\xintboolexpr {\romannumeral0\expandafter\XINT_boolexpr_post
- \romannumeral0\xinteval }%
-\def\xinttheboolexpr {\romannumeral-`0\xintthe\xintboolexpr }%
-\def\xintfloatexpr {\romannumeral0\xintfloateval }%
+ {\expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext }%
\def\xintfloateval
-{%
- \expandafter\XINT_flexpr_until_end_a \romannumeral-`0\XINT_expr_getnext
-}%
-\def\xintthefloatexpr {\romannumeral-`0\xintthe\xintfloatexpr }%
-\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral-`0#1}%
+ {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintiieval
+ {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xinttheexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xinteval }%
+\def\xintthefloatexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintfloateval }%
+\def\xinttheiiexpr
+ {\romannumeral-`0\expandafter\xint_gobble_ii\romannumeral0\xintiieval }%
+\def\xintiexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_iexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xinttheiexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_iexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_done \expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_print\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
+\let\xintnumexpr \xintiexpr % deprecated
+\let\xintthenumexpr\xinttheiexpr % deprecated
+\def\xintifboolexpr #1%
+ {\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
+\def\xintifboolfloatexpr #1%
+ {\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
+\def\xintifbooliiexpr #1%
+ {\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
\def\XINT_expr_getnext
{%
\expandafter\XINT_expr_getnext_checkforbraced_a
\romannumeral-`0\romannumeral-`0%
}%
-\def\XINT_expr_getnext_checkforbraced_a #1%
+\def\XINT_expr_getnext_checkforbraced_a #1% was done later in <1.09i
{%
- \XINT_expr_getnext_checkforbraced_b #1\W\Z {#1}%
-}%
-\def\XINT_expr_getnext_checkforbraced_b #1#2%
-{%
- \xint_UDwfork
- #1\dummy \XINT_expr_getnext_emptybracepair
- #2\dummy \XINT_expr_getnext_onetoken_perhaps
- \W\dummy \XINT_expr_getnext_gotbracedstuff
- \krof
-}%
-\def\XINT_expr_getnext_onetoken_perhaps\Z #1%
-{%
- \expandafter\XINT_expr_getnext_checkforbraced_c\expandafter
+ \expandafter\XINT_expr_getnext_checkforbraced_b\expandafter
{\romannumeral-`0#1}%
}%
-\def\XINT_expr_getnext_checkforbraced_c #1%
+\def\XINT_expr_getnext_checkforbraced_b #1%
{%
- \XINT_expr_getnext_checkforbraced_d #1\W\Z {#1}%
+ \XINT_expr_getnext_checkforbraced_c #1\xint_relax\Z {#1}%
}%
-\def\XINT_expr_getnext_checkforbraced_d #1#2%
+\def\XINT_expr_getnext_checkforbraced_c #1#2%
{%
- \xint_UDwfork
- #1\dummy \XINT_expr_getnext_emptybracepair
- #2\dummy \XINT_expr_getnext_onetoken_wehope
- \W\dummy \XINT_expr_getnext_gotbracedstuff
+ \xint_UDxintrelaxfork
+ #1\XINT_expr_getnext_wasemptyorspace
+ #2\XINT_expr_getnext_gotonetoken_wehope
+ \xint_relax\XINT_expr_getnext_gotbracedstuff
\krof
}% doubly braced things are not acceptable, will cause errors.
-\def\XINT_expr_getnext_emptybracepair #1{\XINT_expr_getnext }%
-\def\XINT_expr_getnext_gotbracedstuff #1\W\Z #2% {..} -> number/fraction
+\def\XINT_expr_getnext_wasemptyorspace #1{\XINT_expr_getnext }%
+\def\XINT_expr_getnext_gotbracedstuff #1\xint_relax\Z #2%
{%
- \expandafter\XINT_expr_getop\csname .#2\endcsname
+ \expandafter\XINT_expr_getop\csname .=#2\endcsname
}%
-\def\XINT_expr_getnext_onetoken_wehope\Z #1% #1 isn't a control sequence!
-{%
+\def\XINT_expr_getnext_gotonetoken_wehope\Z #1%
+{% screens out sub-expressions and \count or \dimen registers/variables
\xint_gob_til_! #1\XINT_expr_subexpr !%
- \expandafter\XINT_expr_getnext_onetoken_fork\string #1%
-}% after this #1 should be now a catcode 12 token.
-\def\XINT_expr_subexpr !#1!{\expandafter\XINT_expr_getop\xint_gobble_ii }%
+ \ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs
+ \expandafter\XINT_expr_countdimenetc_fork
+ \else
+ \expandafter\expandafter\expandafter
+ \XINT_expr_getnext_onetoken_fork\expandafter\string
+ \fi
+ #1%
+}%
+\def\XINT_expr_subexpr !#1\fi {\expandafter\XINT_expr_getop\xint_gobble_iii }%
+\def\XINT_expr_countdimenetc_fork #1%
+{%
+ \ifx\count#1\else\ifx#1\dimen\else\ifx#1\numexpr\else\ifx#1\dimexpr\else
+ \ifx\skip#1\else\ifx\glueexpr#1\else
+ \XINT_expr_unpackvariable
+ \fi\fi\fi\fi\fi\fi
+ \expandafter\XINT_expr_getnext\number #1%
+}%
+\def\XINT_expr_unpackvariable\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext
+ \number #1{\fi\fi\fi\fi\fi\fi
+ \expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
\begingroup
\lccode`*=`#
\lowercase{\endgroup
-\def\XINT_expr_sixwayfork #1(-.+*\dummy #2#3\krof {#2}%
+\def\XINT_expr_sixwayfork #1(-.+*#2#3\krof {#2}%
\def\XINT_expr_getnext_onetoken_fork #1%
-{% The * is in truth catcode 12 #. For (clever!) use with \xintNewExpr.
+{% The * is in truth catcode 12 #. For (hacking) use with \xintNewExpr.
\XINT_expr_sixwayfork
- #1-.+*\dummy {\xint_c_xviii ({}}% back to until to trigger oparen
- (#1.+*\dummy -%
- (-#1+*\dummy {\XINT_expr_scandec_II.}%
- (-.#1*\dummy \XINT_expr_getnext%
- (-.+#1\dummy {\XINT_expr_scandec_II}%
- (-.+*\dummy {\XINT_expr_scan_dec_or_func #1}%
+ #1-.+*{\xint_c_xviii ({}}% back to until for oparen triggering
+ (#1.+*-%
+ (-#1+*{\XINT_expr_scandec_II.}%
+ (-.#1*\XINT_expr_getnext%
+ (-.+#1{\XINT_expr_scandec_II}%
+ (-.+*{\XINT_expr_scan_dec_or_func #1}%
\krof
}}%
-\def\XINT_expr_scan_dec_or_func #1% this #1 of catcode 12
+\def\XINT_expr_scan_dec_or_func #1% this #1 has necessarily here catcode 12
{%
\ifnum \xint_c_ix<1#1
\expandafter\XINT_expr_scandec_I
@@ -230,18 +244,17 @@
\xint_afterfi{\expandafter\XINT_expr_scanfunc_b \string #1}%
\fi
}%
+\def\xint_UDparenfork #1()#2#3\krof {#2}%
\def\XINT_expr_scanfunc_b #1%
{%
- \if #1(\expandafter \xint_gobble_iii\fi
- \xint_firstofone
- {% added in 1.09c for bool and togl
- \if #1)\expandafter \xint_gobble_i
- \else \expandafter \xint_firstoftwo
- \fi }%
- {\XINT_expr_scanfunc_c #1}(%
+ \xint_UDparenfork
+ #1){(}% and then \XINT_expr_func
+ (#1{(}% and then \XINT_expr_func (this is for bool/toggle names)
+ (){\XINT_expr_scanfunc_c #1}%
+ \krof
}%
\def\XINT_expr_scanfunc_panic {\xintError:bigtroubleahead(0\relax }%
-\def\XINT_expr_func #1(% common to expr and flexpr
+\def\XINT_expr_func #1(% common to expr and flexpr and iiexpr
{%
\xint_c_xviii @{#1}% functions have the highest priority.
}%
@@ -255,17 +268,24 @@
\expandafter\XINT_expr_getop\romannumeral-`0\expandafter
\XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b
}%
-\def\XINT_expr_scanintpart_a #1%
+\def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN}
+{%
+ \ifcat #1\relax
+ \expandafter !%
+ \else \expandafter\expandafter\expandafter
+ \XINT_expr_scanintpart_aa\expandafter\string
+ \fi #1%
+}%
+\def\XINT_expr_scanintpart_aa #1%
{%
- \ifnum \xint_c_ix<1\string#1
- \expandafter\expandafter\expandafter\XINT_expr_scanintpart_b
- \expandafter\string
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanintpart_b
\else
- \if #1.%
+ \if .#1%
\expandafter\expandafter\expandafter
\XINT_expr_scandec_transition
- \else
- \expandafter\expandafter\expandafter !% ! of catcode 11...
+ \else % gather what we got so far, leave catcode 12 #1 in stream
+ \expandafter\expandafter\expandafter !% ! of catcode 11 ...
\fi
\fi
#1%
@@ -282,9 +302,16 @@
}%
\def\XINT_expr_scanfracpart_a #1%
{%
- \ifnum \xint_c_ix<1\string#1
- \expandafter\expandafter\expandafter\XINT_expr_scanfracpart_b
- \expandafter\string
+ \ifcat #1\relax
+ \expandafter !%
+ \else \expandafter\expandafter\expandafter
+ \XINT_expr_scanfracpart_aa\expandafter\string
+ \fi #1%
+}%
+\def\XINT_expr_scanfracpart_aa #1%
+{%
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanfracpart_b
\else
\expandafter !%
\fi
@@ -301,23 +328,18 @@
\romannumeral-`0\romannumeral-`0%
}%
\def\XINT_expr_getop_a #1#2%
-{% if an un-expandable control sequence is found, must be the ending \relax
- \ifcat #2\relax
- \ifx #2\relax
- \expandafter\expandafter\expandafter
- \XINT_expr_foundend
- \else
- \XINT_expr_unexpectedtoken
- \expandafter\expandafter\expandafter
- \XINT_expr_getop
- \fi
- \else
- \expandafter\XINT_expr_foundop\expandafter #2%
+{% if a control sequence is found, must be either \relax or register|variable
+ \ifcat #2\relax\expandafter\xint_firstoftwo
+ \else \expandafter\xint_secondoftwo
\fi
- #1%
+ {\ifx #2\relax\expandafter\XINT_expr_foundend\expandafter#1%
+ \else
+ \xint_afterfi{\XINT_expr_foundop *#1#2}%
+ \fi }%
+ {\XINT_expr_foundop #2#1}%
}%
\def\XINT_expr_foundend {\xint_c_ \relax }% \relax is a place holder here.
-\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.f>
+\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.=f>
{% 1.09a: no control sequence \XINT_expr_op_#1, code common to expr/flexpr
\ifcsname XINT_expr_precedence_#1\endcsname
\expandafter\xint_afterfi\expandafter
@@ -332,43 +354,38 @@
\def#1##1%
{%
\xint_UDsignfork
- ##1\dummy {\expandafter#1\romannumeral-`0#3}%
- -\dummy {#2##1}%
+ ##1{\expandafter#1\romannumeral-`0#3}%
+ -{#2##1}%
\krof
}%
\def#2##1##2%
{%
\ifcase ##1\expandafter #4%
- \or \xint_afterfi{%
- \XINT_expr_extra_closing_paren
- \expandafter #1\romannumeral-`0\XINT_expr_getop
- }%
- \else \xint_afterfi{%
- \expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname
- }%
+ \or\xint_afterfi{%
+ \XINT_expr_extra_closing_paren
+ \expandafter #1\romannumeral-`0\XINT_expr_getop
+ }%
+ \else
+ \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname }%
\fi
}%
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_until_end_a\expandafter\endcsname
- \csname XINT_expr_until_end_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\expandafter\endcsname
- \csname XINT_expr_done\endcsname
- {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_until_end_a\expandafter\endcsname
- \csname XINT_flexpr_until_end_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\expandafter\endcsname
- \csname XINT_flexpr_done\endcsname
- {flexpr}%
+ \csname XINT_#1_until_end_a\expandafter\endcsname
+ \csname XINT_#1_until_end_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_#1_done\endcsname
+ {#1}%
+}%
\def\XINT_expr_extra_closing_paren {\xintError:removed }%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
\def #1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
\let #2#1%
\def #3##1{\xint_UDsignfork
- ##1\dummy {\expandafter #3\romannumeral-`0#5}%
- -\dummy {#4##1}%
+ ##1{\expandafter #3\romannumeral-`0#5}%
+ -{#4##1}%
\krof }%
\def #4##1##2%
{%
@@ -379,26 +396,23 @@
\fi
}%
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_op_(\expandafter\endcsname
- \csname XINT_expr_oparen\expandafter\endcsname
- \csname XINT_expr_until_)_a\expandafter\endcsname
- \csname XINT_expr_until_)_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\endcsname
- {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_op_(\expandafter\endcsname
- \csname XINT_flexpr_oparen\expandafter\endcsname
- \csname XINT_flexpr_until_)_a\expandafter\endcsname
- \csname XINT_flexpr_until_)_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\endcsname
- {flexpr}%
+ \csname XINT_#1_op_(\expandafter\endcsname
+ \csname XINT_#1_oparen\expandafter\endcsname
+ \csname XINT_#1_until_)_a\expandafter\endcsname
+ \csname XINT_#1_until_)_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\endcsname
+ {#1}%
+}%
\def\XINT_expr_missing_cparen {\xintError:inserted \xint_c_ \XINT_expr_done }%
-\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_expr_op_)\endcsname\XINT_expr_getop
+\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
\expandafter\let\csname XINT_flexpr_precedence_)\endcsname \xint_c_i
+\expandafter\let\csname XINT_iiexpr_precedence_)\endcsname \xint_c_i
+\expandafter\let\csname XINT_expr_op_)\endcsname \XINT_expr_getop
\expandafter\let\csname XINT_flexpr_op_)\endcsname\XINT_expr_getop
-\def\XINT_tmpb #1#2#3#4#5#6%
+\expandafter\let\csname XINT_iiexpr_op_)\endcsname\XINT_expr_getop
+\def\XINT_tmpb #1#2#3#4#5#6%#7%
{%
\expandafter\XINT_tmpc
\csname XINT_#1_op_#3\expandafter\endcsname
@@ -407,9 +421,9 @@
\csname XINT_#1_op_-#5\expandafter\endcsname
\csname xint_c_#4\expandafter\endcsname
\csname #2#6\expandafter\endcsname
- \csname XINT_expr_precedence_#3\endcsname {#1}%
+ \csname XINT_expr_precedence_#3\endcsname {#1}%{#7}%
}%
-\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+\def\XINT_tmpc #1#2#3#4#5#6#7#8#9%
{%
\def #1##1% \XINT_expr_op_<op>
{% keep value, get next number and operator, then do until
@@ -418,8 +432,8 @@
}%
\def #2##1##2% \XINT_expr_until_<op>_a
{\xint_UDsignfork
- ##2\dummy {\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -\dummy {#3##1##2}%
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
\krof }%
\def #3##1##2##3##4% \XINT_expr_until_<op>_b
{% either execute next operation now, or first do next (possibly unary)
@@ -429,12 +443,12 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3%
- \csname .#6{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
+ \csname .=#6#9{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
\fi
}%
\let #7#5%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1{}}%
\xintApplyInline {\XINT_tmpa }{%
{|{iii}{vi}{OR}}%
{&{iv}{vi}{AND}}%
@@ -449,7 +463,7 @@
{e{ix}{ix}{fE}}%
{E{ix}{ix}{fE}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1{}}%
\xintApplyInline {\XINT_tmpa }{%
{|{iii}{vi}{OR}}%
{&{iv}{vi}{AND}}%
@@ -457,7 +471,7 @@
{>{v}{vi}{Gt}}%
{={v}{vi}{Eq}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1{[\XINTdigits]}}%
\xintApplyInline {\XINT_tmpa }{%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
@@ -467,6 +481,21 @@
{e{ix}{ix}{fE}}%
{E{ix}{ix}{fE}}%
}%
+\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1{}}%
+\xintApplyInline {\XINT_tmpa }{%
+ {|{iii}{vi}{OR}}%
+ {&{iv}{vi}{AND}}%
+ {<{v}{vi}{Lt}}%
+ {>{v}{vi}{Gt}}%
+ {={v}{vi}{Eq}}%
+ {+{vi}{vi}{iiAdd}}%
+ {-{vi}{vi}{iiSub}}%
+ {*{vii}{vii}{iiMul}}%
+ {/{vii}{vii}{iiQuo}}%
+ {^{viii}{viii}{iiPow}}%
+ {e{ix}{ix}{iE}}%
+ {E{ix}{ix}{iE}}%
+}%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
\def #1##1% \XINT_expr_op_,_a
@@ -475,8 +504,8 @@
}%
\def #2##1##2% \XINT_expr_until_,_a
{\xint_UDsignfork
- ##2\dummy {\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -\dummy {#3##1##2}%
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
\krof }%
\def #3##1##2##3##4% \XINT_expr_until_,_b
{%
@@ -486,32 +515,28 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3%
- \csname .\XINT_expr_unlock ##1,\XINT_expr_unlock ##4\endcsname }%
+ \csname .=\XINT_expr_unlock ##1,\XINT_expr_unlock ##4\endcsname }%
\fi
}%
\let #5\xint_c_ii
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_expr_op_,\expandafter\endcsname
- \csname XINT_expr_until_,_a\expandafter\endcsname
- \csname XINT_expr_until_,_b\expandafter\endcsname
- \csname XINT_expr_op_-vi\expandafter\endcsname
- \csname XINT_expr_precedence_,\endcsname {expr}%
-\expandafter\XINT_tmpa
- \csname XINT_flexpr_op_,\expandafter\endcsname
- \csname XINT_flexpr_until_,_a\expandafter\endcsname
- \csname XINT_flexpr_until_,_b\expandafter\endcsname
- \csname XINT_flexpr_op_-vi\expandafter\endcsname
- \csname XINT_expr_precedence_,\endcsname {flexpr}%
-\def\XINT_tmpa #1#2%
+ \csname XINT_#1_op_,\expandafter\endcsname
+ \csname XINT_#1_until_,_a\expandafter\endcsname
+ \csname XINT_#1_until_,_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_,\endcsname {#1}%
+}%
+\def\XINT_tmpa #1#2#3%
{%
\expandafter\XINT_tmpb
- \csname XINT_#1_op_-#2\expandafter\endcsname
- \csname XINT_#1_until_-#2_a\expandafter\endcsname
- \csname XINT_#1_until_-#2_b\expandafter\endcsname
- \csname xint_c_#2\endcsname {#1}%
+ \csname XINT_#1_op_-#3\expandafter\endcsname
+ \csname XINT_#1_until_-#3_a\expandafter\endcsname
+ \csname XINT_#1_until_-#3_b\expandafter\endcsname
+ \csname xint_c_#3\endcsname {#1}#2%
}%
-\def\XINT_tmpb #1#2#3#4#5%
+\def\XINT_tmpb #1#2#3#4#5#6%
{%
\def #1% \XINT_expr_op_-<level>
{% get next number+operator then switch to _until macro
@@ -519,8 +544,8 @@
}%
\def #2##1% \XINT_expr_until_-<l>_a
{\xint_UDsignfork
- ##1\dummy {\expandafter #2\romannumeral-`0#1}%
- -\dummy {#3##1}%
+ ##1{\expandafter #2\romannumeral-`0#1}%
+ -{#3##1}%
\krof }%
\def #3##1##2##3% \XINT_expr_until_-<l>_b
{% _until tests precedence level with next op, executes now or postpones
@@ -529,12 +554,13 @@
\csname XINT_#5_op_##2\endcsname {##3}}%
\else
\xint_afterfi {\expandafter ##1\expandafter ##2%
- \csname .\xintOpp{\XINT_expr_unlock ##3}\endcsname }%
+ \csname .=#6{\XINT_expr_unlock ##3}\endcsname }%
\fi
}%
}%
-\xintApplyInline{\XINT_tmpa {expr}}{{vi}{vii}{viii}{ix}}%
-\xintApplyInline{\XINT_tmpa {flexpr}}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {expr}\xintOpp}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {flexpr}\xintOpp}{{vi}{vii}{viii}{ix}}%
+\xintApplyInline{\XINT_tmpa {iiexpr}\xintiiOpp}{{vi}{vii}{viii}{ix}}%
\let\XINT_expr_precedence_? \xint_c_x
\def \XINT_expr_op_? #1#2#3%
{%
@@ -543,6 +569,7 @@
{\XINT_expr_getnext #2}%
}%
\let\XINT_flexpr_op_?\XINT_expr_op_?
+\let\XINT_iiexpr_op_?\XINT_expr_op_?
\let\XINT_expr_precedence_: \xint_c_x
\def \XINT_expr_op_: #1#2#3#4%
{%
@@ -552,145 +579,198 @@
{\XINT_expr_getnext #4}%
}%
\let\XINT_flexpr_op_:\XINT_expr_op_:
+\let\XINT_iiexpr_op_:\XINT_expr_op_:
\let\XINT_expr_precedence_! \xint_c_x
\def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop
- \csname .\xintFac{\XINT_expr_unlock #1}\endcsname }% [0] removed in 1.09c
+ \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
\let\XINT_flexpr_op_!\XINT_expr_op_!
-\def\XINT_expr_op_@ #1%
-{%
- \ifcsname XINT_expr_onlitteral_#1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter\XINT_expr_op_@@
- \fi {#1}%
+\def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop
+ \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
+\def\XINT_tmpa #1#2#3#4{%
+ \def #1##1%
+ {%
+ \ifcsname XINT_expr_onlitteral_##1\endcsname
+ \expandafter\XINT_expr_funcoflitteral
+ \else
+ \expandafter #2%
+ \fi {##1}%
+ }%
+ \def #2##1%
+ {%
+ \ifcsname XINT_#4_func_##1\endcsname
+ \xint_afterfi
+ {\expandafter\expandafter\csname XINT_#4_func_##1\endcsname}%
+ \else \csname xintError:unknown `##1\string'\endcsname
+ \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
+ \fi
+ \romannumeral-`0#3%
+ }%
}%
-\def\XINT_flexpr_op_@ #1%
-{%
- \ifcsname XINT_expr_onlitteral_#1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter\XINT_flexpr_op_@@
- \fi {#1}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+ \expandafter\XINT_tmpa
+ \csname XINT_#1_op_@\expandafter\endcsname
+ \csname XINT_#1_op_@@\expandafter\endcsname
+ \csname XINT_#1_oparen\endcsname {#1}%
}%
\def\XINT_expr_funcoflitteral #1%
{%
\expandafter\expandafter\csname XINT_expr_onlitteral_#1\endcsname
\romannumeral-`0\XINT_expr_scanfunc
}%
-\def\XINT_expr_op_@@ #1%
-{%
- \ifcsname XINT_expr_func_#1\endcsname
- \xint_afterfi{\expandafter\expandafter\csname XINT_expr_func_#1\endcsname}%
- \else \xintError:unknownfunction
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0\XINT_expr_oparen
-}%
-\def\XINT_flexpr_op_@@ #1%
-{%
- \ifcsname XINT_flexpr_func_#1\endcsname
- \xint_afterfi{\expandafter\expandafter\csname XINT_flexpr_func_#1\endcsname}%
- \else \xintError:unknownfunction
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0\XINT_flexpr_oparen
-}%
\def\XINT_expr_onlitteral_bool #1#2#3{\expandafter\XINT_expr_getop
- \csname .\xintBool{#3}\endcsname }%
+ \csname .=\xintBool{#3}\endcsname }%
\def\XINT_expr_onlitteral_togl #1#2#3{\expandafter\XINT_expr_getop
- \csname .\xintToggle{#3}\endcsname }%
-\def\XINT_expr_func_unknown #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .0[0]\endcsname
-}%
+ \csname .=\xintToggle{#3}\endcsname }%
+\def\XINT_expr_func_unknown #1#2#3% 1.09i removes [0], because \xintiiexpr
+ {\expandafter #1\expandafter #2\csname .=0\endcsname }%
\def\XINT_expr_func_reduce #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIrr {\XINT_expr_unlock #3}\endcsname
+ .=\xintIrr {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
+\def\XINT_expr_func_frac #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintTFrac {\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_flexpr_func_frac #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\XINTinFloatFrac [\XINTdigits]{\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_sqr #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSqr {\XINT_expr_unlock #3}\endcsname
+ .=\xintSqr {\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_sqr #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMul {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMul [\XINTdigits]%
+ {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_sqr #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSqr {\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_abs #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintAbs {\XINT_expr_unlock #3}\endcsname
+ .=\xintAbs {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_abs\XINT_expr_func_abs
+\def\XINT_iiexpr_func_abs #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiAbs {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_sgn #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSgn {\XINT_expr_unlock #3}\endcsname
+ .=\xintSgn {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_sgn\XINT_expr_func_sgn
+\def\XINT_iiexpr_func_sgn #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSgn {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_floor #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloor {\XINT_expr_unlock #3}\endcsname
+ .=\xintFloor {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_floor\XINT_expr_func_floor
+\let\XINT_iiexpr_func_floor\XINT_expr_func_floor
\def\XINT_expr_func_ceil #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintCeil {\XINT_expr_unlock #3}\endcsname
+ .=\xintCeil {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_ceil\XINT_expr_func_ceil
+\let\XINT_iiexpr_func_ceil\XINT_expr_func_ceil
\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
\def\XINT_expr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\expandafter\expandafter\xintQuo
\expandafter\XINT_expr_twoargs
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_quo\XINT_expr_func_quo
+\def\XINT_iiexpr_func_quo #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+}%
\def\XINT_expr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\expandafter\expandafter\xintRem
\expandafter\XINT_expr_twoargs
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_rem\XINT_expr_func_rem
+\def\XINT_iiexpr_func_rem #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+}%
\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
{%
\if\relax#5\relax\expandafter\xint_firstoftwo\else
\expandafter\xint_secondoftwo\fi
- {#1{0}{#3}}{#2{\xintNum {#4}}{#3}}%
+ {#1{0}}{#2{\xintNum {#4}}}{#3}%
}%
\def\XINT_expr_func_round #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
\expandafter\xintiRound\expandafter\xintRound
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_round\XINT_expr_func_round
+\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
+{%
+ \if\relax#4\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#1{#3}}{#2}%
+}%
+\def\XINT_iiexpr_func_round #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINT_iiexpr_oneortwo\expandafter\xintiRound
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+}%
\def\XINT_expr_func_trunc #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
\expandafter\xintiTrunc\expandafter\xintTrunc
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_trunc\XINT_expr_func_trunc
+\def\XINT_iiexpr_func_trunc #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINT_iiexpr_oneortwo\expandafter\xintiTrunc
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+}%
\def\XINT_expr_argandopt #1,#2,#3.%
{%
\if\relax#3\relax\expandafter\xint_firstoftwo\else
\expandafter\xint_secondoftwo\fi
- {[\XINTdigits]{#1}}{[\xintNum {#2}]{#1}}%
+ {[\XINTdigits]}{[\xintNum {#2}]}{#1}%
}%
\def\XINT_expr_func_float #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINTinFloat
\romannumeral-`0\expandafter\XINT_expr_argandopt
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
@@ -698,127 +778,164 @@
\let\XINT_flexpr_func_float\XINT_expr_func_float
\def\XINT_expr_func_sqrt #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .%
+ \expandafter #1\expandafter #2\csname .=%
\expandafter\XINTinFloatSqrt
\romannumeral-`0\expandafter\XINT_expr_argandopt
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
+\def\XINT_iiexpr_func_sqrt #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiSqrt {\XINT_expr_unlock #3}\endcsname
+}%
\def\XINT_expr_func_gcd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
+\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
\def\XINT_expr_func_lcm #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
+\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
\def\XINT_expr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_max #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_min #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintSum:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_sum #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+}%
+\def\XINT_iiexpr_func_prd #1#2#3%
+{%
+ \expandafter #1\expandafter #2\csname
+ .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_expr_func_add\XINT_expr_func_sum
\let\XINT_expr_func_mul\XINT_expr_func_prd
\let\XINT_flexpr_func_add\XINT_flexpr_func_sum
\let\XINT_flexpr_func_mul\XINT_flexpr_func_prd
+\let\XINT_iiexpr_func_add\XINT_iiexpr_func_sum
+\let\XINT_iiexpr_func_mul\XINT_iiexpr_func_prd
\def\XINT_expr_func_? #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_? \XINT_expr_func_?
+\let\XINT_iiexpr_func_? \XINT_expr_func_?
\def\XINT_expr_func_! #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_! \XINT_expr_func_!
+\let\XINT_iiexpr_func_! \XINT_expr_func_!
\def\XINT_expr_func_not #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintIsZero {\XINT_expr_unlock #3}\endcsname
+ .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_not \XINT_expr_func_not
+\let\XINT_iiexpr_func_not \XINT_expr_func_not
\def\XINT_expr_func_all #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_all\XINT_expr_func_all
+\let\XINT_iiexpr_func_all\XINT_expr_func_all
\def\XINT_expr_func_any #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintORof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_any\XINT_expr_func_any
+\let\XINT_iiexpr_func_any\XINT_expr_func_any
\def\XINT_expr_func_xor #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
+ .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_flexpr_func_xor\XINT_expr_func_xor
+\let\XINT_iiexpr_func_xor\XINT_expr_func_xor
\def\xintifNotZero:: #1,#2,#3,{\xintifNotZero{#1}{#2}{#3}}%
\def\XINT_expr_func_if #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\expandafter\xintifNotZero::
+ .=\expandafter\xintifNotZero::
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_if\XINT_expr_func_if
+\let\XINT_iiexpr_func_if\XINT_expr_func_if
\def\xintifSgn:: #1,#2,#3,#4,{\xintifSgn{#1}{#2}{#3}{#4}}%
\def\XINT_expr_func_ifsgn #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\expandafter\xintifSgn::
+ .=\expandafter\xintifSgn::
\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_ifsgn\XINT_expr_func_ifsgn
+\let\XINT_iiexpr_func_ifsgn\XINT_expr_func_ifsgn
\def\XINT_newexpr_print #1{\ifnum\xintNthElt{0}{#1}>1
\expandafter\xint_firstoftwo
\else
\expandafter\xint_secondoftwo
\fi
{_xintListWithSep,{#1}}{\xint_firstofone#1}}%
-\xintForpair #1#2 in {(fl,Float),(num,iRound0),(bool,IsTrue)}\do {%
+\xintForpair #1#2 in {(fl,Float),(i,iRound0),(bool,IsTrue)}\do {%
\expandafter\def\csname XINT_new#1expr_print\endcsname
##1{\ifnum\xintNthElt{0}{##1}>1
\expandafter\xint_firstoftwo
@@ -828,12 +945,18 @@
{_xintListWithSep,{\xintApply{_xint#2}{##1}}}
{_xint#2##1}}}%
\toks0 {}%
-\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,%
+\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,TFrac,%
Lt,Gt,Eq,AND,OR,IsNotZero,IsZero,ifNotZero,ifSgn,%
- Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE}\do
+ Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE,iSqrt,%
+ iiAdd,iiSub,iiMul,iiSqr,iiPow,iiQuo,iiRem,iiSgn,iiAbs,iiOpp,iE}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd}\do
+\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE,Frac}\do
+ {\toks0
+ \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
+ {_XINTinFloat#1}}}%
+\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd,%
+ iMaxof,iMinof,iiSum,iiPrd}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
@@ -841,17 +964,13 @@
{\toks0
\expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1:csv\endcsname
####1{_XINTinFloat#1{\xintCSVtoListNonStripped {####1}}}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
- {_XINTinFloat#1}}}%
\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
\def\XINTdigits {_XINTdigits}%
\def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
\def\XINT_flexpr_print ##1{\expandafter\XINT_newflexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_numexpr_print ##1{\expandafter\XINT_newnumexpr_print\expandafter
+ \def\XINT_iexpr_print ##1{\expandafter\XINT_newiexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
\def\XINT_boolexpr_print ##1{\expandafter\XINT_newboolexpr_print\expandafter
{\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
@@ -859,7 +978,9 @@
\toks0 {}%
\def\xintNewExpr {\xint_NewExpr\xinttheexpr }%
\def\xintNewFloatExpr {\xint_NewExpr\xintthefloatexpr }%
-\def\xintNewNumExpr {\xint_NewExpr\xintthenumexpr }%
+\def\xintNewIExpr {\xint_NewExpr\xinttheiexpr }%
+\let\xintNewNumExpr\xintNewIExpr
+\def\xintNewIIExpr {\xint_NewExpr\xinttheiiexpr }%
\def\xintNewBoolExpr {\xint_NewExpr\xinttheboolexpr }%
\def\xint_NewExpr #1#2[#3]%
{%
@@ -877,31 +998,32 @@
\or \toks0 {\xdef #2##1##2##3##4##5##6##7##8##9}%
\fi
\xintexprSafeCatcodes
+ \escapechar92
\XINT_NewExpr #1%
}%
\catcode`* 13
\def\XINT_NewExpr #1#2%
{%
- \def\xintTmp ##1##2##3##4##5##6##7##8##9{#2}%
+ \def\XINT_tmpa ##1##2##3##4##5##6##7##8##9{#2}%
\XINT_expr_protect
- \lccode`\*=`_ \lowercase {\def*}{!noexpand!}%
- \catcode`_ 13 \catcode`: 11 \endlinechar -1
+ \lccode`*=`_ \lowercase {\def*}{!noexpand!}%
+ \catcode`_ 13 \catcode`: 11 %\endlinechar -1 %not sure why I had that, \par?
\everyeof {\noexpand }%
- \edef\XINTtmp ##1##2##3##4##5##6##7##8##9%
+ \edef\XINT_tmpb ##1##2##3##4##5##6##7##8##9%
{\scantokens
\expandafter{\romannumeral-`0#1%
- \xintTmp {####1}{####2}{####3}%
- {####4}{####5}{####6}%
- {####7}{####8}{####9}%
+ \XINT_tmpa {####1}{####2}{####3}%
+ {####4}{####5}{####6}%
+ {####7}{####8}{####9}%
\relax}}%
- \lccode`\*=`\$ \lowercase {\def*}{####}%
+ \lccode`*=`\$ \lowercase {\def*}{####}%
\catcode`\$ 13 \catcode`! 0 \catcode`_ 11 %
\the\toks0
{\scantokens\expandafter{\expandafter
- \XINT_newexpr_stripprefix\meaning\XINTtmp}}%
+ \XINT_newexpr_setprefix\meaning\XINT_tmpb}}%
\endgroup
}%
-\let\xintexprRestoreCatcodes\relax
+\let\xintexprRestoreCatcodes\empty
\def\xintexprSafeCatcodes
{% for end user.
\edef\xintexprRestoreCatcodes {%
@@ -924,8 +1046,9 @@
\catcode46=\the\catcode46 % .
\catcode45=\the\catcode45 % -
\catcode44=\the\catcode44 % ,
- \catcode61=\the\catcode61\relax % =
- }% this is just for some standard situation with a few made active by Babel
+ \catcode61=\the\catcode61 % =
+ \catcode32=\the\catcode32\relax % space
+ }% it's hard to know where to stop...
\catcode63=12 % ?
\catcode124=12 % |
\catcode38=4 % &
@@ -946,6 +1069,7 @@
\catcode45=12 % -
\catcode44=12 % ,
\catcode61=12 % =
+ \catcode32=10 % space
}%
\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index acebf35e6f7..ebe00b574bc 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintfrac: Expandable operations on fractions
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,7 +103,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2013/11/28 v1.09h Expandable operations on fractions (jfB)]%
+ [2013/12/18 v1.09i Expandable operations on fractions (jfB)]%
\chardef\xint_c_vi 6
\chardef\xint_c_vii 7
\chardef\xint_c_xviii 18
@@ -149,7 +149,7 @@
}%
\def\XINT_outfrac #1#2#3%
{%
- \ifcase\XINT_Sgn{#3}
+ \ifcase\XINT__Sgn #3\Z
\expandafter \XINT_outfrac_divisionbyzero
\or
\expandafter \XINT_outfrac_P
@@ -159,11 +159,11 @@
{#2}{#3}[#1]%
}%
\def\XINT_outfrac_divisionbyzero #1#2{\xintError:DivisionByZero\space #1/0}%
-\def\XINT_outfrac_P #1#2%
+\edef\XINT_outfrac_P #1#2%
{%
- \ifcase\XINT_Sgn{#1}
- \expandafter\XINT_outfrac_Zero
- \fi
+ \noexpand\if0\noexpand\XINT_Sgn #1\noexpand\Z
+ \noexpand\expandafter\noexpand\XINT_outfrac_Zero
+ \noexpand\fi
\space #1/#2%
}%
\def\XINT_outfrac_Zero #1[#2]{ 0/1[0]}%
@@ -184,8 +184,8 @@
\def\XINT_infrac_ #1[#2#3]#4\Z
{%
\xint_UDwfork
- #2\dummy \XINT_infrac_A
- \W\dummy \XINT_infrac_B
+ #2\XINT_infrac_A
+ \W\XINT_infrac_B
\krof
#1[#2#3]#4%
}%
@@ -201,8 +201,8 @@
\def\XINT_infrac_BC #1/#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_infrac_BCa
- \W\dummy {\expandafter\XINT_infrac_BCb \romannumeral-`0#2}%
+ #2\XINT_infrac_BCa
+ \W{\expandafter\XINT_infrac_BCb \romannumeral-`0#2}%
\krof
#3\Z #1\Z
}%
@@ -212,16 +212,16 @@
\def\XINT_frac #1/#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_A
- \W\dummy {\expandafter\XINT_frac_U \romannumeral-`0#2}%
+ #2\XINT_frac_A
+ \W{\expandafter\XINT_frac_U \romannumeral-`0#2}%
\krof
#3e\W\Z #1e\W\Z
}%
\def\XINT_frac_U #1e#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ua
- \W\dummy {\XINT_frac_Ub #2}%
+ #2\XINT_frac_Ua
+ \W{\XINT_frac_Ub #2}%
\krof
#3\Z #1\Z
}%
@@ -230,8 +230,8 @@
\def\XINT_frac_B #1.#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ba
- \W\dummy {\XINT_frac_Bb #2}%
+ #2\XINT_frac_Ba
+ \W{\XINT_frac_Bb #2}%
\krof
#3\Z #1\Z
}%
@@ -245,8 +245,8 @@
\def\XINT_frac_T #1#2#3#4e#5#6\Z
{%
\xint_UDwfork
- #5\dummy \XINT_frac_Ta
- \W\dummy {\XINT_frac_Tb #5}%
+ #5\XINT_frac_Ta
+ \W{\XINT_frac_Tb #5}%
\krof
#6\Z #4\Z {#1}{#2}{#3}%
}%
@@ -255,8 +255,8 @@
\def\XINT_frac_C #1.#2#3\Z
{%
\xint_UDwfork
- #2\dummy \XINT_frac_Ca
- \W\dummy {\XINT_frac_Cb #2}%
+ #2\XINT_frac_Ca
+ \W{\XINT_frac_Cb #2}%
\krof
#3\Z #1\Z
}%
@@ -284,14 +284,14 @@
\def\XINT_frac_F #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_frac_Gdivisionbyzero
- 0#1\dummy \XINT_frac_Gneg
- 0-\dummy {\XINT_frac_Gpos #1}%
+ #1-\XINT_frac_Gdivisionbyzero
+ 0#1\XINT_frac_Gneg
+ 0-{\XINT_frac_Gpos #1}%
\krof
}%
-\def\XINT_frac_Gdivisionbyzero #1\Z #2#3%
+\edef\XINT_frac_Gdivisionbyzero #1\Z #2#3%
{%
- \xintError:DivisionByZero\space {0}{#2}{0}%
+ \noexpand\xintError:DivisionByZero\space {0}{#2}{0}%
}%
\def\XINT_frac_Gneg #1\Z #2#3%
{%
@@ -426,7 +426,7 @@
}%
\def\XINT_rawz #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_rawz_Ba
\or
\expandafter\XINT_rawz_A
@@ -452,7 +452,7 @@
}%
\def\XINT_numer #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_numer_B
\or
\expandafter\XINT_numer_A
@@ -470,7 +470,7 @@
}%
\def\XINT_denom #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_denom_B
\or
\expandafter\XINT_denom_A
@@ -492,23 +492,21 @@
{%
\xint_gob_til_zero #1\XINT_fracfrac_C 0\XINT_fracfrac_D {10^{#1#2}}%
}%
-\def\XINT_fracfrac_C #1#2#3#4#5%
+\def\XINT_fracfrac_C 0\XINT_fracfrac_D #1#2#3%
{%
- \ifcase\XINT_isOne {#5}
- \or \xint_afterfi {\expandafter\xint_firstoftwo_andstop\xint_gobble_ii }%
+ \if1\XINT_isOne {#3}%
+ \xint_afterfi {\expandafter\xint_firstoftwo_afterstop\xint_gobble_ii }%
\fi
\space
- \frac {#4}{#5}%
+ \frac {#2}{#3}%
}%
\def\XINT_fracfrac_D #1#2#3%
{%
- \ifcase\XINT_isOne {#3}
- \or \XINT_fracfrac_E
- \fi
+ \if1\XINT_isOne {#3}\XINT_fracfrac_E\fi
\space
\frac {#2}{#3}#1%
}%
-\def\XINT_fracfrac_E \fi #1#2#3#4{\fi \space #3\cdot }%
+\def\XINT_fracfrac_E \fi\space\frac #1#2{\fi \space #1\cdot }%
\def\xintSignedFrac {\romannumeral0\xintsignedfrac }%
\def\xintsignedfrac #1%
{%
@@ -521,8 +519,8 @@
\def\XINT_sgnfrac_b #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_sgnfrac_N
- -\dummy {\XINT_sgnfrac_P #1}%
+ #1\XINT_sgnfrac_N
+ -{\XINT_sgnfrac_P #1}%
\krof
}%
\def\XINT_sgnfrac_P #1\Z #2%
@@ -531,7 +529,7 @@
}%
\def\XINT_sgnfrac_N
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_sgnfrac_P
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_sgnfrac_P
}%
\def\xintFwOver {\romannumeral0\xintfwover }%
\def\xintfwover #1%
@@ -546,18 +544,14 @@
\catcode`^=11
\def\XINT_fwover_C #1#2#3#4#5%
{%
- \ifcase\XINT_isOne {#5}
- \xint_afterfi { {#4\over #5}}%
- \or
- \xint_afterfi { #4}%
+ \if0\XINT_isOne {#5}\xint_afterfi { {#4\over #5}}%
+ \else\xint_afterfi { #4}%
\fi
}%
\def\XINT_fwover_D #1#2#3%
{%
- \ifcase\XINT_isOne {#3}
- \xint_afterfi { {#2\over #3}}%
- \or
- \xint_afterfi { #2\cdot }%
+ \if0\XINT_isOne {#3}\xint_afterfi { {#2\over #3}}%
+ \else\xint_afterfi { #2\cdot }%
\fi
#1%
}%
@@ -573,8 +567,8 @@
\def\XINT_sgnfwover_b #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_sgnfwover_N
- -\dummy {\XINT_sgnfwover_P #1}%
+ #1\XINT_sgnfwover_N
+ -{\XINT_sgnfwover_P #1}%
\krof
}%
\def\XINT_sgnfwover_P #1\Z #2%
@@ -583,7 +577,7 @@
}%
\def\XINT_sgnfwover_N
{%
- \expandafter\xint_minus_andstop\romannumeral0\XINT_sgnfwover_P
+ \expandafter\xint_minus_afterstop\romannumeral0\XINT_sgnfwover_P
}%
\def\xintREZ {\romannumeral0\xintrez }%
\def\xintrez
@@ -597,13 +591,13 @@
\def\XINT_rez_AB #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_rez_zero
- 0#1\dummy \XINT_rez_neg
- 0-\dummy {\XINT_rez_B #1}%
+ #1-\XINT_rez_zero
+ 0#1\XINT_rez_neg
+ 0-{\XINT_rez_B #1}%
\krof
}%
\def\XINT_rez_zero #1\Z #2#3{ 0/1[0]}%
-\def\XINT_rez_neg {\expandafter\xint_minus_andstop\romannumeral0\XINT_rez_B }%
+\def\XINT_rez_neg {\expandafter\xint_minus_afterstop\romannumeral0\XINT_rez_B }%
\def\XINT_rez_B #1\Z
{%
\expandafter\XINT_rez_C\romannumeral0\XINT_factortens {#1}%
@@ -627,6 +621,7 @@
{%
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+#4}{#2}{#3}%
}%
+\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
\def\xintfE {\romannumeral0\xintfe }%
\def\xintfe #1%
{%
@@ -636,8 +631,51 @@
{%
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+\xintNum{#4}}{#2}{#3}%
}%
-\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
-\let\XINTinFloatfE\xintfE
+\def\xintFloatE {\romannumeral0\xintfloate }%
+\def\xintfloate #1{\XINT_floate_chkopt #1\Z }%
+\def\XINT_floate_chkopt #1%
+{%
+ \ifx [#1\expandafter\XINT_floate_opt
+ \else\expandafter\XINT_floate_noopt
+ \fi #1%
+}%
+\def\XINT_floate_noopt #1\Z
+{%
+ \expandafter\XINT_floate_a\expandafter\XINTdigits
+ \romannumeral0\XINT_infrac {#1}%
+}%
+\def\XINT_floate_opt [\Z #1]#2%
+{%
+ \expandafter\XINT_floate_a\expandafter
+ {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
+}%
+\def\XINT_floate_a #1#2#3#4#5%
+{%
+ \expandafter\expandafter\expandafter\XINT_float_a
+ \expandafter\xint_exchangetwo_keepbraces\expandafter
+ {\the\numexpr #2+#5}{#1}{#3}{#4}\XINT_float_Q
+}%
+\def\XINTinFloatfE {\romannumeral0\XINT_inFloatfE }%
+\def\XINT_inFloatfE [#1]#2%
+{%
+ \expandafter\XINT_infloatfe_a\expandafter
+ {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
+}%
+\def\XINT_infloatfe_a #1#2#3#4#5%
+{%
+ \expandafter\expandafter\expandafter\XINT_infloat_a
+ \expandafter\xint_exchangetwo_keepbraces\expandafter
+ {\the\numexpr #2+\xintNum{#5}}{#1}{#3}{#4}\XINT_infloat_Q
+}%
+\def\xintiE {\romannumeral0\xintie }% for \xintiiexpr only
+\def\xintie #1%
+{%
+ \expandafter\XINT_ie \romannumeral0\XINT_infrac {#1}% allows 3.123e3
+}%
+\def\XINT_ie #1#2#3#4% assumes #3=1 and uses \xint_dsh with its \numexpr
+{%
+ \xint_dsh {#2}{0-(#1+#4)}% could have \xintNum{#4} for a bit more general
+}%
\def\xintIrr {\romannumeral0\xintirr }%
\def\xintirr #1%
{%
@@ -645,27 +683,27 @@
}%
\def\XINT_irr_start #1#2/#3\Z
{%
- \ifcase\XINT_isOne {#3}
+ \if0\XINT_isOne {#3}%
\xint_afterfi
{\xint_UDsignfork
- #1\dummy \XINT_irr_negative
- -\dummy {\XINT_irr_nonneg #1}%
+ #1\XINT_irr_negative
+ -{\XINT_irr_nonneg #1}%
\krof}%
- \or
+ \else
\xint_afterfi{\XINT_irr_denomisone #1}%
\fi
#2\Z {#3}%
}%
\def\XINT_irr_denomisone #1\Z #2{ #1/1}% changed in 1.08
-\def\XINT_irr_negative #1\Z #2{\XINT_irr_D #1\Z #2\Z \xint_minus_andstop}%
+\def\XINT_irr_negative #1\Z #2{\XINT_irr_D #1\Z #2\Z \xint_minus_afterstop}%
\def\XINT_irr_nonneg #1\Z #2{\XINT_irr_D #1\Z #2\Z \space}%
\def\XINT_irr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\dummy \XINT_irr_indeterminate
- #30\dummy \XINT_irr_divisionbyzero
- #10\dummy \XINT_irr_zero
- 00\dummy \XINT_irr_loop_a
+ #3#1\XINT_irr_indeterminate
+ #30\XINT_irr_divisionbyzero
+ #10\XINT_irr_zero
+ 00\XINT_irr_loop_a
\krof
{#3#4}{#1#2}{#3#4}{#1#2}%
}%
@@ -698,20 +736,19 @@
\def\XINT_irr_finish #1#2#3{#3#1/#2}% changed in 1.08
\def\xintNum {\romannumeral0\xintnum }%
\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}\Z }%
-\def\XINT_intcheck #1/#2\Z
+\edef\XINT_intcheck #1/#2\Z
{%
- \ifcase\XINT_isOne {#2}
- \xintError:NotAnInteger
- \fi\space #1%
+ \noexpand\if 0\noexpand\XINT_isOne {#2}\noexpand\xintError:NotAnInteger
+ \noexpand\fi\space #1%
}%
\def\xintifInt {\romannumeral0\xintifint }%
\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintirr {#1}\Z }%
\def\XINT_ifint #1/#2\Z
{%
\if\XINT_isOne {#2}1%
- \xint_afterfi{\expandafter\space\xint_firstoftwo}%
+ \expandafter\xint_firstoftwo_afterstop
\else
- \xint_afterfi{\expandafter\space\xint_secondoftwo}%
+ \expandafter\xint_secondoftwo_afterstop
\fi
}%
\def\xintJrr {\romannumeral0\xintjrr }%
@@ -721,27 +758,26 @@
}%
\def\XINT_jrr_start #1#2/#3\Z
{%
- \ifcase\XINT_isOne {#3}
- \xint_afterfi
+ \if0\XINT_isOne {#3}\xint_afterfi
{\xint_UDsignfork
- #1\dummy \XINT_jrr_negative
- -\dummy {\XINT_jrr_nonneg #1}%
+ #1\XINT_jrr_negative
+ -{\XINT_jrr_nonneg #1}%
\krof}%
- \or
+ \else
\xint_afterfi{\XINT_jrr_denomisone #1}%
\fi
#2\Z {#3}%
}%
\def\XINT_jrr_denomisone #1\Z #2{ #1/1}% changed in 1.08
-\def\XINT_jrr_negative #1\Z #2{\XINT_jrr_D #1\Z #2\Z \xint_minus_andstop }%
+\def\XINT_jrr_negative #1\Z #2{\XINT_jrr_D #1\Z #2\Z \xint_minus_afterstop }%
\def\XINT_jrr_nonneg #1\Z #2{\XINT_jrr_D #1\Z #2\Z \space}%
\def\XINT_jrr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\dummy \XINT_jrr_indeterminate
- #30\dummy \XINT_jrr_divisionbyzero
- #10\dummy \XINT_jrr_zero
- 00\dummy \XINT_jrr_loop_a
+ #3#1\XINT_jrr_indeterminate
+ #30\XINT_jrr_divisionbyzero
+ #10\XINT_jrr_zero
+ 00\XINT_jrr_loop_a
\krof
{#3#4}{#1#2}1001%
}%
@@ -776,6 +812,30 @@
{%
\XINT_irr_finish {#3}{#4}%
}%
+\def\xintTFrac {\romannumeral0\xinttfrac }%
+\def\xinttfrac #1%
+ {\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
+\def\XINT_tfrac_fork #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_tfrac_zero
+ 0#1\XINT_tfrac_N
+ 0-{\XINT_tfrac_P #1}%
+ \krof
+}%
+\def\XINT_tfrac_zero #1\Z { 0/1[0]}%
+\def\XINT_tfrac_N {\expandafter\XINT_opp\romannumeral0\XINT_tfrac_P }%
+\def\XINT_tfrac_P #1/#2\Z
+{%
+ \expandafter\XINT_rez_AB\romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}%
+}%
+\def\XINTinFloatFrac {\romannumeral0\XINT_inFloatFrac }%
+\def\XINT_inFloatFrac [#1]#2%
+{%
+ \expandafter\XINT_infloatfrac_a\expandafter
+ {\romannumeral0\xinttfrac{#2}}{#1}%
+}%
+\def\XINT_infloatfrac_a #1#2{\XINT_inFloat [#2]{#1}}%
\def\xintTrunc {\romannumeral0\xinttrunc }%
\def\xintiTrunc {\romannumeral0\xintitrunc }%
\def\xinttrunc #1%
@@ -810,7 +870,7 @@
\def\XINT_trunc_iszero #1#2#3#4#5{ 0\Z 0}%
\def\XINT_trunc_B #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \ifcase\XINT__Sgn #1\Z
\expandafter\XINT_trunc_D
\or
\expandafter\XINT_trunc_D
@@ -833,16 +893,16 @@
\def\XINT_trunc_E #1#2\Z #3#4\Z
{%
\xint_UDsignsfork
- #1#3\dummy \XINT_trunc_minusminus
- #1-\dummy {\XINT_trunc_minusplus #3}%
- #3-\dummy {\XINT_trunc_plusminus #1}%
- --\dummy {\XINT_trunc_plusplus #3#1}%
+ #1#3\XINT_trunc_minusminus
+ #1-{\XINT_trunc_minusplus #3}%
+ #3-{\XINT_trunc_plusminus #1}%
+ --{\XINT_trunc_plusplus #3#1}%
\krof
{#4}{#2}%
}%
\def\XINT_trunc_minusminus #1#2{\xintiiquo {#1}{#2}\Z \space}%
-\def\XINT_trunc_minusplus #1#2#3{\xintiiquo {#1#2}{#3}\Z \xint_minus_andstop}%
-\def\XINT_trunc_plusminus #1#2#3{\xintiiquo {#2}{#1#3}\Z \xint_minus_andstop}%
+\def\XINT_trunc_minusplus #1#2#3{\xintiiquo {#1#2}{#3}\Z \xint_minus_afterstop}%
+\def\XINT_trunc_plusminus #1#2#3{\xintiiquo {#2}{#1#3}\Z \xint_minus_afterstop}%
\def\XINT_trunc_plusplus #1#2#3#4{\xintiiquo {#1#3}{#2#4}\Z \space}%
\def\XINT_itrunc_G #1#2\Z #3#4%
{%
@@ -944,12 +1004,11 @@
\def\XINT_round:_a {\XINT_round:_b {}}%
\def\XINT_round:_b #1#2,%
{\expandafter\XINT_round:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_round:_c #1{\if #1,\expandafter\XINT_round:_f
+\def\XINT_round:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_round:_d\fi #1}%
\def\XINT_round:_d #1,%
{\expandafter\XINT_round:_e\romannumeral0\xintiround 0{#1},}%
\def\XINT_round:_e #1,#2{\XINT_round:_b {#2,#1}}%
-\def\XINT_round:_f ,#1#2^{\xint_gobble_i #1}%
\mathchardef\XINTdigits 16
\def\xintDigits #1#2%
{\afterassignment \xint_gobble_i \mathchardef\XINTdigits=}%
@@ -980,13 +1039,13 @@
\def\XINT_float_fork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_float_zero
- 0#1\dummy \XINT_float_J
- 0-\dummy {\XINT_float_K #1}%
+ #1-\XINT_float_zero
+ 0#1\XINT_float_J
+ 0-{\XINT_float_K #1}%
\krof
}%
\def\XINT_float_zero #1\Z #2#3#4#5{ 0.e0}%
-\def\XINT_float_J {\expandafter\xint_minus_andstop\romannumeral0\XINT_float_K }%
+\def\XINT_float_J {\expandafter\xint_minus_afterstop\romannumeral0\XINT_float_K }%
\def\XINT_float_K #1\Z #2% #1=A, #2=P, #3=n, #4=B
{%
\expandafter\XINT_float_L\expandafter
@@ -1131,12 +1190,11 @@
\def\XINT_float:_a {\XINT_float:_b {}}%
\def\XINT_float:_b #1#2,%
{\expandafter\XINT_float:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_float:_c #1{\if #1,\expandafter\XINT_float:_f
+\def\XINT_float:_c #1{\if #1,\expandafter\XINT_:_f
\else\expandafter\XINT_float:_d\fi #1}%
\def\XINT_float:_d #1,%
{\expandafter\XINT_float:_e\romannumeral0\xintfloat {#1},}%
\def\XINT_float:_e #1,#2{\XINT_float:_b {#2,#1}}%
-\def\XINT_float:_f ,#1#2^{\xint_gobble_i #1}%
\def\XINTinFloat {\romannumeral0\XINT_inFloat }%
\def\XINT_inFloat [#1]#2%
{%
@@ -1151,12 +1209,12 @@
\def\XINT_infloat_fork #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_infloat_zero
- 0#1\dummy \XINT_infloat_J
- 0-\dummy {\XINT_float_K #1}%
+ #1-\XINT_infloat_zero
+ 0#1\XINT_infloat_J
+ 0-{\XINT_float_K #1}%
\krof
}%
-\def\XINT_infloat_zero #1\Z #2#3#4#5{ 0[0]}%
+\def\XINT_infloat_zero #1\Z #2#3#4#5{ 0/1[0]}%
\def\XINT_infloat_J {\expandafter-\romannumeral0\XINT_float_K }%
\def\XINT_infloat_Q #1%
{%
@@ -1309,11 +1367,10 @@
\def\xintSum:csv #1{\expandafter\XINT_sum:_a\romannumeral-`0#1,,^}%
\def\XINT_sum:_a {\XINT_sum:_b {0/1[0]}}%
\def\XINT_sum:_b #1#2,{\expandafter\XINT_sum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_sum:_e
+\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_sum:_d\fi #1}%
\def\XINT_sum:_d #1,#2{\expandafter\XINT_sum:_b\expandafter
{\romannumeral0\xintadd {#2}{#1}}}%
-\def\XINT_sum:_e ,#1#2^{#1}% allows empty list
\def\xintMul {\romannumeral0\xintmul }%
\def\xintmul #1%
{%
@@ -1351,16 +1408,13 @@
\def\XINT_fpow_fork #1#2\Z
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_fpow_zero
- 0#1\dummy \XINT_fpow_neg
- 0-\dummy {\XINT_fpow_pos #1}%
+ #1-\XINT_fpow_zero
+ 0#1\XINT_fpow_neg
+ 0-{\XINT_fpow_pos #1}%
\krof
{#2}%
}%
-\def\XINT_fpow_zero #1#2#3#4%
-{%
- \space 1/1[0]%
-}%
+\def\XINT_fpow_zero #1#2#3#4{ 1/1[0]}%
\def\XINT_fpow_pos #1#2#3#4#5%
{%
\expandafter\XINT_fpow_pos_A\expandafter
@@ -1407,11 +1461,10 @@
\def\xintPrd:csv #1{\expandafter\XINT_prd:_a\romannumeral-`0#1,,^}%
\def\XINT_prd:_a {\XINT_prd:_b {1/1[0]}}%
\def\XINT_prd:_b #1#2,{\expandafter\XINT_prd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_prd:_e
+\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_prd:_d\fi #1}%
\def\XINT_prd:_d #1,#2{\expandafter\XINT_prd:_b\expandafter
{\romannumeral0\xintmul {#2}{#1}}}%
-\def\XINT_prd:_e ,#1#2^{#1}% allows empty list
\def\xintDiv {\romannumeral0\xintdiv }%
\def\xintdiv #1%
{%
@@ -1434,8 +1487,9 @@
\def\XINT_fdiv_C #1#2{\XINT_outfrac {#2}{#1}}%
\def\xintIsOne {\romannumeral0\xintisone }%
\def\xintisone #1{\expandafter\XINT_fracisone
- \romannumeral0\xintrawwithzeros{#1}\Z }%
-\def\XINT_fracisone #1/#2\Z{\xintsgnfork{\XINT_Cmp {#1}{#2}}{0}{1}{0}}%
+ \romannumeral0\xintrawwithzeros{#1}\Z }%
+\def\XINT_fracisone #1/#2\Z
+ {\if0\XINT_Cmp {#1}{#2}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
\def\xintGeq {\romannumeral0\xintgeq }%
\def\xintgeq #1%
{%
@@ -1467,15 +1521,15 @@
}%
\def\XINT_fgeq_D #1#2#3%
{%
- \xintSgnFork
- {\xintiiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+ \expandafter\XINT__SgnFork\romannumeral-`0\expandafter\XINT__Sgn
+ \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
{ 0}{\XINT_fgeq_E #2\Z {#3}{#1}}{ 1}%
}%
\def\XINT_fgeq_E #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_fgeq_Fd
- -\dummy {\XINT_fgeq_Fn #1}%
+ #1\XINT_fgeq_Fd
+ -{\XINT_fgeq_Fn #1}%
\krof
}%
\def\XINT_fgeq_Fd #1\Z #2#3%
@@ -1501,15 +1555,15 @@
\def\XINT_fmax_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fmax_minusminus
- -#5\dummy \XINT_fmax_firstneg
- #1-\dummy \XINT_fmax_secondneg
- --\dummy \XINT_fmax_nonneg_a
+ #1#5\XINT_fmax_minusminus
+ -#5\XINT_fmax_firstneg
+ #1-\XINT_fmax_secondneg
+ --\XINT_fmax_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
\def\XINT_fmax_minusminus --%
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmin_nonneg_b }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_fmin_nonneg_b }%
\def\XINT_fmax_firstneg #1-#2#3{ #1#2}%
\def\XINT_fmax_secondneg -#1#2#3{ #1#3}%
\def\XINT_fmax_nonneg_a #1#2#3#4%
@@ -1518,9 +1572,9 @@
}%
\def\XINT_fmax_nonneg_b #1#2%
{%
- \ifcase\romannumeral0\XINT_fgeq_A #1#2
- \xint_afterfi{ #1}%
- \or \xint_afterfi{ #2}%
+ \if0\romannumeral0\XINT_fgeq_A #1#2%
+ \xint_afterfi{ #1}%
+ \else \xint_afterfi{ #2}%
\fi
}%
\def\xintMaxof {\romannumeral0\xintmaxof }%
@@ -1535,10 +1589,9 @@
\def\XINT_maxof_e #1\Z #2\Z { #2}%
\def\xintMaxof:csv #1{\expandafter\XINT_maxof:_b\romannumeral-`0#1,,}%
\def\XINT_maxof:_b #1,#2,{\expandafter\XINT_maxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_maxof:_e
+\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_maxof:_d\fi #1}%
\def\XINT_maxof:_d #1,{\expandafter\XINT_maxof:_b\romannumeral0\xintmax {#1}}%
-\def\XINT_maxof:_e ,#1,{#1}%
\def\XINTinFloatMaxof {\romannumeral0\XINTinfloatmaxof }%
\def\XINTinfloatmaxof #1{\expandafter\XINT_flmaxof_a\romannumeral-`0#1\relax }%
\def\XINT_flmaxof_a #1{\expandafter\XINT_flmaxof_b
@@ -1556,12 +1609,11 @@
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flmaxof:_b #1,#2,%
{\expandafter\XINT_flmaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_flmaxof:_e
+\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_flmaxof:_d\fi #1}%
\def\XINT_flmaxof:_d #1,%
{\expandafter\XINT_flmaxof:_b\romannumeral0\xintmax
{\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINT_flmaxof:_e ,#1,{#1}%
\def\xintMin {\romannumeral0\xintmin }%
\def\xintmin #1%
{%
@@ -1574,15 +1626,15 @@
\def\XINT_fmin_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fmin_minusminus
- -#5\dummy \XINT_fmin_firstneg
- #1-\dummy \XINT_fmin_secondneg
- --\dummy \XINT_fmin_nonneg_a
+ #1#5\XINT_fmin_minusminus
+ -#5\XINT_fmin_firstneg
+ #1-\XINT_fmin_secondneg
+ --\XINT_fmin_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
\def\XINT_fmin_minusminus --%
- {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmax_nonneg_b }%
+ {\expandafter\xint_minus_afterstop\romannumeral0\XINT_fmax_nonneg_b }%
\def\XINT_fmin_firstneg #1-#2#3{ -#3}%
\def\XINT_fmin_secondneg -#1#2#3{ -#2}%
\def\XINT_fmin_nonneg_a #1#2#3#4%
@@ -1591,9 +1643,9 @@
}%
\def\XINT_fmin_nonneg_b #1#2%
{%
- \ifcase\romannumeral0\XINT_fgeq_A #1#2
- \xint_afterfi{ #2}%
- \or \xint_afterfi{ #1}%
+ \if0\romannumeral0\XINT_fgeq_A #1#2%
+ \xint_afterfi{ #2}%
+ \else \xint_afterfi{ #1}%
\fi
}%
\def\xintMinof {\romannumeral0\xintminof }%
@@ -1608,10 +1660,9 @@
\def\XINT_minof_e #1\Z #2\Z { #2}%
\def\xintMinof:csv #1{\expandafter\XINT_minof:_b\romannumeral-`0#1,,}%
\def\XINT_minof:_b #1,#2,{\expandafter\XINT_minof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_minof:_e
+\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_minof:_d\fi #1}%
\def\XINT_minof:_d #1,{\expandafter\XINT_minof:_b\romannumeral0\xintmin {#1}}%
-\def\XINT_minof:_e ,#1,{#1}%
\def\XINTinFloatMinof {\romannumeral0\XINTinfloatminof }%
\def\XINTinfloatminof #1{\expandafter\XINT_flminof_a\romannumeral-`0#1\relax }%
\def\XINT_flminof_a #1{\expandafter\XINT_flminof_b
@@ -1629,12 +1680,11 @@
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flminof:_b #1,#2,%
{\expandafter\XINT_flminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_flminof:_e
+\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_flminof:_d\fi #1}%
\def\XINT_flminof:_d #1,%
{\expandafter\XINT_flminof:_b\romannumeral0\xintmin
{\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINT_flminof:_e ,#1,{#1}%
\def\xintCmp {\romannumeral0\xintcmp }%
\def\xintcmp #1%
{%
@@ -1647,10 +1697,10 @@
\def\XINT_fcmp_A #1#2/#3[#4]#5#6/#7[#8]%
{%
\xint_UDsignsfork
- #1#5\dummy \XINT_fcmp_minusminus
- -#5\dummy \XINT_fcmp_firstneg
- #1-\dummy \XINT_fcmp_secondneg
- --\dummy \XINT_fcmp_nonneg_a
+ #1#5\XINT_fcmp_minusminus
+ -#5\XINT_fcmp_firstneg
+ #1-\XINT_fcmp_secondneg
+ --\XINT_fcmp_nonneg_a
\krof
#1#5{#2/#3[#4]}{#6/#7[#8]}%
}%
@@ -1660,10 +1710,10 @@
\def\XINT_fcmp_nonneg_a #1#2%
{%
\xint_UDzerosfork
- #1#2\dummy \XINT_fcmp_zerozero
- 0#2\dummy \XINT_fcmp_firstzero
- #10\dummy \XINT_fcmp_secondzero
- 00\dummy \XINT_fcmp_pos
+ #1#2\XINT_fcmp_zerozero
+ 0#2\XINT_fcmp_firstzero
+ #10\XINT_fcmp_secondzero
+ 00\XINT_fcmp_pos
\krof
#1#2%
}%
@@ -1688,15 +1738,15 @@
}%
\def\XINT_fcmp_D #1#2#3%
{%
- \xintSgnFork
- {\xintiiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+ \expandafter\XINT__SgnFork\romannumeral-`0\expandafter\XINT__Sgn
+ \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
{ -1}{\XINT_fcmp_E #2\Z {#3}{#1}}{ 1}%
}%
\def\XINT_fcmp_E #1%
{%
\xint_UDsignfork
- #1\dummy \XINT_fcmp_Fd
- -\dummy {\XINT_fcmp_Fn #1}%
+ #1\XINT_fcmp_Fd
+ -{\XINT_fcmp_Fn #1}%
\krof
}%
\def\XINT_fcmp_Fd #1\Z #2#3%
@@ -1710,34 +1760,12 @@
\expandafter\XINT_cmp_pre\expandafter
{\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}%
}%
-\def\xintAbs {\romannumeral0\xintabs }%
-\def\xintabs #1%
-{%
- \expandafter\xint_fabs\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fabs #1#2%
-{%
- \expandafter\XINT_outfrac\expandafter
- {\the\numexpr #1\expandafter}\expandafter
- {\romannumeral0\XINT_abs #2}%
-}%
-\def\xintOpp {\romannumeral0\xintopp }%
-\def\xintopp #1%
-{%
- \expandafter\xint_fopp\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fopp #1#2%
-{%
- \expandafter\XINT_outfrac\expandafter
- {\the\numexpr #1\expandafter}\expandafter
- {\romannumeral0\XINT_opp #2}%
-}%
-\def\xintSgn {\romannumeral0\xintsgn }%
-\def\xintsgn #1%
-{%
- \expandafter\xint_fsgn\romannumeral0\XINT_infrac {#1}%
-}%
-\def\xint_fsgn #1#2#3{\xintiisgn {#2}}%
+\def\xintAbs {\romannumeral0\xintabs }%
+\def\xintabs #1{\expandafter\XINT_abs\romannumeral0\xintraw {#1}}%
+\def\xintOpp {\romannumeral0\xintopp }%
+\def\xintopp #1{\expandafter\XINT_opp\romannumeral0\xintraw {#1}}%
+\def\xintSgn {\romannumeral0\xintsgn }%
+\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\Z }%
\def\xintFloatAdd {\romannumeral0\xintfloatadd }%
\def\xintfloatadd #1{\XINT_fladd_chkopt \xintfloat #1\Z }%
\def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }%
@@ -1871,14 +1899,13 @@
{\expandafter\XINT_floatsum_b\romannumeral0\XINTinfloatadd {#1}}%
\def\XINT_floatsum_e #1\Z #2\Z { #2}%
\def\XINTinFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0[0]}}% was 0/1[0] prior to 1.09h
+\def\XINT_floatsum:_a {\XINT_floatsum:_b {0/1[0]}}%
\def\XINT_floatsum:_b #1#2,%
{\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_floatsum:_e
+\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_floatsum:_d\fi #1}%
\def\XINT_floatsum:_d #1,#2{\expandafter\XINT_floatsum:_b\expandafter
{\romannumeral0\XINTinfloatadd {#2}{#1}}}%
-\def\XINT_floatsum:_e ,#1#2^{#1}% allows empty list
\def\XINTinFloatPrd {\romannumeral0\XINTinfloatprd }%
\def\XINTinfloatprd #1{\expandafter\XINT_floatprd_a\romannumeral-`0#1\relax }%
\def\XINT_floatprd_a #1{\expandafter\XINT_floatprd_b
@@ -1891,14 +1918,13 @@
{\expandafter\XINT_floatprd_b\romannumeral0\XINTinfloatmul {#1}}%
\def\XINT_floatprd_e #1\Z #2\Z { #2}%
\def\XINTinFloatPred:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1[0]}}% was 1/1[0] prior to 1.09h
+\def\XINT_floatprd:_a {\XINT_floatprd:_b {1/1[0]}}%
\def\XINT_floatprd:_b #1#2,%
{\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_floatprd:_e
+\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_:_e
\else\expandafter\XINT_floatprd:_d\fi #1}%
\def\XINT_floatprd:_d #1,#2{\expandafter\XINT_floatprd:_b\expandafter
{\romannumeral0\XINTinfloatmul {#2}{#1}}}%
-\def\XINT_floatprd:_e ,#1#2^{#1}% allows empty list
\def\xintFloatPow {\romannumeral0\xintfloatpow}%
\def\xintfloatpow #1{\XINT_flpow_chkopt \xintfloat #1\Z }%
\def\XINTinFloatPow {\romannumeral0\XINTinfloatpow }%
@@ -1926,9 +1952,9 @@
\def\XINT_flpow_checkB_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpow_BisZero
- 0#1\dummy {\XINT_flpow_checkB_b 1}%
- 0-\dummy {\XINT_flpow_checkB_b 0#1}%
+ #1-\XINT_flpow_BisZero
+ 0#1{\XINT_flpow_checkB_b 1}%
+ 0-{\XINT_flpow_checkB_b 0#1}%
\krof
}%
\def\XINT_flpow_BisZero \Z #1#2#3{#3{1/1[0]}}%
@@ -1951,9 +1977,9 @@
\def\XINT_flpow_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpow_zero
- 0#1\dummy {\XINT_flpow_b 1}%
- 0-\dummy {\XINT_flpow_b 0#1}%
+ #1-\XINT_flpow_zero
+ 0#1{\XINT_flpow_b 1}%
+ 0-{\XINT_flpow_b 0#1}%
\krof
}%
\def\XINT_flpow_zero [#1]#2#3#4#5%
@@ -2027,15 +2053,15 @@
\expandafter\XINT_flpow_conclude_really\expandafter
{\the\numexpr\if #41 -\fi#3\expandafter}%
\xint_UDzerofork
- #4\dummy {{#2}}%
- 0\dummy {{1/#2}}%
+ #4{{#2}}%
+ 0{{1/#2}}%
\krof #1%
}%
\def\XINT_flpow_conclude_really #1#2#3#4%
{%
\xint_UDzerofork
- #3\dummy {#4{#2[#1]}}%
- 0\dummy {#4{-#2[#1]}}%
+ #3{#4{#2[#1]}}%
+ 0{#4{-#2[#1]}}%
\krof
}%
\def\xintFloatPower {\romannumeral0\xintfloatpower}%
@@ -2065,9 +2091,9 @@
\def\XINT_flpower_checkB_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpower_BisZero
- 0#1\dummy {\XINT_flpower_checkB_b 1}%
- 0-\dummy {\XINT_flpower_checkB_b 0#1}%
+ #1-\XINT_flpower_BisZero
+ 0#1{\XINT_flpower_checkB_b 1}%
+ 0-{\XINT_flpower_checkB_b 0#1}%
\krof
}%
\def\XINT_flpower_BisZero \Z #1#2#3{#3{1/1[0]}}%
@@ -2090,9 +2116,9 @@
\def\XINT_flpower_a #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_flpower_zero
- 0#1\dummy {\XINT_flpower_b 1}%
- 0-\dummy {\XINT_flpower_b 0#1}%
+ #1-\XINT_flpower_zero
+ 0#1{\XINT_flpower_b 1}%
+ 0-{\XINT_flpower_b 0#1}%
\krof
}%
\def\XINT_flpower_zero [#1]#2#3#4#5%
@@ -2115,11 +2141,12 @@
}%
\def\XINT_flpower_loop #1#2#3%
{%
- \ifcase\XINT_isOne {#2}
- \xint_afterfi{\expandafter\XINT_flpower_loop_x\expandafter
+ \if0\XINT_isOne {#2}\xint_afterfi
+ {\expandafter\XINT_flpower_loop_x\expandafter
{\romannumeral0\XINTinfloatmul [#1]{#3}{#3}}%
- {\romannumeral0\xintdivision {#2}{2}}}%
- \or \expandafter\XINT_flpow_loop_end
+ {\romannumeral0\xintdivision {#2}{2}}%
+ }%
+ \else\expandafter\XINT_flpow_loop_end
\fi
{#1}{{#3}}%
}%
@@ -2171,13 +2198,13 @@
\def\XINT_FL_sqrt_checkifzeroorneg #1%
{%
\xint_UDzerominusfork
- #1-\dummy \XINT_FL_sqrt_iszero
- 0#1\dummy \XINT_FL_sqrt_isneg
- 0-\dummy {\XINT_FL_sqrt_b #1}%
+ #1-\XINT_FL_sqrt_iszero
+ 0#1\XINT_FL_sqrt_isneg
+ 0-{\XINT_FL_sqrt_b #1}%
\krof
}%
-\def\XINT_FL_sqrt_iszero #1[#2]{0[0]}%
-\def\XINT_FL_sqrt_isneg #1[#2]{\xintError:RootOfNegative 0[0]}%
+\def\XINT_FL_sqrt_iszero #1[#2]{0/1[0]}%
+\def\XINT_FL_sqrt_isneg #1[#2]{\xintError:RootOfNegative 0/1[0]}%
\def\XINT_FL_sqrt_b #1[#2]%
{%
\ifodd #2
@@ -2290,9 +2317,9 @@
}%
\def\XINT_flsqrt_big_j #1%
{%
- \ifcase\XINT_Sgn {#1}
+ \if0\XINT_Sgn #1\Z
\expandafter \XINT_flsqrt_big_end_a
- \or \expandafter \XINT_flsqrt_big_k
+ \else \expandafter \XINT_flsqrt_big_k
\fi {#1}%
}%
\def\XINT_flsqrt_big_k #1#2#3%
diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
index 6dc7319aea5..e4db522a478 100644
--- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintgcd: Euclidean algorithm with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,7 +103,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2013/11/28 v1.09h Euclide algorithm with xint package (jfB)]%
+ [2013/12/18 v1.09i Euclide algorithm with xint package (jfB)]%
\def\xintGCD {\romannumeral0\xintgcd }%
\def\xintgcd #1%
{%
@@ -116,9 +116,9 @@
\def\XINT_gcd_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_gcd_BisZero
- #3\dummy \XINT_gcd_AisZero
- 0\dummy \XINT_gcd_loop
+ #1\XINT_gcd_BisZero
+ #3\XINT_gcd_AisZero
+ 0\XINT_gcd_loop
\krof
{#1#2}{#3#4}%
}%
@@ -146,10 +146,9 @@
\def\XINT_gcdof_e #1\Z #2\Z { #2}%
\def\xintGCDof:csv #1{\expandafter\XINT_gcdof:_b\romannumeral-`0#1,,}%
\def\XINT_gcdof:_b #1,#2,{\expandafter\XINT_gcdof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_gcdof:_e
+\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_of:_e
\else\expandafter\XINT_gcdof:_d\fi #1}%
\def\XINT_gcdof:_d #1,{\expandafter\XINT_gcdof:_b\romannumeral0\xintgcd {#1}}%
-\def\XINT_gcdof:_e ,#1,{#1}%
\def\xintLCM {\romannumeral0\xintlcm}%
\def\xintlcm #1%
{%
@@ -162,9 +161,9 @@
\def\XINT_lcm_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_lcm_BisZero
- #3\dummy \XINT_lcm_AisZero
- 0\dummy \expandafter
+ #1\XINT_lcm_BisZero
+ #3\XINT_lcm_AisZero
+ 0\expandafter
\krof
\XINT_lcm_notzero\expandafter{\romannumeral0\XINT_gcd_loop {#1#2}{#3#4}}%
{#1#2}{#3#4}%
@@ -181,10 +180,9 @@
\def\XINT_lcmof_e #1\Z #2\Z { #2}%
\def\xintLCMof:csv #1{\expandafter\XINT_lcmof:_a\romannumeral-`0#1,,}%
\def\XINT_lcmof:_a #1,#2,{\expandafter\XINT_lcmof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_lcmof:_e
+\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_of:_e
\else\expandafter\XINT_lcmof:_d\fi #1}%
\def\XINT_lcmof:_d #1,{\expandafter\XINT_lcmof:_a\romannumeral0\xintlcm {#1}}%
-\def\XINT_lcmof:_e ,#1,{#1}%
\def\xintBezout {\romannumeral0\xintbezout }%
\def\xintbezout #1%
{%
@@ -197,36 +195,35 @@
\def\XINT_bezout_fork #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #1#3\dummy \XINT_bezout_botharezero
- #10\dummy \XINT_bezout_secondiszero
- #30\dummy \XINT_bezout_firstiszero
- 00\dummy
- {\xint_UDsignsfork
- #1#3\dummy \XINT_bezout_minusminus % A < 0, B < 0
- #1-\dummy \XINT_bezout_minusplus % A > 0, B < 0
- #3-\dummy \XINT_bezout_plusminus % A < 0, B > 0
- --\dummy \XINT_bezout_plusplus % A > 0, B > 0
+ #1#3\XINT_bezout_botharezero
+ #10\XINT_bezout_secondiszero
+ #30\XINT_bezout_firstiszero
+ 00{\xint_UDsignsfork
+ #1#3\XINT_bezout_minusminus % A < 0, B < 0
+ #1-\XINT_bezout_minusplus % A > 0, B < 0
+ #3-\XINT_bezout_plusminus % A < 0, B > 0
+ --\XINT_bezout_plusplus % A > 0, B > 0
\krof }%
\krof
{#2}{#4}#1#3{#3#4}{#1#2}% #1#2=B, #3#4=A
}%
-\def\XINT_bezout_botharezero #1#2#3#4#5#6%
+\edef\XINT_bezout_botharezero #1#2#3#4#5#6%
{%
- \xintError:NoBezoutForZeros
+ \noexpand\xintError:NoBezoutForZeros
\space {0}{0}{0}{0}{0}%
}%
\def\XINT_bezout_firstiszero #1#2#3#4#5#6%
{%
\xint_UDsignfork
- #3\dummy { {0}{#3#1}{0}{1}{#1}}%
- -\dummy { {0}{#3#1}{0}{-1}{#1}}%
+ #3{ {0}{#3#1}{0}{1}{#1}}%
+ -{ {0}{#3#1}{0}{-1}{#1}}%
\krof
}%
\def\XINT_bezout_secondiszero #1#2#3#4#5#6%
{%
\xint_UDsignfork
- #4\dummy{ {#4#2}{0}{-1}{0}{#2}}%
- -\dummy{ {#4#2}{0}{1}{0}{#2}}%
+ #4{ {#4#2}{0}{-1}{0}{#2}}%
+ -{ {#4#2}{0}{1}{0}{#2}}%
\krof
}%
\def\XINT_bezout_minusminus #1#2#3#4%
@@ -243,7 +240,7 @@
{%
\expandafter\XINT_bezout_mm_postc\expandafter {#2}{#1}%
}%
-\def\XINT_bezout_mm_postc #1#2#3#4#5%
+\edef\XINT_bezout_mm_postc #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -257,7 +254,7 @@
\expandafter\XINT_bezout_mp_postb\expandafter
{\romannumeral0\xintiiopp {#2}}{#1}%
}%
-\def\XINT_bezout_mp_postb #1#2#3#4#5%
+\edef\XINT_bezout_mp_postb #1#2#3#4#5%
{%
\space {#4}{#5}{#2}{#1}{#3}%
}%
@@ -271,7 +268,7 @@
\expandafter \XINT_bezout_pm_postb \expandafter
{\romannumeral0\xintiiopp{#1}}%
}%
-\def\XINT_bezout_pm_postb #1#2#3#4#5%
+\edef\XINT_bezout_pm_postb #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -280,7 +277,7 @@
\expandafter\XINT_bezout_pp_post
\romannumeral0\XINT_bezout_loop_a 1{#3#1}{#4#2}1001%
}%
-\def\XINT_bezout_pp_post #1#2#3#4#5%
+\edef\XINT_bezout_pp_post #1#2#3#4#5%
{%
\space {#4}{#5}{#1}{#2}{#3}%
}%
@@ -322,11 +319,11 @@
\else\expandafter\XINT_bezout_exitodd
\fi
}%
-\def\XINT_bezout_exiteven #1#2#3#4#5%
+\edef\XINT_bezout_exiteven #1#2#3#4#5%
{%
\space {#5}{#4}{#1}%
}%
-\def\XINT_bezout_exitodd #1#2#3#4#5%
+\edef\XINT_bezout_exitodd #1#2#3#4#5%
{%
\space {-#5}{-#4}{#1}%
}%
@@ -342,9 +339,9 @@
\def\XINT_euc_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_euc_BisZero
- #3\dummy \XINT_euc_AisZero
- 0\dummy \XINT_euc_a
+ #1\XINT_euc_BisZero
+ #3\XINT_euc_AisZero
+ 0\XINT_euc_a
\krof
{0}{#1#2}{#3#4}{{#3#4}{#1#2}}{}\Z
}%
@@ -374,7 +371,7 @@
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\xint_euc_end_ #1#2#3%
+\edef\xint_euc_end_ #1#2#3%
{%
\space {#1}{#3}{#2}%
}%
@@ -390,9 +387,9 @@
\def\XINT_bezalg_fork #1#2\Z #3#4\Z
{%
\xint_UDzerofork
- #1\dummy \XINT_bezalg_BisZero
- #3\dummy \XINT_bezalg_AisZero
- 0\dummy \XINT_bezalg_a
+ #1\XINT_bezalg_BisZero
+ #3\XINT_bezalg_AisZero
+ 0\XINT_bezalg_a
\krof
0{#1#2}{#3#4}1001{{#3#4}{#1#2}}{}\Z
}%
@@ -433,7 +430,7 @@
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\xint_bezalg_end_ #1#2#3#4%
+\edef\xint_bezalg_end_ #1#2#3#4%
{%
\space {#1}{#3}{0}{1}{#2}{#4}{1}{0}%
}%
diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty
index ce13095a7ae..c38cdaaeb03 100644
--- a/Master/texmf-dist/tex/generic/xint/xintseries.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xintseries: Expandable partial sums with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -103,7 +103,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2013/11/28 v1.09h Expandable partial sums with xint package (jfB)]%
+ [2013/12/18 v1.09i Expandable partial sums with xint package (jfB)]%
\def\xintSeries {\romannumeral0\xintseries }%
\def\xintseries #1#2%
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty
index 9b0414b32fa..945f73bf1b5 100644
--- a/Master/texmf-dist/tex/generic/xint/xinttools.sty
+++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09h of November 28, 2013)
+%% The xint bundle (version 1.09i of December 18, 2013)
%% xinttools: Expandable and non-expandable utilities
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -120,7 +120,7 @@
\catcode40=12 % (
\catcode41=12 % )
\catcode47=12 % /
- \catcode96=12 % `
+ \catcode96=12 % ` (for ubiquitous \romannumeral-`0 and some \catcode )
\catcode94=11 % ^
\catcode36=3 % $
\catcode91=12 % [
@@ -150,7 +150,7 @@
\fi
\XINT_providespackage
\ProvidesPackage {xinttools}%
- [2013/11/28 v1.09h Expandable and non-expandable utilities (jfB)]%
+ [2013/12/18 v1.09i Expandable and non-expandable utilities (jfB)]%
\long\def\xint_gobble_ {}%
\long\def\xint_gobble_i #1{}%
\long\def\xint_gobble_ii #1#2{}%
@@ -164,9 +164,9 @@
\xint_firstofone{\let\XINT_sptoken= } %<- space here!
\long\def\xint_firstoftwo #1#2{#1}%
\long\def\xint_secondoftwo #1#2{#2}%
-\long\def\xint_firstoftwo_andstop #1#2{ #1}%
-\long\def\xint_secondoftwo_andstop #1#2{ #2}%
-\def\xint_minus_andstop { -}%
+\long\def\xint_firstoftwo_afterstop #1#2{ #1}%
+\long\def\xint_secondoftwo_afterstop #1#2{ #2}%
+\def\xint_minus_afterstop { -}%
\long\def\xint_gob_til_R #1\R {}%
\long\def\xint_gob_til_W #1\W {}%
\long\def\xint_gob_til_Z #1\Z {}%
@@ -178,6 +178,18 @@
\chardef\xint_c_ 0
\chardef\xint_c_viii 8
\newtoks\XINT_toks
+\def\XINT_odef #1{\expandafter\def\expandafter#1\expandafter }%
+\ifdefined\odef\else\let\odef\XINT_odef\fi
+\def\XINT_godef {\global\XINT_odef }%
+\def\XINT_oodef #1{\expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter }%
+\ifdefined\oodef\else\let\oodef\XINT_oodef\fi
+\def\XINT_goodef {\global\XINT_oodef }%
+\def\XINT_fdef #1#2{\expandafter\def\expandafter#1\expandafter
+ {\romannumeral-`0#2}}%
+\ifdefined\fdef\else\let\fdef\XINT_fdef\fi
+\def\XINT_gfdef {\global\XINT_fdef }%
\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
\long\def\xintreverseorder #1%
{%
@@ -192,9 +204,9 @@
\xint_bye #9\XINT_rord_cleanup\xint_bye
\XINT_rord_main {#9#8#7#6#5#4#3#2#1}%
}%
-\long\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
{%
- \expandafter\space\xint_gob_til_xint_relax #1%
+ \noexpand\expandafter\space\noexpand\xint_gob_til_xint_relax #1%
}%
\def\xintRevWithBraces {\romannumeral0\xintrevwithbraces }%
\def\xintRevWithBracesNoExpand {\romannumeral0\xintrevwithbracesnoexpand }%
@@ -266,7 +278,8 @@
#7\XINT_length_finish_c 2%
\W\XINT_length_finish_c 1\Z
}%
-\def\XINT_length_finish_c #1#2\Z #3{\expandafter\space\the\numexpr #3-#1\relax}%
+\edef\XINT_length_finish_c #1#2\Z #3%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #3-#1\relax}%
\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }%
\long\edef\xintzapfirstspaces #1%
{\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }%
@@ -452,9 +465,9 @@
\expandafter\expandafter\expandafter\XINT_nthelt_finish
\csname xint_gobble_\romannumeral\numexpr#1-1\endcsname
}%
-\long\def\XINT_nthelt_finish #1#2\xint_bye
- {\xint_gob_til_xint_relax #1\expandafter\space
- \xint_gobble_iii\xint_relax\space #1}%
+\long\edef\XINT_nthelt_finish #1#2\xint_bye
+ {\noexpand\xint_gob_til_xint_relax #1\noexpand\expandafter\space
+ \noexpand\xint_gobble_iii\xint_relax\space #1}%
\def\xintApply {\romannumeral0\xintapply }%
\def\xintApplyNoExpand {\romannumeral0\xintapplynoexpand }%
\long\def\xintapply #1#2%
@@ -509,7 +522,7 @@
\def\XINT_seq #1#2%
{%
\ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
- \expandafter\xint_firstoftwo_andstop
+ \expandafter\xint_firstoftwo_afterstop
\or
\expandafter\XINT_seq_p
\else
@@ -935,27 +948,41 @@
}%
\catcode`Z 11
\catcode`j 11
-\long\def\xintAssign #1\to
+\def\xintAssign{\def\XINT_flet_macro {\XINT_assign_fork}\XINT_flet_zapsp }%
+\def\XINT_assign_fork
{%
- \expandafter\XINT_assign_a\romannumeral-`0#1{}\to
+ \let\XINT_assign_def\edef
+ \ifx\XINT_token[\expandafter\XINT_assign_opt
+ \else\expandafter\XINT_assign_a
+ \fi
+}%
+\def\XINT_assign_opt [#1]%
+{%
+ \expandafter\let\expandafter\XINT_assign_def \csname XINT_#1def\endcsname
+ \XINT_assign_a
+}%
+\long\def\XINT_assign_a #1\to
+{%
+ \expandafter\XINT_assign_b\romannumeral-`0#1{}\to
}%
-\long\def\XINT_assign_a #1% attention to the # at the beginning of next line
+\long\def\XINT_assign_b #1% attention to the # at the beginning of next line
#{%
\def\xint_temp {#1}%
\ifx\empty\xint_temp
- \expandafter\XINT_assign_b
+ \expandafter\XINT_assign_c
\else
- \expandafter\XINT_assign_B
+ \expandafter\XINT_assign_d
\fi
}%
-\long\def\XINT_assign_b #1#2\to #3%
+\long\def\XINT_assign_c #1#2\to #3%
{%
- \edef #3{#1}\def\xint_temp {#2}%
- \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_a #2\to }\fi
+ \XINT_assign_def #3{#1}%
+ \def\xint_temp {#2}%
+ \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_b #2\to }\fi
}%
-\def\XINT_assign_B #1\to #2%
+\def\XINT_assign_d #1\to #2% normally #1 is {} here.
{%
- \edef #2{\xint_temp}%
+ \expandafter\XINT_assign_def\expandafter #2\expandafter{\xint_temp}%
}%
\def\xintRelaxArray #1%
{%
@@ -971,7 +998,22 @@
\global\expandafter\let\csname\xint_arrayname 00\endcsname\relax
\global\let #1\relax
}%
-\long\def\xintAssignArray #1\to #2%
+\def\xintAssignArray{\def\XINT_flet_macro {\XINT_assignarray_fork}%
+ \XINT_flet_zapsp }%
+\def\XINT_assignarray_fork
+{%
+ \let\XINT_assignarray_def\edef
+ \ifx\XINT_token[\expandafter\XINT_assignarray_opt
+ \else\expandafter\XINT_assignarray
+ \fi
+}%
+\def\XINT_assignarray_opt [#1]%
+{%
+ \expandafter\let\expandafter\XINT_assignarray_def
+ \csname XINT_#1def\endcsname
+ \XINT_assignarray
+}%
+\long\def\XINT_assignarray #1\to #2%
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }%
\escapechar -1
@@ -993,8 +1035,9 @@
\else
\expandafter\def\expandafter\xint_itemcount\expandafter
{\the\numexpr\xint_itemcount+\xint_c_i}%
- \expandafter\edef
- \csname\xint_arrayname\xint_itemcount\endcsname {\xint_temp }%
+ \expandafter\XINT_assignarray_def
+ \csname\xint_arrayname\xint_itemcount\expandafter\endcsname
+ \expandafter{\xint_temp }%
\expandafter\XINT_assignarray_loop
\fi
}%
@@ -1019,6 +1062,7 @@
}%
}%
\let\xintDigitsOf\xintAssignArray
+\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
\endinput
%%