summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-28 23:21:36 +0000
committerKarl Berry <karl@freefriends.org>2013-11-28 23:21:36 +0000
commit6107abc859b998f72e77750454e95a1c076d22b7 (patch)
tree67151befe44cbd2232f894ef49ddf5d526fb06b0 /Master
parent868273a311e482b0f2d4f227e52b51841c08253f (diff)
xint (28nov13)
git-svn-id: svn://tug.org/texlive/trunk@32271 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/generic/xint/README67
-rw-r--r--Master/texmf-dist/doc/generic/xint/xint.pdfbin1034453 -> 1043913 bytes
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.dtx5133
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.ins2
-rw-r--r--Master/texmf-dist/tex/generic/xint/xint.sty44
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintbinhex.sty4
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcfrac.sty4
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty29
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty42
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintgcd.sty63
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintseries.sty4
-rw-r--r--Master/texmf-dist/tex/generic/xint/xinttools.sty300
12 files changed, 2907 insertions, 2785 deletions
diff --git a/Master/texmf-dist/doc/generic/xint/README b/Master/texmf-dist/doc/generic/xint/README
index 22cd79a8f0f..b76c1aae889 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.09g (2013/11/22).
+Release 1.09h (2013/11/28).
author: Jean-Francois Burnol
License: LPPL 1.3c or later.
@@ -57,32 +57,30 @@ xintcfrac deals with the computation of continued fractions.
Most macros, and all of those doing computations, work purely by
expansion without assignments, and may thus be used almost everywhere
-in TEX. The packages may be used with any flavor of TEX supporting the
-ε-TEX extensions. LATEX users will use \usepackage and others \input
+in TeX. The packages may be used with any flavor of TeX supporting the
+e-TeX extensions. LaTeX users will use \usepackage and others \input
to load the package components.
Installation and Usage:
=======================
-If xint.ins is available "tex xint.ins".
+If xint.ins is available "tex xint.ins" generates the style files
+(pre-existing files in the same repertory will be overwritten).
-Else "tex xint.dtx" or "latex xint.dtx". This will generate the style
-files and the xint.ins file.
-
-The tex (not latex) run will stop with the complaint that it does not
-understand \NeedsTeXFormat, but the style files will already have been
-extracted by that time.
-
-Files with the same names and in the same repertory will be
-overwritten.
+Else, either "latex xint.dtx" or "pdflatex xint.dtx" or "tex xint.dtx"
+will also generate the style files (and the xint.ins file). The tex
+run stops (contrarily to latex/pdflatex) with the complaint that it
+does not understand \NeedsTeXFormat, but the style files will already
+have been extracted by that time.
To get xint.pdf run pdflatex thrice on xint.dtx
+ xinttools.sty |
xint.sty |
xintfrac.sty |
- xintexpr.sty |
- xintbinhex.sty | --> TDS:tex/generic/xint/
+ xintexpr.sty | --> TDS:tex/generic/xint/
+ xintbinhex.sty |
xintgcd.sty |
xintseries.sty |
xintcfrac.sty |
@@ -92,32 +90,33 @@ To get xint.pdf run pdflatex thrice on xint.dtx
It may be necessary to then refresh the TeX installation filename
database.
-Usage with LaTeX: \usepackage{xint}
- \usepackage{xintfrac} (loads xint)
- \usepackage{xintexpr} (loads xintfrac)
-
- \usepackage{xintbinhex} (loads xint)
- \usepackage{xintgcd} (loads xint)
- \usepackage{xintseries} (loads xintfrac)
- \usepackage{xintcfrac} (loads xintfrac)
+Usage with LaTeX: \usepackage{xinttools}
+ \usepackage{xint} % (loads xinttools)
+ \usepackage{xintfrac} % (loads xint)
+ \usepackage{xintexpr} % (loads xintfrac)
-Usage with TeX: \input xint.sty\relax
- \input xintfrac.sty\relax (loads xint)
- \input xintexpr.sty\relax (loads xintfrac)
+ \usepackage{xintbinhex} % (loads xint)
+ \usepackage{xintgcd} % (loads xint)
+ \usepackage{xintseries} % (loads xintfrac)
+ \usepackage{xintcfrac} % (loads xintfrac)
- \input xintbinhex.sty\relax (loads xint)
- \input xintgcd.sty\relax (loads xint)
- \input xintseries.sty\relax (loads xintfrac)
- \input xintcfrac.sty\relax (loads xintfrac)
+Usage with TeX: \input xinttools.sty\relax
+ \input xint.sty\relax % (loads xinttools)
+ \input xintfrac.sty\relax % (loads xint)
+ \input xintexpr.sty\relax % (loads xintfrac)
+ \input xintbinhex.sty\relax % (loads xint)
+ \input xintgcd.sty\relax % (loads xint)
+ \input xintseries.sty\relax % (loads xintfrac)
+ \input xintcfrac.sty\relax % (loads xintfrac)
License
=======
-This work consists of the source file xint.dtx and of its derived files:
-xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty, xintgcd.sty,
-xintseries.sty, xintcfrac.sty, as well as xint.ins and the documentation
-xint.pdf (or xint.dvi).
+This work consists of the source file xint.dtx and of its derived files
+xinttools.sty, xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty,
+xintgcd.sty, xintseries.sty, xintcfrac.sty, xint.ins, xint.dvi and
+xint.pdf.
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
diff --git a/Master/texmf-dist/doc/generic/xint/xint.pdf b/Master/texmf-dist/doc/generic/xint/xint.pdf
index 57731003289..1fced0d553c 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 65c15c30343..e00b30fb815 100644
--- a/Master/texmf-dist/source/generic/xint/xint.dtx
+++ b/Master/texmf-dist/source/generic/xint/xint.dtx
@@ -1,8 +1,8 @@
% -*- coding: iso-latin-1; -*-
%<*doc>
-\def\lasttimestamp{Time-stamp <23-11-2013 12:26:51 CET *>}
+\def\lasttimestamp{Time-stamp <28-11-2013 17:10:29 CET *>}
%</doc>
-% xint.dtx, 1.09g (2013/11/22)
+% xint.dtx, 1.09h (2013/11/28)
%
% Copyright (C) 2013 by Jean-François Burnol
%
@@ -43,8 +43,9 @@
%
% Run tex or latex on xint.dtx.
%
-% This will extract the style files xint.sty, xintfrac.sty, xintexpr.sty,
-% xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty (and xint.ins).
+% This will extract the style files xinttools.sty, xint.sty, xintfrac.sty,
+% xintexpr.sty, xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty
+% (and xint.ins).
%
% Files with the same names and in the same repertory will be overwritten.
% The tex (not latex) run will stop with the complaint that it does not
@@ -91,7 +92,7 @@
%
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%<xinttools>%% xinttools: Expandable and non-expandable utilities
%<xint>%% xint: Expandable operations on long numbers
%<xintfrac>%% xintfrac: Expandable operations on fractions
@@ -104,8 +105,8 @@
%%----------------------------------------------------------------
%%
%<*doc>
-\def\pkgversion{1.09g}
-\def\pkgdate{2013/11/22}
+\def\pkgversion{1.09h}
+\def\pkgdate{2013/11/28}
\def\striptimestamp #1 <#2 #3 #4 #5>{#2 at #3 #4}
\def\getdocdate #1 <#2-#3-#4 #5>{#4/#3/#2}
\edef\docdate{\expandafter\getdocdate\lasttimestamp}
@@ -197,8 +198,8 @@
\etocsetstyle{section}{}
{}
- {\ifnum\etocthenumber=24 \gdef\sectioncouleur{{joli}}\fi
- \ifnum\etocthenumber=32 \gdef\sectioncouleur{[named]{RoyalPurple}}\fi
+ {\ifnum\etocthenumber=25 \gdef\sectioncouleur{{joli}}\fi
+ \ifnum\etocthenumber=33 \gdef\sectioncouleur{[named]{RoyalPurple}}\fi
\savedsectionline{\numberline{\expandafter\textcolor\sectioncouleur
{\etocnumber}}\etocname}
{{\mdseries\etocpage}}%
@@ -342,6 +343,29 @@ pdfpagemode=UseOutlines}
\hss #1\ $\Bigg\{$\ }}%
\vskip\dp\strutbox }\strut{}}
\def\IMPORTANT {\MyMarginNoteWithBrace {IMPORTANT!}}
+% 26 novembre 2013:
+\def\etype #1{%
+ \vadjust{\vskip-\dp\strutbox
+ \smash{\hbox to 0pt {\hss\color[named]{PineGreen}%
+ \itshape \xintListWithSep{\,}{#1}\ $\star$\quad }}%
+ \vskip\dp\strutbox }\strut{}}
+\def\ntype #1{%
+ \vadjust{\vskip-\dp\strutbox
+ \smash{\hbox to 0pt {\hss\color[named]{PineGreen}%
+ \itshape \xintListWithSep{\,}{#1}\quad }}%
+ \vskip\dp\strutbox }\strut{}}
+\def\Numf {{\vbox{\halign{\hfil##\hfil\cr \footnotesize
+ \upshape Num\cr
+ \noalign{\hrule height 0pt \vskip1pt\relax}
+ \itshape f\cr}}}}
+\def\Ff {{\vbox{\halign{\hfil##\hfil\cr \footnotesize
+ \upshape Frac\cr
+ \noalign{\hrule height 0pt \vskip1pt\relax}
+ \itshape f\cr}}}}
+\def\numx {{\vbox{\halign{\hfil##\hfil\cr \footnotesize
+ \upshape num\cr
+ \noalign{\hrule height 0pt \vskip1pt\relax}
+ \itshape x\cr}}}}
\makeatother
%---- \centeredline: OUR OWN LITTLE MACRO FOR CENTERING LINES
@@ -415,11 +439,9 @@ pdfpagemode=UseOutlines}
\relax \ifmmode\hbox\else\leavevmode\null\fi
\bgroup \MicroFont
\let\do\do@noligs \verbatim@nolig@list
+ \let\do\@makeother \dospecials \catcode32 10
\dobackslash
\dobraces
- \let\do\@makeother \dospecials \catcode32 10
- \catcode92 13
- \catcode123 13 \catcode 125 13
\makestarlowast \@jfverb
}%
%
@@ -549,7 +571,7 @@ pdfpagemode=UseOutlines}
\endgroup
% 22 octobre 2013
-\newcommand\fexpan {\textit{ff}-expan}
+\newcommand\fexpan {\textit{f}-expan}
\begin{document}\thispagestyle{empty}\rmfamily
\pdfbookmark[1]{Title page}{TOP}
@@ -694,7 +716,7 @@ independent interest.
All components may be used as regular packages with \LaTeX{} or loaded directly
via \string\input{} (e.g. |\input xint.sty\relax|) in any other format based on
-\TeX. Each of them automatically loads those not alreadly loaded it depends
+\TeX. Each of them automatically loads those not already loaded it depends
on.
The \eTeX{} extensions must be enabled; this is the case in modern distributions
@@ -764,6 +786,26 @@ Some other computational examples are \hyperref[ssec:Machin]{the
\section{Recent changes}
\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}
@@ -775,6 +817,7 @@ Some other computational examples are \hyperref[ssec:Machin]{the
of |\count 255|.
\end{itemize}
+\clearpage
\noindent Release |1.09f| (|[2013/11/04]|):
\begin{itemize}
\item new \csbxint{ZapFirstSpaces}, \csbxint{ZapLastSpaces},
@@ -801,7 +844,6 @@ Some other computational examples are \hyperref[ssec:Machin]{the
% changing outputs) to some inner macros.
\end{itemize}
-\clearpage
\noindent Release |1.09e| (|[2013/10/29]|):
\begin{itemize}
@@ -915,7 +957,7 @@ version \fexpan ds the un-braced list items. After
\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
- \hyperlink{useofcount}{Use of count registers}.
+ \hyperref[sec:useofcount]{Use of count registers}.
\end{itemize}
\noindent Release |1.08a| (|[2013/06/11]|):
@@ -1087,387 +1129,6 @@ complete expandability.\footnote{I could, naturally, be proven
operations are currently limited to the basic four operations, the power
function with integer exponent, and the extraction of square-roots.
-\section{The \csh{xintexpr} math parser (I)}
-\label{sec:exprsummary}
-
-% 27 octobre 2013 plus de problème avec &... il n'est plus actif (ouf)
-\xintexprSafeCatcodes
-\newcommand\formula[3]{\xinttheexpr round((#1 & (#2 | #3)) * (355/113*#3 -
- (#1 - #2/2)^2), 8)\relax }
-\xintexprRestoreCatcodes
-
-
-Here is some random formula, defining a \LaTeX{} command with three parameters,
-\centeredline{\verb$\newcommand\formula[3]$}
-\centeredline{\verb${\xinttheexpr round((#1 & (#2 | #3)) * (355/113*#3 - (#1 -
- #2/2)^2), 8) \relax}$}
-
-\smallskip
-
-Let |a=#1|, |b=#2|, |c=#3| be the parameters. The first term is the logical
-operation |a and (b or c)| where a number or fraction has truth value @1@ if it
-is non-zero, and @0@ otherwise. So here it means that |a| must be non-zero as
-well as |b| or |c|, for this first operand to be @1@, else the formula returns
-@0@. This multiplies a second term which is algebraic. Finally the result (where
-all intermediate computations are done \emph{exactly}) is rounded to a value
-with @8@ digits after the decimal mark, and printed.
-\centeredline{|\formula
- {771.3/9.1}{1.51e2}{37.73} expands to|
- \digitstt{\formula {771.3/9.1}{1.51e2}{37.73}}}
-
-\begingroup % 9 octobre pour une meilleure gestion de l'indentation
-\leftmargini 0pt
-\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
- \labelwidth\parindent
- \itemindent\labelwidth}%
-\item as everything gets expanded, the characters
- \verb$+,-,*,/,^,!,&,|,?,:,<,>,=,(,)$ and the comma ($,$), which are
- used in the
- |infix| syntax, should not be active (for example if
- they serve as shorthands for some language in the |Babel| system) at the time
- of the expressions (if they are in use therein). The command
- \csbxint{exprSafeCatcodes} resets these characters to their standard catcodes
- and \csbxint{exprRestoreCatcodes} restores the status prevailing at the time
- of the previous \csa{xintexprSafeCatcodes}.
-\item the formula may be input without |\xinttheexpr| through suitable
- nesting of various
- package macros. Here one could use:
- \centeredline
- {|\xintRound {8}{\xintMul {\xintAND {#1}{\xintOR {#2}{#3}}}{\xintSub |}
- \centeredline
- {| {\xintMul {355/113}{#3}}{\xintPow {\xintSub {#1}{\xintDiv {#2}{2}}}{2}}}}|}
- with the inherent difficulty of keeping up with braces and everything...
-\item if such a formula is used thousands of times in a document (for plots?),
- this could impact some parts of the \TeX{} program memory (for technical
- reasons explained in \autoref{sec:expr}). So, a utility \csbxint{NewExpr}
- is provided to do the work of translating an |\xintexpr|-ession with
- parameters into a chain of macro evaluations.\footnote{As its makes some macro
- definitions, it is not an expandable command. It does not need protection
- against active characters as it does it itself.}
- \centeredline{|\xintNewExpr\formula[3]|}
- \centeredline{\verb${ round((#1 & (#2 | #3)) * (355/113*#3 - (#1 - #2/2)^2),
- 8) }$}
- one gets a command |\formula| with three parameters and meaning:
-
-\xintNewExpr\formula[3]
-{ round((#1 & (#2 | #3)) * (355/113*#3 - (#1 - #2/2)^2),
- 8) }
-
-{\centering\ttfamily
-
-\meaning\formula
-
-}
-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 \hyperlink{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 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}
- \def\y {\xintexpr \x * \a \relax}|} where |\x| could have been set
- up equivalently as {|\def\x {( \a + \b )}|} but the earlier method is
- better than with parentheses, as it allows {|\xintthe\x|}.
-\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
- rounding is applied to the final result only.
-\item there is also \csbxint{boolexpr}| ... \relax| and \csbxint{theboolexpr}|
- ... \relax|. Same as regular expression but the final result is converted to
- @1@
- if it is not zero. See also \csbxint{ifboolexpr}
- (\autoref{xintifboolexpr}) and the \hyperlink{item:bool}{discussion}
- of the |bool| and |togl| functions in \autoref{sec:exprsummary}. Here is an
- example of use:
-\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}}
-This was obtained with the following input:
-\begingroup
-\def\MacroFont {\ttfamily\parskip0pt \parindent 15pt \baselineskip 12pt }
-\dverb!@
-\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}!%
-\endgroup
-\item there is also \csbxint{floatexpr}| ... \relax| where the algebra is done
- in
- floating point approximation (also for each intermediate result). Use the
- syntax
- |\xintDigits:=N;| to set the precision. Default: @16@ digits.
- \centeredline{|\xintthefloatexpr 2^100000\relax:| \digitstt{\xintthefloatexpr
- 2^100000\relax }} The square-root operation can be used in |\xintexpr|, it
- is computed as a float with the precision set by |\xintDigits| or by the
- optional second argument: \centeredline{|\xinttheexpr sqrt(2,60)\relax|:}
- \centeredline{\digitstt{\xinttheexpr sqrt(2,60)\relax }} Notice the |a/b[n]|
- notation
- (usually |/b| even if |b=1| gets printed; this is the exception) which is the
- default format of the macros of the \xintfracname
- package (hence of |\xintexpr|). To get a float format from the |\xintexpr| one
- needs something more: \centeredline{|\xintFloat[60]{\xinttheexpr
- sqrt(2,60)\relax}|:} \centeredline{\digitstt{\xintFloat[60]{\xinttheexpr
- sqrt(2,60)\relax }}} The precision used by |\xintfloatexpr| must be set by
- |\xintDigits|, it can not be passed as an option to |\xintfloatexpr|.
- \centeredline{|\xintDigits:=48; \xintthefloatexpr 2^100000\relax|: }
- \centeredline{\begingroup \xintDigits:=48;\digitstt{\xintthefloatexpr
- 2^100000\relax}\endgroup} Floats are quickly indispensable when using the
- power function (which can only have an integer exponent), as exact results
- will easily have hundreds of digits.
-\endlist
-\endgroup
-
-\section{The \csh{xintexpr} math parser (II)}
-\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.
-
-Note that |2^-10| is perfectly accepted input, no need for parentheses. And
-|-2^-10^-5*3| does |(-((2^(-10))^(-5)))*3|.
-
-The characters used in the syntax should not have been made 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
-catcode tabulation, math superscript, or math subscript. This should cause no
-problem. As an alternative to |\xintexprSafeCatcodes| one may also use |\string|
-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
-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.
-
-Braces are also allowed in their usual r\^ole for arguments to macros (these
-arguments are thus not seen by the scanner), or to
-encapsulate \emph{arbitrary} completely expandable material which will not be
-parsed but completely expanded and \emph{must} return an integer or
-fraction possibly with decimal mark or in |A/B[N]| notation, but is not allowed
-to have the |e| or |E|. Braced material is not allowed to expand to some infix
-operator or parenthesis, it is allowed only in locations where the parser
-expects to find a number or fraction, possibly with decimal marks, but no |e|
-nor |E|.
-
-One may use sub-|\xintexpr|-expressions nested within a larger one. It is
-allowed to alternate |\xintfloatexpr|-essions with |\xintexpr|-essions. Do not
-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|.
-
-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.
-Next\footnote{in releases earlier than |1.09c|, these postfix operators took
- precedence on a previous function name; the opposite now holds.} are the
-postfix
-operators: |!| for the factorial, |?| and |:| are two-fold way and three-fold
-way branching constructs. Then the |e| and |E| of the scientific notation, the
-power, multiplication/division, addition/subtraction, comparison, and logical
-operators. At the lowest level: commas then parentheses.
-
-
-The |\relax| at the end of an expression is absolutely \emph{mandatory}.
-
- % 1.09c ajoute bool et togl
- % 1.09a:
- % reduce,
- % sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm,
- % max, min, sum, prd, add, mul, not, all, any, xor
- % ?, !, if, ifsgn, ?, :.
-
-\newcommand\ctexttt [1]{\begingroup\color[named]{DarkOrchid}\ttfamily\bfseries
- #1\endgroup}
-
-\begingroup % 9 octobre pour la gestion de l'indentation et couleurs
-\leftmargini 0pt
-\leftmarginii .5\parindent
-\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
- \labelwidth\parindent
- \itemindent\labelwidth}%
-\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}}.
-
- |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
- conditionals such as |\ifmmode|. For example:
- \centeredline{|\xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO}|}
- will return $\xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO}$
- if executed in math mode (the computation is then $100-100=0$) and
- \xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO} if not (the
- \ctexttt{if} conditional is described below; the
- \csbxint{ifboolexpr} test automatically encapsulates its first
- argument in an |\xintexpr| and follows the first branch if the
- result is non-zero (see \autoref{xintifboolexpr})).
-
- The alternative syntax |25*4-\ifmmode100\else75\fi| could have been used
- here, the usefulness of |bool(name)| lies in the availability in the
- |\xintexpr| syntax of the logic operators of conjunction |&|, inclusive
- disjunction \verb+|+, negation |!| (or |not|), of the multi-operands
- functions |all|, |any|, |xor|, of the two branching operators |if| and
- |ifsgn| (see also |?| and |:|), which allow arbitrarily complicated
- combinations of various |bool(name)|.
-
- Similarly |togl(name)| returns @1@
- if the \LaTeX{} package
- \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
- has been used to define a toggle named |name|, and this toggle is
- currently set to |true|. Using |togl| in an |\xintexpr..\relax|
- without having loaded
- \href{http://www.ctan.org/pkg/etoolbox}{etoolbox} will result in an
- error from |\iftoggle| being a non-defined macro. If |etoolbox| is
- loaded but |togl| is used on a name not recognized by |etoolbox| the
- error message will be of the type ``ERROR: Missing |\endcsname|
- inserted.'', with further information saying that |\protect| should
- have not been encountered (this |\protect| comes from the expansion
- of the non-expandable |etoolbox| error message).
-
- When |bool| or |togl| is encountered by the |\xintexpr| parser, the argument
- enclosed in a parenthesis pair is expanded as usual from left to right,
- token by token, until the closing parenthesis is found, but everything is
- taken literally, no computations are performed. For example |togl(2+3)| will
- test the value of a toggle declared to |etoolbox| with name |2+3|, and not
- |5|. Spaces are gobbled in this process. It is impossible to use |togl| on
- such names containing spaces, but |\iftoggle{name with spaces}{1}{0}| will
- work, naturally, as its expansion will pre-empt the |\xintexpr| scanner.
-
- There isn't in |\xintexpr...| a |test| function available analogous to the
- |test{\ifsometest}| construct from the |etoolbox| package; but any
- \emph{expandable} |\ifsometest| can be inserted directly in an
- |\xintexpr|-ession as |\ifsometest10| (or |\ifsometest{1}{0}|), for example
- |if(\ifsometest{1}{0},YES,NO)| (see the |if| operator below) works.
-
- A straight |\ifsometest{YES}{NO}| would do the same more
- efficiently, the point
- of |\ifsometest10| is to allow arbitrary boolean combinations using
- the (described later) \verb+&+ and \verb+|+ logic operators:
- \verb+\ifsometest10 & \ifsomeothertest10 | \ifsomethirdtest10+, etc... |YES|
- or |NO| above stand for material compatible with the
- |\xintexpr| parser syntax.
-
- See also \csbxint{ifboolexpr}, in this context.
- \item[functions with one mandatory and a second optional argument]
- \ctexttt{round, trunc,\\ float, sqrt}. For
- example |round(2^9/3^5,12)=|\digitstt{\xinttheexpr round(2^9/3^5,12)\relax.}
- The |sqrt| is available also in |\xintexpr|, not only in |\xintfloatexpr|.
- The second optional argument is then the required float precision.
- \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).
- \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
- ``branches'' are evaluated (they are not really branches but just numbers).
- See also the |?| operator.
- \item[the ifsgn conditional (threefold way)]
- \ctexttt{ifsgn}|(cond,<0,=0,>0)| checks the sign of |cond| and
- proceeds correspondingly. All three are evaluated. See also the |:|
- operator.
- \item[functions with an arbitrary number of arguments] \ctexttt{all,
- any, xor, add (=sum), mul (=prd), max, min, gcd, lcm}: the last
- two are integer-only and require the \xintgcdname package.
- Currently, |and| and |or| are left undefined, and the package uses
- the vocabulary |all| and |any|. They must have at least one
- argument.
- \end{description}
-\item The three postfix operators:
- \begin{description}
- \item[{\color[named]{DarkOrchid}!}] computes the factorial of an integer. |sqrt(36)!| evaluates to |6!|
- (\digitstt{=\np{\xinttheexpr sqrt(36)!\relax}}) and not to the square root of
- |36!| (\digitstt{$\approx$\np{\xintthefloatexpr sqrt(36!)\relax}}). This is
- the exact
- factorial even when used inside |\xintfloatexpr|.
-\item[{\color[named]{DarkOrchid}?}] is used as |(cond)?{yes}{no}|. It evaluates the (numerical) condition
- (any non-zero value counts as |true|, zero counts as |false|). It then acts as
- a macro with two mandatory arguments within braces (hence this escapes from
- 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
- 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
- (3>2)?{5+(6}{7-(1}2^3)\relax| also works.} Differs thus from the |if|
- conditional in two ways: the false branch is not at all computed, and the
- number scanner is still active on exit, more digits may follow.
-\item[{\color[named]{DarkOrchid}:}] is used as |(cond):{<0}{=0}{>0}|. |cond| is anything, its sign is
- evaluated (it is not necessary to use |sgn(cond):{<}{=}{>}|) and depending on
- the sign the correct branch is un-braced, the two others are swallowed. The
- un-braced branch will then be parsed as usual. Differs from the |ifsgn|
- conditional as the two false branches are not evaluated and furthermore the
- number scanner is still active on exit.
- \centeredline{|\def\x{0.33}\def\y{1/3}|} \centeredline{|\xinttheexpr
- (\x-\y):{sqrt}{0}{1/}(\y-\x)\relax|%
- \digitstt{=\def\x{0.33}\def\y{1/3}\xinttheexpr
- (\x-\y):{sqrt}{0}{1/}(\y-\x)\relax }}
- \end{description}
-\item
- \renewcommand{\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}
- 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 |+|, |-|.
-\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 parentheses.
-\endlist
-\endgroup
-
\section{Some examples}
The main initial goal is to allow computations with integers and fractions of
@@ -1479,8 +1140,6 @@ examples with the \xintgcdname package, one with the \xintseriesname package,
and finally a computation with a float. Some inputs are simplified by the use
of the \xintexprname package.
-% There is also \xintcfracname for continued fractions computations.
-
{\color{magenta}@123456^99@: }\\
{\color[named]{Purple}\csa{xintiPow}|{123456}{99}|}: \digitstt{\printnumber{\xintiPow {123456}{99}}}
@@ -1493,20 +1152,29 @@ of the \xintexprname package.
\digitstt{\printnumber{\xinttheexpr trunc(.99^-100,200)\relax}\dots }
-{\color{magenta}Computation of a Bezout identity with |7^200-3^200| and |2^200-1|:}\\
-{\color[named]{Purple}|\xintAssign\xintBezout|\\
-\hspace*{2cm}|{\xintthenumexpr 7^200-3^200\relax}|\\
-\hspace*{2cm}|{\xintthenumexpr 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
-\digitstt{\printnumber\U$\times$(@7^200-3^200@)+\printnumber{\xintiOpp\V}$\times$(@2^200-1@)=\printnumber\D }
-
-{\color{magenta}The Euclide algorithm applied to \np{179876541573} and
- \np{66172838904}:}\footnote{this example is computed tremendously faster than
- the
- other ones, but we had to limit the space taken by the output.}\\
-{\color[named]{Purple}|\xintTypesetEuclideAlgorithm {179876541573}{66172838904}|}
-\xintTypesetEuclideAlgorithm {179876541573}{66172838904} \smallskip
+{\color{magenta}%
+ 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|%
+\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
+\digitstt
+{\printnumber\U$\times$(@7^200-3^200@)+%
+ \printnumber{\xintiOpp\V}$\times$(@2^200-1@)=\printnumber\D}
+
+\textcolor{magenta}{The Euclide algorithm applied to
+\np{22206980239027589097} and \np{8169486210102119256}:}%
+\footnote{this example is computed tremendously faster than the
+ other ones, but we had to limit the space taken by the output.}\par
+{\color[named]{Purple}
+\noindent|\xintTypesetEuclideAlgorithm
+{22206980239027589097}{8169486210102119256}|\endgraf}
+\xintTypesetEuclideAlgorithm
+{22206980239027589097}{8169486210102119256} \smallskip
{\color{magenta}$\sum_{n=1}^{500} (4n^2 - 9)^{-2}$ with each term rounded to
twelve digits, and the sum to nine digits:} {\color[named]{Purple}%
@@ -1544,10 +1212,77 @@ was:
{\color{magenta}Computation of $2^{\np{999999999}}$ with |24| significant
- figures:}\\
-{\color[named]{Purple}|\xintFloatPow[24] {2}{999999999}|:}
-\digitstt{\np{\xintFloatPow[24] {2}{999999999}}}
+ figures:}\\
+{\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.
+
+\edef\x{\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}
+\edef\y{\xintLen{\x}}
+As an example of chaining package macros, let us consider the following
+code snippet within a file with filename |myfile.tex|:
+\dverb|@
+\newwrite\outstream
+\immediate\openout\outstream \jobname-out\relax
+\immediate\write\outstream {\xintQuo{\xintPow{2}{1000}}{\xintFac{100}}}
+% \immediate\closeout\outfile
+|%
+The tex run creates a file |myfile-out.tex|, and then writes to it the quotient
+from the euclidean division of @2^{1000}@ by @100!@. The number of digits is
+|\xintLen{\xintQuo{\xintPow{2}{1000}}{\xintFac{100}}}| which expands (in two
+steps) and tells us that @[2^{1000}/100!]@ has {\y} digits. This is not so many,
+let us print them here: \digitstt{\printnumber\x}.
+
+For the sake of typesetting this documentation and not have big numbers
+extend into the margin and go beyond the page physical limits, I use
+these commands (not provided by the package):
+\dverb|@
+\def\allowsplits #1{\ifx #1\relax \else #1\hskip 0pt plus 1pt \relax
+ \expandafter\allowsplits\fi}%
+\def\printnumber #1{\expandafter\expandafter\expandafter
+ \allowsplits #1\relax }%
+% Expands twice before printing.|
+
+The |\printnumber| macro is not part of the package and would need additional
+thinking for more general use.\footnote{as explained in \hyperref[fn:np]{a
+ previous footnote}, the |numprint| package may also be used, in text mode
+ only (as the thousand separator seemingly ends up typeset in a |\string\hbox|
+ when in math mode).} It may be used as |\printnumber {\xintQuo{\xintPow
+ {2}{1000}}{\xintFac{100}}}|, or as |\printnumber\mynumber| if the macro
+|\mynumber| was previously defined via an |\edef|, as for example:\centeredline{
+ |\edef\mynumber {\xintQuo {\xintPow {2}{1000}}{\xintFac{100}}}|}%
+or as |\expandafter\printnumber\expandafter{\mynumber}|, if the macro
+|\mynumber| is defined by a |\newcommand| or a |\def|; using seven rather than
+three |\expandafter|'s in |\printnumber| would allow to use it directly as
+|\printnumber\mynumber| when |\mynumber| has been defined via a |\def| or
+|\newcommand| using a chain of package macros.
+
+%
+Just to show off (again), let's print 300 digits (after the decimal point) of
+the decimal expansion of @0.7^{-25}@:\footnote{the |\string\np| typesetting
+ macro is from the |numprint| package.}
+\centeredline{|\np {\xinttheexpr trunc(.7^-25,300)\relax}\dots|}
+ \digitstt{\np {\xinttheexpr trunc(.7^-25,300)\relax}\dots }
+
+This computation is with \csbxint{theexpr} from package \xintexprname, which
+allows to use standard infix notations and function names to access the package
+macros, such as here |trunc| which corresponds to the \xintfracname macro
+\csbxint{Trunc}. The fraction |.7^-25| is first evaluated \emph{exactly}; for
+some more complex inputs, such as |.7123045678952^-243|, the exact evaluation
+before truncation would be expensive, and (assuming one needs twenty digits) one
+would rather use floating mode: \centeredline{|\xintDigits:=20;
+ \np{\xintthefloatexpr .7123045678952^-243\relax}|}%
+\xintDigits:=20;%
+\centeredline{|.7123045678952^-243|${}\approx{}$%
+ \digitstt{\np{\xintthefloatexpr .7123045678952^-243\relax }}} The exponent
+|-243| didn't have to be put inside parentheses, contrarily to what happens with
+some professional computational software.
+% 6.342,022,117,488,416,127,3 10^35
+% maple n'aime pas ^-243 il veut les parenthèses, bon et il donne, en Digits
+% = 24: 0.634202211748841612732270 10^36
+
+\xintDigits:=16;
To see more of \xintname in action, jump to the
{\autoref{sec:series}} describing the commands of the
@@ -1557,11 +1292,12 @@ To see more of \xintname in action, jump to the
{\hyperlink{e-convergents}{computation of the convergents
of $e$}} made with the \xintcfracname package.
-Note that almost all of the computational results interspersed through the
+Almost all of the computational results interspersed through the
documentation are not hard-coded in the source of the document but just written
there using the package macros, and were selected to not impact too much the
compilation time.
+
\section{Origins of the package}
Package |bigintcalc| by \textsc{Heiko Oberdiek} already
@@ -1609,117 +1345,83 @@ The present package is the result of this initial questioning.
\label{sec:expansions}
-Except for some specific macros dealing with assignments or typesetting,
-the bundle macros all work in expansion-only context. Such macros can
-also be used inside a |\csname...\endcsname|, and in an |\edef|.
-Furthermore they expand their arguments so that they can be arbitrarily
-chained.
-
-
-By convention in this manual \fexpan sion (``full first'') is the
-process to expand repeatedly the first token seen until hitting against
-something not further expandable like an unexpandable \TeX-primitive or
-an opening brace |{| or a (un-active) character. The type of expansion
- done almost systematically by the package macros to their arguments is
- usually the \fexpan sion.
-
- Thus the arguments \emph{must} expand to their complete expansion via an
- \fexpan sion.\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 must be used else the
- expansion from a \csa{romannumeral-`0} will not absorb the \csa{else} or
- closing \csa{fi}. Therefore it is highly recommended to use the package
- provided conditionals such as \csbxint{ifEq}, or, for \LaTeX{} users and
- when dealing with short integers the
- \href{http://ctan.org/pkg/etoolbox}{etoolbox} expandable conditionals. Use
- of non expandable things such as \csa{ifthenelse} is impossible inside the
- arguments of \xintname macros.} The main exception is inside
- |\xintexpr...\relax| where everything is 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.
-
-As an example of chaining package macros, let us consider the following
-code snippet within a file with filename |myfile|:
-\dverb|@
-\newwrite\outfile
-\immediate\openout\outfile \jobname-out\relax
-\immediate\write\outfile {\xintQuo{\xintPow{2}{1000}}{\xintFac{100}}}
-% \immediate\closeout\outfile
-|%
-The tex run creates a file |myfile-out.tex|
-containing the decimal representation of the integer quotient @2^{1000}/100!@.
-
-\edef\x{\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}
-\edef\y{\xintLen{\x}}
-
-\centeredline{%
- |\xintLen{\xintQuo{\xintPow{2}{1000}}{\xintFac{100}}}|}
-\noindent expands (in two steps)
-and tells us that @[2^{1000}/100!]@ has {\y} digits. This is not so many, let us
-print them here: \digitstt{\printnumber\x}.
-
-For the sake of typesetting this documentation and not have big numbers
-extend into the margin and go beyond the page physical limits, I use
-these commands (not provided by the package):
-\dverb|@
-\def\allowsplits #1{\ifx #1\relax \else #1\hskip 0pt plus 1pt \relax
- \expandafter\allowsplits\fi}%
-\def\printnumber #1{\expandafter\expandafter\expandafter
- \allowsplits #1\relax }%
-% Expands twice before printing.
-|%
-
-The |\printnumber| macro is not part of the package and would need additional
-thinking for more general use.\footnote{as explained in
- \hyperref[fn:np]{a previous footnote},
- the |numprint| package may also be used, in text mode only (as the thousand
- separator seemingly ends up typeset in a |\string\hbox| when in math
- mode).} It may be used as |\printnumber
-{\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}|, or as |\printnumber\mynumber| if
-the macro |\mynumber| was previously defined via an |\edef|, as for
-example:\centeredline{ |\edef\mynumber {\xintQuo {\xintPow
- {2}{1000}}{\xintFac{100}}}|}%
-or as
- |\expandafter\printnumber\expandafter{\mynumber}|, if the macro |\mynumber| is
- defined by a |\newcommand| or a |\def| (see below {\autoref{item:xpxp}} for the
- underlying expansion issue; adding four |\expandafter|'s to |\printnumber|
- would allow to use it directly as |\printnumber\mynumber| with a |\mynumber|
- itself defined via a |\def| or |\newcommand|).
-
-
-Just to show off, let's print 300 digits (after the decimal point) of
-the decimal expansion of @0.7^{-25}@:\footnote{the |\string\np| typesetting
- macro
- is from the |numprint| package.}
-\centeredline{|\np {\xinttheexpr trunc(.7^-25,300)\relax}\dots|}
-\digitstt{\np {\xinttheexpr trunc(.7^-25,300)\relax}\dots }
-
-This computation uses the macro \csbxint{Trunc} from package \xintfracname
-wich extends to fractions the basic arithmetic operations defined for
-integers by \xintname. It also uses \csbxint{theexpr} from package
-\xintexprname, which allows to use standard notations. Note that the
-fraction |.7^-25| is first evaluated exactly; for some more complex inputs,
-such as |.7123045678952^-243|, the exact evaluation before truncation would
-be expensive, and (assuming one needs twenty digits) one
-would rather use floating mode:
-\centeredline{|\xintDigits:=20;
- \np{\xintthefloatexpr .7123045678952^-243\relax}|}%
-\xintDigits:=20;%
-\centeredline{|.7123045678952^-243|${}\approx{}$%
-\digitstt{\np{\xintthefloatexpr .7123045678952^-243\relax }}}
-
-% 6.342,022,117,488,416,127,3 10^35
-% maple n'aime pas ^-243 il veut les parenthèses, bon et il donne, en Digits
-% = 24: 0.634202211748841612732270 10^36
-
-\xintDigits:=16;
+By convention in this manual \fexpan sion (``full expansion'' or ``full first
+expansion'') is the process of expanding repeatedly the first token seen until
+hitting against something not further expandable like an unexpandable
+\TeX-primitive or an opening brace |{| or a character (inactive). For
+ those familiar with \LaTeX3 (which is not used by \xintname) this is what is
+ called in its documentation full expansion. Technically, macro arguments in
+ \xintname which are submitted to such a \fexpan sion are so via prefixing them
+ with |\romannumeral-`0|. An explicit or implicit space token stops such an
+ expansion and is gobbled.
-Important points, to be noted, related to the expansion of arguments:
+%
+Most of the package macros, and all those dealing with computations, are
+expandable in the strong sense that they expand to their final result via this
+\fexpan sion. Again copied from \LaTeX3 documentation conventions, this will be
+signaled in the description of the macro by a \etype{}star in the margin.
+All\footnote{except \csbxint{loop} and \csbxint{iloop}.}
+expandable macros of the \xintname packages completely expand in two steps.
+
+Furthermore the macros dealing with computations, as well as many utilities from
+\xinttoolsname, apply this process of \fexpan sion to their arguments. Again
+from \LaTeX3's conventions this will be signaled by a%
+%
+\ntype{{\setbox0 \hbox{\Ff}\hbox to \wd0 {\hss f\hss}}}
+%
+margin annotation. Some additional parsing
+which is done by most macros of \xintname is indicated with a
+variant\ntype{\Numf{\kern.5cm}}; and the extended fraction parsing done by most
+macros of \xintfracname has its own symbol\ntype{\Ff}. When the argument has a
+priori to obey the \TeX{} bound of \digitstt{\number"7FFFFFFF} it is
+systematically fed to a |\numexpr..\relax| hence the expansion is then a
+\emph{complete} one, signaled with an \ntype{\numx}\emph{x} in the margin. This
+means not only complete expansion, but also that spaces are ignored, infix
+algebra is possible, count registers are allowed, etc\dots
+
+The \csbxint{ApplyInline} and \csbxint{For*}\ntype{{\lowast f}} macros from
+\xinttoolsname apply a special iterated \fexpan sion, which gobbles spaces, to
+all those items which are found \emph{unbraced} from left to right in the list
+argument; this is denoted specially as here in the margin. Some other macros
+such as \csbxint{Sum}\ntype{f{$\to$}{\lowast\Ff}} from \xintfracname first do an
+\fexpan sion, then treat each found (braced or not) item (skipping spaces
+between such items) via the general fraction input parsing, this is signaled as
+here in the margin where the signification of the \lowast{} is thus a bit
+different from the previous case.
+
+A few macros from \xinttoolsname do not expand, or expand only once their
+argument\ntype{n{{\color{black}\upshape, resp.}} o}. This is also
+signaled in the margin with notations \`a la \LaTeX3.
+
+As the computations are done by \fexpan dable macros which \fexpan d their
+argument they may be chained up to arbitrary depths and still produce expandable
+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
+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
the first token seen (for each argument), then expand, etc..., until something
@@ -1737,11 +1439,27 @@ Important points, to be noted, related to the expansion of arguments:
|\xintAdd\x{\xinttheexpr\x\y\relax}|.\hfill
\endgroup
-\item Unfortunately, after |\def\x {12}|, one can not use just
- {\color{blue}|-\x|} as input to one of the package macros: the rules above
- explain that the expansion will act only on the minus sign,
- hence do nothing. The only way is to use the \csbxint{Opp}
- macro, which replaces a number with its opposite.
+\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).
+
+ \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}}
+ \endgroup
+
+\item after the definition |\def\x {12}|, one can not use
+ {\color{blue}|-\x|} as input to one of the package macros: the \fexpan sion
+ will act only on the minus sign, hence do nothing. The only way is to use the
+ \csbxint{Opp} macro, or perhaps here rather \csbxint{iOpp} which does
+ maintains integer format on output, as they replace a number with
+ its opposite.
\begingroup\slshape
Again, this is otherwise inside an \csbxint{theexpr}-ession or
@@ -1799,80 +1517,18 @@ steps only, there is no reason to follow these guidelines. Just chain
arbitrarily the package macros, and the new ones will be completely expandable
and usable one within the other.
-Release |1.07| has the \csbxint{NewExpr} command which automatizes the creation
-of such expandable macros:
-\centeredline{|\xintNewExpr\AplusBC[3]{#1+#2*#3}|} creates the |\AplusBC|
-macro doing the above and expanding in two expansion steps.
-
-
-\section {Inputs and outputs}\label{sec:inputs}
-
-The core bundle constituents are \xintname, \xintfracname, \xintexprname,
-each one loading its predecessor. The base constituent \xintname only deals
-with integers, of arbitrary sizes, and apart from its macro \csbxint{Num},
-the input format is rather strict.
-
-\begin{framed}
- With release |1.09a|, arithmetic macros of \xintname parse their arguments
- automatically through \csbxint{Num}. This means also that the arguments may
- already contain infix algebra with count registers, see
- \hyperlink{useofcount}{Use of count registers}.
-\end{framed}
-
-Then \xintfracname extends the scope to
-fractions: numerators and
-denominators are separated by a forward slash and may contain each an
-optional fractional part after the decimal mark (which has to be a dot) and a
-scientific part (with a lower case |e|).
-
-
-The numeric arguments to the bundle macros may be of various types,
-extending in generality:
-
-\begin{enumerate}
-\item `short' integers, \emph{i.e.} less than (or equal to) in absolute value
- \np{\xintiSub{\xintiPow {2}{31}}1}. I will refer to this as the `\TeX{}' or
- `|\numexpr|' limit. This is the case for arguments which serve to count or
- index something. It is also the case for the exponent in the power function
- and for the argument to the factorial function. The bounds have been
- (arbitrarily) lowered to \np{999999999} and \np{999999} respectively for the
- latter cases.\footnote{the float power function limits the exponent to the
- \TeX{} bound, not |999999999|, and it has a variant with no imposed limit on
- the exponent; but the result of the computation must in all cases be
- representable with a power of ten exponent obeying the \TeX{} bound.} When
- the argument exceeds the \TeX{} bound (either positively or negatively), an
- error will originate from a \csa{numexpr} expression and it may sometimes be
- followed by a more specific error `message' from a package macro.
-\item `long' integers, which are the bread and butter of the package commands.
- They are signed integers with, for all pratical purposes, an illimited number
- of digits: most macros only require that the number of digits itself be less
- than the \TeX{} and \csa{numexpr} bound of \np{\number "7FFFFFFF}. Concretely
- though, multiplying out two 1000 digits
- numbers is already a longish operation.
-\item `fractions': they become available after having loaded the \xintfracname
- package. A fraction has a
- numerator, a forward slash and then a denominator. Both can make use of scientific notation (with a
- lowercase |e|) and the dot as decimal mark. No separator for thousands.
- Except within |\xintexpr|-essions, spaces
- should be 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|.
+Since release |1.07| the \csbxint{NewExpr} command automatizes the creation of
+such expandable macros: \centeredline{|\xintNewExpr\AplusBC[3]{#1+#2*#3}|}
+creates the |\AplusBC| macro doing the above and expanding in two expansion
+steps.
-% Inside |\xinttheexpr...\relax|, count registers must again be prefixed by
-% |\the| or
-% |\number| (if they are not arguments to macros of \xintfracname).
-% \end{framed}
+\section {Input formats}\label{sec:inputs}
+The core bundle constituents are \xintname, \xintfracname, \xintexprname, each
+one loading its predecessor. The base constituent \xintname only handles (big)
+integers, and \xintfracname additionally manages decimal numbers, numbers in
+scientific notation, and fractions. Both load \xinttoolsname which provides
+utilities not directly related to big numbers.
\edef\z {\xintAdd
{+--0367.8920280/-++278.289287}{-109.2882/+270.12898}}
@@ -1886,49 +1542,62 @@ extending in generality:
The allowed input formats for `long numbers' and `fractions' are:
\begin{enumerate}
-\item the strict format is for some macros of \xintname. The number should
+\item the strict format\ntype{f} is for some macros of \xintname which only
+ \fexpan d their arguments. After this \fexpan sion the input should
be a string of digits, optionally preceded by a unique minus sign. The first
digit can be zero only if the number is zero. A plus sign is not accepted.
- There is a macro \csbxint{Num} which normalizes to this form an input having
+ |-0| is not legal in the strict format.
+\item the macro \csbxint{Num} normalizes into strict format an input having
arbitrarily many minus and plus signs, followed by a string of zeros, then
digits:\centeredline{|\xintNum
- {+-+-+----++-++----00000000009876543210}|\digitstt{=\xintNum
- {+-+-+----++-++----0000000009876543210}}}%
- Note that |-0| is not legal input and will confuse \xintname (but not
- \csa{xintNum} which even accepts an empty input).
-\item the extended integer format is for the arithmetic macros of \xintname
- which
- automatically parse their arguments via \csbxint{Num}, and for the fractions
- serving as input to
- the macros of \xintfracname: they are
- (or expand to) |A/B| (or just an integer |A|), where |A| and |B| will be
- automatically given to \csbxint{Num}.
- Each of |A| and |B| may be decimal numbers: with a decimal point and
- digits following it. Here is an example: \centeredline{|\xintAdd
+ {+-+-+----++-++----00000000009876543210}|\digitstt{=\xintNum
+ {+-+-+----++-++----0000000009876543210}}} The extended integer
+ format\ntype{\Numf} is thus for the arithmetic macros of \xintname which
+ automatically parse their arguments via this \csbxint{Num}.
+\item the fraction format\ntype{\Ff} is what is expected by the macros of
+ \xintfracname: a fraction is constituted of a numerator |A| and optionally a
+ denominator |B|, separated by a forward slash |/| and |A| and |B| may be
+ macros which will be automatically given to \csbxint{Num}. Each of |A| and |B|
+ may be decimal numbers (the decimal mark must be a |.|). Here is an
+ example:\footnote{the square brackets one sees in various outputs are
+ explained
+ near the end of this section.} \centeredline{|\xintAdd
{+--0367.8920280/-++278.289287}{-109.2882/+270.12898}|}%
Incidentally this evaluates to \centeredline{\digitstt{=\z}}%
\centeredline{\digitstt{=\xintIrr\z{} (irreducible)}}%
\centeredline{\digitstt{=\xintTrunc {50}{\z}\dots}}%
where the second line was produced with |\xintIrr| and the next with
|\xintTrunc {50}| to get fifty digits of the decimal expansion following the
- decimal mark. Scientific notation is accepted on
- input both for the numerators and denominators of fractions, and is produced
- on output by \csbxint{Float}: \centeredline{|\xintAdd{10.1e1}{101.010e3}|%
- \digitstt{=\xintAdd{10.1e1}{101.010e3}}}%
-This last example shows that fractions with a denominator equal to one, are
-generally printed as fraction. In math mode \csbxint{Frac} will remove such
-dummy denominators, and in inline text mode one has \csbxint{PRaw}.
- \centeredline{|\xintPRaw{\xintAdd{10.1e1}{101.010e3}}|%
- \digitstt{=\xintPRaw{\xintAdd{10.1e1}{101.010e3}}}} \centeredline{|\xintRaw{1.234e5/6.789e3}|\digitstt{=\xintRaw{1.234e5/6.789e3}}}%
- \centeredline{|\xintFloat[24]{1/66049}|\digitstt{=\xintFloat[24]{1/66049}}}
+ decimal mark. Scientific notation is accepted for both numerator and
+ denominator of a fraction, and is produced on output by \csbxint{Float}:
+ \centeredline{|\xintAdd{10.1e1}{101.010e3}|%
+ \digitstt{=\xintAdd{10.1e1}{101.010e3}}}
+ \centeredline{|\xintFloatAdd{10.1e1}{101.010e3}|%
+ \digitstt{=\xintFloatAdd{10.1e1}{101.010e3}}}
+ \centeredline{|\xintFloat{\xintiPow {2}{100}}|%
+ \digitstt{=\xintFloat{\xintiPow {2}{100}}}}
+%
+Produced fractions with a denominator equal to one are nevertheless generally
+printed as fraction. In math mode \csbxint{Frac} will remove such dummy
+denominators, and in inline text mode one has \csbxint{PRaw} with the similar
+effect. \centeredline{|\xintPRaw{\xintAdd{10.1e1}{101.010e3}}|%
+ \digitstt{=\xintPRaw{\xintAdd{10.1e1}{101.010e3}}}}
+\centeredline{|\xintRaw{1.234e5/6.789e3}|%
+ \digitstt{=\xintRaw{1.234e5/6.789e3}}}%
+\centeredline{|\xintFloat[24]{1/66049}|%
+ \digitstt{=\xintFloat[24]{1/66049}}}
+\item the \hyperref[xintexpr]{expression format} is for inclusion in an
+ \csbxint{expr}|...\relax|, it uses infix notations, function names, complete
+ expansion, and is described in its devoted section
+ (\autoref{sec:exprsummaryII}).
\end{enumerate}
-Even with \xintfracname loaded, some macros by their nature can
-not accept fractions on input. Starting with release |1.05| most of them have
-also been extended to accept a fraction actually reducing to an integer. For
-example it used to be the case with the earlier releases that |\xintQuo
-{100/2}{12/3}| would not work (the macro \csbxint{Quo} computes a euclidean
-quotient). It now does, because its arguments are, after simplification,
-integers.
+Even with \xintfracname loaded, some macros by their nature can not accept
+fractions on input. Those parsing their inputs through \csbxint{Num} will accept
+a fraction reducing to an integer. For example |\xintQuo {100/2}{12/3}| works,
+because its arguments are, after simplification, integers. In this
+documentation, I often say ``numbers or fractions'', although at times the
+vocable ``numbers'' by itself may also include ``fractions''; and ``decimal
+numbers'' are counted among ``fractions''.
A number can start directly with a decimal point:
\centeredline{|\xintPow{-.3/.7}{11}|\digitstt{=\xintPow{-.3/+.7}{11}}}%
@@ -1943,98 +1612,107 @@ such as |\A 245/7.77|, where the numerator will be the concatenation of the
expansion of |\A| and |245|. But, as explained already |123\A| is a no-go,
\emph{except inside an |\string\xintexpr|-ession}!
-Finally, after the decimal point there may be |eN| where |N| is a positive
-or negative number (obeying the \TeX{} bounds on
-integers). This `|e|' part (which must be in
-lowercase, except inside |\xintexpr|-essions) may appear both at the numerator
-and at the denominator. \centeredline{|\xintRaw
+The scientific notation is necessarily (except in |\xintexpr..\relax|) with a
+lowercase |e|. It may appear both at the numerator and at the denominator of a
+fraction. \centeredline{|\xintRaw
{+--+1253.2782e++--3/---0087.123e---5}|\digitstt{=\xintRaw
{+--+1253.2782e++--3/---0087.123e---5}}}
-\hypertarget{useofcount}{\paragraph{Use of count registers:}} 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 subjected to a
-complete expansion which must delivers 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
-applies in particular to the number of digits to truncate or round with, to the
-indices of a series partial sum, \dots
+% obsolète depuis longtemps!
+% , and apart from its macro \csbxint{Num},
+% the input format is rather strict.
-The macros dealing with long numbers/fractions for arithmetic operations allow
-\emph{to some extent} the use of count registers and even infix algebra with
-them inside their arguments: a count register |\mycountA| or |\count 255| is
-admissible as numerator or also as denominator, with no need to be prefixed by
-|\the| or |\number|. It is possible to have as argument an algebraic
-expression as would be acceptable by a |\numexpr...\relax|, under this
-condition: \emph{each of the numerator and denominator is expressed with at
- most \emph{eight} tokens}.\footnote{Attention! there is no problem with a
- \LaTeX{} \csa{value}\texttt{\{countername\}} if if comes first, but if it
- comes later in the input it will not get expanded, and braces around the
- name will be removed and chaos\IMPORTANT{} will ensues inside a
- \csa{numexpr}. One should enclose the whole input in
- \csa{the}\csa{numexpr}|...|\csa{relax} in such cases.} The slash for rounded
-division in a |\numexpr| should be written with braces |{/}| to not be
-confused with the \xintfracname delimiter between numerator and denominator
-(braces will be removed internally). Example:
-|\mycountA+\mycountB{/}17/1+\mycountA*\mycountB|, or |\count 0+\count
-2{/}17/1+\count 0*\count 2|, but in the latter case the numerator has the
-maximal allowed number of tokens (the braced slash counts for only one).
-\centeredline{|\cnta 10 \cntb 35 \xintRaw
- {\cnta+\cntb{/}17/1+\cnta*\cntb}|\digitstt{->\cnta 10 \cntb 35 \xintRaw
- {\cnta+\cntb{/}17/1+\cnta*\cntb}}} For longer algebraic expressions using
-count registers, there are two possibilities:
+Arithmetic macros of \xintname which parse their arguments automatically through
+\csbxint{Num} are signaled by a special
+symbol%\ntype{\Numf{\unskip\kern\dimexpr\FrameSep+\FrameRule\relax}}
+\ntype{\Numf} in the margin. This symbol also means that these arguments may
+contain to some extent infix algebra with count registers, see the section
+\hyperref[sec:useofcount]{Use of count registers}.
+
+
+ With \xintfracname loaded the symbol \smash{\Numf} means that a fraction is
+ accepted if it is a whole number in disguise; and for macros accepting the
+ full fraction format with no restriction there is the corresponding symbol
+ in the margin\ntype{\Ff}.
+
+
+Summary of the input formats for the bundle macros dealing with numbers
+(except \csbxint{expr}|..\relax|):
\begin{enumerate}
-\item encompass each of the numerator and denominator in |\the\numexpr...\relax|,
-\item encompass each of the numerator and denominator in |\numexpr {...}\relax|.
+\item `short' integers,\ntype{\numx} \emph{i.e.} less than (or equal to)
+ in absolute value \np{\xintiSub{\xintiPow {2}{31}}1}. I will refer to
+ this as the `\TeX{}' or `|\numexpr|' limit. This is the case for
+ arguments which serve to count or index something. It is also the case
+ for the exponent in the power function and for the argument to the
+ factorial function.\footnote{the bound has even been lowered for them
+ but the float power function limits the exponent only to the \TeX{}
+ bound, and has a variant with no imposed limit on the exponent; but
+ the result of the computation must in all cases be representable
+ with a power of ten exponent obeying the \TeX{} bound.} When the
+ argument exceeds the \TeX{} bound (either positively or negatively),
+ an error will originate from a \csa{numexpr} expression and it may
+ sometimes be followed by a more specific error `message' from a
+ package macro.
+\item `long' integers in strict format:\ntype{f} only one optional minus sign,
+ anything starting with zero is treated as zero. Some macros of
+ \xintname require this format, but most accept the extended format
+ 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|.
+\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
+ prefixed by |\the| or |\number|.\footnote{A \LaTeX{} \texttt{\char
+ 92value\{countername\}} is accepted, if there is nothing else,
+ especially before, in
+ the macro argument.} The number of digits must (as in the
+ strict format) be less than \np{\number "7FFFFFFF}.
+\item `fractions':\ntype{\Ff} they become available after having loaded
+ the \xintfracname package. A fraction has a numerator, a forward slash
+ and then a denominator. Both can use scientific notation (with
+ a lowercase |e|) and the dot as decimal mark. No separator for
+ thousands. Except within |\xintexpr|-essions, spaces should be
+ avoided.
\end{enumerate}
-\dverb|@
-\cnta 100 \cntb 10 \cntc 1
-\xintPRaw {\numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc+
- 2*\cnta*\cntb+2*\cnta*\cntc+2*\cntb*\cntc}\relax/%
- \numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }|
-\cnta 100 \cntb 10 \cntc 1
-\centeredline{\digitstt{\xintPRaw {\numexpr
- {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc+
- 2*\cnta*\cntb+2*\cnta*\cntc+2*\cntb*\cntc}\relax/%
- \numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }}}
-The braces would not be accepted
- as regular
-|\numexpr|-syntax: and indeed, they
- are removed at some point in the processing.
+% \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}
-\paragraph {Outputs: } loading \xintfracname not only relaxes the format of
- the inputs; it also modifies the format of the outputs: except when a
- fraction is filtered on output by \csbxint{Irr} or \csbxint{RawWithZeros},
- or \csbxint{PRaw}, or by the truncation or rounding macros, or is given as
- argument in math mode to \csbxint{Frac}, the output format is normally of
- the \fbox{|A/B[n]|} form (which stands for |(A/B)|$\times$|10^n|). The
- |A| and |B| may end in zeros (\emph{i.e}, |n| does not represent all powers
- of ten), and will generally have a common factor. The denominator |B| is
- always strictly positive.
-
-A macro \csbxint{Frac} is provided
-for the typesetting (math-mode only) of such a `raw' output. The command
-\csbxint{Frac} is not accepted as input to the package macros, it is for
-typesetting only (in math mode).
-
-Direct user input of things such as |16000/289072[17]| or |3[-4]| is authorized.
-It is even possible to use |\A/\B[17]| if |\A| expands to |16000| and |\B| to
-|289072|, or |\A| if |\A| expands to |3[-4]|. However,
-NEITHER the numerator NOR
-the denominator may then have a decimal
-point\IMPORTANT{}. And, for this format, ONLY the numerator may carry
-a UNIQUE minus sign (and no superfluous leading zeros; and NO plus sign).
-This format with a power of ten represented by a number within
- square brackets is the output format used by (almost all) \xintfracname
- macros dealing with fractions.
- It is allowed for user input but the parsing is minimal and it
- is mandatory to follow the above rules. This reduced
- flexibility, compared to the format without the square brackets,
- allows chaining package macros without too much speed impact, as
- they always output computation results in the |A/B[n]| form.
+Regarding fractions, the \xintfracname macros generally output in
+|A/B[n]| format, representing the fraction |A/B| times |10^n|.
+
+This format with a trailing |[n]| (possibly, |n=0|) is accepted on input
+but it presupposes that the numerator and denominator |A| and |B| are in
+the strict integer format described above. So |16000/289072[17]| or
+|3[-4]| are authorized and it is even possible to use |\A/\B[17]| if
+|\A| expands to |16000| and |\B| to |289072|, or |\A| if |\A| expands to
+|3[-4]|. However, NEITHER the numerator NOR the denominator may then
+have a decimal point\IMPORTANT{}. And, for this format, ONLY the
+numerator may carry a UNIQUE minus sign (and no superfluous leading
+zeros; and NO plus sign).
+
+This format with a power of ten represented by
+a number within square brackets is the output format used by (almost
+all) \xintfracname macros dealing with fractions. It is allowed for user
+input but the parsing is minimal and it is mandatory to follow the above
+rules. This reduced flexibility, compared to the format without the
+square brackets, allows chaining package macros without too much speed
+impact, as they always output computation results in the |A/B[n]| form.
\begin{framed}
All computations done by \xintfracname on fractions are exact. Inputs
@@ -2052,81 +1730,93 @@ Although most would be harmless in most macros, there are some cases
where spaces could break havoc. So the best is to avoid them entirely.
This is entirely otherwise inside an |\xintexpr|-ession, where spaces are
-expected to, as a general rule (with possible exceptions related to the
-allowed use of braces, see the
-\hyperref[sec:expr]{documentation}) be completely
-harmless, and even recommended for making the source more legible.
-
-Syntax such as |\xintMul\A\B| is accepted and equivalent\footnote{see however
- near the end of \hyperref[sec:ifcase]{this later section} for the important
- difference when used in contexts where \TeX{} expects a number, such as
- following an \csa{ifcase} or an \csa{ifnum}.} to |\xintMul {\A}{\B}|. The
-input |\xintAdd\xintMul\A\B\C| does not work, the product operation must be put
-within braces: |\xintAdd{\xintMul\A\B}\C|. It would be nice to have a functional
-form |\add(x,\mul(y,z))| but this is not provided by the package.\footnote{yes
- it is with the |1.09a| \csa{xintexpr}, \csa{xintexpr}
- \texttt{add(x,mul(y,z))}\csa{relax}.} Arguments must be either within braces
-or a
-single control sequence.
-
-Note that |-| and |+| may serve only as unary operators, on \emph{explicit}
-numbers. They can not serve to prefix macros evaluating to such numbers,
-\emph{except inside an |\string\xintexpr|-ession.}
-
-\section{More on fractions}
+ignored (except when they occur inside arguments to some some macros, thus
+escaping the |\xintexpr| parser). See the \hyperref[sec:expr]{documentation}.
+
+% Syntax such as |\xintMul\A\B| is accepted and equivalent\footnote{see
+% however near the end of \hyperref[sec:ifcase]{this later section} for
+% the important difference when used in contexts where \TeX{} expects a
+% number, such as following an \csa{ifcase} or an \csa{ifnum}.} to
+% |\xintMul {\A}{\B}|. Something like |\xintAdd\xintMul\A\B\C| does not
+% work, the product operation must be put within braces:
+% |\xintAdd{\xintMul\A\B}\C|.
+
+% It would be nice to have a functional form
+% |\add(x,\mul(y,z))| but this is not provided by the
+% package.\footnote{yes it is with the |1.09a| \csa{xintexpr},
+% \csa{xintexpr} \texttt{add(x,mul(y,z))}\csa{relax}.} Arguments must be
+% either within braces or a single control sequence.
+
+% Note again that |-| and |+| may serve only as unary operators, on
+% \emph{explicit} numbers. They can not serve to prefix macros evaluating
+% to such numbers, \emph{except inside an |\string\xintexpr|-ession.}
+
+\section{Output formats}
With package \xintfracname loaded, the routines \csbxint{Add}, \csbxint{Sub},
\csbxint{Mul}, \csbxint{Pow}, \csbxint{Sum}, \csbxint{Prd} are modified to allow
-fractions on input,\footnote{the power function does not accept a
- fractional exponent. Or rather, does not expect, and errors will result if one
- is provided.}\,\footnote{macros \csbxint{iAdd}, \csbxint{iSub},
- \csbxint{iMul}, \csbxint{iPow}, \csbxint{iSum}, \csbxint{iPrd} are the
- original ones dealing only with integers. They are available as synonyms, also
- when \xintfracname is not loaded. }\,\footnote{also \csbxint{Cmp},
- \csbxint{Sgn}, \csbxint{Geq}, \csbxint{Opp}, \csbxint{Abs}, \csbxint{Max},
- \csbxint{Min} are
- extended to fractions; and the last four have their integer-only initial
- synonyms.}\,\footnote{and \csbxint{Fac}, \csbxint{Quo}, \csbxint{Rem},
- \csbxint{Division}, \csbxint{FDg}, \csbxint{LDg},
- \csbxint{Odd}, \csbxint{MON}, \csbxint{MMON} all accept a fractional input as
- long as it reduces to an integer.} and produce on output a fractional number
-|f=A/B[n]| where |A| and |B| are integers, with |B| positive, and |n| is a
-``short'' integer (\emph{i.e} less in absolute value than |2^{31}-9|).
-This represents |(A/B)| times |10^n|. The fraction |f| may be, and generally is,
-reducible, and |A| and |B| may well end up with zeros (\emph{i.e.} |n| does not
-contain all powers of 10). Conversely, this format is accepted on input (and is
-parsed more quickly than fractions containing decimal points; the input may be a
-number without denominator).\footnote{at each stage of the computations, the sum
- of |n| and the length of |A|, or of the absolute value of |n| and the length
- of |B|, must be kept less than |2\string^\string{31\string}-9|.}
-
-The \csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, \csbxint{iPow},
-\csbxint{iSum}, \csbxint{iPrd}, etc... are the
-original\MyMarginNote{\digitstt{1.09a}: the original now also use \csa{xintNum}}
-un-modified integer-only versions. They have less parsing overhead.
+fractions on input,\footnote{the power function does not accept a fractional
+ exponent. Or rather, does not expect, and errors will result if one is
+ provided.}\,\footnote{macros \csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul},
+ \csbxint{iPow}, are the original ones dealing only with integers. They are
+ available as synonyms, also when \xintfracname is not loaded. With
+ \xintfracname loaded they accept on input also fractions, if these fractions
+ reduce to integers, and the output format is the original \xintname's one. The
+ macros \csbxint{iiAdd}, \csbxint{iiSub}, \csbxint{iiMul}, \csbxint{iiPow},
+ \csbxint{iiSum}, \csbxint{iiPrd} are strictly integer-only: they skip the
+ overhead of parsing their arguments via \csbxint{Num}.}\,\footnote{also
+ \csbxint{Cmp}, \csbxint{Sgn}, \csbxint{Geq}, \csbxint{Opp}, \csbxint{Abs},
+ \csbxint{Max}, \csbxint{Min} are extended to fractions; and the last four have
+ the integer-only variants \csbxint{iOpp}, \csbxint{iAbs}, \csbxint{iMax},
+ \csbxint{iMin}.}\,\footnote{and \csbxint{Fac}, \csbxint{Quo}, \csbxint{Rem},
+ \csbxint{Division}, \csbxint{FDg}, \csbxint{LDg}, \csbxint{Odd},
+ \csbxint{MON}, \csbxint{MMON} all accept a fractional input as long as it
+ reduces to an integer.} and produce on output a fractional number |f=A/B[n]|
+where |A| and |B| are integers, with |B| positive, and |n| is a ``short''
+integer (\emph{i.e} less in absolute value than |2^{31}-9|). This represents
+|(A/B)| times |10^n|. The fraction |f| may be, and generally is, reducible, and
+|A| and |B| may well end up with zeros (\emph{i.e.} |n| does not contain all
+powers of 10). Conversely, this format is accepted on input (and is parsed more
+quickly than fractions containing decimal points; the input may be a number
+without denominator).\footnote{at each stage of the computations, the sum of |n|
+ and the length of |A|, or of the absolute value of |n| and the length of |B|,
+ must be kept less than |2\string^\string{31\string}-9|.}
+
+
+Thus loading \xintfracname not only relaxes the format of the inputs; it
+also modifies the format of the outputs: except when a fraction is
+filtered on output by \csbxint{Irr} or \csbxint{RawWithZeros}, or
+\csbxint{PRaw}, or by the truncation or rounding macros, or is given as
+argument in math mode to \csbxint{Frac}, the output format is normally
+of the \fbox{|A/B[n]|} form (which stands for |(A/B)|$\times$|10^n|).
+The |A| and |B| may end in zeros (\emph{i.e}, |n| does not represent all
+powers of ten), and will generally have a common factor. The denominator
+|B| is always strictly positive.
+
+A macro \csbxint{Frac} is provided for the typesetting (math-mode only)
+of such a `raw' output. The command \csbxint{Frac} is not accepted as
+input to the package macros, it is for typesetting only (in math mode).
The macro \csbxint{Raw} prints the fraction
directly from its internal representation in |A/B[n]| form. The macro
\csbxint{PRaw} does the same but without printing the |[n]| if |n=0| and without
printing |/1| if |B=1|.
-To convert
-the trailing |[n]| into explicit zeros either at the numerator or the
-denominator, use \csbxint{RawWithZeros}. In both cases the |B| is printed
-even if it has value |1|.
-Conversely (sort of), the macro \csbxint{REZ}
- puts all powers of ten into the |[n]| (REZ stands for remove zeros).
-Here also, the |B| is printed even if it has value |1|.
-
-The macro \csbxint{Irr} reduces the fraction to its irreducible form |C/D|
-(without a trailing |[0]|), and it prints
-the |D| even if |D=1|.
-
-The macro \csbxint{Num} from package \xintname is extended: it now does like
-\csbxint{Irr}, raises an error if the fraction did not reduce to an integer, and
-outputs the numerator. This macro
-should be used when one knows that necessarily the result of a computation is an
-integer, and one wants to get rid of its denominator |/1| which would be left by
+To convert the trailing |[n]| into explicit zeros either at the
+numerator or the denominator, use \csbxint{RawWithZeros}. In both cases
+the |B| is printed even if it has value |1|. Conversely (sort of), the
+macro \csbxint{REZ} puts all powers of ten into the |[n]| (REZ stands
+for remove zeros). Here also, the |B| is printed even if it has value
+|1|.
+
+The macro \csbxint{Irr} reduces the fraction to its irreducible form
+|C/D| (without a trailing |[0]|), and it prints the |D| even if |D=1|.
+
+The macro \csbxint{Num} from package \xintname is extended: it now does
+like \csbxint{Irr}, raises an error if the fraction did not reduce to an
+integer, and outputs the numerator. This macro should be used when one
+knows that necessarily the result of a computation is an integer, and
+one wants to get rid of its denominator |/1| which would be left by
\csa{xintIrr} (or one can use \csbxint{PRaw} on top of \csbxint{Irr}).
@@ -2169,6 +1859,117 @@ To get the integer part of the decimal expansion of |f|, use
See also the documentations of \csbxint{Round}, \csbxint{iRound} and
\csbxint{Float}.
+The \csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, \csbxint{iPow}, and
+some others accept fractions on input under
+the condition that they are (big) integers in disguise and then output a
+(possibly big) integer, without fraction slash nor trailing |[n]|.
+
+The \csbxint{iiAdd}, \csbxint{iiSub}, \csbxint{iiMul}, \csbxint{iiPow}, and
+some others with `\textcolor{blue}{ii}' in their names accept on input
+only integers in strict format (skipping the overhead of the
+\csbxint{Num} parsing) and output naturally a
+(possibly big) integer, without fraction slash nor trailing |[n]|.
+
+
+\section{Multiple outputs}\label{sec:multout}
+
+Some macros have an output consisting of more than one number or
+fraction, each one is then returned within braces. Examples of
+multiple-output macros are \csbxint{Division} which gives first the
+quotient and then the remainder of euclidean division, \csbxint{Bezout}
+from the \xintgcdname package which outputs five numbers,
+\csbxint{FtoCv} from the \xintcfracname package which returns the list
+of the convergents of a fraction, ... \autoref{sec:assign} and
+\autoref{sec:utils} mention utilities, expandable or not, to cope with
+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}}
+
+% 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.
+
+% This is the
+% only situation where a macro from the package \xintname may output something
+% 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
+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
+applies in particular to the number of digits to truncate or round with, to the
+indices of a series partial sum, \dots
+
+The macros dealing with long numbers or fractions allow (when not limited to the
+`strict integer' format on input) \emph{to some extent} the direct use of count
+registers and even infix algebra with them inside their arguments: a count
+register |\mycountA| or |\count 255| is admissible as numerator or also as
+denominator, with no need to be prefixed by |\the| or |\number|. It is possible
+to have as argument an algebraic expression as would be acceptable by a
+|\numexpr...\relax|, under this condition: \emph{each of the numerator and
+ denominator is expressed with at most \emph{eight}
+ tokens}.\footnote{Attention! there is no problem with a \LaTeX{}
+ \csa{value}\texttt{\{countername\}} if if comes first, but if it comes later
+ in the input it will not get expanded, and braces around the name will be
+ removed and chaos\IMPORTANT{} will ensues inside a \csa{numexpr}. One should
+ enclose the whole input in \csa{the}\csa{numexpr}|...|\csa{relax} in such
+ cases.} The slash for rounded division in a |\numexpr| should be written with
+braces |{/}| to not be confused with the \xintfracname delimiter between
+numerator and denominator (braces will be removed internally). Example:
+|\mycountA+\mycountB{/}17/1+\mycountA*\mycountB|, or |\count 0+\count
+2{/}17/1+\count 0*\count 2|, but in the latter case the numerator has the
+maximal allowed number of tokens (the braced slash counts for only one).
+\centeredline{|\cnta 10 \cntb 35 \xintRaw
+ {\cnta+\cntb{/}17/1+\cnta*\cntb}|\digitstt{->\cnta 10 \cntb 35 \xintRaw
+ {\cnta+\cntb{/}17/1+\cnta*\cntb}}} For longer algebraic expressions using
+count registers, there are two possibilities:
+\begin{enumerate}
+\item encompass each of the numerator and denominator in |\the\numexpr...\relax|,
+\item encompass each of the numerator and denominator in |\numexpr {...}\relax|.
+\end{enumerate}
+\dverb|@
+\cnta 100 \cntb 10 \cntc 1
+\xintPRaw {\numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc+
+ 2*\cnta*\cntb+2*\cnta*\cntc+2*\cntb*\cntc}\relax/%
+ \numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }|
+\cnta 100 \cntb 10 \cntc 1
+\centeredline{\digitstt{\xintPRaw {\numexpr
+ {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc+
+ 2*\cnta*\cntb+2*\cnta*\cntc+2*\cntb*\cntc}\relax/%
+ \numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }}}
+The braces would not be accepted
+ as regular
+|\numexpr|-syntax: and indeed, they
+ are removed at some point in the processing.
+
+
+\section{Dimensions}
+
+\meta{dimen} variables can be converted into (short) integers suitable for the
+\xintname macros by prefixing them with |\number|. This transforms a dimension
+into an explicit short integer which is its value in terms of the |sp| unit
+(@1/65536@\,|pt|).
+When |\number| is applied to a \meta{glue} variable, the stretch and shrink
+components are lost.
+
+For \LaTeX{} users: a length is a \meta{glue} variable, prefixing a
+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.
+
+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.
+
\section{\csh{ifcase}, \csh{ifnum}, ... constructs}\label{sec:ifcase}
When using things such as |\ifcase \xintSgn{\A}| one has to make sure to leave
@@ -2181,9 +1982,9 @@ because the blanks (including the end of line) following |\A| will be
skipped and not serve to stop the number which |\ifcase| is looking for.
With |\def\A{1}|:
\dverb|@
-\ifcase \xintSgn\A 0\or OK\else ERROR\fi ---> gives ERROR
-\ifcase \xintSgn{\A} 0\or OK\else ERROR\fi ---> gives OK
-|
+\ifcase \xintSgn\A 0\or OK\else ERROR\fi ---> gives ERROR
+\ifcase \xintSgn\A\space 0\or OK\else ERROR\fi ---> gives OK
+\ifcase \xintSgn{\A} 0\or OK\else ERROR\fi ---> gives OK|
% \def\A{1}
% \ifcase \xintSgn\A 0\or OK\else ERROR\fi\
% \ifcase \xintSgn{\A} 0\or OK\else ERROR\fi
@@ -2192,7 +1993,7 @@ 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}), and also macros.
+commented upon in \autoref{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:
@@ -2207,45 +2008,9 @@ efficient to use (under \LaTeX{}) the equivalent conditional tests from the
\href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
package.
-\section{Dimensions}
-
-\meta{dimen} variables can be converted into (short) integers suitable for the
-\xintname macros by prefixing them with |\number|. This transforms a dimension
-into an explicit short integer which is its value in terms of the |sp| unit
-(@1/65536@\,|pt|).
-When |\number| is applied to a \meta{glue} variable, the stretch and shrink
-components are lost.
-
-For \LaTeX{} users: a length is a \meta{glue} variable, prefixing a
-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.
-
-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.
-
-\section{Multiple outputs}\label{sec:multout}
-
-Some macros have an output consisting of more than one number, each one is then
-within braces. Examples of multiple-output macros are \csbxint{Division} which
-gives first the quotient and then the remainder of euclidean division,
-\csbxint{Bezout} from the \xintgcdname package which outputs five numbers,
-\csbxint{FtoCv} from the \xintcfracname package which returns the list of the
-convergents of a fraction, ... the next two sections explain ways to deal,
-expandably or not, with such outputs.
-
-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.
-
-% This is the
-% only situation where a macro from the package \xintname may output something
-% which could require parsing through \csa{xintNum} before further processing by
-% the other (integer-only) package macros from \xintname.
-\section{Assignments}
+\section{Assignments}\label{sec:assign}
\xintAssign\xintBezout{357}{323}\to\tmpA\tmpB\tmpU\tmpV\tmpD
@@ -2343,22 +2108,20 @@ 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.
-Needless to say \csbxint{Assign}, \csbxint{AssignArray} and
-\csbxint{DigitsOf} do not do any check on whether the macros they
-define are already defined.
-
-In the example above, we deliberately broke all rules of complete
-expandability, but had we wanted to compute the sum of the digits,
-not the sum of the squares, we could just have written:
-\centeredline{\csbxint{iSum}|{\xintiPow{2}{100}}|\digitstt{=%
- \xintiSum\z}} Indeed, \csa{xintiSum} is usually
-used as in \centeredline{%
- \csbxint{iSum}|{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}|%
- \digitstt{=%
- \xintiSum{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}}}
-but in the example above each digit of @2^{100}@ is treated as
-would have been a summand enclosed within braces, due to the rules
-of \TeX{} for parsing macro arguments.
+Warning: macros \csbxint{Assign}, \csbxint{AssignArray} and \csbxint{DigitsOf}
+\emph{do not do any check} on whether the macros they define are already
+defined.
+
+In the example above, we deliberately broke all rules of complete expandability,
+but had we wanted to compute the sum of the digits, not the sum of the squares,
+we could just have written: \csbxint{iiSum}|{\xintiPow{2}{100}}|\digitstt{=%
+ \xintiiSum\z}. Indeed, \csa{xintiiSum} is usually used on braced items as in
+\centeredline{%
+ \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.
Note that |{-\xintRem{3347}{591}}| is not a valid input, because
the expansion will apply only to the minus sign and leave
@@ -2382,7 +2145,7 @@ 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}
+\section{Utilities for expandable manipulations}\label{sec:utils}
The package now has more utilities to deal expandably with `lists of things',
which were treated un-expandably in the previous section with \csa{xintAssign}
@@ -2401,14 +2164,14 @@ As an example the following code uses only expandable operations:
\dverb+@
|2^{100}| (=\xintiPow {2}{100}) has \xintLen{\xintiPow {2}{100}}} digits
and the sum of their squares is
-\xintiSum{\xintApply {\xintiSqr}{\xintiPow {2}{100}}}.
+\xintiiSum{\xintApply {\xintiSqr}{\xintiPow {2}{100}}}.
These digits are, from the least to the most significant:
\xintListWithSep {, }{\xintRev{\xintiPow {2}{100}}}. The thirteenth most
significant digit is \xintNthElt{13}{\xintiPow {2}{100}}. The seventh
least significant one is \xintNthElt{7}{\xintRev{\xintiPow {2}{100}}}.
+
|2^{100}| (=\z) has \xintLen{\z} digits and the sum of
-their squares is \xintiSum{\xintApply\xintiSqr\z}. These digits are, from the
+their squares is \xintiiSum{\xintApply\xintiSqr\z}. These digits are, from the
least to the most significant: \xintListWithSep {, }{\xintRev\z}. The
thirteenth most
significant digit is \xintNthElt{13}{\z}. The seventh
@@ -2435,8 +2198,8 @@ package, there is a new kind of for loop, \csbxint{For}. Check it out
\section{A new kind of expandable loop}
Also included in \xinttoolsname, \csbxint{iloop} is an expandable loop giving
-access to an iteration index, without using count registers. Check it out
-(\autoref{xintiloop}).
+access to an iteration index, without using count registers which would break
+expandability. Check it out (\autoref{xintiloop}).
\section{Exceptions (error messages)}
@@ -2468,8 +2231,7 @@ sequences:
\xintError:inserted
\xintError:use_xintthe!
\xintError:bigtroubleahead
-\xintError:unknownfunction
-|
+\xintError:unknownfunction|
\section{Common input errors when using the package macros}
@@ -2508,24 +2270,23 @@ others are more annoying as they may pass through unsignaled.
\section{Package namespace}
-Inner macros of \xintname, \xintfracname, \xintexprname, \xintbinhexname,
-\xintgcdname, \xintseriesname, and \xintcfracname{} all begin either with
-|\XINT_| or with |\xint_|.\footnote{starting with release |1.06b| the style
- files use for macro names a more modern underscore |\_| rather than the
- \texttt{\char`\@}
- sign. A handful of private macros starting with |\string\XINT| do not have
- the
- underscore for technical reasons:
+Inner macros of \xinttoolsname, \xintname, \xintfracname, \xintexprname,
+\xintbinhexname, \xintgcdname, \xintseriesname, and \xintcfracname{} all begin
+either with |\XINT_| or with |\xint_|.\footnote{starting with release |1.06b|
+ the style files use for macro names a more modern underscore |\_| rather than
+ the \texttt{\char`\@} sign. A handful of private macros starting with
+ |\string\XINT| do not have the underscore for technical reasons:
\csa{XINTsetupcatcodes}, \csa{XINTdigits} and macros with names starting with
- |XINTinFloat| or |XINTinfloat|.}
-The package public commands all start with |\xint|. Some other control sequences
-are used only as delimiters, and left undefined, they may have been defined
-elsewhere, their meaning doesn't matter and is not touched.
+ |XINTinFloat| or |XINTinfloat|.} The package public commands all start with
+|\xint|. Some other control sequences are used only as delimiters, and left
+undefined, they may have been defined elsewhere, their meaning doesn't matter
+and is not touched.
\section{Loading and usage}
\dverb|@
-Usage with LaTeX: \usepackage{xint}
+Usage with LaTeX: \usepackage{xinttools}
+ \usepackage{xint} % (loads xinttools)
\usepackage{xintfrac} % (loads xint)
\usepackage{xintexpr} % (loads xintfrac)
@@ -2534,7 +2295,8 @@ Usage with LaTeX: \usepackage{xint}
\usepackage{xintseries} % (loads xintfrac)
\usepackage{xintcfrac} % (loads xintfrac)
-Usage with TeX: \input xint.sty\relax
+Usage with TeX: \input xinttools.sty\relax
+ \input xint.sty\relax % (loads xinttools)
\input xintfrac.sty\relax % (loads xint)
\input xintexpr.sty\relax % (loads xintfrac)
@@ -2544,18 +2306,17 @@ Usage with TeX: \input xint.sty\relax
\input xintcfrac.sty\relax % (loads xintfrac)
|
-We have added, directly copied from packages by \textsc{Heiko
- Oberdiek}, a mecanism of re-load and \eTeX{} detection,
-especially for Plain \TeX{}. As \eTeX{} is required, the
-executable |tex| can not be used, |etex| or |pdftex| (version
-|1.40| or later) or ..., must
-be invoked.
+We have added, directly copied from packages by \textsc{Heiko Oberdiek}, a
+mechanism of re-load and \eTeX{} detection, especially for Plain \TeX{}. As
+\eTeX{} is required, the executable |tex| can not be used, |etex| or |pdftex|
+(version |1.40| or later) or ..., must be invoked. Each package refuses to
+be loaded twice and automatically loads the other components on which it has
+dependencies.
-Furthermore, \xintfracname, \xintbinhexname, and \xintgcdname check for the
-previous loading of \xintname, and will try to load it if this was not
-already done. Similarly \xintseriesname, \xintcfracname and \xintexprname do
-the necessary loading of \xintfracname. Each package will refuse to be
-loaded twice.
+% Furthermore, \xintfracname, \xintbinhexname, and \xintgcdname check for the
+% previous loading of \xintname, and will try to load it if this was not
+% already done. Similarly \xintseriesname, \xintcfracname and \xintexprname do
+% the necessary loading of \xintfracname.
Also initially inspired from the \textsc{Heiko Oberdiek} packages we have
included a complete catcode protection mecanism. The packages may be loaded in
@@ -2567,51 +2328,54 @@ after the loading of each one of the packages.
This is for the loading of the packages.
-For the actual use of the
-macros, note that when feeding them with negative numbers the
-minus sign must have category code other, as is standard. Similarly the
-slash used for inputting fractions must be of category other, as usual.
-And the square brackets also must be of category code other, if used on
-input. The `e' of the scientific notation must be of category code letter.
-All of that is relaxed when inside an
-|\xintexpr|-ession (but arguments to macros which have been inserted in
-the expression must obey the rules, as it is the macro and not the parser which
-will get the tokens). In an |\xintexpr|-ession, the scientific `e' may be `E'.
-
-The components of the \xintname bundle presuppose that the usual
-\csa{space} and \csa{empty} macros are pre-defined, which is the case in
-Plain \TeX{} as well as in \LaTeX.
+For the input of numbers as macro arguments the minus sign must have its
+standard category code (``\emph{other}''). Similarly the slash used for
+fractions must have its standard category code. And the square brackets, if made
+use of in the input, also must be of category code \emph{other}. The `e' of the
+scientific notation must be of category code letter.
-Lastly, the macros \csa{xintRelaxArray} (of \xintname) and
-\csa{xintTypesetEuclideAlgorithm} and
-\csa{xintTypesetBezoutAlgorithm} (of \xintgcdname) use
-\csa{loop}, both Plain and \LaTeX{} incarnations are
-compatible. \csa{xintTypesetBezoutAlgorithm} also uses the
-\csa{endgraf} macro.
+All of those requirements are relaxed for tokens parsed inside an
+|\xintexpr|-ession (but arguments to macros which have been inserted in the
+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.
+% comme je vais passer à \xintloop, plus de \loop, et plus besoin
+% de \endgraf (le \loop de Plain est short, contrairement à celui de LaTeX)
+%%Also,
+% the macros \csa{xintRelaxArray} (of \xinttoolsname) and
+% \csa{xintTypesetEuclideAlgorithm} and
+% \csa{xintTypesetBezoutAlgorithm} (of \xintgcdname) use
+% \csa{loop}, both Plain and \LaTeX{} incarnations are
+% compatible.
+% \csa{xintTypesetBezoutAlgorithm} from \xintgcdname makes use of the
+% \csa{endgraf} macro.
-\enlargethispage{\baselineskip}
+% \enlargethispage{\baselineskip}
\section{Installation}
+\begingroup
+\def\MacroFont {\ttfamily\baselineskip12pt\relax\catcode`\"=12 }
\dverb+@
-Run tex or latex on xint.dtx.
+If xint.ins is available "tex xint.ins" generates the style files
+(pre-existing files in the same repertory will be overwritten).
-This will extract the style files xint.sty, xintfrac.sty, xintexpr.sty,
-xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty (and xint.ins).
-
-Files with the same names and in the same repertory will be overwritten.
-The tex (not latex) run will stop with the complaint that it does not
-understand \NeedsTeXFormat, but the style files will already have been
-extracted by that time.
-
-Alternatively, run tex or latex on xint.ins if available.
+Else, either "latex xint.dtx" or "pdflatex xint.dtx" or "tex xint.dtx"
+will also generate the style files (and the xint.ins file). The tex
+run stops (contrarily to latex/pdflatex) with the complaint that it
+does not understand \NeedsTeXFormat, but the style files will already
+have been extracted by that time.
To get xint.pdf run pdflatex thrice on xint.dtx
+ xinttools.sty |
xint.sty |
xintfrac.sty |
- xintexpr.sty |
- xintbinhex.sty | --> TDS:tex/generic/xint/
+ xintexpr.sty | --> TDS:tex/generic/xint/
+ xintbinhex.sty |
xintgcd.sty |
xintseries.sty |
xintcfrac.sty |
@@ -2619,21 +2383,407 @@ To get xint.pdf run pdflatex thrice on xint.dtx
xint.pdf --> TDS:doc/generic/xint/
It may be necessary to then refresh the TeX installation filename
-database.
-+
+database.+
+\endgroup
+
+\section{The \csh{xintexpr} math parser (I)}
+\label{sec:exprsummary}
+
+% 27 octobre 2013 plus de problème avec &... il n'est plus actif (ouf)
+\xintexprSafeCatcodes
+\newcommand\formula[3]{\xinttheexpr round((#1 & (#2 | #3)) * (355/113*#3 -
+ (#1 - #2/2)^2), 8)\relax }
+\xintexprRestoreCatcodes
+
+
+Here is some random formula, defining a \LaTeX{} command with three parameters,
+\centeredline{\verb$\newcommand\formula[3]$}
+\centeredline{\verb${\xinttheexpr round((#1 & (#2 | #3)) * (355/113*#3 - (#1 -
+ #2/2)^2), 8) \relax}$}
+
+\smallskip
+
+Let |a=#1|, |b=#2|, |c=#3| be the parameters. The first term is the logical
+operation |a and (b or c)| where a number or fraction has truth value @1@ if it
+is non-zero, and @0@ otherwise. So here it means that |a| must be non-zero as
+well as |b| or |c|, for this first operand to be @1@, else the formula returns
+@0@. This multiplies a second term which is algebraic. Finally the result (where
+all intermediate computations are done \emph{exactly}) is rounded to a value
+with @8@ digits after the decimal mark, and printed.
+\centeredline{|\formula
+ {771.3/9.1}{1.51e2}{37.73} expands to|
+ \digitstt{\formula {771.3/9.1}{1.51e2}{37.73}}}
+
+\begingroup % 9 octobre pour une meilleure gestion de l'indentation
+\leftmargini 0pt
+\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
+ \labelwidth\parindent
+ \itemindent\labelwidth}%
+\item as everything gets expanded, the characters
+ \verb$+,-,*,/,^,!,&,|,?,:,<,>,=,(,)$ and the comma ($,$), which are
+ used in the
+ |infix| syntax, should not be active (for example if
+ they serve as shorthands for some language in the |Babel| system) at the time
+ of the expressions (if they are in use therein). The command
+ \csbxint{exprSafeCatcodes} resets these characters to their standard catcodes
+ and \csbxint{exprRestoreCatcodes} restores the status prevailing at the time
+ of the previous \csa{xintexprSafeCatcodes}.
+\item the formula may be input without |\xinttheexpr| through suitable
+ nesting of various
+ package macros. Here one could use:
+ \centeredline
+ {|\xintRound {8}{\xintMul {\xintAND {#1}{\xintOR {#2}{#3}}}{\xintSub |}
+ \centeredline
+ {| {\xintMul {355/113}{#3}}{\xintPow {\xintSub {#1}{\xintDiv {#2}{2}}}{2}}}}|}
+ with the inherent difficulty of keeping up with braces and everything...
+\item if such a formula is used thousands of times in a document (for plots?),
+ this could impact some parts of the \TeX{} program memory (for technical
+ reasons explained in \autoref{sec:expr}). So, a utility \csbxint{NewExpr}
+ is provided to do the work of translating an |\xintexpr|-ession with
+ parameters into a chain of macro evaluations.\footnote{As its makes some macro
+ definitions, it is not an expandable command. It does not need protection
+ against active characters as it does it itself.}
+ \centeredline{|\xintNewExpr\formula[3]|}
+ \centeredline{\verb${ round((#1 & (#2 | #3)) * (355/113*#3 - (#1 - #2/2)^2),
+ 8) }$}
+ one gets a command |\formula| with three parameters and meaning:
+
+\xintNewExpr\formula[3]
+{ round((#1 & (#2 | #3)) * (355/113*#3 - (#1 - #2/2)^2),
+ 8) }
+
+{\centering\ttfamily
+
+\meaning\formula
+
+}
+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 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}
+ \def\y {\xintexpr \x * \a \relax}|} where |\x| could have been set
+ up equivalently as {|\def\x {( \a + \b )}|} but the earlier method is
+ better than with parentheses, as it allows {|\xintthe\x|}.
+\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
+ rounding is applied to the final result only.
+\item there is also \csbxint{boolexpr}| ... \relax| and \csbxint{theboolexpr}|
+ ... \relax|. Same as regular expression but the final result is converted to
+ @1@
+ if it is not zero. See also \csbxint{ifboolexpr}
+ (\autoref{xintifboolexpr}) and the \hyperlink{item:bool}{discussion}
+ of the |bool| and |togl| functions in \autoref{sec:exprsummary}. Here is an
+ example:
+\begingroup
+\def\MacroFont {\ttfamily\parskip0pt \parindent 15pt \baselineskip 12pt \relax }
+\dverb!@
+\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}!%
+\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}}
+\item there is also \csbxint{floatexpr}| ... \relax| where the algebra is done
+ in
+ floating point approximation (also for each intermediate result). Use the
+ syntax
+ |\xintDigits:=N;| to set the precision. Default: @16@ digits.
+ \centeredline{|\xintthefloatexpr 2^100000\relax:| \digitstt{\xintthefloatexpr
+ 2^100000\relax }} The square-root operation can be used in |\xintexpr|, it
+ is computed as a float with the precision set by |\xintDigits| or by the
+ optional second argument: \centeredline{|\xinttheexpr sqrt(2,60)\relax|:}
+ \centeredline{\digitstt{\xinttheexpr sqrt(2,60)\relax }} Notice the |a/b[n]|
+ notation
+ (usually |/b| even if |b=1| gets printed; this is the exception) which is the
+ default format of the macros of the \xintfracname
+ package (hence of |\xintexpr|). To get a float format from the |\xintexpr| one
+ needs something more: \centeredline{|\xintFloat[60]{\xinttheexpr
+ sqrt(2,60)\relax}|:} \centeredline{\digitstt{\xintFloat[60]{\xinttheexpr
+ sqrt(2,60)\relax }}} The precision used by |\xintfloatexpr| must be set by
+ |\xintDigits|, it can not be passed as an option to |\xintfloatexpr|.
+ \centeredline{|\xintDigits:=48; \xintthefloatexpr 2^100000\relax|: }
+ \centeredline{\begingroup \xintDigits:=48;\digitstt{\xintthefloatexpr
+ 2^100000\relax}\endgroup} Floats are quickly indispensable when using the
+ power function (which can only have an integer exponent), as exact results
+ will easily have hundreds of digits.
+\endlist
+\endgroup
+
+\section{The \csh{xintexpr} math parser (II)}
+\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.
+
+Note that |2^-10| is perfectly accepted input, no need for parentheses. And
+|-2^-10^-5*3| does |(-((2^(-10))^(-5)))*3|.
+
+The characters used in the syntax should not have been made 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
+catcode tabulation, math superscript, or math subscript. This should cause no
+problem. As an alternative to |\xintexprSafeCatcodes| one may also use |\string|
+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
+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.
+
+Braces are also allowed in their usual r\^ole for arguments to macros (these
+arguments are thus not seen by the scanner), or to
+encapsulate \emph{arbitrary} completely expandable material which will not be
+parsed but completely expanded and \emph{must} return an integer or
+fraction possibly with decimal mark or in |A/B[N]| notation, but is not allowed
+to have the |e| or |E|. Braced material is not allowed to expand to some infix
+operator or parenthesis, it is allowed only in locations where the parser
+expects to find a number or fraction, possibly with decimal marks, but no |e|
+nor |E|.
+
+One may use sub-|\xintexpr|-expressions nested within a larger one. It is
+allowed to alternate |\xintfloatexpr|-essions with |\xintexpr|-essions. Do not
+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|.
+
+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.
+Next\footnote{in releases earlier than |1.09c|, these postfix operators took
+ precedence on a previous function name; the opposite now holds.} are the
+postfix
+operators: |!| for the factorial, |?| and |:| are two-fold way and three-fold
+way branching constructs. Then the |e| and |E| of the scientific notation, the
+power, multiplication/division, addition/subtraction, comparison, and logical
+operators. At the lowest level: commas then parentheses.
+
+
+The |\relax| at the end of an expression is absolutely \emph{mandatory}.
+
+ % 1.09c ajoute bool et togl
+ % 1.09a:
+ % reduce,
+ % sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm,
+ % max, min, sum, prd, add, mul, not, all, any, xor
+ % ?, !, if, ifsgn, ?, :.
+
+\newcommand\ctexttt [1]{\begingroup\color[named]{DarkOrchid}\ttfamily\bfseries
+ #1\endgroup}
+
+\begingroup % 9 octobre pour la gestion de l'indentation et couleurs
+\leftmargini 0pt
+\leftmarginii .5\parindent
+\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
+ \labelwidth\parindent
+ \itemindent\labelwidth}%
+\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}}.
+
+ |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
+ conditionals such as |\ifmmode|. For example:
+ \centeredline{|\xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO}|}
+ will return $\xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO}$
+ if executed in math mode (the computation is then $100-100=0$) and
+ \xintifboolexpr{25*4-if(bool(mmode),100,75)}{YES}{NO} if not (the
+ \ctexttt{if} conditional is described below; the
+ \csbxint{ifboolexpr} test automatically encapsulates its first
+ argument in an |\xintexpr| and follows the first branch if the
+ result is non-zero (see \autoref{xintifboolexpr})).
+
+ The alternative syntax |25*4-\ifmmode100\else75\fi| could have been used
+ here, the usefulness of |bool(name)| lies in the availability in the
+ |\xintexpr| syntax of the logic operators of conjunction |&|, inclusive
+ disjunction \verb+|+, negation |!| (or |not|), of the multi-operands
+ functions |all|, |any|, |xor|, of the two branching operators |if| and
+ |ifsgn| (see also |?| and |:|), which allow arbitrarily complicated
+ combinations of various |bool(name)|.
+
+ Similarly |togl(name)| returns @1@
+ if the \LaTeX{} package
+ \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
+ has been used to define a toggle named |name|, and this toggle is
+ currently set to |true|. Using |togl| in an |\xintexpr..\relax|
+ without having loaded
+ \href{http://www.ctan.org/pkg/etoolbox}{etoolbox} will result in an
+ error from |\iftoggle| being a non-defined macro. If |etoolbox| is
+ loaded but |togl| is used on a name not recognized by |etoolbox| the
+ error message will be of the type ``ERROR: Missing |\endcsname|
+ inserted.'', with further information saying that |\protect| should
+ have not been encountered (this |\protect| comes from the expansion
+ of the non-expandable |etoolbox| error message).
+
+ When |bool| or |togl| is encountered by the |\xintexpr| parser, the argument
+ enclosed in a parenthesis pair is expanded as usual from left to right,
+ token by token, until the closing parenthesis is found, but everything is
+ taken literally, no computations are performed. For example |togl(2+3)| will
+ test the value of a toggle declared to |etoolbox| with name |2+3|, and not
+ |5|. Spaces are gobbled in this process. It is impossible to use |togl| on
+ such names containing spaces, but |\iftoggle{name with spaces}{1}{0}| will
+ work, naturally, as its expansion will pre-empt the |\xintexpr| scanner.
+
+ There isn't in |\xintexpr...| a |test| function available analogous to the
+ |test{\ifsometest}| construct from the |etoolbox| package; but any
+ \emph{expandable} |\ifsometest| can be inserted directly in an
+ |\xintexpr|-ession as |\ifsometest10| (or |\ifsometest{1}{0}|), for example
+ |if(\ifsometest{1}{0},YES,NO)| (see the |if| operator below) works.
+
+ A straight |\ifsometest{YES}{NO}| would do the same more
+ efficiently, the point
+ of |\ifsometest10| is to allow arbitrary boolean combinations using
+ the (described later) \verb+&+ and \verb+|+ logic operators:
+ \verb+\ifsometest10 & \ifsomeothertest10 | \ifsomethirdtest10+, etc... |YES|
+ or |NO| above stand for material compatible with the
+ |\xintexpr| parser syntax.
+
+ See also \csbxint{ifboolexpr}, in this context.
+ \item[functions with one mandatory and a second optional argument]
+ \ctexttt{round, trunc,\\ float, sqrt}. For
+ example |round(2^9/3^5,12)=|\digitstt{\xinttheexpr round(2^9/3^5,12)\relax.}
+ The |sqrt| is available also in |\xintexpr|, not only in |\xintfloatexpr|.
+ The second optional argument is then the required float precision.
+ \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).
+ \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
+ ``branches'' are evaluated (they are not really branches but just numbers).
+ See also the |?| operator.
+ \item[the ifsgn conditional (threefold way)]
+ \ctexttt{ifsgn}|(cond,<0,=0,>0)| checks the sign of |cond| and
+ proceeds correspondingly. All three are evaluated. See also the |:|
+ operator.
+ \item[functions with an arbitrary number of arguments] \ctexttt{all,
+ any, xor, add (=sum), mul (=prd), max, min, gcd, lcm}: the last
+ two are integer-only and require the \xintgcdname package.
+ Currently, |and| and |or| are left undefined, and the package uses
+ the vocabulary |all| and |any|. They must have at least one
+ argument.
+ \end{description}
+\item The three postfix operators:
+ \begin{description}
+ \item[{\color[named]{DarkOrchid}!}] computes the factorial of an integer. |sqrt(36)!| evaluates to |6!|
+ (\digitstt{=\np{\xinttheexpr sqrt(36)!\relax}}) and not to the square root of
+ |36!| (\digitstt{$\approx$\np{\xintthefloatexpr sqrt(36!)\relax}}). This is
+ the exact
+ factorial even when used inside |\xintfloatexpr|.
+\item[{\color[named]{DarkOrchid}?}] is used as |(cond)?{yes}{no}|. It evaluates the (numerical) condition
+ (any non-zero value counts as |true|, zero counts as |false|). It then acts as
+ a macro with two mandatory arguments within braces (hence this escapes from
+ 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
+ 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
+ (3>2)?{5+(6}{7-(1}2^3)\relax| also works.} Differs thus from the |if|
+ conditional in two ways: the false branch is not at all computed, and the
+ number scanner is still active on exit, more digits may follow.
+\item[{\color[named]{DarkOrchid}:}] is used as |(cond):{<0}{=0}{>0}|. |cond| is anything, its sign is
+ evaluated (it is not necessary to use |sgn(cond):{<}{=}{>}|) and depending on
+ the sign the correct branch is un-braced, the two others are swallowed. The
+ un-braced branch will then be parsed as usual. Differs from the |ifsgn|
+ conditional as the two false branches are not evaluated and furthermore the
+ number scanner is still active on exit.
+ \centeredline{|\def\x{0.33}\def\y{1/3}|} \centeredline{|\xinttheexpr
+ (\x-\y):{sqrt}{0}{1/}(\y-\x)\relax|%
+ \digitstt{=\def\x{0.33}\def\y{1/3}\xinttheexpr
+ (\x-\y):{sqrt}{0}{1/}(\y-\x)\relax }}
+ \end{description}
+\item
+ \renewcommand{\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}
+ 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 |+|, |-|.
+\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 parentheses.
+\endlist
+\endgroup
-%\clearpage
\etocdepthtag.toc {commandsA}
\section{Commands of the \xinttoolsname package}
\label{sec:tools}
+\def\n{\string{N\string}}
+\def\m{\string{M\string}}
+\def\x{\string{x\string}}
+
These utilities used to be provided within the \xintname package; since |1.09g|
they have been moved to an independently usable package \xinttoolsname, which
-has none of the \xintname facilities regarding big numbers.
+has none of the \xintname facilities regarding big numbers. Whenever relevant
+release |1.09h| has made the macros |\long| so they accept |\par| tokens on
+input.
-The first listed are the completely expandable utilities up to \csbxint{iloop}.
+First the completely expandable utilities up to \csbxint{iloop}, then the non
+expandable utilities.
This section contains various concrete examples and ends with a
\hyperref[ssec:quicksort]{completely expandable implementation of the Quick Sort
@@ -2643,35 +2793,32 @@ This section contains various concrete examples and ends with a
\subsection{\csbh{xintReverseOrder}}\label{xintReverseOrder}
-\csa{xintReverseOrder}\marg{list} does not do any
-expansion of its argument and just reverses the order of the
-tokens in the \meta{list}.\footnote{the argument is not a token list variable,
- just a
- \meta{list} of tokens.} Brace pairs encountered are removed once and the
-enclosed
-material does not get reverted. Spaces are gobbled.
+\csa{xintReverseOrder}\marg{list}\etype{n} does not do any expansion of its
+argument and just reverses the order of the tokens in the \meta{list}. Braces
+are removed once and the enclosed material, now unbraced, does not get
+reverted. Unprotected spaces (of any character code) are gobbled.
\centeredline{|\xintReverseOrder{\xintDigitsOf\xintiPow {2}{100}\to\Stuff}|}
-\centeredline{gives:
- \ttfamily{\string\Stuff\string\to1002\string\xintiPow\string\xintDigitsOf}}
+\centeredline{gives:
+ \ttfamily{\string\Stuff\string\to1002\string\xintiPow\string\xintDigitsOf}}
\subsection{\csbh{xintRevWithBraces}}\label{xintRevWithBraces}
-{\small New in release |1.06|.\par}
+%{\small New in release |1.06|.\par}
+
\edef\X{\xintRevWithBraces{12345}}
\edef\y{\xintRevWithBraces\X}
\expandafter\def\expandafter\w\expandafter
{\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}}
-
-\csa{xintRevWithBraces}\marg{list} first does the expansion of its argument
-(which thus may be macro), then it reverses the order of the tokens, or braced
-material, it encounters, adding a pair of braces to each (thus, maintaining
-brace pairs already existing). Spaces (in-between external brace pairs) are
-gobbled. This macro is mainly thought out for use on a \meta{list} of such
-braced
-material; with such a list as argument the expansion will only hit against the
-first opening brace, hence do nothing, and the braced stuff may thus be macros
-one does not want to expand. \centeredline{|\edef\x{\xintRevWithBraces{12345}}|}
+%
+\csa{xintRevWithBraces}\marg{list}\etype{f} first does the \fexpan sion of its
+argument then it reverses the order of the tokens, or braced material, it
+encounters, adding a pair of braces to each (thus, maintaining brace pairs
+already existing). Spaces (in-between external brace pairs) are gobbled. This
+macro is mainly thought out for use on a \meta{list} of such braced material;
+with such a list as argument the \fexpan sion will only hit against the first
+opening brace, hence do nothing, and the braced stuff may thus be macros one
+does not want to expand. \centeredline{|\edef\x{\xintRevWithBraces{12345}}|}
\centeredline{|\meaning\x:|\ttfamily{\meaning\X}}
\centeredline{|\edef\y{\xintRevWithBraces\x}|}%
\centeredline{|\meaning\y:|\ttfamily{\meaning\y}} The examples above could be
@@ -2679,19 +2826,19 @@ defined with |\edef|'s because the braced material did not contain macros.
Alternatively: \centeredline{|\expandafter\def\expandafter\w\expandafter|}%
\centeredline{|{\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}}|}
\centeredline{|\meaning\w:|\ttfamily{\meaning\w}} The macro
-\csa{xintReverseWithBracesNoExpand}
-does the same job without the initial expansion of its argument.
+\csa{xintReverseWithBracesNoExpand}\etype{n} does the same job without the
+initial
+expansion of its argument.
\subsection{\csbh{xintLength}}\label{xintLength}
-\csa{xintLength}\marg{list} does not do \emph{any} expansion of its argument and just
-counts how many tokens there are (possibly none). So to use it to count things
-in the replacement text of a macro one should do
-|\expandafter\xintLength\expandafter{\x}|. One may also use it inside macros
-as |\xintLength{#1}|. Things enclosed in braces
-count as one. Blanks between tokens are not counted. See \csbxint{NthElt}|{0}|
-for a variant which first \fexpan ds its argument.
-\centeredline{|\xintLength {\xintiPow
+\csa{xintLength}\marg{list}\etype{n} does not do \emph{any} expansion of its
+argument and just counts how many tokens there are (possibly none). So to use it
+to count things in the replacement text of a macro one should do
+|\expandafter\xintLength\expandafter{\x}|. One may also use it inside macros as
+|\xintLength{#1}|. Things enclosed in braces count as one. Blanks between tokens
+are not counted. See \csbxint{NthElt}|{0}| for a variant which first \fexpan ds
+its argument. \centeredline{|\xintLength {\xintiPow
{2}{100}}|\digitstt{=\xintLength {\xintiPow{2}{100}}}}
\centeredline{${}\neq{}$|\xintLen {\xintiPow {2}{100}}|\digitstt{=\xintLen
{\xintiPow{2}{100}}}}
@@ -2701,9 +2848,10 @@ for a variant which first \fexpan ds its argument.
\label{xintZapLastSpaces}
\label{xintZapSpaces}
\label{xintZapSpacesB}
-{\small New with release |1.09f|.\par}
+%{\small New with release |1.09f|.\par}
-\csa{xintZapFirstSpaces}\marg{stuff} does not do \emph{any} expansion of its
+\csa{xintZapFirstSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion
+of its
argument, nor brace removal of any sort, nor does it alter \meta{stuff} in
anyway apart from stripping away all \emph{leading} spaces.
@@ -2715,7 +2863,7 @@ now be talking about. \emph{The essential points, naturally, are the complete
\TeX's input scanner already converts consecutive blanks into single space
tokens, but \csa{xintZapFirstSpaces} handles successfully also inputs with
consecutive multiple space tokens.
-However, it is assumed that \meta{stuff} does not contain (except in braced
+However, it is assumed that \meta{stuff} does not contain (except inside braced
sub-material) space tokens of character code distinct from @32@.
It expands in two steps, and if the goal is to apply it to the
@@ -2736,7 +2884,7 @@ have been stripped.
\medskip
-\noindent\csbxint{ZapLastSpaces}\marg{stuff} does not do \emph{any} expansion of
+\noindent\csbxint{ZapLastSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion of
its argument, nor brace removal of any sort, nor does it alter \meta{stuff} in
anyway apart from stripping away all \emph{ending} spaces. The same remarks as
for \csbxint{ZapFirstSpaces} apply.
@@ -2751,7 +2899,8 @@ for \csbxint{ZapFirstSpaces} apply.
\medskip
-\noindent\csbxint{ZapSpaces}\marg{stuff} does not do \emph{any} expansion of its
+\noindent\csbxint{ZapSpaces}\marg{stuff}\etype{n} does not do \emph{any}
+expansion of its
argument, nor brace removal of any sort, nor does it alter \meta{stuff} in
anyway apart from stripping away all \emph{leading} and all \emph{ending}
spaces. The same remarks as for \csbxint{ZapFirstSpaces} apply.
@@ -2765,7 +2914,8 @@ spaces. The same remarks as for \csbxint{ZapFirstSpaces} apply.
\medskip
-\noindent\csbxint{ZapSpacesB}\marg{stuff} does not do \emph{any} expansion of
+\noindent\csbxint{ZapSpacesB}\marg{stuff}\etype{n} does not do \emph{any}
+expansion of
its argument, nor does it alter \meta{stuff} in anyway apart from stripping away
all leading and all ending spaces and possibly removing one level of braces if
\meta{stuff} had the shape |<spaces>{braced}<spaces>|. The same remarks as for
@@ -2789,10 +2939,10 @@ all leading and all ending spaces and possibly removing one level of braces if
\label{xintCSVtoList}
\label{xintCSVtoListNoExpand}
-{\small New with release |1.06|. Starting with |1.09f|, \fbox{\emph{removes
- spaces around commas}!}\par}
+% {\small New with release |1.06|. Starting with |1.09f|, \fbox{\emph{removes
+% spaces around commas}!}\par}
-\csa{xintCSVtoList}|{a,b,c...,z}| returns |{a}{b}{c}...{z}|. A \emph{list} is by
+\csa{xintCSVtoList}|{a,b,c...,z}|\etype{f} returns |{a}{b}{c}...{z}|. A \emph{list} is by
convention in this manual simply a succession of tokens, where each braced thing
will count as one item (``items'' are defined according to the rules of \TeX{}
for fetching undelimited parameters of a macro, which are exactly the same rules
@@ -2806,7 +2956,8 @@ converts it into a `\TeX{} list of braced items'. The argument to
\hyperref[sec:expansions]{\fexpan ded}. Hence the item before the first comma,
if it is itself a macro, will be expanded which may or may not be a good thing.
A space inserted at the start of the first item serves to stop that expansion
-(and disappear). The macro \csbxint{CSVtoListNoExpand} does the same job without
+(and disappears). The macro \csbxint{CSVtoListNoExpand}\etype{n} does the same
+job without
the initial expansion of the list argument.
Apart from that no expansion of the items is done and the list items may thus be
@@ -2903,26 +3054,35 @@ may have direct use: \centeredline{|\xintCSVtoListNoExpand
%
Again these spaces are an artefact from the use in the source of the document of
\csa{meaning} (or rather here, \csa{detokenize}) to display the result of using
-\csa{xintCSVtoListNoExpand} (which is done for real). The original non-stripping
-macro is available as \csa{xintCSVtoListNonStripped}. There is also
-\csa{xintCSVtoListNonStrippedNoExpand}.
+\csa{xintCSVtoListNoExpand} (which is done for real in this document
+source).
+
+For the similar conversion from comma separated list to braced items list, but
+without removal of spaces around the commas, there is
+\csa{xintCSVtoListNonStripped}\etype{f} and
+\csa{xintCSVtoListNonStrippedNoExpand}\etype{n}.
\endgroup
\subsection{\csbh{xintNthElt}}\label{xintNthElt}
-{\small New in release |1.06|. With |1.09b| negative indices count from the tail.\par}
+% {\small New in release |1.06|. With |1.09b| negative indices count from the tail.\par}
\def\macro #1{\the\numexpr 9-#1\relax}
-\csa{xintNthElt\x}\marg{list} gets (expandably) the |x|th element of the
-\meta{list}, which may be a macro: the list argument is first expanded. The
-seeked element is returned with one pair of braces removed (if initially
-present).
-\centeredline{|\xintNthElt {3}{{agh}\u{zzz}\v{Z}}| is
- \texttt{\xintNthElt {3}{{agh}\u{zzz}\v{Z}}}}\centeredline{|\xintNthElt
- {37}{\xintFac {100}}|\digitstt{=\xintNthElt {37}{\xintFac {100}}} is the
- thirty-seventh digit of @100!@.} \centeredline{|\xintNthElt {10}{\xintFtoCv
+\csa{xintNthElt\x}\marg{list}\etype{\numx f} gets (expandably) the |x|th braced
+item of the \meta{list}. An unbraced item token will be returned as is. The list
+itself may be a macro which is first \fexpan ded. \centeredline{|\xintNthElt
+ {3}{{agh}\u{zzz}\v{Z}}| is \texttt{\xintNthElt {3}{{agh}\u{zzz}\v{Z}}}}
+\centeredline{|\xintNthElt {3}{{agh}\u{{zzz}}\v{Z}}| is
+ \texttt{\expandafter\expandafter\expandafter
+ \detokenize\expandafter\expandafter\expandafter {\xintNthElt
+ {3}{{agh}\u{{zzz}}\v{Z}}}}} \centeredline{|\xintNthElt
+ {2}{{agh}\u{{zzz}}\v{Z}}| is \texttt{\expandafter\expandafter\expandafter
+ \detokenize\expandafter\expandafter\expandafter {\xintNthElt
+ {2}{{agh}\u{{zzz}}\v{Z}}}}} \centeredline{|\xintNthElt {37}{\xintFac
+ {100}}|\digitstt{=\xintNthElt {37}{\xintFac {100}}} is the thirty-seventh
+ digit of @100!@.} \centeredline{|\xintNthElt {10}{\xintFtoCv
{566827/208524}}|\digitstt{=\xintNthElt {10}{\xintFtoCv {566827/208524}}}}
is the tenth convergent of @566827/208524@ (uses \xintcfracname package).
\centeredline{|\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
@@ -2943,10 +3103,8 @@ If |x<0|, the macro returns the \texttt{|x|}th element from the end of the list.
{-5}{{{agh}}\u{zzz}\v{Z}}}}}
-The macro
-\csa{xintNthEltNoExpand} does the same job but without first expanding the
-list argument: |\xintNthEltNoExpand {-4}{\u\v\w T\x\y\z}|
-is
+The macro \csa{xintNthEltNoExpand}\etype{\numx n} does the same job but without first
+expanding the list argument: |\xintNthEltNoExpand {-4}{\u\v\w T\x\y\z}| is
\xintNthEltNoExpand {-4}{\a\b\c\u\v\w T\x\y\z}.
In cases where |x| is larger (in absolute value) than the length of the list
@@ -2954,48 +3112,49 @@ then |\xintNthElt| returns nothing.
\subsection{\csbh{xintListWithSep}}\label{xintListWithSep}
-{\small New with release |1.04|.\par}
+%{\small New with release |1.04|.\par}
\def\macro #1{\the\numexpr 9-#1\relax}
-\csa{xintListWithSep}|{sep}|\marg{list} inserts the given separator |sep|
-in-between all elements of the given list: this separator may be a macro but
-will not be expanded. The second argument also may be itself a macro: it is
-expanded as usual, \emph{i.e.} fully for what comes first. Applying
-\csa{xintListWithSep} removes one level of top braces to each list constituent.
-An empty input gives an empty output, a singleton gives a singleton, the
-separator is used starting with at least two elements. Using an empty separator
-has the net effect of removing one-level of brace pairs from each ot the
-top-level braced material constituting the \meta{list} (in such cases the new
-list may thus be longer than the original).
+\csa{xintListWithSep}|{sep}|\marg{list}\etype{nf} inserts the given separator
+|sep| in-between all items of the given list of braced items: this separator may
+be a macro (or multiple tokens) but will not be expanded. The second argument
+also may be itself a macro: it is \fexpan ded. Applying \csa{xintListWithSep}
+removes the braces from the list items (for example |{1}{2}{3}| turns into
+\digitstt{\xintListWithSep,{123}} via |\xintListWithSep{,}{{1}{2}{3}}|). An
+empty input gives an empty output, a singleton gives a singleton, the separator
+is used starting with at least two elements. Using an empty separator has the
+net effect of unbracing the braced items constituting the \meta{list} (in such
+cases the new list may thus be longer than the original).
\centeredline{|\xintListWithSep{:}{\xintFac
{20}}|\digitstt{=\xintListWithSep{:}{\xintFac {20}}}}
-The macro \csa{xintListWithSepNoExpand} does the same
+The macro \csa{xintListWithSepNoExpand}\etype{nn} does the same
job without the initial expansion.
\subsection{\csbh{xintApply}}\label{xintApply}
-{\small New with release |1.04|.\par}
+%{\small New with release |1.04|.\par}
\def\macro #1{\the\numexpr 9-#1\relax}
-\csa{xintApply}|{\macro}|\marg{list} expandably applies the one parameter
-command |\macro| to each item in the \meta{list} given as second argument and
-return a new list with these outputs: each item is given one after the other as
-parameter to |\macro| which is expanded (as usual, \emph{i.e.} fully for what
-comes first), and the result is braced. On output, a new list with these braced
-results (if |\macro| is defined to start with a space, the space will be gobbled
-and the |\macro| will not be executed; |\macro|
-is allowed to have its own arguments, the list items will serve as last
-arguments to the macro.).
+\csa{xintApply}|{\macro}|\marg{list}\etype{ff} expandably applies the one
+parameter command |\macro| to each item in the \meta{list} given as second
+argument and returns a new list with these outputs: each item is given one after
+the other as parameter to |\macro| which is expanded at that time (as usual,
+\emph{i.e.} fully for what comes first), the results are braced and output
+together as a succession of braced items (if |\macro| is defined to start with a
+space, the space will be gobbled and the |\macro| will not be expanded; it is
+allowed to have its own arguments, the list items serve as last arguments to
+|\macro|). Hence |\xintApply{\macro}{{1}{2}{3}}| returns
+|{\macro{1}}{\macro{2}}{\macro{3}}| where all instances of |\macro| have been
+already \fexpan ded.
Being expandable, |\xintApply| is useful for example inside alignments where
implicit groups make standard loops constructs usually fail. In such situation
it is often not wished that the new list elements be braced, see
-\csbxint{ApplyUnbraced}. The |\macro| is not necessarily compatible with
-expansion only contexts: |\xintApply| will try to expand it, but the expansion
-may remain partial.
+\csbxint{ApplyUnbraced}. The |\macro| does not have to be expandable:
+|\xintApply| will try to expand it, the expansion may remain partial.
The \meta{list} may
itself be some macro expanding (in the previously described way) to the list of
@@ -3005,44 +3164,45 @@ the result of applying |\macro| on it. \centeredline{|\def\macro #1{\the\numexpr
9-#1\relax}|} \centeredline{|\xintApply\macro{\xintFac
{20}}|\digitstt{=\xintApply\macro{\xintFac {20}}}}
-The macro
-\csa{xintApplyNoExpand} does the same job without the first initial expansion
-which gave the \meta{list} of braced tokens to which |\macro| is applied.
+The macro \csa{xintApplyNoExpand}\etype{fn} does the same job without the first
+initial expansion which gave the \meta{list} of braced tokens to which |\macro|
+is applied.
\subsection{\csbh{xintApplyUnbraced}}\label{xintApplyUnbraced}
-{\small New in release |1.06b|.\par}
+%{\small New in release |1.06b|.\par}
\def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}}
\xintApplyUnbraced\macro{{elta}{eltb}{eltc}}
-\csa{xintApplyUnbraced}|{\macro}|\marg{list} is like \csbxint{Apply}. The
-difference is that after having expanded its list argument, and applied
-|\macro| in turn to each item from the list, it reassembles the
-outputs without enclosing them in braces. The net effect is the same as doing
-\centeredline{|\xintListWithSep {}{\xintApply {\macro}|\marg{list}|}|}
-This is useful for preparing a macro which will itself define some other macros
-or make assignments.
-\lverb|&
-$ $ $ $ \def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}}$\
-$null$ $ $ $ \xintApplyUnbraced\macro{{elta}{eltb}{eltc}}$\
-$null$ $ $ $ \meaning\myselfelta:$ $ $meaning$myselfelta$\
-$null$ $ $ $ \meaning\myselfeltb:$ $ $meaning$myselfeltb$\
-$null$ $ $ $ \meaning\myselfeltc:$ $ $meaning$myselfeltc
-|
-The macro \csa{xintApplyUnbracedNoExpand} does the same job without the first
-initial expansion which gave the \meta{list} of braced tokens to which
-|\macro|
-is applied.
+\csa{xintApplyUnbraced}|{\macro}|\marg{list}\etype{ff} is like \csbxint{Apply}.
+The difference is that after having expanded its list argument, and applied
+|\macro| in turn to each item from the list, it reassembles the outputs without
+enclosing them in braces. The net effect is the same as doing
+\centeredline{|\xintListWithSep {}{\xintApply {\macro}|\marg{list}|}|} This is
+useful for preparing a macro which will itself define some other macros or make
+assignments, as the scope will not be limited by brace pairs.
+%
+\dverb|@
+ \def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}}
+ \xintApplyUnbraced\macro{{elta}{eltb}{eltc}}
+ \meaning\myselfelta: "meaning"myselfelta
+ \meaning\myselfeltb: "meaning"myselfeltb
+ \meaning\myselfeltc: "meaning"myselfeltc|
+
+%
+The macro \csa{xintApplyUnbracedNoExpand}\etype{fn} does the same job without
+the first initial expansion which gave the \meta{list} of braced tokens to which
+|\macro| is applied.
\subsection{\csbh{xintSeq}}\label{xintSeq}
-{\small New with release |1.09c|.\par}
+%{\small New with release |1.09c|.\par}
-\csa{xintSeq}|[d]{x}{y}| generates expandably |{x}{x+d}...| up to and possibly
-including |{y}| if |d>0| or down to and including |{y}| if |d<0|. Naturally
-|{y}| is omitted if |y-x| is not a multiple of |d|. If |d=0| the macro returns
-|{x}|. If |y-x| and |d| have opposite signs, the macro returns nothing. If the
-optional argument |d| is omitted it is taken to be the sign of |y-x|.
+\csa{xintSeq}|[d]{x}{y}|\etype{{{\upshape[\numx]}}\numx\numx} generates expandably |{x}{x+d}...| up to and
+possibly including |{y}| if |d>0| or down to and including |{y}| if |d<0|.
+Naturally |{y}| is omitted if |y-x| is not a multiple of |d|. If |d=0| the macro
+returns |{x}|. If |y-x| and |d| have opposite signs, the macro returns nothing.
+If the optional argument |d| is omitted it is taken to be the sign of |y-x|.
The current implementation is only for (short) integers; possibly, a future
@@ -3057,7 +3217,7 @@ or arithmetic with such things.
plus 1pt minus 1pt }{\xintSeq {12}{-25}}|}
\noindent\digitstt{\xintListWithSep{,\hskip2pt plus 1pt minus 1pt }{\xintSeq
{12}{-25}}}
-\centeredline{|\xintiSum{\xintSeq [3]{1}{1000}}|\digitstt{=\xintiSum{\xintSeq [3]{1}{1000}}}}
+\centeredline{|\xintiiSum{\xintSeq [3]{1}{1000}}|\digitstt{=\xintiiSum{\xintSeq [3]{1}{1000}}}}
\textbf{Important:} for reasons of efficiency, this macro, when not given the
optional argument |d|, works backwards, leaving in the token stream the already
@@ -3070,9 +3230,14 @@ However, when given the optional argument |d| (which may be @+1@ or
@-1@), the macro proceeds differently and does not put stress on the input stack
(but is significantly slower for sequences with thousands of integers,
especially if they are somewhat big). For
-example: |\xintSeq [1]{0}{5000}| works and |\xintiSum{\xintSeq [1]{0}{5000}}|
+example: |\xintSeq [1]{0}{5000}| works and |\xintiiSum{\xintSeq [1]{0}{5000}}|
returns the correct value \digitstt{\xintHalf{\xintiMul{5000}{5001}}}.
+The produced integers are with explicit litteral digits, so if used in |\ifnum|
+or other tests they should be properly terminated\footnote{a \csa{space} will
+ stop the \TeX{} scanning of a number and be gobbled in the process,
+ maintaining expandability if this is required; the \csa{relax} stops the
+ scanning but is not gobbled and remains afterwards as a token.}.
\subsection{Completely expandable prime test}\label{ssec:primesI}
@@ -3080,9 +3245,9 @@ Let us now construct a completely expandable macro which returns @1@ if its
given input is prime and @0@ if not:
\dverb|@
\def\remainder #1#2{\the\numexpr #1-(#1/#2)*#2\relax }
-\def\IsPrime #1{\xintANDof
- {\xintApply {\remainder {#1}}{\xintSeq {2}{\xintiSqrt{#1}}}}}
-|
+\def\IsPrime #1%
+ {\xintANDof {\xintApply {\remainder {#1}}{\xintSeq {2}{\xintiSqrt{#1}}}}}|
+
This uses \csbxint{iSqrt} and assumes its input is at least @5@. Rather than
\xintname's own \csbxint{Rem} we used a quicker |\numexpr| expression as we
are dealing with short integers. Also we used \csbxint{ANDof} which will
@@ -3097,8 +3262,7 @@ silly with an even input, ok, let's enhance it to detect an even input:
}%
}
{\xintifEq {#1}{2}{1}{0}}%
- }
-|
+ }|
We used the \xintname provided expandable tests (on big integers or fractions)
to maintain the complete expandability of |\IsPrime| in a strong
@@ -3120,8 +3284,7 @@ The macro becomes:
{\ifnumodd {#1}
{\xintANDof % odd case
{\xintApply {\remainder {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}}
- {\ifnumequal {#1}{2}{1}{0}}}
-|
+ {\ifnumequal {#1}{2}{1}{0}}}|
In the odd case however we have to assume the integer is at least @7@, as
|\xintSeq| generates an empty list if |#1=3| or |5|, and |\xintANDof| returns
@@ -3130,9 +3293,9 @@ letting it work on only @0@'s and @1@'s. We could use:
%
\dverb|@
\def\IsNotDivisibleBy #1#2%
- {\ifnum\numexpr #1-(#1/#2)*#2=0 \expandafter 0\else \expandafter1\fi}
-|%
-%
+ {\ifnum\numexpr #1-(#1/#2)*#2=0 \expandafter 0\else \expandafter1\fi}|%
+
+\noindent
where the |\expandafter|'s are crucial for this macro to be completely
expandable in the restricted sense mentioned in \autoref{fn:fullexp} which we
want for applying confidently \csbxint{ANDof}. Anyhow, now that we have loaded
@@ -3151,8 +3314,8 @@ Let us enhance our prime macro to work also on the small primes:
{ \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}%
}}% END OF THE ODD BRANCH
{\ifnumequal {#1}{2}{1}{0}}% END OF THE EVEN BRANCH
-}
-|%
+}|
+
The
input is still assumed positive. There is a deliberate blank before
\csa{IsNotDivisibleBy} to use this
@@ -3200,9 +3363,8 @@ macro would be more elegant here.
\\
\hline
\end{tabular}
-There are \arabic{primecount} prime numbers up to 1000.
-?%
-%
+There are \arabic{primecount} prime numbers up to 1000.?
+
We had to be careful to use the optional argument |[1]| to \csbxint{Seq} in
this last row to not generate a decreasing sequence from |1| to |0|, but an
empty sequence when the row turns out to already have all its cells.
@@ -3252,13 +3414,14 @@ empty sequence when the row turns out to already have all its cells.
\label{xintloop}
\label{xintbreakloop}
\label{xintbreakloopanddo}
-\label{xintloopskiptonext}
-{\small New with release |1.09g|.\par}
+\label{xintloopskiptonext}
+% {\small New with release |1.09g|. Release |1.09h|
+% makes them long macros.\par}
-|\xintloop|\meta{stuff}|\iftest ... \repeat| is an expandable loop compatible
-with nesting. If a sub-loop is to be used all the material from the start and up
-to the complete subloop inclusive should be braced; these braces will be removed
-and do not create a group.
+|\xintloop|\meta{stuff}|\if<test>...\repeat|\etype{} is an expandable loop
+compatible with nesting. If a sub-loop is to be used all the material from the
+start and up to the complete subloop inclusive should be braced; these braces
+will be removed and do not create a group.
As this loop and \csbxint{iloop} will primarily be of interest to experienced
\TeX{} macro programmers, my description will assume that the user is
@@ -3413,10 +3576,10 @@ illustrate use of the nesting capabilities of |\xintloop|.\footnote{for a more
\def\B@entry #1#2{\the\numexpr #1-#2\relax}% not pre-computed...
\makeatother
\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D
-\setlength{\unitlength}{1cm}
+\setlength{\unitlength}{1cm}%
% le picture de LaTeX est tout de même assez génial!
\begin{picture}(0,0)
-\put(6,10){\vtop{\hsize8cm
+\put(5,11){\vtop{\hsize8cm
\[\begin{pmatrix}
\A11&\A12&\A13&\A14\\
\A21&\A22&\A23&\A24\\
@@ -3462,10 +3625,10 @@ illustrate use of the nesting capabilities of |\xintloop|.\footnote{for a more
\F21&\F22&\F23\\
\F31&\F32&\F33
\end{pmatrix}\]}}
-\end{picture}
+\end{picture}\par
\endgroup
-\vskip-\baselineskip
+\kern-2\baselineskip
\subsection{\csbh{xintiloop}, \csbh{xintiloopindex}, \csbh{xintouteriloopindex},
\csbh{xintbreakiloop}, \csbh{xintbreakiloopanddo}, \csbh{xintiloopskiptonext},
@@ -3477,21 +3640,20 @@ illustrate use of the nesting capabilities of |\xintloop|.\footnote{for a more
\label{xintiloopskipandredo}
\label{xintiloopindex}
\label{xintouteriloopindex}
-{\small New with release |1.09g|.\par}
+%{\small New with release |1.09g|.\par}
-\csa{xintiloop}|[start+delta]|\meta{stuff}|\iftest ... \repeat| is a completely
-expandable nestable loop having access via \csbxint{iloopindex} to the integer
-index of the iteration, with starting value |start| (which may be a |\count|)
-and increment |delta| (\emph{id.}). Currently |[start+delta]| is a
+\csa{xintiloop}|[start+delta]|\meta{stuff}|\if<test> ... \repeat|\etype{} is a
+completely expandable nestable loop having access via \csbxint{iloopindex} to
+the integer index of the iteration, with starting value |start| (which may be a
+|\count|) and increment |delta| (\emph{id.}). Currently |[start+delta]| is a
\emph{mandatory argument}, it is an error to omit it; perhaps a future release
will make it optional with default |1+1|. A space after the closing square
bracket is not significant, it will be ignored. Spaces inside the square
brackets will also be ignored as the two arguments are first given to a
-|\numexpr...\relax|.
+|\numexpr...\relax|. Empty lines and explicit |\par| tokens are accepted.
As with \csbxint{loop}, this tool will mostly be of interest to advanced users.
-As is the case for its variant, it is declared short and can not handle directly
-|\par| tokens or empty lines. For nesting, one puts inside braces all the
+For nesting, one puts inside braces all the
material from the start (immediately after |[start+delta]|) and up to and
inclusive of the inner loop, these braces will be removed and do not create a
loop. In case of nesting, \csbxint{outeriloopindex} gives access to the index of
@@ -3635,7 +3797,7 @@ To spare some fractions of a second in the compilation time of this document
\def\MacroFont{\ttfamily\baselineskip12pt\relax \catcode`\" 12 }
\dverb|@
\tabskip1ex
-\halign {&\hfil\strut#\hfil\cr\noalign{\hrule}
+\halign {\hfil\strut#\hfil&&\hfil#\hfil\cr\noalign{\hrule}
\xintiloop ["7FFFFFE0+1]
\expandafter\bf\xintiloopindex &
\ifnum\xintiloopindex="7FFFFFED
@@ -3720,7 +3882,7 @@ The reason for some strange looking expressions is to avoid arithmetic overflow.
\begin{figure*}[ht!]
\centering\phantomsection\label{floatfactorize}
\tabskip1ex
-\centeredline{\vbox{\halign {&\hfil\strut#\hfil\cr\noalign{\hrule}
+\centeredline{\vbox{\halign {\hfil\strut#\hfil&&\hfil#\hfil\cr\noalign{\hrule}
\xintiloop ["7FFFFFE0+1]
\expandafter\bf\xintiloopindex &
\ifnum\xintiloopindex="7FFFFFED
@@ -3742,16 +3904,16 @@ The reason for some strange looking expressions is to avoid arithmetic overflow.
\subsection{\csbh{xintApplyInline}}\label{xintApplyInline}
-{\small |1.09a|, enhanced in |1.09c| to be usable within alignments, and
- corrected in |1.09d| for a problem related to spaces at the very end of the
- list parameter.\par}
+% {\small |1.09a|, enhanced in |1.09c| to be usable within alignments, and
+% corrected in |1.09d| for a problem related to spaces at the very end of the
+% list parameter.\par}
-\csa{xintApplyInline}|{\macro}|\marg{list} works non expandably. It
-applies the one-parameter |\macro| to the first element of the expanded
-list (|\macro| may have itself some arguments, the list item will be
-appended as last argument), and is then re-inserted in the input stream
-after the tokens resulting from this first expansion of |\macro|. The
-next item is then handled.
+\csa{xintApplyInline}|{\macro}|\marg{list}\ntype{o{\lowast f}} works non
+expandably. It applies the one-parameter |\macro| to the first element of the
+expanded list (|\macro| may have itself some arguments, the list item will be
+appended as last argument), and is then re-inserted in the input stream after
+the tokens resulting from this first expansion of |\macro|. The next item is
+then handled.
This is to be used in situations where one needs to do some repetitive
things. It is not expandable and can not be completely expanded inside a
@@ -3761,8 +3923,7 @@ macro definition, to prepare material for later execution, contrarily to what
\dverb|@
\def\Macro #1{\advance\cnta #1 , \the\cnta}
\cnta 0
-0\xintApplyInline\Macro {3141592653}.
-|
+0\xintApplyInline\Macro {3141592653}.|
\def\Macro #1{\advance\cnta #1 , \the\cnta}
\cnta 0
Output: 0\xintApplyInline\Macro {3141592653}.
@@ -3796,8 +3957,7 @@ was obtained from the following input:
$N$ & $N^2$ & $N^3$ \\ \hline
\def\Row #1{ #1 & \xintiSqr {#1} & \xintiPow {#1}{3} \\ \hline }%
\xintApplyInline \Row {\xintCSVtoList{17,28,39,50,61}}
-\end{tabular}
-|%
+\end{tabular}|%
Despite the fact that the first encountered tabulation character in the first
row close a group and thus erases |\Row| from \TeX's memory, |\xintApplyInline|
knows how to deal with this.
@@ -3819,8 +3979,7 @@ One may nest various |\xintApplyInline|'s. For example (see the
\begin{tabular}{ccccccccccc}
&0&1&2&3&4&5&6&7&8&9\\ \hline
\xintApplyInline \Row {0123456789}
-\end{tabular}
-|
+\end{tabular}|
\begin{figure*}[ht!]
\centering\phantomsection\label{float}
\def\Row #1{#1:\xintApplyInline {\Item {#1}}{0123456789}\\ }%
@@ -3829,7 +3988,8 @@ One may nest various |\xintApplyInline|'s. For example (see the
\xintApplyInline \Row {0123456789}
\end{tabular}}
\end{figure*}
-\smallskip
+
+
One could not move the definition of |\Item| inside the tabular,
as it would get lost after the first |&|. But this
works:
@@ -3852,25 +4012,28 @@ this does not work:\par
But see \csbxint{For}.
\subsection{\csbh{xintFor}, \csbh{xintFor*}}\label{xintFor}\label{xintFor*}
-{\small New with |1.09c|. Extended in |1.09e| (\csbxint{BreakFor},
- \csbxint{integers}, \dots). |1.09f| version handles all macro parameters up to
- |#9| and removes spaces around commas.\par}
-
-\csbxint{For} is a new kind of for loop. Rather than using macros for
-encapsulating list items, its behavior is more like a macro with
-parameters: |#1|, |#2|, \dots, |#9| are used to represent the items
-for up to nine levels of nested loops. Here is an example:
-\dverb|@
+% {\small New with |1.09c|. Extended in |1.09e| (\csbxint{BreakFor},
+% \csbxint{integers}, \dots). |1.09f| version handles all macro parameters up
+% to
+% |#9| and removes spaces around commas.\par}
+
+\csbxint{For}\ntype{on} is a new kind of for loop. Rather than using macros
+for encapsulating list items, its behavior is more like a macro with parameters:
+|#1|, |#2|, \dots, |#9| are used to represent the items for up to nine levels of
+nested loops. Here is an example:
+%
+\dverb|@
\xintFor #9 in {1,2,3} \do {%
\xintFor #1 in {4,5,6} \do {%
\xintFor #3 in {7,8,9} \do {%
\xintFor #2 in {10,11,12} \do {%
- $$#9\times#1\times#3\times#2=\xintiPrd{{#1}{#2}{#3}{#9}}$$}}}}
+ $$#9\times#1\times#3\times#2=\xintiiPrd{{#1}{#2}{#3}{#9}}$$}}}}
|%
This example illustrates that one does not have to use |#1| as the first one:
the order is arbitrary. But each level of nesting should have its specific macro
parameter. Nine levels of nesting is presumably overkill, but I did not know
-where it was reasonable to stop.
+where it was reasonable to stop. |\par| tokens are accepted in both the comma
+separated list and the replacement text.
\begin{framed}
A macro |\macro| whose definition uses internally an \csbxint{For} loop may be
@@ -3888,14 +4051,16 @@ The spaces between the various declarative elements are all optional;
furthermore spaces around the commas or at the start and end of the list
argument are allowed, they will be removed. If an item must contain itself
commas, it should be braced to prevent these commas from being misinterpreted as
-list separator. The braces will be removed during processing. The list
-argument may be a macro |\MyList| which then does not need to be braced (except
-if it has some arguments, as then the whole thing \emph{must} be braced). It
-will be expanded (only once) to reveal its comma separated items for processing.
+list separator. These braces will be removed during processing. The list
+argument may be a macro |\MyList| expanding in one step to the comma separated
+list (if it has no arguments, it does not have to be braced). It
+will be expanded (only once) to reveal its comma separated items for processing,
+comma separated items will not be expanded before being fed into the replacement
+text as |#1|, or |#2|, etc\dots, only leading and trailing spaces are removed.
-A starred variant \csbxint{For*} deals with lists of braced items, rather than
-comma separated items. It has also a distinct expansion policy, which is
-detailed below.
+A starred variant \csbxint{For*}\ntype{{\lowast f}n} deals with lists of braced
+items, rather than comma separated items. It has also a distinct expansion
+policy, which is detailed below.
Contrarily to what happens in loops where the item is represented by a macro,
here it is truly exactly as when defining (in \LaTeX{}) a ``command'' with
@@ -3957,15 +4122,8 @@ by commas). \centeredline{|\xintFor* #1 in {\xintSeq [+2]{-7}{+2}}\do {stuff
with #1}|} will have |#1=-7,-5,-3,-1, and 1|. The |#1| as issued from the
list produced by \csbxint{Seq} is the litteral representation as would be
produced by |\arabic| on a \LaTeX{} counter, it is not a count register. When
-used in |\ifnum| tests or other contexts where \TeX{} looks for a number it is
-recommended to use |#1\space|\footnote{the \csa{space} will stop the \TeX{}
- scanning of a number and be gobbled in the process; the \csa{relax} stops the
- scanning but is not gobbled. Or one may do
- \csa{numexpr}\texttt{\#1}\csa{relax}, and then the \csa{relax} is gobbled.},
-or |#1\relax| if expandability of the process is not an issue (for example if
-the iterated commands do an |\edef| using such a test, |\relax| is not a good
-choice as it will be kept in the complete expansion if it is in the true branch
-of the conditional, whereas |\space| will disappear).
+used in |\ifnum| tests or other contexts where \TeX{} looks for a number it
+should thus be postfixed with |\relax| or |\space|.
When nesting \csa{xintFor*} loops, using \csa{xintSeq} in the inner loops is
inefficient, as the arithmetic sequence will be re-created each time. A more
@@ -4052,12 +4210,13 @@ finds, gobbling spaces).
\subsection{\csbh{xintifForFirst}, \csbh{xintifForLast}}
\label{xintifForFirst}\label{xintifForLast}
-{\small New in |1.09e|.\par}
+% {\small New in |1.09e|.\par}
-\csbxint{ifForFirst}\,\texttt{\{YES branch\}\{NO branch\}}
+\csbxint{ifForFirst}\,\texttt{\{YES branch\}\{NO branch\}}\etype{nn}
and \csbxint{ifForLast}\,\texttt{\{YES
- branch\}\hskip 0pt plus 0.2em \{NO branch\}} execute the |YES| or |NO| branch
+ branch\}\hskip 0pt plus 0.2em \{NO branch\}}\etype{nn} execute the |YES| or
+|NO| branch
if the
\csbxint{For}
or \csbxint{For*} loop is currently in its first, respectively last, iteration.
@@ -4073,7 +4232,7 @@ replacement text of the loop to update it.
\subsection{ \csbh{xintBreakFor}, \csbh{xintBreakForAndDo}}
\label{xintBreakFor}\label{xintBreakForAndDo}
-{\small New in |1.09e|.\par}
+%{\small New in |1.09e|.\par}
One may immediately terminate an \csbxint{For} or \csbxint{For*} loop with
\csbxint{BreakFor}. As the criterion for breaking will be decided on a
@@ -4098,7 +4257,7 @@ in the next section which is devoted to ``forever'' loops.
\subsection{\csbh{xintintegers}, \csbh{xintdimensions}, \csbh{xintrationals}}
\label{xintegers}\label{xintintegers}
\label{xintdimensions}\label{xintrationals}
-{\small New in |1.09e|.\par}
+%{\small New in |1.09e|.\par}
If the list argument to \csbxint{For} (or \csbxint{For*}, both are equivalent in
this context) is \csbxint{integers} (equivalently \csbxint{egers}) or more
@@ -4110,7 +4269,7 @@ generally \csbxint{integers}|[||start|\allowbreak|+|\allowbreak|delta||]|
|#1| (or |#2|, \dots, |#9|) will run through the arithmetic sequence of (short)
integers with initial value |start| and increment |delta| (default values:
|start=1|, |delta=1|; if the optional argument is present it must contains both
-of them, and they may be explicit integers, or macros or count registers. The
+of them, and they may be explicit integers, or macros or count registers). The
|#1| (or |#2|, \dots, |#9|) will stand for |\numexpr <opt sign><digits>\relax|,
and the litteral representation as a string of digits can thus be obtained as
\fbox{\csa{the\#1}} or |\number#1|. Such a |#1| can be used in an |\ifnum| test
@@ -4416,12 +4575,12 @@ been put in a \hyperref[primes]{float}, which appears
\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|
- version handles better spaces and admits all (consecutive) macro
- parameters.\par}
+% {\small New in |1.09c|. The \csa{xintifForFirst}
+% |1.09e| mechanism was missing and has been added for |1.09f|. The |1.09f|
+% version handles better spaces and admits all (consecutive) macro
+% parameters.\par}
-The syntax is illustrated in this
+The syntax\ntype{on} is illustrated in this
example. The notation is the usual one for |n|-uples, with parentheses and
commas. Spaces around commas and parentheses are ignored.
%
@@ -4447,7 +4606,8 @@ commas. Spaces around commas and parentheses are ignored.
is done on the input syntax, |#1#3| or similar all end up in errors).
One can nest with \csbxint{For}, for disjoint sets of macro parameters. There is
also \csa{xintForthree} (from |#1#2#3| to |#7#8#9|) and \csa{xintForfour} (from
-|#1#2#3#4| to |#6#7#8#9|).
+|#1#2#3#4| to |#6#7#8#9|). |\par| tokens are accepted in both the comma
+separated list and the replacement text.
% These three macros |\xintForpair|, |\xintForthree| and |\xintForfour| are to
% be considered in experimental status, and may be removed, replaced or
@@ -4456,39 +4616,43 @@ also \csa{xintForthree} (from |#1#2#3| to |#7#8#9|) and \csa{xintForfour} (from
\subsection{\csbh{xintAssign}}\label{xintAssign}
\csa{xintAssign}\meta{braced things}\csa{to}%
-\meta{as many cs as they are things} defines (without checking if
+\meta{as many cs as they are things}\ntype{{(f$\to$\lowast x)}{\lowast N}}
+defines (without checking if
something gets overwritten) the control sequences on the right of
\csa{to} to be the complete expansions of the successive braced things found on
-the left of \csa{to}.
+the left of \csa{to}. It is not expandable.
-A `full' expansion is first applied first to the
-material in front of \csa{xintAssign}, which may thus be a macro expanding to a
-list of braced items.
+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
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| as the
-complete expansion of the material between \csa{xintAssign} and \csa{to}.
+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{|\meaning\Q: |\digitstt{\meaning\Q}, |\meaning\R:|
\digitstt{\meaning\R}} \centeredline{|\xintAssign\xintiPow
{7}{13}\to\SevenToThePowerThirteen|}
\centeredline{|\SevenToThePowerThirteen|\digitstt{=\SevenToThePowerThirteen}}
-\centeredline{(same as |\edef\SevenToThePowerThirteen{\xintiPow {7}{13}}|)} This
-macro uses various \csa{edef}'s, thus is incompatible with expansion-only
-contexts.
+\centeredline{(same as |\edef\SevenToThePowerThirteen{\xintiPow {7}{13}}|)}
-\subsection{\csbh{xintAssignArray}}\label{xintAssignArray}
-{\small Changed in release |1.06| to let the defined macro pass its
- argument through a |\numexpr...\relax|.\par}
+% 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}
\xintAssignArray\xintBezout {1000}{113}\to\Bez
-\csa{xintAssignArray}\meta{braced things}\csa{to}\csa{myArray} first expands
+\csa{xintAssignArray}\meta{braced
+ things}\csa{to}\csa{myArray}\ntype{{(f$\to$\lowast x)}N} first expands
fully what comes immediately after |\xintAssignArray| and expects to find a list
of braced things |{A}{B}...| (or tokens). It then defines \csa{myArray} as a
macro with one parameter, such that \csa{myArray\x} expands to give the
@@ -4507,9 +4671,9 @@ This macro is incompatible with expansion-only contexts.
\subsection{\csbh{xintRelaxArray}}\label{xintRelaxArray}
-\csa{xintRelaxArray}\csa{myArray} sets to \csa{relax} all
+\csa{xintRelaxArray}\csa{myArray}\ntype{N} (globally) sets to \csa{relax} all
macros which were defined by the previous \csa{xintAssignArray}
-with \csa{myArray} as array name.
+with \csa{myArray} as array macro.
\subsection{The Quick Sort algorithm illustrated}\label{ssec:quicksort}
@@ -4848,50 +5012,65 @@ then one should use the following variants:
\endgroup
It is possible to modify this code to let it do \csa{QSonestep} repeatedly and
-stop automatically when the sort is finished.
+stop automatically when the sort is finished.\footnote{\url{http://tex.stackexchange.com/a/142634/4686}}
+
\section{Commands of the \xintname package}
\label{sec:xint}
-\def\n{\string{N\string}}
-\def\m{\string{M\string}}
-\def\x{\string{x\string}}
-In the description of the macros \texttt{\n} (or also \texttt{\m}) stands
-(except if mentioned otherwise) for a (long) number within braces or for a
-control sequence possibly within braces and \hyperref[sec:expansions]{\fexpan
- ding} to such a number
-(without the braces!), or for material within braces which \fexpan ds to such
-a number, as is acceptable on input by the \csbxint{Num} macro: a sequence of
-plus and minus signs, followed by some string of zeros, followed by digits.
-
-The letter \texttt{x} stands for something which will be inserted in-between a
-|\numexpr| and a |\relax|. It will thus be completely expanded and must give an
-integer obeying the \TeX{} bounds. Thus, it may be for example a count register,
-or itself a \csa{numexpr} expression, or just a number written explicitely with
-digits or something like |4*\count 255 + 17|, etc...
+In the description of the macros \texttt{\n} and \texttt{\m} stand for (long)
+numbers within braces or for a control sequence possibly within braces and
+\hyperref[sec:expansions]{\fexpan ding} to such a number (without the braces!),
+or for material within braces which \fexpan ds to such a number, as is
+acceptable on input by the \csbxint{Num} macro: a sequence of plus and minus
+signs, followed by some string of zeros, followed by digits. The margin
+annotation for such an argument which is parsed by \csbxint{Num} is
+\textcolor[named]{PineGreen}{\Numf}. Sometimes however only a
+\textcolor[named]{PineGreen}{\emph{f}} symbol appears in the margin, signaling
+that the input will not be parsed via \csbxint{Num}.
+
+The letter \texttt{x} (with margin annotation
+\textcolor[named]{PineGreen}{\numx}) stands for something which will be inserted
+in-between a |\numexpr| and a |\relax|. It will thus be completely expanded and
+must give an integer obeying the \TeX{} bounds. Thus, it may be for example a
+count register, or itself a \csa{numexpr} expression, or just a number written
+explicitely with digits or something like |4*\count 255 + 17|, etc...
For the rules regarding direct use of count registers or \csa{numexpr}
expression, in the argument to the package macros, see the
-\hyperlink{useofcount}{use of count section} in \autoref{sec:inputs}.
-
-Some of these macros are extended by \xintfracname to accept fractions on input,
-and, generally, to output a fraction. But this means that additions,
-subtractions, multiplications output fractions and not integers; to guarantee
-the integer format on output when the inputs are integers, the original
-integer-only macros \csa{xintAdd}, \csa{xintSub}, \csa{xintMul} remain available
-under the names \csa{xintiAdd}, \csa{xintiSub}, \csa{xintiMul}. Even the
-original integer-only macros may now accept fractions on input as long as they
-are integers in disguise; they still produce on output integers without any
-forward slash mark nor trailing |[n]|. On the other hand macros such as
-|\xintAdd| will output fractions |A/B[n]|, with |B| present even if its value is
-one. To remove this unit denominator and convert the |[n]| part into explicit
-zeros, one has \csbxint{Num} (if one is certain to deal with an integer; see
-also \csbxint{PRaw}). This is mandatory when the computation result is fetched
-into a context where \TeX{} expects a number (assuming it does not exceed
-@2^31@). See the also the \xintfracname \hyperref[sec:frac]{documentation}
-for more information on how macros of \xintname are modified after loading
-\xintfracname (or \xintexprname).
+\hyperref[sec:useofcount]{Use of count} section.
+
+Some of these macros are extended by \xintfracname to accept fractions
+on input, and, generally, to output a fraction. But this means that
+additions, subtractions, multiplications output in fraction format; to
+guarantee the integer format on output when the inputs are integers, the
+original integer-only macros \csa{xintAdd}, \csa{xintSub},
+\csa{xintMul}, etc\dots are available under the names \csa{xintiAdd},
+\csa{xintiSub}, \csa{xintiMul}, \dots, also when \xintfracname is not
+loaded. Even these originally integer-only macros will accept fractions
+on input if \xintfracname is loaded as long as they are integers in
+disguise; they produce on output integers without any forward
+slash mark nor trailing |[n]|.
+
+But |\xintAdd| will output fractions |A/B[n]|, with |B| present even if its
+value is one. See the \xintfracname \hyperref[sec:frac]{documentation} for
+additional information.
+
+% on how macros of \xintname are modified after loading
+% \xintfracname (or \xintexprname).
+
+
+% \xintfracname will extend \csbxint{Num} for it to remove this unit
+% denominator and convert the |[n]| part into explicit zeros; see also
+% \csbxint{PRaw} which does not make the assumption that the fraction is an
+% integer in disguise.
+
+% This is mandatory when the computation result is fetched
+% into a context where \TeX{} expects a number (assuming it does not exceed
+% @2^31@). See the also the \xintfracname \hyperref[sec:frac]{documentation} for
+% more information on how macros of \xintname are modified after loading
+% \xintfracname (or \xintexprname).
% Package \xintname also provides some general macro programming or token
@@ -4902,7 +5081,7 @@ for more information on how macros of \xintname are modified after loading
\subsection{\csbh{xintRev}} \label{xintRev}
-\csa{xintRev\n} will revert the order of the digits of the number,
+\csa{xintRev\n}\etype{f} will revert the order of the digits of the number,
keeping the optional sign. Leading zeros
resulting from the operation are not removed (see the
\csa{xintNum} macro for this). This macro and all other
@@ -4914,18 +5093,17 @@ macros dealing with numbers first expand `fully' their arguments.
\subsection{\csbh{xintLen}}\label{xintiLen}
-\csa{xintLen\n} returns the length of the number, not counting the sign.
-\centeredline{|\xintLen{-12345678901234567890123456789}|\digitstt
+\csa{xintLen\n}\etype{\Numf} returns the length of the number, not counting the
+sign. \centeredline{|\xintLen{-12345678901234567890123456789}|\digitstt
{=\xintLen{-12345678901234567890123456789}}} Extended by \xintfracname to
-fractions: the length of |A/B[n]| is the length of |A| plus the length of |B|
-plus the absolute value of |n| and minus one (an integer input as |N| is
-internally represented in a form equivalent to |N/1[0]| so the minus one means
-that the extended \csa{xintLen}
-behaves the same as the original for integers).
-\centeredline{|\xintLen{-1e3/5.425}|\digitstt
- {=\xintLen{-1e3/5.425}}}
-The length is computed on the |A/B[n]| which would have been returned by
-\csbxint{Raw}: |\xintRaw {-1e3/5.425}|\digitstt{=\xintRaw {-1e3/5.425}}.
+fractions: the length of |A/B[n]| is the length of |A| plus the
+length of |B| plus the absolute value of |n| and minus one (an integer input as
+|N| is internally represented in a form equivalent to |N/1[0]| so the minus one
+means that the extended \csa{xintLen} behaves the same as the original for
+integers). \centeredline{|\xintLen{-1e3/5.425}|\digitstt
+ {=\xintLen{-1e3/5.425}}} The length is computed on the |A/B[n]| which would
+have been returned by \csbxint{Raw}: |\xintRaw {-1e3/5.425}|\digitstt{=\xintRaw
+ {-1e3/5.425}}.
Let's point out that the whole thing should sum up to
less than circa @2^{31}@, but this is a bit theoretical.
@@ -4935,7 +5113,7 @@ tokens (or rather braced groups), more generally.
\subsection{\csbh{xintDigitsOf}}\label{xintDigitsOf}
-This is a synonym for \csbxint{AssignArray}, to be used to define
+This is a synonym for \csbxint{AssignArray},\ntype{fN} to be used to define
an array giving all the digits of a given (positive, else the minus sign will
be treated as first item) number.
\begingroup\xintDigitsOf\xintiPow {7}{500}\to\digits
@@ -4947,200 +5125,221 @@ be treated as first item) number.
\subsection{\csbh{xintNum}}\label{xintiNum}
-\csa{xintNum\n} removes chains of plus or minus signs, followed by zeros.
-\centeredline{|\xintNum{+---++----+--000000000367941789479}|\digitstt
+\csa{xintNum\n}\etype{f} removes chains of plus or minus signs, followed by
+zeros. \centeredline{|\xintNum{+---++----+--000000000367941789479}|\digitstt
{=\xintNum{+---++----+--000000000367941789479}}} Extended by \xintfracname to
accept also a fraction on input, as long as it reduces to an integer after
division of the numerator by the denominator.
\centeredline{|\xintNum{123.48/-0.03}|\digitstt{=\xintNum{123.48/-0.03}}}
-\subsection{\csbh{xintSgn}}\label{xintiSgn}
+\subsection{\csbh{xintSgn}}\label{xintiiSgn}
-\csa{xintSgn\n} returns 1 if the number is positive, 0 if it is
+\csa{xintSgn\n}\etype{\Numf} returns 1 if the number is positive, 0 if it is
zero and -1 if it is negative. Extended by \xintfracname to fractions.
+\csbxint{iiSgn} skips the \csbxint{Num} overhead.\etype{f}
-\subsection{\csbh{xintOpp}}\label{xintiOpp}
+\subsection{\csbh{xintOpp}}\label{xintiOpp}\label{xintiiOpp}
+
+\csa{xintOpp\n}\etype{\Numf} return the opposite |-N| of the number |N|.
+Extended by \xintfracname to fractions. \csa{xintiOpp} is a synonym not modified
+by \xintfracname\footnote{here, and in all similar instances, this means that
+ the macro remains integer-only both on input and output, but it does accept on
+ input a fraction which in disguise is a (big) integer.}, and
+\csa{xintiiOpp} skips the \csbxint{Num} overhead.\etype{f}
+
+
+\subsection{\csbh{xintAbs}}\label{xintiAbs}\label{xintiiAbs}
+
+\csa{xintAbs\n}\etype{\Numf} returns the absolute value of the number. Extended
+by \xintfracname to fractions. \csa{xintiAbs} is a synonym not modified
+by \xintfracname, and \csa{xintiiAbs} skips the \csbxint{Num} overhead.\etype{f}
-\csa{xintOpp\n} returns the opposite |-N| of the number |N|.
-Extended by \xintfracname to fractions.
+\subsection{\csbh{xintAdd}}\label{xintiAdd}\label{xintiiAdd}
-\subsection{\csbh{xintAbs}}\label{xintiAbs}
+\csa{xintAdd\n\m}\etype{\Numf\Numf} returns the sum of the two numbers. Extended
+by \xintfracname to fractions. \csa{xintiAdd} is a synonym not modified by
+\xintfracname, and \csa{xintiiAdd} skips the \csbxint{Num} overhead.\etype{ff}
-\csa{xintAbs\n} returns the absolute value of the number. Extended
-by \xintfracname to fractions.
-\subsection{\csbh{xintAdd}}\label{xintiAdd}
-\csa{xintAdd\n\m} returns the sum of the two numbers. Extended by
-\xintfracname to fractions.
+\subsection{\csbh{xintSub}}\label{xintiSub}\label{xintiiSub}
-\subsection{\csbh{xintSub}}\label{xintiSub}
+\csa{xintSub\n\m}\etype{\Numf\Numf} returns the difference |N-M|. Extended
+by \xintfracname to fractions. \csa{xintiSub} is a synonym not modified by
+\xintfracname, and \csa{xintiiSub} skips the \csbxint{Num} overhead.\etype{ff}
-\csa{xintSub\n\m} returns the difference |N-M|. Extended by
-\xintfracname to fractions.
\subsection{\csbh{xintCmp}}\label{xintiCmp}
-\csa{xintCmp\n\m} returns 1 if |N>M|, 0 if |N=M|, and -1 if |N<M|.
-Extended by \xintfracname to fractions.
+\csa{xintCmp\n\m}\etype{\Numf\Numf} returns 1 if |N>M|, 0 if |N=M|, and -1
+if |N<M|. Extended by \xintfracname to fractions.
\subsection{\csbh{xintEq}}\label{xintEq}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintEq\n\m} returns 1 if |N=M|, 0 otherwise.
-Extended by \xintfracname to fractions.
+\csa{xintEq\n\m}\etype{\Numf\Numf} returns 1 if |N=M|, 0 otherwise. Extended
+by \xintfracname to fractions.
\subsection{\csbh{xintGt}}\label{xintGt}
-{\small New with release |1.09a|.\par}
-
-% attention dans la doc du 9 octobre j'avais écrit \geq au lieu de >
+%{\small New with release |1.09a|.\par}
-\csa{xintGt\n\m} returns 1 if |N|$>$|M|, 0 otherwise.
+\csa{xintGt\n\m}\etype{\Numf\Numf} returns 1 if |N|$>$|M|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintLt}}\label{xintLt}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-% attention dans la doc du 9 octobre j'avais écrit \leq au lieu de <
-
-\csa{xintLt\n\m} returns 1 if |N|$<$|M|, 0 otherwise.
+\csa{xintLt\n\m}\etype{\Numf\Numf} returns 1 if |N|$<$|M|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintIsZero}}\label{xintIsZero}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintIsZero\n} returns 1 if |N=0|, 0 otherwise.
+\csa{xintIsZero\n}\etype{\Numf} returns 1 if |N=0|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintNot}}\label{xintNot}
-{\small New with release |1.09c|.\par}
+%{\small New with release |1.09c|.\par}
-\csa{xintNot} is a synonym for \csa{xintIsZero}.
+\csa{xintNot}\etype{\Numf} is a synonym for \csa{xintIsZero}.
\subsection{\csbh{xintIsNotZero}}\label{xintIsNotZero}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintIsNotZero\n} returns 1 if |N<>0|, 0 otherwise.
+\csa{xintIsNotZero\n}\etype{\Numf} returns 1 if |N<>0|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintIsOne}}\label{xintIsOne}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintIsOne\n} returns 1 if |N=1|, 0 otherwise.
+\csa{xintIsOne\n}\etype{\Numf} returns 1 if |N=1|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintAND}}\label{xintAND}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintAND\n\m} returns 1 if |N<>0| and |M<>0| and zero otherwise.
- Extended by \xintfracname to fractions.
+\csa{xintAND\n\m}\etype{\Numf\Numf} returns 1 if |N<>0| and |M<>0| and zero
+otherwise. Extended by \xintfracname to fractions.
\subsection{\csbh{xintOR}}\label{xintOR}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintOR\n\m} returns 1 if |N<>0| or |M<>0| and zero otherwise.
- Extended by \xintfracname to fractions.
+\csa{xintOR\n\m}\etype{\Numf\Numf} returns 1 if |N<>0| or |M<>0| and zero
+otherwise. Extended by \xintfracname to fractions.
\subsection{\csbh{xintXOR}}\label{xintXOR}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintXOR\n\m} returns 1 if exactly one of |N| or |M| is true (i.e.
-non-zero).
- Extended by \xintfracname to fractions.
+\csa{xintXOR\n\m}\etype{\Numf\Numf} returns 1 if exactly one of |N| or |M|
+is true (i.e. non-zero). Extended by \xintfracname to fractions.
\subsection{\csbh{xintANDof}}\label{xintANDof}
-{\small New with release |1.09a|.\par}
-
-\csa{xintANDof}|{{a}{b}{c}...}| returns 1 if all are true (i.e. non
-zero) and zero otherwise. The list argument
-may be a macro, it (or rather its first token) is \fexpan ded first (each
-item also is \fexpan ded). Extended by \xintfracname to fractions.
+%{\small New with release |1.09a|.\par}
+\csa{xintANDof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if all
+are true (i.e. non zero) and zero otherwise. The list argument may be a macro,
+it (or rather its first token) is \fexpan ded first (each item also is \fexpan
+ded). Extended by \xintfracname to fractions.
\subsection{\csbh{xintORof}}\label{xintORof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintORof}|{{a}{b}{c}...}| returns 1 if at least one is true
-(i.e. does not vanish). The list argument
-may be a macro, it is \fexpan ded first. Extended by \xintfracname to fractions.
+\csa{xintORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if at
+least one is true (i.e. does not vanish). The list argument may be a macro, it
+is \fexpan ded first. Extended by \xintfracname to fractions.
\subsection{\csbh{xintXORof}}\label{xintXORof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintXORof}|{{a}{b}{c}...}| returns 1 if an odd number of them are
-true (i.e. does not vanish). The list argument may be a macro, it is
-\fexpan ded first. Extended by \xintfracname to fractions.
+\csa{xintXORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if an odd
+number of them are true (i.e. does not vanish). The list argument may be a
+macro, it is \fexpan ded first. Extended by \xintfracname to fractions.
\subsection{\csbh{xintGeq}}\label{xintiGeq}
-\csa{xintGeq\n\m} returns 1 if the \emph{absolute value} of the first number is
-at least equal to the absolute value of the second number. If \verb+|N|<|M|+ it
-returns 0. Extended by \xintfracname to fractions (starting with release
-|1.07|). Please note that the macro compares \emph{absolute values}.
+\csa{xintGeq\n\m}\etype{\Numf\Numf} returns 1 if the \emph{absolute value}
+of the first number is at least equal to the absolute value of the second
+number. If \verb+|N|<|M|+ it returns 0. Extended by \xintfracname to fractions.
+%(starting with release |1.07|)
+Please note that the macro compares
+\emph{absolute values}.
\subsection{\csbh{xintMax}}\label{xintiMax}
-\csa{xintMax\n\m} returns the largest of the two in the sense of the order
-structure on the relative integers (\emph{i.e.} the right-most number if they
-are put on a line with positive numbers on the right): |\xintiMax
-{-5}{-6}|\digitstt{=\xintiMax{-5}{-6}}. Extended by \xintfracname to fractions.
+\csa{xintMax\n\m}\etype{\Numf\Numf} returns the largest of the two in the
+sense of the order structure on the relative integers (\emph{i.e.} the
+right-most number if they are put on a line with positive numbers on the right):
+|\xintiMax {-5}{-6}|\digitstt{=\xintiMax{-5}{-6}}. Extended by \xintfracname to
+fractions. \csa{xintiMax} is a synonym not modified by
+\xintfracname.
\subsection{\csbh{xintMaxof}}\label{xintMaxof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintMaxof}|{{a}{b}{c}...}| returns the maximum. The list argument
-may be a macro, it is \fexpan ded first. Extended by \xintfracname to
-fractions.
+\csa{xintMaxof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the maximum.
+The list argument may be a macro, it is \fexpan ded first. Extended by
+\xintfracname to fractions. \csa{xintiMaxof} is a
+synonym not modified by \xintfracname.
\subsection{\csbh{xintMin}}\label{xintiMin}
-\csa{xintMin\n\m} returns the smallest of the two in the sense of the order
-structure on the relative integers (\emph{i.e.} the left-most number if they are
-put on a line with positive numbers on the right): |\xintiMin
+\csa{xintMin\n\m}\etype{\Numf\Numf} returns the smallest of the two in the
+sense of the order structure on the relative integers (\emph{i.e.} the left-most
+number if they are put on a line with positive numbers on the right): |\xintiMin
{-5}{-6}|\digitstt{=\xintiMin{-5}{-6}}. Extended by \xintfracname to fractions.
+\csa{xintiMin} is a synonym not modified by
+\xintfracname.
\subsection{\csbh{xintMinof}}\label{xintMinof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintMinof}|{{a}{b}{c}...}| returns the minimum. The list argument
-may be a macro, it is \fexpan ded first. Extended by \xintfracname to
-fractions.
+\csa{xintMinof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the minimum.
+The list argument may be a macro, it is \fexpan ded first. Extended by
+\xintfracname to fractions. \csa{xintiMinof} is a synonym not modified by
+\xintfracname.
-\subsection{\csbh{xintSum}}\label{xintiSum}
-\csa{xintSum}\marg{braced things} after expanding its argument
-expects to find a sequence of tokens (or braced material).
-Each is expanded (with the usual meaning), and the sum of all these numbers is
-returned.
+\subsection{\csbh{xintSum}}\label{xintiiSum}
+
+\csa{xintSum}\marg{braced things}\etype{{\lowast f}} after expanding its
+argument expects to find a sequence of tokens (or braced material). Each is
+expanded (with the usual meaning), and the sum of all these numbers is returned.
+Note: the summands are \emph{not} parsed by \csbxint{Num}.
+
+\csa{xintSum} is
+extended by \xintfracname to fractions. The original, which accepts (after
+\fexpan sion) only (big) integers in the strict format and produces a (big)
+integer is available as \csa{xintiiSum}, also with \xintfracname loaded.
+
\centeredline{%
- \csa{xintiSum}|{{123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}}|%
- \digitstt{=\xintiSum{{123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
-\centeredline{\csa{xintiSum}|{1234567890}|\digitstt{=\xintiSum{1234567890}}}
-An empty sum is no error and returns zero: |\xintiSum
-{}|\digitstt{=\xintiSum {}}. A sum with only one
-term returns that number: |\xintiSum {{-1234}}|\digitstt{=\xintiSum
- {{-1234}}}. Attention that |\xintiSum {-1234}| is not legal input
-and will make the \TeX{} run fail. On the other hand |\xintiSum
-{1234}|\digitstt{=\xintiSum{1234}}. Extended by \xintfracname
-to fractions.
+ \csa{xintiiSum}|{{123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}}|%
+ \digitstt{=\xintiiSum{{123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
+\centeredline{\csa{xintiiSum}|{1234567890}|\digitstt{=\xintiiSum{1234567890}}}
+An empty sum is no error and returns zero: |\xintiiSum
+{}|\digitstt{=\xintiiSum {}}. A sum with only one term returns that
+number: |\xintiiSum {{-1234}}|\digitstt{=\xintiiSum {{-1234}}}.
+Attention that |\xintiiSum {-1234}| is not legal input and will make the
+\TeX{} run fail. On the other hand |\xintiiSum
+{1234}|\digitstt{=\xintiiSum{1234}}. Extended by \xintfracname to
+fractions.
% retiré de la doc le 22 octobre 2013
-% \subsection{\csbh{xintSumExpr}}\label{xintiSumExpr}
+% \subsection{\csbh{xintSumExpr}}\label{xintiiSumExpr}
% \csa{xintSumExpr}\meta{braced things}\csa{relax} is to what \csa{xintSum}
% expands. The argument is then expanded (with the usual meaning) and should give
% a list of braced quantities or macros, each one will be expanded in turn.
% \centeredline{%
-% \csa{xintiSumExpr}| {123}{-98763450}|%
+% \csa{xintiiSumExpr}| {123}{-98763450}|%
% |{\xintFac{7}}{\xintiMul{3347}{591}}\relax|\digitstt{=%
-% \xintiSumExpr {123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}\relax}}
+% \xintiiSumExpr {123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}\relax}}
% Note: I am not so happy with the name which seems to suggest that the
% |+| sign should be used instead of braces. Perhaps this will change
@@ -5148,49 +5347,60 @@ to fractions.
% Extended by \xintfracname to fractions.
-\subsection{\csbh{xintMul}}\label{xintiMul}
-{\small Modified in release |1.03|.\par}
+\subsection{\csbh{xintMul}}\label{xintiMul}\label{xintiiMul}
+%{\small Modified in release |1.03|.\par}
-\csa{xintMul\n\m} returns the product of the two numbers. Starting
-with release |1.03| of \xintname, the macro checks the lengths of
-the two numbers and then activates its algorithm with the best (or
-at least, hoped-so) choice of which one to put first. This makes
-the macro a bit slower for numbers up to 50 digits, but may give
-substantial speed gain when one of the number has 100 digits or more.
+\csa{xintMul\n\m}\etype{\Numf\Numf} returns the product of the two numbers.
+% Starting with release |1.03| of \xintname, the macro checks the lengths of the
+% two numbers and then activates its algorithm with the best (or at least,
+% hoped-so) choice of which one to put first. This makes the macro a bit slower
+% for numbers up to 50 digits, but may give substantial speed gain when one of the
+% number has 100 digits or more.
Extended by \xintfracname to fractions.
+\csa{xintiMul} is a synonym not modified by \xintfracname, and
+\csa{xintiiMul} skips the \csbxint{Num} overhead.\etype{ff}
-\subsection{\csbh{xintSqr}}\label{xintiSqr}
+\subsection{\csbh{xintSqr}}\label{xintiSqr}\label{xintiiSqr}
-\csa{xintSqr\n} returns the square. Extended by \xintfracname to fractions.
+\csa{xintSqr\n}\etype{\Numf} returns the square. Extended by \xintfracname to
+fractions. \csa{xintiSqr} is a synonym not modified by
+\xintfracname, and \csa{xintiiSqr} skips the \csbxint{Num} overhead.\etype{f}
-\subsection{\csbh{xintPrd}}\label{xintiPrd}
-\csa{xintPrd}\marg{braced things} after expanding its argument expects to find a
-sequence of tokens (or braced material). Each is expanded (with the usual
-meaning), and the product of all these numbers is returned.
-\centeredline{%
- \csa{xintiPrd}|{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}|%
- \digitstt{=%
- \xintiPrd{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
-\centeredline{\csa{xintiPrd}|{123456789123456789}|\digitstt{=%
- \xintiPrd{123456789123456789}}} An empty product is no error and returns 1:
-|\xintiPrd {}|\digitstt{=\xintiPrd {}}. A product reduced to a single term returns
-this number: |\xintiPrd {{-1234}}|\digitstt{=\xintiPrd {{-1234}}}. Attention that
-|\xintiPrd {-1234}| is not legal input and will make the \TeX{} compilation
-fail. On the other hand |\xintiPrd {1234}|\digitstt{=\xintiPrd {1234}}.
-\centeredline{$\displaystyle 2^{200}3^{100}7^{100}$} \centeredline{|=\xintiPrd
- {{\xintiPow {2}{200}}{\xintiPow {3}{100}}{\xintiPow {7}{100}}}|}
-\digitstt{=\printnumber{\xintNum {\xinttheexpr 2^200*3^100*7^100\relax }}}
-Extended by \xintfracname to fractions.
+\subsection{\csbh{xintPrd}}\label{xintiiPrd}
+\csa{xintPrd}\marg{braced things}\etype{{\lowast f}} after expanding its
+argument expects to find a sequence of (of braced items or unbraced
+single tokens). Each is
+expanded (with the usual meaning), and the product of all these numbers is
+returned. Note: the operands are \emph{not} parsed by \csbxint{Num}.
+\centeredline{%
+ \csa{xintiiPrd}|{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}|%
+ \digitstt{=%
+ \xintiiPrd{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
+\centeredline{\csa{xintiiPrd}|{123456789123456789}|\digitstt{=%
+ \xintiiPrd{123456789123456789}}} An empty product is no error and returns 1:
+|\xintiiPrd {}|\digitstt{=\xintiiPrd {}}. A product reduced to a single term
+returns this number: |\xintiiPrd {{-1234}}|\digitstt{=\xintiiPrd {{-1234}}}.
+Attention that |\xintiiPrd {-1234}| is not legal input and will make the \TeX{}
+compilation fail. On the other hand |\xintiiPrd {1234}|\digitstt{=\xintiiPrd
+ {1234}}. \centeredline{$\displaystyle 2^{200}3^{100}7^{100}$}
+\centeredline{|=\xintiiPrd {{\xintiPow {2}{200}}{\xintiPow {3}{100}}{\xintiPow
+ {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 |}
+Extended by \xintfracname to fractions. The original, which accepts (after
+\fexpan sion) only (big) integers in the strict format and produces a (big)
+integer is available as \csbxint{iiPrd}, also with \xintfracname loaded.
+
+
% I temporarily remove mention of \xintPrdExpr from the documentation; I
% really dislike the name now.
-% \subsection{\csbh{xintPrdExpr}}\label{xintiPrdExpr}
+% \subsection{\csbh{xintPrdExpr}}\label{xintiiPrdExpr}
% {\small Name change in |1.06a|! I apologize, but I suddenly decided that
% \csa{xintProductExpr} was a bad choice; so I just replaced it by the current
@@ -5199,8 +5409,8 @@ With \xintexprname, the above would be coded simply as \centeredline
% \csa{xintPrdExpr}\marg{argument}\csa{relax} is to what \csa{xintPrd} expands
% ; its argument is expanded (with the usual meaning) and should give a list of
% braced numbers or macros. Each will be expanded when it is its turn.
-% \centeredline{\csa{xintiPrdExpr}| 123456789123456789\relax|\digitstt{=%
-% \xintiPrdExpr 123456789123456789\relax}}
+% \centeredline{\csa{xintiiPrdExpr}| 123456789123456789\relax|\digitstt{=%
+% \xintiiPrdExpr 123456789123456789\relax}}
% Note: I am not so happy with the name which seems to suggest that the
% |*| sign should be used instead of braces. Perhaps this will change
@@ -5208,36 +5418,41 @@ With \xintexprname, the above would be coded simply as \centeredline
% Extended by \xintfracname to fractions.
-\subsection{\csbh{xintPow}}\label{xintiPow}
-
-\csa{xintPow\n\x} returns |N^x|. When |x| is zero, this is 1. If |N| is zero and
-|x<0|, if \verb+|N|>1+ and |x<0| negative, or if \verb+|N|>1+ and |x>999999999|,
-then an error is raised. |2^999999999| has \np{301029996} digits; each exact
-multiplication of two one thousand digits numbers already takes a few seconds,
-so needless to say this bound is completely irrealistic. Already |2^9999| has
-\np{3010} digits,\footnote{on my laptop |\string\xintiPow \{2\}\{9999\}|
- obtains all |3010| digits in about ten or eleven seconds. In contrast, the
- float versions for
- |8|, |16|, |24|, or even more significant figures, do their jobs in circa one
- hundredth of a second (|1.08b|). This is done without |log|/|exp| which are
- not (yet?) implemented in \xintfracname. The \LaTeX3
+\subsection{\csbh{xintPow}}\label{xintiPow}\label{xintiiPow}
+
+\csa{xintPow\n\x}\etype{\Numf\numx} returns |N^x|. When |x| is zero, this is
+1. If |N| is zero and |x<0|, if \verb+|N|>1+ and |x<0| negative, or if
+\verb+|N|>1+ and |x>999999999|, then an error is raised. |2^999999999| has
+\np{301029996} digits; each exact multiplication of two one thousand digits
+numbers already takes a few seconds, so needless to say this bound is completely
+irrealistic. Already |2^9999| has \np{3010} digits,\footnote{on my laptop
+ |\string\xintiPow \{2\}\{9999\}| obtains all |3010| digits in about ten or
+ eleven seconds. In contrast, the float versions for |8|, |16|, |24|, or even
+ more significant figures, do their jobs in circa one hundredth of a second
+ (|1.08b|). This is done without |log|/|exp| which are not (yet?) implemented
+ in \xintfracname. The \LaTeX3
\href{http://www.ctan.org/tex-archive/macros/latex/contrib/l3kernel}{l3fp}
does this with |log|/|exp| and is ten times faster (|16| figures only).} so I
should perhaps lower the bound to |99999|.
-Extended by \xintfracname to fractions (\csbxint{Pow}) and also to floats
-(\csbxint{FloatPow}). Negative
-exponents do not then cause errors anymore. The float version is able to deal
-with things such as
-|2^999999999| without any problem. For example
-|\xintFloatPow[4]{2}{9999}|\digitstt{=\xintFloatPow[4]{2}{9999}} and
-|\xintFloatPow[4]{2}{999999999}|
-\digitstt{=\xintFloatPow[4]{2}{999999999}}.
+Extended by \xintfracname to fractions (\csbxint{Pow}) and to floats
+(\csbxint{FloatPow}). Negative exponents do not then cause errors anymore. The
+float version is able to deal with things such as |2^999999999| without any
+problem. For example
+|\xintFloatPow[4]{2}{9999}|\digitstt{=\xintFloatPow[4]{2}{9999}} and
+|\xintFloatPow[4]{2}{999999999}| \digitstt{=\xintFloatPow[4]{2}{999999999}}.
+
+\csa{xintiPow} is a synonym not modified by \xintfracname, and
+\csa{xintiiPow} is an integer only variant skipping the \csbxint{Num}
+overhead.\etype{f\numx}
+
+
+
\subsection{\csbh{xintSgnFork}}\label{xintSgnFork}
-{\small New with release |1.07|. See also \csbxint{ifSgn}.\par}
+%{\small New with release |1.07|. See also \csbxint{ifSgn}.\par}
-\csa{xintSgnFork}\verb+{-1|0|1}+\marg{A}\marg{B}\marg{C} expandably
+\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
@@ -5247,64 +5462,64 @@ choosing depending on a condition which one of the package macros to
use, or which values to confer to their arguments.
\subsection{\csbh{xintifSgn}}\label{xintifSgn}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-Similar to \csa{xintSgnFork} except that the first argument may expand to a
-(big) integer (or a fraction if \xintfracname is loaded), and it is its sign
-which decides which of the three branches is taken. Furthermore this first
-argument may be a count register, with no |\the| or |\number| prefix.
+Similar to \csa{xintSgnFork}\etype{\Numf nnn} except that the first argument may
+expand to a (big) integer (or a fraction if \xintfracname is loaded), and it is
+its sign which decides which of the three branches is taken. Furthermore this
+first argument may be a count register, with no |\the| or |\number| prefix.
\subsection{\csbh{xintifZero}}\label{xintifZero}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintifZero}\marg{N}\marg{IsZero}\marg{IsNotZero} 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.
+\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.
\subsection{\csbh{xintifNotZero}}\label{xintifNotZero}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintifNotZero}\marg{N}\marg{IsNotZero}\marg{IsZero} 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.
+\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.
\subsection{\csbh{xintifTrueFalse}}\label{xintifTrueFalse}
-{\small New with release |1.09c|, renamed in |1.09e|.\par}
+%{\small New with release |1.09c|, renamed in |1.09e|.\par}
-\csa{xintifTrueFalse}\marg{N}\marg{true branch}\marg{false branch} 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{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 |{}|.
\subsection{\csbh{xintifCmp}}\label{xintifCmp}
-{\small New with release |1.09e|.\par}
+%{\small New with release |1.09e|.\par}
-\csa{xintifCmp}\marg{A}\marg{B}\marg{if A<B}\marg{if A=B}\marg{if A>B} compares
+\csa{xintifCmp}\marg{A}\marg{B}\marg{if A<B}\marg{if A=B}\marg{if
+ A>B}\etype{\Numf\Numf nnn} compares
its arguments and chooses accordingly the correct branch.
\subsection{\csbh{xintifEq}}\label{xintifEq}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintifEq}\marg{A}\marg{B}\marg{YES}\marg{NO} checks equality of its
-two first arguments (numbers, or fractions if \xintfracname is loaded) and does the |YES| or the |NO| branch.
+\csa{xintifEq}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn}
+checks equality of its two first arguments (numbers, or fractions if
+\xintfracname is loaded) and does the |YES| or the |NO| branch.
\subsection{\csbh{xintifGt}}\label{xintifGt}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-% attention dans la doc du 9 octobre j'avais écrit \geq au lieu de <
-\csa{xintifGt}\marg{A}\marg{B}\marg{YES}\marg{NO} checks if $A>B$ and in that
-case executes the |YES| branch. Extended to fractions (in particular decimal
-numbers) by \xintfracname.
+\csa{xintifGt}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn} checks if
+$A>B$ and in that case executes the |YES| branch. Extended to fractions (in
+particular decimal numbers) by \xintfracname.
\subsection{\csbh{xintifLt}}\label{xintifLt}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-% attention dans la doc du 9 octobre j'avais écrit \leq au lieu de <
-\csa{xintifLt}\marg{A}\marg{B}\marg{YES}\marg{NO} checks if $A<B$ and in that
-case executes the |YES| branch. Extended to fractions (in particular decimal
-numbers) by \xintfracname.
+\csa{xintifLt}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn}
+checks if $A<B$ and in that case executes the |YES| branch. Extended to
+fractions (in particular decimal numbers) by \xintfracname.
\begin{framed}
The macros described next are all integer-only on input. With \xintfracname
@@ -5313,25 +5528,21 @@ numbers) by \xintfracname.
\end{framed}
\subsection{\csbh{xintifOdd}}\label{xintifOdd}
-{\small New with release |1.09e|.\par}
+%{\small New with release |1.09e|.\par}
-\csa{xintifOdd}\marg{A}\marg{YES}\marg{NO} checks if $A$ is and odd integer
-and in that case executes the |YES| branch.
+\csa{xintifOdd}\marg{A}\marg{YES}\marg{NO}\etype{\Numf nn} checks if $A$ is and
+odd integer and in that case executes the |YES| branch.
\subsection{\csbh{xintFac}}\label{xintiFac}
-\csa{xintFac\x} returns the factorial. It is an error if the
-argument is negative or at least @10^6@. It is not recommended to
-launch the computation of things such as @100000!@, if you need
-your computer for other tasks. Note that the argument is of the |x| type, it
-must obey the \TeX{} bounds, but on the other hand may involve count registers
-and even arithmetic operations as it will be completely expanded inside a
-|\numexpr|.
+\csa{xintFac\x}\etype{\numx} returns the factorial. It is an error if the
+argument is negative or at least @10^6@.
-With \xintfracname loaded, the macro also
-accepts a fraction as argument, as long as this fraction turns out to be an
-integer: |\xintFac {66/3}|\digitstt{=\xintFac {66/3}}.
+With \xintfracname loaded, the macro is modified to accept a fraction as
+argument, as long as this fraction turns out to be an integer: |\xintFac
+{66/3}|\digitstt{=\xintFac {66/3}}. \csa{xintiFac} is a synonym not modified by
+the loading of \xintfracname.
% the construct |\xintFac{\xintAdd {2}{3}}| will fail,
% use either |\xintFac{\xintiAdd {2}{3}}| or |\xintFac{\xintNum{\xintAdd
@@ -5348,81 +5559,91 @@ integer: |\xintFac {66/3}|\digitstt{=\xintFac {66/3}}.
% digits). Not to mention @100000!@ which, from the Stirling formula,
% should have 456574 digits.
-\subsection{\csbh{xintDivision}}\label{xintDivision}
+\subsection{\csbh{xintDivision}}\label{xintDivision}\label{xintiiDivision}
-\csa{xintDivision\n\m} returns |{quotient Q}{remainder R}|. This
-is euclidean division: |N = QM + R|, |0|${}\leq{}$\verb+R < |M|+. So the
-remainder is always non-negative and the formula |N = QM + R|
-always holds independently of the signs of |N| or |M|. Division by
-zero is an error (even if |N| vanishes) and returns |{0}{0}|.
+\csa{xintDivision\n\m}\etype{\Numf\Numf} returns |{quotient Q}{remainder R}|.
+This is euclidean division: |N = QM + R|, |0|${}\leq{}$\verb+R < |M|+. So the
+remainder is always non-negative and the formula |N = QM + R| always holds
+independently of the signs of |N| or |M|. Division by zero is an error (even if
+|N| vanishes) and returns |{0}{0}|. The variant \csa{xintiiDivision}\etype{ff}
+skips the overhead of parsing via \csbxint{Num}.
This macro is integer only (with \xintfracname loaded it accepts
fractions on input, but they must be integers in disguise) and not to be
confused with the \xintfracname macro \csbxint{Div} which divides one
fraction by another.
-\subsection{\csbh{xintQuo}}\label{xintQuo}
+\subsection{\csbh{xintQuo}}\label{xintQuo}\label{xintiiQuo}
-\csa{xintQuo\n\m} returns the quotient from the euclidean division. When
-both |N| and |M| are positive one has \csa{xintQuo\n\m}|=\xintiTrunc
-{0}{N/M}| (using package \xintfracname). With \xintfracname loaded it
-accepts fractions on input, but they must be integers in disguise.
+\csa{xintQuo\n\m}\etype{\Numf\Numf} returns the quotient from the euclidean
+division. When both |N| and |M| are positive one has
+\csa{xintQuo\n\m}|=\xintiTrunc {0}{N/M}| (using package \xintfracname). With
+\xintfracname loaded it accepts fractions on input, but they must be integers in
+disguise. The variant \csa{xintiiQuo}\etype{ff}
+skips the overhead of parsing via \csbxint{Num}.
-\subsection{\csbh{xintRem}}\label{xintRem}
+\subsection{\csbh{xintRem}}\label{xintRem}\label{xintiiRem}
-\csa{xintRem\n\m} returns the remainder from the euclidean division.
-With \xintfracname loaded it accepts fractions on input, but they must
-be integers in disguise.
+\csa{xintRem\n\m}\etype{\Numf\Numf} returns the remainder from the euclidean
+division. With \xintfracname loaded it accepts fractions on input, but they must
+be integers in disguise. The variant \csa{xintiiRem}\etype{ff}
+skips the overhead of parsing via \csbxint{Num}.
+\subsection{\csbh{xintFDg}}\label{xintFDg}\label{xintiiFDg}
-\subsection{\csbh{xintFDg}}\label{xintFDg}
+\csa{xintFDg\n}\etype{\Numf} returns the first digit (most significant) of the
+decimal expansion. The variant \csa{xintiiFDg}\etype{f}
+skips the overhead of parsing via \csbxint{Num}.
-\csa{xintFDg\n} returns the first digit (most significant) of the
-decimal expansion.
+\subsection{\csbh{xintLDg}}\label{xintLDg}\label{xintiiLDg}
-\subsection{\csbh{xintLDg}}\label{xintLDg}
+\csa{xintLDg\n}\etype{\Numf} returns the least significant digit. When the
+number is positive, this is the same as the remainder in the euclidean division
+by ten. The variant \csa{xintiiLDg}\etype{f}
+skips the overhead of parsing via \csbxint{Num}.
-\csa{xintLDg\n} returns the least significant digit. When the
-number is positive, this is the same as the remainder in the
-euclidean division by ten.
+\subsection{\csbh{xintMON}, \csbh{xintMMON}}
+\label{xintMON}\label{xintMMON}\label{xintiiMON}\label{xintiiMMON}
+%{\small New in version |1.03|.\par}
-\subsection{\csbh{xintMON}, \csbh{xintMMON}}\label{xintMON}\label{xintMMON}
-{\small New in version |1.03|.\par}
-
-\csa{xintMON\n} returns |(-1)^N| and \csa{xintMMON\n} returns
+\csa{xintMON\n}\etype{\Numf} returns |(-1)^N| and \csa{xintMMON\n} returns
|(-1)^{N-1}|. \centeredline{|\xintMON {-280914019374101929}|\digitstt{=\xintMON
- {280914019374101929}}, |\xintMMON
-{-280914019374101929}|\digitstt{=\xintMMON {280914019374101929}}}
+ {280914019374101929}}, |\xintMMON {-280914019374101929}|\digitstt{=\xintMMON
+ {280914019374101929}}}
+The variants \csa{xintiiMON}\etype{f} and \csa{xintiiMMON}
+skip the overhead of parsing via \csbxint{Num}.
+
+\subsection{\csbh{xintOdd}}\label{xintOdd}\label{xintiiOdd}
-\subsection{\csbh{xintOdd}}\label{xintOdd}
+\csa{xintOdd\n}\etype{\Numf} is 1 if the number is odd and 0 otherwise. The
+variant \csa{xintiiOdd} skip the overhead of parsing via \csbxint{Num}.\etype{f}
-\csa{xintOdd\n} is 1 if the number is odd and 0 otherwise.
\subsection{\csbh{xintiSqrt}, \csbh{xintiSquareRoot}}\label{xintiSqrt}
\label{xintiSquareRoot}
-{\small New with |1.08|.\par}
+%{\small New with |1.08|.\par}
+
\xintAssign\xintiSquareRoot {17000000000000000000000000}\to\A\B
-\noindent\csa{xintiSqrt\n} returns the largest integer whose square is
-at most equal to |N|.
-\centeredline{|\xintiSqrt {2000000000000000000000000000000000000}=|%
-\digitstt{\xintiSqrt{2000000000000000000000000000000000000}}}
+\noindent\csa{xintiSqrt\n}\etype{\Numf} returns the largest integer whose
+square is at most equal to |N|. \centeredline{|\xintiSqrt
+ {2000000000000000000000000000000000000}=|%
+ \digitstt{\xintiSqrt{2000000000000000000000000000000000000}}}
\centeredline{|\xintiSqrt {3000000000000000000000000000000000000}=|%
-\digitstt{\xintiSqrt{3000000000000000000000000000000000000}}}
+ \digitstt{\xintiSqrt{3000000000000000000000000000000000000}}}
\centeredline{|\xintiSqrt {\xintDSH {-120}{2}}=|}%
\centeredline{\digitstt{\xintiSqrt {\xintDSH {-120}{2}}}}
-\csa{xintiSquareRoot\n} returns |{M}{d}| with |d>0|, |M^2-d=N| and |M|
-smallest (hence |=1+|\csa{xint\-iSqrt}|{N}|).
+\csa{xintiSquareRoot\n}\etype{\Numf} returns |{M}{d}| with |d>0|, |M^2-d=N| and
+|M| smallest (hence |=1+|\csa{xint\-iSqrt}|{N}|).
\centeredline{|\xintAssign\xintiSquareRoot
- {17000000000000000000000000}\to\A\B|}%
+ {17000000000000000000000000}\to\A\B|}%
\centeredline{|\xintiSub{\xintiSqr\A}\B=\A^2-\B|}%
-\centeredline{\digitstt{\xintiSub{\xintiSqr\A}\B=\A\string^2-\B}}
-A rational approximation to
-$\sqrt{|N|}$ is $|M|-\frac{|d|}{|2M|}$ (this is a majorant and the error is at
-most |1/2M|; if |N| is a perfect square |k^2| then |M=k+1| and this gives
-|k+1/(2k+2)|, not |k|).
+\centeredline{\digitstt{\xintiSub{\xintiSqr\A}\B=\A\string^2-\B}} A rational
+approximation to $\sqrt{|N|}$ is $|M|-\frac{|d|}{|2M|}$ (this is a majorant and
+the error is at most |1/2M|; if |N| is a perfect square |k^2| then |M=k+1| and
+this gives |k+1/(2k+2)|, not |k|).
Package \xintfracname has \csbxint{FloatSqrt} for square
roots of floating point numbers.
@@ -5436,44 +5657,43 @@ roots of floating point numbers.
\subsection{\csbh{xintInc}, \csbh{xintDec}}
\label{xintInc}
\label{xintDec}
-{\small New with |1.08|.\par}
+%{\small New with |1.08|.\par}
-\csa{xintInc\n} is |N+1| and \csa{xintDec\n} is |N-1|. These macros remain
-integer-only, even with \xintfracname loaded.
+\csa{xintInc\n}\etype{f} is |N+1| and \csa{xintDec\n} is |N-1|. These macros
+remain integer-only, even with \xintfracname loaded.
\subsection{\csbh{xintDouble}, \csbh{xintHalf}}
\label{xintDouble}
\label{xintHalf}
-{\small New with |1.08|.\par}
+%{\small New with |1.08|.\par}
-\csa{xintDouble\n} returns |2N| and \csa{xintHalf\n} is |N/2| rounded
+\csa{xintDouble\n}\etype{f} returns |2N| and \csa{xintHalf\n} is |N/2| rounded
towards zero. These macros remain integer-only, even with \xintfracname loaded.
\subsection{\csbh{xintDSL}}\label{xintDSL}
-\csa{xintDSL\n} is decimal shift left, \emph{i.e.} multiplication
-by ten.
+\csa{xintDSL\n}\etype{f} is decimal shift left, \emph{i.e.} multiplication by
+ten.
\subsection{\csbh{xintDSR}}\label{xintDSR}
-\csa{xintDSR\n} is decimal shift right, \emph{i.e.} it removes the last digit
-(keeping the sign), equivalently it is the closest integer to |N/10| when
+\csa{xintDSR\n}\etype{f} is decimal shift right, \emph{i.e.} it removes the last
+digit (keeping the sign), equivalently it is the closest integer to |N/10| when
starting at zero.
\subsection{\csbh{xintDSH}}\label{xintDSH}
-\csa{xintDSH\x\n} is parametrized decimal shift. When |x| is
-negative, it is like iterating \csa{xintDSL} \verb+|x|+ times
-(\emph{i.e.} multiplication by @10^{-@|x|@}@). When |x| positive,
-it is like iterating \csa{DSR} |x| times (and is more efficient), and for a
-non-negative |N| this is thus the same as the
-quotient from the euclidean division by |10^x|.
+\csa{xintDSH\x\n}\etype{\numx f} is parametrized decimal shift. When |x| is
+negative, it is like iterating \csa{xintDSL} \verb+|x|+ times (\emph{i.e.}
+multiplication by @10^{-@|x|@}@). When |x| positive, it is like iterating
+\csa{DSR} |x| times (and is more efficient), and for a non-negative |N| this is
+thus the same as the quotient from the euclidean division by |10^x|.
\subsection{\csbh{xintDSHr}, \csbh{xintDSx}}\label{xintDSHr}\label{xintDSx}
-{\small New in release |1.01|.\par}
+%{\small New in release |1.01|.\par}
-\csa{xintDSHr\x\n} expects |x| to be zero or positive and it returns
-then a value |R| which is correlated to the value |Q| returned by
+\csa{xintDSHr\x\n}\etype{\numx f} expects |x| to be zero or positive and it
+returns then a value |R| which is correlated to the value |Q| returned by
\csa{xintDSH\x\n} in the following manner:
\begin{itemize}
\item if |N| is
@@ -5492,11 +5712,10 @@ positive, and |N = 10^x Q - R| if |Q| turns out to be negative,
which is exactly the case when |N| is at most |-10^x|.
-\csa{xintDSx\x\n} for |x| negative is exactly as
-\csa{xintDSH\x\n}, \emph{i.e.} multiplication by @10^{-@|x|@}@.
-For |x| zero or positive it returns the two numbers |{Q}{R}|
-described above, each one within braces. So |Q| is
-\csa{xintDSH\x\n}, and |R| is \csa{xintDSHr\x\n}, but computed
+\csa{xintDSx\x\n}\etype{\numx f} for |x| negative is exactly as
+\csa{xintDSH\x\n}, \emph{i.e.} multiplication by @10^{-@|x|@}@. For |x| zero or
+positive it returns the two numbers |{Q}{R}| described above, each one within
+braces. So |Q| is \csa{xintDSH\x\n}, and |R| is \csa{xintDSHr\x\n}, but computed
simultaneously.
\begin{flushleft}
@@ -5534,19 +5753,18 @@ simultaneously.
\subsection{\csbh{xintDecSplit}}\label{xintDecSplit}
-{\small This has been modified in release |1.01|.\par}
+%{\small This has been modified in release |1.01|.\par}
-\csa{xintDecSplit\x\n} cuts the number into two pieces (each one within a
-pair of enclosing braces). First the sign if present is \emph{removed}.
+\csa{xintDecSplit\x\n}\etype{\numx f} cuts the number into two pieces (each one
+within a pair of enclosing braces). First the sign if present is \emph{removed}.
Then, for |x| positive or null, the second piece contains the |x| least
significant digits (\emph{empty} if |x=0|) and the first piece the remaining
-digits (\emph{empty} when |x| equals or exceeds the length of |N|).
-Leading zeros in the second piece are not removed. When |x| is negative
-the first piece contains the \verb+|x|+ most significant digits and the
-second piece the remaining digits (\emph{empty} if @|x|@ equals or exceeds
-the length of |N|). Leading zeros in this second piece are not removed.
-So the absolute value of the original number is always the concatenation
-of the first and second piece.
+digits (\emph{empty} when |x| equals or exceeds the length of |N|). Leading
+zeros in the second piece are not removed. When |x| is negative the first piece
+contains the \verb+|x|+ most significant digits and the second piece the
+remaining digits (\emph{empty} if @|x|@ equals or exceeds the length of |N|).
+Leading zeros in this second piece are not removed. So the absolute value of the
+original number is always the concatenation of the first and second piece.
{\footnotesize This macro's behavior for |N| non-negative is final and will not
change. I am still hesitant about what to do with the sign of a
@@ -5577,12 +5795,12 @@ of the first and second piece.
\subsection{\csbh{xintDecSplitL}}\label{xintDecSplitL}
-\csa{xintDecSplitL\x\n} returns the first piece after the action
+\csa{xintDecSplitL\x\n}\etype{\numx f} returns the first piece after the action
of \csa{xintDecSplit}.
\subsection{\csbh{xintDecSplitR}}\label{xintDecSplitR}
-\csa{xintDecSplitR\x\n} returns the second piece after the action
+\csa{xintDecSplitR\x\n}\etype{\numx f} returns the second piece after the action
of \csa{xintDecSplit}.
@@ -5597,14 +5815,14 @@ general rule of the bundle that each macro first expands (what comes first,
fully) each one of its arguments applies.
-|f| stands for an integer or a fraction (see \autoref{sec:inputs} for the
-accepted input formats) or something which expands to an integer or fraction. It
-is possible to use in the numerator or the denominator of |f| count
-registers and even expressions with
-infix arithmetic operators, under some rules which are explained in the previous
-\hyperlink{useofcount}{Use of count registers} section.
+|f|\ntype{\Ff} stands for an integer or a fraction (see \autoref{sec:inputs}
+for the accepted input formats) or something which expands to an integer or
+fraction. It is possible to use in the numerator or the denominator of |f| count
+registers and even expressions with infix arithmetic operators, under some rules
+which are explained in the previous \hyperref[sec:useofcount]{Use of count
+ registers} section.
-As in the \hyperref[sec:xint]{xint.sty} documentation, |x|
+As in the \hyperref[sec:xint]{xint.sty} documentation, |x|\ntype{\numx}
stands for something which will internally be embedded in a \csa{numexpr}.
It
may thus be a count register or something like |4*\count 255 + 17|, etc..., but
@@ -5635,38 +5853,37 @@ Some macros (such as \csbxint{iTrunc},
\subsection{\csbh{xintNum}}\label{xintNum}
-The macro is extended to accept a fraction on input. But this fraction should
-reduce to an integer. If not an error will be raised. The original is available
-as \csbxint{iNum}. It is imprudent to apply \csa{xintNum} to numbers with a
-large power of ten given either in scientific notation or with the |[n]|
-notation, as the macro will add the necessary zeros to get an explicit
-integer.
+The macro\etype{f} is extended to accept a fraction on input. But this fraction
+should reduce to an integer. If not an error will be raised. The original is
+available as \csbxint{iNum}. It is imprudent to apply \csa{xintNum} to numbers
+with a large power of ten given either in scientific notation or with the |[n]|
+notation, as the macro will add the necessary zeros to get an explicit integer.
\subsection{\csbh{xintifInt}}\label{xintifInt}
-{\small New with release |1.09e|.\par}
-
-\csa{xintifInt}|{f}{YES branch}{NO branch}| expandably chooses the |YES| branch
-if |f| reveals itself after expansion and simplification to be an integer. As
-with the other \xintname conditionals, both branches must be present although
-one of the two (or both, but why then?) may well be an empty brace pair |{}|. As
-will all other \xintname conditionals, spaces in-between the braced things do
-not matter, but a space after the closing brace of the |NO| branch is
+%{\small New with release |1.09e|.\par}
+
+\csa{xintifInt}|{f}{YES branch}{NO branch}|\etype{\Ff nn} expandably chooses the
+|YES| branch if |f| reveals itself after expansion and simplification to be an
+integer. As with the other \xintname conditionals, both branches must be present
+although one of the two (or both, but why then?) may well be an empty brace pair
+|{}|. As will all other \xintname conditionals, spaces in-between the braced
+things do not matter, but a space after the closing brace of the |NO| branch is
significant.
\subsection{\csbh{xintLen}}\label{xintLen}
-The original macro is extended to accept a fraction on input.
+The original macro\etype{\Ff} is extended to accept a fraction on input.
\centeredline {|\xintLen {201710/298219}|\digitstt{=\xintLen {201710/298219}},
|\xintLen {1234/1}|\digitstt{=\xintLen {1234/1}}, |\xintLen {1234}|%
\digitstt{=\xintLen {1234}}}
\subsection{\csbh{xintRaw}}\label{xintRaw}
-{\small New with release |1.04|.\par}
-{\small \color{red}MODIFIED IN |1.07|.\par}
+%{\small New with release |1.04|.\par}
+%{\small \color{red}MODIFIED IN |1.07|.\par}
-This macro `prints' the
+This macro `prints' the\etype{\Ff}
fraction |f| as it is received by the package after its parsing and
expansion, in a form |A/B[n]| equivalent to the internal
representation: the denominator |B| is always strictly positive and is
@@ -5677,57 +5894,54 @@ printed even if it has value |1|.
571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}}
\subsection{\csbh{xintPRaw}}\label{xintPRaw}
-{\small New in |1.09b|.\par}
+%{\small New in |1.09b|.\par}
-|PRaw| stands for ``pretty raw''. It does \emph{not} show the |[n]| if |n=0| and
-does \emph{not} show the |B| if |B=1|. \centeredline{|\xintPRaw
+|PRaw|\etype{\Ff} stands for ``pretty raw''. It does \emph{not} show the |[n]|
+if |n=0| and does \emph{not} show the |B| if |B=1|. \centeredline{|\xintPRaw
{123e10/321e10}=|\digitstt{\xintPRaw {123e10/321e10}}, |\xintPRaw
- {123e9/321e10}=|\digitstt{\xintPRaw {123e9/321e10}}}
-\centeredline{|\xintPRaw
- {\xintIrr{861/123}}=|\digitstt{\xintPRaw{\xintIrr{861/123}}} \ vz.\
-|\xintIrr{861/123}=|\digitstt{\xintIrr{861/123}}} See also
-\csbxint{Frac} (or \csbxint{FwOver}) for math mode. As is examplified above the
-\csbxint{Irr} macro which puts the fraction into irreducible form does not
-remove the |/1| if the fraction is an integer. One can use \csbxint{Num} for
-that, but there will be an error message if the fraction was not an integer; so
-the combination |\xintPRaw{\xintIrr{f}}| is the way to go.
+ {123e9/321e10}=|\digitstt{\xintPRaw {123e9/321e10}}} \centeredline{|\xintPRaw
+ {\xintIrr{861/123}}=|\digitstt{\xintPRaw{\xintIrr{861/123}}} \ vz.\
+ |\xintIrr{861/123}=|\digitstt{\xintIrr{861/123}}} See also \csbxint{Frac} (or
+\csbxint{FwOver}) for math mode. As is examplified above the \csbxint{Irr} macro
+which puts the fraction into irreducible form does not remove the |/1| if the
+fraction is an integer. One can use \csbxint{Num} for that, but there will be an
+error message if the fraction was not an integer; so the combination
+|\xintPRaw{\xintIrr{f}}| is the way to go.
\subsection{\csbh{xintNumerator}}\label{xintNumerator}
-This returns the numerator corresponding to the internal representation of a
-fraction, with positive powers of ten converted into zeros of this numerator:
-\centeredline{|\xintNumerator
+This returns\etype{\Ff} the numerator corresponding to the internal
+representation of a fraction, with positive powers of ten converted into zeros
+of this numerator: \centeredline{|\xintNumerator
{178000/25600000[17]}|\digitstt{=\xintNumerator {178000/25600000[17]}}}
\centeredline{|\xintNumerator {312.289001/20198.27}|%
- \digitstt{=\xintNumerator {312.289001/20198.27}}}
+ \digitstt{=\xintNumerator {312.289001/20198.27}}}
\centeredline{|\xintNumerator {178000e-3/256e5}|\digitstt{=\xintNumerator
- {178000e-3/256e5}}}
-\centeredline{|\xintNumerator {178.000/25600000}|\digitstt{=\xintNumerator
- {178.000/25600000}}} As shown by the examples, no simplification of the
-input is done. For a result uniquely associated to the value of the fraction
-first apply \csa{xintIrr}.
+ {178000e-3/256e5}}} \centeredline{|\xintNumerator
+ {178.000/25600000}|\digitstt{=\xintNumerator {178.000/25600000}}} As shown by
+the examples, no simplification of the input is done. For a result uniquely
+associated to the value of the fraction first apply \csa{xintIrr}.
\subsection{\csbh{xintDenominator}}\label{xintDenominator}
-This returns the denominator corresponding to the internal representation of the
-fraction:\footnote{recall that the |[]| construct excludes presence of a decimal
- point.} \centeredline{|\xintDenominator
+This returns\etype{\Ff} the denominator corresponding to the internal
+representation of the fraction:\footnote{recall that the |[]| construct excludes
+ presence of a decimal point.} \centeredline{|\xintDenominator
{178000/25600000[17]}|\digitstt{=\xintDenominator {178000/25600000[17]}}}%
\centeredline{|\xintDenominator {312.289001/20198.27}|%
- \digitstt{=\xintDenominator {312.289001/20198.27}}}
+ \digitstt{=\xintDenominator {312.289001/20198.27}}}
\centeredline{|\xintDenominator {178000e-3/256e5}|\digitstt{=\xintDenominator
- {178000e-3/256e5}}}
-\centeredline{|\xintDenominator {178.000/25600000}|\digitstt{=\xintDenominator
- {178.000/25600000}}} As shown by the examples, no simplification of the
-input is done. The denominator looks wrong in the last example, but the
-numerator was tacitly multiplied by @1000@ through the removal of the decimal
-point. For a result uniquely associated to the value of the fraction
-first apply \csa{xintIrr}.
+ {178000e-3/256e5}}} \centeredline{|\xintDenominator
+ {178.000/25600000}|\digitstt{=\xintDenominator {178.000/25600000}}} As shown
+by the examples, no simplification of the input is done. The denominator looks
+wrong in the last example, but the numerator was tacitly multiplied by @1000@
+through the removal of the decimal point. For a result uniquely associated to
+the value of the fraction first apply \csa{xintIrr}.
\subsection{\csbh{xintRawWithZeros}}\label{xintRawWithZeros}
-{\small New name in |1.07| (former name |\xintRaw|).\par}
+%{\small New name in |1.07| (former name |\xintRaw|).\par}
-This macro `prints' the
+This macro `prints'\etype{\Ff} the
fraction |f| (after its parsing and expansion) in |A/B| form, with |A|
as returned by \csa{xintNumerator}|{f}| and |B| as returned by
\csa{xintDenominator}|{f}|.
@@ -5739,67 +5953,64 @@ as returned by \csa{xintNumerator}|{f}| and |B| as returned by
\subsection{\csbh{xintREZ}}\label{xintREZ}
-This command normalizes a fraction by removing the powers of ten from its
-numerator and denominator: \centeredline{|\xintREZ {178000/25600000[17]}|\digitstt{=\xintREZ
- {178000/25600000[17]}}}
-\centeredline{|\xintREZ
-{1780000000000e30/2560000000000e15}|\digitstt{=\xintREZ
-{1780000000000e30/2560000000000e15}}}
-As shown by the example, it does not
+This command\etype{\Ff} normalizes a fraction by removing the powers of ten from
+its numerator and denominator: \centeredline{|\xintREZ
+ {178000/25600000[17]}|\digitstt{=\xintREZ {178000/25600000[17]}}}
+\centeredline{|\xintREZ {1780000000000e30/2560000000000e15}|\digitstt{=\xintREZ
+ {1780000000000e30/2560000000000e15}}} As shown by the example, it does not
otherwise simplify the fraction.
\subsection{\csbh{xintFrac}}\label{xintFrac}
-This is a \LaTeX{} only command, to be used in math mode only. It will print a
-fraction, internally represented as something equivalent to |A/B[n]| as |\frac
-{A}{B}10^n|. The power of ten is omitted when |n=0|, the denominator is omitted
-when it has value one, the number being separated from the power of ten by a
-|\cdot|. |$\xintFrac {178.000/25600000}$| gives $\xintFrac {178.000/25600000}$,
-|$\xintFrac {178.000/1}$| gives $\xintFrac {178.000/1}$, |$\xintFrac
-{3.5/5.7}$| gives $\xintFrac {3.5/5.7}$, and |$\xintFrac {\xintNum
- {\xintFac{10}/|\allowbreak|\xintiSqr{\xintFac {5}}}}$| gives
- $\xintFrac {\xintNum {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$.
-As shown by the examples,
-simplification of the input (apart from removing the decimal points and
-moving the minus sign to the numerator) is not done automatically and must be
-the result of macros such as |\xintIrr|, |\xintREZ|, or |\xintNum| (for
-fractions being in fact integers.)
+This is a \LaTeX{} only command,\etype{\Ff} to be used in math mode only. It
+will print a fraction, internally represented as something equivalent to
+|A/B[n]| as |\frac {A}{B}10^n|. The power of ten is omitted when |n=0|, the
+denominator is omitted when it has value one, the number being separated from
+the power of ten by a |\cdot|. |$\xintFrac {178.000/25600000}$| gives $\xintFrac
+{178.000/25600000}$, |$\xintFrac {178.000/1}$| gives $\xintFrac {178.000/1}$,
+|$\xintFrac {3.5/5.7}$| gives $\xintFrac {3.5/5.7}$, and |$\xintFrac {\xintNum
+ {\xintFac{10}/|\allowbreak|\xintiSqr{\xintFac {5}}}}$| gives $\xintFrac
+{\xintNum {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$. As shown by the examples,
+simplification of the input (apart from removing the decimal points and moving
+the minus sign to the numerator) is not done automatically and must be the
+result of macros such as |\xintIrr|, |\xintREZ|, or |\xintNum| (for fractions
+being in fact integers.)
\subsection{\csbh{xintSignedFrac}}\label{xintSignedFrac}
-{\small New with release |1.04|.\par}
+%{\small New with release |1.04|.\par}
-This is as \csbxint{Frac} except that a negative fraction has the sign put in
-front, not in the numerator.
-\centeredline{|\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\]|}
+This is as \csbxint{Frac}\etype{\Ff} except that a negative fraction has the
+sign put in front, not in the numerator. \centeredline{|\[\xintFrac
+ {-355/113}=\xintSignedFrac {-355/113}\]|}
\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\]
\subsection{\csbh{xintFwOver}}\label{xintFwOver}
-This does the same as \csa{xintFrac} except that the \csa{over} primitive is
-used for the fraction (in case the denominator is not one; and a pair of braces
-contains the |A\over B| part). |$\xintFwOver {178.000/25600000}$| gives
-$\xintFwOver {178.000/25600000}$, |$\xintFwOver {178.000/1}$| gives $\xintFwOver
-{178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver {3.5/5.7}$, and
-|$\xintFwOver {\xintNum {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$| gives
-$\xintFwOver {\xintNum {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$.
+This does the same as \csa{xintFrac}\etype{\Ff} except that the \csa{over}
+primitive is used for the fraction (in case the denominator is not one; and a
+pair of braces contains the |A\over B| part). |$\xintFwOver {178.000/25600000}$|
+gives $\xintFwOver {178.000/25600000}$, |$\xintFwOver {178.000/1}$| gives
+$\xintFwOver {178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver
+{3.5/5.7}$, and |$\xintFwOver {\xintNum {\xintFac{10}/\xintiSqr{\xintFac
+ {5}}}}$| gives $\xintFwOver {\xintNum {\xintFac{10}/\xintiSqr{\xintFac
+ {5}}}}$.
\subsection{\csbh{xintSignedFwOver}}\label{xintSignedFwOver}
-{\small New with release |1.04|.\par}
+%{\small New with release |1.04|.\par}
-This is as \csbxint{FwOver} except that a negative fraction has the sign put in
-front, not in the numerator.
-\centeredline{|\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\]|}
+This is as \csbxint{FwOver}\etype{\Ff} except that a negative fraction has the
+sign put in front, not in the numerator. \centeredline{|\[\xintFwOver
+ {-355/113}=\xintSignedFwOver {-355/113}\]|}
\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\]
\subsection{\csbh{xintIrr}}\label{xintIrr}
-{\small \color{red}MODIFIED IN |1.08|.\par}
-This puts the fraction into its unique irreducible form: \centeredline{|\xintIrr
- {178.256/256.178}|%
+This puts the fraction\etype{\Ff} into its unique irreducible form:
+\centeredline{|\xintIrr {178.256/256.178}|%
\digitstt{=\xintIrr {178.256/256.178}}${}=\xintFrac{\xintIrr
{178.256/256.178}[0]}$}%
Note that the current implementation does not cleverly first factor powers of 2
@@ -5815,16 +6026,15 @@ trailing |/1|. For display in math mode, use rather |\xintFrac{\xintIrr {f}}| or
|\xintFwOver{\xintIrr {f}}|.
\subsection{\csbh{xintJrr}}\label{xintJrr}
-{\small \color{red}MODIFIED IN |1.08|.\par}
-This also puts the fraction into its unique irreducible form:
+This also puts the fraction\etype{\Ff} into its unique irreducible form:
\centeredline{|\xintJrr {178.256/256.178}|%
\digitstt{=\xintJrr {178.256/256.178}}}%
This is faster than \csa{xintIrr} for fractions having some big common
factor in the numerator and the denominator.\par
-{\centering |\xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiPrdExpr
+{\centering |\xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiiPrdExpr
{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }|\digitstt{=%
- \xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiPrdExpr
+ \xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiiPrdExpr
{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }}\par} But to notice the
difference one would need computations with much bigger numbers than in this
example.
@@ -5834,13 +6044,14 @@ when the output is an integer.
\subsection{\csbh{xintTrunc}}\label{xintTrunc}
-\csa{xintTrunc}|{x}{f}| returns the start of the decimal expansion of the
-fraction |f|, with |x| digits after the decimal point. The argument |x| should
-be non-negative. When |x=0|, the integer part of |f| results, with an ending
-decimal point. Only when |f| evaluates to zero does \csa{xintTrunc} not print a
-decimal point. When |f| is not zero, the sign is maintained in the output, also
-when the digits are all zero. \centeredline{|\xintTrunc
- {16}{-803.2028/20905.298}|\digitstt{=\xintTrunc {16}{-803.2028/20905.298}}}%
+\csa{xintTrunc}|{x}{f}|\etype{\numx\Ff} returns the start of the decimal
+expansion of the fraction |f|, with |x| digits after the decimal point. The
+argument |x| should be non-negative. When |x=0|, the integer part of |f|
+results, with an ending decimal point. Only when |f| evaluates to zero does
+\csa{xintTrunc} not print a decimal point. When |f| is not zero, the sign is
+maintained in the output, also when the digits are all zero.
+\centeredline{|\xintTrunc {16}{-803.2028/20905.298}|\digitstt{=\xintTrunc
+ {16}{-803.2028/20905.298}}}%
\centeredline{|\xintTrunc {20}{-803.2028/20905.298}|\digitstt{=\xintTrunc
{20}{-803.2028/20905.298}}}%
\centeredline{|\xintTrunc {10}{\xintPow {-11}{-11}}|\digitstt{=\xintTrunc
@@ -5857,105 +6068,99 @@ holds.\footnote{Recall that |-\string\macro| is not valid as argument to any
\subsection{\csbh{xintiTrunc}}\label{xintiTrunc}
-\csa{xintiTrunc}|{x}{f}| returns the integer equal to |10^x| times what
-\csa{xintTrunc}|{x}{f}| would return. \centeredline{|\xintiTrunc
+\csa{xintiTrunc}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x|
+times what \csa{xintTrunc}|{x}{f}| would return. \centeredline{|\xintiTrunc
{16}{-803.2028/20905.298}|\digitstt{=\xintiTrunc {16}{-803.2028/20905.298}}}%
- \centeredline{|\xintiTrunc
- {10}{\xintPow {-11}{-11}}|\digitstt{=\xintiTrunc
- {10}{\xintPow {-11}{-11}}}}%
- \centeredline{|\xintiTrunc
- {12}{\xintPow {-11}{-11}}|\digitstt{=\xintiTrunc
- {12}{\xintPow {-11}{-11}}}}%
-Differences between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}|:
-the former cannot be used inside integer-only macros, and the latter
-removes the decimal point, and never returns |-0| (and removes
-all superfluous leading zeros.)
+\centeredline{|\xintiTrunc {10}{\xintPow {-11}{-11}}|\digitstt{=\xintiTrunc
+ {10}{\xintPow {-11}{-11}}}}%
+\centeredline{|\xintiTrunc {12}{\xintPow {-11}{-11}}|\digitstt{=\xintiTrunc
+ {12}{\xintPow {-11}{-11}}}}%
+Differences between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}|: the
+former cannot be used inside integer-only macros, and the latter removes the
+decimal point, and never returns |-0| (and removes all superfluous leading
+zeros.)
\subsection{\csbh{xintRound}}\label{xintRound}
-{\small New with release |1.04|.\par}
-
-\csa{xintRound}|{x}{f}| returns the start of the decimal expansion of the
-fraction |f|, rounded to |x| digits precision after the decimal point. The
-argument |x| should be non-negative. Only when |f| evaluates exactly to zero
-does \csa{xintRound} return |0| without decimal point. When |f| is not zero, its
-sign is given in the output, also when the digits printed are all zero.
-\centeredline{|\xintRound {16}{-803.2028/20905.298}|\digitstt{=\xintRound
- {16}{-803.2028/20905.298}}}%
- \centeredline{|\xintRound
- {20}{-803.2028/20905.298}|\digitstt{=\xintRound {20}{-803.2028/20905.298}}}%
- \centeredline{|\xintRound
- {10}{\xintPow {-11}{-11}}|\digitstt{=\xintRound
- {10}{\xintPow {-11}{-11}}}}%
- \centeredline{|\xintRound
- {12}{\xintPow {-11}{-11}}|\digitstt{=\xintRound
- {12}{\xintPow {-11}{-11}}}}%
+%{\small New with release |1.04|.\par}
+
+\csa{xintRound}|{x}{f}|\etype{\numx\Ff} returns the start of the decimal
+expansion of the fraction |f|, rounded to |x| digits precision after the decimal
+point. The argument |x| should be non-negative. Only when |f| evaluates exactly
+to zero does \csa{xintRound} return |0| without decimal point. When |f| is not
+zero, its sign is given in the output, also when the digits printed are all
+zero. \centeredline{|\xintRound {16}{-803.2028/20905.298}|\digitstt{=\xintRound
+ {16}{-803.2028/20905.298}}}%
+\centeredline{|\xintRound {20}{-803.2028/20905.298}|\digitstt{=\xintRound
+ {20}{-803.2028/20905.298}}}%
+\centeredline{|\xintRound {10}{\xintPow {-11}{-11}}|\digitstt{=\xintRound
+ {10}{\xintPow {-11}{-11}}}}%
+\centeredline{|\xintRound {12}{\xintPow {-11}{-11}}|\digitstt{=\xintRound
+ {12}{\xintPow {-11}{-11}}}}%
\centeredline{|\xintRound {12}{\xintAdd {-1/3}{3/9}}|\digitstt{=\xintRound
- {12}{\xintAdd {-1/3}{3/9}}}}
-The identity |\xintRound {x}{-f}=-\xintRound {x}{f}| holds. And regarding
-$(-11)^{-11}$ here is some more of its expansion:
-\centeredline{\digitstt{\xintTrunc {50}{\xintPow {-11}{-11}}\dots}}
+ {12}{\xintAdd {-1/3}{3/9}}}} The identity |\xintRound {x}{-f}=-\xintRound
+{x}{f}| holds. And regarding $(-11)^{-11}$ here is some more of its expansion:
+\centeredline{\digitstt{\xintTrunc {50}{\xintPow {-11}{-11}}\dots}}
\subsection{\csbh{xintiRound}}\label{xintiRound}
-{\small New with release |1.04|.\par}
+%{\small New with release |1.04|.\par}
-\csa{xintiRound}|{x}{f}| returns the integer equal to |10^x| times what
-\csa{xintRound}|{x}{f}| would return. \centeredline{|\xintiRound
+\csa{xintiRound}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x|
+times what \csa{xintRound}|{x}{f}| would return. \centeredline{|\xintiRound
{16}{-803.2028/20905.298}|\digitstt{=\xintiRound {16}{-803.2028/20905.298}}}%
\centeredline{|\xintiRound {10}{\xintPow {-11}{-11}}|\digitstt{=\xintiRound
{10}{\xintPow {-11}{-11}}}}%
-Differences between \csa{xintRound}|{0}{f}| and \csa{xintiRound}|{0}{f}|:
-the former cannot be used inside integer-only macros, and the
-latter removes the decimal point, and never returns |-0| (and removes
-all superfluous leading zeros.)
+Differences between \csa{xintRound}|{0}{f}| and \csa{xintiRound}|{0}{f}|: the
+former cannot be used inside integer-only macros, and the latter removes the
+decimal point, and never returns |-0| (and removes all superfluous leading
+zeros.)
\subsection{\csbh{xintFloor}}\label{xintFloor}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-|\xintFloor {f}| returns the largest relative integer |N| with |N|${}\leq{}$|f|.
-\centeredline{|\xintFloor {-2.13}|\digitstt{=\xintFloor {-2.13}},
-|\xintFloor {-2}|\digitstt{=\xintFloor {-2}},
-|\xintFloor {2.13}|\digitstt{=\xintFloor {2.13}}%
+|\xintFloor {f}|\etype{\Ff} returns the largest relative integer |N| with
+|N|${}\leq{}$|f|. \centeredline{|\xintFloor {-2.13}|\digitstt{=\xintFloor
+ {-2.13}}, |\xintFloor {-2}|\digitstt{=\xintFloor {-2}}, |\xintFloor
+ {2.13}|\digitstt{=\xintFloor {2.13}}%
}
\subsection{\csbh{xintCeil}}\label{xintCeil}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-|\xintCeil {f}| returns the smallest relative integer |N| with |N|${}>{}$|f|.
-\centeredline{|\xintCeil {-2.13}|\digitstt{=\xintCeil {-2.13}},
-|\xintCeil {-2}|\digitstt{=\xintCeil {-2}},
-|\xintCeil {2.13}|\digitstt{=\xintCeil {2.13}}%
+|\xintCeil {f}|\etype{\Ff} returns the smallest relative integer |N| with
+|N|${}>{}$|f|. \centeredline{|\xintCeil {-2.13}|\digitstt{=\xintCeil {-2.13}},
+ |\xintCeil {-2}|\digitstt{=\xintCeil {-2}}, |\xintCeil
+ {2.13}|\digitstt{=\xintCeil {2.13}}%
}
\subsection{\csbh{xintE}}\label{xintE}
-{\small New with |1.07|.}
-
-|\xintE {f}{x}| multiplies the fraction |f| by @10^x@. The \emph{second}
-argument |x| must obey the \TeX{} bounds. Example:
-\centeredline{|\count
-255 123456789 \xintE {10}{\count 255}|\digitstt{->\count
-255 123456789 \xintE {10}{\count 255}}} Be careful that for obvious reasons such
-gigantic numbers should not be given to \csbxint{Num}, or added to something
-with a widely different order of magnitude, as the package always works to get
-the \emph{exact} result. There is \emph{no problem} using them for
+%{\small New with |1.07|.}
+
+|\xintE {f}{x}|\etype{\Ff\numx} multiplies the fraction |f| by @10^x@. The
+\emph{second} argument |x| must obey the \TeX{} bounds. Example:
+\centeredline{|\count 255 123456789 \xintE {10}{\count 255}|\digitstt{->\count
+ 255 123456789 \xintE {10}{\count 255}}} Be careful that for obvious reasons
+such gigantic numbers should not be given to \csbxint{Num}, or added to
+something with a widely different order of magnitude, as the package always
+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{xintDigits}, \csbh{xinttheDigits}}\label{xintDigits}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
The syntax |\xintDigits := D;| (where spaces do not matter) assigns the
value of |D| to the number of digits to be used by floating point
operations. The default is |16|. The maximal value is |32767|. The macro
-|\xinttheDigits| serves to print the current value.
+|\xinttheDigits|\etype{} serves to print the current value.
\subsection{\csbh{xintFloat}}\label{xintFloat}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
-The macro |\xintFloat [P]{f}| has an optional argument |P| which replaces
+The macro |\xintFloat [P]{f}|\etype{{\upshape[\numx]}\Ff} has an optional argument |P| which replaces
the current value of |\xintDigits|. The (rounded truncation of the) fraction
|f| is then printed in scientific form, with |P| digits,
a lowercase |e| and an exponent |N|. The first digit is from |1| to |9|, it is
@@ -5983,88 +6188,89 @@ mode. For this one must use |\xintthefloatexpr|.
\subsection{\csbh{xintAdd}}\label{xintAdd}
-The original macro is extended to accept fractions on input. Its output will now
-always be in the form |A/B[n]|. The original is available as \csbxint{iAdd}.
+The original\etype{\Ff\Ff} macro is extended to accept fractions on input. Its
+output will now always be in the form |A/B[n]|. The original is available as
+\csbxint{iAdd}.
\subsection{\csbh{xintFloatAdd}}\label{xintFloatAdd}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
-|\xintFloatAdd [P]{f}{g}| first replaces |f| and |g| with their float
-approximations, with 2 safety digits. It then adds exactly and outputs in
-float format with precision |P| (which is optional) or |\xintDigits| if |P|
-was absent, the result of this computation.
+|\xintFloatAdd [P]{f}{g}|\etype{{\upshape[\numx]}\Ff\Ff} first replaces |f| and
+|g| with their float approximations, with 2 safety digits. It then adds exactly
+and outputs in float format with precision |P| (which is optional) or
+|\xintDigits| if |P| was absent, the result of this computation.
\subsection{\csbh{xintSub}}\label{xintSub}
-The original macro is extended to accept fractions on input. Its output will now
-always be in the form |A/B[n]|.
-The original is available as \csbxint{iSub}.
+The original\etype{\Ff\Ff} macro is extended to accept fractions on input. Its
+output will now always be in the form |A/B[n]|. The original is available as
+\csbxint{iSub}.
\subsection{\csbh{xintFloatSub}}\label{xintFloatSub}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
-|\xintFloatSub [P]{f}{g}| first replaces |f| and |g| with their float
-approximations, with 2 safety digits. It then subtracts exactly and outputs in
-float format with precision |P| (which is optional), or |\xintDigits| if |P|
-was absent, the result of this computation.
+|\xintFloatSub [P]{f}{g}|\etype{{\upshape[\numx]}\Ff\Ff} first replaces |f| and
+|g| with their float approximations, with 2 safety digits. It then subtracts
+exactly and outputs in float format with precision |P| (which is optional), or
+|\xintDigits| if |P| was absent, the result of this computation.
\subsection{\csbh{xintMul}}\label{xintMul}
-The original macro is extended to accept fractions on input. Its output will now
-always be in the form |A/B[n]|. The original, only for big integers, and
-outputting a big integer, is available as \csbxint{iMul}.
+The original\etype{\Ff\Ff} macro is extended to accept fractions on input. Its
+output will now always be in the form |A/B[n]|. The original, only for big
+integers, and outputting a big integer, is available as \csbxint{iMul}.
\subsection{\csbh{xintFloatMul}}\label{xintFloatMul}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
-|\xintFloatMul [P]{f}{g}| first replaces |f| and |g| with their float
-approximations, with 2 safety digits. It then multiplies exactly and outputs in
-float format with precision |P| (which is optional), or |\xintDigits| if |P|
-was absent, the result of this computation.
+|\xintFloatMul [P]{f}{g}|\etype{{\upshape[\numx]}\Ff\Ff} first replaces |f| and
+|g| with their float approximations, with 2 safety digits. It then multiplies
+exactly and outputs in float format with precision |P| (which is optional), or
+|\xintDigits| if |P| was absent, the result of this computation.
\subsection{\csbh{xintSqr}}\label{xintSqr}
-The original macro is extended to accept a fraction on input. Its output will
-now always be in the form |A/B[n]|. The original which outputs only big integers
-is available as \csbxint{iSqr}.
+The original\etype{\Ff} macro is extended to accept a fraction on input. Its
+output will now always be in the form |A/B[n]|. The original which outputs only
+big integers is available as \csbxint{iSqr}.
\subsection{\csbh{xintDiv}}\label{xintDiv}
-\csa{xintDiv}|{f}{g}| computes the fraction |f/g|. As with all other computation
-macros, no simplification is done on the output, which is in the form |A/B[n]|.
+\csa{xintDiv}|{f}{g}|\etype{\Ff\Ff} computes the fraction |f/g|. As with all
+other computation macros, no simplification is done on the output, which is in
+the form |A/B[n]|.
\subsection{\csbh{xintFloatDiv}}\label{xintFloatDiv}
-{\small New with release |1.07|.\par}
+%{\small New with release |1.07|.\par}
-|\xintFloatDiv [P]{f}{g}| first replaces |f| and |g| with their float
-approximations, with 2 safety digits. It then divides exactly and outputs in
-float format with precision |P| (which is optional), or |\xintDigits| if |P|
-was absent, the result of this computation.
+|\xintFloatDiv [P]{f}{g}|\etype{{\upshape[\numx]}\Ff\Ff} first replaces |f| and
+|g| with their float approximations, with 2 safety digits. It then divides
+exactly and outputs in float format with precision |P| (which is optional), or
+|\xintDigits| if |P| was absent, the result of this computation.
\subsection{\csbh{xintFac}}\label{xintFac}
-{\small Modified in |1.08b| (to allow fractions on input).\par}
+%{\small Modified in |1.08b| (to allow fractions on input).\par}
-The original is extended to allow a fraction on input but this fraction |f| must
-simplify to a integer |n| (non negative and at most |999999|, but already
-|100000!| is prohibitively time-costly). On output |n!|
-(no trailing |/1[0]|). The original macro
-(which has less overhead) is still
-available as \csbxint{iFac}.
+The original\etype{\Numf} is extended to allow a fraction on input but this
+fraction |f| must simplify to a integer |n| (non negative and at most |999999|,
+but already |100000!| is prohibitively time-costly). On output |n!| (no trailing
+|/1[0]|). The original macro (which has less overhead) is still available as
+\csbxint{iFac}.
\subsection{\csbh{xintPow}}\label{xintPow}
-\csa{xintPow}{|{f}{g}|}: the original macro is extended to accept fractions on
-input. The output will now always be in the form
-|A/B[n]| (even when the exponent vanishes: |\xintPow
+\csa{xintPow}{|{f}{g}|}:\etype{\Ff\Numf} the original macro is extended to
+accept fractions on input. The output will now always be in the form |A/B[n]|
+(even when the exponent vanishes: |\xintPow
{2/3}{0}|\digitstt{=\xintPow{2/3}{0}}). The original is available as
-\csbxint{iPow}.
+\csbxint{iPow}.
% \xintDigits:= 3;
@@ -6081,10 +6287,11 @@ denominators which can not be computed exactly in a reasonable time. Indeed
% \xintDigits:= 16;
\subsection{\csbh{xintFloatPow}}\label{xintFloatPow}
-{\small New with |1.07|.\par}
+%{\small New with |1.07|.\par}
-|\xintFloatPow [P]{f}{x}| uses either the optional argument |P| or the value of
-|\xintDigits|. It computes a floating approximation to |f^x|.
+|\xintFloatPow [P]{f}{x}|\etype{{\upshape[\numx]}\Ff\numx} uses either the
+optional argument |P| or the value of |\xintDigits|. It computes a floating
+approximation to |f^x|.
The exponent |x| will be fed to a |\numexpr|, hence count registers are accepted
on input for this |x|. And the absolute value \verb+|x|+ must obey the \TeX{}
@@ -6104,18 +6311,17 @@ accuracy (hopefully).
\subsection{\csbh{xintFloatPower}}\label{xintFloatPower}
-{\small New with |1.07|.\par}
+%{\small New with |1.07|.\par}
-\csa{xintFloatPower}|{f}{g}| computes a floating point value |f^g| where the
-exponent |g| is not constrained to be at most the \TeX{} bound
-\texttt{\number "7FFFFFFF}. It may even be a
-fraction |A/B| but must simplify to an integer.
+\csa{xintFloatPower}|[P]{f}{g}|\etype{{\upshape[\numx]}\Ff\Numf} computes a
+floating point value |f^g| where the exponent |g| is not constrained to be at
+most the \TeX{} bound \texttt{\number "7FFFFFFF}. It may even be a fraction
+|A/B| but must simplify to a (possibly big) integer.
\centeredline{|\xintFloatPower [8]{1.000000000001}{1e12}|%
- \digitstt{=\xintFloatPower [8]{1.000000000001}{1e12}}}
+ \digitstt{=\xintFloatPower [8]{1.000000000001}{1e12}}}
\centeredline{|\xintFloatPower [8]{3.1415}{3e9}|%
- \digitstt{=\xintFloatPower [8]{3.1415}{3e9}}}
-Note that |3e9>2^31|. But the number following |e| in the output must at any
-rate obey the \TeX{}
+ \digitstt{=\xintFloatPower [8]{3.1415}{3e9}}} Note that |3e9>2^31|. But the
+number following |e| in the output must at any rate obey the \TeX{}
\digitstt{\number"7FFFFFFF} bound.
@@ -6129,12 +6335,12 @@ The intermediate multiplications are done with a higher precision than
final result to hopefully have the desired accuracy.
\subsection{\csbh{xintFloatSqrt}}\label{xintFloatSqrt}
-{\small New with |1.08|.\par}
+%{\small New with |1.08|.\par}
-\csa{xintFloatSqrt}|[P]{f}| computes a floating point approximation of
-$\sqrt{|f|}$, either using the optional precision |P| or the value of
-|\xintDigits|. The computation is done for a precision of at least 17 figures
-(and the output is rounded if the asked-for precision was smaller).
+\csa{xintFloatSqrt}|[P]{f}|\etype{{\upshape[\numx]}\Ff} computes a floating
+point approximation of $\sqrt{|f|}$, either using the optional precision |P| or
+the value of |\xintDigits|. The computation is done for a precision of at least
+17 figures (and the output is rounded if the asked-for precision was smaller).
\centeredline{|\xintFloatSqrt [50]{12.3456789e12}|}%
\centeredline{${}\approx{}$\digitstt{\xintFloatSqrt [50]{12.3456789e12}}}%
\centeredline{|\xintDigits:=50;\xintFloatSqrt {\xintFloatSqrt {2}}|}%
@@ -6158,27 +6364,27 @@ $\sqrt{|f|}$, either using the optional precision |P| or the value of
% The original commands are extended to accept fractions on input and produce
% fractions on output. Their outputs will now always be in the form |A/B[n]|. The
-% originals are available as \csa{xintiSum} and \csa{xintiSumExpr}.
+% originals are available as \csa{xintiiSum} and \csa{xintiiSumExpr}.
-The original command is extended to accept fractions on input and produce
-fractions on output. The output will now always be in the form |A/B[n]|. The
-original, for big integers only, is available \csa{xintiSum}.
+The original\etype{f{$\to$}{\lowast\Ff}} command is extended to accept fractions
+on input and produce fractions on output. The output will now always be in the
+form |A/B[n]|. The original, for big integers only (in strict format), is
+available as \csa{xintiiSum}.
% \subsection{\csbh{xintPrd}, \csbh{xintPrdExpr}}\label{xintPrd}\label{xintPrdExpr}
\subsection{\csbh{xintPrd}}\label{xintPrd}\label{xintPrdExpr}
-The original is extended to accept fractions on input and produce fractions on
-output. The output will now always be in the form |A/B[n]|. The original, for
-big integers only,
-is
-available as \csa{xintiPrd}.
+The original\etype{f{$\to$}{\lowast\Ff}} is extended to accept fractions on
+input and produce fractions on output. The output will now always be in the form
+|A/B[n]|. The original, for big integers only (in strict format), is available
+as \csa{xintiiPrd}.
\subsection{\csbh{xintCmp}}\label{xintCmp}
-{\small Rewritten in |1.08a|.\par}
+%{\small Rewritten in |1.08a|.\par}
-The macro is extended to fractions. Its output is still either
+The macro\etype{\Ff\Ff} is extended to fractions. Its output is still either
|-1|, |0|, or |1| with no forward slash nor trailing |[n]|.
For choosing branches according to the result of comparing |f| and |g|, the
@@ -6191,168 +6397,140 @@ following syntax is recommended: |\xintSgnFork{\xintCmp{f}{g}}{code for
% of zeros in certain circumstances, causing a serious efficiency impact).
\subsection{\csbh{xintIsOne}}
-See \csbxint{IsOne} (\autoref{xintIsOne}).
+See \csbxint{IsOne}\etype{\Ff} (\autoref{xintIsOne}).
\subsection{\csbh{xintGeq}}\label{xintGeq}
-{\small Rewritten in |1.08a|.\par}
+%{\small Rewritten in |1.08a|.\par}
-The macro is extended to fractions. Beware that the
-comparison is on
-the \emph{absolute values} of the fractions. Can be used as:
+The macro\etype{\Ff\Ff} is extended to fractions. Beware that the comparison is
+on the \emph{absolute values} of the fractions. Can be used as:
\verb+\xintSgnFork{\xintGeq{f}{g}}{}{code for |f|<|g|}{code for
- |f|+$\geqslant$\verb+|g|}+
+ |f|+$\geqslant$\verb+|g|}+
\subsection{\csbh{xintMax}}\label{xintMax}
-{\small Rewritten in |1.08a|.\par}
+%{\small Rewritten in |1.08a|.\par}
-The macro is extended to fractions. But now |\xintMax {2}{3}| returns
-\digitstt{\xintMax {2}{3}}. The original, for use with (possibly big) integers
-only, is available as \csbxint{iMax}: |\xintiMax {2}{3}=|\digitstt{\xintiMax
- {2}{3}}.
+The macro is extended to fractions.\etype{\Ff\Ff} But now |\xintMax {2}{3}|
+returns \digitstt{\xintMax {2}{3}}. The original, for use with (possibly big)
+integers only, is available as \csbxint{iMax}: |\xintiMax
+{2}{3}=|\digitstt{\xintiMax {2}{3}}.
\subsection{\csbh{xintMaxof}}
-See \csbxint{Maxof} (\autoref{xintMaxof}).
+See \csbxint{Maxof} (\autoref{xintMaxof}).\etype{f{$\to$}{\lowast\Ff}}
\subsection{\csbh{xintMin}}\label{xintMin}
-{\small Rewritten in |1.08a|.\par}
+%{\small Rewritten in |1.08a|.\par}
-The macro is extended to fractions. The original, for (big) integers only, is
-available as \csbxint{iMin}.
+The macro is extended to fractions.\etype{\Ff\Ff} The original, for (big)
+integers only, is available as \csbxint{iMin}.
\subsection{\csbh{xintMinof}}
-See \csbxint{Minof} (\autoref{xintMinof}).
+See \csbxint{Minof} (\autoref{xintMinof}).\etype{f{$\to$}{\lowast\Ff}}
\subsection{\csbh{xintAbs}}\label{xintAbs}
-The macro is extended to fractions. The original, for (big) integers only, is
-available as \csbxint{iAbs}. Note that |\xintAbs {-2}|\digitstt{=\xintAbs {-2}}
-whereas |\xintiAbs {-2}|\digitstt{=\xintiAbs {-2}}.
+The macro is extended to fractions.\etype{\Ff} The original, for (big) integers
+only, is available as \csbxint{iAbs}. Note that |\xintAbs
+{-2}|\digitstt{=\xintAbs {-2}} whereas |\xintiAbs {-2}|\digitstt{=\xintiAbs
+ {-2}}.
\subsection{\csbh{xintSgn}}\label{xintSgn}
-The macro is extended to fractions. Naturally, its output is still either
-|-1|, |0|, or |1| with no forward slash nor trailing |[n]|.
+The macro is extended to fractions.\etype{\Ff} Naturally, its output is still
+either |-1|, |0|, or |1| with no forward slash nor trailing |[n]|.
\subsection{\csbh{xintOpp}}\label{xintOpp}
-The macro is extended to fractions. The original is available as
+The macro is extended to fractions.\etype{\Ff} The original is available as
\csbxint{iOpp}. Note that |\xintOpp {3}| now outputs \digitstt{\xintOpp {3}}
whereas |\xintiOpp {3}| returns \digitstt{\xintiOpp {3}}.
\subsection{\csbh{xintDivision}, \csbh{xint\-Quo}, \csbh{xint\-Rem},
\csbh{xintFDg}, \csbh{xintLDg}, \csbh{xintMON}, \csbh{xintMMON}, \csbh{xintOdd}}
-\label{xintiiMON}%
-\label{xintiiMMON}
-
-These macros are extended to accept a fraction on input if this fraction
-in fact reduces to an integer (if not an |\xintError:NotAnInteger| will
-be raised). There is no difference in the format of the outputs, which are big
-integers without fraction slash nor trailing |[n]|, the sole difference is in
-the extended range of accepted inputs.
+These macros\etype{\Ff\Ff} accept a fraction on input if this fraction in fact
+reduces to an integer (if not an |\xintError:NotAnInteger| will be
+raised).\etype{{\textcolor{black}{\upshape or}}\Ff} There is no difference in
+the format of the outputs, which are still (possibly big) integers without
+fraction slash nor trailing |[n]|, the sole difference is in the extended range
+of accepted inputs.
-There are variants with |xintii| rather than |xint| in their names, which accept
-on input only integers in the strict format (they do not use \csbxint{Num}).
-They thus have less overhead, and may be used when one is dealing exclusively
-with (big) integers.
+All have variants whose names start with |xintii| rather than |xint|; these
+variants accept on input only integers in the strict format (they do not use
+\csbxint{Num}). They thus have less overhead, and may be used when one is
+dealing exclusively with (big) integers. These variants are already available in
+\xintname, there is no need for \xintfracname to be loaded.
\centeredline{|\xintNum {1e80}|}
\centeredline{\digitstt{\xintNum{1e80}}}
+\clearpage
+
\etocdepthtag.toc {xintexpr}
\section{Expandable expressions with the \xintexprname package}%
\label{sec:expr}
-
-
The \xintexprname package was first released with version |1.07| of the
-\xintname bundle. Loading this package automatically loads \xintfracname, hence
-also \xintname.
-
-\begin{framed}
- Release |1.09a| has extended the scope of |\xintexpr|-essions with infix
- comparison operators (|<|, |>|, |=|), logical operators (|&|, \verb+|+),
- functions (|round|, |sqrt|, |max|, |all|, etc...) and conditional branching
- (|if| and |?|, |ifsgn| and |:|, the function forms evaluate the skipped
- branches, the |?| and |:| operators do not).
-
- Refer to the first pages of this manual (\autoref{sec:exprsummary} and
-\autoref{sec:exprsummaryII}) for the
- current situation. Apart from
- some adjustments in the description of |\xintNewExpr| which now works with
- |#|, and removal of obsolete material, the documentation in this section is
- close to its earlier state describing |1.08b| and is lacking in examples
- illustrating all the new functionality with |1.09a|.
-\end{framed}
+\xintname bundle. It loads automatically \xintfracname, hence
+also \xintname and \xinttoolsname.
-%% \clearpage
+% Release |1.09a| has extended the scope of |\xintexpr|-essions: infix
+% comparison operators (|<|, |>|, |=|), logical operators (|&|, \verb+|+),
+% functions (|round|, |sqrt|, |max|, |all|, etc...), conditional ``branching''
+% (|if| and |?|, |ifsgn| and |:|).
+The syntax is described in \autoref{sec:exprsummary} and
+\autoref{sec:exprsummaryII}.
-%% \addtocontents{toc}{\protect\STOPMULTICOLS}
\localtableofcontents
-
\subsection{The \csbh{xintexpr} expressions}\label{xintexpr}%
\label{xinttheexpr}\label{xintthe}
An \xintexprname{}ession is a construct
-\csbxint{expr}\meta{expandable\_expression}|\relax| where the expandable
-expression is read and expanded from left to right, and whose
-constituents\MyMarginNote{See \autoref{sec:exprsummary} for
- up-to-date information}
-should be (they are uncovered by iterated left to right expansion of the
-contents during the scanning):
-\begingroup % 18 octobre, je reprends la méthode déjà utilisée au début du
- % docuement le 9 octobre.
-\leftmargini 0pt
-\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
- \labelwidth\parindent
- \itemindent\labelwidth}%
-\item integers or decimal numbers, such as |123.345|, or numbers in scientific
- notation |6.02e23| or |6.02E23| (or anything expanding to
- these things; a decimal number may start directly with a decimal point),
-\item fractions |A/B|, or |a.b/c.d| or |a.beN/c.deM|, if they are to be treated
- as one entity should then be parenthesized, \emph{e.g.} disambiguating |A/B^2|
- from |(A/B)^2|,
-\item the standard binary operators, |+|, |-|, |*|, |/|, and |^| (the |**|
- notation for exponentiation is not recognized and will give an error),
-\item opening and closing parentheses, with arbitrary level of nesting,
-\item |+| and |-| as prefix operators,
-\item |!| as postfix factorial operator (applied to a non-negative integer),
-\item and sub-expressions |\xintexpr|\meta{stuff}|\relax| (they do not need
- to be put within parentheses).
-\item braced material |{...}| which is only allowed to arise when the parser is
- starting to fetch an operand; the material will be completely expanded and
- \emph{must} deliver some number |A|, or fraction |A/B|, possibly with decimal
- mark or ending |[n]|, but without the |e|, |E| of the scientific notation.
- Conversely fractions in |A/B[n]| format with the ending |[n]| \emph{must} be
- enclosed in such braces. Braces also appear in the completely
- other r\^ole of feeding macros with their parameters, they will then not be
- seen by the parser at all as they are managed by the macro.
-\endlist
-\endgroup
+\csbxint{expr}\meta{expandable\_expression}|\relax|\etype{x} where the expandable
+expression is read and completely expanded from left to right.
+
+During this parsing, braced sub-content \marg{expandable} may be serving as a
+macro parameter, or a branch of the |?| two-way and |:| three-way operators;
+else it is treated in a special manner:
+\begin{enumerate}
+\item it is allowed to occur only at the spots where numbers are legal,
+\item the \meta{expandable} contents is then completely expanded as if it were
+ put in a |\csname..\endcsname|,\footnote{well, actually it \emph{is} put in
+ such a \texttt{\char92csname..\char92endcsname}.} thus it escapes entirely
+ the parser scope and infix notations will not be recognized except if the
+ expanded macros know how to handle them by themselves,
+\item and this complete expansion \emph{must} produce a number or a fraction,
+ possibly with decimal mark and trailing |[n]|, the scientific notation is
+ \emph{not} authorized.
+\end{enumerate}
+Braces are the only way to input some number or fraction with
+a trailing |[n]| as square brackets are
+\emph{not} accepted in a |\xintexpr...\relax| if not within such braces.
-Such an expression, like a |\numexpr| expression, is not directly printable, nor
-can it be directly used as argument to the other package macros. For this one
-uses one of the two equivalent forms:
+An |\xintexpr..\relax| \emph{must} end in a |\relax| (which will be absorbed).
+Like a |\numexpr| expression, it is not printable as is, nor can it be directly
+employed as argument to the other package macros. For this one must use one
+of the two equivalent forms:
\begin{itemize}
-\item \csbxint{theexpr}\meta{expandable\_expression}|\relax|, or
-\item \csbxint{the}|\xintexpr|\meta{expandable\_expression}|\relax|.
+\item \csbxint{theexpr}\meta{expandable\_expression}|\relax|\etype{x}, or
+\item \csbxint{the}|\xintexpr|\meta{expandable\_expression}|\relax|.\etype{x}
\end{itemize}
-As with other package macros the computations are done \emph{exactly}, and with
-no simplification of the result. The output format can be coded inside the
-expression through the use of one of the functions
-|round|, |trunc|, |float|, |reduce|.\footnote{In |round| and |trunc| the second
- optional parameter is the number of digits of the fractional part; in |float|
- it is the total number of digits of the mantissa.} \par
+The computations are done \emph{exactly}, and with no simplification of the
+result. The output format for the result can be coded inside the expression
+through the use of one of the functions |round|, |trunc|, |float|,
+|reduce|.\footnote{In |round| and |trunc| the second optional parameter is the
+ number of digits of the fractional part; in |float| it is the total number of
+ digits of the mantissa.} Here are some examples\par
\begingroup\raggedright\leftskip.5cm
{|\xinttheexpr 1/5!-1/7!-1/9!\relax|%
\digitstt{=\xinttheexpr 1/5!-1/7!-1/9!\relax}}\\
@@ -6370,23 +6548,11 @@ expression through the use of one of the functions
\smallskip
\begingroup % 18 octobre, je reprends la méthode déjà utilisée au début du
- % docuement le 9 octobre.
+ % document le 9 octobre.
\leftmargini 0pt
\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
\labelwidth\parindent
\itemindent\labelwidth}%
-\item |\xintexpr|-essions evaluate through expansion to arbitrarily big
- fractions, and are prefixed by |\xintthe| for printing (or use
- |\xinttheexpr|).
-\item the standard operations of addition, subtraction,
- multiplication, division, power, are written in infix form,
-\item recognized numbers on input are either integers, decimal numbers, or
- numbers written in scientific notation, (or anything expanding to the previous
- things),
-\item macros encountered on the way must be fully expandable,
-\item fractions on input with the ending |[n]| part, or macros expanding to
- such some |A/B[n]| must be enclosed in
- (exactly one) pair of braces,
\item the expression may contain arbitrarily many levels of nested parenthesized
sub-expressions,
\item sub-contents giving numbers of fractions should be either
@@ -6399,23 +6565,16 @@ expression through the use of one of the functions
nor printed, for this one must use |\xinttheexpr...\relax| or
|\xintthe\xintexpr...\relax|,
\item one does not use |\xinttheexpr...\relax| as a sub-constituent of an
- |\xintexpr...\relax| as it would have to be put
- within some braces, and it is simpler to write it directly as
+ |\xintexpr...\relax| (or |\xinttheexpr...\relax|) but simply
|\xintexpr...\relax|,
-\item as usual no simplification is done on the output and is the responsability
- of post-processing,
-\item very long output will need special macros to break
- across lines, like the |\printnumber| macro used in this documentation,
-\item use of |+|, |*|, ... inside parameters to macros is out of the scope of
- the |\xintexpr| parser,
-\item finally each \xintexprname{}ession is completely expandable and obtains
+\item each \xintexprname{}ession is completely expandable and obtains
its result in two expansion steps.
\endlist
\endgroup
-With defined macros destined to be re-used within another one, one has the
-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|.
+% With defined macros destined to be re-used within another one, one has the
+% 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}
@@ -6435,52 +6594,53 @@ decimal point.
\subsubsection{\csbh{xintexprSafeCatcodes}}\label{xintexprSafeCatcodes}
-{\small New with release |1.09a|.\par}
+%{\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 (locally) sets the catcodes of the characters acting
-as operators to safe values. The command \csbxint{NewExpr} does it by itself,
-in a group.
+|\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).
\subsubsection{\csbh{xintexprRestoreCatcodes}}\label{xintexprRestoreCatcodes}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
Restores the catcodes to the earlier state.
\bigskip
-Spaces inside an |\xinttheexpr...\relax| should mostly be
-innocuous (if the
-expression contains macros, then it is the macro which is responsible for
-grabbing its arguments, so spaces within the arguments are presumably to be
-avoided, as a general rule.).
-
-|\xintexpr| and |\xintthexpr| are very agnostic regarding catcodes: 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. The characters |+|, |-|, |*|, |/|, |^| or |!| should
-not be
-active as everything is expanded along the way. If one of them (especially |!|
-which is made active by Babel for certain languages) 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 this will avoid
-the subsequent slow scan digit by digit of its expansion (other macros from the
-\xintfracname package generally \emph{must} be used within a brace pair, as they
-expand to fractions |A/B[n]| with the trailing |[n]|; the |\xintFac| produces an
-integer with no |[n]| and braces are only optional, but preferable, as the
-scanner will get the job done faster.)
-
-Sub-material within braces is treated technically in a different manner, and
-depending on the macros used therein may be more sensitive to the catcode of the
-five operations. Digits, slash, square
-brackets, sign, produced on output by an |\xinttheexpr| are all of catcode 12.
-For the output of |\xintthefloatexpr| digits, decimal dot, signs are of catcode
-12, and the `e' is of catcode 11.
-
-Note that if some macro is inserted in the expression it will expand and grab
-its arguments before the parser may get a chance to see them, so the situation
-with catcodes and spaces is not as flexible within the macro arguments.
+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.
+
+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|.
+
+% In the case of the factorial, the macro
+% |\xintFac| may be used rather than the postfix |!|, preferably within braces as
+% this will avoid the subsequent slow scan digit by digit of its expansion (other
+% macros from the \xintfracname package generally \emph{must} be used within a
+% brace pair, as they expand to fractions |A/B[n]| with the trailing |[n]|; the
+% |\xintFac| produces an integer with no |[n]| and braces are only optional, but
+% preferable, as the scanner will get the job done faster.)
+
+% Sub-material within braces is treated technically in a different manner, and
+% depending on the macros used therein may be more sensitive to the catcode of the
+% 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
+11.
+
+A macro with arguments will expand and grab its arguments before the
+parser may get a chance to see them, so the situation with catcodes and spaces
+is not the same within such macro arguments (or within braces used to protect
+square brackets).
\subsection{Expandability}
@@ -6544,11 +6704,9 @@ as:\centeredline{|\xintNewExpr{\myformula}[n]|\marg{stuff}, where}
\begin{itemize}
\item \meta{stuff} will be inserted inside |\xinttheexpr . . . \relax|,
\item |n| is an integer between zero and nine, inclusive, and tells how many
- parameters will |\myformula| have (it is \emph{mandatory} despite the bracket
- notation, and |n=0| if the macro to be defined has no
- parameter,\footnote{there is some use for \csa{xintNewExpr}|[0]| compared to
- an
- \csa{edef} as \csa{xintNewExpr} has some built-in catcode protection.}
+ parameters will |\myformula| have (it is \emph{mandatory} even if
+ |n=0|\footnote{there is some use for \csa{xintNewExpr}|[0]| compared to an
+ \csa{edef} as \csa{xintNewExpr} has some built-in catcode protection.})
\item the placeholders |#1|, |#2|, ..., |#n| are used inside \meta{stuff}
in their usual r\^ole.
\end{itemize}
@@ -6557,15 +6715,12 @@ The macro |\myformula| is defined without checking if it
already exists, \LaTeX{} users might prefer to do first |\newcommand*\myformula
{}| to get a reasonable error message in case |\myformula| already exists.
-The definition of |\myformula| made by |\xintNewExpr| is global, it transcends
-\TeX{} groups or \LaTeX{} environments. The protection against active characters
-is done automatically.
+The definition of |\myformula| made by |\xintNewExpr| is global. The protection
+against active characters is done automatically.
It will be a completely expandable macro entirely built-up using |\xintAdd|,
-|\xintSub|, |\xintMul|, |\xintDiv|, |\xintPow|, |\xintOpp| and
-|\xintFac|\MyMarginNote{|1.09a|: and many others... } and
-corresponding to the formula as written with the infix
-operators.
+|\xintSub|, |\xintMul|, |\xintDiv|, |\xintPow|, etc\dots as corresponds to the
+expression written with the infix operators.
\begin{framed}
A ``formula'' created by |\xintNewExpr| is thus a macro whose parameters are
@@ -6593,8 +6748,7 @@ operators.
@\xintNewExpr\myformE[2]{ -----((((((#1*10-5*#2)))))) }
@\xintNewExpr\myformF[4]{ -#1^-#2*-#3-#4 }
@\xintNewExpr\myformG[4]{ -#1*-#2^-#3-#4 }
-\xintNewExpr\DET[9]{ #1*#5*#9+#2*#6*#7+#3*#4*#8-#1*#6*#8-#2*#4*#9-#3*#5*#7 }
-|
+\xintNewExpr\DET[9]{ #1*#5*#9+#2*#6*#7+#3*#4*#8-#1*#6*#8-#2*#4*#9-#3*#5*#7 }|
% \xintNewExpr\myformA[4]{ #1 + #2 * #3^#4 }
% \xintNewExpr\myformB[3]{ (#1 + 1.75)^#2 + #3*2.7 }
@@ -6639,12 +6793,12 @@ This is why |\printnumber| was used, to have breaks across lines.
\subsubsection {Use of conditional operators}
- The |1.09a| conditional operators |?| and |:| can not be parsed by
- |\xintNewExpr| when they contain macro parameters within their scope, and not
- only numerical data. However using the functions |if| and, respectively
- |ifsgn|, the parsing should succeed. Moreover the created macro will \emph{not
- evaluate the branches to be skipped}, thus behaving exactly like |?| and |:|
- would have in the |\xintexpr|.
+The |1.09a| conditional operators |?| and |:| cannot be parsed by |\xintNewExpr|
+when they contain macro parameters |#1|,\dots, |#9| within their scope. However
+replacing them with the functions |if| and, respectively |ifsgn|, the parsing
+should succeed. And the created macro will \emph{not evaluate the branches
+ to be skipped}, thus behaving exactly like |?| and |:| would have in the
+|\xintexpr|.
\xintNewExpr\Formula [3]{ if((#1>#2) & (#2>#3),
sqrt(#1-#2)*sqrt(#2-#3), #1^2+#3/#2) }
@@ -6706,8 +6860,7 @@ 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}} }|
\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }
\ttfamily
@@ -6718,55 +6871,55 @@ pre-defined to be in correspondance with them):
\subsection{\csbh{xintnumexpr},
\csbh{xintthenumexpr}}\label{xintnumexpr}\label{xintthenumexpr}
-Equivalent 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.
+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.
\subsection{\csbh{xintboolexpr},
\csbh{xinttheboolexpr}}\label{xintboolexpr}\label{xinttheboolexpr}
-{\small New in |1.09c|.\par}
+%{\small New in |1.09c|.\par}
-Equivalent 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)).
+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}
+%{\small New in |1.09c|.\par}
-\csh{xintifboolexpr}|{<expr>}{YES}{NO}| 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.
+\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}
+%{\small New in |1.09c|.\par}
-\csh{xintifboolfloatexpr}|{<expr>}{YES}{NO}| 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.
+\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}
-\csbxint{floatexpr}|...\relax| is exactly like |\xintexpr...\relax| but with the
-four binary operations and the power function mapped to \csa{xintFloatAdd},
-\csa{xintFloatSub}, \csa{xintFloatMul}, \csa{xintFloatDiv} and
-\csa{xintFloatPower}. The precision is from the current setting of
+\csbxint{floatexpr}|...\relax|\etype{x} is exactly like |\xintexpr...\relax| but
+with the four binary operations and the power function mapped to
+\csa{xintFloatAdd}, \csa{xintFloatSub}, \csa{xintFloatMul}, \csa{xintFloatDiv}
+and \csa{xintFloatPower}. The precision is from the current setting of
|\xintDigits| (it can not be given as an optional parameter).
-Currently, the factorial function hasn't yet a float version; so inside
+Currently, the factorial function hasn't yet a float version; so inside
|\xintthefloatexpr . . . \relax|, |n!| will be computed exactly. Perhaps this
-will
-be improved in a future release.
+will be improved in a future release.
\xintDigits:= 9;
@@ -6803,24 +6956,26 @@ sub-expression. It was a bit funny to discover that |maple|, configured with
floats, gives exactly the same result with the same rounding errors
as does |\xintthefloatexpr|!
-Note that using |\xintthefloatexpr| only pays off compared to using
-|\xinttheexpr| and then |\xintFloat| if the computations turn out to involve
-hundreds of digits. For elementary calculations with hand written numbers
-(not using the scientific notation with exponents differing greatly) it will
-generally be more efficient to use |\xinttheexpr|. The situation is quickly
-otherwise if one starts using the Power function. Then, |\xintthefloat| is
-often useful; and sometimes indispensable to achieve the (approximate)
-computation in reasonable time.
+Using |\xintthefloatexpr| only pays off compared to using |\xinttheexpr|
+followed with |\xintFloat| if the computations turn out to involve hundreds of
+digits. For elementary calculations with hand written numbers (not using the
+scientific notation with exponents differing greatly) it will generally be more
+efficient to use |\xinttheexpr|. The situation is quickly otherwise if one
+starts using the Power function. Then, |\xintthefloat| is often useful; and
+sometimes indispensable to achieve the (approximate) computation in reasonable
+time.
-We can try some crazy things:
+We can try some crazy things:
+%
\centeredline{|\xintDigits:=12;\xintthefloatexpr 1.000000000000001^1e15\relax|}
+%
\centeredline{\xintDigits:=12;%
-\digitstt{\xintthefloatexpr 1.000000000000001^1e15\relax}}
-Note that contrarily to some professional computing sofware which are our
-concurrents on this market, the \digitstt{1.000000000000001} wasn't rounded
-to |1| despite the setting of \csa{xintDigits}; it would have been if we had
-input it as
-|(1+1e-15)|.
+ \digitstt{\xintthefloatexpr 1.000000000000001^1e15\relax}}
+%
+Contrarily to some professional computing sofware which are our concurrents on
+this market, the \digitstt{1.000000000000001} wasn't rounded to |1| despite the
+setting of \csa{xintDigits}; it would have been if we had input it as
+|(1+1e-15)|.
% \xintDigits:=12;
% \pdfresettimer
@@ -6836,28 +6991,24 @@ input it as
This is exactly like \csbxint{NewExpr} except that the created formulas are
set-up to use |\xintthefloatexpr|. The precision used for numbers fetched as
-parameters will be the one
-locally given by |\xintDigits| at the time of use of 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|.
+parameters will be the one locally given by |\xintDigits| at the time of use of
+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}
-{\small New in |1.09c|.\par }
+%{\small New in |1.09c|.\par }
Like \csbxint{NewExpr} but using |\xintthenumexpr|.
\subsection{\csbh{xintNewBoolExpr}}\label{xintNewBoolExpr}
-{\small New in |1.09c|.\par }
+%{\small New in |1.09c|.\par }
Like \csbxint{NewExpr} but using |\xinttheboolexpr|.
-
-
-
\xintDigits:= 16;
-\subsection{Technicalities and experimental status}
+\subsection{Technicalities}
As already mentioned \csa{xintNewExpr}|\myformula[n]| does not check the prior
existence of a macro |\myformula|. And the number of parameters |n| given as
@@ -6872,7 +7023,7 @@ 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
zapping the first two things, the third one will then recover |A/B[n]| from the
-undefined 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
@@ -6882,10 +7033,10 @@ expandably and encapsulates an arbitrarily long fraction in a single token (left
with undefined meaning), thus providing tremendous relief to the programmer in
his/her expansion control.
-\begin{framed}
- This implementation and user interface are still to be considered
- \emph{experimental}.
-\end{framed}
+% \begin{framed}
+% This implementation and user interface are still to be considered
+% \emph{experimental}.
+% \end{framed}
Syntax errors in the input such as using a one-argument function with two
arguments will generate low-level \TeX{} processing unrecoverable errors, with
@@ -6900,7 +7051,7 @@ treated, it assumes it is the start of the function name and will expand forward
in the hope of hitting an opening parenthesis; if none is found at least it
should stop when encountering the |\relax| marking the end of the expressions.
-Note that |\relax| is absolutely mandatory (contrarily to a |\numexpr|).
+Note that |\relax| is mandatory (contrarily to a |\numexpr|).
\subsection{Acknowledgements}
@@ -6939,19 +7090,19 @@ uppercased.
\subsection{\csbh{xintDecToHex}}\label{xintDecToHex}
-Converts from decimal to hexadecimal.
+Converts from decimal to hexadecimal.\etype{f}
\texttt{\string\xintDecToHex \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\digitstt{->\printnumber{\xintDecToHex{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
\subsection{\csbh{xintDecToBin}}\label{xintDecToBin}
-Converts from decimal to binary.
+Converts from decimal to binary.\etype{f}
\texttt{\string\xintDecToBin \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\digitstt{->\printnumber{\xintDecToBin{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
\subsection{\csbh{xintHexToDec}}\label{xintHexToDec}
-Converts from hexadecimal to decimal.
+Converts from hexadecimal to decimal.\etype{f}
\texttt{\string\xintHexToDec
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
@@ -6959,7 +7110,7 @@ Converts from hexadecimal to decimal.
\subsection{\csbh{xintBinToDec}}\label{xintBinToDec}
-Converts from binary to decimal.
+Converts from binary to decimal.\etype{f}
\texttt{\string\xintBinToDec
\string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent
@@ -6967,7 +7118,7 @@ Converts from binary to decimal.
\subsection{\csbh{xintBinToHex}}\label{xintBinToHex}
-Converts from binary to hexadecimal.
+Converts from binary to hexadecimal.\etype{f}
\texttt{\string\xintBinToHex
\string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent
@@ -6975,7 +7126,7 @@ Converts from binary to hexadecimal.
\subsection{\csbh{xintHexToBin}}\label{xintHexToBin}
-Converts from hexadecimal to binary.
+Converts from hexadecimal to binary.\etype{f}
\texttt{\string\xintHexToBin
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
@@ -6984,8 +7135,8 @@ Converts from hexadecimal to binary.
\subsection{\csbh{xintCHexToBin}}\label{xintCHexToBin}
-Also converts from hexadecimal to binary. Faster on inputs with at least
-one hundred hexadecimal digits.
+Also converts from hexadecimal to binary.\etype{f} Faster on inputs with at
+least one hundred hexadecimal digits.
\texttt{\string\xintCHexToBin
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
@@ -7009,44 +7160,44 @@ integers.
\subsection{\csbh{xintGCD}}\label{xintGCD}
-\csa{xintGCD\n\m} computes the greatest common divisor. It is
-positive, except when both |N| and |M| vanish, in which case the macro
-returns zero.
+\csa{xintGCD\n\m}\etype{\Numf\Numf} computes the greatest common divisor. It is
+positive, except when both |N| and |M| vanish, in which case the macro returns
+zero.
\centeredline{\csa{xintGCD}|{10000}{1113}|\digitstt{=\xintGCD{10000}{1113}}}
\centeredline{|\xintGCD{123456789012345}{9876543210321}=|\digitstt
- {\xintGCD{123456789012345}{9876543210321}}}
+ {\xintGCD{123456789012345}{9876543210321}}}
\subsection{\csbh{xintGCDof}}\label{xintGCDof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintGCDof}|{{a}{b}{c}...}| computes the greatest common divisor of all
+\csa{xintGCDof}|{{a}{b}{c}...}|\etype{f{$\to$}{\lowast\Numf}} computes the greatest common divisor of all
integers |a|, |b|, \dots{} The list argument
may be a macro, it is \fexpan ded first and must contain at least one item.
\subsection{\csbh{xintLCM}}\label{xintLCM}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintGCD\n\m} computes the least common multiple. It is |0| if one of the
-two integers vanishes.
+\csa{xintGCD\n\m}\etype{\Numf\Numf} computes the least common multiple. It is
+|0| if one of the two integers vanishes.
\subsection{\csbh{xintLCMof}}\label{xintLCMof}
-{\small New with release |1.09a|.\par}
+%{\small New with release |1.09a|.\par}
-\csa{xintLCMof}|{{a}{b}{c}...}| computes the least common multiple of all
-integers |a|, |b|, \dots{} The list argument
-may be a macro, it is \fexpan ded first and must contain at least one item.
+\csa{xintLCMof}|{{a}{b}{c}...}|\etype{f{$\to$}{\lowast\Numf}} computes the least
+common multiple of all integers |a|, |b|, \dots{} The list argument may be a
+macro, it is \fexpan ded first and must contain at least one item.
\subsection{\csbh{xintBezout}}\label{xintBezout}
\xintAssign{{\xintBezout {10000}{1113}}}\to\X
\xintAssign {\xintBezout {10000}{1113}}\to\A\B\U\V\D
-\csa{xintBezout\n\m} returns five numbers |A|, |B|, |U|, |V|, |D| within
-braces. |A| is the first (expanded, as usual) input number, |B| the
-second, |D| is the GCD, and \digitstt{UA - VB = D}.
-\centeredline{|\xintAssign {{\xintBezout {10000}{1113}}}\to\X|}
-\centeredline{|\meaning\X: |\digitstt{\meaning\X }.}
+\csa{xintBezout\n\m}\etype{\Numf\Numf} returns five numbers |A|, |B|, |U|, |V|,
+|D| within braces. |A| is the first (expanded, as usual) input number, |B| the
+second, |D| is the GCD, and \digitstt{UA - VB = D}. \centeredline{|\xintAssign
+ {{\xintBezout {10000}{1113}}}\to\X|} \centeredline{|\meaning\X:
+ |\digitstt{\meaning\X }.}
\noindent{|\xintAssign {\xintBezout {10000}{1113}}\to\A\B\U\V\D|}\\
|\A: |\digitstt{\A },
|\B: |\digitstt{\B },
@@ -7087,9 +7238,9 @@ second, |D| is the GCD, and \digitstt{UA - VB = D}.
[{#1}\hskip 0pt plus 1pt \allowlistsplitx ]
\endgroup
-\csa{xintEuclideAlgorithm\n\m} applies the Euclide algorithm and
-keeps a copy of all quotients and remainders.
-\centeredline{|\xintAssign {{\xintEuclideAlgorithm {10000}{1113}}}\to\X|}
+\csa{xintEuclideAlgorithm\n\m}\etype{\Numf\Numf} applies the Euclide algorithm
+and keeps a copy of all quotients and remainders. \centeredline{|\xintAssign
+ {{\xintEuclideAlgorithm {10000}{1113}}}\to\X|}
|\meaning\X: |\digitstt{\expandafter\allowlistsplit
\meaning\X\relax .}
@@ -7104,12 +7255,12 @@ final quotient and last (zero) remainder.
\xintAssign {{\xintBezoutAlgorithm {10000}{1113}}}\to\X
-\csa{xintBezoutAlgorithm\n\m} applies the Euclide algorithm and
-keeps a copy of all quotients and remainders. Furthermore it
-computes the entries of the successive products of the 2 by 2 matrices
-$\left(\vcenter{\halign {\,#&\,#\cr q & 1 \cr 1 & 0 \cr}}\right)$
-formed from the quotients arising in the algorithm.
-\centeredline{|\xintAssign {{\xintEuclideAlgorithm {10000}{1113}}}\to\X|}
+\csa{xintBezoutAlgorithm\n\m}\etype{\Numf\Numf} applies the Euclide algorithm
+and keeps a copy of all quotients and remainders. Furthermore it computes the
+entries of the successive products of the 2 by 2 matrices
+$\left(\vcenter{\halign {\,#&\,#\cr q & 1 \cr 1 & 0 \cr}}\right)$ formed from
+the quotients arising in the algorithm. \centeredline{|\xintAssign
+ {{\xintEuclideAlgorithm {10000}{1113}}}\to\X|}
|\meaning\X: |\digitstt{\expandafter\allowlistsplit\meaning\X \relax .}
@@ -7122,20 +7273,19 @@ entry, and then these four things at each step until the end.
\subsection{\csbh{xintTypesetEuclideAlgorithm}\texorpdfstring{\allowbreak\null\hspace*{.25cm}}{}}%
\label{xintTypesetEuclideAlgorithm}
-This macro is just an example of how to organize the data returned
-by \csa{xintEuclideAlgorithm}. Copy the source code to a new macro
-and modify it to what is needed.
-\centeredline{|\xintTypesetEuclideAlgorithm
- {123456789012345}{9876543210321}|} \xintTypesetEuclideAlgorithm
-{123456789012345}{9876543210321}
+This macro is just an example of how to organize the data returned by
+\csa{xintEuclideAlgorithm}.\ntype{\Numf\Numf} Copy the source code to a new
+macro and modify it to what is needed.
+\centeredline{|\xintTypesetEuclideAlgorithm {123456789012345}{9876543210321}|}
+\xintTypesetEuclideAlgorithm {123456789012345}{9876543210321}
\subsection{\csbh{xintTypesetBezoutAlgorithm}}%
\label{xintTypesetBezoutAlgorithm}
-This macro is just an example of how to organize the data returned
-by \csa{xintBezoutAlgorithm}. Copy the source code to a new macro
-and modify it to what is needed.
+This macro is just an example of how to organize the data returned by
+\csa{xintBezoutAlgorithm}.\ntype{\Numf\Numf} Copy the source code to a new
+macro and modify it to what is needed.
\centeredline{|\xintTypesetBezoutAlgorithm {10000}{1113}|}
\xintTypesetBezoutAlgorithm {10000}{1113}
@@ -7148,8 +7298,12 @@ when given their parameters. The arguments serving as indices are systematically
given to a |\numexpr| expressions (new with |1.06|!) , hence \fexpan ded,
they may be count registers, etc...
-This package was
-first released with version |1.03| of the \xintname bundle.
+This package was first released with version |1.03| of the \xintname bundle.
+
+We use \Ff{} for the expansion type of various macro arguments, but if only
+\xintname and not \xintfracname is loaded this should be more appropriately
+\Numf. The macro \csbxint{iSeries} is special and expects summing big integers
+obeying the strict format, even if \xintfracname is loaded.
%% \clearpage
@@ -7161,24 +7315,27 @@ first released with version |1.03| of the \xintname bundle.
\edef\w {\xintSeries {0}{50}{\coeff}}
\edef\z {\xintJrr {\w}[0]}
-\csa{xintSeries}|{A}{B}{\coeff}| computes
+\csa{xintSeries}|{A}{B}{\coeff}|\etype{\numx\numx\Ff} computes
$\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|$. The initial and final indices
must obey the |\numexpr| constraint of expanding to numbers at most |2^31-1|.
-The |\coeff| macro must be a
-one-parameter fully expandable command, taking on input an explicit number |n|
-and producing some fraction |\coeff{n}|; it is expanded at the time it is
-needed.\footnote{\label{fn:xintiiMON}\csa{xintiiMON} is like \csbxint{MON} but does not parse its
- argument through \csbxint{Num}, for efficiency; other macros of this type are
- \csa{xintiiMMON}, \csa{xintiiLDg}, \csa{xintiiFDg}, \csa{xintiiOdd}.}
+The |\coeff| macro must be a one-parameter \fexpan dable command, taking on
+input an explicit number |n| and producing some number or fraction |\coeff{n}|;
+it is expanded at the time it is
+needed.\footnote{\label{fn:xintiiMON}\csbxint{iiMON} is like \csbxint{MON} but
+ does not parse its argument through \csbxint{Num}, for efficiency; other
+ macros of this type are \csbxint{iiAdd}, \csbxint{iiMul},
+ \csbxint{iiSum}, \csbxint{iiPrd}, \csbxint{iiMMON},
+ \csbxint{iiLDg}, \csbxint{iiFDg}, \csbxint{iiOdd}, \dots}
+%
\dverb|@
\def\coeff #1{\xintiiMON{#1}/#1.5} % (-1)^n/(n+1/2)
\edef\w {\xintSeries {0}{50}{\coeff}} % we want to re-use it
\edef\z {\xintJrr {\w}[0]} % the [0] for a microsecond gain.
% \xintJrr preferred to \xintIrr: a big common factor is suspected.
% But numbers much bigger would be needed to show the greater efficiency.
-\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]
-|
-\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \] For info,
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]|
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]
+For info,
before action by |\xintJrr| the inner representation of the result has a
denominator of |\xintLen {\xintDenominator\w}=|\xintLen
{\xintDenominator\w} digits. This troubled me as @101!!@ has only 81
@@ -7250,8 +7407,7 @@ digits) in the denominator. See the explanations in the next section.
\xintTrunc {12}
{\xintSeries {1}{\cnta}{\coeffleibnitz}}\dots
\endgraf
-\ifnum\cnta < 30 \advance\cnta 1 \repeat
-|
+\ifnum\cnta < 30 \advance\cnta 1 \repeat|
\begin{multicols}{3}
\def\coeffleibnitz #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]} \cnta 1
\loop
@@ -7266,11 +7422,9 @@ digits) in the denominator. See the explanations in the next section.
\def\coeff #1{\xintiTrunc {40}
{\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
- \csa{xintiSeries}|{A}{B}{\coeff}| computes
- $\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|$ where now |\coeff{n}|
- \emph{must} expand to a (possibly long) integer, as is acceptable on input by
- the
- integer-only \csa{xintiAdd}.
+ \csa{xintiSeries}|{A}{B}{\coeff}|\etype{\numx\numx f} computes
+ $\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|$ where |\coeff{n}|
+ must \fexpan d to a (possibly long) integer in the strict format.
\dverb|@
\def\coeff #1{\xintiTrunc {40}{\xintMON{#1}/#1.5}}%
% better:
@@ -7281,8 +7435,8 @@ digits) in the denominator. See the explanations in the next section.
{\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
% (-1)^n/(n+1/2) times 10^40, truncated to an integer.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
- \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\dots\]
-|
+ \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\dots\]|
+
The |#1.5| trick to define the |\coeff| macro was neat, but |1/3.5|, for
example, turns internally into |10/35| whereas it would be more efficient to
have |2/7|. The second way of coding the wanted coefficient avoids a superfluous
@@ -7310,8 +7464,8 @@ expansion of the exactly computed partial sum of the series:
\def\exactcoeff #1%
{\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}%
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12}
- = \xintTrunc {50}{\xintSeries {0}{50}{\exactcoeff}}\dots\]
-|
+ = \xintTrunc {50}{\xintSeries {0}{50}{\exactcoeff}}\dots\]|
+
\def\coeff #1{\xintiRound {40}
{\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
% (-1)^n/(n+1/2) times 10^40, rounded to an integer.
@@ -7330,12 +7484,12 @@ estimated wrongly the 39th and 40th digits of the exact result\footnote{as
\subsection{\csbh{xintRationalSeries}}\label{xintRationalSeries}
-{\small \hspace*{\parindent}New with release |1.04|.\par}
+%{\small \hspace*{\parindent}New with release |1.04|.\par}
-\noindent \csa{xintRationalSeries}|{A}{B}{f}{\ratio}| evaluates
-$\sum_{\text{|n=A|}}^{\text{|n=B|}}|F(n)|$, where |F(n)| is specified indirectly
-via the data of |f=F(A)| and the one-parameter macro |\ratio| which must be such
-that |\macro{n}| expands to |F(n)/F(n-1)|. The name indicates that
+\noindent \csa{xintRationalSeries}|{A}{B}{f}{\ratio}|\etype{\numx\numx\Ff\Ff}
+evaluates $\sum_{\text{|n=A|}}^{\text{|n=B|}}|F(n)|$, where |F(n)| is specified
+indirectly via the data of |f=F(A)| and the one-parameter macro |\ratio| which
+must be such that |\macro{n}| expands to |F(n)/F(n-1)|. The name indicates that
\csa{xintRationalSeries} was designed to be useful in the cases where
|F(n)/F(n-1)| is a rational function of |n| but it may be anything expanding to
a fraction. The macro |\ratio| must be an expandable-only compatible command and
@@ -7351,8 +7505,8 @@ expressions built with such; they must obey the \TeX{} bound. The initial term
\noindent$\sum_{n=0}^{\the\cnta} \frac{2^n}{n!}=
\xintTrunc{12}\z\dots=
\xintFrac\z=\xintFrac{\xintIrr\z}$\vtop to 5pt{}\endgraf
-\ifnum\cnta<20 \advance\cnta 1 \repeat
-|
+\ifnum\cnta<20 \advance\cnta 1 \repeat|
+
\def\ratio #1{2/#1[0]}% 2/n, comes from the series of exp(2)
\cnta 0
\loop
@@ -7376,8 +7530,8 @@ evaluate the partial sums via a less silly iterative scheme.
\noindent$\sum_{n=0}^{\the\cnta} \frac{(-1)^n}{n!}=
\xintTrunc{20}\z\dots=\xintFrac{\z}=\xintFrac{\xintIrr\z}$
\vtop to 5pt{}\endgraf
-\ifnum\cnta<20 \advance\cnta 1 \repeat
-|
+\ifnum\cnta<20 \advance\cnta 1 \repeat|
+
\def\ratio #1{-1/#1[0]}% -1/n, comes from the series of exp(-1)
\cnta 0 % previously declared count
@@ -7405,8 +7559,7 @@ will compute $\sum_{n=0}^{n=b} x^n/n!$:\par
$\sum_{n=0}^{\the\cnta} (.57)^n/n! = \xintTrunc {50}
{\xintRationalSeries {0}{\cnta}{1}{\ratioexp{.57}}}\dots$
\vtop to 5pt {}\endgraf
-\ifnum\cnta<50 \advance\cnta 10 \repeat
-|
+\ifnum\cnta<50 \advance\cnta 10 \repeat|
\cnta 0
\loop
@@ -7441,8 +7594,8 @@ Here is a slightly more complicated evaluation:
$\sum_{n=\the\cnta}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!}/%
\sum_{n=0}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!} =
\xintTrunc{8}{\xintDiv\z\w}\dots$ \vtop to 5pt{}\endgraf
-\ifnum\cnta<20 \advance\cnta 1 \repeat
-|
+\ifnum\cnta<20 \advance\cnta 1 \repeat|
+
\cnta 1
\begin{multicols}{2}
\loop \edef\z {\xintRationalSeries
@@ -7459,16 +7612,17 @@ $\sum_{n=\the\cnta}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!}/%
\subsection{\csbh{xintRationalSeriesX}}\label{xintRationalSeriesX}
-{\small \hspace*{\parindent}New with release |1.04|.\par}
+%{\small \hspace*{\parindent}New with release |1.04|.\par}
-\noindent\csa{xintRationalSeriesX}|{A}{B}{\first}{\ratio}{\g}| is a parametrized
-version of \csa{xintRationalSeries} where |\first| is turned into a one
-parameter macro with |\first{\g}| giving |F(A,\g)| and |\ratio| is a two
-parameters macro such that |\ratio{n}{\g}| gives |F(n,\g)/F(n-1,\g)|. The
-parameter |\g| is evaluated only once at the beginning of the computation, and
-can thus itself be the yet unevaluated result of a previous computation.
+\noindent\csa{xintRationalSeriesX}|{A}{B}{\first}{\ratio}{\g}|%
+\etype{\numx\numx\Ff\Ff f} is a parametrized version of \csa{xintRationalSeries}
+where |\first| is now a one-parameter macro such that |\first{\g}| gives the
+initial term and |\ratio| is a two-parameter macro such that |\ratio{n}{\g}|
+represents the ratio of one term to the previous one. The parameter |\g| is
+evaluated only once at the beginning of the computation, and can thus itself be
+the yet unevaluated result of a previous computation.
-Let |\ratio| be such a two-parameters macro; note the subtle differences
+Let |\ratio| be such a two-parameter macro; note the subtle differences
between\centeredline{|\xintRationalSeries {A}{B}{\first}{\ratio{\g}}|}
\centeredline{and |\xintRationalSeriesX {A}{B}{\first}{\ratio}{\g}|.} First the
location of braces differ... then, in the former case |\first| is a
@@ -7500,8 +7654,7 @@ next section.
\xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
{\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-1]}}}\dots
\endgraf
-\ifnum\cnta < 12 \advance \cnta 1 \repeat
-|
+\ifnum\cnta < 12 \advance \cnta 1 \repeat|
\def\firstterm #1{1[0]}% first term of the exponential series
% although it is the constant 1, here it must be defined as a
@@ -7620,7 +7773,8 @@ Update: release |1.08a| of \xintseriesname now includes a tentative naive
\subsection{\csbh{xintPowerSeries}}\label{xintPowerSeries}
-\csa{xintPowerSeries}|{A}{B}{\coeff}{f}| evaluates the sum
+\csa{xintPowerSeries}|{A}{B}{\coeff}{f}|\etype{\numx\numx\Ff\Ff}
+evaluates the sum
$\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|\cdot |f|^{\text{|n|}}$. The
initial and final indices are given to a |\numexpr| expression. The |\coeff|
macro (which, as argument to \csa{xintPowerSeries} is expanded only at the time
@@ -7654,8 +7808,7 @@ which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
\def\f {5/17[0]}
\[ \sum_{n=0}^{n=20} \Bigl(\frac 5{17}\Bigr)^n
=\xintFrac{\xintIrr{\xintPowerSeries {0}{20}{\geom}{\f}}}
- =\xintFrac{\xinttheexpr (17^21-5^21)/12/17^20\relax}\]
-|
+ =\xintFrac{\xinttheexpr (17^21-5^21)/12/17^20\relax}\]|%
\def\geom #1{1[0]} % the geometric series
\def\f {5/17[0]} %
\[ \sum_{n=0}^{n=20} \Bigl(\frac 5{17}\Bigr)^n
@@ -7668,8 +7821,7 @@ which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
\[ \log 2 \approx \sum_{n=1}^{20} \frac1{n\cdot 2^n}
= \xintFrac {\xintIrr {\xintPowerSeries {1}{20}{\coefflog}{\f}}}\]
\[ \log 2 \approx \sum_{n=1}^{50} \frac1{n\cdot 2^n}
- = \xintFrac {\xintIrr {\xintPowerSeries {1}{50}{\coefflog}{\f}}}\]
-|
+ = \xintFrac {\xintIrr {\xintPowerSeries {1}{50}{\coefflog}{\f}}}\]|%
\def\coefflog #1{1/#1[0]} % 1/n
\def\f {1/2[0]}%
\[ \log 2 \approx \sum_{n=1}^{20} \frac1{n\cdot 2^n}
@@ -7685,8 +7837,7 @@ which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
\xintTrunc {12}
{\xintPowerSeries {1}{\cnta}{\coefflog}{\f}}\dots
\endgraf
-\ifnum \cnta < 30 \advance\cnta 1 \repeat
-|
+\ifnum \cnta < 30 \advance\cnta 1 \repeat|
\setlength{\columnsep}{0pt}
\begin{multicols}{3}
\cnta 1 % previously declared count
@@ -7709,8 +7860,8 @@ which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
\[\mathrm{Arctg}(\frac15)\approx
\frac15\sum_{n=0}^{15} \frac{(-1)^n}{(2n+1)25^n}
= \xintFrac{\xintIrr {\xintDiv
- {\xintPowerSeries {0}{15}{\coeffarctg}{\f}}{5}}}\]
-|
+ {\xintPowerSeries {0}{15}{\coeffarctg}{\f}}{5}}}\]|
+
\def\coeffarctg #1{1/\the\numexpr\ifodd #1 -2*#1-1\else2*#1+1\fi\relax }%
\def\f {1/25[0]}% 1/5^2
\[\mathrm{Arctg}(\frac15)\approx
@@ -7720,20 +7871,20 @@ which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
\subsection{\csbh{xintPowerSeriesX}}\label{xintPowerSeriesX}
-{\small\hspace*{\parindent}New with release |1.04|.\par}
-
-\noindent This is the same as \csbxint{PowerSeries} apart from the fact that the
-last
-parameter |f| is expanded once and for all before being then used repeatedly. If
-the |f| parameter is to be an explicit big fraction with many (dozens) digits,
-rather than using it directly it is slightly better to have some macro
-|\g| defined to expand to the explicit fraction and then use
-\csbxint{PowerSeries} with |\g|;
-but if |f| has not yet been evaluated and will be the output of a complicated
-expansion of some |\f|, and if, due to an expanding only context, doing
-|\edef\g{\f}| is no option, then \csa{xintPowerSeriesX} should be used with |\f|
-as last parameter.
-\dverb|@
+%{\small\hspace*{\parindent}New with release |1.04|.\par}
+
+\noindent This is the same as \csbxint{PowerSeries}\ntype{\numx\numx\Ff\Ff}
+apart
+from the fact that the last parameter |f| is expanded once and for all before
+being then used repeatedly. If the |f| parameter is to be an explicit big
+fraction with many (dozens) digits, rather than using it directly it is slightly
+better to have some macro |\g| defined to expand to the explicit fraction and
+then use \csbxint{PowerSeries} with |\g|; but if |f| has not yet been evaluated
+and will be the output of a complicated expansion of some |\f|, and if, due to
+an expanding only context, doing |\edef\g{\f}| is no option, then
+\csa{xintPowerSeriesX} should be used with |\f| as last parameter.
+%
+\dverb|@
\def\ratioexp #1#2{\xintDiv {#1}{#2}}% x/n
% These are the (-1)^{n-1}/n of the log(1+h) series:
\def\coefflog #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]}%
@@ -7748,8 +7899,8 @@ as last parameter.
{\xintRationalSeries {0}{9}{1[0]}{\ratioexp{\the\cnta[-1]}}}
{1}}}\dots
\endgraf
-\ifnum\cnta < 12 \advance \cnta 1 \repeat
-|
+\ifnum\cnta < 12 \advance \cnta 1 \repeat|
+
\cnta 0
\def\ratioexp #1#2{\xintDiv {#1}{#2}}% x/n
% These are the (-1)^{n-1}/n of the log(1+h) series
@@ -7772,9 +7923,11 @@ as last parameter.
\subsection{\csbh{xintFxPtPowerSeries}}\label{xintFxPtPowerSeries}
-\csa{xintFxPtPowerSeries}|{A}{B}{\coeff}{f}{D}| computes
+\csa{xintFxPtPowerSeries}|{A}{B}{\coeff}{f}{D}|\etype{\numx\numx}
+computes
$\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|\cdot |f|^{\,\text{|n|}}$ with each
- term of the series truncated to |D| digits after the decimal point. As
+ term of the series truncated to |D| digits\etype{\Ff\Ff\numx}
+ after the decimal point. As
usual, |A| and |B| are completely expanded through their inclusion in a
|\numexpr| expression. Regarding |D| it will be similarly be expanded each
time it is used inside an \csa{xintTrunc}. The one-parameter macro |\coeff|
@@ -7823,15 +7976,13 @@ $\xintFxPtPowerSeries {0}{\cnta}{\coeffexp}{\f}{20}$\\
% errors of up to 10^{-20} per term accumulate and never disappear! (the
% effect is attenuated by the alternating signs in the series). We can
% confirm that the last two digits (of our evaluation of the nineteenth
-% partial sum) are wrong via the evaluation with more digits:
-|
+% partial sum) are wrong via the evaluation with more digits: |
+
\centeredline{|\xintFxPtPowerSeries {0}{19}{\coeffexp}{\f}{25}=|
\digitstt{\xintFxPtPowerSeries {0}{19}{\coeffexp}{\f}{25}}}
+\edef\z{\xintIrr {\xintPowerSeries {0}{19}{\coeffexp}{\f}}}%
-\texttt{\hyphenchar\font45 }
-
-\edef\z{\xintIrr {\xintPowerSeries {0}{19}{\coeffexp}{\f}}}
-
+\texttt{\hyphenchar\font45 }%
It is no difficulty for \xintfracname to compute exactly, with the help
of \csa{xintPowerSeries}, the nineteenth partial sum, and to then give
(the start of) its exact decimal expansion:
@@ -7848,11 +7999,13 @@ of digits possibly of dubious significance.
\subsection{\csbh{xintFxPtPowerSeriesX}}\label{xintFxPtPowerSeriesX}
-{\small\hspace*{\parindent}New with release |1.04|.\par}
+%{\small\hspace*{\parindent}New with release |1.04|.\par}
-\noindent\csa{xintFxPtPowerSeriesX}|{A}{B}{\coeff}{\f}{D}| computes, exactly as
+\noindent\csa{xintFxPtPowerSeriesX}|{A}{B}{\coeff}{\f}{D}|%
+\ntype{\numx\numx}
+computes, exactly as
\csa{xintFxPtPowerSeries}, the sum of
-|\coeff{n}|\raisebox{.5ex}{|.|}|\f^n| from |n=A| to |n=B| with each term
+|\coeff{n}|\raisebox{.5ex}{|.|}|\f^n|\etype{\Ff\Ff\numx} from |n=A| to |n=B| with each term
of the series being \emph{truncated} to |D| digits after the decimal
point. The sole difference is that |\f| is first expanded and it
is the result of this which is used in the computations.
@@ -7881,8 +8034,7 @@ more precisely than, say circa 5 digits after the decimal points.
{\xintFxPtPowerSeriesX {1}{10}{\coefflog}
{\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
{5}}\endgraf
-\ifnum\cnta < 49 \advance\cnta 7 \repeat
-|
+\ifnum\cnta < 49 \advance\cnta 7 \repeat|
\cnta 0
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}% (-1)^{n-1}/n
@@ -7917,8 +8069,7 @@ to the next evaluation.
{\the\cnta [-2]}{6}}}
{6}}%
}\endgraf
-\ifnum\cnta < 49 \advance\cnta 7 \repeat
-|
+\ifnum\cnta < 49 \advance\cnta 7 \repeat|
\begin{multicols}2
\loop
@@ -7949,11 +8100,13 @@ release.
\subsection{\csbh{xintFloatPowerSeries}}\label{xintFloatPowerSeries}
-{\small\hspace*{\parindent}New with |1.08a|.\par}
+%{\small\hspace*{\parindent}New with |1.08a|.\par}
-\noindent\csa{xintFloatPowerSeries}|[P]{A}{B}{\coeff}{f}| computes
+\noindent\csa{xintFloatPowerSeries}|[P]{A}{B}{\coeff}{f}|%
+\ntype{{\upshape[\numx]}\numx\numx}
+ computes
$\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|\cdot |f|^{\,\text{|n|}}$
-with a floating point
+with a floating point\etype{\Ff\Ff}
precision given by the optional parameter |P| or by the current setting of
|\xintDigits|.
@@ -7972,16 +8125,19 @@ with |\coeff{n}|, and the sum is done adding one term at a time with
\dverb+@
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}%
-\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}+
+\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}+%
\centeredline{\digitstt{\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}}
\subsection{\csbh{xintFloatPowerSeriesX}}\label{xintFloatPowerSeriesX}
-{\small\hspace*{\parindent}New with |1.08a|.\par}
+%{\small\hspace*{\parindent}New with |1.08a|.\par}
-\noindent\csa{xintFloatPowerSeriesX}|[P]{A}{B}{\coeff}{f}| is like
+\noindent\csa{xintFloatPowerSeriesX}|[P]{A}{B}{\coeff}{f}|%
+\ntype{{\upshape[\numx]}\numx\numx}
+is like
\csa{xintFloatPowerSeries} with the difference that |f| is
-expanded once and for all at the start of the computation, thus allowing
+expanded once\etype{\Ff\Ff}
+and for all at the start of the computation, thus allowing
efficient chaining of such series evaluations.
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}%
@@ -7989,7 +8145,7 @@ efficient chaining of such series evaluations.
\def\coeffexp #1{1/\xintFac {#1}[0]}% 1/n! (exact, not float)
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}%
\xintFloatPowerSeriesX [8]{0}{30}{\coeffexp}
- {\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}+
+ {\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}+%
\centeredline{\digitstt{\xintFloatPowerSeriesX [8]{0}{30}{\coeffexp}
{\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}}}
@@ -8057,8 +8213,8 @@ correct exact truncated one.
}%
\noindent $\log 2 \approx \LogTwo {60}\dots$\endgraf
\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {65}}\dots\endgraf
-\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {70}}\dots\endgraf
-|
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {70}}\dots\endgraf|
+
\def\coefflog #1{1/#1[0]}% 1/n
\def\xa {13/256[0]}% we will compute log(1-13/256)
\def\xb {1/9[0]}% we will compute log(1-1/9)
@@ -8106,8 +8262,7 @@ higher than |100| it is more efficient to use the code using
{\xintMul {2}{\xintPowerSeries {1}{#2}{\coefflog}{\xa}}}
{\xintMul {5}{\xintPowerSeries {1}{#1}{\coefflog}{\xb}}}%
}%
-}%
-|
+}%|
Let us turn now to Pi, computed with the Machin formula. Again the numbers of
terms to keep in the two |arctg| series were roughly estimated, and some
@@ -8150,8 +8305,8 @@ zeros may be nine (and the last non-zero one should be decreased).
{\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
{\xintMul {4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
}}%
-\[ \pi = \Machin {60}\dots \]
-|
+\[ \pi = \Machin {60}\dots \]|
+
\def\coeffarctg #1{\the\numexpr\ifodd#1 -1\else1\fi\relax/%
\the\numexpr 2*#1+1\relax [0]}%
%\def\coeffarctg #1{\romannumeral0\xintmon{#1}/\the\numexpr 2*#1+1\relax }%
@@ -8195,8 +8350,7 @@ which evaluates the partial sums \emph{exactly} using
{\xintSub
{\xintMul {16/5}{\xintPowerSeries {0}{#1}{\coeffarctg}{\xa}}}
{\xintMul{4/239}{\xintPowerSeries {0}{#2}{\coeffarctg}{\xb}}}%
-}}%
-|
+}}%|
\def\MachinBis #1{% #1 may be a count register,
% the final result will be truncated to #1 digits post decimal point
@@ -8219,8 +8373,8 @@ Let us use this variant for a loop showing the build-up of digits:
\cnta 0 % previously declared \count register
\loop
\MachinBis{\cnta} \endgraf % Plain's \loop does not accept \par
- \ifnum\cnta < 30 \advance\cnta 1 \repeat
-|
+ \ifnum\cnta < 30 \advance\cnta 1 \repeat|
+
\begin{multicols}{2}
\cnta 0 % previously declared \count register
\loop \noindent
@@ -8237,8 +8391,8 @@ compile:
\newwrite\outfile
\immediate\openout\outfile \jobname-out\relax
\immediate\write\outfile {\Machin {1000}}
-\immediate\closeout\outfile
-|
+\immediate\closeout\outfile|
+
This will create a file with the correct first 1000 digits of $\pi$
after the decimal point. On my laptop (a 2012 model) this took about 42
seconds last time I tried (and for 200 digits it is less than 1 second).
@@ -8483,15 +8637,14 @@ was obtained with this code:
\def\bn #1{\the\numexpr (#1+1)*(#1+1)\relax }%
\[ \xintFrac{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}} =
\cfrac{4}{\xintGCFrac{\xintGCntoGC {5}{\an}{\bn}}} =
-\xintTrunc {10}{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}}\dots\]
-|
+\xintTrunc {10}{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}}\dots\]|
+
We see that the quality of approximation is not fantastic compared to the simple
continued fraction of $\pi$ with about as many terms:
\dverb|@
\[ \xintFrac{\xintCstoF{3,7,15,1,292,1,1}}=
\xintGCFrac{3+1/7+1/15+1/1+1/292+1/1+1/1}=
- \xintTrunc{10}{\xintCstoF{3,7,15,1,292,1,1}}\dots\]
-|
+ \xintTrunc{10}{\xintCstoF{3,7,15,1,292,1,1}}\dots\]|
\[ \xintFrac{\xintCstoF{3,7,15,1,292,1,1}}=
\xintGCFrac{3+1/7+1/15+1/1+1/292+1/1+1/1}=
\xintTrunc{10}{\xintCstoF{3,7,15,1,292,1,1}}\dots\]
@@ -8511,8 +8664,8 @@ the convergents of Euler's number $e$.
$\xintTrunc {30}{\xintAdd {1[0]}{#1}}\dots=
\xintFrac{\xintAdd {1[0]}{#1}}$}%
\xintListWithSep{\vtop to 6pt{}\vbox to 12pt{}\par}
- {\xintApply\mymacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}
-|
+ {\xintApply\mymacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}|
+
\smallskip The volume of computation is kept minimal by the following steps:
\begin{itemize}
\item a comma separated list of the first 36 coefficients is produced by
@@ -8567,8 +8720,7 @@ and the 200th convergent is obtained ten times faster).
\indent\llap {Numerator = }{\printnumber{\xintNumerator\z}\par
\indent\llap {Denominator = }\printnumber{\xintDenominator\z}\par
\indent\llap {Expansion = }\printnumber{\xintTrunc{268}\z}\dots
-\par\endgroup
-|
+\par\endgroup|
\edef\z {\xintCntoF {199}{\cn}}%
@@ -8584,7 +8736,8 @@ $1$ or $-1$.
\subsection{\csbh{xintCFrac}}\label{xintCFrac}
-\csa{xintCFrac}|{f}| is a math-mode only, \LaTeX{} with |amsmath| only, macro
+\csa{xintCFrac}|{f}|\etype{\Ff} is a math-mode only, \LaTeX{} with |amsmath|
+only, macro
which first computes then displays with the help of |\cfrac| the simple
continued fraction corresponding to the given fraction (or macro expanding in
two steps to one such). It admits an optional argument which may be |[l]|, |[r]|
@@ -8594,7 +8747,8 @@ from the \xintfracname package.
\subsection{\csbh{xintGCFrac}}\label{xintGCFrac}
-\csa{xintGCFrac}|{a+b/c+d/e+f/g+h/...}| uses similarly |\cfrac| to typeset a
+\csa{xintGCFrac}|{a+b/c+d/e+f/g+h/...}|\etype{f} uses similarly |\cfrac| to
+typeset a
generalized continued fraction in inline format. It admits the same optional
argument as \csa{xintCFrac}.
\centeredline{|\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}\]|}
@@ -8606,39 +8760,39 @@ arguments to the
\csbxint{Frac} macro.
\subsection{\csbh{xintGCtoGCx}}\label{xintGCtoGCx}
-{\small New with release |1.05|.\par}
+%{\small New with release |1.05|.\par}
-\csa{xintGCtoGCx}|{sepa}{sepb}{a+b/c+d/e+f/...+x/y}| returns the list of the
-coefficients of the generalized continued fraction of |f|, each one within a
-pair of braces, and separated with the help of |sepa| and |sepb|. Thus
+\csa{xintGCtoGCx}|{sepa}{sepb}{a+b/c+d/e+f/...+x/y}|\etype{nnf} returns the list
+of the coefficients of the generalized continued fraction of |f|, each one
+within a pair of braces, and separated with the help of |sepa| and |sepb|. Thus
\centeredline{|\xintGCtoGCx :;{1+2/3+4/5+6/7}| gives \xintGCtoGCx
:;{1+2/3+4/5+6/7}} Plain \TeX{}+|amstex| users may be interested in:\par
-\noindent|$$\xintGCtoGCx {+\cfrac}{\\}{a+b/...}\endcfrac$$|\par
-\noindent
-|$$\xintGCtoGCx {+\cfrac\xintFwOver}{\\\xintFwOver}{a+b/...}\endcfrac$$|\par
+\dverb|@
+$$\xintGCtoGCx {+\cfrac}{\\}{a+b/...}\endcfrac$$
+$$\xintGCtoGCx {+\cfrac\xintFwOver}{\\\xintFwOver}{a+b/...}\endcfrac$$|
\subsection{\csbh{xintFtoCs}}\label{xintFtoCs}
-\csa{xintFtoCs}|{f}| returns the comma separated list of the coefficients of the
-simple continued fraction of |f|.
+\csa{xintFtoCs}|{f}|\etype{\Ff} returns the comma separated list of the
+coefficients of the simple continued fraction of |f|.
\centeredline{%
-|\[ \xintSignedFrac{-5262046/89233} = [\xintFtoCs{-5262046/89233}]\]|}%
+ |\[ \xintSignedFrac{-5262046/89233} = [\xintFtoCs{-5262046/89233}]\]|}%
\[ \xintSignedFrac{-5262046/89233} = [\xintFtoCs{-5262046/89233}]\]
\subsection{\csbh{xintFtoCx}}\label{xintFtoCx}
-\csa{xintFtoCx}|{sep}{f}| returns the list of the coefficients of the simple
-continued fraction of |f|, withing group braces and separated with the help of
-|sep|. \centeredline{|$$\xintFtoCx {+\cfrac1\\ }{f}\endcfrac$$|} will
-display the
-continued fraction in |\cfrac| format, with Plain \TeX{} and |amstex|.
+\csa{xintFtoCx}|{sep}{f}|\etype{n\Ff} returns the list of the coefficients of
+the simple continued fraction of |f|, withing group braces and separated with
+the help of |sep|. \centeredline{|$$\xintFtoCx {+\cfrac1\\ }{f}\endcfrac$$|}
+will display the continued fraction in |\cfrac| format, with Plain \TeX{} and
+|amstex|.
\subsection{\csbh{xintFtoGC}}\label{xintFtoGC}
-\csa{xintFtoGC}|{f}| does the same as \csa{xintFtoCx}|{+1/}{f}|. Its
+\csa{xintFtoGC}|{f}|\etype{\Ff} does the same as \csa{xintFtoCx}|{+1/}{f}|. Its
output may thus be used in the package macros expecting such an `inline
format'. This continued fraction is a \emph{simple} one, not a
\emph{generalized} one, but as it is produced in the format used for
@@ -8649,41 +8803,38 @@ user input of generalized continued fractions, the macro was called
\subsection{\csbh{xintFtoCC}}\label{xintFtoCC}
-\csa{xintFtoCC}|{f}| returns the `centered' continued fraction of |f|, in
-`inline format'.
-\centeredline{|566827/208524=\xintFtoCC {566827/208524}|}%
-\centeredline{566827/208524=\xintFtoCC {566827/208524}}
-\centeredline{%
-|\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]|}%
+\csa{xintFtoCC}|{f}|\etype{\Ff} returns the `centered' continued fraction of
+|f|, in `inline format'. \centeredline{|566827/208524=\xintFtoCC
+ {566827/208524}|}%
+\centeredline{566827/208524=\xintFtoCC {566827/208524}} \centeredline{%
+ |\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]|}%
\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]
\subsection{\csbh{xintFtoCv}}\label{xintFtoCv}
-\csa{xintFtoCv}|{f}| returns the list of the (braced) convergents of |f|, with
-no separator. To be treated with \csbxint{AssignArray} or \csbxint{ListWithSep}.
-\centeredline{%
-|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]|}%
+\csa{xintFtoCv}|{f}|\etype{\Ff} returns the list of the (braced) convergents of
+|f|, with no separator. To be treated with \csbxint{AssignArray} or
+\csbxint{ListWithSep}. \centeredline{%
+ |\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]|}%
\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]
\subsection{\csbh{xintFtoCCv}}\label{xintFtoCCv}
-\csa{xintFtoCCv}|{f}| returns the list of the (braced) centered convergents of
-|f|, with no separator. To be treated with \csbxint{AssignArray} or
-\csbxint{ListWithSep}.
-\centeredline{%
-|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]|}%
+\csa{xintFtoCCv}|{f}|\etype{\Ff} returns the list of the (braced) centered
+convergents of |f|, with no separator. To be treated with \csbxint{AssignArray}
+or \csbxint{ListWithSep}. \centeredline{%
+ |\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]|}%
\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]
\subsection{\csbh{xintCstoF}}\label{xintCstoF}
-\csa{xintCstoF}|{a,b,c,d,...,z}| computes the fraction corresponding to the
-coefficients, which may be fractions or even macros expanding to such
-fractions (in two steps). The final fraction may then be highly
-reducible.
+\csa{xintCstoF}|{a,b,c,d,...,z}|\etype{f} computes the fraction corresponding to
+the coefficients, which may be fractions or even macros expanding to such
+fractions (in two steps). The final fraction may then be highly reducible.
\centeredline{|\[\xintGCFrac {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}|}%
\centeredline{|=\xintSignedFrac{\xintCstoF {-1,3,-5,7,-9,11,-13}}|}%
-\centeredline{|=\xintSignedFrac{\xintGCtoF
- {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]|}%
+\centeredline{|=\xintSignedFrac{\xintGCtoF
+ {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]|}%
\[\xintGCFrac {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}=
\xintSignedFrac{\xintCstoF {-1,3,-5,7,-9,11,-13}}
=\xintSignedFrac{\xintGCtoF {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]
@@ -8697,7 +8848,7 @@ be obvious to a human, like simplification by 3 in the result above).
\subsection{\csbh{xintCstoCv}}\label{xintCstoCv}
-\csa{xintCstoCv}|{a,b,c,d,...,z}| returns the list of the corresponding
+\csa{xintCstoCv}|{a,b,c,d,...,z}|\etype{f} returns the list of the corresponding
convergents. It is allowed to use fractions as coefficients (the computed
convergents have then no reason to be the real convergents of the final
fraction). When the coefficients are integers, the convergents are irreducible
@@ -8722,11 +8873,10 @@ fractions, but otherwise it is not necessarily the case.
\subsection{\csbh{xintCstoGC}}\label{xintCstoGC}
-\csa{xintCstoGC}|{a,b,..,z}| transforms a comma separated list (or
-something expanding to such a list) into an
-`inline format' continued fraction |{a}+1/{b}+1/...+1/{z}|. The
-coefficients are just copied and put within braces, without expansion.
-The output can then be used in \csbxint{GCFrac} for example.
+\csa{xintCstoGC}|{a,b,..,z}|\etype{f} transforms a comma separated list (or
+something expanding to such a list) into an `inline format' continued fraction
+|{a}+1/{b}+1/...+1/{z}|. The coefficients are just copied and put within braces,
+without expansion. The output can then be used in \csbxint{GCFrac} for example.
\centeredline{|\[\xintGCFrac {\xintCstoGC {-1,1/2,-1/3,1/4,-1/5}}|}%
\centeredline{|=\xintSignedFrac {\xintCstoF {-1,1/2,-1/3,1/4,-1/5}}\]|}%
\[\xintGCFrac {\xintCstoGC {-1,1/2,-1/3,1/4,-1/5}} =
@@ -8734,23 +8884,20 @@ The output can then be used in \csbxint{GCFrac} for example.
\subsection{\csbh{xintGCtoF}}\label{xintGCtoF}
-\csa{xintGCtoF}|{a+b/c+d/e+f/g+......+v/w+x/y}| computes the fraction defined by
-the inline generalized continued fraction. Coefficients may be fractions but
-must then be put within braces. They can be macros. The plus signs are
-mandatory.
-\dverb|@
+\csa{xintGCtoF}|{a+b/c+d/e+f/g+......+v/w+x/y}|\etype{f} computes the fraction
+defined by the inline generalized continued fraction. Coefficients may be
+fractions but must then be put within braces. They can be macros. The plus signs
+are mandatory. \dverb|@
\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}} =
\xintFrac{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}} =
\xintFrac{\xintIrr{\xintGCtoF
- {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]
-|
+ {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]|
\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}} =
\xintFrac{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}} =
\xintFrac{\xintIrr{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]
\dverb|@
\[ \xintGCFrac{{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}} =
- \xintFrac{\xintGCtoF {{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}}} \]
-|
+ \xintFrac{\xintGCtoF {{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}}} \]|
\[ \xintGCFrac{{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}} =
\xintFrac{\xintGCtoF {{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}}} \]
The macro tries its best not to accumulate superfluous factor in the
@@ -8759,9 +8906,9 @@ returning it and does not do simplifications which would be obvious to a human.
\subsection{\csbh{xintGCtoCv}}\label{xintGCtoCv}
-\csa{xintGCtoCv}|{a+b/c+d/e+f/g+......+v/w+x/y}| returns the list of the
-corresponding convergents. The coefficients may be fractions, but must
-then be inside braces. Or they may be macros, too.
+\csa{xintGCtoCv}|{a+b/c+d/e+f/g+......+v/w+x/y}|\etype{f} returns the list of
+the corresponding convergents. The coefficients may be fractions, but must then
+be inside braces. Or they may be macros, too.
The convergents will in the general case be reducible. To put them into
irreducible form, one needs one more step, for example it can be done
@@ -8770,8 +8917,7 @@ with |\xintApply\xintIrr|.
\[\xintListWithSep{,}{\xintApply\xintFrac
{\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}\]
\[\xintListWithSep{,}{\xintApply\xintFrac{\xintApply\xintIrr
- {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}}\]
-|
+ {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}}\]|
\[\xintListWithSep{,}{\xintApply\xintFrac
{\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}\]
\[\xintListWithSep{,}{\xintApply\xintFrac{\xintApply\xintIrr
@@ -8781,7 +8927,7 @@ with |\xintApply\xintIrr|.
\def\macro #1{\the\numexpr 1+#1*#1\relax}
-\csa{xintCntoF}|{N}{\macro}| computes the fraction |f| having coefficients
+\csa{xintCntoF}|{N}{\macro}|\etype{\numx f} computes the fraction |f| having coefficients
|c(j)=\macro{j}| for |j=0,1,...,N|. The |N| parameter is given to a |\numexpr|.
The values of the coefficients, as returned by |\macro| do not have to be
positive, nor integers, and it is thus not necessarily the case that the
@@ -8794,10 +8940,10 @@ original |c(j)| are the true coefficients of the final |f|. \centeredline{%
\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%
\def\coeffB #1{\xintMON{#1}}% (-1)^n
-\csa{xintGCntoF}|{N}{\macroA}{\macroB}| returns the fraction |f| corresponding
-to the inline generalized continued fraction |a0+b0/a1+b1/a2+....+b(N-1)/aN|,
-with |a(j)=\macroA{j}| and |b(j)=\macroB{j}|. The |N| parameter is given to a
-|\numexpr|.
+\csa{xintGCntoF}|{N}{\macroA}{\macroB}|\etype{\numx ff} returns the fraction |f|
+corresponding to the inline generalized continued fraction
+|a0+b0/a1+b1/a2+....+b(N-1)/aN|, with |a(j)=\macroA{j}| and |b(j)=\macroB{j}|.
+The |N| parameter is given to a |\numexpr|.
\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}}
= \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]
There is also \csbxint{GCntoGC} to get the `inline format' continued
@@ -8810,14 +8956,13 @@ fraction. The previous display was obtained with:
\subsection{\csbh{xintCntoCs}}\label{xintCntoCs}
-\csa{xintCntoCs}|{N}{\macro}| produces the comma separated list of the
-corresponding coefficients, from |n=0| to |n=N|. The |N| is given to a
-|\numexpr|.
-\centeredline{%
-|\def\macro #1{\the\numexpr 1+#1*#1\relax}|}%
+\csa{xintCntoCs}|{N}{\macro}|\etype{\numx f} produces the comma separated list
+of the corresponding coefficients, from |n=0| to |n=N|. The |N| is given to a
+|\numexpr|. \centeredline{%
+ |\def\macro #1{\the\numexpr 1+#1*#1\relax}|}%
\centeredline{|\xintCntoCs {5}{\macro}|\digitstt{->\xintCntoCs {5}{\macro}}}%
-\centeredline{|\[\xintFrac{\xintCntoF
- {5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]|}%
+\centeredline{|\[\xintFrac{\xintCntoF {5}{\macro}}=\xintCFrac{\xintCntoF
+ {5}{\macro}}\]|}%
\[ \xintFrac{\xintCntoF
{5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]
@@ -8825,33 +8970,31 @@ corresponding coefficients, from |n=0| to |n=N|. The |N| is given to a
\def\macro #1{\the\numexpr\ifodd#1 -1-#1\else1+#1\fi\relax/%
\the\numexpr 1+#1*#1\relax}
-
-\csa{xintCntoGC}|{N}{\macro}| evaluates the |c(j)=\macro{j}| from |j=0|
-to |j=N| and returns a continued fraction written in inline
-format: |{c(0)}+1/{c(1)}+1/...+1/{c(N)}|. The parameter |N| is given to a
-|\numexpr|. The coefficients, after expansion, are, as shown, being
-enclosed in an added pair of braces, they may thus be
-fractions.
-\centeredline{%
-|\def\macro #1{\the\numexpr\ifodd#1 -1-#1\else1+#1\fi\relax/%|}%
-\centeredline{|\the\numexpr 1+#1*#1\relax}|}%
-\centeredline{|\edef\x{\xintCntoGC {5}{\macro}}\meaning\x|}%
-\centeredline{\edef\x{\xintCntoGC {5}{\macro}}\digitstt{\meaning\x}}%
-\centeredline{|\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]|}%
+%
+\csa{xintCntoGC}|{N}{\macro}|\etype{\numx f} evaluates the |c(j)=\macro{j}| from
+|j=0| to |j=N| and returns a continued fraction written in inline format:
+|{c(0)}+1/{c(1)}+1/...+1/{c(N)}|. The parameter |N| is given to a |\numexpr|.
+The coefficients, after expansion, are, as shown, being enclosed in an added
+pair of braces, they may thus be fractions. \centeredline{%
+ |\def\macro #1{\the\numexpr\ifodd#1 -1-#1\else1+#1\fi\relax/%|}%
+ \centeredline{|\the\numexpr 1+#1*#1\relax}|}%
+ \centeredline{|\edef\x{\xintCntoGC {5}{\macro}}\meaning\x|}%
+ \centeredline{\edef\x{\xintCntoGC {5}{\macro}}\digitstt{\meaning\x}}%
+ \centeredline{|\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]|}%
\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]
\subsection{\csbh{xintGCntoGC}}\label{xintGCntoGC}
-\csa{xintGCntoGC}|{N}{\macroA}{\macroB}| evaluates the coefficients and then
-returns the corresponding |{a0}+{b0}/{a1}+{b1}/{a2}+...+{b(N-1)}/{aN}| inline
-generalized fraction. |N| is givent to a |\numexpr|. As shown, the coefficients
-are enclosed into added pairs of braces, and may thus be fractions.
-\dverb|@
-\def\an #1{\the\numexpr #1*#1*#1+1\relax}%
+\csa{xintGCntoGC}|{N}{\macroA}{\macroB}|\etype{\numx ff} evaluates the
+coefficients and then returns the corresponding
+|{a0}+{b0}/{a1}+{b1}/{a2}+...+{b(N-1)}/{aN}| inline generalized fraction. |N| is
+givent to a |\numexpr|. As shown, the coefficients are enclosed into added pairs
+of braces, and may thus be fractions. \dverb|@ \def\an #1{\the\numexpr
+ #1*#1*#1+1\relax}%
\def\bn #1{\the\numexpr \xintiiMON{#1}*(#1+1)\relax}%
-$\xintGCntoGC {5}{\an}{\bn}}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}}
- = \displaystyle\xintFrac {\xintGCntoF {5}{\an}{\bn}}$\par
-|
+$\xintGCntoGC {5}{\an}{\bn}}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}} =
+\displaystyle\xintFrac {\xintGCntoF {5}{\an}{\bn}}$\par|
+
\def\an #1{\the\numexpr #1*#1*#1+1\relax}%
\def\bn #1{\the\numexpr \xintiiMON{#1}*(#1+1)\relax}%
$\xintGCntoGC {5}{\an}{\bn}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}}
@@ -8872,14 +9015,12 @@ hundreds of coefficients.
\subsection{\csbh{xintGCtoGC}}\label{xintGCtoGC}
-\csa{xintGCtoGC}|{a+b/c+d/e+f/g+......+v/w+x/y}| expands (with the usual
-meaning) each one of the coefficients and returns an inline continued fraction
-of the same type, each expanded coefficient being enclosed withing braces.
-\dverb|@
-\edef\x {\xintGCtoGC
- {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}+\xintCstoF {2,-7,-5}/16}}
-\meaning\x
-|
+\csa{xintGCtoGC}|{a+b/c+d/e+f/g+......+v/w+x/y}|\etype{f} expands (with the
+usual meaning) each one of the coefficients and returns an inline continued
+fraction of the same type, each expanded coefficient being enclosed withing
+braces. \dverb|@ \edef\x {\xintGCtoGC {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac
+ {6}+\xintCstoF {2,-7,-5}/16}} \meaning\x|
+
\edef\x {\xintGCtoGC
{1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}+\xintCstoF {2,-7,-5}/16}}
\digitstt{\meaning\x}
@@ -8924,7 +9065,7 @@ first place.
% \section {Package \xinttoolsnameimp implementation}
% \label{sec:toolsimp}
%
-% Release |1.09g| splits off |xinttools.sty| from |xint.sty|
+% Release |1.09g| splits off |xinttools.sty| from |xint.sty|.
%
% \localtableofcontents
%
@@ -9088,45 +9229,45 @@ first place.
\fi
\XINT_providespackage
\ProvidesPackage {xinttools}%
- [2013/11/22 v1.09g Expandable and non-expandable utilities (jfB)]%
+ [2013/11/28 v1.09h Expandable and non-expandable utilities (jfB)]%
% \end{macrocode}
% \subsection{Token management, constants}
-% \lverb|In 1.09e \xint_undef replaced everywhere by \xint_bye.|
-% \begin{macrocode}
-\def\xint_gobble_ {}%
-\def\xint_gobble_i #1{}%
-\def\xint_gobble_ii #1#2{}%
-\def\xint_gobble_iii #1#2#3{}%
-\def\xint_gobble_iv #1#2#3#4{}%
-\def\xint_gobble_v #1#2#3#4#5{}%
-\def\xint_gobble_vi #1#2#3#4#5#6{}%
-\def\xint_gobble_vii #1#2#3#4#5#6#7{}%
-\def\xint_gobble_viii #1#2#3#4#5#6#7#8{}%
-\long\def\xint_firstofone #1{#1}% long since 1.09f, 2013/11/01
-\xint_firstofone{\let\XINT_sptoken= } % 1.09d, 2013/10/22
-\long\def\xint_firstoftwo #1#2{#1}% long since 1.09e, 2013/10/28
-\long\def\xint_secondoftwo #1#2{#2}% idem
-\def\xint_firstoftwo_andstop #1#2{ #1}%
-\def\xint_secondoftwo_andstop #1#2{ #2}%
+% \lverb|In 1.09e \xint_undef replaced everywhere by \xint_bye.
+% Release 1.09h makes most everything \long.|
+% \begin{macrocode}
+\long\def\xint_gobble_ {}%
+\long\def\xint_gobble_i #1{}%
+\long\def\xint_gobble_ii #1#2{}%
+\long\def\xint_gobble_iii #1#2#3{}%
+\long\def\xint_gobble_iv #1#2#3#4{}%
+\long\def\xint_gobble_v #1#2#3#4#5{}%
+\long\def\xint_gobble_vi #1#2#3#4#5#6{}%
+\long\def\xint_gobble_vii #1#2#3#4#5#6#7{}%
+\long\def\xint_gobble_viii #1#2#3#4#5#6#7#8{}%
+\long\def\xint_firstofone #1{#1}%
+\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 { -}%
-\def\xint_gob_til_R #1\R {}%
-\def\xint_gob_til_W #1\W {}%
-\def\xint_gob_til_Z #1\Z {}%
-\long\def\xint_bye #1\xint_bye {}% long since 1.09f
+\long\def\xint_gob_til_R #1\R {}%
+\long\def\xint_gob_til_W #1\W {}%
+\long\def\xint_gob_til_Z #1\Z {}%
+\long\def\xint_bye #1\xint_bye {}%
\let\xint_relax\relax
\def\xint_brelax {\xint_relax }%
-\long\def\xint_gob_til_xint_relax #1\xint_relax {}% long since 1.09f
-\def\xint_afterfi #1#2\fi {\fi #1}%
+\long\def\xint_gob_til_xint_relax #1\xint_relax {}%
+\long\def\xint_afterfi #1#2\fi {\fi #1}%
\chardef\xint_c_ 0
\chardef\xint_c_viii 8
\newtoks\XINT_toks
-\newcount\XINT_count % 1.09g: \xintFor from 1.09f modified \count 255 :-(
% \end{macrocode}
% \subsection{ \csh{xintReverseOrder}}
-% \lverb|\xintReverseOrder: does NOT expand its argument|
+% \lverb|\xintReverseOrder: does NOT expand its argument.|
% \begin{macrocode}
\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
-\def\xintreverseorder #1%
+\long\def\xintreverseorder #1%
{%
\XINT_rord_main {}#1%
\xint_relax
@@ -9134,12 +9275,12 @@ first place.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_rord_main #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_rord_main #1#2#3#4#5#6#7#8#9%
{%
\xint_bye #9\XINT_rord_cleanup\xint_bye
\XINT_rord_main {#9#8#7#6#5#4#3#2#1}%
}%
-\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+\long\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
{%
\expandafter\space\xint_gob_til_xint_relax #1%
}%
@@ -9156,24 +9297,24 @@ first place.
% \begin{macrocode}
\def\xintRevWithBraces {\romannumeral0\xintrevwithbraces }%
\def\xintRevWithBracesNoExpand {\romannumeral0\xintrevwithbracesnoexpand }%
-\def\xintrevwithbraces #1%
+\long\def\xintrevwithbraces #1%
{%
\expandafter\XINT_revwbr_loop\expandafter{\expandafter}%
\romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\xintrevwithbracesnoexpand #1%
+\long\def\xintrevwithbracesnoexpand #1%
{%
\XINT_revwbr_loop {}%
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_revwbr_loop #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_revwbr_loop #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_revwbr_finish_a\xint_relax
\XINT_revwbr_loop {{#9}{#8}{#7}{#6}{#5}{#4}{#3}{#2}#1}%
}%
-\def\XINT_revwbr_finish_a\xint_relax\XINT_revwbr_loop #1#2\xint_bye
+\long\def\XINT_revwbr_finish_a\xint_relax\XINT_revwbr_loop #1#2\xint_bye
{%
\XINT_revwbr_finish_b #2\R\R\R\R\R\R\R\Z #1%
}%
@@ -9206,13 +9347,13 @@ first place.
% and \W perfectly safe here.|
% \begin{macrocode}
\def\xintLength {\romannumeral0\xintlength }%
-\def\xintlength #1%
+\long\def\xintlength #1%
{%
\XINT_length_loop
{0}#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_length_loop #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_length_loop #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_length_finish_a\xint_relax
\expandafter\XINT_length_loop\expandafter {\the\numexpr #1+8\relax}%
@@ -9237,15 +9378,15 @@ first place.
\def\XINT_length_finish_c #1#2\Z #3{\expandafter\space\the\numexpr #3-#1\relax}%
% \end{macrocode}
% \subsection{\csh{xintZapFirstSpaces}}
-% \lverb+1.09f, written [2013/11/01].+
+% \lverb|1.09f, written [2013/11/01].|
% \begin{macrocode}
\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }%
% \end{macrocode}
% \lverb|defined via an \edef in order to inject space tokens inside.|
% \begin{macrocode}
-\edef\xintzapfirstspaces #1%
+\long\edef\xintzapfirstspaces #1%
{\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }%
-\xint_firstofone {\def\XINT_zapbsp_a #1 } %<- space token here
+\xint_firstofone {\long\def\XINT_zapbsp_a #1 } %<- space token here
{%
% \end{macrocode}
% \lverb|If the original #1 started with a space, here #1 will be in fact empty,
@@ -9268,7 +9409,7 @@ first place.
% contain space tokens of other than 32 as character code.|
% \begin{macrocode}
}%
-\def\XINT_zapbsp_again? #1{\xint_bye #1\XINT_zapbsp_again }%
+\long\def\XINT_zapbsp_again? #1{\xint_bye #1\XINT_zapbsp_again }%
% \end{macrocode}
% \lverb|In the "empty" situation above, here #1=\xint_bye, else #1 could be
% some brace things, but unbracing will anyhow not reveal any \xint_bye. When we
@@ -9281,7 +9422,7 @@ first place.
% \lverb|We now have now gotten rid of the initial spaces, but #1 perhaps extend
% only to some initial chunk which was delimited by <sp><sp>.|
% \begin{macrocode}
-\def\XINT_zapbsp_b #1#2\xint_relax
+\long\def\XINT_zapbsp_b #1#2\xint_relax
{\XINT_zapbsp_end? #2\XINT_zapbsp_e\empty #2{#1}}%
% \end{macrocode}
% \lverb|If the initial chunk up to <sp><sp> (after stripping away the first
@@ -9292,12 +9433,12 @@ first place.
% with \XINT_zapbsp_e. If the chunk was maximal, then the #2 above contains as
% many space tokens as there were originally at the end.|
% \begin{macrocode}
-\def\XINT_zapbsp_end? #1{\xint_bye #1\XINT_zapbsp_end }%
+\long\def\XINT_zapbsp_end? #1{\xint_bye #1\XINT_zapbsp_end }%
% \end{macrocode}
% \lverb|The #2 starts with a space which stops the \romannumeral.
% The #1 contains the same number of space tokens there was originally.|
% \begin{macrocode}
-\def\XINT_zapbsp_end\XINT_zapbsp_e\empty #1\xint_bye #2{#2#1}%
+\long\def\XINT_zapbsp_end\XINT_zapbsp_e\empty #1\xint_bye #2{#2#1}%
% \end{macrocode}
% \lverb|&
% Here the initial chunk was not maximal. So we need to get a second piece
@@ -9305,13 +9446,13 @@ first place.
% initially added ending space tokens. We inserted an \empty to prevent brace
% removal. The \expandafter get rid of the \empty.|
% \begin{macrocode}
-\xint_firstofone{\def\XINT_zapbsp_e #1 } \xint_bye
+\xint_firstofone{\long\def\XINT_zapbsp_e #1 } \xint_bye
{\expandafter\XINT_zapbsp_f \expandafter{#1}}%
% \end{macrocode}
% \lverb|Let's not forget when we glue to reinsert the two intermediate space
% tokens. |
% \begin{macrocode}
-\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
+\long\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
% \end{macrocode}
% \subsection{\csh{xintZapLastSpaces}}
% \lverb+1.09f, written [2013/11/01].+
@@ -9320,18 +9461,18 @@ first place.
% \end{macrocode}
% \lverb|Next macro is defined via an \edef for the space tokens.|
% \begin{macrocode}
-\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
+\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
#1\space\space\noexpand\xint_bye \xint_relax}%
% \end{macrocode}
% \lverb|This creates a delimited macro with two space tokens:|
% \begin{macrocode}
-\xint_firstofone {\def\XINT_zapesp_a #1#2 } %<- second space here
+\xint_firstofone {\long\def\XINT_zapesp_a #1#2 } %<- second space here
{\expandafter\XINT_zapesp_b\expandafter{#2}{#1}}%
% \end{macrocode}
% \lverb|The \empty from \xintzaplastspaces is to prevent brace removal in the
% #2 above. The \expandafter chain removes it.|
% \begin{macrocode}
-\def\XINT_zapesp_b #1#2#3\xint_relax
+\long\def\XINT_zapesp_b #1#2#3\xint_relax
{\XINT_zapesp_end? #3\XINT_zapesp_e {#2#1}\empty #3\xint_relax }%
% \end{macrocode}
% \lverb|&
@@ -9339,14 +9480,14 @@ first place.
% by \xint_bye. So the #1 below will be \xint_bye. In all other cases #1 can not
% be \xint_bye nor can it give birth to it via brace stripping.|
% \begin{macrocode}
-\def\XINT_zapesp_end? #1{\xint_bye #1\XINT_zapesp_end }%
+\long\def\XINT_zapesp_end? #1{\xint_bye #1\XINT_zapesp_end }%
% \end{macrocode}
% \lverb|&
% We are done. The #1 here has accumulated all the previous material. It started
% with a space token which stops the \romannumeral0. The reason for the space is
% the recycling of this code in \xintZapSpaces.|
% \begin{macrocode}
-\def\XINT_zapesp_end\XINT_zapesp_e #1#2\xint_relax {#1}%
+\long\def\XINT_zapesp_end\XINT_zapesp_e #1#2\xint_relax {#1}%
% \end{macrocode}
% \lverb|We haven't yet reached the end, so we need to re-inject two space
% tokens after what we have gotten so far. Then we loop. We might wonder why in
@@ -9359,7 +9500,7 @@ first place.
% I do not see (so far) any other way than scooping everything up to the end.
% Anyhow, 99$% of the use cases will NOT have <sp><sp> inside!.|
% \begin{macrocode}
-\edef\XINT_zapesp_e #1{\noexpand \XINT_zapesp_a {#1\space\space}}%
+\long\edef\XINT_zapesp_e #1{\noexpand \XINT_zapesp_a {#1\space\space}}%
% \end{macrocode}
% \subsection{\csh{xintZapSpaces}}
% \lverb+1.09f, written [2013/11/01].+
@@ -9368,7 +9509,7 @@ first place.
% \end{macrocode}
% \lverb|We start like \xintZapStartSpaces.|
% \begin{macrocode}
-\edef\xintzapspaces #1%
+\long\edef\xintzapspaces #1%
{\noexpand\XINT_zapsp_a \space #1\space\space\noexpand\xint_bye\xint_relax}%
% \end{macrocode}
% \lverb|&
@@ -9377,27 +9518,27 @@ first place.
% initial space, this is why we arranged code of \xintZapLastSpaces to do the
% same.|
% \begin{macrocode}
-\xint_firstofone {\def\XINT_zapsp_a #1 } %<- space token here
+\xint_firstofone {\long\def\XINT_zapsp_a #1 } %<- space token here
{%
\XINT_zapsp_again? #1\xint_bye\XINT_zapesp_b {#1}{}%
}%
-\def\XINT_zapsp_again? #1{\xint_bye #1\XINT_zapsp_again }%
-\edef\XINT_zapsp_again\XINT_zapesp_b #1#2{\noexpand\XINT_zapsp_a\space }%
+\long\def\XINT_zapsp_again? #1{\xint_bye #1\XINT_zapsp_again }%
+\long\edef\XINT_zapsp_again\XINT_zapesp_b #1#2{\noexpand\XINT_zapsp_a\space }%
% \end{macrocode}
% \subsection{\csh{xintZapSpacesB}}
% \lverb+1.09f, written [2013/11/01].+
% \begin{macrocode}
\def\xintZapSpacesB {\romannumeral0\xintzapspacesb }%
-\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
+\long\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
\xint_bye\xintzapspaces {#1}}%
-\def\XINT_zapspb_one? #1#2%
+\long\def\XINT_zapspb_one? #1#2%
{\xint_gob_til_xint_relax #1\XINT_zapspb_onlyspaces\xint_relax
\xint_gob_til_xint_relax #2\XINT_zapspb_bracedorone\xint_relax
\xint_bye {#1}}%
\def\XINT_zapspb_onlyspaces\xint_relax
\xint_gob_til_xint_relax\xint_relax\XINT_zapspb_bracedorone\xint_relax
\xint_bye #1\xint_bye\xintzapspaces #2{ }%
-\def\XINT_zapspb_bracedorone\xint_relax
+\long\def\XINT_zapspb_bracedorone\xint_relax
\xint_bye #1\xint_relax\xint_bye\xintzapspaces #2{ #1}%
% \end{macrocode}
% \subsection{\csh{xintCSVtoList}, \csh{xintCSVtoListNonStripped}}
@@ -9413,34 +9554,36 @@ first place.
% faster. But ... it doesn't strip spaces.|
% \begin{macrocode}
\def\xintCSVtoList {\romannumeral0\xintcsvtolist }%
-\def\xintcsvtolist #1{\expandafter\xintApply\expandafter\xintzapspacesb
+\long\def\xintcsvtolist #1{\expandafter\xintApply
+ \expandafter\xintzapspacesb
\expandafter{\romannumeral0\xintcsvtolistnonstripped{#1}}}%
\def\xintCSVtoListNoExpand {\romannumeral0\xintcsvtolistnoexpand }%
-\def\xintcsvtolistnoexpand #1{\expandafter\xintApply\expandafter\xintzapspacesb
+\long\def\xintcsvtolistnoexpand #1{\expandafter\xintApply
+ \expandafter\xintzapspacesb
\expandafter{\romannumeral0\xintcsvtolistnonstrippednoexpand{#1}}}%
\def\xintCSVtoListNonStripped {\romannumeral0\xintcsvtolistnonstripped }%
\def\xintCSVtoListNonStrippedNoExpand
{\romannumeral0\xintcsvtolistnonstrippednoexpand }%
-\def\xintcsvtolistnonstripped #1%
+\long\def\xintcsvtolistnonstripped #1%
{%
\expandafter\XINT_csvtol_loop_a\expandafter
{\expandafter}\romannumeral-`0#1%
,\xint_bye,\xint_bye,\xint_bye,\xint_bye
,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z
}%
-\def\xintcsvtolistnonstrippednoexpand #1%
+\long\def\xintcsvtolistnonstrippednoexpand #1%
{%
\XINT_csvtol_loop_a
{}#1,\xint_bye,\xint_bye,\xint_bye,\xint_bye
,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z
}%
-\def\XINT_csvtol_loop_a #1#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_csvtol_loop_a #1#2,#3,#4,#5,#6,#7,#8,#9,%
{%
\xint_bye #9\XINT_csvtol_finish_a\xint_bye
\XINT_csvtol_loop_b {#1}{{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}%
}%
-\def\XINT_csvtol_loop_b #1#2{\XINT_csvtol_loop_a {#1#2}}%
-\def\XINT_csvtol_finish_a\xint_bye\XINT_csvtol_loop_b #1#2#3\Z
+\long\def\XINT_csvtol_loop_b #1#2{\XINT_csvtol_loop_a {#1#2}}%
+\long\def\XINT_csvtol_finish_a\xint_bye\XINT_csvtol_loop_b #1#2#3\Z
{%
\XINT_csvtol_finish_b #3\R,\R,\R,\R,\R,\R,\R,\Z #2{#1}%
}%
@@ -9460,14 +9603,15 @@ first place.
{%
\csname XINT_csvtol_finish_d\romannumeral #1\endcsname
}%
-\def\XINT_csvtol_finish_dviii #1#2#3#4#5#6#7#8#9{ #9}%
-\def\XINT_csvtol_finish_dvii #1#2#3#4#5#6#7#8#9{ #9{#1}}%
-\def\XINT_csvtol_finish_dvi #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}}%
-\def\XINT_csvtol_finish_dv #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}}%
-\def\XINT_csvtol_finish_div #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}}%
-\def\XINT_csvtol_finish_diii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}}%
-\def\XINT_csvtol_finish_dii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}{#6}}%
-\def\XINT_csvtol_finish_di #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_csvtol_finish_dviii #1#2#3#4#5#6#7#8#9{ #9}%
+\long\def\XINT_csvtol_finish_dvii #1#2#3#4#5#6#7#8#9{ #9{#1}}%
+\long\def\XINT_csvtol_finish_dvi #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}}%
+\long\def\XINT_csvtol_finish_dv #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}}%
+\long\def\XINT_csvtol_finish_div #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}}%
+\long\def\XINT_csvtol_finish_diii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}}%
+\long\def\XINT_csvtol_finish_dii #1#2#3#4#5#6#7#8#9%
+ { #9{#1}{#2}{#3}{#4}{#5}{#6}}%
+\long\def\XINT_csvtol_finish_di #1#2#3#4#5#6#7#8#9%
{ #9{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
% \end{macrocode}
% \subsection{\csh{xintListWithSep}}
@@ -9534,7 +9678,7 @@ first place.
{%
\expandafter\XINT_ntheltnoexpand_a\expandafter {\the\numexpr #1}%
}%
-\def\XINT_nthelt_a #1#2%
+\long\def\XINT_nthelt_a #1#2%
{%
\ifnum #1<0
\xint_afterfi{\expandafter\XINT_nthelt_c\expandafter
@@ -9544,7 +9688,7 @@ first place.
{\romannumeral-`0#2}{#1}}%
\fi
}%
-\def\XINT_ntheltnoexpand_a #1#2%
+\long\def\XINT_ntheltnoexpand_a #1#2%
{%
\ifnum #1<0
\xint_afterfi{\expandafter\XINT_nthelt_c\expandafter
@@ -9554,7 +9698,7 @@ first place.
{#2}{#1}}%
\fi
}%
-\def\XINT_nthelt_c #1#2%
+\long\def\XINT_nthelt_c #1#2%
{%
\ifnum #2>\xint_c_
\expandafter\XINT_nthelt_loop_a
@@ -9572,7 +9716,7 @@ first place.
\fi
{#1}%
}%
-\def\XINT_nthelt_loop_b #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_nthelt_loop_b #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_nthelt_silentend\xint_relax
\expandafter\XINT_nthelt_loop_a\expandafter{\the\numexpr #1-8}%
@@ -9583,7 +9727,7 @@ first place.
\expandafter\expandafter\expandafter\XINT_nthelt_finish
\csname xint_gobble_\romannumeral\numexpr#1-1\endcsname
}%
-\def\XINT_nthelt_finish #1#2\xint_bye
+\long\def\XINT_nthelt_finish #1#2\xint_bye
{\xint_gob_til_xint_relax #1\expandafter\space
\xint_gobble_iii\xint_relax\space #1}%
% \end{macrocode}
@@ -9597,22 +9741,22 @@ first place.
% \begin{macrocode}
\def\xintApply {\romannumeral0\xintapply }%
\def\xintApplyNoExpand {\romannumeral0\xintapplynoexpand }%
-\def\xintapply #1#2%
+\long\def\xintapply #1#2%
{%
\expandafter\XINT_apply\expandafter {\romannumeral-`0#2}%
{#1}%
}%
-\def\XINT_apply #1#2{\XINT_apply_loop_a {}{#2}#1\xint_bye }%
-\def\xintapplynoexpand #1#2{\XINT_apply_loop_a {}{#1}#2\xint_bye }%
-\def\XINT_apply_loop_a #1#2#3%
+\long\def\XINT_apply #1#2{\XINT_apply_loop_a {}{#2}#1\xint_bye }%
+\long\def\xintapplynoexpand #1#2{\XINT_apply_loop_a {}{#1}#2\xint_bye }%
+\long\def\XINT_apply_loop_a #1#2#3%
{%
\xint_bye #3\XINT_apply_end\xint_bye
\expandafter
\XINT_apply_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
-\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}%
-\def\XINT_apply_end\xint_bye\expandafter\XINT_apply_loop_b
+\long\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}%
+\long\def\XINT_apply_end\xint_bye\expandafter\XINT_apply_loop_b
\expandafter #1#2#3{ #2}%
% \end{macrocode}
% \subsection{\csh{xintApplyUnbraced}}
@@ -9629,22 +9773,22 @@ first place.
% \begin{macrocode}
\def\xintApplyUnbraced {\romannumeral0\xintapplyunbraced }%
\def\xintApplyUnbracedNoExpand {\romannumeral0\xintapplyunbracednoexpand }%
-\def\xintapplyunbraced #1#2%
+\long\def\xintapplyunbraced #1#2%
{%
\expandafter\XINT_applyunbr\expandafter {\romannumeral-`0#2}%
{#1}%
}%
-\def\XINT_applyunbr #1#2{\XINT_applyunbr_loop_a {}{#2}#1\xint_bye }%
-\def\xintapplyunbracednoexpand #1#2%
+\long\def\XINT_applyunbr #1#2{\XINT_applyunbr_loop_a {}{#2}#1\xint_bye }%
+\long\def\xintapplyunbracednoexpand #1#2%
{\XINT_applyunbr_loop_a {}{#1}#2\xint_bye }%
-\def\XINT_applyunbr_loop_a #1#2#3%
+\long\def\XINT_applyunbr_loop_a #1#2#3%
{%
\xint_bye #3\XINT_applyunbr_end\xint_bye
\expandafter\XINT_applyunbr_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
-\def\XINT_applyunbr_loop_b #1#2{\XINT_applyunbr_loop_a {#2#1}}%
-\def\XINT_applyunbr_end\xint_bye\expandafter\XINT_applyunbr_loop_b
+\long\def\XINT_applyunbr_loop_b #1#2{\XINT_applyunbr_loop_a {#2#1}}%
+\long\def\XINT_applyunbr_end\xint_bye\expandafter\XINT_applyunbr_loop_b
\expandafter #1#2#3{ #2}%
% \end{macrocode}
% \subsection{\csh{xintSeq}}
@@ -9668,7 +9812,7 @@ first place.
}%
\def\XINT_seq #1#2%
{%
- \ifcase\xintiiSgn{\the\numexpr #2-#1\relax}
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
\expandafter\xint_firstoftwo_andstop
\or
\expandafter\XINT_seq_p
@@ -9705,7 +9849,7 @@ first place.
}%
\def\XINT_seqo #1#2%
{%
- \ifcase\xintiiSgn{\the\numexpr #2-#1\relax}
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
\expandafter\XINT_seqo_a
\or
\expandafter\XINT_seqo_pa
@@ -9718,13 +9862,13 @@ first place.
\def\XINT_seqo_o #1#2#3#4{ #4}%
\def\XINT_seqo_pa #1#2#3%
{%
- \ifcase\XINT_Sgn {#3}
- \expandafter\XINT_seqo_o
- \or
- \expandafter\XINT_seqo_pb
+ \ifcase\ifnum #3=\xint_c_ 0\else\ifnum #3>\xint_c_ 1\else -1\fi\fi\space
+ \expandafter\XINT_seqo_o
+ \or
+ \expandafter\XINT_seqo_pb
\else
- \xint_afterfi{\expandafter\space\xint_gobble_iv}%
- \fi
+ \xint_afterfi{\expandafter\space\xint_gobble_iv}%
+ \fi
{#1}{#2}{#3}{{#1}}%
}%
\def\XINT_seqo_pb #1#2#3%
@@ -9733,7 +9877,7 @@ first place.
}%
\def\XINT_seqo_pc #1#2%
{%
- \ifnum#1>#2
+ \ifnum #1>#2
\expandafter\XINT_seqo_o
\else
\expandafter\XINT_seqo_pd
@@ -9743,7 +9887,7 @@ first place.
\def\XINT_seqo_pd #1#2#3#4{\XINT_seqo_pb {#1}{#2}{#3}{#4{#1}}}%
\def\XINT_seqo_na #1#2#3%
{%
- \ifcase\XINT_Sgn {#3}
+ \ifcase\ifnum #3=\xint_c_ 0\else\ifnum #3>\xint_c_ 1\else -1\fi\fi\space
\expandafter\XINT_seqo_o
\or
\xint_afterfi{\expandafter\space\xint_gobble_iv}%
@@ -9758,7 +9902,7 @@ first place.
}%
\def\XINT_seqo_nc #1#2%
{%
- \ifnum#1<#2
+ \ifnum #1<#2
\expandafter\XINT_seqo_o
\else
\expandafter\XINT_seqo_nd
@@ -9769,39 +9913,40 @@ first place.
% \end{macrocode}
%\subsection{\csh{xintloop}, \csh{xintbreakloop}, \csh{xintbreakloopanddo},
% \csh{xintloopskiptonext}}
-% \lverb|1.09g [2013/11/22]|
+% \lverb|1.09g [2013/11/22]. Made long with 1.09h.|
% \begin{macrocode}
-\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}%
-\def\xintloop_again\fi\xint_gobble_i #1{\fi
+\long\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}%
+\long\def\xintloop_again\fi\xint_gobble_i #1{\fi
#1\xintloop_again\fi\xint_gobble_i {#1}}%
-\def\xintbreakloop #1\xintloop_again\fi\xint_gobble_i #2{}%
-\def\xintbreakloopanddo #1#2\xintloop_again\fi\xint_gobble_i #3{#1}%
-\def\xintloopskiptonext #1\xintloop_again\fi\xint_gobble_i #2{%
+\long\def\xintbreakloop #1\xintloop_again\fi\xint_gobble_i #2{}%
+\long\def\xintbreakloopanddo #1#2\xintloop_again\fi\xint_gobble_i #3{#1}%
+\long\def\xintloopskiptonext #1\xintloop_again\fi\xint_gobble_i #2{%
#2\xintloop_again\fi\xint_gobble_i {#2}}%
% \end{macrocode}
% \subsection{\csh{xintiloop}, \csh{xintiloopindex}, \csh{xintouteriloopindex},
% \csh{xintbreakiloop}, \csh{xintbreakiloopanddo}, \csh{xintiloopskiptonext},
% \csh{xintiloopskipandredo}}
-% \lverb|1.09g [2013/11/22]|
+% \lverb|1.09g [2013/11/22]. Made long with 1.09h.|
% \begin{macrocode}
\def\xintiloop [#1+#2]{%
\expandafter\xintiloop_a\the\numexpr #1\expandafter.\the\numexpr #2.}%
-\def\xintiloop_a #1.#2.#3#4\repeat{%
+\long\def\xintiloop_a #1.#2.#3#4\repeat{%
#3#4\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3#4}}%
\def\xintiloop_again\fi\xint_gobble_iii #1#2{%
\fi\expandafter\xintiloop_again_b\the\numexpr#1+#2.#2.}%
-\def\xintiloop_again_b #1.#2.#3{%
+\long\def\xintiloop_again_b #1.#2.#3{%
#3\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3}}%
-\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}%
-\def\xintbreakiloopanddo #1.#2\xintiloop_again\fi\xint_gobble_iii #3#4#5{#1}%
-\def\xintiloopindex #1\xintiloop_again\fi\xint_gobble_iii #2%
+\long\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}%
+\long\def\xintbreakiloopanddo
+ #1.#2\xintiloop_again\fi\xint_gobble_iii #3#4#5{#1}%
+\long\def\xintiloopindex #1\xintiloop_again\fi\xint_gobble_iii #2%
{#2#1\xintiloop_again\fi\xint_gobble_iii {#2}}%
-\def\xintouteriloopindex #1\xintiloop_again
+\long\def\xintouteriloopindex #1\xintiloop_again
#2\xintiloop_again\fi\xint_gobble_iii #3%
{#3#1\xintiloop_again #2\xintiloop_again\fi\xint_gobble_iii {#3}}%
-\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{%
+\long\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{%
\expandafter\xintiloop_again_b \the\numexpr#2+#3.#3.}%
-\def\xintiloopskipandredo #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{%
+\long\def\xintiloopskipandredo #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{%
#4\xintiloop_again\fi\xint_gobble_iii {#2}{#3}{#4}}%
% \end{macrocode}
% \subsection{\csh{XINT\_xflet}}
@@ -9962,8 +10107,10 @@ first place.
% 1.09f rewrites (2013/11/03) the code which now allows all macro parameters
% from #1 to #9 in \xintFor, \xintFor*, and \XINT_forever.
%
-% 1.09g \xintFor and \xintFor* modified the value of \count 255, now uses
-% \XINT_count. |
+% The 1.09f \xintFor and \xintFor* modified the value of \count 255
+% which was silly, 1.09g used \XINT_count, but requiring a \count only
+% for that was also silly, 1.09h just uses \numexpr (all of that was only to
+% get rid simply of a possibly space in #2...).|
% \begin{macrocode}
\def\XINT_tmpa #1#2{\ifnum #2<#1 \xint_afterfi {{#########2}}\fi}%
\def\XINT_tmpb #1#2{\ifnum #1<#2 \xint_afterfi {{#########2}}\fi}%
@@ -10001,9 +10148,8 @@ first place.
}%
\long\def\XINT_for #1#2in#3#4#5%
{%
- \XINT_count #2\relax
\expandafter\XINT_toks\expandafter
- {\expandafter\XINT_for_d\the\XINT_count{#5}}%
+ {\expandafter\XINT_for_d\the\numexpr #2\relax {#5}}%
\def\XINT_flet_macro {\expandafter\XINT_for_forever?\space}%
\expandafter\XINT_flet_zapsp #3Z%
}%
@@ -10017,9 +10163,8 @@ first place.
\def\XINT_to_forever\fi #1\xintcsvtolist #2{\fi \XINT_forever #2}%
\long\def\XINT_forx *#1#2in#3#4#5%
{%
- \XINT_count #2\relax
\expandafter\XINT_toks\expandafter
- {\expandafter\XINT_forx_d\the\XINT_count{#5}}%
+ {\expandafter\XINT_forx_d\the\numexpr #2\relax {#5}}%
\XINT_xflet\XINT_forx_forever? #3Z%
}%
\def\XINT_forx_forever?
@@ -10251,13 +10396,17 @@ first place.
% \xintAssignArray {}{}{}\to\Stuff.
%
% With release 1.06b an empty argument (or expanding to empty) to
-% \xintAssignArray is ok.|
+% \xintAssignArray is ok.
+%
+% 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.|
% \begin{macrocode}
-\def\xintAssign #1\to
+\long\def\xintAssign #1\to
{%
\expandafter\XINT_assign_a\romannumeral-`0#1{}\to
}%
-\def\XINT_assign_a #1% attention to the # at the beginning of next line
+\long\def\XINT_assign_a #1% attention to the # at the beginning of next line
#{%
\def\xint_temp {#1}%
\ifx\empty\xint_temp
@@ -10266,13 +10415,10 @@ first place.
\expandafter\XINT_assign_B
\fi
}%
-\def\XINT_assign_b #1#2\to #3%
+\long\def\XINT_assign_b #1#2\to #3%
{%
\edef #3{#1}\def\xint_temp {#2}%
- \ifx\empty\xint_temp
- \else
- \xint_afterfi{\XINT_assign_a #2\to }%
- \fi
+ \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_a #2\to }\fi
}%
\def\XINT_assign_B #1\to #2%
{%
@@ -10282,56 +10428,44 @@ first place.
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax}%
\escapechar -1
- \edef\xint_arrayname {\string #1}%
+ \expandafter\def\expandafter\xint_arrayname\expandafter {\string #1}%
\XINT_restoreescapechar
- \expandafter\let\expandafter\xint_temp
- \csname\xint_arrayname 0\endcsname
- \XINT_count 0
- \loop
- \global\expandafter\let
- \csname\xint_arrayname\the\XINT_count\endcsname\relax
- \ifnum \XINT_count < \xint_temp
- \advance\XINT_count 1
+ \xintiloop [\csname\xint_arrayname 0\endcsname+-1]
+ \global
+ \expandafter\let\csname\xint_arrayname\xintiloopindex\endcsname\relax
+ \ifnum \xintiloopindex > \xint_c_
\repeat
\global\expandafter\let\csname\xint_arrayname 00\endcsname\relax
\global\let #1\relax
}%
-\def\xintAssignArray #1\to #2% 1.06b: #1 may now be empty
+\long\def\xintAssignArray #1\to #2%
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }%
\escapechar -1
- \edef\xint_arrayname {\string #2}%
+ \expandafter\def\expandafter\xint_arrayname\expandafter {\string #2}%
\XINT_restoreescapechar
- \XINT_count 0
+ \def\xint_itemcount {0}%
\expandafter\XINT_assignarray_loop \romannumeral-`0#1\xint_relax
- \csname\xint_arrayname 00\endcsname
- \csname\xint_arrayname 0\endcsname
- {\xint_arrayname}%
- #2%
+ \csname\xint_arrayname 00\expandafter\endcsname
+ \csname\xint_arrayname 0\expandafter\endcsname
+ \expandafter {\xint_arrayname}#2%
}%
-\def\XINT_assignarray_loop #1%
+\long\def\XINT_assignarray_loop #1%
{%
\def\xint_temp {#1}%
\ifx\xint_brelax\xint_temp
- \expandafter\edef\csname\xint_arrayname 0\endcsname{\the\XINT_count }%
- \expandafter\expandafter\expandafter\XINT_assignarray_end_a
+ \expandafter\def\csname\xint_arrayname 0\expandafter\endcsname
+ \expandafter{\the\numexpr\xint_itemcount}%
+ \expandafter\expandafter\expandafter\XINT_assignarray_end
\else
- \advance\XINT_count 1
+ \expandafter\def\expandafter\xint_itemcount\expandafter
+ {\the\numexpr\xint_itemcount+\xint_c_i}%
\expandafter\edef
- \csname\xint_arrayname\the\XINT_count\endcsname{\xint_temp }%
+ \csname\xint_arrayname\xint_itemcount\endcsname {\xint_temp }%
\expandafter\XINT_assignarray_loop
\fi
}%
-\def\XINT_assignarray_end_a #1%
-{%
- \expandafter\XINT_assignarray_end_b\expandafter #1%
-}%
-\def\XINT_assignarray_end_b #1#2#3%
-{%
- \expandafter\XINT_assignarray_end_c
- \expandafter #1\expandafter #2\expandafter {#3}%
-}%
-\def\XINT_assignarray_end_c #1#2#3#4%
+\def\XINT_assignarray_end #1#2#3#4%
{%
\def #4##1%
{%
@@ -10339,16 +10473,14 @@ first place.
}%
\def #1##1%
{%
- \ifnum ##1< 0
- \xint_afterfi {\xintError:ArrayIndexIsNegative\space 0}%
+ \ifnum ##1<\xint_c_
+ \xint_afterfi {\xintError:ArrayIndexIsNegative\space }%
\else
- \xint_afterfi {%
+ \xint_afterfi {%
\ifnum ##1>#2
- \xint_afterfi {\xintError:ArrayIndexBeyondLimit\space 0}%
- \else
- \xint_afterfi
- {\expandafter\expandafter\expandafter
- \space\csname #3##1\endcsname}%
+ \xint_afterfi {\xintError:ArrayIndexBeyondLimit\space }%
+ \else\xint_afterfi
+ {\expandafter\expandafter\expandafter\space\csname #3##1\endcsname}%
\fi}%
\fi
}%
@@ -10472,13 +10604,13 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xint}%
- [2013/11/22 v1.09g Expandable operations on long numbers (jfB)]%
+ [2013/11/28 v1.09h Expandable operations on long numbers (jfB)]%
% \end{macrocode}
% \subsection{Token management, constants}
% \begin{macrocode}
-\def\xint_firstofthree #1#2#3{#1}%
-\def\xint_secondofthree #1#2#3{#2}%
-\def\xint_thirdofthree #1#2#3{#3}%
+\long\def\xint_firstofthree #1#2#3{#1}%
+\long\def\xint_secondofthree #1#2#3{#2}%
+\long\def\xint_thirdofthree #1#2#3{#3}%
\def\xint_gob_til_zero #10{}%
\def\xint_gob_til_zeros_iii #1000{}%
\def\xint_gob_til_zeros_iv #10000{}%
@@ -12298,15 +12430,17 @@ first place.
% computations). Also the way \xintSum and \xintSumExpr ...\relax are related.
% has been modified. Now \xintSumExpr \z \relax is accepted input when
% \z expands to a list of braced terms (prior only \xintSum {\z} or \xintSum \z
-% was possible). 1.09a does NOT add \xintnum (I would need for this to
-% re-organize the code first). |
-% \begin{macrocode}
-\def\xintiSum {\romannumeral0\xintisum }%
-\def\xintisum #1{\xintisumexpr #1\relax }%
-\def\xintiSumExpr {\romannumeral0\xintisumexpr }%
-\def\xintisumexpr {\expandafter\XINT_sumexpr\romannumeral-`0}%
-\let\xintSum\xintiSum \let\xintsum\xintisum
-\let\xintSumExpr\xintiSumExpr \let\xintsumexpr\xintisumexpr
+% was possible).
+%
+% 1.09a does NOT add the \xintnum overhead. 1.09h renames \xintiSum to
+% \xintiiSum to correctly reflect this.|
+% \begin{macrocode}
+\def\xintiiSum {\romannumeral0\xintiisum }%
+\def\xintiisum #1{\xintiisumexpr #1\relax }%
+\def\xintiiSumExpr {\romannumeral0\xintiisumexpr }%
+\def\xintiisumexpr {\expandafter\XINT_sumexpr\romannumeral-`0}%
+\let\xintSum\xintiiSum \let\xintsum\xintiisum
+\let\xintSumExpr\xintiiSumExpr \let\xintsumexpr\xintiisumexpr
\def\XINT_sumexpr {\XINT_sum_loop {0000}{0000}}%
\def\XINT_sum_loop #1#2#3%
{%
@@ -12851,16 +12985,19 @@ first place.
%
% In 1.06a I suddenly decide that \xintProductExpr was a silly name, and as the
% package is new and certainly not used, I decide I may just switch to
-% \xintPrdExpr which I should have used from the beginning.|
-% \begin{macrocode}
-\def\xintiPrd {\romannumeral0\xintiprd }%
-\def\xintiprd #1{\xintiprdexpr #1\relax }%
-\let\xintPrd\xintiPrd
-\let\xintprd\xintiprd
-\def\xintiPrdExpr {\romannumeral0\xintiprdexpr }%
-\def\xintiprdexpr {\expandafter\XINT_prdexpr\romannumeral-`0}%
-\let\xintPrdExpr\xintiPrdExpr
-\let\xintprdexpr\xintiprdexpr
+% \xintPrdExpr which I should have used from the beginning.
+%
+% 1.09a does NOT add the \xintnum overhead. 1.09h renames \xintiPrd to
+% \xintiiPrd to correctly reflect this.|
+% \begin{macrocode}
+\def\xintiiPrd {\romannumeral0\xintiiprd }%
+\def\xintiiprd #1{\xintiiprdexpr #1\relax }%
+\let\xintPrd\xintiiPrd
+\let\xintprd\xintiiprd
+\def\xintiiPrdExpr {\romannumeral0\xintiiprdexpr }%
+\def\xintiiprdexpr {\expandafter\XINT_prdexpr\romannumeral-`0}%
+\let\xintPrdExpr\xintiiPrdExpr
+\let\xintprdexpr\xintiiprdexpr
\def\XINT_prdexpr {\XINT_prod_loop_a 1\Z }%
\def\XINT_prod_loop_a #1\Z #2%
{%
@@ -12893,11 +13030,7 @@ first place.
{%
\expandafter\XINT_fac_fork\expandafter{\the\numexpr #1}%
}%
-\def\xintFac {\romannumeral0\xintfac }%
-\def\xintfac #1%
-{%
- \expandafter\XINT_fac_fork\expandafter{\romannumeral0\xintnum{#1}}%
-}%
+\let\xintFac\xintiFac \let\xintfac\xintifac
\def\XINT_fac_fork #1%
{%
\ifcase\XINT_Sgn {#1}
@@ -14903,7 +15036,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2013/11/22 v1.09g Expandable binary and hexadecimal conversions (jfB)]%
+ [2013/11/28 v1.09h Expandable binary and hexadecimal conversions (jfB)]%
% \end{macrocode}
% \subsection{Constants, etc...}
% \lverb!v1.08!
@@ -15507,7 +15640,11 @@ first place.
% \section{Package \xintgcdnameimp implementation}
% \label{sec:gcdimp}
%
-% The commenting is currently (\docdate) very sparse.
+% The commenting is currently (\docdate) very sparse. Release |1.09h| has
+% modified a bit the |\xintTypesetEuclideAlgorithm| and
+% |\xintTypesetBezoutAlgorithm| layout with respect to line indentation in
+% particular. And they use the \xinttoolsnameimp |\xintloop| rather than the
+% Plain \TeX{} or \LaTeX{}'s |\loop|.
%
% \localtableofcontents
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
@@ -15607,7 +15744,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2013/11/22 v1.09g Euclide algorithm with xint package (jfB)]%
+ [2013/11/28 v1.09h Euclide algorithm with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintGCD}}
% The macros of |1.09a| benefits from the |\xintnum| which has been inserted
@@ -16143,7 +16280,10 @@ first place.
% r(n-2) = q(n)r(n-1)+r(n) (n e étape)
%
% \U{2n} = \U{2n+3} \times \U{2n+2} + \U{2n+4}, n e étape.
-% (avec n entre 1 et N)|
+% (avec n entre 1 et N)
+%
+% 1.09h uses \xintloop, and \par rather than \endgraf; and \par rather than
+% \hfill\break|
% \begin{macrocode}
\def\xintTypesetEuclideAlgorithm #1#2%
{% l'algo remplace #1 et #2 par |#1| et |#2|
@@ -16152,18 +16292,16 @@ first place.
\xintAssignArray\xintEuclideAlgorithm {#1}{#2}\to\U
\edef\A{\U2}\edef\B{\U4}\edef\N{\U1}%
\setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}%
- \noindent
- \XINT_count 1
- \loop
- \hbox to \wd 0 {\hfil$\U{\numexpr 2*\XINT_count\relax}$}%
- ${} = \U{\numexpr 2*\XINT_count + 3\relax}
- \times \U{\numexpr 2*\XINT_count + 2\relax}
- + \U{\numexpr 2*\XINT_count + 4\relax}$%
- \ifnum \XINT_count < \N
- \hfill\break
- \advance \XINT_count 1
+ \count 255 1
+ \xintloop
+ \indent\hbox to \wd 0 {\hfil$\U{\numexpr 2*\count255\relax}$}%
+ ${} = \U{\numexpr 2*\count255 + 3\relax}
+ \times \U{\numexpr 2*\count255 + 2\relax}
+ + \U{\numexpr 2*\count255 + 4\relax}$%
+ \ifnum \count255 < \N
+ \par
+ \advance \count255 1
\repeat
- \par
\endgroup
}%
% \end{macrocode}
@@ -16176,36 +16314,36 @@ first place.
% U1 = N, U2= A, U5=D, U6=B, q1 = U9, qn = U{4n+5}, n au moins 1$\
% rn = U{4n+6}, n au moins -1$\
% alpha(n) = U{4n+7}, n au moins -1$\
-% beta(n) = U{4n+8}, n au moins -1|
+% beta(n) = U{4n+8}, n au moins -1
+%
+% 1.09h uses \xintloop, and \par rather than \endgraf; and no more \parindent0pt
+% |
% \begin{macrocode}
\def\xintTypesetBezoutAlgorithm #1#2%
{%
\par
\begingroup
- \parindent0pt
\xintAssignArray\xintBezoutAlgorithm {#1}{#2}\to\BEZ
\edef\A{\BEZ2}\edef\B{\BEZ6}\edef\N{\BEZ1}% A = |#1|, B = |#2|
\setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}%
- \XINT_count 1
- \loop
- \noindent
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count - 2}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 2}
- + \BEZ{4*\XINT_count + 6}$\hfill\break
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count +7}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 3}
- + \BEZ{4*\XINT_count - 1}$\hfill\break
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count +8}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 4}
- + \BEZ{4*\XINT_count }$
- \endgraf
- \ifnum \XINT_count < \N
- \advance \XINT_count 1
+ \count255 1
+ \xintloop
+ \indent\hbox to \wd 0 {\hfil$\BEZ{4*\count255 - 2}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 2}
+ + \BEZ{4*\count255 + 6}$\hfill\break
+ \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +7}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 3}
+ + \BEZ{4*\count255 - 1}$\hfill\break
+ \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +8}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 4}
+ + \BEZ{4*\count255 }$
+ \par
+ \ifnum \count255 < \N
+ \advance \count255 1
\repeat
- \par
\edef\U{\BEZ{4*\N + 4}}%
\edef\V{\BEZ{4*\N + 3}}%
\edef\D{\BEZ5}%
@@ -16214,7 +16352,7 @@ first place.
\else
$\U\times\A - \V\times\B = \D$%
\fi
- \par
+ \par
\endgroup
}%
\XINT_restorecatcodes_endinput%
@@ -16330,7 +16468,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2013/11/22 v1.09g Expandable operations on fractions (jfB)]%
+ [2013/11/28 v1.09h Expandable operations on fractions (jfB)]%
\chardef\xint_c_vi 6
\chardef\xint_c_vii 7
\chardef\xint_c_xviii 18
@@ -18010,11 +18148,11 @@ first place.
\def\XINT_maxof:_d #1,{\expandafter\XINT_maxof:_b\romannumeral0\xintmax {#1}}%
\def\XINT_maxof:_e ,#1,{#1}%
% \end{macrocode}
-% \subsection{\csh{xintFloatMaxof}}
-% \lverb|1.09a, for use by \xintNewFloatExpr.|
+% \subsection{\csh{XINTinFloatMaxof}}
+% \lverb|1.09a, for use by \xintNewFloatExpr. Name changed in 1.09h|
% \begin{macrocode}
-\def\xintFloatMaxof {\romannumeral0\xintflmaxof }%
-\def\xintflmaxof #1{\expandafter\XINT_flmaxof_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatMaxof {\romannumeral0\XINTinfloatmaxof }%
+\def\XINTinfloatmaxof #1{\expandafter\XINT_flmaxof_a\romannumeral-`0#1\relax }%
\def\XINT_flmaxof_a #1{\expandafter\XINT_flmaxof_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1}\Z }%
\def\XINT_flmaxof_b #1\Z #2%
@@ -18026,10 +18164,10 @@ first place.
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flmaxof_e #1\Z #2\Z { #2}%
% \end{macrocode}
-% \subsection{\csh{xintFloatMaxof:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr.|
+% \subsection{\csh{XINTinFloatMaxof:csv}}
+% \lverb|1.09a. For use by \xintfloatexpr. Name changed in 1.09h|
% \begin{macrocode}
-\def\xintFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
+\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
\def\XINT_flmaxof:_a #1,{\expandafter\XINT_flmaxof:_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flmaxof:_b #1,#2,%
@@ -18103,11 +18241,11 @@ first place.
\def\XINT_minof:_d #1,{\expandafter\XINT_minof:_b\romannumeral0\xintmin {#1}}%
\def\XINT_minof:_e ,#1,{#1}%
% \end{macrocode}
-% \subsection{\csh{xintFloatMinof}}
-% \lverb|1.09a, for use by \xintNewFloatExpr.|
+% \subsection{\csh{XINTinFloatMinof}}
+% \lverb|1.09a, for use by \xintNewFloatExpr. Name changed in 1.09h|
% \begin{macrocode}
-\def\xintFloatMinof {\romannumeral0\xintflminof }%
-\def\xintflminof #1{\expandafter\XINT_flminof_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatMinof {\romannumeral0\XINTinfloatminof }%
+\def\XINTinfloatminof #1{\expandafter\XINT_flminof_a\romannumeral-`0#1\relax }%
\def\XINT_flminof_a #1{\expandafter\XINT_flminof_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1}\Z }%
\def\XINT_flminof_b #1\Z #2%
@@ -18119,10 +18257,10 @@ first place.
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flminof_e #1\Z #2\Z { #2}%
% \end{macrocode}
-% \subsection{\csh{xintFloatMinof:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr.|
+% \subsection{\csh{XINTinFloatMinof:csv}}
+% \lverb|1.09a. For use by \xintfloatexpr. Name changed in 1.09h|
% \begin{macrocode}
-\def\xintFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
+\def\XINTinFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
\def\XINT_flminof:_a #1,{\expandafter\XINT_flminof:_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flminof:_b #1,#2,%
@@ -18262,8 +18400,8 @@ first place.
% \begin{macrocode}
\def\xintFloatAdd {\romannumeral0\xintfloatadd }%
\def\xintfloatadd #1{\XINT_fladd_chkopt \xintfloat #1\Z }%
-\def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }%
-\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINT_inFloat #1\Z }%
+\def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }%
+\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINT_inFloat #1\Z }%
\def\XINT_fladd_chkopt #1#2%
{%
\ifx [#2\expandafter\XINT_fladd_opt
@@ -18394,15 +18532,16 @@ first place.
}%
\def\XINT_FL_Div_b #1[#2]#3[#4]{\xintE{#3/#1}{#4-#2}}%
% \end{macrocode}
-% \subsection{\csh{xintFloatSum}}
+% \subsection{\csh{XINTinFloatSum}}
% \lverb|1.09a: quick write-up, for use by \xintfloatexpr, will need to be
-% thought through again.|
+% thought through again. Renamed (and slightly modified) in 1.09h. Should be
+% extended for optional precision. Should be rewritten for optimization. |
% \begin{macrocode}
-\def\xintFloatSum {\romannumeral0\xintfloatsum }%
-\def\xintfloatsum #1{\expandafter\XINT_floatsum_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatSum {\romannumeral0\XINTinfloatsum }%
+\def\XINTinfloatsum #1{\expandafter\XINT_floatsum_a\romannumeral-`0#1\relax }%
\def\XINT_floatsum_a #1{\expandafter\XINT_floatsum_b
- \romannumeral0\xintraw{#1}\Z }% normalizes if only 1
-\def\XINT_floatsum_b #1\Z #2% but a bit wasteful
+ \romannumeral0\XINT_inFloat[\XINTdigits]{#1}\Z }%
+\def\XINT_floatsum_b #1\Z #2%
{\expandafter\XINT_floatsum_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_floatsum_c #1%
{\xint_gob_til_relax #1\XINT_floatsum_e\relax\XINT_floatsum_d #1}%
@@ -18410,11 +18549,11 @@ first place.
{\expandafter\XINT_floatsum_b\romannumeral0\XINTinfloatadd {#1}}%
\def\XINT_floatsum_e #1\Z #2\Z { #2}%
% \end{macrocode}
-% \subsection{\csh{xintFloatSum:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr.|
+% \subsection{\csh{XINTinFloatSum:csv}}
+% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
% \begin{macrocode}
-\def\xintFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0/1[0]}}%
+\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:_b #1#2,%
{\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_floatsum:_e
@@ -18423,14 +18562,15 @@ first place.
{\romannumeral0\XINTinfloatadd {#2}{#1}}}%
\def\XINT_floatsum:_e ,#1#2^{#1}% allows empty list
% \end{macrocode}
-% \subsection{\csh{xintFloatPrd}}
+% \subsection{\csh{XINTinFloatPrd}}
% \lverb|1.09a: quick write-up, for use by \xintfloatexpr, will need to be
-% thought through again.|
+% thought through again. Renamed (and slightly modified) in 1.09h. Should be
+% extended for optional precision. Should be rewritten for optimization. |
% \begin{macrocode}
-\def\xintFloatPrd {\romannumeral0\xintfloatprd }%
-\def\xintfloatprd #1{\expandafter\XINT_floatprd_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatPrd {\romannumeral0\XINTinfloatprd }%
+\def\XINTinfloatprd #1{\expandafter\XINT_floatprd_a\romannumeral-`0#1\relax }%
\def\XINT_floatprd_a #1{\expandafter\XINT_floatprd_b
- \romannumeral0\xintraw{#1}\Z }%
+ \romannumeral0\XINT_inFloat[\XINTdigits]{#1}\Z }%
\def\XINT_floatprd_b #1\Z #2%
{\expandafter\XINT_floatprd_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_floatprd_c #1%
@@ -18439,11 +18579,11 @@ first place.
{\expandafter\XINT_floatprd_b\romannumeral0\XINTinfloatmul {#1}}%
\def\XINT_floatprd_e #1\Z #2\Z { #2}%
% \end{macrocode}
-% \subsection{\csh{xintFloatPrd:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr.|
+% \subsection{\csh{XINTinFloatPrd:csv}}
+% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
% \begin{macrocode}
-\def\xintFloatPrd:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1/1[0]}}%
+\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:_b #1#2,%
{\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_floatprd:_e
@@ -18992,7 +19132,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2013/11/22 v1.09g Expandable partial sums with xint package (jfB)]%
+ [2013/11/28 v1.09h Expandable partial sums with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintSeries}}
% \lverb|&
@@ -19529,7 +19669,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2013/11/22 v1.09g Expandable continued fractions with xint package (jfB)]%
+ [2013/11/28 v1.09h Expandable continued fractions with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintCFrac}}
% \begin{macrocode}
@@ -20682,7 +20822,7 @@ first place.
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2013/11/22 v1.09g Expandable expression parser (jfB)]%
+ [2013/11/28 v1.09h Expandable expression parser (jfB)]%
% \end{macrocode}
% \subsection{Helper macros}
% \begin{macrocode}
@@ -21265,7 +21405,8 @@ first place.
\let\XINT_flexpr_op_!\XINT_expr_op_!
% \end{macrocode}
% \subsection{Functions}
-% \lverb|New with 1.09a.|
+% \lverb|New with 1.09a. Names of ..Float..:csv macros have been changed in
+% 1.09h |
% \begin{macrocode}
\def\XINT_expr_op_@ #1%
{%
@@ -21435,7 +21576,7 @@ first place.
\def\XINT_flexpr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_min #1#2#3%
{%
@@ -21445,7 +21586,7 @@ first place.
\def\XINT_flexpr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_sum #1#2#3%
{%
@@ -21455,7 +21596,7 @@ first place.
\def\XINT_flexpr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_prd #1#2#3%
{%
@@ -21465,7 +21606,7 @@ first place.
\def\XINT_flexpr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_expr_func_add\XINT_expr_func_sum
\let\XINT_expr_func_mul\XINT_expr_func_prd
@@ -21540,7 +21681,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),(num,iRound0),(bool,IsTrue)}\do {%
\expandafter\def\csname XINT_new#1expr_print\endcsname
##1{\ifnum\xintNthElt{0}{##1}>1
\expandafter\xint_firstoftwo
@@ -21552,18 +21693,21 @@ first place.
\toks0 {}%
\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,%
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}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,%
- FloatMaxof,FloatMinof,Sum,Prd,FloatSum,FloatPrd} \do
+\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
- ####1{_xint#1 {\xintCSVtoListNonStripped {####1}}}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE} \do
+ ####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
+\xintFor #1 in {Maxof,Minof,Sum,Prd}\do
+ {\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}}}%
+ {_XINTinFloat#1}}}%
\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
\def\XINTdigits {_XINTdigits}%
\def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
@@ -21684,7 +21828,8 @@ first place.
\def\mymacroaux #1#2{#2}%
%
\parbox[t]{10cm}{Total number of code lines:
- \digitstt{\xintiSum{\xintApply\mymacro\storedlinecounts}}. Each package starts
+ \digitstt{\xintiiSum{\xintApply\mymacro\storedlinecounts}}. Each
+ package starts
with circa \digitstt{80} lines dealing with catcodes, package identification
and reloading management, also for Plain \TeX\strut. Version
\texttt{\pkgversion} of \texttt{\pkgdate}.\par}
@@ -21705,7 +21850,7 @@ first place.
Right bracket \] Circumflex \^ Underscore \_
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum {20159}
+\CheckSum {20277}
\makeatletter\check@checksum\makeatother
\Finale
%%
diff --git a/Master/texmf-dist/source/generic/xint/xint.ins b/Master/texmf-dist/source/generic/xint/xint.ins
index 717d1ac7adb..69767398e82 100644
--- a/Master/texmf-dist/source/generic/xint/xint.ins
+++ b/Master/texmf-dist/source/generic/xint/xint.ins
@@ -1,6 +1,6 @@
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index da74f7916af..a2f9a610e2d 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xint: Expandable operations on long numbers
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,10 +105,10 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xint}%
- [2013/11/22 v1.09g Expandable operations on long numbers (jfB)]%
-\def\xint_firstofthree #1#2#3{#1}%
-\def\xint_secondofthree #1#2#3{#2}%
-\def\xint_thirdofthree #1#2#3{#3}%
+ [2013/11/28 v1.09h 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}%
\def\xint_gob_til_zero #10{}%
\def\xint_gob_til_zeros_iii #1000{}%
\def\xint_gob_til_zeros_iv #10000{}%
@@ -1530,12 +1530,12 @@
{\expandafter\XINT_iminof_b\romannumeral0\xintimin {#1}}%
\def\XINT_iminof_e #1\Z #2\Z { #2}%
\let\xintMinof\xintiMinof \let\xintminof\xintiminof
-\def\xintiSum {\romannumeral0\xintisum }%
-\def\xintisum #1{\xintisumexpr #1\relax }%
-\def\xintiSumExpr {\romannumeral0\xintisumexpr }%
-\def\xintisumexpr {\expandafter\XINT_sumexpr\romannumeral-`0}%
-\let\xintSum\xintiSum \let\xintsum\xintisum
-\let\xintSumExpr\xintiSumExpr \let\xintsumexpr\xintisumexpr
+\def\xintiiSum {\romannumeral0\xintiisum }%
+\def\xintiisum #1{\xintiisumexpr #1\relax }%
+\def\xintiiSumExpr {\romannumeral0\xintiisumexpr }%
+\def\xintiisumexpr {\expandafter\XINT_sumexpr\romannumeral-`0}%
+\let\xintSum\xintiiSum \let\xintsum\xintiisum
+\let\xintSumExpr\xintiiSumExpr \let\xintsumexpr\xintiisumexpr
\def\XINT_sumexpr {\XINT_sum_loop {0000}{0000}}%
\def\XINT_sum_loop #1#2#3%
{%
@@ -1968,14 +1968,14 @@
\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
\Z\Z\Z\Z #1\W\W\W\W
}%
-\def\xintiPrd {\romannumeral0\xintiprd }%
-\def\xintiprd #1{\xintiprdexpr #1\relax }%
-\let\xintPrd\xintiPrd
-\let\xintprd\xintiprd
-\def\xintiPrdExpr {\romannumeral0\xintiprdexpr }%
-\def\xintiprdexpr {\expandafter\XINT_prdexpr\romannumeral-`0}%
-\let\xintPrdExpr\xintiPrdExpr
-\let\xintprdexpr\xintiprdexpr
+\def\xintiiPrd {\romannumeral0\xintiiprd }%
+\def\xintiiprd #1{\xintiiprdexpr #1\relax }%
+\let\xintPrd\xintiiPrd
+\let\xintprd\xintiiprd
+\def\xintiiPrdExpr {\romannumeral0\xintiiprdexpr }%
+\def\xintiiprdexpr {\expandafter\XINT_prdexpr\romannumeral-`0}%
+\let\xintPrdExpr\xintiiPrdExpr
+\let\xintprdexpr\xintiiprdexpr
\def\XINT_prdexpr {\XINT_prod_loop_a 1\Z }%
\def\XINT_prod_loop_a #1\Z #2%
{%
@@ -1996,11 +1996,7 @@
{%
\expandafter\XINT_fac_fork\expandafter{\the\numexpr #1}%
}%
-\def\xintFac {\romannumeral0\xintfac }%
-\def\xintfac #1%
-{%
- \expandafter\XINT_fac_fork\expandafter{\romannumeral0\xintnum{#1}}%
-}%
+\let\xintFac\xintiFac \let\xintfac\xintifac
\def\XINT_fac_fork #1%
{%
\ifcase\XINT_Sgn {#1}
diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
index 398a240f692..c6f5f4c3ec0 100644
--- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintbinhex: Expandable binary and hexadecimal conversions
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2013/11/22 v1.09g Expandable binary and hexadecimal conversions (jfB)]%
+ [2013/11/28 v1.09h Expandable binary and hexadecimal conversions (jfB)]%
\chardef\xint_c_xvi 16
\chardef\xint_c_ii^v 32
\chardef\xint_c_ii^vi 64
diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
index 23fcc93cdc4..ec890d28333 100644
--- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintcfrac: Expandable continued fractions with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2013/11/22 v1.09g Expandable continued fractions with xint package (jfB)]%
+ [2013/11/28 v1.09h Expandable continued fractions with xint package (jfB)]%
\def\xintCFrac {\romannumeral0\xintcfrac }%
\def\xintcfrac #1%
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index b8ec31f6495..73cd012e331 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintexpr: Expandable expression parser
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2013/11/22 v1.09g Expandable expression parser (jfB)]%
+ [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
@@ -726,7 +726,7 @@
\def\XINT_flexpr_func_max #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_min #1#2#3%
{%
@@ -736,7 +736,7 @@
\def\XINT_flexpr_func_min #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_sum #1#2#3%
{%
@@ -746,7 +746,7 @@
\def\XINT_flexpr_func_sum #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatSum:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_prd #1#2#3%
{%
@@ -756,7 +756,7 @@
\def\XINT_flexpr_func_prd #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .\xintFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
+ .\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
}%
\let\XINT_expr_func_add\XINT_expr_func_sum
\let\XINT_expr_func_mul\XINT_expr_func_prd
@@ -820,7 +820,7 @@
\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),(num,iRound0),(bool,IsTrue)}\do {%
\expandafter\def\csname XINT_new#1expr_print\endcsname
##1{\ifnum\xintNthElt{0}{##1}>1
\expandafter\xint_firstoftwo
@@ -832,18 +832,21 @@
\toks0 {}%
\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,%
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}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,%
- FloatMaxof,FloatMinof,Sum,Prd,FloatSum,FloatPrd} \do
+\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd}\do
{\toks0
\expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
- ####1{_xint#1 {\xintCSVtoListNonStripped {####1}}}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE} \do
+ ####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
+\xintFor #1 in {Maxof,Minof,Sum,Prd}\do
+ {\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}}}%
+ {_XINTinFloat#1}}}%
\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
\def\XINTdigits {_XINTdigits}%
\def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index 0dbbf609461..627ea69c50f 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintfrac: Expandable operations on fractions
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2013/11/22 v1.09g Expandable operations on fractions (jfB)]%
+ [2013/11/28 v1.09h Expandable operations on fractions (jfB)]%
\chardef\xint_c_vi 6
\chardef\xint_c_vii 7
\chardef\xint_c_xviii 18
@@ -1541,8 +1541,8 @@
\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\xintFloatMaxof {\romannumeral0\xintflmaxof }%
-\def\xintflmaxof #1{\expandafter\XINT_flmaxof_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatMaxof {\romannumeral0\XINTinfloatmaxof }%
+\def\XINTinfloatmaxof #1{\expandafter\XINT_flmaxof_a\romannumeral-`0#1\relax }%
\def\XINT_flmaxof_a #1{\expandafter\XINT_flmaxof_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1}\Z }%
\def\XINT_flmaxof_b #1\Z #2%
@@ -1553,7 +1553,7 @@
{\expandafter\XINT_flmaxof_b\romannumeral0\xintmax
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flmaxof_e #1\Z #2\Z { #2}%
-\def\xintFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
+\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
\def\XINT_flmaxof:_a #1,{\expandafter\XINT_flmaxof:_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flmaxof:_b #1,#2,%
@@ -1614,8 +1614,8 @@
\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\xintFloatMinof {\romannumeral0\xintflminof }%
-\def\xintflminof #1{\expandafter\XINT_flminof_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatMinof {\romannumeral0\XINTinfloatminof }%
+\def\XINTinfloatminof #1{\expandafter\XINT_flminof_a\romannumeral-`0#1\relax }%
\def\XINT_flminof_a #1{\expandafter\XINT_flminof_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1}\Z }%
\def\XINT_flminof_b #1\Z #2%
@@ -1626,7 +1626,7 @@
{\expandafter\XINT_flminof_b\romannumeral0\xintmin
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flminof_e #1\Z #2\Z { #2}%
-\def\xintFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
+\def\XINTinFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
\def\XINT_flminof:_a #1,{\expandafter\XINT_flminof:_b
\romannumeral0\XINT_inFloat [\XINTdigits]{#1},}%
\def\XINT_flminof:_b #1,#2,%
@@ -1742,8 +1742,8 @@
\def\xint_fsgn #1#2#3{\xintiisgn {#2}}%
\def\xintFloatAdd {\romannumeral0\xintfloatadd }%
\def\xintfloatadd #1{\XINT_fladd_chkopt \xintfloat #1\Z }%
-\def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }%
-\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINT_inFloat #1\Z }%
+\def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }%
+\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINT_inFloat #1\Z }%
\def\XINT_fladd_chkopt #1#2%
{%
\ifx [#2\expandafter\XINT_fladd_opt
@@ -1861,19 +1861,19 @@
\expandafter\XINT_FL_Div_b\romannumeral0\XINT_inFloat [#1]{#3}#2%
}%
\def\XINT_FL_Div_b #1[#2]#3[#4]{\xintE{#3/#1}{#4-#2}}%
-\def\xintFloatSum {\romannumeral0\xintfloatsum }%
-\def\xintfloatsum #1{\expandafter\XINT_floatsum_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatSum {\romannumeral0\XINTinfloatsum }%
+\def\XINTinfloatsum #1{\expandafter\XINT_floatsum_a\romannumeral-`0#1\relax }%
\def\XINT_floatsum_a #1{\expandafter\XINT_floatsum_b
- \romannumeral0\xintraw{#1}\Z }% normalizes if only 1
-\def\XINT_floatsum_b #1\Z #2% but a bit wasteful
+ \romannumeral0\XINT_inFloat[\XINTdigits]{#1}\Z }%
+\def\XINT_floatsum_b #1\Z #2%
{\expandafter\XINT_floatsum_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_floatsum_c #1%
{\xint_gob_til_relax #1\XINT_floatsum_e\relax\XINT_floatsum_d #1}%
\def\XINT_floatsum_d #1\Z
{\expandafter\XINT_floatsum_b\romannumeral0\XINTinfloatadd {#1}}%
\def\XINT_floatsum_e #1\Z #2\Z { #2}%
-\def\xintFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0/1[0]}}%
+\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:_b #1#2,%
{\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_floatsum:_e
@@ -1881,10 +1881,10 @@
\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\xintFloatPrd {\romannumeral0\xintfloatprd }%
-\def\xintfloatprd #1{\expandafter\XINT_floatprd_a\romannumeral-`0#1\relax }%
+\def\XINTinFloatPrd {\romannumeral0\XINTinfloatprd }%
+\def\XINTinfloatprd #1{\expandafter\XINT_floatprd_a\romannumeral-`0#1\relax }%
\def\XINT_floatprd_a #1{\expandafter\XINT_floatprd_b
- \romannumeral0\xintraw{#1}\Z }%
+ \romannumeral0\XINT_inFloat[\XINTdigits]{#1}\Z }%
\def\XINT_floatprd_b #1\Z #2%
{\expandafter\XINT_floatprd_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_floatprd_c #1%
@@ -1892,8 +1892,8 @@
\def\XINT_floatprd_d #1\Z
{\expandafter\XINT_floatprd_b\romannumeral0\XINTinfloatmul {#1}}%
\def\XINT_floatprd_e #1\Z #2\Z { #2}%
-\def\xintFloatPrd:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1/1[0]}}%
+\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:_b #1#2,%
{\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_floatprd:_e
diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
index a6e141b3084..7e0b39b038a 100644
--- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintgcd: Euclidean algorithm with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2013/11/22 v1.09g Euclide algorithm with xint package (jfB)]%
+ [2013/11/28 v1.09h Euclide algorithm with xint package (jfB)]%
\def\xintGCD {\romannumeral0\xintgcd }%
\def\xintgcd #1%
{%
@@ -446,48 +446,43 @@
\xintAssignArray\xintEuclideAlgorithm {#1}{#2}\to\U
\edef\A{\U2}\edef\B{\U4}\edef\N{\U1}%
\setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}%
- \noindent
- \XINT_count 1
- \loop
- \hbox to \wd 0 {\hfil$\U{\numexpr 2*\XINT_count\relax}$}%
- ${} = \U{\numexpr 2*\XINT_count + 3\relax}
- \times \U{\numexpr 2*\XINT_count + 2\relax}
- + \U{\numexpr 2*\XINT_count + 4\relax}$%
- \ifnum \XINT_count < \N
- \hfill\break
- \advance \XINT_count 1
+ \count 255 1
+ \xintloop
+ \indent\hbox to \wd 0 {\hfil$\U{\numexpr 2*\count255\relax}$}%
+ ${} = \U{\numexpr 2*\count255 + 3\relax}
+ \times \U{\numexpr 2*\count255 + 2\relax}
+ + \U{\numexpr 2*\count255 + 4\relax}$%
+ \ifnum \count255 < \N
+ \par
+ \advance \count255 1
\repeat
- \par
\endgroup
}%
\def\xintTypesetBezoutAlgorithm #1#2%
{%
\par
\begingroup
- \parindent0pt
\xintAssignArray\xintBezoutAlgorithm {#1}{#2}\to\BEZ
\edef\A{\BEZ2}\edef\B{\BEZ6}\edef\N{\BEZ1}% A = |#1|, B = |#2|
\setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}%
- \XINT_count 1
- \loop
- \noindent
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count - 2}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 2}
- + \BEZ{4*\XINT_count + 6}$\hfill\break
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count +7}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 3}
- + \BEZ{4*\XINT_count - 1}$\hfill\break
- \hbox to \wd 0 {\hfil$\BEZ{4*\XINT_count +8}$}%
- ${} = \BEZ{4*\XINT_count + 5}
- \times \BEZ{4*\XINT_count + 4}
- + \BEZ{4*\XINT_count }$
- \endgraf
- \ifnum \XINT_count < \N
- \advance \XINT_count 1
+ \count255 1
+ \xintloop
+ \indent\hbox to \wd 0 {\hfil$\BEZ{4*\count255 - 2}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 2}
+ + \BEZ{4*\count255 + 6}$\hfill\break
+ \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +7}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 3}
+ + \BEZ{4*\count255 - 1}$\hfill\break
+ \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +8}$}%
+ ${} = \BEZ{4*\count255 + 5}
+ \times \BEZ{4*\count255 + 4}
+ + \BEZ{4*\count255 }$
+ \par
+ \ifnum \count255 < \N
+ \advance \count255 1
\repeat
- \par
\edef\U{\BEZ{4*\N + 4}}%
\edef\V{\BEZ{4*\N + 3}}%
\edef\D{\BEZ5}%
@@ -496,7 +491,7 @@
\else
$\U\times\A - \V\times\B = \D$%
\fi
- \par
+ \par
\endgroup
}%
\XINT_restorecatcodes_endinput%
diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty
index 0cd0f52fa8a..df153fe9ca3 100644
--- a/Master/texmf-dist/tex/generic/xint/xintseries.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xintseries: Expandable partial sums with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -105,7 +105,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2013/11/22 v1.09g Expandable partial sums with xint package (jfB)]%
+ [2013/11/28 v1.09h 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 9e2fad8b5d6..17150430247 100644
--- a/Master/texmf-dist/tex/generic/xint/xinttools.sty
+++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.09g of November 22, 2013)
+%% The xint bundle (version 1.09h of November 28, 2013)
%% xinttools: Expandable and non-expandable utilities
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -152,37 +152,36 @@
\fi
\XINT_providespackage
\ProvidesPackage {xinttools}%
- [2013/11/22 v1.09g Expandable and non-expandable utilities (jfB)]%
-\def\xint_gobble_ {}%
-\def\xint_gobble_i #1{}%
-\def\xint_gobble_ii #1#2{}%
-\def\xint_gobble_iii #1#2#3{}%
-\def\xint_gobble_iv #1#2#3#4{}%
-\def\xint_gobble_v #1#2#3#4#5{}%
-\def\xint_gobble_vi #1#2#3#4#5#6{}%
-\def\xint_gobble_vii #1#2#3#4#5#6#7{}%
-\def\xint_gobble_viii #1#2#3#4#5#6#7#8{}%
-\long\def\xint_firstofone #1{#1}% long since 1.09f, 2013/11/01
-\xint_firstofone{\let\XINT_sptoken= } % 1.09d, 2013/10/22
-\long\def\xint_firstoftwo #1#2{#1}% long since 1.09e, 2013/10/28
-\long\def\xint_secondoftwo #1#2{#2}% idem
-\def\xint_firstoftwo_andstop #1#2{ #1}%
-\def\xint_secondoftwo_andstop #1#2{ #2}%
+ [2013/11/28 v1.09h Expandable and non-expandable utilities (jfB)]%
+\long\def\xint_gobble_ {}%
+\long\def\xint_gobble_i #1{}%
+\long\def\xint_gobble_ii #1#2{}%
+\long\def\xint_gobble_iii #1#2#3{}%
+\long\def\xint_gobble_iv #1#2#3#4{}%
+\long\def\xint_gobble_v #1#2#3#4#5{}%
+\long\def\xint_gobble_vi #1#2#3#4#5#6{}%
+\long\def\xint_gobble_vii #1#2#3#4#5#6#7{}%
+\long\def\xint_gobble_viii #1#2#3#4#5#6#7#8{}%
+\long\def\xint_firstofone #1{#1}%
+\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 { -}%
-\def\xint_gob_til_R #1\R {}%
-\def\xint_gob_til_W #1\W {}%
-\def\xint_gob_til_Z #1\Z {}%
-\long\def\xint_bye #1\xint_bye {}% long since 1.09f
+\long\def\xint_gob_til_R #1\R {}%
+\long\def\xint_gob_til_W #1\W {}%
+\long\def\xint_gob_til_Z #1\Z {}%
+\long\def\xint_bye #1\xint_bye {}%
\let\xint_relax\relax
\def\xint_brelax {\xint_relax }%
-\long\def\xint_gob_til_xint_relax #1\xint_relax {}% long since 1.09f
-\def\xint_afterfi #1#2\fi {\fi #1}%
+\long\def\xint_gob_til_xint_relax #1\xint_relax {}%
+\long\def\xint_afterfi #1#2\fi {\fi #1}%
\chardef\xint_c_ 0
\chardef\xint_c_viii 8
\newtoks\XINT_toks
-\newcount\XINT_count % 1.09g: \xintFor from 1.09f modified \count 255 :-(
\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
-\def\xintreverseorder #1%
+\long\def\xintreverseorder #1%
{%
\XINT_rord_main {}#1%
\xint_relax
@@ -190,35 +189,35 @@
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_rord_main #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_rord_main #1#2#3#4#5#6#7#8#9%
{%
\xint_bye #9\XINT_rord_cleanup\xint_bye
\XINT_rord_main {#9#8#7#6#5#4#3#2#1}%
}%
-\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+\long\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
{%
\expandafter\space\xint_gob_til_xint_relax #1%
}%
\def\xintRevWithBraces {\romannumeral0\xintrevwithbraces }%
\def\xintRevWithBracesNoExpand {\romannumeral0\xintrevwithbracesnoexpand }%
-\def\xintrevwithbraces #1%
+\long\def\xintrevwithbraces #1%
{%
\expandafter\XINT_revwbr_loop\expandafter{\expandafter}%
\romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\xintrevwithbracesnoexpand #1%
+\long\def\xintrevwithbracesnoexpand #1%
{%
\XINT_revwbr_loop {}%
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_revwbr_loop #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_revwbr_loop #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_revwbr_finish_a\xint_relax
\XINT_revwbr_loop {{#9}{#8}{#7}{#6}{#5}{#4}{#3}{#2}#1}%
}%
-\def\XINT_revwbr_finish_a\xint_relax\XINT_revwbr_loop #1#2\xint_bye
+\long\def\XINT_revwbr_finish_a\xint_relax\XINT_revwbr_loop #1#2\xint_bye
{%
\XINT_revwbr_finish_b #2\R\R\R\R\R\R\R\Z #1%
}%
@@ -241,13 +240,13 @@
\csname xint_gobble_\romannumeral #1\endcsname
}%
\def\xintLength {\romannumeral0\xintlength }%
-\def\xintlength #1%
+\long\def\xintlength #1%
{%
\XINT_length_loop
{0}#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_length_loop #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_length_loop #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_length_finish_a\xint_relax
\expandafter\XINT_length_loop\expandafter {\the\numexpr #1+8\relax}%
@@ -271,81 +270,83 @@
}%
\def\XINT_length_finish_c #1#2\Z #3{\expandafter\space\the\numexpr #3-#1\relax}%
\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }%
-\edef\xintzapfirstspaces #1%
+\long\edef\xintzapfirstspaces #1%
{\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }%
-\xint_firstofone {\def\XINT_zapbsp_a #1 } %<- space token here
+\xint_firstofone {\long\def\XINT_zapbsp_a #1 } %<- space token here
{%
\XINT_zapbsp_again? #1\xint_bye\XINT_zapbsp_b {#1}%
}%
-\def\XINT_zapbsp_again? #1{\xint_bye #1\XINT_zapbsp_again }%
+\long\def\XINT_zapbsp_again? #1{\xint_bye #1\XINT_zapbsp_again }%
\edef\XINT_zapbsp_again\XINT_zapbsp_b #1{\noexpand\XINT_zapbsp_a\space }%
-\def\XINT_zapbsp_b #1#2\xint_relax
+\long\def\XINT_zapbsp_b #1#2\xint_relax
{\XINT_zapbsp_end? #2\XINT_zapbsp_e\empty #2{#1}}%
-\def\XINT_zapbsp_end? #1{\xint_bye #1\XINT_zapbsp_end }%
-\def\XINT_zapbsp_end\XINT_zapbsp_e\empty #1\xint_bye #2{#2#1}%
-\xint_firstofone{\def\XINT_zapbsp_e #1 } \xint_bye
+\long\def\XINT_zapbsp_end? #1{\xint_bye #1\XINT_zapbsp_end }%
+\long\def\XINT_zapbsp_end\XINT_zapbsp_e\empty #1\xint_bye #2{#2#1}%
+\xint_firstofone{\long\def\XINT_zapbsp_e #1 } \xint_bye
{\expandafter\XINT_zapbsp_f \expandafter{#1}}%
-\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
+\long\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
\def\xintZapLastSpaces {\romannumeral0\xintzaplastspaces }%
-\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
+\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
#1\space\space\noexpand\xint_bye \xint_relax}%
-\xint_firstofone {\def\XINT_zapesp_a #1#2 } %<- second space here
+\xint_firstofone {\long\def\XINT_zapesp_a #1#2 } %<- second space here
{\expandafter\XINT_zapesp_b\expandafter{#2}{#1}}%
-\def\XINT_zapesp_b #1#2#3\xint_relax
+\long\def\XINT_zapesp_b #1#2#3\xint_relax
{\XINT_zapesp_end? #3\XINT_zapesp_e {#2#1}\empty #3\xint_relax }%
-\def\XINT_zapesp_end? #1{\xint_bye #1\XINT_zapesp_end }%
-\def\XINT_zapesp_end\XINT_zapesp_e #1#2\xint_relax {#1}%
-\edef\XINT_zapesp_e #1{\noexpand \XINT_zapesp_a {#1\space\space}}%
+\long\def\XINT_zapesp_end? #1{\xint_bye #1\XINT_zapesp_end }%
+\long\def\XINT_zapesp_end\XINT_zapesp_e #1#2\xint_relax {#1}%
+\long\edef\XINT_zapesp_e #1{\noexpand \XINT_zapesp_a {#1\space\space}}%
\def\xintZapSpaces {\romannumeral0\xintzapspaces }%
-\edef\xintzapspaces #1%
+\long\edef\xintzapspaces #1%
{\noexpand\XINT_zapsp_a \space #1\space\space\noexpand\xint_bye\xint_relax}%
-\xint_firstofone {\def\XINT_zapsp_a #1 } %<- space token here
+\xint_firstofone {\long\def\XINT_zapsp_a #1 } %<- space token here
{%
\XINT_zapsp_again? #1\xint_bye\XINT_zapesp_b {#1}{}%
}%
-\def\XINT_zapsp_again? #1{\xint_bye #1\XINT_zapsp_again }%
-\edef\XINT_zapsp_again\XINT_zapesp_b #1#2{\noexpand\XINT_zapsp_a\space }%
+\long\def\XINT_zapsp_again? #1{\xint_bye #1\XINT_zapsp_again }%
+\long\edef\XINT_zapsp_again\XINT_zapesp_b #1#2{\noexpand\XINT_zapsp_a\space }%
\def\xintZapSpacesB {\romannumeral0\xintzapspacesb }%
-\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
+\long\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
\xint_bye\xintzapspaces {#1}}%
-\def\XINT_zapspb_one? #1#2%
+\long\def\XINT_zapspb_one? #1#2%
{\xint_gob_til_xint_relax #1\XINT_zapspb_onlyspaces\xint_relax
\xint_gob_til_xint_relax #2\XINT_zapspb_bracedorone\xint_relax
\xint_bye {#1}}%
\def\XINT_zapspb_onlyspaces\xint_relax
\xint_gob_til_xint_relax\xint_relax\XINT_zapspb_bracedorone\xint_relax
\xint_bye #1\xint_bye\xintzapspaces #2{ }%
-\def\XINT_zapspb_bracedorone\xint_relax
+\long\def\XINT_zapspb_bracedorone\xint_relax
\xint_bye #1\xint_relax\xint_bye\xintzapspaces #2{ #1}%
\def\xintCSVtoList {\romannumeral0\xintcsvtolist }%
-\def\xintcsvtolist #1{\expandafter\xintApply\expandafter\xintzapspacesb
+\long\def\xintcsvtolist #1{\expandafter\xintApply
+ \expandafter\xintzapspacesb
\expandafter{\romannumeral0\xintcsvtolistnonstripped{#1}}}%
\def\xintCSVtoListNoExpand {\romannumeral0\xintcsvtolistnoexpand }%
-\def\xintcsvtolistnoexpand #1{\expandafter\xintApply\expandafter\xintzapspacesb
+\long\def\xintcsvtolistnoexpand #1{\expandafter\xintApply
+ \expandafter\xintzapspacesb
\expandafter{\romannumeral0\xintcsvtolistnonstrippednoexpand{#1}}}%
\def\xintCSVtoListNonStripped {\romannumeral0\xintcsvtolistnonstripped }%
\def\xintCSVtoListNonStrippedNoExpand
{\romannumeral0\xintcsvtolistnonstrippednoexpand }%
-\def\xintcsvtolistnonstripped #1%
+\long\def\xintcsvtolistnonstripped #1%
{%
\expandafter\XINT_csvtol_loop_a\expandafter
{\expandafter}\romannumeral-`0#1%
,\xint_bye,\xint_bye,\xint_bye,\xint_bye
,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z
}%
-\def\xintcsvtolistnonstrippednoexpand #1%
+\long\def\xintcsvtolistnonstrippednoexpand #1%
{%
\XINT_csvtol_loop_a
{}#1,\xint_bye,\xint_bye,\xint_bye,\xint_bye
,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z
}%
-\def\XINT_csvtol_loop_a #1#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_csvtol_loop_a #1#2,#3,#4,#5,#6,#7,#8,#9,%
{%
\xint_bye #9\XINT_csvtol_finish_a\xint_bye
\XINT_csvtol_loop_b {#1}{{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}%
}%
-\def\XINT_csvtol_loop_b #1#2{\XINT_csvtol_loop_a {#1#2}}%
-\def\XINT_csvtol_finish_a\xint_bye\XINT_csvtol_loop_b #1#2#3\Z
+\long\def\XINT_csvtol_loop_b #1#2{\XINT_csvtol_loop_a {#1#2}}%
+\long\def\XINT_csvtol_finish_a\xint_bye\XINT_csvtol_loop_b #1#2#3\Z
{%
\XINT_csvtol_finish_b #3\R,\R,\R,\R,\R,\R,\R,\Z #2{#1}%
}%
@@ -365,14 +366,15 @@
{%
\csname XINT_csvtol_finish_d\romannumeral #1\endcsname
}%
-\def\XINT_csvtol_finish_dviii #1#2#3#4#5#6#7#8#9{ #9}%
-\def\XINT_csvtol_finish_dvii #1#2#3#4#5#6#7#8#9{ #9{#1}}%
-\def\XINT_csvtol_finish_dvi #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}}%
-\def\XINT_csvtol_finish_dv #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}}%
-\def\XINT_csvtol_finish_div #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}}%
-\def\XINT_csvtol_finish_diii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}}%
-\def\XINT_csvtol_finish_dii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}{#6}}%
-\def\XINT_csvtol_finish_di #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_csvtol_finish_dviii #1#2#3#4#5#6#7#8#9{ #9}%
+\long\def\XINT_csvtol_finish_dvii #1#2#3#4#5#6#7#8#9{ #9{#1}}%
+\long\def\XINT_csvtol_finish_dvi #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}}%
+\long\def\XINT_csvtol_finish_dv #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}}%
+\long\def\XINT_csvtol_finish_div #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}}%
+\long\def\XINT_csvtol_finish_diii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}}%
+\long\def\XINT_csvtol_finish_dii #1#2#3#4#5#6#7#8#9%
+ { #9{#1}{#2}{#3}{#4}{#5}{#6}}%
+\long\def\XINT_csvtol_finish_di #1#2#3#4#5#6#7#8#9%
{ #9{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
\def\xintListWithSep {\romannumeral0\xintlistwithsep }%
\def\xintListWithSepNoExpand {\romannumeral0\xintlistwithsepnoexpand }%
@@ -403,7 +405,7 @@
{%
\expandafter\XINT_ntheltnoexpand_a\expandafter {\the\numexpr #1}%
}%
-\def\XINT_nthelt_a #1#2%
+\long\def\XINT_nthelt_a #1#2%
{%
\ifnum #1<0
\xint_afterfi{\expandafter\XINT_nthelt_c\expandafter
@@ -413,7 +415,7 @@
{\romannumeral-`0#2}{#1}}%
\fi
}%
-\def\XINT_ntheltnoexpand_a #1#2%
+\long\def\XINT_ntheltnoexpand_a #1#2%
{%
\ifnum #1<0
\xint_afterfi{\expandafter\XINT_nthelt_c\expandafter
@@ -423,7 +425,7 @@
{#2}{#1}}%
\fi
}%
-\def\XINT_nthelt_c #1#2%
+\long\def\XINT_nthelt_c #1#2%
{%
\ifnum #2>\xint_c_
\expandafter\XINT_nthelt_loop_a
@@ -441,7 +443,7 @@
\fi
{#1}%
}%
-\def\XINT_nthelt_loop_b #1#2#3#4#5#6#7#8#9%
+\long\def\XINT_nthelt_loop_b #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_nthelt_silentend\xint_relax
\expandafter\XINT_nthelt_loop_a\expandafter{\the\numexpr #1-8}%
@@ -452,46 +454,46 @@
\expandafter\expandafter\expandafter\XINT_nthelt_finish
\csname xint_gobble_\romannumeral\numexpr#1-1\endcsname
}%
-\def\XINT_nthelt_finish #1#2\xint_bye
+\long\def\XINT_nthelt_finish #1#2\xint_bye
{\xint_gob_til_xint_relax #1\expandafter\space
\xint_gobble_iii\xint_relax\space #1}%
\def\xintApply {\romannumeral0\xintapply }%
\def\xintApplyNoExpand {\romannumeral0\xintapplynoexpand }%
-\def\xintapply #1#2%
+\long\def\xintapply #1#2%
{%
\expandafter\XINT_apply\expandafter {\romannumeral-`0#2}%
{#1}%
}%
-\def\XINT_apply #1#2{\XINT_apply_loop_a {}{#2}#1\xint_bye }%
-\def\xintapplynoexpand #1#2{\XINT_apply_loop_a {}{#1}#2\xint_bye }%
-\def\XINT_apply_loop_a #1#2#3%
+\long\def\XINT_apply #1#2{\XINT_apply_loop_a {}{#2}#1\xint_bye }%
+\long\def\xintapplynoexpand #1#2{\XINT_apply_loop_a {}{#1}#2\xint_bye }%
+\long\def\XINT_apply_loop_a #1#2#3%
{%
\xint_bye #3\XINT_apply_end\xint_bye
\expandafter
\XINT_apply_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
-\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}%
-\def\XINT_apply_end\xint_bye\expandafter\XINT_apply_loop_b
+\long\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}%
+\long\def\XINT_apply_end\xint_bye\expandafter\XINT_apply_loop_b
\expandafter #1#2#3{ #2}%
\def\xintApplyUnbraced {\romannumeral0\xintapplyunbraced }%
\def\xintApplyUnbracedNoExpand {\romannumeral0\xintapplyunbracednoexpand }%
-\def\xintapplyunbraced #1#2%
+\long\def\xintapplyunbraced #1#2%
{%
\expandafter\XINT_applyunbr\expandafter {\romannumeral-`0#2}%
{#1}%
}%
-\def\XINT_applyunbr #1#2{\XINT_applyunbr_loop_a {}{#2}#1\xint_bye }%
-\def\xintapplyunbracednoexpand #1#2%
+\long\def\XINT_applyunbr #1#2{\XINT_applyunbr_loop_a {}{#2}#1\xint_bye }%
+\long\def\xintapplyunbracednoexpand #1#2%
{\XINT_applyunbr_loop_a {}{#1}#2\xint_bye }%
-\def\XINT_applyunbr_loop_a #1#2#3%
+\long\def\XINT_applyunbr_loop_a #1#2#3%
{%
\xint_bye #3\XINT_applyunbr_end\xint_bye
\expandafter\XINT_applyunbr_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
-\def\XINT_applyunbr_loop_b #1#2{\XINT_applyunbr_loop_a {#2#1}}%
-\def\XINT_applyunbr_end\xint_bye\expandafter\XINT_applyunbr_loop_b
+\long\def\XINT_applyunbr_loop_b #1#2{\XINT_applyunbr_loop_a {#2#1}}%
+\long\def\XINT_applyunbr_end\xint_bye\expandafter\XINT_applyunbr_loop_b
\expandafter #1#2#3{ #2}%
\def\xintSeq {\romannumeral0\xintseq }%
\def\xintseq #1{\XINT_seq_chkopt #1\xint_bye }%
@@ -508,7 +510,7 @@
}%
\def\XINT_seq #1#2%
{%
- \ifcase\xintiiSgn{\the\numexpr #2-#1\relax}
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
\expandafter\xint_firstoftwo_andstop
\or
\expandafter\XINT_seq_p
@@ -545,7 +547,7 @@
}%
\def\XINT_seqo #1#2%
{%
- \ifcase\xintiiSgn{\the\numexpr #2-#1\relax}
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
\expandafter\XINT_seqo_a
\or
\expandafter\XINT_seqo_pa
@@ -558,12 +560,12 @@
\def\XINT_seqo_o #1#2#3#4{ #4}%
\def\XINT_seqo_pa #1#2#3%
{%
- \ifcase\XINT_Sgn {#3}
- \expandafter\XINT_seqo_o
+ \ifcase\ifnum #3=\xint_c_ 0\else\ifnum #3>\xint_c_ 1\else -1\fi\fi\space
+ \expandafter\XINT_seqo_o
\or
- \expandafter\XINT_seqo_pb
+ \expandafter\XINT_seqo_pb
\else
- \xint_afterfi{\expandafter\space\xint_gobble_iv}%
+ \xint_afterfi{\expandafter\space\xint_gobble_iv}%
\fi
{#1}{#2}{#3}{{#1}}%
}%
@@ -573,7 +575,7 @@
}%
\def\XINT_seqo_pc #1#2%
{%
- \ifnum#1>#2
+ \ifnum #1>#2
\expandafter\XINT_seqo_o
\else
\expandafter\XINT_seqo_pd
@@ -583,7 +585,7 @@
\def\XINT_seqo_pd #1#2#3#4{\XINT_seqo_pb {#1}{#2}{#3}{#4{#1}}}%
\def\XINT_seqo_na #1#2#3%
{%
- \ifcase\XINT_Sgn {#3}
+ \ifcase\ifnum #3=\xint_c_ 0\else\ifnum #3>\xint_c_ 1\else -1\fi\fi\space
\expandafter\XINT_seqo_o
\or
\xint_afterfi{\expandafter\space\xint_gobble_iv}%
@@ -598,7 +600,7 @@
}%
\def\XINT_seqo_nc #1#2%
{%
- \ifnum#1<#2
+ \ifnum #1<#2
\expandafter\XINT_seqo_o
\else
\expandafter\XINT_seqo_nd
@@ -606,31 +608,32 @@
{#1}{#2}%
}%
\def\XINT_seqo_nd #1#2#3#4{\XINT_seqo_nb {#1}{#2}{#3}{#4{#1}}}%
-\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}%
-\def\xintloop_again\fi\xint_gobble_i #1{\fi
+\long\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}%
+\long\def\xintloop_again\fi\xint_gobble_i #1{\fi
#1\xintloop_again\fi\xint_gobble_i {#1}}%
-\def\xintbreakloop #1\xintloop_again\fi\xint_gobble_i #2{}%
-\def\xintbreakloopanddo #1#2\xintloop_again\fi\xint_gobble_i #3{#1}%
-\def\xintloopskiptonext #1\xintloop_again\fi\xint_gobble_i #2{%
+\long\def\xintbreakloop #1\xintloop_again\fi\xint_gobble_i #2{}%
+\long\def\xintbreakloopanddo #1#2\xintloop_again\fi\xint_gobble_i #3{#1}%
+\long\def\xintloopskiptonext #1\xintloop_again\fi\xint_gobble_i #2{%
#2\xintloop_again\fi\xint_gobble_i {#2}}%
\def\xintiloop [#1+#2]{%
\expandafter\xintiloop_a\the\numexpr #1\expandafter.\the\numexpr #2.}%
-\def\xintiloop_a #1.#2.#3#4\repeat{%
+\long\def\xintiloop_a #1.#2.#3#4\repeat{%
#3#4\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3#4}}%
\def\xintiloop_again\fi\xint_gobble_iii #1#2{%
\fi\expandafter\xintiloop_again_b\the\numexpr#1+#2.#2.}%
-\def\xintiloop_again_b #1.#2.#3{%
+\long\def\xintiloop_again_b #1.#2.#3{%
#3\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3}}%
-\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}%
-\def\xintbreakiloopanddo #1.#2\xintiloop_again\fi\xint_gobble_iii #3#4#5{#1}%
-\def\xintiloopindex #1\xintiloop_again\fi\xint_gobble_iii #2%
+\long\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}%
+\long\def\xintbreakiloopanddo
+ #1.#2\xintiloop_again\fi\xint_gobble_iii #3#4#5{#1}%
+\long\def\xintiloopindex #1\xintiloop_again\fi\xint_gobble_iii #2%
{#2#1\xintiloop_again\fi\xint_gobble_iii {#2}}%
-\def\xintouteriloopindex #1\xintiloop_again
+\long\def\xintouteriloopindex #1\xintiloop_again
#2\xintiloop_again\fi\xint_gobble_iii #3%
{#3#1\xintiloop_again #2\xintiloop_again\fi\xint_gobble_iii {#3}}%
-\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{%
+\long\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{%
\expandafter\xintiloop_again_b \the\numexpr#2+#3.#3.}%
-\def\xintiloopskipandredo #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{%
+\long\def\xintiloopskipandredo #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{%
#4\xintiloop_again\fi\xint_gobble_iii {#2}{#3}{#4}}%
\def\XINT_xflet #1%
{%
@@ -733,9 +736,8 @@
}%
\long\def\XINT_for #1#2in#3#4#5%
{%
- \XINT_count #2\relax
\expandafter\XINT_toks\expandafter
- {\expandafter\XINT_for_d\the\XINT_count{#5}}%
+ {\expandafter\XINT_for_d\the\numexpr #2\relax {#5}}%
\def\XINT_flet_macro {\expandafter\XINT_for_forever?\space}%
\expandafter\XINT_flet_zapsp #3Z%
}%
@@ -749,9 +751,8 @@
\def\XINT_to_forever\fi #1\xintcsvtolist #2{\fi \XINT_forever #2}%
\long\def\XINT_forx *#1#2in#3#4#5%
{%
- \XINT_count #2\relax
\expandafter\XINT_toks\expandafter
- {\expandafter\XINT_forx_d\the\XINT_count{#5}}%
+ {\expandafter\XINT_forx_d\the\numexpr #2\relax {#5}}%
\XINT_xflet\XINT_forx_forever? #3Z%
}%
\def\XINT_forx_forever?
@@ -936,11 +937,11 @@
}%
\catcode`Z 11
\catcode`j 11
-\def\xintAssign #1\to
+\long\def\xintAssign #1\to
{%
\expandafter\XINT_assign_a\romannumeral-`0#1{}\to
}%
-\def\XINT_assign_a #1% attention to the # at the beginning of next line
+\long\def\XINT_assign_a #1% attention to the # at the beginning of next line
#{%
\def\xint_temp {#1}%
\ifx\empty\xint_temp
@@ -949,13 +950,10 @@
\expandafter\XINT_assign_B
\fi
}%
-\def\XINT_assign_b #1#2\to #3%
+\long\def\XINT_assign_b #1#2\to #3%
{%
\edef #3{#1}\def\xint_temp {#2}%
- \ifx\empty\xint_temp
- \else
- \xint_afterfi{\XINT_assign_a #2\to }%
- \fi
+ \unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_a #2\to }\fi
}%
\def\XINT_assign_B #1\to #2%
{%
@@ -965,56 +963,44 @@
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax}%
\escapechar -1
- \edef\xint_arrayname {\string #1}%
+ \expandafter\def\expandafter\xint_arrayname\expandafter {\string #1}%
\XINT_restoreescapechar
- \expandafter\let\expandafter\xint_temp
- \csname\xint_arrayname 0\endcsname
- \XINT_count 0
- \loop
- \global\expandafter\let
- \csname\xint_arrayname\the\XINT_count\endcsname\relax
- \ifnum \XINT_count < \xint_temp
- \advance\XINT_count 1
+ \xintiloop [\csname\xint_arrayname 0\endcsname+-1]
+ \global
+ \expandafter\let\csname\xint_arrayname\xintiloopindex\endcsname\relax
+ \ifnum \xintiloopindex > \xint_c_
\repeat
\global\expandafter\let\csname\xint_arrayname 00\endcsname\relax
\global\let #1\relax
}%
-\def\xintAssignArray #1\to #2% 1.06b: #1 may now be empty
+\long\def\xintAssignArray #1\to #2%
{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }%
\escapechar -1
- \edef\xint_arrayname {\string #2}%
+ \expandafter\def\expandafter\xint_arrayname\expandafter {\string #2}%
\XINT_restoreescapechar
- \XINT_count 0
+ \def\xint_itemcount {0}%
\expandafter\XINT_assignarray_loop \romannumeral-`0#1\xint_relax
- \csname\xint_arrayname 00\endcsname
- \csname\xint_arrayname 0\endcsname
- {\xint_arrayname}%
- #2%
+ \csname\xint_arrayname 00\expandafter\endcsname
+ \csname\xint_arrayname 0\expandafter\endcsname
+ \expandafter {\xint_arrayname}#2%
}%
-\def\XINT_assignarray_loop #1%
+\long\def\XINT_assignarray_loop #1%
{%
\def\xint_temp {#1}%
\ifx\xint_brelax\xint_temp
- \expandafter\edef\csname\xint_arrayname 0\endcsname{\the\XINT_count }%
- \expandafter\expandafter\expandafter\XINT_assignarray_end_a
+ \expandafter\def\csname\xint_arrayname 0\expandafter\endcsname
+ \expandafter{\the\numexpr\xint_itemcount}%
+ \expandafter\expandafter\expandafter\XINT_assignarray_end
\else
- \advance\XINT_count 1
+ \expandafter\def\expandafter\xint_itemcount\expandafter
+ {\the\numexpr\xint_itemcount+\xint_c_i}%
\expandafter\edef
- \csname\xint_arrayname\the\XINT_count\endcsname{\xint_temp }%
+ \csname\xint_arrayname\xint_itemcount\endcsname {\xint_temp }%
\expandafter\XINT_assignarray_loop
\fi
}%
-\def\XINT_assignarray_end_a #1%
-{%
- \expandafter\XINT_assignarray_end_b\expandafter #1%
-}%
-\def\XINT_assignarray_end_b #1#2#3%
-{%
- \expandafter\XINT_assignarray_end_c
- \expandafter #1\expandafter #2\expandafter {#3}%
-}%
-\def\XINT_assignarray_end_c #1#2#3#4%
+\def\XINT_assignarray_end #1#2#3#4%
{%
\def #4##1%
{%
@@ -1022,16 +1008,14 @@
}%
\def #1##1%
{%
- \ifnum ##1< 0
- \xint_afterfi {\xintError:ArrayIndexIsNegative\space 0}%
+ \ifnum ##1<\xint_c_
+ \xint_afterfi {\xintError:ArrayIndexIsNegative\space }%
\else
- \xint_afterfi {%
+ \xint_afterfi {%
\ifnum ##1>#2
- \xint_afterfi {\xintError:ArrayIndexBeyondLimit\space 0}%
- \else
- \xint_afterfi
- {\expandafter\expandafter\expandafter
- \space\csname #3##1\endcsname}%
+ \xint_afterfi {\xintError:ArrayIndexBeyondLimit\space }%
+ \else\xint_afterfi
+ {\expandafter\expandafter\expandafter\space\csname #3##1\endcsname}%
\fi}%
\fi
}%