summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/generic/xint/CHANGES.html309
-rw-r--r--Master/texmf-dist/doc/generic/xint/CHANGES.pdfbin0 -> 56756 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xint/README307
-rw-r--r--Master/texmf-dist/doc/generic/xint/README.html128
-rw-r--r--Master/texmf-dist/doc/generic/xint/sourcexint.pdfbin0 -> 517705 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xint/xint.pdfbin601724 -> 654384 bytes
-rw-r--r--Master/texmf-dist/source/generic/xint/Makefile13
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.dtx21975
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.ins61
-rw-r--r--Master/texmf-dist/tex/generic/xint/xint.sty2285
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintbinhex.sty71
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcfrac.sty45
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcore.sty2104
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty2508
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty488
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintgcd.sty113
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintkernel.sty254
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintseries.sty45
-rw-r--r--Master/texmf-dist/tex/generic/xint/xinttools.sty254
19 files changed, 17852 insertions, 13108 deletions
diff --git a/Master/texmf-dist/doc/generic/xint/CHANGES.html b/Master/texmf-dist/doc/generic/xint/CHANGES.html
new file mode 100644
index 00000000000..82a02cb72a7
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/xint/CHANGES.html
@@ -0,0 +1,309 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta name="generator" content="pandoc" />
+ <meta name="author" content="xint v1.1" />
+ <title>CHANGE LOG</title>
+ <style type="text/css">code{white-space: pre;}</style>
+ <style type="text/css">
+ body{margin-left : 10%; margin-right : 15%; margin-top: 4ex; font-size: 14pt;}
+ pre {white-space: pre-wrap;}
+ code {white-space: pre-wrap;}
+ #TOC {float: right; position: relative; top: 100px; margin-bottom: 100px;}
+ </style>
+</head>
+<body>
+<div id="header">
+<h1 class="title">CHANGE LOG</h1>
+<h2 class="author">xint v1.1</h2>
+<h3 class="date">2014/10/28</h3>
+</div>
+<div id="TOC">
+<ul>
+<li><a href="#section"><code>1.1 (2014/10/28)</code></a></li>
+<li><a href="#n-20140401"><code>1.09n (2014/04/01)</code></a></li>
+<li><a href="#m-20140226"><code>1.09m (2014/02/26)</code></a></li>
+<li><a href="#kb-20140213"><code>1.09kb (2014/02/13)</code></a></li>
+<li><a href="#k-20140121"><code>1.09k (2014/01/21)</code></a></li>
+<li><a href="#j-20140109"><code>1.09j (2014/01/09)</code></a></li>
+<li><a href="#i-20131218"><code>1.09i (2013/12/18)</code></a></li>
+<li><a href="#h-20131128"><code>1.09h (2013/11/28)</code></a></li>
+<li><a href="#g-20131122"><code>1.09g (2013/11/22)</code></a></li>
+<li><a href="#f-20131104"><code>1.09f (2013/11/04)</code></a></li>
+<li><a href="#e-20131029"><code>1.09e (2013/10/29)</code></a></li>
+<li><a href="#d-20131022"><code>1.09d (2013/10/22)</code></a></li>
+<li><a href="#c-20131009"><code>1.09c (2013/10/09)</code></a></li>
+<li><a href="#b-20131003"><code>1.09b (2013/10/03)</code></a></li>
+<li><a href="#a-20130924"><code>1.09a (2013/09/24)</code></a></li>
+<li><a href="#b-20130614"><code>1.08b (2013/06/14)</code></a></li>
+<li><a href="#a-20130611"><code>1.08a (2013/06/11)</code></a></li>
+<li><a href="#section-1"><code>1.08 (2013/06/07)</code></a></li>
+<li><a href="#section-2"><code>1.07 (2013/05/25)</code></a></li>
+<li><a href="#b-20130514"><code>1.06b (2013/05/14)</code></a></li>
+<li><a href="#section-3"><code>1.06 (2013/05/07)</code></a></li>
+<li><a href="#section-4"><code>1.05 (2013/05/01)</code></a></li>
+<li><a href="#section-5"><code>1.04 (2013/04/25)</code></a></li>
+<li><a href="#section-6"><code>1.03 (2013/04/14)</code></a></li>
+<li><a href="#section-7"><code>1.0 (2013/03/28)</code></a></li>
+</ul>
+</div>
+<pre><code>Source: xint.dtx (v1.1, 2014/10/28)
+Author: Jean-Francois Burnol
+Info: Expandable operations on big integers, decimals, fractions
+License: LPPL 1.3c or later</code></pre>
+<h2 id="section"><code>1.1 (2014/10/28)</code></h2>
+<dl>
+<dt>bug fixes</dt>
+<dd><ul>
+<li><p><code>\xintZapFirstSpaces</code> hence also <code>\xintZapSpaces</code> from package <strong>xinttools</strong> were buggy when used with an argument either empty or containing only space tokens.</p></li>
+<li><p><code>\xintiiexpr</code> did not strip leading zeroes, hence <code>\xinttheiiexpr 001+1\relax</code> did not obtain the expected result ...</p></li>
+<li><p><code>\xinttheexpr \xintiexpr 1.23\relax\relax</code> should have produced <code>1</code>, but it produced <code>1.23</code></p></li>
+<li><p>the catcode of <code>;</code> was not set at package launching time.</p></li>
+<li><p>the <code>\XINTinFloatPrd:csv</code> macro name had a typo, hence <code>prd</code> was non-functional in <code>\xintfloatexpr</code>.</p></li>
+</ul>
+</dd>
+<dt>breaking changes</dt>
+<dd><ul>
+<li><p>in <code>\xintiiexpr</code>, <code>/</code> does <em>rounded</em> division, rather than the Euclidean division (for positive arguments, this is truncated division). The new <code>//</code> operator does truncated division,</p></li>
+<li><p>the <code>:</code> operator for three-way branching is gone, replaced with <code>??</code>,</p></li>
+<li><p><code>1e(3+5)</code> is now illegal. The number parser identifies <code>e</code> and <code>E</code> in the same way it does for the decimal mark, earlier versions treated <code>e</code> as <code>E</code> rather as postfix operators,</p></li>
+<li><p>the <code>add</code> and <code>mul</code> have a new syntax, old syntax is with <code>`+`</code> and <code>`*`</code> (quotes mandatory), <code>sum</code> and <code>prd</code> are gone,</p></li>
+<li><p>no more special treatment for encountered brace pairs <code>{..}</code> by the number scanner, <code>a/b[N]</code> notation can be used without use of braces (the <code>N</code> will end up as is in a <code>\numexpr</code>, it is not parsed by the <code>\xintexpr</code>-ession scanner),</p></li>
+<li><p>although <code>&amp;</code> and <code>|</code> are still available as Boolean operators the use of <code>&amp;&amp;</code> and <code>||</code> is strongly recommended. The single letter operators might be assigned some other meaning in later releases (bitwise operations, perhaps). Do not use them.</p></li>
+</ul>
+</dd>
+</dl>
+<p>There are many novelties, most to be found in package <strong>xintexpr</strong>. But first the other changes.</p>
+<ul>
+<li><p>new package <strong>xintcore</strong> has been split off <strong>xint</strong>. It contains the core arithmetic macros. It is loaded by package <strong>bnumexpr</strong>,</p></li>
+<li><p>neither <strong>xint</strong> nor <strong>xintfrac</strong> load <strong>xinttools</strong>. Only <strong>xintexpr</strong> does,</p></li>
+<li><p>whenever some portion of code has been revised, often use has been made of the <code>\xint_dothis</code> and <code>\xint_orthat</code> pair of macros for expandably branching,</p></li>
+<li><p>these tiny helpful macros, and a few others are in package <strong>xintkernel</strong> which contains also the catcode and loading order management code, initially inspired by code found in Heiko Oberdiek's packages,</p></li>
+<li><p>the <code>\xintAdd</code> and <code>\xintSub</code> macros from package <strong>xintfrac</strong> check if one of the denominator is a multiple of the other, and only if this is not the case do they multiply the denominators. But systematic reduction would be too costly,</p></li>
+<li><p>this naturally will be also the case for the <code>+</code> and <code>-</code> operations in <code>\xintexpr</code>,</p></li>
+<li><p>new macros <code>\xintiiDivRound</code>, <code>\xintiiDivTrunc</code> and <code>\xintiiMod</code> for rounded and truncated division of big integers (now in <strong>xintcore</strong>), alongside the earlier <code>\xintiiQuo</code> and <code>\xintiiRem</code>,</p></li>
+<li><p>with <strong>xintfrac</strong> loaded, the <code>\xintNum</code> macro does <code>\xintTTrunc</code> (which is truncation to an integer, same as <code>\xintiTrunc {0}</code>),</p></li>
+<li><p>new macro <code>\xintMod</code> in <strong>xintfrac</strong> for modulo operation with fractional numbers,</p></li>
+<li><p><code>\xintiexpr</code>, <code>\xinttheiexpr</code> admit an optional argument within brackets <code>[d]</code>, they round the computation result (or results, if comma separated) to <code>d</code> digits after decimal mark, (the whole computation is done exactly, as in <code>xintexpr</code>),</p></li>
+<li><p><code>\xintfloatexpr</code>, <code>\xintthefloatexpr</code> similarly admit an optional argument which serves to keep only <code>d</code> digits of precision, getting rid of cumulated uncertainties in the last digits (the whole computation is done according to the precision set via <code>\xintDigits</code>),</p></li>
+<li><p><code>\xinttheexpr</code> and <code>\xintthefloatexpr</code> ''pretty-print'' if possible, the former removing unit denominator or <code>[0]</code> brackets, the latter avoiding scientific notation if decimal notation is practical,</p></li>
+<li><p>the <code>//</code> does truncated division and <code>/:</code> is the associated modulo,</p></li>
+<li><p>multi-character operators <code>&amp;&amp;</code>, <code>|</code>, <code>==</code>, <code>&lt;=</code>, <code>&gt;=</code>, <code>!=</code>, <code>**</code>,</p></li>
+<li><p>multi-letter infix binary words <code>'and'</code>, <code>'or'</code>, <code>'xor'</code>, <code>'mod'</code> (quotes mandatory),</p></li>
+<li><p>functions <code>even</code>, <code>odd</code>,</p></li>
+<li><p><code>\xintdefvar A3:=3.1415;</code> for variable definitions (non expandable, naturally), usable in subsequent expressions; variable names may contain letters, digits, underscores. They should not start with a digit, the <code>@</code> is reserved, and single lowercase and uppercase Latin letters are predefined to work as dummy variables (see next),</p></li>
+<li><p>generation of comma separated lists <code>a..b</code>, <code>a..[d]..b</code>,</p></li>
+<li><p>Python syntax-like list extractors <code>[list][n:]</code>, <code>[list][:n]</code>, <code>[list][a:b]</code> allowing negative indices, but no optional step argument, and <code>[list][n]</code> (<code>n=0</code> for the number of items in the list),</p></li>
+<li><p>functions <code>first</code>, <code>last</code>, <code>reversed</code>,</p></li>
+<li><p>itemwise operations on comma separated lists <code>a*[list]</code>, etc.., possible on both sides <code>a*[list]^b</code>, an obeying the same precedence rules as with numbers,</p></li>
+<li><p><code>add</code> and <code>mul</code> must use a dummy variable: <code>add(x(x+1)(x-1), x=-10..10)</code>,</p></li>
+<li><p>variable substitutions with <code>subs</code>: <code>subs(subs(add(x^2+y^2,x=1..y),y=t),t=20)</code>,</p></li>
+<li><p>sequence generation using <code>seq</code> with a dummy variable: <code>seq(x^3, x=-10..10)</code>,</p></li>
+<li><p>simple recursive lists with <code>rseq</code>, with <code>@</code> given the last value, <code>rseq(1;2@+1,i=1..10)</code>,</p></li>
+<li><p>higher recursion with <code>rrseq</code>, <code>@1</code>, <code>@2</code>, <code>@3</code>, <code>@4</code>, and <code>@@(n)</code> for earlier values, up to <code>n=K</code> where <code>K</code> is the number of terms of the initial stretch <code>rrseq(0,1;@1+@2,i=2..100)</code>,</p></li>
+<li><p>iteration with <code>iter</code> which is like <code>rrseq</code> but outputs only the last <code>K</code> terms, where <code>K</code> was the number of initial terms,</p></li>
+<li><p>inside <code>seq</code>, <code>rseq</code>, <code>rrseq</code>, <code>iter</code>, possibility to use <code>omit</code>, <code>abort</code> and <code>break</code> to control termination,</p></li>
+<li><p><code>n++</code> potentially infinite index generation for <code>seq</code>, <code>rseq</code>, <code>rrseq</code>, and <code>iter</code>, it is advised to use <code>abort</code> or <code>break(..)</code> at some point,</p></li>
+<li><p>the <code>add</code>, <code>mul</code>, <code>seq</code>, ... are nestable,</p></li>
+<li><p><code>\xintthecoords</code> converts a comma separated list of an even number of items to the format expected by the <code>TikZ</code> <code>coordinates</code> syntax,</p></li>
+<li><p>completely new version <code>\xintNewExpr</code>, <code>protect</code> function to handle external macros. Not all constructs are compatible with <code>\xintNewExpr</code>.</p></li>
+</ul>
+<h2 id="n-20140401"><code>1.09n (2014/04/01)</code></h2>
+<ul>
+<li><p>the user manual does not include by default the source code anymore: the <code>\NoSourceCode</code> toggle in file <code>xint.tex</code> has to be set to 0 before compilation to get source code inclusion.</p></li>
+<li><p>bug fix (<strong>xinttools</strong>) in <code>\XINT_nthelt_finish</code> (this bug was introduced in <code>1.09i</code> of <code>2013/12/18</code> and showed up when the index <code>N</code> was larger than the number of elements of the list).</p></li>
+</ul>
+<h2 id="m-20140226"><code>1.09m (2014/02/26)</code></h2>
+<ul>
+<li><p>new in <strong>xinttools</strong>: <code>\xintKeep</code> keeps the first <code>N</code> or last <code>N</code> elements of a list (sequence of braced items); <code>\xintTrim</code> cuts out either the first <code>N</code> or the last <code>N</code> elements from a list.</p></li>
+<li><p>new in <strong>xintcfrac</strong>: <code>\xintFGtoC</code> finds the initial partial quotients common to two numbers or fractions <code>f</code> and <code>g</code>; <code>\xintGGCFrac</code> is a clone of <code>\xintGCFrac</code> which however does not assume that the coefficients of the generalized continued fraction are numeric quantities. Some other minor changes.</p></li>
+</ul>
+<h2 id="kb-20140213"><code>1.09kb (2014/02/13)</code></h2>
+<ul>
+<li><p>bug fix (<strong>xintexpr</strong>): an aloof modification done by <code>1.09i</code> to <code>\xintNewExpr</code> had resulted in a spurious trailing space present in the outputs of all macros created by <code>\xintNewExpr</code>, making nesting of such macros impossible.</p></li>
+<li><p>bug fix (<strong>xinttools</strong>): <code>\xintBreakFor</code> and <code>\xintBreakForAndDo</code> were buggy when used in the last iteration of an <code>\xintFor</code> loop.</p></li>
+<li><p>bug fix (<strong>xinttools</strong>): <code>\xintSeq</code> from <code>1.09k</code> needed a <code>\chardef</code> which was missing from <code>xinttools.sty</code>, it was in <code>xint.sty</code>.</p></li>
+</ul>
+<h2 id="k-20140121"><code>1.09k (2014/01/21)</code></h2>
+<ul>
+<li><p>inside <code>\xintexpr..\relax</code> (and its variants) tacit multiplication is implied when a number or operand is followed directly with an opening parenthesis,</p></li>
+<li><p>the <code>&quot;</code> for denoting (arbitrarily big) hexadecimal numbers is recognized by <code>\xintexpr</code> and its variants (package <strong>xintbinhex</strong> is required); a fractional hexadecimal part introduced by a dot <code>.</code> is allowed.</p></li>
+<li><p>re-organization of the first sections of the user manual.</p></li>
+<li><p>bug fix (<strong>xinttools</strong>, <strong>xint</strong>, ...): forgotten catcode check of <code>&quot;</code> at loading time has been added.</p></li>
+</ul>
+<h2 id="j-20140109"><code>1.09j (2014/01/09)</code></h2>
+<ul>
+<li><p>(<strong>xint</strong>) the core division routines have been re-written for some (limited) efficiency gain, more pronounced for small divisors. As a result the <em>computation of one thousand digits of <span class="math"><em>Ï€</em></span></em> is close to three times faster than with earlier releases.</p></li>
+<li><p>some various other small improvements, particularly in the power routines.</p></li>
+<li><p>(<strong>xintfrac</strong>) a new macro <code>\xintXTrunc</code> is designed to produce thousands or even tens of thousands of digits of the decimal expansion of a fraction. Although completely expandable it has its use limited to inside an <code>\edef</code>, <code>\write</code>, <code>\message</code>, . It can thus not be nested as argument to another package macro.</p></li>
+<li><p>(<strong>xintexpr</strong>) the tacit multiplication done in <code>\xintexpr..\relax</code> on encountering a count register or variable, or a <code>\numexpr</code>, while scanning a (decimal) number, is extended to the case of a sub <code>\xintexpr</code>-ession.</p></li>
+<li><p><code>\xintexpr</code> can now be used in an <code>\edef</code> with no <code>\xintthe</code> prefix; it will execute completely the computation, and the error message about a missing <code>\xintthe</code> will be inhibited. Previously, in the absence of <code>\xintthe</code>, expansion could only be a full one (with <code>\romannumeral-`0</code>), not a complete one (with <code>\edef</code>). Note that this differs from the behavior of the non-expandable <code>\numexpr</code>: <code>\the</code> or <code>\number</code> are needed not only to print but also to trigger the computation, whereas <code>\xintthe</code> is mandatory only for the printing step.</p></li>
+<li><p>the default behavior of <code>\xintAssign</code> is changed, it now does not do any further expansion beyond the initial full-expansion which provided the list of items to be assigned to macros.</p></li>
+<li><p>bug fix (<strong>xintfrac</strong>): <code>1.09i</code> did an unexplainable change to <code>\XINT_infloat_zero</code> which broke the floating point routines for vanishing operands =:(((</p></li>
+<li><p>bug fix: the <code>1.09i</code> <code>xint.ins</code> file produced a buggy <code>xint.tex</code> file.</p></li>
+</ul>
+<h2 id="i-20131218"><code>1.09i (2013/12/18)</code></h2>
+<ul>
+<li><p>(<strong>xintexpr</strong>) <code>\xintiiexpr</code> is a variant of <code>\xintexpr</code> which is optimized to deal only with (long) integers, <code>/</code> does a euclidean quotient.</p></li>
+<li><p><code>\xintnumexpr</code>, <code>\xintthenumexpr</code>, <code>\xintNewNumExpr</code> are renamed, respectively, <code>\xintiexpr</code>, <code>\xinttheiexpr</code>, <code>\xintNewIExpr</code>. The earlier denominations are kept but to be removed at some point.</p></li>
+<li><p>it is now possible within <code>\xintexpr...\relax</code> and its variants to use count, dimen, and skip registers or variables without explicit <code>\the/\number</code>: the parser inserts automatically <code>\number</code> and a tacit multiplication is implied when a register or variable immediately follows a number or fraction. Regarding dimensions and <code>\number</code>, see the further discussion in <em>Dimensions</em>.</p></li>
+<li><p>(<strong>xintfrac</strong>) new conditional <code>\xintifOne</code>; <code>\xintifTrueFalse</code> renamed to <code>\xintifTrueAelseB</code>; new macros <code>\xintTFrac</code> (<code>fractional part</code>, mapped to function <code>frac</code> in <code>\xintexpr</code>-essions), <code>\xintFloatE</code>.</p></li>
+<li><p>(<strong>xinttools</strong>) <code>\xintAssign</code> admits an optional argument to specify the expansion type to be used: <code>[]</code> (none, default), <code>[o]</code> (once), <code>[oo]</code> (twice), <code>[f]</code> (full), <code>[e]</code> (<code>\edef</code>),... to define the macros</p></li>
+<li><p><strong>xinttools</strong> defines <code>\odef</code>, <code>\oodef</code>, <code>\fdef</code> (if the names have already been assigned, it uses <code>\xintoodef</code> etc...). These tools are provided for the case one uses the package macros in a non-expandable context, particularly <code>\oodef</code> which expands twice the macro replacement text and is thus a faster alternative to <code>\edef</code> taking into account that the <strong>xint</strong> bundle macros expand already completely in only two steps. This can be significant when repeatedly making <code>\def</code>-initions expanding to hundreds of digits.</p></li>
+<li><p>some across the board slight efficiency improvement as a result of modifications of various types to <em>fork macros</em> and <em>branching conditionals</em> which are used internally.</p></li>
+<li><p>bug fix (<strong>xint</strong>): <code>\xintAND</code> and <code>\xintOR</code> inserted a space token in some cases and did not expand as promised in two steps <code>:-((</code> (bug dating back to <code>1.09a</code> I think; this bug was without consequences when using <code>&amp;</code> and <code>|</code> in <code>\xintexpr-essions</code>, it affected only the macro form).</p></li>
+<li><p>bug fix (<strong>xintcfrac</strong>): <code>\xintFtoCCv</code> still ended fractions with the <code>[0]</code>'s which were supposed to have been removed since release <code>1.09b</code>.</p></li>
+</ul>
+<h2 id="h-20131128"><code>1.09h (2013/11/28)</code></h2>
+<ul>
+<li><p>parts of the documentation have been re-written or re-organized, particularly the discussion of expansion issues and of input and output formats.</p></li>
+<li><p>the expansion types of macro arguments are documented in the margin of the macro descriptions, with conventions mainly taken over from those in the <code>LaTeX3</code> documentation.</p></li>
+<li><p>a dependency of <strong>xinttools</strong> on <strong>xint</strong> (inside <code>\xintSeq</code>) has been removed.</p></li>
+<li><p>(<strong>xintgcd</strong>) <code>\xintTypesetEuclideAlgorithm</code> and <code>\xintTypesetBezoutAlgorithm</code> have been slightly modified (regarding indentation).</p></li>
+<li><p>(<strong>xint</strong>) macros <code>xintiSum</code> and <code>xintiPrd</code> are renamed to <code>\xintiiSum</code> and <code>\xintiiPrd</code>.</p></li>
+<li><p>(<strong>xinttools</strong>) a count register used in <code>1.09g</code> in the <code>\xintFor</code> loops for parsing purposes has been removed and replaced by use of a <code>\numexpr</code>.</p></li>
+<li><p>the few uses of <code>\loop</code> have been replaced by <code>\xintloop/\xintiloop</code>.</p></li>
+<li><p>all macros of <strong>xinttools</strong> for which it makes sense are now declared <code>\long</code>.</p></li>
+</ul>
+<h2 id="g-20131122"><code>1.09g (2013/11/22)</code></h2>
+<ul>
+<li><p>a package <strong>xinttools</strong> is detached from <strong>xint</strong>, to make tools such as <code>\xintFor</code>, <code>\xintApplyUnbraced</code>, and <code>\xintiloop</code> available without the <strong>xint</strong> overhead.</p></li>
+<li><p>new expandable nestable loops <code>\xintloop</code> and <code>\xintiloop</code>.</p></li>
+<li><p>bugfix: <code>\xintFor</code> and <code>\xintFor*</code> do not modify anymore the value of <code>\count 255</code>.</p></li>
+</ul>
+<h2 id="f-20131104"><code>1.09f (2013/11/04)</code></h2>
+<ul>
+<li><p>(<strong>xint</strong>) new <code>\xintZapFirstSpaces</code>, <code>\xintZapLastSpaces</code>, <code>\xintZapSpaces</code>, <code>\xintZapSpacesB</code>, for expandably stripping away leading and/or ending spaces.</p></li>
+<li><p><code>\xintCSVtoList</code> by default uses <code>\xintZapSpacesB</code> to strip away spaces around commas (or at the start and end of the comma separated list).</p></li>
+<li><p>also the <code>\xintFor</code> loop will strip out all spaces around commas and at the start and the end of its list argument; and similarly for <code>\xintForpair</code>, <code>\xintForthree</code>, <code>\xintForfour</code>.</p></li>
+<li><p><code>\xintFor</code> <em>et al.</em> accept all macro parameters from <code>#1</code> to <code>#9</code>.</p></li>
+<li><p>for reasons of inner coherence some macros previously with one extra <code>i</code> in their names (e.g. <code>\xintiMON</code>) now have a doubled <code>ii</code> (<code>\xintiiMON</code>) to indicate that they skip the overhead of parsing their inputs via <code>\xintNum</code>. Macros with a <em>single</em> <code>i</code> such as <code>\xintiAdd</code> are those which maintain the non-<strong>xintfrac</strong> output format for big integers, but do parse their inputs via <code>\xintNum</code> (since release <code>1.09a</code>). They too may have doubled-<code>i</code> variants for matters of programming optimization when working only with (big) integers and not fractions or decimal numbers.</p></li>
+</ul>
+<h2 id="e-20131029"><code>1.09e (2013/10/29)</code></h2>
+<ul>
+<li><p>(<strong>xint</strong>) new <code>\xintintegers</code>, <code>\xintdimensions</code>, <code>\xintrationals</code> for infinite <code>\xintFor</code> loops, interrupted with <code>\xintBreakFor</code> and <code>\xintBreakForAndDo</code>.</p></li>
+<li><p>new <code>\xintifForFirst</code>, <code>\xintifForLast</code> for the <code>\xintFor</code> and <code>\xintFor*</code> loops,</p></li>
+<li><p>the <code>\xintFor</code> and <code>xintFor*</code> loops are now <code>\long</code>, the replacement text and the items may contain explicit <code>\par</code>'s.</p></li>
+<li><p>new conditionals <code>\xintifCmp</code>, <code>\xintifInt</code>, <code>\xintifOdd</code>.</p></li>
+<li><p>bug fix (<strong>xint</strong>): the <code>\xintFor</code> loop (not <code>\xintFor*</code>) did not correctly detect an empty list.</p></li>
+<li><p>bug fix (<strong>xint</strong>): <code>\xintiSqrt {0}</code> crashed. <code>:-((</code></p></li>
+<li><p>the documentation has been enriched with various additional examples, such as the <em>the quick sort algorithm illustrated</em> or the various ways of <em>computing prime numbers</em>.</p></li>
+<li><p>the documentation explains with more details various expansion related issues, particularly in relation to conditionals.</p></li>
+</ul>
+<h2 id="d-20131022"><code>1.09d (2013/10/22)</code></h2>
+<ul>
+<li><p>bug fix (<strong>xint</strong>): <code>\xintFor*</code> is modified to gracefully handle a space token (or more than one) located at the very end of its list argument (as the space before <code>\do</code> in <code>\xintFor* #1 in {{a}{b}{c}&lt;space&gt;} \do {stuff}</code>; spaces at other locations were already harmless). Furthermore this new version <em>f-expands</em> the un-braced list items. After <code>\def\x{{1}{2}}</code> and <code>\def\y{{a}\x {b}{c}\x }</code>, <code>\y</code> will appear to <code>\xintFor*</code> exactly as if it had been defined as <code>\def\y{{a}{1}{2}{b}{c}{1}{2}}</code>.</p></li>
+<li><p>same bug fix for <code>\xintApplyInline</code>.</p></li>
+</ul>
+<h2 id="c-20131009"><code>1.09c (2013/10/09)</code></h2>
+<ul>
+<li><p>(<strong>xintexpr</strong>) added <code>bool</code> and <code>togl</code> to the <code>\xintexpr</code> syntax; also added <code>\xintboolexpr</code> and <code>\xintifboolexpr</code>.</p></li>
+<li><p>added <code>\xintNewNumExpr</code> (now <code>\xintNewIExpr</code> and <code>\xintNewBoolExpr</code>),</p></li>
+<li><p>the factorial <code>!</code> and branching <code>?</code>, <code>:</code>, operators (in <code>\xintexpr...\relax</code>) have now less precedence than a function name located just before,</p></li>
+<li><p>(<strong>xint</strong>) <code>\xintFor</code> is a new type of loop, whose replacement text inserts the comma separated values or list items via macro parameters, rather than encapsulated in macros; the loops are nestable up to four levels (nine levels since <code>1.09f</code>) and their replacement texts are allowed to close groups as happens with the tabulation in alignments,</p></li>
+<li><p><code>\xintForpair</code>, <code>\xintForthree</code>, <code>\xintForfour</code> are experimental variants of <code>\xintFor</code>,</p></li>
+<li><p><code>\xintApplyInline</code> has been enhanced in order to be usable for generating rows (partially or completely) in an alignment,</p></li>
+<li><p>new command <code>\xintSeq</code> to generate (expandably) arithmetic sequences of (short) integers,</p></li>
+<li><p>again various improvements and changes in the documentation.</p></li>
+</ul>
+<h2 id="b-20131003"><code>1.09b (2013/10/03)</code></h2>
+<ul>
+<li><p>various improvements in the documentation,</p></li>
+<li><p>more economical catcode management and re-loading handling,</p></li>
+<li><p>removal of all those <code>[0]</code>'s previously forcefully added at the end of fractions by various macros of <strong>xintcfrac</strong>,</p></li>
+<li><p><code>\xintNthElt</code> with a negative index returns from the tail of the list,</p></li>
+<li><p>new macro <code>\xintPRaw</code> to have something like what <code>\xintFrac</code> does in math mode; i.e. a <code>\xintRaw</code> which does not print the denominator if it is one.</p></li>
+</ul>
+<h2 id="a-20130924"><code>1.09a (2013/09/24)</code></h2>
+<ul>
+<li><p>(<strong>xintexpr</strong>) <code>\xintexpr..\relax</code> and <code>\xintfloatexpr..\relax</code> admit functions in their syntax, with comma separated values as arguments, among them <code>reduce, sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm, max, min, sum, prd, add, mul, not, all, any, xor</code>.</p></li>
+<li><p>comparison (<code>&lt;</code>, <code>&gt;</code>, <code>=</code>) and logical (<code>|</code>, <code>&amp;</code>) operators.</p></li>
+<li><p>the command <code>\xintthe</code> which converts <code>\xintexpr</code>essions into printable format (like <code>\the</code> with <code>\numexpr</code>) is more efficient, for example one can do <code>\xintthe\x</code> if <code>\x</code> was defined to be an <code>\xintexpr..\relax</code>:</p>
+<pre><code>\def\x{\xintexpr 3^57\relax}
+\def\y{\xintexpr \x^(-2)\relax}
+\def\z{\xintexpr \y-3^-114\relax}
+\xintthe\z</code></pre></li>
+<li><p><code>\xintnumexpr .. \relax</code> (now renamed <code>\xintiexpr</code>) is <code>\xintexpr round( .. ) \relax</code>.</p></li>
+<li><p><code>\xintNewExpr</code> now works with the standard macro parameter character <code>#</code>.</p></li>
+<li><p>both regular <code>\xintexpr</code>-essions and commands defined by <code>\xintNewExpr</code> will work with comma separated lists of expressions,</p></li>
+<li><p>new commands <code>\xintFloor</code>, <code>\xintCeil</code>, <code>\xintMaxof</code>, <code>\xintMinof</code> (package <strong>xintfrac</strong>), <code>\xintGCDof</code>, <code>\xintLCM</code>, <code>\xintLCMof</code> (package <strong>xintgcd</strong>), <code>\xintifLt</code>, <code>\xintifGt</code>, <code>\xintifSgn</code>, <code>\xintANDof</code>, ...</p></li>
+<li><p>The arithmetic macros from package <strong>xint</strong> now filter their operands via <code>\xintNum</code> which means that they may use directly count registers and <code>\numexpr</code>-essions without having to prefix them by <code>\the</code>. This is thus similar to the situation holding previously already when <strong>xintfrac</strong> was loaded.</p></li>
+<li><p>a bug (<strong>xintfrac</strong>) introduced in <code>1.08b</code> made <code>\xintCmp</code> crash when one of its arguments was zero. <code>:-((</code></p></li>
+</ul>
+<h2 id="b-20130614"><code>1.08b (2013/06/14)</code></h2>
+<ul>
+<li><p>(<strong>xintexpr</strong>) Correction of a problem with spaces inside <code>\xintexpr</code>-essions.</p></li>
+<li><p>(<strong>xintfrac</strong>) Additional improvements to the handling of floating point numbers.</p></li>
+<li><p>new section <em>Use of count registers</em> documenting how count registers may be directly used in arguments to the macros of <strong>xintfrac</strong>.</p></li>
+</ul>
+<h2 id="a-20130611"><code>1.08a (2013/06/11)</code></h2>
+<ul>
+<li><p>(<strong>xintfrac</strong>) Improved efficiency of the basic conversion from exact fractions to floating point numbers, with ensuing speed gains especially for the power function macros <code>\xintFloatPow</code> and <code>\xintFloatPower</code>,</p></li>
+<li><p>Better management by <code>\xintCmp</code>, <code>\xintMax</code>, <code>\xintMin</code> and <code>\xintGeq</code> of inputs having big powers of ten in them.</p></li>
+<li><p>Macros for floating point numbers added to the <strong>xintseries</strong> package.</p></li>
+</ul>
+<h2 id="section-1"><code>1.08 (2013/06/07)</code></h2>
+<ul>
+<li><p>(<strong>xint</strong> and <strong>xintfrac</strong>) Macros for extraction of square roots, for floating point numbers (<code>\xintFloatSqrt</code>), and integers (<code>\xintiSqrt</code>).</p></li>
+<li><p>New package <strong>xintbinhex</strong> providing <em>conversion routines</em> to and from binary and hexadecimal bases.</p></li>
+</ul>
+<h2 id="section-2"><code>1.07 (2013/05/25)</code></h2>
+<ul>
+<li><p>The <strong>xintexpr</strong> package is a new core constituent (which loads automatically <strong>xintfrac</strong> and <strong>xint</strong>) and implements the expandable expanding parser</p>
+<pre><code>\xintexpr . . . \relax,</code></pre>
+<p>and its variant</p>
+<pre><code>\xintfloatexpr . . . \relax</code></pre>
+<p>allowing on input formulas using the infix operators <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, and <code>^</code>, and arbitrary levels of parenthesizing. Within a float expression the operations are executed according to the current value of <code>\xintDigits</code>. Within an <code>\xintexpr</code>-ession the binary operators are computed exactly.</p>
+<p>To write the <code>\xintexpr</code> parser I benefited from the commented source of the <code>l3fp</code> parser; the <code>\xintexpr</code> parser has its own features and peculiarities. <em>See its documentation</em>.</p></li>
+<li><p>The floating point precision <code>D</code> is set (this is a local assignment to a <code>\mathchar</code> variable) with <code>\xintDigits := D;</code> and queried with <code>\xinttheDigits</code>. It may be set to anything up to <code>32767</code>.<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> The macro incarnations of the binary operations admit an optional argument which will replace pointwise <code>D</code>; this argument may exceed the <code>32767</code> bound.</p></li>
+<li><p>The <strong>xintfrac</strong> macros now accept numbers written in scientific notation, the <code>\xintFloat</code> command serves to output its argument with a given number <code>D</code> of significant figures. The value of <code>D</code> is either given as optional argument to <code>\xintFloat</code> or set with <code>\xintDigits := D;</code>. The default value is <code>16</code>.</p></li>
+</ul>
+<h2 id="b-20130514"><code>1.06b (2013/05/14)</code></h2>
+<ul>
+<li>Minor code and documentation improvements. Everywhere in the source code, a more modern underscore has replaced the @ sign.</li>
+</ul>
+<h2 id="section-3"><code>1.06 (2013/05/07)</code></h2>
+<ul>
+<li><p>Some code improvements, particularly for macros of <strong>xint</strong> doing loops.</p></li>
+<li><p>New utilities in <strong>xint</strong> for expandable manipulations of lists:</p>
+<pre><code>\xintNthElt, \xintCSVtoList, \xintRevWithBraces</code></pre></li>
+<li><p>The macros did only a double expansion of their arguments. They now fully expand them (using <code>\romannumeral-`0</code>). Furthermore, in the case of arguments constrained to obey the TeX bounds they will be inserted inside a <code>\numexpr..\relax</code>, hence completely expanded, one may use count registers, even infix arithmetic operations, etc...</p></li>
+</ul>
+<h2 id="section-4"><code>1.05 (2013/05/01)</code></h2>
+<p>Minor changes and additions to <strong>xintfrac</strong> and <strong>xintcfrac</strong>.</p>
+<h2 id="section-5"><code>1.04 (2013/04/25)</code></h2>
+<ul>
+<li><p>New component <strong>xintcfrac</strong> devoted to continued fractions.</p></li>
+<li><p>bug fix (<strong>xintfrac</strong>): <code>\xintIrr {0}</code> crashed.</p></li>
+<li><p>faster division routine in <strong>xint</strong>, new macros to deal expandably with token lists.</p></li>
+<li><p><code>\xintRound</code> added.</p></li>
+<li><p><strong>xintseries</strong> has a new implementation of <code>\xintPowerSeries</code> based on a Horner scheme, and new macro <code>\xintRationalSeries</code>. Both to help deal with the <em>denominator buildup</em> plague.</p></li>
+<li><p><code>tex xint.dtx</code> extracts style files (no need for a <code>xint.ins</code>).</p></li>
+</ul>
+<h2 id="section-6"><code>1.03 (2013/04/14)</code></h2>
+<ul>
+<li><p>new modules <strong>xintfrac</strong> (expandable operations on fractions) and <strong>xintseries</strong> (expandable partial sums with xint package).</p></li>
+<li><p>slightly improved division and faster multiplication (the best ordering of the arguments is chosen automatically).</p></li>
+<li><p>added illustration of Machin algorithm to the documentation.</p></li>
+</ul>
+<h2 id="section-7"><code>1.0 (2013/03/28)</code></h2>
+<p>Initial announcement:</p>
+<blockquote>
+<p>The <strong>xint</strong> package implements with expandable TeX macros the basic arithmetic operations of addition, subtraction, multiplication and division, as applied to arbitrarily long numbers represented as chains of digits with an optional minus sign.</p>
+</blockquote>
+<blockquote>
+<p>The <strong>xintgcd</strong> package provides implementations of the Euclidean algorithm and of its typesetting.</p>
+</blockquote>
+<blockquote>
+<p>The packages may be used with Plain and with LaTeX.</p>
+</blockquote>
+<div class="footnotes">
+<hr />
+<ol>
+<li id="fn1"><p>but values higher than 100 or 200 will presumably give too slow evaluations.<a href="#fnref1">↩</a></p></li>
+</ol>
+</div>
+</body>
+</html>
diff --git a/Master/texmf-dist/doc/generic/xint/CHANGES.pdf b/Master/texmf-dist/doc/generic/xint/CHANGES.pdf
new file mode 100644
index 00000000000..40cf76b8a93
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/xint/CHANGES.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/xint/README b/Master/texmf-dist/doc/generic/xint/README
index 6d5fc644c85..8cc40dd45c9 100644
--- a/Master/texmf-dist/doc/generic/xint/README
+++ b/Master/texmf-dist/doc/generic/xint/README
@@ -1,158 +1,175 @@
-The xint bundle
-Release 1.09n (2014/04/01). Documentation date: 2014/04/01
+ Source: xint.dtx (v1.1, 2014/10/28)
+ Author: Jean-Francois Burnol
+ Info: Expandable operations on big integers, decimals, fractions
+ License: LPPL 1.3c or later
-Copyright (C) 2013-2014 by Jean-Francois Burnol
-License: LaTeX Project Public License 1.3c or later.
+This README is also available as README.pdf and README.html.
-Contents: Abstract, Installation, License.
+Change log is in CHANGES.pdf and CHANGES.html.
-Abstract
-========
-xinttools is loaded by xint (hence by all other packages of the
-bundle, too): it provides utilities of independent interest such as
-expandable and non-expandable loops.
-xint implements with expandable TEX macros additions, subtractions,
-multiplications, divisions and powers with arbitrarily long numbers.
+USAGE
-xintfrac extends the scope of xint to decimal numbers, to numbers in
-scientific notation and also to fractions with arbitrarily long such
-numerators and denominators separated by a forward slash.
-xintexpr extends xintfrac with an expandable parser
- \xintexpr . . . \relax
-of expressions involving arithmetic operations in infix notation on
-decimal numbers, fractions, numbers in scientific notation, with
-parentheses, factorial symbol, function names, comparison operators,
-logic operators, twofold and threefold way conditionals,
-sub-expressions, macros expanding to the previous items.
+With LaTeX
-Further modules:
+ \usepackage{xint} % expandable arithmetic with big integers
+ \usepackage{xintfrac} % decimal numbers, fractions, floats
+ \usepackage{xintexpr} % expressions with infix operators
-xintbinhex is for conversions to and from binary and hexadecimal
-bases.
+Further packages: xintbinhex, xintgcd, xintseries and xintcfrac. All
+dependencies are handled automatically. For example xintexpr
+automatically loads xintfrac which itself loads xint. Package xintcore
+is the subset of xint providing only the five operations on big
+integers: \xintiiAdd, \xintiiMul, ... There is also xinttools which is a
+separate package providing, among others, expandable and non-expandable
+loops such as \xintFor.
-xintseries provides some basic functionality for computing in an
-expandable manner partial sums of series and power series with
-fractional coefficients.
-xintgcd implements the Euclidean algorithm and its typesetting.
+With TeX
-xintcfrac deals with the computation of continued fractions.
+One does for example:
+
+ \input xintexpr.sty\relax
+
+Again, all dependencies are handled automatically. The packages may be
+loaded in any catcode context such that letters, digits, \ and % have
+their standard catcodes.
+
+xintcore.sty and xinttools.sty both import xintkernel.sty which has the
+catcode handler and package identifier and defines a few utilities such
+as \oodef or \xint_dothis/\xint_orthat.
+
+
+
+INSTALLATION
+
+
+Method A: using the package manager of your TeX distribution
+
+xint is included in TeXLive (hence also MacTeX) and MikTeX.
+
+There can be a few days of delay between apparition of a new version on
+CTAN and availability via the distribution package manager.
+
+
+Method B: manual installation using xint.tds.zip and unzip
+
+Assumes a GNU/Linux-like system (or Mac OS X).
+
+1. obtain xint.tds.zip from CTAN:
+ http://mirror.ctan.org/install/macros/generic/xint.tds.zip
+
+2. cd to the download repertory and issue:
+
+ unzip xint.tds.zip -d <TEXMF>
+
+ where <TEXMF> is a suitable TDS-compliant destination repertory. For
+ example, with TeXLive:
+
+ - Linux, standard access rights, hence sudo is needed,
+ installation into the "local" tree:
+
+ sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
+ sudo texhash /usr/local/texlive/texmf-local
+
+ - Mac OS X, installation into user home folder (no sudo needed,
+ and it is recommended to not have a ls-R file there, hence no
+ texhash):
+
+ unzip xint.tds.zip -d ~/Library/texmf
+
+
+Method C: manual installation using Makefile and xint.dtx
+
+The Makefile automatizes rebuilding from xint.dtx all documentation
+files as well as xint.tds.zip. It is for GNU/Linux-like (inc. Mac OS X)
+systems, with a teTeX like installation such as TeXLive. Furthermore the
+Pandoc software is required.
+
+1. obtain xint.dtx and Makefile from http://www.ctan.org/pkg/xint.
+
+2. put them in an otherwise empty working repertory, run make or
+ equivalently make help for further instructions.
+
+
+Method D: installation starting with only xint.dtx
+
+Run "tex xint.dtx" or "etex xint.dtx" to extract from xint.dtx all
+packages as well as these files:
+
+README.md
+ the current README with Markdown formatting.
+
+CHANGES.md
+ the changes across successive releases.
+
+xint.tex
+
+ used to generate xint.pdf via "latex xint.tex" (thrice) then
+ "dvipdfmx xint.dvi". For successful compilation, packages newtxtt,
+ newtxmath, etoc, mathastext are needed. Inclusion of the source code
+ is off by default, but the toggle can be set in xint.tex.
+
+ It is also possible to compile xint.tex with pdflatex.
+
+ A third option is to generate xint.pdf via pdflatex xint.dtx. Source
+ code is then included by default.
+
+Makefile.mk
+ this is for UNIX-like systems. Note: this file is only produced with
+ "etex xint.dtx", not with "tex xint.dtx". Rename it to Makefile and
+ run make on the command line for further help.
+
+doHTMLs.sh and doPDFs.sh
+ these are scripts (for UNIX-like systems) which can be used to
+ convert the README.md and CHANGES.md to HTML and PDF formats. They
+ require Pandoc.
+
+pandoctpl.latex
+ a Pandoc template used by doPDFs.sh.
+
+Finishing the installation in a TDS hierarchy:
+
+- move the style files to TDS:tex/generic/xint/
+
+- xint.dtx goes to TDS:source/generic/xint/
+
+- the documentation (xint.pdf, README.md,...) goes to
+ TDS:doc/generic/xint/
+
+Depending on the destination, it may then be necessary to refresh a
+filename database.
+
+
+
+LICENSE
+
+
+Copyright (C) 2014 by Jean-Francois Burnol
+
+This Work may be distributed and/or modified under the conditions of the
+LaTeX Project Public License, either version 1.3c of this license or (at
+your option) any later version. This version of this license is in
+
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+
+and the latest version of this license is in
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+This Work has the LPPL maintenance status author-maintained.
+
+The Author of this Work is Jean-Francois Burnol.
+
+This Work consists of the source file xint.dtx and of its derived files:
+xintkernel.sty, xintcore.sty, xint.sty, xintfrac.sty, xintexpr.sty,
+xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty,
+xinttools.sty, xint.ins, xint.tex, README, README.md, README.html,
+README.pdf, CHANGES.md, CHANGES.html, CHANGES.pdf, pandoctpl.latex,
+doHTMLs.sh, doPDFs.sh, xint.dvi, xint.pdf, Makefile.mk.
-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
-e-TeX extensions. LaTeX users will use \usepackage and others \input
-to load the package components.
-
-Installation
-============
-
-A. Installation using xint.tds.zip:
------------------------------------
-
-obtain xint.tds.zip from CTAN:
- http://mirror.ctan.org/install/macros/generic/xint.tds.zip
-
-cd to the download repertory and issue
- unzip xint.tds.zip -d <TEXMF>
-for example: (assuming standard access rights, so sudo needed)
- sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
- sudo mktexlsr
-
-On Mac OS X, installation into user home folder:
- unzip xint.tds.zip -d ~/Library/texmf
-
-B. Installation after file extractions:
----------------------------------------
-
-obtain xint.dtx, xint.ins and the README from CTAN:
- http://www.ctan.org/pkg/xint
-
-- "tex xint.ins" generates the style files
-(pre-existing files in the same repertory will be overwritten).
-
-- without xint.ins: "tex or latex or pdflatex or xelatex xint.dtx"
-will also generate the style files (and xint.ins).
-
-xint.tex is also extracted, use it for the documentation:
-
-- with latex+dvipdfmx: latex xint.tex thrice then dvipdfmx xint.dvi
-Ignore dvipdfmx warnings, but if the pdf file has problems with fonts
-(possibly from an old dvipdfmx), use then rather pdflatex or xelatex.
-
-- with pdflatex or xelatex: run it directly thrice on xint.dtx, or run
-it on xint.tex after having edited the suitable toggle therein.
-
-Whether compiling xint.tex or xint.dtx, the documentation is by default
-produced without inclusion of the source code. See instructions in the
-file xint.tex for changing this default.
-
-Finishing the installation: (on first installation the destination
-repertories may need to be created)
-
- xinttools.sty |
- xint.sty |
- xintfrac.sty |
- xintexpr.sty | --> TDS:tex/generic/xint/
- xintbinhex.sty |
- xintgcd.sty |
- xintseries.sty |
- xintcfrac.sty |
-
- xint.dtx --> TDS:source/generic/xint/
- xint.ins --> TDS:source/generic/xint/
- xint.tex --> TDS:source/generic/xint/
-
- xint.pdf --> TDS:doc/generic/xint/
- README --> TDS:doc/generic/xint/
-
-Depending on the TDS destination and the TeX installation, it may be
-necessary to refresh the TeX installation filename database (mktexlsr)
-
-C. Usage:
----------
-
-Usage with LaTeX: \usepackage{xinttools}
- \usepackage{xint} % (loads xinttools)
- \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 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 may be distributed and/or modified under the
- conditions of the LaTeX Project Public License, either
- version 1.3c of this license or (at your option) any later
- version. This version of this license is in
- http://www.latex-project.org/lppl/lppl-1-3c.txt
- and the latest version of this license is in
- http://www.latex-project.org/lppl.txt
- and version 1.3 or later is part of all distributions of
- LaTeX version 2005/12/01 or later.
-
-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, as well as xint.ins, xint.tex
-and the documentation xint.pdf (or xint.dvi).
-
-The author of this work is Jean-Francois Burnol <jfbu at free dot fr>.
-This work has the LPPL maintenance status `author-maintained'.
-
diff --git a/Master/texmf-dist/doc/generic/xint/README.html b/Master/texmf-dist/doc/generic/xint/README.html
new file mode 100644
index 00000000000..be17b072a27
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/xint/README.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta name="generator" content="pandoc" />
+ <meta name="author" content="xint v1.1" />
+ <title>README</title>
+ <style type="text/css">code{white-space: pre;}</style>
+ <style type="text/css">
+ body{margin-left : 10%; margin-right : 15%; margin-top: 4ex; font-size: 14pt;}
+ pre {white-space: pre-wrap; }
+ code {white-space: pre-wrap; }
+ .mono {font-family: monospace;}
+ </style>
+</head>
+<body>
+<div id="header">
+<h1 class="title">README</h1>
+<h2 class="author">xint v1.1</h2>
+<h3 class="date">2014/10/28</h3>
+</div>
+<div id="TOC">
+<ul>
+<li><a href="#usage">Usage</a><ul>
+<li><a href="#with-latex">With LaTeX</a></li>
+<li><a href="#with-tex">With TeX</a></li>
+</ul></li>
+<li><a href="#installation">Installation</a><ul>
+<li><a href="#method-a-using-the-package-manager-of-your-tex-distribution">Method A: using the package manager of your TeX distribution</a></li>
+<li><a href="#method-b-manual-installation-using-xint.tds.zip-and-unzip">Method B: manual installation using <code>xint.tds.zip</code> and <code>unzip</code></a></li>
+<li><a href="#method-c-manual-installation-using-makefile-and-xint.dtx">Method C: manual installation using <code>Makefile</code> and <code>xint.dtx</code></a></li>
+<li><a href="#method-d-installation-starting-with-only-xint.dtx">Method D: installation starting with only <code>xint.dtx</code></a></li>
+</ul></li>
+<li><a href="#license">License</a></li>
+</ul>
+</div>
+<pre><code>Source: xint.dtx (v1.1, 2014/10/28)
+Author: Jean-Francois Burnol
+Info: Expandable operations on big integers, decimals, fractions
+License: LPPL 1.3c or later</code></pre>
+<p>This README is also available as README.pdf and README.html.</p>
+<p>Change log is in CHANGES.pdf and CHANGES.html.</p>
+<h1 id="usage">Usage</h1>
+<h2 id="with-latex">With LaTeX</h2>
+<pre><code>\usepackage{xint} % expandable arithmetic with big integers
+\usepackage{xintfrac} % decimal numbers, fractions, floats
+\usepackage{xintexpr} % expressions with infix operators</code></pre>
+<p>Further packages: <code>xintbinhex</code>, <code>xintgcd</code>, <code>xintseries</code> and <code>xintcfrac</code>. All dependencies are handled automatically. For example <code>xintexpr</code> automatically loads <code>xintfrac</code> which itself loads <code>xint</code>. Package <code>xintcore</code> is the subset of <code>xint</code> providing only the five operations on big integers: <code>\xintiiAdd</code>, <code>\xintiiMul</code>, ... There is also <code>xinttools</code> which is a separate package providing, among others, expandable and non-expandable loops such as <code>\xintFor</code>.</p>
+<h2 id="with-tex">With TeX</h2>
+<p>One does for example:</p>
+<pre><code>\input xintexpr.sty\relax</code></pre>
+<p>Again, all dependencies are handled automatically. The packages may be loaded in any catcode context such that letters, digits, <code>\</code> and <code>%</code> have their standard catcodes.</p>
+<p><code>xintcore.sty</code> and <code>xinttools.sty</code> both import <code>xintkernel.sty</code> which has the catcode handler and package identifier and defines a few utilities such as <code>\oodef</code> or <code>\xint_dothis/\xint_orthat</code>.</p>
+<h1 id="installation">Installation</h1>
+<h2 id="method-a-using-the-package-manager-of-your-tex-distribution">Method A: using the package manager of your TeX distribution</h2>
+<p><code>xint</code> is included in <a href="http://tug.org/texlive/">TeXLive</a> (hence also <a href="http://tug.org/mactex/">MacTeX</a>) and <a href="http://www.miktex.org/">MikTeX</a>.</p>
+<p>There can be a few days of delay between apparition of a new version on <a href="http://www.ctan.org/pkg/xint">CTAN</a> and availability via the distribution package manager.</p>
+<h2 id="method-b-manual-installation-using-xint.tds.zip-and-unzip">Method B: manual installation using <code>xint.tds.zip</code> and <code>unzip</code></h2>
+<p>Assumes a GNU/Linux-like system (or Mac OS X).</p>
+<ol style="list-style-type: decimal">
+<li><p>obtain <code>xint.tds.zip</code> from CTAN: <a href="http://mirror.ctan.org/install/macros/generic/xint.tds.zip" class="uri">http://mirror.ctan.org/install/macros/generic/xint.tds.zip</a></p></li>
+<li><p>cd to the download repertory and issue:</p>
+<pre><code>unzip xint.tds.zip -d &lt;TEXMF&gt;</code></pre>
+<p>where <code>&lt;TEXMF&gt;</code> is a suitable TDS-compliant destination repertory. For example, with TeXLive:</p>
+<ul>
+<li><p>Linux, standard access rights, hence sudo is needed, installation into the &quot;local&quot; tree:</p>
+<pre><code>sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
+sudo texhash /usr/local/texlive/texmf-local</code></pre></li>
+<li><p>Mac OS X, installation into user home folder (no sudo needed, and it is recommended to not have a ls-R file there, hence no texhash):</p>
+<pre><code>unzip xint.tds.zip -d ~/Library/texmf</code></pre></li>
+</ul></li>
+</ol>
+<h2 id="method-c-manual-installation-using-makefile-and-xint.dtx">Method C: manual installation using <code>Makefile</code> and <code>xint.dtx</code></h2>
+<p>The Makefile automatizes rebuilding from <code>xint.dtx</code> all documentation files as well as <code>xint.tds.zip</code>. It is for GNU/Linux-like (inc. Mac OS X) systems, with a teTeX like installation such as TeXLive. Furthermore the <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a> software is required.</p>
+<ol style="list-style-type: decimal">
+<li><p>obtain <code>xint.dtx</code> and <code>Makefile</code> from <a href="http://www.ctan.org/pkg/xint" class="uri">http://www.ctan.org/pkg/xint</a>.</p></li>
+<li><p>put them in an otherwise empty working repertory, run <code>make</code> or equivalently <code>make help</code> for further instructions.</p></li>
+</ol>
+<h2 id="method-d-installation-starting-with-only-xint.dtx">Method D: installation starting with only <code>xint.dtx</code></h2>
+<p>Run <code>&quot;tex xint.dtx&quot;</code> or <code>&quot;etex xint.dtx&quot;</code> to extract from <code>xint.dtx</code> all packages as well as these files:</p>
+<dl>
+<dt><code>README.md</code></dt>
+<dd>the current README with Markdown formatting.
+</dd>
+<dt><code>CHANGES.md</code></dt>
+<dd>the changes across successive releases.
+</dd>
+<dt><code>xint.tex</code></dt>
+<dd><p>used to generate <code>xint.pdf</code> via <code>&quot;latex xint.tex&quot;</code> (thrice) then <code>&quot;dvipdfmx xint.dvi&quot;</code>. For successful compilation, packages <code>newtxtt</code>, <code>newtxmath</code>, <code>etoc</code>, <code>mathastext</code> are needed. Inclusion of the source code is off by default, but the toggle can be set in <code>xint.tex</code>.</p>
+<p>It is also possible to compile <code>xint.tex</code> with <code>pdflatex</code>.</p>
+<p>A third option is to generate <code>xint.pdf</code> via <code>pdflatex xint.dtx</code>. Source code is then included by default.</p>
+</dd>
+<dt><code>Makefile.mk</code></dt>
+<dd>this is for UNIX-like systems. Note: this file is only produced with <code>&quot;etex xint.dtx&quot;</code>, not with <code>&quot;tex xint.dtx&quot;</code>. Rename it to <code>Makefile</code> and run <code>make</code> on the command line for further help.
+</dd>
+<dt><code>doHTMLs.sh</code> and <code>doPDFs.sh</code></dt>
+<dd>these are scripts (for UNIX-like systems) which can be used to convert the <code>README.md</code> and <code>CHANGES.md</code> to HTML and PDF formats. They require <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
+</dd>
+<dt><code>pandoctpl.latex</code></dt>
+<dd>a Pandoc template used by <code>doPDFs.sh</code>.
+</dd>
+</dl>
+<p>Finishing the installation in a TDS hierarchy:</p>
+<ul>
+<li><p>move the style files to <code>TDS:tex/generic/xint/</code></p></li>
+<li><p><code>xint.dtx</code> goes to <code>TDS:source/generic/xint/</code></p></li>
+<li><p>the documentation (xint.pdf, README.md,...) goes to <code>TDS:doc/generic/xint/</code></p></li>
+</ul>
+<p>Depending on the destination, it may then be necessary to refresh a filename database.</p>
+<h1 id="license">License</h1>
+<div class="mono">
+<p>Copyright (C) 2014 by Jean-Francois Burnol</p>
+<p>This Work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This version of this license is in</p>
+<blockquote>
+<p><a href="http://www.latex-project.org/lppl/lppl-1-3c.txt" class="uri">http://www.latex-project.org/lppl/lppl-1-3c.txt</a></p>
+</blockquote>
+<p>and the latest version of this license is in</p>
+<blockquote>
+<p><a href="http://www.latex-project.org/lppl.txt" class="uri">http://www.latex-project.org/lppl.txt</a></p>
+</blockquote>
+<p>and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.</p>
+<p>This Work has the LPPL maintenance status <code>author-maintained</code>.</p>
+<p>The Author of this Work is Jean-Francois Burnol.</p>
+This Work consists of the source file xint.dtx and of its derived files: xintkernel.sty, xintcore.sty, xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty, xinttools.sty, xint.ins, xint.tex, README, README.md, README.html, README.pdf, CHANGES.md, CHANGES.html, CHANGES.pdf, pandoctpl.latex, doHTMLs.sh, doPDFs.sh, xint.dvi, xint.pdf, Makefile.mk.
+</div>
+</body>
+</html>
diff --git a/Master/texmf-dist/doc/generic/xint/sourcexint.pdf b/Master/texmf-dist/doc/generic/xint/sourcexint.pdf
new file mode 100644
index 00000000000..7a622d72ff2
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/xint/sourcexint.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/xint/xint.pdf b/Master/texmf-dist/doc/generic/xint/xint.pdf
index 9f9f8440a62..dbf49051df8 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/Makefile b/Master/texmf-dist/source/generic/xint/Makefile
new file mode 100644
index 00000000000..cc38697b4ab
--- /dev/null
+++ b/Master/texmf-dist/source/generic/xint/Makefile
@@ -0,0 +1,13 @@
+# Makefile for compilation of the complete xint
+# documentation, packages, and installation.
+# (C) 2014 Jean-Francois Burnol
+# distributed under LPPL 1.3c or later at your convenience.
+
+# with this file Makefile and xint.dtx in a working
+# repertory run 'make' and then get further instructions.
+
+# Tested with GNU Make 3.81 on Mac OS X Mavericks,
+# with TeXLive 2014 and Pandoc 1.13.1, xint.dtx v1.1
+
+include Makefile.mk
+Makefile.mk: xint.dtx ; etex xint.dtx
diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx
index 20f34ef1bb6..4ddd4f93514 100644
--- a/Master/texmf-dist/source/generic/xint/xint.dtx
+++ b/Master/texmf-dist/source/generic/xint/xint.dtx
@@ -1,175 +1,1260 @@
-% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y %02H:%02M:%02S %Z" -*-
-% File: xint.dtx, package: 1.09n (2014/04/01), documentation: 2014/04/01
-% License: LaTeX Project Public License 1.3c or later.
-% Copyright (C) 2013-2014 by Jean-Francois Burnol <jfbu at free dot fr>
+% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
%<*dtx>
-\def\lasttimestamp{Time-stamp: <01-04-2014 19:06:46 CEST>}
+\def\xintdtxtimestamp {Time-stamp: <28-10-2014 at 19:39:20 CET>}
%</dtx>
%<*drv>
-\def\xintdate {2014/04/01}
-\def\xintversion {1.09n}
+%% ---------------------------------------------------------------
+\def\xintdocdate {2014/10/28}
+\def\xintbndldate{2014/10/28}
+\def\xintbndlversion {1.1}
%</drv>
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
+%<*dtx>
+\iffalse
+%</dtx>
+%<readme>% README
+%<changes>% CHANGE LOG
+%<readme|changes>% xint v1.1
+%<readme|changes>% 2014/10/28
+%<*readme|changes>
+
+ Source: xint.dtx (v1.1, 2014/10/28)
+ Author: Jean-Francois Burnol
+ Info: Expandable operations on big integers, decimals, fractions
+ License: LPPL 1.3c or later
+
+%</readme|changes>
+%<*!readme&!changes&!dohtmlsh&!dopdfsh&!makefile>
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
+%% Copyright (C) 2013-2014 by Jean-Francois Burnol
+%<xintkernel>%% xintkernel: Paraphernalia for the xint packages
%<xinttools>%% xinttools: Expandable and non-expandable utilities
-%<xint>%% xint: Expandable operations on long numbers
-%<xintfrac>%% xintfrac: Expandable operations on fractions
+%<xintcore>%% xintcore: Expandable arithmetic on big integers
+%<xint>%% xint: Expandable operations on big integers
+%<xintfrac>%% xintfrac: Expandable operations on fractions
%<xintexpr>%% xintexpr: Expandable expression parser
%<xintbinhex>%% xintbinhex: Expandable binary and hexadecimal conversions
-%<xintgcd>%% xintgcd: Euclidean algorithm with xint package
+%<xintgcd>%% xintgcd: Euclidean algorithm with xint package
%<xintseries>%% xintseries: Expandable partial sums with xint package
%<xintcfrac>%% xintcfrac: Expandable continued fractions with xint package
-%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
-% Installation
-% ============
-%
-% A. Installation using xint.tds.zip:
-% -----------------------------------
-%
-% obtain xint.tds.zip from CTAN:
-% http://mirror.ctan.org/install/macros/generic/xint.tds.zip
-%
-% cd to the download repertory and issue
-% unzip xint.tds.zip -d <TEXMF>
-% for example: (assuming standard access rights, so sudo needed)
-% sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
-% sudo mktexlsr
-%
-% On Mac OS X, installation into user home folder:
-% unzip xint.tds.zip -d ~/Library/texmf
-%
-% B. Installation after file extractions:
-% ---------------------------------------
-%
-% obtain xint.dtx, xint.ins and the README from CTAN:
-% http://www.ctan.org/pkg/xint
-%
-% - "tex xint.ins" generates the style files
-% (pre-existing files in the same repertory will be overwritten).
-%
-% - without xint.ins: "tex or latex or pdflatex or xelatex xint.dtx"
-% will also generate the style files (and xint.ins).
-%
-% xint.tex is also extracted, use it for the documentation:
-%
-% - with latex+dvipdfmx: latex xint.tex thrice then dvipdfmx xint.dvi
-% Ignore dvipdfmx warnings, but if the pdf file has problems with fonts
-% (possibly from an old dvipdfmx), use then rather pdflatex or xelatex.
-%
-% - with pdflatex or xelatex: run it directly thrice on xint.dtx, or run
-% it on xint.tex after having edited the suitable toggle therein.
-%
-% Whether compiling xint.tex or xint.dtx, the documentation is by default
-% produced without inclusion of the source code. See instructions in the
-% file xint.tex for changing this default.
-%
-% Finishing the installation: (on first installation the destination
-% repertories may need to be created)
-%
-% xinttools.sty |
-% xint.sty |
-% xintfrac.sty |
-% xintexpr.sty | --> TDS:tex/generic/xint/
-% xintbinhex.sty |
-% xintgcd.sty |
-% xintseries.sty |
-% xintcfrac.sty |
-%
-% xint.dtx --> TDS:source/generic/xint/
-% xint.ins --> TDS:source/generic/xint/
-% xint.tex --> TDS:source/generic/xint/
-%
-% xint.pdf --> TDS:doc/generic/xint/
-% README --> TDS:doc/generic/xint/
-%
-% Depending on the TDS destination and the TeX installation, it may be
-% necessary to refresh the TeX installation filename database (mktexlsr)
-%
-% C. Usage:
-% ---------
-%
-% Usage with LaTeX: \usepackage{xinttools}
-% \usepackage{xint} % (loads xinttools)
-% \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 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 may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either
-% version 1.3c of this license or (at your option) any later
-% version. This version of this license is in
-% http://www.latex-project.org/lppl/lppl-1-3c.txt
-% and the latest version of this license is in
-% http://www.latex-project.org/lppl.txt
-% and version 1.3 or later is part of all distributions of
-% LaTeX version 2005/12/01 or later.
-%
-% 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, as well as xint.ins, xint.tex
-% and the documentation xint.pdf (or xint.dvi).
-%
-% The author of this work is Jean-Francois Burnol <jfbu at free dot fr>.
-% This work has the LPPL maintenance status `author-maintained'.
-%
+%% ---------------------------------------------------------------
+%</!readme&!changes&!dohtmlsh&!dopdfsh&!makefile>
+%<*readme>
+This README is also available as README.pdf and README.html.
+
+Change log is in CHANGES.pdf and CHANGES.html.
+
+Usage
+=====
+
+## With LaTeX
+
+ \usepackage{xint} % expandable arithmetic with big integers
+ \usepackage{xintfrac} % decimal numbers, fractions, floats
+ \usepackage{xintexpr} % expressions with infix operators
+
+Further packages: `xintbinhex`, `xintgcd`, `xintseries` and
+`xintcfrac`. All dependencies are handled automatically. For example
+`xintexpr` automatically loads `xintfrac` which itself loads `xint`.
+Package `xintcore` is the subset of `xint` providing only the five
+operations on big integers: `\xintiiAdd`, `\xintiiMul`,\ ...
+There is also `xinttools` which is a separate package providing,
+among others, expandable and non-expandable loops such as `\xintFor`.
+
+## With TeX
+
+One does for example:
+
+ \input xintexpr.sty\relax
+
+Again, all dependencies are handled automatically. The packages may
+be loaded in any catcode context such that letters, digits, `\` and
+`%` have their standard catcodes.
+
+`xintcore.sty` and `xinttools.sty` both import `xintkernel.sty`
+which has the catcode handler and package identifier and defines a
+few utilities such as `\oodef` or `\xint_dothis/\xint_orthat`.
+
+Installation
+============
+
+## Method A: using the package manager of your TeX distribution
+
+`xint` is included in [TeXLive](http://tug.org/texlive/) (hence also
+[MacTeX](http://tug.org/mactex/)) and [MikTeX](http://www.miktex.org/).
+
+There can be a few days of delay between apparition of a new version on
+[CTAN](http://www.ctan.org/pkg/xint) and availability via the distribution
+package manager.
+
+## Method B: manual installation using `xint.tds.zip` and `unzip`
+
+Assumes a GNU/Linux-like system (or Mac OS X).
+
+1. obtain `xint.tds.zip` from CTAN:
+ <http://mirror.ctan.org/install/macros/generic/xint.tds.zip>
+
+2. cd to the download repertory and issue:
+
+ unzip xint.tds.zip -d <TEXMF>
+
+ where `<TEXMF>` is a suitable TDS-compliant destination repertory.
+ For example, with TeXLive:
+
+ - Linux, standard access rights, hence sudo is needed, installation
+ into the "local" tree:
+
+ sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
+ sudo texhash /usr/local/texlive/texmf-local
+
+ - Mac OS X, installation into user home folder (no sudo needed,
+ and it is recommended to not have a ls-R file there, hence no texhash):
+
+ unzip xint.tds.zip -d ~/Library/texmf
+
+## Method C: manual installation using `Makefile` and `xint.dtx`
+
+The Makefile automatizes rebuilding from `xint.dtx` all documentation
+files as well as `xint.tds.zip`. It is for GNU/Linux-like (inc. Mac OS X)
+systems, with a teTeX like installation such as TeXLive. Furthermore the
+[Pandoc](http://johnmacfarlane.net/pandoc/) software is required.
+
+1. obtain `xint.dtx` and `Makefile` from <http://www.ctan.org/pkg/xint>.
+
+2. put them in an otherwise empty working repertory, run `make` or
+ equivalently `make help` for further instructions.
+
+## Method D: installation starting with only `xint.dtx`
+
+Run `"tex xint.dtx"` or `"etex xint.dtx"` to extract from `xint.dtx`
+all packages as well as these files:
+
+`README.md`
+ : the current README with Markdown formatting.
+
+`CHANGES.md`
+ : the changes across successive releases.
+
+`xint.tex`
+ : used to generate `xint.pdf` via `"latex xint.tex"` (thrice) then
+ `"dvipdfmx xint.dvi"`. For successful compilation, packages
+ `newtxtt`, `newtxmath`, `etoc`, `mathastext` are needed. Inclusion
+ of the source code is off by default, but the toggle can be set in
+ `xint.tex`.
+
+ It is also possible to compile `xint.tex` with `pdflatex`.
+
+ A third option is to generate `xint.pdf` via `pdflatex xint.dtx`.
+ Source code is then included by default.
+
+`Makefile.mk`
+ : this is for UNIX-like systems. Note: this file is only produced
+ with `"etex xint.dtx"`, not with `"tex xint.dtx"`. Rename it to
+ `Makefile` and run `make` on the command line for further help.
+
+`doHTMLs.sh` and `doPDFs.sh`
+ : these are scripts (for UNIX-like systems) which can be used to
+ convert the `README.md` and `CHANGES.md` to HTML and PDF formats.
+ They require [Pandoc](http://johnmacfarlane.net/pandoc/).
+
+`pandoctpl.latex`
+ : a Pandoc template used by `doPDFs.sh`.
+
+Finishing the installation in a TDS hierarchy:
+
+- move the style files to `TDS:tex/generic/xint/`
+
+- `xint.dtx` goes to `TDS:source/generic/xint/`
+
+- the documentation (xint.pdf, README.md,...) goes to `TDS:doc/generic/xint/`
+
+Depending on the destination, it may then be necessary to refresh a
+filename database.
+
+License
+=======
+
+<div class="mono">
+Copyright (C) 2014 by Jean-Francois Burnol
+
+This Work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3c of this license or (at your option) any later
+version. This version of this license is in
+
+> <http://www.latex-project.org/lppl/lppl-1-3c.txt>
+
+and the latest version of this license is in
+
+> <http://www.latex-project.org/lppl.txt>
+
+and version 1.3 or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+
+This Work has the LPPL maintenance status `author-maintained`.
+
+The Author of this Work is Jean-Francois Burnol.
+
+This Work consists of the source file xint.dtx and of its derived
+files: xintkernel.sty, xintcore.sty, xint.sty, xintfrac.sty,
+xintexpr.sty, xintbinhex.sty, xintgcd.sty, xintseries.sty,
+xintcfrac.sty, xinttools.sty, xint.ins, xint.tex, README, README.md,
+README.html, README.pdf, CHANGES.md, CHANGES.html, CHANGES.pdf,
+pandoctpl.latex, doHTMLs.sh, doPDFs.sh, xint.dvi, xint.pdf,
+Makefile.mk.</div>
+%</readme>--------------------------------------------------------
+%<*changes>-------------------------------------------------------
+`1.1 (2014/10/28)`
+----
+
+bug fixes
+
+: - `\xintZapFirstSpaces` hence also `\xintZapSpaces` from package **xinttools**
+ were buggy when used with an argument either empty or containing only
+ space tokens.
+
+ - `\xintiiexpr` did not strip leading zeroes, hence
+ `\xinttheiiexpr 001+1\relax` did not obtain the expected result ...
+
+ - `\xinttheexpr \xintiexpr 1.23\relax\relax` should have produced `1`,
+ but it produced `1.23`
+
+ - the catcode of `;` was not set at package launching time.
+
+ - the `\XINTinFloatPrd:csv` macro name had a typo, hence `prd` was
+ non-functional in `\xintfloatexpr`.
+
+breaking changes
+
+: - in `\xintiiexpr`, `/` does _rounded_ division, rather than the
+ Euclidean division (for positive arguments, this is truncated division).
+ The new `//` operator does truncated division,
+
+ - the `:` operator for three-way branching is gone, replaced with `??`,
+
+ - `1e(3+5)` is now illegal. The number parser identifies `e` and `E`
+ in the same way it does for the decimal mark, earlier versions treated
+ `e` as `E` rather as postfix operators,
+
+ - the `add` and `mul` have a new syntax, old syntax is with `` `+` `` and
+ `` `*` `` (quotes mandatory), `sum` and `prd` are gone,
+
+ - no more special treatment for encountered brace pairs `{..}` by the
+ number scanner, `a/b[N]` notation can be used without use of braces (the
+ `N` will end up as is in a `\numexpr`, it is not parsed by the
+ `\xintexpr`-ession scanner),
+
+ - although `&` and `|` are still available as Boolean operators the
+ use of `&&` and `||` is strongly recommended. The single
+ letter operators might be assigned some other meaning in later releases
+ (bitwise operations, perhaps). Do not use them.
+
+There are many novelties, most to be found in package **xintexpr**.
+But first the other changes.
+
+ * new package **xintcore** has been split off **xint**. It contains the
+ core arithmetic macros. It is loaded by package **bnumexpr**,
+
+ * neither **xint** nor **xintfrac** load **xinttools**. Only
+ **xintexpr** does,
+
+ * whenever some portion of code has been revised, often use has been made of
+ the `\xint_dothis` and `\xint_orthat` pair of macros for expandably
+ branching,
+
+ * these tiny helpful macros, and a few others are in package **xintkernel**
+ which contains also the catcode and loading order management code,
+ initially inspired by code found in Heiko Oberdiek's packages,
+
+ * the `\xintAdd` and `\xintSub` macros from package **xintfrac** check if
+ one of the denominator is a multiple of the other, and only if this is
+ not the case do they multiply the denominators. But systematic reduction
+ would be too costly,
+
+ * this naturally will be also the case for the `+` and `-` operations
+ in `\xintexpr`,
+
+ * new macros `\xintiiDivRound`, `\xintiiDivTrunc` and `\xintiiMod` for
+ rounded and truncated division of big integers (now in **xintcore**),
+ alongside the earlier `\xintiiQuo` and `\xintiiRem`,
+
+ * with **xintfrac** loaded, the `\xintNum` macro does `\xintTTrunc`
+ (which is truncation to an integer, same as `\xintiTrunc {0}`),
+
+ * new macro `\xintMod` in **xintfrac** for modulo operation with
+ fractional numbers,
+
+ * `\xintiexpr`, `\xinttheiexpr` admit an optional argument within brackets
+ `[d]`, they round the computation result (or results, if comma separated)
+ to `d` digits after decimal mark, (the whole computation is done exactly,
+ as in `xintexpr`),
+
+ * `\xintfloatexpr`, `\xintthefloatexpr` similarly admit an optional
+ argument which serves to keep only `d` digits of precision, getting rid
+ of cumulated uncertainties in the last digits (the whole computation is
+ done according to the precision set via `\xintDigits`),
+
+ * `\xinttheexpr` and `\xintthefloatexpr` ''pretty-print'' if possible,
+ the former removing unit denominator or `[0]` brackets, the latter
+ avoiding scientific notation if decimal notation is practical,
+
+ * the `//` does truncated division and `/:` is the associated modulo,
+
+ * multi-character operators `&&`, `|`, `==`, `<=`, `>=`, `!=`,
+ `**`,
+
+ * multi-letter infix binary words `'and'`, `'or'`, `'xor'`, `'mod'`
+ (quotes mandatory),
+
+ * functions `even`, `odd`,
+
+ * `\xintdefvar A3:=3.1415;` for variable definitions (non expandable,
+ naturally), usable in subsequent expressions; variable names may contain
+ letters, digits, underscores. They should not start with a digit, the
+ `@` is reserved, and single lowercase and uppercase Latin letters are
+ predefined to work as dummy variables (see next),
+
+ * generation of comma separated lists `a..b`, `a..[d]..b`,
+
+ * Python syntax-like list extractors `[list][n:]`, `[list][:n]`,
+ `[list][a:b]` allowing negative indices, but no optional step argument,
+ and `[list][n]` (`n=0` for the number of items in the list),
+
+ * functions `first`, `last`, `reversed`,
+
+ * itemwise operations on comma separated lists `a*[list]`, etc.., possible
+ on both sides `a*[list]^b`, an obeying the same precedence rules as with
+ numbers,
+
+ * `add` and `mul` must use a dummy variable: `add(x(x+1)(x-1), x=-10..10)`,
+
+ * variable substitutions with `subs`: `subs(subs(add(x^2+y^2,x=1..y),y=t),t=20)`,
+
+ * sequence generation using `seq` with a dummy variable: `seq(x^3, x=-10..10)`,
+
+ * simple recursive lists with `rseq`, with `@` given the last value,
+ `rseq(1;2@+1,i=1..10)`,
+
+ * higher recursion with `rrseq`, `@1`, `@2`, `@3`, `@4`, and `@@(n)`
+ for earlier values, up to `n=K` where `K` is the number of terms of the
+ initial stretch `rrseq(0,1;@1+@2,i=2..100)`,
+
+ * iteration with `iter` which is like `rrseq` but outputs only the
+ last `K` terms, where `K` was the number of initial terms,
+
+ * inside `seq`, `rseq`, `rrseq`, `iter`, possibility to use `omit`,
+ `abort` and `break` to control termination,
+
+ * `n++` potentially infinite index generation for `seq`, `rseq`,
+ `rrseq`, and `iter`, it is advised to use `abort` or `break(..)` at
+ some point,
+
+ * the `add`, `mul`, `seq`, ... are nestable,
+
+ * `\xintthecoords` converts a comma separated list of an even number
+ of items to the format expected by the `TikZ` `coordinates` syntax,
+
+ * completely new version `\xintNewExpr`, `protect` function to handle
+ external macros. Not all constructs are compatible with `\xintNewExpr`.
+
+`1.09n (2014/04/01)`
+----
+
+ * the user manual does not include by default the source code
+ anymore: the `\NoSourceCode` toggle in file `xint.tex` has to
+ be set to 0 before compilation to get source code inclusion.
+
+ * bug fix (**xinttools**) in `\XINT_nthelt_finish` (this bug was
+ introduced in `1.09i` of `2013/12/18` and showed up when the index
+ `N` was larger than the number of elements of the list).
+
+`1.09m (2014/02/26)`
+----
+
+ * new in **xinttools**: `\xintKeep` keeps the first `N` or last
+ `N` elements of a list (sequence of braced items); `\xintTrim`
+ cuts out either the first `N` or the last `N` elements from a
+ list.
+
+ * new in **xintcfrac**: `\xintFGtoC` finds the initial partial
+ quotients common to two numbers or fractions `f` and `g`;
+ `\xintGGCFrac` is a clone of `\xintGCFrac` which however does not
+ assume that the coefficients of the generalized continued
+ fraction are numeric quantities. Some other minor changes.
+
+`1.09kb (2014/02/13)`
+----
+
+ * bug fix (**xintexpr**): an aloof modification done by `1.09i` to
+ `\xintNewExpr` had resulted in a spurious trailing space present
+ in the outputs of all macros created by `\xintNewExpr`, making
+ nesting of such macros impossible.
+
+ * bug fix (**xinttools**): `\xintBreakFor` and `\xintBreakForAndDo`
+ were buggy when used in the last iteration of an `\xintFor` loop.
+
+ * bug fix (**xinttools**): `\xintSeq` from `1.09k` needed a `\chardef`
+ which was missing from `xinttools.sty`, it was in `xint.sty`.
+
+`1.09k (2014/01/21)`
+----
+
+ * inside `\xintexpr..\relax` (and its variants) tacit multiplication is
+ implied when a number or operand is followed directly with an
+ opening parenthesis,
+
+ * the `"` for denoting (arbitrarily big) hexadecimal numbers is
+ recognized by `\xintexpr` and its variants (package
+ **xintbinhex** is required); a fractional hexadecimal part
+ introduced by a dot `.` is allowed.
+
+ * re-organization of the first sections of the user manual.
+
+ * bug fix (**xinttools**, **xint**, ...): forgotten catcode check of
+ `"` at loading time has been added.
+
+`1.09j (2014/01/09)`
+----
+
+ * (**xint**) the core division routines have been re-written for some
+ (limited) efficiency gain, more pronounced for small divisors. As a
+ result the *computation of one thousand digits of $\pi$* is close
+ to three times faster than with earlier releases.
+
+ * some various other small improvements, particularly in the power
+ routines.
+
+ * (**xintfrac**) a new macro `\xintXTrunc` is designed to produce
+ thousands or even tens of thousands of digits of the decimal
+ expansion of a fraction. Although completely expandable it has its
+ use limited to inside an `\edef`, `\write`, `\message`, \dots. It
+ can thus not be nested as argument to another package macro.
+
+ * (**xintexpr**) the tacit multiplication done in `\xintexpr..\relax`
+ on encountering a count register or variable, or a `\numexpr`,
+ while scanning a (decimal) number, is extended to the case of a sub
+ `\xintexpr`-ession.
+
+ * `\xintexpr` can now be used in an `\edef` with no `\xintthe` prefix;
+ it will execute completely the computation, and the error message
+ about a missing `\xintthe` will be inhibited. Previously, in the
+ absence of `\xintthe`, expansion could only be a full one (with
+ ``\romannumeral-`0``), not a complete one (with `\edef`). Note
+ that this differs from the behavior of the non-expandable
+ `\numexpr`: `\the` or `\number` are needed not only to print but
+ also to trigger the computation, whereas `\xintthe` is mandatory
+ only for the printing step.
+
+ * the default behavior of `\xintAssign` is changed, it now does not
+ do any further expansion beyond the initial full-expansion which
+ provided the list of items to be assigned to macros.
+
+ * bug fix (**xintfrac**): `1.09i` did an unexplainable change to
+ `\XINT_infloat_zero` which broke the floating point routines for
+ vanishing operands =:(((
+
+ * bug fix: the `1.09i` `xint.ins` file produced a buggy `xint.tex` file.
+
+`1.09i (2013/12/18)`
+----
+
+ * (**xintexpr**) `\xintiiexpr` is a variant of `\xintexpr` which is
+ optimized to deal only with (long) integers, `/` does a euclidean
+ quotient.
+
+ * `\xintnumexpr`, `\xintthenumexpr`, `\xintNewNumExpr` are renamed,
+ respectively, `\xintiexpr`, `\xinttheiexpr`, `\xintNewIExpr`. The
+ earlier denominations are kept but to be removed at some point.
+
+ * it is now possible within `\xintexpr...\relax` and its variants to
+ use count, dimen, and skip registers or variables without
+ explicit `\the/\number`: the parser inserts automatically
+ `\number` and a tacit multiplication is implied when a register
+ or variable immediately follows a number or fraction. Regarding
+ dimensions and `\number`, see the further discussion in
+ *Dimensions*.
+
+ * (**xintfrac**) new conditional `\xintifOne`; `\xintifTrueFalse`
+ renamed to `\xintifTrueAelseB`; new macros `\xintTFrac`
+ (`fractional part`, mapped to function `frac` in
+ `\xintexpr`-essions), `\xintFloatE`.
+
+ * (**xinttools**) `\xintAssign` admits an optional argument to
+ specify the expansion type to be used: `[]` (none, default), `[o]`
+ (once), `[oo]` (twice), `[f]` (full), `[e]` (`\edef`),... to define
+ the macros
+
+ * **xinttools** defines `\odef`, `\oodef`, `\fdef` (if the names have
+ already been assigned, it uses `\xintoodef` etc...). These tools
+ are provided for the case one uses the package macros in a
+ non-expandable context, particularly `\oodef` which expands twice
+ the macro replacement text and is thus a faster alternative to
+ `\edef` taking into account that the **xint** bundle macros expand
+ already completely in only two steps. This can be significant when
+ repeatedly making `\def`-initions expanding to hundreds of digits.
+
+ * some across the board slight efficiency improvement as a result of
+ modifications of various types to *fork macros* and *branching
+ conditionals* which are used internally.
+
+ * bug fix (**xint**): `\xintAND` and `\xintOR` inserted a space token
+ in some cases and did not expand as promised in two steps `:-((`
+ (bug dating back to `1.09a` I think; this bug was without
+ consequences when using `&` and `|` in `\xintexpr-essions`, it
+ affected only the macro form).
+
+ * bug fix (**xintcfrac**): `\xintFtoCCv` still ended fractions with
+ the `[0]`'s which were supposed to have been removed since release
+ `1.09b`.
+
+`1.09h (2013/11/28)`
+----
+
+ * parts of the documentation have been re-written or re-organized,
+ particularly the discussion of expansion issues and of input and
+ output formats.
+
+ * 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.
+
+ * a dependency of **xinttools** on **xint** (inside `\xintSeq`) has
+ been removed.
+
+ * (**xintgcd**) `\xintTypesetEuclideAlgorithm` and
+ `\xintTypesetBezoutAlgorithm` have been slightly modified
+ (regarding indentation).
+
+ * (**xint**) macros `xintiSum` and `xintiPrd` are renamed to
+ `\xintiiSum` and `\xintiiPrd`.
+
+ * (**xinttools**) a count register used in `1.09g` in the `\xintFor`
+ loops for parsing purposes has been removed and replaced by use of
+ a `\numexpr`.
+
+ * the few uses of `\loop` have been replaced by `\xintloop/\xintiloop`.
+
+ * all macros of **xinttools** for which it makes sense are now declared
+ `\long`.
+
+`1.09g (2013/11/22)`
+----
+
+ * a package **xinttools** is detached from **xint**, to make tools such
+ as `\xintFor`, `\xintApplyUnbraced`, and `\xintiloop` available
+ without the **xint** overhead.
+
+ * new expandable nestable loops `\xintloop` and `\xintiloop`.
+
+ * bugfix: `\xintFor` and `\xintFor*` do not modify anymore the value of
+ `\count 255`.
+
+`1.09f (2013/11/04)`
+----
+
+ * (**xint**) new `\xintZapFirstSpaces`, `\xintZapLastSpaces`,
+ `\xintZapSpaces`, `\xintZapSpacesB`, for expandably stripping away
+ leading and/or ending spaces.
+
+ * `\xintCSVtoList` by default uses `\xintZapSpacesB` to strip away
+ spaces around commas (or at the start and end of the comma
+ separated list).
+
+ * also the `\xintFor` loop will strip out all spaces around commas and
+ at the start and the end of its list argument; and similarly for
+ `\xintForpair`, `\xintForthree`, `\xintForfour`.
+
+ * `\xintFor` *et al.* accept all macro parameters from `#1` to
+ `#9`.
+
+ * for reasons of inner coherence some macros previously with one extra
+ `i` in their names (e.g. `\xintiMON`) now have a doubled
+ `ii` (`\xintiiMON`) to indicate that they skip the overhead of
+ parsing their inputs via `\xintNum`. Macros with a *single*
+ `i` such as `\xintiAdd` are those which maintain the
+ non-**xintfrac** output format for big integers, but do parse
+ their inputs via `\xintNum` (since release `1.09a`). They too may
+ have doubled-`i` variants for matters of programming optimization
+ when working only with (big) integers and not fractions or
+ decimal numbers.
+
+`1.09e (2013/10/29)`
+----
+
+ * (**xint**) new `\xintintegers`, `\xintdimensions`, `\xintrationals`
+ for infinite `\xintFor` loops, interrupted with `\xintBreakFor` and
+ `\xintBreakForAndDo`.
+
+ * new `\xintifForFirst`, `\xintifForLast` for the `\xintFor` and
+ `\xintFor*` loops,
+
+ * the `\xintFor` and `xintFor*` loops are now `\long`, the
+ replacement text and the items may contain explicit `\par`'s.
+
+ * new conditionals `\xintifCmp`, `\xintifInt`, `\xintifOdd`.
+
+ * bug fix (**xint**): the `\xintFor` loop (not `\xintFor*`) did
+ not correctly detect an empty list.
+
+ * bug fix (**xint**): `\xintiSqrt {0}` crashed. `:-((`
+
+ * the documentation has been enriched with various additional examples,
+ such as the *the quick sort algorithm
+ illustrated* or the various ways of *computing prime numbers*.
+
+ * the documentation explains with more details various expansion
+ related issues, particularly in relation to conditionals.
+
+`1.09d (2013/10/22)`
+----
+
+ * bug fix (**xint**): `\xintFor*` is modified to gracefully
+ handle a space token (or more than one) located at the very end of
+ its list argument (as the space before `\do` in `\xintFor* #1 in
+ {{a}{b}{c}<space>} \do {stuff}`; spaces at other locations were
+ already harmless). Furthermore this new version _f-expands_ the
+ un-braced list items. After `\def\x{{1}{2}}` and `\def\y{{a}\x
+ {b}{c}\x }`, `\y` will appear to `\xintFor*` exactly as if it had
+ been defined as `\def\y{{a}{1}{2}{b}{c}{1}{2}}`.
+
+ * same bug fix for `\xintApplyInline`.
+
+`1.09c (2013/10/09)`
+----
+
+ * (**xintexpr**) added `bool` and `togl` to the `\xintexpr` syntax;
+ also added `\xintboolexpr` and `\xintifboolexpr`.
+
+ * added `\xintNewNumExpr` (now `\xintNewIExpr` and `\xintNewBoolExpr`),
+
+ * the factorial `!` and branching `?`, `:`, operators (in
+ `\xintexpr...\relax`) have now less precedence than a function
+ name located just before,
+
+ * (**xint**) `\xintFor` is a new type of loop, whose replacement text
+ inserts the comma separated values or list items via macro
+ parameters, rather than encapsulated in macros; the loops are
+ nestable up to four levels (nine levels since `1.09f`) and their
+ replacement texts are allowed to close groups as happens with the
+ tabulation in alignments,
+
+ * `\xintForpair`, `\xintForthree`, `\xintForfour` are experimental
+ variants of `\xintFor`,
+
+ * `\xintApplyInline` has been enhanced in order to be usable for
+ generating rows (partially or completely) in an alignment,
+
+ * new command `\xintSeq` to generate (expandably) arithmetic sequences
+ of (short) integers,
+
+ * again various improvements and changes in the documentation.
+
+`1.09b (2013/10/03)`
+----
+
+ * various improvements in the documentation,
+
+ * more economical catcode management and re-loading handling,
+
+ * removal of all those `[0]`'s previously forcefully added at the end
+ of fractions by various macros of **xintcfrac**,
+
+ * `\xintNthElt` with a negative index returns from the tail of the
+ list,
+
+ * new macro `\xintPRaw` to have something like what `\xintFrac` does in
+ math mode; i.e. a `\xintRaw` which does not print the denominator
+ if it is one.
+
+`1.09a (2013/09/24)`
+----
+
+ * (**xintexpr**) `\xintexpr..\relax` and `\xintfloatexpr..\relax`
+ admit functions in their syntax, with comma separated values as
+ arguments, among them `reduce, sqr, sqrt, abs, sgn, floor, ceil,
+ quo, rem, round, trunc, float, gcd, lcm, max, min, sum, prd, add,
+ mul, not, all, any, xor`.
+
+ * comparison (`<`, `>`, `=`) and logical (`|`, `&`) operators.
+
+ * the command `\xintthe` which converts `\xintexpr`essions into
+ printable format (like `\the` with `\numexpr`) is more efficient,
+ for example one can do `\xintthe\x` if `\x` was defined to be an
+ `\xintexpr..\relax`:
+
+ \def\x{\xintexpr 3^57\relax}
+ \def\y{\xintexpr \x^(-2)\relax}
+ \def\z{\xintexpr \y-3^-114\relax}
+ \xintthe\z
+
+ * `\xintnumexpr .. \relax` (now renamed `\xintiexpr`) is `\xintexpr
+ round( .. ) \relax`.
+
+ * `\xintNewExpr` now works with the standard macro parameter character
+ `#`.
+
+ * both regular `\xintexpr`-essions and commands defined by
+ `\xintNewExpr` will work with comma separated lists of
+ expressions,
+
+ * new commands `\xintFloor`, `\xintCeil`, `\xintMaxof`, `\xintMinof`
+ (package **xintfrac**), `\xintGCDof`, `\xintLCM`, `\xintLCMof`
+ (package **xintgcd**), `\xintifLt`, `\xintifGt`, `\xintifSgn`,
+ `\xintANDof`, ...
+
+ * The arithmetic macros from package **xint** now filter their operands
+ via `\xintNum` which means that they may use directly count
+ registers and `\numexpr`-essions without having to prefix them by
+ `\the`. This is thus similar to the situation holding previously
+ already when **xintfrac** was loaded.
+
+ * a bug (**xintfrac**) introduced in `1.08b` made `\xintCmp` crash
+ when one of its arguments was zero. `:-((`
+
+`1.08b (2013/06/14)`
+----
+
+ * (**xintexpr**) Correction of a problem with spaces inside
+ `\xintexpr`-essions.
+
+ * (**xintfrac**) Additional improvements to the handling of floating
+ point numbers.
+
+ * new section *Use of count registers* documenting how count
+ registers may be directly used in arguments to the macros of
+ **xintfrac**.
+
+`1.08a (2013/06/11)`
+----
+
+ * (**xintfrac**) Improved efficiency of the basic conversion from
+ exact fractions to floating point numbers, with ensuing speed gains
+ especially for the power function macros `\xintFloatPow` and
+ `\xintFloatPower`,
+
+ * Better management by `\xintCmp`, `\xintMax`, `\xintMin` and
+ `\xintGeq` of inputs having big powers of ten in them.
+
+ * Macros for floating point numbers added to the **xintseries**
+ package.
+
+`1.08 (2013/06/07)`
+----
+
+ * (**xint** and **xintfrac**) Macros for extraction of square roots,
+ for floating point numbers (`\xintFloatSqrt`), and integers
+ (`\xintiSqrt`).
+
+ * New package **xintbinhex** providing *conversion routines* to and from
+ binary and hexadecimal bases.
+
+`1.07 (2013/05/25)`
+----
+
+ * The **xintexpr** package is a new core constituent (which loads
+ automatically **xintfrac** and **xint**) and implements the
+ expandable expanding parser
+
+ \xintexpr . . . \relax,
+
+ and its variant
+
+ \xintfloatexpr . . . \relax
+
+ allowing on input formulas using the infix operators `+`, `-`, `*`,
+ `/`, and `^`, and arbitrary levels of parenthesizing. Within a
+ float expression the operations are executed according to the
+ current value of `\xintDigits`. Within an `\xintexpr`-ession the
+ binary operators are computed exactly.
+
+ To write the `\xintexpr` parser I benefited from the commented
+ source of the `l3fp` parser; the `\xintexpr` parser has its own
+ features and peculiarities. *See its documentation*.
+
+ * The floating point precision `D` is set (this is a local assignment
+ to a `\mathchar` variable) with `\xintDigits := D;` and queried
+ with `\xinttheDigits`. It may be set to anything up to
+ `32767`.[^1] The macro incarnations of the binary operations
+ admit an optional argument which will replace pointwise `D`; this
+ argument may exceed the `32767` bound.
+
+ * The **xintfrac** macros now accept numbers written in scientific
+ notation, the `\xintFloat` command serves to output its argument
+ with a given number `D` of significant figures. The value of `D`
+ is either given as optional argument to `\xintFloat` or set with
+ `\xintDigits := D;`. The default value is `16`.
+
+[^1]: but values higher than 100 or 200 will presumably give too slow
+evaluations.
+
+`1.06b (2013/05/14)`
+----
+
+ * Minor code and documentation improvements. Everywhere in the source
+ code, a more modern underscore has replaced the @ sign.
+
+`1.06 (2013/05/07)`
+----
+
+ * Some code improvements, particularly for macros of **xint** doing loops.
+
+ * New utilities in **xint** for expandable manipulations of lists:
+
+ \xintNthElt, \xintCSVtoList, \xintRevWithBraces
+
+ * The macros did only a double expansion of their arguments. They now
+ fully expand them (using ``\romannumeral-`0``). Furthermore, in the
+ case of arguments constrained to obey the TeX bounds they will be
+ inserted inside a `\numexpr..\relax`, hence completely expanded, one
+ may use count registers, even infix arithmetic operations, etc...
+
+`1.05 (2013/05/01)`
+----
+
+Minor changes and additions to **xintfrac** and **xintcfrac**.
+
+`1.04 (2013/04/25)`
+----
+
+ * New component **xintcfrac** devoted to continued fractions.
+
+ * bug fix (**xintfrac**): `\xintIrr {0}` crashed.
+
+ * faster division routine in **xint**, new macros to deal expandably with
+ token lists.
+
+ * `\xintRound` added.
+
+ * **xintseries** has a new implementation of `\xintPowerSeries` based
+on a Horner scheme, and new macro `\xintRationalSeries`. Both to help
+deal with the *denominator buildup* plague.
+
+ * `tex xint.dtx` extracts style files (no need for a `xint.ins`).
+
+`1.03 (2013/04/14)`
+----
+
+ * new modules **xintfrac** (expandable operations on fractions) and
+ **xintseries** (expandable partial sums with xint package).
+
+ * slightly improved division and faster multiplication (the best
+ordering of the arguments is chosen automatically).
+
+ * added illustration of Machin algorithm to the documentation.
+
+`1.0 (2013/03/28)`
+----
+
+Initial announcement:
+
+> The **xint** package implements with expandable TeX macros the basic
+ arithmetic operations of addition, subtraction, multiplication
+ and division, as applied to arbitrarily long numbers represented
+ as chains of digits with an optional minus sign.
+
+> The **xintgcd** package provides implementations of the Euclidean
+ algorithm and of its typesetting.
+
+> The packages may be used with Plain and with LaTeX.
+
+%</changes>-------------------------------------------------------
%<*dtx>
-\iffalse
+\fi
+\catcode`+ 0 \catcode`\\ 12 +iffalse
%</dtx>
-%<*drv>----------------------------------------------------------------------
-%% This is a generated file. Run latex thrice on this file xint.tex then
-%% run dvipdfmx on xint.dvi to produce the documentation xint.pdf, with
-%% or without source code accoding to value of \NoSourceCode toggle below.
+%<*makefile>------------------------------------------------------
+# This file: Makefile.mk (generated from xint.dtx)
+# Tested on Mac OS X Mavericks with GNU Make 3.81,
+# TeXLive 2014 and Pandoc 1.13.1.
+# Either download the master Makefile from
+# http://www.ctan.org/pkg/xint
+# or rename the present one as "Makefile".
+# Then run "make" or equivalently "make help" to
+# get instructions. Compilation of the complete
+# documentation requires Pandoc.
+
+# Note to myself: I wanted to use .RECIPEPREFIX = > but it is supported
+# only with GNU Make 3.82 and later.
+
+# this crazyness is to circumvent a problem with docstrip generation
+# of the Makefile; we do not want two empty lines becoming only one
+nullstring :=
+define newline
+$(nullstring)
+
+endef
+# will speed-up a little, I think.
+newline := $(newline)
+
+define helptext
+==== INSTRUCTIONS
+
+The Makefile is to automatize the extraction and compilation from
+xint.dtx of package files and documentation files, and for producing
+xint.tds.zip. It is for GNU/Linux like systems, with a teTeX like
+installation such as TeXLive. Tested on Mac OS X Mavericks with TL2014.
+
+For compiling the PDF files, packages newtx, newtxtt, etoc,... are used
+and should be up-to-date (as of 2014/10). Conversion to plain, html and
+pdf format of README.md and CHANGES.md (make PanPDF, make PanHTML)
+require Pandoc software. (tested with Pandoc 1.13.1).
+
+It is recommended to work with xint.dtx and Makefile in an otherwise
+initially empty temporary repertory.
+
+make help
+ prints this help (using more). It will also have already extracted
+ all files from xint.dtx.
+
+make helpless
+ prints this help (using less).
+
+make xint.pdf
+ extracts files and produces only xint.pdf, via latex+dvipdfmx.
+ No Pandoc needed.
+
+make sourcexint.pdf
+ extracts files and produces only sourcexint.pdf, via latex+dvipdfmx.
+ No Pandoc needed.
+
+make PanPDF
+ produces README.pdf and CHANGES.pdf, requires Pandoc.
+
+make PanHTML
+ produces README.html and CHANGES.html, requires Pandoc.
+
+make doc
+ produces all documentation.
+
+make all
+ produces all documentation, and creates xint.tds.zip.
+
+make xint.tds.zip
+ same as "make all"
+
+make clean
+ removes some auxiliary generated files.
+
+==== INSTALLING
+
+The following has been tested on a TeXLive installation:
+
+make installhome
+ creates xint.tds.zip, and unzips it in <TEXMFHOME>
+ (it assumes there is no ls-R file there)
+
+make installlocal
+ creates xint.tds.zip, and unzips it in <TEXMFLOCAL>
+ (and then does texhash <TEXMFLOCAL>)
+ IT MIGHT BE NEEDED TO RUN IT AS "sudo make installlocal"
+ This depends on how the access rights are configured.
+ In case of doubt run first "make doc" and then "make
+ installlocal". If the latter fails, "sudo make installlocal".
+
+make uninstallhome
+ removes all xint files and repertories from <TEXMFHOME>
+
+make uninstalllocal
+ removes all xint files and repertories from <TEXMFLOCAL>
+ (and then does texhash <TEXMFLOCAL>)
+ IT MIGHT BE NEEDED TO RUN IT AS "sudo make uninstalllocal"
+
+endef
+
+.PHONY: help helpless all extract doc PDF HTML clean cleanall\
+ installhome uninstallhome installlocal uninstalllocal
+
+# for printf with subst and \n, got it from
+# http://stackoverflow.com/a/5887751
+
+# I could do the trick with := here, for \n substitution, but this would add
+# tiny overhead to all other operations of make
+
+help:
+ @printf '$(subst $(newline),\n,$(helptext))' | more
+
+helpless:
+ @printf '$(subst $(newline),\n,$(helptext))' | less
+
+# RM = rm -f
+JF_tmpdir = jfbu_tmp
+TEXMF_local = $(shell kpsewhich -var-value TEXMFLOCAL)
+TEXMF_home = $(shell kpsewhich -var-value TEXMFHOME)
+packages = xintkernel.sty xintcore.sty xint.sty xintfrac.sty xintexpr.sty\
+ xintgcd.sty xintbinhex.sty xintseries.sty xintcfrac.sty\
+ xinttools.sty
+# Makefile.mk is not included in $(extracted). Its extraction rule is in
+# master Makefile file. We can not extract Makefile from xint.dtx via
+# docstrip, as .tex is always appended if a filename with no extension is
+# specified. If "make -f Makefile.mk" is run, Makefile.mk will not be
+# overwritten because tex xint.dtx does not extract it (etex xint.dtx does).
+extracted = $(packages) xint.tex xint.ins README.md CHANGES.md\
+ doHTMLs.sh doPDFs.sh pandoctpl.latex
+doc_pdf = README.pdf CHANGES.pdf
+doc_html = README.html CHANGES.html
+filesfortex = $(packages)
+filesforsource = xint.dtx xint.ins Makefile
+filesfordoc = xint.pdf sourcexint.pdf README $(doc_pdf) $(doc_html)
+xint_cmd = latex -interaction=nonstopmode xint
+sourcexint_cmd = latex -interaction=nonstopmode -jobname=sourcexint\
+ "\chardef\dosourcexint=1 \input{xint}"
+
+all: $(extracted) doc xint.tds.zip
+ @echo 'make all done.'
+
+extract: $(extracted)
+
+$(extracted): xint.dtx
+ tex xint.dtx
+
+doc: xint.pdf sourcexint.pdf README PanPDF PanHTML
+ @echo 'make doc done.'
+
+xint.pdf: xint.dtx xint.tex
+ $(xint_cmd)
+ $(xint_cmd)
+ $(xint_cmd)
+ dvipdfmx xint.dvi && rm xint.dvi
+ @echo 'Warnings of dvipdfmx may presumably be safely ignored,'
+ @echo 'but if the pdf has (font) problems do "pdflatex xint.dtx"'
+
+sourcexint.pdf: xint.dtx xint.tex
+ $(sourcexint_cmd)
+ $(sourcexint_cmd)
+ $(sourcexint_cmd)
+ dvipdfmx sourcexint.dvi && rm sourcexint.dvi
+ @echo 'Warnings of dvipdfmx may presumably be safely ignored,'
+ @echo 'but if the pdf has (font) problems do "pdflatex xint.dtx"'
+
+README: README.md
+ pandoc -t plain -o README README.md
+
+PanPDF: $(doc_pdf)
+
+$(doc_pdf): doPDFs.sh
+ chmod u+x doPDFs.sh && ./doPDFs.sh
+
+PanHTML: $(doc_html)
+
+$(doc_html): doHTMLs.sh
+ chmod u+x doHTMLs.sh && ./doHTMLs.sh
+
+xint.tds.zip: $(filesfordoc) $(filesforsource) $(filesfortex)
+ rm -fr $(JF_tmpdir)
+ mkdir -p $(JF_tmpdir)/doc/generic/xint
+ mkdir -p $(JF_tmpdir)/source/generic/xint
+ mkdir -p $(JF_tmpdir)/tex/generic/xint
+ chmod -R ugo+rwx $(JF_tmpdir)
+ cp -a $(filesfordoc) $(JF_tmpdir)/doc/generic/xint
+ cp -a $(filesforsource) $(JF_tmpdir)/source/generic/xint
+ cp -a $(filesfortex) $(JF_tmpdir)/tex/generic/xint
+ cd $(JF_tmpdir); chmod -R ugo+r doc source tex
+ umask 0022 && cd $(JF_tmpdir) &&\
+ zip -r xint.tds.zip doc source tex &&\
+ mv -f xint.tds.zip ../
+ rm -fr $(JF_tmpdir)
+ @echo 'make xint.tds.zip done.'
+
+xint.zip: $(filesfordoc) $(filesforsource) $(filesfortex) xint.tds.zip
+ mkdir -p $(JF_tmpdir)/xint
+ chmod ugo+rwx $(JF_tmpdir)/xint
+ cp -a $(filesfordoc) $(JF_tmpdir)/xint
+ cp -a $(filesforsource) $(JF_tmpdir)/xint
+ chmod -R ugo+r $(JF_tmpdir)/xint
+ mv xint.tds.zip $(JF_tmpdir)/
+ umask 0022 && cd $(JF_tmpdir) && zip -r xint.zip xint.tds.zip xint
+ mv $(JF_tmpdir)/xint.tds.zip ./
+ mv -f $(JF_tmpdir)/xint.zip ./
+ rm -fr $(JF_tmpdir)
+ @echo 'make xint.zip done.'
+
+installhome: xint.tds.zip
+ unzip xint.tds.zip -d $(TEXMF_home)
+
+uninstallhome:
+ cd $(TEXMF_home) && rm -fr doc/generic/xint \
+ source/generic/xint \
+ tex/generic/xint
+
+# cf http://stackoverflow.com/a/1909390
+# as kpsewhich is very slow (.5s) I want to evaluate once only.
+installlocal: xint.tds.zip
+ $(eval $@_tmp := $(TEXMF_local))
+ unzip xint.tds.zip -d $($@_tmp) && texhash $($@_tmp)
+
+uninstalllocal:
+ cd $(TEXMF_local) && rm -fr doc/generic/xint \
+ source/generic/xint \
+ tex/generic/xint && texhash .
+
+clean:
+ rm -f *.aux *.dvi *.log *.out *.toc
+ rm -fr $(JF_tmpdir)
+
+cleanall: clean
+ rm -f $(extracted) $(doc_pdf) $(doc_html)\
+ README xint.pdf sourcexint.pdf xint.tds.zip
+%</makefile>$------------------------------------------------------
+%<*pandoctpl>-----------------------------------------------------
+$if(dvipdfmx)$
+{\csname @for\endcsname\x:=hyperref,graphicx,color,xcolor\do
+ {\PassOptionsToPackage{dvipdfmx}\x}}
+ \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref}
+ \PassOptionsToPackage{dvipdfm}{geometry}
+$endif$
+\documentclass[$papersize$,fontsize=$fontsize$]{scrartcl}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage[english]{babel}
+
+\usepackage{newtxtext}
+\usepackage{newtxtt}
+\usepackage{newtxmath}
+$if(geometry)$
+\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
+$endif$
+$if(tables)$
+\usepackage{longtable,booktabs}
+$endif$
+\usepackage[unicode=true,bookmarks]{hyperref}
+\hypersetup{breaklinks=true,%
+ pdfauthor={Jean-Fran\c cois Burnol},%
+ pdftitle={$title$ $author$ $date$},%
+ colorlinks=true,%
+ citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,%
+ urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,%
+ linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,%
+ pdfborder={0 0 0},%
+ pdfstartview=FitH,%
+ pdfpagemode=UseOutlines}
+%%\urlstyle{same} % don't use monospace font for urls
+
+\setlength{\parindent}{0pt}
+\setlength{\emergencystretch}{3em} % prevent overfull lines
+\usepackage{enumitem}
+%% reduce LaTeX's insane vertical spacing around verbatim blocks
+\setlength{\parskip}{\medskipamount}
+\setlist[trivlist]{topsep=0pt,partopsep=0pt,itemsep=0pt,parsep=0pt}
+
+$if(numbersections)$
+\setcounter{secnumdepth}{5}
+$else$
+\setcounter{secnumdepth}{0}
+$endif$
+
+$if(etoc)$\usepackage{etoc}$endif$
+
+\title{$title$}
+\author{$author$}
+\date{$date$}
+
+$for(header-includes)$
+$header-includes$
+$endfor$
+
+\begin{document}
+$if(title)$
+\maketitle
+$endif$
+
+$for(include-before)$
+$include-before$
+
+$endfor$
+
+$if(toc)$
+\setcounter{tocdepth}{$toc-depth$}
+$if(etoc)$
+\etocdefaultlines
+\etocmulticolstyle[$etoc$]{}
+$endif$
+\tableofcontents
+$endif$
+
+$body$
+
+$for(include-after)$
+$include-after$
+
+$endfor$
+\end{document}
+%</pandoctpl>-----------------------------------------------------
+%<*dohtmlsh>------------------------------------------------------
+#! /bin/sh
+# produces README.html and CHANGES.html from README.md and CHANGES.md
+# tested with pandoc 1.13.1
+
+pandoc -o README.html -s --toc -V highlighting-css=' body{margin-left : 10%; margin-right : 15%; margin-top: 4ex; font-size: 14pt;}
+ pre {white-space: pre-wrap; }
+ code {white-space: pre-wrap; }
+ .mono {font-family: monospace;}' README.md
+
+pandoc -o CHANGES.html -s --toc -V highlighting-css=' body{margin-left : 10%; margin-right : 15%; margin-top: 4ex; font-size: 14pt;}
+ pre {white-space: pre-wrap;}
+ code {white-space: pre-wrap;}
+ #TOC {float: right; position: relative; top: 100px; margin-bottom: 100px;}' CHANGES.md
+
+%</dohtmlsh>------------------------------------------------------
+%<*dopdfsh>-------------------------------------------------------
+#! /bin/sh
+# produces README.pdf and CHANGES.pdf from README.md and CHANGES.md
+# via latex+dvipdfmx and custom pandoc latex template
+
+pandoc -o README.tex --template=pandoctpl --toc -V papersize=a4paper -V fontsize=11pt -V dvipdfmx --variable=geometry:footskip=1cm,left=2.5cm,right=2.5cm,top=2cm,bottom=3cm -V etoc=1 README.md
+latex -interaction=nonstopmode README
+latex -interaction=nonstopmode README
+latex -interaction=nonstopmode README
+dvipdfmx README.dvi && rm README.dvi
+
+pandoc -o CHANGES.tex --template=pandoctpl --toc -V papersize=a4paper -V fontsize=11pt -V dvipdfmx --variable=geometry:footskip=1cm,left=2.5cm,right=2.5cm,top=2cm,bottom=3cm -V etoc=2 CHANGES.md
+latex -interaction=nonstopmode CHANGES
+latex -interaction=nonstopmode CHANGES
+latex -interaction=nonstopmode CHANGES
+dvipdfmx CHANGES.dvi && rm CHANGES.dvi
+%</dopdfsh>-------------------------------------------------------
+%<*drv>-----------------------------------------------------------
%%
-%% Customize as desired the class options and the two toggles below.
+%% Run latex thrice on this file xint.tex then run dvipdfmx on
+%% xint.dvi to produce the documentation xint.pdf.
%%
-%% See xint.dtx for the copyright and the conditions for distribution
-%% and/or modification of this work.
+%% Or if preferred, run pdflatex (setting of \Withdvipdfmx will be
+%% automatically corrected).
+%% It does not extract Makefile.mk. For this, run rather etex xint.dtx.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{xint.tex}%
-[\xintdate\space v\xintversion\space driver file for xint documentation (jfB)]%
-\PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}
-\chardef\Withdvipdfmx 1 % replace 1<space> by 0<space> for using latex/pdflatex
-\chardef\NoSourceCode 1 % replace 1<space> by 0<space> for source code inclusion
+[\xintbndldate\space v\xintbndlversion\space driver file for xint documentation (jfB)]%
+\PassOptionsToClass{a4paper,fontsize=10pt}{scrdoc}
+\chardef\Withdvipdfmx 1 % 0 for pdflatex or latex+dvips
+\chardef\NoSourceCode 1 % 0 for source code inclusion
\input xint.dtx
%%% Local Variables:
%%% mode: latex
%%% End:
%</drv>----------------------------------------------------------------------
%<*ins>-------------------------------------------------------------------------
-%% This is a generated file.
-%% "tex xint.ins" extracts from xint.dtx:
-%% xinttools.sty, xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty,
-%% xintgcd.sty, xintseries.sty and xintcfrac.sty as well as xint.tex
-%% (for typesetting the documentation).
%%
-%% See xint.dtx for the copyright and the conditions for distribution
-%% and/or modification of this work.
+%% tex xint.ins extracts all package files from xint.dtx, as well as
+%% xint.tex, README.md, CHANGES.md, doPDFs.sh, doHTMLs.sh.
+%%
+%% tex xint.ins does not extract Makefile.mk, but etex xint.ins does
%%
\input docstrip.tex
\askforoverwritefalse
-\generate{\nopreamble
-\file{xint.tex}{\from{xint.dtx}{drv}}
+\generate{\nopreamble\nopostamble
+\file{README.md}{\from{xint.dtx}{readme}}
+\file{CHANGES.md}{\from{xint.dtx}{changes}}
+\file{doHTMLs.sh}{\from{xint.dtx}{dohtmlsh}}
+\file{doPDFs.sh}{\from{xint.dtx}{dopdfsh}}
+\ifx\numexpr\undefined\else\catcode9 11
+ \file{Makefile.mk}{\from{xint.dtx}{makefile}}\fi
\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble
+\file{pandoctpl.latex}{\from{xint.dtx}{pandoctpl}}
+\file{xint.tex}{\from{xint.dtx}{drv}}
+\file{xintkernel.sty}{\from{xint.dtx}{xintkernel}}
\file{xinttools.sty}{\from{xint.dtx}{xinttools}}
+\file{xintcore.sty}{\from{xint.dtx}{xintcore}}
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintbinhex.sty}{\from{xint.dtx}{xintbinhex}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
@@ -184,18 +1269,22 @@
\Msg{* To finish the installation you have to move the following}
\Msg{* files into a directory searched by TeX:}
\Msg{*}
-\Msg{* xinttools.sty}
-\Msg{* xint.sty}
-\Msg{* xintbinhex.sty}
-\Msg{* xintgcd.sty}
-\Msg{* xintfrac.sty}
-\Msg{* xintseries.sty}
-\Msg{* xintcfrac.sty}
-\Msg{* xintexpr.sty}
+\Msg{* xintkernel.sty}
+\Msg{* xintcore.sty}
+\Msg{* xint.sty}
+\Msg{* xintbinhex.sty}
+\Msg{* xintgcd.sty}
+\Msg{* xintfrac.sty}
+\Msg{* xintseries.sty}
+\Msg{* xintcfrac.sty}
+\Msg{* xintexpr.sty}
+\Msg{* xinttools.sty}
\Msg{*}
\Msg{* To produce the documentation run latex thrice on xint.tex}
\Msg{* then dvipdfmx on xint.dvi. Edit xint.tex to get the code}
-\Msg{* source included. (ignore the dvipdfmx warnings)}
+\Msg{* source included.}
+\Msg{* dvipdfmx warnings may be ignored, but if the produced pdf}
+\Msg{* has font problems, run rather pdflatex on xint.tex}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
@@ -203,31 +1292,29 @@
\endbatchfile
%</ins>-------------------------------------------------------------------------
%<*dtx>
-\fi % end of \iffalse block
-\def\striptimestamp #1 <#2 #3 #4>{#2 at #3 #4}
-\def\getdocdate #1 <#2-#3-#4 #5>{#4/#3/#2}
-\edef\docdate{\expandafter\getdocdate\lasttimestamp}
-\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp}
++fi % end of \iffalse block
++catcode`\ 0 \catcode`\+ 12
\chardef\noetex 0
-\expandafter\ifx\csname numexpr\endcsname\relax \chardef\noetex 1 \fi
+\ifx\numexpr\undefined\chardef\noetex 1 \fi
\ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop
\else
- \expandafter\ifx\csname ProvidesFile\endcsname\relax
- \chardef\extractfiles 0 % etex etc.. on xint.dtx
- \else % latex/pdflatex on xint.tex or on xint.dtx
- \expandafter\ifx\csname Withdvipdfmx\endcsname\relax
- % latex run is on etoc.dtx, we will extract all files
- \chardef\extractfiles 1 % 1 = extract all and typeset doc
+ \ifx\ProvidesFile\undefined
+ \chardef\extractfiles 0 % no LaTeX2e. etex, xetex, ... on xint.dtx
+ \else % latex/pdflatex on xint.tex or on xint.dtx
+ \ifx\Withdvipdfmx\undefined
+ % latex run is on xint.dtx, we will extract all files
+ \chardef\extractfiles 1 % 1 = extract and typeset, 2 = only typeset
\chardef\Withdvipdfmx 0 % 0 = pdflatex or latex+dvips, 1 = dvipdfmx
- \chardef\NoSourceCode 1 %
+ \chardef\NoSourceCode 0 % 0 = include source code, 1 = do not
\NeedsTeXFormat{LaTeX2e}%
- \PassOptionsToClass{a4paper,11pt}{scrdoc}%
- \else % latex run is on etoc.tex,
- \chardef\extractfiles 2 % no extractions
+ \PassOptionsToClass{a4paper,fontsize=10pt}{scrdoc}%
+ \else % latex run is on xint.tex,
+ \chardef\extractfiles 2 % no extractions, but typeset
+ % \Withdvipdfmx and \NoSourceCode are set-up there
\fi
- \ProvidesFile{xint.dtx}%
- [bundle source (\xintversion, \xintdate) and documentation (\docdate)]%
- \fi
+ \ProvidesFile{xint.dtx}[bundle source (\xintbndlversion, \xintbndldate) %
+ and documentation (\xintdocdate)]%
+ \fi
\fi
\ifnum\extractfiles<2 % extract files
\def\MessageDeFin{\newlinechar10 \let\Msg\message
@@ -237,7 +1324,8 @@
\Msg{* To finish the installation you have to move the following^^J}%
\Msg{* files into a directory searched by TeX:^^J}%
\Msg{*^^J}%
-\Msg{*\space\space\space\space xinttools.sty^^J}%
+\Msg{*\space\space\space\space xintkernel.sty^^J}%
+\Msg{*\space\space\space\space xintcore.sty^^J}%
\Msg{*\space\space\space\space xint.sty^^J}%
\Msg{*\space\space\space\space xintbinhex.sty^^J}%
\Msg{*\space\space\space\space xintgcd.sty^^J}%
@@ -245,10 +1333,13 @@
\Msg{*\space\space\space\space xintseries.sty^^J}%
\Msg{*\space\space\space\space xintcfrac.sty^^J}%
\Msg{*\space\space\space\space xintexpr.sty^^J}%
+\Msg{*\space\space\space\space xinttools.sty^^J}%
\Msg{*^^J}%
\Msg{* To produce the documentation run latex thrice on xint.tex^^J}%
\Msg{* then dvipdfmx on xint.dvi. Edit xint.tex to get the code^^J}%
-\Msg{* source included. (ignore the dvipdfmx warnings)^^J}%
+\Msg{* source included.^^J}%
+\Msg{* dvipdfmx warnings may be ignored, but if the produced pdf^^J}%
+\Msg{* has font problems, run rather pdflatex on xint.tex^^J}%
\Msg{*^^J}%
\Msg{* Happy TeXing!^^J}%
\Msg{*^^J}%
@@ -257,11 +1348,22 @@
\begingroup
\input docstrip.tex
\askforoverwritefalse
- \generate{\nopreamble
+ \catcode9 11 % do not kill TAB in producing Makefile.mk
+ \generate{\nopreamble\nopostamble
+ \file{README.md}{\from{xint.dtx}{readme}}
+ \file{CHANGES.md}{\from{xint.dtx}{changes}}
+ % pure tex will use ^^I notation for TAB character, don't want that.
+ \ifnum\noetex=0 \file{Makefile.mk}{\from{xint.dtx}{makefile}}\fi
+ \file{doHTMLs.sh}{\from{xint.dtx}{dohtmlsh}}
+ \file{doPDFs.sh}{\from{xint.dtx}{dopdfsh}}
+ \usepreamble\defaultpreamble
+ \usepostamble\defaultpostamble
+ \file{pandoctpl.latex}{\from{xint.dtx}{pandoctpl}}
\file{xint.ins}{\from{xint.dtx}{ins}}
\file{xint.tex}{\from{xint.dtx}{drv}}
- \usepreamble\defaultpreamble
+ \file{xintkernel.sty}{\from{xint.dtx}{xintkernel}}
\file{xinttools.sty}{\from{xint.dtx}{xinttools}}
+ \file{xintcore.sty}{\from{xint.dtx}{xintcore}}
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintbinhex.sty}{\from{xint.dtx}{xintbinhex}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
@@ -270,19 +1372,26 @@
\file{xintcfrac.sty}{\from{xint.dtx}{xintcfrac}}
\file{xintexpr.sty}{\from{xint.dtx}{xintexpr}}}
\endgroup
-\fi % end of file extraction
-\ifnum\extractfiles=0
-% direct tex/etex/xetex/etc on xint.dtx, files now extracted, stop
+\fi % end of file extraction (from etex/latex/pdflatex run on xint.dtx)
+\ifnum\extractfiles=0 % no LaTeX, files now extracted. Stop.
\MessageDeFin\expandafter\end
\fi
-% no use of docstrip to extract files if latex compilation was on etoc.tex
+% From this point on, run is necessarily with e-TeX.
+% Check if \MessageDeFin got defined, if yes put it at end of run.
\ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi
%-------------------------------------------------------------------------------
\documentclass {scrdoc}
+\ifdefined\dosourcexint % this toggle is set by corresponding make rule
+ \chardef\NoSourceCode 0
+\else
+ \chardef\dosourcexint 0
+\fi
\ifnum\NoSourceCode=1 \OnlyDescription\fi
+\usepackage{ifpdf}% also loaded later by other packages (such as xcolor)
+\ifpdf\chardef\Withdvipdfmx 0 \fi
\makeatletter
\ifnum\Withdvipdfmx=1
- \@for\@tempa:=hyperref,bookmark,graphicx,xcolor\do
+ \@for\@tempa:=hyperref,bookmark,graphicx,xcolor,pict2e\do
{\PassOptionsToPackage{dvipdfmx}\@tempa}
%
\PassOptionsToPackage{dvipdfm}{geometry}
@@ -298,31 +1407,6 @@
\pagestyle{headings}
\makeatletter
-% January 4, 2014
-% took me a while to pinpoint yesterday evening the origin of the problem, if
-% only I had visited
-% http://www.komascript.de/release3.12 immediately!
-%
-% as I subscribe to c.t.tex and d.c.t.tex I thought a problem with KOMA scrartcl
-% would have been mentioned there, if as crippling as is this one, so I
-% initially thought something related to TOCs had changed in KOMA and that etoc
-% was now incompatible, and thus I started examining this, until finally
-% understanding this had nothing to do with the TOC but originated in a
-% buggy \sectionmark, revealed with pagestyle headings.
-%
-% This morning I see this is fixed in the experimental archive
-% http://www.komascript.de/~mkohm/texlive-KOMA/archive/ and appears in the
-% CHANGELOG as r1584. It is a bit hard for me to understand why such a typo with
-% big consequences is not yet fixed in the CTAN distributed version. I did waste
-% 90 minutes on that, at a time I was concentrating on xint things. Bugs are
-% unavoidable, especially typos like this originating from modifying earlier
-% code, but this tiny typo is severely annoying to users (*) and in my humble
-% opinion a CTAN update should have been done sooner. Ok, this was a
-% turn-of-year time...
-%
-% (*) compiling old documents is broken, and one sometimes does not want to
-% modify the source files.
-%
\def\buggysectionmark #1{% KOMA 3.12 as released to CTAN December 2013
\if@twoside\expandafter\markboth\else\expandafter\markright\fi
{\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat\fi}{}#1}}{}}
@@ -339,178 +1423,190 @@
%\usepackage{array}
\usepackage{multicol}
-%---- GEOMETRY WILL BE CHANGED FOR SOURCE CODE SECTIONS
-\usepackage[hscale=0.66,vscale=0.75]{geometry}
+\usepackage{geometry}
+% 11 octobre 2014
+\AtBeginDocument {\ttzfamily
+ \newgeometry{textwidth=\dimexpr92\fontcharwd\font`X\relax,
+ vscale=0.75}}
+\unless\ifnum\dosourcexint=1
\usepackage{xintexpr}
-
\usepackage{xintbinhex}
\usepackage{xintgcd}
\usepackage{xintseries}
\usepackage{xintcfrac}
+\usepackage{amsmath} % for use of \cfrac in the documentation
+\usepackage{pifont} % pour la hollow star \ding{73}
+\fi
+
+\usepackage{xinttools}
+
+\usepackage{enumitem}% à partir d'octobre 2014
-\usepackage{amsmath} % for \cfrac in the documentation
\usepackage{varioref}
+%\vrefwarning
\usepackage{etoolbox}
+% Est-ce que je l'utilise vraiment? oui, \ifnumequal dans un \IsPrime
+
+\usepackage{tocloft}% pour la TOC de la section locale du code pour
+% xintexpr, il vaut mieux un look standard, mais je dois customiser la
+% "numwidth", trop petite.
+
\usepackage{etoc}[2013/10/16] % I need \etocdepthtag.toc
%---- USE OF ETOC FOR THE TABLES OF CONTENTS
\def\gobbletodot #1.{}
-% \makeatletter
-% \let\savedsectionline\l@section
-% % (j'avais été fainéant à l'époque, mais le problème c'est que donc je
-% % ne contrôle alors plus directement les paramètres d'espacement verticaux ce
-% % qui rend délicat de synchroniser par exemple les espacements horizontaux
-% % pour section et subsection ou vertical à la fin, etc..)
-% \makeatother
\newif\ifindescription % 1 avril 2014
-\indescriptiontrue
+\ifnum\dosourcexint=0
+ \indescriptiontrue
+\fi
\def\sectioncouleur{{cyan}}
-% attention à ce 22 hard codé. 23 maintenant,... 24; et 31 non 32... et ça
-% continue de changer
-%
-% 1er avril 2014, je fais un vrai style un peu grossier alors qu'avant
-% j'utilisais savedsectionline, par paresse.
+\def\MARGEPAGENO {1.5em}% changera pour la partie implémentation
+
+% 1er avril 2014, je fais un vrai style, un peu grossier cependant,
+% alors qu'avant j'utilisais savedsectionline, par paresse.
+
+% 12 octobre 2014, emploi \llap, \leftmargini et aussi de \MARGEPAGENO ici aussi
\etocsetstyle{section}{}
{\normalfont}
- {% avant: 1 avril 2014, j'avais
- % \savedsectionline{\numberline{\expandafter\textcolor\sectioncouleur
- % {\etocnumber}}\etocname}
- % {{\mdseries\etocpage}}%
- \addvspace{\medskipamount}%
- \noindent
- \rightskip 1.5em
- \parfillskip -1.5em\relax
- \ifnum\etocthenumber=23 \gdef\sectioncouleur{{joli}}\fi
- \ifnum\etocthenumber=31 \gdef\sectioncouleur{[named]{RoyalPurple}}\fi
- \bfseries
- \makebox[2.3em][l]{\expandafter\textcolor\sectioncouleur {\etocnumber}}%
+ {\kern\bigskipamount
+ \rightskip \MARGEPAGENO\relax
+ \parfillskip -\MARGEPAGENO\relax
+ \bfseries
+ \leftskip \leftmargini
+ \noindent\llap % \llap
+ {\makebox[\leftmargini][l]% et \leftmargini le 12/10/2014
+ {\expandafter\textcolor\sectioncouleur {\etocnumber}}}%
\strut\etocname
- \mdseries\nobreak\hfill\nobreak\strut\makebox[1.5em][r]{\etocpage}\par
-% 1 avril 2014
+ \mdseries\nobreak\leaders\etoctoclineleaders\hfill\nobreak\strut
+ \makebox[\MARGEPAGENO][r]{\etocpage}\par
+% pour les sous-sections (1 avril 2014)
\let\ETOCsectionnumber\etocthenumber
-% je pourrais sans doute simplement modifier mon \gobbletodot utilisé dans le
-% style de sous-section, mais c'est qu'il y a la main TOC et les autres. Je fais
-% des styles communs à toutes.
}%
{}%
-\def\MARGEPAGENO {1.5em}
-
+% Octobre 2014: emploi de \leftmargini et ajout de \parskip\z@skip.
+\makeatletter
\etocsetstyle{subsection}
{\begingroup\normalfont
- \setlength{\premulticols}{0pt}
- \setlength{\multicolsep}{0pt}
- \setlength{\columnsep}{1em}
- \setlength{\columnseprule}{.4pt}
- \raggedcolumns % only added for 1.08a, I should have done it long time ago!
+ \setlength{\premulticols}{0pt}%
+ \setlength{\multicolsep}{0pt}%
+ \setlength{\columnsep}{1em}%
+ \setlength{\columnseprule}{.4pt}%
+ % Octobre 2014 mes problèmes d'alors étaient liés à la glue dans \parskip
+ \parskip\z@skip
+ % j'avais seulement ceci avant, je laisse les deux
+ \raggedcolumns
+ \addvspace{\smallskipamount}%
\begin{multicols}{2}
- \leftskip 2.3em
+ \leftskip \leftmargini % 12 octobre 2014
\rightskip \MARGEPAGENO plus 2em minus 1em % 18 octobre 2013
\parfillskip -\MARGEPAGENO\relax
}
{}
{\noindent
- \llap{\makebox[2.3em][l]{\ttfamily\bfseries\etoclink
+ \llap{\makebox[\leftmargini][l]{\ttzfamily\bfseries\etoclink
{\ifindescription\expandafter\textcolor\sectioncouleur
{\normalfont\bfseries\ETOCsectionnumber}\fi
.\expandafter\gobbletodot\etocthenumber}}}%
- \strut\etocname\nobreak\leaders\etoctoclineleaders\hfill\nobreak
- \strut\makebox[1.5em][r]{\small\etocpage}\endgraf }
- {\end{multicols}\endgroup }%
+ \strut\etocname\nobreak
+ \unless\ifindescription\leaders\etoctoclineleaders\fi
+ \hfill\nobreak
+ \strut\makebox[\MARGEPAGENO][r]{\small\etocpage}\endgraf }
+ {\end{multicols}\endgroup\addvspace{\smallskipamount}}%
\makeatother
\addtocontents{toc}{\protect\hypersetup{hidelinks}}
-% je rends le @ actif... après begin document... (donc ok pour aux)
-\addtocontents{toc}{\protect\makeatother}
-%--- TXFONTS: TXTT WILL BE MADE SMALLER AND WILL ALLOW HYPHENATION
-\usepackage{txfonts}
-\usepackage{pifont}
+% Septembre 2014, préparation de la doc pour xint 1.1
+\usepackage[zerostyle=a,scaled=0.95]{newtxtt}
+\usepackage{newtxmath}
-% malheureusement, comme j'utilise des diacritiques dans mes
-% parties commentées, imprimées verbatim, je ne pourrai pas
-% utiliser dvipdfmx qui a un problème avec txtt
+\makeatletter
-\DeclareFontFamily{T1}{txtt}{}
-\DeclareFontShape{T1}{txtt}{m}{n}{ %medium
- <->s*[.96] t1xtt%
-}{}
-\DeclareFontShape{T1}{txtt}{m}{sc}{ %cap & small cap
- <->s*[.96] t1xttsc%
-}{}
-\DeclareFontShape{T1}{txtt}{m}{sl}{ %slanted
- <->s*[.96] t1xttsl%
-}{}
-\DeclareFontShape{T1}{txtt}{m}{it}{ %italic
- <->ssub * txtt/m/sl%
-}{}
-\DeclareFontShape{T1}{txtt}{m}{ui}{ %unslanted italic
- <->ssub * txtt/m/sl%
-}{}
-\DeclareFontShape{T1}{txtt}{bx}{n}{ %bold extended
- <->t1xbtt%
-}{}
-\DeclareFontShape{T1}{txtt}{bx}{sc}{ %bold extended cap & small cap
- <->t1xbttsc%
-}{}
-\DeclareFontShape{T1}{txtt}{bx}{sl}{ %bold extended slanted
- <->t1xbttsl%
-}{}
-\DeclareFontShape{T1}{txtt}{bx}{it}{ %bold extended italic
- <->ssub * txtt/bx/sl%
-}{}
-\DeclareFontShape{T1}{txtt}{bx}{ui}{ %bold extended unslanted italic
- <->ssub * txtt/bx/sl%
-}{}
-\DeclareFontShape{T1}{txtt}{b}{n}{ %bold
- <->ssub * txtt/bx/n%
+% I need also the font with a slashed zero, for verbatim code.
+
+\DeclareFontFamily{T1}{newtxttb}{\hyphenchar\font\m@ne}
+
+\DeclareFontShape{T1}{newtxttb}{m}{n}{
+ <-> s*[\newtxtt@scale]newtxttb
}{}
-\DeclareFontShape{T1}{txtt}{b}{sc}{ %bold cap & small cap
- <->ssub * txtt/bx/sc%
+\DeclareFontShape{T1}{newtxttb}{b}{n}{
+ <-> s*[\newtxtt@scale]newtxbttb
}{}
-\DeclareFontShape{T1}{txtt}{b}{sl}{ %bold slanted
- <->ssub * txtt/bx/sl%
+\DeclareFontShape{T1}{newtxttb}{bx}{n}{
+ <-> ssub * newtxttb/b/n
}{}
-\DeclareFontShape{T1}{txtt}{b}{it}{ %bold italic
- <->ssub * txtt/bx/it%
+\DeclareFontShape{T1}{newtxttb}{m}{sl}{
+ <-> s*[\newtxtt@scale]newtxttslb
}{}
-\DeclareFontShape{T1}{txtt}{b}{ui}{ %bold unslanted italic
- <->ssub * txtt/bx/ui%
+\DeclareFontShape{T1}{newtxttb}{m}{it}{
+ <-> ssub * newtxttb/m/sl
}{}
-\def\digitstt {\bgroup\fontfamily {lmtt}\selectfont\let\next=}
-
+\makeatother
+
+% this is with a slashed 0 like the original txtt.
+\newcommand\ttbfamily {\fontfamily{newtxttb}\selectfont }
+
+% I will leave this old markup here for the time being, in case there
+% is later some use to it.
+% 11 octobre, j'essaie couleur, YellowOrange, CadetBlue
+% \def\digitstt {\bgroup \color[named]{OrangeRed}\let\next=}
+\def\digitstt #1{\begingroup\color[named]{OrangeRed}#1\endgroup}
+
+\let\dtt\digitstt
+
+\ifnum\dosourcexint=1
+\else
+% Septembre 2014 emploi de mathastext
+\renewcommand\familydefault\ttdefault
+\usepackage[noendash]{mathastext}% pas de endahs dans newtxtt
+\fi
+\renewcommand\familydefault\sfdefault % <-- sans-serif in footnotes, TOC,
+ % headers etc...
+
\usepackage{xspace}
-%\usepackage[dvipsnames]{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{framed}
+% 14 octobre 2014
+% copié de snugshade de framed.sty
+\makeatletter
+\newenvironment{snugframed}{%
+% transféré ici 17 octobre
+ \fboxsep \dimexpr2\fontcharwd\font`X\relax
+ \advance\linewidth-2\fboxsep
+ \advance\csname @totalleftmargin\endcsname \fboxsep
+ \def\FrameCommand##1{\hskip\@totalleftmargin
+ \hskip-\fboxsep
+ \fbox{##1}\hskip-\fboxsep
+ % There is no \@totalrightmargin, so:
+ \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \MakeFramed {\advance\hsize-\width \@totalleftmargin\z@ \linewidth\hsize
+ \@setminipage}%
+ }{\par\unskip\@minipagefalse\endMakeFramed}
+\makeatother
+
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\definecolor{BLUE}{RGB}{0,0,255}
\definecolor{niceone}{RGB}{38,128,192}
-% for the quick sort algorithm illustration
-\definecolor{LEFT}{RGB}{216,195,88}
-\definecolor{RIGHT}{RGB}{208,231,153}
-\definecolor{INERT}{RGB}{199,200,194}
-\definecolor{PIVOT}{RGB}{109,8,57}
-
\usepackage[para]{footmisc}
\usepackage[english]{babel}
\usepackage[autolanguage,np]{numprint}
\AtBeginDocument{\npthousandsep{,\hskip .5pt plus .1pt minus .1pt}}
-
\usepackage[pdfencoding=pdfdoc]{hyperref}
+
\hypersetup{%
linktoc=all,%
breaklinks=true,%
@@ -523,14 +1619,18 @@ pdfsubject={Arithmetic with TeX},%
pdfkeywords={Expansion, arithmetic, TeX},%
pdfstartview=FitH,%
pdfpagemode=UseOutlines}
-\usepackage{bookmark}
+
+\ifnum\dosourcexint=1
+\hypersetup{pdftitle={The xint bundle source code}}
+\fi
+
+\usepackage{bookmark}
\usepackage{picture} % permet d'utiliser des unités dans les dimensions de la
% picture et dans \put
\usepackage{graphicx}
\usepackage{eso-pic}
-
%---- \MyMarginNote: a simple macro for some margin notes with no fuss
% je m'aperçois que je peux l'utiliser dans les footnotes...
\makeatletter
@@ -541,32 +1641,33 @@ pdfpagemode=UseOutlines}
\vadjust{\vskip-\dp\strutbox
\smash{\hbox to 0pt
{\color[named]{PineGreen}\normalfont\small
- \hsize 1.5cm\rightskip.5cm minus.5cm
- \hss\vtop{\noindent #2}\ $\to$#1\ }}%
- \vskip\dp\strutbox }\strut{}}
+ \hsize 1.6cm\rightskip.5cm minus.5cm
+ \hss\vtop{\offinterlineskip #2}\ $\to$#1\ }}%
+ \vskip\dp\strutbox }\strut{}}
\def\MyMarginNoteWithBrace #1{%
\vadjust{\vskip-\dp\strutbox
\smash{\hbox to 0pt
- {\color[named]{PineGreen}\normalfont\small
- \hss #1\ $\Bigg\{$\ }}%
- \vskip\dp\strutbox }\strut{}}
-\def\IMPORTANT {\MyMarginNoteWithBrace {IMPORTANT!}}
+ {\color[named]{PineGreen}%\normalfont\small
+ \hss #1\ $\bigg\{$\ }}%
+ \vskip\dp\strutbox }\strut{}}
+\def\IMPORTANT {\MyMarginNoteWithBrace
+ {\raisebox{-.5\height}{\resizebox{2\width}{!}{\ding{43}}}}}
% 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{}}
+ \vskip\dp\strutbox }\strut{}}
\def\retype #1{%
\vadjust{\vskip-\dp\strutbox
\smash{\hbox to 0pt {\hss\color[named]{PineGreen}%
\itshape \xintListWithSep{\,}{#1}\ \ding{73}\quad }}%
- \vskip\dp\strutbox }\strut{}}
+ \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{}}
+ \vskip\dp\strutbox }\strut{}}
%-------------------------------------------------------------------------------
\def\Numf {{\vbox{\halign{\hfil##\hfil\cr \footnotesize
\upshape Num\cr
@@ -588,198 +1689,402 @@ pdfpagemode=UseOutlines}
\normalfont\small
\hsize 1.5cm\rightskip.5cm minus.5cm
\vtop{\noindent New with #1}\ }}%
- \vskip\dp\strutbox }\strut{}}
+ \vskip\dp\strutbox }\strut{}}
\makeatother
-%---- \centeredline: OUR OWN LITTLE MACRO FOR CENTERING LINES
+% \centeredline: OUR OWN LITTLE MACRO FOR CENTERING LINES
+% =======================================================
% 7 mars 2013
+% -----------
+%
% This macro allows to conveniently center a line inside a paragraph and still
-% use therein \verb or other commands changing catcodes.
-% A proposito, the \LaTeX \centerline uses \hsize and not \linewidth !
+% allow use therein of \verb or other commands changing catcodes.
+% A proposito, the \LaTeX \centerline uses \hsize and not \linewidth !
% (which in my humble opinion is bad)
-% \ignorespaces ajouté le 9 juin.
+% Actually my \centeredline works nicely in list environments.
+
+% \ignorespaces ajouté le 9 juin 2013.
+
+% Note: \centeredline creates a group
\makeatletter
\newcommand*\centeredline {%
\ifhmode \\\relax
\def\centeredline@{\hss\egroup\hskip\z@skip\ignorespaces }%
- \else
+ \else
\def\centeredline@{\hss\egroup }%
\fi
\afterassignment\@centeredline
\let\next=}
-\def\@centeredline
+\def\@centeredline
{\hbox to \linewidth \bgroup \hss \bgroup \aftergroup\centeredline@ }
-\makeatother
-%---- MODIFIED \verb, and verbatim like `environments' FITS BETTER OUR USE OF IT
-% le \verb de doc.sty est très chiant car il a retiré \verbatim@font pour mettre
-% un \ttfamily hard-coded à la place. [en fin de compte j'utilise dorénavant le
-% vocable \MicroFont plutôt que \verbatim@font]
-%
-% à propos \do@noligs:
-% macro:#1->\catcode `#1\active \begingroup \lccode `\~=`#1\relax \lowercase
-% {\endgroup \def ~{\leavevmode \kern \z@ \char `#1}}
-% ne manque-t-il pas un espace après le \char `#1? En effet! ça me pose des
-% problèmes lorsque l'espace a catcode 10!! Ils ont voulu optimiser et gagner
-% un token mais du coup ça en limite l'employabilité.
+% 12 octobre 2014
+% ---------------
%
-\def\MicroFont {\ttfamily\hyphenchar\font45 }
-\def\MacroFont {\ttfamily\baselineskip12pt\relax}
-\makeatletter
+% \centeredline-->\leftedline.
+% And I add colored background. I have more sophisticated approaches, but the
+% mark-up was essentially already there, thus I just wanted to exploit the
+% manual from 1.09n for the transition to 1.1.
+%
-% \makestarlowast ajouté le 8 juin 2013
+\newif\ifinlefted
-% 18 octobre 2013, hyphénation dans les blocs verbatim
-\def\dobackslash
-{%
- \catcode92 \active
- \begingroup \lccode `\~=92\relax
- \lowercase {\endgroup \def ~{\hskip \z@\@plus.1pt\@minus.1pt \char 92 }}%
-}%
-\def\dobraces
-{%
- \catcode123 \active
- \begingroup \lccode `\~=123\relax
- \lowercase {\endgroup \def ~{\hskip \z@\@plus.1pt\@minus.1pt
- \char 123 }}%
- \catcode125 \active
- \begingroup \lccode `\~=125\relax
- \lowercase {\endgroup \def ~{\char 125 \hskip \z@\@plus.1pt\@minus.1pt }}%
-}%
-% modif de \do@noligs: \char`#1} --> \char`#1 }
-\def\do@noligs #1%
-{%
- \catcode `#1\active
- \begingroup \lccode `\~=`#1\relax
- \lowercase {\endgroup \def ~{\leavevmode \kern \z@ \char `#1 }}%
-}%
-% *** \verb utilise \MicroFont
-\def\verb
-{%
- \relax \ifmmode\hbox\else\leavevmode\null\fi
- \bgroup \MicroFont
- \let\do\do@noligs \verbatim@nolig@list
- \let\do\@makeother \dospecials \catcode32 10
- \dobackslash
- \dobraces
- \makestarlowast \@jfverb
-}%
+\newcommand*\leftedline {%
+ \ifhmode \\\relax
+ \def\leftedline@{\hss\egroup\hskip\z@skip\ignorespaces }%
+ \else
+ \def\leftedline@{\hss\egroup }%
+ \fi
+ \afterassignment\@leftedline
+ \let\next=}
+\def\@leftedline
+ {\hbox to \linewidth \bgroup \inleftedtrue
+ \everbatimeverypar
+ \bgroup
+ \aftergroup\leftedline@ }
+
+\makeatother
+
+% verbatim environments
+% =====================
+%
+% June 2013, then October 2014.
+% -----------------------------
%
-\long\def\lverb % pour utilisation dans la partie implémentation
-% *** \lverb utilise \MacroFont (comme \verbatim)
-{%
- \relax\par\smallskip\noindent\null
+\makeatletter
+\catcode`_ 11
+
+% some of my verbatim environments do not make the space active (\lverb e.g.). Then
+% \do@noligs must be modified, \char`#1 must be followed by a space token, else,
+% the `#1 expansion will swallow one space.
+\def\do@noligs #1{%
+ \catcode`#1\active
\begingroup
- \let\par\@@par\hbadness 100 \hfuzz 100pt\relax
- \hsize .85\hsize
- \MacroFont
- \bgroup
- \aftergroup\@@par \aftergroup\endgroup \aftergroup\medskip
- \let\do\do@noligs \verbatim@nolig@list
- \let\do\@makeother \dospecials
- \catcode32 10 \catcode`\% 9 \catcode`\& 14 \catcode`\$ 0
- \@jfverb
+ \lccode`~`#1\relax
+ \lowercase{%
+ \endgroup\def~{\leavevmode\kern\z@\char`#1 }}%
}
-% et voilà. Comme quoi, on peut aussi faire sans \trivlist si on veut.
-% Voir aussi la re-définition de \MacroFont au moment du \StopEventually
+
+%--- for soft-wrapping. I will use discretionaries.
+
+\DeclareFontFamily{U}{MdSymbolC}{}
+\DeclareFontShape {U}{MdSymbolC}{m}{n}{<-> MdSymbolC-Regular}{}
+
+\newbox\SoftWrapIcon
+\colorlet {softwrapicon}{blue}
+
+\def\SetSoftWrapIcon{%
+ \setbox\SoftWrapIcon\hb@xt@\z@
+ {\hb@xt@\fontdimen2\font
+ {\hss{\color{softwrapicon}\usefont{U}{MdSymbolC}{m}{n}\char"97}\hss}%
+ \hss}%
+ }
+
+\AtBeginDocument {\SetSoftWrapIcon }% ttzfamily déjà fait
+
+%--- \MacroFont, and a \MicroFont
+%
+% Ne PAS mettre de changement de taille de police dans \MacroFont.
+
+% 17/10/2014, essai avec CadetBlue après Purple. Puis Blue
+
+\def\restoreMicroFont {\def\MicroFont {\ttbfamily\makestarlowast
+ \ifinlefted\else\ifineverb\else\color[named]{Blue}\fi\fi}}
+\restoreMicroFont
+
+\def\restoreMacroFont {\def\MacroFont {\ttbfamily
+ \ifinlefted\else\ifineverb\else\color[named]{Blue}\fi\fi}}
+\restoreMacroFont
+
+% ---- a new \verb
+
+% Initially, June 2013, then Sep 9, 2014, and Oct 9-12 2014
+%
+% Initial motivation was simply that doc.sty and related classes \verb
+% command is with a hard-coded \ttfamily. There were further issues.
+%
+% 1. with |stuff with space|, paragraph reformatting in the Emacs/AUCTeX
+% buffer caused havoc. Thus I wanted to be able to have the input across
+% lines.
%
-% *** \dverb utilise \MacroFont (comme \verbatim)
+% 2. Hence I did not want to have spaces obeyed, as often the
+% reformatting added spaces at the beginning of a line.
%
-% J'ai parfois besoin d'un caractère de contrôle, j'avais dans les premières
-% versions de cette doc utilisé & ou $ mais ceci est devenu très peu commode
-% lorsque j'ai commencé à insérer des tabular. Finalement j'ai fait sans, mais
-% je prends aujourd'hui " qui par miracle est compatible aux emplois de \dverb
-% dans la doc, et va me permettre par exemple d'en colorier des parties, via
-% méthode sioux pour disposer des { et } temporairement.
+% 3. Also I wanted to allow hyphenation on output, at least at some
+% locations. I did a first version which treated spaces, \, {, and }
+% specially.
%
-\long\def\dverb % pour utilisation dans le manuel de l'utilisateur
+% 4. at some point I wanted to add some colored background (I have
+% dropped that since due to pdf file size increase).
+%
+% 5. and also I got fed up from the non-compatibility with footnotes due
+% to catcode freeze.
+%
+% Because of 5. I opted for a \scantokens approach, hence for a macro
+% with delimited argument. Here is what I do now, this is compatible
+% with short verbs.
+
+\def\verb
{%
- \relax\par\smallskip
- \bgroup
- \parindent0pt
- \def\par{\@@par\leavevmode\null}%
- \let\do\do@noligs \verbatim@nolig@list
- \let\do\@makeother \dospecials
- \def\"{\begingroup\catcode123 1 \catcode 125 2 \dverbescape}%
- \catcode`\@ 14 \catcode`\" 0 \makestarlowast
- \MacroFont \obeylines \@vobeyspaces
- \@jfverb
+ \relax \ifmmode\else\leavevmode\null\fi
+ \bgroup
+ \let\do\@makeother \dospecials
+ \MicroFont % change font, color, catcode hooks, ...
+ \catcode 32 10
+ \endlinechar 32
+ \@@jfverb
+}%
+% Note (Oct 12, 2014): in the improbable situation a newlinechar is
+% found in the ##1, \scantokens will convert this to an end of line in
+% its "write" phase, which will be then ignored in its "read" phase due
+% to \endlinechar-1. This also avoids possible creation of \par which
+% would defeat \@@jfverb@@. Thus it is good.
+\def\@@jfverb #1{%
+ \ifcat\noexpand#1\noexpand~\catcode`#1\active\fi
+% No problem with the EOL for the line where the short verb delimiter stands.
+ \def\next ##1#1{%
+ \@vobeyspaces\everyeof{\relax}\endlinechar\m@ne
+ \expandafter\@@jfverb_a\scantokens\expandafter{##1}}%
+% hack with \@empty to prevent brace stripping if catcodes had been
+% frozen earlier, like in footnotes.
+ \next \@empty
}
-\def\dverbescape #1;!{#1\endgroup }
-\def\@jfverb #1{\catcode`#1\active
- \lccode`\~`#1\lowercase{\let~\egroup}}%
+% We don't want a \discretionary at the very start.
+% But then an empty argument is forbidden!
+\def\@@jfverb_a #1{#1\@@jfverb_b }
+
+\def\@@jfverb_b #1{\ifx\relax #1%
+ \egroup
+ \else
+% \penalty\z@, or rather (Oct 11, 2014) but I then adjust the textwidth
+% precisely:
+ \discretionary{\copy\SoftWrapIcon}{}{}%
+ #1\expandafter\@@jfverb_b\fi
+}
+
+\catcode`_ 8
\makeatother
-\catcode`\_=11
-
-\def\csa_aux #1{\ttfamily\hyphenchar\font45 \char`\\%
- \scantokens{#1}\endgroup }
-\def\csb_aux #1{\hyperref[\detokenize{xint#1}]{\ttfamily
- \hyphenchar\font45 \char`\\\mbox{xint}\-%
- \scantokens{#1}}\endgroup }
-
-\DeclareRobustCommand\csa {\begingroup\catcode`\_=11
- \everyeof{\noexpand}\endlinechar -1
- \makeatother
- \makestarlowast
- \csa_aux }
-\DeclareRobustCommand\csbnolk {\begingroup\catcode`\_=11
- \everyeof{\noexpand}\endlinechar -1
- \makestarlowast
- \makeatother
- \color{blue}%
- \csa_aux }
-\DeclareRobustCommand\csbxint {\begingroup\catcode`\_=11
- \everyeof{\noexpand}\endlinechar -1
- \makestarlowast
- \makeatother
- \csb_aux }
-\catcode`\_=8
-
-\newcommand\csh[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
-\newcommand\csbh[1]{\texorpdfstring{\csbnolk{#1}}{\textbackslash #1}}
-
-% emploi de \xintFor à partir de 1.09c
-% There were some color leaks in 1.09i from dvipdfmx (not pdflatex) compilation,
-% due to missing braces around use of \color, I have now added them.
-\xintForpair #1#2 in
-{(xinttools,tools),(xint,xint),(xintbinhex,binhex),(xintgcd,gcd),%
+%--- everbatim environment
+% October 13-14, 2014
+% Verbatim with an \everypar hook, mainly to have background color, followed by
+% execution of the code
+
+\makeatletter
+\catcode`_ 11
+
+\def\everbatimxprehook {\colorlet{everbsavedcolor}{.}\color[named]{OrangeRed}}
+\def\everbatimxposthook {\color{everbsavedcolor}}
+% \def\everbatimxprehook {}
+% \def\everbatimxposthook {}
+
+\def\everbatimtop {\MacroFont\small }
+\let\everbatimbottom\relax
+\let\everbatimhook\relax
+
+\newif\ifineverb
+
+\def\everbatim {\s@everbatim\@everbatim }
+\@namedef{everbatim*}{\s@everbatim\expandafter\@everbatimx\expandafter
+ {\the\newlinechar}}
+
+\def\everbatimeverypar{\strut
+ {\color{yellow!5}\vrule\@width\linewidth }%
+ \kern-\linewidth
+ \kern\everbatimindent }
+\def\everbatimindent {\z@}
+% voir plus loin atbegindocument
+
+\def\endeverbatim {\if@newlist \leavevmode\fi\endtrivlist }
+\expandafter\let\csname endeverbatim*\endcsname \endeverbatim
+
+\def\s@everbatim {%
+ \ineverbtrue
+ \everbatimtop % put there size changes
+ \topsep \z@skip
+ \partopsep \z@skip
+ \itemsep \z@skip
+ \parsep \z@skip
+ \parskip \z@skip
+ \lineskip \z@skip
+ \let\do\@makeother \dospecials
+ \let\do\do@noligs \verbatim@nolig@list
+ \makestarlowast
+ \everbatimhook
+ \trivlist\item\relax
+ \leftskip \@totalleftmargin
+ \rightskip \z@skip
+ \parindent \z@
+ \parfillskip\@flushglue
+ \parskip \z@skip
+ \@@par
+ \def\par{\leavevmode\null\@@par\pagebreak[1]}%
+ \everypar\expandafter{\the\everypar \unpenalty
+ \everbatimeverypar
+ \everypar \expandafter{\the\everypar\everbatimeverypar}%
+ }%
+ \obeylines \@vobeyspaces
+}
+
+\begingroup
+\lccode`X 13
+\catcode`X \active
+\lccode`Y `* % this is because of \makestarlowast.
+% I have to think whether this is useful: obviously if I were to provide
+% everbatim and everbatim* in a package I wouldn't do that.
+\catcode`Y \active
+\catcode`| 0 \catcode`[ 1 \catcode`] 2 \catcode`* 12
+\catcode`{ 12 \catcode`} 12 |catcode`\\ 12
+|lowercase[|endgroup% both freezes catcodes and converts X to active ^^M
+|def|@everbatim #1X#2\end{everbatim}%
+ [#2|end[everbatim]|everbatimbottom ]
+|def|@everbatimx #1#2X#3\end{everbatimY}]%
+ {#3\end{everbatim*}%
+ \everbatimbottom
+ % No group here: this allows executed code to make macro
+ % definitions which may reused in later uses of everbatim.
+ \newlinechar 13
+ % Indentation of next paragraph produced from execution of #3 is
+ % suppressed, if #3 by itself or \everbatimbottom does no \par,
+ % from \@endparenv done by \endtrivlist
+ \everbatimxprehook
+ \scantokens {#3}% there will typically be an EOL space after this if one
+ % continues after \end{everbatim} on same line, which
+ % is allowed.
+ \newlinechar #1\relax % restores \newlinechar to previous value.
+ \everbatimxposthook
+}%
+
+
+% L'espace venant du endofline final mis par \scantokens sera inhibé si #3 se
+% termine par un % ou un \x, etc...
+
+% --- \everb
+% Original was called \dverb and I did it in June 2013.
+% Then after doing everbatim, I transformed \dverb, now called \everb
+% for itself being as compatible as standard verbatim with list making
+% surrounding environments.
+% Supposed to be used as
+% \everb|@ this will be ignored
+% stuff
+% escape character: "
+% | not necessarily starting a line.
+% I chose @ as comment character, mainly for pretty-formatting of the
+% source, this can be changed by \everbhook.
+
+% " comme caractère d'échappement. Par exemple pour colorier des parties.
+\def\restoreeverbhook{\def\everbhook{%
+ \def\"{\begingroup\catcode123 1 \catcode 125 2 \everbescape }%
+ \catcode`\" 0 \catcode`\@ 14
+}}\restoreeverbhook
+
+\def\everbescape #1;!{#1\endgroup }
+
+\def\everb {%
+ \bgroup
+ \let\everbatimhook\everbhook
+ \s@everbatim
+ \@everb
+}
+
+\def\@everb #1{\catcode`#1\active
+ \lccode`\~`#1%
+ \lowercase{\def~{\if@newlist \leavevmode\fi
+ \endtrivlist
+ \egroup
+ \@doendpe
+ \everbatimbottom }}%
+ }%
+
+
+\catcode`_8
+\makeatother
+
+%--- \csa, \csbxint, \csh, \csbh
+% dates back to earliest versions of this manual, but I changed things a bit
+% (back then for example @ was active throughout the document...)
+% The mark-up being in place, I only have to use it here.
+
+\DeclareRobustCommand\csa [1]
+ {{\MicroFont\char92\detokenize{#1}}}
+
+\DeclareRobustCommand\csbnolk [1]
+ {{\MicroFont\color{blue}\char92\detokenize{#1}}}
+
+\DeclareRobustCommand\csbxint [1]
+ {\hyperref[\detokenize{xint#1}]%
+ {{\ttzfamily\char92\mbox{xint}\-\detokenize{#1}}}}
+
+\newcommand\csh[1]
+ {\texorpdfstring{\csa{#1}}{\textbackslash\detokenize{#1}}}
+\newcommand\csbh[1]
+ {\texorpdfstring{\csbnolk{#1}}{\textbackslash\detokenize{#1}}}
+
+%--- octobre 2014
+% Je dois faire des routines spéciales pour xintFor*, pour ne pas avoir à
+% traiter en général l'activation du *
+\DeclareRobustCommand\csaxintForstar {{\ttzfamily\char92xintFor\lowast}}
+
+\DeclareRobustCommand\csbnolkxintForstar
+ {{\color{blue}\ttzfamily\char92xintFor\lowast}}
+
+\DeclareRobustCommand\csbxintForstar {\hyperref[xintFor*]
+ {{\ttzfamily\char92\mbox{xint}\-For\lowast}}}
+
+\def\cshxintForstar {\texorpdfstring
+ {\csaxintForstar}
+ {\textbackslash xintFor*}}
+
+\def\csbhxintForstar {\texorpdfstring
+ {\csbnolkxintForstar}
+ {\textbackslash xintFor*}}
+
+%--- \xintname, \xintnameimp etc...
+\xintForpair #1#2 in
+{(xintkernel,kernel),
+ (xinttools,tools),
+ (xintcore,core),(xint,xint),(xintbinhex,binhex),(xintgcd,gcd),%
(xintfrac,frac),(xintseries,series),(xintcfrac,cfrac),(xintexpr,expr)}
\do
{%
\expandafter\def\csname #1name\endcsname
{\texorpdfstring
{\hyperref[sec:#2]%
- {{\color{joli}\bfseries\ttfamily\hyphenchar\font45 #1}}}
+ {{\color{joli}\ttzfamily #1}}}
{#1}%
\xspace }%
\expandafter\def\csname #1nameimp\endcsname
{\texorpdfstring
{\hyperref[sec:#2imp]%
- {{\color[named]{RoyalPurple}%
- \bfseries\ttfamily\hyphenchar\font45 #1}}}
+ {{\color[named]{RoyalPurple}\ttzfamily #1}}}
{#1}%
\xspace }%
}%
-\frenchspacing
-\renewcommand\familydefault\sfdefault
+%--- \printnumber
+% new version, october 11, 2014
+\catcode`_ 11
+\makeatletter
+\hyphenpenalty \z@
-%---- QUICK WAY TO PRINT LONG THINGS, IN PARTICULAR, BUT NOT EXCLUSIVELY, LONG
-% NUMBERS
-\def\allowsplits #1%
-{%
- \ifx #1\relax \else #1\hskip 0pt plus 1pt\relax
- \expandafter\allowsplits\fi
-}%
-\def\printnumber #1% first ``fully'' expands its argument.
-{\expandafter\allowsplits \romannumeral-`0#1\relax }%
+\def\allowsplits_a #1{\ifx \relax #1\xint_dothis\xint_gobble_i\fi
+ \if ,#1\xint_dothis {\discretionary{\rlap,}{}{,} }\fi
+ \xint_orthat{\discretionary
+ {\copy\SoftWrapIcon}%
+ {}%
+ {}#1}\allowsplits_a }%
+
+\def\allowsplits #1{#1\allowsplits_a}% évite un discretionary au premier.
+
+\def\printnumber #1{\expandafter\allowsplits \romannumeral-`0#1\relax }%
+\makeatother
+\catcode`_ 8
%--- counts used in particular in the samples from the documentation of the
% xintseries.sty package
@@ -787,23 +2092,90 @@ pdfpagemode=UseOutlines}
\newcount\cntb
\newcount\cntc
-%--- printing (systematically) * in a lowered position in the various verbatim
-% blocks using txtt.
-
+%--- \lowast
\def\lowast{\raisebox{-.25\height}{*}}
\begingroup
\catcode`* 13
\gdef\makestarlowast {\let*\lowast\catcode`\*\active}%
\endgroup
-% 22 octobre 2013
+%--- \fexpan 22 octobre 2013
\newcommand\fexpan {\textit{f}-expan}
+\ifnum\dosourcexint=1
+\else
+% Dependency graph done using TikZ (manually)
+ \usepackage{tikz}
+ \usetikzlibrary{shapes,arrows}
+\fi
+
+\colorlet {codeboxbg}{yellow!10}
+\colorlet {codeboxframe}{black!30}
+\colorlet {execboxfringe}{black!10}
+
+% 12 octobre 2014
+\AtBeginDocument{%
+ \leftmargini \dimexpr4\fontcharwd\font`X\relax
+ \leftmarginii\dimexpr3\fontcharwd\font`X\relax
+ \leftmarginiii \leftmarginii
+ \leftmarginiv \leftmarginii
+ \parindent\dimexpr2\fontcharwd\font`X\relax
+ \leftmargin\leftmargini % pourquoi pas 0?
+% attention à un deuxième relax!
+%\advance\linewidth\dimexpr-\everbatimindent-\everbatimindent\relax
+% était alors bogué!
+ \edef\everbatimindent{\the\dimexpr\leftmargini\relax\space }%
+ \cftsubsecnumwidth 2\leftmarginii
+ \cftsubsubsecnumwidth 2\leftmargini
+ \cftsubsecindent 0pt
+ \cftsubsubsecindent \cftsubsecnumwidth
+}%
+
+%--- CodeBox
+
+\frenchspacing
+\renewcommand\familydefault\sfdefault
+
+\begin{document}\thispagestyle{empty}% \ttzfamily already done
+\pdfbookmark[1]{Title page}{TOP}
+% \makeatletter % @ n'est plus actif dans dtx 1.1, ouf!
+
+{%
+\normalfont\Large\parindent0pt \parfillskip 0pt\relax
+ \leftskip 2cm plus 1fil \rightskip 2cm plus 1fil
+\ifnum\dosourcexint=1
+ The \xintnameimp source code\par
+\else
+ The \xintname bundle\par
+\fi
+}
+
+{\centering
+ \textsc{Jean-François Burnol}\par
+ \footnotesize
+ jfbu (at) free (dot) fr\par
+ Package version: \xintbndlversion\ (\xintbndldate);
+ documentation date: \xintdocdate.\par
+ {From source file \texttt{xint.dtx}. \xintdtxtimestamp.}\par
+}
+
+\bigskip
+
+% Mercredi 08 octobre 2014 à 22:03:19
+% Skips safely.
+\ifnum\dosourcexint=1
+\catcode`+ 0
+\catcode`\\ 12
++expandafter+iffalse+fi
+\fi
+
+% ----
+% Fibonacci code
% December 7, 2013. Expandably computing a big Fibonacci number
% with the help of TeX+\numexpr+\xintexpr, (c) Jean-François Burnol
\catcode`_ 11
%
-% ajouté 7 janvier 2014 au xint.dtx pour 1.07j.
+% ajouté 7 janvier 2014 au xint.dtx pour 1.07j.
%
% Le 17 janvier je me décide de simplifier l'algorithme car l'original ne tenait
% pas compte de la relation toujours vraie A=B+C dans les matrices symétriques
@@ -825,7 +2197,7 @@ pdfpagemode=UseOutlines}
\expandafter\Fibonacci_end_i
\or
\expandafter\Fibonacci_end_ii
- \else
+ \else
\ifodd #1
\expandafter\expandafter\expandafter\Fibonacci_b_ii
\else
@@ -838,7 +2210,7 @@ pdfpagemode=UseOutlines}
{\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval (2#2-#3)#3\relax}%
}% end of Fibonacci_b_i
-\def\Fibonacci_b_ii #1#2#3#4#5{\expandafter\Fibonacci_a\expandafter
+\def\Fibonacci_b_ii #1#2#3#4#5{\expandafter\Fibonacci_a\expandafter
{\the\numexpr (#1-1)/2\expandafter}\expandafter
{\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval (2#2-#3)#3\expandafter\relax\expandafter}\expandafter
@@ -851,24 +2223,12 @@ pdfpagemode=UseOutlines}
\def\Fibo #1.{\Fibonacci {#1}}
-\begin{document}\thispagestyle{empty}\rmfamily
-\pdfbookmark[1]{Title page}{TOP}
-\makeatletter
-
-\begingroup\lccode`\~=`@
-\lowercase{\endgroup\def~}{\begingroup\fontfamily{lmtt}\selectfont
- \let\do\@makeother\dospecials
- \catcode`\@ \active
- \jfendshrtverb }
-\catcode`\@ \active
-\def\jfendshrtverb #1@{#1\endgroup }
-
% nice background added for 1.09j release, January 7, 2014.
% superbe, non? moi très content!
% bon je peaufine ce background le 17 janvier, c'est hard-coded mais je ne veux
% pas y passer plus de temps (ce qui est amusant c'est que j'ai constaté a
% posteriori qu'il y a 17 chiffres par lignes donc 1 chiffre avec son padding =
-% 1cm...
+% 1cm...
% *\message{\xinttheexpr round(\dimexpr 8cm\relax/17,3)\relax}
% 877496.353
\def\specialprintone #1%
@@ -877,172 +2237,86 @@ pdfpagemode=UseOutlines}
\expandafter\specialprintone\fi
}%
\def\specialprintnumber #1% first ``fully'' expands its argument.
-{\expandafter\specialprintone \romannumeral-`0#1\relax }%
+{\expandafter\specialprintone \romannumeral-`0#1\relax }%
\AddToShipoutPicture*{%
\put(10.5cm,14.85cm)
{\makebox(0,0)
{\resizebox{17cm}{!}{\vbox
{\hsize 8cm\Huge\baselineskip.8\baselineskip\color{black!10}%
- \digitstt{\specialprintnumber{F(1250)=}%
- \specialprintnumber{\Fibonacci{1250}}}\par}}%
- }
+ \specialprintnumber{F(1250)=}%
+ \specialprintnumber{\Fibonacci{1250}}}\par}%
+ }%
}%
}
-% Octobre 2013: le & est devenu assez pénible puisque j'en ai besoin dans mes
-% exemples de \xintApplyInline/\xintFor avec des tabulars. Donc je décide
-% (après avoir temporairement fait des choses un peu lourdes avec \lverb) de
-% le remplacer par @ car il n'y en a quasi pas dans la partie user manual;
-% idem pour \dverb. Cependant je dois faire attention avec un @ actif par
-% exemple dans les tables de matières. Bon on va voir.
-
-{\normalfont\Large\parindent0pt \parfillskip 0pt\relax
- \leftskip 2cm plus 1fil \rightskip 2cm plus 1fil
- The \xintname bundle\par}%
-{\centering
- \textsc{Jean-François Burnol}\par
- \footnotesize \ttfamily
- jfbu (at) free (dot) fr\par
- Package version: \xintversion\ (\xintdate)%
- \let\thefootnote\empty
- \footnote{Documentation generated from the
- source file with timestamp ``\dtxtimestamp''.}\par
-}
-\setcounter{footnote}{0}
-
-\bigskip
-
-% comme \dverb ne fait pas un \par à la fin, il y a un problème avec le
-% \baselineskip si on ne le spécifie pas en plus; il faudra que je voie si
-% vraiment j'utilise \dverb sans terminer un paragraphe, il doit y avoir au plus
-% quelque cas.
-\begingroup\footnotesize\def\MacroFont {\ttfamily\baselineskip10pt\relax}
-\baselineskip 10pt
-\dverb|@
-\input xintexpr.sty
-% December 7, 2013. Expandably computing a big Fibonacci number
-% using TeX+\numexpr+\xintexpr, (c) Jean-François Burnol
-% January 17, 2014: algorithm modified to be more economical in computations.
-
-\catcode`_ 11
-
-\def\Fibonacci #1{%
- \expandafter\Fibonacci_a\expandafter
- {\the\numexpr #1\expandafter}\expandafter
- {\romannumeral0\xintiieval 1\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval 1\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval 1\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval 0\relax}}
-
-\def\Fibonacci_a #1{%
- \ifcase #1
- \expandafter\Fibonacci_end_i
- \or
- \expandafter\Fibonacci_end_ii
- \else
- \ifodd #1
- \expandafter\expandafter\expandafter\Fibonacci_b_ii
- \else
- \expandafter\expandafter\expandafter\Fibonacci_b_i
- \fi
- \fi {#1}%
-}%
-
-\def\Fibonacci_b_i #1#2#3{\expandafter\Fibonacci_a\expandafter
- {\the\numexpr #1/2\expandafter}\expandafter
- {\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval (2*#2-#3)*#3\relax}%
-}% end of Fibonacci_b_i
-
-\def\Fibonacci_b_ii #1#2#3#4#5{\expandafter\Fibonacci_a\expandafter
- {\the\numexpr (#1-1)/2\expandafter}\expandafter
- {\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval (2*#2-#3)*#3\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval #2*#4+#3*#5\expandafter\relax\expandafter}\expandafter
- {\romannumeral0\xintiieval #2*#5+#3*(#4-#5)\relax}%
-}% end of Fibonacci_b_ii
-
-\def\Fibonacci_end_i #1#2#3#4#5{\xintthe#5}
-\def\Fibonacci_end_ii #1#2#3#4#5{\xinttheiiexpr #2*#5+#3*(#4-#5)\relax}
-
-\catcode`_ 8
-
-% This \Fibonacci macro is designed to compute *one* Fibonacci number, not a
-% whole sequence of them. Let's reap the fruits of our work:
-
-\message{F(1250)=\Fibonacci {1250}}
-\bye |\ttfamily\% see \autoref{ssec:fibonacci} for some explanations and
-more.\par
-\endgroup
-
-\clearpage
-
-% \pagebreak[3]
-
-\pdfbookmark[1]{Abstract}{ABSTRACT}
-
-\begin{addmargin}{1cm}\footnotesize
- \begin{center} \bfseries\large Description of the packages\par\smallskip
- \end{center}\medskip
-\makeatletter
-\renewenvironment{description}
- {\list{}{\topsep\z@ \parsep\z@ \labelwidth\z@ \itemindent-\leftmargin
- \let\makelabel\descriptionlabel}}
- {\endlist}
-\makeatother
-\begin{description}
-\item[\xinttoolsname] is loaded by \xintname (hence by all other packages of the
- bundle, too): it provides utilities of independent interest such as expandable
- and non-expandable loops.
-
-\item[\xintname] implements with expandable \TeX{} macros additions,
- subtractions, multiplications, divisions and powers with arbitrarily long
- numbers.
-
-\item[\xintfracname] extends the scope of \xintname to decimal numbers, to
- numbers in scientific notation and also to fractions with arbitrarily
- long such numerators and denominators separated by a forward slash.
-
-\item[\xintexprname] extends \xintfracname with an expandable parser |\xintexpr
- . . . \relax| of expressions involving arithmetic operations in infix notation
- on decimal numbers, fractions, numbers in scientific notation, with
- parentheses, factorial symbol, function names, comparison operators, logic
- operators, twofold and threefold way conditionals, sub-expressions, macros
- expanding to the previous items.
-\end{description}
-
-\noindent Further modules:
-%
-\begin{description}
-\item[\xintbinhexname] is for conversions to and from binary and
- hexadecimal bases.
-
-\item[\xintseriesname] provides some basic functionality for computing in an
- expandable manner partial sums of series and power series with fractional
- coefficients.
-
-\item[\xintgcdname] implements the Euclidean algorithm and its typesetting.
-
-\item[\xintcfracname] deals with the computation of continued fractions.
-\end{description}
+% Samedi 27 septembre 2014 à 16:04:52
+\pdfbookmark[1]{Dependency graph}{DependencyGraph}
- Most macros, and all of those doing computations, work purely by expansion
- without assignments, and may thus be used almost everywhere in \TeX{}.
+\tikzstyle{block} = [rectangle, draw,
+ fill=codeboxbg,
+ fill opacity=0.5,% fill opacity Octobre 2014
+ draw=codeboxframe,
+ line width=2pt,
+ text width=6em, text centered, rounded corners, minimum height=4em]
+\tikzstyle{line} = [draw, line width=1pt, color=codeboxframe]
- The packages may be used with any flavor of \TeX{} supporting the \eTeX{}
- extensions. \LaTeX{} users will use |\usepackage| and others |\input| to
- load the package components.
+\vspace{2\baselineskip}
+\begin{figure}[ht!]
+ \phantomsection\label{dependencygraph}
+\centeredline{%
+\begin{tikzpicture}[node distance = 2.5cm]
+ % Place nodes
+ \node [block] (kernel) {xintkernel};
+ \node [left of=kernel] (A) {};
+ \node [right of=kernel] (B) {};
+ \node [block, below right of=B] (core) {\xintcorename};
+ \node [block, below left of=A] (tools) {\xinttoolsname};
+ \node [block, right of=core, xshift=1cm] (bnumexpr) {\href{http://www.ctan.org/pkg/bnumexpr}{bnumexpr}};
+ \node [block, below of=core] (xint) {\xintname};
+ \node [block, left of=xint, xshift=-.5cm] (binhex) {\xintbinhexname};
+ \node [block, left of=binhex] (gcd) {\xintgcdname};
+ \node [block, below of=xint] (frac) {\xintfracname};
+ \node [block, below of=frac, yshift=-.5cm] (expr) {\xintexprname};
+ \node [block, below right of=frac, xshift=1cm] (cfrac) {\xintcfracname};
+ \node [block, right of=cfrac] (series) {\xintseriesname};
+ % Draw edges
+ \path [line] (kernel) -- (core);
+ \path [line] (kernel) -- (tools);
+ \path [line] (core) -- (bnumexpr);
+ \path [line] (core) -- (gcd.north);
+ \path [line] (core) -- (binhex.north);
+ \path [line] (core) -- (xint);
+ \path [line] (xint) -- (frac);
+ \path [line] (frac) -- (expr);
+ \path [line] (frac) -- (series.north);
+ \path [line] (frac) -- (cfrac.north);
+ \path [line,dashed] (binhex.south) -- (expr);
+ \path [line,dashed] (gcd.south) -- (expr);
+ \path [line,dashed] (tools) -- (gcd);
+ \path [line] (tools) to [out=270,in=180] (expr);
+ \end{tikzpicture}}\bigskip
+\end{figure}
+
+\vspace{2\baselineskip}
+
+\begin{addmargin}{2cm}
+\normalfont\footnotesize Dependency graph for the
+ \xintname bundle components: modules at the bottom import modules at the
+ top when connected by a continuous line. No module will be loaded twice,
+ this is managed internally under Plain as well as \LaTeX. Dashed lines
+ indicate a partial dependency, and to enable the corresponding
+ functionalities of the lower module it is necessary for the user to issue
+ the suitable |\usepackage{top_module}| in the
+ preamble (or |\input top_module.sty\relax| in Plain
+ \TeX). The \href{http://ctan.org/pkg/bnumexpr}{bnumexpr} package is a
+ separate package (\LaTeX{} only) by the author.\par
\end{addmargin}
-\bigskip
-
-% \clearpage
-% 18 octobre 2013, je remets la TOC ici.
+\vfill
-% je ne veux pas non plus que la main toc se liste elle-même donc je passe pour
-% elle aussi à \section*
+\clearpage
\etocsetlevel{toctobookmark}{6} % 9 octobre 2013, je fais des petits tricks.
@@ -1060,90 +2334,242 @@ more.\par
\etoctoccontentsline*{toctobookmark}{Contents}{1}%
}
\etocsettagdepth {description}{subsection}
- \etocsettagdepth {commandsA} {none}
- \etocsettagdepth {xintexpr} {none}
- \etocsettagdepth {commandsB} {none}
+ \etocsettagdepth {commands} {none}
\etocsettagdepth {implementation}{none}
\tableofcontents
-%original: \newcommand*\etocabovetocskip{3.5ex plus 1ex minus .2ex}
-\renewcommand*\etocabovetocskip{\medskipamount}
-\etocmulticolstyle [2]{\raggedcolumns}
+\renewcommand*\etocabovetocskip{\bigskipamount}
+\makeatletter
+\etocmulticolstyle [2]{\parskip\z@skip\raggedcolumns }%
+\makeatother
\etocsettagdepth {description}{none}
- \etocsettagdepth {commandsA} {section}
- \etocsettagdepth {xintexpr} {section}
- \etocsettagdepth {commandsB} {section}
-\ifnum\NoSourceCode=0
- \etocsettagdepth {implementation}{section}
-\else
+ \etocsettagdepth {commands} {section}
+\ifnum\NoSourceCode=1
\etocsettagdepth {implementation}{none}
+\else
+ \etocsettagdepth {implementation}{section}
\fi
\tableofcontents
-% \medskip
-% pour la suite:
+% pour la suite: [voir aussi juste avant la section Commandes de xint]
+% 12 octobre 2014, je supprime tous les "Contents", maintenant que les
+% TOC sont déplacées vers immédiatement après le titre de la section.
\etocignoredepthtags
\etocmulticolstyle [1]{%
- \phantomsection\section* {Contents}
+ \phantomsection% \section* {Contents}
\etoctoccontentsline*{toctobookmark}{Contents}{2}%
}
\etocdepthtag.toc {description}
-% \pdfbookmark[1]{Snapshot}{SNAPSHOT}
+\section{Read this first}\label{sec:quickintro}
-\section{Read me first}\label{sec:quickintro}
+This section provides recommended reading on first discovering the package.
-This section provides recommended reading on first discovering the package;
-complete details are given later in the manual.
+% local TOC supprimée 12 octobre 2014
+% finalement non, car LaTeX laisse un énorme vide au bas de la page à la
+% place!!! Bon, je ne le mets que s'il y a la place.
+\ifnum\NoSourceCode=1
{\etocdefaultlines\etocsettocstyle{}{}\localtableofcontents}
+\fi
-\subsection{Presentation of the package}
+\subsection{Installation instructions}
+\label{ssec:install}
+
+\xintname is made available under the
+\href{http://www.latex-project.org/lppl/lppl-1-3c.txt}{LaTeX Project Public
+ License 1.3c} (or any later version). It is included in the major \TeX\
+distributions, thus there is probably no need for a custom install: just use
+the package manager to update if necessary \xintname to the latest version
+available.
+
+After installation, issuing in terminal |texdoc --list xint|, on installations
+with a |"texdoc"| or similar utility, will offer the choice to display one of
+the documentation files: |xint.pdf| (this file), |sourcexint.pdf| (source
+code), |README|, |README.pdf|, |README.html|, |CHANGES.pdf|, and
+|CHANGES.html|.
+
+For manual installation, follow the instructions from the |README| file which
+is to be found on \href{http://www.ctan.org/pkg/xint}{CTAN}; it is also
+available there in PDF and HTML formats. The simplest method proposed is to
+use the archive file \href{http://www.ctan.org/pkg/xint}{xint.tds.zip},
+downloadable from the same location.
+
+The next simplest one is to make use of the |Makefile|, which is also
+downloadable from \href{http://www.ctan.org/pkg/xint}{CTAN}. This is
+for GNU/Linux systems and Mac OS X, and necessitates use of the command
+line. If for some reason you have |xint.dtx| but no internet access,
+you can recreate |Makefile| as a file with this name and the following
+contents:
+
+{\def\everbatimindent {0pt }%
+\begin{everbatim}
+include Makefile.mk
+Makefile.mk: xint.dtx ; etex xint.dtx
+\end{everbatim}}
+
+Then run |make| in a working repertory where there is |xint.dtx| and the file
+named |Makefile| and having only the two lines above. The |make| will extract
+the package files from |xint.dtx| and display some further instructions.
+
+If you have |xint.dtx|, no internet access and can not use the Makefile method
+: |etex xint.dtx| extracts all files and among them the |README| as a file
+with name |README.md|. Further help and options will be found therein.
+
+\subsection{Presentation of the packages}
The components of the \xintname bundle provide macros dedicated to
\emph{expandable} computations on numbers exceeding the \TeX{} (and \eTeX{})
-limit of \digitstt{\number"7FFFFFFF}.
+limit of \dtt{\number"7FFFFFFF}.
+
+The \eTeX{} extensions (dating back to 1999) must be enabled; this is the case
+by default in modern distributions, except for the |tex| executable itself
+which has to be the pure \textsc{D.~Knuth} software with no additions. The
+name for the extended binary is |etex|. In |TL2014| for example |etex| is a
+symbolic link to the |pdftex| executable which will then run in |DVI| output
+mode, the \eTeX{} extensions being automatically active.
-The \eTeX{} extensions must be enabled; this is the case in modern
-distributions by default, except if \TeX{} is invoked under the name
-|tex| in command line (|etex| should be used then, or |pdftex| in |DVI|
-output mode). All components may be used as regular \LaTeX{} packages
-or, with any other format based on \TeX{}, loaded directly via
-\string\input{} (e.g. |\input
-xint.sty\relax|).
+All components may be loaded with \LaTeX{} |\usepackage| or
+|\RequirePackage| or, for any other format based on \TeX{}, directly via
+\string\input{}, e.g. |\input xint.sty\relax|. There are no package
+options.
%
% {\makeatother\footnote{\csa{empty}, \csa{space}, \csa{z@},
% \csa{@ne}, and \csa{m@ne} should have the same meaning as in Plain and
-% \LaTeX.}}
+% \LaTeX.}}
%
Each package automatically loads those not already loaded
-it depends on.
+it depends on.\smallskip
-The \xintname bundle consists of the three principal components \xintname,
-\xintfracname (which loads \xintname), and \xintexprname (which loads
-\xintfracname), and four additional modules. The macros of the \xintname bundle
-not dealing directly with the manipulation of big numbers belong to a package
-\xinttoolsname (automatically loaded by all others), which is of independent
-interest.
+%% \pdfbookmark[1]{Abstract}{ABSTRACT}
+
+\begin{addmargin}{1cm}\small
+ % \begin{center} \bfseries\large Description of the packages\par\smallskip
+ % \end{center}\medskip
+\makeatletter
+\renewenvironment{description}
+ {\list{}{\topsep\z@\partopsep\z@
+ \parsep\z@ \labelwidth\z@ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}}
+ {\endlist}
+\makeatother
+\begin{description}
+\item[\xinttoolsname] provides utilities of independent interest such as
+ expandable and non-expandable loops. It is \fbox{not}
+ loaded\MyMarginNote{Changed} automatically (nor needed) by the other bundle
+ packages, apart from \xintexprname.
+
+\item[\xintcorename] provides\MyMarginNote{Formerly, part of \xintname.} the
+ expandable \TeX{} macros doing additions, subtractions, multiplications,
+ divisions and powers on arbitrarily long numbers (loaded automatically by
+ \xintname, and also by package \href{http://ctan.org/pkg/bnumexpr}{bnumexpr}
+ in its default configuration).
+
+\item[\xintname] extends \xintcorename with additional operations on big
+ integers.
+
+\item[\xintfracname] extends the scope of \xintname to decimal numbers, to
+ numbers in scientific notation and also to fractions with arbitrarily
+ long such numerators and denominators separated by a forward slash.
+
+\item[\xintexprname] extends \xintfracname with expandable parsers doing
+ algebra (exact or float, or limited to integers) on comma separated
+ expressions using standard infix notations with parentheses, numbers in
+ decimal notation, and scientific notation, comparison operators, Boolean
+ logic, twofold and threefold way conditionals, sub-expressions, some
+ functions with one or many arguments, user-definable variables, evaluation
+ of sub-expressions over a dummy variable range, with possible recursion,
+ omit, abort, break instructions, nesting.
+\end{description}
+
+Further modules:
+
+\begin{description}
+\item[\xintbinhexname] is for conversions to and from binary and
+ hexadecimal bases.
+
+\item[\xintseriesname] provides some basic functionality for computing in an
+ expandable manner partial sums of series and power series with fractional
+ coefficients.
+
+\item[\xintgcdname] implements the Euclidean algorithm and its typesetting.
+
+\item[\xintcfracname] deals with the computation of continued fractions.
+\end{description}
+\end{addmargin}
+
+\subsection{Changes}
+
+The \csbxint{expr}|...\relax| has many new features, among them the evaluation
+of expressions with dummy variables, possiblyt iteratively, in a nestable way.
+See \autoref{sec:expr11}.
+
+Apart from that, the two main changes is that |\xintiiexpr...\relax| now maps
+|/| to the \emph{rounded} division (the |//| operator does \emph{truncated}
+division) to be in synchrony with the habits of |\numexpr|, and that the
+\xintfracname macro \csbxint{Add} (corresponding naturally to |+| in
+expressions) does not anymore blindly multiply denominators but at least checks
+if one is a multiple of the other. However doing systematic reduction to
+smallest terms, or even always compute always the |LCM| of the
+denominators would be too costly.
+
+Also worth mentioning is the fact that \xintname does not load \xinttoolsname
+anymore (only \xintexprname does) and that the core arithmetic macros have
+been moved to a new package \xintcorename which is loaded automatically by
+\xintname.
+
+The other package by the author
+\href{http://www.ctan.org/pkg/bnumexpr}{bnumexpr} now loads only
+\xintcorename.
+
+See file |CHANGES.pdf|.
\subsection{User interface}
The user interface for executing operations on numbers is via macros such as
\csbxint{Add} or \csbxint{Mul} which have two arguments, or via expressions
-\csbxint{expr}|..\relax| which use infix notations such as |+|, |-|, |*|, |/|,
-and |^| for the basic operations, and recognize functions of one or more comma
-separated arguments (such as |max|, or |round|, or |sqrt|), parentheses, logic
-operators of conjunction |&|, disjunction \verb+|+, as well as two-way |?| and
-three-way |:| conditionals and more.
-
-In the latter case the contents are expanded completely from left to right until
-the ending |\relax| is found and swallowed, and spaces and even (to some extent)
-catcodes do not matter. In the former (macro) case the arguments are each
-subjected to the process of \fexpan sion: repeated expansion of the first token
-until finding something unexpandable (or being stopped by a space token).
+\csbxint{expr}|..\relax| which use infix notations such as |+|, |-|, |*|, |/|
+and |^| (or |**|) for the basic operations, and recognize functions of one or
+more comma separated arguments (such as |max|, or |round|, or |sqrt|),
+parentheses, logic operators of conjunction |&&|, disjunction \verb+||+, as
+well as two-way |?| and three-way |??| conditionals and more. A few examples:
+%
+\begin{everbatim*}
+\begin{enumerate}[nosep]
+ \item \xintiiAdd {2719873981798137981381789317981279}{13819093809180120910390190}
+ \item \xintiiMul {2719873981798137981381789317981279}{13819093809180120910390190}
+ \item \xintthefloatexpr (19317/21913+2198/9291)^3\relax
+ \item \xintDigits:=64;\xintthefloatexpr (19317/21913+2198/9291)^3\relax
+% Let's compute the inner sum exactly, not as a float, before raising to third power:
+ \item \xintDigits:=16;\xintthefloatexpr \xintexpr 19317/21913+2198/9291\relax^3\relax
+\end{enumerate}
+\end{everbatim*}
+In \csbxint{expr}|..\relax| the contents are expanded completely from left to
+right until the ending |\relax| is found and swallowed, and spaces and even
+(to some extent) catcodes do not matter.
+
+The \csbxint{iiexpr} variant is only for big integers, it does not know
+fractions. Thus it (greatly) extends |\numexpr...\relax|, on which it is
+based. Notice though the following very surprising behavior of |\numexpr|:
+\begin{everbatim*}
+\the\numexpr 3 5 + 7 9 \relax +++ what did you expect?
+\end{everbatim*}
+
+To the contrary:
+\begin{everbatim*}
+\xinttheiiexpr 3 5 + 7 9 \relax +++ I like it better that way
+\end{everbatim*}
+
+Also worth mentioning is the fact that |\numexpr -(1)\relax| is illegal. But
+this is perfectly legal and with the expected result in |\xintexpr...\relax|.
+
+For macros like \csbxint{Add} or
+\csbxint{Mul} the arguments are each subjected to the process of \fexpan sion:
+repeated expansion of the first token until finding something unexpandable (or
+being stopped by a space token).
Conversely this process of \fexpan sion always provokes the complete expansion
-of the package macros and \csbxint{expr}|..\relax| also will expand completely
+of the package macros and |\xintexpr..\relax| also will expand completely
under \fexpan sion, but to a private format; the \csbxint{the} prefix allows the
computation result either to be passed as argument to one of the package
macros,\footnote{the \csa{xintthe} prefix \fexpan ds the \csa{xintexpr}-ession
@@ -1151,34 +2577,53 @@ macros,\footnote{the \csa{xintthe} prefix \fexpan ds the \csa{xintexpr}-ession
sub-expressions inside a bigger one as its is more efficient for the
expression parser to keep the result in the private format.} or also end up on
the printed page (or in an auxiliary file).
+To recapitulate, all macros dealing with computations
+\begin{enumerate}
+\item \emph{expand completely under the sole process of repeated expansion of
+ the first token, (and two expansions suffice)},\footnote{see in
+ \autoref{sec:expansions} for more details.}
-To recapitulate: all macros dealing with computations (1.)~\emph{expand
- completely under the sole process of repeated expansion of the first token,
- (and two expansions suffice)},\footnote{see in \autoref{sec:expansions} for
- more details.} (2.)~\emph{apply this \fexpan sion to each one of their
- arguments.} Hence they can be nested one within the other up to arbitrary
+\item \emph{apply this \fexpan sion to each one of their arguments.}
+\end{enumerate}
+Hence they can be nested one within the other up to arbitrary
depths. Conditional evaluations either within the macro arguments themselves, or
with branches defined in terms of these macros are made possible via macros such
as as \csbxint{ifSgn} or \csbxint{ifCmp}.
-There is no notion of \emph{declaration of a variable} to \xintname,
-\xintfracname, or \xintexprname. The user employs the |\def|, |\edef|, or
-|\newcommand| (in \LaTeX) as usual, for example:
-%
-\centeredline{|\def\x{17} \def\y{35} \edef\z{\xintMul {\x}{\y}}|}
+\begin{framed}
+ There is no notion of \emph{declaration of a variable} to \xintname,
+ \xintfracname, or \xintexprname.
+ The user employs the |\def|, |\edef|, or
+ |\newcommand| (in \LaTeX) as usual, for example: \IMPORTANT
%
+\begin{everbatim*}
+\def\x{1729728} \def\y{352827927} \edef\z{\xintMul {\x}{\y}}
+\meaning\z
+\end{everbatim*}\ (see below for the |A/B[N]| output format; with |\xintiiMul|
+in place of |\xintMul| there would not be the strange looking |/1[0]|.)
+
As a faster alternative to |\edef| (when hundreds of digits are involved), the
-package provides |\oodef| which only expands twice its argument.
+package provides |\oodef| which only expands twice its argument. This provokes
+full expansion of the \xintname \fexpan dable macros (nested to possibly many
+levels), inclusive of |\xintexpr| and variants.
+\end{framed}
+\begingroup % pour \z, \zz
The \xintexprname package has a private internal
representation for the evaluated computation result. With
%
-\centeredline{|\oodef\z {\xintexpr 3.141^17\relax}|}
+\begin{everbatim*}
+\oodef\z {\xintexpr 3.141^18\relax}
+\end{everbatim*}
%
the macro |\z| is already fully evaluated (two expansions were applied, and this
is enough), and can be reused in other |\xintexpr|-essions, such as for example
%
-\centeredline{|\xintexpr \z+1/\z\relax|}
+\begin{everbatim*}
+\edef\zz {\xintexpr \z+1/\z\relax}
+ % (using short macro names such as \z and \zz is not too recommended in real
+ % life, some may have already definitions; I did it all in a group).
+\end{everbatim*}
%
But to print it, or to use it as argument to one of the package macros,
it must be prefixed by |\xintthe| (a synonym for |\xintthe\xintexpr| is
@@ -1187,9 +2632,11 @@ value in the \xintfracname semi-private internal format
|A/B[N]|,\footnote{there is also the notion of \csbxint{floatexpr}, for
which the output format after the action of \csa{xintthe} is a number in
floating point scientific notation.} representing the fraction
-$(A/B)\times 10^N$. The example above produces a somewhat large output:
-\digitstt{\oodef\z {\xintexpr 3.141^17\relax}%
- \printnumber {\xinttheexpr \z+1/\z\relax }}
+$(A/B)\times 10^N$. The |\zz| above produces a somewhat large output:
+\begin{everbatim*}
+\printnumber{\xintthe\zz }${}\approx{}$\xintFloat{\xintthe\zz}
+\end{everbatim*}
+\endgroup % pour \z, \zz
\begin{framed}
By default, computations done by the macros of \xintfracname or within
@@ -1199,6 +2646,19 @@ $(A/B)\times 10^N$. The example above produces a somewhat large output:
%
% Floating point evaluations are done via special macros containing
% `Float' in their names, or inside |\xintfloatexpr|-essions.
+
+ Manipulating exactly big fractions quickly leads to \dots bigger fractions.
+ There is a command \csbxint{Irr} (or the function |reduce| in an expression)
+ to reduce to smallest terms, but it has to be explicitely requested. Prior
+ to release |1.1| addition and subtraction blindly multiplied denominators;
+ they now check if one is a multiple of the other.\IMPORTANT\ But systematic
+ reduction of the result to its smallest terms would be too
+ costly.\def\everbatimindent{0pt }
+\begin{everbatim*}
+\xinttheexpr 27/25+46/50\relax\ is a bit simpler than \xinttheexpr (27*50+25*46)/(25*50)\relax,
+but less so than \xinttheexpr reduce(27/25+46/50)\relax. And \xinttheexpr 3/75+4/50+2/100\relax\
+looks weird, but systematically reducing fractions would be too costly.
+\end{everbatim*}
\end{framed}
%
@@ -1207,457 +2667,350 @@ benefits from accelerated parsing when used on input, compared to the normal
user syntax which has no |[N]| part. An example of valid user input for a
fraction is
%
-\centeredline{|-123.45602e78/+765.987e-123|}
-%
+\leftedline{|-123.45602e78/+765.987e-123|}
+%
where both the decimal parts, the scientific exponent parts, and the whole
denominator are optional components. The corresponding semi-private form in this
case would be
%
-\centeredline{\digitstt{\xintRaw{-123.45602e78/+765.987e-123}}}
+\leftedline{\xintRaw{-123.45602e78/+765.987e-123}}
%
-The optional forward slash |/| introducing a denominator is not an operation,
-but a denomination for a fractional input. Reduction to the irreducible form
-must be asked for explicitely via the \csbxint{Irr} macro or the |reduce|
-function within |\xintexpr..\relax|. Elementary operations on fractions work
-blindly (addition does not even check for equality of the denominators and
-multiply them automatically) and do none of the simplifications which
-could be obvious to (some) human beings.
+The optional forward slash |/| for the denominator for the \xintfracname
+macros, but simply a delimiter to separate numerator and denominator. In
+|\xintexpr..\relax|, |/| is treated as on operation like |*| naturally.
-
-\subsection{Space and time, floating point macros}
-
-The size of the manipulated numbers is limited by two
-factors:\footnote{there is an intrinsic limit of
- \digitstt{\number"7FFFFFFF} on the number of digits, but it is
- irrelevant, in view of the other limiting factors.} (1.)~\emph{the
- available memory as configured in the |tex| executable},
-(2.)~\emph{the \emph{time} necessary to fully expand the computations
- themselves}. The most limiting factor is the second one, the time
-needed (for multiplication and division, and even more for powers)
-explodes with increasing input sizes long before the computations could
-get limited by constraints on \TeX's available memory:
-computations with @100@ digits are still reasonably fast, but the
-situation then deteriorates swiftly, as it takes of the order of seconds (on my
-laptop) for the package to multiply exactly two numbers each of @1000@ digits
-and it would take hours for numbers each of @20000@ digits.\footnote{Perhaps
- some faster routines could emerge from an approach which, while maintaining
- expandability would renounce at \fexpan dability (without impacting the input
- save stack). There is one such routine \csbxint{XTrunc} which is able to write
- to a file (or inside an \csa{edef}) tens of thousands of digits of a
- (reasonably-sized) fraction.}
-
-To address this issue, floating
-point macros are provided to work with a given arbitrary precision. The default
-size for significands is @16@ digits. Working with significands of @24@, @32@,
-@48@, @64@, or even @80@ digits is well within the reach of the package. But
-routine multiplications and divisions will become too slow if the precision goes
-into the hundreds, although the syntax to set it (|\xintDigits:=P;|) allows
-values up to @32767@.\footnote{for a one-shot conversion of a fraction to float
- format, or one addition, a precision exceeding \digitstt{32767} may be passed
- as optional argument to the used macro.} The exponents may be as big as
-\digitstt{$\pm$\number"7FFFFFFF}.\footnote{almost\dots{} as inner manipulations
- may either add or subtract the precision value to the exponent, arithmetic
- overflow may occur if the exponents are a bit to close to the \TeX{} bound
- \digitstt{$\pm$\number"7FFFFFFF}.}
-
-Here is such a floating point computation: \centeredline{|\xintFloatPower [48]
- {1.1547}{\xintiiPow {2}{35}}|} which thus computes
-$(1.1547)^{2^{35}}=(1.1547)^{\xintiiPow {2}{35}}$ to be approximately
-\centeredline{\digitstt{\np{\xintFloatPower [48] {1.1547}{\xintiiPow
- {2}{35}}}}}
-%
-Notice that @2^35@ exceeds \TeX's bound, but \csa{xintFloatPower} allows it,
-what counts is the exponent of the result which, while dangerously close to
-@2^31@ is not quite there yet. The printing of the result was done via the
-|\numprint| command from the \href{http://ctan.org/pkg/numprint}{numprint}
-package\footnote{\url{http://ctan.org/pkg/numprint}}.
-
-The same computation can be done via the non-expandable assignment
-|\xintDigits:=48;| and then \centeredline{|\xintthefloatexpr
- 1.1547^(2^35)\relax|} Notice though that |2^35| will be evaluated as a
-floating point number, and if the floating point precision had been too
-low, this computation would have given an inexact value. It is safer,
-and also more efficient to code this as:
-%
-\centeredline{|\xintthefloatexpr 1.1547^\xintiiexpr 2^35\relax\relax|}
-%
-The |\xintiiexpr| is a cousin of |\xintexpr| which is big integer-only and skips
-the overhead of fraction management. Notice on this example that being
-embedded inside the |floatexpr|-ession has nil influence on the
-|iiexpr|-ession: expansion proceeds in exactly the same way as if it had
-been at the `top' level.
-
-
-\xintexprname provides \emph{no} implementation of the |IEEE| standard:
-no |NaN|s, signed infinities, signed zeroes, error traps, \dots; what is
-achieved though is exact rounding for the basic operations. The only
-non-algebraic operation currently implemented is square root extraction.
-The power functions (there are three of them: \csbxint{Pow} to which |^|
-is mapped in |\xintexpr..\relax|, \csbxint{FloatPower} for |^| in
-|\xintfloatexpr..relax|, and \csbxint{FloatPow} which is slighty faster
-but limits the exponent to the \TeX{} bound) allow only integral
-exponents.
-
-
-\subsection{Printing big numbers on the page}\label{ssec:printnumber}
-
-When producing very long numbers there is the question of printing them on
- the page, without going beyond the page limits. In this document, I have most
- of the time made use of these macros (not provided by the package:)
-
-%
-\begingroup\baselineskip11pt\def\MacroFont{\small\ttfamily\baselineskip11pt\relax }%
-\dverb|@
-\def\allowsplits #1{\ifx #1\relax \else #1\hskip 0pt plus 1pt\relax
- \expandafter\allowsplits\fi}%
-\def\printnumber #1{\expandafter\allowsplits \romannumeral-`0#1\relax }%
-% \printnumber thus first ``fully'' expands its argument.|
-\par\endgroup
-%
-An alternative (\autoref{fn:np}) is to suitably configure the thousand separator
-with the \href{http://ctan.org/pkg/numprint}{numprint} package (does not work in
-math mode; I also tried \href{http://ctan.org/pkg/siunitx}{siunitx} but even in
-text mode could not get it to break numbers accross lines). Recently I became
-aware of the
-\href{http://ctan.org/pkg/seqsplit}{seqsplit}
-package\footnote{\url{http://ctan.org/pkg/seqsplit}}
-which can be used to achieve this splitting accross lines, and does work
-in inline math mode (however it doesnt allow, for example to separate digits by
-groups of three).\par
-
-\subsection{Expandable implementations of mathematical algorithms}
-
-Another use of the |\xintexpr|-essions is illustrated with the algorithm on the
-title page: it shows how one may chain expandable evaluations, almost as if one
-were using the |\numexpr| facilities.\footnote{The implementation uses the
- (already once-expanded) integer only variant \csa{xintiiexpr} as \csa{romannumeral0}\csa{xintiieval..}\csa{relax}.}
-Notice that the @47@th Fibonacci number is \digitstt{\Fibonacci {47}} thus
-already too big for \TeX{} and \eTeX{}, a difficulty which our front page showed
-how to overcome (see \autoref{ssec:fibonacci} for more). The |\Fibonacci| macro
-is completely expandable hence can be used for example within |\message| to
-write to the log and terminal.
-
-It is even \fexpan dable (although not in only two steps, this could be added
-but does not matter here), thus if we are interested in knowing how many digits
-@F(1250)@ has, suffices to use |\xintLen {\Fibonacci {1250}}| (which expands to
-\digitstt{\xintLen {\Fibonacci {1250}}}), or if we want to check the formula
-@gcd(F(1859),F(1573))=F(gcd(1859,1573))=F(143)@, we only need\footnote{The
- \csa{xintGCD} macro is provided by the \xintgcdname package.}
-\centeredline{|\xintGCD{\Fibonacci{1859}}{\Fibonacci{1573}}=\Fibonacci{\xintGCD{1859}{1573}}|}
-\centeredline{\digitstt{\printnumber{\xintGCD{\Fibonacci{1859}}{\Fibonacci{1573}}}=\printnumber{\Fibonacci{\xintGCD{1859}{1573}}}}}
-
-The |\Fibonacci| macro expanded its |\xintGCD{1859}{1573}| argument via the
-services of |\numexpr|: this step allows only things obeying the \TeX{} bound,
-naturally! (but \digitstt{F(\xintiiPow2{31}}) would be rather big anyhow...).
+Reduction to the irreducible form of the output must be asked for explicitely
+via the \csbxint{Irr} macro or the |reduce| function within
+|\xintexpr..\relax|. Elementary operations on fractions do very little of the
+simplifications which could be obvious to (some) human beings.
\subsection{FAQ}
+We are honored to present here this interview with the author, dating back to
+late March 2014.
\begin{description}
\item[Will \xintexprname implement \texttt{exp}, \texttt{log},
\texttt{cos}, \texttt{sin} \dots at some point?]
I guess so.
+
\item[\xintseriesname already provides generic tools.] Right, although the
casual user of the \xintname bundle will not quite know how to do variable
reduction expandably in order to use some series or Pad\'e approximants.
Besides I wrote the code at the beginning of the project and perhaps I could
do it better now (I have not looked at it for a while). Anyhow, generic things
do not help much if one wants to optimize.
+
\item[Optimizing? isn't \TeX's macro expansion mechanism intrinsically slow?]
Intensive use of \csa{numexpr} and some token manipulation algorithms
exploiting to the best I could \TeX{} macros with parameters grant \xintname a
significant speed up in expandable arithmetic on big integers compared to
previously available implementations. You can do some comparisons with
- multiplication on numbers with @100@ digits or division of one of @100@ digits
- by another of @50@ digits, for example. However expandability is antagonist of
+ multiplication on numbers with $100$ digits or division of one of $100$ digits
+ by another of $50$ digits, for example. However expandability is antagonist of
speed, and I agree it is not very exciting to optimize slow things. And I was
disappointed last year to realize the slowness of \TeX's mouth when it has to
keep hundreds of tokens in cheek to mix them later with new aliments. Believe
me, I try not to think too much about the fact that the whole enterprise is
made irrelevant by Lua\LaTeX's ability to access external libraries.
-\item[Well, why isn't this \texttt{log} etc\dots thing done yet?]
-I have to decide on the maximal precision to achieve: @24@, @32@, @48@,
-@64@,\dots ; to settle that I would need to implement some initial versions and
-benchmark them.
+
+\item[Well, why isn't this \texttt{log} etc\dots thing done yet?]
+I have to decide on the maximal precision to achieve: $24$, $32$, $48$,
+$64$,\dots ; to settle that I would need to implement some initial versions and
+benchmark them.
+
\item[Fair enough. That's the common lot. So why not yet?] I am a bit
overworked. It is also an opportunity to think over
the basic underlying mathematics, and will need devoted thinking for some not
insignificant amount of time. So far I didn't find the time, or rather I found
out good means to waste it sillily. I also anticipate that originality could
- very
+ very
well not pay off at all, so small is the window for the precision.
+
\item[Any chance this could be done in time for TL2014?] No,
sorry.\newline Release |1.09m| of |[2014/02/26]| was the end of a cycle, and
this |1.09n| of |[2014/04/01]| is only for a bug fix and inclusion of this
|FAQ| in the documentation.
-\end{description}
-
-\section{Recent changes}
\footnotesize
+\item[and in time for TL2015?] ... (indistinct mumbles, something like
+ \emph{too tired}, \emph{I need a life}, \emph{get yourself a calculator},
+ \emph{we'll see}\dots)
+\end{description}
-\noindent Release |1.09n| (|[2014/04/01]|):
-\begin{itemize}
-\item the user manual does not include by default the source code anymore: the
- |\NoSourceCode| toggle in file |xint.tex| has to be set to @0@ before
- compilation to get source code inclusion.
-\item bug fix in |\XINT_nthelt_finish| (this bug was introduced in |1.09i| of
- |2013/12/18| and showed up when the index |N| was larger
- than the number of elements of the list).
-\end{itemize}
+\section{Introduction via examples}
-\noindent Releases |1.09m| (|[2014/02/26]|):
-\begin{itemize}
-\item new macros in \xinttoolsname: \csbxint{Keep} keeps the first |N|
- or last |N| elements of a list (sequence of braced items);
- \csbxint{Trim} cuts out either the first |N| or the last |N| elements
- from a list.
-\item new macros in \xintcfracname: \csbxint{FGtoC} finds the
- initial partial quotients common to two numbers or fractions |f| and
- |g|; \csbxint{GGCFrac} is a clone of \csbxint{GCFrac} which however
- does not assume that the coefficients of the generalized continued
- fraction are numeric quantities. Some other minor changes.
-\end{itemize}
-
-\noindent Releases |1.09ka| (|[2014/02/05]|) and |1.09kb| (|[2014/02/13]|):
-\begin{itemize}
-\item bug fix (\xintexprname): an aloof modification done by |1.09i| to
- \csbxint{NewExpr} had resulted in a spurious trailing space present in the
- outputs of all macros created by |\xintNewExpr|, making nesting of such macros
- impossible.
-\item bug fix (\xinttoolsname): \csbxint{BreakFor} and \csbxint{BreakForAndDo}
- were buggy when used in the last iteration of an |\xintFor| loop.
-\item bug fix (\xinttoolsname): \csbxint{Seq} from |1.09k| needed a |\chardef|
- which was missing from |xinttools.sty|, it was in |xint.sty|.
-\end{itemize}
+The main goal is to allow expandable computations with integers and
+fractions of arbitrary sizes.
-\noindent Release |1.09k| (|[2014/01/21]|):
-\begin{itemize}
-\item inside |\xintexpr..\relax| (and its variants) tacit multiplication
- is implied when a number or operand is followed directly with an
- opening parenthesis,
-\item the |"| for denoting (arbitrarily big) hexadecimal numbers is recognized
- by |\xintexpr| and its variants (package \xintbinhexname is required); a
- fractional hexadecimal part introduced by a
- dot |.| is allowed.
-\item re-organization of the first sections of the user manual.
-\item bug fix: forgotten loading time |"| catcode sanity check has been added.
-\end{itemize}
+\subsection{Printing big numbers on the page}\label{ssec:printnumber}
-\noindent Release |1.09j| (|[2014/01/09]|):
-\begin{itemize}
-\item the core division routines have been re-written for some (limited)
- efficiency gain, more pronounced for small divisors. As a result the
- \hyperlink{Machin1000}{computation of one thousand digits of $\pi$}
- is close to three times faster than with earlier releases.
-\item a new macro \csbxint{XTrunc} is designed to produce thousands or even tens
- of thousands of digits of the decimal expansion of a fraction.
-\item the tacit multiplication done in \csbxint{expr}|..\relax| on encountering
- a count register or variable, or a |\numexpr|, while scanning a (decimal)
- number, is extended to the case of a sub |\xintexpr|-ession.
-\item \csbxint{expr} can now be used in an |\edef| with no |\xintthe|
- prefix.
-\end{itemize}
+When producing very long numbers there is the question of printing them on
+ the page, without going beyond the page limits. In this document, I have most
+ of the time made use of these macros (not provided by the package:)
-For a more detailed change history, see \autoref{sec:releases}.
+%
+\everb|@
+\def\allowsplits #1{\ifx #1\relax \else #1\hskip 0pt plus 1pt\relax
+ \expandafter\allowsplits\fi}%
+\def\printnumber #1{\expandafter\allowsplits \romannumeral-`0#1\relax }%
+% \printnumber thus first ``fully'' expands its argument.
+|
-\normalsize
+It may be used like this:
+%
+\leftedline{|\printnumber {\xintiiQuo{\xintiiPow {2}{1000}}{\xintiFac{100}}}|}
+%
+or as |\printnumber\mybiginteger| or |\printnumber{\mybiginteger}| if
+|\mybiginteger| was previously defined via a |\newcommand|, a |\def| or
+an |\edef|.
+An alternative is to suitably configure the thousand
+separator with the \href{http://ctan.org/pkg/numprint}{numprint} package
+(see \autoref{fn:np}. This will not allow linebreaks when used in math
+mode; I also tried \href{http://ctan.org/pkg/siunitx}{siunitx} but even
+in text mode could not get it to break numbers accross lines). Recently
+I became aware of the \href{http://ctan.org/pkg/seqsplit}{seqsplit}
+package%
+%
+\footnote{\url{http://ctan.org/pkg/seqsplit}}
+%
+which can be used to achieve this splitting accross lines, and does work
+in inline math mode (however it doesn't allow to separate digits by
+groups of three, for example).\par
+\subsection{Randomly chosen examples}
-\section{Some examples}
+Here are some examples of use of the package macros. The first one uses only
+the base module \xintname, the next two require the \xintfracname package,
+which deals with fractions. Then two 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.
-The main initial goal is to allow computations with integers and fractions of
-arbitrary sizes.
+\begin{itemize}
+\item {$123456^{99}$: }\\
+|\xintiiPow {123456}{99}|:
+\dtt{\printnumber{\xintiiPow {123456}{99}}}
-Here are some examples. The first one uses only the base module \xintname, the
-next two require the \xintfracname package, which deals with fractions. Then two
-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.
+\item {1234/56789 with 1500 digits after the decimal point: }\\
+|\xintTrunc {1500}{1234/56789}\dots|:
+\dtt{\printnumber {\xintTrunc {1500}{1234/56789}}\dots }
-{\color{magenta}@123456^99@: }\\
-{\color[named]{Purple}\csa{xintiPow}|{123456}{99}|}: \digitstt{\printnumber{\xintiPow {123456}{99}}}
+\item {$0.99^{-100}$ with 200 digits after the decimal point:}\\
+|\xinttheexpr trunc(.99^-100,200)\relax\dots|:
+\dtt{\printnumber{\xinttheexpr trunc(.99^-100,200)\relax}\dots }
-{\color{magenta}1234/56789 with 1500 digits after the decimal point: }\\
-{\color[named]{Purple}\csa{xintTrunc}|{1500}{1234/56789}\dots|}:
-\digitstt{\printnumber {\xintTrunc {1500}{1234/56789}}\dots }
-{\color{magenta}@0.99^{-100}@ with 200 digits after the decimal point:}\\
-{\color[named]{Purple}\csa{xinttheexpr trunc}|(.99^-100,200)\relax\dots|}:
-\digitstt{\printnumber{\xinttheexpr trunc(.99^-100,200)\relax}\dots }
+\item Just to show off (again), let's print 300 digits (after the decimal
+ point) of the decimal expansion of $0.7^{-25}$:%
+%
+\footnote{the |\np| typesetting macro is from the |numprint| package.}
+%
+\begin{everbatim*}
+% % in the preamble:
+% \usepackage[english]{babel}
+% \usepackage[autolanguage,np]{numprint}
+% \npthousandsep{,\hskip 1pt plus .5pt minus .5pt}
+% \usepackage{xintexpr}
+% in the body:
+\np {\xinttheexpr trunc(.7^-25,300)\relax}\dots
+\end{everbatim*}
+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}.
-{\color{magenta}%
- Computation of a Bezout identity with |7^200-3^200| and |2^200-1|:}\par
-{\color[named]{Purple}
-\dverb|@
-\xintAssign \xintBezout {\xinttheiexpr 7^200-3^200\relax}
- {\xinttheiexpr 2^200-1\relax}\to\A\B\U\V\D|%
-\centeredline {|\U$\times$(7^200-3^200)+\xintiOpp\V$\times$(2^200-1)=\D|}}%
+\begin{snugframed}
+ The fraction |0.7^-25| is first evaluated \emph{exactly}; for some more
+ complex inputs, such as |0.7123045678952^-243|, the exact evaluation before
+ truncation would be rather costly, and one would rather use floating point
+ numbers:
%
+\leftedline{|\xintDigits:=20;
+ \np{\xintthefloatexpr .7123045678952^-243\relax}|}%
+%
+\leftedline{\xintDigits:=20;\dtt{\np{\xintthefloatexpr .7123045678952^-243\relax }}}
+%
+Side note: 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
+\end{snugframed}
+
+\xintDigits:=16;
+
+\item Computation of a Bezout identity with |7^200-3^200| and |2^200-1|:
+(with \xintgcdname)\par
+\everb|@
\xintAssign \xintBezout {\xinttheiexpr 7^200-3^200\relax}
+ {\xinttheiexpr 2^200-1\relax}\to\A\B\U\V\D
+$\U\times(7^{200}-3^{200})+\xintiOpp\V\times(2^{200}-1)=\D$
+|
+
+\xintAssign \xintBezout {\xinttheiexpr 7^200-3^200\relax}%
{\xinttheiexpr 2^200-1\relax}\to\A\B\U\V\D
-\digitstt
-{\printnumber\U$\times$(@7^200-3^200@)+%
- \printnumber{\xintiOpp\V}$\times$(@2^200-1@)=\printnumber\D}
-
-\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}%
- |\def\coeff #1%|\\
- | {\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}|\\
- |\xintRound {9}{\xintiSeries {1}{500}{\coeff}[-12]}|:} \def\coeff #1%
-{\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}
-\digitstt{\xintRound {9}{\xintiSeries {1}{500}{\coeff}[-12]}}\endgraf
+\dtt
+{\printnumber\U$\times(7^{200}-3^{200})+{}$%
+ \printnumber{\xintiOpp\V}$\times(2^{200}-1)={}$\printnumber\D}
+
+% 11 octobre 2014, je modifie juste d'une unité le deuxième... plus joli.
+\item The Euclide algorithm applied to \np{22206980239027589097} and
+\np{8169486210102119257}: (with \xintgcdname)%
+%
+\footnote {this example is computed tremendously faster than the other
+ ones, but we had to limit the space taken by the output hence picked
+ up rather small big integers as input.}\par
+\noindent\begingroup\parskip0pt\relax
+|\xintTypesetEuclideAlgorithm {22206980239027589097}{8169486210102119257}|\par
+\dtt
+{\xintTypesetEuclideAlgorithm {22206980239027589097}{8169486210102119257}}
+\endgroup
+\smallskip
+
+\item $\sum_{n=1}^{500} (4n^2 - 9)^{-2}$ with each term rounded to twelve digits,
+and the sum to nine digits:
+\begin{everbatim*}
+\def\coeff #1{\xintiRound {12}{1/\xintiSqr{\the\numexpr 4*#1*#1-9\relax }[0]}}
+\xintRound {9}{\xintiSeries {1}{500}{\coeff}[-12]}
+\end{everbatim*}
The complete series, extended to
infinity, has value
$\frac{\pi^2}{144}-\frac1{162}={}$%
-\digitstt{\np{0.06236607994583659534684445}\dots}\,%
+\dtt{\np{0.06236607994583659534684445}\dots}\,%
+%
\footnote{\label{fn:np}This number is typeset using the
\href{http://www.ctan.org/pkg/numprint}{numprint} package, with
- \texttt{\detokenize{\npthousandsep{,\hskip 1pt plus .5pt minus .5pt}}}.
- But the breaking across
- lines works only in text mode. The number itself was (of course...) computed
- initially with \xintname, with 30 digits of $\pi$ as input.
- See
- \hyperref[ssec:Machin]{{how {\xintname} may compute $\pi$
- from scratch}}.} I also used (this is a lengthier computation
+ |\npthousandsep{,\hskip 1pt plus .5pt minus .5pt}|. But the breaking
+ across lines works only in text mode. The number itself was (of
+ course...) computed initially with \xintname, with 30 digits of $\pi$
+ as input. See \hyperref[ssec:Machin]{{how {\xintname} may compute
+ $\pi$ from scratch}}.}
+%
+I also used (this is a lengthier computation
than the one above) \xintseriesname to evaluate the sum with \np{100000} terms,
-obtaining 16
+obtaining 16
correct decimal digits for the complete sum. The
coefficient macro must be redefined to avoid a |\numexpr| overflow, as
-|\numexpr| inputs must not exceed @2^31-1@; my choice
-was:
-{\color[named]{Purple}\dverb|@
+|\numexpr| inputs must not exceed $2^{31}-1$; my choice
+was:
+\everb|@
\def\coeff #1%
{\xintiRound {22}{1/\xintiSqr{\xintiMul{\the\numexpr 2*#1-3\relax}
{\the\numexpr 2*#1+3\relax}}[0]}}
-|%
-}%
+|
+\restoreMacroFont
+\edef\Temp {\xintFloatPow [24]{2}{999999999}}
-{\color{magenta}Computation of $2^{\np{999999999}}$ with |24| significant
- figures:}\\
-|\numprint{|{\color[named]{Purple}|\xintFloatPow [24] {2}{999999999}|}|}| expands to:
-\centeredline{\digitstt{\np{\xintFloatPow [24] {2}{999999999}}}} where the
-|\numprint| macro from the \hyperref[fn:np]{eponym package} was used.
+\item {Computation of $2^{\np{999999999}}$ with |24| significant
+ figures:}
+%
+\leftedline{|\numprint{\xintFloatPow [24]{2}{999999999}}|}
+\leftedline{\dtt{\numprint{\Temp}}}
+%
+where the \href{http://www.ctan.org/pkg/numprint}{numprint} package was used
+(\autoref{fn:np}), directly in text mode (it can also naturally be used from
+inside math mode). \xintname provides a simple-minded \csbxint{Frac}
+typesetting macro,%
+%
+\footnote{Plain \TeX{} users of \xintname have \csbxint{FwOver}.}
+%
+which is math-mode only:
+%
+\leftedline{|$\xintFrac{\xintFloatPow [24]{2}{999999999}}$|}
+\leftedline{\dtt{$\xintFrac{\Temp}$}}
+%
+The exponent differs, but this is because
+|\xintFrac| does not use a decimal mark in the mantissa of the output.
+Admittedly most users will have the need of more powerful (and customizable)
+number formatting macros than |\xintFrac|.
+%
+\footnote{There should be a |\xintFloatFrac|, but it is lacking.}
+%
+We have already mentioned
+|\numprint| which is used above, there is also |\num| from package
+\href{http://www.ctan.org/pkg/siunitx}{siunitx}. The raw output from
+%
+\leftedline{\detokenize{\xintFloatPow[24]{2}{999999999}}}
+%
+is $\Temp$.
-\edef\x{\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}
+\edef\x{\xintiiQuo{\xintiiPow {2}{1000}}{\xintiFac{100}}}
\edef\y{\xintLen{\x}}
-As an example of chaining package macros, let us consider the following
+\item As an example of nesting package macros, let us consider the following
code snippet within a file with filename |myfile.tex|:
-\dverb|@
+\everb|@
\newwrite\outstream
\immediate\openout\outstream \jobname-out\relax
-\immediate\write\outstream {\xintQuo{\xintPow{2}{1000}}{\xintFac{100}}}
+\immediate\write\outstream {\xintiiQuo{\xintiiPow{2}{1000}}{\xintiFac{100}}}
% \immediate\closeout\outstream
-|%
-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% first ``fully'' expands its argument.
-{\expandafter\allowsplits \romannumeral-`0#1\relax }|
-
-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 like this:
-%
-\centeredline{|\printnumber {\xintQuo{\xintPow {2}{1000}}{\xintFac{100}}}|}
-or as |\printnumber\mynumber| or |\printnumber{\mynumber}| if
-|\mynumber| was previously defined via a |\newcommand|, or a |\def|:
+|
+\noindent
+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{\xintiiQuo{\xintiiPow{2}{1000}}{\xintiFac{100}}}| which
+expands (in two steps) and tells us that $[2^{1000}/100!]$ has \dtt{\y}
+digits. This is not so many, let us print them here:
+\dtt{\printnumber\x}.%
%
-\centeredline{%
- |\def\mynumber {\xintQuo {\xintPow {2}{1000}}{\xintFac{100}}}|}%
-
+% \footnote{See \autoref{ssec:printnumber} and \hyperref[fn:np]{a previous
+% footnote}.}
-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
+\end{itemize}
-\xintDigits:=16;
+\subsection {More examples, some quite elaborate, within this document}
+\label{sec:awesome}
+\begin{itemize}
+\item The utilities provided by \xinttoolsname (\autoref{sec:tools}), some
+ completely expandable, others not, are of independent interest. Their use
+ is illustrated through various examples: among those, it is shown in
+ \autoref{ssec:quicksort} how to implement in a completely expandable way
+ the \hyperref[quicksort]{Quick Sort algorithm} and also how to illustrate
+ it graphically. Other examples include some dynamically constructed
+ alignments with automatically computed prime number cells: one using a
+ completely expandable prime test and \csbxint{ApplyUnbraced}
+ (\autoref{ssec:primesI}), another one with \csbxintForstar\
+ (\autoref{ssec:primesIII}).
+
+\item One has also a \hyperref[edefprimes]{computation of primes within an
+ \csa{edef}} (\autoref{xintiloop}), with the help of \csbxint{iloop}.
+ Also with \csbxint{iloop} an
+ \hyperref[ssec:factorizationtable]{automatically generated table of
+ factorizations} (\autoref{ssec:factorizationtable}).
+
+\item The code for the title page fun with Fibonacci numbers is given in
+ \autoref{ssec:fibonacci} with \csbxintForstar\ joining the game.
+
+\item The computations of \hyperref[ssec:Machin]{ $\pi$ and $\log 2$}
+ (\autoref{ssec:Machin}) using \xintname and the computation of the
+ \hyperref[ssec:e-convergents]{convergents of $e$} with the further help of
+ the \xintcfracname package are among further examples.
+
+\item There is also an
+ example of an \hyperref[xintXTrunc]{interactive session}, where results
+ are output to the log or to a file.
+
+\item The new functionalities of \xintexprname are illustrated with various
+ examples in \autoref{sec:expr11}.
+\end{itemize}
+Almost all of the computational results interspersed throughout the
+documentation are not hard-coded in the source of the document. They are the
+result of evaluation of the package macros, and were selected to not impact
+too much the compilation time of this documentation. However, there are so
+many computations done that compilation time is nevertheless significantly
+increased compared to a \LaTeX\ run on a typical document of about the same
+size.
-\section {Further illustrative examples within this document}
-\label{sec:awesome}
-
+\section{The \xintname bundle}
-The utilities provided by \xinttoolsname (\autoref{sec:tools}), some
-completely expandable, others not, are of independent interest. Their
-use is illustrated through various examples: among those, it is shown in
-\autoref{ssec:quicksort} how to implement in a completely expandable way
-the \hyperref[quicksort]{Quick Sort algorithm} and also how to
-illustrate it graphically. Other examples include some dynamically
-constructed alignments with automatically computed prime number cells:
-one using a completely expandable prime test and \csbxint{ApplyUnbraced}
-(\autoref{ssec:primesI}), another one with \csbxint{For*}
-(\autoref{ssec:primesIII}).
-
-One has also a \hyperref[edefprimes]{computation of primes
- within an \csa{edef}} (\autoref{xintiloop}), with the help of
-\csbxint{iloop}. Also with \csbxint{iloop} an
-\hyperref[ssec:factorizationtable]{automatically generated table of
- factorizations} (\autoref{ssec:factorizationtable}).
-
-The title page fun with Fibonacci numbers is continued in
-\autoref{ssec:fibonacci} with \csbxint{For*} joining the game.
-
-The computations of \hyperref[ssec:Machin]{ $\pi$ and $\log 2$}
-(\autoref{ssec:Machin}) using \xintname and the computation of the
-\hyperref[ssec:e-convergents]{convergents of $e$} with the further help of
-the \xintcfracname package are among further examples.
-There is also an example of an \hyperref[xintXTrunc]{interactive
- session}, where results are output to the log or to a file.
-
-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{General overview}
+\subsection{General overview}
The main characteristics are:
\begin{enumerate}
@@ -1667,17 +3020,17 @@ The main characteristics are:
context.
\end{enumerate}
-`Arbitrarily big': this means with less than
- |2^31-1|\digitstt{=\number"7FFFFFFF} digits, as most of the macros will
+`Arbitrarily big' means with less than
+ |2^31-1|\dtt{=\number"7FFFFFFF} digits, as most of the macros will
have to compute the length of the inputs and these lengths must be treatable
- as \TeX{} integers, which are at most \digitstt{\number "7FFFFFFF}
+ as \TeX{} integers, which are at most \dtt{\number "7FFFFFFF}
in absolute value.
This is a distant irrelevant upper bound, as no such thing can fit
- in \TeX's memory! And besides,
+ in \TeX's memory! And besides,
the true limitation is from the \emph{time} taken by the
expansion-compatible algorithms, as will be commented upon soon.
-As just recalled, ten-digits numbers starting with a @3@ already exceed the
+As just recalled, ten-digits numbers starting with a $3$ already exceed the
\TeX{} bound on integers; and \TeX{} does not have a native processing of
floating point numbers (multiplication by a decimal number of a dimension
register is allowed --- this is used for example by the
@@ -1696,35 +3049,51 @@ possibilities, when available) on arbitrarily big integers, beyond the \TeX{}
bound. The present package does this again, using more of |\numexpr| (\xintname
requires the \eTeX{} extensions) for higher speed, and also on fractions, not
only integers. Arbitrary precision floating points operations are a derivative,
-and not the initial design goal.\footnote{currently (|v1.08|), the only
- non-elementary operation implemented for floating point numbers is the
- square-root extraction; no signed infinities, signed zeroes, |NaN|'s, error
- trapes\dots, have been
- implemented, only the notion of `scientific notation with a given number of
- significant figures'.}${}^{\text{,\,}}$\footnote{multiplication of two floats
- with |P=\string\xinttheDigits| digits is first done exactly then rounded to
- |P| digits, rather than using a specially tailored multiplication for floating
- point numbers which would be more efficient (it is a waste to evaluate fully
- the multiplication result with |2P| or |2P-1| digits.)}
+and not the initial design goal.%
+%
+\footnote{currently (|v1.08|), the only non-elementary operation
+ implemented for floating point numbers is the square-root extraction;
+ no signed infinities, signed zeroes, |NaN|'s, error trapes\dots, have
+ been implemented, only the notion of `scientific notation with a given
+ number of significant figures'.}%
+%
+${}^{\text{,\,}}$%
+%
+\footnote{multiplication of two floats with |P=\xinttheDigits| digits is
+ first done exactly then rounded to |P| digits, rather than using a
+ specially tailored multiplication for floating point numbers which
+ would be more efficient (it is a waste to evaluate fully the
+ multiplication result with |2P| or |2P-1| digits.)}
The \LaTeX3 project has implemented expandably floating-point computations with
16 significant figures
(\href{http://www.ctan.org/pkg/l3kernel}{l3fp}), including
-special functions such as exp, log, sine and cosine.\footnote{at the time of
- writing the \href{http://www.ctan.org/pkg/l3kernel}{l3fp}
- (exactly represented) floating point numbers have their exponents limited to
- $\pm$\digitstt{9999}.}
-
-The \xintname package can be used for @24@, @40@, etc\dots{} significant figures
-but one rather quickly (not much beyond @100@ figures) hits against a
+special functions such as exp, log, sine and cosine.%
+%
+\footnote{at the time of writing the
+ \href{http://www.ctan.org/pkg/l3kernel}{l3fp} (exactly represented)
+ floating point numbers have their exponents limited to
+ $\pm$\dtt{9999}.} There is also
+ \href{http://latex-project.org/svnroot/experimental/trunk/l3trial/l3bigint}{l3bigint},
+ which (a.t.t.o.w.) is part of the experimental trunk of the
+ \href{http://latex-project.org}{\LaTeX3 Project}. Like
+ \href{http://www.ctan.org/pkg/bigintcalc}{bigintcalc} and \xintname it
+ provides macros for big integer arithmetics. All three implementations of the
+ basic arithmetic macros can be mapped to easier infix notations via the
+ services of the \href{http://www.ctan.org/pkg/bnumexpr}{bnumexpr} package.
+
+The \xintname package can be used for $24$, $40$, etc\dots{} significant figures
+but one rather quickly (not much beyond $100$ figures) hits against a
`wall' created by the constraint of expandability: currently, multiplying out
-two one-hundred digits numbers takes circa @80@ or @90@ times longer than for
+two one-hundred digits numbers takes circa $80$ or $90$ times longer than for
two ten-digits numbers, which is reasonable, but multiplying out two
-one-thousand digits numbers takes more than @500@ times longer than for two one
+one-thousand digits numbers takes more than $500$ times longer than for two one
hundred-digits numbers. This shows that the algorithm is drifting from quadratic
-to cubic in that range. On my laptop multiplication of two @1000@-digits numbers
+to cubic in that range. On my laptop multiplication of two $1000$-digits numbers
takes some seconds, so it can not be done routinely in a
-document.\footnote{without entering into too much technical details, the source
+document.%
+%
+\footnote{without entering into too much technical details, the source
of this `wall' is that when dealing with two long operands, when one wants to
pick some digits from the second one, one has to jump above all digits
constituting the first one, which can not be stored away: expandability
@@ -1751,34 +3120,40 @@ demonstrated long ago by the \href{http://www.ctan.org/pkg/pi}{pi
compute with many digits at a much higher speed than what \xintname
achieves: but, direct access to memory storage in one form or another
seems a necessity for this kind of speed and one has to renounce at the
-complete expandability.\footnote{I could, naturally, be proven
- wrong!}\,\footnote{The Lua\TeX{} project possibly makes endeavours
- such as \xintname appear even more insane that they are, in truth.}
-
+complete expandability.%
+%
+\footnote{I could, naturally, be proven wrong!}\,%
+%
+\footnote{The Lua\TeX{} project possibly makes endeavours such as
+ \xintname appear even more insane that they are, in truth.}
% \section{Missing things}
-
% `Arbitrary-precision' floating-point
% operations are currently limited to the basic four operations, the power
% function with integer exponent, and the extraction of square-roots.
-
-\section{Origins of the package}
+\subsection{Origins of the package}
Package |bigintcalc| by \textsc{Heiko Oberdiek} already
provides expandable arithmetic operations on ``big integers'',
-exceeding the \TeX{} limits (of @2^{31}-1@), so why another\footnote{this section was written before the
- \xintfracname package; the author is not aware of another package allowing
- expandable computations with arbitrarily big fractions.}
+exceeding the \TeX{} limits (of $2^{31}-1$), so why another%
+%
+\footnote{this section was written before the \xintfracname package; the
+ author is not aware of another package allowing expandable
+ computations with arbitrarily big fractions.}
+%
one?
I got started on this in early March 2013, via a thread on the
|c.t.tex| usenet group, where \textsc{Ulrich D\,i\,e\,z} used the
previously cited package together with a macro (|\ReverseOrder|)
-which I had contributed to another thread.\footnote{the
- \csa{ReverseOrder} could be avoided in that circumstance, but it
- does play a crucial r\^ole here.} What I had learned in this
+which I had contributed to another thread.%
+%
+\footnote{the \csa{ReverseOrder} could be avoided in that circumstance,
+ but it does play a crucial r\^ole here.}
+%
+What I had learned in this
other thread thanks to interaction with \textsc{Ulrich D\,i\,e\,z} and
\textsc{GL} on expandable manipulations of tokens motivated me to
try my hands at addition and multiplication.
@@ -1789,7 +3164,7 @@ versions did not use the \eTeX{} \csa{numexpr} primitive, they worked
one digit at a time, having previously stored carry-arithmetic in
1200 macros.
-I noticed that the |bigintcalc| package used\csa{numexpr}
+I noticed that the |bigintcalc| package used \csa{numexpr}
if available, but (as far as I could tell) not
to do computations many digits at a time. Using \csa{numexpr} for
one digit at a time for \csa{bigAdd} and \csa{bigMul} slowed them
@@ -1799,18 +3174,15 @@ could be gained by using \csa{numexpr} to do four digits at a time
for elementary multiplications (as the maximal admissible number
for \csa{numexpr} has ten digits).
-The present package is the result of this initial questioning.
+The present package is the result of this initial questioning.
% \begin{framed}\centering
% \xintname requires the \eTeX{} extensions.
% \end{framed}
-
-
-\section{Expansion matters}
+\subsection{Expansion matters}
\label{sec:expansions}
-
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
@@ -1820,32 +3192,34 @@ hitting against something not further expandable like an unexpandable
\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.
-
%
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}.}
+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}}}
+\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
+priori to obey the \TeX{} bound of \dtt{\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
+The \csbxint{ApplyInline} and \csbxintForstar\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
@@ -1857,15 +3231,17 @@ 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.
+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.
+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
+ expansion} for this argument to be acceptable.%
+%
+\footnote{this is not quite as
stringent as claimed here, see \autoref{sec:useofcount} for more details.}
The
main exception is inside \csbxint{expr}|...\relax| where everything will be
@@ -1873,16 +3249,17 @@ expanded from left to right, completely.
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
- un-expandable
- such as a\strut{} digit or a brace is hit against. This example
- \centeredline{|\def\x{98765}\def\y{43210}|%
- |\xintAdd {\x}{\x\y}|} is \emph{not} a legal construct, as the |\y| will
- remain untouched by expansion and not get converted into the digits which
- are expected by the sub-routines of |\xintAdd|. It is a |\numexpr|
- which will expand it and an arithmetic overflow will arise as |9876543210|
- exceeds the \TeX{} bounds.
+\item the macros \fexpan d their arguments, this means that they expand the
+ first token seen (for each argument), then expand, etc..., until something
+ un-expandable such as a\strut{} digit or a brace is hit against. This
+ example
+%
+ \leftedline{|\def\x{98765}\def\y{43210}| |\xintAdd {\x}{\x\y}|}
+%
+ is \emph{not} a legal construct, as the |\y| will remain untouched by
+ expansion and not get converted into the digits which are expected by the
+ sub-routines of |\xintAdd|. It is a |\numexpr| which will expand it and an
+ arithmetic overflow will arise as |9876543210| exceeds the \TeX{} bounds.
\begingroup\slshape
With \csbxint{theexpr} one could write |\xinttheexpr \x+\x\y\relax|, or
@@ -1897,7 +3274,9 @@ Summary of important expansion aspects:
package provided conditionals such as \csbxint{ifEq}, \csbxint{ifGt},
\csbxint{ifSgn}, \csbxint{ifOdd}\dots, or, for \LaTeX{} users and when dealing
with short integers the
- \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
+ \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}%
+%
+\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
expandable conditionals (for small integers only) such as \texttt{\char92
ifnumequal}, \texttt{\char92 ifnumgreater}, \dots . Use of
\emph{non-expandable} things such as \csa{ifthenelse} is impossible inside the
@@ -1907,15 +3286,19 @@ Summary of important expansion aspects:
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{|\xinttheiexpr\ifnum3>2 143\else 33\fi 0^2\relax|$\to$\digitstt{\xinttheiexpr \ifnum3>2 143\else 33\fi 0^2\relax =1430\char`\^2}}
+%
+\leftedline{|\xinttheiexpr\ifnum3>2 143\else 33\fi
+ 0^2\relax|$\to$\dtt{\xinttheiexpr \ifnum3>2 143\else 33\fi 0^2\relax
+ =1430\char`\^2}}
+%
\endgroup
-\item after the definition |\def\x {12}|, one can not use
+\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.
+ its opposite.
\begingroup\slshape
Again, this is otherwise inside an \csbxint{theexpr}-ession or
@@ -1927,27 +3310,36 @@ Summary of important expansion aspects:
\def\x {12}%
\def\AplusBC #1#2#3{\xintAdd {#1}{\xintMul {#2}{#3}}}%
-
-\item \label{item:xpxp} With the definition \centeredline{%
- |\def\AplusBC #1#2#3{\xintAdd {#1}{\xintMul {#2}{#3}}}|} one obtains an
+\item \label{item:xpxp} With the definition
+%
+\leftedline{|\def\AplusBC #1#2#3{\xintAdd {#1}{\xintMul {#2}{#3}}}|}
+%
+one obtains an
expandable macro producing the expected result, not in two, but rather in
three steps: a first expansion is consumed by the macro expanding to its
definition. As the package macros expand their arguments until no more is
possible (regarding what comes first), this |\AplusBC| may be used inside
them: {|\xintAdd {\AplusBC {1}{2}{3}}{4}|} does work and returns
- \digitstt{\xintAdd {\AplusBC {1}{2}{3}}{4}}.
+ \dtt{\xintAdd {\AplusBC {1}{2}{3}}{4}}.
If, for some reason, it is important to create a macro expanding in two steps
- to its final value, one may either do:
-\smallskip\centeredline {|\def\AplusBC
- #1#2#3{|{\color{blue}|\romannumeral-`0\xintAdd |}|{#1}{\xintMul {#2}{#3}}}|}or use the \emph{lowercase} form of
- \csa{xintAdd}: \smallskip\centeredline {|\def\AplusBC
- #1#2#3{|{\color{blue}|\romannumeral0\xintadd |}|{#1}{\xintMul {#2}{#3}}}|}
-
+ to its final value, one may either do:
+%
+\smallskip
+%
+\leftedline {|\def\AplusBC #1#2#3{\romannumeral-`0\xintAdd {#1}{\xintMul
+ {#2}{#3}}}|}
+%
+or use the \emph{lowercase} form of \csa{xintAdd}:
+%
+\smallskip
+%
+\leftedline {|\def\AplusBC #1#2#3{\romannumeral0\xintadd {#1}{\xintMul
+ {#2}{#3}}}|}
+
and then \csa{AplusBC} will share the same properties as do the
other \xintname `primitive' macros.
-
\end{enumerate}
The |\romannumeral0| and |\romannumeral-`0| things above look like an invitation
@@ -1957,10 +3349,93 @@ arbitrarily the package macros, and the new ones will be completely expandable
and usable one within the other.
Since release |1.07| the \csbxint{NewExpr} command automatizes the creation of
-such expandable macros: \centeredline{|\xintNewExpr\AplusBC[3]{#1+#2*#3}|}
+such expandable macros:
+%
+\leftedline{|\xintNewExpr\AplusBC[3]{#1+#2*#3}|}
+%
creates the |\AplusBC| macro doing the above and expanding in two expansion
steps.
+\subsection{Efficiency; floating point macros}
+
+The size of the manipulated numbers is limited by two
+factors:\footnote{there is an intrinsic limit of
+ \dtt{\number"7FFFFFFF} on the number of digits, but it is
+ irrelevant, in view of the other limiting factors.} (1.)~\emph{the
+available memory as configured in the |tex| executable},
+(2.)~\emph{the \emph{time} necessary to fully expand the computations
+ themselves}.
+The most limiting factor is the second one, the time
+needed (for multiplication and division, and even more for powers)
+explodes with increasing input sizes long before the computations could
+get limited by constraints on \TeX's available memory:
+computations with $100$ digits are still reasonably fast, but the
+situation then deteriorates swiftly, as it takes of the order of seconds (on my
+laptop) for the package to multiply exactly two numbers each of $1000$ digits
+and it would take hours for numbers each of $20000$ digits.\footnote{Perhaps
+ some faster routines could emerge from an approach which, while maintaining
+ expandability would renounce at \fexpan dability (without impacting the input
+ save stack). There is one such routine \csbxint{XTrunc} which is able to write
+ to a file (or inside an \csa{edef}) tens of thousands of digits of a
+ (reasonably-sized) fraction.}
+
+To address this issue, floating
+point macros are provided to work with a given arbitrary precision. The default
+size for significands is $16$ digits. Working with significands of $24$, $32$,
+$48$, $64$, or even $80$ digits is well within the reach of the package. But
+routine multiplications and divisions will become too slow if the precision goes
+into the hundreds, although the syntax to set it (|\xintDigits:=P;|) allows
+values up to $32767$.\footnote{for a one-shot conversion of a fraction to float
+ format, or one addition, a precision exceeding \dtt{32767} may be passed
+ as optional argument to the used macro.} The exponents may be as big as
+\dtt{$\pm$\number"7FFFFFFF}.\footnote{almost\dots{} as inner manipulations
+ may either add or subtract the precision value to the exponent, arithmetic
+ overflow may occur if the exponents are a bit too close to the \TeX{} bound
+ \dtt{$\pm$\number"7FFFFFFF}.}
+
+Here is such a floating point computation:
+%
+\leftedline{|\xintFloatPower [48] {1.1547}{\xintiiPow {2}{35}}|}
+%
+which thus computes $(1.1547)^{2^{35}}=(1.1547)^{\xintiiPow {2}{35}}$ to be
+approximately
+%
+\leftedline{\dtt{\np{\xintFloatPower [48] {1.1547}{\xintiiPow {2}{35}}}}}
+%
+Notice that $2^{35}$ exceeds \TeX's bound, but \csa{xintFloatPower} allows it,
+what counts is the exponent of the result which, while dangerously close to
+$2^{31}$ is not quite there yet. The printing of the result was done via the
+|\numprint| command from the \href{http://ctan.org/pkg/numprint}{numprint}
+package\footnote{\url{http://ctan.org/pkg/numprint}}.
+
+The same computation can be done via the non-expandable assignment
+|\xintDigits:=48;| and then
+%
+\leftedline{|\xintthefloatexpr 1.1547^(2^35)\relax|}
+%
+Notice though that |2^35| will be evaluated as a
+floating point number, and if the floating point precision had been too
+low, this computation would have given an inexact value. It is safer,
+and also more efficient to code this as:
+%
+\leftedline{|\xintthefloatexpr 1.1547^\xintiiexpr 2^35\relax\relax|}
+%
+The \csbxint{iiexpr} is a cousin of \csbxint{expr} which is big integer-only
+and skips the overhead of fraction management. Notice on this example that
+being embedded inside the |floatexpr|-ession has nil influence on the
+|iiexpr|-ession: expansion proceeds in exactly the same way as if it had been
+at the `top' level.
+
+\xintexprname provides \emph{no} implementation of the |IEEE| standard:
+no |NaN|s, signed infinities, signed zeroes, error traps, \dots; what is
+achieved though is exact rounding for the basic operations. The only
+non-algebraic operation currently implemented is square root extraction.
+The power functions (there are three of them: \csbxint{Pow} to which |^|
+is mapped in |\xintexpr..\relax|, \csbxint{FloatPower} for |^| in
+|\xintfloatexpr..relax|, and \csbxint{FloatPow} which is slighty faster
+but limits the exponent to the \TeX{} bound) allow only integral
+exponents.
+
\section{User interface}
@@ -1969,37 +3444,49 @@ doing macro definitions in the midst of the computation; in many cases, one does
not need complete expandability, and definitions are allowed. In such contexts,
there is no declaration for the user to be made to the package of a ``typed
variable'' such as a long integer, or a (long) fraction, or possibly an
-|\xintexpr|-ession. Rather, the user has at its disposals the general tools of
-the \TeX{} language: |\def| or (in \LaTeX) |\newcommand|, and |\edef|.
+|\xintexpr|-ession. Rather, the user has at its disposal the general tools of
+the \TeX{} language: |\def| and |\edef|. In \LaTeX\ there is |\newcommand| as
+wrapper to |\def|,
+but \LaTeX\ chose not to provide an analogous wrapper for |\edef|. It can still
+be used directly of course.\footnote{I don't know if \LaTeX3 will still allow
+ direct use of |\def| and |\edef|\dots}
The \xinttoolsname package provides |\oodef| which expands twice the replacement
-text, hence forces complete expansion when the top level of this replacement
+text\footnote{only for parameter less undelimited macros.}, hence forces
+complete expansion when the top level of this replacement
text is a call to one of the \xintname bundle macros, its arguments being
themselves chains of such macros. There is also |\fdef| which will apply \fexpan
sion to the replacement text. Both are in such uses faster alternatives to
-|\edef|.
+|\edef|.
This section will explain the various inputs which are recognized by the package
macros and the format for their outputs. Inputs have mainly five possible
shapes:
\begin{enumerate}
\item expressions which will end up inside a |\numexpr..\relax|,
+
\item long integers in the strict format (no |+|, no leading zeroes, a count
register or variable must be prefixed by |\the| or |\number|)
+
\item long integers in the general format allowing both |-| and |+| signs, then
leading zeroes, and a count register or variable without prefix is allowed,
+
\item fractions with numerators and denominators as in the
previous item, or also decimal numbers, possibly in scientific notation (with
a lowercase |e|), and
also optionally the semi-private |A/B[N]| format,
+
\item and finally expandable material understood by the |\xintexpr| parser.
\end{enumerate}
Outputs are mostly of the following types:
\begin{enumerate}
\item long integers in the strict format,
+
\item fractions in the |A/B[N]| format where |A| and |B| are both strict long
integers, and |B| is positive,
+
\item numbers in scientific format (with a lowercase |e|),
+
\item the private |\xintexpr| format which needs the |\xintthe| prefix in order
to end up on the printed page (or get expanded in the log)
or be used as argument to the package macros.
@@ -2007,8 +3494,6 @@ Outputs are mostly of the following types:
{\etocdefaultlines\etocsettocstyle{}{}\localtableofcontents}
-
-
\subsection {Input formats}\label{sec:inputs}
% \edef\z {\xintAdd
@@ -2021,7 +3506,7 @@ will be embedded in a |\numexpr..\relax| hence on input one may even use count
registers or variables and expressions with infix operators. Notice though that
|-(..stuff..)| is surprisingly not legal in the |\numexpr| syntax!
-But \xintname is mainly devoted to big numbers;
+But \xintname is mainly devoted to big numbers;
the allowed input formats for `long numbers' and `fractions' are:
\begin{enumerate}
\item the strict format\ntype{f} is for some macros of \xintname which only
@@ -2033,51 +3518,68 @@ the allowed input formats for `long numbers' and `fractions' are:
like \csbxint{Add} and accept the extended format described in the next item;
they may have a `strict' variant such as \csbxint{iiAdd} which remains
available even with \xintfracname loaded, for optimization purposes.
+
\item the macro \csbxint{Num} normalizes into strict format an input having
arbitrarily many minus and plus signs, followed by a string of zeroes, then
- digits:\centeredline{|\xintNum
- {+-+-+----++-++----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}.\footnote{A
+ digits:%
+ %
+ \leftedline{|\xintNum
+ {+-+-+----++-++----00000000009876543210}|\dtt{=\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}.%
+%
+\footnote{A
\LaTeX{} \texttt{\char 92value\{countername\}} is accepted as macro
argument.}
+
\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}|}%
- 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{|\xintPow {2}{100}|%
- \digitstt{=\xintPow {2}{100}}}
- \centeredline{|\xintFloat{\xintPow {2}{100}}|%
- \digitstt{=\xintFloat{\xintPow {2}{100}}}}
- \centeredline{|\xintFloatPow {2}{100}|%
- \digitstt{=\xintFloatPow {2}{100}}}
-%
-Produced fractions having a denominator equal to one are, as a general rule,
-nevertheless printed as fractions. 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}}}%
+ example:%
+ %
+ \footnote{the square brackets one sees in various outputs are
+ explained
+ near the end of this section.} %
+ %
+ \leftedline{|\xintAdd
+ {+--0367.8920280/-++278.289287}{-109.2882/+270.12898}|}
+ %
+ Scientific notation is accepted for both numerator and denominator of a
+ fraction, and is produced on output by \csbxint{Float}:
+ %
+ \begin{quote}
+ |\xintAdd{10.1e1}{101.010e3}|\dtt{=\xintAdd{10.1e1}{101.010e3}}\\
+ %
+ |\xintFloatAdd{10.1e1}{101.010e3}|\dtt{=\xintFloatAdd{10.1e1}{101.010e3}}\\
+ %
+ |\xintPow {2}{100}|\dtt{=\xintPow {2}{100}}\\
+ %
+ |\xintFloat{\xintPow {2}{100}}|\dtt{=\xintFloat{\xintPow {2}{100}}}\\
+ %
+ |\xintFloatPow {2}{100}|\dtt{=\xintFloatPow {2}{100}}
+ \end{quote}
+ %
+ Produced fractions having a denominator equal to one are, as a general
+ rule, nevertheless printed as fractions. In math mode \csbxint{Frac}
+ will remove such dummy denominators, and in inline text mode one has
+ \csbxint{PRaw} with the similar effect.
+ %
+ \begin{quote}
+ |\xintPRaw{\xintAdd{10.1e1}{101.010e3}}|\dtt{=\xintPRaw{\xintAdd{10.1e1}{101.010e3}}}\\
+ %
+ |\xintRaw{1.234e5/6.789e3}|\dtt{=\xintRaw{1.234e5/6.789e3}}%
+ \end{quote}
+
\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}).
+ expansion, and is described in \autoref{sec:expr11} and \autoref{sec:expr}.
\end{enumerate}
+
Generally speaking, there should be no spaces among the digits in the inputs
(in arguments to the package macros).
Although most would be harmless in most macros, there are some cases
@@ -2087,35 +3589,31 @@ This is entirely otherwise inside an |\xintexpr|-ession, where spaces are
ignored (except when they occur inside arguments to some macros, thus
escaping the |\xintexpr| parser). See the \hyperref[sec:expr]{documentation}.
-
-
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''.
+fractions on input. Those parsing their inputs through \csbxint{Num} will now
+accept fractions, truncating them first to integers.
With \xintfracname loaded, a number may be empty or start directly with a
-decimal point: \centeredline{|\xintRaw{}=\xintRaw{.}|\digitstt{=\xintRaw{}}}
-\centeredline{|\xintPow{-.3/.7}{11}|\digitstt{=\xintPow{-.3/+.7}{11}}}
-\centeredline{|\xinttheexpr (-.3/.7)^11\relax|%
- \digitstt{=\xinttheexpr (-.3/.7)^11\relax}} It is also licit to use |\A/\B| as
+decimal point:
+\begin{quote}
+ |\xintRaw{}=\xintRaw{.}|\dtt{=\xintRaw{}}\\
+ |\xintPow{-.3/.7}{11}|\dtt{=\xintPow{-.3/+.7}{11}}\\
+ |\xinttheexpr (-.3/.7)^11\relax|\dtt{=\xinttheexpr (-.3/.7)^11\relax}
+\end{quote}
+It is also licit to use |\A/\B| as
input if each of |\A| and |\B| expands (in the sense previously described) to a
``decimal number'' as examplified above by the numerators and denominators
(thus, possibly with a `scientific' exponent part, with a lowercase `e'). Or one
may have just one macro |\C| which expands to such a ``fraction with optional
decimal points'', or mixed things 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}!
+already |123\A| is a no-go, \emph{except inside an |\xintexpr|-ession}!
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
+fraction.
+%
+\leftedline{|\xintRaw {+--+1253.2782e++--3/---0087.123e---5}|\dtt{=\xintRaw
{+--+1253.2782e++--3/---0087.123e---5}}}
Arithmetic macros of \xintname which parse their arguments automatically through
@@ -2125,15 +3623,13 @@ symbol%\ntype{\Numf{\unskip\kern\dimexpr\FrameSep+\FrameRule\relax}}
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}.
-
The \xintfracname macros generally output
-their result in |A/B[n]| format, representing the fraction |A/B| times |10^n|.
+their result 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
@@ -2143,7 +3639,7 @@ the strict integer format described above. So |16000/289072[17]| or
|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
-zeroes; and NO plus sign).
+zeroes; and NO plus sign).
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
@@ -2152,150 +3648,122 @@ impact.
\subsection{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
+\csbxint{Mul}, \csbxint{Pow}, initiallly synonyms in \xintname of
+\csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, \csbxint{iPow}, are modified
+to become the fraction handling routines.%
+%
+\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 then 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
+ provided.}
+%
+\footnote{as commented upon more later, for that very reason use of
+ \csbxint{Add} etc\dots when only \xintname is loaded is strongly
+ discouraged.}\,%
+%
+% \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, which they first
+% truncate to integers, and then the output format is the integer 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.}
+%
+They 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|).
+% (\emph{i.e} less in absolute value than |2^{31}-9|).
+%
+This represents |(A/B)| times |10^n|.
%
-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 zeroes (\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
+\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 zeroes (\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 zeroes 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 zeroes). 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}).
-
-
-% The macro \csbxint{Trunc}|{N}{f}| prints\footnote{`prints' does not at all mean
-% that this macro is designed for typesetting; I am just using the verb here in
-% analogy to the effect of the functioning of a computing software in console
-% mode. The package does not provide any `printing' facility, besides its
-% rudimentary \csbxint{Frac} and \csbxint{FwOver} math-mode only macros. To deal
-% with really long numbers, some macros are necessary as \TeX{} by default will
-% print a long number on a single line extending beyond the page limits. The
-% \csa{printnumber} command used in this documentation is just one way to
-% address this problem, some other method should be used if it is important that
-% digits occupy the same width always.} the decimal expansion of |f| with |N|
-% digits after the decimal point.\footnote{the current release does not provide a
-% macro to get the period of the decimal expansion.} Currently, it does not
-% verify that |N| is non-negative and strange things could happen with a negative
-% |N|. A negative |f| is no problem, needless to say. When the original
-% fraction is negative and its truncation has only zeroes, it is printed as
-% |-0.0...0|, with |N| zeroes following the decimal point:
-% \centeredline{|\xintTrunc {5}{\xintPow {-13}{-9}}|\digitstt{=\xintTrunc
-% {5}{\xintPow {-13}{-9}}}}%
-% \centeredline{|\xintTrunc {20}{\xintPow {-13}{-9}}|\digitstt{=\xintTrunc
-% {20}{\xintPow {-13}{-9}}}} The output always contains a decimal point (even
-% for |N=0|) followed by |N| digits, except when the original fraction was zero.
-% In that case the output is |0|, with no decimal point. \centeredline{|\xintTrunc
-% {10}{\xintSum {{1/2}{1/3}{1/5}{-31/30}}}|%
-% \digitstt{=\xintTrunc {10}{\xintSum {{1/2}{1/3}{1/5}{-31/30}}}}}
-
-% \edef\z {\xintPow {1.01}{100}}
-
-% The macro \csbxint{iTrunc}|{N}{f}| is like \csa{xintTrunc}|{N}{f}|
-% followed by multiplication by |10^N|. Thus, it outputs an integer
-% in a format acceptable by the integer-only macros.
-% To get the integer part of the decimal expansion of |f|, use
-% |\xintiTrunc{0}{f}|: \centeredline{|\xintiTrunc {0}{\xintPow
-% {1.01}{100}}|\digitstt{=\xintiTrunc {0}\z}}%
-% \centeredline{|\xintiTrunc {0}{\xintPow{0.123}{-10}}|\digitstt{=\xintiTrunc
-% {0}{\xintPow{0.123}{-10}}}}
-
-See also the documentations of \csbxint{Trunc}, \csbxint{iTrunc},
-\csbxint{XTrunc}, \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]|.
-
-
-\subsection{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{|\xinttheiexpr 10!,2^20,lcm(1000,725)\relax|%
- $\to$\digitstt{\xinttheiexpr 10!,2^20,lcm(1000,725)\relax}}
-
-
-\section{Use of \TeX{} registers and variables}
+ |2^{31}-9|.}
-{\etocdefaultlines\etocsettocstyle{}{}\localtableofcontents}
+\begin{framed}
+ The fraction output format for most \xintfracname macros is {|A/B[n]|} which
+ stands for |(A/B)|$\times$|10^n|. The |A| and |B| may end in zeroes
+ (\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.
+ Conversely, this format is accepted on input and is parsed more quickly than
+ fractions containing decimal points or in scientific notation; the input
+ denominator is optional.
+\end{framed}
+
+\begin{itemize}
+\item 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).
+
+\item \csbxint{Raw} prints the fraction directly as its internal
+ representation |A/B[n]|.
+\begin{everbatim*}
+$\xintRaw{273.3734e5/3395.7200e-2}=\xintFrac {273.3734e5/3395.7200e-2}$
+\end{everbatim*}
+
+\item \csbxint{PRaw} does the same but without printing the |[n]| if |n=0| and
+ without printing |/1| if |B=1|.
+
+\item \csbxint{Irr} reduces the fraction to its irreducible form |C/D|
+ (without a trailing |[0]|), and it prints the |D| even if |D=1|.
+\begin{everbatim*}
+$\xintIrr{273.3734e5/3395.7200e-2}$
+\end{everbatim*}
+
+\item \csbxint{Num} from package \xintname becomes when \xintfracname is
+ loaded a synonym to its macro \csbxint{TTrunc} (same as
+ \csbxint{iTrunc}|{0}|) which truncates to the nearest integer.
+
+\item See also the documentations of \csbxint{Trunc}, \csbxint{iTrunc},
+\csbxint{XTrunc}, \csbxint{Round}, \csbxint{iRound} and \csbxint{Float}.
+
+\item The \csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, \csbxint{iPow}
+ macros and some others accept fractions on input which they truncate via
+ \csbxint{TTrunc}. On output they still produce an integer with no fraction
+ slash nor trailing |[n]|.
+
+\item The \csbxint{iiAdd}, \csbxint{iiSub}, \csbxint{iiMul}, \csbxint{iiPow},
+ and others with `\textcolor{blue}{ii}' in their names accept on input only
+ integers in the strict format (they skip the overhead of the \csbxint{Num}
+ parsing) and naturally they output an integer, with no fraction slash nor
+ trailing |[n]|.
+
+\end{itemize}
+
+%\subsection{Multiple outputs}\label{sec:multout}
+
+Some macros return a token list of two or more numbers or fractions; they are
+then each enclosed in braces. Examples are \csbxint{iDivision} 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 number output is when using commas inside
+\csbxint{expr}|..\relax|:
+%
+\leftedline{|\xinttheiexpr 10!,2^20,lcm(1000,725)\relax|%
+ $\to$\dtt{\xinttheiexpr 10!,2^20,lcm(1000,725)\relax}}
+
+This returns a comma separated list, with a space after each comma.
+
+% \section{Use of \TeX{} registers and variables}
+
+% {\etocdefaultlines\etocsettocstyle{}{}\localtableofcontents}
\subsection{Use of count registers}\label{sec:useofcount}
@@ -2325,55 +3793,64 @@ 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{}
+ 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
+ removed and chaos\IMPORTANT{} will ensue 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
+ 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
+%
+\leftedline{|\cnta 10 \cntb 35 \xintRaw
+ {\cnta+\cntb{/}17/1+\cnta*\cntb}|\dtt{->\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
+\everb|@
+\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+
+ \numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }
+|
+\cnta 100 \cntb 10 \cntc 1
+%
+\leftedline{\dtt{\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
+ as regular
+|\numexpr|-syntax: and indeed, they
are removed at some point in the processing.
-
\subsection{Dimensions}
\label{sec:Dimensions}
\meta{dimen} variables can be converted into (short) integers suitable for the
\xintname macros by prefixing them with |\number|. This transforms a dimension
into an explicit short integer which is its value in terms of the |sp| unit
-(@1/65536@\,|pt|).
+($1/65536$\,|pt|).
When |\number| is applied to a \meta{glue} variable, the stretch and shrink
-components are lost.
+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.
+described above, and usable in the \xintname bundle macros.
This conversion is done automatically inside an
|\xintexpr|-essions, with tacit multiplication implied if prefixed by some
@@ -2387,12 +3864,11 @@ factor and a rounding to a given number of decimal places.
A \hyperref[tableofdimensions]{table of dimensions} illustrates that the
internal values used by \TeX{} do not correspond always to the closest rounding.
For example a millimeter exact value in terms of |sp| units is
-\digitstt{72.27/10/2.54*65536=\xinttheexpr trunc(72.27/10/2.54*65536,3)\relax
- ...} and \TeX{} uses internally \digitstt{\number\dimexpr 1mm\relax}|sp| (it
+\dtt{72.27/10/2.54*65536=\xinttheexpr trunc(72.27/10/2.54*65536,3)\relax
+ ...} and \TeX{} uses internally \dtt{\number\dimexpr 1mm\relax}|sp| (it
thus appears that \TeX{} truncates to get an integral multiple of the |sp|
unit).
-
% impossible avec le \ignorespaces mis par LaTeX de faire \number\dimexpr
% idem à la fin avec \unskip, si je veux xinttheexpr
\begin{figure*}[ht!]
@@ -2440,73 +3916,89 @@ unit).
\end{figure*}
There is something quite amusing with the Didot point. According to the \TeX
-Book, @1157@\,|dd|=@1238@\,|pt|. The actual internal value of @1@\,|dd| in \TeX{} is @70124@\,|sp|. We can use \xintcfracname to display the list of
-centered convergents of the fraction @70124/65536@:
-\centeredline{|\xintListWithSep{, }{\xintFtoCCv{70124/65536}}|}
+Book, $1157$\,|dd|=$1238$\,|pt|. The actual internal value of $1$\,|dd| in \TeX{} is $70124$\,|sp|. We can use \xintcfracname to display the list of
+centered convergents of the fraction $70124/65536$:
+%
+\leftedline{|\xintListWithSep{, }{\xintFtoCCv{70124/65536}}|}
%
-\xintFor* #1 in {\xintFtoCCv{70124/65536}}\do {@#1@, }and we don't find
-@1238/1157@ therein, but another approximant @1452/1357@!
+\xintFor* #1 in {\xintFtoCCv{70124/65536}}\do {$\printnumber{#1}$, }%
+and we don't find
+$1238/1157$ therein, but another approximant $1452/1357$!
-And indeed multiplying @70124/65536@ by @1157@, and respectively @1357@, we find
+And indeed multiplying $70124/65536$ by $1157$, and respectively $1357$, we find
the approximations (wait for more, later):
-\centeredline{``@1157@\,|dd|''\digitstt{=\xinttheexpr trunc(1157\dimexpr
+%
+\leftedline{``$1157$\,|dd|''\dtt{=\xinttheexpr trunc(1157\dimexpr
1dd\relax/\dimexpr 1pt\relax,12)\relax}\dots|pt|}
-\centeredline{``@1357@\,|dd|''\digitstt{=\xinttheexpr trunc(1357\dimexpr
+%
+\leftedline{``$1357$\,|dd|''\dtt{=\xinttheexpr trunc(1357\dimexpr
1dd\relax/\dimexpr 1pt\relax,12)\relax}\dots|pt|}
-and we seemingly discover that @1357@\,|dd|=@1452@\,|pt| is \emph{far more
- accurate} than
-the \TeX Book formula @1157@\,|dd|=@1238@\,|pt|~!
-The formula to compute @N@\,|dd| was
%
-\centeredline{|\xinttheexpr trunc(N\dimexpr 1dd\relax/\dimexpr
+and we seemingly discover that $1357$\,|dd|=$1452$\,|pt| is \emph{far more
+ accurate} than
+the \TeX Book formula $1157$\,|dd|=$1238$\,|pt|~!
+The formula to compute $N$\,|dd| was
+%
+\leftedline{|\xinttheexpr trunc(N\dimexpr 1dd\relax/\dimexpr
1pt\relax,12)\relax}|}
%
-What's the catch? The catch is that \TeX{} \emph{does not} compute @1157@\,|dd|
-like we just did:
-\centeredline{@1157@\,|dd|=|\number\dimexpr 1157dd\relax/65536|%
- \digitstt{=\xintTrunc{12}{\number\dimexpr 1157dd\relax/65536}}\dots|pt|}
-\centeredline{@1357@\,|dd|=|\number\dimexpr 1357dd\relax/65536|%
- \digitstt{=\xintTrunc{12}{\number\dimexpr 1357dd\relax/65536}}\dots|pt|}
+What's the catch? The catch is that \TeX{} \emph{does not} compute $1157$\,|dd|
+like we just did:%
+%
+\leftedline{$1157$\,|dd|=|\number\dimexpr 1157dd\relax/65536|%
+ \dtt{=\xintTrunc{12}{\number\dimexpr 1157dd\relax/65536}}\dots|pt|}
+%
+\leftedline{$1357$\,|dd|=|\number\dimexpr 1357dd\relax/65536|%
+ \dtt{=\xintTrunc{12}{\number\dimexpr 1357dd\relax/65536}}\dots|pt|}
+%
We thus discover that \TeX{} (or rather here, e-\TeX{}, but one can check that
-this works the same in \TeX82), uses indeed @1238/1157@ as a conversion factor,
-and necessarily intermediate computations are done with more precision than is
-possible with only integers less than @2^31@ (or @2^30@ for dimensions). Hence
-the @1452/1357@ ratio is irrelevant, a misleading artefact of the necessary
-rounding (or, as we see, truncating) for one |dd| as an integral number of
-|sp|'s.
+this works the same in \TeX82), uses indeed $1238/1157$ as a conversion
+factor, and necessarily intermediate computations are done with more precision
+than is possible with only integers less than $2^{31}$ (or $2^{30}$ for
+dimensions). Hence the $1452/1357$ ratio is irrelevant, a misleading artefact
+of the necessary rounding (or, as we see, truncating) for one |dd| as an
+integral number of |sp|'s.
Let us now
use |\xintexpr| to compute the value of the Didot point in millimeters, if
-the above rule is exactly verified: \centeredline{|\xinttheexpr
- trunc(1238/1157*25.4/72.27,12)\relax|%
- \digitstt{=\xinttheexpr trunc(1238/1157*25.4/72.27,12)\relax}|...mm|} This
-fits very well with the possible values of the Didot point as listed in the
+the above rule is exactly verified:
+%
+\leftedline{|\xinttheexpr
+ trunc(1238/1157*25.4/72.27,12)\relax|%
+ \dtt{=\xinttheexpr trunc(1238/1157*25.4/72.27,12)\relax}|...mm|}
+%
+This fits very well with the possible values of the Didot point as listed in
+the
\href{http://en.wikipedia.org/wiki/Point_%28typography%29#Didot}{Wikipedia Article}.
%
-The value @0.376065@\,|mm| is said to be the \emph{the traditional value in
- European printers' offices}. So the @1157@\,|dd|=@1238@\,|pt| rule refers to
+The value $0.376065$\,|mm| is said to be the \emph{the traditional value in
+ European printers' offices}. So the $1157$\,|dd|=$1238$\,|pt| rule refers to
this Didot point, or more precisely to the \emph{conversion factor} to be used
between this Didot and \TeX{} points.
The actual value in millimeters of exactly one Didot point as implemented in
\TeX{} is
-%
-\centeredline
-{|\xinttheexpr trunc(\dimexpr 1dd\relax/65536/72.27*25.4,12)\relax|}
-\centeredline{%
-\digitstt{=\xinttheexpr trunc(\dimexpr
- 1dd\relax/65536/72.27*25.4,12)\relax}|...mm|}
-The difference of circa @5@\AA\ is arguably tiny!
+%
+\leftedline {|\xinttheexpr trunc(\dimexpr
+ 1dd\relax/65536/72.27*25.4,12)\relax|}
+%
+\leftedline{\dtt{=\xinttheexpr trunc(\dimexpr
+ 1dd\relax/65536/72.27*25.4,12)\relax}|...mm|}
+%
+The difference of circa $5$\AA\ is arguably tiny!
% 543564351/508000000
-By the way the \emph{European printers' offices \emph{(dixit Wikipedia)} Didot} is thus exactly
-\centeredline{|\xinttheexpr reduce(.376065/(25.4/72.27))\relax|%
- \digitstt{=\xinttheexpr reduce(.376065/(25.4/72.27))\relax}\,|pt|}
-and the centered convergents of this fraction are \xintFor* #1 in
-{\xintFtoCCv{543564351/508000000}}\do {@#1@\xintifForLast{.}{, }} We do recover
-the @1238/1157@ therein!
+By the way the \emph{European printers' offices \emph{(dixit Wikipedia)}
+ Didot} is thus exactly
+%
+\leftedline{|\xinttheexpr reduce(.376065/(25.4/72.27))\relax|%
+ \dtt{=\xinttheexpr reduce(.376065/(25.4/72.27))\relax}\,|pt|}
+%
+and the centered convergents of this fraction are \xintFor* #1 in
+{\xintFtoCCv{543564351/508000000}}\do {\dtt{\printnumber{#1}}\xintifForLast{.}{, }} We do
+recover the $1238/1157$ therein!
% As a final comment on the \hyperref[tableofdimensions]{table of dimensions}, we
% conclude that the ``Relative Error'' column is misleading as these relative
@@ -2516,22 +4008,20 @@ the @1238/1157@ therein!
% To conclude our comments on the
% \hyperref[tableofdimensions]{table of dimensions}, the big point, now known as
% \emph{Desktop Publishing Point} is less accurately implemented in \TeX{} than
-% other units. Let us test for example the relation @1@\,|in|@=72@\,|bp|, the difference is
-% %
+% other units. Let us test for example the relation $1$\,|in|$=72$\,|bp|, the difference is
+% %
% \centeredline{|\number\numexpr\dimexpr1in\relax-72*\dimexpr1bp\relax\relax|%
-% \digitstt{=\number\numexpr\dimexpr1in\relax-72*\dimexpr1bp\relax\relax}\,|sp|}
+% \dtt{=\number\numexpr\dimexpr1in\relax-72*\dimexpr1bp\relax\relax}\,|sp|}
% \centeredline{|\number\dimexpr1in-72bp\relax|%
-% \digitstt{=\number\dimexpr1in-72bp\relax}\,|sp|}
+% \dtt{=\number\dimexpr1in-72bp\relax}\,|sp|}
% on the other hand
% \centeredline{|\xinttheexpr reduce(\dimexpr1in\relax-72.27*\dimexpr1pt\relax)\relax|}
% \centeredline
-% \digitstt{=\xinttheexpr reduce(\dimexpr1in\relax-72.27*\dimexpr1pt\relax)\relax}\,|sp|=@-0.72@\,|sp|}
+% \dtt{=\xinttheexpr reduce(\dimexpr1in\relax-72.27*\dimexpr1pt\relax)\relax}\,|sp|=$-0.72$\,|sp|}
% \centeredline
-% {\digitstt{=\number\dimexpr1in-72.27pt\relax}\,|sp|=@-0.72@\,|sp|}
+% {\dtt{=\number\dimexpr1in-72.27pt\relax}\,|sp|=$-0.72$\,|sp|}
-
-
-\section{\csh{ifcase}, \csh{ifnum}, ... constructs}\label{sec:ifcase}
+\subsection{\csh{ifcase}, \csh{ifnum}, ... constructs}\label{sec:ifcase}
When using things such as |\ifcase \xintSgn{\A}| one has to make sure to leave
a space after the closing brace for \TeX{} to
@@ -2541,14 +4031,14 @@ space (or something `unexpandable') must stop it looking for more
digits. Using |\ifcase\xintSgn\A| without the braces is very dangerous,
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\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
+%
+\begin{everbatim*}
+\begin{enumerate}[nosep]\def\A{1}
+\item \ifcase \xintSgn\A 0\or OK\else ERROR\fi
+\item \ifcase \xintSgn\A\space 0\or OK\else ERROR\fi
+\item \ifcase \xintSgn{\A} 0\or OK\else ERROR\fi
+\end{enumerate}
+\end{everbatim*}
In order to use successfully |\if...\fi| constructions either as arguments to
the \xintname bundle expandable macros, or when building up a completely
@@ -2566,34 +4056,254 @@ forgotten.
If these tests are to be applied to standard \TeX{} short integers, it is more
efficient to use (under \LaTeX{}) the equivalent conditional tests from the
-\href{http://www.ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
+\href{http://www.ctan.org/pkg/etoolbox}{etoolbox}%
+%
+\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
package.
+\subsection{Expandable implementations of mathematical algorithms}
+
+It is possible to chain |\xintexpr|-essions with |\expandafter|'s, like experts
+do with |\numexpr| to compute multiple things at once. See
+\autoref{ssec:fibonacci} for an example devoted to Fibonacci numbers (this
+section provides the code which was used on the title page for the
+\dtt{$F(1250)$} evaluation.) Notice that the $47$th Fibonacci number is
+\dtt{\Fibonacci {47}} thus already too big for \TeX{} and \eTeX{}.
+
+The |\Fibonacci| macro found in \autoref{ssec:fibonacci} is completely
+expandable, (it is even \fexpan dable in the sense previously explained) hence
+can be used for example within |\message| to write to the log and terminal.
+
+\begingroup
+ \def\A {1859}\def\B {1573}
+ \edef\C {\xintGCD\A\B}
+ \edef\X {\Fibonacci\A}
+ \edef\Y {\Fibonacci\B}
+%
+Also, one can thus use it as argument to the \xintname macros: for example if
+we are interested in knowing how many digits $F(1250)$ has, it suffices to
+issue |\xintLen {\Fibonacci {1250}}| (which expands to \dtt{\xintLen
+ {\Fibonacci {1250}}}). Or if we want to check the formula
+$gcd(F(1859),F(1573))=F(gcd(1859,1573))=F(143)$, we only need%
+%
+\footnote{The
+ \csa{xintGCD} macro is provided by the \xintgcdname package.}
+%
+\leftedline{|$\xintGCD{\Fibonacci{1859}}{\Fibonacci{1573}}=\Fibonacci{\xintGCD{1859}{1573}}$|}
+%
+which outputs:
+%
+\leftedline{$\dtt{\xintGCD{\X}{\Y}}=\dtt{\Fibonacci{\C}}$}
-\section{Assignments}\label{sec:assign}
+The |\Fibonacci| macro expanded its |\xintGCD{1859}{1573}| argument via the
+services of |\numexpr|: this step allows only things obeying the \TeX{} bound,
+naturally! (but \dtt{F(\xintiiPow2{31}}) would be rather big anyhow...).
+
+In practice, whenever one typesets things, one has left the expansion only
+contexts; hence there is no objection to, on the contrary it is recommended,
+assign the result of earlier computations to macros via an |\edef| (or an
+|\oodef|, see \ref{oodef}), for later use. The above could thus be coded
+\begin{everbatim}
+\begingroup
+ \def\A {1859} \def\B {1573} \edef\C {\xintGCD\A\B}
+ \edef\X {\Fibonacci\A} \edef\Y {\Fibonacci\B}
+The identity $\gcd(F(\A),F(\B))=F(\gcd(\A,\B))$ can be checked via evaluation
+of both sides: $\gcd(F(\A),F(\B))=\gcd(\printnumber\X,\printnumber\Y)=
+\printnumber{\xintGCD\X\Y} = F(\gcd(\A,\B))$.\par
+ % some further computations involving \A, \B, \C, \X, \Y
+\endgroup % closing the group removes assignments to \A, \B, ...
+% or choose longer names less susceptible to overwriting something. Note that there
+% is no LaTeX \newecommand which would be to \edef like \newcommand is to \def
+\end{everbatim}
+The identity $\gcd(F(\A),F(\B))=F(\gcd(\A,\B))$ can be checked via evaluation
+of both sides:
+$\gcd(F(\A),F(\B))=\gcd(\dtt{\printnumber\X{\normalcolor,}\printnumber\Y})=
+\dtt{\printnumber{\xintGCD\X\Y}} = F(\C) = F(\gcd(\A,\B))$.\par
+
+
+\endgroup
+One may thus legitimately ask the author: why expandability to such extremes,
+for things such as big fractions or floating point numbers (even
+continued fractions...) which anyhow can not be used directly
+within \TeX's primitives such as |\ifnum|? the answer is that the author
+chose, seemingly, at some point back in his past to waste from then on his time
+on such useless things!
+
+\subsection{Possible syntax errors to avoid}
+
+\edef\x{\xintMul {3}{5}/\xintMul{7}{9}}
+
+Here is a list of imaginable input errors. Some will cause compilation errors,
+others are more annoying as they may pass through unsignaled.
+\begin{itemize}
+\item using |-| to prefix some macro: |-\xintiSqr{35}/271|.%
+%
+\footnote{to the
+ contrary, this \emph{is}
+ allowed inside an |\xintexpr|-ession.}
+\item using one pair of braces too many |\xintIrr{{\xintiPow {3}{13}}/243}| (the
+ computation goes through with no error signaled, but the result is completely
+ wrong).
+\item using |[]| and decimal points at the same time |1.5/3.5[2]|, or with a
+ sign in the denominator |3/-5[7]|. The scientific notation has no such
+ restriction, the two inputs |1.5/-3.5e-2| and |-1.5e2/3.5| are equivalent:
+ |\xintRaw{1.5/-3.5e-2}|\dtt{=\xintRaw{1.5/-3.5e-2}},
+ |\xintRaw{-1.5e2/3.5}|\dtt{=\xintRaw{-1.5e2/3.5}}.
+\item specifying numerators and
+ denominators with macros producing fractions when \xintfracname is loaded:
+ |\edef\x{|\allowbreak|\xintMul {3}{5}/\xintMul{7}{9}}|. This expands to
+ \texttt{\x} which is
+ invalid on input. Using this |\x| in a fraction macro will most certainly
+ cause a compilation error, with its usual arcane and undecipherable
+ accompanying message. The fix here would be to use |\xintiMul|. The simpler
+ alternative with package \xintexprname:
+ |\xinttheexpr 3*5/(7*9)\relax|.
+\item generally speaking, using in a context expecting an integer (possibly
+ restricted to the \TeX{} bound) a macro or expression which returns a
+ fraction: |\xinttheexpr 4/2\relax| outputs \dtt{\xinttheexpr 4/2\relax},
+ not $2$. Use |\xintNum {\xinttheexpr 4/2\relax}| or |\xinttheiexpr 4/2\relax|
+ (which rounds the result to the nearest integer, here, the result is already
+ an integer) or |\xinttheiiexpr 4/2\relax| (but |/| therein is euclidean
+ quotient, which on positive operands is like truncating to the integer part,
+ not rounding).
+\item use of square brackets |[|, |]| in |xintexpr...\name| has some traps, see
+ \autoref{sec:expr}.
+\end{itemize}
+
+\subsection{Error messages}
+
+In situations such as division by zero, the package will insert in the
+\TeX{} processing an undefined control sequence (we copy this method
+from the |bigintcalc| package). This will trigger the writing to the log
+of a message signaling an undefined control sequence. The name of the
+control sequence is the message. The error is raised \emph{before} the
+end of the expansion so as to not disturb further processing of the
+token stream, after completion of the operation. Generally the problematic
+operation will output a zero. Possible such error message control
+sequences:
+
+% \the\parskip\par % attention 0pt plus 1pt
+
+\begin{multicols}{2}\parskip0pt\relax
+\begin{everbatim}
+\xintError:ArrayIndexIsNegative
+\xintError:ArrayIndexBeyondLimit
+\xintError:FactorialOfNegativeNumber
+\xintError:FactorialOfTooBigNumber
+\xintError:DivisionByZero
+\xintError:NaN
+\xintError:FractionRoundedToZero
+\xintError:NotAnInteger
+\xintError:ExponentTooBig
+\xintError:TooBigDecimalShift
+\xintError:TooBigDecimalSplit
+\xintError:RootOfNegative
+\xintError:NoBezoutForZeros
+\xintError:ignored
+\xintError:removed
+\xintError:inserted
+\xintError:unknownfunction
+\xintError:we_are_doomed
+\xintError:missing_xintthe!
+\end{everbatim}
+\end{multicols}
+% NOTES 12 octobre 2014
+% J'ai voulu faire avec verbatim, mais bizarrement il met dans la
+% colonne de gauche 10 et 8 dans celle de droite. Je n'ai pas réussi à
+% reproduire le problème sur un MWE, en tout cas un exemple naïf ne
+% reproduit pas le problème. Ensuite avec \everb c'est beaucoup mieux
+% mais j'ai dû mettre \raggedcolumns. J'ai essayé avec \strut. Ah, mais
+% le problème c'est \parskip.
+
+% par ailleurs il y a trop d'espace vertical avant le multicols, mais
+% bon.
+
+Don't forget to set |\errorcontextlines| to at least |2| to get from \LaTeX\
+more meaningful error messages. Errors occuring during the parsing of
+|\xintexpr-essions| try to provide helpful information about the offending
+token. Release |1.1| employs in some situations delimited macros and there is
+the possibility in case of an ill-formed expression to end up beyond the
+|\relax| end-marker. The errors inevitably arising could then lead to very
+cryptic messages; but nothing unusual or especially traumatizing for the
+daring experienced \TeX/\LaTeX\ user.
+
+
+\subsection{Package namespace, catcodes}
+
+The \xintname bundle packages presuppose that the \csa{space}, \csa{empty} and
+|\m@ne| control sequences are pre-defined with meanings as in Plain
+\TeX{} or \LaTeX2e.
+
+Private macros of \xinttoolsname, \xintname, \xintfracname, \xintexprname,
+\xintbinhexname, \xintgcdname, \xintseriesname, and \xintcfracname{} use one
+or more underscores |_| as private letter, to reduce the risk of getting
+overwritten. They almost all begin either with |\XINT_| or with |\xint_|, a
+handful of these private macros such as \csa{XINTsetupcatcodes},
+\csa{XINTdigits} and those with names such as |\XINTinFloat...| or
+|\XINTinfloat...| do not have any underscore in their names (for obscure legacy
+reasons).
+
+\xinttoolsname provides \hyperref[odef]{|\odef|}, \hyperref[oodef]{|\oodef|},
+\hyperref[fdef]{|\fdef|} (if macros with these names already exist
+\xinttoolsname will not overwrite them but provide |\xintodef| etc... ) but
+all other public macros from the \xintname bundle packages start with |\xint|.
+
+For the good functioning of the macros, standard catcodes are assumed for the
+minus sign, the forward slash, the square brackets, the letter `e'. These
+requirements are dropped inside an |\xintexpr|-ession: spaces are gobbled,
+catcodes mostly do not matter, the |e| of scientific notation may be |E| (on
+input) \dots{} If a character used in the |\xintexpr| syntax is made active,
+this will surely cause problems; prefixing it with |\string| is one option.
+There is \csbxint{exprSafeCatcodes} and \csbxint{exprRestoreCatcodes} to
+temporarily turn off potentially active characters (but setting catcodes is an
+un-expandable action).
+
+\begin{framed}
+ For advanced \TeX\ users. At loading time of the packages the
+ catcode configuration may be arbitrary as long as it satisfies the following
+ requirements: the percent is of category code comment character, the
+ backslash is of category code escape character, digits have category code
+ other and letters have category code letter. Nothing else is assumed.
+\end{framed}
+
+\section{Some utilities from the \xinttoolsname package}
+
+This is a first overview. Many examples combining these utilities with the
+arithmetic macros of \xintname are to be found in \autoref{sec:tools}.
+
+\subsection{Assignments}\label{sec:assign}
\xintAssign \xintBezout{357}{323}\to\tmpA\tmpB\tmpU\tmpV\tmpD
It might not be necessary to maintain at all times complete expandability. A
devoted syntax is provided to make these things more efficient, for example when
-using the \csa{xintDivision} macro which computes both quotient and remainder at
+using the \csbxint{iDivision} macro which computes both quotient and remainder
+at
the same time:
-\centeredline{\csbxint{Assign}\csa{xintDivision}|{100}{3}|\csbnolk{to}|\A\B|}
-\centeredline{\csbxint{Assign}\csa{xintDivision}%
- |{\xintiPow {2}{1000}}{\xintFac{100}}|\csbnolk{to}|\A\B|} gives
-\xintAssign\xintDivision{\xintiPow {2}{1000}}{\xintFac{100}}\to\A\B
-|\meaning\A|\digitstt{: \expandafter\allowsplits\meaning\A\relax} and
-|\meaning\B|\digitstt{: \expandafter\allowsplits\meaning\B\relax}.
+%
+\leftedline{\csbxint{Assign}|\xintiDivision{100}{3}|\csbnolk{to}|\A\B|}
+%
+\leftedline{\csbxint{Assign}
+%
+ |\xintiDivision{\xintiPow {2}{1000}}{\xintFac{100}}|\csbnolk{to}|\A\B|}
+%
+give
+\xintAssign\xintiDivision{\xintiPow {2}{1000}}{\xintFac{100}}\to\A\B
+|\meaning\A|\dtt{: \printnumber{\meaning\A}\relax} and
+|\meaning\B|\dtt{: \printnumber{\meaning\B}\relax}.
%
Another example (which uses \csbxint{Bezout} from the \xintgcdname package):
-\centeredline{\csbxint{Assign}\csa{xintBezout}|{357}{323}|%
-\csbnolk{to}|\A\B\U\V\D|} is equivalent to setting |\A| to \digitstt{\tmpA},
-|\B| to \digitstt{\tmpB}, |\U| to \digitstt{\tmpU}, |\V| to \digitstt{\tmpV},
-and |\D| to \digitstt{\tmpD}. And indeed
-\digitstt{(\tmpU)$\times$\tmpA-(\tmpV)$\times$\tmpB$=$%
-\xintiSub{\xintiMul\tmpU\tmpA}{\xintiMul\tmpV\tmpB}} is a Bezout Identity.
+%
+\leftedline{\csbxint{Assign}
+%
+ |\xintBezout{357}{323}|\csbnolk{to}|\A\B\U\V\D|}
+%
+is equivalent to setting |\A| to \dtt{\tmpA}, |\B| to \dtt{\tmpB}, |\U| to
+\dtt{\tmpU}, |\V| to \dtt{\tmpV}, and |\D| to \dtt{\tmpD}. And indeed
+\dtt{(\tmpU)$\times$\tmpA-(\tmpV)$\times$\tmpB$=$%
+ \xintiSub{\xintiMul\tmpU\tmpA}{\xintiMul\tmpV\tmpB}} is a Bezout Identity.
Thus, what |\xintAssign| does is to first apply an
\hyperref[sec:expansions]{\fexpan sion} to what comes next; it then defines one
@@ -2603,23 +4313,26 @@ expansion type, see \autoref{xintAssign} for details), the macros found after
prior to |\to|.
\xintAssign
-\xintBezout{3570902836026}{200467139463}\to\tmpA\tmpB\tmpU\tmpV\tmpD
+\xintBezout{3570902836026}{200467139463}\to\tmpA\tmpB\tmpU\tmpV\tmpD
-\centeredline{\csbxint{Assign}\csa{xintBezout}|{3570902836026}{200467139463}|%
- \csbnolk{to}|\A\B\U\V\D|}
-\noindent
-gives then |\U|\digitstt{:
- \expandafter\allowsplits\meaning\tmpU\relax},
- |\V|\digitstt{:
- \expandafter\allowsplits\meaning\tmpV\relax} and |\D|\digitstt{=\tmpD}.
+\leftedline
+{\csbxint{Assign}|\xintBezout{3570902836026}{200467139463}|%
+ \csbnolk{to}|\A\B\U\V\D|}
+\noindent
+gives then |\U|\dtt{:
+ \printnumber\tmpU},
+ |\V|\dtt{:
+ \printnumber\tmpV} and |\D|\dtt{=\tmpD}.
%
In situations when one does not know in advance the number of items, one has
\csbxint{AssignArray} or its synonym \csbxint{DigitsOf}:
-\centeredline{\csbxint{DigitsOf}\csa{xintiPow}|{2}{100}|\csbnolk{to}\csa{DIGITS}}
+%
+\leftedline{\csbxint{DigitsOf}|\xintiPow{2}{100}|\csbnolk{to}\csa{DIGITS}}
+%
This defines \csa{DIGITS} to be macro with one parameter, \csa{DIGITS}|{0}|
gives the size |N| of the array and \csa{DIGITS}|{n}|, for |n| from |1| to |N|
-then gives the |n|th element of the array, here the |n|th digit of @2^{100}@,
+then gives the |n|th element of the array, here the |n|th digit of $2^{100}$,
from the most significant to the least significant. As usual, the generated
macro \csa{DIGITS} is completely expandable (in two steps). As it wouldn't make
much sense to allow indices exceeding the \TeX{} bounds, the macros created by
@@ -2627,9 +4340,9 @@ much sense to allow indices exceeding the \TeX{} bounds, the macros created by
completely expanded and may be a count register, not necessarily prefixed by
|\the| or |\number|. Consider the following code snippet:
%
-\dverb+@
-\newcount\cnta
-\newcount\cntb
+\begin{everbatim*}
+% \newcount\cnta
+% \newcount\cntb
\begingroup
\xintDigitsOf\xintiPow{2}{100}\to\DIGITS
\cnta = 1
@@ -2640,79 +4353,17 @@ completely expanded and may be a count register, not necessarily prefixed by
\advance\cnta 1
\repeat
-|2^{100}| (=\xintiPow {2}{100}) has \DIGITS{0} digits and the sum of
-their squares is \the\cntb. These digits are, from the least to
-the most significant: \cnta = \DIGITS{0}
-\loop \DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
-\endgroup
-+
-
-\edef\z{\xintiPow {2}{100}}
-
-\begingroup
-\xintDigitsOf\z\to\DIGITS
-\cnta = 1
-\cntb = 0
-\loop
-\advance \cntb \xintiSqr{\DIGITS{\cnta}}
-\ifnum \cnta < \DIGITS{0}
-\advance\cnta 1
-\repeat
-
-@2^{100}@ (=\z) has \DIGITS{0} digits and the sum of
-their squares is \the\cntb. These digits are, from the least to
-the most significant: \cnta = \DIGITS{0}
-\loop \DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
-\endgroup
-
-% We used a group in order to release the memory taken by the
-% \csa{DIGITS} array: indeed internally, besides \csa{DIGITS} itself,
-% additional macros are defined which are \csa{DIGITS0}, \csa{DIGITS00},
-% \csa{DIGITS1}, \csa{DIGITS2}, ..., \csa{DIGITSN}, where |N| is the size of
-% the array (which is the value returned by |\DIGITS{0}|; the digits
-% are parts of the names not arguments).
-
-% The command \csbxint{RelaxArray}\csa{DIGITS} sets all these macros to
-% \csa{relax}, but it was simpler to put everything withing a group.
+|2^{100}| (=\xintiPow {2}{100}) has \DIGITS{0} digits and the sum of their squares is \the\cntb.
+These digits are, from the least to the most significant: \cnta = \DIGITS{0} \loop
+\DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.\endgroup
+\end{everbatim*}
Warning: \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: |{-\xintRem{3347}{591}}| would not be a valid input, because
-% the expansion will apply only to the minus sign and leave
-% unaffected the |\xintRem|. So we used \csa{xint}\-|iOpp| which replaces
-% a number with its opposite.
-
-
-% As a last example with \csa{xintAssignArray} here is one line
-% extracted from the source code of the \xintgcdname macro
-% \csbxint{TypesetEuclideAlgorithm}:
-% \centeredline{|\xintAssignArray\xintEuclideAlgorithm
-% {#1}{#2}\to\U|}
-% This is done inside a group. After this command |\U{1}| contains
-% the number |N| of steps of the algorithm (not to be confused with
-% |\U{0}=2N+4| which is the number of elements in the |\U| array),
-% and the GCD is to be found in |\U{3}|, a convenient location
-% between |\U{2}| and |\U{4}| which are (absolute values of the
-% expansion of) the
-% initial inputs. Then follow |N| quotients and remainders
-% from the first to the last step of the algorithm. The
-% \csa{xintTypesetEuclideAlgorithm} macro organizes this data
-% for typesetting: this is just an example of one way to do it.
-
-\section{Utilities for expandable manipulations}\label{sec:utils}
+
+\subsection{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}
@@ -2720,1092 +4371,423 @@ and \csa{xintAssignArray}: \csbxint{ReverseOrder} and \csbxint{Length} since the
first release, \csbxint{Apply} and \csbxint{ListWithSep} since |1.04|,
\csbxint{RevWithBraces}, \csbxint{CSVtoList}, \csbxint{NthElt} since |1.06|,
\csbxint{ApplyUnbraced}, since |1.06b|, \csbxint{loop} and \csbxint{iloop} since
-|1.09g|.\footnote{All these utilities, as well as \csbxint{Assign},
+|1.09g|.%
+%
+\footnote{All these utilities, as well as \csbxint{Assign},
\csbxint{AssignArray} and the \csbxint{For} loops are now available from the
\xinttoolsname package, independently of the big integers facilities of
\xintname.}
-\edef\z{\xintiPow {2}{100}}
-
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
-\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 \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
-least significant one is \xintNthElt{7}{\xintRev\z}.
+\begin{everbatim*}
+$2^{100}$ (=\xintiPow {2}{100}) has \xintLen{\xintiPow {2}{100}} digits and the sum of their
+ squares is \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}}}.
+\end{everbatim*}
It would be more efficient to do once and for all
-|\oodef\z{\xintiPow {2}{100}}|, and then use |\z| in place of
+|\oodef\z{\xintiPow {2}{100}}|, and then use |\z| in place of
|\xintiPow {2}{100}| everywhere as this would spare the CPU some repetitions.
Expandably computing primes is done in \autoref{xintSeq}.
-
-\section{A new kind of for loop}
+\subsection{A new kind of for loop}
As part of the \hyperref[sec:tools]{utilities} coming with the \xinttoolsname
package, there is a new kind of for loop, \csbxint{For}. Check it out
(\autoref{xintFor}).
-\section{A new kind of expandable loop}
+\subsection{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 which would break
expandability. Check it out (\autoref{xintiloop}).
-\section{Exceptions (error messages)}
-In situations such as division by zero, the package will insert in the
-\TeX{} processing an undefined control sequence (we copy this method
-from the |bigintcalc| package). This will trigger the writing to the log
-of a message signaling an undefined control sequence. The name of the
-control sequence is the message. The error is raised \emph{before} the
-end of the expansion so as to not disturb further processing of the
-token stream, after completion of the operation. Generally the problematic
-operation will output a zero. Possible such error message control
-sequences:
-\dverb|@
-\xintError:ArrayIndexIsNegative
-\xintError:ArrayIndexBeyondLimit
-\xintError:FactorialOfNegativeNumber
-\xintError:FactorialOfTooBigNumber
-\xintError:DivisionByZero
-\xintError:NaN
-\xintError:FractionRoundedToZero
-\xintError:NotAnInteger
-\xintError:ExponentTooBig
-\xintError:TooBigDecimalShift
-\xintError:TooBigDecimalSplit
-\xintError:RootOfNegative
-\xintError:NoBezoutForZeros
-\xintError:ignored
-\xintError:removed
-\xintError:inserted
-\xintError:bigtroubleahead
-\xintError:unknownfunction|
-
-\section{Common input errors when using the package macros}
-
-\edef\x{\xintMul {3}{5}/\xintMul{7}{9}}
-
-Here is a list of common input errors. Some will cause compilation errors,
-others are more annoying as they may pass through unsignaled.
+% Lundi 06 octobre 2014 à 22:02:44
+% je décide de ne plus inclure le README verbatim
+% \begingroup
+% \makeatletter\def\x{\baselineskip10pt
+% \ttfamily
+% %\settowidth\dimen@{X}%
+% %\parindent \dimexpr.5\linewidth-33\dimen@\relax
+% \parindent\z@
+% \let\do\do@noligs\verbatim@nolig@list
+% \let\do\@makeother\dospecials
+% \def\par{\leavevmode \null\@@par\penalty\interlinepenalty}%
+% \makestarlowast
+% \@vobeyspaces\obeylines
+% \noindent\kern\parindent\input README.md
+% \endgroup }\x
+
+\section{New features of the \xintexprname package}
+\label{sec:expr11}
+
+Release |1.1| has brought many changes to \xintexprname. This chapter is
+for people already familiar with earlier versions. A more systematic
+item per item syntax description is provided in \autoref{sec:expr}.
+
+\subsection{Some breaking changes and quite a few novelties}
+
+First, there are some breaking changes:
\begin{itemize}
-\item using |-| to prefix some macro: |-\xintiSqr{35}/271|.\footnote{to the
- contrary, this \emph{is}
- allowed inside an |\string\xintexpr|-ession.}
-\item using one pair of braces too many |\xintIrr{{\xintiPow {3}{13}}/243}| (the
- computation goes through with no error signaled, but the result is completely
- wrong).
-\item using |[]| and decimal points at the same time |1.5/3.5[2]|, or with a
- sign in the denominator |3/-5[7]|. The scientific notation has no such
- restriction, the two inputs |1.5/-3.5e-2| and |-1.5e2/3.5| are equivalent:
- |\xintRaw{1.5/-3.5e-2}|\digitstt{=\xintRaw{1.5/-3.5e-2}},
- |\xintRaw{-1.5e2/3.5}|\digitstt{=\xintRaw{-1.5e2/3.5}}.
-\item specifying numerators and
- denominators with macros producing fractions when \xintfracname is loaded:
- |\edef\x{|\allowbreak|\xintMul {3}{5}/\xintMul{7}{9}}|. This expands to
- \texttt{\x} which is
- invalid on input. Using this |\x| in a fraction macro will most certainly
- cause a compilation error, with its usual arcane and undecipherable
- accompanying message. The fix here would be to use |\xintiMul|. The simpler
- alternative with package \xintexprname:
- |\xinttheexpr 3*5/(7*9)\relax|.
-\item generally speaking, using in a context expecting an integer (possibly
- restricted to the \TeX{} bound) a macro or expression which returns a
- fraction: |\xinttheexpr 4/2\relax| outputs \digitstt{\xinttheexpr 4/2\relax},
- not @2@. Use |\xintNum {\xinttheexpr 4/2\relax}| or |\xinttheiexpr 4/2\relax|
- (which rounds the result to the nearest integer, here, the result is already
- an integer) or |\xinttheiiexpr 4/2\relax| (but |/| therein is euclidean
- quotient, which on positive operands is like truncating to the integer part,
- not rounding).
+ \item in |\xintiiexpr|, |/| does \emph{rounded} division, rather than as
+ in earlier releases the
+ Euclidean division (for positive arguments, this is truncated division).
+ The new |//| operator does truncated division,
+ \item the |:| operator for three-way branching is gone, replaced with |??|,
+ \item |1e(3+5)| is now illegal. The number parser identifies |e| and |E|
+ in the same way it does for the decimal mark, earlier versions treated
+ |e| as |E| rather as postfix operators,
+ \item the |add| and |mul| have a new syntax, old syntax is with |`+`| and
+ |`*`| (quotes mandatory), |sum| and |prd| are gone,
+ \item no more special treatment for encountered brace pairs |{..}| by the
+ number scanner, |a/b[N]| notation can be used without use of braces (the
+ |N| will end up as is in a |\numexpr|, it is not parsed by the
+ |\xintexpr|-ession scanner).
+ \item although |&| and \verb+|+ are still available as Boolean operators the
+ use of |&&| and \verb+||+ is strongly recommended. The single
+ letter operators might be assigned some other meaning in later releases
+ (bitwise operations, perhaps). Do not use them.
\end{itemize}
+The novelties are numerous.
+
+\begin{itemize}[parsep=0pt]
+ \item |\xintiexpr|, |\xinttheiexpr| admit an optional argument within
+ brackets |[d]|, it then presents the computation result (or results, if
+ comma separated) after rounding to |d| digits after decimal mark, (the
+ whole computation is done exactly, as in |xintexpr|),
+\begin{everbatim*}
+\xinttheiexpr [32] 1.23^50, 1.231^50\relax
+\end{everbatim*}
+ \item |\xintfloatexpr|, |\xintthefloatexpr| similarly admit an optional
+ argument which serves to keep only |d| digits of precision, getting rid
+ of cumulated uncertainties in the last digits (the whole computation is
+ done according to the precision set via |\xintDigits|),
+\begin{everbatim*}
+\xintDigits:=32;\xintthefloatexpr 1.010101^10-1.0101^10\relax
+
+\xintDigits:=16;\xintthefloatexpr 1.010101^10-1.0101^10\relax
+
+\xintthefloatexpr [12] 1.010101^10-1.0101^10\relax
+\end{everbatim*}
+
+ \item |\xinttheexpr| and |\xintthefloatexpr| ``pretty-print'' if possible,
+ the former removing unit denominator or |[0]| brackets, the latter
+ avoiding scientific notation if decimal notation is practical,
+ \item the |//| does truncated division and |/:| is the associated modulo,
+ \item multi-character operators |&&|, \verb+||+, |==|, |<=|, |>=|, |!=|,
+ |**|,
+ \item multi-letter infix binary words |'and'|, |'or'|, |'xor'|, |'mod'|
+ (quotes mandatory),
+ \item functions |even|, |odd|, |first|, |last|,
+ \item |\xintdefvar A3:=3.1415;| for variable definitions (non expandable,
+ naturally), usable in subsequent expressions; variable names may contain
+ letters, digits, underscores. They should not start with a digit, the
+ |@| is reserved, and single lowercase and uppercase Latin letters are
+ predefined to work as dummy variables (see next),
+ \item generation of comma separated lists |a..b|, |a..[d]..b|,
+ \item Python syntax-like list extractors |[list][n:]|, |[list][:n]|, |[list][a:b]|
+ and |[list][n]| (|n=0| for the number of list items), the step is always
+ |+1|,
+ \item function |reversed|, to reverse the order of list items,
+ \item itemwise sequence operations |a*[list]|, etc.., on both sides |a*[list]^b|,
+ \item dummy variables in |add| and |mul|: |add(x(x+1)(x-1), x=-10..10)|,
+ \item variable substitutions with |subs|: |subs(subs(add(x^2+y^2,x=1..y),y=t),t=20)|,
+ \item sequence generation using |seq| with a dummy variable: |seq(x^3, x=-10..10)|,
+ \item simple recursive sequences with |rseq|, with |@| given the last value,
+ |rseq(1;2@+1,i=1..10)|,
+ \item higher recursion with |rrseq|, |@1|, |@2|, |@3|, |@4|, and |@@(n)|
+ for earlier values, up to |n=K| where |K| is the number of terms of the
+ initial stretch |rrseq(0,1;@1+@2,i=2..100)|,
+ \item iteration with |iter| which is like |rrseq| but outputs only the
+ last |K| terms, where |K| was the number of initial terms,
+ \item inside |seq|, |rseq|, |rrseq|, |iter|, possibility to use |omit|,
+ |abort| and |break| to control termination,
+ \item |n++| potentially infinite index generation for |seq|, |rseq|,
+ |rrseq|, and |iter|, it is advised to use |abort| or |break(..)| at
+ some point,
+ \item the |add|, |mul|, |seq|, ... are nestable,
+ \item |\xintthecoords| converts a comma separated list of an even number
+ of items to the format as expected by the |TikZ| |coordinates| syntax,
+ \item completely rewritten |\xintNewExpr|, new |protect| function to handle
+ external macros. However not all constructs are compatible with
+ |\xintNewExpr|.
+\end{itemize}
-\section{Package namespace}
-
-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.
-
-\xinttoolsname defines \hyperref[odef]{\ttfamily\char92odef},
-\hyperref[oodef]{\ttfamily\char92oodef}, \hyperref[fdef]{\ttfamily\char92fdef},
-but only if macros with these names do not already exist (|\xintoodef| etc...
-are defined anyhow for use in \csbxint{Assign} and \csbxint{AssignArray}).
-
-{\makeatother The \xintname packages presuppose that the \csa{space},
-\csa{empty}, |\m@ne|, |\z@| and |\@ne| control sequences
-have their meanings as in Plain \TeX{} or \LaTeX2e.}
-
-
-\section{Loading and usage}
-
-\dverb|@
-Usage with LaTeX: \usepackage{xinttools}
- \usepackage{xint} % (loads xinttools)
- \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 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)
-|
-
-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.\footnote{exception: \xintexprname needs the user to explicitely
- load \xintgcdname, resp. \xintbinhexname, if use is to be made in
- \csa{xintexpr} of the \texttt{lcm} and \texttt{gcd} functions, and, resp.,
- hexadecimal numbers.}
-
-Also initially inspired from the \textsc{Heiko Oberdiek} packages we have
-included a complete catcode protection mecanism. The packages may be loaded in
-any catcode configuration satisfying these requirements: the percent is of
-category code comment character, the backslash is of category code escape
-character, digits have category code other and letters have category code
-letter. Nothing else is assumed, and the previous configuration is restored
-after the loading of each one of the packages.
-
-This is for the loading of the packages.
-
-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 \emph{letter}.
-
-All these requirements (which are anyhow satisfied by default) are
-relaxed for the contents of an |\xintexpr|-ession: spaces are gobbled,
-catcodes mostly do not matter, the |e| of scientific notation may be |E|
-(on input) \dots{}
-
-
-\section{Installation}\label{sec:install}
-
-\begingroup
-\def\MacroFont {\ttfamily\small\baselineskip11pt\relax\catcode`\"=12 }
-\dverb!@
-A. Installation using xint.tds.zip:
------------------------------------
-
-obtain xint.tds.zip from CTAN:
- http://mirror.ctan.org/install/macros/generic/xint.tds.zip
-
-cd to the download repertory and issue
- unzip xint.tds.zip -d <TEXMF>
-for example: (assuming standard access rights, so sudo needed)
- sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
- sudo mktexlsr
-
-On Mac OS X, installation into user home folder:
- unzip xint.tds.zip -d ~/Library/texmf
-
-B. Installation after file extractions:
----------------------------------------
-
-obtain xint.dtx, xint.ins and the README from CTAN:
- http://www.ctan.org/pkg/xint
-
-- "tex xint.ins" generates the style files
-(pre-existing files in the same repertory will be overwritten).
-
-- without xint.ins: "tex or latex or pdflatex or xelatex xint.dtx"
-will also generate the style files (and xint.ins).
-
-xint.tex is also extracted, use it for the documentation:
-
-- with latex+dvipdfmx: latex xint.tex thrice then dvipdfmx xint.dvi
-Ignore dvipdfmx warnings, but if the pdf file has problems with fonts
-(possibly from an old dvipdfmx), use then rather pdflatex or xelatex.
-
-- with pdflatex or xelatex: run it directly thrice on xint.dtx, or run
-it on xint.tex after having edited the suitable toggle therein.
-
-Whether compiling xint.tex or xint.dtx, the documentation is by default
-produced without inclusion of the source code. See instructions in the
-file xint.tex for changing this default.
-
-Finishing the installation: (on first installation the destination
-repertories may need to be created)
-
- xinttools.sty |
- xint.sty |
- xintfrac.sty |
- xintexpr.sty | --> TDS:tex/generic/xint/
- xintbinhex.sty |
- xintgcd.sty |
- xintseries.sty |
- xintcfrac.sty |
-
- xint.dtx --> TDS:source/generic/xint/
- xint.ins --> TDS:source/generic/xint/
- xint.tex --> TDS:source/generic/xint/
-
- xint.pdf --> TDS:doc/generic/xint/
- README --> TDS:doc/generic/xint/
-
-Depending on the TDS destination and the TeX installation, it may be
-necessary to refresh the TeX installation filename database (mktexlsr)!
-\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
+\subsection{Examples using the new possibilities}
-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}}}
-Note that |#1|, |#2|, and |#3| are not protected by parentheses in the
-definition of |\formula|, this is something to keep in mind if for example we
-want to use |2+5| as third argument: it should be |(2+5)| then.
-
-
-\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 may appear
- in the |infix| syntax, should not (if actually used in the expression) be
- active (for example from serving as
- shorthands for some language in the |Babel| system).
- 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 many expressions have equivalent macro formulations written without
- |\xinttheexpr|.\footnote{Not everything allows a straightforward reformulation
- because the package macros only \fexpan d their arguments while
- \csa{xintexpr} expands everything from left to right.} Here for |\formula|
- we could have used: \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.} With
- \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
-(but expands in only two steps).\footnote{But the hand-written version as well
- as the \csa{xintNewExpr} generated one differ from the original \csa{formula}
- command which allowed each of its argument to use all the operators and
- functions recognized by \csa{xintexpr}, and this aspect is lost. To recover it
- the arguments themselves should be passed as \csa{xinttheexpr..\char92relax}
- to the defined macro.} The use
-even thousands of times of such an |\xintNewExpr|-generated |\formula| has no
-memory impact.
-\item count registers and |\numexpr|-essions are accepted (LaTeX{}'s counters
- can be inserted using |\value|) without needing |\the| or |\number| as prefix.
- Also dimen registers and control sequences, skip registers and control
- sequences (\LaTeX{}'s lengths), |\dimexpr|-essions, |\glueexpr|-essions are
- automatically unpacked using |\number|, discarding the stretch and shrink
- components and giving the dimension value in |sp| units (@1/65536@th of a
- \TeX{} point). Furthermore, tacit multiplication is implied, when the
- register, variable, or expression if immediately prefixed by a (decimal)
- number.
-\item tacit multiplication (the parser inserts a |*|) applies when the parser is
- currently scanning the digits of a number (or its decimal part), or is looking
- for an infix operator, and: (1.)\inmarg{v1.09i}~\emph{encounters a register,
- variable or \eTeX{} expression (as described in the previous item)},
- (2.)\inmarg{v1.09j}~\emph{encounters a sub-\csa{xintexpr}-ession}, or
- (3.)\inmarg{\\ v1.09k}~\emph{encounters an opening parenthesis.}
-\item so far only |\xinttheexpr| was mentioned: there is also |\xintexpr| which,
- like a |\numexpr|, needs a prefix which is called \csbxint{the}. Thus
- \csbxint{theexpr} as was done in the definition of |\formula| is equivalent to
- \csbxint{the}|\xintexpr|.
-\item This latter form is convenient when one has defined for
- example:
-%
-\centeredline{|\def\x {\xintexpr \a + \b \relax}| or |\edef\x {\xintexpr \a+\b\relax}|}
-%
-One may then do |\xintthe\x|, either for printing the result
-on the page or use it in some other package macros. The |\edef| does the
-computation but keeps it in an internal private format.
-Naturally, the |\edef| is only possible if |\a| and |\b| are already defined.
-\item in both cases (the `yet-to-be computed' and the
-`already computed') |\x| can then be inserted in other expressions, as
-for example
-%
-\centeredline {|\edef\y {\xintexpr \x^3\relax}|}
-%
-This would have worked also with |\x| defined as |\def\x {(\a+\b)}| but
-|\edef\x| would not have been an option then, and |\x| could have been used only
-inside an |\xintexpr|-ession, whereas the previous |\x| can also be used as
-|\xintthe\x| in any context triggering the expansion of |\xintthe|.
-\item sometimes one needs an integer, not a fraction or decimal number. The
- |round| function rounds to the nearest integer, and |\xintexpr
- round(...)\relax| has an alternative and equivalent syntax as \csbxint{iexpr}|
- ... \relax|. There is also \csbxint{theiexpr}. The rounding is applied to the
- final result only, intermediate computations are not rounded.
-\item \csbxint{iiexpr}|..\relax| and \csbxint{theiiexpr}|..\relax| deal only
- with (long) integers and skip the overhead of the fraction internal format.
- The infix operator |/| does euclidean division, thus |2+5/3| will not be
- treated exactly but be like |2+1|.
-\item there is also \csbxint{boolexpr}| ... \relax| and \csbxint{theboolexpr}|
- ... \relax|. Same as |\xintexpr| with the final result 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:
+\begin{itemize}[parsep=0pt]
+\item One can define variables (the definition itself is a non expandable
+ step). The allowed names are composed of letters, digits, and underscores.
+ The variable should not start with a digit and single letters |a..z|, |A..Z|
+ are predefined for use as dummy variables --- see below. The |@| is
+ reserved.
+\begin{everbatim*}
\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) }
-\xintFor #1 in {0,1} \do {%
- \xintFor #2 in {0,1} \do {%
- \xintFor #3 in {0,1} \do {%
- \centerline{#1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}\hfil
- #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}\hfil
- #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}}}}}
-!%
-\endgroup
-\xintNewBoolExpr \AssertionA[3]{ #1 & (#2|#3) }
-\xintNewBoolExpr \AssertionB[3]{ #1 | (#2&#3) }
-\xintNewBoolExpr \AssertionC[3]{ xor(#1,#2,#3) }
-\xintFor #1 in {0,1} \do {%
- \xintFor #2 in {0,1} \do {%
- \xintFor #3 in {0,1} \do {%
- \centeredline{#1 AND (#2 OR #3) is \AssertionA {#1}{#2}{#3}\hfil
- #1 OR (#2 AND #3) is \AssertionB {#1}{#2}{#3}\hfil
- #1 XOR #2 XOR #3 is \AssertionC {#1}{#2}{#3}}}}}
-
-%
-\item there is also \csbxint{floatexpr}| ... \relax| where the algebra is done
- in floating point approximation (also for each intermediate result). Use the
- 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 the denominator |b| even if |1| gets printed; it does not
- show here because the square root is computed by a version of
- \csbxint{FloatSqrt} which for efficiency when used in such expressions outputs
- the result in a format |d_1 d_2 .... d_P [N]| equivalent to the usual float
- output format |d_1.d_2...d_P e<expon.>|. To get a float
- format, it is easier to use an |\xintfloatexpr|, but the precision must be set
- using the non expandable |\xintDigits:=60;| assignment, there is no optional
- parameter possible currently to |\xintfloatexpr|:
-%
-\centeredline{|\xintDigits:=60;\xintthefloatexpr sqrt(2)\relax|}
-\centeredline{\digitstt{\xintDigits:=60;\xintthefloatexpr sqrt(2)\relax}}
-%
-Or, without manipulating |\xintDigits|, another option to convert to float a
-computation done by an |\xintexpr|:
-\centeredline{|\xintFloat[60]{\xinttheexpr sqrt(2,60)\relax}|}
-\centeredline{\digitstt{\xintFloat[60]{\xinttheexpr sqrt(2,60)\relax}}}
-%
-Floats
- are quickly indispensable when using the power function (which can only have
- an integer exponent), as exact results will easily have hundreds, if not
- thousands, of digits.
-%
-\centeredline{|\xintDigits:=48;
- \xintthefloatexpr 2^100000\relax|: }
-\centeredline{\xintDigits:=48;\digitstt{\xintthefloatexpr 2^100000\relax}}
-%
-\item hexadecimal \TeX{} number\inmarg{New with 1.09k!} denotations
- (\emph{i.e.}, with a |"| prefix) are recognized by the |\xintexpr| parser and
- its variants. Except in |\xintiiexpr|, a (possibly empty) fractional part
- with the dot |.| as ``hexadecimal'' mark is allowed.
-%
-\centeredline{|\xinttheexpr "FEDCBA9876543210\relax|$\to$\digitstt{\xinttheexpr
- "FEDCBA9876543210\relax}}
-\centeredline{|\xinttheiexpr 16^5-("F75DE.0A8B9+"8A21.F5746+16^-5)\relax|$\to$\digitstt{\xinttheiexpr 16^5-("F75DE.0A8B9+"8A21.F5746+16^-5)\relax}}
-%
-Letters must be uppercased, as with standard
- \TeX{} hexadecimal denotations. Loading the \xintbinhexname package is required
- for this functionality.
-\endlist
+ \xintdefvar a_1 := 3.14159;\xintdefvar a2 := 2.71828;\xinttheiexpr [5] a_1+a2\relax
\endgroup
-
-\section{The \csh{xintexpr} math parser (II)}
-\label{sec:exprsummaryII}
-
-An expression is built with infix operators (including comparison and boolean
-operators), parentheses, functions, and the two branching operators |?| and |:|.
-The parser expands everything from the left to the right and everything may thus
-be revealed step by step by expansion of macros. Spaces anywhere are allowed.
-
-Note that |2^-10| is perfectly accepted input, no need for parentheses;
-operators of power |^|, division |/|, and subtraction |-| are all
-left-associative: |2^4^8| is evaluated as |(2^4)^8|. The minus sign as prefix
-has various precedence levels: |\xintexpr -3-4*-5^-7\relax| evaluates as
-|(-3)-(4*(-(5^(-7))))| and |-3^-4*-5-7| as |(-((3^(-4))*(-5)))-7|.
-
-If one uses directly macros within |\xintexpr..\relax|, rather than the
-operators or the functions which are described next, one should take into
-account that:
-\begin{enumerate}
-\item the parser will not see the macro arguments, (but they may themselves be
- set-up as |\xinttheexpr...\relax|),
-\item the output format of most \xintfracname macros is |A/B[N]|, and square
- brackets are \emph{not understood by the parser}. One \emph{must} enclose the
- macro and its arguments inside a brace pair |{..}|, which will be recognized
- and treated specially,
-\item a macro outputting numbers in scientific notation |x.yEz| (either with a
- lowercase |e| or uppercase |E|), must \emph{not} be enclosed
- in a brace pair, this is the exact opposite of the |A/B[N]| case; scientific
- numbers, explicit or implicit, should just be inserted directly in the
- expression.
-\end{enumerate}
-
-One may insert a sub-|\xintexpr|-expression within a larger one. Each one of
-|\xintexpr|, |\xintiexpr|, |\xintfloatexpr|, |\xintboolexpr| may be inserted in
-another one. On the other hand the integer only |\xintiiexpr| will generally
-choke on a sub-|\xintexpr| as the latter (except if it did not do any operation
-or had an overall top level |round| or |trunc| or |?(..)| or\dots) produces (in
-internal format) an |A/B[N]| which the strictly integer only \csbxint{iiexpr}
-does not understand. See \autoref{xintiiexpr} for more information.
-
-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 are
-the postfix operators: |!| for the factorial, |?| and |:| are two-fold way and
-three-fold way branching constructs. Also at the top level of priority the |e|
-and |E| of the scientific notation and the |"|\inmarg{\string" is new in 1.09k}
-for hexadecimal numbers, then 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 \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. All functions even
- |?| and |!| (as prefix) require parentheses around their argument
- (possibly a comma separated list).
- \begin{framed}
- \ctexttt{floor, ceil, frac, reduce, sqr, abs, sgn, ?, !, not, bool,
- togl, round, trunc, float, sqrt, quo, rem, if, ifsgn, all, any,
- xor, add (=sum), mul (=prd), max, min, gcd, lcm.}
-
- |quo| and |rem|
- operate only on integers; |gcd| and |lcm| also and require
- \xintgcdname loaded; |togl| requires the |etoolbox| package; |all|, |any|,
- |xor|, |add|, |mul|, |max| and |min| are functions with arbitrarily many
- comma separated arguments.
- \end{framed}
- \begin{description}
- \item[functions with one (numeric) argument] (numeric: any expression leading
- to an integer, decimal number, fraction, or floating number in scientific
- notation) \ctexttt{floor, ceil, frac, reduce, sqr, abs, sgn, ?, !, not}. The
- |?(x)| function returns the truth value, @1@ if |x<>0|, @0@ if |x=0|. The
- |!(x)| is the logical not. The |reduce| function puts the fraction in
- irreducible form. The |frac| function is fractional part,
- same sign as the number:\newline
- \null\quad\quad|\xinttheexpr
- frac(-3.57)\relax|$\to$\digitstt{\xinttheexpr frac(-3.57)\relax}\newline
- \null\quad\quad|\xinttheexpr
- trunc(frac(-3.57),2)\relax|$\to$\digitstt{\xinttheexpr
- trunc(frac(-3.57),2)\relax}\newline
- \null\quad\quad|\xintthefloatexpr
- frac(-3.57)\relax|$\to$\digitstt{\xintthefloatexpr
- frac(-3.57)\relax}.\newline
- Like
- the other functions |!| and |?| \emph{must} use parentheses.
-
- \item[functions with one (alphabetical) argument] \hypertarget{item:bool}
- {\ctexttt{bool,togl}}.
- |bool(name)| returns @1@ if the \TeX{} conditional |\ifname| would
- act as |\iftrue| and @0@ otherwise. This works with conditionals
- defined by |\newif| (in \TeX{} or \LaTeX{}) or with primitive
- 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 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; related: the |frac| function).
- \item[the if conditional (twofold way)] \ctexttt{if}|(cond,yes,no)| checks if
- |cond| is true or false and takes the corresponding branch. Any non zero
- number or fraction is logical true. The zero value is logical false. Both
- ``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}: |gcd| and |lcm| are
- integer-only and require the \xintgcdname package. Currently, the |and| and
- |or| keywords are left undefined by the package, which uses rather |all|
- and |any|. They must have at least one argument.
- \end{description}
-\item The three postfix operators \ctexttt{!, ?, :}.
- \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{|\xinttheiexpr (3>2)?{5+6}{7-1}2^3\relax|} is legal and
- computes |5+62^3=|\digitstt{\xinttheiexpr(3>2)?{5+(6}{7-(1}2^3)\relax}. Note
- though that it would be better practice to include here the |2^3| inside the
- branches. The contents of the branches may be arbitrary as long as once glued
- to what is next the syntax is respected: {|\xintexpr
- (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 \def\MicroFont{\color[named]{DarkOrchid}\ttfamily\bfseries}
- The |.| as decimal mark; the number scanner treats it as an inherent,
- optional and unique component of a being formed number. One can do things
- such as {\def\MicroFont{\ttfamily}|\xinttheexpr
- .^2+2^.\relax|$\to$\digitstt{\xinttheexpr .^2+2^.\relax} (which is
- |0^2+2^0|)}.
-\item The |"| for hexadecimal numbers: it is treated with highest priority,
- allowed only at locations where the parser expects to start forming a numeric
- operand, once encountered it triggers the hexadecimal scanner which looks for
- successive hexadecimal digits (as usual skipping spaces and expanding forward
- everything) possibly a unique optional dot (allowed directly in front) and
- then an optional (possibly empty) fractional part. The dot and fractional part
- are not allowed in {\def\MicroFont{\ttfamily}|\xintiiexpr..\relax|}. The |"|
- functionality requires that the user loaded \xintbinhexname (there is no
- warning, but an ``undefined control sequence'' error will naturally results if
- the package has not been loaded).
-\item
- %
- The |e| and |E| for scientific notation. They are treated as infix operators
- of highest priority: this means that they serve as an end marker (possibly
- arising from macro expansion) for the scanned number, and then will pre-empt
- the number coming next, either explicit, or arising from expansion, from
- parenthesized material, from a sub-expression etc..., to serve as exponent.
- \begingroup
- \def\MicroFont{\ttfamily}%
- From
- the rules above, inside |\xintexpr|, |1e3-1|
- is \digitstt{\xinttheexpr 1e3-1\relax}, |1e3^2| is \digitstt{\xinttheexpr
- 1e3^2\relax}, and |"Ae("A+"F)^"A|
- is \digitstt{\xinttheexpr "Ae("A+"F)^"A\relax}.\endgroup
-\item The power operator |^|. It is left associative:
-\begingroup\def\MicroFont{\ttfamily}%
-|\xinttheiexpr 2^2^3\relax| evaluates to \xinttheiexpr 2^2^3\relax, not
-\xinttheiexpr 2^(2^3)\relax. Note that if the float precision is too low,
-iterated powers withing |\xintfloatexpr..\relax| may fail: for example with the
-default setting |(1+1e-8)^(12^16)| will be computed with |12^16| approximated
-from its @16@ most significant digits but it has @18@ digits
-(\digitstt{={\xintiiPow{12}{16}}}), hence the result is wrong:
-%
-\centeredline{$\np{\xintthefloatexpr (1+1e-8)^(12^16)\relax }$}
-%
-One should code
-%
-\centeredline{|\xintthe\xintfloatexpr (1+1e-8)^\xintiiexpr 12^20\relax \relax|}
-%
-to obtain the correct floating point evaluation
-%
-\centeredline{$\np{1.00000001}^{12^{16}}\approx\np{\xintthefloatexpr
- (1+1e-8)^\xintiiexpr 12^16\relax\relax }$}%
-%
-\endgroup
-\item Multiplication and division \raisebox{-.3\height}{|*|}, |/|. The division
- is left associative, too: \begingroup\def\MicroFont{\ttfamily}%
- |\xinttheiexpr 100/50/2\relax| evaluates to
- \xinttheiexpr 100/50/2\relax, not \xinttheiexpr 100/(50/2)\relax.\endgroup
-\item Addition and subtraction |+|, |-|. Again, |-| is left
- associative: \begingroup\def\MicroFont{\ttfamily}%
- |\xinttheiexpr 100-50-2\relax| evaluates to
- \xinttheiexpr 100-50-2\relax, not \xinttheiexpr 100-(50-2)\relax.\endgroup
-\item Comparison operators |<|, |>|, |=| (currently, no @<=@, @>=@,
- \dots ).
-\item Conjunction (logical and): |&|. (no @&&@)
-\item Inclusive disjunction (logical or): \verb$|$. (no @||@)
-\item The comma |,|. \def\MicroFont{\ttfamily}%
- With |\xinttheiexpr 2^3, 3^4, 5^6\relax| one obtains as output
- \xinttheiexpr 2^3,3^4,5^6\relax{} (no space after the commas on output).
-\item The parentheses.
-\endlist
-\endgroup
-
-See \autoref{ssec:countinexpr} for count and dimen registers and variables.
-
-
-\section{Change log for earlier releases}
-\label{sec:releases}
-
-% peut-être je devrais mettre ici le dernier aussi?
-
-\footnotesize
-
-\noindent Release |1.09j| (|[2014/01/09]|):
-\begin{itemize}
-\item the core division routines have been re-written for some (limited)
- efficiency gain, more pronounced for small divisors. As a result the
- \hyperlink{Machin1000}{computation of one thousand digits of $\pi$}
- is close to three times faster than with earlier releases.
-\item some various other small improvements, particularly in the power routines.
-\item a new macro \csbxint{XTrunc} is designed to produce thousands or even tens
- of thousands of digits of the decimal expansion of a fraction. Although
- completely expandable it has its use limited to inside an |\edef|, |\write|,
- |\message|, \dots. It
- can thus not be nested as argument to another package macro.
-\item the tacit multiplication done in \csbxint{expr}|..\relax| on encountering
- a count register or variable, or a |\numexpr|, while scanning a (decimal)
- number, is extended to the case of a sub |\xintexpr|-ession.
-\item \csbxint{expr} can now be used in an |\edef| with no |\xintthe|
- prefix; it will execute completely the computation, and the error
- message about a missing |\xintthe| will be inhibited. Previously, in
- the absence of |\xintthe|, expansion could only be a full one (with
- |\romannumeral-`0|), not a complete one (with |\edef|). Note that this
- differs from the behavior of the non-expandable |\numexpr|: |\the| or
- |\number| are needed not only to print but also to trigger the
- computation, whereas |\xintthe| is mandatory only for the printing step.
-\item the default behavior of \csbxint {Assign} is changed, it now does not do
- any further expansion beyond the initial full-expansion which provided the
- list of items to be assigned to macros.
-\item bug-fix: |1.09i| did an unexplainable change to |\XINT_infloat_zero| which
- broke the floating point routines for vanishing operands =:(((
-\item dtx bug-fix: the |1.09i .ins| file produced a buggy |.tex| file.
+\end{everbatim*}
+\item |add| and |mul| have a new syntax requiring a dummy variable:
+\begin{everbatim*}
+\xinttheexpr add(x, x=1,3,19), mul(x^2, x=1,3,19), add(x(x+1), x= 1,3,19)\relax
+\end{everbatim*}
+
+Use |`+`| and |`*`| (left ticks mandatory) for syntax without dummy variables:
+\begin{everbatim*}
+\xinttheexpr `+`(1,3,19), `*`(1^2,3^2,19^2), `+`(1*2,3*4,19*20)\relax
+\end{everbatim*}
+\item The |seq| function generates sequences according to a given formula:
+\begin{everbatim*}
+\xinttheexpr seq(x(x+1)(x+2), x=1,3,19), `+`(seq(x(x+1)(x+2), x=1,3,19)),
+ add(x(x+1)(x+2), x=1,3,19)\relax
+\end{everbatim*}
+\begin{everbatim*}
+And this is nestable!
+\xinttheexpr seq(seq(x^y, y=1..5),x=1..5), add(mul(x^y,y=1..5), x=1..5),
+ add(x^15, x=1..5)\relax % 15 = 1+2+3+4+5
+\end{everbatim*}
+
+One should use parentheses appropriately. The \csbxint{expr} parser in normal
+operation is not bad at identifying missing or extra opening or closing
+parentheses, but when it handles |seq|, |add|, |mul| or similar constructs it
+switches to another mode of operation (it starts using delimited macros,
+something which is almost non-existent in all its other operations) and ill-formed
+expressions are much more likely to let the parser fetch tokens from beyond the
+mandatory ending |\relax|. Thus, in case of a missing parenthesis in such
+circumstances the error message from \TeX{} might be very cryptic, even for
+the seasoned \xintname user.
+
+\item As seen in the last example |a..b| constructs the integers from |a| to
+ |b|. This is (small) integer only. A more general |a..[d]..b| works with big
+ integers, or fractions, from |a| to |b| with step |d|.
+\begin{everbatim*}
+\xinttheexpr seq(2x+1, x=1..10, 100..110, 3/5..[1/5]..7/5)\relax
+\end{everbatim*}
+\item itemwise operations on lists are possible, as well as item extractions:
+\begin{everbatim*}
+\xinttheiiexpr 2*[1,10,100]^3, 5+[2*[1,10,100]^3]*100 \relax
+\end{everbatim*}
+\begin{everbatim*}
+\xinttheiiexpr 1+[seq(3^j, j=1..10, 21..30)][17], 1+3^27\relax
+\end{everbatim*}
+
+We used the |[list][n]| construct which gives the nth item from the list. In
+this context there are also the functions |last| and |first|. There is no real
+concept of a list object, nor list operations, although itemwise manipulation
+are made possible as shown above via the |[..]| constructor. The list
+manipulation utilities are so far a bit limited. There is no notion of an
+``nuple'' object. The variable |nil| is reserved, it represents an empty list.
+
+\item |subs| is similar to |seq| in syntax but is for variable substitution:
+\begin{everbatim*}
+\xinttheexpr subs(100*subs(10*subs(3*x+5,x=y+50)+2,y=z^2),z=10)\relax % 100(10(3*150+5)+2)
+\end{everbatim*}
+\begin{everbatim*}
+\xinttheexpr subs(subs(add(x^2+y^2,x=1..y),y=t),t=20)\relax
+\end{everbatim*}
+
+The substituted variable may be a comma separated list (this is impossible
+with |seq| which will always pick one item after the other of a list).
+\begin{everbatim*}
+\xinttheexpr subs([x]^2,x=-123,17,32)\relax
+\end{everbatim*}
+
+\item last but not least, |seq| has variants |rseq| and |rrseq| which allow
+ recursive definitions. They start with at least one initial value, then a
+ semi-colon, then the formula, then the list of indices to iterate over. |@|
+ (or |@1|) evaluates to the last computed item, and |rrseq| keeps the memory
+ of the |K| last results, where |K| was the number of initial terms. One
+ accesses them via |@1, @2, @3, @4| and |@@(N)| for |N>4|. It is even
+ possible to nest them and use |@@@| to access the values of the master
+ recursion...
+\begin{everbatim*}
+\xinttheiiexpr rseq(1; 2*@, i=1..10), `+`(rseq(1; 2*@, i=1..10))\relax
+\end{everbatim*}
+\begin{everbatim*}
+\xinttheiiexpr rseq(2; @(@+1)/2, i=1..5)\relax
+\end{everbatim*}
+\begin{everbatim*}
+\xinttheiiexpr rseq(0,1; (@1,add(x,x=@1)), y=2..10)\relax
+\end{everbatim*}
+
+Some Fibonacci fun
+\begin{everbatim*}
+\xinttheiiexpr rrseq(0,1; @1+@2, x=2..10), last(rrseq(0,1; @1+@2, x=2..100))\relax
+\end{everbatim*}
+\begin{everbatim*}
+Sum of previous last three: \xinttheiiexpr rrseq(0,0,1; @1+@2+@3, i=1..20)\relax
+\end{everbatim*}
+\begin{everbatim*}
+Big numbers: \printnumber{\xinttheexpr rseq(1; @(@+1), j=1..10)\relax }
+\end{everbatim*}
+
+Nested recursion often quickly leads to gigantic outputs. This is an
+experimental feature, susceptible to be removed or altered in the future.
+\begin{everbatim*}
+\xinttheexpr rrseq(1; `+`(rrseq(0,1; @@@(1)+@1+@2, i=1..10)), j=1..5)\relax
+\end{everbatim*}
+
+\item The special kerwords |omit|, |abort| and |break(..)| are available
+ inside |seq|, |rseq|, |rrseq|, as well as the |n++| for a potentially
+ infinite iteration. The |n++| construct in conjunction with an |abort| or
+ |break| is often more efficient, because in other cases the list to iterate
+ over is first completely constructed.
+\begin{everbatim*}
+First Fibonacci number at least |2^31| and its index
+\xinttheiiexpr iter(0,1; (@1>=2^31)?{break(i)}{@2+@1}, i=1++)\relax
+\end{everbatim*}
+
+\begin{everbatim*}
+Prime numbers are always cool
+\xinttheiiexpr seq((seq((subs((x/:m)?{(m*m>x)?{1}{0}}{-1},m=2n+1))
+ ??{break(0)}{omit}{break(1)},n=1++))?{x}{omit},
+ x=10001..[2]..10200)\relax
+\end{everbatim*}
+
+The syntax in this last example may look a bit involved. First |x/:m| computes
+|x modulo m| (this is the modulo with respect to truncated division, which
+here for positive arguments is like Euclidean division; in
+|\xintexpr...\relax|, |a/:b| is such that |a = b*(a//b)+a/:b|, with |a//b| the
+algebraic quotient |a/b| truncated to an integer.). The |(x)?{yes}{no}|
+construct checks if |x| (which \emph{must} be within parentheses) is true or
+false, i.e. non zero or zero. It then executes either the |yes| or the |no|
+branch, the non chosen branch is \emph{not} evaluated. Thus if |m| divides |x|
+we are in the second (``false'') branch. This gives a |-1|. This |-1| is the
+argument to a |??| branch which is of the type |(y)??{y<0}{y=0}{y>0}|, thus here
+the |y<0|, i.e., |break(0)| is chosen. This |0| is thus given to another |?|
+which consequently chooses |omit|, hence the number is not kept in the list.
+The numbers which survive are the prime numbers.
+
+% A006877 In the `3x+1' problem, these values for the starting value set new
+% records for number of steps to reach 1. (Formerly M0748) 14 1, 2, 3, 6, 7,
+% 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, 871, 1161,
+% 2223, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 23529, 26623, 34239,
+% 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935,
+% 626331, 837799
+
+\item The |iter| function is like |rrseq| but does not leave a trace of earlier items,
+ it starts with |K| initial values, then it iterates: either a fixed number of times,
+ or until aborting or breaking. And ultimately it prints |K| final values.
+\begin{everbatim*}
+The first Fibonacci number beyond the \TeX{} bound is
+\xinttheiiexpr subs(iter(0,1;(@1>N)?{break(i)}{@1+@2},i=1++),N=2^31)\relax{}
+and the previous number was its index.
+\end{everbatim*}But this was a bit too easy, what is the smallest Fibonacci number not representable on 64 bits?
+\begin{everbatim*}
+The first Fibonacci number beyond |2^64| bound is
+\xinttheiiexpr subs(iter(0,1;(@1>N)?{break(i)}{@1+@2},i=1++),N=2^64)\relax{}
+and the previous number was its index.
+\end{everbatim*}
+
+One more recursion:
+\begin{everbatim*}
+\def\syr #1{\xinttheiiexpr rseq(#1; (@<=1)?{break(i)}{odd(@)?{3@+1}{@/2}},i=0++)\relax}
+The 3x+1 problem: \syr{231}\par
+\end{everbatim*}
+
+Ok, a final one:
+\begin{everbatim*}
+\def\syrMax #1{\xinttheiiexpr iter(#1,#1;even(i)?
+ {(@2<=1)?{break(i/2)}{odd(@2)?{3@2+1}{@2/2}}}
+ {(@1>@2)?{@1}{@2}},i=0++)\relax }
+With initial value 1161, the maximal number attained is \syrMax{1161} and that latter
+number is the number of steps which was needed to reach 1.\par
+\end{everbatim*}
+
+Well, one more:
+
+\begin{everbatim*}
+\newcommand\GCD [2]{\xinttheiiexpr rrseq(#1,#2; (@1=0)?{abort}{@2/:@1}, i=1++)\relax }
+\GCD {13^10*17^5*29^5}{2^5*3^6*17^2}
+\end{everbatim*}
+
+and the ultimate:
+
+\begin{everbatim*}
+\newcommand\Factors [1]{\xinttheiiexpr
+ subs(seq((i/:3=2)?{omit}{[L][i]},i=1..([L][0])), % [L][0]= # of items
+ L=rseq(#1;([@][1]<=1)?{abort}{(([@][1])/:p)?{omit}
+ {iter(([@][1])//p; (@/:p)?{break((@,p,e))}{@//p},e=1++)}},p=2++))\relax }
+\Factors {41^4*59^2*29^3*13^5*17^8*29^2*59^4*37^6}
+\end{everbatim*}
+
+This might look a bit scary, I admit. \xintexprname has so far minimal tools.
+Particularly we are hampered by absence of a notion of ``nuple''. The |y| will
+evaluate, if one follows the steps, to a comma separated list starting with
+the initial (evaluated) |N=#1| and then triplets where the second member is a
+prime divisor, and the third its exponent in |N|. I couldn't see an immediate
+way with the current tools to avoid having to carry along as first entry of
+the triplets the number |N| progressively trimmed of its prime factors. Thus
+we keep it in the recursion, and once the sequence is produced in its entirety
+we remove the extra stuff and end up in a completely expandable way with the
+prime factors and their exponents.
+
+Notice that in |iter(([@][1])//p;| this |@| refers to the previous triplet (or
+in the first step to |N|), but the latter |@| showing up in |(@/:p)?| refers
+to the previous value computed by |iter|. This way we divide the number by the
+prime |p| keeping track of the exponent |e|.
+
+\begin{snugframed}
+ Parentheses are essential in |..([y][0])| else the parser will see |..[| and
+ end up in ultimate confusion, and also in |([@][1])/:p| else the parser will
+ see the itemwise operator |]/| on lists and again be very confused (I could
+ implement a |]/:| on lists, but in this situation this would also be very
+ confusing to the parser.)
+\end{snugframed}
\end{itemize}
-\noindent Release |1.09i| (|[2013/12/18]|):
-\begin{itemize}
-\item \csbxint{iiexpr} is a variant of \csbxint{expr} which is optimized to deal
- only with (long) integers, |/| does a euclidean quotient.
-\item |\xintnumexpr|, |\xintthenumexpr|, |\xintNewNumExpr| are renamed,
- respectively, \csbxint{iexpr}, \csbxint{theiexpr}, \csbxint{NewIExpr}. The
- earlier denominations are kept but to be removed at some point.
-\item it is now possible within |\xintexpr...\relax| and its variants to use
- count, dimen, and skip registers or variables without explicit |\the/\number|:
- the parser inserts automatically |\number| and a tacit multiplication is
- implied when a register or variable immediately follows a number or fraction.
- Regarding dimensions and |\number|, see the further discussion in
- \autoref{sec:Dimensions}.
-\item new conditional \csbxint{ifOne}; |\xintifTrueFalse| renamed to
- \csbxint{ifTrueAelseB}; new macros \csbxint{TFrac} (`fractional part', mapped
- to function |frac| in |\xintexpr|-essions), \csbxint{FloatE}.
-\item \csbxint{Assign} admits an optional argument to specify the expansion
- type to be used: |[]| (none, default), |[o]| (once), |[oo]| (twice), |[f]|
- (full), |[e]| (|\edef|),... to define the macros
-\item related to the previous item, \xinttoolsname defines
- \hyperref[odef]{\ttfamily\char92odef},
- \hyperref[oodef]{\ttfamily\char92oodef},
- \hyperref[fdef]{\ttfamily\char92fdef} (if the names have already been
- assigned, it uses |\xintoodef| etc...). These tools are provided for the
- case one uses the package macros in a non-expandable context, particularly
- \hyperref[oodef]{\ttfamily\char92oodef} which expands twice the macro
- replacement text and is thus a faster alternative to |\edef| taking into
- account that the \xintname bundle macros expand already completely in only
- two steps. This can be significant when repeatedly making |\def|-initions
- expanding to hundreds of digits.
-\item some across the board slight efficiency improvement as a result of
- modifications of various types to ``fork'' macros and ``branching
- conditionals'' which are used internally.
-\item bug-fix: |\xintAND| and |\xintOR| inserted a space token in some cases and
- did not expand as promised in two steps (bug dating back to |1.09a| I think;
- this bug was without consequences when using |&| and \verb+|+ in
- \csa{xintexpr-}essions, it affected only the macro form)
- |:-((|.
-\item bug-fix: \csbxint{FtoCCv} still ended fractions with the |[0]|'s which
- were supposed to have been removed since release |1.09b|.
-\end{itemize}
-
-\noindent Release |1.09h| (|[2013/11/28]|):
-\begin{itemize}
-\item parts of the documentation have been re-written or re-organized,
- particularly the discussion of expansion issues and of input and
- output formats.
-\item the expansion types of macro arguments are documented in the margin of the
- macro descriptions, with conventions mainly taken over from those in the
- \LaTeX3 documentation.
-\item a dependency of \xinttoolsname on \xintname (inside \csbxint{Seq}) has
- been removed.
-\item \csbxint{TypesetEuclideAlgorithm} and \csbxint{TypesetBezoutAlgorithm}
- have been slightly modified (regarding indentation).
-\item macros \csa{xintiSum} and \csa{xintiPrd} are renamed to \csbxint{iiSum}
- and \csbxint{iiPrd}.
-\item a count register used in |1.09g| in the \csbxint{For} loops for parsing
- purposes has been removed and replaced by use of a |\numexpr|.
-\item the few uses of |\loop| have been replaced by |\xintloop/\xintiloop|.
-\item all macros of \xinttoolsname for which it makes sense are now
- declared |\long|.
-\end{itemize}
-
-\noindent Release |1.09g| (|[2013/11/22]|):
-\begin{itemize}
-\item package \xinttoolsname is detached from \xintname, to make tools such as
- \csbxint{For}, \csbxint{ApplyUnbraced}, and \csbxint{iloop} available without
- the \xintname overhead.
-\item new expandable nestable loops \csbxint{loop} and \csbxint{iloop}.
-\item bugfix: \csbxint{For} and \csbxint{For*} do not modify anymore the value
- of |\count 255|.
-\end{itemize}
-
-\noindent Release |1.09f| (|[2013/11/04]|):
-\begin{itemize}
-\item new \csbxint{ZapFirstSpaces}, \csbxint{ZapLastSpaces},
- \csbxint{ZapSpaces}, \csbxint{ZapSpacesB}, for expandably stripping away
- leading and/or ending spaces.
-\item \csbxint{CSVtoList} by default uses \csbxint{ZapSpacesB} to strip away
- spaces around commas (or at the start and end of the comma separated list).
-\item also the \csbxint{For} loop will strip out all spaces around commas and at
- the start and the end of its list argument; and similarly for
- \csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour}.
-\item \csbxint{For} \emph{et al.} accept all macro parameters
- from
- |#1| to |#9|.
-\item for reasons of inner coherence some macros previously with one extra `|i|'
- in their names (e.g. \csa{xint\-iMON}) now have a doubled `|ii|'
- (\csbxint{iiMON}) to indicate that they skip the overhead of parsing their
- inputs via \csbxint{Num}. Macros with a \emph{single} `|i|' such as
- \csbxint{iAdd} are those which maintain the non-\xintfracname output format
- for big integers, but do parse their inputs via \csbxint{Num} (since release
- |1.09a|). They too may have doubled-|i| variants for matters of programming
- optimization when working only with (big) integers and not fractions or
- decimal numbers.
-\end{itemize}
-
-
-\noindent Release |1.09e| (|[2013/10/29]|):
-\begin{itemize}
-\item new \csbxint{integers}, \csbxint{dimensions}, \csbxint{rationals} for
- infinite \csbxint{For} loops, interrupted with \csbxint{BreakFor} and
- \csbxint{BreakForAndDo}.
-\item new \csbxint{ifForFirst}, \csbxint{ifForLast} for the \csa{xintFor} and
- \csa{xintFor*} loops,
-\item the \csa{xintFor} and \csa{xintFor*} loops are now |\long|, the
- replacement text and the items may contain explicit |\par|'s.
-\item bug fix, the \csbxint{For} loop (not \csbxint{For*}) did not correctly
- detect an
- empty list.
-\item new conditionals \csbxint{ifCmp}, \csbxint{ifInt}, \csbxint{ifOdd}.
-\item bug fix, |\xintiSqrt {0}| crashed. |:-((|
-\item the documentation has been enriched with various additional examples,
- such as the \hyperref[ssec:quicksort]{the quick sort algorithm illustrated} or
- the computation of prime numbers (\autoref{ssec:primesI},
- \autoref{ssec:primesII}, \autoref{ssec:primesIII}).
-\item the documentation explains with more details various expansion related
- issues, particularly in relation to conditionals.
-\end{itemize}
-
-\noindent Release |1.09d| (|[2013/10/22]|):\nobreak
-\begin{itemize}
-\item \csbxint{For*} is modified to gracefully handle a space token (or
- more than one) located at the
- very end of its list argument (as in for example |\xintFor* #1 in
- {{a}{b}{c}<space>} \do {stuff}|;
- spaces at other locations were already harmless). Furthermore this new
-version \fexpan ds the un-braced list items. After
-|\def\x{{1}{2}}| and |\def\y{{a}\x {b}{c}\x }|, |\y| will appear to
-\csbxint{For*} exactly as if it had been defined as
-|\def\y{{a}{1}{2}{b}{c}{1}{2}}|.
-\item same bug fix in \csbxint{ApplyInline}.
-\end{itemize}
-
-\noindent Release |1.09c| (|[2013/10/09]|):
-\begin{itemize}
-\item added \hyperlink{item:bool}{|bool|} and \hyperlink{item:bool}{|togl|} to
- the
- \csbxint{expr} syntax; also added \csbxint{boolexpr} and \csbxint{ifboolexpr}.
-\item added |\xintNewNumExpr| (now \csbxint{NewIExpr} and \csbxint{NewBoolExpr},
-\item \csbxint{For} is a new type of loop, whose replacement text inserts the
- comma separated values or list items via macro parameters, rather than
- encapsulated in macros; the loops are nestable up to four levels (nine
- levels since |1.09f|) and their replacement texts are allowed to close
- groups as happens with the tabulation in alignments,
-\item \csbxint{Forpair}, \csbxint{Forthree}, \csbxint{Forfour} are experimental
- variants of \csbxint{For},
-\item \csbxint{ApplyInline} has been enhanced in order to be usable for
- generating rows (partially or completely) in an alignment,
-\item new command \csbxint{Seq} to generate (expandably) arithmetic sequences of
- (short) integers,
-\item the factorial |!| and branching |?|, |:|, operators (in
- \csbxint{expr}|...\relax|) have now less precedence than a function name
- located just before: |func(x)!| is the factorial of |func(x)|, not |func(x!)|,
-\item again various improvements and changes in the documentation.
-\end{itemize}
-
-\noindent Release |1.09b| (|[2013/10/03]|):
-\begin{itemize}
-\item various improvements in the documentation,
-\item more economical catcode management and re-loading handling,
-\item removal of all those |[0]|'s previously forcefully added at the end of
- fractions by various macros of \xintcfracname,
-\item \csbxint{NthElt} with a negative index returns from the tail of the list,
-\item new macro \csbxint{PRaw} to have something like what |\xintFrac| does in
- math
- mode; i.e. a |\xintRaw| which does not print the denominator if it is one.
-\end{itemize}
-
-\noindent Release |1.09a| (|[2013/09/24]|):
-\begin{itemize}
-\item \csbxint{expr}|..\relax| and
- \csbxint{floatexpr}|..\relax| admit functions in their
- syntax, with comma separated values as arguments, among them \texttt{reduce,
- sqr, sqrt, abs, sgn, floor, ceil, quo, rem, round, trunc, float, gcd, lcm,
- max, min, sum, prd, add, mul, not, all, any, xor}.
-\item comparison (|<|, |>|, |=|) and logical (\verb$|$, |&|) operators.
-\item the command |\xintthe| which converts |\xintexpr|essions into printable
- format (like |\the| with |\numexpr|) is more efficient, for example one can do
- |\xintthe\x| if |\x| was def'ined to be an |\xintexpr..\relax|:
-\centeredline{|\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}|}
-\centeredline{|\def\z{\xintexpr
- \y-3^-114\relax}|\hspace{1cm}|\xintthe\z=|\begingroup
-\def\x{\xintexpr 3^57\relax}\def\y{\xintexpr \x^(-2)\relax}%
-\def\z{\xintexpr \y-3^-114\relax}\digitstt{\xintthe\z}\endgroup}
-\item |\xintnumexpr .. \relax| (now renamed \csbxint{iexpr}) is |\xintexpr
- round( .. ) \relax|.
-\item \csbxint{NewExpr} now works with the standard macro parameter character
- |#|.
-\item both regular |\xintexpr|-essions and commands defined by |\xintNewExpr|
- will work with comma separated lists of expressions,
-\item new commands \csbxint{Floor}, \csbxint{Ceil}, \csbxint{Maxof},
- \csbxint{Minof} (package \xintfracname), \csbxint{GCDof}, \csbxint{LCM},
- \csbxint{LCMof} (package \xintgcdname), \csbxint{ifLt}, \csbxint{ifGt},
- \csbxint{ifSgn}, \csbxint{ANDof}, ...
-\item The arithmetic macros from package \xintname now filter their operands via
- \csbxint{Num} which means that they may use directly count registers and
- |\numexpr|-essions without having to prefix them by |\the|. This is thus
- similar to the situation holding previously but with \xintfracname loaded.
-\item a bug introduced in |1.08b| made \csbxint{Cmp} crash when one of its
- arguments was zero. |:-((|
-\end{itemize}
-
-
-\noindent Release |1.08b| (|[2013/06/14]|):
-\begin{itemize}
-\item Correction of a problem with spaces inside |\xintexpr|-essions.
-\item Additional improvements to the handling of floating point numbers.
-\item The macros of \xintfracname allow to use count registers in their
- arguments in ways which were not previously documented. See
- \hyperref[sec:useofcount]{Use of count registers}.
-\end{itemize}
-
-\noindent Release |1.08a| (|[2013/06/11]|):
-\begin{itemize}
-\item Improved efficiency of the basic conversion from exact
- fractions to floating point numbers,
- with ensuing speed gains especially for the power function macros
- \csbxint{FloatPow} and \csbxint{FloatPower},
-\item Better management by the \xintfracname macros \csbxint{Cmp},
- \csbxint{Max}, \csbxint{Min} and \csbxint{Geq} of inputs having big powers
- of ten in them.
-\item Macros for floating point numbers added to the \xintseriesname package.
-\end{itemize}
-
-\noindent Release |1.08| (|[2013/06/07]|):
-\begin{itemize}
-\item Extraction of square roots, for floating point numbers
- (\csbxint{FloatSqrt}), and also in
- a version adapted to integers (\csbxint{iSqrt}).
-\item New package \xintbinhexname providing \hyperref[sec:binhex]{conversion
- routines} to and from binary and hexadecimal bases.
-\end{itemize}
-
-\noindent Release |1.07| (|[2013/05/25)]|):
-\begin{itemize}
-\item The \xintfracname macros accept numbers written in scientific notation,
- the \csbxint{Float} command serves to output its argument with a given number
- |D| of significant figures. The value of |D| is either given as optional
- argument to \csbxint{Float} or set with |\xintDigits := D;|. The default value
- is |16|.
-\item The \xintexprname package is a new core constituent (which loads
- automatically \xintfracname and \xintname) and implements the expandable
- expanding parsers \centeredline{\csbxint{expr}| . . . \relax|,
- and its variant
- \csbxint{floatexpr}| . . . \relax|} allowing on input formulas using the
- standard form with infix
- operators |+|, |-|, |*|, |/|, and |^|, and arbitrary levels of
- parenthesizing. Within a float expression the operations are executed
- according to the current value of \csbxint{Digits}. Within an
- |\xintexpr|-ession the binary operators are computed exactly.
-\item The floating point precision |D| is set (this is a
-local assignment to a |\mathchar| variable) with |\xintDigits := D;| and queried
-with |\xinttheDigits|. It may be set to anything up to |32767|.\footnote{but
- values higher than 100 or 200 will presumably give too slow evaluations.} The
-macro incarnations of the binary operations admit an optional argument which
-will replace pointwise |D|; this argument may exceed the |32767| bound.
-\item To write the |\xintexpr| parser I benefited from the commented source of
- the
-\LaTeX3 parser; the |\xintexpr| parser has its own features and peculiarities.
-See \hyperref[sec:expr]{its documentation}.
-\end{itemize}
-
-Initial release |1.0| was on |2013/03/28|.
-
-
-% \noindent Historians debate the early history of the \xintname bundle, whose
-% details will need patient reconstruction from the scattered archeological
-% remnants. It has been established that the initial release |1.0| was on
-% |2013/03/28|, although only closer scrutiny of the CTAN logs could help
-% completely exclude possibility of an earlier |0.9|.
-
-
-
-\normalsize
-
-
-\etocdepthtag.toc {commandsA}
+%\phantomsection
+\phantomsection\label{sec:expr11coords}
+
+To conclude with this overview of the new features in \xintexprname |1.1|, I
+will mention {\bfseries |\xintthecoords|} which converts a comma separated
+list as produced by |\xintfloatexpr| or |\xintiexpr [d]| to the format
+expected by the |TikZ| |coordinates| syntax.
+\begin{everbatim*}
+{\centering\begin{tikzpicture}[scale=10]\xintDigits:=8;
+ \clip (-1.1,-.25) rectangle (.3,.25);
+ \draw [blue] (-1.1,0)--(1,0);
+ \draw [blue] (0,-1)--(0,+1);
+ \draw plot[smooth] coordinates {\xintthecoords
+ % converts into (x1, y1) (x2, y2)... format
+ \xintfloatexpr seq((x^2-1,mul(x-t,t=-1+[0..4]/2)),x=-1.2..[0.1]..+1.2) \relax };
+\end{tikzpicture}\par }
+\end{everbatim*}
+
+% Notice: if x goes no take exactly value 1 or -1, the origin appears slightly
+% off the curve, not MY fault!!!
+
+\csbxint{thecoords} should be followed immediately by \csbxint{floatexpr} or
+\csbxint{iexpr} or \csbxint{iiexpr}, but not |\xintthefloatexpr|, etc\dots
+
+Besides, as |TikZ| will not understand the |A/B[N]| format which is used on
+output by |\xintexpr|, |\xintexpr| is not really usable with |\xintthecoords|
+for a |TikZ| picture, but one may use it on its own, and the reason for the
+spaces in and between coordinate pairs is to allow if necessary to print on
+the page for examination with about correct line-breaks.
+
+\begin{everbatim*}
+\oodef\x{\xintthecoords \xintexpr rrseq(1/2,1/3; @1+@2, x=1..20)\relax }
+\meaning\x +++
+\end{everbatim*}
+
+\etocdepthtag.toc {commands}
\indescriptionfalse
+\addtocontents{toc}{\gdef\string\sectioncouleur{{joli}}}
+\renewcommand{\etocaftertochook}{\addvspace{\bigskipamount}}
\section{Commands of the \xinttoolsname package}
\label{sec:tools}
-\def\n{\string{N\string}}
-\def\m{\string{M\string}}
-\def\x{\string{x\string}}
+\localtableofcontents
+
+\def\n{|{N}|}
+\def\m{|{M}|}
+\def\x{|{x}|}
These utilities used to be provided within the \xintname package; since |1.09g|
(|2013/11/22|) they have been moved to an independently usable package
@@ -3814,26 +4796,24 @@ numbers. Whenever relevant release |1.09h| has made the macros |\long| so they
accept |\par| tokens on input.
First the completely expandable utilities up to \csbxint{iloop}, then the non
-expandable utilities.
+expandable utilities.
This section contains various concrete examples and ends with a
\hyperref[ssec:quicksort]{completely expandable implementation of the Quick Sort
algorithm} together with a graphical illustration of its action.
-
% \clearpage % attention à ce clearpage
-\localtableofcontents
-
-
\subsection{\csbh{xintReverseOrder}}\label{xintReverseOrder}
\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:
+reversed. Unprotected spaces (of any character code) are gobbled.
+%
+\leftedline{|\xintReverseOrder{\xintDigitsOf\xintiPow {2}{100}\to\Stuff}|}
+%
+\leftedline{gives:
\ttfamily{\string\Stuff\string\to1002\string\xintiPow\string\xintDigitsOf}}
\subsection{\csbh{xintRevWithBraces}}\label{xintRevWithBraces}
@@ -3854,16 +4834,26 @@ tokens) 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
-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}\etype{n} does the same job without the
-initial expansion of its argument.
+%
+\leftedline{|\edef\x{\xintRevWithBraces{12345}}|}
+%
+\leftedline{|\meaning\x:|\dtt{\meaning\X}}
+%
+\leftedline{|\edef\y{\xintRevWithBraces\x}|}
+%
+\leftedline{|\meaning\y:|\dtt{\meaning\y}}
+%
+The examples above could be defined with |\edef|'s because the braced material
+did not contain macros. Alternatively:
+%
+\leftedline{|\expandafter\def\expandafter\w\expandafter|}
+%
+\leftedline{|{\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}}|}
+%
+\leftedline{|\meaning\w:|\dtt{\meaning\w}}
+%
+The macro \csa{xintReverseWithBracesNoExpand}\etype{n} does the same job
+without the initial expansion of its argument.
\subsection{\csbh{xintLength}}\label{xintLength}
@@ -3873,9 +4863,12 @@ 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
+its argument.
+%
+\leftedline{|\xintLength {\xintiPow {2}{100}}|\dtt{=\xintLength
+ {\xintiPow{2}{100}}}}
+%
+\leftedline{${}\neq{}$|\xintLen {\xintiPow {2}{100}}|\dtt{=\xintLen
{\xintiPow{2}{100}}}}
\subsection{\csbh{xintZapFirstSpaces}, \csbh{xintZapLastSpaces}, \csbh{xintZapSpaces}, \csbh{xintZapSpacesB}}
@@ -3886,20 +4879,19 @@ its argument. \centeredline{|\xintLength {\xintiPow
%{\small New with release |1.09f|.\par}
\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.
+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.
This macro will be mostly of interest to programmers who will know what I will
now be talking about. \emph{The essential points, naturally, are the complete
expandability and the fact that no brace removal nor any other alteration is
- done to the input.}
+ done to the input.}
\TeX's input scanner already converts consecutive blanks into single space
-tokens, but \csa{xintZapFirstSpaces} handles successfully also inputs with
+tokens, but |\xintZapFirstSpaces| handles successfully also inputs with
consecutive multiple space tokens.
However, it is assumed that \meta{stuff} does not contain (except inside braced
-sub-material) space tokens of character code distinct from @32@.
+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
expansion text of |\x| to define |\y|, then one should do:
@@ -3912,10 +4904,11 @@ have been stripped.
\begingroup
\def\x { \a { \X } { \b \Y } }
-\centeredline{|\xintZapFirstSpaces { \a { \X } { \b \Y } }->|%
-\digitstt{\color{magenta}{}\expandafter\detokenize\expandafter
+%
+\leftedline{|\xintZapFirstSpaces { \a { \X } { \b \Y } }->|%
+\dtt{\color{magenta}{}\expandafter\detokenize\expandafter
{\romannumeral0\expandafter\xintzapfirstspaces\expandafter{\x}}}+++}
-\endgroup
+\endgroup
\medskip
@@ -3927,30 +4920,32 @@ for \csbxint{ZapFirstSpaces} apply.
% ATTENTION à l'\ignorespaces fait par \color!
\begingroup
\def\x { \a { \X } { \b \Y } }
-\centeredline{|\xintZapLastSpaces { \a { \X } { \b \Y } }->|%
-\digitstt{\color{magenta}{}\expandafter\detokenize\expandafter
+%
+\leftedline{|\xintZapLastSpaces { \a { \X } { \b \Y } }->|%
+\dtt{\color{magenta}{}\expandafter\detokenize\expandafter
{\romannumeral0\expandafter\xintzaplastspaces\expandafter{\x}}}+++}
-\endgroup
+\endgroup
\medskip
\noindent\csbxint{ZapSpaces}\marg{stuff}\etype{n} does not do \emph{any}
-expansion of its
+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.
\begingroup
\def\x { \a { \X } { \b \Y } }
-\centeredline{|\xintZapSpaces { \a { \X } { \b \Y } }->|%
-\digitstt{\color{magenta}{}\expandafter\detokenize\expandafter
+%
+\leftedline{|\xintZapSpaces { \a { \X } { \b \Y } }->|%
+\dtt{\color{magenta}{}\expandafter\detokenize\expandafter
{\romannumeral0\expandafter\xintzapspaces\expandafter{\x}}}+++}
-\endgroup
+\endgroup
\medskip
\noindent\csbxint{ZapSpacesB}\marg{stuff}\etype{n} does not do \emph{any}
-expansion of
+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
@@ -3958,14 +4953,16 @@ all leading and all ending spaces and possibly removing one level of braces if
\begingroup
\def\x { \a { \X } { \b \Y } }
-\centeredline{|\xintZapSpacesB { \a { \X } { \b \Y } }->|%
-\digitstt{\color{magenta}{}\expandafter\detokenize\expandafter
+%
+\leftedline{|\xintZapSpacesB { \a { \X } { \b \Y } }->|%
+\dtt{\color{magenta}{}\expandafter\detokenize\expandafter
{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++}
\def\x { { \a { \X } { \b \Y } } }
-\centeredline{|\xintZapSpacesB { { \a { \X } { \b \Y } } }->|%
-\digitstt{\color{magenta}{}\expandafter\detokenize\expandafter
+%
+\leftedline{|\xintZapSpacesB { { \a { \X } { \b \Y } } }->|%
+\dtt{\color{magenta}{}\expandafter\detokenize\expandafter
{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++}
-\endgroup
+\endgroup
The spaces here at the start and end of the output come from the braced
material, and are not removed (one would need a second application for that;
recall though that the \xintname zapping macros do not expand their argument).
@@ -3978,7 +4975,7 @@ all leading and all ending spaces and possibly removing one level of braces if
% spaces around commas}!}\par}
\csa{xintCSVtoList}|{a,b,c...,z}|\etype{f} returns |{a}{b}{c}...{z}|. A
-\emph{list} is by
+\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
@@ -3993,7 +4990,7 @@ converts it into a `\TeX{} list of braced items'. The argument to
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 disappears). The macro \csbxint{CSVtoListNoExpand}\etype{n} does the same
-job without
+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
@@ -4001,15 +4998,23 @@ completely arbitrary (and even contain perilous stuff such as unmatched |\if|
and |\fi| tokens).
Contiguous spaces and tab characters, are collapsed by \TeX{}
-into single spaces. All such spaces around commas\footnote{and multiple space
- tokens are not a problem; but those at the top level (not hidden inside
- braces) \emph{must} be of character code |32|.} \fbox{are removed}, as well as
-the spaces at the start and the spaces at the end of the list.\footnote{let us
- recall that this is all done completely expandably... There is absolutely no
- alteration of any sort of the item apart from the stripping of initial and
- final space tokens (of character code |32|) and brace removal if and only if
- the item apart from intial and final spaces (or more generally multiple |char
- 32| space tokens) is braced.} The items may contain explicit |\par|'s or
+into single spaces. All such spaces around commas%
+%
+\footnote{and multiple space tokens are not a problem; but those at the
+ top level (not hidden inside braces) \emph{must} be of character code
+ |32|.}
+%
+\fbox{are removed}, as well as
+the spaces at the start and the spaces at the end of the list.%
+%
+\footnote{let us recall that this is all done completely expandably...
+ There is absolutely no alteration of any sort of the item apart from
+ the stripping of initial and final space tokens (of character code
+ |32|) and brace removal if and only if the item apart from intial and
+ final spaces (or more generally multiple |char 32| space tokens) is
+ braced.}
+%
+The items may contain explicit |\par|'s or
empty lines (converted by the \TeX{} input parsing into |\par| tokens).
\begingroup
@@ -4017,15 +5022,17 @@ empty lines (converted by the \TeX{} input parsing into |\par| tokens).
\edef\X{\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } , { {x ,
y} } }}
-\centeredline{|\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } ,
+%
+\leftedline{|\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } ,
{ {x , y} } }|}
-\centeredline{|->|%
-{\makeatletter\digitstt{\expandafter\strip@prefix\meaning\X}}}
+%
+\leftedline{|->|%
+{\makeatletter\dtt{\expandafter\strip@prefix\meaning\X}}}
One sees on this example how braces protect commas from
sub-lists to be perceived as delimiters of the top list. Braces around an entire
item are removed, even when surrounded by spaces before and/or after. Braces for
-sub-parts of an item are not removed.
+sub-parts of an item are not removed.
We observe also that there is a slight difference regarding the brace stripping
of an item: if the braces were not surrounded by spaces, also the initial and
@@ -4034,29 +5041,29 @@ the only situation where spaces protected by braces are nevertheless removed.
From the rules above: for an empty argument (only spaces, no braces, no comma)
the output is
-\digitstt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist { }}}
-(a list with one empty item),
+\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist { }}}
+(a list with one empty item),
for ``|<opt. spaces>{}<opt.
spaces>|'' the output is
-\digitstt{\expandafter\detokenize\expandafter
- {\romannumeral0\xintcsvtolist { {} }}}
+\dtt{\expandafter\detokenize\expandafter
+ {\romannumeral0\xintcsvtolist { {} }}}
(again a list with one empty item, the braces were removed),
for ``|{ }|'' the output is
-\digitstt{\expandafter\detokenize\expandafter
- {\romannumeral0\xintcsvtolist {{ }}}}
+\dtt{\expandafter\detokenize\expandafter
+ {\romannumeral0\xintcsvtolist {{ }}}}
(again a list with one empty item, the braces were removed and then
-the inner space was removed),
+the inner space was removed),
for ``| { }|'' the output is
-\digitstt{\expandafter\detokenize\expandafter
+\dtt{\expandafter\detokenize\expandafter
{\romannumeral0\xintcsvtolist { { }}}} (again a list with one empty item, the initial space served only to stop the expansion, so this was like ``|{ }|'' as input, the braces were removed and the inner space was stripped),
for ``\texttt{\ \{\ \ \}\ }'' the output is
-\digitstt{\expandafter\detokenize\expandafter
+\dtt{\expandafter\detokenize\expandafter
{\romannumeral0\xintcsvtolist { { } }}} (this time the ending space of the first
item meant that after brace removal the inner spaces were kept; recall though
that \TeX{} collapses on input consecutive blanks into one space token),
for ``|,|'' the output consists of two consecutive
empty items
-\digitstt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist
+\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist
{,}}}. Recall that on output everything is braced, a |{}| is an ``empty''
item.
%
@@ -4070,10 +5077,15 @@ the input).
\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}
\expandafter\def\expandafter\T\expandafter{\romannumeral0\xintcsvtolist{\t}}
-\centeredline{|\def\y{ \a,\b,\c,\d,\e} \xintCSVtoList\y->|%
- {\makeatletter\digitstt{\expandafter\strip@prefix\meaning\Y}}}
-\centeredline{|\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|} \centeredline
-{|\xintCSVtoList\t->|\makeatletter\digitstt{\expandafter\strip@prefix\meaning\T}}
+%
+\leftedline{|\def\y{ \a,\b,\c,\d,\e} \xintCSVtoList\y->|%
+ {\makeatletter\dtt{\expandafter\strip@prefix\meaning\Y}}}
+%
+\leftedline{|\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|}
+%
+\leftedline
+{|\xintCSVtoList\t->|\makeatletter\dtt{\expandafter\strip@prefix\meaning\T}}
+%
The results above were automatically displayed using \TeX's primitive
\csa{meaning}, which adds a space after each control sequence name. These spaces
are not in the actual braced items of the produced lists. The first items |\a|
@@ -4081,21 +5093,25 @@ and |\if| were either preceded by a space or braced to prevent expansion. The
macro \csa{xintCSVtoListNoExpand} would have done the same job without the
initial expansion of the list argument, hence no need for such protection but if
|\y| is defined as |\def\y{\a,\b,\c,\d,\e}| we then must do:
-\centeredline{|\expandafter\xintCSVtoListNoExpand\expandafter {\y}|} Else, we
-may have direct use: \centeredline{|\xintCSVtoListNoExpand
- {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|}
-\centeredline{|->|\digitstt{\expandafter\detokenize\expandafter
+%
+\leftedline{|\expandafter\xintCSVtoListNoExpand\expandafter {\y}|} Else, we
+may have direct use: %
+%
+\leftedline{|\xintCSVtoListNoExpand
+ {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|}
+%
+\leftedline{|->|\dtt{\expandafter\detokenize\expandafter
{\romannumeral0\xintcsvtolistnoexpand
- {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}}}}
+ {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}}}}
%
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 in this document
-source).
+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
+without removal of spaces around the commas, there is
+\csa{xintCSVtoListNonStripped}\etype{f} and
\csa{xintCSVtoListNonStrippedNoExpand}\etype{n}.
\endgroup
@@ -4108,41 +5124,52 @@ without removal of spaces around the commas, there is
\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}}|%
- \digitstt{=\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}}%
-\centeredline{|\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
- \digitstt{=\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}}
-\centeredline{|\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
- \digitstt{=\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} If |x=0|,
+itself may be a macro which is first \fexpan ded.
+
+\leftedline{|\xintNthElt {3}{{agh}\u{zzz}\v{Z}}| is
+ \texttt{\xintNthElt {3}{{agh}\u{zzz}\v{Z}}}}
+%
+\leftedline{|\xintNthElt {3}{{agh}\u{{zzz}}\v{Z}}| is
+ \texttt{\expandafter\expandafter\expandafter
+ \detokenize\expandafter\expandafter\expandafter {\xintNthElt
+ {3}{{agh}\u{{zzz}}\v{Z}}}}}
+%
+\leftedline{|\xintNthElt {2}{{agh}\u{{zzz}}\v{Z}}| is
+ \texttt{\expandafter\expandafter\expandafter
+ \detokenize\expandafter\expandafter\expandafter {\xintNthElt
+ {2}{{agh}\u{{zzz}}\v{Z}}}}}
+%
+\leftedline{|\xintNthElt {37}{\xintFac {100}}|\dtt{=\xintNthElt
+ {37}{\xintFac {100}}} is the thirty-seventh digit of $100!$.}
+%
+\leftedline{|\xintNthElt {10}{\xintFtoCv
+ {566827/208524}}|\dtt{=\xintNthElt {10}{\xintFtoCv
+ {566827/208524}}}}
+\leftedline{is the tenth convergent of $566827/208524$ (uses \xintcfracname
+ package).}
+%
+\leftedline{|\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
+ \dtt{=\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}}
+%
+\leftedline{|\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
+ \dtt{=\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}}
+%
+\leftedline{|\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|%
+ \dtt{=\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}}
+
+If |x=0|,
the macro returns the \emph{length} of the expanded list: this is not equivalent
to \csbxint{Length} which does no pre-expansion. And it is different from
\csbxint{Len} which is to be used only on integers or fractions.
If |x<0|, the macro returns the \verb+|x|+th element from the end of the list.
- \centeredline{|\xintNthElt
- {-5}{{{agh}}\u{zzz}\v{Z}}| is \texttt{\expandafter\expandafter\expandafter
- \detokenize
- \expandafter\expandafter\expandafter{\xintNthElt
- {-5}{{{agh}}\u{zzz}\v{Z}}}}}
-
+%
+\leftedline {|\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}| is
+ \texttt{\expandafter\expandafter\expandafter \detokenize
+ \expandafter\expandafter\expandafter{\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}}}}
-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
+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
@@ -4164,11 +5191,11 @@ brace pairs (either added to a naked token, or initially present), one may use
\csa{xintKeepNoExpand} does the same without first \fexpan ding its list
argument.
-\centeredline {|\oodef\test {\xintKeep {17}{\xintKeep {-69}{\xintSeq
- {1}{100}}}}\meaning\test|}
-\centeredline {\oodef\test {\xintKeep {17}{\xintKeep {-69}{\xintSeq
- {1}{100}}}}\meaning\test}
-
+%
+\begin{everbatim*}
+\oodef\test {\xintKeep {17}{\xintKeep {-69}{\xintSeq {1}{100}}}}\meaning\test
+\end{everbatim*}
+%
\subsection{\csbh{xintTrim}}\label{xintTrim}
@@ -4183,11 +5210,9 @@ up braced in the output (if present there).
\csa{xintTrimNoExpand} does the same without first \fexpan ding its list
argument.
-\centeredline {|\oodef\test {\xintTrim {17}{\xintTrim {-69}{\xintSeq
- {1}{100}}}}\meaning\test|}
-\centeredline {\oodef\test {\xintTrim {17}{\xintTrim {-69}{\xintSeq
- {1}{100}}}}\meaning\test}
-
+\begin{everbatim*}
+\oodef\test {\xintTrim {17}{\xintTrim {-69}{\xintSeq {1}{100}}}}\meaning\test
+\end{everbatim*}
\subsection{\csbh{xintListWithSep}}\label{xintListWithSep}
@@ -4200,13 +5225,14 @@ argument.
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
+\dtt{\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}}}}
+%
+\leftedline{|\xintListWithSep{:}{\xintFac
+ {20}}|\dtt{=\xintListWithSep{:}{\xintFac {20}}}}
The macro \csa{xintListWithSepNoExpand}\etype{nn} does the same
job without the initial expansion.
@@ -4239,9 +5265,13 @@ The \meta{list} may
itself be some macro expanding (in the previously described way) to the list of
tokens to which the command |\macro| will be applied. For example, if the
\meta{list} expands to some positive number, then each digit will be replaced by
-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 result of applying |\macro| on it. %
+%
+\leftedline{|\def\macro #1{\the\numexpr
+ 9-#1\relax}|} %
+%
+\leftedline{|\xintApply\macro{\xintFac
+ {20}}|\dtt{=\xintApply\macro{\xintFac {20}}}}
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|
@@ -4251,24 +5281,25 @@ is applied.
%{\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}\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
+%
+\leftedline{|\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|
-
+\begin{everbatim*}
+\def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}}
+\xintApplyUnbraced\macro{{elta}{eltb}{eltc}}
+\begin{enumerate}[nosep,label=(\arabic{*})]
+\item \meaning\myselfelta
+\item \meaning\myselfeltb
+\item \meaning\myselfeltc
+\end{enumerate}
+\end{everbatim*}
+
%
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
@@ -4287,7 +5318,6 @@ optional argument |d| is omitted it is taken to be the sign of |y-x|
|\xintSeq [1]{1}{N}| if you want an empty sequence for |N| zero or
negative).
-
The current implementation is only for (short) integers; possibly, a future
variant could allow big integers and fractions, although one already has
access to similar
@@ -4296,47 +5326,53 @@ integers. Currently thus, |x| and |y| are expanded inside a
|\numexpr| so they may be count registers or a \LaTeX{} |\value{countername}|,
or arithmetic with such things.
-\centeredline{|\xintListWithSep{,\hskip2pt
- plus 1pt minus 1pt }{\xintSeq {12}{-25}}|}
-\noindent\digitstt{\xintListWithSep{,\hskip2pt plus 1pt minus 1pt }{\xintSeq
- {12}{-25}}}
-\centeredline{|\xintiiSum{\xintSeq [3]{1}{1000}}|\digitstt{=\xintiiSum{\xintSeq [3]{1}{1000}}}}
+%
+\begin{everbatim*}
+\xintListWithSep{,\hskip2pt plus 1pt minus 1pt }{\xintSeq {12}{-25}}
+\end{everbatim*}
+%
+\begin{everbatim*}
+\xintiiSum{\xintSeq [3]{1}{1000}}
+\end{everbatim*}
\textbf{Important:} for reasons of efficiency, this macro, when not given the
optional argument |d|, works backwards, leaving in the token stream the already
constructed integers, from the tail down (or up). But this will provoke a
failure of \IMPORTANT{} the |tex| run if the number of such items exceeds the
-input stack
-limit; on my installation this limit is at @5000@.
+input stack
+limit; on my installation this limit is at $5000$.
-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
+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 |\xintiiSum{\xintSeq [1]{0}{5000}}|
-returns the correct value \digitstt{\xintHalf{\xintiMul{5000}{5001}}}.
+returns the correct value \dtt{\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
+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}
-Let us now construct a completely expandable macro which returns @1@ if its
-given input is prime and @0@ if not:
-\dverb|@
+Let us now construct a completely expandable macro which returns $1$ if its
+given input is prime and $0$ if not:
+\everb|@
\def\remainder #1#2{\the\numexpr #1-(#1/#2)*#2\relax }
\def\IsPrime #1%
- {\xintANDof {\xintApply {\remainder {#1}}{\xintSeq {2}{\xintiSqrt{#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
+This uses \csbxint{iSqrt} and assumes its input is at least $5$. Rather than
+\xintname's own \csbxint{iRem} we used a quicker |\numexpr| expression as we
are dealing with short integers. Also we used \csbxint{ANDof} which will
-return @1@ only if all the items are non-zero. The macro is a bit
+return $1$ only if all the items are non-zero. The macro is a bit
silly with an even input, ok, let's enhance it to detect an even input:
-\dverb|@
+\everb|@
\def\IsPrime #1%
{\xintifOdd {#1}
{\xintANDof % odd case
@@ -4345,54 +5381,63 @@ 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)
in oder for |\IsPrime| to be \fexpan dable.
Our integers are short, but without |\expandafter|'s with
-\makeatletter|\@firstoftwo|\catcode`@ \active, or some other related techniques,
+%\makeatletter|\@firstoftwo|\catcode`@ \active,
+|\@firstoftwo|, % @ n'est plus actif dans le dtx 1.1 !
+or some other related techniques,
direct use of |\ifnum..\fi| tests is dangerous. So to make the macro more
efficient we are going to use the expandable tests provided by the package
-\href{http://ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://ctan.org/pkg/etoolbox}}.
-The macro becomes:
+\href{http://ctan.org/pkg/etoolbox}{etoolbox}%
+%
+\footnote{\url{http://ctan.org/pkg/etoolbox}}.
+%
+The macro becomes:
%
-\dverb|@
+\everb|@
\def\IsPrime #1%
- {\ifnumodd {#1}
+ {\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
+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
-@1@ when supplied an empty list. Let us ease up a bit |\xintANDof|'s work by
-letting it work on only @0@'s and @1@'s. We could use:
+$1$ when supplied an empty list. Let us ease up a bit |\xintANDof|'s work by
+letting it work on only $0$'s and $1$'s. We could use:
%
-\dverb|@
+\everb|@
\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 \fexpan dable and
hence work within the applied \csbxint{ANDof}. Anyhow, now that we have loaded
\href{http://ctan.org/pkg/etoolbox}{etoolbox}, we might as well use:
%
-\dverb|@
+\everb|@
\newcommand{\IsNotDivisibleBy}[2]{\ifnumequal{#1-(#1/#2)*#2}{0}{0}{1}}
-|%
+|
+\noindent
Let us enhance our prime macro to work also on the small primes:
-\dverb|@
+\everb|@
\newcommand{\IsPrime}[1] % returns 1 if #1 is prime, and 0 if not
{\ifnumodd {#1}
{\ifnumless {#1}{8}
{\ifnumequal{#1}{1}{0}{1}}% 3,5,7 are primes
{\xintANDof
- {\xintApply
+ {\xintApply
{ \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}%
}}% END OF THE ODD BRANCH
{\ifnumequal {#1}{2}{1}{0}}% EVEN BRANCH
-}|
+}
+|
The input is still assumed positive. There is a deliberate blank before
\csa{IsNotDivisibleBy} to use this feature of \csbxint{Apply}: a space stops the
@@ -4406,68 +5451,72 @@ which is still expandable and another one (\autoref{ssec:primesIII}) which is a
close variant of the |\IsPrime| code above but with the \csbxint{For} loop, thus
breaking expandability. The \hyperref[ssec:primesII]{xintiloop variant} does not
first evaluate the integer square root, the \hyperref[ssec:primesIII]{xintFor
- variant} still does. I did not compare their efficiencies.
+ variant} still does. I did not compare their efficiencies.
% Hmm, if one really needs to compute primes fast, sure I do applaud using
% \xintname, but, well, there is some slight
% overhead\MyMarginNoteWithBrace{funny private joke} in using \TeX{} for these
-% things (something like a factor @1000@? not tested\dots) compared to accessing
+% things (something like a factor $1000$? not tested\dots) compared to accessing
% to the |CPU| ressources via standard compiled code from a standard programming
% language\dots
Let us construct with this expandable primality test a table of the prime
-numbers up to @1000@. We need to count how many we have in order to know how
-many tab stops one shoud add in the last row.\footnote{although a tabular row
- may have less tabs than in the preamble, there is a problem with the
- \char`\|\space\space
- vertical rule, if one does that.} There is some subtlety for this
+numbers up to $1000$. We need to count how many we have in order to know how
+many tab stops one shoud add in the last row.%
+%
+\footnote{although a tabular row may have less tabs than in the
+ preamble, there is a problem with the \char`\|\space\space vertical
+ rule, if one does that.}
+%
+There is some subtlety for this
last row. Turns out to be better to insert a |\\| only when we know for sure we
are starting a new row; this is how we have designed the |\OneCell| macro. And
for the last row, there are many ways, we use again |\xintApplyUnbraced| but
with a macro which gobbles its argument and replaces it with a tabulation
-character. The \csbxint{For*} macro would be more elegant here.
+character. The \csbxintForstar\ macro would be more elegant here.
%
-\dverb?@
+\everb?@
\newcounter{primecount}
-\newcounter{cellcount}
-\newcommand{\NbOfColumns}{13}
+\newcounter{cellcount}
+\newcommand{\NbOfColumns}{13}
\newcommand{\OneCell}[1]{%
- \ifnumequal{\IsPrime{#1}}{1}
+ \ifnumequal{\IsPrime{#1}}{1}
{\stepcounter{primecount}
\ifnumequal{\value{cellcount}}{\NbOfColumns}
- {\\\setcounter{cellcount}{1}#1}
+ {\\\setcounter{cellcount}{1}#1}
{&\stepcounter{cellcount}#1}%
} % was prime
{}% not a prime, nothing to do
-}
+}
\newcommand{\OneTab}[1]{&}
\begin{tabular}{|*{\NbOfColumns}{r}|}
\hline
2 \setcounter{cellcount}{1}\setcounter{primecount}{1}%
\xintApplyUnbraced \OneCell {\xintSeq [2]{3}{999}}%
- \xintApplyUnbraced \OneTab
+ \xintApplyUnbraced \OneTab
{\xintSeq [1]{1}{\the\numexpr\NbOfColumns-\value{cellcount}\relax}}%
\\
\hline
\end{tabular}
-There are \arabic{primecount} prime numbers up to 1000.?
+There are \arabic{primecount} prime numbers up to 1000.
+?
The table has been put in \hyperref[primesupto1000]{float} which appears
-\vpageref{primesupto1000}.
+\vpageref{primesupto1000}.
We had to be careful to use in the last row \csbxint{Seq} with its optional
argument |[1]| so as to not generate a decreasing sequence from |1| to |0|, but
really an empty sequence in case the row turns out to already have all its
cells (which doesn't happen here but would with a number of columns dividing
-@168@).
+$168$).
%
\newcommand{\IsNotDivisibleBy}[2]{\ifnumequal{#1-(#1/#2)*#2}{0}{0}{1}}
-\newcommand{\IsPrime}[1]
+\newcommand{\IsPrime}[1]
{\ifnumodd {#1}
{\ifnumless {#1}{8}
{\ifnumequal{#1}{1}{0}{1}}% 3,5,7 are primes
{\xintANDof
- {\xintApply
+ {\xintApply
{ \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}%
}}% END OF THE ODD BRANCH
{\ifnumequal {#1}{2}{1}{0}}% EVEN BRANCH
@@ -4493,7 +5542,7 @@ cells (which doesn't happen here but would with a number of columns dividing
\hline
2\setcounter{cellcount}{1}\setcounter{primecount}{1}%
\xintApplyUnbraced \OneCell {\xintSeq [2]{3}{999}}%
- \xintApplyUnbraced \OneTab
+ \xintApplyUnbraced \OneTab
{\xintSeq [1]{1}{\the\numexpr\NbOfColumns-\value{cellcount}\relax}}%
\\
\hline
@@ -4506,7 +5555,7 @@ cells (which doesn't happen here but would with a number of columns dividing
\label{xintloop}
\label{xintbreakloop}
\label{xintbreakloopanddo}
-\label{xintloopskiptonext}
+\label{xintloopskiptonext}
% {\small New with release |1.09g|. Release |1.09h|
% makes them long macros.\par}
@@ -4543,7 +5592,7 @@ will cause the \TeX{} input scanner to insert |\endtemplate| on each encountered
can be resolved via |\xint_firstofone{&}| or use of |\TAB| with |\def\TAB{&}|.
It is thus simpler for alignments to use rather than \csbxint{loop} either the
expandable \csbxint{ApplyUnbraced} or the non-expandable but alignment
-compatible \csbxint{ApplyInline}, \csbxint{For} or \csbxint{For*}.
+compatible \csbxint{ApplyInline}, \csbxint{For} or \csbxintForstar.
As an example, let us suppose we have two macros |\A|\marg{i}\marg{j} and
|\B|\marg{i}\marg{j} behaving like (small) integer valued matrix entries, and we
@@ -4553,55 +5602,18 @@ of rows, |\A[J]| to the number of columns and want the produced |\C| to act in
the same manner. The code is very dispendious in use of |\count| registers, not
optimized in any way, not made very robust (the defined macro can not have the
same name as the first two matrices for example), we just wanted to quickly
-illustrate use of the nesting capabilities of |\xintloop|.\footnote{for a more sophisticated implementation of matrix multiplication, inclusive of determinants, inverses, and display utilities, with entries big integers or decimal numbers or even fractions see \url{http://tex.stackexchange.com/a/143035/4686} from November 11, 2013.}
-\begingroup
-\makeatother
-\newcount\rowmax \newcount\colmax \newcount\summax
-\newcount\rowindex \newcount\colindex \newcount\sumindex
-\newcount\tmpcount
-\makeatletter
-\def\MatrixMultiplication #1#2#3{%
- \rowmax #1[I]\relax
- \colmax #2[J]\relax
- \summax #1[J]\relax
- \rowindex 1
- \xintloop % loop over row index i
- {\colindex 1
- \xintloop % loop over col index k
- {\tmpcount 0
- \sumindex 1
- \xintloop % loop over intermediate index j
- \advance\tmpcount \numexpr #1\rowindex\sumindex*#2\sumindex\colindex\relax
- \ifnum\sumindex<\summax
- \advance\sumindex 1
- \repeat }%
- \expandafter\edef\csname\string#3{\the\rowindex.\the\colindex}\endcsname
- {\the\tmpcount}%
- \ifnum\colindex<\colmax
- \advance\colindex 1
- \repeat }%
- \ifnum\rowindex<\rowmax
- \advance\rowindex 1
- \repeat
- \expandafter\edef\csname\string#3{I}\endcsname{\the\rowmax}%
- \expandafter\edef\csname\string#3{J}\endcsname{\the\colmax}%
- \def #3##1{\ifx[##1\expandafter\Matrix@helper@size
- \else\expandafter\Matrix@helper@entry\fi #3{##1}}%
-}%
-\def\Matrix@helper@size #1#2#3]{\csname\string#1{#3}\endcsname }%
-\def\Matrix@helper@entry #1#2#3%
- {\csname\string#1{\the\numexpr#2.\the\numexpr#3}\endcsname }%
-\def\A #1{\ifx[#1\expandafter\A@size
- \else\expandafter\A@entry\fi {#1}}%
-\def\A@size #1#2]{\ifx I#23\else4\fi}% 3rows, 4columns
-\def\A@entry #1#2{\the\numexpr #1+#2-1\relax}% not pre-computed...
-\def\B #1{\ifx[#1\expandafter\B@size
- \else\expandafter\B@entry\fi {#1}}%
-\def\B@size #1#2]{\ifx I#24\else3\fi}% 4rows, 3columns
-\def\B@entry #1#2{\the\numexpr #1-#2\relax}% not pre-computed...
-\makeatother
-\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D
-\begin{verbatim}
+illustrate use of the nesting capabilities of |\xintloop|.%
+%
+\footnote{for a more sophisticated implementation of matrix
+ multiplication, inclusive of determinants, inverses, and display
+ utilities, with entries big integers or decimal numbers or even
+ fractions see \url{http://tex.stackexchange.com/a/143035/4686} from
+ November 11, 2013.}
+%
+
+%\def\everbhook {\makeatother }
+
+\begin{everbatim*}
\newcount\rowmax \newcount\colmax \newcount\summax
\newcount\rowindex \newcount\colindex \newcount\sumindex
\newcount\tmpcount
@@ -4646,91 +5658,58 @@ illustrate use of the nesting capabilities of |\xintloop|.\footnote{for a more
\def\B@size #1#2]{\ifx I#24\else3\fi}% 4rows, 3columns
\def\B@entry #1#2{\the\numexpr #1-#2\relax}% not pre-computed...
\makeatother
-\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D % etc...
-\end{verbatim}
-\vspace{-2\baselineskip}
-\setlength{\unitlength}{1cm}%
-% le picture de LaTeX est tout de même assez génial!
-\begin{picture}(0,0)
-\put(5,-.5){\vtop{\hsize8cm
-\[\begin{pmatrix}
+\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D
+\MatrixMultiplication\C\D\E \MatrixMultiplication\C\E\F
+\begin{multicols}2
+ \[\begin{pmatrix}
\A11&\A12&\A13&\A14\\
\A21&\A22&\A23&\A24\\
\A31&\A32&\A33&\A34
\end{pmatrix}
-\times
+ \times
\begin{pmatrix}
\B11&\B12&\B13\\
\B21&\B22&\B23\\
\B31&\B32&\B33\\
\B41&\B42&\B43
\end{pmatrix}
-=
-\begin{pmatrix}
+ =
+ \begin{pmatrix}
\C11&\C12&\C13\\
\C21&\C22&\C23\\
\C31&\C32&\C33
-\end{pmatrix}\]
-\[\begin{pmatrix}
+ \end{pmatrix}\]
+ \[\begin{pmatrix}
\C11&\C12&\C13\\
\C21&\C22&\C23\\
\C31&\C32&\C33
-\end{pmatrix}^2 = \begin{pmatrix}
+ \end{pmatrix}^2 = \begin{pmatrix}
\D11&\D12&\D13\\
\D21&\D22&\D23\\
\D31&\D32&\D33
-\end{pmatrix}\]\MatrixMultiplication\C\D\E
-\[\begin{pmatrix}
+ \end{pmatrix}\]
+ \[\begin{pmatrix}
\C11&\C12&\C13\\
\C21&\C22&\C23\\
\C31&\C32&\C33
-\end{pmatrix}^3 = \begin{pmatrix}
+ \end{pmatrix}^3 = \begin{pmatrix}
\E11&\E12&\E13\\
\E21&\E22&\E23\\
\E31&\E32&\E33
-\end{pmatrix}\]\MatrixMultiplication\C\E\F
-\[\begin{pmatrix}
+ \end{pmatrix}\]
+ \[\begin{pmatrix}
\C11&\C12&\C13\\
\C21&\C22&\C23\\
\C31&\C32&\C33
-\end{pmatrix}^4 = \begin{pmatrix}
+ \end{pmatrix}^4 = \begin{pmatrix}
\F11&\F12&\F13\\
\F21&\F22&\F23\\
\F31&\F32&\F33
-\end{pmatrix}\]}}
-\end{picture}
-\begin{verbatim}
-\[\begin{pmatrix}
- \A11&\A12&\A13&\A14\\
- \A21&\A22&\A23&\A24\\
- \A31&\A32&\A33&\A34
- \end{pmatrix}
-\times
- \begin{pmatrix}
- \B11&\B12&\B13\\
- \B21&\B22&\B23\\
- \B31&\B32&\B33\\
- \B41&\B42&\B43
- \end{pmatrix}
-=
-\begin{pmatrix}
- \C11&\C12&\C13\\
- \C21&\C22&\C23\\
- \C31&\C32&\C33
-\end{pmatrix}\]
-\[\begin{pmatrix}
- \C11&\C12&\C13\\
- \C21&\C22&\C23\\
- \C31&\C32&\C33
-\end{pmatrix}^2 = \begin{pmatrix}
- \D11&\D12&\D13\\
- \D21&\D22&\D23\\
- \D31&\D32&\D33
-\end{pmatrix}\]
-\end{verbatim}
-\endgroup
+ \end{pmatrix}\]
+\end{multicols}
+\end{everbatim*}
-% \kern-2\baselineskip
+% \restoreeverbhook
\subsection{\csbh{xintiloop}, \csbh{xintiloopindex}, \csbh{xintouteriloopindex},
\csbh{xintbreakiloop}, \csbh{xintbreakiloopanddo}, \csbh{xintiloopskiptonext},
@@ -4766,7 +5745,6 @@ loop. In case of nesting, \csbxint{outeriloopindex} gives access to the index of
the outer loop. If needed one could write on its model a macro giving access to
the index of the outer outer loop (or even to the |nth| outer loop).
-
The \csa{xintiloopindex} and \csa{xintouteriloopindex} can not be used inside
braces, and generally speaking this means they should be expanded first when
given as argument to a macro, and that this macro receives them as delimited
@@ -4787,25 +5765,27 @@ The syntax of |\xintbreakiloopanddo| is a bit surprising, the sequence of tokens
to be executed after breaking the loop is not within braces but is delimited by
a dot as in:
%
-\centeredline{|\xintbreakiloopanddo <afterloop>.etc.. etc... \repeat|}
+\leftedline{|\xintbreakiloopanddo <afterloop>.etc.. etc... \repeat|}
%
The reason is that one may wish to use the then current value of
|\xintiloopindex| in |<afterloop>| but it can't be within braces at the time it
is evaluated. However, it is not that easy as |\xintiloopindex| must be expanded
before, so one ends up with code like this:
%
-\centeredline
+\leftedline
{|\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.%|}
-\centeredline{|etc.. etc.. \repeat|}
+%
+\leftedline{|etc.. etc.. \repeat|}
%
As moreover the |\fi| from the test leading to the decision of breaking out of
the loop must be cleared out of the way, the above should be
a branch of an expandable conditional test, else one needs something such
as:
-\centeredline
+%
+\leftedline
{|\xint_afterfi{\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.}%|}
-\centeredline{|\fi etc..etc.. \repeat|}
-
+%
+\leftedline{|\fi etc..etc.. \repeat|}
There is \csbxint{iloopskiptonext} to abort the current iteration and skip to
the next, \hyperref[xintiloopskipandredo]{\ttfamily\hyphenchar\font45 \char92
@@ -4822,22 +5802,8 @@ expanding to it or replace it by a suitable |\firstofone{&}|, and similarly for
\phantomsection\label{edefprimes}
As an example, let us construct an |\edef\z{...}| which will define |\z| to be a
list of prime numbers:
-\dverb|@
-\edef\z
-{\xintiloop [10001+2]
- {\xintiloop [3+2]
- \ifnum\xintouteriloopindex<\numexpr\xintiloopindex*\xintiloopindex\relax
- \xintouteriloopindex,
- \expandafter\xintbreakiloop
- \fi
- \ifnum\xintouteriloopindex=\numexpr
- (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax
- \else
- \repeat
- }% no space here
- \ifnum \xintiloopindex < 10999 \repeat }%
-\meaning\z|
-\begingroup%\ttfamily
+\begin{everbatim*}
+\begingroup
\edef\z
{\xintiloop [10001+2]
{\xintiloop [3+2]
@@ -4851,17 +5817,19 @@ list of prime numbers:
\repeat
}% no space here
\ifnum \xintiloopindex < 10999 \repeat }%
-\meaning\z and we should have taken some steps to not have a trailing comma, but
+\meaning\z\endgroup
+\end{everbatim*}and we should have taken
+some steps to not have a trailing comma, but
the point was to show that one can do that in an |\edef|\,! See also
\autoref{ssec:primesII} which extracts from this code its way of testing
-primality.
-\endgroup
-
+primality.
Let us create an alignment where each row will contain all divisors of its
-first entry.
-\dverb|@
-\tabskip1ex
+first entry.
+Here is the output, thus obtained without any count register:
+\begin{everbatim*}
+\begin{multicols}2
+\tabskip1ex \normalcolor
\halign{&\hfil#\hfil\cr
\xintiloop [1+1]
{\expandafter\bfseries\xintiloopindex &
@@ -4869,48 +5837,32 @@ first entry.
\ifnum\xintouteriloopindex=\numexpr
(\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax
\xintiloopindex&\fi
- \ifnum\xintiloopindex<\xintouteriloopindex\space % \space is CRUCIAL
+ \ifnum\xintiloopindex<\xintouteriloopindex\space % CRUCIAL \space HERE
\repeat \cr }%
\ifnum\xintiloopindex<30
- \repeat }|
-
-%
-\noindent We wanted this first entry in bold face, but |\bfseries| leads to
+ \repeat
+}
+\end{multicols}
+\end{everbatim*}
+We wanted this first entry in bold face, but |\bfseries| leads to
unexpandable tokens, so the |\expandafter| was necessary for |\xintiloopindex|
and |\xintouteriloopindex| not to be confronted with a hard to digest
-|\endtemplate|. An alternative way of coding is:
+|\endtemplate|. An alternative way of coding:
%
-\dverb|@ \tabskip1ex
+\begin{everbatim}
+\tabskip1ex
\def\firstofone #1{#1}%
-\halign{&\hfil#\hfil\cr
- \xintiloop [1+1]
+\halign{&\hfil#\hfil\cr
+ \xintiloop [1+1]
{\bfseries\xintiloopindex\firstofone{&}%
\xintiloop [1+1] \ifnum\xintouteriloopindex=\numexpr
(\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax
\xintiloopindex\firstofone{&}\fi
\ifnum\xintiloopindex<\xintouteriloopindex\space % \space is CRUCIAL
\repeat \firstofone{\cr}}%
- \ifnum\xintiloopindex<30 \repeat }|
+ \ifnum\xintiloopindex<30 \repeat }
+\end{everbatim}
-\noindent
-Here is the output, thus obtained without any count register:
-\begingroup\catcode`_ 11
-\begin{multicols}2
-\tabskip1ex
-\halign{&\hfil#\hfil\cr
- \xintiloop [1+1]
- {\expandafter\bfseries\xintiloopindex &
- \xintiloop [1+1]
- \ifnum\xintouteriloopindex=\numexpr
- (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax
- \xintiloopindex&\fi
- \ifnum\xintiloopindex<\xintouteriloopindex\space % CRUCIAL \space HERE
- \repeat \cr }%
- \ifnum\xintiloopindex<30
- \repeat
-}
-\end{multicols}
-\endgroup
\subsection{Another completely expandable prime test}\label{ssec:primesII}
@@ -4925,12 +5877,15 @@ to illustrate use of the general purpose \csbxint{iloop}. A little table giving
the first values of |\SmallestFactor| follows, its coding uses \csbxint{For},
which is described later; none of this uses count registers.
%
-\dverb?@
+%\tracingmacros1
+
+\begin{everbatim*}
+\let\IsPrime\undefined \let\SmallestFactor\undefined % clean up possible previous mess
\newcommand{\IsPrime}[1] % returns 1 if #1 is prime, and 0 if not
{\ifnumodd {#1}
{\ifnumless {#1}{8}
{\ifnumequal{#1}{1}{0}{1}}% 3,5,7 are primes
- {\if
+ {\if
\xintiloop [3+2]
\ifnum#1<\numexpr\xintiloopindex*\xintiloopindex\relax
\expandafter\xintbreakiloopanddo\expandafter1\expandafter.%
@@ -4954,37 +5909,7 @@ which is described later; none of this uses count registers.
\ifnum#1=\numexpr (#1/\xintiloopindex)*\xintiloopindex\relax
\xint_afterfi{\expandafter\xintbreakiloopanddo\xintiloopindex.}%
\fi
- \iftrue\repeat
- }%
- }% END OF THE ODD BRANCH
- {2}% EVEN BRANCH
-}%
-\catcode`_ 8
- \begin{tabular}{|c|*{10}c|}
- \hline
- \xintFor #1 in {0,1,2,3,4,5,6,7,8,9}\do {&\bfseries #1}\\
- \hline
- \bfseries 0&--&--&2&3&2&5&2&7&2&3\\
- \xintFor #1 in {1,2,3,4,5,6,7,8,9}\do
- {\bfseries #1%
- \xintFor #2 in {0,1,2,3,4,5,6,7,8,9}\do
- {&\SmallestFactor{#1#2}}\\}%
- \hline
- \end{tabular}
-?
-\catcode`_ 11
-\newcommand{\SmallestFactor}[1] % returns the smallest prime factor of #1>1
- {\ifnumodd {#1}
- {\ifnumless {#1}{8}
- {#1}% 3,5,7 are primes
- {\xintiloop [3+2]
- \ifnum#1<\numexpr\xintiloopindex*\xintiloopindex\relax
- \xint_afterfi{\xintbreakiloopanddo#1.}%
- \fi
- \ifnum#1=\numexpr (#1/\xintiloopindex)*\xintiloopindex\relax
- \xint_afterfi{\expandafter\xintbreakiloopanddo\xintiloopindex.}%
- \fi
- \iftrue\repeat
+ \iftrue\repeat
}%
}% END OF THE ODD BRANCH
{2}% EVEN BRANCH
@@ -5001,7 +5926,9 @@ which is described later; none of this uses count registers.
\xintFor #2 in {0,1,2,3,4,5,6,7,8,9}\do
{&\SmallestFactor{#1#2}}\\}%
\hline
- \end{tabular}\par }
+ \end{tabular}\par
+}
+\end{everbatim*}
\subsection{A table of factorizations}
\label{ssec:factorizationtable}
@@ -5019,74 +5946,25 @@ To spare some fractions of a second in the compilation time of this document
|factorize| but just typeset directly; this illustrates use of
\csbxint{iloopskiptonext}.
-\begingroup
-\def\MacroFont{\ttfamily\baselineskip12pt\relax \catcode`\" 12 }
-\dverb|@
-\tabskip1ex
-\halign {\hfil\strut#\hfil&&\hfil#\hfil\cr\noalign{\hrule}
- \xintiloop ["7FFFFFE0+1]
- \expandafter\bfseries\xintiloopindex &
- \ifnum\xintiloopindex="7FFFFFED
- \number"7FFFFFED\cr\noalign{\hrule}
- \expandafter\xintiloopskiptonext
- \fi
- \expandafter\factorize\xintiloopindex.\cr\noalign{\hrule}
- \ifnum\xintiloopindex<"7FFFFFFE
- \repeat
- \bfseries \number"7FFFFFFF&\number "7FFFFFFF\cr\noalign{\hrule}
-}|\par\smallskip
-\endgroup
-
-The \hyperref[floatfactorize]{table} has been made into a float which appears
-\vpageref{floatfactorize}. Here is now the code for factorization; the
-conditionals use
-the package provided |\xint_firstoftwo| and |\xint_secondoftwo|, one could have
-employed rather \LaTeX{}'s own \texttt{\char92\string@firstoftwo} and
-\texttt{\char92\string@secondoftwo}, or, simpler still in \LaTeX{} context, the
-|\ifnumequal|, |\ifnumless| \dots, utilities from the package |etoolbox| which
-do exactly that under the hood. Only \TeX{} acceptable numbers are treated here,
-but it would be easy to make a translation and use the \xintname macros, thus
-extending the scope to big numbers; naturally up to a cost in speed.
+The code next generates a \hyperref[floatfactorize]{table} which has
+been made into a float appearing \vpageref{floatfactorize}. Here is now
+the code for factorization; the conditionals use the package provided
+|\xint_firstoftwo| and |\xint_secondoftwo|, one could have employed
+rather \LaTeX{}'s own |\@firstoftwo| and |\@secondoftwo|, or, simpler
+still in \LaTeX{} context, the |\ifnumequal|, |\ifnumless| \dots,
+utilities from the package |etoolbox| which do exactly that under the
+hood. Only \TeX{} acceptable numbers are treated here, but it would be
+easy to make a translation and use the \xintname macros, thus extending
+the scope to big numbers; naturally up to a cost in speed.
The reason for some strange looking expressions is to avoid arithmetic overflow.
-\begingroup
-\def\MacroFont{\ttfamily\baselineskip12pt\relax \catcode`\" 12 }
-\dverb|@
+\begin{everbatim*}
\catcode`_ 11
\def\abortfactorize #1\xint_secondoftwo\fi #2#3{\fi}
\def\factorize #1.{\ifnum#1=1 \abortfactorize\fi
- % avoid overflow if #1="7FFFFFFF
- \ifnum\numexpr #1-2=\numexpr ((#1/2)-1)*2\relax
- \expandafter\xint_firstoftwo
- \else\expandafter\xint_secondoftwo
- \fi
- {2&\expandafter\factorize\the\numexpr#1/2.}%
- {\factorize_b #1.3.}}%
-
-\def\factorize_b #1.#2.{\ifnum#1=1 \abortfactorize\fi
- % this will avoid overflow which could result from #2*#2
- \ifnum\numexpr #1-(#2-1)*#2<#2
- #1\abortfactorize % this #1 is prime
- \fi
- % again, avoiding overflow as \numexpr integer division
- % rounds rather than truncates.
- \ifnum \numexpr #1-#2=\numexpr ((#1/#2)-1)*#2\relax
- \expandafter\xint_firstoftwo
- \else\expandafter\xint_secondoftwo
- \fi
- {#2&\expandafter\factorize_b\the\numexpr#1/#2.#2.}%
- {\expandafter\factorize_b\the\numexpr #1\expandafter.%
- \the\numexpr #2+2.}}%
-\catcode`_ 8|
-\endgroup
-
-\catcode`_ 11
-\def\abortfactorize #1\xint_secondoftwo\fi #2#3{\fi}
-
-\def\factorize #1.{\ifnum#1=1 \abortfactorize\fi
- \ifnum\numexpr #1-2=\numexpr ((#1/2)-1)*2\relax
+ \ifnum\numexpr #1-2=\numexpr ((#1/2)-1)*2\relax
\expandafter\xint_firstoftwo
\else\expandafter\xint_secondoftwo
\fi
@@ -5106,12 +5984,12 @@ The reason for some strange looking expressions is to avoid arithmetic overflow.
\the\numexpr #2+2.}}%
\catcode`_ 8
\begin{figure*}[ht!]
-\centering\phantomsection\label{floatfactorize}
+\centering\phantomsection\label{floatfactorize}\normalcolor
\tabskip1ex
\centeredline{\vbox{\halign {\hfil\strut#\hfil&&\hfil#\hfil\cr\noalign{\hrule}
\xintiloop ["7FFFFFE0+1]
\expandafter\bfseries\xintiloopindex &
- \ifnum\xintiloopindex="7FFFFFED
+ \ifnum\xintiloopindex="7FFFFFED
\number"7FFFFFED\cr\noalign{\hrule}
\expandafter\xintiloopskiptonext
\fi
@@ -5122,10 +6000,10 @@ The reason for some strange looking expressions is to avoid arithmetic overflow.
}}}
\centeredline{A table of factorizations}
\end{figure*}
-
+\end{everbatim*}
\begin{framed}
- The next utilities are not compatible with expansion-only context.
+ The next utilities are not compatible with expansion-only context.
\end{framed}
\subsection{\csbh{xintApplyInline}}\label{xintApplyInline}
@@ -5144,20 +6022,16 @@ 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
macro definition, to prepare material for later execution, contrarily to what
-\csbxint{Apply} or \csbxint{ApplyUnbraced} achieve.
+\csbxint{Apply} or \csbxint{ApplyUnbraced} achieve.
-\dverb|@
-\def\Macro #1{\advance\cnta #1 , \the\cnta}
-\cnta 0
-0\xintApplyInline\Macro {3141592653}.|
+\begin{everbatim*}
\def\Macro #1{\advance\cnta #1 , \the\cnta}
\cnta 0
-Output: 0\xintApplyInline\Macro {3141592653}.
-
-
+0\xintApplyInline\Macro {3141592653}.
+\end{everbatim*}
The first argument |\macro| does not have to be an expandable macro.
-\csa{xintApplyInline} submits its second, token list parameter to an
+\csa{xintApplyInline} submits its second, token list parameter to an
\hyperref[sec:expansions]{\fexpan
sion}. Then, each \emph{unbraced} item will also be \fexpan ded. This provides
an easy way to insert one list inside another. \emph{Braced} items are not
@@ -5167,23 +6041,14 @@ or the end of the list), but not the spaces \emph{inside} the braced items.
\csa{xintApplyInline}, despite being non-expandable, does survive to
contexts where the executed |\macro| closes groups, as happens inside
alignments with the tabulation character |&|.
-This tabular for example:\par
-\smallskip
-\centeredline
- {\begin{tabular}{ccc}
- $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}}
-\smallskip
-% 38 = &, 43 = +, 36=$, 45 = -
-was obtained from the following input:
-\dverb|@
-\begin{tabular}{ccc}
+This tabular provides an example:\par
+\begin{everbatim*}
+\centerline{\normalcolor\begin{tabular}{ccc}
$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}}\medskip
+\end{everbatim*}
We see that despite the fact that the first encountered tabulation character in
the first row close a group and thus erases |\Row| from \TeX's memory,
@@ -5198,15 +6063,9 @@ keeping on hold and shuffling around hundreds of tokens has an impact on
\TeX{}'s speed (make this ``thousands of tokens'' for the impact to be
noticeable).
-One may nest various |\xintApplyInline|'s. For example (see the
+One may nest various |\xintApplyInline|'s. For example (see the
\hyperref[float]{table} \vpageref{float}):\par
-\dverb|@
-\def\Row #1{#1:\xintApplyInline {\Item {#1}}{0123456789}\\ }%
-\def\Item #1#2{&\xintiPow {#1}{#2}}%
-\begin{tabular}{ccccccccccc}
- &0&1&2&3&4&5&6&7&8&9\\ \hline
- \xintApplyInline \Row {0123456789}
-\end{tabular}|
+\begin{everbatim*}
\begin{figure*}[ht!]
\centering\phantomsection\label{float}
\def\Row #1{#1:\xintApplyInline {\Item {#1}}{0123456789}\\ }%
@@ -5215,48 +6074,50 @@ One may nest various |\xintApplyInline|'s. For example (see the
\xintApplyInline \Row {0123456789}
\end{tabular}}
\end{figure*}
-
+\end{everbatim*}
One could not move the definition of |\Item| inside the tabular,
as it would get lost after the first |&|. But this
-works:
-\dverb|@
+works:
+\everb|@
\begin{tabular}{ccccccccccc}
&0&1&2&3&4&5&6&7&8&9\\ \hline
\def\Row #1{#1:\xintApplyInline {&\xintiPow {#1}}{0123456789}\\ }%
\xintApplyInline \Row {0123456789}
-\end{tabular}|
+\end{tabular}
+|
A limitation is that, contrarily to what one may have expected, the
|\macro| for an |\xintApplyInline| can not be used to define
the |\macro| for a nested sub-|\xintApplyInline|. For example,
this does not work:\par
-\dverb|@
+\everb|@
\def\Row #1{#1:\def\Item ##1{&\xintiPow {#1}{##1}}%
\xintApplyInline \Item {0123456789}\\ }%
\xintApplyInline \Row {0123456789} % does not work
-|%
-But see \csbxint{For}.
+|
+\noindent But see \csbxint{For}.
-\subsection{\csbh{xintFor}, \csbh{xintFor*}}\label{xintFor}\label{xintFor*}
+\subsection{\csbh{xintFor}, \csbhxintForstar}\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}
+% 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:
+nested loops. Here is an example:
%
-\dverb|@
+\everb|@
\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=\xintiiPrd{{#1}{#2}{#3}{#9}}$$}}}}
-|%
-This example illustrates that one does not have to use |#1| as the first one:
+ $$#9\times#1\times#3\times#2=\xintiiPrd{{#1}{#2}{#3}{#9}}$$}}}}
+|
+\noindent 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. |\par| tokens are accepted in both the comma
@@ -5269,7 +6130,7 @@ separated list and the replacement text.
the character |#| as is the general rule in \TeX{} with definitions done
inside macros.
- The macros \csa{xintFor} and \csa{xintFor*} are not expandable, one can not
+ The macros \csa{xintFor} and \csaxintForstar\ are not expandable, one can not
use them inside an |\edef|. But they may be used inside alignments (such as a
\LaTeX{} |tabular|), as will be shown in examples.
\end{framed}
@@ -5285,7 +6146,7 @@ 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*}\ntype{{\lowast f}n} deals with lists of braced
+A starred variant \csbxintForstar\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.
@@ -5313,7 +6174,7 @@ which encapsulate the item in a macro expanding to that item.
\end{framed}
\begin{framed}
- The starred variant \csbxint{For*} deals with token lists (\emph{spaces
+ The starred variant \csbxintForstar\ deals with token lists (\emph{spaces
between braced items or single tokens are not significant}) and
\hyperref[sec:expansions]{\fexpan ds} each \emph{unbraced} list item. This
makes it easy to simulate concatenation of various list macros |\x|, |\y|, ...
@@ -5344,23 +6205,26 @@ which encapsulate the item in a macro expanding to that item.
\addtocounter{Hfootnote}{1}
The macro \csbxint{Seq} which generates arithmetic sequences may only be used
-with \csbxint{For*} (numbers from output of |\xintSeq| are braced, not separated
-by commas). \centeredline{|\xintFor* #1 in {\xintSeq [+2]{-7}{+2}}\do {stuff
+with \csbxintForstar\ (numbers from output of |\xintSeq| are braced, not separated
+by commas). %
+%
+\leftedline{|\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
should thus be postfixed with |\relax| or |\space|.
-When nesting \csa{xintFor*} loops, using \csa{xintSeq} in the inner loops is
+When nesting \csaxintForstar\ loops, using \csa{xintSeq} in the inner loops is
inefficient, as the arithmetic sequence will be re-created each time. A more
efficient style is:
%
-\dverb|@
+\begin{everbatim}
\edef\innersequence {\xintSeq[+2]{-50}{50}}%
- \xintFor* #1 in {\xintSeq {13}{27}} \do
+ \xintFor* #1 in {\xintSeq {13}{27}} \do
{\xintFor* #2 in \innersequence \do {stuff with #1 and #2}%
- .. some other macros .. }|
+ .. some other macros .. }
+\end{everbatim}
This is a general remark applying for any nesting of loops, one should avoid
recreating the inner lists of arguments at each iteration of the outer loop.
@@ -5372,45 +6236,38 @@ exists when dealing with arithmetic sequences: it is to use the
arithmetic sequences; the loops will then be terminated via a test |#1|
(or |#2| etc\dots) and subsequent use of \csbxint{BreakFor}.
-
-
The \csbxint{For} loops are not completely expandable; but they may be nested
and used inside alignments or other contexts where the replacement text closes
groups. Here is an example (still using \LaTeX's tabular):
-\begingroup
-\centeredline{\begin{tabular}{rccccc}
- \xintFor #7 in {A,B,C} \do {%
- #7:\xintFor* #3 in {abcde} \do {&($ #3 \to #7 $)}\\ }%
-\end{tabular}}
-\endgroup
-
-\dverb|@
+\begin{everbatim*}
\begin{tabular}{rccccc}
\xintFor #7 in {A,B,C} \do {%
#7:\xintFor* #3 in {abcde} \do {&($ #3 \to #7 $)}\\ }%
-\end{tabular}|
+\end{tabular}
+\end{everbatim*}
When
inserted inside a macro for later execution the |#| characters must be
-doubled.\footnote{sometimes what seems to be a macro argument isn't really; in
- \csa{raisebox\{1cm\}\{}\csa{xintFor \#1 in \{a,b,c\} }\csa{do \{\#1\}\}} no
- doubling should be done.} For example:
+doubled.%
+%
+\footnote{sometimes what seems to be a macro argument isn't really; in
+ \csa{raisebox\{1cm\}\{}\csa{xintFor \#1 in \{a,b,c\} }\csa{do
+ \{\#1\}\}} no doubling should be done.}
+%
+For example:
%
-\dverb|@
+\begin{everbatim*}
\def\T{\def\z {}%
\xintFor* ##1 in {{u}{v}{w}} \do {%
\xintFor ##2 in {x,y,z} \do {%
\expandafter\def\expandafter\z\expandafter {\z\sep (##1,##2)} }%
}%
}%
-\T\def\sep {\def\sep{, }}\z |%
-\def\T{\def\z {}%
- \xintFor* ##1 in {{u}{v}{w}} \do {%
- \xintFor ##2 in {x,y,z} \do {%
- \expandafter\def\expandafter\z\expandafter {\z\sep (##1,##2)} }%
- }}%
-\centeredline{\T\def\sep {\def\sep{, }}\z} Similarly when the replacement text
+\T\def\sep {\def\sep{, }}\z
+\end{everbatim*}
+
+Similarly when the replacement text
of |\xintFor| defines a macro with parameters, the macro character |#| must be
doubled.
@@ -5422,77 +6279,103 @@ doubled, as is the general rule in \TeX{} with things defined inside other
things).
The iterated commands as well as the list items are allowed to contain explicit
-|\par| tokens. Neither \csbxint{For} nor \csbxint{For*} create groups. The
+|\par| tokens. Neither \csbxint{For} nor \csbxintForstar\ create groups. The
effect is like piling up the iterated commands with each time |#1| (or |#2| ...)
replaced by an item of the list. However, contrarily to the completely
expandable \csbxint{ApplyUnbraced}, but similarly to the non completely
expandable \csbxint{ApplyInline} each iteration is executed first before looking
-at the next |#1|\footnote{to be completely honest, both \csbxint{For} and
- \csbxint{For*} intially scoop up both the list and the iterated commands;
- \csbxint{For} scoops up a second time the entire comma separated list in order
- to feed it to \csbxint{CSVtoList}. The starred variant \csbxint{For*} which
- does not need this step will thus be a bit faster on equivalent inputs.} (and
-the starred variant \csbxint{For*} keeps on expanding each unbraced item it
+at the next |#1|%
+%
+\footnote{to be completely honest, both \csbxint{For} and
+ \csbxintForstar\ intially scoop up both the list and the iterated
+ commands; \csbxint{For} scoops up a second time the entire comma
+ separated list in order to feed it to \csbxint{CSVtoList}. The starred
+ variant \csbxintForstar\ which does not need this step will thus be a
+ bit faster on equivalent inputs.}
+%
+(and
+the starred variant \csbxintForstar\ keeps on expanding each unbraced item it
finds, gobbling spaces).
\subsection{\csbh{xintifForFirst}, \csbh{xintifForLast}}
\label{xintifForFirst}\label{xintifForLast}
% {\small New in |1.09e|.\par}
-
\csbxint{ifForFirst}\,\texttt{\{YES branch\}\{NO branch\}}\etype{nn}
and \csbxint{ifForLast}\,\texttt{\{YES
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.
+|NO| branch
+if the
+\csbxint{For}
+or \csbxintForstar\ loop is currently in its first, respectively last, iteration.
Designed to work as expected under nesting. Don't forget an empty brace pair
|{}| if a branch is to do nothing. May be used multiple times in the replacement
-text of the loop.
+text of the loop.
There is no such thing as an iteration counter provided by the \csa{xintFor}
loops; the user is invited to define if needed his own count register or
\LaTeX{} counter, for example with a suitable |\stepcounter| inside the
replacement text of the loop to update it.
+\begin{framed}
+ It is a known feature of these conditionals that they cease to function if
+ put at a location of the |\xintFor| replacement text which has closed a
+ group, for example in the last cell of an alignment created by the loop,
+ assuming the replacement text of the |\xintFor| loop creates a row. The
+ conditional must be used before the first cell is closed. This is not likely
+ to change in future versions. It is not an intrinsic limitation as the
+ branches of the conditional can be the complete rows, inclusive of all |&|'s
+ and the tabular newline |\\|.
+\end{framed}
+
\subsection{ \csbh{xintBreakFor}, \csbh{xintBreakForAndDo}}
\label{xintBreakFor}\label{xintBreakForAndDo}
%{\small New in |1.09e|.\par}
-One may immediately terminate an \csbxint{For} or \csbxint{For*} loop with
+One may immediately terminate an \csbxint{For} or \csbxintForstar\ loop with
\csbxint{BreakFor}. As the criterion for breaking will be decided on a
basis of some test, it is recommended to use for this test the syntax of
-\href{http://ctan.org/pkg/ifthen}{ifthen}\footnote{\url{http://ctan.org/pkg/ifthen}}
+\href{http://ctan.org/pkg/ifthen}{ifthen}%
+%
+\footnote{\url{http://ctan.org/pkg/ifthen}}
+%
or
-\href{http://ctan.org/pkg/etoolbox}{etoolbox}\footnote{\url{http://ctan.org/pkg/etoolbox}}
+\href{http://ctan.org/pkg/etoolbox}{etoolbox}%
+%
+\footnote{\url{http://ctan.org/pkg/etoolbox}}
+%
or the \xintname own conditionals, rather than one of the various
|\if...\fi| of \TeX{}. Else (and this is without even mentioning all the various
-pecularities of the
+pecularities of the
|\if...\fi| constructs), one has to carefully move the break after the closing
-of
-the conditional, typically with |\expandafter\xintBreakFor\fi|.\footnote{the
- difficulties here are similar to those mentioned in \autoref{sec:ifcase},
- although less severe, as complete expandability is not to be maintained; hence
- the allowed use of \href{http://ctan.org/pkg/ifthen}{ifthen}.}
+of
+the conditional, typically with |\expandafter\xintBreakFor\fi|.%
+%
+\footnote{the difficulties here are similar to those mentioned in
+ \autoref{sec:ifcase}, although less severe, as complete expandability
+ is not to be maintained; hence the allowed use of
+ \href{http://ctan.org/pkg/ifthen}{ifthen}.}
There is also \csbxint{BreakForAndDo}. Both are illustrated by various examples
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}
-If the list argument to \csbxint{For} (or \csbxint{For*}, both are equivalent in
+If the list argument to \csbxint{For} (or \csbxintForstar, both are equivalent in
this context) is \csbxint{integers} (equivalently \csbxint{egers}) or more
generally \csbxint{integers}|[||start|\allowbreak|+|\allowbreak|delta||]|
-(\emph{the whole within braces}!)\footnote{the |start+delta| optional
- specification may have extra spaces around the plus sign of near the square
- brackets, such spaces are removed. The same applies with \csa{xintdimensions}
- and \csa{xintrationals}.}, then \csbxint{For} does an infinite iteration where
+(\emph{the whole within braces}!)%
+%
+\footnote{the |start+delta| optional specification may have extra spaces
+ around the plus sign of near the square brackets, such spaces are
+ removed. The same applies with \csa{xintdimensions} and
+ \csa{xintrationals}.},
+%
+then \csbxint{For} does an infinite iteration where
|#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
@@ -5518,24 +6401,22 @@ used anywhere \TeX{} expects a dimension (and there is no need in conditionals
to insert a |\relax|, and one should \emph{not} do it), and to print its value
one uses \fbox{\csa{the\#1}}. The chosen representation guarantees exact
incrementation with no rounding errors accumulating from converting into
-points at each step.
-
+points at each step.
% original definitions, a bit slow.
-
-% \def\DimToNum #1{\number\dimexpr #1\relax }
-% % cube
-% \xintNewNumExpr \FA [2] {{_DimToNum {$2}}^3/{_DimToNum {$1}}^2} %$
-% % square root
-% \xintNewNumExpr \FB [2] {sqrt ({_DimToNum {$2}}*{_DimToNum {$1}})}
-% \xintNewExpr \Ratio [2] {trunc({_DimToNum {$2}}/{_DimToNum{$1}},3)}
+%\def\DimToNum #1{\number\dimexpr #1\relax }
+% cube
+%\xintNewIExpr \FA [2] {protect(\DimToNum {#2})^3/protect(\DimToNum{#1})^2}
+% square root
+%\xintNewIExpr \FB [2] {sqrt (protect(\DimToNum {#2})*protect(\DimToNum {#1}))}
+%\xintNewExpr \Ratio [2] {trunc(protect(\DimToNum {#2})/protect(\DimToNum{#1}),3)}
% improved faster code (4 four times faster)
\def\DimToNum #1{\the\numexpr \dimexpr#1\relax/10000\relax }
-\def\FA #1#2{\xintDSH{-4}{\xintQuo {\xintiPow {\DimToNum {#2}}{3}}{\xintiSqr
+\def\FA #1#2{\xintDSH{-4}{\xintiQuo {\xintiPow {\DimToNum {#2}}{3}}{\xintiSqr
{\DimToNum{#1}}}}}
-\def\FB #1#2{\xintDSH {-4}{\xintiSqrt
+\def\FB #1#2{\xintDSH {-4}{\xintiSqrt
{\xintiMul {\DimToNum {#2}}{\DimToNum{#1}}}}}
\def\Ratio #1#2{\xintTrunc {2}{\DimToNum {#2}/\DimToNum{#1}}}
@@ -5549,36 +6430,36 @@ points at each step.
\vrule width .25pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp }%
}% end of For iterated text
}%
-\hspace{1cm}%
-\scriptsize\def\MacroFont {\ttfamily\baselineskip8pt\relax}
-\begin{minipage}{\dimexpr\linewidth-3cm-\parindent\relax}
-\dverb|@
+\hspace{.5cm}%
+\scriptsize\baselineskip8pt\relax
+\begin{minipage}{\dimexpr\linewidth-2.5cm-\parindent\relax}\def\everbatimindent{0pt }%
+\begin{everbatim}
\def\DimToNum #1{\number\dimexpr #1\relax }
-\xintNewNumExpr \FA [2] {{_DimToNum {$2}}^3/{_DimToNum {$1}}^2} % cube
-\xintNewNumExpr \FB [2] {sqrt ({_DimToNum {$2}}*{_DimToNum {$1}})} % sqrt
-\xintNewExpr \Ratio [2] {trunc({_DimToNum {$2}}/{_DimToNum{$1}},3)}
+\xintNewIExpr \FA [2] {protect(\DimToNum {#2})^3/protect(\DimToNum{#1})^2} %cube
+\xintNewIExpr \FB [2] {sqrt (protect(\DimToNum {#2})*protect(\DimToNum {#1}))} %sqrt
+\xintNewExpr \Ratio [2] {trunc(protect(\DimToNum {#2})/protect(\DimToNum{#1}),3)}
\xintFor #1 in {\xintdimensions [0pt+.1pt]} \do
{\ifdim #1>2cm \expandafter\xintBreakFor\fi
{\color [rgb]{\Ratio {2cm}{#1},0,0}%
\vrule width .1pt height \FB {2cm}{#1}sp depth -\FA {2cm}{#1}sp }%
}% end of For iterated text
-|\par
+\end{everbatim}
\end{minipage}}
\end{figure*}
-% attention, pour le \meaning dans cette note de base de page
-
-The\xintNewNumExpr \FA [2] {{_DimToNum {$2}}^3/{_DimToNum {$1}}^2} %$
-\hyperlink{graphic}{graphic}, with the code on its right\footnote{the somewhat
- peculiar use of |\_| and |\$| is explained in \autoref{xintNewExpr}; they are
- made necessary from the fact that the parameters are passed to a \emph{macro}
- (\csa{DimToNum}) and not only to \emph{functions}, as are known to
- \hyperref[sec:exprsummary]{\csa{xintexpr}}. But one can also define directly
- the desired function, for example the constructed \csa{FA} turns out to have
- meaning \texttt{\meaning\FA}, where the \csa{romannumeral} part is only to
- ensure it expands in only two steps, and could be removed. A handwritten macro
- would use here \csa{xintiPow} and not \csa{xintPow}, as we know it has to deal
- with integers only. See the next footnote.}, is for illustration only, not
+The\xintNewIExpr \FA [2] {protect(\DimToNum {#2})^3/protect(\DimToNum{#1})^2}
+\hyperlink{graphic}{graphic}, with the code on its right%
+%
+\footnote{see \autoref{sssec:protect} for the significance of the |protect|'s:
+ they are needed because the expression has macro parameters inside macros,
+ and not only functions from the \csbxint{expr} syntax. The \csa{FA} turns
+ out to have meaning \texttt{\meaning\FA}. The \csa{romannumeral} part is
+ only to ensure it expands in only two steps, and could be removed. The
+ mysterious \expandafter|\string\xintiRound::csv| is what \csbxint{iexpr}
+ uses to round its result (or comma separated results) to an integer. See
+ also the next footnote.},
+%
+is for illustration only, not
only because of pdf rendering artefacts when displaying adjacent rules (which do
\emph{not} show in |dvi| output as rendered by |xdvi|, and depend from your
viewer), but because not using anything but rules it is quite inefficient and
@@ -5588,17 +6469,17 @@ drawing by a factor of five, but the boundary is then visibly ragged.
\newbox\codebox
\begingroup\makeatletter
\def\x{%
- \parindent0pt
+ \parindent0pt
\def\par{\@@par\leavevmode\null}%
\let\do\do@noligs \verbatim@nolig@list
- \let\do\@makeother \dospecials
+ \let\do\@makeother \dospecials
\catcode`\@ 14 \makestarlowast
- \ttfamily \scriptsize\baselineskip 8pt \obeylines \@vobeyspaces
+ \ttfamily \scriptsize\baselineskip 8pt \obeylines \@vobeyspaces
\catcode`\|\active
\lccode`\~`\|\lowercase{\let~\egroup}}%
\global\setbox\codebox \vbox\bgroup\x
\def\DimToNum #1{\the\numexpr \dimexpr#1\relax/10000\relax } % no need to be more precise!
-\def\FA #1#2{\xintDSH {-4}{\xintQuo {\xintiPow {\DimToNum {#2}}{3}}{\xintiSqr {\DimToNum{#1}}}}}
+\def\FA #1#2{\xintDSH {-4}{\xintiQuo {\xintiPow {\DimToNum {#2}}{3}}{\xintiSqr {\DimToNum{#1}}}}}
\def\FB #1#2{\xintDSH {-4}{\xintiSqrt {\xintiMul {\DimToNum {#2}}{\DimToNum{#1}}}}}
\def\Ratio #1#2{\xintTrunc {2}{\DimToNum {#2}/\DimToNum{#1}}}
\xintFor #1 in {\xintdimensions [0pt+.25pt]} \do
@@ -5612,10 +6493,10 @@ drawing by a factor of five, but the boundary is then visibly ragged.
computation time through using the following definitions, together with a
horizontal step of |.25pt| rather than |.1pt|. The displayed original code
would make the slowest computation of all those done in this document using
- the \xintname bundle macros!\par\smallskip
+ the \xintname bundle macros!\par\smallskip
\noindent\box \codebox\par }
-If the list argument to \csbxint{For} (or \csbxint{For*}) is \csbxint{rationals}
+If the list argument to \csbxint{For} (or \csbxintForstar) is \csbxint{rationals}
or more generally
\csbxint{rationals}|[||start|\allowbreak|+|\allowbreak|delta||]| (\emph{within
braces}!), then \csbxint{For} does an infinite iteration where |#1| (or |#2|,
@@ -5633,24 +6514,17 @@ the denominator |b| is the product of the denominators of
form, and for another reason explained later |start| and |delta| are not put
either into irreducible form; the input may use explicitely \csa{xintIrr} to
achieve that).
-
+\begin{everbatim*}
\begingroup\small
-\noindent\dverb|@
-\xintFor #1 in {\xintrationals [10/21+1/21]} \do
-{#1=\xintifInt {#1}
- {\textcolor{blue}{\xintTrunc{10}{#1}}}
- {\xintTrunc{10}{#1}}% in blue if an integer
- \xintifGt {#1}{1.123}{\xintBreakFor}{, }%
-}|
-
-\smallskip
-\centeredline{\parbox{\dimexpr\linewidth-3em}{\xintFor #1 in {\xintrationals [10/21+1/21]} \do
+\noindent\parbox{\dimexpr\linewidth-3em}{\color[named]{OrangeRed}%
+\xintFor #1 in {\xintrationals [10/21+1/21]} \do
{#1=\xintifInt {#1}
{\textcolor{blue}{\xintTrunc{10}{#1}}}
{\xintTrunc{10}{#1}}% display in blue if an integer
\xintifGt {#1}{1.123}{\xintBreakFor}{, }%
- }}}
-\endgroup
+ }}
+\endgroup\smallskip
+\end{everbatim*}
\smallskip The example above confirms that computations are done exactly, and
illustrates that the two initial (reduced) denominators are not multiplied when
@@ -5662,40 +6536,27 @@ computations are done with numerators and denominators completely expanded, one
should be careful not to input numbers in scientific notation with exponents in
the hundreds, as they will get converted into as many zeroes.
-\begingroup\footnotesize \def\MacroFont {\ttfamily\relax}
-\noindent\dverb|@
-\xintFor #1 in {\xintrationals [0.000+0.125]} \do
-{\edef\tmp{\xintTrunc{3}{#1}}%
- \xintifInt {#1}
- {\textcolor{blue}{\tmp}}
- {\tmp}%
- \xintifGt {#1}{2}{\xintBreakFor}{, }%
- }|
-\smallskip
-
-\centeredline{\parbox{\dimexpr.7\linewidth}{\raggedright
-\xintFor #1 in {\xintrationals [0.000+0.125]} \do
+\begin{everbatim*}
+\noindent\parbox{\dimexpr.7\linewidth}{\raggedright
+\xintFor #1 in {\xintrationals [0.000+0.125]} \do
{\edef\tmp{\xintTrunc{3}{#1}}%
\xintifInt {#1}
{\textcolor{blue}{\tmp}}
{\tmp}%
\xintifGt {#1}{2}{\xintBreakFor}{, }%
- }}}
-
-\smallskip
+ }}\smallskip
+\end{everbatim*}
-We see here that \csbxint{Trunc} outputs (deliberately) zero as @0@, not (here)
-@0.000@, the idea being not to lose the information that the truncated thing was
+We see here that \csbxint{Trunc} outputs (deliberately) zero as $0$, not (here)
+$0.000$, the idea being not to lose the information that the truncated thing was
truly zero. Perhaps this behavior should be changed? or made optional? Anyhow
printing of fixed points numbers should be dealt with via dedicated packages
such as |numprint| or |siunitx|.\par
-\endgroup
-
\subsection{Another table of primes}\label{ssec:primesIII}
-As a further example, let us dynamically generate a tabular with the first @50@
-prime numbers after @12345@. First we need a macro to test if a (short) number
+As a further example, let us dynamically generate a tabular with the first $50$
+prime numbers after $12345$. First we need a macro to test if a (short) number
is prime. Such a completely expandable macro was given in \autoref{xintSeq},
here we consider a variant which will be slightly more efficient. This new
|\IsPrime| has two parameters. The first one is a macro which it redefines to
@@ -5711,7 +6572,7 @@ as they are able to deal with arbitrarily big integers.
\ifnumodd {\TheNumber}
{\ifnumgreater {\TheNumber}{1}
{\edef\ItsSquareRoot{\xintiSqrt \TheNumber}%
- \xintFor ##1 in {\xintintegers [3+2]}\do
+ \xintFor ##1 in {\xintintegers [3+2]}\do
{\ifnumgreater {##1}{\ItsSquareRoot}
{\def#1{1}\xintBreakFor}
{}%
@@ -5720,16 +6581,16 @@ as they are able to deal with arbitrarily big integers.
{}%
}}
{\def#1{0}}}% 1 is not prime
- {\ifnumequal {\TheNumber}{2}{\def#1{1}}{\def#1{0}}}%
+ {\ifnumequal {\TheNumber}{2}{\def#1{1}}{\def#1{0}}}%
}%
-\dverb|@
+\everb|@
\def\IsPrime #1#2% """color[named]{PineGreen}#1=\Result, #2=tested number (assumed >0).;!
{\edef\TheNumber {\the\numexpr #2}%"""color[named]{PineGreen} hence #2 may be a count or \numexpr.;!
\ifnumodd {\TheNumber}
- {\ifnumgreater {\TheNumber}{1}
+ {\ifnumgreater {\TheNumber}{1}
{\edef\ItsSquareRoot{\xintiSqrt \TheNumber}%
- \xintFor """color{red}##1;! in {"""color{red}\xintintegers;! [3+2]}\do
+ \xintFor """color{red}##1;! in {"""color{red}\xintintegers;! [3+2]}\do
{\ifnumgreater {"""color{red}##1;!}{\ItsSquareRoot} """color[named]{PineGreen}% "textcolor{red}{##1} is a \numexpr.;!
{\def#1{1}\xintBreakFor}
{}%
@@ -5738,71 +6599,75 @@ as they are able to deal with arbitrarily big integers.
{}%
}}
{\def#1{0}}}% 1 is not prime
- {\ifnumequal {\TheNumber}{2}{\def#1{1}}{\def#1{0}}}%
-}|
+ {\ifnumequal {\TheNumber}{2}{\def#1{1}}{\def#1{0}}}%
+}
+|
%\newcounter{primecount}
%\newcounter{cellcount}
+
+As we used \csbxint{For} inside a macro we had to double the |#| in its |#1|
+parameter. Here is now the code which creates the prime table (the table has
+been put in a \hyperref[primes]{float}, which should be found on page
+\pageref{primes}):
+
+\everb?@
+\newcounter{primecount}
+\newcounter{cellcount}
\begin{figure*}[ht!]
- \centering\phantomsection\label{primes}
+ \centering
\begin{tabular}{|*{7}c|}
\hline
\setcounter{primecount}{0}\setcounter{cellcount}{0}%
- \xintFor #1 in {\xintintegers [12345+2]} \do
+ \xintFor """color{red}#1;! in {"""color{red}\xintintegers;! [12345+2]} \do
+"""color[named]{PineGreen}% "textcolor{red}{#1} is a \numexpr.;!
{\IsPrime\Result{#1}%
\ifnumgreater{\Result}{0}
{\stepcounter{primecount}%
\stepcounter{cellcount}%
\ifnumequal {\value{cellcount}}{7}
- {\the#1 \\\setcounter{cellcount}{0}}
- {\the#1 &}}
+ {"""color{red}\the#1;! \\\setcounter{cellcount}{0}}
+ {"""color{red}\the#1;! &}}
{}%
\ifnumequal {\value{primecount}}{50}
- {\xintBreakForAndDo
+ {\xintBreakForAndDo
{\multicolumn {6}{l|}{These are the first 50 primes after 12345.}\\}}
{}%
}\hline
\end{tabular}
\end{figure*}
+?
-As we used \csbxint{For} inside a macro we had to double the |#| in its |#1|
-parameter. Here is now the code which creates the prime table (the table has
-been put in a \hyperref[primes]{float}, which appears
-\vpageref[above]{primes}):
-\dverb?@
-\newcounter{primecount}
-\newcounter{cellcount}
\begin{figure*}[ht!]
- \centering
+ \centering\phantomsection\label{primes}
\begin{tabular}{|*{7}c|}
\hline
\setcounter{primecount}{0}\setcounter{cellcount}{0}%
- \xintFor """color{red}#1;! in {"""color{red}\xintintegers;! [12345+2]} \do
-"""color[named]{PineGreen}% "textcolor{red}{#1} is a \numexpr.;!
+ \xintFor #1 in {\xintintegers [12345+2]} \do
{\IsPrime\Result{#1}%
\ifnumgreater{\Result}{0}
{\stepcounter{primecount}%
\stepcounter{cellcount}%
\ifnumequal {\value{cellcount}}{7}
- {"""color{red}\the#1;! \\\setcounter{cellcount}{0}}
- {"""color{red}\the#1;! &}}
+ {\the#1 \\\setcounter{cellcount}{0}}
+ {\the#1 &}}
{}%
\ifnumequal {\value{primecount}}{50}
- {\xintBreakForAndDo
+ {\xintBreakForAndDo
{\multicolumn {6}{l|}{These are the first 50 primes after 12345.}\\}}
{}%
}\hline
\end{tabular}
-\end{figure*}?
+\end{figure*}
\subsection{Some arithmetic with Fibonacci numbers}
\label{ssec:fibonacci}
-Here is again the code employed on the title page to compute Fibonacci numbers:
+Here is the code employed on the title page to compute (expandably, of
+course!) the 1250th Fibonacci number:
-\begingroup\footnotesize\baselineskip10pt
-\def\MacroFont {\ttfamily}
-\dverb|@
+\begin{everbatim*}
+\catcode`_ 11
\def\Fibonacci #1{% \Fibonacci{N} computes F(N) with F(0)=0, F(1)=1.
\expandafter\Fibonacci_a\expandafter
{\the\numexpr #1\expandafter}\expandafter
@@ -5816,7 +6681,7 @@ Here is again the code employed on the title page to compute Fibonacci numbers:
\expandafter\Fibonacci_end_i
\or
\expandafter\Fibonacci_end_ii
- \else
+ \else
\ifodd #1
\expandafter\expandafter\expandafter\Fibonacci_b_ii
\else
@@ -5829,15 +6694,17 @@ Here is again the code employed on the title page to compute Fibonacci numbers:
{\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval (2#2-#3)#3\relax}%
}% end of Fibonacci_b_i
-\def\Fibonacci_b_ii #1#2#3#4#5{\expandafter\Fibonacci_a\expandafter
+\def\Fibonacci_b_ii #1#2#3#4#5{\expandafter\Fibonacci_a\expandafter
{\the\numexpr (#1-1)/2\expandafter}\expandafter
{\romannumeral0\xintiieval sqr(#2)+sqr(#3)\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval (2#2-#3)#3\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval #2#4+#3#5\expandafter\relax\expandafter}\expandafter
{\romannumeral0\xintiieval #2#5+#3(#4-#5)\relax}%
}% end of Fibonacci_b_ii
-\def\Fibonacci_end_i #1#2#3#4#5{\xintthe#5}
-\def\Fibonacci_end_ii #1#2#3#4#5{\xinttheiiexpr #2#5+#3(#4-#5)\relax}
+% code as used on title page:
+%\def\Fibonacci_end_i #1#2#3#4#5{\xintthe#5}
+%\def\Fibonacci_end_ii #1#2#3#4#5{\xinttheiiexpr #2#5+#3(#4-#5)\relax}
+% new definitions:
\def\Fibonacci_end_i #1#2#3#4#5{{#4}{#5}}% {F(N+1)}{F(N)} in \xintexpr format
\def\Fibonacci_end_ii #1#2#3#4#5%
{\expandafter
@@ -5846,19 +6713,10 @@ Here is again the code employed on the title page to compute Fibonacci numbers:
{\romannumeral0\xintiieval #2#5+#3(#4-#5)\relax}}% idem.
% \FibonacciN returns F(N) (in encapsulated format: needs \xintthe for printing)
\def\FibonacciN {\expandafter\xint_secondoftwo\romannumeral-`0\Fibonacci }%
-|\par\endgroup
-
-\catcode`_ 11
-\def\Fibonacci_end_i #1#2#3#4#5{{#4}{#5}}%
-\def\Fibonacci_end_ii #1#2#3#4#5%
- {\expandafter
- {\romannumeral0\xintiieval #2#4+#3#5\expandafter\relax
- \expandafter}\expandafter
- {\romannumeral0\xintiieval #2#5+#3(#4-#5)\relax}}% idem.
-% \Fibonacci returns {F(N+1)}{F(N)} (both in \xintexpr encapsulation)
-% \FibonacciN returns F(N) (also in encapsulated format)
-\def\FibonacciN {\expandafter\xint_secondoftwo\romannumeral-`0\Fibonacci }%
\catcode`_ 8
+\end{everbatim*}
+
+
% ok
% \def\Fibo #1.{\xintthe\FibonacciN {#1}}% to use \xintiloopindex...
@@ -5866,40 +6724,41 @@ Here is again the code employed on the title page to compute Fibonacci numbers:
% \expandafter\Fibo\xintiloopindex.,
% \ifnum\xintiloopindex<49 \repeat \xintthe\FibonacciN{50}.}
-I have modified the ending, as I now want not only one specific value |F(N)| but
+I have modified the ending: we want not only one specific value |F(N)| but
a pair of successive values which can serve as starting point of another routine
devoted to compute a whole sequence |F(N), F(N+1), F(N+2),....|. This pair is,
for efficiency, kept in the encapsulated internal \xintexprname format.
|\FibonacciN| outputs the single |F(N)|, also as an |\xintexpr|-ession, and
-printing it will thus need the |\xintthe| prefix.
+printing it will thus need the |\xintthe| prefix.
-\begingroup\footnotesize\sffamily\baselineskip 10pt\let\MacroFont\ttfamily
+\begingroup\footnotesize\sffamily\baselineskip 10pt
Here a code snippet which
-checks the routine via a \string\message\ of the first @51@ Fibonacci
+checks the routine via a \string\message\ of the first $51$ Fibonacci
numbers (this is not an efficient way to generate a sequence of such
numbers, it is only for validating \csa{FibonacciN}).
%
-\dverb|@
+\begin{everbatim}
\def\Fibo #1.{\xintthe\FibonacciN {#1}}%
-\message{\xintiloop [0+1] \expandafter\Fibo\xintiloopindex.,
- \ifnum\xintiloopindex<49 \repeat \xintthe\FibonacciN{50}.}|\par
+\message{\xintiloop [0+1] \expandafter\Fibo\xintiloopindex.,
+ \ifnum\xintiloopindex<49 \repeat \xintthe\FibonacciN{50}.}
+\end{everbatim}
\endgroup
-The various |\romannumeral0\xintiieval| could very well all have been
+The various |\romannumeral0\xintiieval| could very well all have been
|\xintiiexpr|'s but then we would have needed more |\expandafter|'s.
Indeed the order of expansion must be controlled for the whole thing to work,
-and |\romannumeral0\xintiieval| is the first expanded form of |\xintiiexpr|.
+and |\romannumeral0\xintiieval| is the first expanded form of |\xintiiexpr|.
The way we use |\expandafter|'s to chain successive |\xintexpr| evaluations is
exactly analogous to well-known expandable techniques made possible by
-|\numexpr|.
+|\numexpr|.
\begin{framed}
There is a difference though: |\numexpr| is \emph{NOT} expandable, and to
force its expansion we must prefix it with |\the| or |\number|. On the other
hand |\xintexpr|, |\xintiexpr|, ..., (or |\xinteval|, |\xintieval|, ...)
expand fully when prefixed by |\romannumeral-`0|: the computation is fully
- executed and its result encapsulated in a private format.
+ executed and its result encapsulated in a private format.
Using |\xintthe| as prefix is necessary to print the result (this is like
|\the| for |\numexpr|), but it is not necessary to get the computation done
@@ -5923,26 +6782,28 @@ exactly analogous to well-known expandable techniques made possible by
\end{framed}
\footnotetext{To be completely honest the examination by \TeX{} of all
- successive digits was not avoided, as it occurs already in the locking-up of
- the result, what is avoided is to spend time un-locking, and then have
- the macros shuffle around possibly hundreds of digit tokens rather
- than a few control words.\par
- Technical note: I decided (somewhat hesitantly) for
- reasons of optimization purposes to skip in the private \csa{xintexpr}
- format a \csa{protect}-ion for the \csa{.=digits/digits[digits]}
- control sequences used internally. Thus in the improbable case that
- some macro package (such control sequence names are unavailable to the
- casual user) has given a meaning to one such control sequence, there
- is a possibility of a crash when embedding an \csa{xintexpr} without
+ successive digits was not avoided, as it occurs already in the
+ locking-up of the result, what is avoided is to spend time un-locking,
+ and then have the macros shuffle around possibly hundreds of digit
+ tokens rather than a few control words.\par
+ Technical note: I decided (somewhat hesitantly) for reasons of
+ optimization purposes to skip in the private \csa{xintexpr} format a
+ \csa{protect}-ion for the |.=digits/digits[digits]| control
+ sequences used internally. Thus in the improbable case that some macro
+ package (such control sequence names are unavailable to the casual
+ user) has given a meaning to one such control sequence, there is a
+ possibility of a crash when embedding an \csa{xintexpr} without
\csa{xintthe} prefix in an \csa{edef} (the computations by themselves
do proceed perfectly correctly even if these control sequences have
acquired some non \csa{relax} meaning).}
Our |\Fibonacci| expands completely under \fexpan sion,
so we can use \hyperref[fdef]{\ttfamily\char92fdef} rather than |\edef| in a
-situation such as \centeredline {|\fdef \X {\FibonacciN {100}}|} but for the
+situation such as %
+\leftedline {|\fdef \X {\FibonacciN {100}}|} but for the
reasons explained above, it is as efficient to employ |\edef|. And if we want
-\centeredline{|\edef \Y {(\FibonacciN{100},\FibonacciN{200})}|,} then |\edef| is
+%
+\leftedline{|\edef \Y {(\FibonacciN{100},\FibonacciN{200})}|,} then |\edef| is
necessary.
Allright, so let's now give the code to generate a sequence of braced Fibonacci
@@ -5964,13 +6825,12 @@ two and then using the standard recursion |F(N+2)=F(N+1)+F(N)|:
{\the\numexpr #1+1\expandafter}\expandafter
{\romannumeral0\xintiieval #2+#3\relax}{#2}{#4}%
}%
-\def\Fibonacci_Seq_end\fi\expandafter\Fibonacci_Seq_loop\expandafter
+\def\Fibonacci_Seq_end\fi\expandafter\Fibonacci_Seq_loop\expandafter
#1\expandafter #2#3#4{\fi {#3}}%
\catcode`_ 8
\begingroup\footnotesize\baselineskip10pt
-\def\MacroFont {\ttfamily}
-\dverb|@
+\everb|@
\catcode`_ 11
\def\FibonacciSeq #1#2{%#1=starting index, #2>#1=ending index
\expandafter\Fibonacci_Seq\expandafter
@@ -5986,17 +6846,18 @@ two and then using the standard recursion |F(N+2)=F(N+1)+F(N)|:
{\the\numexpr #1+1\expandafter}\expandafter
{\romannumeral0\xintiieval #2+#3\relax}{#2}{#4}%
}%
-\def\Fibonacci_Seq_end\fi\expandafter\Fibonacci_Seq_loop\expandafter
+\def\Fibonacci_Seq_end\fi\expandafter\Fibonacci_Seq_loop\expandafter
#1\expandafter #2#3#4{\fi {#3}}%
\catcode`_ 8
-|\par\endgroup
+|
+\endgroup
Deliberately and for optimization, this |\FibonacciSeq| macro is
completely expandable but not \fexpan dable. It would be easy to modify
-it to be so. But I wanted to check that the \csbxint{For*} does apply
+it to be so. But I wanted to check that the \csbxintForstar\ does apply
full expansion to what comes next each time it fetches an item from its
list argument. Thus, there is no need to generate lists of braced
-Fibonacci numbers beforehand, as \csbxint{For*}, without using any
+Fibonacci numbers beforehand, as \csbxintForstar, without using any
|\edef|, still manages to generate the list via iterated full expansion.
I initially used only one |\halign| in a three-column |multicols|
@@ -6004,60 +6865,59 @@ environment, but |multicols| only knows to divide the page horizontally
evenly, thus I employed in the end one |\halign| for each column (I
could have then used a |tabular| as no column break was then needed).
-
\begin{figure*}[ht!]
\phantomsection\label{fibonacci}
\newcounter{index}
\fdef\Fibxxx{\FibonacciN {30}}%
\setcounter{index}{30}%
\centeredline{\tabskip 1ex
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {30}{59}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}\vrule
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {60}{89}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}\vrule
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {90}{119}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}}%
%
\centeredline{Some Fibonacci numbers together with their residues modulo
- |F(30)|\digitstt{=\xintthe\Fibxxx}}
+ |F(30)|\dtt{=\xintthe\Fibxxx}}
\end{figure*}
\begingroup\footnotesize\baselineskip10pt
-\def\MacroFont {\ttfamily}
-\dverb|@
+\everb|@
\newcounter{index}
\tabskip 1ex
\fdef\Fibxxx{\FibonacciN {30}}%
\setcounter{index}{30}%
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {30}{59}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}\vrule
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {60}{89}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}\vrule
-\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
+\vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr
\xintFor* #1 in {\FibonacciSeq {90}{119}}\do
- {\theindex &\xintthe#1 &
- \xintRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
+ {\theindex &\xintthe#1 &
+ \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}%
}%
-|\par\endgroup
+|
+\endgroup
This produces the Fibonacci numbers from |F(30)| to |F(119)|, and
computes also all the
-congruence classes modulo |F(30)|. The output has
+congruence classes modulo |F(30)|. The output has
been put in a \hyperref[fibonacci]{float}, which appears
\vpageref[above]{fibonacci}. I leave to the mathematically inclined
readers the task to explain the visible patterns\dots |;-)|.
@@ -6070,27 +6930,20 @@ readers the task to explain the visible patterns\dots |;-)|.
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.
+commas. Spaces around commas and parentheses are ignored.
%
-\dverb|@
-\begin{tabular}{cccc}
- \xintForpair #1#2 in { ( A , a ) , ( B , b ) , ( C , c ) } \do {%
- \xintForpair #3#4 in { ( X , x ) , ( Y , y ) , ( Z , z ) } \do {%
- $\Biggl($\begin{tabular}{cc}
- -#1- & -#3-\\
- -#4- & -#2-\\
- \end{tabular}$\Biggr)$&}\\\noalign{\vskip1\jot}}%
-\end{tabular}|%
-\centeredline{\begin{tabular}{cccc}
+\begin{everbatim*}
+{\centering\begin{tabular}{cccc}
\xintForpair #1#2 in { ( A , a ) , ( B , b ) , ( C , c ) } \do {%
\xintForpair #3#4 in { ( X , x ) , ( Y , y ) , ( Z , z ) } \do {%
$\Biggl($\begin{tabular}{cc}
-#1- & -#3-\\
-#4- & -#2-\\
\end{tabular}$\Biggr)$&}\\\noalign{\vskip1\jot}}%
-\end{tabular}}
+\end{tabular}\\}
+\end{everbatim*}
-\smallskip Only |#1#2|, |#2#3|, |#3#4|, \dots, |#8#9| are valid (no error check
+Only |#1#2|, |#2#3|, |#3#4|, \dots, |#8#9| are valid (no error check
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
@@ -6116,7 +6969,7 @@ A `full' expansion is first applied to the material in front of
\csa{xintAssign}, which may thus be a macro expanding to a list of braced items.
\xintAssign \xintiPow {7}{13}\to\SevenToThePowerThirteen
-\xintAssign \xintDivision{1000000000000}{133333333}\to\Q\R
+\xintAssign \xintiDivision{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
@@ -6124,15 +6977,20 @@ following |\to|, and this control sequence is then defined via
|\def| to expand to the material between
\csa{xintAssign} and \csa{to}. Other types of expansions are specified through
an optional parameter to \csa{xintAssign}, see \emph{infra}.
-\centeredline{|\xintAssign \xintDivision{1000000000000}{133333333}\to\Q\R|}
-\centeredline{|\meaning\Q: |\digitstt{\meaning\Q}, |\meaning\R:|
- \digitstt{\meaning\R}} \centeredline{|\xintAssign \xintiPow
+%
+\leftedline{|\xintAssign \xintiDivision{1000000000000}{133333333}\to\Q\R|}
+%
+\leftedline{|\meaning\Q: |\dtt{\meaning\Q}, |\meaning\R:|
+ \dtt{\meaning\R}} %
+%
+\leftedline{|\xintAssign \xintiPow
{7}{13}\to\SevenToThePowerThirteen|}
-\centeredline{|\SevenToThePowerThirteen|\digitstt{=\SevenToThePowerThirteen}}
-\centeredline{(same as |\edef\SevenToThePowerThirteen{\xintiPow {7}{13}}|)}
-
+%
+\leftedline{|\SevenToThePowerThirteen|\dtt{=\SevenToThePowerThirteen}}
+%
+\leftedline{(same as |\edef\SevenToThePowerThirteen{\xintiPow {7}{13}}|)}
-\noindent\csa{xintAssign}\MyMarginNote{Changed!} admits since |1.09i| an
+\noindent\csa{xintAssign} admits since |1.09i| an
optional parameter, for example |\xintAssign [e]...| or |\xintAssign [oo]
...|. The latter means that the definitions of the macros initially on the
right of |\to| will be made with \hyperref[oodef]{\ttfamily\char92oodef} which
@@ -6149,6 +7007,13 @@ then to each one of these items.
default, but it now does |\def|. Use the optional parameter |[e]| to force use
of |\edef|.
+\begin{framed}
+ It is known that \csa{xintAssign} is very picky and does not want a space
+ before the |\to| or will give a surprising result if the material prior to
+ |\to| does not start with a brace but does contain brace pairs. Next
+ release of \xinttoolsname will presumably modify these ``features''.
+\end{framed}
+
% This
% macro uses various \csa{edef}'s, thus is incompatible with expansion-only
% contexts.
@@ -6156,7 +7021,7 @@ of |\edef|.
\subsection{\csbh{xintAssignArray}}\label{xintAssignArray}
% {\small Changed in release |1.06| to let the defined macro pass its
% argument through a |\numexpr...\relax|. |1.09i| adds optional
-% parameter. \par}
+% parameter. \par}
\xintAssignArray \xintBezout {1000}{113}\to\Bez
@@ -6171,14 +7036,15 @@ list (the argument \texttt{\x} itself is fed to a |\numexpr| by |\myArray|,
and |\myArray| expands in two steps to its output). With |0| as parameter,
\csa{myArray}|{0}| returns the number |M| of elements of the array so that the
successive elements are \csa{myArray}|{1}|, \dots, \csa{myArray}|{M}|.
-\centeredline{|\xintAssignArray \xintBezout {1000}{113}\to\Bez|} will set
-|\Bez{0}| to \digitstt{\Bez0}, |\Bez{1}| to \digitstt{\Bez1}, |\Bez{2}| to
-\digitstt{\Bez2}, |\Bez{3}| to \digitstt{\Bez3}, |\Bez{4}| to
-\digitstt{\Bez4}, and |\Bez{5}| to \digitstt{\Bez5}:
-\digitstt{(\Bez3)${}\times{}$\Bez1${}-{}$(\Bez4)${}\times{}$\Bez2${}={}$\Bez5.}
+%
+\leftedline{|\xintAssignArray \xintBezout {1000}{113}\to\Bez|} will set
+|\Bez{0}| to \dtt{\Bez0}, |\Bez{1}| to \dtt{\Bez1}, |\Bez{2}| to
+\dtt{\Bez2}, |\Bez{3}| to \dtt{\Bez3}, |\Bez{4}| to
+\dtt{\Bez4}, and |\Bez{5}| to \dtt{\Bez5}:
+\dtt{(\Bez3)${}\times{}$\Bez1${}-{}$(\Bez4)${}\times{}$\Bez2${}={}$\Bez5.}
This macro is incompatible with expansion-only contexts.
-\csa{xintAssignArray}\MyMarginNote{Changed!} admits now an optional
+\csa{xintAssignArray} admits now an optional
parameter, for example |\xintAssignArray [e]...|. This means that the
definitions of the macros will be made with |\edef|. The default is
|[]|, which makes the definitions with |\def|. Other possibilities: |[],
@@ -6191,7 +7057,7 @@ submitted to an |\edef|, but the default is now to use |\def|.
\subsection{\csbh{xintRelaxArray}}\label{xintRelaxArray}
-\csa{xintRelaxArray}\csa{myArray} %\ntype{N}
+\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 macro.
@@ -6202,22 +7068,22 @@ submitted to an |\edef|, but the default is now to use |\def|.
\label{fdef}
\csa{oodef}|\controlsequence {<stuff>}| does
-\dverb|@
+\everb|@
\expandafter\expandafter\expandafter\def
\expandafter\expandafter\expandafter\controlsequence
- \expandafter\expandafter\expandafter{<stuff>}|
+ \expandafter\expandafter\expandafter{<stuff>}
+|
-%
This works only for a single
|\controlsequence|, with no parameter text, even without parameters. An
alternative would be:
-\dverb|@
+\everb|@
\def\oodef #1#{\def\oodefparametertext{#1}%
\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\def
\expandafter\expandafter\expandafter\oodefparametertext
- \expandafter\expandafter\expandafter }|
-%
+ \expandafter\expandafter\expandafter }
+|
\noindent
but it does not allow |\global| as prefix, and, besides, would have anyhow its
@@ -6235,7 +7101,6 @@ two steps for example, as is the case with all (except \csbxint{loop} and
Each will be defined only if \xinttoolsname finds them currently undefined. They
can be prefixed with |\global|.
-
\subsection{The Quick Sort algorithm illustrated}\label{ssec:quicksort}
First a completely expandable macro which sorts a list of numbers. The |\QSfull|
@@ -6253,56 +7118,17 @@ If the interest is only in \TeX{} integers, then one should replace the macros
|\ifnumequal| and |\ifnumless| conditionals rather than \csbxint{ifGt},
\csbxint{ifEq}, \csbxint{ifLt}.
-\begingroup\makeatletter\let\check@percent\relax
-\def\MacroFont{\small\baselineskip12pt \ttfamily }
-\begin{verbatim}
-% THE QUICK SORT ALGORITHM EXPANDABLY
-\input xintfrac.sty
-% HELPER COMPARISON MACROS
-\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}
-% the spaces are there to stop the \romannumeral-`0 originating
-% in \xintapplyunbraced when it applies a macro to an item
-\def\QSEqual #1#2{\xintifEq {#2}{#1}{{#2}}{ }}
-\def\QSLess #1#2{\xintifLt {#2}{#1}{{#2}}{ }}
-%
-\makeatletter
-\def\QSfull {\romannumeral0\qsfull }
-\def\qsfull #1{\expandafter\qsfull@a\expandafter{\romannumeral-`0#1}}
-\def\qsfull@a #1{\expandafter\qsfull@b\expandafter {\xintLength {#1}}{#1}}
-\def\qsfull@b #1{\ifcase #1
- \expandafter\qsfull@empty
- \or\expandafter\qsfull@single
- \else\expandafter\qsfull@c
- \fi
-}%
-\def\qsfull@empty #1{ } % the space stops the \QSfull \romannumeral0
-\def\qsfull@single #1{ #1}
-% for simplicity of implementation, we pick up the first item as pivot
-\def\qsfull@c #1{\qsfull@ci #1\undef {#1}}
-\def\qsfull@ci #1#2\undef {\qsfull@d {#1}}% #3 is the list, #1 its first item
-\def\qsfull@d #1#2{\expandafter\qsfull@e\expandafter
- {\romannumeral0\qsfull
- {\xintApplyUnbraced {\QSMore {#1}}{#2}}}%
- {\romannumeral0\xintapplyunbraced {\QSEqual {#1}}{#2}}%
- {\romannumeral0\qsfull
- {\xintApplyUnbraced {\QSLess {#1}}{#2}}}%
-}%
-\def\qsfull@e #1#2#3{\expandafter\qsfull@f\expandafter {#2}{#3}{#1}}%
-\def\qsfull@f #1#2#3{\expandafter\space #2#1#3}
-\makeatother
-% EXAMPLE
-\edef\z {\QSfull {{1.0}{0.5}{0.3}{1.5}{1.8}{2.0}{1.7}{0.4}{1.2}{1.4}%
- {1.3}{1.1}{0.7}{1.6}{0.6}{0.9}{0.8}{0.2}{0.1}{1.9}}}
-\tt\meaning\z
-\def\a {3.123456789123456789}\def\b {3.123456789123456788}
-\def\c {3.123456789123456790}\def\d {3.123456789123456787}
-\expandafter\def\expandafter\z\expandafter
- {\romannumeral0\qsfull {{\a}\b\c\d}}% \a is braced to not be expanded
-\meaning\z
-\end{verbatim}
+%% \makeatletter\let\check@percent\relax lorsque je faisais avec verbatim
+%% ne pas changer la taille dans \MacroFont
+%% \def\MacroFont{\ttbfamily \small }
+%% anciennement avec \dverb, puis \everb
+%% \everb|"makeatletter"@gobble
+\begin{everbatim*}
% THE QUICK SORT ALGORITHM EXPANDABLY
-\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}
+% \usepackage{xintfrac} in the preamble (latex), or \input xintfrac.sty (Plain)
+\catcode`@ 11 % = \makeatletter
+\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}
% the spaces stop the \romannumeral-`0 done by \xintapplyunbraced each time
% it applies its macro argument to an item
\def\QSEqual #1#2{\xintifEq {#2}{#1}{{#2}}{ }}
@@ -6315,362 +7141,468 @@ If the interest is only in \TeX{} integers, then one should replace the macros
\expandafter\qsfull@empty
\or\expandafter\qsfull@single
\else\expandafter\qsfull@c
- \fi
-}%
-\def\qsfull@empty #1{ } % the space stops the \QSfull \romannumeral0
+ \fi }
+\def\qsfull@empty #1{ }% the space stops the \QSfull \romannumeral0
\def\qsfull@single #1{ #1}
-\def\qsfull@c #1{\qsfull@ci #1\undef {#1}} % we pick up the first as Pivot
+\def\qsfull@c #1{\qsfull@ci #1\undef {#1}}% we pick up the first as Pivot
\def\qsfull@ci #1#2\undef {\qsfull@d {#1}}
\def\qsfull@d #1#2{\expandafter\qsfull@e\expandafter
- {\romannumeral0\qsfull
- {\xintApplyUnbraced {\QSMore {#1}}{#2}}}%
+ {\romannumeral0\qsfull {\xintApplyUnbraced {\QSMore {#1}}{#2}}}%
{\romannumeral0\xintapplyunbraced {\QSEqual {#1}}{#2}}%
- {\romannumeral0\qsfull
- {\xintApplyUnbraced {\QSLess {#1}}{#2}}}%
-}%
-\def\qsfull@e #1#2#3{\expandafter\qsfull@f\expandafter {#2}{#3}{#1}}%
+ {\romannumeral0\qsfull {\xintApplyUnbraced {\QSLess {#1}}{#2}}}%
+}
+\def\qsfull@e #1#2#3{\expandafter\qsfull@f\expandafter {#2}{#3}{#1}}
\def\qsfull@f #1#2#3{\expandafter\space #2#1#3}
-\makeatother
+\catcode`@ 12 % = \makeatother
% EXAMPLE
+\begingroup
\edef\z {\QSfull {{1.0}{0.5}{0.3}{1.5}{1.8}{2.0}{1.7}{0.4}{1.2}{1.4}%
{1.3}{1.1}{0.7}{1.6}{0.6}{0.9}{0.8}{0.2}{0.1}{1.9}}}
-\noindent Output:\par
-\texttt{\printnumber{\meaning\z}}
+\printnumber{\meaning\z}
\def\a {3.123456789123456789}\def\b {3.123456789123456788}
\def\c {3.123456789123456790}\def\d {3.123456789123456787}
\expandafter\def\expandafter\z\expandafter
- {\romannumeral0\qsfull {{\a}\b\c\d}}% \a is braced to not be expanded
-\texttt{\printnumber{\meaning\z}}
+ {\romannumeral0\qsfull {{\a}\b\c\d}}% \a is braced to not be expanded
+\printnumber{\meaning\z}
\endgroup
-
-
+\end{everbatim*}
We then turn to a graphical illustration of the algorithm. For simplicity the
pivot is always chosen to be the first list item. We also show later how to
illustrate the variant which picks up the last item of each unsorted
chunk as pivot.
-\begingroup
-\makeatletter
-\let\check@percent\relax
-% il utilise MacroFont
-\def\MacroFont{\small\baselineskip 12pt \ttfamily }
-\begin{verbatim}
-\input xintfrac.sty % if Plain TeX
+\begin{everbatim*}
+% in LaTeX preamble:
+% \usepackage{xintfrac}
+% \usepackage{color}
+% or, when using Plain TeX:
+% \input xintfrac.sty
+% \input color.tex
%
+% Color definitions
\definecolor{LEFT}{RGB}{216,195,88}
\definecolor{RIGHT}{RGB}{208,231,153}
\definecolor{INERT}{RGB}{199,200,194}
\definecolor{PIVOT}{RGB}{109,8,57}
-%
-\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}% space will be gobbled
+% Start of macro defintions
+\catcode`@ 11 % = \makeatletter in latex
+\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}% space will be gobbled
\def\QSEqual #1#2{\xintifEq {#2}{#1}{{#2}}{ }}
\def\QSLess #1#2{\xintifLt {#2}{#1}{{#2}}{ }}
%
-\makeatletter
\def\QS@a #1{\expandafter \QS@b \expandafter {\xintLength {#1}}{#1}}
-\def\QS@b #1{\ifcase #1
+\def\QS@b #1{\ifcase #1
\expandafter\QS@empty
\or\expandafter\QS@single
\else\expandafter\QS@c
- \fi
-}%
+ \fi }
\def\QS@empty #1{}
\def\QS@single #1{\QSIr {#1}}
\def\QS@c #1{\QS@d #1!{#1}} % we pick up the first as pivot.
-\def\QS@d #1#2!{\QS@e {#1}}% #1 = first element, #3 = list
+\def\QS@d #1#2!{\QS@e {#1}} % #1 = first element, #3 = list
\def\QS@e #1#2{\expandafter\QS@f\expandafter
{\romannumeral0\xintapplyunbraced {\QSMore {#1}}{#2}}%
{\romannumeral0\xintapplyunbraced {\QSEqual {#1}}{#2}}%
- {\romannumeral0\xintapplyunbraced {\QSLess {#1}}{#2}}%
-}%
-\def\QS@f #1#2#3{\expandafter\QS@g\expandafter {#2}{#3}{#1}}%
-% Here \QSLr, \QSIr, \QSr have been let to \relax, so expansion stops.
-% #2= elements < pivot, #1 = elements = pivot, #3 = elements > pivot
-\def\QS@g #1#2#3{\QSLr {#2}\QSIr {#1}\QSRr {#3}}%
-%
-\def\DecoLEFT #1{\xintFor* ##1 in {#1} \do {\colorbox{LEFT}{##1}}}
-\def\DecoINERT #1{\xintFor* ##1 in {#1} \do {\colorbox{INERT}{##1}}}
-\def\DecoRIGHT #1{\xintFor* ##1 in {#1} \do {\colorbox{RIGHT}{##1}}}
-\def\DecoPivot #1{\begingroup\color{PIVOT}\advance\fboxsep-\fboxrule
- \fbox{#1}\endgroup}
-\def\DecoLEFTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForFirst {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}%
-}
-\def\DecoRIGHTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForFirst {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}%
-}
-%
-\def\QSinitialize #1{\def\QS@list{\QSRr {#1}}%
- \let\QSRr\DecoRIGHT
-% \QS@list \par
-\par\centerline{\QS@list}
-}
-\def\QSoneStep {\let\QSLr\DecoLEFTwithPivot
- \let\QSIr\DecoINERT
- \let\QSRr\DecoRIGHTwithPivot
-% \QS@list
-\centerline{\QS@list}
-% \par
- \def\QSLr {\noexpand\QS@a}%
- \let\QSIr\relax
- \def\QSRr {\noexpand\QS@a}%
- \edef\QS@list{\QS@list}%
- \let\QSLr\relax
- \let\QSRr\relax
- \edef\QS@list{\QS@list}%
- \let\QSLr\DecoLEFT
- \let\QSIr\DecoINERT
- \let\QSRr\DecoRIGHT
-% \QS@list
-\centerline{\QS@list}
-% \par
-}
-\begingroup\offinterlineskip
-\small
-\QSinitialize {{1.0}{0.5}{0.3}{1.5}{1.8}{2.0}{1.7}{0.4}{1.2}{1.4}%
- {1.3}{1.1}{0.7}{1.6}{0.6}{0.9}{0.8}{0.2}{0.1}{1.9}}
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\endgroup
-\end{verbatim}
-
-\def\QSMore #1#2{\xintifGt {#2}{#1}{{#2}}{ }}% space will be gobbled
-\def\QSEqual #1#2{\xintifEq {#2}{#1}{{#2}}{ }}
-\def\QSLess #1#2{\xintifLt {#2}{#1}{{#2}}{ }}
-%
-\def\QS@a #1{\expandafter \QS@b \expandafter {\xintLength {#1}}{#1}}
-\def\QS@b #1{\ifcase #1
- \expandafter\QS@empty
- \or\expandafter\QS@single
- \else\expandafter\QS@c
- \fi
-}%
-\def\QS@empty #1{}
-\def\QS@single #1{\QSIr {#1}}
-\def\QS@c #1{\QS@d #1!{#1}} % we pick up the first as pivot.
-\def\QS@d #1#2!{\QS@e {#1}}% #1 = first element, #3 = list
-\def\QS@e #1#2{\expandafter\QS@f\expandafter
- {\romannumeral0\xintapplyunbraced {\QSMore {#1}}{#2}}%
- {\romannumeral0\xintapplyunbraced {\QSEqual {#1}}{#2}}%
- {\romannumeral0\xintapplyunbraced {\QSLess {#1}}{#2}}%
-}%
-\def\QS@f #1#2#3{\expandafter\QS@g\expandafter {#2}{#3}{#1}}%
+ {\romannumeral0\xintapplyunbraced {\QSLess {#1}}{#2}}}
+\def\QS@f #1#2#3{\expandafter\QS@g\expandafter {#2}{#3}{#1}}
% #2= elements < pivot, #1 = elements = pivot, #3 = elements > pivot
% Here \QSLr, \QSIr, \QSr have been let to \relax, so expansion stops.
-\def\QS@g #1#2#3{\QSLr {#2}\QSIr {#1}\QSRr {#3}}%
+\def\QS@g #1#2#3{\QSLr {#2}\QSIr {#1}\QSRr {#3}}
%
\def\DecoLEFT #1{\xintFor* ##1 in {#1} \do {\colorbox{LEFT}{##1}}}
\def\DecoINERT #1{\xintFor* ##1 in {#1} \do {\colorbox{INERT}{##1}}}
\def\DecoRIGHT #1{\xintFor* ##1 in {#1} \do {\colorbox{RIGHT}{##1}}}
-\def\DecoPivot #1{\begingroup\color{PIVOT}\advance\fboxsep-\fboxrule
- \fbox{#1}\endgroup}
+\def\DecoPivot #1{\begingroup\color{PIVOT}\advance\fboxsep-\fboxrule\fbox{#1}\endgroup}
\def\DecoLEFTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForFirst {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}%
-}
+ \xintFor* ##1 in {#1} \do {\xintifForFirst {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}}
\def\DecoRIGHTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForFirst {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}%
-}
+ \xintFor* ##1 in {#1} \do {\xintifForFirst {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}}
%
-\def\QSinitialize #1{\def\QS@list{\QSRr {#1}}%
- \let\QSRr\DecoRIGHT
-% \QS@list \par
-\par\centerline{\QS@list}
-}
-\def\QSoneStep {\let\QSLr\DecoLEFTwithPivot
- \let\QSIr\DecoINERT
- \let\QSRr\DecoRIGHTwithPivot
-% \QS@list
-\centerline{\QS@list}
-% \par
- \def\QSLr {\noexpand\QS@a}%
- \let\QSIr\relax
- \def\QSRr {\noexpand\QS@a}%
+\def\QSinitialize #1{\def\QS@list{\QSRr {#1}}\let\QSRr\DecoRIGHT
+ \par\centerline{\QS@list}}
+\def\QSoneStep {\let\QSLr\DecoLEFTwithPivot \let\QSIr\DecoINERT \let\QSRr\DecoRIGHTwithPivot
+ \centerline{\QS@list}%
+ \def\QSLr {\noexpand\QS@a}\let\QSIr\relax\def\QSRr {\noexpand\QS@a}%
\edef\QS@list{\QS@list}%
- \let\QSLr\relax
- \let\QSRr\relax
+ \let\QSLr\relax\let\QSRr\relax
\edef\QS@list{\QS@list}%
- \let\QSLr\DecoLEFT
- \let\QSIr\DecoINERT
- \let\QSRr\DecoRIGHT
-% \QS@list
-\centerline{\QS@list}
-% \par
-}
-
-\phantomsection\label{quicksort}
+ \let\QSLr\DecoLEFT \let\QSIr\DecoINERT \let\QSRr\DecoRIGHT
+ \centerline{\QS@list}}
+\catcode`@ 12 % = \makeatother in latex
+% End of macro definitions.
+% The next line is for xint.pdf use only.
+\normalcolor\phantomsection\label{quicksort}
+% Start of Example
\begingroup\offinterlineskip
\small
\QSinitialize {{1.0}{0.5}{0.3}{1.5}{1.8}{2.0}{1.7}{0.4}{1.2}{1.4}%
{1.3}{1.1}{0.7}{1.6}{0.6}{0.9}{0.8}{0.2}{0.1}{1.9}}
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
+\QSoneStep\QSoneStep\QSoneStep\QSoneStep\QSoneStep
\endgroup
-
+\end{everbatim*}
If one wants rather to have the pivot from the end of the yet to sort chunks,
then one should use the following variants:
-\begin{verbatim}
-\def\QS@c #1{\expandafter\QS@e\expandafter
- {\romannumeral0\xintnthelt {-1}{#1}}{#1}%
-}%
-\def\DecoLEFTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForLast {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}%
-}
-\def\DecoRIGHTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForLast {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}%
-}
-\def\QSinitialize #1{\def\QS@list{\QSLr {#1}}%
- \let\QSLr\DecoLEFT
-% \QS@list \par
-\par\centerline{\QS@list}
-}
-\end{verbatim}
-\def\QS@c #1{\expandafter\QS@e\expandafter
- {\romannumeral0\xintnthelt {-1}{#1}}{#1}%
-}%
+
+\begin{everbatim*}
+\normalcolor
+\makeatletter
+\def\QS@c #1{\expandafter\QS@e\expandafter {\romannumeral0\xintnthelt {-1}{#1}}{#1}}
\def\DecoLEFTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForLast {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}%
-}
+ \xintFor* ##1 in {#1} \do {\xintifForLast {\DecoPivot {##1}}{\colorbox{LEFT}{##1}}}}
\def\DecoRIGHTwithPivot #1{%
- \xintFor* ##1 in {#1} \do
- {\xintifForLast {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}%
-}
-\def\QSinitialize #1{\def\QS@list{\QSLr {#1}}%
- \let\QSLr\DecoLEFT
-% \QS@list \par
-\par\centerline{\QS@list}
-}
+ \xintFor* ##1 in {#1} \do{\xintifForLast {\DecoPivot {##1}}{\colorbox{RIGHT}{##1}}}}
+\def\QSinitialize #1{\def\QS@list{\QSLr {#1}}\let\QSLr\DecoLEFT\par\centerline{\QS@list}}
+\makeatother
\begingroup\offinterlineskip
\small
\QSinitialize {{1.0}{0.5}{0.3}{1.5}{1.8}{2.0}{1.7}{0.4}{1.2}{1.4}%
{1.3}{1.1}{0.7}{1.6}{0.6}{0.9}{0.8}{0.2}{0.1}{1.9}}
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\QSoneStep
-\endgroup
-
+\QSoneStep\QSoneStep\QSoneStep\QSoneStep\QSoneStep
+\QSoneStep\QSoneStep\QSoneStep\QSoneStep\QSoneStep
\endgroup
+\end{everbatim*}
It is possible to modify this code to let it do \csa{QSonestep} repeatedly and
-stop automatically when the sort is finished.\footnote{\url{http://tex.stackexchange.com/a/142634/4686}}
+stop automatically when the sort is finished.%
+%
+\footnote{\url{http://tex.stackexchange.com/a/142634/4686}}
+\section{Commands of the \xintcorename package}
+\label{sec:core}
-\section{Commands of the \xintname package}
-\label{sec:xint}
-
-Version |1.0| was released |2013/03/28|. This is \texttt{\xintversion} of
-\texttt{\xintdate}.
+\localtableofcontents
-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 zeroes, 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}.
+Prior to release |1.1| the macros which are now included in the separate
+package \xintcorename were part of \xintname. Package \xintcorename is
+automatically loaded by \xintname.\IMPORTANT\
+
+\xintcorename provides the five basic arithmetic operations on big integers:
+addition, subtraction, multiplication, division and powers. Division may be
+either rounded (\csbxint{iiDivRound}) (the rounding of |0.5| is |1| and the
+one of |-0.5| is |-1|) or Euclidean (\csbxint{iiQuo}) (which for positive
+operands is the same as truncated division), or truncated (\csbxint{iiDivTrunc}).
+
+In the description of the macros the \texttt{\n} and \texttt{\m} symbols stand
+for explicit (big) integers within braces or more generally any control
+sequence (possibly within braces) \hyperref[sec:expansions]{\fexpan ding} to
+such a big integer.
+
+The macros with a single |i| in their names parse their arguments
+automatically through \hyperref[xintiNum]{\string\xintNum}. This type of
+expansion applied to an argument is signaled by a
+\textcolor[named]{PineGreen}{\Numf} in the margin. The accepted input format
+is then a sequence of plus and minus signs, followed by some string of zeroes,
+followed by digits.
+
+If \xintfracname additionally to \xintcorename is loaded, \csbxint{Num}
+becomes a synonym to \csbxint{TTrunc}; this means that
+arbitrary\inmarg{Changed} fractions will be accepted as arguments of the
+macros with a single |i| in their names, but get truncated to integers before
+further processing. The format of the output will be as with only \xintname
+loaded. The only extension is in allowing a wider variety of inputs.
+
+The macros with |ii| in their names have arguments which will only be \fexpan
+ded, but will not be parsed via \hyperref[xintiNum]{\string\xintNum}.
+Arguments of this type are signaled by the margin annotation
+\textcolor[named]{PineGreen}{\emph{f}}. For such big integers only one minus
+sign and no plus sign, nor leading zeros, are accepted. |-0| is not valid in
+this strict input format. Loading \xintfracname does not bring any
+modification to these macros whether for input or output.
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...
+\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
+expression, in the arguments to the package macros, see the
\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]|.
+\begin{framed}
+ \xintcorename also provides macros |\xintAdd|, |\xintMul|,\dots as synonyms
+ to |\xintiAdd|, |\xintiMul|,\dots. Their usage is
+ \fbox{deprecated}\IMPORTANT{} for the following reason: with \xintfracname
+ loaded they become the routines dealing fully with fractions on input. But
+ this means that they now use fraction format on output, even with integer
+ arguments.
+
+ Due to this variability of the output format on whether the document uses
+ only \xintname or loads additionally \xintfracname, code using these macros
+ is fragile, because loading at some later date a package which itself loads
+ \xintfracname or \xintexprname will modify their output format, and this is
+ catastrophic for example in locations expanded by |\ifnum|, or even in
+ arguments to those other macros of \xintname with |ii| in their names.
+
+ Prefer thus, when writing code loading only \xintcorename or \xintname, to
+ use the macros \csbxint{iAdd}, \csbxint{iMul}, \dots, or \csbxint{iiAdd},
+ \csbxint{iiMul}, \dots. They are guaranteed to always output an integer
+ without a trailing |/B[n]|. The latter have the less overhead, and the
+ former do not complain, if \xintfracname is loaded, even if used with true
+ fractions, as they will then truncate their arguments to
+ integers.\MyMarginNote[\kern\dimexpr\FrameSep+\FrameRule\relax]{Changed}
+
+ It was an error for the \xintname package (now \xintcorename) to provide
+ macros |\xintAdd|, |\xintMul|, |\xintSub| \dots. They should be used only
+ with \xintfracname loaded.
+\end{framed}
+
+The {\color[named]{PineGreen}$\star$}'s in the margin are there to remind of
+the complete expandability, even \fexpan dability of the macros, as discussed
+in \autoref{sec:expansions}.
+
+
+\subsection{\csbh{xintNum}}\label{xintiNum}
+
+|\xintNum|\n\etype{f} removes chains of plus or minus signs, followed by
+zeroes. %
+%
+\leftedline{|\xintNum{+---++----+--000000000367941789479}|\dtt
+ {=\xintNum{+---++----+--000000000367941789479}}}
+
+All \xintname macros with a single |i| in their names, such as \csbxint{iAdd},
+\csbxint{iMul} apply \csbxint{Num} to their arguments.
+
+When \xintfracname is loaded, \csbxint{Num} becomes a synonym to
+\csbxint{TTrunc}.\inmarg{Changed}
+
+\subsection{\csbh{xintSgn}, \csbh{xintiiSgn}}\label{xintiiSgn}
+
+|\xintiiSgn|\n\etype{f} returns 1 if the number is positive, 0 if it is zero
+and -1 if it is negative. It skips the \csbxint{Num} overhead.
+
+\csbxint{Sgn}\etype{\Numf} is the variant using \csbxint{Num} and getting
+extended by \xintfracname to fractions.
+
+\subsection{\csbh{xintiOpp}, \csbh{xintiiOpp}}\label{xintiOpp}\label{xintiiOpp}
+
+|\xintiOpp|\n\etype{\Numf} return the opposite |-N| of the number |N|.
+\csbxint{Opp} is initially a synonym but gets extended by \xintfracname to
+fractions (its output format will be a fraction even if the argument is an
+integer) and \csa{xintiiOpp} is the strict integer-only variant which skips
+the \csbxint{Num} overhead.\etype{f}
+
+\subsection{\csbh{xintiAbs}, \csbh{xintiiAbs}}\label{xintiAbs}\label{xintiiAbs}
+
+|\xintiAbs|\n\etype{\Numf} returns the absolute value of the number.
+\csbxint{Abs} is a synonym but gets modified by \xintfracname. \csa{xintiiAbs}
+skips the \csbxint{Num} overhead.\etype{f}
+
+\subsection{\csbh{xintiAdd}, \csbh{xintiiAdd}}\label{xintiAdd}\label{xintiiAdd}
+
+|\xintiAdd|\n\m\etype{\Numf\Numf} returns the sum of the two numbers.
+\csbxint{Add} is initially a synonym but gets extended by \xintfracname.
+\csa{xintiiAdd} skips the \csbxint{Num} overhead.\etype{ff}
+
+\subsection{\csbh{xintiSub}, \csbh{xintiiSub}}\label{xintiSub}\label{xintiiSub}
-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.
+|\xintiSub|\n\m\etype{\Numf\Numf} returns the difference |N-M|. \csbxint{Sub}
+is initially a synonym but gets extended by \xintfracname.
+\csa{xintiiSub} skips the \csbxint{Num} overhead.\etype{ff}
+
+\subsection{\csbh{xintiMul}, \csbh{xintiiMul}}\label{xintiMul}\label{xintiiMul}
+%{\small Modified in release |1.03|.\par}
+
+|\xintiMul|\n\m\etype{\Numf\Numf} returns the product of the two numbers.
+\csbxint{Mul} is the initial synonym modified by \xintfracname, and
+\csa{xintiiMul} skips the \csbxint{Num} overhead.\etype{ff}
+
+\subsection{\csbh{xintiSqr}, \csbh{xintiiSqr}}\label{xintiSqr}\label{xintiiSqr}
+
+|\xintiSqr|\n\etype{\Numf} returns the square. \csbxint{Sqr} is the initial
+synonym extended by \xintfracname to fractions. \csa{xintiiSqr} skips the
+\csbxint{Num} overhead.\etype{f}
+
+\subsection{\csbh{xintiPow}, \csbh{xintiiPow}}\label{xintiPow}\label{xintiiPow}
+
+|\xintiPow|\n\x\etype{\Numf\numx} returns |N^x|. When |x| is zero, this is 1.
+If |N=0| and |x<0|, if \verb+|N|>1+ and |x<0|, or if \verb+|N|>1+
+and |x>100000|, then an error is raised.
+
+The |x>100000| condition should perhaps be made more strict: as it stands it
+allows launching operations taking hours to complete. Indeed, observe that
+|2^50000| already has \dtt{\xintLen{\xintFloatPow [1]{2}{50000}}} digits; as
+it turns out each exact multiplication done via \csbxint{iiMul} of two
+numbers with one thousand digits each already takes of the order of seconds,
+and it would take hours for arguments each with circa $15000$ digits. Perhaps
+some completely expandable but not \fexpan dable variants could fare better?
+
+\csa{xintiiPow} is an integer only variant skipping the \csbxint{Num}
+overhead\etype{f\numx}, it produces the same result as \csa{xintiPow} with
+stricter assumptions on the inputs, and is thus a tiny bit faster.
+
+\csbxint{Pow} is the initial synonym of \csa{xintiPow} which gets extended by
+\xintfracname to fractions (see
+also \csbxint{FloatPow} for which the exponent must still obey the \TeX{} bound
+and \csbxint{FloatPower} which has no restriction at all on the size of the
+exponent). Negative exponents do not then raise errors anymore. The float
+version is able to deal with things such as |2^999999999| without any problem.
+For example |\xintFloatPow[4]{2}{50000}|\dtt{=\xintFloatPow[4]{2}{50000}}
+and |\xintFloatPow[4]{2}{999999999}|
+\dtt{=\xintFloatPow[4]{2}{999999999}}.%
+%
+\footnote{On my laptop \texttt{\detokenize{\xintiiPow {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 less than one hundredth of a second
+ (|1.09j|; we used in the text only four significant digits only for
+ reasons of space, not time.) This is done without |log|/|exp| which
+ are not (yet?) implemented in \xintfracname. The \LaTeX3
+ \href{http://www.ctan.org/pkg/l3kernel}{l3fp} package does this with
+ |log|/|exp| and is ten times faster, but allows only |16| significant
+ figures and the (exactly represented) floating point numbers must have
+ their exponents limited to $\pm$\dtt{9999}.}
+
+Within an \csbxint{iiexpr}|..\relax| the infix operator |^| is mapped to
+\csa{xintiiPow}; within an \csbxint{expr}-ession it is mapped to \csbxint{Pow}
+(as extended by \xintfracname); in \csbxint{floatexpr}, it is mapped to
+\csbxint{FloatPower}.
+
+\subsection{\csbh{xintiDivision},
+ \csbh{xintiiDivision}}\label{xintiDivision}\label{xintiiDivision}
+
+% 17 octobre 2014: je supprime \xintDivision, seulement \xintiDivision.
+
+|\xintiiDivision|\n\m\etype{ff} 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}|. It skips the overhead of parsing via
+\csbxint{Num}.
-% on how macros of \xintname are modified after loading
-% \xintfracname (or \xintexprname).
+|\xintiDivision|\etype{\Numf\Numf} submits its arguments to \csbxint{Num} and
+is extended by \xintfracname to accept fractions on input, which it truncates
+first, and is not to be confused with the \xintfracname macro \csbxint{Div}
+which divides one fraction by another.
+Note: |\xintDivision| was the former name of |\xintiDivision|. Its use is
+deprecated since release |1.1|.\inmarg{Changed}
-% \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.
+\subsection{\csbh{xintiQuo}, \csbh{xintiiQuo}}\label{xintiQuo}\label{xintiiQuo}
-% 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).
+|\xintiiQuo|\n\m\etype{ff} returns the quotient from the euclidean division.
+It skips the overhead of parsing via \csbxint{Num}.
+|\xintiQuo|\etype{\Numf\Numf} submits its arguments to \csbxint{Num} and
+is extended by \xintfracname to accept fractions on input, which it truncates
+first.
-% Package \xintname also provides some general macro programming or token
-% manipulation utilities (expandable as well as non-expandable), which are
-% described in the next section (\autoref{sec:tools}).
+Note: |\xintQuo| is the former name of |\xintiQuo|. Its use is deprecated.
+\inmarg{Changed}
+
+\subsection{\csbh{xintiRem}, \csbh{xintiiRem}}\label{xintiRem}\label{xintiiRem}
+
+|\xintiiRem|\n\m\etype{ff} returns the remainder from the euclidean
+division. It skips the overhead of parsing via \csbxint{Num}.
+
+|\xintiRem|\etype{\Numf\Numf} submits its arguments to \csbxint{Num} and
+is extended by \xintfracname to accept fractions on input, which it truncates
+first.
+
+Note: |\xintRem| is the former name of |\xintiRem|. Its use is deprecated.
+\inmarg{Changed}
+
+\subsection{\csbh{xintiDivRound}, \csbh{xintiiDivRound}}
+\label{xintiDivRound}\label{xintiiDivRound}
+
+|\xintiiDivRound|\n\m\etype{ff} returns the rounded value of the algebraic
+quotient $N/M$ of two big integers. The rounding of half integers is towards
+the nearest integer of bigger absolute value. The macro skips the overhead of
+parsing via \csbxint{Num}. The rounding is away from zero.
+
+|\xintiDivRound|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. It
+is extended by \xintfracname to accept fractions on input, which it truncates
+first before computing the rounded quotient.
+
+\subsection{\csbh{xintiDivTrunc}, \csbh{xintiiDivTrunc}}
+\label{xintiDivTrunc}\label{xintiiDivTrunc}
+
+|\xintiiDivTrunc|\n\m\etype{ff} computes the truncation towards zero of the
+algebraic quotient $N/M$. It skips the overhead of parsing the operands with
+\csbxint{Num}. For $M>0$ it is the same as \csbxint{iiQuo}.
+\begin{everbatim*}
+$\xintiiQuo {1000}{-57}, \xintiiDivRound {1000}{-57}, \xintiiDivTrunc {1000}{-57}$
+\end{everbatim*}
+
+|\xintiDivTrunc|\etype{\Numf\Numf} submits first its arguments to \csbxint{Num}.
+
+\subsection{\csbh{xintiMod}, \csbh{xintiiMod}}
+\label{xintiMod}\label{xintiiMod}
+
+|\xintiiMod|\n\m\etype{ff} computes $N - M*t(N/M)$, where $t(N/M)$ is the
+algebraic quotient truncated towards zero . The macro skips the overhead of parsing
+the operands with \csbxint{Num}. For $M>0$ it is the same as \csbxint{iiRem}.
+\begin{everbatim*}
+$\xintiiRem {1000}{-57}, \xintiiMod {1000}{-57},
+ \xintiiRem {-1000}{57}, \xintiiMod {-1000}{57}$
+\end{everbatim*}
+
+|\xintiMod|\etype{\Numf\Numf} submits first its arguments to \csbxint{Num}.
+
+\subsection{\csbh{xintInc}, \csbh{xintDec}}
+\label{xintInc}
+\label{xintDec}
+%{\small New with |1.08|.\par}
+
+|\xintInc|\n\etype{f} is |N+1| and |\xintDec|\n{} is |N-1|. These macros
+remain integer-only, even with \xintfracname loaded. They skip the overhead
+of parsing via \csbxint{Num}.
+
+
+\section{Commands of the \xintname package}
+\label{sec:xint}
\localtableofcontents
+Version |1.0| was released |2013/03/28|. This is \texttt{\xintbndlversion} of
+\texttt{\xintbndldate}. The core arithmetic macros have been
+moved\inmarg{Changed} to separate package \xintcorename, which is
+automatically loaded by \xintname.
+
+See the documentation of \xintcorename or \autoref{sec:expansions} for the
+significance of the \textcolor[named]{PineGreen}{\Numf},
+\textcolor[named]{PineGreen}{\emph{f}}, \textcolor[named]{PineGreen}{\numx}
+and \textcolor[named]{PineGreen}{$\star$} margin annotations and some
+important background information.
+
\subsection{\csbh{xintRev}} \label{xintRev}
-\csa{xintRev\n}\etype{f} will revert the order of the digits of the number,
+|\xintRev|\n\etype{f} will reverse the order of the digits of the number,
keeping the optional sign. Leading zeroes
resulting from the operation are not removed (see the
\csa{xintNum} macro for this). This macro and all other
-macros dealing with numbers first expand `fully' their arguments.
-\centeredline{|\xintRev{-123000}|\digitstt{=\xintRev{-123000}}}
-\centeredline{|\xintNum{\xintRev{-123000}}|%
- \digitstt{=\xintNum{\xintRev{-123000}}}}
-
+macros dealing with numbers first expand `fully' their arguments.
+%
+\leftedline{|\xintRev{-123000}|\dtt{=\xintRev{-123000}}}
+%
+\leftedline{|\xintNum{\xintRev{-123000}}|%
+ \dtt{=\xintNum{\xintRev{-123000}}}}
\subsection{\csbh{xintLen}}\label{xintiLen}
-\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
+|\xintLen|\n\etype{\Numf} returns the length of the number, not counting the
+sign. %
+%
+\leftedline{|\xintLen{-12345678901234567890123456789}|\dtt
+ {=\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
+integers). %
+%
+\leftedline{|\xintLen{-1e3/5.425}|\dtt
+ {=\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}|\dtt{=\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.
+less than circa $2^{31}$, but this is a bit theoretical.
|\xintLen| is only for numbers or fractions. See \csbxint{Length} for counting
tokens (or rather braced groups), more generally.
@@ -6681,87 +7613,41 @@ 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
-\centeredline{|\xintDigitsOf\xintiPow {7}{500}\to\digits|}
-\noindent @7^500@ has |\digits{0}=|\digits{0} digits, and the 123rd among them
+%
+\leftedline{|\xintDigitsOf\xintiPow {7}{500}\to\digits|}
+\noindent $7^{500}$ has |\digits{0}=|\digits{0} digits, and the 123rd among them
(starting from the most significant) is
|\digits{123}=|\digits{123}.
-\endgroup
-
-\subsection{\csbh{xintNum}}\label{xintiNum}
-
-\csa{xintNum\n}\etype{f} removes chains of plus or minus signs, followed by
-zeroes. \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{xintiiSgn}
-
-\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}\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}
-
-
-\subsection{\csbh{xintAdd}}\label{xintiAdd}\label{xintiiAdd}
-
-\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}
-
-
-
-\subsection{\csbh{xintSub}}\label{xintiSub}\label{xintiiSub}
-
-\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}
-
+\endgroup
-\subsection{\csbh{xintCmp}}\label{xintiCmp}
+\subsection{\csbh{xintCmp}}
-\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.
+|\xintCmp|\n\m\etype{\Numf\Numf} returns \dtt{1} if |N>M|, \dtt{0} if |N=M|,
+and \dtt{-1} if |N<M|. Extended by \xintfracname to fractions (its output
+naturally still being either |1|, |0|, or |-1|).
\subsection{\csbh{xintEq}}\label{xintEq}
%{\small New with release |1.09a|.\par}
-\csa{xintEq\n\m}\etype{\Numf\Numf} returns 1 if |N=M|, 0 otherwise. Extended
+|\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}
-\csa{xintGt\n\m}\etype{\Numf\Numf} returns 1 if |N|$>$|M|, 0 otherwise.
+|\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}
-\csa{xintLt\n\m}\etype{\Numf\Numf} returns 1 if |N|$<$|M|, 0 otherwise.
+|\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}
-\csa{xintIsZero\n}\etype{\Numf} returns 1 if |N=0|, 0 otherwise.
+|\xintIsZero|\n\etype{\Numf} returns 1 if |N=0|, 0 otherwise.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintNot}}\label{xintNot}
@@ -6772,32 +7658,31 @@ Extended by \xintfracname to fractions.
\subsection{\csbh{xintIsNotZero}}\label{xintIsNotZero}
%{\small New with release |1.09a|.\par}
-\csa{xintIsNotZero\n}\etype{\Numf} returns 1 if |N<>0|, 0 otherwise.
+|\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}
-\csa{xintIsOne\n}\etype{\Numf} returns 1 if |N=1|, 0 otherwise.
+|\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}
-\csa{xintAND\n\m}\etype{\Numf\Numf} returns 1 if |N<>0| and |M<>0| and zero
+|\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}
-\csa{xintOR\n\m}\etype{\Numf\Numf} returns 1 if |N<>0| or |M<>0| and zero
+|\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}
-\csa{xintXOR\n\m}\etype{\Numf\Numf} returns 1 if exactly one of |N| or |M|
+|\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}
@@ -6815,7 +7700,6 @@ ded). Extended by \xintfracname to fractions.
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}
@@ -6823,210 +7707,116 @@ is \fexpan ded first. Extended by \xintfracname to fractions.
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}\etype{\Numf\Numf} returns 1 if the \emph{absolute value}
+|\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}\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}
+\subsection{\csbh{xintiMax}, \csbh{xintiiMax}}\label{xintiMax}\label{xintiiMax}
-\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.
+|\xintiMax|\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}|\dtt{=\xintiMax{-5}{-6}}. The initial synonym \csbxint{Max}
+gets modified by \xintfracname which extends it to fractions. Its usage when
+only \xintname is loaded is discouraged.
+The |\xintiiMax| macro skips the overhead of parsing the operands with
+\csbxint{Num}.\etype{ff}
-\subsection{\csbh{xintMin}}\label{xintiMin}
+\subsection{\csbh{xintiMin}, \csbh{xintiiMin}}\label{xintiMin}\label{xintiiMin}
-\csa{xintMin\n\m}\etype{\Numf\Numf} returns the smallest of the two in the
+|\xintiMin|\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.
+{-5}{-6}|\dtt{=\xintiMin{-5}{-6}}. The initial synonym \csbxint{Min}
+gets modified by \xintfracname which extends it to fractions. Its usage when
+only \xintname is loaded is discouraged.
-\subsection{\csbh{xintMinof}}\label{xintMinof}
+The |\xintiiMin| macro skips the overhead of parsing the operands with
+\csbxint{Num}.\etype{ff}
+
+\subsection{\csbh{xintiMaxof}}\label{xintiMaxof}
%{\small New with release |1.09a|.\par}
-\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.
+\csa{xintiMaxof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the
+maximum. The list argument may be a macro, it is \fexpan ded first. Each item
+is submitted to |\xintNum| normalization. \csbxint{Maxof} is the initial
+synonym which gets extended by \xintfracname to fractions. Do not use it when
+only \xintname is loaded.
+
+\subsection{\csbh{xintiMinof}}\label{xintiMinof}
+%{\small New with release |1.09a|.\par}
+\csa{xintiMinof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the
+minimum. The list argument may be a macro, it is \fexpan ded first. Each item
+is submitted to |\xintNum| normalization. \csbxint{Minof} is the initial
+synonym which gets extended by \xintfracname to fractions. Do not use it when
+only \xintname is loaded.
-\subsection{\csbh{xintSum}}\label{xintiiSum}
+\subsection{\csbh{xintiiSum}}\label{xintiiSum}
-\csa{xintSum}\marg{braced things}\etype{{\lowast f}} after expanding its
+\csa{xintiiSum}\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}.
+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.
+\csbxint{Sum} is initially a synonym, it gets extended by \xintfracname to
+fractions.
-\centeredline{%
+%
+\leftedline{%
\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}}}
+ \dtt{=\xintiiSum{{123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
+%
+\leftedline{\csa{xintiiSum}|{1234567890}|\dtt{=\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}}}.
+{}|\dtt{=\xintiiSum {}}. A sum with only one term returns that
+number: |\xintiiSum {{-1234}}|\dtt{=\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.
+{1234}|\dtt{=\xintiiSum{1234}}.
% retiré de la doc le 22 octobre 2013
-
% \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{xintiiSumExpr}| {123}{-98763450}|%
-% |{\xintFac{7}}{\xintiMul{3347}{591}}\relax|\digitstt{=%
-% \xintiiSumExpr {123}{-98763450}{\xintFac{7}}{\xintiMul{3347}{591}}\relax}}
+\subsection{\csbh{xintiiPrd}}\label{xintiiPrd}
-% 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
-% in the future.
-
-% Extended by \xintfracname to fractions.
-
-\subsection{\csbh{xintMul}}\label{xintiMul}\label{xintiiMul}
-%{\small Modified in release |1.03|.\par}
-
-\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}\label{xintiiSqr}
-
-\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{xintiiPrd}
-
-\csa{xintPrd}\marg{braced things}\etype{{\lowast f}} after expanding its
+\csa{xintiiPrd}\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{=%
+%
+\leftedline{\csa{xintiiPrd}|{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}|%
+ \dtt{=%
\xintiiPrd{{-9876}{\xintFac{7}}{\xintiMul{3347}{591}}}}}
-\centeredline{\csa{xintiiPrd}|{123456789123456789}|\digitstt{=%
+%
+\leftedline{\csa{xintiiPrd}|{123456789123456789}|\dtt{=%
\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}}}.
+|\xintiiPrd {}|\dtt{=\xintiiPrd {}}. A product reduced to a single term
+returns this number: |\xintiiPrd {{-1234}}=|\dtt{\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 could be coded simply as \centeredline
-{|\xinttheiiexpr 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.
+compilation fail. On the other hand |\xintiiPrd {1234}|\dtt{=\xintiiPrd
+ {1234}}. %
+%
+\begin{everbatim*}
+$2^{200}3^{100}7^{100}=\printnumber
+ {\xintiiPrd {{\xintiPow {2}{200}}{\xintiPow {3}{100}}{\xintiPow {7}{100}}}}$
+\end{everbatim*}
+With \xintexprname, this would be easier:
+%
+\leftedline {|\xinttheiiexpr 2^200*3^100*7^100\relax |}
-% I temporarily remove mention of \xintPrdExpr from the documentation; I
-% really dislike the name now.
+The initial synonym \csbxint{Prd} is extended by \xintfracname to fractions.
% \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
-% name. \par}
-
-% \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{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
-% in the future.
-
-% Extended by \xintfracname to fractions.
-
-\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>100000|,\MyMarginNote{Changed!} then an error is raised. Indeed |2^50000|
-already has \digitstt{\xintLen{\xintFloatPow [1]{2}{50000}}} digits; each exact
-multiplication of two one thousand digits numbers already takes a few seconds,
-and it would take hours for the expandable computation to conclude with two
-numbers with each circa @15000@ digits. Perhaps some completely expandable but
-not \fexpan dable variants could fare better?
-
-Extended by \xintfracname to fractions (\csbxint{Pow}) and to floats
-(\csbxint{FloatPow} for which the exponent must still obey the \TeX{} bound and
-\csbxint{FloatPower} which has no restriction at all on the size of the
-exponent). 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}{50000}|\digitstt{=\xintFloatPow[4]{2}{50000}}
-and |\xintFloatPow[4]{2}{999999999}|
-\digitstt{=\xintFloatPow[4]{2}{999999999}}.\footnote{On my laptop
- |\string\xintiiPow \{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 less than one hundredth of a second
- (|1.09j|; we used in the text only four significant digits only for reasons of
- space, not time.) This is done without |log|/|exp| which are not (yet?)
- implemented in \xintfracname. The \LaTeX3
- \href{http://www.ctan.org/pkg/l3kernel}{l3fp} package does this with
- |log|/|exp| and is ten times faster, but allows only |16| significant
- figures and the (exactly represented) floating point numbers must have their
- exponents limited to $\pm$\digitstt{9999}.}
-
-\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}, it
-produces the same result as \csa{xintiPow} with stricter assumptions on the
-inputs, and is thus a tiny bit faster.
-
-Within an \csbxint{iiexpr}|..\relax| the infix operator |^| is mapped to
-\csa{xintiiPow}; within an \csbxint{expr}-ession\MyMarginNote{corr. of the
- previous doc.} it is mapped to \csbxint{Pow}
-(as extended by \xintfracname); in \csbxint{floatexpr}, it is mapped to
-\csbxint{FloatPower}.
-
-
-
\subsection{\csbh{xintSgnFork}}\label{xintSgnFork}
%{\small New with release |1.07|. See also \csbxint{ifSgn}.\par}
@@ -7038,7 +7828,7 @@ expanding to either |-1|, |0| or |1| (a count register must be
prefixed by |\the| and a |\numexpr...\relax| also must be prefixed by
|\the|). This utility is provided to help construct expandable macros
choosing depending on a condition which one of the package macros to
-use, or which values to confer to their arguments.
+use, or which values to confer to their arguments.
\subsection{\csbh{xintifSgn}}\label{xintifSgn}
%{\small New with release |1.09a|.\par}
@@ -7075,8 +7865,7 @@ checks if the first mandatory argument |N| (a number, possibly a fraction if
then either executes the first or the second branch. Beware that both branches
must be present.
-
-\subsection{\csbh{xintifTrueAelseB}, \csbh{xint\-ifFalseAelseB}}
+\subsection{\csbh{xintifTrueAelseB}, \csbh{xintifFalseAelseB}}
\label{xintifTrueAelseB}
\label{xintifFalseAelseB}
@@ -7084,20 +7873,17 @@ must be present.
%{\small New with release |1.09c|, renamed in |1.09e|.\par}
\csa{xintifTrueAelseB}\marg{N}\marg{true branch}\marg{false branch}\etype{\Numf
- nn} is a synonym for \csbxint{ifNotZero}.
+ nn} is a synonym for \csbxint{ifNotZero}.
-{\small
+{\small
\noindent 1. with |1.09i|, the synonyms |\xintifTrueFalse| and |\xintifTrue| are
- deprecated
+ deprecated
and will be removed in next release.\par
\noindent 2. These macros have no lowercase versions, use |\xintifzero|,
-|\xintifnotzero|.\par }
+|\xintifnotzero|.\par }
\csa{xintifFalseAelseB}\marg{N}\marg{false branch}\marg{true branch}\etype{\Numf
- nn} is a synonym for \csbxint{ifZero}.
-
-
-
+ nn} is a synonym for \csbxint{ifZero}.
\subsection{\csbh{xintifCmp}}\label{xintifCmp}
%{\small New with release |1.09e|.\par}
@@ -7127,185 +7913,159 @@ particular decimal numbers) by \xintfracname.
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
- loaded their argument is first given to \csbxint{Num} and may thus be
- a fraction, as long as it is in fact an integer in disguise.
-\end{framed}
-
\subsection{\csbh{xintifOdd}}\label{xintifOdd}
%{\small New with release |1.09e|.\par}
\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.
+\begin{framed}
+ The macros described next are all integer-only on input. Those with |ii| in
+ their names skip the \csbxint{Num} parsing. The others, with \xintfracname
+ loaded, can have fractions as arguments, which will get truncated to
+ integers via \csbxint{TTrunc}. On output, the macros here always produce
+ integers (with no |/B[N]|).
+\end{framed}
-\subsection{\csbh{xintFac}}\label{xintiFac}
-
-\csa{xintFac\x}\etype{\numx} returns the factorial. It is an error if the
-argument is negative or at least @10^5@.% avant 1.09j c'était 1000000.
+\subsection{\csbh{xintiFac}}\label{xintiFac}
-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.
+|\xintiFac|\x\etype{\numx} returns the factorial. It is an error if the
+argument is negative or at least $10^5$.% avant 1.09j c'était 1000000.
-% the construct |\xintFac{\xintAdd {2}{3}}| will fail,
-% use either |\xintFac{\xintiAdd {2}{3}}| or |\xintFac{\xintNum{\xintAdd
-% {2}{3}}}|.
+|\xintFac| is a variant using |\xintNum| and thus, when \xintfracname is
+loaded, accepting a fraction on input (but it truncates it first).
% temps obsolètes, mettre à jour
-% On my laptop @1000!@ (2568 digits)
-% is computed in a little less than ten seconds, @2000!@ (5736
+% On my laptop $1000!$ (2568 digits)
+% is computed in a little less than ten seconds, $2000!$ (5736
% digits) is computed in a little less than one hundred seconds, and
-% @3000!@ (which has 9131 digits) needs close to seven minutes\dots
-% I have no idea how much time @10000!@ would need (do rather
-% @9999!@ if you can, the algorithm has some overhead at the
-% transition from @N=9999@ to @10000@ and higher; @10000!@ has 35660
-% digits). Not to mention @100000!@ which, from the Stirling formula,
+% $3000!$ (which has 9131 digits) needs close to seven minutes\dots
+% I have no idea how much time $10000!$ would need (do rather
+% $9999!$ if you can, the algorithm has some overhead at the
+% transition from $N=9999$ to $10000$ and higher; $10000!$ has 35660
+% digits). Not to mention $100000!$ which, from the Stirling formula,
% should have 456574 digits.
-\subsection{\csbh{xintDivision}}\label{xintDivision}\label{xintiiDivision}
-
-\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}\label{xintiiQuo}
-
-\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}\label{xintiiRem}
-
-\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{xintiiFDg}}\label{xintFDg}\label{xintiiFDg}
-\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}.
+|\xintiiFDg|\n\etype{f} returns the first digit (most significant) of the
+decimal expansion. It skips the overhead of parsing via \csbxint{Num}. The
+variant \csa{xintFDg}\etype{\Numf} uses |\xintNum| and gets extended by
+\xintfracname.
-\subsection{\csbh{xintLDg}}\label{xintLDg}\label{xintiiLDg}
+\subsection{\csbh{xintiiLDg}}\label{xintLDg}\label{xintiiLDg}
-\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}.
+|\xintiiLDg|\n\etype{f} returns the least significant digit. When the number
+is positive, this is the same as the remainder in the euclidean division by
+ten. It skips the overhead of parsing via \csbxint{Num}. The variant
+\csa{xintLDg}\etype{\Numf} uses |\xintNum| and gets extended by \xintfracname.
-\subsection{\csbh{xintMON}, \csbh{xintMMON}}
+\subsection{\csbh{xintiiMON}, \csbh{xintiiMMON}}
\label{xintMON}\label{xintMMON}\label{xintiiMON}\label{xintiiMMON}
%{\small New in version |1.03|.\par}
-\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}}}
-The variants \csa{xintiiMON}\etype{f} and \csa{xintiiMMON}
-skip the overhead of parsing via \csbxint{Num}.
+|\xintiiMON|\n\etype{f} returns |(-1)^N| and |\xintiiMMON|\n{} returns
+|(-1)^{N-1}|. They skip the overhead of parsing via \csbxint{Num}.
+%
+\leftedline{|\xintiiMON {-280914019374101929}|\dtt{=\xintiiMON
+ {280914019374101929}}, |\xintiiMMON
+ {-280914019374101929}|\dtt{=\xintiiMMON {280914019374101929}}}
-\subsection{\csbh{xintOdd}}\label{xintOdd}\label{xintiiOdd}
+The variants
+\csa{xintMON}\etype{\Numf} and \csa{xintMMON} use |\xintNum| and get extended
+to fractions by \xintfracname.
-\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}
+\subsection{\csbh{xintiiOdd}}\label{xintOdd}\label{xintiiOdd}
+|\xintiiOdd|\n\etype{f} is 1 if the number is odd and 0 otherwise. It skips
+the overhead of parsing via \csbxint{Num}. \csa{xintOdd}\etype{\Numf} is the
+variant using |\xintNum| and extended to fractions by \xintfracname.
-\subsection{\csbh{xintiSqrt}, \csbh{xintiSquareRoot}}\label{xintiSqrt}
-\label{xintiSquareRoot}
+\subsection{\csbh{xintiSqrt}, \csbh{xintiiSqrt}, \csbh{xintiSquareRoot},
+ \csbh{xintiiSquareRoot}}\label{xintiSqrt}\label{xintiiSqrt}
+\label{xintiSquareRoot}\label{xintiiSquareRoot}
%{\small New with |1.08|.\par}
-\xintAssign\xintiSquareRoot {17000000000000000000000000}\to\A\B
-
-\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}}}
-\centeredline{|\xintiSqrt {\xintDSH {-120}{2}}=|}%
-\centeredline{\digitstt{\xintiSqrt {\xintDSH {-120}{2}}}}
-\csa{xintiSquareRoot\n}\etype{\Numf} returns |{M}{d}| with |d>0|, |M^2-d=N| and
+\xintAssign\xintiiSquareRoot {17000000000000000000000000}\to\A\B
+
+\noindent|\xintiSqrt|\n\etype{\Numf} returns the largest integer whose
+square is at most equal to |N|. |\xintiiSqrt| is the variant skipping
+the |\xintNum| overhead.\etype{f}
+%
+%
+\leftedline{|\xintiSqrt
+ {2000000000000000000000000000000000000}=|%
+ \dtt{\xintiSqrt{2000000000000000000000000000000000000}}}
+%
+\leftedline{|\xintiSqrt {3000000000000000000000000000000000000}=|%
+ \dtt{\xintiSqrt{3000000000000000000000000000000000000}}}
+%
+\leftedline{|\xintiSqrt {\xintDSH {-120}{2}}=|}%
+%
+\leftedline{\dtt{\xintiSqrt {\xintDSH {-120}{2}}}}
+|\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
+%
+\leftedline{|\xintAssign\xintiSquareRoot
{17000000000000000000000000}\to\A\B|}%
-\centeredline{|\xintiSub{\xintiSqr\A}\B=\A^2-\B|}%
-\centeredline{\digitstt{\xintiSub{\xintiSqr\A}\B=\A\string^2-\B}} A rational
+%
+\leftedline{|\xintiSub{\xintiSqr\A}\B=\A^2-\B|}%
+%
+\leftedline{\dtt{\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.
-
+roots of floating point numbers.
\begin{framed}
The macros described next are strictly for integer-only arguments. These
- arguments are \emph{not} filtered via \csbxint{Num}.
+ arguments are \emph{not} filtered via \csbxint{Num}. The macros are not
+ usable with fractions, even with \xintfracname loaded.
\end{framed}
-\subsection{\csbh{xintInc}, \csbh{xintDec}}
-\label{xintInc}
-\label{xintDec}
-%{\small New with |1.08|.\par}
-
-\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}
-\csa{xintDouble\n}\etype{f} returns |2N| and \csa{xintHalf\n} is |N/2| rounded
+|\xintDouble|\n\etype{f} returns |2N| and |\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}\etype{f} is decimal shift left, \emph{i.e.} multiplication by
+|\xintDSL|\n\etype{f} is decimal shift left, \emph{i.e.} multiplication by
ten.
\subsection{\csbh{xintDSR}}\label{xintDSR}
-\csa{xintDSR\n}\etype{f} is decimal shift right, \emph{i.e.} it removes the last
+|\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}\etype{\numx f} is parametrized decimal shift. When |x| is
+|\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
+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}
-\csa{xintDSHr\x\n}\etype{\numx f} expects |x| to be zero or positive and it
+|\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:
+|\xintDSH|\x\n{} in the following manner:
\begin{itemize}
\item if |N| is
positive or zero, |Q| and |R| are the quotient and remainder in
the euclidean division by |10^x| (obtained in a more efficient
- manner than using \csa{xintDivision}),
+ manner than using \csa{xintiDivision}),
\item if |N| is negative let
|Q1| and |R1| be the quotient and remainder in the euclidean
division by |10^x| of the absolute value of |N|. If |Q1|
@@ -7317,58 +8077,51 @@ So one has |N = 10^x Q + R| if |Q| turns out to be zero or
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}\etype{\numx f} for |x| negative is exactly as
-\csa{xintDSH\x\n}, \emph{i.e.} multiplication by @10^{-@|x|@}@. For |x| zero or
+|\xintDSx|\x\n\etype{\numx f} for |x| negative is exactly as
+|\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
+braces. So |Q| is |\xintDSH|\x\n, and |R| is |\xintDSHr|\x\n, but computed
simultaneously.
-\begin{flushleft}
- \xintAssign\xintDSx {-1}{-123456789}\to\M
- \noindent{|\xintAssign\xintDSx {-1}{-123456789}\to\M|}\\
- |\meaning\M: |\digitstt{\meaning\M}.\\
- \xintAssign\xintDSx {-20}{1234567689}\to\M
- {|\xintAssign\xintDSx {-20}{123456789}\to\M|}\\
- |\meaning\M: |\digitstt{\meaning\M}.\\
- \xintAssign\xintDSx{0}{-123004321}\to\Q\R
- {|\xintAssign\xintDSx {0}{-123004321}\to\Q\R|}\\
- \noindent|\meaning\Q: |\digitstt{\meaning\Q}, |\meaning\R:
- |\digitstt{\meaning\R.}\\
- |\xintDSH {0}{-123004321}|\digitstt{=\xintDSH {0}{-123004321}},
- |\xintDSHr {0}{-123004321}|\digitstt{=\xintDSHr {0}{-123004321}}\\
- \xintAssign\xintDSx {6}{-123004321}\to\Q\R
- {|\xintAssign\xintDSx {6}{-123004321}\to\Q\R|}\\
- |\meaning\Q: |\digitstt{\meaning\Q},
- |\meaning\R: |\digitstt{\meaning\R.}\\
- |\xintDSH {6}{-123004321}|\digitstt{=\xintDSH {6}{-123004321}},
- |\xintDSHr {6}{-123004321}|\digitstt{=\xintDSHr {6}{-123004321}}\\
- \xintAssign\xintDSx {8}{-123004321}\to\Q\R
- {|\xintAssign\xintDSx {8}{-123004321}\to\Q\R|}\\
- |\meaning\Q: |\digitstt{\meaning\Q},
- |\meaning\R: |\digitstt{\meaning\R.} \\
- |\xintDSH {8}{-123004321}|\digitstt{=\xintDSH {8}{-123004321}},
- |\xintDSHr {8}{-123004321}|\digitstt{=\xintDSHr {8}{-123004321}}\\
- \xintAssign\xintDSx {9}{-123004321}\to\Q\R
- {|\xintAssign\xintDSx {9}{-123004321}\to\Q\R|}\\
- |\meaning\Q: |\digitstt{\meaning\Q},
- |\meaning\R: |\digitstt{\meaning\R.}\\
- |\xintDSH {9}{-123004321}|\digitstt{=\xintDSH {9}{-123004321}},
- |\xintDSHr {9}{-123004321}|\digitstt{=\xintDSHr {9}{-123004321}}\\
-\end{flushleft}
+ \xintAssign\xintDSx {-1}{-123456789}\to\M
+\leftedline{|\xintAssign\xintDSx {-1}{-123456789}\to\M|}
+\leftedline{|\meaning\M: |\dtt{\meaning\M}.}
+ \xintAssign\xintDSx {-20}{1234567689}\to\M
+\leftedline{|\xintAssign\xintDSx {-20}{123456789}\to\M|}
+\leftedline{|\meaning\M: |\dtt{\meaning\M}.}
+ \xintAssign\xintDSx{0}{-123004321}\to\Q\R
+\leftedline{|\xintAssign\xintDSx {0}{-123004321}\to\Q\R|}
+\leftedline{|\meaning\Q: |\dtt{\meaning\Q}, |\meaning\R:|\dtt{\meaning\R.}}
+\leftedline{|\xintDSH {0}{-123004321}|\dtt{=\xintDSH {0}{-123004321}},
+|\xintDSHr {0}{-123004321}|\dtt{=\xintDSHr {0}{-123004321}}}
+ \xintAssign\xintDSx {6}{-123004321}\to\Q\R
+\leftedline{|\xintAssign\xintDSx {6}{-123004321}\to\Q\R|}
+\leftedline{|\meaning\Q: |\dtt{\meaning\Q},|\meaning\R: |\dtt{\meaning\R.}}
+\leftedline{|\xintDSH {6}{-123004321}|\dtt{=\xintDSH {6}{-123004321}},
+|\xintDSHr {6}{-123004321}|\dtt{=\xintDSHr {6}{-123004321}}}
+ \xintAssign\xintDSx {8}{-123004321}\to\Q\R
+\leftedline{|\xintAssign\xintDSx {8}{-123004321}\to\Q\R|}
+\leftedline{|\meaning\Q: |\dtt{\meaning\Q},|\meaning\R: |\dtt{\meaning\R.}}
+\leftedline{|\xintDSH {8}{-123004321}|\dtt{=\xintDSH {8}{-123004321}},
+|\xintDSHr {8}{-123004321}|\dtt{=\xintDSHr {8}{-123004321}}}
+ \xintAssign\xintDSx {9}{-123004321}\to\Q\R
+\leftedline{|\xintAssign\xintDSx {9}{-123004321}\to\Q\R|}
+\leftedline{|\meaning\Q: |\dtt{\meaning\Q},|\meaning\R: |\dtt{\meaning\R.}}
+\leftedline{|\xintDSH {9}{-123004321}|\dtt{=\xintDSH {9}{-123004321}},
+|\xintDSHr {9}{-123004321}|\dtt{=\xintDSHr {9}{-123004321}}}
\subsection{\csbh{xintDecSplit}}\label{xintDecSplit}
%{\small This has been modified in release |1.01|.\par}
-\csa{xintDecSplit\x\n}\etype{\numx f} cuts the number into two pieces (each one
+|\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
zeroes 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|).
+remaining digits (\emph{empty} if $|x|$ equals or exceeds the length of |N|).
Leading zeroes 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.
@@ -7376,51 +8129,57 @@ original number is always the concatenation of the first and second piece.
change. I am still hesitant about what to do with the sign of a
negative |N|.\par}
-
\xintAssign\xintDecSplit {0}{-123004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {0}{-123004321}\to\L\R|}
-\noindent|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {0}{-123004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {5}{-123004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {5}{-123004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {5}{-123004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {9}{-123004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {9}{-123004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {9}{-123004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {10}{-123004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {10}{-123004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {10}{-123004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {-5}{-12300004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {-5}{-12300004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {-5}{-12300004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {-11}{-12300004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {-11}{-12300004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {-11}{-12300004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\xintAssign\xintDecSplit {-15}{-12300004321}\to\L\R
-\centeredline{|\xintAssign\xintDecSplit {-15}{-12300004321}\to\L\R|}
-|\meaning\L: |\digitstt{\meaning\L}, |\meaning\R: |\digitstt{\meaning\R.}
+\leftedline{|\xintAssign\xintDecSplit {-15}{-12300004321}\to\L\R|}
+\leftedline{|\meaning\L: |\dtt{\meaning\L}, |\meaning\R: |\dtt{\meaning\R.}}
\subsection{\csbh{xintDecSplitL}}\label{xintDecSplitL}
-\csa{xintDecSplitL\x\n}\etype{\numx f} returns the first piece after the action
+|\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}\etype{\numx f} returns the second piece after the action
+|\xintDecSplitR|\x\n\etype{\numx f} returns the second piece after the action
of \csa{xintDecSplit}.
+\subsection{\csbh{xintiiE}}\label{xintiiE}
+
+|\xintiiE|\n\x\etype{f\numx } serves to add zeros to the right of |N|.
+\begin{everbatim*}
+\xintiiE {123}{80}
+\end{everbatim*}
\section{Commands of the \xintfracname package}
\label{sec:frac}
-\def\x{\string{x\string}}
+\localtableofcontents
+
+\def\x{|{x}|}
This package was first included in release |1.03| (|2013/04/14|) of the
\xintname bundle. The general rule of the bundle that each macro first expands
(what comes first, fully) each one of its arguments applies.
-
|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
@@ -7430,7 +8189,7 @@ which are explained in the previous \hyperref[sec:useofcount]{Use of count
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
+It
may thus be a count register or something like |4*\count 255 + 17|, etc..., but
must expand to an integer obeying the \TeX{} bound.
@@ -7439,31 +8198,38 @@ and the |A/B[n]| format for all other fraction macros, with the exception of
\csbxint{Trunc}, {\color{blue}\string\xint\-Round} (which produce decimal
numbers) and \csbxint{Irr}, \csbxint{Jrr}, \csbxint{RawWithZeros} (which returns
an |A/B| with no trailing |[n]|, and prints the |B| even if it is |1|), and
-\csbxint{PRaw} which does not print the |[n]| if |n=0| or the |B| if |B=1|.
+\csbxint{PRaw} which does not print the |[n]| if |n=0| or the |B| if |B=1|.
To be certain to print an integer output without trailing |[n]| nor fraction
slash, one should use either |\xintPRaw {\xintIrr {f}}| or |\xintNum {f}| when
it is already known that |f| evaluates to a (big) integer. For example
|\xintPRaw {\xintAdd {2/5}{3/5}}| gives a perhaps disappointing
-\digitstt{\xintPRaw {\xintAdd {2/5}{3/5}}}\footnote{yes, \csbxint{Add} blindly
- multiplies denominators... }, whereas |\xintPRaw {\xintIrr {\xintAdd
- {2/5}{3/5}}}| returns \digitstt{\xintPRaw {\xintIrr {\xintAdd
+\dtt{\xintPRaw {\xintAdd {2/5}{3/5}}}%
+%
+%
+%
+whereas |\xintPRaw {\xintIrr {\xintAdd
+ {2/5}{3/5}}}| returns \dtt{\xintPRaw {\xintIrr {\xintAdd
{2/5}{3/5}}}}. As we knew the result was an integer we could have used
|\xintNum {\xintAdd {2/5}{3/5}}=|\xintNum {\xintAdd {2/5}{3/5}}.
Some macros (such as \csbxint{iTrunc},
\csbxint{iRound}, and \csbxint{Fac}) always produce directly integers on output.
-
-\localtableofcontents
-
\subsection{\csbh{xintNum}}\label{xintNum}
-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 zeroes to get an explicit integer.
+The macro\etype{f} from \xintname is made a synonym to \csbxint{TTrunc}.
+(\textcolor[named]{PineGreen}{Changed!})\footnote{In earlier releases than
+ |1.1|, \csbxint{Num} did \csbxint{Irr} and then complained if the
+ denominator was not |1|, else, it silently removed the denominator.}
+
+The original (which
+normalizes big integers to strict format) is still 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 according to its definition add all the needed zeroes to
+produce an explicit integer in strict format.
\subsection{\csbh{xintifInt}}\label{xintifInt}
%{\small New with release |1.09e|.\par}
@@ -7476,97 +8242,120 @@ although one of the two (or both, but why then?) may well be an empty brace pair
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\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}}}
-
+%
+\leftedline {|\xintLen {201710/298219}|\dtt{=\xintLen {201710/298219}},
+|\xintLen {1234/1}|\dtt{=\xintLen {1234/1}}, |\xintLen {1234}|%
+ \dtt{=\xintLen {1234}}}
\subsection{\csbh{xintRaw}}\label{xintRaw}
%{\small New with release |1.04|.\par}
%{\small \color{red}MODIFIED IN |1.07|.\par}
-This macro `prints' the\etype{\Ff}
+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
-printed even if it has value |1|.
-\centeredline{|\xintRaw{\the\numexpr 571*987\relax.123e-10/\the\numexpr
- -201+59\relax e-7}=|}%
-\centeredline{\digitstt{\xintRaw{\the\numexpr
+printed even if it has value |1|.
+%
+\leftedline{|\xintRaw{\the\numexpr 571*987\relax.123e-10/\the\numexpr
+ -201+59\relax e-7}=|}
+%
+\leftedline{\dtt{\xintRaw{\the\numexpr
571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}}
\subsection{\csbh{xintPRaw}}\label{xintPRaw}
%{\small New in |1.09b|.\par}
|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.
+if |n=0| and does \emph{not} show the |B| if |B=1|.
+% %
+%
+\leftedline{|\xintPRaw {123e10/321e10}=|\dtt{\xintPRaw {123e10/321e10}}, %
+|\xintPRaw {123e9/321e10}=|\dtt{\xintPRaw {123e9/321e10}}}
+% %
+%
+\leftedline{|\xintPRaw {\xintIrr{861/123}}=|\dtt{\xintPRaw{\xintIrr{861/123}}}\ vz.\
+ |\xintIrr{861/123}=|\dtt{\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
+|\xintNum{f}| or |\xintPRaw{\xintIrr{f}}| which produces the same output only
+if |f| is an integer (after simplication).
\subsection{\csbh{xintNumerator}}\label{xintNumerator}
This returns\etype{\Ff} the numerator corresponding to the internal
representation of a fraction, with positive powers of ten converted into zeroes
-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}}}
-\centeredline{|\xintNumerator {178000e-3/256e5}|\digitstt{=\xintNumerator
- {178000e-3/256e5}}} \centeredline{|\xintNumerator
- {178.000/25600000}|\digitstt{=\xintNumerator {178.000/25600000}}} As shown by
+of this numerator: %
+%
+\leftedline{|\xintNumerator
+ {178000/25600000[17]}|\dtt{=\xintNumerator {178000/25600000[17]}}}
+%
+\leftedline{|\xintNumerator {312.289001/20198.27}|%
+ \dtt{=\xintNumerator {312.289001/20198.27}}}
+%
+\leftedline{|\xintNumerator {178000e-3/256e5}|\dtt{=\xintNumerator
+ {178000e-3/256e5}}} %
+%
+\leftedline{|\xintNumerator
+ {178.000/25600000}|\dtt{=\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\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}}}
-\centeredline{|\xintDenominator {178000e-3/256e5}|\digitstt{=\xintDenominator
- {178000e-3/256e5}}} \centeredline{|\xintDenominator
- {178.000/25600000}|\digitstt{=\xintDenominator {178.000/25600000}}} As shown
+representation of the fraction:%
+%
+\footnote{recall that the |[]| construct excludes
+ presence of a decimal point.}
+%
+\leftedline{|\xintDenominator
+ {178000/25600000[17]}|\dtt{=\xintDenominator {178000/25600000[17]}}}
+%
+\leftedline{|\xintDenominator {312.289001/20198.27}|%
+ \dtt{=\xintDenominator {312.289001/20198.27}}}
+%
+\leftedline{|\xintDenominator {178000e-3/256e5}|\dtt{=\xintDenominator
+ {178000e-3/256e5}}} %
+%
+\leftedline{|\xintDenominator
+ {178.000/25600000}|\dtt{=\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@
+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}
-This macro `prints'\etype{\Ff} 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}|.
-\centeredline{|\xintRawWithZeros{\the\numexpr 571*987\relax.123e-10/\the\numexpr
- -201+59\relax e-7}=|}%
-\centeredline{\digitstt{\xintRawWithZeros{\the\numexpr
- 571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}}
-
+%
+\leftedline{|\xintRawWithZeros{\the\numexpr 571*987\relax.123e-10/\the\numexpr
+ -201+59\relax e-7}=|}
+%
+\leftedline{\dtt{\xintRawWithZeros{\the\numexpr
+ 571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}}
\subsection{\csbh{xintREZ}}\label{xintREZ}
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
+its numerator and denominator: %
+%
+\leftedline{|\xintREZ
+ {178000/25600000[17]}|\dtt{=\xintREZ {178000/25600000[17]}}}
+%
+\leftedline{|\xintREZ {1780000000000e30/2560000000000e15}|\dtt{=\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,\etype{\Ff} to be used in math mode only. It
@@ -7588,8 +8377,10 @@ being in fact integers.)
%{\small New with release |1.04|.\par}
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}\]|}
+sign put in front, not in the numerator. %
+%
+\leftedline{|\[\xintFrac
+ {-355/113}=\xintSignedFrac {-355/113}\]|}
\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\]
\subsection{\csbh{xintFwOver}}\label{xintFwOver}
@@ -7608,17 +8399,20 @@ $\xintFwOver {178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver
%{\small New with release |1.04|.\par}
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}\]|}
+sign put in front, not in the numerator. %
+%
+\leftedline{|\[\xintFwOver
+ {-355/113}=\xintSignedFwOver {-355/113}\]|}
\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\]
-
\subsection{\csbh{xintIrr}}\label{xintIrr}
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]}$}%
+%
+\leftedline{|\xintIrr {178.256/256.178}|%
+ \dtt{=\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
and 5, so input such as |\xintIrr {2/3[100]}| will make \xintfracname do the
Euclidean division of |2|\raisebox{.5ex}{|.|}|10^{100}| by |3|, which is a bit
@@ -7634,45 +8428,53 @@ trailing |/1|. For display in math mode, use rather |\xintFrac{\xintIrr {f}}| or
\subsection{\csbh{xintJrr}}\label{xintJrr}
This also puts the fraction\etype{\Ff} into its unique irreducible form:
-\centeredline{|\xintJrr {178.256/256.178}|%
- \digitstt{=\xintJrr {178.256/256.178}}}%
+%
+\leftedline{|\xintJrr {178.256/256.178}|%
+ \dtt{=\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}/\xintiiPrdExpr
-{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }|\digitstt{=%
+{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }|\dtt{=%
\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.
Starting with release |1.08|, \csa{xintJrr} does not remove the trailing |/1|
-when the output is an integer.
-
+when the output is an integer.
\subsection{\csbh{xintTrunc}}\label{xintTrunc}
\csa{xintTrunc}|{x}{f}|\etype{\numx\Ff} returns the integral part, a dot, and
then the first |x| digits of the decimal
expansion of the fraction |f|. The
-argument |x| should be non-negative.
+argument |x| should be non-negative.
-In the special case when |f| evaluates to @0@, the output is @0@ with no decimal
+In the special case when |f| evaluates to $0$, the output is $0$ with no decimal
point nor decimal digits, else the post decimal mark digits are always printed.
A non-zero negative |f| which is smaller in absolute value than |10^{-x}| will
-give @-0.000...@.
-\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
- {10}{\xintPow {-11}{-11}}}}%
-\centeredline{|\xintTrunc {12}{\xintPow {-11}{-11}}|\digitstt{=\xintTrunc
- {12}{\xintPow {-11}{-11}}}}%
-\centeredline{|\xintTrunc {12}{\xintAdd {-1/3}{3/9}}|\digitstt{=\xintTrunc
+give $-0.000...$.
+%
+\leftedline{|\xintTrunc
+ {16}{-803.2028/20905.298}|\dtt{=\xintTrunc {16}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintTrunc {20}{-803.2028/20905.298}|\dtt{=\xintTrunc
+ {20}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintTrunc {10}{\xintPow {-11}{-11}}|\dtt{=\xintTrunc
+ {10}{\xintPow {-11}{-11}}}}
+%
+\leftedline{|\xintTrunc {12}{\xintPow {-11}{-11}}|\dtt{=\xintTrunc
+ {12}{\xintPow {-11}{-11}}}}
+%
+\leftedline{|\xintTrunc {12}{\xintAdd {-1/3}{3/9}}|\dtt{=\xintTrunc
{12}{\xintAdd {-1/3}{3/9}}}} The digits printed are exact up to and
-including the last one.
+including the last one.
% The identity |\xintTrunc {x}{-f}=-\xintTrunc {x}{f}|
-% holds.\footnote{Recall that |-\string\macro| is not valid as argument to any
+% holds.%
+%
+% \footnote{Recall that |-\string\macro| is not valid as argument to any
% package macro, one must use |\string\xintOpp\string{\string\macro\string}| or
% |\string\xintiOpp\string{\string\macro\string}|, except inside
% |\string\xinttheexpr...\string\relax|.}
@@ -7680,19 +8482,28 @@ including the last one.
\subsection{\csbh{xintiTrunc}}\label{xintiTrunc}
\csa{xintiTrunc}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x|
-times what \csa{xintTrunc}|{x}{f}| would produce.
-%
-\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}}}}%
+times what \csa{xintTrunc}|{x}{f}| would produce.
+%
+\leftedline{|\xintiTrunc
+ {16}{-803.2028/20905.298}|\dtt{=\xintiTrunc {16}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintiTrunc {10}{\xintPow {-11}{-11}}|\dtt{=\xintiTrunc
+ {10}{\xintPow {-11}{-11}}}}
+%
+\leftedline{|\xintiTrunc {12}{\xintPow {-11}{-11}}|\dtt{=\xintiTrunc
+ {12}{\xintPow {-11}{-11}}}}
+%
The difference between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}| is
that the latter never has the decimal mark always present in the former except
-for |f=0|. And \csa{xintTrunc}|{0}{-0.5}| returns ``\digitstt{\xintTrunc
+for |f=0|. And \csa{xintTrunc}|{0}{-0.5}| returns ``\dtt{\xintTrunc
0{-0.5}}'' whereas \csa{xintiTrunc}|{0}{-0.5}| simply returns
-``\digitstt{\xintiTrunc 0{-0.5}}''.
+``\dtt{\xintiTrunc 0{-0.5}}''.
+
+\subsection{\csbh{xintTTrunc}}\label{xintTTrunc}
+
+\csa{xintTTrunc}|{f}|\etype{\Ff} truncates to an integer (truncation towards
+zero; \textcolor[named]{PineGreen}{New}). This is the same as |\xintiTrunc
+{0}{f}| and as \csbxint{Num}.
\subsection{\csbh{xintXTrunc}}\label{xintXTrunc}
@@ -7702,11 +8513,11 @@ for |f=0|. And \csa{xintTrunc}|{0}{-0.5}| returns ``\digitstt{\xintTrunc
\fexpan dable, as is indicated by the hollow star in the margin. It can not be
used as argument to the other package macros, but is designed to be used inside
an |\edef|, or rather a |\write|. Here is an example session where the user
-after some warming up checks that @1/66049=1/257^2@ has period @257*256=65792@
+after some warming up checks that $1/66049=1/257^2$ has period $257*256=65792$
(it is also checked here that this is indeed the smallest period).
%
\begingroup\small
-\dverb|@
+\everb|@
xxx:_xint $ etex -jobname worksheet-66049
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.
@@ -7758,39 +8569,41 @@ YES!
*\immediate\write-1 {10\string^65792-1=\xintiiMul {\ZA}{66049}}
-*% This was slow :( I should write a multiplication, still completely
+*% This was slow :( I should write a multiplication, still completely
*% expandable, but not f-expandable, which could be much faster on such cases.
*\bye
No pages of output.
Transcript written on worksheet-66049.log.
-xxx:_xint $ |
+xxx:_xint $
+|
\endgroup
Using |\xintTrunc| rather than |\xintXTrunc| would be hopeless on such long
outputs (and even |\xintXTrunc| needed of the order of seconds to complete
here). But it is not worth it to use |\xintXTrunc| for less than hundreds of
-digits.
+digits.
Fraction arguments to |\xintXTrunc| corresponding to a |A/B[N]| with a negative
|N| are treated somewhat less efficiently (additional memory impact) than for positive or zero |N|. This is because the algorithm tries to work with the
smallest denominator hence does not extend |B| with zeroes, and technical
-reasons lead to the use of some tricks.\footnote{Technical note: I do not
- provide an |\char92 xintXFloat| because this would almost certainly mean
- having to clone the entire core division routines into a ``long division''
- variant. But this could have given another approach to the implementation of
- |\char 92 xintXTrunc|, especially for the case of a negative |N|. Doing these
- things with \TeX{} is an effort. Besides an
- |\char 92 xintXFloat| would be interesting only if also for example the square
- root routine was provided in an |X| version (I have not given thought to
- that). If feasible |X| routines would be interesting in the |\char 92
- xintexpr| context where things are expanded inside |\char92 csname..\char92
- endcsname|.}
+reasons lead to the use of some tricks.%
+%
+\footnote{Technical note: I do not provide an |\xintXFloat|
+ because this would almost certainly mean having to clone the entire
+ core division routines into a ``long division'' variant. But this
+ could have given another approach to the implementation of
+ |\xintXTrunc|, especially for the case of a negative |N|. Doing these
+ things with \TeX{} is an effort. Besides an |\xintXFloat|
+ would be interesting only if also for example the square root routine
+ was provided in an |X| version (I have not given thought to that). If
+ feasible |X| routines would be interesting in the |\xintexpr|
+ context where things are expanded inside |\csname..\endcsname|.}
Contrarily to \csbxint{Trunc}, in the case of the second argument revealing
-itself to be exactly zero, \csbxint{XTrunc} will output @0.000...@, not @0@.
-Also, the first argument must be at least @1@.
+itself to be exactly zero, \csbxint{XTrunc} will output $0.000...$, not $0$.
+Also, the first argument must be at least $1$.
\subsection{\csbh{xintRound}}\label{xintRound}
@@ -7801,90 +8614,126 @@ 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
+zero. %
+%
+\leftedline{|\xintRound {16}{-803.2028/20905.298}|\dtt{=\xintRound
+ {16}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintRound {20}{-803.2028/20905.298}|\dtt{=\xintRound
+ {20}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintRound {10}{\xintPow {-11}{-11}}|\dtt{=\xintRound
+ {10}{\xintPow {-11}{-11}}}}
+%
+\leftedline{|\xintRound {12}{\xintPow {-11}{-11}}|\dtt{=\xintRound
+ {12}{\xintPow {-11}{-11}}}}
+%
+\leftedline{|\xintRound {12}{\xintAdd {-1/3}{3/9}}|\dtt{=\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}}
+%
+\leftedline{\dtt{\xintTrunc {50}{\xintPow {-11}{-11}}\dots}}
\subsection{\csbh{xintiRound}}\label{xintiRound}
%{\small New with release |1.04|.\par}
\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}}}}%
+times what \csa{xintRound}|{x}{f}| would return. %
+%
+\leftedline{|\xintiRound
+ {16}{-803.2028/20905.298}|\dtt{=\xintiRound {16}{-803.2028/20905.298}}}
+%
+\leftedline{|\xintiRound {10}{\xintPow {-11}{-11}}|\dtt{=\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
zeroes.)
-\subsection{\csbh{xintFloor}}\label{xintFloor}
+\subsection{\csbh{xintFloor}, \csbh{xintiFloor}}
+\label{xintFloor}\label{xintiFloor}
%{\small New with release |1.09a|.\par}
|\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}}%
+|N|${}\leq{}$|f|. %
+%
+\leftedline{|\xintFloor {-2.13}|\dtt{=\xintFloor
+ {-2.13}}, |\xintFloor {-2}|\dtt{=\xintFloor {-2}}, |\xintFloor
+ {2.13}|\dtt{=\xintFloor {2.13}}
+%
}
-\subsection{\csbh{xintCeil}}\label{xintCeil}
+|\xintiFloor {f}|\etype{\Ff} does the same but without adding the
+|/1[0]|.\inmarg{New}
+%
+\leftedline{|\xintiFloor {-2.13}|\dtt{=\xintiFloor
+ {-2.13}}, |\xintiFloor {-2}|\dtt{=\xintiFloor {-2}}, |\xintiFloor
+ {2.13}|\dtt{=\xintiFloor {2.13}}}
+
+\subsection{\csbh{xintCeil}, \csbh{xintiCeil}}
+\label{xintCeil}\label{xintiCeil}
%{\small New with release |1.09a|.\par}
|\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}}%
+|N|${}>{}$|f|. %
+%
+\leftedline{|\xintCeil {-2.13}|\dtt{=\xintCeil {-2.13}},
+ |\xintCeil {-2}|\dtt{=\xintCeil {-2}}, |\xintCeil
+ {2.13}|\dtt{=\xintCeil {2.13}}
+%
}
+|\xintiCeil {f}|\etype{\Ff} does the same but without adding the
+|/1[0]|.\inmarg{New}
+
+
\subsection{\csbh{xintTFrac}}\label{xintTFrac}
\csa{xintTFrac}|{f}|\etype{\Ff} returns the fractional part,
-|f=trunc(f)+frac(f)|.
+|f=trunc(f)+frac(f)|.
The |T| stands for `Trunc', and there could similar macros associated to
`Round', `Floor', and `Ceil'. Inside |\xintexpr..\relax|, the function |frac| is
mapped to \csa{xintTFrac}. Inside |\xint|\-|floatexpr..\relax|, |frac| first
-applies
-\csa{xintTFrac} to its argument (which may be in float format, or
+applies
+\csa{xintTFrac} to its argument (which may be in float format, or
an exact fraction), and only next makes the float conversion.
-\centeredline{|\xintTFrac {1235/97}|\digitstt{=\xintTFrac {1235/97}}\quad
- |\xintTFrac {-1235/97}|\digitstt{=\xintTFrac {-1235/97}}}
-\centeredline{|\xintTFrac {1235.973}|\digitstt{=\xintTFrac {1235.973}}\quad
- |\xintTFrac {-1235.973}|\digitstt{=\xintTFrac {-1235.973}}}
-\centeredline{|\xintTFrac {1.122435727e5}|%
- \digitstt{=\xintTFrac {1.122435727e5}}}
-
+%
+\leftedline{|\xintTFrac {1235/97}|\dtt{=\xintTFrac {1235/97}}\quad
+ |\xintTFrac {-1235/97}|\dtt{=\xintTFrac {-1235/97}}}
+%
+\leftedline{|\xintTFrac {1235.973}|\dtt{=\xintTFrac {1235.973}}\quad
+ |\xintTFrac {-1235.973}|\dtt{=\xintTFrac {-1235.973}}}
+%
+\leftedline{|\xintTFrac {1.122435727e5}|%
+ \dtt{=\xintTFrac {1.122435727e5}}}
\subsection{\csbh{xintE}}\label{xintE}
%{\small New with |1.07|.}
-|\xintE {f}{x}|\etype{\Ff\numx} multiplies the fraction |f| by @10^x@. The
+|\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
+%
+\leftedline{|\count 255 123456789 \xintE {10}{\count 255}|\dtt{->\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}}}
+\emph{float} operations:%
+%
+\leftedline{|\xintFloatAdd
+ {1e1234567890}{1}|\dtt{=\xintFloatAdd {1e1234567890}{1}}}
\subsection{\csbh{xintFloatE}}\label{xintFloatE}
%{\small New with |1.097|.}
|\xintFloatE [P]{f}{x}|\etype{{\upshape[\numx]}\Ff\numx} multiplies the input
-|f| by @10^x@, and
+|f| by $10^x$, and
converts it to float format according to the optional first argument or current
value of |\xintDigits|.
-\centeredline{|\xintFloatE {1.23e37}{53}|\digitstt{=\xintFloatE {1.23e37}{53}}}
+%
+\leftedline{|\xintFloatE {1.23e37}{53}|\dtt{=\xintFloatE {1.23e37}{53}}}
\subsection{\csbh{xintDigits}, \csbh{xinttheDigits}}\label{xintDigits}
@@ -7903,19 +8752,21 @@ The macro |\xintFloat [P]{f}|\etype{{\upshape[\numx]}\Ff} has an optional argume
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
-preceded by an optional minus sign and
+preceded by an optional minus sign and
is followed by a dot and |P-1| digits, the trailing zeroes
are not trimmed. In the exceptional case where the
rounding went to the next power of ten, the output is |10.0...0eN|
(with a sign, perhaps). The sole exception is for a zero value, which then gets
output as |0.e0| (in an \csa{xintCmp} test it is the only possible output of
\csa{xintFloat} or one of the `Float' macros which will test positive for
-equality with zero).
-\centeredline{|\xintFloat[32]{1234567/7654321}|%
- \digitstt{=\xintFloat[32]{1234567/7654321}}}
+equality with zero).
+%
+\leftedline{|\xintFloat[32]{1234567/7654321}|%
+ \dtt{=\xintFloat[32]{1234567/7654321}}}
% \pdfresettimer
-\centeredline{|\xintFloat[32]{1/\xintFac{100}}|%
- \digitstt{=\xintFloat[32]{1/\xintFac{100}}}}
+%
+\leftedline{|\xintFloat[32]{1/\xintFac{100}}|%
+ \dtt{=\xintFloat[32]{1/\xintFac{100}}}}
% \the\pdfelapsedtime
% 992: plus rapide que ce que j'aurais cru..
@@ -7924,12 +8775,13 @@ other macros; only its final evaluation is submitted to \csa{xintFloat}: the
inner evaluations of chained arguments are not at all done in `floating'
mode. For this one must use |\xintthefloatexpr|.
-
\subsection{\csbh{xintAdd}}\label{xintAdd}
-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}.
+Computes the addition\etype{\Ff\Ff} of two fractions. To keep for integers the
+integer format on output use \csbxint{iAdd}.
+
+Checks if one denominator is a multiple of the other. Else multiplies the
+denominators.
\subsection{\csbh{xintFloatAdd}}\label{xintFloatAdd}
@@ -7940,13 +8792,15 @@ output will now always be in the form |A/B[n]|. The original is available as
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\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
+Computes the difference\etype{\Ff\Ff} of two fractions (|\xintSub{F}{G}|
+computes |F-G|). To keep for integers the integer format on output use
\csbxint{iSub}.
+Checks if one denominator is a multiple of the other. Else multiplies the
+denominators.
+
\subsection{\csbh{xintFloatSub}}\label{xintFloatSub}
%{\small New with release |1.07|.\par}
@@ -7956,12 +8810,17 @@ output will now always be in the form |A/B[n]|. The original is available as
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\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}.
+Computes the product\etype{\Ff\Ff} of two fractions. To keep for integers the
+integer format on output use \csbxint{iMul}.
+
+No reduction attempted.
+
+\subsection{\csbh{xintSqr}}\label{xintSqr}
+
+Computes the square\etype{\Ff} of one fraction. To maintain for integer input
+an integer format on output use \csbxint{iSqr}.
\subsection{\csbh{xintFloatMul}}\label{xintFloatMul}
@@ -7972,17 +8831,13 @@ integers, and outputting a big integer, is available as \csbxint{iMul}.
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\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}|\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]|.
+Computes the algebraic quotient \etype{\Ff\Ff} of two fractions.
+(|\xintDiv{F}{G}| computes |F/G|). To keep for integers the integer format on
+output use \csbxint{iMul}.
+
+No reduction attempted.
\subsection{\csbh{xintFloatDiv}}\label{xintFloatDiv}
@@ -7993,29 +8848,32 @@ the form |A/B[n]|.
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}
-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}.
+The original\etype{\Numf} is extended to allow a fraction |f| which will be
+truncated first to an integer |n| (non negative and at most |999999|, but
+already |100000!| is prohibitively time-costly). On output |n!| (with no
+trailing |/1[0]|).
+
+The original macro\etype{\numx} (which parses its input via |\numexpr|) is
+still available as \csbxint{iFac}.
\subsection{\csbh{xintPow}}\label{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}.
+\csa{xintPow}{|{f}{g}|}:\etype{\Ff\Numf} computes |f^g| with |f| a fraction
+and |g| possibly also, but |g| will first get truncated to an integer.
+
+The output will now always be in the form |A/B[n]| (even when the exponent
+vanishes: |\xintPow {2/3}{0}|\dtt{=\xintPow{2/3}{0}}).
+
+The original
+is available as \csbxint{iPow}.
-The exponent is allowed to be input as a fraction but it must simplify to an
-integer: |\xintPow {2/3}{10/2}|\digitstt{=\xintPow {2/3}{10/2}}. This integer
-will be checked to not exceed |100000|. Indeed |2^50000| already has
-\digitstt{\xintLen {\xintFloatPow [1]{2}{50000}}} digits, and squaring such a
-number would take hours (I think) with the expandable routine of \xintname.
+The exponent (after truncation to an integer) will be checked to not exceed
+|100000|. Indeed |2^50000| already has \dtt{\xintLen {\xintFloatPow
+ [1]{2}{50000}}} digits, and squaring such a number would take hours (I
+think) with the expandable routine of \xintname.
\subsection{\csbh{xintFloatPow}}\label{xintFloatPow}
%{\small New with |1.07|.\par}
@@ -8031,15 +8889,13 @@ which allows the exponent to be a fraction simplifying to an integer and does
not limit its size. This slightly slower routine is the one to which |^| is
mapped inside |\xintthefloatexpr...\relax|.
-
The macro |\xintFloatPow| chooses dynamically an appropriate number of
digits for the intermediate computations, large enough to achieve the desired
accuracy (hopefully).
-\centeredline{|\xintFloatPow [8]{3.1415}{1234567890}|%
- \digitstt{=\xintFloatPow [8]{3.1415}{1234567890}}}
-
-
+%
+\leftedline{|\xintFloatPow [8]{3.1415}{1234567890}|%
+ \dtt{=\xintFloatPow [8]{3.1415}{1234567890}}}
\subsection{\csbh{xintFloatPower}}\label{xintFloatPower}
%{\small New with |1.07|.\par}
@@ -8048,19 +8904,19 @@ accuracy (hopefully).
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}}}
-\centeredline{|\xintFloatPower [8]{3.1415}{3e9}|%
- \digitstt{=\xintFloatPower [8]{3.1415}{3e9}}} Note that |3e9>2^31|. But the
+%
+\leftedline{|\xintFloatPower [8]{1.000000000001}{1e12}|%
+ \dtt{=\xintFloatPower [8]{1.000000000001}{1e12}}}
+%
+\leftedline{|\xintFloatPower [8]{3.1415}{3e9}|%
+ \dtt{=\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.
-
+\dtt{\number"7FFFFFFF} bound.
Inside an |\xintfloatexpr|-ession, \csa{xintFloatPower} is the function to which
|^| is mapped. The exponent may then be something like |(144/3/(1.3-.5)-37)|
which is, in disguise, an integer.
-
The intermediate multiplications are done with a higher precision than
|\xintDigits| or the optional |P| argument, in order for the
final result to hopefully have the desired accuracy.
@@ -8072,18 +8928,21 @@ final result to hopefully have the desired accuracy.
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}}|}%
-\centeredline{%
- ${}\approx{}$\xintDigits:=50;\digitstt{\xintFloatSqrt {\xintFloatSqrt {2}}}}
+%
+\leftedline{|\xintFloatSqrt [50]{12.3456789e12}|}
+%
+\leftedline{${}\approx{}$\dtt{\xintFloatSqrt [50]{12.3456789e12}}}
+%
+\leftedline{|\xintDigits:=50;\xintFloatSqrt {\xintFloatSqrt {2}}|}
+%
+\leftedline{${}\approx{}$\xintDigits:=50;\dtt{\xintFloatSqrt {\xintFloatSqrt
+ {2}}}}
% maple: 0.351364182864446216166582311675807703715914271812431919843183 1O^7
% 3.5136418286444621616658231167580770371591427181243e6
% maple: 1.18920711500272106671749997056047591529297209246381741301900
% 1.1892071150027210667174999705604759152929720924638e0
-
\xintDigits:=16;
% removed from doc october 22
@@ -8097,26 +8956,35 @@ the value of |\xintDigits|. The computation is done for a precision of at least
% fractions on output. Their outputs will now always be in the form |A/B[n]|. The
% originals are available as \csa{xintiiSum} and \csa{xintiiSumExpr}.
-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}.
+This\etype{f{$\to$}{\lowast\Ff}} computes the sum of fractions. 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}.
+\begin{everbatim*}
+\xintSum {{1282/2196921}{-281710/291927}{4028/28612}}
+\end{everbatim*}
+
+No simplification attempted.
% \subsection{\csbh{xintPrd}, \csbh{xintPrdExpr}}\label{xintPrd}\label{xintPrdExpr}
\subsection{\csbh{xintPrd}}\label{xintPrd}\label{xintPrdExpr}
-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}.
+TThis\etype{f{$\to$}{\lowast\Ff}} computes the product of fractions. 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}.
+
+\begin{everbatim*}
+\xintPrd {{1282/2196921}{-281710/291927}{4028/28612}}
+\end{everbatim*}
+
+No simplification attempted.
\subsection{\csbh{xintCmp}}\label{xintCmp}
%{\small Rewritten in |1.08a|.\par}
-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]|.
+This\etype{\Ff\Ff} compares two fractions |F| and |G| and produces
+|-1|, |0|, or |1| according to |F<G|, |F=G|, |F>G|.
For choosing branches according to the result of comparing |f| and |g|, the
following syntax is recommended: |\xintSgnFork{\xintCmp{f}{g}}{code for
@@ -8128,122 +8996,151 @@ following syntax is recommended: |\xintSgnFork{\xintCmp{f}{g}}{code for
% of zeroes in certain circumstances, causing a serious efficiency impact).
\subsection{\csbh{xintIsOne}}
-See \csbxint{IsOne}\etype{\Ff} (\autoref{xintIsOne}).
+
+This\etype{\Ff} naturally returns |1| if the fraction is |1| and |0| if not.
+
+\begin{everbatim*}
+\xintIsOne {21921379213/21921379213} but \xintIsOne {1.00000000000000000000000000000001}
+\end{everbatim*}
\subsection{\csbh{xintGeq}}\label{xintGeq}
%{\small Rewritten in |1.08a|.\par}
-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:
+This\etype{\Ff\Ff} compares the \emph{absolute values} of two
+fractions.|\xintGeq{f}{g}| returns |1| if {\catcode`| 12 $|f|\geqslant|g|$} and |0|
+if not.
+
+May be used for expandably branching as:
\verb+\xintSgnFork{\xintGeq{f}{g}}{}{code for |f|<|g|}{code for
|f|+$\geqslant$\verb+|g|}+
-
-
\subsection{\csbh{xintMax}}\label{xintMax}
%{\small Rewritten in |1.08a|.\par}
-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}}.
+The maximum of two fractions.\etype{\Ff\Ff} But now |\xintMax {2}{3}|
+returns \dtt{\xintMax {2}{3}}. The original, for use with (possibly big)
+integers only with no need of normalization, is available as \csbxint{iiMax}:
+|\xintiiMax {2}{3}=|\dtt{\xintiMax {2}{3}}.\etype{ff}
+
+There is also \csbxint{iMax}\etype{\Numf\Numf} which works with fractions but
+first truncates them to integers.
-\subsection{\csbh{xintMaxof}}
-See \csbxint{Maxof} (\autoref{xintMaxof}).\etype{f{$\to$}{\lowast\Ff}}
+\begin{everbatim*}
+\xintMax {2.5}{7.2} but \xintiMax {2.5}{7.2}
+\end{everbatim*}
\subsection{\csbh{xintMin}}\label{xintMin}
%{\small Rewritten in |1.08a|.\par}
-The macro is extended to fractions.\etype{\Ff\Ff} The original, for (big)
-integers only, is available as \csbxint{iMin}.
+The maximum of two fractions.\etype{\Ff\Ff} The original, for use with (possibly big)
+integers only with no need of normalization, is available as \csbxint{iiMin}:
+|\xintiiMin {2}{3}=|\dtt{\xintiMin {2}{3}}.\etype{ff}
-\subsection{\csbh{xintMinof}}
-See \csbxint{Minof} (\autoref{xintMinof}).\etype{f{$\to$}{\lowast\Ff}}
+There is also \csbxint{iMin}\etype{\Numf\Numf} which works with fractions but first
+truncates them to integers.
-\subsection{\csbh{xintAbs}}\label{xintAbs}
+\begin{everbatim*}
+\xintMin {2.5}{7.2} but \xintiMin {2.5}{7.2}
+\end{everbatim*}
-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{xintMaxof}}\label{xintMaxof}
-\subsection{\csbh{xintSgn}}\label{xintSgn}
+The maximum of any number of fractions, each within braces, and the whole
+thing within braces. \etype{f{$\to$}{\lowast\Ff}}
-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]|.
+\begin{everbatim*}
+\xintMaxof {{1.23}{1.2299}{1.2301}} and \xintMaxof {{-1.23}{-1.2299}{-1.2301}}
+\end{everbatim*}
-\subsection{\csbh{xintOpp}}\label{xintOpp}
+\subsection{\csbh{xintMinof}}\label{xintMinof}
-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}}.
+The minimum of any number of fractions, each within braces, and the whole
+thing within braces. \etype{f{$\to$}{\lowast\Ff}}
-\subsection{\csbh{xintDivision}, \csbh{xint\-Quo}, \csbh{xint\-Rem},
- \csbh{xintFDg}, \csbh{xintLDg}, \csbh{xintMON}, \csbh{xintMMON}, \csbh{xintOdd}}
+\begin{everbatim*}
+\xintMinof {{1.23}{1.2299}{1.2301}} and \xintMinof {{-1.23}{-1.2299}{-1.2301}}
+\end{everbatim*}
-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.
+\subsection{\csbh{xintAbs}}\label{xintAbs}
-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.
+The absolute value\etype{\Ff}. Note that |\xintAbs {-2}|\dtt{=\xintAbs {-2}}
+whereas |\xintiAbs {-2}|\dtt{=\xintiAbs {-2}}.
-\centeredline{|\xintNum {1e80}|}
-\centeredline{\digitstt{\xintNum{1e80}}}
+\subsection{\csbh{xintSgn}}\label{xintSgn}
+The sign of a fraction.\etype{\Ff}
-\etocdepthtag.toc {xintexpr}
+\subsection{\csbh{xintOpp}}\label{xintOpp}
-\section{Expandable expressions with the \xintexprname package}%
-\label{sec:expr}
+The opposite of a fraction. Note that |\xintOpp {3}| now outputs \dtt{\xintOpp
+ {3}} whereas |\xintiOpp {3}| returns \dtt{\xintiOpp {3}}.
-The \xintexprname package was first released with version |1.07| (|2013/05/25|)
-of the \xintname bundle. It loads automatically \xintfracname, hence also
-\xintname and \xinttoolsname.
+\subsection{\csbh{xintiDivision}, \csbh{xintiQuo}, \csbh{xintiRem},
+ \csbh{xintFDg}, \csbh{xintLDg}, \csbh{xintMON}, \csbh{xintMMON},
+ \csbh{xintOdd}}
-% 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 |:|).
+These macros\etype{\Ff\Ff} accept a fraction (or two) on input but will
+truncate it (them) to an integer using \csbxint{Num} (which is the same as
+\csbxint{TTrunc}). On output they produce integers without |/| nor |[N]|.
-The syntax is described in \autoref{sec:exprsummary} and
-\autoref{sec:exprsummaryII}.
+All have variants from package \xintname 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.
+
+%
+\leftedline{|\xintNum {1e80}|}
+%
+\leftedline{\dtt{\xintNum{1e80}}}
+
+%\etocdepthtag.toc {xintexpr}
+
+\section{Commands of the \xintexprname package}%
+\label{sec:expr}
\localtableofcontents
+The \xintexprname package was first released with version |1.07|
+(|2013/05/25|) of the \xintname bundle. The package loads automatically
+\xintfracname and \xinttoolsname (it is now the only arithmetic package from the \xintname
+bundle which loads \xinttoolsname).
+\begin{itemize}
+\item for using the |gcd| and |lcm| functions, it is necessary to load package
+ \xintgcdname.
+\begin{everbatim*}
+\xinttheexpr lcm (2^5*7*13^10*17^5,2^3*13^15*19^3,7^3*13*23^2)\relax
+\end{everbatim*}
+\item for allowing hexadecimal numbers (uppercase letters) on input, it is necessary
+ to load package \xintbinhexname.
+ \begin{everbatim*}
+\xinttheexpr "A*"B*"C*"D*"D*"F, "FF.FF, reduce("FF.FFF + 16^-3)\relax
+\end{everbatim*}
+\end{itemize}
+
+Release |1.1| has brought many changes to \xintexprname.
+See \autoref{sec:expr11} if you are already familiar with the earlier versions.
\subsection{The \csbh{xintexpr} expressions}\label{xintexpr}%
\label{xinttheexpr}\label{xintthe}
-
An \xintexprname{}ession is a construct
\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]|: square brackets are
-\emph{not} accepted in a |\xintexpr...\relax| if not within such braces.
-
+During this parsing, braced sub-content may be serving as usual as a macro
+parameter, or as a branch to the |?| two-way and |??| three-way operators.
+Prior to release |1.1|, there were also some other usage, but this has been
+removed. It was mainly needed because there was no other way to feed the
+number parser directtly with fractions in the |A/B[N]| notation which is the
+output format of the \xintfracname macros. There was no real need to use such
+macros anyhow. If one really wants to, one can now directly:
+\begin{everbatim*}
+\xinttheexpr \xintAdd{3/5[2]}{7/13[2]}+199/13[1]\relax
+\end{everbatim*}
+
+Notice in passing that the expressions benefit from the improved handling of
+denominators by \csbxint{Add} and \csbxint{Sub} from \xintfracname, which are
+the macros to which naturally |+| and |-| are mapped.
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
@@ -8257,62 +9154,800 @@ of the two equivalent forms:
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}}\\
-{|\xinttheexpr round(1/5!-1/7!-1/9!,18)\relax|%
- \digitstt{=\xinttheexpr round(1/5!-1/7!-1/9!,18)\relax}}\\
-{|\xinttheexpr float(1/5!-1/7!-1/9!,18)\relax|%
- \digitstt{=\xinttheexpr float(1/5!-1/7!-1/9!,18)\relax}}\\
-{|\xinttheexpr reduce(1/5!-1/7!-1/9!)\relax|%
- \digitstt{=\xinttheexpr reduce(1/5!-1/7!-1/9!)\relax}}\\
-{|\xinttheexpr 1.99^-2 - 2.01^-2 \relax|%
- \digitstt{=\xinttheexpr 1.99^-2 - 2.01^-2 \relax}}\\
-{|\xinttheexpr round(1.99^-2 - 2.01^-2, 10)\relax|%
- \digitstt{=\xinttheexpr round(1.99^-2 - 2.01^-2, 10) \relax}}\par
-\endgroup
+|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
+\leftedline{|\xinttheexpr 1/5!-1/7!-1/9!\relax|%
+ \dtt{=\xinttheexpr 1/5!-1/7!-1/9!\relax}}
+\leftedline{|\xinttheexpr round(1/5!-1/7!-1/9!,18)\relax|%
+ \dtt{=\xinttheexpr round(1/5!-1/7!-1/9!,18)\relax}}
+\leftedline{|\xinttheexpr float(1/5!-1/7!-1/9!,18)\relax|%
+ \dtt{=\xinttheexpr float(1/5!-1/7!-1/9!,18)\relax}}
+\leftedline{|\xinttheexpr reduce(1/5!-1/7!-1/9!)\relax|%
+ \dtt{=\xinttheexpr reduce(1/5!-1/7!-1/9!)\relax}}
+\leftedline{|\xinttheexpr 1.99^-2 - 2.01^-2 \relax|%
+ \dtt{=\xinttheexpr 1.99^-2 - 2.01^-2 \relax}}
+\leftedline{|\xinttheexpr round(1.99^-2 - 2.01^-2, 10)\relax|%
+ \dtt{=\xinttheexpr round(1.99^-2 - 2.01^-2, 10) \relax}}\par
+
+With |1.1| on has:
+\leftedline{|\xinttheiexpr [10] 1.99^-2 - 2.01^-2\relax|%
+ \dtt{=\xinttheiexpr [10] 1.99^-2 - 2.01^-2\relax}}
-\smallskip
-\begingroup % 18 octobre, je reprends la méthode déjà utilisée au début du
- % document le 9 octobre.
-\leftmargini 0pt
-\list\labelitemi{\def\makelabel#1{\hss\llap{#1}}\listparindent\parindent
- \labelwidth\parindent
- \itemindent\labelwidth}%
+
+\begin{itemize}
\item the expression may contain arbitrarily many levels of nested parenthesized
- sub-expressions.
-\item sub-contents giving numbers of fractions should be either
+ sub-expressions.
+\item to let sub-contents evaluate as a sub-unit it should be either
\begin{enumerate}
\item parenthesized,
- \item a sub-expression |\xintexpr...\relax|,
- \item or within braces.
+ \item or a sub-expression |\xintexpr...\relax|.
\end{enumerate}
- When a sub-expression is hit against in the midst of absorbing the
- digits of a number, a |*| to force tacit multiplication is
- inserted.\inmarg{1.09j}. Similarly, if it is an opening parenthesis
- which is hit against.\inmarg{1.09k}
- \item an expression can not be given as argument to the other package macros,
- 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| but simply |\xintexpr...\relax|; this is mainly because
- most of the time |\xinttheexpr..\relax| will insert explicit square brackets
- which are not parsable, as already mentioned, in the surrounding expression.
-\item each \xintexprname{}ession is completely expandable and obtains
- its result in two expansion steps.
-\endlist
-\endgroup
+ When the parser scans a number and hits against either an opening
+ parenthesis or a sub-expression it inserts tacitly a |*|.
+ \item to either give an expression as argument to the other package macros,
+ or more generally to macros which expand their arguments, one must use the
+ |\xinttheexpr...\relax| or |\xintthe\xintexpr...\relax| forms. Similarly,
+ printing the result itself must be done with these forms.
+ \item one should not use |\xinttheexpr...\relax| as a sub-constituent of an
+ |\xintexpr...\relax| but rather the |\xintexpr...\relax| form which will be
+ more efficient.
+ \item each \xintexprname{}ession, whether prefixed or not with |\xintthe|, is
+ completely expandable and obtains its result in two expansion steps.
+\end{itemize}
In an algorithm implemented non-expandably, one may define macros to
expand to infix expressions to be used within others. One then has the
choice between parentheses or |\xintexpr...\relax|: |\def\x {(\a+\b)}|
or |\def\x {\xintexpr \a+\b\relax}|. The latter is the better choice as
it allows also to be prefixed with |\xintthe|. Furthemore, if |\a| and
-|\b| are already defined |\oodef\x {\xintexpr \a+\b\relax}| will do the
-computation on the spot.
+|\b| are already defined |\edef\x {\xintexpr \a+\b\relax}| will do the
+computation on the spot. Rather than |\edef| one can use |\oodef|.
+
+\subsection{The syntax}
+
+An expression is enclosed between either \csbxint{expr}, or \csbxint{iexpr},
+or \csbxint{iiexpr}, or \csbxint{floatexpr}, or \csbxint{boolexpr} and a
+\emph{mandatory} ending |\relax|. An expression may be a sub-unit of another
+one.
+
+Apart from \csbxint{floatexpr} the evaluations of algebraic operations are
+\emph{exact}. The variant \csbxint{iiexpr} does not know fractions and is
+provided for integer-only calculations. The variant \csbxint{iexpr} is exactly
+like \csbxint{expr} except that it either rounds the final result to an
+integer, or in case of an optional parameter |[d]|, rounds to a fixed point
+number with |d| digits after decimal mark. The variant \csbxint{floatexpr}
+does float calculations according to the current value of the precision set by
+|\xintDigits|.
+
+The whole expression should be prefixed by |\xintthe| when it is destined to
+be printed on the typeset page, or given as argument to a macro (assuming this
+macro systematically expands its argument). As a shortcut to
+|\xintthe\xintexpr| there is |\xinttheexpr|. One gets used to not forget the
+two |t|'s.
+
+|\xintexpr|-essions and |\xinttheexpr|-essions are completely expandable, in two steps.
+
+\begin{itemize}
+\item An expression is built the standard way with opening and closing
+ parentheses, infix operators, and (big) numbers, with possibly a fractional
+ part, and/or scientific notation (except for \csbxint{iiexpr} which only
+ admits big integers). All variants work with comma separated expressions. On
+ output each comma will be followed by a space.
+
+\item as everything gets expanded, the characters |.|, |+|, |-|, |*|, |/|, |^|,
+ |!|, |&|, \verb+|+, |?|, |:|, |<|, |>|, |=|, |(|, |)|, |"|, |]|, |[|, |@|
+ and the comma |,| should not (if used in the expression) be active. For
+ example, the French language in |Babel| system, for pdf\LaTeX, activates |!|,
+ |?|, |;| and |:|. Turn off the activity before the expressions.
+
+ Alternatively the command \csbxint{exprSafeCatcodes} resets all
+ characters potentially needed by \csbxint{expr} to their standard catcodes
+ and \csbxint{exprRestoreCatcodes} restores the status prevailing at the time
+ of the previous \csa{xintexprSafeCatcodes}.
+
+\item The infix operators are |+|, |-|, |*|, |/|, |^| (or |**|) for exact or
+ floating point algebra (only integer exponents for power operations), |&&|
+ and \verb+||+ \footnote{with releases earlier than |1.1|, only single
+ character operators |&| and \verb+|+ were available, because the parser
+ did not handle multi-character operators. Their usage in this rôle is now
+ deprecated,\IMPORTANT{} as they may be assigned some new meaning in the
+ future.} for combining ``true'' (non zero) and ``false'' (zero)
+ conditions, as can be formed for example with the |=| (or |==|), |<|, |>|,
+ |<=|, |>=|, |!=| comparison operators.
+
+\item The |!| is either a
+ function (the logical not) requiring an argument within parentheses, or a
+ post-fix operator which does the factorial (so far, no float version).
+
+\item The |?| may serve either as a function (the truth value) requiring an
+ argument within parentheses), or as two-way post-fix branching operator
+ |(cond)?{YES}{NO}|. The false branch will \emph{not} be evaluated.
+
+\item There is also |??| which branches according to the scheme
+ |(x)??{<0}{=0}{>0}|.
+
+\item Comma separated lists may be generated with |a..b| and |a..[d]..b| and
+ they may be
+ manipulated to some extent once put into brackets:
+ \begin{itemize}
+ \item |a..b| constructs the \textbf{small} integers from $\lceil a\rceil$ to
+ $\lfloor b\rfloor$ (possibly a decreasing sequence),
+\begin{everbatim*}
+\xinttheexpr 1.5..11.23\relax
+\end{everbatim*}
+
+ \item |a..[d]..b| allows big integers, or fractions, it proceeds by step of |d|.
+\begin{everbatim*}
+\xinttheexpr 1.5..[0.97]..11.23\relax
+\end{everbatim*}
+
+ \item |[list][n]| extracts the |n|th element, or give the number of items if
+ |n=0|. If |n<0| it extracts from the tail.
+\begin{everbatim*}
+\xinttheiexpr \empty[1..10][6], [1..10][0], [1..10][-1], [1..10][23*18-22*19]\relax\
+(and 23*18-22*19 has value \the\numexpr 23*18-22*19\relax).
+\end{everbatim*}
+
+See the frame coming next for the |\empty| token.
+As shown, it is perfectly legal to do operations in the index parameter, which
+will be handled by the parser as everything else. The same remark applies to
+the next items.
+
+ \item |[list][:n]| extracts the first |n| elements if |n>0|, or suppresses
+ the last \verb+|n|+ elements if |n<0|.
+\begin{everbatim*}
+\xinttheiiexpr [1..10][:6]\relax\ and \xinttheiiexpr [1..10][:-6]\relax
+\end{everbatim*}
+ \item |[list][n:]| suppresses the first |n| elements if |n>0|, or extracts
+ the last \verb+|n|+ elements if |n<0|.
+\begin{everbatim*}
+\xinttheiiexpr [1..10][6:]\relax\ and \xinttheiiexpr [1..10][-6:]\relax
+\end{everbatim*}
+\item More generally, |[list][a:b]| works according to the Python ``slicing''
+ rules (inclusive of negative indices). Notice though that there is no
+ optional third argument for the step, which always defaults to |+1|.
+\begin{everbatim*}
+\xinttheiiexpr [1..20][6:13]\relax\ = \xinttheiiexpr [1..20][6-20:13-20]\relax
+\end{everbatim*}
+\item It is naturally possible to nest these things:
+\begin{everbatim*}
+\xinttheexpr [[1..50][13:37]][10:-10]\relax
+\end{everbatim*}
+\item itemwise operations either on the left or the right are possible:
+\begin{everbatim*}
+\xinttheiiexpr 123*[1..10]^2\relax
+\end{everbatim*}
+
+\begin{snugframed}
+ As list operations are implemented using square brackets, it is
+ necessary in |\xintiexpr| and |\xintfloatexpr| to insert something before
+ the first bracket if it belongs to a list, to avoid confusion with the
+ bracket of an optional parameter. We need something expandable which does
+ not leave a trace: the |\empty| does the trick.\IMPORTANT{}
+
+\begin{everbatim*}
+\xinttheiexpr \empty [1,3,6,99,100,200][2:4]\relax
+\end{everbatim*}
+
+ An alternative is to use parentheses
+\begin{everbatim*}
+\xinttheiexpr ([1,3,6,99,100,200][2:4])\relax
+\end{everbatim*}
+
+ Notice though that |([1,3,6,99,100,200])[2:4]| would not work. It is
+ mandatory for |][| and |][:| not to be interspersed with parentheses. On
+ the other hand spaces are perfectly legal:
+\begin{everbatim*}
+\xinttheiiexpr [1..10 ] [ : 7 ]\relax
+\end{everbatim*}
+
+Similarly all the |+[|, |*[|, \dots and |]**|, |]/|, \dots operators admit
+spaces but nothing else in-between their constituent characters.
+\begin{everbatim*}
+\xinttheiiexpr [ 1 . . 1 0 ] * * 1 1 \relax
+\end{everbatim*}
+
+ In an other vein, the parser will be confused by |1..[list][3]|, one must
+ write |1..([list][3])|. Also things such as |[100,300,500,700][2]//11| will
+ be confusing because the |]/| is an operator with higher priority than the
+ |][|, and then there will a dangling |/11| which does not make sense. In
+ fact even |[100,300,500,700][2]/11| is a syntax error: one must write
+ |([100,300,500,700][2])//11|.
+\end{snugframed}
+
+\end{itemize}
+
+\item count registers and |\numexpr|-essions are accepted (LaTeX{}'s counters
+ can be inserted using |\value|) natively without |\the| or |\number| as prefix.
+ Also dimen registers and control sequences, skip registers and control
+ sequences (\LaTeX{}'s lengths), |\dimexpr|-essions, |\glueexpr|-essions are
+ automatically unpacked using |\number|, discarding the stretch and shrink
+ components and giving the dimension value in |sp| units ($1/65536$th of a
+ \TeX{} point). Furthermore, tacit multiplication is implied, when the
+ register, variable, or expression if immediately prefixed by a (decimal)
+ number.
+
+\item tacit multiplication (the parser inserts a |*|) applies when the parser is
+ currently scanning the digits of a number (or its decimal part or scientific
+ part), or is looking
+ for an infix operator, and: (1.)~\emph{encounters a register,
+ variable or \eTeX{} expression (as described in the previous item)},
+ (2.)~\emph{encounters a sub-\csa{xintexpr}-ession}, or
+ (3.)~\emph{encounters an opening parenthesis.}
+
+\item when defining a macro to expand to an expression either via
+ %
+ \leftedline{|\def\x {\xintexpr \a + \b \relax}| or |\edef\x {\xintexpr
+ \a+\b\relax}|}
+ %
+ one may then do |\xintthe\x|, either for printing the result on the page or
+ to use it in some other macros expanding their arguments. The |\edef| does
+ the computation but keeps it in an internal private format. Naturally, the
+ |\edef| is only possible if |\a| and |\b| are already defined, either as
+ macros expanding to legal syntax like |37^23*17| or themselves in the same
+ way |\x| above was defined. Indeed in both cases (the `yet-to-be computed'
+ and the `already computed') |\x| can then be inserted in other expressions,
+ as for example
+ %
+ \leftedline {|\edef\y {\xintexpr \x^3\relax}|}
+ %
+ This would have worked also with |\x| defined as |\def\x {(\a+\b)}| but
+ |\edef\x| would not have been an option then, and |\x| could have been used
+ only inside an |\xintexpr|-ession, whereas the previous |\x| can also be
+ used as |\xintthe\x| in any context triggering the expansion of |\xintthe|.
+
+\item there is also \csbxint{boolexpr}| ... \relax| and
+ \csbxint{theboolexpr}| ... \relax|. Same as |\xintexpr| with the final
+ result 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:expr}. Here is an example:
+\catcode`| 12 % \xintNewBoolExpr le fait mais ça sera trop tard
+ % après le \scantokens qui aura redonné à | son
+ % caractère actif... avant j'utilisais ici \everb
+ % avec délimiteur !
+\begin{everbatim*}
+\xintNewBoolExpr \AssertionA[3]{ #1 & (#2|#3) }
+\xintNewBoolExpr \AssertionB[3]{ #1 | (#2&#3) }
+\xintNewBoolExpr \AssertionC[3]{ xor(#1,#2,#3) }
+{\centering\normalcolor\xintFor #1 in {0,1} \do {%
+ \xintFor #2 in {0,1} \do {%
+ \xintFor #3 in {0,1} \do {%
+ #1 AND (#2 OR #3) is \textcolor[named]{OrangeRed}{\AssertionA {#1}{#2}{#3}}\hfil
+ #1 OR (#2 AND #3) is \textcolor[named]{OrangeRed}{\AssertionB {#1}{#2}{#3}}\hfil
+ #1 XOR #2 XOR #3 is \textcolor[named]{OrangeRed}{\AssertionC {#1}{#2}{#3}}\\}}}}
+\end{everbatim*}\catcode`| 13
+
+ This example used for efficiency \csbxint{NewBoolExpr}. See also the
+ \autoref{xintNewExpr}.
+
+\item there is \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.
+ %
+ \leftedline{|\xintthefloatexpr 2^100000\relax:| \dtt{\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:
+ %
+\begin{everbatim*}
+\xinttheexpr sqrt(2,60)\relax
+
+Here the [60] is to avoid truncation to |\xintDigits| of precision on output.
+\printnumber{\xintthefloatexpr [60] sqrt(2,60)\relax}
+\end{everbatim*}
+
+\item
+ Floats are quickly indispensable when using the power function (which
+ can only have an integer exponent), as exact results will easily have
+ hundreds, if not thousands, of digits.
+ %
+\begin{everbatim*}
+\xintDigits:=48;\xintthefloatexpr 2^100000\relax
+\end{everbatim*}
+
+\item hexadecimal \TeX{} number denotations (\emph{i.e.}, with a |"| prefix)
+ are recognized by the |\xintexpr| parser and its variants. \fbox{This
+ requires \xintbinhexname}. Except in |\xintiiexpr|, a (possibly empty)
+ fractional part with the dot |.| as ``hexadecimal'' mark is allowed.
+ %
+ \leftedline{|\xinttheexpr "FEDCBA9876543210\relax|$\to$\dtt{\xinttheexpr
+ "FEDCBA9876543210\relax}}
+ %
+ \leftedline{|\xinttheiexpr
+ 16^5-("F75DE.0A8B9+"8A21.F5746+16^-5)\relax|$\to$\dtt{\xinttheiexpr
+ 16^5-("F75DE.0A8B9+"8A21.F5746+16^-5)\relax}}
+ %
+ Letters must be uppercased, as with standard \TeX{} hexadecimal
+ denotations.
+\end{itemize}
+
+
+Note that |2^-10| is perfectly accepted input, no need for parentheses;
+operators of power |^|, division |/|, and subtraction |-| are all
+left-associative: |2^4^8| is evaluated as |(2^4)^8|. The minus sign as prefix
+has various precedence levels: |\xintexpr -3-4*-5^-7\relax| evaluates as
+|(-3)-(4*(-(5^(-7))))| and |-3^-4*-5-7| as |(-((3^(-4))*(-5)))-7|.
+
+If one uses directly macros within |\xintexpr..\relax|, rather than the
+operators or the functions which are described next, one should obviously take
+into account that the parser will \emph{not} see the macro arguments.
+
+Here is, listed from the highest priority to the lowest, the complete list of
+operators and functions.
+
+% \ctexttt is a remnant of 1.09n manual, don't have time to get rid of it now.
+
+\newcommand\ctexttt [1]{\begingroup\color[named]{DarkOrchid}%\bfseries
+ #1\endgroup}
+
+\begin{itemize}
+\item
+ Functions are at the same top level of priority. All functions even
+ |?| and |!| (as prefix) require parentheses around their arguments.
+
+ \begin{snugframed}
+ \ctexttt{num, reduce, abs, sgn, frac, floor, ceil, sqr, sqrt, float,
+ round, trunc, mod, quo, rem, gcd, lcm, max, min, `+`, `*`, ?, !, not,
+ all, any, xor, if, ifsgn, even, odd, first, last, reversed, bool,
+ togl, add, mul, seq, subs, rseq, rrseq, iter}
+
+ |quo|, |rem|, |even|, |odd|, |gcd| and |lcm| will first truncate their
+ arguments to integers; the latter two require package \xintgcdname;
+ |togl| requires the |etoolbox| package; |all|, |any|, |xor|, |`+`|,
+ |`*`|, |max| and |min| are functions with arbitrarily many comma
+ separated arguments.
+
+ |bool| and |togl| use delimited macros to fetch their argument whose
+ closing parenthesis thus must be explicit, not arising from expansion.
+
+ Similarly |add|, |mul|, |subs|, |seq|, |rseq|, |rrseq|, |iter| use at
+ some stages delimited macros. They work with \emph{dummy variables},
+ represented as one Latin letter (lowercase or uppercase) followed by a
+ mandatory |=| sign, then a comma separated list of values to assign in
+ turn to the dummy variable, which will be substituted in the expression
+ which was parsed as the first, comma delimited, argument to the
+ function; additionally |rseq|, |rrseq| and |iter| have a mandatory
+ initial comma separated list which is separated by a semi-colon from the
+ expression to evaluate iteratively. |seq|, |rseq|, |rrseq|, |iter| but
+ not |add|, |mul|, |subs| admit the |omit|, |abort|, and |break(..)|
+ keywords, possibly but not necessarily in combination with a potentially
+ infinite list generated by a |n++| expression.
+
+ They may be nested.
+ \end{snugframed}
+
+\begin{description}
+ \item[functions with a single (numeric) argument]
+\noindent\par
+\begin{description}
+ \item[num] truncates to the nearest integer (truncation towards zero)
+\begin{everbatim*}
+\xinttheexpr num(3.1415^20)\relax
+\end{everbatim*}
+
+ \item[reduce] reduces a fraction to smallest terms
+\begin{everbatim*}
+\xinttheexpr reduce(50!/20!/20!/10!)\relax
+\end{everbatim*}
+
+Recall that this is NOT done automatically, for example when adding fractions.
+ \item[abs] absolute value
+ \item[sgn] sign
+ \item[frac] fractional part
+\begin{everbatim*}
+\xinttheexpr frac(-355/113), frac(-1129.218921791279)\relax
+\end{everbatim*}
+
+ \item[floor] floor function
+ \item[ceil] ceil function
+ \item[sqr] square
+ \item[?] |?(x)| is the truth value, $1$ if non zero, $0$ if zero. Must use parentheses.
+ \item[!] |!(x)| is logical not, $0$ if non zero, $1$ if zero. Must use parentheses.
+ \item[not] logical not
+ \item[even] evenness of the truncation
+\begin{everbatim*}
+\xinttheexpr seq((x,even(x)), x=-5/2..[1/3]..+5/2)\relax
+\end{everbatim*}
+
+ \item[odd] oddness of the truncation
+\begin{everbatim*}
+\xinttheexpr seq((x,odd(x)), x=-5/2..[1/3]..+5/2)\relax
+\end{everbatim*}
+\end{description}
+
+\item[functions with an alphabetical argument]
+\noindent\par
+ \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:
+ %
+ \leftedline{|\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 but optional argument]
+\noindent\par
+ \begin{description}
+ \item[round] For example
+ |round(-2^9/3^5,12)=|\dtt{\xinttheexpr round(-2^9/3^5,12)\relax.}
+ \item[trunc] For example
+ |trunc(-2^9/3^5,12)=|\dtt{\xinttheexpr trunc(-2^9/3^5,12)\relax.}
+ \item[float] For example
+ |float(-20^9/3^5,12)=|\dtt{\xinttheexpr float(-20^9/3^5,12)\relax.}
+ \item [sqrt] also available in \csbxint{expr}, uses the float evaluation
+ with precision given by the second argument. Available as a \emph{single}
+ argument function in \csbxint{iiexpr}, returns the truncated (not rounded)
+ exact square root.
+\begin{everbatim*}
+\xinttheexpr sqrt(2,30)\relax\ and \xinttheiiexpr sqrt(num(2e60))\relax
+\end{everbatim*}
+ \end{description}
+
+ \item[functions with two arguments]
+\noindent\par
+ \begin{description}
+ \item[quo] first truncates the arguments then computes the Euclidean quotient.
+ \item[rem] first truncates the arguments then computes the Euclidean remainder.
+ \item[mod] computes the modulo associated to the truncated division, same as
+ |/:| infix operator
+\begin{everbatim*}
+\xinttheexpr mod(11/7,1/13), reduce(((11/7)//(1/13))*1/13+mod(11/7,1/13)),
+mod(11/7,1/13)- (11/7)/:(1/13), (11/7)//(1/13)\relax
+\end{everbatim*}
+ \end{description}
+
+ \item[the if conditional (twofold way)]
+\noindent\par
+\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)]
+\noindent\par
+ \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]
+\noindent\par
+This argument may well be generated by one or many |a..b| or |a..[d]..b|
+constructs, separated by commas.
+ \begin{description}
+\item[all] inserts a logical |AND| in between arguments and evaluates,
+\item[any] inserts a logical |OR| in between all arguments and evaluates,
+\item[xor] inserts a logical |XOR| in between all arguments and evaluates,
+\item[|`+`|] adds (left ticks mandatory),
+\item[|`*`|] multiplies (left ticks mandatory),
+\item[max] maximum,
+\item[min] minimum,
+\item[gcd] first truncates to integers then computes the |GCD|, requires \xintgcdname,
+\item[lcm] first truncates to integers then computes the |LCM|, requires \xintgcdname,
+\item[first] first among comma separated items, |first(list)| is like |[list][:1]|.
+\begin{everbatim*}
+\xinttheiiexpr first(-7..3), [-7..3][:1]\relax
+\end{everbatim*}
+\item[last] last among comma separated items, |last(list)| is like |[list][-1:]|.
+\begin{everbatim*}
+\xinttheiiexpr last(-7..3), [-7..3][-1:]\relax
+\end{everbatim*}
+\item[reversed] reverses the order
+\begin{everbatim*}
+\xinttheiiexpr reversed(123..150)\relax
+\end{everbatim*}
+ \end{description}
+
+\item[functions using dummy variables]
+\noindent\par
+They are nestable to arbitrary depth if suitably parenthesized.
+\begin{description}
+\item [subs] for variable substitution, useful to get something evaluated only
+ once
+\begin{everbatim*}
+% ATTENTION that xz generates an error, 'unknown variable xz', one must use x*z
+\xinttheexpr subs(subs(seq(x*z,x=1..10),z=y^2),y=10)\relax
+\end{everbatim*}
+
+\item[add] addition
+\begin{everbatim*}
+\xinttheiiexpr add(x^3,x=1..50)\relax
+\end{everbatim*}
+
+\item[mul] multiplication
+\begin{everbatim*}
+\xinttheiiexpr subs(mul(2n+1,n=1..N),N=30)\relax
+\end{everbatim*}
+
+\item[seq] comma separated values generated according to a formula
+\begin{everbatim*}
+\xinttheiiexpr seq(x(x+1)(x+2)(x+3),x=1..10)\relax
+\end{everbatim*}
+\begin{everbatim*}
+\xinttheiiexpr seq(seq(i^2+j^2, i=0..j), j=0..10)\relax
+\end{everbatim*}
+\end{description}
+
+\item[rseq] recursive sequence, |@| for the previous value.
+\begin{everbatim*}
+% ATTENTION y/2@ would give (y/2)@, that is (y/2)*@ !!
+\printnumber {\xintthefloatexpr subs(rseq (1; @/2+y/(2@), i=1..10),y=1000)\relax }
+\end{everbatim*}
+
+In case the initial stretch is a comma separated list, |@| refers at the first
+iteration to the whole list. Use parentheses at each iteration to maintain
+this ``nuple''.
+\begin{everbatim*}
+\printnumber{\xintthefloatexpr rseq(1,10^6;
+ (sqrt([@][1]*[@][2]),([@][1]+[@][2])/2), i=1..10)\relax }
+\end{everbatim*}
+
+\item[rrseq] recursive sequence with multiple initial terms. Say, there are
+ |K| of them. Then |@1|, ..., |@4| and then |@@(n)| up to |n=K| refer to the
+ last |K| values. Notice the difference with |rseq| for which |@| refers to
+ the complete list of all initial terms (if there are more than one).
+\begin{everbatim*}
+\xinttheiiexpr rrseq(0,1; @1+@2, i=2..30)\relax
+\end{everbatim*}
+
+\begin{everbatim*}
+\xinttheiiexpr rrseq(0,1,2,3,4,5; @1+@2+@3+@4+@@(5)+@@(6), i=1..20)\relax
+\end{everbatim*}
+
+I implemented an |Rseq| which at all times keeps the memory of \emph{all}
+previous items, but decided to drop it as the package was becoming big.
+
+\item[iter] same as |rrseq| but does not print any value until the last |K|.
+\begin{everbatim*}
+\xinttheiiexpr iter(0,1; @1+@2, i=2..5, 6..10)\relax
+% the iterated over list is allowed to have disjoint defining parts.
+\end{everbatim*}
+\end{description}
+
+Recursions may be nested, with |@@@(n)| giving access to the values of the
+outer recursion\dots and there is even |@@@@(n)| but I never tried it!
+
+With |seq|, |rseq|,
+|rrseq|, |iter|, but not with |subs|, |add|, |mul|, one has:
+\begin{description}
+\item[abort] stop here and now.
+\item[omit] omit this value.
+\item[break] |break(stuff)| to abort and have |stuff| as last value.
+\item[n++] serves to generate a potentially infinite list
+\begin{everbatim*}
+\xinttheiiexpr iter(1;(@>10^40)?{break(@)}{2@},i=1++)\relax
+% this would not work with i=1,2,3++. Only n++ syntax, nothing before.
+\end{everbatim*}
+\end{description}
+
+Refer to \autoref{sec:expr11} for more examples.
+
+\item The postfix operators \ctexttt{!} and the branching conditionals \ctexttt{?, ??}.
+ \begin{description}
+ \item[{\color[named]{DarkOrchid}!}] computes the factorial of an integer.
+ 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
+ %
+ \leftedline{|\xinttheiexpr (3>2)?{5+6}{7-1}2^3\relax|}
+ %
+ is legal and computes
+ |5+62^3=|\dtt{\xinttheiexpr(3>2)?{5+(6}{7-(1}2^3)\relax}. Note
+ though that it would be better practice to include here the |2^3|
+ inside the branches. The contents of the branches may be arbitrary
+ as long as once glued to what is next the syntax is respected:
+ {|\xintexpr (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.
+ %
+ \leftedline{|\def\x{0.33}\def\y{1/3}|}
+ %
+ \leftedline{|\xinttheexpr (\x-\y)??{sqrt}{0}{1/}(\y-\x)\relax|%
+ \dtt{=\def\x{0.33}\def\y{1/3}%
+ \xinttheexpr (\x-\y)??{sqrt}{0}{1/}(\y-\x)\relax }}
+ %
+ \end{description}
+
+\item \def\MicroFont{\color[named]{DarkOrchid}\ttfamily}The
+ |.| as decimal mark; the number scanner treats it as an inherent,
+ optional and unique component of a being formed number. One can do
+ things such as
+ %
+ \leftedline{\restoreMicroFont|\xinttheexpr .^2+2^.\relax|}
+ %
+ which is |0^2+2^0| and produces \dtt{\xinttheexpr .^2+2^.\relax}.
+
+\item The |e| and |E| for scientific notation.\inmarg{Changed} They are parsed
+ like the decimal is. Thus |1e(3+2)| is no legal syntax anymore, one must use
+ |10^(3+2)| in such cases.
+\begingroup
+\restoreMicroFont |1e3^2| is \dtt{\xinttheexpr 1e3^2\relax}
+\endgroup
+
+\item The |"| for hexadecimal numbers: it is treated with highest
+ priority, allowed only at locations where the parser expects to start
+ forming a numeric operand, once encountered it triggers the
+ hexadecimal scanner which looks for successive hexadecimal digits (as
+ usual skipping spaces and expanding forward everything) possibly a
+ unique optional dot (allowed directly in front) and then an optional
+ (possibly empty) fractional part. The dot and fractional part are not
+ allowed in {\restoreMicroFont|\xintiiexpr..\relax|}. The |"|
+ functionality \fbox{requires package \xintbinhexname} (there is
+ no warning, but an ``undefined control sequence'' error will
+ naturally results if the package has not been loaded).
+\begingroup
+ \restoreMicroFont |"A*"A^"A| is \dtt{\xinttheexpr "A*"A^"A\relax}.
+\endgroup
+
+
+\item The power operator |^|, or |**|. It is left associative:
+ {\restoreMicroFont|\xinttheiexpr 2^2^3\relax|} evaluates to \xinttheiexpr
+ 2^2^3\relax, not \xinttheiexpr 2^(2^3)\relax. Note that if the float
+ precision is too low, iterated powers withing |\xintfloatexpr..\relax| may
+ fail: for example with the default setting |(1+1e-8)^(12^16)| will be
+ computed with |12^16| approximated from its $16$ most significant digits
+ but it has $18$ digits (\dtt{={\xintiiPow{12}{16}}}), hence the result is
+ wrong:
+ % REVOIR CECI
+ \begingroup
+ %
+ \leftedline{$\np{\xintthefloatexpr (1+1e-8)^(12^16)\relax }$}
+ %
+ One should code
+ %
+ \leftedline{\restoreMicroFont|\xintthe\xintfloatexpr (1+1e-8)^\xintiiexpr 12^16\relax
+ \relax|}
+ %
+ to obtain the correct floating point evaluation
+ % REVOIR CECI
+ %
+ \leftedline{$\np{1.00000001}^{12^{16}}\approx\np{\xintthefloatexpr
+ (1+1e-8)^\xintiiexpr 12^16\relax\relax }$}
+ %
+ \endgroup
+
+\item Multiplication and division \raisebox{-.3\height}{|*|}, |/|. The
+ division is left associative, too:
+ %
+ \begingroup\restoreMicroFont
+ %
+ |\xinttheiexpr 100/50/2\relax| evaluates to \xinttheiexpr 100/50/2\relax,
+ not \xinttheiexpr 100/(50/2)\relax.
+ %
+ \endgroup
+ Inside \csbxint{iiexpr}, |/| does \emph{rounded} division.\inmarg{Changed}
+
+\item Truncated division |//| and modulo |/:| (equivalently |'mod'|, right ticks
+ mandatory) are at the same level of priority than multiplication and
+ division, thus left-associative with them. Apply parentheses for
+ disambiguation.
+\begin{everbatim*}
+\xinttheexpr 100000//13, 100000/:13, 100000 'mod' 13, trunc(100000/13,10),
+ trunc(100000/:13/13,10)\relax
+\end{everbatim*}
+
+\item The list itemwise operators |*[|, |/[|, |^[|, |**[|, |]*|, |]/|, |]^|,
+ |]**| are at the same precedence level.
+
+\item Addition and subtraction |+|, |-|. Again, |-| is left
+ associative:
+ %
+ \begingroup\restoreMicroFont
+ %
+ |\xinttheiexpr 100-50-2\relax| evaluates to \xinttheiexpr 100-50-2\relax,
+ not \xinttheiexpr 100-(50-2)\relax.
+ %
+ \endgroup
+
+\item The list itemwise operators |+[|, |-[|, |]+|, |]-|, are at
+ the same precedence level.
+
+\item Comparison operators |<|, |>|, |=| (same as |==|), |<=|, |>=|, |!=| all
+ at the same level of precedence, use parentheses for disambiguation.
+
+\item Conjunction (logical and): |&&| or equivalently
+ |'and'| (right ticks mandatory).
+
+\item Inclusive disjunction (logical or): \verb+||+
+ and equivalently |'or'| (quotes mandatory).
+
+\item XOR: |'xor'| with mandatory quotes is at the same level of precedence
+ as \verb+||+.
+
+\item The comma:
+\restoreMicroFont With |\xinttheexpr 2^3,3^4,5^6\relax|
+one obtains as output \xinttheexpr 2^3,3^4,5^6\relax{}.
+
+\item The parentheses.
+\end{itemize}
+
+See \autoref{ssec:countinexpr} for count and dimen registers and variables.
\subsection{\texorpdfstring{\texttt{\protect\string\numexpr}}{\textbackslash
numexpr} or \texorpdfstring{\texttt{\protect\string\dimexpr}}{\textbackslash
@@ -8323,7 +9958,7 @@ Count registers, count control sequences, dimen registers,
dimen control sequences, skips and skip control sequences, |\numexpr|,
|\dimexpr|, |\glueexpr| can be inserted directly, they will be unpacked using
|\number| (which gives the internal value in terms of scaled points for the
-dimensional variables: @1@\,|pt|${}={}$@65536@\,|sp|; stretch and shrink
+dimensional variables: $1$\,|pt|${}=65536$\,|sp|; stretch and shrink
components are thus discarded). Tacit multiplication is implied, when a
number or decimal number prefixes such a register or control sequence.
@@ -8341,29 +9976,32 @@ automatically (the parser will actually try |\number|, and thus fail). Do not
use |\the| but only |\number| with a dimen or skip, as the |\xintexpr| parser
doesn't understand |pt| and its presence is a syntax error. To use a dimension
expressed in terms of points or other \TeX{} recognized units, incorporate it in
-|\dimexpr...\relax|.
-
-If one needs to optimize, |1.72\dimexpr 3.2pt\relax| is less efficient
-than |1.72*{\number\dimexpr 3.2pt\relax}| as the latter avoids re-parsing the
-digits of the representation of the dimension as scaled points.
-\centeredline{|\xinttheexpr 1.72\dimexpr 3.2pt\relax/2.71828\relax=|}
-\centeredline{|\xinttheexpr 1.72*{\number\dimexpr 3.2pt\relax}/2.71828\relax|}
-\centeredline{\digitstt{\xinttheexpr 1.72\dimexpr
- 3.2pt\relax/2.71828\relax=\xinttheexpr 1.72*{\number\dimexpr
- 3.2pt\relax}/2.71828\relax}}
+|\dimexpr...\relax|.
+
+% REVOIR
+% If one needs to optimize, |1.72\dimexpr 3.2pt\relax| is less efficient
+% than |1.72*{\number\dimexpr 3.2pt\relax}| as the latter avoids re-parsing the
+% digits of the representation of the dimension as scaled points.
+% \centeredline{|\xinttheexpr 1.72\dimexpr 3.2pt\relax/2.71828\relax=|}
+% \centeredline{|\xinttheexpr 1.72*{\number\dimexpr 3.2pt\relax}/2.71828\relax|}
+% \centeredline{\dtt{\xinttheexpr 1.72\dimexpr
+% 3.2pt\relax/2.71828\relax=\xinttheexpr 1.72*{\number\dimexpr
+% 3.2pt\relax}/2.71828\relax}}
Regarding how dimensional expressions are converted by \TeX{} into scaled points
-see \autoref{sec:Dimensions}.
+see \autoref{sec:Dimensions}.
\subsection{Catcodes and spaces}
+Active characters may (and will) break the functioning of \csbxint{expr}.
+Inside an expression one may prefix, for example a |:| with |\string|. Or, for
+a more radical way, there is \csbxint{exprSafeCatcodes}. This is a
+non-expandable step as it changes catcodes.
+
\subsubsection{\csbh{xintexprSafeCatcodes}}
\label{xintexprSafeCatcodes}
%{\small New with release |1.09a|.\par}
-Active characters will interfere with |\xintexpr|-essions. One may prefix them
-with |\string| within |\xintexpr..\relax|, thus preserving expandability, or
-there is the non-expandable \csa{xintexprSafeCatcodes} which can be issued
-before the use of |\xintexpr|. This command sets (not globally) the catcodes of
+This command sets the catcodes of
the relevant characters to safe values. This is used internally by
\csbxint{NewExpr} (restoring the catcodes on exit), hence \csbxint{NewExpr} does
not have to be protected against active characters.
@@ -8375,47 +10013,33 @@ Restores the catcodes to the earlier state.
\bigskip
-Unbraced spaces inside an |\xinttheexpr...\relax| should mostly be
+Spaces inside an |\xinttheexpr...\relax| should mostly be
innocuous (except inside macro arguments).
|\xintexpr| and |\xinttheexpr| are for the most part agnostic regarding
-catcodes:
-(unbraced) digits, binary operators, minus and plus signs as prefixes, dot as
-decimal mark, parentheses, may be indifferently of catcode letter or other or
-subscript or superscript, ..., it doesn't matter.\footnote{Furthermore, although
- \csbxint{expr} uses \csa{string}, it is (we hope) escape-char agnostic.}
-
-The characters \verb[+,-,*,/,^,!,&,|,?,:,<,>,=,(,),"[, the dot and the comma
-should not be active as everything is expanded along the way. If one of them is
+catcodes: (unbraced) digits, binary operators, minus and plus signs as
+prefixes, dot as decimal mark, parentheses, may be indifferently of catcode
+letter or other or subscript or superscript, ..., it doesn't matter.%
+%
+\footnote{Furthermore, although \csbxint{expr} uses \csa{string}, it is
+ (we hope) escape-char agnostic.}
+
+The characters |+|, |-|, |*|, |/|, |^|, |!|, |&|, \verb+|+, |?|, |:|, |<|, |>|,
+|=|, |(|, |)|, |"|, |[|, |]|, |;|, the dot and the comma should not be active if
+in the expression, as everything is expanded along the way. If one of them is
active, it should be prefixed with |\string|.
The |!| as either logical negation or postfix factorial operator must be a
-standard (\emph{i.e.} catcode @12@) |!|, more precisely a catcode @11@
+standard (\emph{i.e.} catcode $12$) |!|, more precisely a catcode $11$
exclamation point |!| must be avoided as it is used internally by |\xintexpr|
for various special purposes.
-
-% 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 the output is of
-catcode 11.
+are all of catcode 12. For |\xintthefloatexpr| the `e' in the output has its standard catcode ``letter''.
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).
-
+is not the same within such macro arguments.
\subsection{Expandability, \csh{xinteval}}
@@ -8425,51 +10049,53 @@ two steps) to the chain of digits (and possibly minus sign |-|, decimal mark
|.|, fraction slash |/|, scientific |e|, square brackets |[|, |]|) representing
the result.
-Starting with |1.09j|, an |\xintexpr..\relax| can be inserted without |\xintthe|
-prefix inside an |\edef|, or a |\write|.\MyMarginNote{New with 1.09j!} It
-expands to a private more compact representation (five tokens) than
-|\xinttheexpr| or |\xintthe\xintexpr|.
+Starting with |1.09j|, an |\xintexpr..\relax| can be inserted without
+|\xintthe| prefix inside an |\edef|, or a |\write|. It expands to a private
+more compact representation (five tokens) than |\xinttheexpr| or
+|\xintthe\xintexpr|.
The material between |\xintexpr| and |relax| should contain only expandable
-material; the exception is with brace pairs which, apart from their usual r\^ole
-for macro arguments, are also allowed in places where the scanner expects a
-numeric operand, the braced material should expand to some number (or fraction),
-but scientific notation is not allowed. Conversely fractions in |A/B[N]| format
-(either explicit or from macro expansion) must be enclosed in such a brace pair.
+material.
The once expanded |\xintexpr| is |\romannumeral0\xinteval|. And there is
-similarly |\xintieval|, |\xintiieval|, and |\xintfloateval|. For the other cases
-one can use |\romannumeral-`0| as prefix. For an example of expandable
+similarly |\xintieval|, |\xintiieval|, and |\xintfloateval|. For the other
+cases one can use |\romannumeral-`0| as prefix. For an example of expandable
algorithms making use of chains of |\xinteval|-uations connected via
-|\expandafter| see \autoref{ssec:fibonacci}.\MyMarginNote{New with 1.09j!}
+|\expandafter| see \autoref{ssec:fibonacci}.
An expression can only be legally finished by a |\relax| token, which
will be absorbed.
+It is quite possible to nest expressions among themselves; for example, if one
+needs inside an |\xintiiexpr...\relax| to do some computations with fractions,
+rounding the final result to an integer, on just has to insert
+|\xintiexpr...\relax|. The functioning of the infix operators will not be in
+the least affected from the fact that the surrounding ``environment'' is the
+|\xintiiexpr| one.
\subsection{Memory considerations}
The parser creates an undefined control sequence for each intermediate
-computation (this does not refer to the intermediate steps needed in
-the evaluations of the \csbxint{Add}, \csbxint{Mul}, etc... macros corresponding
-to the infix operators, but only to each conversion of such an infix operator
-into a computation). So, a moderately sized expression might create 10, or 20
-such control sequences. On my \TeX{} installation, the memory available for such
-things is of circa \np{200000} multi-letter control words. So this means that a
-document containing hundreds, perhaps even thousands of expressions will compile
-with no problem.
+computation evaluation: addition, subtraction, etc\dots Thus, a moderately sized
+expression might create 10, or 20 such control sequences. On my \TeX{}
+installation, the memory available for such things is of circa \np{200000}
+multi-letter control words. So this means that a document containing hundreds,
+perhaps even thousands of expressions will compile with no problem.
Besides the hash table, also \TeX{} main memory is impacted. Thus, if
-\xintexprname is used for computing plots\footnote{this is not very
- probable as so far \xintname does not include a mathematical library
- with floating point calculations, but provides only the basic
- operations of algebra.}, this may cause a problem.
-
-
+\xintexprname is used for computing plots%
+%
+\footnote{this is not very probable as so far \xintname does not include
+ a mathematical library with floating point calculations, but provides
+ only the basic operations of algebra.}%
+%
+, this may cause a problem.
-There is a solution.\footnote{which convinced me that I could stick with the
- parser implementation despite its potential impact on the hash-table
- and other parts of \TeX{}'s memory.}
+There is a (partial) solution.%
+%
+\footnote{which convinced me that I could stick with the parser
+ implementation despite its potential impact on the hash-table and
+ other parts of \TeX{}'s memory.}
A
document can possibly do tens of thousands of evaluations only
@@ -8493,286 +10119,352 @@ necessary to do without the facilities of the \xintexprname package.
% \xintname{}expression where the parameters are input using the usual
% macro-parameter: |#1|, ..., |#9|.
-The command is used
-as:\centeredline{|\xintNewExpr{\myformula}[n]|\marg{stuff}, where}
+The command is used as:
+%
+\leftedline{|\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} even if
- |n=0|\footnote{there is some use for \csa{xintNewExpr}|[0]| compared to an
+ |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.
+ in their usual r\^ole.
\end{itemize}
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. The protection
-against active characters is done automatically.
+The definition of |\myformula| made by |\xintNewExpr| is global (i.e. it does
+not obey the scope of environments). The protection against active characters
+is done automatically.
It will be a completely expandable macro entirely built-up using |\xintAdd|,
|\xintSub|, |\xintMul|, |\xintDiv|, |\xintPow|, etc\dots as corresponds to the
expression written with the infix operators.
-
-Macros created by |\xintNewExpr| can thus be nested:
-\dverb|@
- \xintNewExpr \MyFunction [1]{reduce(2*#1^3 - #1^-2*3)}
- (1) \MyFunction {\MyFunction {2/3}}
- \xintNewFloatExpr \MyOtherFunction [1]{(#1+#1^-1)/(#1-#1^-1)}
- (2) \MyOtherFunction {1.234}
- (3) \MyOtherFunction {\MyOtherFunction {1.234}}|\newline
-\xintNewExpr \MyFunction [1]{reduce(2*#1^3 - #1^-2*3)}
-\xintNewFloatExpr \MyOtherFunction [1]{(#1+#1^-1)/(#1-#1^-1)}
-(1) \digitstt{\MyFunction {\MyFunction {2/3}}}\newline
-(2) \digitstt{\MyOtherFunction {1.234}}\newline
-(3) \digitstt{\MyOtherFunction {\MyOtherFunction {1.234}}}
+Macros created by |\xintNewExpr| can thus be nested.
+
+\begin{everbatim*}
+ \xintNewFloatExpr \FA [2]{(#1+#2)^10}
+ \xintNewFloatExpr \FB [2]{sqrt(#1*#2)}
+\begin{enumerate}[nosep]
+ \item \FA {5}{5}
+ \item \FB {30}{10}
+ \item \FA {\FB {30}{10}}{\FB {40}{20}}
+\end{enumerate}
+\end{everbatim*}
\begin{framed}
+ The whole point of using \csbxint{NewExpr} is to produce a macro which does
+ not do any of the \csbxint{expr} for expandable manipulations, manipulations
+ which may have an impact on some regions of \TeX{}'s memory (this impact gets
+ noticeable only if many of thousands of \csbxint{expr}-essions
+ are evaluated).
+
A ``formula'' created by |\xintNewExpr| is thus a macro whose parameters are
given to a possibly very complicated combination of the various macros of
- \xintname and \xintfracname; hence one can not use infix notation inside the
- arguments, as in for example |\myformula {28^7-35^12}| which would have been
- allowed by
- \centeredline{|\def\myformula #1{\xinttheexpr (#1)^3\relax}|}
- One will have to do |\myformula {\xinttheexpr 28^7-35^12\relax}|, or redefine
- |\myformula| to have more parameters.
+ \xintname and \xintfracname. Consequently, one can not use at all any infix
+ notation there, but only the input format recognized by the \xintfracname
+ macros.
+
+The situation is thus quite distinct from a macro with parameters defined via
+a simple |\def| such as:
+ %
+ \leftedline{|\def\myformula #1{\xinttheexpr (#1)^3\relax}|}
\end{framed}
-% The formula may contain besides the infix operators and macro
-% parameters some arbitrary decimal numbers, fractions (within braces) and also
-% macros. If these macros do not involve the parameters, nothing special needs to
-% be done, they will be expanded once during the construction of the formula. But
-% if the parameters are to be used within the macros themselves, then the macro
-% should be code with an underscore |_| rather than a backslash |\|.
-
-\dverb|@
-@\xintNewExpr\myformA[4]{ #1 + #2 * #3^#4 }
-@\xintNewExpr\myformB[3]{ (#1 + 1.75)^#2 + #3*2.7 }
-@\xintNewExpr\myformC[3]{ #1*#1+#2*#2+#3*#3-(#1*#2+#2*#3+#3*#1) }
-@\xintNewExpr\myformD[2]{ (1+1.5*#1)^#2 - (1+1.5*#2)^#1 }
-@\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\myformA[4]{ #1 + #2 * #3^#4 }
-% \xintNewExpr\myformB[3]{ (#1 + 1.75)^#2 + #3*2.7 }
-% \xintNewExpr\myformC[3]{ #1*#1+#2*#2+#3*#3-(#1*#2+#2*#3+#3*#1) }
-% \xintNewExpr\myformD[2]{ (1+1.5*#1)^#2 - (1+1.5*#2)^#1 }
-% \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| tries to do as many evaluations as are possible at the time the
+macro parameters are still parameters. Let's see a few examples. For this I
+will use |\meaning| which reveals the contents of a macro. We will thus see
+some private macros of the \xintname bundle, which should not be directly
+used. If the things look a bit complicated, it is because they have to cater
+for many possibilities. With |\meaning| we will see what has already been
+evaluated.
+
+\emph{Remark:} In these examples we sometimes use |\printnumber| to avoid for
+the meaning to go into the right margin, but this zaps all spaces originally
+in the output from |\meaning|.
+
+\begin{everbatim*}
+\xintNewIIExpr\FA [1]{13*25*78*#1+2826*292}\meaning\FA
+\end{everbatim*}
+\smallskip
-\ttfamily
-% |\meaning\myformA:|\printnumber{\meaning\myformA}\endgraf
-% |\meaning\myformB:|\printnumber{\meaning\myformB}\endgraf
-% |\meaning\myformC:|\printnumber{\meaning\myformC}\endgraf
-% |\meaning\myformD:|\printnumber{\meaning\myformD}\endgraf
-% |\meaning\myformE:|\printnumber{\meaning\myformE}\endgraf
-% |\meaning\myformF:|\printnumber{\meaning\myformF}\endgraf
-% |\meaning\myformG:|\printnumber{\meaning\myformG}\endgraf
-|\meaning\DET:|\printnumber{\meaning\DET}\endgraf
+\begin{everbatim*}
+\xintNewIExpr\FA [2]{(3/5*9/7*13/11*#1-#2)*3^7}
+\printnumber{\meaning\FA}
+\end{everbatim*}
+\smallskip
-\centeredline{|\xintNum{\DET {1}{1}{1}{10}{-10}{5}{11}{-9}{6}}|%
- \digitstt{=\xintNum{\DET {1}{1}{1}{10}{-10}{5}{11}{-9}{6}}}}%
-\centeredline{|\xintNum{\DET {1}{2}{3}{10}{0}{-10}{21}{2}{-17}}|%
- \digitstt{=\xintNum{\DET {1}{2}{3}{10}{0}{-10}{21}{2}{-17}}}}
+\begin{everbatim*}
+% an example with optional parameter
+\xintNewIExpr\FA [3]{[24] (#1+#2)/(#1-#2)^#3}
+\printnumber{\meaning\FA}
+\end{everbatim*}
+\smallskip
+
+\begin{everbatim*}
+\xintNewFloatExpr\FA [2]{[12] 3.1415^3*#1-#2^5}
+\printnumber{\meaning\FA}
+\end{everbatim*}
-\rmfamily
+\smallskip
+\begin{everbatim*}
+\xintNewExpr\DET[9]{ #1*#5*#9+#2*#6*#7+#3*#4*#8-#1*#6*#8-#2*#4*#9-#3*#5*#7 }
+\printnumber{\meaning\DET}
+\end{everbatim*}
-\emph{Remark:} |\meaning| has been used within the argument to a |\printnumber|
-command, to avoid going into the right margin, but this zaps all spaces
-originally in the output from |\meaning|. Here is as an illustration the raw
-output of
-|\meaning| on the previous example:
+\smallskip
-\ttfamily
-\meaning\DET
-\rmfamily
+\begin{everbatim*}
+\xintNewExpr\FA[3]{ #1*#1+#2*#2+#3*#3-(#1*#2+#2*#3+#3*#1) }
+\printnumber{\meaning\FA }
+\end{everbatim*}
-This is why |\printnumber| was used, to have breaks across lines.
-\subsubsection {Use of conditional operators}
+One can even do some quite daring things:
+\begin{everbatim*}
+\xintNewExpr\FA[5]{[#1..[#2]..#3][#4:#5]}
+And this works:
+\begin{itemize}[nosep]
+\item \FA{1}{3}{90}{20}{30}
+\item \FA{1}{3}{90}{-40}{-15}
+\item \FA{1.234}{-0.123}{-10}{3}{7}
+\end{itemize}
+\oodef\test {\FA {0}{10}{100}{3}{6}}\meaning\test +++
+\end{everbatim*}
-The |1.09a| conditional operators |?| and |:| cannot be parsed by |\xintNewExpr|
+In the last example though, do not hope to use empty |#4| or |#5|: this is
+possible in an expression, because the parser identifies |][:| or |:]| and
+handles them appropriately. Here the macro |\FA| is built with idea that there
+is something non-empty as it found the place holders |#4| and |#5|.
+
+
+\subsubsection {Conditional operators and \csbh{NewExpr}}
+
+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
+ 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) }
-
-\centeredline{|\xintNewExpr\Formula [3]|}
-\centeredline{|{ if((#1>#2) & (#2>#3),
- sqrt(#1-#2)*sqrt(#2-#3), #1^2+#3/#2) }|}
-
-\ttfamily
-\noindent|\meaning\Formula:|\printnumber{\meaning\Formula}\endgraf
+\begin{everbatim*}
+\xintNewExpr\Formula [3]{ if((#1>#2) && (#2>#3), sqrt(#1-#2)*sqrt(#2-#3), #1^2+#3/#2) }%
+\printnumber{\meaning\Formula }
+\end{everbatim*}
-\rmfamily
-This formula (with |\xintifNotZero|) will gobble the false branch.
+This formula (with its |\xintiiifNotZero|) will gobble the false branch without
+evaluating it when used with given arguments.
-Remark: this
-|\XINTinFloatSqrt| macro is a non-user package macro used internally within
-|\xintexpr|-essions, it produces the result in |A[n]| form rather
-than in scientific notation, and for reasons of the inner workings of
-|\xintexpr|-essions, this is necessary; a hand-made macro would
-have used instead the equivalent |\xintFloatSqrt|.
+Remark: the meaning above reveals some of the private macros used by the
+package. They are not for direct use.
Another example
-\xintNewExpr\myformula[3]{ ifsgn(#1,#2/#3,#2-#3,#2*#3) }
-\centeredline{|\xintNewExpr\myformula [3]|}
-\centeredline{|{ ifsgn(#1,#2/#3,#2-#3,#2*#3) }|}
+\begin{everbatim*}
+\xintNewExpr\myformula[3]{ ifsgn(#1,#2/#3,#2-#3,#2*#3) }%
+\meaning\myformula
+\end{everbatim*}
-\ttfamily
-\noindent\printnumber{\meaning\myformula}\endgraf
-
-\rmfamily
-Again, this macro gobbles the false branches, as would have the operator |:|
+Again, this macro gobbles the false branches, as would have the operator |??|
inside an |\xintexpr|-ession.
+\subsubsection{External macros and \csbh{NewExpr}; the protect function}
+\label{sssec:protect}
-
-\subsubsection{Use of macros}
-
-
-For macros to be inserted within such a created \xintname-formula command, there
-are two cases:
+For macros within such a created \xintname-formula command, there
+are two cases:\inmarg{Changed}
\begin{itemize}
\item the macro does not involve the numbered parameters in its arguments: it
may then be left as is, and will be evaluated once during the construction of
the formula,
-\item it does involve at least one of the parameters as argument. Then:
- \begin{enumerate}
- \item the whole thing (macro + argument) should be braced (not necessary if it
- is already included into a braced group),
- \item the macro should be coded with an underscore |_| in place of the
- backslash |\|.
- \item the parameters should be coded with a dollar sign |$1|, |$2|, etc...
- \end{enumerate}
+\item it does involve at least one of the macro parameters as argument. Then:
+ \begin{snugframed}
+ the whole thing (macro + argument) should be |protect|-ed, not in the
+ \LaTeX{} sense (!), but in the following way: |protect(\macro {#1})|.\IMPORTANT
+ \end{snugframed}
\end{itemize}
-Here is a silly example illustrating the general principle (the macros here have
+Here is a silly example illustrating the general principle: the macros here have
equivalent functional forms which are more convenient; but some of the more
obscure package macros of \xintname dealing with integers do not have functions
-pre-defined to be in correspondance with them):
+pre-defined to be in correspondance with them, use this mechanism could be
+applied to them.
+
+\begin{everbatim*}
+\xintNewExpr\myformI[2]{protect(\xintRound{#1}{#2}) - protect(\xintTrunc{#1}{#2})}%
+\meaning\myformI
+
+\xintNewIIExpr\formula [3]{rem(#1,quo(protect(\the\numexpr #2\relax),#3))}%
+\noindent\meaning\formula
+\end{everbatim*}
-\dverb|@
-\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }
-\meaning\myformI:|
+Only macros involving the |#1|, |#2|, etc\dots should be protected in this
+way; the |+|, |*|, etc\dots symbols, the functions from the \csbxint{expr}
+syntax, none should ever be included in a protected string.
-\xintNewExpr\myformI[2]{ {_xintRound{$1}{$2}} - {_xintTrunc{$1}{$2}} }
-\ttfamily
-\centeredline{\meaning\myformI}
-\dverb|@
-\xintNewIIExpr\formula [3]{rem(#1,quo({_the_numexpr $2_relax},#3))}
-\meaning\formula:|%$
+\subsubsection{Limitations of \csbxint{NewExpr}}
-\xintNewIIExpr\formula [3]{rem(#1,quo({_the_numexpr $2_relax},#3))}%$
-\noindent{\meaning\formula}\endgraf
+All depends on where the macro parameters arise |#1|, |#2|, ... we went to some
+effort to allow many things but not everything goes through. |\xintNewExpr|
+tries to evaluate completely as many things as possible which do not involve the
+macro parameters. A somewhat elaborate scheme allows to handle also
+complicated situations with list operations:
-\rmfamily
+\begin{everbatim*}
+\xintNewIExpr \FA [3] {[3] `+`([1.5..[3.5+#1]..#2]*#3)}
+\begin{itemize}[nosep]
+\item \FA {3.5}{50}{100} (cf. \xinttheiexpr [3] 1.5..[7]..50\relax)
+\item \FA {-15}{-100}{20} (cf. \xinttheiexpr [3] 1.5..[-11.5]..-100\relax)
+\item \FA {0}{20}{1} (cf. \xinttheiexpr [3] 1.5..[3.5]..20\relax)
+\end{itemize}
+\end{everbatim*}
+
+Some things are definitely expected not to work therein: particularly the
+|add|, |mul|, |subs|, |seq|, |rseq|, |rrseq|, |iter| with |omit|, |abort|,
+|break|. Also, but this is quite anecdotical, |first| and |last| should not
+work (I did not try; actually I did not try the functions with dummy letters
+either, because each time I think about compatibility with \csbxint{NewExpr},
+my head starts spinning.)
+
+Also, using sub-|\xintexpr|-essions (including some of the macro parameters)
+inside something given to |\xintNewExpr| will probably not work.
+
+Naturally, it is always possible to use, after the macro has been constructed,
+|\xinttheexpr...\relax| among the arguments.
\subsection{\csbh{xintiexpr}, \csbh{xinttheiexpr}}
\label{xintiexpr}\label{xinttheiexpr}
% \label{xintnumexpr}\label{xintthenumexpr}
-Equivalent\etype{x} to doing |\xintexpr round(...)\relax|. Thus, only the final
-result is rounded to an integer. Half integers are rounded 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, \emph{only} the
+final result is rounded to an integer. Half integers are rounded towards
+$+\infty$ for positive numbers and towards $-\infty$ for negative ones. Comma
+separated lists of expressions are allowed.
+
+An optional parameter within brackets is allowed: if strictly positive it
+instructs the expression to do its final rounding to the nearest value with
+that many digits after the decimal mark.\inmarg{New}
+
+% Le temps est venu pour leur obsolescence
-Initially\MyMarginNote{|1.09i| warning} baptized |\xintnumexpr|,
-|\xintthenumexpr| but
-I am not too happy about this choice of name; one should keep in mind that
-|\numexpr|'s integer division rounds, whereas in |\xintiexpr|, the |/| is an
-exact fractional operation, and only the final result is rounded to an integer.
+% Initially baptized |\xintnumexpr|,
+% |\xintthenumexpr| but
+% I am not too happy about this choice of name; one should keep in mind that
+% |\numexpr|'s integer division rounds, whereas in |\xintiexpr|, the |/| is an
+% exact fractional operation, and only the final result is rounded to an integer.
-So |\xintnumexpr|, |\xintthenumexpr| are deprecated, and although still provided
-for the time being this might change in the future.
+% So |\xintnumexpr|, |\xintthenumexpr| are deprecated, and although still provided
+% for the time being this might change in the future.
\subsection{\csbh{xintiiexpr}, \csbh{xinttheiiexpr}}
\label{xintiiexpr}\label{xinttheiiexpr}
-This variant\etype{x} maps |/| to the euclidean quotient and deals almost only
-with (long) integers. It uses the `ii' macros for addition, subtraction,
-multiplication, power, square, sums, products, euclidean quotient and remainder.
-The |round| and |trunc|, in the presence of the second optional argument, are
-mapped to \csbxint{iRound}, respectively \csbxint{iTrunc}, hence they always
-produce (long) integers.
+This variant\etype{x} does not know fractions. It deals almost only with long
+integers. Comma separated lists of expressions are allowed.
-To input a fraction to |round|, |trunc|, |floor| or |ceil| one can
-use braces, else the |/| will do the euclidean quotient.
-The minus sign should be put together with the fraction: |round(-{30/18})| is
-illegal (even if the fraction had been an integer), use
-|round({-30/18})|\digitstt{=\xinttheiiexpr round({-30/18})\relax}.
+\begin{framed}
+ It maps |/| to the \emph{rounded} quotient.\inmarg{Changed} The operator
+ |//| is, like in |\xintexpr...\relax|, mapped to \emph{truncated} division.
+ The euclidean quotient (which for positive operands is like the truncated
+ quotient) was, prior to release |1.1|, associated to |/|. The function
+ |quo(a,b)| can still be employed.
+\end{framed}
-Decimal numbers are allowed only if postfixed immediately with |e| or |E|, the
-number will then be truncated to an integer after multiplication by the power of
-ten with exponent the number following |e| or |E|.
-\centeredline{|\xinttheiiexpr 13.4567e3+10000123e-3\relax|%
- \digitstt{=\xinttheiiexpr 13.4567e3+10000123e-3\relax}}
-%
+The \csbxint{iiexpr}-essions use the `ii' macros for addition, subtraction,
+multiplication, power, square, sums, products, euclidean quotient and
+remainder.
+
+The |round|, |trunc|, |floor|, |ceil| functions are still available, and are
+about the only places where fractions can be used, but |/| can not be used!
+This dilemma is solved using |protect|.\inmarg{Changed} For understanding the
+next example, recall that |round| and |trunc| have a second (non negative)
+optional argument. In a normal \csbxint{expr}-essions, |round| and |trunc| are
+mapped to \csbxint{Round} and \csbxint{Trunc}, in \csbxint{iiexpr}-essions,
+they are mapped to \csbxint{iRound} and \csbxint{iTrunc}.
+
+
+\begin{everbatim*}
+\xinttheiiexpr 5/3, round(5/3,3), trunc(5/3,3), trunc(\xintDiv {5}{3},3),
+trunc(\xintRaw {5/3},3)\relax{},
+but \xinttheiiexpr 5/3, round(protect(5/3),3), trunc(protect(5/3),3), floor(protect(5/3)),
+ceil(protect(5/3))\relax{} works!
-A fraction within braces should be followed immediately by an |e| (or inside a
-|round|, |trunc|, etc...) to convert it
-into an integer as expected by the main operations. The truncation is only done
-after the |e| action.
+\noindent And with negative numbers: \xinttheiiexpr -5/3, round(protect(-5/3),3),
+trunc(protect(-5/3),3), floor(protect(-5/3)), ceil(protect(-5/3))\relax.
+\end{everbatim*}
+
+
+Decimal numbers and numbers using scientific notations must be given as
+arguments to one of the |num|, or |round|, or etc\dots functions, which will truncate
+them to an integer.%
+\inmarg{Changed} Internally the number will be represented with as many zeros
+as is necessary, thus one does not want to do |num(1e100000)| for example!
+
+%
+\begin{everbatim*}
+\xinttheiiexpr num(13.4567e3)+num(10000123e-3)\relax % should compute 13456+10000
+\end{everbatim*}
+%
The |reduce| function is not available and will raise un error. The |frac|
-function also. The |sqrt| function is mapped to \csbxint{iSqrt}.
-
-Numbers in float notation, obtained via a macro like \csbxint{FloatSqrt}, are a
-bit of a challenge: they can not be within braces (this has been mentioned
-already, |e| is not legal within braces) and if not braced they will be
-truncated when the parser meets the |e|. The way out of the dilemma is to use a
-sub-expression:
-\centeredline{|\xinttheiiexpr \xintFloatSqrt{2}\relax|%
- \digitstt{=\xinttheiiexpr \xintFloatSqrt{2}\relax}}
-\centeredline{|\xinttheiiexpr \xintexpr\xintFloatSqrt{2}\relax e10\relax|%
- \digitstt{=\xinttheiiexpr \xintexpr\xintFloatSqrt{2}\relax e10\relax}}
-\centeredline{|\xinttheiiexpr round(\xintexpr\xintFloatSqrt{2}\relax,10)\relax|%
- \digitstt{=\xinttheiiexpr round(\xintexpr\xintFloatSqrt{2}\relax,10)\relax}}
-(recall that |round| is mapped within |\xintiiexpr..\relax| to \csbxint{iRound}
-which always outputs an integer).
-
-The whole point of \csbxint{iiexpr} is to gain some speed in integer only
-algorithms, and the above explanations related to how to use fractions therein
-are a bit peripheral. We observed of the order of @30@\% speed gain when dealing
-with numbers with circa one hundred digits, but this gain decreases the longer
-the manipulated numbers become and becomes negligible for numbers with thousand
-digits: the overhead from parsing fraction format is little compared
-to other expensive aspects of the expandable shuffling of tokens.
+function also. The |sqrt| function is mapped to \csbxint{iSqrt} (this gives
+the truncated not the rounded square root).
+
+One can use the Float macros if one is careful to use |num|, or |round| on
+their output,
+\begin{everbatim*}
+\xinttheiiexpr \xintFloatSqrt [20]{2}, \xintFloatSqrt [20]{3}\relax % no operations
+
+\noindent The next example requires the |round|, and one could not put the |+| inside it:
+
+\xinttheiiexpr round(\xintFloatSqrt [20]{2},19)+round(\xintFloatSqrt [20]{3},19)\relax
+
+(the second argument of |round| and |trunc| tells how many digits from after the
+decimal mark one should keep.)
+\end{everbatim*}
+
+The whole point of \csbxint{iiexpr} is to gain some speed in \emph{integer-only}
+algorithms, and the above explanations related to how to nevertheless use
+fractions therein are a bit peripheral. We observed of the order of
+$30$\% speed gain when dealing with numbers with circa one hundred digits, but this
+gain decreases the longer the manipulated numbers become and becomes negligible
+for numbers with thousand digits: the overhead from parsing fraction format is
+little compared to other expensive aspects of the expandable shuffling of
+tokens.
\subsection{\csbh{xintboolexpr},
\csbh{xinttheboolexpr}}\label{xintboolexpr}\label{xinttheboolexpr}
%{\small New in |1.09c|.\par}
-Equivalent\etype{x} to doing |\xintexpr ...\relax| and returning @1@ if the
-result does not vanish, and @0@ is the result is zero. As |\xintexpr|, this
+Equivalent\etype{x} to doing |\xintexpr ...\relax| and returning $1$ if the
+result does not vanish, and $0$ is the result is zero. As |\xintexpr|, this
can be used on comma separated lists of expressions, and will return a
-comma separated list of @0@'s and @1@'s.
-
+comma separated list of $0$'s and $1$'s.
\subsection{\csbh{xintfloatexpr},
- \csbh{xintthe\-float\-expr}}\label{xintfloatexpr}\label{xintthefloatexpr}
+ \csbh{xintthefloatexpr}}\label{xintfloatexpr}\label{xintthefloatexpr}
-\csbxint{floatexpr}|...\relax|\etype{x} is exactly like |\xintexpr...\relax| but
-with the four binary operations and the power function mapped to
+\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).
+and \csa{xintFloatPower}. The precision for the computation is from the
+current setting of |\xintDigits|. Comma separated lists of expressions are
+allowed.
+
+An optional parameter within brackets is allowed: the final float will have
+that many digits of precision. This is provided to get rid of non-relevant
+last digits.\inmarg{New}
Currently, the factorial function hasn't yet a float version; so inside
|\xintthefloatexpr . . . \relax|, |n!| will be computed exactly. Perhaps this
@@ -8785,26 +10477,35 @@ Note that |1.000000001| and |(1+1e-9)| will not be equivalent for
(and executed when the closing parenthesis is found) will provoke the rounding
to |1|. Whereas |1.000000001|, when found as operand of one of the four
elementary operations is kept with |D+2| digits, and even more for the power
-function. \centeredline{|\xintDigits:= 9; \xintthefloatexpr
- (1+1e-9)-1\relax|\digitstt{=\xintthefloatexpr (1+1e-9)-1\relax}}
-\centeredline{|\xintDigits:= 9; \xintthefloatexpr
- 1.000000001-1\relax|\digitstt{=\xintthefloatexpr 1.000000001-1\relax}}
+function.
+% REVOIR ceci
+%
+\leftedline{|\xintDigits:= 9; \xintthefloatexpr
+ (1+1e-9)-1\relax|\dtt{=\xintthefloatexpr (1+1e-9)-1\relax}}
+%
+\leftedline{|\xintDigits:= 9; \xintthefloatexpr
+ 1.000000001-1\relax|\dtt{=\xintthefloatexpr 1.000000001-1\relax}}
For the fun of it:\xintDigits:=20; |\xintDigits:=20;|%
-\centeredline{|\xintthefloatexpr (1+1e-7)^1e7\relax|%
- \digitstt{=\xintthefloatexpr (1+1e-7)^1e7\relax}}
+%
+\leftedline{|\xintthefloatexpr (1+1e-7)^1e7\relax|%
+ \dtt{=\xintthefloatexpr (1+1e-7)^1e7\relax}}
|\xintDigits:=36;|\xintDigits:=36;
-\centeredline{|\xintthefloatexpr
+%
+\leftedline{|\xintthefloatexpr
((1/13+1/121)*(1/179-1/173))/(1/19-1/18)\relax|}
-\centeredline{\digitstt{\xintthefloatexpr
+%
+\leftedline{\dtt{\xintthefloatexpr
((1/13+1/121)*(1/179-1/173))/(1/19-1/18)\relax}}
-\centeredline{|\xintFloat{\xinttheexpr
+%
+\leftedline{|\xintFloat{\xinttheexpr
((1/13+1/121)*(1/179-1/173))/(1/19-1/18)\relax}|}
-\centeredline{\digitstt{\xintFloat
+%
+\leftedline{\dtt{\xintFloat
{\xinttheexpr((1/13+1/121)*(1/179-1/173))/(1/19-1/18)\relax}}}
-\xintDigits := 16;
+\xintDigits := 16;
The latter result is the rounding of the exact result. The previous one has
rounding errors coming from the various roundings done for each
@@ -8822,15 +10523,15 @@ 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|}
+\leftedline{|\xintDigits:=12;\xintthefloatexpr 1.000000000000001^1e15\relax|}
%
-\centeredline{\xintDigits:=12;%
- \digitstt{\xintthefloatexpr 1.000000000000001^1e15\relax}}
+\leftedline{\xintDigits:=12;%
+ \dtt{\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
+this market, the \dtt{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)|.
@@ -8840,16 +10541,14 @@ setting of \csa{xintDigits}; it would have been if we had input it as
% \edef\temps{\the\pdfelapsedtime}%
% \xintRound {5}{\temps/65536}s\endgraf
-
\xintDigits := 16; % mais en fait \centeredline crée un groupe.
-
\subsection{\csbh{xintifboolexpr}}\label{xintifboolexpr}
%{\small New in |1.09c|.\par}
\csh{xintifboolexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xinttheexpr
<expr>\relax| and then executes the |YES| or the |NO| branch depending on
-whether the outcome was non-zero or zero. |<expr>| can involove various |&| and
+whether the outcome was non-zero or zero. |<expr>| can involve various |&| and
\verb+|+, parentheses, |all|, |any|, |xor|, the |bool| or |togl| operators, but
is not limited to them: the most general computation can be done, the test is on
whether the outcome of the computation vanishes or not.
@@ -8861,7 +10560,7 @@ Will not work on an expression composed of comma separated sub-expressions.
\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.
+whether the outcome was non zero or zero.
\subsection{\csbh{xintifbooliiexpr}}\label{xintifbooliiexpr}
%{\small New in |1.09i|.\par}
@@ -8873,17 +10572,39 @@ whether the outcome was non zero or zero.
\subsection{\csbh{xintNewFloatExpr}}\label{xintNewFloatExpr}
This is exactly like \csbxint{NewExpr} except that the created formulas are
-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|.
+set-up to use |\xintthefloatexpr|. The precision used for the computation will
+be the one given by |\xintDigits| at the time of use of the created formulas.
+However, the numbers hard-wired in the original expression will have been
+evaluated with the then current setting for |\xintDigits|.
+
+\begin{everbatim*}
+\xintNewFloatExpr \f [1] {sqrt(#1)}
+\f {2} (with \xinttheDigits{} of precision).
+
+{\xintDigits := 32;\f {2} (with \xinttheDigits{} of precision).}
+
+\xintNewFloatExpr \f [1] {sqrt(#1)*sqrt(2)}
+\f {2} (with \xinttheDigits {} of precision).
+
+{\xintDigits := 32;\f {2} (?? we thought we had a higher precision.Explanation next)}
+
+The sqrt(2) in the second formula was computed with only \xinttheDigits{} of
+precision. Setting |\xintDigits| to a higher value at the time of definition will
+confirm that the result above is from a mismatch of the precision for |sqrt(2)| at
+the time of its evaluation and the precision for the new |sqrt(2)| with |#1=2| at
+the time of use.
+
+{\xintDigits := 32;\xintNewFloatExpr \f [1] {sqrt(#1)*sqrt(2)}
+\f {2} (with \xinttheDigits {} of precision)}
+\end{everbatim*}
\subsection{\csbh{xintNewIExpr}}\label{xintNewIExpr}
%{\small New in |1.09c|.\par }
-Like \csbxint{NewExpr} but using |\xinttheiexpr|. Former denomination was
-|\xintNewNumExpr| which is deprecated and should not be used.
+Like \csbxint{NewExpr} but using |\xinttheiexpr|.
+
+%Former denomination was
+%|\xintNewNumExpr| which is deprecated and should not be used.
\subsection{\csbh{xintNewIIExpr}}\label{xintNewIIExpr}
%{\small New in |1.09i|.\par }
@@ -8897,6 +10618,14 @@ Like \csbxint{NewExpr} but using |\xinttheboolexpr|.
\xintDigits:= 16;
+\subsection{\csbh{xintthecoords}}\label{xintthecoords}
+
+From a comma separated output of an even number of items as output by
+|\xintfloatexpr [P] ...\relax| or by |\xintiexpr [D] ...\relax|, creates
+coordinate pairs for |TikZ|. See \hyperref[sec:expr11coords]{an example} on
+page \pageref{sec:expr11coords}.
+
+
\subsection{Technicalities}
As already mentioned \csa{xintNewExpr}|\myformula[n]| does not check the prior
@@ -8907,28 +10636,20 @@ to the number of parameters in the expression.
Obviously I should mention that \csa{xintNewExpr} itself can not be used in an
expansion-only context, as it creates a macro.
-The |\escapechar| setting may be arbitrary when using
-|\xintexpr|.
+The |\escapechar| setting may be arbitrary when using |\xintexpr|.
The format of the output of
-|\xintexpr|\meta{stuff}|\relax| is a |!| (with catcode 11) followed by
-|\XINT_expr_usethe| which prints an error message in the document and in
-the log file if it is executed, then a |\xint_protect| token, a token
-doing the actual printing and finally a token |\.=A/B[n]|. Using
-|\xinttheexpr| means zapping the first three things, the fourth one will
-then unlock |A/B[n]| from the (presumably undefined, but it does not
-matter) control sequence |\.=A/B[n]|.
-
-Thanks to the release |1.09j| added |\xint_protect| token and the fact
-that |\XINT_expr_usethe| is |\protected|, one can now use |\xintexpr|
-inside an |\edef|, with no need of the |\xintthe| prefix.
+|\xintexpr|\meta{stuff}|\relax| is a |!| (with catcode 11) followed by various things:
+\begin{everbatim*}
+\oodef\f {\xintexpr 1.23^10\relax }\meaning\f
+\end{everbatim*}
\begin{framed}
Note that |\xintexpr| is thus compatible with complete expansion, contrarily
to |\numexpr| which is non-expandable, if not prefixed by |\the| or |\number|,
and away from contexts where \TeX{} is building a number. See
\autoref{ssec:fibonacci} for some illustration.
-%
+% pour mémoire:
% \MyMarginNote[\kern\dimexpr\FrameSep+\FrameRule\relax]{New with 1.09j!}
\end{framed}
@@ -8956,19 +10677,21 @@ his/her expansion control.
Syntax errors in the input such as using a one-argument function with two
arguments will generate low-level \TeX{} processing unrecoverable errors, with
-cryptic accompanying message.
+cryptic accompanying message.
Some other problems will give rise to `error messages' macros giving some
indication on the location and nature of the problem. Mainly, an attempt has
been made to handle gracefully missing or extraneous parentheses.
-When the scanner is looking for a number and finds something else not otherwise
-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.
+However, this mechanism is completely inoperant for parentheses involved in
+the syntax of the |seq|, |add|, |mul|, |subs|, |rseq| and |rrseq| functions.
-Note that |\relax| is mandatory (contrarily to a |\numexpr|).
+% When the scanner is looking for a number and finds something else not otherwise
+% 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 \emph{mandatory} (contrarily to a |\numexpr|).
\subsection{Acknowledgements}
@@ -8979,14 +10702,15 @@ expandable parser, by the commented source of the
|calc| package was instructive, despite the fact that here for |\xintexpr| the
principles are necessarily different due to the aim of achieving expandability.
-
-\etocdepthtag.toc {commandsB}
+%\etocdepthtag.toc {commandsB}
\section{Commands of the \xintbinhexname package}
-\label{sec:binhex}
+\label{sec:binhex}
+
+\localtableofcontents
This package was first included in the |1.08| (|2013/06/07|) release of
-\xintname. It provides expandable conversions of arbitrarily long numbers to and
+\xintname. It provides expandable conversions of arbitrarily big integers to and
from binary and hexadecimal.
The argument is first \fexpan ded. It then may start with an optional minus
@@ -9000,21 +10724,17 @@ uppercased.
% \clearpage
-\localtableofcontents
-
-
-
\subsection{\csbh{xintDecToHex}}\label{xintDecToHex}
Converts from decimal to hexadecimal.\etype{f}
-\texttt{\string\xintDecToHex \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\digitstt{->\printnumber{\xintDecToHex{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
+\texttt{\string\xintDecToHex \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\dtt{->\printnumber{\xintDecToHex{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
\subsection{\csbh{xintDecToBin}}\label{xintDecToBin}
Converts from decimal to binary.\etype{f}
-\texttt{\string\xintDecToBin \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\digitstt{->\printnumber{\xintDecToBin{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
+\texttt{\string\xintDecToBin \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\dtt{->\printnumber{\xintDecToBin{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}}
\subsection{\csbh{xintHexToDec}}\label{xintHexToDec}
@@ -9022,15 +10742,15 @@ Converts from hexadecimal to decimal.\etype{f}
\texttt{\string\xintHexToDec
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
-\digitstt{->\printnumber{\xintHexToDec{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
-
+\dtt{->\printnumber{\xintHexToDec{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
+
\subsection{\csbh{xintBinToDec}}\label{xintBinToDec}
Converts from binary to decimal.\etype{f}
\texttt{\string\xintBinToDec
\string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent
-\digitstt{->\printnumber{\xintBinToDec{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}}
+\dtt{->\printnumber{\xintBinToDec{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}}
\subsection{\csbh{xintBinToHex}}\label{xintBinToHex}
@@ -9038,7 +10758,7 @@ Converts from binary to hexadecimal.\etype{f}
\texttt{\string\xintBinToHex
\string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent
-\digitstt{->\printnumber{\xintBinToHex{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}}
+\dtt{->\printnumber{\xintBinToHex{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}}
\subsection{\csbh{xintHexToBin}}\label{xintHexToBin}
@@ -9046,8 +10766,7 @@ Converts from hexadecimal to binary.\etype{f}
\texttt{\string\xintHexToBin
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
-\digitstt{->\printnumber{\xintHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
-
+\dtt{->\printnumber{\xintHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
\subsection{\csbh{xintCHexToBin}}\label{xintCHexToBin}
@@ -9056,32 +10775,35 @@ least one hundred hexadecimal digits.
\texttt{\string\xintCHexToBin
\string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent
-\digitstt{->\printnumber{\xintCHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
-
-
+\dtt{->\printnumber{\xintCHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}}
\section{Commands of the \xintgcdname package}
\label{sec:gcd}
+\localtableofcontents
This package was included in the original release |1.0| (|2013/03/28|) of the
\xintname bundle.
Since release |1.09a| the macros filter their inputs through the \csbxint{Num}
macro, so one can use count registers, or fractions as long as they reduce to
-integers.
+integers.
-%% \clearpage
+Since release |1.1|, the two ``|typeset|'' macros require the explicit
+loading by the user of package \xinttoolsname.\inmarg{Changed}
-\localtableofcontents
+
+%% \clearpage
\subsection{\csbh{xintGCD}}\label{xintGCD}
-\csa{xintGCD\n\m}\etype{\Numf\Numf} computes the greatest common divisor. It is
+|\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
+%
+\leftedline{\csa{xintGCD}|{10000}{1113}|\dtt{=\xintGCD{10000}{1113}}}
+%
+\leftedline{|\xintGCD{123456789012345}{9876543210321}=|\dtt
{\xintGCD{123456789012345}{9876543210321}}}
\subsection{\csbh{xintGCDof}}\label{xintGCDof}
@@ -9089,13 +10811,12 @@ zero.
\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.
-
+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}
-\csa{xintGCD\n\m}\etype{\Numf\Numf} computes the least common multiple. It is
+|\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}
@@ -9110,26 +10831,29 @@ macro, it is \fexpan ded first and must contain at least one item.
\xintAssign{{\xintBezout {10000}{1113}}}\to\X
\xintAssign {\xintBezout {10000}{1113}}\to\A\B\U\V\D
-\csa{xintBezout\n\m}\etype{\Numf\Numf} returns five numbers |A|, |B|, |U|, |V|,
+|\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 }.}
+second, |D| is the GCD, and \dtt{UA - VB = D}. %
+%
+\leftedline{|\xintAssign
+ {{\xintBezout {10000}{1113}}}\to\X|} %
+%
+\leftedline{|\meaning\X:
+ |\dtt{\meaning\X }.}
\noindent{|\xintAssign {\xintBezout {10000}{1113}}\to\A\B\U\V\D|}\\
-|\A: |\digitstt{\A },
-|\B: |\digitstt{\B },
-|\U: |\digitstt{\U },
-|\V: |\digitstt{\V },
-|\D: |\digitstt{\D }.\\
+|\A: |\dtt{\A },
+|\B: |\dtt{\B },
+|\U: |\dtt{\U },
+|\V: |\dtt{\V },
+|\D: |\dtt{\D }.\\
\xintAssign {\xintBezout {123456789012345}{9876543210321}}\to\A\B\U\V\D
\noindent{|\xintAssign {\xintBezout {123456789012345}{9876543210321}}\to\A\B\U\V\D
|}\\
-|\A: |\digitstt{\A },
-|\B: |\digitstt{\B },
-|\U: |\digitstt{\U },
-|\V: |\digitstt{\V },
-|\D: |\digitstt{\D }.
-
+|\A: |\dtt{\A },
+|\B: |\dtt{\B },
+|\U: |\dtt{\U },
+|\V: |\dtt{\V },
+|\D: |\dtt{\D }.
\subsection{\csbh{xintEuclideAlgorithm}}\label{xintEuclideAlgorithm}
@@ -9138,7 +10862,7 @@ second, |D| is the GCD, and \digitstt{UA - VB = D}. \centeredline{|\xintAssign
\def\restorebracecatcodes
{\catcode`\{=1 \catcode`\}=2 }
-\def\allowlistsplit
+\def\allowlistsplit
{\catcode`\{=12 \catcode`\}=12 \allowlistsplita }
\def\allowlistsplitx {\futurelet\listnext\allowlistsplitxx }
@@ -9155,11 +10879,12 @@ second, |D| is the GCD, and \digitstt{UA - VB = D}. \centeredline{|\xintAssign
[{#1}\hskip 0pt plus 1pt \allowlistsplitx ]
\endgroup
-\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|}
+|\xintEuclideAlgorithm|\n\m\etype{\Numf\Numf} applies the Euclide algorithm
+and keeps a copy of all quotients and remainders. %
+%
+\leftedline{|\xintAssign {{\xintEuclideAlgorithm {10000}{1113}}}\to\X|}
-|\meaning\X: |\digitstt{\expandafter\allowlistsplit
+|\meaning\X: |\dtt{\expandafter\allowlistsplit
\meaning\X\relax .}
The first token is the number of steps, the second is |N|, the
@@ -9169,167 +10894,137 @@ final quotient and last (zero) remainder.
\subsection{\csbh{xintBezoutAlgorithm}}\label{xintBezoutAlgorithm}
-
\xintAssign {{\xintBezoutAlgorithm {10000}{1113}}}\to\X
-\csa{xintBezoutAlgorithm\n\m}\etype{\Numf\Numf} applies the Euclide algorithm
+|\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|}
+the quotients arising in the algorithm. %
+%
+\leftedline{|\xintAssign {{\xintBezoutAlgorithm {10000}{1113}}}\to\X|}
-|\meaning\X: |\digitstt{\expandafter\allowlistsplit\meaning\X \relax .}
+|\meaning\X: |\dtt{\expandafter\allowlistsplit\meaning\X \relax .}
The first token is the number of steps, the second is |N|, then
|0|, |1|, the GCD, |M|, |1|, |0|, the first quotient, the first
remainder, the top left entry of the first matrix, the bottom left
entry, and then these four things at each step until the end.
+\subsection{\csbh{xintTypesetEuclideAlgorithm}}\label{xintTypesetEuclideAlgorithm}
-\subsection{\csbh{xintTypesetEuclideAlgorithm}\texorpdfstring{\allowbreak\null\hspace*{.25cm}}{}}%
-\label{xintTypesetEuclideAlgorithm}
+% Requires explicit loading by the user of package \xinttoolsname.\inmarg{Changed}
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}|}
+%
+\leftedline{|\xintTypesetEuclideAlgorithm {123456789012345}{9876543210321}|}
\xintTypesetEuclideAlgorithm {123456789012345}{9876543210321}
-
\subsection{\csbh{xintTypesetBezoutAlgorithm}}%
\label{xintTypesetBezoutAlgorithm}
+% Requires explicit loading by the user of package \xinttoolsname.\inmarg{Changed}
+
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}|}
+%
+\leftedline{|\xintTypesetBezoutAlgorithm {10000}{1113}|}
\xintTypesetBezoutAlgorithm {10000}{1113}
+% 28 octobre, le problème de color stack overflow avec dvipdfmx vu le 14
+% octobre dans xintcfrac apparaît dans xintseries. Pas envie d'investiguer.
+\def\everbatimxprehook {}
+\def\everbatimxposthook {}
+
\section{Commands of the \xintseriesname package}
\label{sec:series}
+\localtableofcontents
+
This package was first released with version |1.03| (|2013/04/14|) of the
\xintname bundle.
-Some arguments to the package commands are macros which are expanded only later,
-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...
+The \Ff{} expansion type of various macro arguments is only a \Numf{} if only
+\xintname but not \xintfracname is loaded. The macro \csbxint{iSeries} is
+special and expects summing big integers obeying the strict format, even if
+\xintfracname is loaded.
-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.
+The arguments serving as indices are of the \numx{} expansion type.
-%% \clearpage
+In some cases one or two of the macro arguments are only expanded at a later
+stage not immediately.
-\localtableofcontents
+%% \clearpage
\subsection{\csbh{xintSeries}}\label{xintSeries}
-\def\coeff #1{\xintiiMON{#1}/#1.5} % (-1)^n/(n+1/2)
-\edef\w {\xintSeries {0}{50}{\coeff}}
-\edef\z {\xintJrr {\w}[0]}
-
\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 \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}
+needed.%
%
-\dverb|@
+\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}
+
+\begin{everbatim*}
\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.
+\oodef\w {\xintSeries {0}{50}{\coeff}} % we want to re-use it
+\oodef\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,
-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
-digits: |\xintLen {\xintQuo {\xintFac {101}}{\xintiMul {\xintiPow
- {2}{50}}{\xintFac{50}}}}|\digitstt{=\xintLen {\xintQuo {\xintFac
- {101}}{\xintiMul {\xintiPow {2}{50}}{\xintFac{50}}}}}. The
-explanation lies in the too clever to be efficient |#1.5| trick. It
-leads to a silly extra @5^{51}@ (which has \xintLen {\xintPow {5}{51}}
-digits) in the denominator. See the explanations in the next section.
-
-\begin{framed}
- Note: as soon as the coefficients look like factorials, it is more
- efficient to use the \csbxint{RationalSeries} macro whose evaluation
- will avoid a denominator build-up; indeed the raw operations of
- addition and subtraction of fractions blindly multiply out
- denominators. So the raw evaluation of $\sum_{n=0}^{|N|}1/n!$ with
- \csa{xintSeries} will have a denominator equal to $\prod_{n=0}^{|N|}
- n!$. Needless to say this makes it more difficult to compute the exact
- value of this sum with |N=50|, for example, whereas with
- \csbxint{RationalSeries} the denominator does not
- get bigger than $50!$.
-
-\footnotesize
- For info: by the way $\prod_{n=0}^{50} n!$ is easily computed by \xintname
- and is a number with 1394 digits. And $\prod_{n=0}^{100} n!$ is also
- computable by \xintname (24 seconds on my laptop for the brute force
- iterated multiplication of all factorials, a
- specialized routine would do it faster) and has 6941 digits (this
- means more than two pages if printed...). Whereas $100!$ only has
- 158 digits.
-\end{framed}
-
-% \newcount\cntb
-% \cnta 2
-% \loop
-% \advance\cntb by \xintLen{\xintFac{\the\cnta}}%
-% \ifnum\cnta < 50
-% \advance\cnta 1
-% \repeat
-% \the\cntb
-
-% \cnta 2
-% \def\z{1}
-% \pdfresettimer
-% \loop
-% \edef\z {\xintiMul\z{\xintFac{\the\cnta}}}%
-% \ifnum\cnta < 100
-% \advance\cnta 1
-% \repeat
-% \edef\temps{\the\pdfelapsedtime}%
-
-% \temps: \xintQuo\temps{\xintiMul{60}{65536}} minutes,
-% \xintQuo{\xintRem\temps{\xintiMul{60}{65536}}}{65536} secondes et
-% \xintiTrunc {2}{\xintRem\temps{65536}/65536} centièmes de secondes
-% 1573518: 0 minutes, 24 secondes et 0 centièmes de secondes
-% nota bene, marrant c'était 0,99 centièmes en fait.
-
-% \xintLen\z
-
-% \printnumber\z
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]
+\end{everbatim*}
+
+The definition of |\coeff| as |\xintiiMON{#1}/#1.5| is quite suboptimal. It
+allows |#1| to be a big integer, but anyhow only small integers are accepted
+as initial and final indices (they are of the \numx{} type). Second, when the
+\xintfracname parser sees the |#1.5| it will remove the dot hence create a
+denominator with one digit more. For example |1/3.5| turns internally into
+|10/35| whereas it would be more efficient to have |2/7|. For info here is the
+non-reduced |\w|:
+\[\xintFrac\w\]
+It would have been bigger still in releases earlier than |1.1|: now, the
+\xintfracname \csbxint{Add} routine does not multiply blindly denominators
+anymore, it checks if one is a multiple of the other. However it does not
+practice systematic reduction to lowest terms.
+
+A more efficient way to code |\coeff| is illustrated next.
+\begin{everbatim*}
+\def\coeff #1{\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}%
+% The [0] in \coeff is a tiny optimization: in its presence the \xintfracname parser
+% sees something which is already in internal format.
+\oodef\w {\xintSeries {0}{50}{\coeff}}
+\[\sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12}=\xintFrac\w\]
+\end{everbatim*}
+The reduced form |\z| as displayed above only differs from this one by a
+factor of \dtt{\xintNum {\xintDenominator\w/\xintDenominator\z}}.
\setlength{\columnsep}{0pt}
-\dverb|@
+\everb|@
\def\coeffleibnitz #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]}
\cnta 1
-\loop % in this loop we recompute from scratch each partial sum!
+\loop % in this loop we recompute from scratch each partial sum!
% we can afford that, as \xintSeries is fast enough.
-\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
- \xintTrunc {12}
- {\xintSeries {1}{\cnta}{\coeffleibnitz}}\dots
+\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+ \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
- \noindent\hbox to 2em{\hfil\digitstt{\the\cnta.} }%
+ \noindent\hbox to 2em{\hfil\dtt{\the\cnta.} }%
\xintTrunc {12}{\xintSeries {1}{\cnta}{\coeffleibnitz}}\dots
\endgraf
\ifnum\cnta < 30 \advance\cnta 1 \repeat
@@ -9338,34 +11033,28 @@ digits) in the denominator. See the explanations in the next section.
\subsection{\csbh{xintiSeries}}\label{xintiSeries}
\def\coeff #1{\xintiTrunc {40}
- {\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
+ {\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
\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|@
+\everb|@
\def\coeff #1{\xintiTrunc {40}{\xintMON{#1}/#1.5}}%
% better:
\def\coeff #1{\xintiTrunc {40}
- {\the\numexpr 2*\xintiiMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
+ {\the\numexpr 2*\xintiiMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
% better still:
\def\coeff #1{\xintiTrunc {40}
- {\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
+ {\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\]|
-
-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
-factor of five and leads to a faster evaluation. The third way is faster, after
-all there is no need to use \csbxint{MON} (or rather
-\hyperref[fn:xintiiMON]{\csa{xintiiMON}} which has
-less parsing overhead) on integers
-obeying the \TeX{} bound. The denominator having no sign, we have added the
-|[0]| as this speeds up (infinitesimally) the parsing.
+ \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\dots\]
+|
+
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx \xintTrunc
-{40}{\xintiSeries {0}{50}{\coeff}[-40]}\] We should have cut out at
+{40}{\xintiSeries {0}{50}{\coeff}[-40]}\]
+
+We should have cut out at
least the last two digits: truncating errors originating with the first
coefficients of the sum will never go away, and each truncation
introduces an uncertainty in the last digit, so as we have 40 terms, we
@@ -9373,32 +11062,35 @@ should trash the last two digits, or at least round at 38 digits. It is
interesting to compare with the computation where rounding rather than
truncation is used, and with the decimal
expansion of the exactly computed partial sum of the series:
-\dverb|@
+\everb|@
\def\coeff #1{\xintiRound {40} % rounding at 40
- {\the\numexpr\ifodd #1 -2\else2\fi\relax/\the\numexpr 2*#1+1\relax [0]}}%
+ {\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.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
\xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\]
\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\]|
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12}
+ = \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]}}%
+ {\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.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
\xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\]
\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}
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12}
= \xintTrunc {50}{\xintSeries {0}{50}{\exactcoeff}}\dots\]
This shows indeed that our sum of truncated terms
-estimated wrongly the 39th and 40th digits of the exact result\footnote{as
- the series
- is alternating, we can roughly expect an error of $\sqrt{40}$ and the
- last two digits are off by 4 units, which is not contradictory to our
- expectations.} and that the sum of rounded terms fared a bit better.
+estimated wrongly the 39th and 40th digits of the exact result%
+%
+\footnote{as the series is alternating, we can roughly expect an error
+ of $\sqrt{40}$ and the last two digits are off by 4 units, which is
+ not contradictory to our expectations.}
+%
+and that the sum of rounded terms fared a bit better.
\subsection{\csbh{xintRationalSeries}}\label{xintRationalSeries}
@@ -9416,49 +11108,30 @@ expand to its value after iterated full expansion of its first token. |A| and
expressions built with such; they must obey the \TeX{} bound. The initial term
|f| may be a macro |\f|, it will be expanded to its value representing |F(A)|.
-\dverb|@
+\begin{everbatim*}
\def\ratio #1{2/#1[0]}% 2/n, to compute exp(2)
\cnta 0 % previously declared count
-\loop \edef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
-\noindent$\sum_{n=0}^{\the\cnta} \frac{2^n}{n!}=
+\begin{quote}\normalcolor
+\loop \oodef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
+\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|
-
-\def\ratio #1{2/#1[0]}% 2/n, comes from the series of exp(2)
-\cnta 0
-\loop
-\edef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
-\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
-
-\medskip
-Such computations would become quickly completely inaccessible via the
-\csbxint{Series} macros, as the factorials in the denominators would get
-all multiplied together: the raw addition and subtraction on fractions
-just blindly multiplies denominators! Whereas \csa{xintRationalSeries}
-evaluate the partial sums via a less silly iterative scheme.
-\dverb|@
-\def\ratio #1{-1/#1[0]}% -1/n, comes from the series of exp(-1)
-\cnta 0 % previously declared count
-\loop
-\edef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
-\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|
+ \xintFrac\z={}$\textcolor[named]{OrangeRed}{$\xintFrac{\xintIrr\z}$}\vtop to 5pt{}\par
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{quote}
+\end{everbatim*}
+\begin{everbatim*}
\def\ratio #1{-1/#1[0]}% -1/n, comes from the series of exp(-1)
\cnta 0 % previously declared count
-
-\loop
-\edef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
-\noindent$\sum_{n=0}^{\the\cnta} \frac{(-1)^n}{n!}=
- \xintTrunc{20}\z\dots=\xintFrac{\z}=\xintFrac{\xintIrr\z}$
- \vtop to 5pt{}\endgraf
+\begin{quote}\normalcolor
+\loop
+\oodef\z {\xintRationalSeries {0}{\cnta}{1}{\ratio }}%
+\noindent$\sum_{n=0}^{\the\cnta} \frac{(-1)^n}{n!}=
+ \xintTrunc{20}\z\dots=\xintFrac{\z}={}$\textcolor[named]{OrangeRed}{$\xintFrac{\xintIrr\z}$}
+ \vtop to 5pt{}\par
\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{quote}
+\end{everbatim*}
\def\ratioexp #1#2{\xintDiv{#1}{#2}}% #1/#2
@@ -9467,9 +11140,11 @@ evaluate the partial sums via a less silly iterative scheme.
a macro with two parameters: |\def\ratioexp
#1#2{\xintDiv{#1}{#2}}|\texttt{\%}| x/n: x=#1, n=#2|.
Then, if |\x| expands to some fraction |x|, the
-command \centeredline{|\xintRationalSeries {0}{b}{1}{\ratioexp{\x}}|}
+command %
+%
+\leftedline{|\xintRationalSeries {0}{b}{1}{\ratioexp{\x}}|}
will compute $\sum_{n=0}^{n=b} x^n/n!$:\par
-\dverb|@
+\begin{everbatim*}
\cnta 0
\def\ratioexp #1#2{\xintDiv{#1}{#2}}% #1/#2
\loop
@@ -9477,15 +11152,9 @@ 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|
-
-\cnta 0
-\loop
-\noindent
-$\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
+\end{everbatim*}
+
Observe that in this last example the |x| was directly inserted; if it
had been a more complicated explicit fraction it would have been
worthwile to use |\ratioexp\x| with |\x| defined to expand to its value.
@@ -9500,33 +11169,23 @@ use this result without recomputing it. This is \csbxint{RationalSeriesX},
documented next.
Here is a slightly more complicated evaluation:
-\dverb|@
+\begin{everbatim*}
\cnta 1
-\loop \edef\z {\xintRationalSeries
+\begin{multicols}{2}\normalcolor
+\loop \oodef\z {\xintRationalSeries
{\cnta}
- {2*\cnta-1}
+ {2*\cnta-1}
{\xintiPow {\the\cnta}{\cnta}/\xintFac{\cnta}}
{\ratioexp{\the\cnta}}}%
-\edef\w {\xintRationalSeries {0}{2*\cnta-1}{1}{\ratioexp{\the\cnta}}}%
+\oodef\w {\xintRationalSeries {0}{2*\cnta-1}{1}{\ratioexp{\the\cnta}}}%
\noindent
$\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|
-
-\cnta 1
-\begin{multicols}{2}
-\loop \edef\z {\xintRationalSeries
- {\cnta}
- {2*\cnta-1}
- {\xintiPow {\the\cnta}{\cnta}/\xintFac{\cnta}}
- {\ratioexp{\the\cnta}}}%
-\edef\w {\xintRationalSeries {0}{2*\cnta-1}{1}{\ratioexp{\the\cnta}}}%
-\noindent$\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
+ \sum_{n=0}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!} = {}$%
+ \textcolor[named]{OrangeRed}{$\xintTrunc{8}{\xintDiv\z\w}\dots$} \vtop to 5pt{}\endgraf
\ifnum\cnta<20 \advance\cnta 1 \repeat
\end{multicols}
+\end{everbatim*}
+
\subsection{\csbh{xintRationalSeriesX}}\label{xintRationalSeriesX}
@@ -9541,113 +11200,90 @@ 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-parameter macro; note the subtle differences
-between\centeredline{|\xintRationalSeries {A}{B}{\first}{\ratio{\g}}|}
-\centeredline{and |\xintRationalSeriesX {A}{B}{\first}{\ratio}{\g}|.} First the
+between%
+%
+\leftedline{|\xintRationalSeries {A}{B}{\first}{\ratio{\g}}|}
+%
+\leftedline{and |\xintRationalSeriesX {A}{B}{\first}{\ratio}{\g}|.} First the
location of braces differ... then, in the former case |\first| is a
\emph{no-parameter} macro expanding to a fractional number, and in the latter,
-it is a
+it is a
\emph{one-parameter} macro which will use |\g|. Furthermore the |X| variant
will expand |\g| at the very beginning whereas the former non-|X| former variant
will evaluate it each time it needs it (which is bad if this
evaluation is time-costly, but good if |\g| is a big explicit fraction
encapsulated in a macro).
-
The example will use the macro \csbxint{PowerSeries} which computes
efficiently exact partial sums of power series, and is discussed in the
next section.
-\dverb|@
+\begin{everbatim*}
\def\firstterm #1{1[0]}% first term of the exponential series
% although it is the constant 1, here it must be defined as a
% one-parameter macro. Next comes the ratio function for exp:
\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]}%
+\def\coefflog #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]}%
% Let L(h) be the first 10 terms of the log(1+h) series and
% let E(t) be the first 10 terms of the exp(t) series.
% The following computes E(L(a/10)) for a=1,...,12.
+\begin{multicols}{3}\raggedcolumns
\cnta 0
\loop
\noindent\xintTrunc {18}{%
\xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
- {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-1]}}}\dots
+ {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-1]}}}\dots
\endgraf
-\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
-% one-parameter macro. Next comes the ratio function for exp:
-\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]}%
-% Let L(h) be the first 10 terms of the log(1+h) series and
-% let E(t) be the first 10 terms of the exp(t) series.
-% The following computes E(L(a/12)) for a=1,..., 12.
-\begin{multicols}{3}\raggedcolumns
- \cnta 1
- \loop
- \noindent\xintTrunc {18}{%
- \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
\end{multicols}
- % to see how they look like...
- % \loop
- % \noindent\printnumber{%
- % \xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
- % {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-2]}}}\dots
- % \endgraf
- % \ifnum\cnta < 60 \advance \cnta 1 \repeat
+\end{everbatim*}
+
These completely exact operations rapidly create numbers with many digits. Let
us print in full the raw fractions created by the operation illustrated above:
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1[-1]}}}
-|E(L(1[-1]))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(1[-1]))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z})
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{12[-2]}}}
-|E(L(12[-2]))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(12[-2]))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z})
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{123[-3]}}}
-|E(L(123[-3]))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(123[-3]))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z})
-
We see that the denominators here remain the same, as our input only had various
powers of ten as denominators, and \xintfracname efficiently assemble (some
only, as we can see) powers of ten. Notice that 1 more digit in an input
denominator seems to mean 90 more in the raw output. We can check that with some
other test cases:
-
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/7}}}
-|E(L(1/7))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(1/7))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z}; length of denominator:
\xintLen {\xintDenominator \z})
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/71}}}
-|E(L(1/71))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(1/71))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z}; length of denominator:
\xintLen {\xintDenominator \z})
-
-\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+\oodef\z{\xintRationalSeriesX {0}{9}{\firstterm}
{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/712}}}
-|E(L(1/712))=|\digitstt{\printnumber{\z}} (length of numerator:
+|E(L(1/712))=|\dtt{\printnumber{\z}} (length of numerator:
\xintLen {\xintNumerator \z}; length of denominator:
\xintLen {\xintDenominator \z})
@@ -9655,11 +11291,8 @@ other test cases:
% \edef\w{\xintDenominator{\xintIrr{\z}}}
% \the\pdfelapsedtime
-For info the last fraction put into irreducible form still has 288 digits in its
-denominator.\footnote{putting this fraction in irreducible form takes more time
- than is typical of the other computations in this document; so exceptionally I
- have hard-coded the 288 in the document source.} Thus
-decimal numbers such as |0.123| (equivalently
+Thus
+decimal numbers such as |0.123| (equivalently
|123[-3]|) give less computing intensive tasks than fractions such as |1/712|:
in the case of decimal numbers the (raw) denominators originate in the
coefficients of the series themselves, powers of ten of the input within
@@ -9669,30 +11302,18 @@ coefficient being given by the order of series: here 10 from the log and 9 from
the exp, so 90. One more digit in the input means 90 more digits in the
numerator of the output: obviously we can not go on composing such partial sums
of series and hope that \xintname will joyfully do all at the speed of light!
-Briefly said, imagine that the rules of the game make the programmer like a
-security guard at an airport scanning machine: a never-ending flux of passengers
-keep on arriving and all you can do is re-shuffle the first nine of them,
-organize marriages among some, execute some, move children farther back among
-the first nine only. If a passenger comes along with many hand luggages, this
-will slow down the process even if you move him to ninth position, because
-sooner or later you will have to digest him, and the children will be big too.
-There is no way to move some guy out of the file and to a discrete interrogatory
-room for separate treatment or to give him/her some badge saying ``I left my
-stuff in storage box 357''.
Hence, truncating the output (or better, rounding) is the only way to go if one
needs a general calculus of special functions. This is why the package
\xintseriesname provides, besides \csbxint{Series}, \csbxint{RationalSeries}, or
-\csbxint{PowerSeries} which compute \emph{exact} sums, also has
-\csbxint{FxPtPowerSeries} for fixed-point computations.
-
-Update: release |1.08a| of \xintseriesname now includes a tentative naive
+\csbxint{PowerSeries} which compute \emph{exact} sums,
+\csbxint{FxPtPowerSeries} for fixed-point computations and a (tentative naive)
\csbxint{FloatPowerSeries}.
\subsection{\csbh{xintPowerSeries}}\label{xintPowerSeries}
\csa{xintPowerSeries}|{A}{B}{\coeff}{f}|\etype{\numx\numx\Ff\Ff}
-evaluates the sum
+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
@@ -9705,94 +11326,64 @@ fraction |f| in such a macro, if it has big numerators and denominators (`big'
means hundreds of digits) as it will then take less space in the processing
until being (repeatedly) used.
-This macro computes the \emph{exact} result (one can use it also for polynomial
-evaluation). Starting with release |1.04| a Horner scheme for polynomial
-evaluation is used, which has the advantage to avoid a denominator build-up
-which was plaguing the |1.03| version. \footnote{with powers |f\string^k|, from
- |k=0| to |N|, a denominator |d| of |f| became
- |d\string^\string{1+2+\dots+N\string}|, which is bad. With the |1.04| method,
- the part of the denominator originating from |f| does not accumulate to more
- than |d\string^N|. }
-
-\begin{framed}
- Note: as soon as the coefficients look like factorials, it is more efficient
- to use the \csbxint{RationalSeries} macro whose evaluation, also based on a
- similar Horner scheme, will avoid a denominator build-up originating in the
- coefficients themselves.
-\end{framed}
+This macro computes the \emph{exact} result (one can use it also for
+polynomial evaluation), using a Horner scheme which helps avoiding a
+denominator build-up (this problem however, even if using a naive additive
+approach, is much less acute since release |1.1| and its new policy regarding
+\csbxint{Add}).
-\dverb|@
+\begin{everbatim*}
\def\geom #1{1[0]} % the geometric series
-\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}\]|%
-\def\geom #1{1[0]} % the geometric series
-\def\f {5/17[0]} %
-\[ \sum_{n=0}^{n=20} \Bigl(\frac 5{17}\Bigr)^n
+\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}\]
+\end{everbatim*}
-\dverb|@
+\begin{everbatim*}
\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}
+\[ \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}}}\]|%
-\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}
- = \xintFrac {\xintIrr {\xintPowerSeries
- {1}{20}{\coefflog}{\f}}}\]
-\[ \log 2 \approx \sum_{n=1}^{50} \frac1{n\cdot 2^n}
+\[ \log 2 \approx \sum_{n=1}^{50} \frac1{n\cdot 2^n}
= \xintFrac {\xintIrr {\xintPowerSeries {1}{50}{\coefflog}{\f}}}\]
-\dverb|@
+\end{everbatim*}
+
+
+\begin{everbatim*}
+\setlength{\columnsep}{0pt}
+\begin{multicols}{3}
\cnta 1 % previously declared count
-\loop % in this loop we recompute from scratch each partial sum!
+\loop % in this loop we recompute from scratch each partial sum!
% we can afford that, as \xintPowerSeries is fast enough.
-\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
\xintTrunc {12}
{\xintPowerSeries {1}{\cnta}{\coefflog}{\f}}\dots
\endgraf
-\ifnum \cnta < 30 \advance\cnta 1 \repeat|
-\setlength{\columnsep}{0pt}
-\begin{multicols}{3}
- \cnta 1 % previously declared count
- \loop % in this loop we recompute from scratch each partial sum!
-% we can afford that, as \xintPowerSeries is fast enough.
-\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
- \xintTrunc {12}{\xintPowerSeries {1}{\cnta}{\coefflog}{\f}}\dots
-\endgraf
\ifnum \cnta < 30 \advance\cnta 1 \repeat
\end{multicols}
-\dverb|@
-%\def\coeffarctg #1{1/\the\numexpr\xintMON{#1}*(2*#1+1)\relax }%
-\def\coeffarctg #1{1/\the\numexpr\ifodd #1 -2*#1-1\else2*#1+1\fi\relax }%
-% the above gives (-1)^n/(2n+1). The sign being in the denominator,
-% **** no [0] should be added ****,
+\end{everbatim*}
+
+
+\begin{everbatim*}
+\def\coeffarctg #1{1/\the\numexpr\ifodd #1 -2*#1-1\else2*#1+1\fi\relax }%
+% the above gives (-1)^n/(2n+1). The sign being in the denominator,
+% **** no [0] should be added ****,
% else nothing is guaranteed to work (even if it could by sheer luck)
-% NOTE in passing this aspect of \numexpr:
-% **** \numexpr -(1)\relax does not work!!! ****
+% Notice in passing this aspect of \numexpr:
+% **** \numexpr -(1)\relax is ilegal !!! ****
\def\f {1/25[0]}% 1/5^2
-\[\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}}}\]|
+\[\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}}}\]
+\end{everbatim*}
-\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
- \frac15\sum_{n=0}^{15} \frac{(-1)^n}{(2n+1)25^n}
-= \xintFrac{\xintIrr {\xintDiv
- {\xintPowerSeries {0}{15}{\coeffarctg}{\f}}{5}}}\]
\subsection{\csbh{xintPowerSeriesX}}\label{xintPowerSeriesX}
%{\small\hspace*{\parindent}New with release |1.04|.\par}
\noindent This is the same as \csbxint{PowerSeries}\ntype{\numx\numx\Ff\Ff}
-apart
+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
@@ -9800,15 +11391,16 @@ 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.
+\csa{xintPowerSeriesX} should be used with |\f| as last parameter.
%
-\dverb|@
+\begin{everbatim*}
\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]}%
+\def\coefflog #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]}%
% Let L(h) be the first 10 terms of the log(1+h) series and
% let E(t) be the first 10 terms of the exp(t) series.
% The following computes L(E(a/10)-1) for a=1,..., 12.
+\begin{multicols}{3}\raggedcolumns
\cnta 1
\loop
\noindent\xintTrunc {18}{%
@@ -9817,26 +11409,9 @@ an expanding only context, doing |\edef\g{\f}| is no option, then
{\xintRationalSeries {0}{9}{1[0]}{\ratioexp{\the\cnta[-1]}}}
{1}}}\dots
\endgraf
-\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
-\def\coefflog #1{\the\numexpr\ifodd #1 1\else-1\fi\relax/#1[0]}%
-% Let L(h) be the first 10 terms of the log(1+h) series and
-% let E(t) be the first 10 terms of the exp(t) series.
-% The following computes L(E(a/10)-1) for a=1,..., 12.
-\begin{multicols}{3}\raggedcolumns
-\cnta 1
- \loop
- \noindent\xintTrunc {18}{%
- \xintPowerSeriesX {1}{10}{\coefflog}
- {\xintSub
- {\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
\end{multicols}
+\end{everbatim*}
\subsection{\csbh{xintFxPtPowerSeries}}\label{xintFxPtPowerSeries}
@@ -9870,57 +11445,61 @@ Perhaps in the next package release.
\def\coeffexp #1{1/\xintFac {#1}[0]}% [0] for faster parsing
\def\f {-1/2[0]}%
-\newcount\cnta
+\newcount\cnta
\setlength{\multicolsep}{0pt}
\begin{multicols}{3}[%
\centeredline{$e^{-\frac12}\approx{}$}]%
-\cnta 0
+\cnta 0
\noindent\loop
$\xintFxPtPowerSeries {0}{\cnta}{\coeffexp}{\f}{20}$\\
\ifnum\cnta<19
\advance\cnta 1
\repeat\par
\end{multicols}
-\dverb|@
+\everb|@
\def\coeffexp #1{1/\xintFac {#1}[0]}% 1/n!
\def\f {-1/2[0]}% [0] for faster input parsing
\cnta 0 % previously declared \count register
\noindent\loop
-$\xintFxPtPowerSeries {0}{\cnta}{\coeffexp}{\f}{20}$\\
+$\xintFxPtPowerSeries {0}{\cnta}{\coeffexp}{\f}{20}$\\
\ifnum\cnta<19 \advance\cnta 1 \repeat\par
% One should **not** trust the final digits, as the potential truncation
% 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}}}%
+%
+\leftedline{|\xintFxPtPowerSeries {0}{19}{\coeffexp}{\f}{25}=|
+\dtt{\xintFxPtPowerSeries {0}{19}{\coeffexp}{\f}{25}}}
+\oodef\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:
-\centeredline{|\xintPowerSeries {0}{19}{\coeffexp}{\f}| ${}=
+%
+\leftedline{|\xintPowerSeries {0}{19}{\coeffexp}{\f}| ${}=
\displaystyle\xintFrac{\z}$%
\vphantom{\vrule height 20pt depth 12pt}}%
-\centeredline{${}=\xintTrunc {30}{\z}\dots$} Thus, one should always
+%
+\leftedline{${}=\xintTrunc {30}{\z}\dots$} Thus, one should always
estimate a priori how many ending digits are not reliable: if there are
|N| terms and |N| has |k| digits, then digits up to but excluding the
last |k| may usually be trusted. If we are optimistic and the series is
alternating we may even replace |N| with $\sqrt{|N|}$ to get the number |k|
of digits possibly of dubious significance.
-
\subsection{\csbh{xintFxPtPowerSeriesX}}\label{xintFxPtPowerSeriesX}
%{\small\hspace*{\parindent}New with release |1.04|.\par}
\noindent\csa{xintFxPtPowerSeriesX}|{A}{B}{\coeff}{\f}{D}|%
-\ntype{\numx\numx}
+\ntype{\numx\numx}
computes, exactly as
\csa{xintFxPtPowerSeries}, the sum of
|\coeff{n}|\raisebox{.5ex}{|.|}|\f^n|\etype{\Ff\Ff\numx} from |n=A| to |n=B| with each term
@@ -9931,43 +11510,33 @@ is the result of this which is used in the computations.
% Let us illustrate this on the computation of |(1+y)^{5/3}| where
% |1+y=(1+x)^{3/5}| and each of the two binomial series is evaluated with ten
% terms, the results being computed with |8| digits after the decimal point, and
-% @|f|<1/10@.
-
+% $|f|<1/10$.
Let us illustrate this on the numerical exploration of the identity
-\centeredline{|log(1+x) = -log(1/(1+x))|}%
+%
+\leftedline{|log(1+x) = -log(1/(1+x))|}
+%
Let |L(h)=log(1+h)|, and |D(h)=L(h)+L(-h/(1+h))|. Theoretically thus,
|D(h)=0| but we shall evaluate |L(h)| and |-h/(1+h)| keeping only 10
-terms of their respective series. We will assume @|h|<0.5@. With only
+terms of their respective series. We will assume $|h|<0.5$. With only
ten terms kept in the power series we do not have quite 3 digits
-precision as @2^10=1024@. So it wouldn't make sense to evaluate things
+precision as $2^{10}=1024$. So it wouldn't make sense to evaluate things
more precisely than, say circa 5 digits after the decimal points.
-\dverb|@
-\cnta 0
-\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}% (-1)^{n-1}/n
-\def\coeffalt #1{\the\numexpr\ifodd#1 -1\else1\fi\relax [0]}% (-1)^n
-\loop
-\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
-\xintAdd {\xintFxPtPowerSeriesX {1}{10}{\coefflog}{\the\cnta [-2]}{5}}
- {\xintFxPtPowerSeriesX {1}{10}{\coefflog}
- {\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
- {5}}\endgraf
-\ifnum\cnta < 49 \advance\cnta 7 \repeat|
-
+\begin{everbatim*}
\cnta 0
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}% (-1)^{n-1}/n
\def\coeffalt #1{\the\numexpr\ifodd#1 -1\else1\fi\relax [0]}% (-1)^n
-
-
\begin{multicols}2
\loop
\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
-\digitstt{\xintAdd {\xintFxPtPowerSeriesX {1}{10}{\coefflog}{\the\cnta [-2]}{5}}
- {\xintFxPtPowerSeriesX {1}{10}{\coefflog}
- {\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
- {5}}}\endgraf
+\xintAdd {\xintFxPtPowerSeriesX {1}{10}{\coefflog}{\the\cnta [-2]}{5}}
+ {\xintFxPtPowerSeriesX {1}{10}{\coefflog}
+ {\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
+ {5}}\endgraf
\ifnum\cnta < 49 \advance\cnta 7 \repeat
\end{multicols}
+\end{everbatim*}
+
Let's say we evaluate functions on |[-1/2,+1/2]| with values more or less also
in |[-1/2,+1/2]| and we want to keep 4 digits of precision. So, roughly we need
@@ -9977,31 +11546,20 @@ digits precision. So we compute with 6 digits
precision but return only 4 digits (rounded) after the decimal point.
This result with 4 post-decimal points precision is then used as input
to the next evaluation.
-\dverb|@
-\loop
-\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
-\xintRound{4}
- {\xintAdd {\xintFxPtPowerSeriesX {1}{15}{\coefflog}{\the\cnta [-2]}{6}}
- {\xintFxPtPowerSeriesX {1}{15}{\coefflog}
- {\xintRound {4}{\xintFxPtPowerSeriesX {1}{15}{\coeffalt}
- {\the\cnta [-2]}{6}}}
- {6}}%
- }\endgraf
-\ifnum\cnta < 49 \advance\cnta 7 \repeat|
-
+\begin{everbatim*}
\begin{multicols}2
\loop
\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
-\digitstt{\xintRound{4}
+\dtt{\xintRound{4}
{\xintAdd {\xintFxPtPowerSeriesX {1}{15}{\coefflog}{\the\cnta [-2]}{6}}
- {\xintFxPtPowerSeriesX {1}{15}{\coefflog}
+ {\xintFxPtPowerSeriesX {1}{15}{\coefflog}
{\xintRound {4}{\xintFxPtPowerSeriesX {1}{15}{\coeffalt}
- {\the\cnta [-2]}{6}}}
+ {\the\cnta [-2]}{6}}}
{6}}%
- }}\endgraf
+ }}\endgraf
\ifnum\cnta < 49 \advance\cnta 7 \repeat
\end{multicols}
-
+\end{everbatim*}
Not bad... I have cheated a bit: the `four-digits precise' numeric
evaluations were left unrounded in the final addition. However the inner
@@ -10015,18 +11573,17 @@ I guess there should be some command to do this final truncating, or
better, rounding, at a given number |D'<D| of digits. Maybe for the next
release.
-
\subsection{\csbh{xintFloatPowerSeries}}\label{xintFloatPowerSeries}
%{\small\hspace*{\parindent}New with |1.08a|.\par}
\noindent\csa{xintFloatPowerSeries}|[P]{A}{B}{\coeff}{f}|%
\ntype{{\upshape[\numx]}\numx\numx}
- computes
+ computes
$\sum_{\text{|n=A|}}^{\text{|n=B|}}|\coeff{n}|\cdot |f|^{\,\text{|n|}}$
-with a floating point\etype{\Ff\Ff}
+with a floating point
precision given by the optional parameter |P| or by the current setting of
-|\xintDigits|.
+|\xintDigits|.\etype{\Ff\Ff}
In the current, preliminary, version, no attempt has been made to try to
guarantee to the final result the precision |P|. Rather, |P| is used for all
@@ -10041,10 +11598,13 @@ with |\coeff{n}|, and the sum is done adding one term at a time with
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}%
-\dverb+@
+\everb+@
\def\coefflog #1{\the\numexpr\ifodd#1 1\else-1\fi\relax/#1[0]}%
-\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}+%
-\centeredline{\digitstt{\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}}
+\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}
++
+
+%
+\leftedline{\dtt{\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}}
\subsection{\csbh{xintFloatPowerSeriesX}}\label{xintFloatPowerSeriesX}
@@ -10052,21 +11612,23 @@ with |\coeff{n}|, and the sum is done adding one term at a time with
\noindent\csa{xintFloatPowerSeriesX}|[P]{A}{B}{\coeff}{f}|%
\ntype{{\upshape[\numx]}\numx\numx}
-is like
+is like
\csa{xintFloatPowerSeries} with the difference that |f| is
-expanded once\etype{\Ff\Ff}
+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]}%
-\dverb+@
+\everb+@
\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]}}+%
-\centeredline{\digitstt{\xintFloatPowerSeriesX [8]{0}{30}{\coeffexp}
+ {\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}
++
+
+%
+\leftedline{\dtt{\xintFloatPowerSeriesX [8]{0}{30}{\coeffexp}
{\xintFloatPowerSeries [8]{1}{30}{\coefflog}{-1/2[0]}}}}
-
\subsection{Computing \texorpdfstring{$\log 2$}{log(2)} and \texorpdfstring{$\pi$}{pi}}\label{ssec:Machin}
@@ -10077,8 +11639,11 @@ make them difficult!) computations of the first digits of the decimal expansion
of the familiar constants $\log 2$ and $\pi$.
Let us start with $\log 2$. We will get it from this formula (which is
-left as an exercise): \centeredline{\digitstt{log(2)=-2\,log(1-13/256)-%
- 5\,log(1-1/9)}}%
+left as an exercise): %
+%
+\leftedline{\dtt{log(2)=-2\,log(1-13/256)-%
+ 5\,log(1-1/9)}}
+%
The number of terms to be kept in the log series, for a desired
precision of |10^{-D}| was roughly estimated without much theoretical
analysis. Computing exactly the partial sums with \csa{xintPowerSeries}
@@ -10104,12 +11669,12 @@ correct exact truncated one.
% 693147180559945309417232121458176568075500134360255254120680009493
-\dverb|@
+\begin{everbatim*}
\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)
\def\LogTwo #1%
-% get log(2)=-2log(1-13/256)- 5log(1-1/9)
+% get log(2)=-2log(1-13/256)- 5log(1-1/9)
{% we want to use \printnumber, hence need something expanding in two steps
% only, so we use here the \romannumeral0 method
\romannumeral0\expandafter\LogTwoDoIt \expandafter
@@ -10120,8 +11685,8 @@ correct exact truncated one.
% We print #1 digits, but we know the ending ones are garbage
{\the\numexpr #1\relax}% allows #1 to be a count register
}%
-\def\LogTwoDoIt #1#2#3%
-% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
+\def\LogTwoDoIt #1#2#3%
+% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
{% #3=nb of digits for computations, also used for printing
\xinttrunc {#3} % lowercase form to stop the \romannumeral0 expansion!
{\xintAdd
@@ -10131,32 +11696,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|
-
-\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)
-\def\LogTwo #1% get log(2)=-2log(1-13/256)- 5log(1-1/9) with #1 digits precision
-{% this #1 may be a count register, if desired
- \romannumeral0\expandafter\LogTwoDoIt \expandafter
- {\the\numexpr #1*150/143\expandafter}\expandafter % Nb Terms for 1/9
- {\the\numexpr #1*100/129\expandafter}\expandafter % Nb Terms for 13/256
- {\the\numexpr #1\relax }%
-}%
-\def\LogTwoDoIt #1#2#3% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
-{% #3=nb of digits for computations
- \xinttrunc {#3}
- {\xintAdd
- {\xintMul {2}{\xintFxPtPowerSeries {1}{#2}{\coefflog}{\xa}{#3}}}
- {\xintMul {5}{\xintFxPtPowerSeries {1}{#1}{\coefflog}{\xb}{#3}}}%
- }%
-}%
-
-\noindent $\log 2 \approx {}$\digitstt{\LogTwo {60}\dots}\endgraf
-\noindent\phantom{$\log 2$}${}\approx{}$\digitstt{\printnumber{\LogTwo
- {65}}\dots}\endgraf
-\noindent\phantom{$\log 2$}${}\approx{}$\digitstt{\printnumber{\LogTwo
- {70}}\dots}\endgraf
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {70}}\dots\endgraf
+\end{everbatim*}
Here is the code doing an exact evaluation of the partial sums. We have
added a |+1| to the number of digits for estimating the number of terms
@@ -10164,15 +11705,15 @@ to keep from the log series: we experimented that this gets exactly the
first |D| digits, for all values from |D=0| to |D=100|, except in one
case (|D=40|) where the last digit is wrong. For values of |D|
higher than |100| it is more efficient to use the code using
-\csa{xintFxPtPowerSeries}.
-\dverb|@
+\csa{xintFxPtPowerSeries}.
+\everb|@
\def\LogTwo #1% get log(2)=-2log(1-13/256)- 5log(1-1/9)
-{%
+{%
\romannumeral0\expandafter\LogTwoDoIt \expandafter
{\the\numexpr (#1+1)*150/143\expandafter}\expandafter
{\the\numexpr (#1+1)*100/129\expandafter}\expandafter
{\the\numexpr #1\relax}%
-}%
+}%
\def\LogTwoDoIt #1#2#3%
{% #3=nb of digits for truncating an EXACT partial sum
\xinttrunc {#3}
@@ -10180,7 +11721,8 @@ 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
@@ -10191,121 +11733,75 @@ again, say for |D=1010|.) A theoretical analysis could help confirm that this
algorithm always gets better than |10^{-D}| precision, but again, strings of
zeroes or nines encountered in the decimal expansion may falsify the ending
digits, nines may be zeroes (and the last non-nine one should be increased) and
-zeroes may be nine (and the last non-zero one should be decreased).
+zeroes may be nine (and the last non-zero one should be decreased).
\hypertarget{MachinCode}{}
-\dverb|@
-% pi = 16 Arctg(1/5) - 4 Arctg(1/239) (John Machin's formula)
-\def\coeffarctg #1{\the\numexpr\ifodd#1 -1\else1\fi\relax/%
- \the\numexpr 2*#1+1\relax [0]}%
-% the above computes (-1)^n/(2n+1).
-\def\xa {1/25[0]}% 1/5^2, the [0] for (infinitesimally) faster parsing
-\def\xb {1/57121[0]}% 1/239^2, the [0] for faster parsing
-\def\Machin #1{% \Machin {\mycount} is allowed
- \romannumeral0\expandafter\MachinA \expandafter
- % number of terms for arctg(1/5):
- {\the\numexpr (#1+3)*5/7\expandafter}\expandafter
- % number of terms for arctg(1/239):
- {\the\numexpr (#1+3)*10/45\expandafter}\expandafter
- % do the computations with 3 additional digits:
- {\the\numexpr #1+3\expandafter}\expandafter
- % allow #1 to be a count register:
- {\the\numexpr #1\relax }}%
-\def\MachinA #1#2#3#4%
-% #4: digits to keep after decimal point for final printing
-% #3=#4+3: digits for evaluation of the necessary number of terms
-% to be kept in the arctangent series, also used to truncate each
-% individual summand.
-{\xinttrunc {#4} % lowercase macro to match the initial \romannumeral0.
- {\xintSub
- {\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
- {\xintMul {4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
- }}%
-\[ \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 }%
+\begin{everbatim*}
+\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 }%
\def\xa {1/25[0]}% 1/5^2, the [0] for faster parsing
\def\xb {1/57121[0]}% 1/239^2, the [0] for faster parsing
\def\Machin #1{% #1 may be a count register, \Machin {\mycount} is allowed
\romannumeral0\expandafter\MachinA \expandafter
% number of terms for arctg(1/5):
- {\the\numexpr (#1+3)*5/7\expandafter}\expandafter
- % number of terms for arctg(1/239):
+ {\the\numexpr (#1+3)*5/7\expandafter}\expandafter
+ % number of terms for arctg(1/239):
{\the\numexpr (#1+3)*10/45\expandafter}\expandafter
% do the computations with 3 additional digits:
{\the\numexpr #1+3\expandafter}\expandafter
% allow #1 to be a count register:
{\the\numexpr #1\relax }}%
-\def\MachinA #1#2#3#4%
-{\xinttrunc {#4}
- {\xintSub
+\def\MachinA #1#2#3#4%
+{\xinttrunc {#4}
+ {\xintSub
{\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
{\xintMul{4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
}}%
\begin{framed}
\[ \pi = \Machin {60}\dots \]
\end{framed}
+\end{everbatim*}
+
Here is a variant|\MachinBis|,
which evaluates the partial sums \emph{exactly} using
\csa{xintPowerSeries}, before their final truncation. No need for a
``|+3|'' then.
-\dverb|@
+\begin{everbatim*}
\def\MachinBis #1{% #1 may be a count register,
% the final result will be truncated to #1 digits post decimal point
\romannumeral0\expandafter\MachinBisA \expandafter
% number of terms for arctg(1/5):
- {\the\numexpr #1*5/7\expandafter}\expandafter
- % number of terms for arctg(1/239):
+ {\the\numexpr #1*5/7\expandafter}\expandafter
+ % number of terms for arctg(1/239):
{\the\numexpr #1*10/45\expandafter}\expandafter
% allow #1 to be a count register:
{\the\numexpr #1\relax }}%
-\def\MachinBisA #1#2#3%
+\def\MachinBisA #1#2#3%
{\xinttrunc {#3} %
- {\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
- \romannumeral0\expandafter\MachinBisA \expandafter
- % number of terms for arctg(1/5):
- {\the\numexpr #1*5/7\expandafter}\expandafter
- % number of terms for arctg(1/239):
- {\the\numexpr #1*10/45\expandafter}\expandafter
- % allow #1 to be a count register:
- {\the\numexpr #1\relax }}%
-\def\MachinBisA #1#2#3%
-{\xinttrunc {#3} %
- {\xintSub
+ {\xintSub
{\xintMul {16/5}{\xintPowerSeries {0}{#1}{\coeffarctg}{\xa}}}
{\xintMul{4/239}{\xintPowerSeries {0}{#2}{\coeffarctg}{\xb}}}%
}}%
+\end{everbatim*}
Let us use this variant for a loop showing the build-up of digits:
-\dverb|@
- \cnta 0 % previously declared \count register
- \loop
- \MachinBis{\cnta} \endgraf % Plain's \loop does not accept \par
- \ifnum\cnta < 30 \advance\cnta 1 \repeat|
-
+\begin{everbatim*}
\begin{multicols}{2}
\cnta 0 % previously declared \count register
\loop \noindent
- \centeredline{\digitstt{\MachinBis{\cnta}}}%
+ \centeredline{\dtt{\MachinBis{\cnta}}}%
\ifnum\cnta < 30
\advance\cnta 1 \repeat
\end{multicols}
+\end{everbatim*}
-
-\hypertarget{Machin1000}{}
+\hypertarget{Machin1000}{}
%
You want more digits and have some time? compile this copy of the
-\hyperlink{MachinCode}{|\char 92 Machin|} with |etex| (or |pdftex|):
+\hyperlink{MachinCode}{|\Machin|} with |etex| (or |pdftex|):
%
-\dverb|@
+\everb|@
% Compile with e-TeX extensions enabled (etex, pdftex, ...)
\input xintfrac.sty
\input xintseries.sty
@@ -10325,26 +11821,29 @@ You want more digits and have some time? compile this copy of the
{\xintSub
{\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
{\xintMul {4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
-}}%
+}}%
\pdfresettimer
\oodef\Z {\Machin {1000}}
\odef\W {\the\pdfelapsedtime}
\message{\Z}
\message{computed in \xintRound {2}{\W/65536} seconds.}
-\bye |
+\bye
+|
This will log the first 1000 digits of $\pi$ after the decimal point. On my
-laptop (a 2012 model) this took about @16@ seconds last time I tried.%
-\footnote{With \texttt{1.09i} and earlier \xintname releases, this used to be
- \digitstt{42} seconds; the \texttt{1.09j} division is much faster with small
- denominators as occurs here with \digitstt{\char92xa=1/25}, and I believe this
- to be the main explanation for the speed gain.} As mentioned in the
+laptop (a 2012 model) this took about $16$ seconds last time I tried.%
+%
+\footnote{With \texttt{1.09i} and earlier \xintname releases, this used
+ to be \dtt{42} seconds; the \texttt{1.09j} division is much faster
+ with small denominators as occurs here with \dtt{\char92xa=1/25}, and
+ I believe this to be the main explanation for the speed gain.}
+%
+As mentioned in the
introduction, the file \href{http://www.ctan.org/pkg/pi}{pi.tex} by \textsc{D.
Roegel} shows that orders of magnitude faster computations are possible within
\TeX{}, but recall our constraints of complete expandability and be merciful,
please.
-
\textbf{Why truncating rather than rounding?} One of our main competitors
on the market of scientific computing, a canadian product (not
encumbered with expandability constraints, and having barely ever heard
@@ -10376,6 +11875,13 @@ always do it on a value computed with |D+1| truncation.
\section{Commands of the \xintcfracname package}
\label{sec:cfrac}
+\localtableofcontents
+
+% 14 octobre, problème de color stack overflow avec dvipdfmx que je n'ai
+% pas le temps d'essayer de comprendre.
+\def\everbatimxprehook {}
+\def\everbatimxposthook {}
+
This package was first included in release |1.04| (|2013/04/25|) of the
\xintname bundle. It was kept almost unchanged until |1.09m| of |2014/02/26|
which brings some new macros: \csbxint{FtoC}, \csbxint{CtoF}, \csbxint{CtoCv},
@@ -10395,9 +11901,6 @@ This section contains:
\hyperref[ssec:e-convergents]{convergents of $e$}.
\end{enumerate}
-
-\localtableofcontents
-
\subsection{Package overview}\label{ssec:cfracoverview}
The package computes partial quotients and convergents of a fraction, or
@@ -10411,20 +11914,19 @@ macros from the \xintname bundle, particularly the macros of \xinttoolsname
dealing with sequences of braced items or comma separated lists.
A \emph{simple} continued fraction has coefficients
-|[c0,c1,...,cN]| (usually called partial quotients, but I
+|[c0,c1,...,cN]| (usually called partial quotients, but I
dislike this entrenched terminology), where |c0| is a positive or
-negative integer and the others are positive integers.
-
+negative integer and the others are positive integers.
Typesetting is usually done via the |amsmath| macro |\cfrac|:
-\centeredline{|\[ c_0 + \cfrac{1}{c_1+\cfrac1{c_2+\cfrac1{c_3+\cfrac1{\ddots}}}}\]|}
+\begin{everbatim*}
\[ c_0 + \cfrac{1}{c_1+\cfrac1{c_2+\cfrac1{c_3+\cfrac1{\ddots}}}}\]
+\end{everbatim*}
+
Here is a concrete example:
-%
-\centeredline{|\[ \xintFrac {208341/66317}=\xintCFrac {208341/66317} \]|}
-%
+\begin{everbatim*}
\[ \xintFrac {208341/66317}=\xintCFrac {208341/66317}\]%
-%
+\end{everbatim*}
But it is the command \csbxint{CFrac} which did all the work of \emph{computing}
the continued fraction \emph{and} using |\cfrac| from |amsmath| to typeset
it.
@@ -10432,16 +11934,19 @@ it.
A \emph{generalized} continued fraction has the same structure but the
numerators are not restricted to be $1$, and numbers used in the continued
fraction may be arbitrary, also fractions, irrationals, complex,
-indeterminates.\footnote{\xintcfracname may be used with indeterminates,
+indeterminates.%
+%
+\footnote{\xintcfracname may be used with indeterminates,
for basic conversions from one inline format to another, but not for
actual computations. See \csbxint{GGCFrac}.}
+%
The \emph{centered} continued fraction is an
example:
-\centeredline{|\[ \xintFrac {915286/188421}=\xintGCFrac
- {5+-1/7+1/39+-1/53+-1/13} \]|}
+\begin{everbatim*}
\[ \xintFrac {915286/188421}=\xintGCFrac {5+-1/7+1/39+-1/53+-1/13}
-=\xintCFrac {915286/188421}\]
-
+ =\xintCFrac {915286/188421}\]
+\end{everbatim*}
+
The command \csbxint{GCFrac}, contrarily to
\csbxint{CFrac}, does not compute anything, it just typesets starting from a
generalized continued fraction in inline format, which in this example
@@ -10450,74 +11955,65 @@ for comparison of the two types of continued fractions.
To let \TeX{} compute the centered continued fraction of |f| there is
\csbxint{FtoCC}:
- \centeredline{|\[\xintFrac {915286/188421}\to\xintFtoCC {915286/188421}\]|}
+\begin{everbatim*}
\[\xintFrac {915286/188421}\to\xintFtoCC {915286/188421}\]
+\end{everbatim*}
The package macros are expandable and may be nested (naturally \csa{xintCFrac}
and \csa{xintGCFrac} must be at the top level, as they deal with typesetting).
-Thus
- \centeredline{|\[\xintGCFrac {\xintFtoCC{915286/188421}}\]|}
-produces
+\begin{everbatim*}
\[\xintGCFrac {\xintFtoCC{915286/188421}}\]
-
+\end{everbatim*}
The `inline' format expected on input by \csbxint{GCFrac} is
-\centeredline{$a_0+b_0/a_1+b_1/a_2+b_2/a_3+\cdots
- +b_{n-2}/a_{n-1}+b_{n-1}/a_n$}%
+%
+\leftedline{$a_0+b_0/a_1+b_1/a_2+b_2/a_3+\cdots+b_{n-2}/a_{n-1}+b_{n-1}/a_n$}
+%
Fractions among the coefficients are allowed but they must be enclosed
within braces. Signed integers may be left without braces (but the |+|
signs are mandatory). No spaces are allowed around the plus and fraction
symbols. The coefficients may themselves be macros, as long as these
macros are \fexpan dable.
-%
-\centeredline{|\xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintQuo
- {132}{25}}|}
-\[ \xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintQuo {132}{25}}}=
- \xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintQuo {132}{25}}\]
+\begin{everbatim*}
+\[ \xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}}
+ = \xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}\]
+\end{everbatim*}
To compute the actual fraction one has \csbxint{GCtoF}:
-\centeredline{|\[\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintQuo
- {132}{25}}}\]|}
-\[\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintQuo
- {132}{25}}}\]
-
+\begin{everbatim*}
+\[\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}}\]
+\end{everbatim*}
For non-numeric input there is \csbxint{GGCFrac}.
-%
-\centeredline{|\[\xintGGCFrac
- {a_0+b_0/a_1+b_1/a_2+b_2/\ddots+\ddots/a_{n-1}+b_{n-1}/a_n}\]|}
-%
+\begin{everbatim*}
\[\xintGGCFrac {a_0+b_0/a_1+b_1/a_2+b_2/\ddots+\ddots/a_{n-1}+b_{n-1}/a_n}\]
-%
-
+\end{everbatim*}
For regular continued fractions, there is a simpler comma separated format:
-\centeredline
-{|-7,6,19,1,33\to\xintFrac{\xintCstoF{-7,6,19,1,33}}=\xintCFrac{\xintCstoF{-7,6,19,1,33}}|}
-%
-\[
--7,6,19,1,33\to
-\xintFrac{\xintCstoF{-7,6,19,1,33}}=\xintCFrac{\xintCstoF{-7,6,19,1,33}}\]
-%
+\begin{everbatim*}
+\[-7,6,19,1,33\to\xintFrac{\xintCstoF{-7,6,19,1,33}}=\xintCFrac{\xintCstoF{-7,6,19,1,33}}\]
+\end{everbatim*}
The command \csbxint{FtoCs} produces from a fraction |f| the comma separated
list of its coefficients.
-\centeredline{|\[\xintFrac{1084483/398959}=[\xintFtoCs{1084483/398959}]\]|}
+\begin{everbatim*}
\[\xintFrac{1084483/398959}=[\xintFtoCs{1084483/398959}]\]
+\end{everbatim*}
If one prefers other separators, one can use the two arguments macros
\csbxint{FtoCx} whose first argument is the separator (which may consist of more
than one token) which is to be used.
-\centeredline{|\[\xintFrac{2721/1001}=\xintFtoCx {+1/(}{2721/1001})\cdots)\]|}
+\begin{everbatim*}
\[\xintFrac{2721/1001}=\xintFtoCx {+1/(}{2721/1001})\cdots)\]
-
-This allows under Plain \TeX{} with |amstex| to obtain the same effect
+\end{everbatim*}
+This allows under Plain \TeX{} with |amstex| to obtain the same effect
as with \LaTeX{}+|\amsmath|+\csbxint{CFrac}:
-\centeredline{|$$\xintFwOver{2721/1001}=\xintFtoCx {+\cfrac1\\ }{2721/1001}\endcfrac$$|}
-
+%
+\leftedline{|$$\xintFwOver{2721/1001}=\xintFtoCx {+\cfrac1\\ }{2721/1001}\endcfrac$$|}
As a shortcut to \csa{xintFtoCx} with separator |1+/|, there is
\csbxint{FtoGC}:
-\centeredline{|2721/1001=\xintFtoGC {2721/1001}|}%
-\centeredline{\digitstt{2721/1001=\xintFtoGC {2721/1001}}}
+\begin{everbatim*}
+2721/1001=\xintFtoGC {2721/1001}
+\end{everbatim*}
Let us compare in that case with the output of \csbxint{FtoCC}:
-\centeredline{|2721/1001=\xintFtoCC {2721/1001}|}%
-\centeredline{\digitstt{2721/1001=\xintFtoCC {2721/1001}}}
-
+\begin{everbatim*}
+2721/1001=\xintFtoCC {2721/1001}
+\end{everbatim*}
To obtain the coefficients as a sequence of braced numbers, there is
\csbxint{FtoC} (this is a shortcut for |\xintFtoCx {}|). This list
(sequence) may then be manipulated using the various macros of \xinttoolsname
@@ -10530,31 +12026,34 @@ corresponding fraction there is \csbxint{CtoF}.
The `|\printnumber|' (\autoref{ssec:printnumber}) macro which we use in this
document to print long numbers can also be useful on long continued fractions.
%
-\centeredline{|\printnumber{\xintFtoCC {35037018906350720204351049/%|}%
-\centeredline{|244241737886197404558180}}|}%
-\digitstt{\printnumber{\xintFtoCC {35037018906350720204351049/244241737886197404558180}}}.
+\begin{everbatim*}
+\printnumber{\xintFtoCC {35037018906350720204351049/244241737886197404558180}}
+\end{everbatim*}
+%
If we apply \csbxint{GCtoF} to this generalized continued fraction, we
discover that the original fraction was reducible:
-\centeredline{|\xintGCtoF
- {143+1/2+...+-1/9}|\digitstt{=\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6+-1/9}}}
+%
+\leftedline{|\xintGCtoF
+ {143+1/2+...+-1/9}|\dtt{=\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6+-1/9}}}
\def\mymacro #1{$\xintFrac{#1}=[\xintFtoCs{#1}]$\vtop to 6pt{}}
\begingroup
\catcode`^\active
-\def^#1^{\hbox{\fontfamily{lmtt}\selectfont #1}}%
+\def^#1^{\hbox{#1}}%
When a generalized continued fraction is built with integers, and
numerators are only |1|'s or |-1|'s, the produced fraction is
irreducible. And if we compute it again with the last sub-fraction
omitted we get another irreducible fraction related to the bigger one by
a Bezout identity. Doing this here we get:
-\centeredline{|\xintGCtoF {143+1/2+...+-1/6}|\digitstt{=\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6}}}
+%
+\leftedline{|\xintGCtoF {143+1/2+...+-1/6}|\dtt{=\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6}}}
and indeed:
-\[ \begin{vmatrix}
+\[\begin{vmatrix}
^2897319801297630107^ & ^328124887710626729^\\
- ^20197107104701740^ & ^2287346221788023^
- \end{vmatrix} = \mbox{\digitstt{\xintiSub {\xintiMul {2897319801297630107}{2287346221788023}}{\xintiMul{20197107104701740}{328124887710626729}}}}\]
+ ^20197107104701740^ & ^2287346221788023^
+ \end{vmatrix} = \mbox{\dtt{\xintiSub {\xintiMul {2897319801297630107}{2287346221788023}}{\xintiMul{20197107104701740}{328124887710626729}}}}\]
\endgroup
@@ -10564,78 +12063,73 @@ such as \csbxint{FtoCv}, \csbxint{FtoCCv}, and others which compute such
convergents, return them as a list of braced items, with no separator (as does
\csbxint {FtoC} for the partial quotients). Here is an example:
-\noindent
-\centeredline{|$$\xintFrac{915286/188421}\to \xintListWithSep {,}%|}%
-\centeredline{|{\xintApply{\xintFrac}{\xintFtoCv{915286/188421}}}$$|}
-\[ \xintFrac{915286/188421}\to \xintListWithSep {,}
-{\xintApply\xintFrac{\xintFtoCv{915286/188421}}}\]
-\centeredline{|$$\xintFrac{915286/188421}\to \xintListWithSep {,}%|}%
-\centeredline{|{\xintApply{\xintFrac}{\xintFtoCCv{915286/188421}}}$$|}
-\[ \xintFrac{915286/188421}\to \xintListWithSep {,}
-{\xintApply\xintFrac{\xintFtoCCv{915286/188421}}}\]
+\begin{everbatim*}
+\[\xintFrac{915286/188421}\to
+ \xintListWithSep{,}{\xintApply\xintFrac{\xintFtoCv{915286/188421}}}\]
+\end{everbatim*}
+\begin{everbatim*}
+\[\xintFrac{915286/188421}\to
+ \xintListWithSep{,}{\xintApply\xintFrac{\xintFtoCCv{915286/188421}}}\]
+\end{everbatim*}
%
We thus see that the `centered convergents' obtained with \csbxint{FtoCCv} are
among the fuller list of convergents as returned by \csbxint{FtoCv}.
Here is a more complicated use of \csa{xintApply}
and \csa{xintListWithSep}. We first define a macro which will be applied to each
-convergent:\centeredline{|\newcommand{\mymacro}[1]|%
- |{$\xintFrac{#1}=[\xintFtoCs{#1}]$\vtop to 6pt{}}|}%
+convergent:%
+%
+\leftedline{|\newcommand{\mymacro}[1]{$\xintFrac{#1}=[\xintFtoCs{#1}]$\vtop to 6pt{}}|}
+%
Next, we use the following code:
-\centeredline{|$\xintFrac{49171/18089}\to{}$|}%
-\centeredline{|\xintListWithSep {,
+%
+\leftedline{|$\xintFrac{49171/18089}\to{}$|}
+%
+\leftedline{|\xintListWithSep {,
}{\xintApply{\mymacro}{\xintFtoCv{49171/18089}}}|}
It produces:\par
\noindent$ \xintFrac{49171/18089}\to {}$\xintListWithSep {,
}{\xintApply{\mymacro}{\xintFtoCv{49171/18089}}}.
-
-\def\cn #1{\xintiiPow {2}{#1}}%
-
The macro \csbxint{CntoF} allows to specify the coefficients as a function given
by a one-parameter macro. The produced values do not have to be integers.
-\centeredline{|\def\cn #1{\xintiiPow {2}{#1}}% 2^n|}%
- \centeredline{|\[\xintFrac{\xintCntoF {6}{\cn}}=\xintCFrac [l]{\xintCntoF
- {6}{\cn}}\]|}%
-\[\xintFrac{\xintCntoF {6}{\cn}}=\xintCFrac [l]{\xintCntoF
- {6}{\cn}}\]
-Notice the use of the optional argument |[l]| to \csa{xintCFrac}. Other
+\begin{everbatim*}
+\def\cn #1{\xintiiPow {2}{#1}}% 2^n
+ \[\xintFrac{\xintCntoF {6}{\cn}}=\xintCFrac [l]{\xintCntoF {6}{\cn}}\]
+\end{everbatim*}
+
+% Mardi 14 octobre 2014 à 23:10:16
+% color stack overflow dans cette zone avec dvipdfmx commit b988dcb45
+% (pas avec pdflatex)
+
+Notice the use of the optional argument |[l]| to \csa{xintCFrac}. Other
possibilities are |[r]| and (default) |[c]|.
+\begin{everbatim*}
\def\cn #1{\xintPow {2}{-#1}}%
-\centeredline{|\def\cn #1{\xintPow {2}{-#1}}% 1/2^n|}%
-\centeredline{%
-|\[\xintFrac{\xintCntoF {6}{\cn}} = \xintGCFrac [r]{\xintCntoGC {6}{\cn}}|}%
-\centeredline{| = [\xintFtoCs {\xintCntoF {6}{\cn}}]\]|}%
-\[\xintFrac{\xintCntoF {6}{\cn}}=\xintGCFrac [r]{\xintCntoGC {6}{\cn}}=
- [\xintFtoCs {\xintCntoF {6}{\cn}}]\]
+ \[\xintFrac{\xintCntoF {6}{\cn}}=\xintGCFrac [r]{\xintCntoGC {6}{\cn}}=
+ [\xintFtoCs {\xintCntoF {6}{\cn}}]\]
+\end{everbatim*}
We used \csbxint{CntoGC} as we wanted to display also the continued fraction and
-not only the fraction returned by \csa{xintCntoF}.
+not only the fraction returned by \csa{xintCntoF}.
There are also \csbxint{GCntoF} and \csbxint{GCntoGC} which allow the same for
-generalized fractions. The following initial portion of a generalized continued
-fraction for $\pi$:
-\def\an #1{\the\numexpr 2*#1+1\relax }%
-\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\]
-was obtained with this code:
-\dverb|@
+generalized fractions. An initial portion of a generalized continued
+fraction for $\pi$ is obtained like this
+\begin{everbatim*}
\def\an #1{\the\numexpr 2*#1+1\relax }%
\def\bn #1{\the\numexpr (#1+1)*(#1+1)\relax }%
-\[ \xintFrac{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}} =
+\[\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\]
+\end{everbatim*}
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\]|
-\[ \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\]
+\begin{everbatim*}
+\[\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\]
+\end{everbatim*}
When studying the continued fraction of some real number, there is always
some doubt about how many terms are valid, when computed starting from some
@@ -10645,18 +12139,14 @@ and convergents. The macro \csbxint{FGtoC} outputs as a sequence of braced items
the common partial quotients of its two arguments. We can thus use it to produce
a sure list of valid convergents of $\pi$ for example, starting from some proven
lower and upper bound:
-
-\dverb|@
-$$\pi\to [\xintListWithSep{,}
- {\xintFGtoC {3.14159265358979323}{3.14159265358979324}}, \dots]$$
-$\pi\to\xintListWithSep{,\allowbreak\;}
- {\xintApply{\xintFrac}
- {\xintCtoCv{\xintFGtoC {3.14159265358979323}{3.14159265358979324}}}}, \dots$|
+\begin{everbatim*}
$$\pi\to [\xintListWithSep{,}
{\xintFGtoC {3.14159265358979323}{3.14159265358979324}}, \dots]$$
\noindent$\pi\to\xintListWithSep{,\allowbreak\;}
- {\xintApply{\xintFrac}
- {\xintCtoCv{\xintFGtoC {3.14159265358979323}{3.14159265358979324}}}},\;\dots$
+ {\xintApply{\xintFrac}
+ {\xintCtoCv{\xintFGtoC {3.14159265358979323}{3.14159265358979324}}}}, \dots$
+\end{everbatim*}
+
\subsection{\csbh{xintCFrac}}\label{xintCFrac}
@@ -10678,10 +12168,9 @@ generalized continued fraction given in inline format (or as macro which
will \fexpan d to it). It admits the
same optional argument as \csa{xintCFrac}. Plain \TeX{} with |amstex|
users, see \csbxint{GCtoGCx}.
-%
-\centeredline{|\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}\]|}
+\begin{everbatim*}
\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}\]
-%
+\end{everbatim*}
This is mostly a typesetting macro, although it does provoke the
expansion of the coefficients. See \csbxint{GCtoF} if you are impatient
to see this specific fraction computed.
@@ -10710,36 +12199,37 @@ one of the \xintcfracname macros producing a (general) continued
fraction in inline format, see \csbxint{FtoCx} for an example. If this
expansion is not wished, it is enough to start the argument with a
space.
-\centeredline{|\[\xintGGCFrac {1+q/1+q^2/1+q^3/1+q^4/1+q^5/\ddots}\]|}
+\begin{everbatim*}
\[\xintGGCFrac {1+q/1+q^2/1+q^3/1+q^4/1+q^5/\ddots}\]
+\end{everbatim*}
\subsection{\csbh{xintGCtoGCx}}\label{xintGCtoGCx}
%{\small New with release |1.05|.\par}
-
\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}}
+%
+\leftedline{|\xintGCtoGCx :;{1+2/3+4/5+6/7}| gives \xintGCtoGCx
+ :;{1+2/3+4/5+6/7}}
%
The following can be used byt Plain \TeX{}+|amstex| users to obtain an
output similar as the ones produced by \csbxint{GCFrac} and
\csbxint{GGCFrac}:\par
-\dverb|@
+\everb|@
$$\xintGCtoGCx {+\cfrac}{\\}{a+b/...}\endcfrac$$
-$$\xintGCtoGCx {+\cfrac\xintFwOver}{\\\xintFwOver}{a+b/...}\endcfrac$$|
-
+$$\xintGCtoGCx {+\cfrac\xintFwOver}{\\\xintFwOver}{a+b/...}\endcfrac$$
+|
\subsection{\csbh{xintFtoC}}\label{xintFtoC}
-\csa{xintFtoC}|{f}|\etype{\Ff} computes the
+\csa{xintFtoC}|{f}|\etype{\Ff} computes the
coefficients of the simple continued fraction of |f| and returns them as a list
(sequence) of braced items.\NewWith {1.09m}
-\centeredline{%
- |\oodef\test{\xintFtoC{-5262046/89233}}\texttt{\meaning\test}|}%
-\centeredline{\oodef\test{\xintFtoC{-5262046/89233}}\texttt{\meaning\test}}
+\begin{everbatim*}
+\oodef\test{\xintFtoC{-5262046/89233}}\texttt{\meaning\test}
+\end{everbatim*}
\subsection{\csbh{xintFtoCs}}\label{xintFtoCs}
@@ -10747,100 +12237,92 @@ coefficients of the simple continued fraction of |f| and returns them as a list
coefficients of the simple continued fraction of |f|. Notice that starting with
|1.09m| a space follows each comma (mainly for usage in text mode, as in math
mode spaces are produced in the typeset output by \TeX{} itself).
-\centeredline{%
- |\[ \xintSignedFrac{-5262046/89233} \to [\xintFtoCs{-5262046/89233}]\]|}%
+\begin{everbatim*}
\[ \xintSignedFrac{-5262046/89233} \to [\xintFtoCs{-5262046/89233}]\]
+\end{everbatim*}
\subsection{\csbh{xintFtoCx}}\label{xintFtoCx}
\csa{xintFtoCx}|{sep}{f}|\etype{n\Ff} returns the list of the
coefficients of the simple continued fraction of |f| separated with the
help of |sep|, which may be anything (and is kept unexpanded). For
-example, with Plain \TeX{} and |amstex|,
+example, with Plain \TeX{} and |amstex|,
%
-\centeredline{|$$\xintFtoCx {+\cfrac1\\ }{-5262046/89233}\endcfrac$$|}
+\leftedline{|$$\xintFtoCx {+\cfrac1\\ }{-5262046/89233}\endcfrac$$|}
%
will display the continued fraction using
|\cfrac|. Each coefficient is inside a brace pair \hbox{|{ }|}, allowing
a macro to end the separator and fetch it as argument,
for example, again with Plain \TeX{} and |amstex|:
-\dverb|@
+\everb|@
\def\highlight #1{\ifnum #1>200 \textcolor{red}{#1}\else #1\fi}
- $$\xintFtoCx {+\cfrac1\\ \highlight}{104348/33215}\endcfrac$$|
-%
+ $$\xintFtoCx {+\cfrac1\\ \highlight}{104348/33215}\endcfrac$$
+|
Due to the different and extremely cumbersome syntax of |\cfrac| under
\LaTeX{} it proves a bit tortuous to obtain there the same effect.
Actually, it is partly for this purpose that |1.09m| added \csbxint
{GGCFrac}. We thus use \csa{xintFtoCx} with a suitable separator, and\;
then the whole thing as argument to \csbxint{GGCFrac}:
-%
- \dverb|@
-\def\highlight #1{\ifnum #1>200
- \fcolorbox{blue}{white}{\boldmath\color{red}$#1$}%
- \else #1\fi}
-\[\xintGGCFrac {\xintFtoCx {+1/\highlight}{208341/66317}}\]|
-\def\highlight #1{\ifnum #1>200
- \fcolorbox{blue}{white}{\boldmath\color{red}$#1$}%
- \else #1\fi}
+\begin{everbatim*}
+\def\highlight #1{\ifnum #1>200 \fcolorbox{blue}{white}{\boldmath\color{red}$#1$}%
+ \else #1\fi}
\[\xintGGCFrac {\xintFtoCx {+1/\highlight}{208341/66317}}\]
+\end{everbatim*}
\subsection{\csbh{xintFtoGC}}\label{xintFtoGC}
\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'.
+format'.
% This continued fraction is a \emph{simple} one, not a
% \emph{generalized} one, but as it is produced in the format used for
% user input of generalized continued fractions, the macro was called
% \csa{xintFtoGC} rather than \csa{xintFtoC} for example.
-\centeredline{|566827/208524=\xintFtoGC {566827/208524}|}%
-\centeredline{566827/208524=\xintFtoGC {566827/208524}}
-
-
+%
+\begin{everbatim*}
+566827/208524=\xintFtoGC {566827/208524}
+\end{everbatim*}
\subsection{\csbh{xintFGtoC}}\label{xintFGtoC}
\csa{xintFGtoC}|{f}{g}|\etype{\Ff\Ff} computes the common initial coefficients
-to
+to
two given fractions |f| and |g|. Notice\NewWith {1.09m} that any real number |f<x<g| or |f>x>g|
will then necessarily share with |f| and |g| these common initial coefficients
for its regular continued fraction. The coefficients are output as a sequence of
braced numbers. This list can then be manipulated via macros from
\xinttoolsname, or other macros of \xintcfracname.
-\centeredline{%
- |\oodef\test{\xintFGtoC{-5262046/89233}{-5314647/90125}}\texttt{\meaning\test}|}%
-\centeredline{\oodef\test{\xintFGtoC{-5262046/89233}{-5314647/90125}}\texttt{\meaning\test}}
-\centeredline{%
- |\oodef\test{\xintFGtoC{3.141592653}{3.141592654}}\texttt{\meaning\test}|}%
-\centeredline{%
- \oodef\test{\xintFGtoC{3.141592653}{3.141592654}}\texttt{\meaning\test}}%
-\centeredline{%
- |\oodef\test{\xintFGtoC{3.1415926535897932384}{3.1415926535897932385}}\texttt{\meaning\test}|}%
-\oodef\test{\xintFGtoC{3.1415926535897932384}{3.1415926535897932385}}%
-\centeredline{%
- \texttt{\meaning\test}}%
-% \centeredline{\xintRound {30}{\xintCstoF{\xintListWithSep{,}{\test}}}}
-% \centeredline{\xintRound {30}{\xintCtoF{\test}}}
-% \centeredline{\xintCtoF{\test}}
-\centeredline{%
- |\oodef\test{\xintFGtoC{1.41421356237309}{1.4142135623731}}\texttt{\meaning\test}|}%
-\oodef\test{\xintFGtoC{1.41421356237309}{1.4142135623731}}%
-\centeredline{%
- \texttt{\meaning\test}}%
-% \centeredline{\xintRound {30}{\xintCstoF{\xintListWithSep{,}{\test}}}}
-% \centeredline{\xintRound {30}{\xintCtoF{\test}}}
-% \centeredline{\xintCtoF{\test}}
+\begin{everbatim*}
+\oodef\test{\xintFGtoC{-5262046/89233}{-5314647/90125}}\texttt{\meaning\test}
+\end{everbatim*}
+\begin{everbatim*}
+\oodef\test{\xintFGtoC{3.141592653}{3.141592654}}\texttt{\meaning\test}
+\end{everbatim*}
+\begin{everbatim*}
+\oodef\test{\xintFGtoC{3.1415926535897932384}{3.1415926535897932385}}\meaning\test
+\end{everbatim*}
+\begin{everbatim*}
+\xintRound {30}{\xintCstoF{\xintListWithSep{,}{\test}}}
+\end{everbatim*}
+\begin{everbatim*}
+\xintRound {30}{\xintCtoF{\test}}
+\end{everbatim*}
+\begin{everbatim*}
+\oodef\test{\xintFGtoC{1.41421356237309}{1.4142135623731}}\meaning\test
+\end{everbatim*}
\subsection{\csbh{xintFtoCC}}\label{xintFtoCC}
\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}}\]|}%
+|f|, in `inline format'. %
+\begin{everbatim*}
+566827/208524=\xintFtoCC {566827/208524}
+\end{everbatim*}
+\begin{everbatim*}
\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]
+\end{everbatim*}
\subsection{\csbh{xintCstoF}}\label{xintCstoF}
@@ -10849,17 +12331,14 @@ the coefficients, which may be fractions or even macros expanding to such
fractions. The final fraction may then be highly reducible. Starting with
release |1.09m| spaces before commas are allowed and trimmed automatically
(spaces after commas were already silently handled in earlier releases).
-\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}}\]|}%
+\begin{everbatim*}
\[\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}}\]
-\centeredline{|\xintGCFrac{{1/2}+1/{1/3}+1/{1/4}+1/{1/5}}= |}%
-\centeredline{| \xintFrac{\xintCstoF {1/2,1/3,1/4,1/5}}|}%
-\[\xintGCFrac{{1/2}+1/{1/3}+1/{1/4}+1/{1/5}}=
-\xintFrac{\xintCstoF {1/2,1/3,1/4,1/5}}\]
+ \xintSignedFrac{\xintCstoF {-1,3,-5,7,-9,11,-13}}=\xintSignedFrac{\xintGCtoF
+ {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]
+\end{everbatim*}
+\begin{everbatim*}
+\[\xintGCFrac{{1/2}+1/{1/3}+1/{1/4}+1/{1/5}}=\xintFrac{\xintCstoF {1/2,1/3,1/4,1/5}}\]
+\end{everbatim*}
%
A generalized continued fraction may produce a reducible fraction
(\csa{xintCstoF} tries its best not to accumulate in a silly way superfluous
@@ -10870,38 +12349,35 @@ simplification by 3 in the result above).
\csa{xintCtoF}|{{a}{b}{c}...{z}}|\etype{f} computes the fraction corresponding
to the coefficients, which may be fractions or even macros.\NewWith {1.09m}
-\centeredline{|\xintCtoF {\xintApply {\xintiiPow 3}{\xintSeq {1}{5}}}|}
-% pour vérifier que l'expansion se fait bien:
-%\centeredline{\digitstt{\xintCtoF {\xintApply { \xintiiPow 3}{\xintSeq {1}{5}}}}}
-\centeredline{\digitstt{\xintCtoF {\xintApply {\xintiiPow 3}{\xintSeq {1}{5}}}}}
-\centeredline{|\[ \xintFrac{14946960/4805083}=\xintCFrac {14946960/4805083}\]|}
+\begin{everbatim*}
+\xintCtoF {\xintApply {\xintiiPow 3}{\xintSeq {1}{5}}}
+\end{everbatim*}
+\begin{everbatim*}
\[ \xintFrac{14946960/4805083}=\xintCFrac {14946960/4805083}\]
-
-In the example above the power of @3@ was already pre-computed via the expansion
+\end{everbatim*}
+In the example above the power of $3$ was already pre-computed via the expansion
done by |\xintApply|, but if we try with |\xintApply { \xintiiPow 3}| where the
space will stop this expansion, we can check that |\xintCtoF| will itself
-provoke the needed coefficient expansion.
-% ok
-
+provoke the needed coefficient expansion.% ok
\subsection{\csbh{xintGCtoF}}\label{xintGCtoF}
\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}} =
+are mandatory.
+\begin{everbatim*}
+\[\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}}}}\]|
-\[\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}}} \]|
-\[ \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{\xintIrr{\xintGCtoF
+ {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]
+\end{everbatim*}
+
+\begin{everbatim*}
+\[ \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}}} \]
+\end{everbatim*}
+
The macro tries its best not to accumulate superfluous factor in the
denominators, but doesn't reduce the fraction to irreducible form before
returning it and does not do simplifications which would be obvious to a human.
@@ -10915,22 +12391,24 @@ 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
fractions, but otherwise it is not necessarily the case.
-\centeredline{|\xintListWithSep:{\xintCstoCv{1,2,3,4,5,6}}|}%
-\centeredline{\digitstt{\xintListWithSep:{\xintCstoCv{1,2,3,4,5,6}}}}
-\centeredline{|\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}|}%
-\centeredline{\digitstt{\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}}}
-% j'ai retiré les [0] à partir de la version 1.09b, le 3 octobre 2013.
-\centeredline{|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv|}%
- \centeredline{|{\xintPow {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]|}%
-\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv
- {\xintPow {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]
+\begin{everbatim*}
+\xintListWithSep:{\xintCstoCv{1,2,3,4,5,6}}
+\end{everbatim*}
+\begin{everbatim*}
+\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}
+\end{everbatim*}
+\begin{everbatim*}
+\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv {\xintPow
+ {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]
+\end{everbatim*}
\subsection{\csbh{xintCtoCv}}\label{xintCtoCv}
\csa{xintCtoCv}|{{a}{b}{c}...{z}}|\etype{f} returns the sequence of the
corresponding convergents, each one within braces.\NewWith {1.09m}
-\centeredline{|\oodef\test{\xintCtoCv {11111111111}}\texttt{\meaning\test}|}
-\centeredline{\oodef\test{\xintCtoCv {11111111111}}\texttt{\meaning\test}}
+\begin{everbatim*}
+\oodef\test{\xintCtoCv {11111111111}}\texttt{\meaning\test}
+\end{everbatim*}
\subsection{\csbh{xintGCtoCv}}\label{xintGCtoCv}
@@ -10941,48 +12419,44 @@ 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
with |\xintApply\xintIrr|.
-\dverb|@
-\[\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}}}}\]|
+\begin{everbatim*}
\[\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}}}}\]
+\end{everbatim*}
\subsection{\csbh{xintFtoCv}}\label{xintFtoCv}
\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}}}\]|}%
+\csbxint{ListWithSep}.
+\begin{everbatim*}
\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]
+\end{everbatim*}
\subsection{\csbh{xintFtoCCv}}\label{xintFtoCCv}
\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}}}\]|}%
+or \csbxint{ListWithSep}.
+\begin{everbatim*}
\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]
+\end{everbatim*}
\subsection{\csbh{xintCntoF}}\label{xintCntoF}
-\def\macro #1{\the\numexpr 1+#1*#1\relax}
\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
-original |c(j)| are the true coefficients of the final |f|.
-%
-\centeredline{%
- |\def\macro #1{\the\numexpr 1+#1*#1\relax}\xintCntoF {5}{\macro}|}%
-\centeredline{|\xintCntoF {5}{\macro}|}
-\centeredline{\digitstt{\xintCntoF {5}{\macro}}}
-%
+original |c(j)| are the true coefficients of the final |f|.
+\begin{everbatim*}
+\def\macro #1{\the\numexpr 1+#1*#1\relax} \xintCntoF {5}{\macro}
+\end{everbatim*}
+
This example shows that the fraction is output with a trailing number in square
brackets (representing a power of ten), this is for consistency with what do
most macros of \xintfracname, and does not have to be always this annoying |[0]|
@@ -10993,53 +12467,44 @@ coefficients, as the fraction is guaranteed to be irreducible then).
\subsection{\csbh{xintGCntoF}}\label{xintGCntoF}
-\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%
-\def\coeffB #1{\the\numexpr \ifodd #1 -\fi 1\relax }% (-1)^n
-
\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|.
-\centeredline{|\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%|}%
-\centeredline{|\def\coeffB #1{\the\numexpr \ifodd #1 -\fi 1\relax }% (-1)^n|}
-\centeredline{|\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}}|}%
-\centeredline{| = \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]|}
-\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}}
-= \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]
+\begin{everbatim*}
+\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%
+\def\coeffB #1{\the\numexpr \ifodd #1 -\fi 1\relax }% (-1)^n
+\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}} =
+ \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]
+\end{everbatim*}
There is also \csbxint{GCntoGC} to get the `inline format' continued
-fraction.
-
+fraction.
\subsection{\csbh{xintCntoCs}}\label{xintCntoCs}
\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}}\]|}%
-\[ \xintFrac{\xintCntoF
- {5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]
+|\numexpr|. %
+\begin{everbatim*}
+\xintCntoCs {5}{\macro}
+\end{everbatim*}
+\begin{everbatim*}
+\[ \xintFrac{\xintCntoF{5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]
+\end{everbatim*}
\subsection{\csbh{xintCntoGC}}\label{xintCntoGC}
-\def\macro #1{\the\numexpr\ifodd#1 -1-#1\else1+#1\fi\relax/%
- \the\numexpr 1+#1*#1\relax}
%
\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}}\]|}%
+pair of braces, they may thus be fractions.
+\begin{everbatim*}
+\def\macro #1{\the\numexpr\ifodd#1 -1-#1\else1+#1\fi\relax/\the\numexpr 1+#1*#1\relax}
+\oodef\x{\xintCntoGC {5}{\macro}}\meaning\x
\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]
+\end{everbatim*}
\subsection{\csbh{xintGCntoGC}}\label{xintGCntoGC}
@@ -11050,17 +12515,12 @@ givent to a |\numexpr|. The coefficients are enclosed into pairs
of braces, and may thus be fractions, the fraction slash will not be
confused in further processing by the continued fraction slashes.
%
-\dverb|@
+\begin{everbatim*}
\def\an #1{\the\numexpr #1*#1*#1+1\relax}%
\def\bn #1{\the\numexpr \ifodd#1 -\fi 1*(#1+1)\relax}%
-$\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 \ifodd #1 -\fi 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
+\end{everbatim*}
\subsection{\csbh{xintCstoGC}}\label{xintCstoGC}
@@ -11068,13 +12528,10 @@ $\xintGCntoGC {5}{\an}{\bn}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}}
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}} =
-\xintSignedFrac{\xintCstoF {-1,1/2,-1/3,1/4,-1/5}}\]
-
-
-\subsection{\csbh{xintiCstoF}, \csbh{xintiGCtoF}, \csbh{xint\-iCstoCv}, \csbh{xintiGCtoCv}}\label{xintiCstoF}
+\begin{everbatim*}
+\[\xintGCFrac {\xintCstoGC {-1,1/2,-1/3,1/4,-1/5}}=\xintSignedFrac{\xintCstoF {-1,1/2,-1/3,1/4,-1/5}}\]
+\end{everbatim*}
+\subsection{\csbh{xintiCstoF}, \csbh{xintiGCtoF}, \csbh{xintiCstoCv}, \csbh{xintiGCtoCv}}\label{xintiCstoF}
\label{xintiGCtoF}
\label{xintiCstoCv}
\label{xintiGCtoCv}
@@ -11088,38 +12545,20 @@ internal use by the package.
\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.
+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}
+\begin{everbatim*}
+\oodef\x {\xintGCtoGC {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/%
+ \xintFac {6}+\xintCstoF {2,-7,-5}/16}} \meaning\x
+\end{everbatim*}
To be honest I have forgotten for which purpose I wrote this macro in the first
place.
-
\subsection{Euler's number \texorpdfstring{$e$}{e}}\label{ssec:e-convergents}
Let us explore
the convergents of Euler's number $e$.
-\dverb|@
-\def\cn #1{\the\numexpr\ifcase \numexpr #1+3-3*((#1+2)/3)\relax
- 1\or1\or2*(#1/3)\fi\relax }
-% produces the pattern 1,1,2,1,1,4,1,1,6,1,1,8,... which are the
-% coefficients of the simple continued fraction of e-1.
-\cnta 0
-\def\mymacro #1{\advance\cnta by 1
- \noindent
- \hbox to 3em {\hfil\small\texttt{\the\cnta.} }%
- $\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}}}}|
-
\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
@@ -11136,7 +12575,7 @@ the convergents of Euler's number $e$.
from time to time\dots
\end{itemize}
-
+\begin{everbatim*}
\def\cn #1{\the\numexpr\ifcase \numexpr #1+3-3*((#1+2)/3)\relax
1\or1\or2*(#1/3)\fi\relax }
% produces the pattern 1,1,2,1,1,4,1,1,6,1,1,8,... which are the
@@ -11144,19 +12583,19 @@ the convergents of Euler's number $e$.
\cnta 0
\def\mymacro #1{\advance\cnta by 1
\noindent
- \hbox to 3em {\hfil\small\digitstt{\the\cnta.} }%
+ \hbox to 3em {\hfil\small\dtt{\the\cnta.} }%
$\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}}}}
+\end{everbatim*}
% \def\testmacro #1{\xintTrunc {30}{\xintAdd {1[0]}{#1}}\xintAdd {1[0]}{#1}}
% \pdfresettimer
-% \edef\z{\xintApply\testmacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}
+% \oodef\z{\xintApply\testmacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}
% (\the\pdfelapsedtime)
-
-\smallskip
+\smallskip
% The actual computation of the list of all 36 convergents accounts for
% only 8\% of the total time (total time equal to about 5 hundredths of a second
@@ -11173,88 +12612,138 @@ source of this document when the need arises, I limit here to the 200th
convergent.
% (getting the 500th took about 1.2s on my laptop last time I tried,
% and the 200th convergent is obtained ten times faster).
-\dverb|@
+\begin{everbatim*}
\oodef\z {\xintCntoF {199}{\cn}}%
\begingroup\parindent 0pt \leftskip 2.5cm
-\indent\llap {Numerator = }{\printnumber{\xintNumerator\z}\par
+\indent\llap {Numerator = }\printnumber{\xintNumerator\z}\par
\indent\llap {Denominator = }\printnumber{\xintDenominator\z}\par
-\indent\llap {Expansion = }\printnumber{\xintTrunc{268}\z}\dots
-\par\endgroup|
-
-\oodef\z {\xintCntoF {199}{\cn}}%
+\indent\llap {Expansion = }\printnumber{\xintTrunc{268}\z}\dots\par\endgroup
+\end{everbatim*}
-\begingroup\parindent 0pt \leftskip 2.5cm
-\indent\llap {Numerator = }\digitstt{\printnumber{\xintNumerator\z}}\par
-\indent\llap {Denominator = }\digitstt{\printnumber{\xintDenominator\z}}\par
-\indent\llap
- {Expansion = }\digitstt{\printnumber{\xintTrunc{268}\z}\dots}\par\endgroup
One can also use a centered continued fraction: we get more digits but there are
also more computations as the numerators may be either
$1$ or $-1$.
-
-% will be used by the \lverb things
-
-\def\givesomestretch{%
-\fontdimen2\font=0.33333\fontdimen6\font
-\fontdimen3\font=0.16666\fontdimen6\font
-\fontdimen4\font=0.11111\fontdimen6\font
-}%
-\def\MacroFont{\ttfamily\small\givesomestretch\hyphenchar\font45
- \baselineskip12pt\relax }
-
-
-\ifnum\NoSourceCode=1
+\ifnum\NoSourceCode=1
\bigskip
\begin{framed}
- \ttfamily\small\givesomestretch\hyphenchar\font45 This documentation
- has been compiled without the source code. To produce the
- documentation with the source code included, run "tex xint.dtx" to
- generate xint.tex (if not already available), then edit xint.tex to set the
- \string\NoSourceCode\space toggle to 0, then run thrice "latex" on
- xint.tex and finally dvipdfmx on xint.dvi.
+ \small This documentation has been compiled without the source code,
+ which is available in the separate file:
+ %
+ \centeredline{|sourcexint.pdf|,}
+ %
+ which should be among the candidates proposed by |texdoc --list xint|. To
+ produce a single file including both the user documentation and the
+ source code, run |tex xint.dtx| to generate |xint.tex| (if not already
+ available), then edit |xint.tex| to set the |\NoSourceCode| toggle to |0|,
+ then run thrice |latex| on |xint.tex| and finally |dvipdfmx| on |xint.dvi|.
+ Alternatively, run |pdflatex| either directly on |xint.dtx|, or on
+ |xint.tex| with |\NoSourceCode| set to |0|.
\end{framed}
\fi
+% Mercredi 08 octobre 2014 à 22:09:54
+\ifnum\dosourcexint=1
++fi
++catcode`\ 0
+\catcode`\+ 12
+\etocignoredepthtags
+\etocsetnexttocdepth{section}
+\tableofcontents
\makeatletter
+\@gobble\fi
+
\StopEventually{\end{document}\endinput}
+\ifnum\dosourcexint=1
+\renewcommand{\etocaftertochook}{\addvspace{\bigskipamount}}
+\etocsettocstyle {}{}
+\else
+\clearpage
+% \newgeometry{%hmarginratio=4:3,
+% hscale=0.75,vscale=0.75}% ATTENTION \newgeometry fait
+% % un reset de vscale si on ne le
+% % précise pas ici !!!
+\fi
+
+\def\MARGEPAGENO{2.5em}
+
+\etocdepthtag.toc {implementation}
+\addtocontents{toc}{\gdef\string\sectioncouleur{[named]{RoyalPurple}}}
+
+\makeatletter
\def\storedlinecounts {}
\def\StoreCodelineNo #1{\edef\storedlinecounts{%
\unexpanded\expandafter{\storedlinecounts}%
{{#1}{\the\c@CodelineNo}}}\c@CodelineNo\z@ }
-\makeatother
+% Pour le code des macros
+% On va redéfinir \macro@font
+% Pas de couleur, et 0 slashed
-\newgeometry{hmarginratio=4:3,hscale=0.75}
+\def\macro@font {\ttbfamily }
+% Pour \lverb
-\etocdepthtag.toc {implementation}
+\def\MicroFont {\ttzfamily\color[named]{Purple}\makestarlowast }
+
+% Définition de \lverb
+\long\def\lverb {%
+ \relax\par\smallskip\noindent\null
+ \begingroup
+% en ai-je encore besoin?
+% \let\par\@@par\hbadness 100 \hfuzz 100pt\relax
+% supprimé pour dtx 1.1:
+% \hsize .85\hsize
+ \bgroup
+ \aftergroup\@@par \aftergroup\endgroup \aftergroup\medskip
+ \let\do\do@noligs \verbatim@nolig@list
+ \let\do\@makeother \dospecials
+ \catcode32 10 \catcode`\% 9 \catcode`\& 14 \catcode`\$ 0
+ \MicroFont % sera donc en couleur.
+ \@lverb
+}
+
+\def\@lverb #1{\catcode`#1\active
+ \lccode`\~`#1\lowercase{\let~\egroup}}%
+
+\makeatother
\MakePercentIgnore
-%
+%
% \catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
% \let</dtx>\relax
-% \def<*xinttools>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
+% \def<*xintkernel>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
%</dtx>
-%<*xinttools>
-% \def\MARGEPAGENO{2.5em}
-% \section {Package \xinttoolsnameimp implementation}
-% \label{sec:toolsimp}
+%<*xintkernel>
%
-% Release |1.09g| splits off |xinttools.sty| from |xint.sty|.
+% \bigskip
+% The main changes with Release |1.1| are in \xintexprnameimp.
+%
+% \section {Package \xintkernelnameimp implementation}
+% \label{sec:kernelimp}
%
% \localtableofcontents
%
+% Release |1.09g| of |2013/11/22| splits off |xinttools.sty| from |xint.sty|. But it
+% is still loaded automatically by |xint.sty|.
+%
+% Release |1.1| of |2014/10/28| splits off |xintcore.sty| from |xint.sty| and also
+% |xintkernel.sty| which is the common minimal code base for loading management and
+% catcode control with also a few programming utilities. It is loaded by both
+% |xintcore.sty| and |xinttools.sty| hence by all other packages.
+%
+% \noindent\fbox{|xinttools.sty| is not loaded anymore by |xint.sty|, nor by
+% |xintfrac.sty|, but only by |xintexpr.sty|.}
+%
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
-%
-% The method for package identification and reload detection is copied verbatim
-% from the packages by \textsc{Heiko Oberdiek} (with some modifications starting
-% with release |1.09b|).
%
-% The method for catcodes was also inspired by these packages, we proceed
-% slightly differently.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
+%
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% Starting with version |1.06| of the package, also |`| must be
% catcode-protected, because we replace everywhere in the code the
@@ -11262,7 +12751,7 @@ $1$ or $-1$.
% |\romannumeral-`0|.
%
% Starting with version |1.06b| I decide that I suffer from an indigestion of @
-% signs, so I replace them all with underscores |_|, \`a la \LaTeX 3.
+% signs, so I replace them all with underscores |_|, \`a la \LaTeX 3.
%
% Release |1.09b| is more economical: some macros are defined already in
% |xint.sty| (now |xinttools.sty|) and re-used in other modules. All catcode
@@ -11276,14 +12765,12 @@ $1$ or $-1$.
\endlinechar=13 %
\catcode123=1 % {
\catcode125=2 % }
- \catcode64=11 % @
- \catcode95=11 % _
\catcode35=6 % #
\catcode44=12 % ,
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \expandafter\let\expandafter\x\csname ver@xint.sty\endcsname
+ \catcode95=11 % _
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -11291,27 +12778,26 @@ $1$ or $-1$.
\def\y#1#2{\PackageInfo{#1}{#2}}%
\fi
\expandafter
- \ifx\csname numexpr\endcsname\relax
- \y{xinttools}{\numexpr not available, aborting input}%
+ \ifx\csname numexpr\endcsname\relax
+ \y{xintkernel}{\numexpr not available, aborting input}%
\aftergroup\endinput
- \else
- \ifx\x\relax % plain-TeX, first loading
\else
- \def\empty {}%
- \ifx\x\empty % LaTeX, first loading,
- % variable is initialized, but \ProvidesPackage not yet seen
+ \expandafter
+ \ifx\csname XINTsetupcatcodes\endcsname\relax
\else
- \y{xinttools}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \y{xintkernel}{I was already loaded, aborting input}%
+ \aftergroup\endinput
\fi
\fi
- \fi
- \def\ChangeCatcodesIfInputNotAborted
+ \def\SetCatcodesIfInputNotAborted
{%
\endgroup
- \def\XINT_storecatcodes
+ \def\XINT_restorecatcodes
{% takes care of all, to allow more economical code in modules
- \catcode34=\the\catcode34 % " xintbinhex, and 1.09k xintexpr
+ \catcode59=\the\catcode59 % ; xintexpr
+ \catcode126=\the\catcode126 % ~ xintexpr
+ \catcode39=\the\catcode39 % ' xintexpr
+ \catcode34=\the\catcode34 % " xintbinhex, and xintexpr
\catcode63=\the\catcode63 % ? xintexpr
\catcode124=\the\catcode124 % | xintexpr
\catcode38=\the\catcode38 % & xintexpr
@@ -11320,46 +12806,46 @@ $1$ or $-1$.
\catcode93=\the\catcode93 % ] -, xintfrac, xintseries, xintcfrac
\catcode91=\the\catcode91 % [ -, xintfrac, xintseries, xintcfrac
\catcode36=\the\catcode36 % $ xintgcd only
- \catcode94=\the\catcode94 % ^
- \catcode96=\the\catcode96 % `
- \catcode47=\the\catcode47 % /
- \catcode41=\the\catcode41 % )
- \catcode40=\the\catcode40 % (
- \catcode42=\the\catcode42 % *
- \catcode43=\the\catcode43 % +
- \catcode62=\the\catcode62 % >
- \catcode60=\the\catcode60 % <
- \catcode58=\the\catcode58 % :
- \catcode46=\the\catcode46 % .
- \catcode45=\the\catcode45 % -
- \catcode44=\the\catcode44 % ,
- \catcode35=\the\catcode35 % #
- \catcode95=\the\catcode95 % _
- \catcode125=\the\catcode125 % }
- \catcode123=\the\catcode123 % {
- \endlinechar=\the\endlinechar
- \catcode13=\the\catcode13 % ^^M
- \catcode32=\the\catcode32 %
- \catcode61=\the\catcode61\relax % =
+ \catcode94=\the\catcode94 % ^
+ \catcode96=\the\catcode96 % `
+ \catcode47=\the\catcode47 % /
+ \catcode41=\the\catcode41 % )
+ \catcode40=\the\catcode40 % (
+ \catcode42=\the\catcode42 % *
+ \catcode43=\the\catcode43 % +
+ \catcode62=\the\catcode62 % >
+ \catcode60=\the\catcode60 % <
+ \catcode58=\the\catcode58 % :
+ \catcode46=\the\catcode46 % .
+ \catcode45=\the\catcode45 % -
+ \catcode44=\the\catcode44 % ,
+ \catcode35=\the\catcode35 % #
+ \catcode95=\the\catcode95 % _
+ \catcode125=\the\catcode125 % }
+ \catcode123=\the\catcode123 % {
+ \endlinechar=\the\endlinechar
+ \catcode13=\the\catcode13 % ^^M
+ \catcode32=\the\catcode32 %
+ \catcode61=\the\catcode61\relax % =
}%
\edef\XINT_restorecatcodes_endinput
{%
- \XINT_storecatcodes\noexpand\endinput %
+ \XINT_restorecatcodes\noexpand\endinput %
}%
\def\XINT_setcatcodes
{%
\catcode61=12 % =
\catcode32=10 % space
\catcode13=5 % ^^M
- \endlinechar=13 %
+ \endlinechar=13 %
\catcode123=1 % {
\catcode125=2 % }
- \catcode95=11 % _ (replaces @ everywhere, starting with 1.06b)
+ \catcode95=11 % _ LETTER
\catcode35=6 % #
\catcode44=12 % ,
\catcode45=12 % -
\catcode46=12 % .
- \catcode58=11 % : (made letter for error cs)
+ \catcode58=11 % : LETTER
\catcode60=12 % <
\catcode62=12 % >
\catcode43=12 % +
@@ -11367,27 +12853,33 @@ $1$ or $-1$.
\catcode40=12 % (
\catcode41=12 % )
\catcode47=12 % /
- \catcode96=12 % ` (for ubiquitous \romannumeral-`0 and some \catcode )
- \catcode94=11 % ^
- \catcode36=3 % $
- \catcode91=12 % [
- \catcode93=12 % ]
- \catcode33=11 % !
- \catcode64=11 % @
- \catcode38=12 % &
- \catcode124=12 % |
- \catcode63=11 % ?
- \catcode34=12 % " missing from v < 1.09k although needed in xintbinhex
+ \catcode96=12 % `
+ \catcode94=11 % ^ LETTER
+ \catcode36=3 % $
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ \catcode33=11 % ! LETTER
+ \catcode64=11 % @ LETTER
+ \catcode38=12 % &
+ \catcode124=12 % |
+ \catcode63=11 % ? LETTER
+ \catcode34=12 % "
+ \catcode39=12 % '
+ \catcode126=3 % ~
+ \catcode59=12 % ;
}%
\XINT_setcatcodes
}%
-\ChangeCatcodesIfInputNotAborted
+\SetCatcodesIfInputNotAborted
+% \end{macrocode}
+% Other modules could possibly be loaded under a different catcode regime.
+% \begin{macrocode}
\def\XINTsetupcatcodes {% for use by other modules
\edef\XINT_restorecatcodes_endinput
{%
- \XINT_storecatcodes\noexpand\endinput %
+ \XINT_restorecatcodes\noexpand\endinput %
}%
- \XINT_setcatcodes
+ \XINT_setcatcodes
}%
% \end{macrocode}
% \subsection{Package identification}
@@ -11396,11 +12888,11 @@ $1$ or $-1$.
% re-use in the other modules. Also I assume now that if |\ProvidesPackage|
% exists it then does define |\ver@<pkgname>.sty|, code of |HO| for some reason
% escaping me (compatibility with LaTeX 2.09 or other things ??) seems to set
-% extra precautions.
+% extra precautions.
%
% |1.09c| uses e-\TeX{} |\ifdefined|.
% \begin{macrocode}
-\ifdefined\ProvidesPackage
+\ifdefined\ProvidesPackage
\let\XINT_providespackage\relax
\else
\def\XINT_providespackage #1#2[#3]%
@@ -11408,14 +12900,13 @@ $1$ or $-1$.
\expandafter\xdef\csname ver@#2.sty\endcsname{#3}}%
\fi
\XINT_providespackage
-\ProvidesPackage {xinttools}%
- [2014/04/01 v1.09n Expandable and non-expandable utilities (jfB)]%
+\ProvidesPackage {xintkernel}%
+ [2014/10/28 v1.1 Paraphernalia for the xint packages (jfB)]%
% \end{macrocode}
-% \subsection{Token management, constants}
-% \lverb|In 1.09e \xint_undef replaced everywhere by \xint_bye.
-% Release 1.09h makes most everything \long.|
+% \subsection{Token management utilities}
+% \lverb|Most, but not all, are \long.|
% \begin{macrocode}
-\long\def\xint_gobble_ {}%
+\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{}%
@@ -11430,17 +12921,44 @@ $1$ or $-1$.
\long\def\xint_firstofone_thenstop #1{ #1}%
\long\def\xint_firstoftwo_thenstop #1#2{ #1}%
\long\def\xint_secondoftwo_thenstop #1#2{ #2}%
-\def\xint_minus_thenstop { -}%
-\def\xint_gob_til_zero #10{}% no need to make it long, so far
-\def\xint_UDzerominusfork #10-#2#3\krof {#2}% id.
+% \end{macrocode}
+% \subsection{gob til macros and UD style fork}
+% \begin{macrocode}
+\def\xint_gob_til_zero #10{}%
+\def\xint_UDzerominusfork #10-#2#3\krof {#2}%
\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 {}%
+% \end{macrocode}
+% \subsection{\csh{xint_afterfi}}
+% \begin{macrocode}
\long\def\xint_afterfi #1#2\fi {\fi #1}%
+% \end{macrocode}
+% \subsection{\csh{xint_bye}}
+% \begin{macrocode}
+\long\def\xint_bye #1\xint_bye {}%
+% \end{macrocode}
+% \subsection{\csh{xint_dothis}, \csh{xint_orthat}}
+% \lverb|New with 1.1. Used as \if..\xint_dothis{..}\fi <multiple times>
+% followed by \xint_orthat{...}. To be used with less probable things first.|
+% \begin{macrocode}
+\long\def\xint_dothis #1#2\xint_orthat #3{\fi #1}% v1.1
+\let\xint_orthat \xint_firstofone
+% \end{macrocode}
+% \subsection{\csh{xint_zapspaces}}
+% \lverb|New with 1.1 \xint_zapspaces is to be used (usually within an
+% \edef or a \csname...\endcsname) as \xint_zapspaces
+% foo<space>\xint_bye\xint_bye. Will strip some brace pairs. By the way
+% the \zap@space of LaTeX chokes on things such as \zap@space 1 {22} 3 4
+% \@empty|
+% \begin{macrocode}
+\def\xint_zapspaces #1 #2{#1#2\xint_zapspaces }% v1.1
+% \end{macrocode}
+% \subsection{Constants}
+% \begin{macrocode}
\chardef\xint_c_ 0
\chardef\xint_c_i 1
\chardef\xint_c_ii 2
@@ -11450,49 +12968,25 @@ $1$ or $-1$.
\chardef\xint_c_vi 6
\chardef\xint_c_vii 7
\chardef\xint_c_viii 8
-\newtoks\XINT_toks
-\xint_firstofone{\let\XINT_sptoken= } %<- space here!
% \end{macrocode}
-% \subsection{ \csh{xintodef}, \csh{xintgodef}, \csh{odef}}
-% \lverb|1.09i. For use in \xintAssign. No parameter text! 1.09j uses \xint...
-% rather than \XINT_.... \xintAssign [o] will use the preexisting \odef if there
-% was one before xint' loading.|
+% \subsection{\csh{odef}, \csh{oodef}, \csh{fdef}}
+% \lverb|May be prefixed with \global. No parameter text.|
% \begin{macrocode}
\def\xintodef #1{\expandafter\def\expandafter#1\expandafter }%
-\ifdefined\odef\else\let\odef\xintodef\fi
-\def\xintgodef {\global\xintodef }%
-% \end{macrocode}
-% \subsection{ \csh{xintoodef}, \csh{xintgoodef}, \csh{oodef}}
-% \lverb|1.09i. Can be prefixed with \global. No parameter text. The alternative
-% $\
-% $null \def\oodef #1#{\def\XINT_tmpa{#1}%$\
-% $null $quad $quad $quad \expandafter\expandafter\expandafter\expandafter$\
-% $null $quad $quad $quad \expandafter\expandafter\expandafter\def$\
-% $null $quad $quad $quad \expandafter\expandafter\expandafter\XINT_tmpa$\
-% $null $quad $quad $quad \expandafter\expandafter\expandafter }%$\
-% could not be prefixed by \global. Anyhow, macro parameter tokens would have to
-% somehow not be seen by expanded stuff, except if designed for it.
-% \xintAssign [oo] (etc...) uses the pre-existing \oodef if there was one. |
-% \begin{macrocode}
\def\xintoodef #1{\expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter#1%
- \expandafter\expandafter\expandafter }%
-\ifdefined\oodef\else\let\oodef\xintoodef\fi
-\def\xintgoodef {\global\xintoodef }%
-% \end{macrocode}
-% \subsection{ \csh{xintfdef}, \csh{xintgfdef}, \csh{fdef}}
-% \lverb|1.09i. No parameter text! |
-% \begin{macrocode}
-\def\xintfdef #1#2{\expandafter\def\expandafter#1\expandafter
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter }%
+\def\xintfdef #1#2{\expandafter\def\expandafter#1\expandafter
{\romannumeral-`0#2}}%
+\ifdefined\odef\else\let\odef\xintodef\fi
+\ifdefined\oodef\else\let\oodef\xintoodef\fi
\ifdefined\fdef\else\let\fdef\xintfdef\fi
-\def\xintgfdef {\global\xintfdef }% should be \global\fdef if \fdef pre-exists?
% \end{macrocode}
% \subsection{ \csh{xintReverseOrder}}
% \lverb|\xintReverseOrder: does NOT expand its argument.|
% \begin{macrocode}
\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
-\long\def\xintreverseorder #1%
+\long\def\xintreverseorder #1%
{%
\XINT_rord_main {}#1%
\xint_relax
@@ -11500,16 +12994,137 @@ $1$ or $-1$.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\long\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}%
}%
-\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
{%
\noexpand\expandafter\space\noexpand\xint_gob_til_xint_relax #1%
}%
% \end{macrocode}
+% \subsection{\csh{xintLength}}
+% \lverb|\xintLength does NOT expand its argument.|
+% \begin{macrocode}
+\def\xintLength {\romannumeral0\xintlength }%
+\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
+}%
+\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\the\numexpr #1+\xint_c_viii.%
+}%
+\def\XINT_length_finish_a\xint_relax\expandafter\XINT_length_loop
+ \the\numexpr #1+\xint_c_viii.#2\xint_bye
+{%
+ \XINT_length_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
+}%
+\def\XINT_length_finish_b #1#2#3#4#5#6#7#8\Z
+{%
+ \xint_gob_til_W
+ #1\XINT_length_finish_c \xint_c_
+ #2\XINT_length_finish_c \xint_c_i
+ #3\XINT_length_finish_c \xint_c_ii
+ #4\XINT_length_finish_c \xint_c_iii
+ #5\XINT_length_finish_c \xint_c_iv
+ #6\XINT_length_finish_c \xint_c_v
+ #7\XINT_length_finish_c \xint_c_vi
+ \W\XINT_length_finish_c \xint_c_vii\Z
+}%
+\edef\XINT_length_finish_c #1#2\Z #3%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
+\XINT_restorecatcodes_endinput%
+% \end{macrocode}
+%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
+%\let</xintkernel>\relax
+%\def<*xinttools>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
+%</xintkernel>
+%<*xinttools>
+%
+% \StoreCodelineNo {xintkernel}
+%
+% \section{Package \xinttoolsnameimp implementation}
+% \label{sec:toolsimp}
+%
+% \localtableofcontents
+%
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
+%
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
+%
+% The method for catcodes was also initially directly inspired by these
+% packages.
+%
+% \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xinttools.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintkernel.sty\endcsname
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xinttools}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \ifx\x\relax % plain-TeX, first loading of xinttools.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintkernel.sty\relax}%
+ \fi
+ \else
+ \def\empty {}%
+ \ifx\x\empty % LaTeX, first loading,
+ % variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintkernel.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintkernel}}%
+ \fi
+ \else
+ \aftergroup\endinput % xinttools already loaded.
+ \fi
+ \fi
+ \fi
+\z%
+\XINTsetupcatcodes% defined in xintkernel.sty
+% \end{macrocode}
+% \subsection{Package identification}
+% \begin{macrocode}
+\XINT_providespackage
+\ProvidesPackage{xinttools}%
+ [2014/10/28 v1.1 Expandable and non-expandable utilities (jfB)]%
+% \end{macrocode}
+% \lverb|\XINT_toks is used in macros such as \xintFor. It is not used
+% elsewhere in the xint bundle.|
+% \begin{macrocode}
+\newtoks\XINT_toks
+\xint_firstofone{\let\XINT_sptoken= } %<- space here!
+% \end{macrocode}
+% \subsection{\csh{xintgodef}, \csh{xintgoodef}, \csh{xintgfdef}}
+% \lverb|1.09i. For use in \xintAssign.|
+% \begin{macrocode}
+\def\xintgodef {\global\xintodef }%
+\def\xintgoodef {\global\xintoodef }%
+\def\xintgfdef {\global\xintfdef }%
+% \end{macrocode}
% \subsection{\csh{xintRevWithBraces}}
% \lverb|New with 1.06. Makes the expansion of its argument and then reverses
% the resulting tokens or braced tokens, adding a pair of braces to each (thus,
@@ -11534,7 +13149,7 @@ $1$ or $-1$.
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\long\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}%
@@ -11545,7 +13160,7 @@ $1$ or $-1$.
}%
\def\XINT_revwbr_finish_b #1#2#3#4#5#6#7#8\Z
{%
- \xint_gob_til_R
+ \xint_gob_til_R
#1\XINT_revwbr_finish_c 8%
#2\XINT_revwbr_finish_c 7%
#3\XINT_revwbr_finish_c 6%
@@ -11562,123 +13177,37 @@ $1$ or $-1$.
\csname xint_gobble_\romannumeral #1\endcsname
}%
% \end{macrocode}
-% \subsection{\csh{xintLength}}
-% \lverb|\xintLength does NOT expand its argument.$\
-% 1.09g adds the missing \xintlength, which was previously called \XINT_length,
-% and suppresses \XINT_Length$\
-% 1.06: improved code is roughly 20$% faster than the one from earlier
-% versions. 1.09a, \xintnum inserted. 1.09e: \Z->\xint_bye as this is called
-% from \xintNthElt, and there it was necessary not to use \Z. Later use of \Z
-% and \W perfectly safe here. Very minor optimization in 1.09m.|
-% \begin{macrocode}
-\def\xintLength {\romannumeral0\xintlength }%
-\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
-}%
-\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\the\numexpr #1+\xint_c_viii.%
-}%
-\def\XINT_length_finish_a\xint_relax\expandafter\XINT_length_loop
- \the\numexpr #1+\xint_c_viii.#2\xint_bye
-{%
- \XINT_length_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
-}%
-\def\XINT_length_finish_b #1#2#3#4#5#6#7#8\Z
-{%
- \xint_gob_til_W
- #1\XINT_length_finish_c \xint_c_
- #2\XINT_length_finish_c \xint_c_i
- #3\XINT_length_finish_c \xint_c_ii
- #4\XINT_length_finish_c \xint_c_iii
- #5\XINT_length_finish_c \xint_c_iv
- #6\XINT_length_finish_c \xint_c_v
- #7\XINT_length_finish_c \xint_c_vi
- \W\XINT_length_finish_c \xint_c_vii\Z
-}%
-\edef\XINT_length_finish_c #1#2\Z #3%
- {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
-% \end{macrocode}
% \subsection{\csh{xintZapFirstSpaces}}
-% \lverb|1.09f, written [2013/11/01].|
+% \lverb|1.09f, written [2013/11/01]. Modified (2014/10/21) for release 1.1 to
+% correct the bug in case of an empty argument, or argument containing only
+% spaces, which had been forgotten in first version. New version is simpler than
+% the initial one. This macro does NOT expand its argument.|
% \begin{macrocode}
\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }%
% \end{macrocode}
% \lverb|defined via an \edef in order to inject space tokens inside.|
% \begin{macrocode}
\long\edef\xintzapfirstspaces #1%
- {\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }%
-\xint_firstofone {\long\def\XINT_zapbsp_a #1 } %<- space token here
+ {\noexpand\XINT_zapbsp_a \space #1\xint_relax \space\space\xint_relax }%
+\xint_firstofone {\long\edef\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,
-% so the effect will be to remove precisely one space from the original, because
-% the first two space tokens are matched to the ones of the macro parameter
-% text. If the original #1 did not start with a space then the #1 will be this
-% original #1, with its added first space, up to the first <sp><sp> found. The
-% added initial space will stop later the \romannumeral0. And in
-% \xintZapLastSpaces we also carried along a space in order to be able to mix
-% tne two codes in \xintZapSpaces. Testing for \emptiness of #1 is NOT done with
-% an \if test because #1 may contain \if, \fi things (one could use a
-% \detokenize method), and also because xint.sty has a style of its own for
-% doing these things...|
+% \lverb|If the original #1 started with a space, the grabbed #1 is empty. Thus
+% _again? will see #1=\xint_bye, and hand over control to _again which will loop
+% back into \XINT_zapbsp_a, with one initial space less. If the original #1 did
+% not start with a space, or was empty, then the #1 below will be a <sptoken>,
+% then an extract of the original #1, not empty and not starting with a space,
+% which contains what was up to the first <sp><sp> present in original #1, or,
+% if none preexisted, <sptoken> and all of #1 (possibly empty) plus an ending
+% \xint_relax. The added initial space will stop later the \romannumeral0. No
+% brace stripping is possible. Control is handed over to \XINT_zapbsp_b which
+% strips out the ending \xint_relax<sp><sp>\xint_relax|
% \begin{macrocode}
- \XINT_zapbsp_again? #1\xint_bye\XINT_zapbsp_b {#1}%
-% \end{macrocode}
-% \lverb|The #1 above is thus either empty, or it starts with a (char 32) space
-% token followed with a non (char 32) space token and at any rate #1 is
-% protected from brace stripping. It is assumed that the initial input does not
-% contain space tokens of other than 32 as character code.|
-% \begin{macrocode}
-}%
+ \noexpand\XINT_zapbsp_again? #1\noexpand\xint_bye\noexpand\XINT_zapbsp_b #1\space\space
+}%
\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
-% do below \XINT_zapbsp_again we recall that we have stripped two spaces out of
-% <sp><original #1>, so we have one <sp> less in #1, and when we loop we better
-% not forget to re-insert one initial <sp>.|
-% \begin{macrocode}
-\edef\XINT_zapbsp_again\XINT_zapbsp_b #1{\noexpand\XINT_zapbsp_a\space }%
-% \end{macrocode}
-% \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}
-\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
-% spaces) was maximal, then #2 above is some spaces followed by \xint_bye, so in
-% the \XINT_zapbsp_end? below it appears as \xint_bye, else the #1 below will
-% not be nor give rise after brace removal to \xint_bye. And then the original
-% \xint_bye in #2 will have the effect that all is swallowed and we continue
-% 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}
-\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}
-\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
-% all the way up to \xint_bye, we take this opportunity to remove the two
-% initially added ending space tokens. We inserted an \empty to prevent brace
-% removal. The \expandafter get rid of the \empty.|
-% \begin{macrocode}
-\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}
-\long\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
+\xint_firstofone{\def\XINT_zapbsp_again\XINT_zapbsp_b} {\XINT_zapbsp_a }%
+\long\def\XINT_zapbsp_b #1\xint_relax #2\xint_relax {#1}%
% \end{macrocode}
% \subsection{\csh{xintZapLastSpaces}}
% \lverb+1.09f, written [2013/11/01].+
@@ -11687,72 +13216,51 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|Next macro is defined via an \edef for the space tokens.|
% \begin{macrocode}
-\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
- #1\space\space\noexpand\xint_bye \xint_relax}%
+\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {}\noexpand\empty#1%
+ \space\space\noexpand\xint_bye\xint_relax}%
% \end{macrocode}
-% \lverb|This creates a delimited macro with two space tokens:|
+% \lverb|The \empty from \xintzaplastspaces is to prevent brace removal in the
+% #2 below. The \expandafter chain removes it.|
% \begin{macrocode}
\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}
\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|&
-% When we have reached the ending space tokens, #3 is a bunch of spaces followed
-% 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.|
+% \lverb|When we have reached the ending space tokens, #3 is a bunch of spaces
+% followed 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}
\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.|
+% \lverb|We are done. The #1 here has accumulated all the previous material.|
% \begin{macrocode}
-\long\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
-% \XINT_zapesp_b we scooped everything up to the end, rather than trying to test
-% if the next thing was a bunch of spaces followed by \xint_bye\xint_relax. But
-% how can we expandably examine what comes next? if we pick up something as
-% undelimited parameter token we risk brace removal and we will never know about
-% it so we cannot reinsert correctly; the only way is to gather a delimited
-% macro parameter and be sure some token will be inside to forbid brace removal.
-% 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!.|
+% tokens after what we have gotten so far. Then we loop.|
% \begin{macrocode}
\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].+
+% \lverb+1.09f, written [2013/11/01]. Modified for 1.1, 2014/10/21 as it has the
+% same bug as \xintZapFirstSpaces. We in effect do first \xintZapFirstSpaces,
+% then \xintZapLastSpaces.+
% \begin{macrocode}
\def\xintZapSpaces {\romannumeral0\xintzapspaces }%
-% \end{macrocode}
-% \lverb|We start like \xintZapStartSpaces.|
-% \begin{macrocode}
-\long\edef\xintzapspaces #1%
- {\noexpand\XINT_zapsp_a \space #1\space\space\noexpand\xint_bye\xint_relax}%
-% \end{macrocode}
-% \lverb|&
-% Once the loop stripping the starting spaces is done, we plug into the
-% \xintZapLast$-Spaces code via \XINT_zapesp_b. As our #1 will always have an
-% initial space, this is why we arranged code of \xintZapLastSpaces to do the
-% same.|
-% \begin{macrocode}
-\xint_firstofone {\long\def\XINT_zapsp_a #1 } %<- space token here
-{%
- \XINT_zapsp_again? #1\xint_bye\XINT_zapesp_b {#1}{}%
-}%
+\long\edef\xintzapspaces #1% like \xintZapFirstSpaces.
+ {\noexpand\XINT_zapsp_a \space #1\xint_relax \space\space\xint_relax }%
+\xint_firstofone {\long\edef\XINT_zapsp_a #1 } %
+ {\noexpand\XINT_zapsp_again? #1\noexpand\xint_bye\noexpand\XINT_zapsp_b #1\space\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 }%
+\xint_firstofone{\def\XINT_zapsp_again\XINT_zapsp_b} {\XINT_zapsp_a }%
+\xint_firstofone{\def\XINT_zapsp_b} {\XINT_zapsp_c }%
+\long\edef\XINT_zapsp_c #1\xint_relax #2\xint_relax {\noexpand\XINT_zapesp_a
+ {}\noexpand \empty #1\space\space\noexpand\xint_bye\xint_relax }%
% \end{macrocode}
% \subsection{\csh{xintZapSpacesB}}
-% \lverb+1.09f, written [2013/11/01].+
+% \lverb+1.09f, written [2013/11/01]. Strips up to one pair of braces (but then
+% does not strip spaces inside).+
% \begin{macrocode}
\def\xintZapSpacesB {\romannumeral0\xintzapspacesb }%
\long\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
@@ -11768,7 +13276,7 @@ $1$ or $-1$.
\xint_bye #1\xint_relax\xint_bye\xintzapspaces #2{ #1}%
% \end{macrocode}
% \subsection{\csh{xintCSVtoList}, \csh{xintCSVtoListNonStripped}}
-% \lverb|&
+% \lverb|&
% \xintCSVtoList transforms a,b,..,z into {a}{b}...{z}. The comma separated list
% may be a macro which is first expanded (protect the first item with a space if
% it is not to be expanded). First included in release 1.06. Here, use of \Z
@@ -11788,22 +13296,22 @@ $1$ or $-1$.
\expandafter\xintzapspacesb
\expandafter{\romannumeral0\xintcsvtolistnonstrippednoexpand{#1}}}%
\def\xintCSVtoListNonStripped {\romannumeral0\xintcsvtolistnonstripped }%
-\def\xintCSVtoListNonStrippedNoExpand
+\def\xintCSVtoListNonStrippedNoExpand
{\romannumeral0\xintcsvtolistnonstrippednoexpand }%
\long\def\xintcsvtolistnonstripped #1%
{%
- \expandafter\XINT_csvtol_loop_a\expandafter
+ \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
}%
\long\def\xintcsvtolistnonstrippednoexpand #1%
{%
- \XINT_csvtol_loop_a
+ \XINT_csvtol_loop_a
{}#1,\xint_bye,\xint_bye,\xint_bye,\xint_bye
,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z
}%
-\long\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}}%
@@ -11815,7 +13323,7 @@ $1$ or $-1$.
}%
\def\XINT_csvtol_finish_b #1,#2,#3,#4,#5,#6,#7,#8\Z
{%
- \xint_gob_til_R
+ \xint_gob_til_R
#1\XINT_csvtol_finish_c 8%
#2\XINT_csvtol_finish_c 7%
#3\XINT_csvtol_finish_c 6%
@@ -11842,7 +13350,8 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintListWithSep}}
% \lverb|&
-% \xintListWithSep {\sep}{{a}{b}...{z}} returns a \sep b \sep .... \sep z$\
+% \xintListWithSep {\sep}{{a}{b}...{z}} returns a \sep b \sep ....
+% \sep z$\
% Included in release 1.04. The 'sep' can be \par's: the macro
% xintlistwithsep etc... are all declared long. 'sep' does not have to be a
% single token. It is not expanded. The list may be a macro and it is expanded.
@@ -11861,7 +13370,7 @@ $1$ or $-1$.
\long\def\xintlistwithsepnoexpand #1#2{\XINT_lws_start {#1}#2\xint_bye }%
\long\def\XINT_lws_start #1#2%
{%
- \xint_bye #2\XINT_lws_dont\xint_bye
+ \xint_bye #2\XINT_lws_dont\xint_bye
\XINT_lws_loop_a {#2}{#1}%
}%
\long\def\XINT_lws_dont\xint_bye\XINT_lws_loop_a #1#2{ }%
@@ -11876,7 +13385,7 @@ $1$ or $-1$.
% \subsection{\csh{xintNthElt}}
% \lverb+&
% First included in release 1.06.
-%
+%
% \xintNthElt {i}{stuff expanding to {a}{b}...{z}} (or `tokens' abcd...z)returns
% the i th element (one pair of braces removed). The list is first expanded. The
% \xintNthEltNoExpand does no expansion of its second argument. Both variants
@@ -11885,11 +13394,11 @@ $1$ or $-1$.
% With i = 0, the number of items is returned. This is different from \xintLen
% which is only for numbers (particularly, it checks the sign) and different
% from \xintLength which does not first expand its argument.
-%
+%
% Negative values return the |i|th element from the end. Release 1.09m
% rewrote the initial bits of the code (which checked the sign of #1 and
% expanded or not #2), ome `improvements' made earlier in 1.09c were quite
-% sub-efficient. Now uses \xint_UDzerominusfork, moved from xint.sty.
+% sub-efficient. Now uses \xint_UD$-zero$-minus$-fork, moved from xint.sty.
%
% A bug in \XINT_nthelt_finish was introduced in 1.09i (2013/12/18): in order to
% pre-expand \space, I used an \edef as in quite a few other places of the code.
@@ -11915,7 +13424,7 @@ $1$ or $-1$.
#1-{\XINT_nthelt_bzero}%
0#1{\XINT_nthelt_bneg {#2}}%
0-{\XINT_nthelt_bpos {#1#2}}%
- \krof
+ \krof
}%
\long\def\XINT_nthelt_bzero #1%
{%
@@ -11954,24 +13463,24 @@ $1$ or $-1$.
\fi\expandafter\expandafter\expandafter\XINT_nthelt_finish
\csname xint_gobble_\romannumeral\numexpr#1-\xint_c_i\endcsname
}%
-\long\edef\XINT_nthelt_finish #1#2\xint_bye
+\long\edef\XINT_nthelt_finish #1#2\xint_bye
{\noexpand\xint_gob_til_xint_relax #1\noexpand\expandafter\space
\noexpand\xint_gobble_ii\xint_relax\space #1}%
% \end{macrocode}
% \subsection{\csh{xintKeep}}
% \lverb+&
% First included in release 1.09m.
-%
+%
% \xintKeep {i}{stuff expanding to {a}{b}...{z}} (or `tokens' abcd...z,
% but each naked token ends up braced in the output) returns (in two
% expansion steps) the first i elements from the list, which is first
% f-expanded. The i is expanded inside \numexpr. Variant
% \xintKeepNoExpand does not expand the list argument.
%
-% With i = 0, the empty sequence is returned.
+% With i = 0, the empty sequence is returned.
%
% With i<0, the last |i| elements are returned (in the same order as in
-% the original list).
+% the original list).
%
% With |i| equal to or bigger than the length of the (f-expanded) list,
% the full list is returned.+
@@ -11993,7 +13502,7 @@ $1$ or $-1$.
#1-{\expandafter\space\xint_gobble_i }%
0#1{\XINT_keep_bneg_a {#2}}%
0-{\XINT_keep_bpos {#1#2}}%
- \krof
+ \krof
}%
\long\def\XINT_keep_bneg_a #1#2%
{%
@@ -12005,7 +13514,7 @@ $1$ or $-1$.
#1-{\xint_firstofone_thenstop }%
0#1{\xint_firstofone_thenstop }%
0-{\XINT_trim_bpos {#1#2}}%
- \krof
+ \krof
}%
\long\def\XINT_keep_bpos #1#2%
{%
@@ -12042,7 +13551,7 @@ $1$ or $-1$.
#4\XINT_keep_endc_iii
#5\XINT_keep_endc_iv
#6\XINT_keep_endc_v
- \W\XINT_keep_endc_vi\Z
+ \W\XINT_keep_endc_vi\Z
}%
\long\def\XINT_keep_endc_ #1\Z #2#3#4#5#6#7#8#9{ #9}%
\long\def\XINT_keep_endc_i #1\Z #2#3#4#5#6#7#8#9{ #9{#2}}%
@@ -12076,14 +13585,14 @@ $1$ or $-1$.
% \subsection{\csh{xintTrim}}
% \lverb+&
% First included in release 1.09m.
-%
+%
% \xintTrim {i}{stuff expanding to {a}{b}...{z}} (or `tokens' abcd...z,
% but each naked token ends up braced in the output) returns (in two
% expansion steps) the sequence with the first i elements omitted. The
% list is first f-expanded. The i is expanded inside \numexpr. Variant
% \xintTrimNoExpand does not expand the list argument.
%
-% With i = 0, the original (expanded) list is returned.
+% With i = 0, the original (expanded) list is returned.
%
% With i<0, the last |i| elements from the tail are suppressed.
%
@@ -12107,7 +13616,7 @@ $1$ or $-1$.
#1-{\xint_firstofone_thenstop }%
0#1{\XINT_trim_bneg_a {#2}}%
0-{\XINT_trim_bpos {#1#2}}%
- \krof
+ \krof
}%
\long\def\XINT_trim_bneg_a #1#2%
{%
@@ -12119,7 +13628,7 @@ $1$ or $-1$.
#1-{\expandafter\space\xint_gobble_i }%
0#1{\expandafter\space\xint_gobble_i }%
0-{\XINT_keep_bpos {#1#2}}%
- \krof
+ \krof
}%
\long\def\XINT_trim_bpos #1#2%
{%
@@ -12170,7 +13679,7 @@ $1$ or $-1$.
{%
\xint_bye #3\XINT_apply_end\xint_bye
\expandafter
- \XINT_apply_loop_b
+ \XINT_apply_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
\long\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}%
@@ -12185,7 +13694,7 @@ $1$ or $-1$.
% are added: this allows for example a non-expandable \def in \macro, without
% having to do \gdef. The list is first expanded. Introduced with release 1.06b.
% Define \macro to start with a space if it is not expandable or its execution
-% should be delayed only when all of \macro{a}...\macro{z} is ready.
+% should be delayed only when all of \macro{a}...\macro{z} is ready.
%
% Modified in 1.09e to use \xint_bye rather than \Z.|
% \begin{macrocode}
@@ -12201,7 +13710,7 @@ $1$ or $-1$.
{\XINT_applyunbr_loop_a {}{#1}#2\xint_bye }%
\long\def\XINT_applyunbr_loop_a #1#2#3%
{%
- \xint_bye #3\XINT_applyunbr_end\xint_bye
+ \xint_bye #3\XINT_applyunbr_end\xint_bye
\expandafter\XINT_applyunbr_loop_b
\expandafter {\romannumeral-`0#2{#3}}{#1}{#2}%
}%
@@ -12274,7 +13783,7 @@ $1$ or $-1$.
\else
\expandafter\XINT_seqo_na
\fi
- {#1}{#2}%
+ {#1}{#2}%
}%
\def\XINT_seqo_a #1#2#3{ {#1}}%
\def\XINT_seqo_o #1#2#3#4{ #4}%
@@ -12288,7 +13797,7 @@ $1$ or $-1$.
\xint_afterfi{\expandafter\space\xint_gobble_iv}%
\fi
{#1}{#2}{#3}{{#1}}%
-}%
+}%
\def\XINT_seqo_pb #1#2#3%
{%
\expandafter\XINT_seqo_pc\expandafter{\the\numexpr #1+#3}{#2}{#3}%
@@ -12307,13 +13816,13 @@ $1$ or $-1$.
{%
\ifcase\ifnum #3=\xint_c_ 0\else\ifnum #3>\xint_c_ 1\else -1\fi\fi\space
\expandafter\XINT_seqo_o
- \or
+ \or
\xint_afterfi{\expandafter\space\xint_gobble_iv}%
\else
\expandafter\XINT_seqo_nb
- \fi
+ \fi
{#1}{#2}{#3}{{#1}}%
-}%
+}%
\def\XINT_seqo_nb #1#2#3%
{%
\expandafter\XINT_seqo_nc\expandafter{\the\numexpr #1+#3}{#2}{#3}%
@@ -12330,7 +13839,7 @@ $1$ or $-1$.
\def\XINT_seqo_nd #1#2#3#4{\XINT_seqo_nb {#1}{#2}{#3}{#4{#1}}}%
% \end{macrocode}
%\subsection{\csh{xintloop}, \csh{xintbreakloop}, \csh{xintbreakloopanddo},
-% \csh{xintloopskiptonext}}
+% \csh{xintloopskiptonext}}
% \lverb|1.09g [2013/11/22]. Made long with 1.09h.|
% \begin{macrocode}
\long\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}%
@@ -12355,11 +13864,11 @@ $1$ or $-1$.
\long\def\xintiloop_again_b #1.#2.#3{%
#3\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3}}%
\long\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}%
-\long\def\xintbreakiloopanddo
+\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}}%
-\long\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}}%
\long\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{%
@@ -12367,7 +13876,7 @@ $1$ or $-1$.
\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}}
+% \subsection{\csh{XINT_xflet}}
% \lverb|1.09e [2013/10/29]: we expand fully unbraced tokens and swallow arising
% space tokens until the dust settles. For treating cases
% {<blank>\x<blank>\y...}, with guaranteed expansion of the \x (which may itself
@@ -12418,10 +13927,10 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintApplyInline}}
% \lverb|&
-% 1.09a: \xintApplyInline\macro{{a}{b}...{z}} has the same effect as executing
+% 1.09a: \xintApplyInline\macro{{a}{b}...{z}} has the same effect as executing
% \macro{a} and then applying again \xintApplyInline to the shortened list
-% {{b}...{z}} until
-% nothing is left. This is a non-expandable command which will result in
+% {{b}...{z}} until
+% nothing is left. This is a non-expandable command which will result in
% quicker code than using
% \xintApplyUnbraced. It expands (fully) its second (list) argument
% first, which may thus be encapsulated in a macro.
@@ -12429,18 +13938,18 @@ $1$ or $-1$.
% Release 1.09c has a new \xintApplyInline: the new version, while not
% expandable, is designed to survive when the applied macro closes a group, as
% is the case in alignemnts when it contains a $& or \\. It uses catcode 3 Z as
-% list terminator. Don't use it among the list items.
+% list terminator. Don't use it among the list items.
%
% 1.09d: the bug which was discovered in \xintFor* regarding space tokens at the
% very end of the item list also was in \xintApplyInline. The new version will
% expand unbraced item elements and this is in fact convenient to simulate
-% insertion of lists in others.
+% insertion of lists in others.
%
% 1.09e: the applied macro is allowed to be long, with items (or the first fixed
% arguments of he macro, passed together with it as #1 to \xintApplyInline)
% containing explicit \par's. (1.09g: some missing \long's added)
%
-% 1.09f: terminator used to be z, now Z (still catcode 3).
+% 1.09f: terminator used to be z, now Z (still catcode 3).
%|
% \begin{macrocode}
\catcode`Z 3
@@ -12453,13 +13962,13 @@ $1$ or $-1$.
\def\XINT_inline_b
{%
\ifx\XINT_token Z\expandafter\xint_gobble_i
- \else\expandafter\XINT_inline_d\fi
+ \else\expandafter\XINT_inline_d\fi
}%
\long\def\XINT_inline_d #1%
{%
\long\def\XINT_item{{#1}}\XINT_xflet\XINT_inline_e
}%
-\def\XINT_inline_e
+\def\XINT_inline_e
{%
\ifx\XINT_token Z\expandafter\XINT_inline_w
\else\expandafter\XINT_inline_f\fi
@@ -12471,20 +13980,20 @@ $1$ or $-1$.
\long\def\XINT_inline_g #1%
{%
\expandafter\XINT_inline_macro\XINT_item
- \long\def\XINT_inline_macro ##1{#1}\XINT_inline_d
-}%
+ \long\def\XINT_inline_macro ##1{#1}\XINT_inline_d
+}%
\def\XINT_inline_w #1%
{%
\expandafter\XINT_inline_macro\XINT_item
-}%
+}%
% \end{macrocode}
% \subsection{\csh{xintFor},
-% \csh{xintFor*}, \csh{xintBreakFor}, \csh{xintBreakForAndDo}}
+% \cshxintForstar, \csh{xintBreakFor}, \csh{xintBreakForAndDo}}
% \lverb|1.09c [2013/10/09]: a new kind of loop which uses macro parameters
% #1, #2, #3, #4 rather than macros; while not expandable it survives executing
% code closing groups, like what happens in an alignment with the $& character.
% When inserted in a macro for later use, the # character must be doubled.
-%
+%
% The non-star variant works on a csv list, which it expands once, the
% star variant works on a token list, expanded fully.
%
@@ -12494,9 +14003,9 @@ $1$ or $-1$.
% conscientiously clean out of the way space tokens, but also we ff-expand with
% \romannumeral-`0 (unbraced) items, a process which may create new space
% tokens, so it is iterated. As unbraced items are expanded, it is easy to
-% simulate insertion of a list in another.
+% simulate insertion of a list in another.
% Unbraced items consecutive to an even (non-zero) number of space tokens will
-% not get expanded.
+% not get expanded.
%
% 1.09e: [2013/10/29] does this better, no difference between an even or odd
% number of explicit consecutive space tokens. Normal situations anyhow only
@@ -12508,7 +14017,7 @@ $1$ or $-1$.
% \xintFor is not expandable anyhow, there is no loss of generality if the
% iterated commands do themselves the bookkeeping using a count or a LaTeX
% counter, and deal with nesting or other problems. I can't do *everything*!
-%
+%
% 1.09e adds \XINT_forever with \xintintegers, \xintdimensions, \xintrationals
% and \xintBreakFor, \xintBreakForAndDo, \xintifForFirst, \xintifForLast. On
% this occasion \xint_firstoftwo and \xint_secondoftwo are made long.
@@ -12520,10 +14029,10 @@ $1$ or $-1$.
% \XINT_for_forever? has an initial space token which serves two purposes:
% preventing brace stripping, and stopping the expansion made by \xintcsvtolist.
% If the \XINT_forever branch is taken, the added space will not be a problem
-% there.
+% there.
%
% 1.09f rewrites (2013/11/03) the code which now allows all macro parameters
-% from #1 to #9 in \xintFor, \xintFor*, and \XINT_forever.
+% from #1 to #9 in \xintFor, \xintFor*, and \XINT_forever.
%
% 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
@@ -12537,9 +14046,9 @@ $1$ or $-1$.
\def\XINT_tmpb #1#2{\ifnum #1<#2 \xint_afterfi {{#########2}}\fi}%
\def\XINT_tmpc #1%
{%
- \expandafter\edef \csname XINT_for_left#1\endcsname
+ \expandafter\edef \csname XINT_for_left#1\endcsname
{\xintApplyUnbraced {\XINT_tmpa #1}{123456789}}%
- \expandafter\edef \csname XINT_for_right#1\endcsname
+ \expandafter\edef \csname XINT_for_right#1\endcsname
{\xintApplyUnbraced {\XINT_tmpb #1}{123456789}}%
}%
\xintApplyInline \XINT_tmpc {123456789}%
@@ -12588,7 +14097,7 @@ $1$ or $-1$.
{\expandafter\XINT_forx_d\the\numexpr #2\relax {#5}}%
\XINT_xflet\XINT_forx_forever? #3Z%
}%
-\def\XINT_forx_forever?
+\def\XINT_forx_forever?
{%
\ifx\XINT_token U\XINT_to_forxever\fi
\ifx\XINT_token V\XINT_to_forxever\fi
@@ -12623,14 +14132,14 @@ $1$ or $-1$.
\XINT_xflet\XINT_for_last?
}%
\def\XINT_for_last?
-{%
+{%
\let\xintifForLast\xint_secondoftwo
\ifx\XINT_token Z\let\xintifForLast\xint_firstoftwo
\xint_afterfi{\xintBreakForAndDo{\XINT_x\xint_gobble_i Z}}\fi
- \the\XINT_toks
+ \the\XINT_toks
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_forever}, \csh{xintintegers}, \csh{xintdimensions}, \csh{xintrationals}}
+% \subsection{\csh{XINT_forever}, \csh{xintintegers}, \csh{xintdimensions}, \csh{xintrationals}}
% \lverb|New with 1.09e. But this used inadvertently \xintiadd/\xintimul which
% have the unnecessary \xintnum overhead. Changed in 1.09f to use
% \xintiiadd/\xintiimul which do not have this overhead. Also 1.09f has
@@ -12647,9 +14156,9 @@ $1$ or $-1$.
\def\XINT_forever #1%
{%
\expandafter\XINT_forever_a
- \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi a\expandafter\endcsname
- \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi i\expandafter\endcsname
- \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi \endcsname
+ \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi a\expandafter\endcsname
+ \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi i\expandafter\endcsname
+ \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi \endcsname
}%
\catcode`U 11
\catcode`D 11
@@ -12659,20 +14168,20 @@ $1$ or $-1$.
\expandafter\relax\expandafter}%
\expandafter{\the\numexpr #2}}%
\def\XINT_?expr_Da #1#2%
- {\expandafter{\expandafter\dimexpr\number\dimexpr #1\expandafter\relax
+ {\expandafter{\expandafter\dimexpr\number\dimexpr #1\expandafter\relax
\expandafter s\expandafter p\expandafter\relax\expandafter}%
\expandafter{\number\dimexpr #2}}%
\catcode`Z 11
\def\XINT_?expr_Va #1#2%
{%
- \expandafter\XINT_?expr_Vb\expandafter
+ \expandafter\XINT_?expr_Vb\expandafter
{\romannumeral-`0\xintrawwithzeros{\xintZapSpacesB{#2}}}%
{\romannumeral-`0\xintrawwithzeros{\xintZapSpacesB{#1}}}%
}%
\catcode`Z 3
\def\XINT_?expr_Vb #1#2{\expandafter\XINT_?expr_Vc #2.#1.}%
\def\XINT_?expr_Vc #1/#2.#3/#4.%
-{%
+{%
\xintifEq {#2}{#4}%
{\XINT_?expr_Vf {#3}{#1}{#2}}%
{\expandafter\XINT_?expr_Vd\expandafter
@@ -12694,7 +14203,7 @@ $1$ or $-1$.
\def\XINT_?expr_V #1#2{\XINT_?expr_Vx #2}%
\def\XINT_?expr_Vx #1#2%
{%
- \expandafter\XINT_?expr_Vy\expandafter
+ \expandafter\XINT_?expr_Vy\expandafter
{\romannumeral0\xintiiadd {#1}{#2}}{#2}%
}%
\def\XINT_?expr_Vy #1#2#3#4%
@@ -12704,20 +14213,20 @@ $1$ or $-1$.
\def\XINT_forever_a #1#2#3#4%
{%
\ifx #4[\expandafter\XINT_forever_opt_a
- \else\expandafter\XINT_forever_b
+ \else\expandafter\XINT_forever_b
\fi #1#2#3#4%
}%
\def\XINT_forever_b #1#2#3Z{\expandafter\XINT_forever_c\the\XINT_toks #2#3}%
\long\def\XINT_forever_c #1#2#3#4#5%
{\expandafter\XINT_forever_d\expandafter #2#4#5{#3}Z}%
-\def\XINT_forever_opt_a #1#2#3[#4+#5]#6Z%
+\def\XINT_forever_opt_a #1#2#3[#4+#5]#6Z%
{%
\expandafter\expandafter\expandafter
\XINT_forever_opt_c\expandafter\the\expandafter\XINT_toks
\romannumeral-`0#1{#4}{#5}#3%
}%
\long\def\XINT_forever_opt_c #1#2#3#4#5#6{\XINT_forever_d #2{#4}{#5}#6{#3}Z}%
-\long\def\XINT_forever_d #1#2#3#4#5%
+\long\def\XINT_forever_d #1#2#3#4#5%
{%
\long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#5}%
\XINT_toks {{#2}}%
@@ -12732,7 +14241,7 @@ $1$ or $-1$.
% \lverb|1.09c: I don't know yet if {a}{b} is better for the user or worse than
% (a,b). I prefer the former. I am not very motivated to deal with spaces in the
% (a,b) approach which is the one (currently) followed here.
-%
+%
% [2013/11/02] 1.09f: I may not have been very motivated in 1.09c, but since
% then I developped the \xintZapSpaces/\xintZapSpacesB tools (much to my
% satisfaction). Based on this, and better parameter texts, \xintForpair and its
@@ -12812,48 +14321,11 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintAssign}, \csh{xintAssignArray}, \csh{xintDigitsOf}}
% \lverb|&
-% \xintAssign {a}{b}..{z}\to\A\B...\Z,$\
-% \xintAssignArray {a}{b}..{z}\to\U
-%
-% version 1.01 corrects an oversight in 1.0 related to the value of
-% \escapechar at the time of using \xintAssignArray or \xintRelaxArray
-% These macros are non-expandable.
-%
-% In version 1.05a I suddenly see some incongruous \expandafter's in (what is
-% called now) \XINT_assignarray_end_c, which I remove.
-%
-% Release 1.06 modifies the macros created by \xintAssignArray to feed their
-% argument to a \numexpr. Release 1.06a detects an incredible typo in 1.01, (bad
-% copy-paste from
-% \xintRelaxArray) which caused \xintAssignArray to use #1 rather than the #2 as
-% in the correct earlier 1.0 version!!! This went through undetected because
-% \xint_arrayname, although weird, was still usable: the probability to
-% overwrite something was almost zero. The bug got finally revealed doing
-% \xintAssignArray {}{}{}\to\Stuff.
-%
-% With release 1.06b an empty argument (or expanding to empty) to
-% \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.
-%
-% 1.09i allows an optional parameter \xintAssign [oo] for example, then \oodef
-% rather than \edef is used. Idem for \xintAssignArray. However in the latter
-% case, the global variant is not available, one should use \globaldefs for
-% that.
-%
-% 1.09j: I decide that the default behavior of \xintAssign should be to use
-% \def, not \edef when assigning to a cs an item of the list. This is a
-% breaking change but I don't think anybody on earth is using xint anyhow.
-% Also use of the optional parameter was broken if it was [], [g], [e], [x] as
-% the corresponding \XINT_... macros had not been defined (in the initial
-% version I did not have the XINT_ prefix; then I added it in case \oodef was
-% pre-existing and thus was not redefined by the package which instead had
-% \XINT_oodef, now \xintoodef.)|
+% \xintAssign {a}{b}..{z}\to\A\B...\Z or \xintAssignArray {a}{b}..{z}\to\U
+% |
% \begin{macrocode}
\def\xintAssign{\def\XINT_flet_macro {\XINT_assign_fork}\XINT_flet_zapsp }%
-\def\XINT_assign_fork
+\def\XINT_assign_fork
{%
\let\XINT_assign_def\def
\ifx\XINT_token[\expandafter\XINT_assign_opt
@@ -12863,7 +14335,7 @@ $1$ or $-1$.
\def\XINT_assign_opt [#1]%
{%
\ifcsname #1def\endcsname
- \expandafter\let\expandafter\XINT_assign_def \csname #1def\endcsname
+ \expandafter\let\expandafter\XINT_assign_def \csname #1def\endcsname
\else
\expandafter\let\expandafter\XINT_assign_def \csname xint#1def\endcsname
\fi
@@ -12877,13 +14349,13 @@ $1$ or $-1$.
#{%
\def\xint_temp {#1}%
\ifx\empty\xint_temp
- \expandafter\XINT_assign_c
+ \expandafter\XINT_assign_c
\else
\expandafter\XINT_assign_d
\fi
}%
\long\def\XINT_assign_c #1#2\to #3%
-{%
+{%
\XINT_assign_def #3{#1}%
\def\xint_temp {#2}%
\unless\ifx\empty\xint_temp\xint_afterfi{\XINT_assign_b #2\to }\fi
@@ -12902,13 +14374,13 @@ $1$ or $-1$.
\global
\expandafter\let\csname\xint_arrayname\xintiloopindex\endcsname\relax
\ifnum \xintiloopindex > \xint_c_
- \repeat
+ \repeat
\global\expandafter\let\csname\xint_arrayname 00\endcsname\relax
- \global\let #1\relax
+ \global\let #1\relax
}%
\def\xintAssignArray{\def\XINT_flet_macro {\XINT_assignarray_fork}%
\XINT_flet_zapsp }%
-\def\XINT_assignarray_fork
+\def\XINT_assignarray_fork
{%
\let\XINT_assignarray_def\def
\ifx\XINT_token[\expandafter\XINT_assignarray_opt
@@ -12918,15 +14390,15 @@ $1$ or $-1$.
\def\XINT_assignarray_opt [#1]%
{%
\ifcsname #1def\endcsname
- \expandafter\let\expandafter\XINT_assignarray_def \csname #1def\endcsname
+ \expandafter\let\expandafter\XINT_assignarray_def \csname #1def\endcsname
\else
- \expandafter\let\expandafter\XINT_assignarray_def
+ \expandafter\let\expandafter\XINT_assignarray_def
\csname xint#1def\endcsname
\fi
\XINT_assignarray
}%
\long\def\XINT_assignarray #1\to #2%
-{%
+{%
\edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }%
\escapechar -1
\expandafter\def\expandafter\xint_arrayname\expandafter {\string #2}%
@@ -12934,7 +14406,7 @@ $1$ or $-1$.
\def\xint_itemcount {0}%
\expandafter\XINT_assignarray_loop \romannumeral-`0#1\xint_relax
\csname\xint_arrayname 00\expandafter\endcsname
- \csname\xint_arrayname 0\expandafter\endcsname
+ \csname\xint_arrayname 0\expandafter\endcsname
\expandafter {\xint_arrayname}#2%
}%
\long\def\XINT_assignarray_loop #1%
@@ -12948,7 +14420,7 @@ $1$ or $-1$.
\expandafter\def\expandafter\xint_itemcount\expandafter
{\the\numexpr\xint_itemcount+\xint_c_i}%
\expandafter\XINT_assignarray_def
- \csname\xint_arrayname\xint_itemcount\expandafter\endcsname
+ \csname\xint_arrayname\xint_itemcount\expandafter\endcsname
\expandafter{\xint_temp }%
\expandafter\XINT_assignarray_loop
\fi
@@ -12974,37 +14446,38 @@ $1$ or $-1$.
}%
}%
\let\xintDigitsOf\xintAssignArray
-\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
+\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
%\let</xinttools>\relax
-%\def<*xint>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
+%\def<*xintcore>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
%</xinttools>
-%<*xint>
+%<*xintcore>
%
% \StoreCodelineNo {xinttools}
%
-% \section{Package \xintnameimp implementation}
-% \label{sec:xintimp}
+% \section{Package \xintcorenameimp implementation}
+% \label{sec:coreimp}
%
-% With release |1.09a| all macros doing arithmetic operations and a few more
-% apply systematically |\xintnum| to their arguments; this adds a little
-% overhead but this is more convenient for using count registers even with infix
-% notation; also this is what |xintfrac.sty| did all along. Simplifies the
-% discussion in the documentation too.
+% \localtableofcontents
%
+% Got split off from \xintnameimp with release |1.1|. Adds
+% |\xintiiDivRound|. Does not load \xinttoolsnameimp.
%
-% \localtableofcontents
+% Since release |xint 1.09a| these macros doing arithmetic operations
+% apply systematically |\xintnum| to their arguments; this adds a little
+% overhead but this is more convenient for using count registers even
+% with infix notation; also this is what |xintfrac.sty| did all along.
+% Simplifies the discussion in the documentation too.
%
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the master \xintname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -13018,10 +14491,9 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
- \expandafter\let\expandafter\x\csname ver@xint.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xinttools.sty\endcsname
+ \expandafter\let\expandafter\x\csname ver@xintcore.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintkernel.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -13030,93 +14502,50 @@ $1$ or $-1$.
\fi
\expandafter
\ifx\csname numexpr\endcsname\relax
- \y{xint}{\numexpr not available, aborting input}%
+ \y{xintcore}{\numexpr not available, aborting input}%
\aftergroup\endinput
\else
- \ifx\x\relax % plain-TeX, first loading of xint.sty
- \ifx\w\relax % but xinttools.sty not yet loaded.
- \y{xint}{now issuing \string\input\space xinttools.sty}%
- \def\z{\endgroup\input xinttools.sty\relax}%
+ \ifx\x\relax % plain-TeX, first loading of xintcore.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintkernel.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xinttools.sty not yet loaded.
- \y{xint}{now issuing \string\RequirePackage{xinttools}}%
- \def\z{\endgroup\RequirePackage{xinttools}}%
+ \ifx\w\relax % xintkernel.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintkernel}}%
\fi
\else
- \y{xint}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xinttools already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xinttoolsnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xinttools.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xint}{Loading of package xinttools failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xint}{Loading of package xinttools failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
-\ProvidesPackage{xint}%
- [2014/04/01 v1.09n Expandable operations on long numbers (jfB)]%
+\ProvidesPackage{xintcore}%
+ [2014/10/28 v1.1 Expandable arithmetic on big integers (jfB)]%
% \end{macrocode}
-% \subsection{Token management, constants}
+% \subsection{More token management, constants}
% \begin{macrocode}
-\long\def\xint_firstofthree #1#2#3{#1}%
-\long\def\xint_secondofthree #1#2#3{#2}%
-\long\def\xint_thirdofthree #1#2#3{#3}%
-\long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i
-\long\def\xint_secondofthree_thenstop #1#2#3{ #2}%
-\long\def\xint_thirdofthree_thenstop #1#2#3{ #3}%
-%\def\xint_gob_til_zero #10{}% moved to xinttools
+\def\xint_minus_thenstop { -}%
\def\xint_gob_til_zeros_iii #1000{}%
\def\xint_gob_til_zeros_iv #10000{}%
\def\xint_gob_til_one #11{}%
\def\xint_gob_til_G #1G{}%
-\def\xint_gob_til_minus #1-{}%
+\def\xint_gob_til_minus #1-{}%
\def\xint_gob_til_relax #1\relax {}%
-\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
+\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
\def\xint_exchangetwo_keepbraces_thenstop #1#2{ {#2}{#1}}%
\def\xint_UDzerofork #10#2#3\krof {#2}%
\def\xint_UDsignfork #1-#2#3\krof {#2}%
\def\xint_UDwfork #1\W#2#3\krof {#2}%
\def\xint_UDzerosfork #100#2#3\krof {#2}%
\def\xint_UDonezerofork #110#2#3\krof {#2}%
-%\def\xint_UDzerominusfork #10-#2#3\krof {#2}% moved to xinttools
\def\xint_UDsignsfork #1--#2#3\krof {#2}%
\chardef\xint_c_ix 9
\chardef\xint_c_x 10
@@ -13126,78 +14555,27 @@ $1$ or $-1$.
\mathchardef\xint_c_x^iv 10000
\newcount\xint_c_x^viii \xint_c_x^viii 100000000
% \end{macrocode}
-% \subsection{\csh{xintRev}}
-% \lverb|&
-% \xintRev: expands fully its argument \romannumeral-`0, and checks the sign.
-% However this last aspect does not appear like a very useful thing. And despite
-% the fact that a special check is made for a sign, actually the input is not
-% given to \xintnum, contrarily to \xintLen. This is all a bit incoherent.
-% Should be fixed.|
-% \begin{macrocode}
-\def\xintRev {\romannumeral0\xintrev }%
-\def\xintrev #1%
-{%
- \expandafter\XINT_rev_fork
- \romannumeral-`0#1\xint_relax % empty #1 ok, \xint_relax stops expansion
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
-}%
-\def\XINT_rev_fork #1%
-{%
- \xint_UDsignfork
- #1{\expandafter\xint_minus_thenstop\romannumeral0\XINT_rord_main {}}%
- -{\XINT_rord_main {}#1}%
- \krof
-}%
-% \end{macrocode}
-% \subsection{\csh{xintLen}}
-% \lverb|\xintLen is ONLY for (possibly long) integers. Gets extended to
-% fractions by xintfrac.sty|
-% \begin{macrocode}
-\def\xintLen {\romannumeral0\xintlen }%
-\def\xintlen #1%
-{%
- \expandafter\XINT_len_fork
- \romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
-}%
-\def\XINT_Len #1% variant which does not expand via \xintnum.
-{%
- \romannumeral0\XINT_len_fork
- #1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
-}%
-\def\XINT_len_fork #1%
-{%
- \expandafter\XINT_length_loop
- \xint_UDsignfork
- #1{0.}%
- -{0.#1}%
- \krof
-}%
-% \end{macrocode}
-% \subsection{\csh{XINT\_RQ}}
+% \subsection{\csh{XINT_RQ}}
% \lverb|&
% cette macro renverse et ajoute le nombre minimal de zéros à
-% la fin pour que la longueur soit alors multiple de 4$\
-% \romannumeral0\XINT_RQ {}<le truc à renverser>\R\R\R\R\R\R\R\R\Z$\
+% la fin pour que la longueur soit alors multiple de 4$\
+% \romannumeral0\XINT_RQ {}<le truc à renverser>\R\R\R\R\R\R\R\R\Z$\
% Attention, ceci n'est utilisé que pour des chaînes de chiffres, et donc le
% comportement avec des {..} ou autres espaces n'a fait l'objet d'aucune
% attention |
% \begin{macrocode}
-\def\XINT_RQ #1#2#3#4#5#6#7#8#9%
+\def\XINT_RQ #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_R #9\XINT_RQ_end_a\R\XINT_RQ {#9#8#7#6#5#4#3#2#1}%
}%
-\def\XINT_RQ_end_a\R\XINT_RQ #1#2\Z
+\def\XINT_RQ_end_a\R\XINT_RQ #1#2\Z
{%
\XINT_RQ_end_b #1\Z
}%
-\def\XINT_RQ_end_b #1#2#3#4#5#6#7#8%
+\def\XINT_RQ_end_b #1#2#3#4#5#6#7#8%
{%
- \xint_gob_til_R
- #8\XINT_RQ_end_viii
+ \xint_gob_til_R
+ #8\XINT_RQ_end_viii
#7\XINT_RQ_end_vii
#6\XINT_RQ_end_vi
#5\XINT_RQ_end_v
@@ -13215,33 +14593,9 @@ $1$ or $-1$.
\def\XINT_RQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
\def\XINT_RQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
\def\XINT_RQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
-\def\XINT_SQ #1#2#3#4#5#6#7#8%
-{%
- \xint_gob_til_R #8\XINT_SQ_end_a\R\XINT_SQ {#8#7#6#5#4#3#2#1}%
-}%
-\def\XINT_SQ_end_a\R\XINT_SQ #1#2\Z
-{%
- \XINT_SQ_end_b #1\Z
-}%
-\def\XINT_SQ_end_b #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_R
- #7\XINT_SQ_end_vii
- #6\XINT_SQ_end_vi
- #5\XINT_SQ_end_v
- #4\XINT_SQ_end_iv
- #3\XINT_SQ_end_iii
- #2\XINT_SQ_end_ii
- \R\XINT_SQ_end_i
- \Z #2#3#4#5#6#7%
-}%
-\def\XINT_SQ_end_vii #1\Z #2#3#4#5#6#7#8\Z { #8}%
-\def\XINT_SQ_end_vi #1\Z #2#3#4#5#6#7#8\Z { #7#8000000}%
-\def\XINT_SQ_end_v #1\Z #2#3#4#5#6#7#8\Z { #6#7#800000}%
-\def\XINT_SQ_end_iv #1\Z #2#3#4#5#6#7#8\Z { #5#6#7#80000}%
-\def\XINT_SQ_end_iii #1\Z #2#3#4#5#6#7#8\Z { #4#5#6#7#8000}%
-\def\XINT_SQ_end_ii #1\Z #2#3#4#5#6#7#8\Z { #3#4#5#6#7#800}%
-\def\XINT_SQ_end_i \Z #1#2#3#4#5#6#7\Z { #1#2#3#4#5#6#70}%
+% \end{macrocode}
+% \subsection{\csh{XINT_OQ}}
+% \begin{macrocode}
\def\XINT_OQ #1#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_R #9\XINT_OQ_end_a\R\XINT_OQ {#9#8#7#6#5#4#3#2#1}%
@@ -13272,32 +14626,32 @@ $1$ or $-1$.
\def\XINT_OQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
\def\XINT_OQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
% \end{macrocode}
-% \subsection{\csh{XINT\_cuz}}
+% \subsection{\csh{XINT_cuz}}
% \begin{macrocode}
\edef\xint_cleanupzeros_andstop #1#2#3#4%
{%
- \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
\def\xint_cleanupzeros_nostop #1#2#3#4%
{%
- \the\numexpr #1#2#3#4\relax
+ \the\numexpr #1#2#3#4\relax
}%
\def\XINT_rev_andcuz #1%
{%
- \expandafter\xint_cleanupzeros_andstop
+ \expandafter\xint_cleanupzeros_andstop
\romannumeral0\XINT_rord_main {}#1%
\xint_relax
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
+ \xint_relax
}%
% \end{macrocode}
% \lverb|&
% routine CleanUpZeros. Utilisée en particulier par la
-% soustraction.$\
-% INPUT: longueur **multiple de 4** (<-- ATTENTION)$\
+% soustraction.$\
+% INPUT: longueur **multiple de 4** (<-- ATTENTION)$\
% OUTPUT: on a retiré tous les leading zéros, on n'est **plus*
-% nécessairement de longueur 4n$\
+% nécessairement de longueur 4n$\
% Délimiteur pour _main: \W\W\W\W\W\W\W\Z avec SEPT \W|
% \begin{macrocode}
\def\XINT_cuz #1%
@@ -13314,7 +14668,7 @@ $1$ or $-1$.
{%
\xint_cuz_end_b #2%
}%
-\edef\xint_cuz_end_b #1#2#3#4#5\Z
+\edef\xint_cuz_end_b #1#2#3#4#5\Z
{%
\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
}%
@@ -13330,55 +14684,37 @@ $1$ or $-1$.
\def\XINT_cuz_stop #1\W #2\Z{ #1}%
\def\xint_cuz_backtoloop 0\XINT_cuz_stop 0{\XINT_cuz_loop }%
% \end{macrocode}
-% \subsection{\csh{xintIsOne}}
-% \lverb|&
-% Added in 1.03. Attention: \XINT_isOne does not do any expansion. Release 1.09a
-% defines \xintIsOne which is more user-friendly. Will be modified if xintfrac
-% is loaded. |
-% \begin{macrocode}
-\def\xintIsOne {\romannumeral0\xintisone }%
-\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
-\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
-\def\XINT_isone #1#2%
-{%
- \xint_gob_til_one #1\XINT_isone_b 1%
- \expandafter\space\expandafter 0\xint_gob_til_Z #2%
-}%
-\def\XINT_isone_b #1\xint_gob_til_Z #2%
-{%
- \xint_gob_til_W #2\XINT_isone_yes \W
- \expandafter\space\expandafter 0\xint_gob_til_Z
-}%
-\def\XINT_isone_yes #1\Z { 1}%
-% \end{macrocode}
% \subsection{\csh{xintNum}}
% \lverb|&
-% For example \xintNum {----+-+++---+----000000000000003}$\
+% For example \xintNum {----+-+++---+----000000000000003}$\
% 1.05 defines \xintiNum, which allows redefinition of \xintNum by xintfrac.sty
% Slightly modified in 1.06b (\R->\xint_relax) to avoid initial re-scan of
% input stack (while still allowing empty #1). In versions earlier than 1.09a
% it was entirely up to the user to apply \xintnum; starting with 1.09a
-% arithmetic
+% arithmetic
% macros of xint.sty (like earlier already xintfrac.sty with its own \xintnum)
% make use of \xintnum. This allows arguments to
% be count registers, or even \numexpr arbitrary long expressions (with the
-% trick of braces, see the user documentation).|
+% trick of braces, see the user documentation).
+%
+% Note (22/06/14): \xintiNum jamais utilisé sous ce nom, le supprimer?
+% \XINT_num maintenant utilisé par le parseur de xintexpr.|
% \begin{macrocode}
\def\xintiNum {\romannumeral0\xintinum }%
\def\xintinum #1%
{%
\expandafter\XINT_num_loop
\romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
}%
\let\xintNum\xintiNum \let\xintnum\xintinum
\def\XINT_num #1%
{%
\XINT_num_loop #1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
}%
\def\XINT_num_loop #1#2#3#4#5#6#7#8%
-{%
+{%
\xint_gob_til_xint_relax #8\XINT_num_end\xint_relax
\XINT_num_NumEight #1#2#3#4#5#6#7#8%
}%
@@ -13398,18 +14734,21 @@ $1$ or $-1$.
}%
\def\XINT_num_keepsign_a #1%
{%
- \xint_gob_til_one#1\XINT_num_gobacktoloop 1\XINT_num_keepsign_b
+ \xint_gob_til_one#1\XINT_num_gobacktoloop 1\XINT_num_keepsign_b
}%
\def\XINT_num_gobacktoloop 1\XINT_num_keepsign_b {\XINT_num_loop }%
\def\XINT_num_keepsign_b #1{\XINT_num_loop -}%
\def\XINT_num_finish #1\xint_relax #2\Z { #1}%
% \end{macrocode}
-% \subsection{\csh{xintSgn}, \csh{xintiiSgn}, \csh{XINT\_Sgn}, \csh{XINT\_cntSgn}}
+% \subsection{\csh{xintSgn}, \csh{xintiiSgn}, \csh{XINT_Sgn}, \csh{XINT_cntSgn}}
% \lverb|&
% Changed in 1.05. Earlier code was unnecessarily strange. 1.09a with \xintnum
%
% 1.09i defines \XINT_Sgn and \XINT_cntSgn (was \XINT__Sgn in 1.09i) for reasons
-% of internal optimizations|
+% of internal optimizations.
+%
+% xintfrac.sty will overwrite \xintsgn with use of \xintraw rather than
+% \xintnum, naturally.|
% \begin{macrocode}
\def\xintiiSgn {\romannumeral0\xintiisgn }%
\def\xintiisgn #1%
@@ -13440,182 +14779,13 @@ $1$ or $-1$.
\def\XINT_cntSgn #1#2\Z
{%
\xint_UDzerominusfork
- #1-\z@
- 0#1\m@ne
- 0-\@ne
+ #1-\xint_c_
+ 0#1\m@ne % I will not allocate a count only for -1?
+ 0-\xint_c_i
\krof
}%
% \end{macrocode}
-% \subsection{\csh{xintBool}, \csh{xintToggle}}
-% \lverb|1.09c|
-% \begin{macrocode}
-\def\xintBool #1{\romannumeral-`0%
- \csname if#1\endcsname\expandafter1\else\expandafter0\fi }%
-\def\xintToggle #1{\romannumeral-`0\iftoggle{#1}{1}{0}}%
-% \end{macrocode}
-% \subsection{\csh{xintSgnFork}}
-% \lverb|Expandable three-way fork added in 1.07. The argument #1 must expand
-% to -1,0 or 1. 1.09i has _afterstop, renamed _thenstop later, for efficiency.|
-% \begin{macrocode}
-\def\xintSgnFork {\romannumeral0\xintsgnfork }%
-\def\xintsgnfork #1%
-{%
- \ifcase #1 \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{XINT\_cntSgnFork}}
-% \lverb|1.09i. Used internally, #1 must expand to \m@ne, \z@, or \@ne or
-% equivalent. Does not insert a space token to stop a romannumeral0 expansion.|
-% \begin{macrocode}
-\def\XINT_cntSgnFork #1%
-{%
- \ifcase #1\expandafter\xint_secondofthree
- \or\expandafter\xint_thirdofthree
- \else\expandafter\xint_firstofthree
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifSgn}}
-% \lverb|Expandable three-way fork added in 1.09a. Branches expandably
-% depending on whether <0, =0, >0. Choice of branch guaranteed in two steps.
-%
-% The use of \romannumeral0\xintsgn rather than \xintSgn is for matters related
-% to the transformation of the ternary operator : in \xintNewExpr. I hope I have
-% explained there the details because right now off hand I can't recall why.
-%
-% 1.09i has \xint_firstofthreeafterstop (now _thenstop) etc for faster
-% expansion.|
-% \begin{macrocode}
-\def\xintifSgn {\romannumeral0\xintifsgn }%
-\def\xintifsgn #1%
-{%
- \ifcase \romannumeral0\xintsgn{#1}
- \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifZero}, \csh{xintifNotZero}}
-% \lverb|&
-% Expandable two-way fork added in 1.09a. Branches expandably depending on
-% whether the argument is zero (branch A) or not (branch B). 1.09i restyling. By
-% the way it appears (not thoroughly tested, though) that \if tests are faster
-% than \ifnum tests. |
-% \begin{macrocode}
-\def\xintifZero {\romannumeral0\xintifzero }%
-\def\xintifzero #1%
-{%
- \if0\xintSgn{#1}%
- \expandafter\xint_firstoftwo_thenstop
- \else
- \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-\def\xintifNotZero {\romannumeral0\xintifnotzero }%
-\def\xintifnotzero #1%
-{%
- \if0\xintSgn{#1}%
- \expandafter\xint_secondoftwo_thenstop
- \else
- \expandafter\xint_firstoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifOne}}
-% \lverb|added in 1.09i.|
-% \begin{macrocode}
-\def\xintifOne {\romannumeral0\xintifone }%
-\def\xintifone #1%
-{%
- \if1\xintIsOne{#1}%
- \expandafter\xint_firstoftwo_thenstop
- \else
- \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifTrueAelseB}, \csh{xint\-ifFalseAelseB}}
-% \lverb|1.09i. Warning, \xintifTrueFalse, \xintifTrue deprecated, to be
-% removed|
-% \begin{macrocode}
-\let\xintifTrueAelseB\xintifNotZero
-\let\xintifFalseAelseB\xintifZero
-\let\xintifTrue\xintifNotZero
-\let\xintifTrueFalse\xintifNotZero
-% \end{macrocode}
-% \subsection{\csh{xintifCmp}}
-% \lverb|&
-% 1.09e
-% \xintifCmp {n}{m}{if n<m}{if n=m}{if n>m}.|
-% \begin{macrocode}
-\def\xintifCmp {\romannumeral0\xintifcmp }%
-\def\xintifcmp #1#2%
-{%
- \ifcase\xintCmp {#1}{#2}
- \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifEq}}
-% \lverb|&
-% 1.09a
-% \xintifEq {n}{m}{YES if n=m}{NO if n<>m}.|
-% \begin{macrocode}
-\def\xintifEq {\romannumeral0\xintifeq }%
-\def\xintifeq #1#2%
-{%
- \if0\xintCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifGt}}
-% \lverb|&
-% 1.09a \xintifGt {n}{m}{YES if n>m}{NO if n<=m}.|
-% \begin{macrocode}
-\def\xintifGt {\romannumeral0\xintifgt }%
-\def\xintifgt #1#2%
-{%
- \if1\xintCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifLt}}
-% \lverb|&
-% 1.09a \xintifLt {n}{m}{YES if n<m}{NO if n>=m}. Restyled in 1.09i|
-% \begin{macrocode}
-\def\xintifLt {\romannumeral0\xintiflt }%
-\def\xintiflt #1#2%
-{%
- \ifnum\xintCmp{#1}{#2}<\xint_c_
- \expandafter\xint_firstoftwo_thenstop
- \else \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintifOdd}}
-% \lverb|1.09e. Restyled in 1.09i.|
-% \begin{macrocode}
-\def\xintifOdd {\romannumeral0\xintifodd }%
-\def\xintifodd #1%
-{%
- \if\xintOdd{#1}1%
- \expandafter\xint_firstoftwo_thenstop
- \else
- \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintOpp}}
+% \subsection{\csh{xintiOpp}}
% \lverb|\xintnum added in 1.09a|
% \begin{macrocode}
\def\xintiiOpp {\romannumeral0\xintiiopp }%
@@ -13639,7 +14809,7 @@ $1$ or $-1$.
\krof
}%
% \end{macrocode}
-% \subsection{\csh{xintAbs}}
+% \subsection{\csh{xintiAbs}}
% \lverb|Release 1.09a has now \xintiabs which does \xintnum (contrarily to some
% other i-macros, but similarly as \xintiAdd etc...) and this is
% inherited by DecSplit, by Sqr, and macros of xintgcd.sty.|
@@ -13665,8 +14835,8 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% -----------------------------------------------------------------$\
-% -----------------------------------------------------------------$\
+% -----------------------------------------------------------------$\
+% -----------------------------------------------------------------$\
% ARITHMETIC OPERATIONS: ADDITION, SUBTRACTION, SUMS,
% MULTIPLICATION, PRODUCTS, FACTORIAL, POWERS, EUCLIDEAN DIVISION.
%
@@ -13678,17 +14848,17 @@ $1$ or $-1$.
%
% ADDITION I: \XINT_add_A
%
-% INPUT:$\
-% \romannumeral0\XINT_add_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
-% 1. <N1> et <N2> renversés $\
-% 2. de longueur 4n (avec des leading zéros éventuels)$\
+% INPUT:$\
+% \romannumeral0\XINT_add_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
+% 1. <N1> et <N2> renversés $\
+% 2. de longueur 4n (avec des leading zéros éventuels)$\
% 3. l'un des deux ne doit pas se terminer par 0000$\$relax
% [Donc on peut avoir 0000 comme input si l'autre est >0 et ne se termine pas en
% 0000 bien sûr]. On peut avoir l'un des deux vides. Mais alors l'autre ne doit
% être ni vide ni 0000.
%
% OUTPUT: la somme <N1>+<N2>, ordre normal, plus sur 4n, pas de leading zeros
-% La procédure est plus rapide lorsque <N1> est le plus court des deux.$\
+% La procédure est plus rapide lorsque <N1> est le plus court des deux.$\
% Nota bene: (30 avril 2013). J'ai une version qui est deux fois plus rapide sur
% des nombres d'environ 1000 chiffres chacun, et qui commence à être avantageuse
% pour des nombres d'au moins 200 chiffres. Cependant il serait vraiment
@@ -13696,14 +14866,14 @@ $1$ or $-1$.
% autres routines, comme celle de multiplication ou celle de division; et son
% implémentation ajouterait au minimum la mesure de la longueur des summands.|
% \begin{macrocode}
-\def\XINT_add_A #1#2#3#4#5#6%
+\def\XINT_add_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_add_az\W
- \XINT_add_AB #1{#3#4#5#6}{#2}%
+ \XINT_add_AB #1{#3#4#5#6}{#2}%
}%
-\def\xint_add_az\W\XINT_add_AB #1#2%
+\def\xint_add_az\W\XINT_add_AB #1#2%
{%
- \XINT_add_AC_checkcarry #1%
+ \XINT_add_AC_checkcarry #1%
}%
% \end{macrocode}
% \lverb|&
@@ -13711,16 +14881,16 @@ $1$ or $-1$.
% pour \numexpr. #3 = résultat partiel. #4 = chiffres qui restent. On vérifie si
% le deuxième nombre s'arrête.|
% \begin{macrocode}
-\def\XINT_add_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+\def\XINT_add_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
{%
- \xint_gob_til_W #5\xint_add_bz\W
- \XINT_add_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+ \xint_gob_til_W #5\xint_add_bz\W
+ \XINT_add_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
}%
\def\XINT_add_ABE #1#2#3#4#5#6%
{%
\expandafter\XINT_add_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
}%
-\def\XINT_add_ABEA #1#2#3.#4%
+\def\XINT_add_ABEA #1#2#3.#4%
{%
\XINT_add_A #2{#3#4}%
}%
@@ -13734,7 +14904,7 @@ $1$ or $-1$.
{%
\expandafter\XINT_add_CC\the\numexpr #1+10#5#4#3#2.%
}%
-\def\XINT_add_CC #1#2#3.#4%
+\def\XINT_add_CC #1#2#3.#4%
{%
\XINT_add_AC_checkcarry #2{#3#4}% on va examiner et \'eliminer #2
}%
@@ -13746,7 +14916,7 @@ $1$ or $-1$.
% \begin{macrocode}
\def\XINT_add_AC_checkcarry #1%
{%
- \xint_gob_til_zero #1\xint_add_AC_nocarry 0\XINT_add_C
+ \xint_gob_til_zero #1\xint_add_AC_nocarry 0\XINT_add_C
}%
\def\xint_add_AC_nocarry 0\XINT_add_C #1#2\W\X\Y\Z
{%
@@ -13760,7 +14930,7 @@ $1$ or $-1$.
\xint_relax
#1%
}%
-\def\XINT_add_C #1#2#3#4#5%
+\def\XINT_add_C #1#2#3#4#5%
{%
\xint_gob_til_W #2\xint_add_cz\W
\XINT_add_CD {#5#4#3#2}{#1}%
@@ -13771,38 +14941,38 @@ $1$ or $-1$.
}%
\def\xint_add_cz\W\XINT_add_CD #1#2{ 1#2}%
% \end{macrocode}
-% \lverb|Addition II: \XINT_addr_A.$\
+% \lverb|Addition II: \XINT_addr_A.$\
% INPUT: \romannumeral0\XINT_addr_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z
%
% Comme \XINT_add_A, la différence principale c'est qu'elle donne son résultat
% aussi *sur 4n*, renversé. De plus cette variante accepte que l'un ou même les
% deux inputs soient vides. Utilisé par la sommation et par la division (pour
% les quotients). Et aussi par la multiplication d'ailleurs.$\
-% INPUT: comme pour \XINT_add_A$\
-% 1. <N1> et <N2> renversés $\
-% 2. de longueur 4n (avec des leading zéros éventuels)$\
-% 3. l'un des deux ne doit pas se terminer par 0000$\
+% INPUT: comme pour \XINT_add_A$\
+% 1. <N1> et <N2> renversés $\
+% 2. de longueur 4n (avec des leading zéros éventuels)$\
+% 3. l'un des deux ne doit pas se terminer par 0000$\
% OUTPUT: la somme <N1>+<N2>, *aussi renversée* et *sur 4n*|
% \begin{macrocode}
-\def\XINT_addr_A #1#2#3#4#5#6%
+\def\XINT_addr_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_addr_az\W
- \XINT_addr_B #1{#3#4#5#6}{#2}%
+ \XINT_addr_B #1{#3#4#5#6}{#2}%
}%
-\def\xint_addr_az\W\XINT_addr_B #1#2%
+\def\xint_addr_az\W\XINT_addr_B #1#2%
{%
\XINT_addr_AC_checkcarry #1%
}%
-\def\XINT_addr_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
+\def\XINT_addr_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
{%
\xint_gob_til_W #5\xint_addr_bz\W
- \XINT_addr_E #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+ \XINT_addr_E #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
}%
\def\XINT_addr_E #1#2#3#4#5#6%
{%
\expandafter\XINT_addr_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
}%
-\def\XINT_addr_ABEA #1#2#3#4#5#6#7%
+\def\XINT_addr_ABEA #1#2#3#4#5#6#7%
{%
\XINT_addr_A #2{#7#6#5#4#3}%
}%
@@ -13810,16 +14980,16 @@ $1$ or $-1$.
{%
\expandafter\XINT_addr_CC\the\numexpr #1+10#5#4#3#2\relax
}%
-\def\XINT_addr_CC #1#2#3#4#5#6#7%
+\def\XINT_addr_CC #1#2#3#4#5#6#7%
{%
\XINT_addr_AC_checkcarry #2{#7#6#5#4#3}%
}%
\def\XINT_addr_AC_checkcarry #1%
{%
- \xint_gob_til_zero #1\xint_addr_AC_nocarry 0\XINT_addr_C
+ \xint_gob_til_zero #1\xint_addr_AC_nocarry 0\XINT_addr_C
}%
\def\xint_addr_AC_nocarry 0\XINT_addr_C #1#2\W\X\Y\Z { #1#2}%
-\def\XINT_addr_C #1#2#3#4#5%
+\def\XINT_addr_C #1#2#3#4#5%
{%
\xint_gob_til_W #2\xint_addr_cz\W
\XINT_addr_D {#5#4#3#2}{#1}%
@@ -13830,38 +15000,38 @@ $1$ or $-1$.
}%
\def\xint_addr_cz\W\XINT_addr_D #1#2{ #21000}%
% \end{macrocode}
-% \lverb|ADDITION III, \XINT_addm_A$\
-% INPUT:\romannumeral0\XINT_addm_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
-% 1. <N1> et <N2> renversés$\
-% 2. <N1> de longueur 4n ; <N2> non$\
-% 3. <N2> est *garanti au moins aussi long* que <N1>$\
+% \lverb|ADDITION III, \XINT_addm_A$\
+% INPUT:\romannumeral0\XINT_addm_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
+% 1. <N1> et <N2> renversés$\
+% 2. <N1> de longueur 4n ; <N2> non$\
+% 3. <N2> est *garanti au moins aussi long* que <N1>$\
% OUTPUT: la somme <N1>+<N2>, ordre normal, pas sur 4n, leading zeros retirés.
% Utilisé par la multiplication.|
% \begin{macrocode}
-\def\XINT_addm_A #1#2#3#4#5#6%
+\def\XINT_addm_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_addm_az\W
- \XINT_addm_AB #1{#3#4#5#6}{#2}%
+ \XINT_addm_AB #1{#3#4#5#6}{#2}%
}%
-\def\xint_addm_az\W\XINT_addm_AB #1#2%
+\def\xint_addm_az\W\XINT_addm_AB #1#2%
{%
\XINT_addm_AC_checkcarry #1%
}%
-\def\XINT_addm_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+\def\XINT_addm_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
{%
- \XINT_addm_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+ \XINT_addm_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
}%
\def\XINT_addm_ABE #1#2#3#4#5#6%
{%
\expandafter\XINT_addm_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
}%
-\def\XINT_addm_ABEA #1#2#3.#4%
+\def\XINT_addm_ABEA #1#2#3.#4%
{%
\XINT_addm_A #2{#3#4}%
}%
\def\XINT_addm_AC_checkcarry #1%
{%
- \xint_gob_til_zero #1\xint_addm_AC_nocarry 0\XINT_addm_C
+ \xint_gob_til_zero #1\xint_addm_AC_nocarry 0\XINT_addm_C
}%
\def\xint_addm_AC_nocarry 0\XINT_addm_C #1#2\W\X\Y\Z
{%
@@ -13875,53 +15045,53 @@ $1$ or $-1$.
\xint_relax
#1%
}%
-\def\XINT_addm_C #1#2#3#4#5%
+\def\XINT_addm_C #1#2#3#4#5%
{%
- \xint_gob_til_W
+ \xint_gob_til_W
#5\xint_addm_cw
- #4\xint_addm_cx
- #3\xint_addm_cy
- #2\xint_addm_cz
+ #4\xint_addm_cx
+ #3\xint_addm_cy
+ #2\xint_addm_cz
\W\XINT_addm_CD {#5#4#3#2}{#1}%
}%
\def\XINT_addm_CD #1%
{%
\expandafter\XINT_addm_CC\the\numexpr 1+10#1.%
}%
-\def\XINT_addm_CC #1#2#3.#4%
+\def\XINT_addm_CC #1#2#3.#4%
{%
\XINT_addm_AC_checkcarry #2{#3#4}%
}%
-\def\xint_addm_cw
+\def\xint_addm_cw
#1\xint_addm_cx
#2\xint_addm_cy
#3\xint_addm_cz
- \W\XINT_addm_CD
+ \W\XINT_addm_CD
{%
\expandafter\XINT_addm_CDw\the\numexpr 1+#1#2#3.%
}%
-\def\XINT_addm_CDw #1.#2#3\X\Y\Z
+\def\XINT_addm_CDw #1.#2#3\X\Y\Z
{%
\XINT_addm_end #1#3%
}%
-\def\xint_addm_cx
+\def\xint_addm_cx
#1\xint_addm_cy
#2\xint_addm_cz
- \W\XINT_addm_CD
+ \W\XINT_addm_CD
{%
\expandafter\XINT_addm_CDx\the\numexpr 1+#1#2.%
}%
-\def\XINT_addm_CDx #1.#2#3\Y\Z
+\def\XINT_addm_CDx #1.#2#3\Y\Z
{%
\XINT_addm_end #1#3%
}%
-\def\xint_addm_cy
+\def\xint_addm_cy
#1\xint_addm_cz
\W\XINT_addm_CD
{%
\expandafter\XINT_addm_CDy\the\numexpr 1+#1.%
}%
-\def\XINT_addm_CDy #1.#2#3\Z
+\def\XINT_addm_CDy #1.#2#3\Z
{%
\XINT_addm_end #1#3%
}%
@@ -13929,52 +15099,52 @@ $1$ or $-1$.
\edef\XINT_addm_end #1#2#3#4#5%
{\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5\relax}%
% \end{macrocode}
-% \lverb|ADDITION IV, variante \XINT_addp_A$\
+% \lverb|ADDITION IV, variante \XINT_addp_A$\
% INPUT:
-% \romannumeral0\XINT_addp_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
-% 1. <N1> et <N2> renversés$\
-% 2. <N1> de longueur 4n ; <N2> non$\
-% 3. <N2> est *garanti au moins aussi long* que <N1>$\
+% \romannumeral0\XINT_addp_A 0{}<N1>\W\X\Y\Z <N2>\W\X\Y\Z$\
+% 1. <N1> et <N2> renversés$\
+% 2. <N1> de longueur 4n ; <N2> non$\
+% 3. <N2> est *garanti au moins aussi long* que <N1>$\
% OUTPUT: la somme <N1>+<N2>, dans l'ordre renversé, sur 4n, et en faisant
% attention de ne pas terminer en 0000.
% Utilisé par la multiplication servant pour le calcul des puissances.|
% \begin{macrocode}
-\def\XINT_addp_A #1#2#3#4#5#6%
+\def\XINT_addp_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_addp_az\W
- \XINT_addp_AB #1{#3#4#5#6}{#2}%
+ \XINT_addp_AB #1{#3#4#5#6}{#2}%
}%
-\def\xint_addp_az\W\XINT_addp_AB #1#2%
+\def\xint_addp_az\W\XINT_addp_AB #1#2%
{%
\XINT_addp_AC_checkcarry #1%
}%
\def\XINT_addp_AC_checkcarry #1%
{%
- \xint_gob_til_zero #1\xint_addp_AC_nocarry 0\XINT_addp_C
+ \xint_gob_til_zero #1\xint_addp_AC_nocarry 0\XINT_addp_C
}%
-\def\xint_addp_AC_nocarry 0\XINT_addp_C
+\def\xint_addp_AC_nocarry 0\XINT_addp_C
{%
\XINT_addp_F
}%
-\def\XINT_addp_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+\def\XINT_addp_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
{%
- \XINT_addp_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+ \XINT_addp_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
}%
\def\XINT_addp_ABE #1#2#3#4#5#6%
{%
\expandafter\XINT_addp_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
}%
-\def\XINT_addp_ABEA #1#2#3#4#5#6#7%
-{%
+\def\XINT_addp_ABEA #1#2#3#4#5#6#7%
+{%
\XINT_addp_A #2{#7#6#5#4#3}%<-- attention on met donc \`a droite
}%
-\def\XINT_addp_C #1#2#3#4#5%
+\def\XINT_addp_C #1#2#3#4#5%
{%
- \xint_gob_til_W
+ \xint_gob_til_W
#5\xint_addp_cw
- #4\xint_addp_cx
- #3\xint_addp_cy
- #2\xint_addp_cz
+ #4\xint_addp_cx
+ #3\xint_addp_cy
+ #2\xint_addp_cz
\W\XINT_addp_CD {#5#4#3#2}{#1}%
}%
\def\XINT_addp_CD #1%
@@ -13985,40 +15155,40 @@ $1$ or $-1$.
{%
\XINT_addp_AC_checkcarry #2{#7#6#5#4#3}%
}%
-\def\xint_addp_cw
+\def\xint_addp_cw
#1\xint_addp_cx
#2\xint_addp_cy
#3\xint_addp_cz
- \W\XINT_addp_CD
+ \W\XINT_addp_CD
{%
\expandafter\XINT_addp_CDw\the\numexpr \xint_c_i+10#1#2#3\relax
}%
-\def\XINT_addp_CDw #1#2#3#4#5#6%
+\def\XINT_addp_CDw #1#2#3#4#5#6%
{%
- \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDw_zeros
+ \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDw_zeros
0000\XINT_addp_endDw #2#3#4#5%
}%
\def\XINT_addp_endDw_zeros 0000\XINT_addp_endDw 0000#1\X\Y\Z{ #1}%
\def\XINT_addp_endDw #1#2#3#4#5\X\Y\Z{ #5#4#3#2#1}%
-\def\xint_addp_cx
+\def\xint_addp_cx
#1\xint_addp_cy
#2\xint_addp_cz
- \W\XINT_addp_CD
+ \W\XINT_addp_CD
{%
\expandafter\XINT_addp_CDx\the\numexpr \xint_c_i+100#1#2\relax
}%
-\def\XINT_addp_CDx #1#2#3#4#5#6%
+\def\XINT_addp_CDx #1#2#3#4#5#6%
{%
\xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDx_zeros
0000\XINT_addp_endDx #2#3#4#5%
}%
\def\XINT_addp_endDx_zeros 0000\XINT_addp_endDx 0000#1\Y\Z{ #1}%
\def\XINT_addp_endDx #1#2#3#4#5\Y\Z{ #5#4#3#2#1}%
-\def\xint_addp_cy #1\xint_addp_cz\W\XINT_addp_CD
+\def\xint_addp_cy #1\xint_addp_cz\W\XINT_addp_CD
{%
\expandafter\XINT_addp_CDy\the\numexpr \xint_c_i+1000#1\relax
}%
-\def\XINT_addp_CDy #1#2#3#4#5#6%
+\def\XINT_addp_CDy #1#2#3#4#5#6%
{%
\xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDy_zeros
0000\XINT_addp_endDy #2#3#4#5%
@@ -14026,26 +15196,26 @@ $1$ or $-1$.
\def\XINT_addp_endDy_zeros 0000\XINT_addp_endDy 0000#1\Z{ #1}%
\def\XINT_addp_endDy #1#2#3#4#5\Z{ #5#4#3#2#1}%
\def\xint_addp_cz\W\XINT_addp_CD #1#2{ #21000}%
-\def\XINT_addp_F #1#2#3#4#5%
+\def\XINT_addp_F #1#2#3#4#5%
{%
- \xint_gob_til_W
+ \xint_gob_til_W
#5\xint_addp_Gw
- #4\xint_addp_Gx
- #3\xint_addp_Gy
- #2\xint_addp_Gz
+ #4\xint_addp_Gx
+ #3\xint_addp_Gy
+ #2\xint_addp_Gz
\W\XINT_addp_G {#2#3#4#5}{#1}%
}%
\def\XINT_addp_G #1#2%
{%
\XINT_addp_F {#2#1}%
}%
-\def\xint_addp_Gw
+\def\xint_addp_Gw
#1\xint_addp_Gx
#2\xint_addp_Gy
#3\xint_addp_Gz
\W\XINT_addp_G #4%
{%
- \xint_gob_til_zeros_iv #3#2#10\XINT_addp_endGw_zeros
+ \xint_gob_til_zeros_iv #3#2#10\XINT_addp_endGw_zeros
0000\XINT_addp_endGw #3#2#10%
}%
\def\XINT_addp_endGw_zeros 0000\XINT_addp_endGw 0000#1\X\Y\Z{ #1}%
@@ -14055,7 +15225,7 @@ $1$ or $-1$.
#2\xint_addp_Gz
\W\XINT_addp_G #3%
{%
- \xint_gob_til_zeros_iv #2#100\XINT_addp_endGx_zeros
+ \xint_gob_til_zeros_iv #2#100\XINT_addp_endGx_zeros
0000\XINT_addp_endGx #2#100%
}%
\def\XINT_addp_endGx_zeros 0000\XINT_addp_endGx 0000#1\Y\Z{ #1}%
@@ -14064,165 +15234,127 @@ $1$ or $-1$.
#1\xint_addp_Gz
\W\XINT_addp_G #2%
{%
- \xint_gob_til_zeros_iv #1000\XINT_addp_endGy_zeros
+ \xint_gob_til_zeros_iv #1000\XINT_addp_endGy_zeros
0000\XINT_addp_endGy #1000%
}%
\def\XINT_addp_endGy_zeros 0000\XINT_addp_endGy 0000#1\Z{ #1}%
\def\XINT_addp_endGy #1#2#3#4#5\Z{ #5#1#2#3#4}%
\def\xint_addp_Gz\W\XINT_addp_G #1#2{ #2}%
% \end{macrocode}
-% \subsection{\csh{xintAdd}}
-% \lverb|Release 1.09a has \xintnum added into \xintiAdd.|
+% \subsection{\csh{xintiAdd}}
+% \lverb|ADDITION
+% [algo plus efficace lorsque le premier argument plus long que le second]
+%
+% Note (octobre 2014, pendant la préparation de la sortie de 1.1)
+%
+% Je n'aurais pas dû l'appeler \xintAdd, mais seulement \xintiAdd. Le format
+% de sortie de \xintAdd est modifié par xintfrac.sty, Celui de \xintiAdd ne
+% bouge pas, et \xintiiAdd reste la version stricte.|
% \begin{macrocode}
\def\xintiiAdd {\romannumeral0\xintiiadd }%
-\def\xintiiadd #1%
-{%
- \expandafter\xint_iiadd\expandafter{\romannumeral-`0#1}%
-}%
-\def\xint_iiadd #1#2%
+\def\xintiiadd #1{\expandafter\xint_iiadd\romannumeral-`0#1\Z }%
+\def\xint_iiadd #1#2\Z #3%
{%
- \expandafter\XINT_add_fork \romannumeral-`0#2\Z #1\Z
+ \expandafter\XINT_add_fork\expandafter #1\romannumeral-`0#3\Z #2\Z
}%
\def\xintiAdd {\romannumeral0\xintiadd }%
\def\xintiadd #1%
{%
- \expandafter\xint_add\expandafter{\romannumeral0\xintnum{#1}}%
+ \expandafter\xint_add\romannumeral0\xintnum{#1}\Z
}%
-\def\xint_add #1#2%
+\def\xint_add #1#2\Z #3%
{%
- \expandafter\XINT_add_fork \romannumeral0\xintnum{#2}\Z #1\Z
+ \expandafter\XINT_add_fork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z
}%
\let\xintAdd\xintiAdd \let\xintadd\xintiadd
-\def\XINT_Add #1#2{\romannumeral0\XINT_add_fork #2\Z #1\Z }%
-\def\XINT_add #1#2{\XINT_add_fork #2\Z #1\Z }%
-% \end{macrocode}
-% \lverb|ADDITION
-% Ici #1#2 vient du *deuxième* argument de \xintAdd et #3#4 donc du *premier*
-% [algo plus efficace lorsque le premier est plus long que le second]|
-% \begin{macrocode}
-\def\XINT_add_fork #1#2\Z #3#4\Z
+\def\XINT_add_fork #1#2%
{%
\xint_UDzerofork
- #1\XINT_add_secondiszero
- #3\XINT_add_firstiszero
- 0
- {\xint_UDsignsfork
- #1#3\XINT_add_minusminus % #1 = #3 = -
- #1-\XINT_add_minusplus % #1 = -
- #3-\XINT_add_plusminus % #3 = -
- --\XINT_add_plusplus
- \krof }%
+ #1\XINT_add_firstiszero
+ #2\XINT_add_secondiszero
+ 0{}%
\krof
- {#2}{#4}#1#3%
+ \xint_UDsignsfork
+ #1#2\XINT_add_minusminus
+ #1-\XINT_add_minusplus
+ #2-\XINT_add_plusminus
+ --\XINT_add_plusplus
+ \krof #1#2%
}%
-\def\XINT_add_secondiszero #1#2#3#4{ #4#2}%
-\def\XINT_add_firstiszero #1#2#3#4{ #3#1}%
+\def\XINT_add_firstiszero #1\krof #2#3\Z #4\Z { #3}%
+\def\XINT_add_secondiszero #1\krof #2#3\Z #4\Z { #2#4}%
+\def\XINT_add_plusplus #1#2#3\Z #4\Z {\XINT_add_pre {#1#4}{#2#3}}%
+\def\XINT_add_minusminus #1#2#3\Z #4\Z
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_add_pre {#4}{#3}}%
+\def\XINT_add_minusplus #1#2#3\Z #4\Z {\XINT_sub_pre {#2#3}{#4}}%
+\def\XINT_add_plusminus #1#2#3\Z #4\Z {\XINT_sub_pre {#1#4}{#3}}%
% \end{macrocode}
-% \lverb|#1 vient du *deuxième* et #2 vient du *premier*|
+% \lverb|positive summands|
% \begin{macrocode}
-\def\XINT_add_minusminus #1#2#3#4%
-{%
- \expandafter\xint_minus_thenstop%
- \romannumeral0\XINT_add_pre {#2}{#1}%
-}%
-\def\XINT_add_minusplus #1#2#3#4%
-{%
- \XINT_sub_pre {#4#2}{#1}%
-}%
-\def\XINT_add_plusminus #1#2#3#4%
-{%
- \XINT_sub_pre {#3#1}{#2}%
-}%
-\def\XINT_add_plusplus #1#2#3#4%
-{%
- \XINT_add_pre {#4#2}{#3#1}%
-}%
\def\XINT_add_pre #1%
{%
\expandafter\XINT_add_pre_b\expandafter
{\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
}%
\def\XINT_add_pre_b #1#2%
-{%
+{%
\expandafter\XINT_add_A
\expandafter0\expandafter{\expandafter}%
\romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
\W\X\Y\Z #1\W\X\Y\Z
}%
% \end{macrocode}
-% \subsection{\csh{xintSub}}
+% \subsection{\csh{xintiSub}}
% \lverb|Release 1.09a has \xintnum added into \xintiSub.|
% \begin{macrocode}
-\def\xintiiSub {\romannumeral0\xintiisub }%
-\def\xintiisub #1%
-{%
- \expandafter\xint_iisub\expandafter{\romannumeral-`0#1}%
-}%
-\def\xint_iisub #1#2%
+\def\xintiiSub {\romannumeral0\xintiisub }%
+\def\xintiisub #1{\expandafter\xint_iisub\romannumeral-`0#1\Z }%
+\def\xint_iisub #1#2\Z #3%
{%
- \expandafter\XINT_sub_fork \romannumeral-`0#2\Z #1\Z
+ \expandafter\XINT_sub_fork\expandafter #1\romannumeral-`0#3\Z #2\Z
}%
\def\xintiSub {\romannumeral0\xintisub }%
\def\xintisub #1%
{%
- \expandafter\xint_sub\expandafter{\romannumeral0\xintnum{#1}}%
+ \expandafter\xint_sub\romannumeral0\xintnum{#1}\Z
}%
-\def\xint_sub #1#2%
+\def\xint_sub #1#2\Z #3%
{%
- \expandafter\XINT_sub_fork \romannumeral0\xintnum{#2}\Z #1\Z
+ \expandafter\XINT_sub_fork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z
}%
-\def\XINT_Sub #1#2{\romannumeral0\XINT_sub_fork #2\Z #1\Z }%
-\def\XINT_sub #1#2{\XINT_sub_fork #2\Z #1\Z }%
\let\xintSub\xintiSub \let\xintsub\xintisub
-% \end{macrocode}
-% \lverb|&
-% SOUSTRACTION
-% #3#4-#1#2:
-% #3#4 vient du *premier*
-% #1#2 vient du *second*|
-% \begin{macrocode}
-\def\XINT_sub_fork #1#2\Z #3#4\Z
+\def\XINT_sub_fork #1#2%
{%
- \xint_UDsignsfork
- #1#3\XINT_sub_minusminus
- #1-\XINT_sub_minusplus % attention, #3=0 possible
- #3-\XINT_sub_plusminus % attention, #1=0 possible
- --{\xint_UDzerofork
- #1\XINT_sub_secondiszero
- #3\XINT_sub_firstiszero
- 0\XINT_sub_plusplus
- \krof }%
+ \xint_UDzerofork
+ #1\XINT_sub_firstiszero
+ #2\XINT_sub_secondiszero
+ 0{}%
\krof
- {#2}{#4}#1#3%
-}%
-\def\XINT_sub_secondiszero #1#2#3#4{ #4#2}%
-\def\XINT_sub_firstiszero #1#2#3#4{ -#3#1}%
-\def\XINT_sub_plusplus #1#2#3#4%
-{%
- \XINT_sub_pre {#4#2}{#3#1}%
-}%
-\def\XINT_sub_minusminus #1#2#3#4%
-{%
- \XINT_sub_pre {#1}{#2}%
-}%
-\def\XINT_sub_minusplus #1#2#3#4%
-{%
- \xint_gob_til_zero #4\xint_sub_mp0\XINT_add_pre {#4#2}{#1}%
-}%
-\def\xint_sub_mp0\XINT_add_pre #1#2{ #2}%
-\def\XINT_sub_plusminus #1#2#3#4%
-{%
- \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_thenstop%
- \romannumeral0\XINT_add_pre {#2}{#3#1}%
-}%
-\def\xint_sub_pm #1\XINT_add_pre #2#3{ -#2}%
+ \xint_UDsignsfork
+ #1#2\XINT_sub_minusminus
+ #1-\XINT_sub_minusplus
+ #2-\XINT_sub_plusminus
+ --\XINT_sub_plusplus
+ \krof #1#2%
+}%
+\def\XINT_sub_firstiszero #1\krof #2#3\Z #4\Z {\XINT_opp #3}%
+\def\XINT_sub_secondiszero #1\krof #2#3\Z #4\Z { #2#4}%
+\def\XINT_sub_plusplus #1#2#3\Z #4\Z {\XINT_sub_pre {#1#4}{#2#3}}%
+\def\XINT_sub_minusminus #1#2#3\Z #4\Z {\XINT_sub_pre {#3}{#4}}%
+\def\XINT_sub_minusplus #1#2#3\Z #4\Z
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_add_pre {#4}{#2#3}}%
+\def\XINT_sub_plusminus #1#2#3\Z #4\Z {\XINT_add_pre {#1#4}{#3}}%
+% \end{macrocode}
+% \lverb|SOUSTRACTION A-B avec A premier argument, B second argument de
+% \xintSub et ensuite \XINT_sub_pre ici|
+% \begin{macrocode}
\def\XINT_sub_pre #1%
{%
\expandafter\XINT_sub_pre_b\expandafter
{\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
}%
\def\XINT_sub_pre_b #1#2%
-{%
+{%
\expandafter\XINT_sub_A
\expandafter1\expandafter{\expandafter}%
\romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
@@ -14230,29 +15362,29 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% \romannumeral0\XINT_sub_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
+% \romannumeral0\XINT_sub_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
% N1 et N2 sont présentés à l'envers ET ON A RAJOUTÉ DES ZÉROS
% POUR QUE LEURS LONGUEURS À CHACUN SOIENT MULTIPLES DE 4, MAIS
-% AUCUN NE SE TERMINE EN 0000.$\ output: N2 - N1$\
+% AUCUN NE SE TERMINE EN 0000.$\ output: N2 - N1$\
% Elle donne le résultat dans le **bon ordre**, avec le bon signe,
% et sans zéros superflus.|
% \begin{macrocode}
-\def\XINT_sub_A #1#2#3\W\X\Y\Z #4#5#6#7%
+\def\XINT_sub_A #1#2#3\W\X\Y\Z #4#5#6#7%
{%
- \xint_gob_til_W
- #4\xint_sub_az
- \W\XINT_sub_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
+ \xint_gob_til_W
+ #4\xint_sub_az
+ \W\XINT_sub_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
}%
-\def\XINT_sub_B #1#2#3#4#5#6#7%
+\def\XINT_sub_B #1#2#3#4#5#6#7%
{%
- \xint_gob_til_W
- #4\xint_sub_bz
+ \xint_gob_til_W
+ #4\xint_sub_bz
\W\XINT_sub_onestep #1#2{#7#6#5#4}{#3}%
}%
% \end{macrocode}
% \lverb|&
% d'abord la branche principale
-% #6 = 4 chiffres de N1, plus significatif en *premier*,
+% #6 = 4 chiffres de N1, plus significatif en *premier*,
% #2#3#4#5 chiffres de N2, plus significatif en *dernier*
% On veut N2 - N1.|
% \begin{macrocode}
@@ -14267,7 +15399,7 @@ $1$ or $-1$.
{%
\XINT_sub_A #2{#3#4}%
}%
-\def\xint_sub_bz
+\def\xint_sub_bz
\W\XINT_sub_onestep #1#2#3#4#5#6#7%
{%
\xint_UDzerofork
@@ -14290,8 +15422,8 @@ $1$ or $-1$.
}%
\def\XINT_sub_C #1#2#3#4#5%
{%
- \xint_gob_til_W
- #2\xint_sub_cz
+ \xint_gob_til_W
+ #2\xint_sub_cz
\W\XINT_sub_AC_onestep {#5#4#3#2}{#1}%
}%
\def\XINT_sub_AC_onestep #1%
@@ -14304,7 +15436,7 @@ $1$ or $-1$.
}%
\def\XINT_sub_AC_checkcarry #1%
{%
- \xint_gob_til_one #1\xint_sub_AC_nocarry 1\XINT_sub_C
+ \xint_gob_til_one #1\xint_sub_AC_nocarry 1\XINT_sub_C
}%
\def\xint_sub_AC_nocarry 1\XINT_sub_C #1#2\W\X\Y\Z
{%
@@ -14322,10 +15454,10 @@ $1$ or $-1$.
{%
\XINT_cuz
}%
-\def\xint_sub_az\W\XINT_sub_B #1#2#3#4#5#6#7%
+\def\xint_sub_az\W\XINT_sub_B #1#2#3#4#5#6#7%
{%
- \xint_gob_til_W
- #4\xint_sub_ez
+ \xint_gob_til_W
+ #4\xint_sub_ez
\W\XINT_sub_Eenter #1{#3}#4#5#6#7%
}%
% \end{macrocode}
@@ -14443,536 +15575,7 @@ $1$ or $-1$.
\romannumeral0\XINT_cuz_loop #3\W\W\W\W\W\W\W\Z
}%
% \end{macrocode}
-% \subsection{\csh{xintCmp}}
-% \lverb|Release 1.09a has \xintnum inserted into \xintCmp. Unnecessary
-% \xintiCmp suppressed in 1.09f.|
-% \begin{macrocode}
-\def\xintCmp {\romannumeral0\xintcmp }%
-\def\xintcmp #1%
-{%
- \expandafter\xint_cmp\expandafter{\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_cmp #1#2%
-{%
- \expandafter\XINT_cmp_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\def\XINT_Cmp #1#2{\romannumeral0\XINT_cmp_fork #2\Z #1\Z }%
-% \end{macrocode}
-% \lverb|&
-% COMPARAISON $\
-% 1 si #3#4>#1#2, 0 si #3#4=#1#2, -1 si #3#4<#1#2$\
-% #3#4 vient du *premier*,$
-% #1#2 vient du *second*|
-% \begin{macrocode}
-\def\XINT_cmp_fork #1#2\Z #3#4\Z
-{%
- \xint_UDsignsfork
- #1#3\XINT_cmp_minusminus
- #1-\XINT_cmp_minusplus
- #3-\XINT_cmp_plusminus
- --{\xint_UDzerosfork
- #1#3\XINT_cmp_zerozero
- #10\XINT_cmp_zeroplus
- #30\XINT_cmp_pluszero
- 00\XINT_cmp_plusplus
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-\def\XINT_cmp_minusplus #1#2#3#4{ 1}%
-\def\XINT_cmp_plusminus #1#2#3#4{ -1}%
-\def\XINT_cmp_zerozero #1#2#3#4{ 0}%
-\def\XINT_cmp_zeroplus #1#2#3#4{ 1}%
-\def\XINT_cmp_pluszero #1#2#3#4{ -1}%
-\def\XINT_cmp_plusplus #1#2#3#4%
-{%
- \XINT_cmp_pre {#4#2}{#3#1}%
-}%
-\def\XINT_cmp_minusminus #1#2#3#4%
-{%
- \XINT_cmp_pre {#1}{#2}%
-}%
-\def\XINT_cmp_pre #1%
-{%
- \expandafter\XINT_cmp_pre_b\expandafter
- {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
-}%
-\def\XINT_cmp_pre_b #1#2%
-{%
- \expandafter\XINT_cmp_A
- \expandafter1\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #1\W\X\Y\Z
-}%
-% \end{macrocode}
-% \lverb|&
-% COMPARAISON$\
-% N1 et N2 sont présentés à l'envers ET ON A RAJOUTÉ DES ZÉROS
-% POUR QUE LEUR LONGUEURS À CHACUN SOIENT MULTIPLES DE 4, MAIS
-% AUCUN NE SE TERMINE EN 0000.
-% routine appelée via$\
-% \XINT_cmp_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
-% ATTENTION RENVOIE 1 SI N1 < N2, 0 si N1 = N2, -1 si N1 > N2|
-% \begin{macrocode}
-\def\XINT_cmp_A #1#2#3\W\X\Y\Z #4#5#6#7%
-{%
- \xint_gob_til_W #4\xint_cmp_az\W
- \XINT_cmp_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
-}%
-\def\XINT_cmp_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W#4\xint_cmp_bz\W
- \XINT_cmp_onestep #1#2{#7#6#5#4}{#3}%
-}%
-\def\XINT_cmp_onestep #1#2#3#4#5#6%
-{%
- \expandafter\XINT_cmp_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
-}%
-\def\XINT_cmp_backtoA #1#2#3.#4%
-{%
- \XINT_cmp_A #2{#3#4}%
-}%
-\def\xint_cmp_bz\W\XINT_cmp_onestep #1\Z { 1}%
-\def\xint_cmp_az\W\XINT_cmp_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W #4\xint_cmp_ez\W
- \XINT_cmp_Eenter #1{#3}#4#5#6#7%
-}%
-\def\XINT_cmp_Eenter #1\Z { -1}%
-\def\xint_cmp_ez\W\XINT_cmp_Eenter #1%
-{%
- \xint_UDzerofork
- #1\XINT_cmp_K % il y a une retenue
- 0\XINT_cmp_L % pas de retenue
- \krof
-}%
-\def\XINT_cmp_K #1\Z { -1}%
-\def\XINT_cmp_L #1{\XINT_OneIfPositive_main #1}%
-\def\XINT_OneIfPositive #1%
-{%
- \XINT_OneIfPositive_main #1\W\X\Y\Z%
-}%
-\def\XINT_OneIfPositive_main #1#2#3#4%
-{%
- \xint_gob_til_Z #4\xint_OneIfPositive_terminated\Z
- \XINT_OneIfPositive_onestep #1#2#3#4%
-}%
-\def\xint_OneIfPositive_terminated\Z\XINT_OneIfPositive_onestep\W\X\Y\Z { 0}%
-\def\XINT_OneIfPositive_onestep #1#2#3#4%
-{%
- \expandafter\XINT_OneIfPositive_check\the\numexpr #1#2#3#4\relax
-}%
-\def\XINT_OneIfPositive_check #1%
-{%
- \xint_gob_til_zero #1\xint_OneIfPositive_backtomain 0%
- \XINT_OneIfPositive_finish #1%
-}%
-\def\XINT_OneIfPositive_finish #1\W\X\Y\Z{ 1}%
-\def\xint_OneIfPositive_backtomain 0\XINT_OneIfPositive_finish 0%
- {\XINT_OneIfPositive_main }%
-% \end{macrocode}
-% \subsection{\csh{xintEq}, \csh{xintGt}, \csh{xintLt}}
-% \lverb|1.09a.|
-% \begin{macrocode}
-\def\xintEq {\romannumeral0\xinteq }%
-\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}%
-\def\xintGt {\romannumeral0\xintgt }%
-\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}%
-\def\xintLt {\romannumeral0\xintlt }%
-\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
-% \end{macrocode}
-% \subsection{\csh{xintIsZero}, \csh{xintIsNotZero}}
-% \lverb|1.09a. restyled in 1.09i.|
-% \begin{macrocode}
-\def\xintIsZero {\romannumeral0\xintiszero }%
-\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
-\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
-\def\xintisnotzero
- #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
-% \end{macrocode}
-% \subsection{\csh{xintIsTrue}, \csh{xintNot}, \csh{xintIsFalse}}
-% \lverb|1.09c|
-% \begin{macrocode}
-\let\xintIsTrue\xintIsNotZero
-\let\xintNot\xintIsZero
-\let\xintIsFalse\xintIsZero
-% \end{macrocode}
-% \subsection{\csh{xintAND}, \csh{xintOR}, \csh{xintXOR}}
-% \lverb|1.09a. Embarrasing bugs in \xintAND and \xintOR which inserted a space
-% token corrected in 1.09i. \xintxor restyled with \if (faster) in 1.09i|
-% \begin{macrocode}
-\def\xintAND {\romannumeral0\xintand }%
-\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
- \else\expandafter\xint_secondoftwo\fi
- { 0}{\xintisnotzero{#2}}}%
-\def\xintOR {\romannumeral0\xintor }%
-\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
- \else\expandafter\xint_secondoftwo\fi
- {\xintisnotzero{#2}}{ 1}}%
-\def\xintXOR {\romannumeral0\xintxor }%
-\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}%
- \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }%
-% \end{macrocode}
-% \subsection{\csh{xintANDof}}
-% \lverb|New with 1.09a. \xintANDof works also with an empty list.|
-% \begin{macrocode}
-\def\xintANDof {\romannumeral0\xintandof }%
-\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral-`0#1\relax }%
-\def\XINT_andof_a #1{\expandafter\XINT_andof_b\romannumeral-`0#1\Z }%
-\def\XINT_andof_b #1%
- {\xint_gob_til_relax #1\XINT_andof_e\relax\XINT_andof_c #1}%
-\def\XINT_andof_c #1\Z
- {\xintifTrueAelseB {#1}{\XINT_andof_a}{\XINT_andof_no}}%
-\def\XINT_andof_no #1\relax { 0}%
-\def\XINT_andof_e #1\Z { 1}%
-% \end{macrocode}
-% \subsection{\csh{xintORof}}
-% \lverb|New with 1.09a. Works also with an empty list.|
-% \begin{macrocode}
-\def\xintORof {\romannumeral0\xintorof }%
-\def\xintorof #1{\expandafter\XINT_orof_a\romannumeral-`0#1\relax }%
-\def\XINT_orof_a #1{\expandafter\XINT_orof_b\romannumeral-`0#1\Z }%
-\def\XINT_orof_b #1%
- {\xint_gob_til_relax #1\XINT_orof_e\relax\XINT_orof_c #1}%
-\def\XINT_orof_c #1\Z
- {\xintifTrueAelseB {#1}{\XINT_orof_yes}{\XINT_orof_a}}%
-\def\XINT_orof_yes #1\relax { 1}%
-\def\XINT_orof_e #1\Z { 0}%
-% \end{macrocode}
-% \subsection{\csh{xintXORof}}
-% \lverb|New with 1.09a. Works with an empty list, too. \XINT_xorof_c more
-% efficient in 1.09i|
-% \begin{macrocode}
-\def\xintXORof {\romannumeral0\xintxorof }%
-\def\xintxorof #1{\expandafter\XINT_xorof_a\expandafter
- 0\romannumeral-`0#1\relax }%
-\def\XINT_xorof_a #1#2{\expandafter\XINT_xorof_b\romannumeral-`0#2\Z #1}%
-\def\XINT_xorof_b #1%
- {\xint_gob_til_relax #1\XINT_xorof_e\relax\XINT_xorof_c #1}%
-\def\XINT_xorof_c #1\Z #2%
- {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof_a 1}%
- \else\xint_afterfi{\XINT_xorof_a 0}\fi}%
- {\XINT_xorof_a #2}%
- }%
-\def\XINT_xorof_e #1\Z #2{ #2}%
-% \end{macrocode}
-% \subsection{\csh{xintGeq}}
-% \lverb|&
-% Release 1.09a has \xintnum added into \xintGeq. Unused and useless \xintiGeq
-% removed in 1.09e.
-% PLUS GRAND OU ÉGAL
-% attention compare les **valeurs absolues**|
-% \begin{macrocode}
-\def\xintGeq {\romannumeral0\xintgeq }%
-\def\xintgeq #1%
-{%
- \expandafter\xint_geq\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_geq #1#2%
-{%
- \expandafter\XINT_geq_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\def\XINT_Geq #1#2{\romannumeral0\XINT_geq_fork #2\Z #1\Z }%
-% \end{macrocode}
-% \lverb|&
-% PLUS GRAND OU ÉGAL
-% ATTENTION, TESTE les VALEURS ABSOLUES|
-% \begin{macrocode}
-\def\XINT_geq_fork #1#2\Z #3#4\Z
-{%
- \xint_UDzerofork
- #1\XINT_geq_secondiszero % |#1#2|=0
- #3\XINT_geq_firstiszero % |#1#2|>0
- 0{\xint_UDsignsfork
- #1#3\XINT_geq_minusminus
- #1-\XINT_geq_minusplus
- #3-\XINT_geq_plusminus
- --\XINT_geq_plusplus
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-\def\XINT_geq_secondiszero #1#2#3#4{ 1}%
-\def\XINT_geq_firstiszero #1#2#3#4{ 0}%
-\def\XINT_geq_plusplus #1#2#3#4{\XINT_geq_pre {#4#2}{#3#1}}%
-\def\XINT_geq_minusminus #1#2#3#4{\XINT_geq_pre {#2}{#1}}%
-\def\XINT_geq_minusplus #1#2#3#4{\XINT_geq_pre {#4#2}{#1}}%
-\def\XINT_geq_plusminus #1#2#3#4{\XINT_geq_pre {#2}{#3#1}}%
-\def\XINT_geq_pre #1%
-{%
- \expandafter\XINT_geq_pre_b\expandafter
- {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
-}%
-\def\XINT_geq_pre_b #1#2%
-{%
- \expandafter\XINT_geq_A
- \expandafter1\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #1 \W\X\Y\Z
-}%
-% \end{macrocode}
-% \lverb|&
-% PLUS GRAND OU ÉGAL$\
-% N1 et N2 sont présentés à l'envers ET ON A RAJOUTÉ DES ZÉROS
-% POUR QUE LEURS LONGUEURS À CHACUN SOIENT MULTIPLES DE 4, MAIS
-% AUCUN NE SE TERMINE EN 0000$\
-% routine appelée via$\
-% \romannumeral0\XINT_geq_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
-% ATTENTION RENVOIE 1 SI N1 < N2 ou N1 = N2 et 0 si N1 > N2|
-% \begin{macrocode}
-\def\XINT_geq_A #1#2#3\W\X\Y\Z #4#5#6#7%
-{%
- \xint_gob_til_W #4\xint_geq_az\W
- \XINT_geq_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
-}%
-\def\XINT_geq_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W #4\xint_geq_bz\W
- \XINT_geq_onestep #1#2{#7#6#5#4}{#3}%
-}%
-\def\XINT_geq_onestep #1#2#3#4#5#6%
-{%
- \expandafter\XINT_geq_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
-}%
-\def\XINT_geq_backtoA #1#2#3.#4%
-{%
- \XINT_geq_A #2{#3#4}%
-}%
-\def\xint_geq_bz\W\XINT_geq_onestep #1\W\X\Y\Z { 1}%
-\def\xint_geq_az\W\XINT_geq_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W #4\xint_geq_ez\W
- \XINT_geq_Eenter #1%
-}%
-\def\XINT_geq_Eenter #1\W\X\Y\Z { 0}%
-\def\xint_geq_ez\W\XINT_geq_Eenter #1%
-{%
- \xint_UDzerofork
- #1{ 0} % il y a une retenue
- 0{ 1} % pas de retenue
- \krof
-}%
-% \end{macrocode}
-% \subsection{\csh{xintMax}}
-% \lverb|&
-% The rationale is that it is more efficient than using \xintCmp.
-% 1.03 makes the code a tiny bit slower but easier to re-use for fractions.
-% Note: actually since 1.08a code for fractions does not all reduce to these
-% entry points, so perhaps I should revert the changes made in 1.03. Release
-% 1.09a has \xintnum added into \xintiMax.|
-% \begin{macrocode}
-\def\xintiMax {\romannumeral0\xintimax }%
-\def\xintimax #1%
-{%
- \expandafter\xint_max\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\let\xintMax\xintiMax \let\xintmax\xintimax
-\def\xint_max #1#2%
-{%
- \expandafter\XINT_max_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
-}%
-\def\XINT_max_pre #1#2{\XINT_max_fork #1\Z #2\Z {#2}{#1}}%
-\def\XINT_Max #1#2{\romannumeral0\XINT_max_fork #2\Z #1\Z {#1}{#2}}%
-% \end{macrocode}
-% \lverb|&
-% #3#4 vient du *premier*,
-% #1#2 vient du *second*|
-% \begin{macrocode}
-\def\XINT_max_fork #1#2\Z #3#4\Z
-{%
- \xint_UDsignsfork
- #1#3\XINT_max_minusminus % A < 0, B < 0
- #1-\XINT_max_minusplus % B < 0, A >= 0
- #3-\XINT_max_plusminus % A < 0, B >= 0
- --{\xint_UDzerosfork
- #1#3\XINT_max_zerozero % A = B = 0
- #10\XINT_max_zeroplus % B = 0, A > 0
- #30\XINT_max_pluszero % A = 0, B > 0
- 00\XINT_max_plusplus % A, B > 0
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-% \end{macrocode}
-% \lverb|&
-% A = #4#2, B = #3#1|
-% \begin{macrocode}
-\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_thenstop }%
-\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_thenstop }%
-\def\XINT_max_plusplus #1#2#3#4%
-{%
- \ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_firstoftwo_thenstop
- \else
- \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \lverb+#3=-, #4=-, #1 = |B| = -B, #2 = |A| = -A+
-% \begin{macrocode}
-\def\XINT_max_minusminus #1#2#3#4%
-{%
- \ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_firstoftwo_thenstop
- \else
- \expandafter\xint_secondoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintMaxof}}
-% \lverb|New with 1.09a.|
-% \begin{macrocode}
-\def\xintiMaxof {\romannumeral0\xintimaxof }%
-\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral-`0#1\relax }%
-\def\XINT_imaxof_a #1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}\Z }%
-\def\XINT_imaxof_b #1\Z #2%
- {\expandafter\XINT_imaxof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_imaxof_c #1%
- {\xint_gob_til_relax #1\XINT_imaxof_e\relax\XINT_imaxof_d #1}%
-\def\XINT_imaxof_d #1\Z
- {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}%
-\def\XINT_imaxof_e #1\Z #2\Z { #2}%
-\let\xintMaxof\xintiMaxof \let\xintmaxof\xintimaxof
-% \end{macrocode}
-% \subsection{\csh{xintMin}}
-% \lverb|\xintnum added New with 1.09a.|
-% \begin{macrocode}
-\def\xintiMin {\romannumeral0\xintimin }%
-\def\xintimin #1%
-{%
- \expandafter\xint_min\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\let\xintMin\xintiMin \let\xintmin\xintimin
-\def\xint_min #1#2%
-{%
- \expandafter\XINT_min_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
-}%
-\def\XINT_min_pre #1#2{\XINT_min_fork #1\Z #2\Z {#2}{#1}}%
-\def\XINT_Min #1#2{\romannumeral0\XINT_min_fork #2\Z #1\Z {#1}{#2}}%
-% \end{macrocode}
-% \lverb|&
-% #3#4 vient du *premier*,
-% #1#2 vient du *second*|
-% \begin{macrocode}
-\def\XINT_min_fork #1#2\Z #3#4\Z
-{%
- \xint_UDsignsfork
- #1#3\XINT_min_minusminus % A < 0, B < 0
- #1-\XINT_min_minusplus % B < 0, A >= 0
- #3-\XINT_min_plusminus % A < 0, B >= 0
- --{\xint_UDzerosfork
- #1#3\XINT_min_zerozero % A = B = 0
- #10\XINT_min_zeroplus % B = 0, A > 0
- #30\XINT_min_pluszero % A = 0, B > 0
- 00\XINT_min_plusplus % A, B > 0
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-% \end{macrocode}
-% \lverb|&
-% A = #4#2, B = #3#1|
-% \begin{macrocode}
-\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_thenstop }%
-\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_thenstop }%
-\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_thenstop }%
-\def\XINT_min_plusplus #1#2#3#4%
-{%
- \ifodd\XINT_Geq {#4#2}{#3#1}
- \expandafter\xint_secondoftwo_thenstop
- \else
- \expandafter\xint_firstoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \lverb+#3=-, #4=-, #1 = |B| = -B, #2 = |A| = -A+
-% \begin{macrocode}
-\def\XINT_min_minusminus #1#2#3#4%
-{%
- \ifodd\XINT_Geq {#1}{#2}
- \expandafter\xint_secondoftwo_thenstop
- \else
- \expandafter\xint_firstoftwo_thenstop
- \fi
-}%
-% \end{macrocode}
-% \subsection{\csh{xintMinof}}
-% \lverb|1.09a|
-% \begin{macrocode}
-\def\xintiMinof {\romannumeral0\xintiminof }%
-\def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral-`0#1\relax }%
-\def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}\Z }%
-\def\XINT_iminof_b #1\Z #2%
- {\expandafter\XINT_iminof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_iminof_c #1%
- {\xint_gob_til_relax #1\XINT_iminof_e\relax\XINT_iminof_d #1}%
-\def\XINT_iminof_d #1\Z
- {\expandafter\XINT_iminof_b\romannumeral0\xintimin {#1}}%
-\def\XINT_iminof_e #1\Z #2\Z { #2}%
-\let\xintMinof\xintiMinof \let\xintminof\xintiminof
-% \end{macrocode}
-% \subsection{\csh{xintSum}}
-% \lverb|&
-% \xintSum {{a}{b}...{z}}$\
-% \xintSumExpr {a}{b}...{z}\relax$\
-% 1.03 (drastically) simplifies and makes the routines more efficient (for big
-% 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 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%
-{%
- \expandafter\XINT_sum_checksign\romannumeral-`0#3\Z {#1}{#2}%
-}%
-\def\XINT_sum_checksign #1%
-{%
- \xint_gob_til_relax #1\XINT_sum_finished\relax
- \xint_gob_til_zero #1\XINT_sum_skipzeroinput0%
- \xint_UDsignfork
- #1\XINT_sum_N
- -{\XINT_sum_P #1}%
- \krof
-}%
-\def\XINT_sum_finished #1\Z #2#3%
-{%
- \XINT_sub_A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
-}%
-\def\XINT_sum_skipzeroinput #1\krof #2\Z {\XINT_sum_loop }%
-\def\XINT_sum_P #1\Z #2%
-{%
- \expandafter\XINT_sum_loop\expandafter
- {\romannumeral0\expandafter
- \XINT_addr_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #2\W\X\Y\Z }%
-}%
-\def\XINT_sum_N #1\Z #2#3%
-{%
- \expandafter\XINT_sum_NN\expandafter
- {\romannumeral0\expandafter
- \XINT_addr_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #3\W\X\Y\Z }{#2}%
-}%
-\def\XINT_sum_NN #1#2{\XINT_sum_loop {#2}{#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintMul}}
+% \subsection{\csh{xintiMul}}
% \lverb|1.09a adds \xintnum|
% \begin{macrocode}
\def\xintiiMul {\romannumeral0\xintiimul }%
@@ -14982,7 +15585,7 @@ $1$ or $-1$.
}%
\def\xint_iimul #1#2%
{%
- \expandafter\XINT_mul_fork \romannumeral-`0#2\Z #1\Z
+ \expandafter\XINT_mul_fork \romannumeral-`0#2\Z #1\Z
}%
\def\xintiMul {\romannumeral0\xintimul }%
\def\xintimul #1%
@@ -14991,14 +15594,14 @@ $1$ or $-1$.
}%
\def\xint_mul #1#2%
{%
- \expandafter\XINT_mul_fork \romannumeral0\xintnum{#2}\Z #1\Z
+ \expandafter\XINT_mul_fork \romannumeral0\xintnum{#2}\Z #1\Z
}%
\let\xintMul\xintiMul \let\xintmul\xintimul
\def\XINT_Mul #1#2{\romannumeral0\XINT_mul_fork #2\Z #1\Z }%
% \end{macrocode}
% \lverb|&
-% MULTIPLICATION$\
-% Ici #1#2 = 2e input et #3#4 = 1er input $\
+% MULTIPLICATION$\
+% Ici #1#2 = 2e input et #3#4 = 1er input $\
% Release 1.03 adds some overhead to first compute and compare the
% lengths of the two inputs. The algorithm is asymmetrical and whether
% the first input is the longest or the shortest sometimes has a strong
@@ -15014,16 +15617,17 @@ $1$ or $-1$.
\xint_UDzerofork
#1\XINT_mul_zero
#3\XINT_mul_zero
- 0{\xint_UDsignsfork
+ 0{}%
+ \krof
+ \xint_UDsignsfork
#1#3\XINT_mul_minusminus % #1 = #3 = -
#1-{\XINT_mul_minusplus #3}% % #1 = -
#3-{\XINT_mul_plusminus #1}% % #3 = -
--{\XINT_mul_plusplus #1#3}%
- \krof }%
\krof
{#2}{#4}%
}%
-\def\XINT_mul_zero #1#2{ 0}%
+\def\XINT_mul_zero #1\krof #2#3{ 0}%
\def\XINT_mul_minusminus #1#2%
{%
\expandafter\XINT_mul_choice_a
@@ -15064,7 +15668,7 @@ $1$ or $-1$.
\else
\expandafter\expandafter\expandafter\XINT_mul_choice_compare
\fi
- \fi
+ \fi
{#1}{#2}%
}%
\def\XINT_mul_choice_littlebyfirst #1#2#3#4%
@@ -15092,20 +15696,20 @@ $1$ or $-1$.
{%
\ifnum #1<\numexpr\ifcase \numexpr (#2-\xint_c_iii)/\xint_c_iv\relax
\or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
- \expandafter\XINT_mul_choice_same
+ \expandafter\XINT_mul_choice_same
\else
\expandafter\XINT_mul_choice_permute
\fi
-}%
+}%
\def\XINT_mul_choice_ii #1#2%
{%
\ifnum #2<\numexpr\ifcase \numexpr (#1-\xint_c_iii)/\xint_c_iv\relax
\or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
- \expandafter\XINT_mul_choice_permute
+ \expandafter\XINT_mul_choice_permute
\else
\expandafter\XINT_mul_choice_same
\fi
-}%
+}%
\def\XINT_mul_choice_same #1#2%
{%
\expandafter\XINT_mul_enter
@@ -15116,21 +15720,21 @@ $1$ or $-1$.
{%
\expandafter\XINT_mul_enter
\romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \Z\Z\Z\Z #1\W\W\W\W
+ \Z\Z\Z\Z #1\W\W\W\W
}%
% \end{macrocode}
% \lverb|&
% Cette portion de routine d'addition se branche directement sur _addr_
-% lorsque
+% lorsque
% le premier nombre est épuisé, ce qui est garanti arriver avant le second
% nombre. Elle produit son résultat toujours sur 4n, renversé. Ses deux inputs
% sont garantis sur 4n.|
% \begin{macrocode}
-\def\XINT_mul_Ar #1#2#3#4#5#6%
+\def\XINT_mul_Ar #1#2#3#4#5#6%
{%
- \xint_gob_til_Z #6\xint_mul_br\Z\XINT_mul_Br #1{#6#5#4#3}{#2}%
+ \xint_gob_til_Z #6\xint_mul_br\Z\XINT_mul_Br #1{#6#5#4#3}{#2}%
}%
-\def\xint_mul_br\Z\XINT_mul_Br #1#2%
+\def\xint_mul_br\Z\XINT_mul_Br #1#2%
{%
\XINT_addr_AC_checkcarry #1%
}%
@@ -15146,8 +15750,8 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|&
% << Petite >> multiplication.
-% mul_Mr renvoie le résultat *à l'envers*, sur *4n*$\
-% \romannumeral0\XINT_mul_Mr {<n>}<N>\Z\Z\Z\Z$\
+% mul_Mr renvoie le résultat *à l'envers*, sur *4n*$\
+% \romannumeral0\XINT_mul_Mr {<n>}<N>\Z\Z\Z\Z$\
% Fait la multiplication de <N> par <n>, qui est < 10000.
% <N> est présenté *à l'envers*, sur *4n*. Lorsque <n> vaut 0, donne 0000.|
% \begin{macrocode}
@@ -15159,7 +15763,7 @@ $1$ or $-1$.
{%
\ifcase #1
\expandafter\XINT_mul_Mr_zero
- \or
+ \or
\expandafter\XINT_mul_Mr_one
\else
\expandafter\XINT_mul_Nr
@@ -15169,12 +15773,12 @@ $1$ or $-1$.
\def\XINT_mul_Mr_zero #1\Z\Z\Z\Z { 0000}%
\def\XINT_mul_Mr_one #1#2#3#4\Z\Z\Z\Z { #4}%
\def\XINT_mul_Nr #1#2#3#4#5#6#7%
-{%
+{%
\xint_gob_til_Z #4\xint_mul_pr\Z\XINT_mul_Pr {#1}{#3}{#7#6#5#4}{#2}{#3}%
}%
\def\XINT_mul_Pr #1#2#3%
{%
- \expandafter\XINT_mul_Lr\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
+ \expandafter\XINT_mul_Lr\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
}%
\def\XINT_mul_Lr 1#1#2#3#4#5#6#7#8#9%
{%
@@ -15190,8 +15794,8 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|&
% << Petite >> multiplication.
-% renvoie le résultat *à l'endroit*, avec *nettoyage des leading zéros*.$\
-% \romannumeral0\XINT_mul_M {<n>}<N>\Z\Z\Z\Z$\
+% renvoie le résultat *à l'endroit*, avec *nettoyage des leading zéros*.$\
+% \romannumeral0\XINT_mul_M {<n>}<N>\Z\Z\Z\Z$\
% Fait la multiplication de <N> par <n>, qui est < 10000.
% <N> est présenté *à l'envers*, sur *4n*. |
% \begin{macrocode}
@@ -15203,7 +15807,7 @@ $1$ or $-1$.
{%
\ifcase #1
\expandafter\XINT_mul_M_zero
- \or
+ \or
\expandafter\XINT_mul_M_one
\else
\expandafter\XINT_mul_N
@@ -15211,17 +15815,17 @@ $1$ or $-1$.
{0000}{}{#1}%
}%
\def\XINT_mul_M_zero #1\Z\Z\Z\Z { 0}%
-\def\XINT_mul_M_one #1#2#3#4\Z\Z\Z\Z
+\def\XINT_mul_M_one #1#2#3#4\Z\Z\Z\Z
{%
\expandafter\xint_cleanupzeros_andstop\romannumeral0\xintreverseorder{#4}%
}%
\def\XINT_mul_N #1#2#3#4#5#6#7%
-{%
+{%
\xint_gob_til_Z #4\xint_mul_p\Z\XINT_mul_P {#1}{#3}{#7#6#5#4}{#2}{#3}%
}%
\def\XINT_mul_P #1#2#3%
{%
- \expandafter\XINT_mul_L\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
+ \expandafter\XINT_mul_L\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
}%
\def\XINT_mul_L 1#1#2#3#4#5#6#7#8#9%
{%
@@ -15238,14 +15842,14 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|&
% Routine de multiplication principale
-% (attention délimiteurs modifiés pour 1.08)$\
+% (attention délimiteurs modifiés pour 1.08)$\
% Le résultat partiel est toujours maintenu avec significatif à
-% droite et il a un nombre multiple de 4 de chiffres$\
-% \romannumeral0\XINT_mul_enter <N1>\Z\Z\Z\Z <N2>\W\W\W\W$\
+% droite et il a un nombre multiple de 4 de chiffres$\
+% \romannumeral0\XINT_mul_enter <N1>\Z\Z\Z\Z <N2>\W\W\W\W$\
% avec <N1> *renversé*, *longueur 4n* (zéros éventuellement ajoutés
% au-delà du chiffre le plus significatif)
% et <N2> dans l'ordre *normal*, et pas forcément longueur 4n.
-% pas de signes.$\
+% pas de signes.$\
% Pour 1.08: dans \XINT_mul_enter et les modifs de 1.03
% qui filtrent les courts, on pourrait croire que le
% second opérande a au moins quatre chiffres; mais le problème c'est que
@@ -15261,9 +15865,9 @@ $1$ or $-1$.
% modifiée pour le deuxième opérande.|
% \begin{macrocode}
\def\XINT_mul_enter #1\Z\Z\Z\Z #2#3#4#5%
-{%
+{%
\xint_gob_til_W #5\XINT_mul_exit_a\W
- \XINT_mul_start {#2#3#4#5}#1\Z\Z\Z\Z
+ \XINT_mul_start {#2#3#4#5}#1\Z\Z\Z\Z
}%
\def\XINT_mul_exit_a\W\XINT_mul_start #1%
{%
@@ -15289,23 +15893,23 @@ $1$ or $-1$.
{%
\XINT_mul_M {#1}#2\Z\Z\Z\Z
}%
-\def\XINT_mul_start #1#2\Z\Z\Z\Z
+\def\XINT_mul_start #1#2\Z\Z\Z\Z
{%
\expandafter\XINT_mul_main\expandafter
- {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
+ {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
}%
\def\XINT_mul_main #1#2\Z\Z\Z\Z #3#4#5#6%
{%
\xint_gob_til_W #6\XINT_mul_finish_a\W
- \XINT_mul_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
+ \XINT_mul_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
}%
-\def\XINT_mul_compute #1#2#3\Z\Z\Z\Z
+\def\XINT_mul_compute #1#2#3\Z\Z\Z\Z
{%
\expandafter\XINT_mul_main\expandafter
{\romannumeral0\expandafter
\XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
- \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
+ \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
}%
% \end{macrocode}
% \lverb|&
@@ -15330,18 +15934,18 @@ $1$ or $-1$.
\def\XINT_mul_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
{%
\expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
}%
\def\XINT_mul_finish_cii
\W\XINT_mul_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
{%
\expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
}%
-\def\XINT_mul_finish_ci #1\XINT_mul_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
+\def\XINT_mul_finish_ci #1\XINT_mul_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
{%
\expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
}%
\def\XINT_mul_finish_c #1\XINT_mul_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z
{%
@@ -15349,19 +15953,19 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% Variante de la Multiplication$\
-% \romannumeral0\XINT_mulr_enter <N1>\Z\Z\Z\Z <N2>\W\W\W\W $\
+% Variante de la Multiplication$\
+% \romannumeral0\XINT_mulr_enter <N1>\Z\Z\Z\Z <N2>\W\W\W\W $\
% Ici <N1> est à l'envers sur 4n, et <N2> est à l'endroit, pas sur 4n, comme
% dans \XINT_mul_enter, mais le résultat est lui-même fourni *à l'envers*, sur
-% *4n* (en faisant attention de ne pas avoir 0000 à la fin).$\
+% *4n* (en faisant attention de ne pas avoir 0000 à la fin).$\
% Utilisé par le calcul des puissances. J'ai modifié dans 1.08 sur le
% modèle de la nouvelle version de \XINT_mul_enter. Je pourrais économiser des
% macros et fusionner \XINT_mul_enter et \XINT_mulr_enter. Une autre fois.|
% \begin{macrocode}
\def\XINT_mulr_enter #1\Z\Z\Z\Z #2#3#4#5%
-{%
+{%
\xint_gob_til_W #5\XINT_mulr_exit_a\W
- \XINT_mulr_start {#2#3#4#5}#1\Z\Z\Z\Z
+ \XINT_mulr_start {#2#3#4#5}#1\Z\Z\Z\Z
}%
\def\XINT_mulr_exit_a\W\XINT_mulr_start #1%
{%
@@ -15387,23 +15991,23 @@ $1$ or $-1$.
{%
\XINT_mul_Mr {#1}#2\Z\Z\Z\Z
}%
-\def\XINT_mulr_start #1#2\Z\Z\Z\Z
+\def\XINT_mulr_start #1#2\Z\Z\Z\Z
{%
\expandafter\XINT_mulr_main\expandafter
- {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
+ {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
}%
\def\XINT_mulr_main #1#2\Z\Z\Z\Z #3#4#5#6%
{%
\xint_gob_til_W #6\XINT_mulr_finish_a\W
- \XINT_mulr_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
+ \XINT_mulr_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
}%
-\def\XINT_mulr_compute #1#2#3\Z\Z\Z\Z
+\def\XINT_mulr_compute #1#2#3\Z\Z\Z\Z
{%
\expandafter\XINT_mulr_main\expandafter
{\romannumeral0\expandafter
\XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
- \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
+ \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
}%
\def\XINT_mulr_finish_a\W\XINT_mulr_compute #1%
{%
@@ -15420,194 +16024,51 @@ $1$ or $-1$.
\def\XINT_mulr_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
{%
\expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
}%
\def\XINT_mulr_finish_cii
\W\XINT_mulr_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
{%
\expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
}%
-\def\XINT_mulr_finish_ci #1\XINT_mulr_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
+\def\XINT_mulr_finish_ci #1\XINT_mulr_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
{%
\expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
+ \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
}%
\def\XINT_mulr_finish_c #1\XINT_mulr_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z { #2}%
% \end{macrocode}
-% \subsection{\csh{xintSqr}}
+% \subsection{\csh{xintiSqr}}
% \begin{macrocode}
\def\xintiiSqr {\romannumeral0\xintiisqr }%
\def\xintiisqr #1%
{%
- \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiiabs{#1}}%
+ \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiiabs{#1}}%
}%
\def\xintiSqr {\romannumeral0\xintisqr }%
\def\xintisqr #1%
{%
- \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiabs{#1}}%
+ \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiabs{#1}}%
}%
\let\xintSqr\xintiSqr \let\xintsqr\xintisqr
\def\XINT_sqr #1%
-{%
+{%
\expandafter\XINT_mul_enter
\romannumeral0%
\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
\Z\Z\Z\Z #1\W\W\W\W
}%
% \end{macrocode}
-% \subsection{\csh{xintPrd}}
-% \lverb|&
-% \xintPrd {{a}...{z}}$\
-% \xintPrdExpr {a}...{z}\relax$\
-% Release 1.02 modified the product routine. The earlier version was faster in
-% situations where each new term is bigger than the product of all previous
-% terms, a situation which arises in the algorithm for computing powers. The
-% 1.02 version was changed to be more efficient on big products, where the new
-% term is small compared to what has been computed so far (the power algorithm
-% now has its own product routine).
-%
-% Finally, the 1.03 version just simplifies everything as the multiplication now
-% decides what is best, with the price of a little overhead. So the code has
-% been dramatically reduced here.
-%
-% In 1.03 I also modify the way \xintPrd and \xintPrdExpr ...\relax are
-% related. Now \xintPrdExpr \z \relax is accepted input when \z expands
-% to a list of braced terms (prior only \xintPrd {\z} or \xintPrd \z was
-% possible).
-%
-% 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.
-%
-% 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%
- {\expandafter\XINT_prod_loop_b \romannumeral-`0#2\Z #1\Z \Z}%
-\def\XINT_prod_loop_b #1%
- {\xint_gob_til_relax #1\XINT_prod_finished\relax\XINT_prod_loop_c #1}%
-\def\XINT_prod_loop_c
- {\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork }%
-\def\XINT_prod_finished #1\Z #2\Z \Z { #2}%
-% \end{macrocode}
-% \subsection{\csh{xintFac}}
-% \lverb|&
-% Modified with 1.02 and again in 1.03 for greater efficiency. I am
-% tempted,
-% here and elsewhere, to use \ifcase\XINT_Geq {#1}{1000000000} rather than
-% \ifnum\xintLength {#1}>9 but for the time being I leave things as they stand.
-% With release 1.05, rather than using \xintLength I opt finally for direct use
-% of \numexpr (which will throw a suitable number too big message), and to raise
-% the \xintError:$\ FactorialOfTooBigNumber for argument larger than 1000000
-% (rather than 1000000000). With 1.09a, \xintFac uses \xintnum.
-%
-% 1.09j for no special reason, I lower the maximal number from 999999 to 100000.
-% Any how this computation would need more memory than TL2013 standard allows to
-% TeX. And I don't even mention time... |
-% \begin{macrocode}
-\def\xintiFac {\romannumeral0\xintifac }%
-\def\xintifac #1%
-{%
- \expandafter\XINT_fac_fork\expandafter{\the\numexpr #1}%
-}%
-\let\xintFac\xintiFac \let\xintfac\xintifac
-\def\XINT_fac_fork #1%
-{%
- \ifcase\XINT_cntSgn #1\Z
- \xint_afterfi{\expandafter\space\expandafter 1\xint_gobble_i }%
- \or
- \expandafter\XINT_fac_checklength
- \else
- \xint_afterfi{\expandafter\xintError:FactorialOfNegativeNumber
- \expandafter\space\expandafter 1\xint_gobble_i }%
- \fi
- {#1}%
-}%
-\def\XINT_fac_checklength #1%
-{%
- \ifnum #1>100000
- \xint_afterfi{\expandafter\xintError:FactorialOfTooBigNumber
- \expandafter\space\expandafter 1\xint_gobble_i }%
- \else
- \xint_afterfi{\ifnum #1>\xint_c_ixixixix
- \expandafter\XINT_fac_big_loop
- \else
- \expandafter\XINT_fac_loop
- \fi }%
- \fi
- {#1}%
-}%
-\def\XINT_fac_big_loop #1{\XINT_fac_big_loop_main {10000}{#1}{}}%
-\def\XINT_fac_big_loop_main #1#2#3%
-{%
- \ifnum #1<#2
- \expandafter
- \XINT_fac_big_loop_main
- \expandafter
- {\the\numexpr #1+1\expandafter }%
- \else
- \expandafter\XINT_fac_big_docomputation
- \fi
- {#2}{#3{#1}}%
-}%
-\def\XINT_fac_big_docomputation #1#2%
-{%
- \expandafter \XINT_fac_bigcompute_loop \expandafter
- {\romannumeral0\XINT_fac_loop {9999}}#2\relax
-}%
-\def\XINT_fac_bigcompute_loop #1#2%
-{%
- \xint_gob_til_relax #2\XINT_fac_bigcompute_end\relax
- \expandafter\XINT_fac_bigcompute_loop\expandafter
- {\expandafter\XINT_mul_enter
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \Z\Z\Z\Z #1\W\W\W\W }%
-}%
-\def\XINT_fac_bigcompute_end #1#2#3#4#5%
-{%
- \XINT_fac_bigcompute_end_ #5%
-}%
-\def\XINT_fac_bigcompute_end_ #1\R #2\Z \W\X\Y\Z #3\W\X\Y\Z { #3}%
-\def\XINT_fac_loop #1{\XINT_fac_loop_main 1{1000}{#1}}%
-\def\XINT_fac_loop_main #1#2#3%
-{%
- \ifnum #3>#1
- \else
- \expandafter\XINT_fac_loop_exit
- \fi
- \expandafter\XINT_fac_loop_main\expandafter
- {\the\numexpr #1+1\expandafter }\expandafter
- {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z }%
- {#3}%
-}%
-\def\XINT_fac_loop_exit #1#2#3#4#5#6#7%
-{%
- \XINT_fac_loop_exit_ #6%
-}%
-\def\XINT_fac_loop_exit_ #1#2#3%
-{%
- \XINT_mul_M
-}%
-% \end{macrocode}
-% \subsection{\csh{xintPow}}
+% \subsection{\csh{xintiPow}}
% \lverb|1.02 modified the \XINT_posprod routine, the was renamed
% \XINT_pow_posprod and moved here, as it was well adapted for computing powers.
% Then 1.03 moved the special variants of multiplication (hence of addition)
-% which were needed to earlier in this style file.
+% which were needed to earlier in this style file.
%
% Modified in 1.06, the exponent is given to a \numexpr rather than twice
% expanded. \xintnum added in 1.09a.
-%
+%
% \XINT_pow_posprod: Routine de produit servant pour le calcul des
% puissances. Chaque nouveau terme est plus grand que ce qui a déjà été calculé.
% Par conséquent on a intérêt à le conserver en second dans la routine de
@@ -15619,7 +16080,7 @@ $1$ or $-1$.
% routine has been removed, intermediate multiplications are done
% immediately. Also, the maximal accepted exponent is now 100000 (no such
% restriction in \xintFloatPow, which accepts any exponent less than 2^31, and
-% in \xintFloatPower which accepts long integers as exponent).
+% in \xintFloatPower which accepts long integers as exponent).
%
% 2^100000=9.990020930143845e30102 and multiplication of two numbers
% with 30000 digits would take hours on my laptop (seconds for 1000 digits).|
@@ -15635,8 +16096,8 @@ $1$ or $-1$.
\expandafter\xint_pow\romannumeral0\xintnum{#1}\Z%
}%
\let\xintPow\xintiPow \let\xintpow\xintipow
-\def\xint_pow #1#2\Z
-{%
+\def\xint_pow #1#2\Z
+{%
\xint_UDsignfork
#1\XINT_pow_Aneg
-\XINT_pow_Anonneg
@@ -15645,7 +16106,7 @@ $1$ or $-1$.
}%
\def\XINT_pow_Aneg #1#2#3%
{%
- \expandafter\XINT_pow_Aneg_\expandafter{\the\numexpr #3}{#2}%
+ \expandafter\XINT_pow_Aneg_\expandafter{\the\numexpr #3}#2\Z
}%
\def\XINT_pow_Aneg_ #1%
{%
@@ -15656,28 +16117,28 @@ $1$ or $-1$.
}%
\def\XINT_pow_Aneg_Bodd #1%
{%
- \expandafter\XINT_opp\romannumeral0\XINT_pow_Anonneg_
+ \expandafter\XINT_opp\romannumeral0\XINT_pow_Anonneg_
}%
% \end{macrocode}
% \lverb|B = #3, faire le xpxp. Modified with 1.06: use of \numexpr.|
% \begin{macrocode}
\def\XINT_pow_Anonneg #1#2#3%
{%
- \expandafter\XINT_pow_Anonneg_\expandafter {\the\numexpr #3}{#1#2}%
+ \expandafter\XINT_pow_Anonneg_\expandafter {\the\numexpr #3}#1#2\Z
}%
% \end{macrocode}
-% \lverb+#1 = B, #2 = |A|+
+% \lverb+#1 = B, #2 = |A|. Modifié pour v1.1, car utilisait \XINT_Cmp, ce qui
+% d'ailleurs n'était sans doute pas super efficace, et m'obligeait à mettre
+% \xintCmp dans xintcore. Donc ici A est déjà #2#3 et il y a un \Z après.+
% \begin{macrocode}
-\def\XINT_pow_Anonneg_ #1#2%
+\def\XINT_pow_Anonneg_ #1#2#3\Z
{%
- \ifcase\XINT_Cmp {#2}{1}
- \expandafter\XINT_pow_AisOne
- \or
- \expandafter\XINT_pow_AatleastTwo
- \else
- \expandafter\XINT_pow_AisZero
- \fi
- {#1}{#2}%
+ \if\relax #3\relax\xint_dothis
+ {\ifcase #2 \expandafter\XINT_pow_AisZero
+ \or\expandafter\XINT_pow_AisOne
+ \else\expandafter\XINT_pow_AatleastTwo
+ \fi }\fi
+ \xint_orthat \XINT_pow_AatleastTwo {#1}{#2#3}%
}%
\def\XINT_pow_AisOne #1#2{ 1}%
% \end{macrocode}
@@ -15714,7 +16175,7 @@ $1$ or $-1$.
% \begin{macrocode}
\def\XINT_pow_checkBsize #1%
{%
- \ifnum #1>100000
+ \ifnum #1>100000
\expandafter\XINT_pow_BtooBig
\else
\expandafter\XINT_pow_loopI
@@ -15782,7 +16243,7 @@ $1$ or $-1$.
\fi\XINT_mul_enter #4\Z\Z\Z\Z #3\W\W\W\W
}%
% \end{macrocode}
-% \subsection{\csh{xintDivision}, \csh{xintQuo}, \csh{xintRem}}
+% \subsection{\csh{xintiDivision}, \csh{xintiQuo}, \csh{xintiRem}}
% \lverb|The 1.09a release inserted the use of \xintnum. The \xintiiDivision
% etc... are the ones which do only \romannumeral-`0.
%
@@ -15811,7 +16272,7 @@ $1$ or $-1$.
% is not much worse, indeed it is perhaps actually better than the one
% abandoning the quotient digits upstream (and in the end putting them
% in the correct order). So, finally, I re-incorporated the produced
-% quotient digits within a tail recursion. Hence \xintDivision, like all
+% quotient digits within a tail recursion. Hence \xintiDivision, like all
% other routines in xint (except \xintSeq without optional parameter)
% still does not impact the input save stack. One can have a produced
% quotient longer than 4x5000=20000 digits, and no need to worry about
@@ -15831,127 +16292,70 @@ $1$ or $-1$.
% & \expandafter's...) in order to be nestable. Inside \xintexpr such style of
% & tail recursion leaving downstream things should definitely be implemented for
% & the routines for which it is possible as things get expanded inside
-% & \csname..\endcsname. I don't do yet anything like this for 1.09j.
+% & \csname..\endcsname. I don't do yet anything like this for 1.09j.
% |
% \begin{macrocode}
\def\xintiiQuo {\romannumeral0\xintiiquo }%
\def\xintiiRem {\romannumeral0\xintiirem }%
-\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop
- \romannumeral0\xintiidivision }%
-\def\xintiirem {\expandafter\xint_secondoftwo_thenstop
- \romannumeral0\xintiidivision }%
-\def\xintQuo {\romannumeral0\xintquo }%
-\def\xintRem {\romannumeral0\xintrem }%
-\def\xintquo {\expandafter\xint_firstoftwo_thenstop
- \romannumeral0\xintdivision }%
-\def\xintrem {\expandafter\xint_secondoftwo_thenstop
- \romannumeral0\xintdivision }%
-% \end{macrocode}
-% \lverb|#1 = A, #2 = B. On calcule le quotient et le reste dans la division
-% euclidienne de A par B.|
-% \begin{macrocode}
-\def\xintiiDivision {\romannumeral0\xintiidivision }%
-\def\xintiidivision #1%
-{%
- \expandafter\xint_iidivision\expandafter {\romannumeral-`0#1}%
-}%
-\def\xint_iidivision #1#2%
+\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }%
+\def\xintiirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }%
+\def\xintiQuo {\romannumeral0\xintiquo }%
+\def\xintiRem {\romannumeral0\xintirem }%
+\def\xintiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }%
+\def\xintirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }%
+\let\xintQuo\xintiQuo\let\xintquo\xintiquo % deprecated (1.1)
+\let\xintRem\xintiRem\let\xintrem\xintirem % deprecated (1.1)
+% \end{macrocode}
+% \lverb-#1 = A, #2 = B. On calcule le quotient et le reste dans la division
+% euclidienne de A par B: A=BQ+R, 0<= R < |B|.-
+% \begin{macrocode}
+\def\xintiDivision {\romannumeral0\xintidivision }%
+\def\xintidivision #1{\expandafter\XINT_division\romannumeral0\xintnum{#1}\Z }%
+\let\xintDivision\xintiDivision \let\xintdivision\xintidivision % deprecated
+\def\XINT_division #1#2\Z #3{\expandafter\XINT_iidivision_a\expandafter #1%
+ \romannumeral0\xintnum{#3}\Z #2\Z }%
+\def\xintiiDivision {\romannumeral0\xintiidivision }%
+\def\xintiidivision #1{\expandafter\XINT_iidivision \romannumeral-`0#1\Z }%
+\def\XINT_iidivision #1#2\Z #3{\expandafter\XINT_iidivision_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivision_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivision_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivision_aiszero\fi
+ \if-#2\xint_dothis{\expandafter\XINT_iidivision_bneg
+ \romannumeral0\XINT_iidivision_bpos #1}\fi
+ \xint_orthat{\XINT_iidivision_bpos #1#2}%
+}%
+\def\XINT_iidivision_divbyzero #1\Z #2\Z {\xintError:DivisionByZero\space {0}{0}}%
+\def\XINT_iidivision_aiszero #1\Z #2\Z { {0}{0}}%
+\def\XINT_iidivision_bneg #1% q->-q, r unchanged
+ {\expandafter\space\expandafter{\romannumeral0\XINT_opp #1}}%
+\def\XINT_iidivision_bpos #1%
{%
- \expandafter\XINT_div_fork \romannumeral-`0#2\Z #1\Z
-}%
-\def\xintDivision {\romannumeral0\xintdivision }%
-\def\xintdivision #1%
-{%
- \expandafter\xint_division\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_division #1#2%
-{%
- \expandafter\XINT_div_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-% \end{macrocode}
-% \lverb|#1#2 = 2e input = diviseur = B.
-% #3#4 = 1er input = divisé = A.|
-% \begin{macrocode}
-\def\XINT_div_fork #1#2\Z #3#4\Z
-{%
- \xint_UDzerofork
- #1\XINT_div_BisZero
- #3\XINT_div_AisZero
- 0{\xint_UDsignfork
- #1\XINT_div_BisNegative % B < 0
- #3\XINT_div_AisNegative % A < 0, B > 0
- -\XINT_div_plusplus % B > 0, A > 0
- \krof }%
+ \xint_UDsignfork
+ #1\XINT_iidivision_aneg
+ -{\XINT_iidivision_apos #1}%
\krof
- {#2}{#4}#1#3% #1#2=B, #3#4=A
}%
-\edef\XINT_div_BisZero #1#2#3#4{\noexpand\xintError:DivisionByZero\space {0}{0}}%
-\def\XINT_div_AisZero #1#2#3#4{ {0}{0}}%
-% \end{macrocode}
-% \lverb|&
-% jusqu'à présent c'est facile.$\
-% minusplus signifie B < 0, A > 0$\
-% plusminus signifie B > 0, A < 0$\
-% Ici #3#1 correspond au diviseur B et #4#2 au divisé A.
-%
-% Cases with B<0 or especially A<0 are treated sub-optimally in terms of
-% post-processing, things get reversed which could have been produced directly
-% in the wanted order, but A,B>0 is given priority for optimization. I should
-% revise the next few macros, definitely.|
-% \begin{macrocode}
-\def\XINT_div_plusplus #1#2#3#4{\XINT_div_prepare {#3#1}{#4#2}}%
-% \end{macrocode}
-% \lverb|B = #3#1 < 0, A non nul positif ou négatif|
-% \begin{macrocode}
-\def\XINT_div_BisNegative #1#2#3#4%
-{%
- \expandafter\XINT_div_BisNegative_b
- \romannumeral0\XINT_div_fork #1\Z #4#2\Z
-}%
-\edef\XINT_div_BisNegative_b #1%
-{%
- \noexpand\expandafter\space\noexpand\expandafter
- {\noexpand\romannumeral0\noexpand\XINT_opp #1}%
-}%
-% \end{macrocode}
-% \lverb|B = #3#1 > 0, A =-#2< 0|
-% \begin{macrocode}
-\def\XINT_div_AisNegative #1#2#3#4%
-{%
- \expandafter\XINT_div_AisNegative_b
- \romannumeral0\XINT_div_prepare {#3#1}{#2}{#3#1}%
-}%
-\def\XINT_div_AisNegative_b #1#2%
-{%
- \if0\XINT_Sgn #2\Z
- \expandafter \XINT_div_AisNegative_Rzero
- \else
- \expandafter \XINT_div_AisNegative_Rpositive
- \fi
- {#1}{#2}%
-}%
-% \end{macrocode}
-% \lverb|en #3 on a une copie de B (à l'endroit)|
-% \begin{macrocode}
-\edef\XINT_div_AisNegative_Rzero #1#2#3%
-{%
- \noexpand\expandafter\space\noexpand\expandafter
- {\noexpand\romannumeral0\noexpand\XINT_opp #1}{0}%
-}%
-% \end{macrocode}
-% \lverb!#1 = quotient, #2 = reste, #3 = diviseur initial (à l'endroit)
-% remplace Reste par B - Reste, après avoir remplacé Q par -(Q+1)
-% de sorte que la formule a = qb + r, 0<= r < |b| est valable!
-% \begin{macrocode}
-\def\XINT_div_AisNegative_Rpositive #1%
+\def\XINT_iidivision_apos #1#2\Z #3\Z{\XINT_div_prepare {#2}{#1#3}}%
+\def\XINT_iidivision_aneg #1\Z #2\Z
+ {\expandafter
+ \XINT_iidivision_aneg_b\romannumeral0\XINT_div_prepare {#1}{#2}{#1}}%
+\def\XINT_iidivision_aneg_b #1#2{\if0\XINT_Sgn #2\Z
+ \expandafter\XINT_iidivision_aneg_rzero
+ \else
+ \expandafter\XINT_iidivision_aneg_rpos
+ \fi {#1}{#2}}%
+\def\XINT_iidivision_aneg_rzero #1#2#3{ {-#1}{0}}% necessarily q was >0
+\def\XINT_iidivision_aneg_rpos #1%
{%
- \expandafter \XINT_div_AisNegative_Rpositive_b \expandafter
- {\romannumeral0\xintiiopp{\xintInc {#1}}}%
+ \expandafter\XINT_iidivision_aneg_end\expandafter
+ {\expandafter-\romannumeral0\xintinc {#1}}% q-> -(1+q)
}%
-\def\XINT_div_AisNegative_Rpositive_b #1#2#3%
+\def\XINT_iidivision_aneg_end #1#2#3%
{%
- \expandafter \xint_exchangetwo_keepbraces_thenstop \expandafter
- {\romannumeral0\XINT_sub {#3}{#2}}{#1}%
+ \expandafter\xint_exchangetwo_keepbraces_thenstop
+ \expandafter{\romannumeral0\XINT_sub_pre {#3}{#2}}{#1}% r-> b-r
}%
% \end{macrocode}
% \lverb|&
@@ -15997,7 +16401,7 @@ $1$ or $-1$.
}%
\edef\XINT_div_BisTwo_a #1#2%
{%
- \noexpand\expandafter\space\noexpand\expandafter
+ \noexpand\expandafter\space\noexpand\expandafter
{\noexpand\romannumeral0\noexpand\xinthalf {#2}}{#1}%
}%
% \end{macrocode}
@@ -16025,7 +16429,7 @@ $1$ or $-1$.
\def\XINT_div_prepareB_e #1#2#3#4%
{%
\ifnum#3=\xint_c_iv\expandafter\XINT_div_prepareLittleB_f
- \else\expandafter\XINT_div_prepareB_f
+ \else\expandafter\XINT_div_prepareB_f
\fi
#4#1{#3}{#2}{#1}%
}%
@@ -16051,7 +16455,7 @@ $1$ or $-1$.
% #5 = K, #6 = «c», #7= {} ou {0} ou {00} ou {000}, #8 = A initial
% On multiplie aussi A par 10^c. -> AK{x'yx}B«c». Par contre dans le
% cas little on a #1=y=(x/2), #2={}, #3={}, #4=x, donc cela donne
-% ->AK{y{}x}{}«c», il n'y a pas de B.|
+% ->AK{y{}x}{}«c», il n'y a pas de B.|
% \begin{macrocode}
\def\XINT_div_prepareB_g #1.#2.#3.#4#5#6#7#8%
{%
@@ -16087,11 +16491,11 @@ $1$ or $-1$.
\def\XINT_div_prepareA_diii {\XINT_div_prepareA_e {000}}%
% \end{macrocode}
% \lverb|#1#3 = A préparé, #2 = longueur de ce A préparé, #4=K, #5={x'yx}->
-% LKAx'yxB«c»|
+% LKAx'yxB«c»|
% \begin{macrocode}
\def\XINT_div_prepareA_e #1#2#3#4#5%
{%
- \XINT_div_start_a {#2}{#4}{#1#3}#5%
+ \XINT_div_start_a {#2}{#4}{#1#3}#5%
}%
% \end{macrocode}
% \lverb|L, K, A, x',y,x, B, «c» (avec y{}x{} au lieu de x'yxB dans la
@@ -16108,7 +16512,7 @@ $1$ or $-1$.
\fi
\fi
{#1}{#2}%
-}%
+}%
% \end{macrocode}
% \lverb|L, K, A, x',y,x, B, «c».|
% \begin{macrocode}
@@ -16123,7 +16527,7 @@ $1$ or $-1$.
\def\XINT_div_III_b #1%
{%
\if0#1%
- \expandafter\XINT_div_III_bRzero
+ \expandafter\XINT_div_III_bRzero
\else
\expandafter\XINT_div_III_bRpos
\fi
@@ -16134,7 +16538,7 @@ $1$ or $-1$.
\expandafter\space\expandafter
{\romannumeral0\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z}{0}%
}%
-\def\XINT_div_III_bRpos #1.#2#3%
+\def\XINT_div_III_bRpos #1.#2#3%
{%
\expandafter\XINT_div_III_c \XINT_div_cleanR #1#3.{#2}%
}%
@@ -16158,8 +16562,8 @@ $1$ or $-1$.
\ifnum #1=\xint_c_iv\XINT_div_start_ca\fi
\expandafter\XINT_div_start_c\expandafter
{\the\numexpr #1-\xint_c_iv}#2#3#4#5#6.%
-}%
-\def\XINT_div_start_ca\fi\expandafter\XINT_div_start_c\expandafter
+}%
+\def\XINT_div_start_ca\fi\expandafter\XINT_div_start_c\expandafter
#1#2#3#4#5{\fi\XINT_div_start_d {#2#3#4#5}#2#3#4#5}%
% \end{macrocode}
% \lverb|#1=a, #2=alpha (de longueur K, à l'endroit).#3=reste de A.#4=x,
@@ -16172,7 +16576,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|Ceci est le point de retour de la boucle principale. a, x, alpha, B,
-% q0, L, K, {x'y}, x, alpha', BQ«c» |
+% q0, L, K, {x'y}, x, alpha', BQ«c» |
% \begin{macrocode}
\def\XINT_div_I_a #1#2%
{%
@@ -16184,7 +16588,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|On intercepte quotient nul: #1=a, x, alpha, B, #5=q0, L, K, {x'y}, x,
-% alpha', BQ«c» -> q{alpha} L, K, {x'y}, x, alpha', BQ«c»|
+% alpha', BQ«c» -> q{alpha} L, K, {x'y}, x, alpha', BQ«c»|
% \begin{macrocode}
\def\XINT_div_I_czero 0%
\XINT_div_I_c 0.#1#2#3#4#5{\XINT_div_I_g {#5}{#3}}%
@@ -16204,7 +16608,7 @@ $1$ or $-1$.
\expandafter\expandafter\expandafter\XINT_div_I_dN
\else
\expandafter\expandafter\expandafter\XINT_div_I_db
- \fi
+ \fi
\fi
}%
\def\XINT_div_I_dN #1.%
@@ -16212,7 +16616,7 @@ $1$ or $-1$.
\expandafter\XINT_div_I_dP\the\numexpr #1-\xint_c_i.%
}%
\def\XINT_div_I_db #1.#2#3% #1=q=un chiffre, #2=alpha, #3=B
-{%
+{%
\expandafter\XINT_div_I_dc\expandafter
{\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
{\romannumeral0\xintreverseorder{#2}}%
@@ -16221,7 +16625,7 @@ $1$ or $-1$.
}%
\def\XINT_div_I_dc #1#2%
{%
- \if-#1% s'arranger pour que si négatif on ait renvoyé alpha=-.
+ \if-#1% s'arranger pour que si n\'egatif on ait renvoy\'e alpha=-.
\expandafter\xint_firstoftwo
\else\expandafter\xint_secondoftwo\fi
{\expandafter\XINT_div_I_dP\the\numexpr #2-\xint_c_i.}%
@@ -16229,7 +16633,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|alpha,q,ancien alpha,B, q0->1nouveauq.alpha, L, K, {x'y},x, alpha',
-% BQ«c»|
+% BQ«c»|
% \begin{macrocode}
\def\XINT_div_I_e #1#2#3#4#5%
{%
@@ -16247,7 +16651,7 @@ $1$ or $-1$.
{\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}%
}%
% \end{macrocode}
-% \lverb|1#1#2#3#4=nouveau q, nouvel alpha, L, K, {x'y},x,alpha', BQ«c»|
+% \lverb|1#1#2#3#4=nouveau q, nouvel alpha, L, K, {x'y},x,alpha', BQ«c»|
% \begin{macrocode}
\def\XINT_div_I_f 1#1#2#3#4{\XINT_div_I_g {#1#2#3#4}}%
% \end{macrocode}
@@ -16303,7 +16707,7 @@ $1$ or $-1$.
\def\XINT_div_II_skipc 0000\XINT_div_II_c #1#2#3#4#5.#6#7%
{%
\XINT_div_II_k #7{#4#5}{#6}{0000}%
-}%
+}%
% \end{macrocode}
% \lverb|x'ya->1qx'yalpha.B, {{x'y},x,K,L}, nouveau alpha',B, Q«c»|
% \begin{macrocode}
@@ -16319,14 +16723,14 @@ $1$ or $-1$.
% \begin{macrocode}
\def\XINT_div_II_d 1#1#2#3#4#5#6#7.#8%
{%
- \expandafter\XINT_div_II_e
+ \expandafter\XINT_div_II_e
\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
{\romannumeral0\xintreverseorder{#7}}%
{\romannumeral0\XINT_mul_Mr {#1#2#3#4}#8\Z\Z\Z\Z }.%
{#5}{#6}{#8}{#1#2#3#4}%
}%
% \end{macrocode}
-% \lverb|alpha.x',y,B,q1, {{x'y},x,K,L}, alpha', B, Q«c»|
+% \lverb|alpha.x',y,B,q1, {{x'y},x,K,L}, alpha', B, Q«c»|
% \begin{macrocode}
\def\XINT_div_II_e #1#2#3#4%
{%
@@ -16348,7 +16752,7 @@ $1$ or $-1$.
% \begin{macrocode}
\def\XINT_div_II_f #1#2#3#4#5#6#7#8#9.%
{%
- \XINT_div_II_fa {#1#2#3#4#5#6#7#8}{#1#2#3#4#5#6#7#8#9}%
+ \XINT_div_II_fa {#1#2#3#4#5#6#7#8}{#1#2#3#4#5#6#7#8#9}%
}%
\def\XINT_div_II_fa #1#2#3#4%
{%
@@ -16356,13 +16760,13 @@ $1$ or $-1$.
{\the\numexpr (#1+#4)/#3-\xint_c_i}{#2}%
}%
% \end{macrocode}
-% \lverb|#1=q, #2=alpha (K+4), #3=B, #4=q1, {{x'y},x,K,L}, alpha', BQ«c»
+% \lverb|#1=q, #2=alpha (K+4), #3=B, #4=q1, {{x'y},x,K,L}, alpha', BQ«c»
% -> 1 puis nouveau q sur 4 chiffres, nouvel alpha sur K chiffres,
% B, {{x'y},x,K,L}, alpha',BQ«c» |
% \begin{macrocode}
\def\XINT_div_II_g #1#2#3#4%
{%
- \expandafter \XINT_div_II_h
+ \expandafter \XINT_div_II_h
\the\numexpr #4+#1+\xint_c_x^iv\expandafter\expandafter\expandafter
{\expandafter\xint_gobble_iv
\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
@@ -16371,7 +16775,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|1 puis nouveau q sur 4 chiffres, #5=nouvel alpha sur K chiffres,
-% #6=B, #7={{x'y},x,K,L} avec L à ajuster, alpha', BQ«c»
+% #6=B, #7={{x'y},x,K,L} avec L à ajuster, alpha', BQ«c»
% -> {x'y}x,K,L à diminuer de 4, {alpha}B{q}, alpha', BQ«c»|
% \begin{macrocode}
\def\XINT_div_II_h 1#1#2#3#4#5#6#7%
@@ -16381,7 +16785,7 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|{x'y}x,K,L à diminuer de 4, alpha, B{q}alpha',BQ«c»
% ->nouveau L.K,x',y,x,alpha.B,q,alpha',B,Q«c»
-% ->{LK{x'y}x},x,a,alpha.B,q,alpha',B,Q«c»|
+% ->{LK{x'y}x},x,a,alpha.B,q,alpha',B,Q«c»|
% \begin{macrocode}
\def\XINT_div_II_k #1#2#3#4#5%
{%
@@ -16393,7 +16797,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|{LK{x'y}x},x,a,alpha.B{q}alpha'BQ -> a, x, alpha, B, q,
-% L, K, {x'y}, x, alpha', BQ«c» |
+% L, K, {x'y}, x, alpha', BQ«c» |
% \begin{macrocode}
\def\XINT_div_II_m #1#2#3#4.#5#6%
{%
@@ -16433,10 +16837,10 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|On intercepte quotient nul: [est-ce vraiment utile? ou n'est-ce pas
% plutôt une perte de temps en moyenne? il faudrait tester] q=0#1=a,
-% #2=y, x, L, alpha', «c» ->
+% #2=y, x, L, alpha', «c» ->
% II_a avec L{alpha}alpha'.{yx}{0000}«c». Et en cas de quotient non nul on
% procède avec littleI_c avec #1=q, #2=a, #3=y, #4=x -> {nouvel alpha sur 4
-% chiffres}q{yx},L,alpha',«c».|
+% chiffres}q{yx},L,alpha',«c».|
% \begin{macrocode}
\def\XINT_div_littleI_b #1%
{%
@@ -16452,7 +16856,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|#1=nouvel alpha sur 4 chiffres#2=q,#3={yx}, #4=L, #5=alpha',«c» ->
-% L{alpha}alpha'.{yx}{000q}«c» point d'entrée de la boucle principale|
+% L{alpha}alpha'.{yx}{000q}«c» point d'entrée de la boucle principale|
% \begin{macrocode}
\def\XINT_div_littleI_e #1#2#3#4#5%
{\XINT_div_littleII_a {#4}{#1}#5.{#3}{000#2}}%
@@ -16471,7 +16875,7 @@ $1$ or $-1$.
% \lverb|L{alpha}alpha'.{yx}Q«c» -> (en fait #3 est vide normalement ici) R
% sans leading zeros.Q«c»|
% \begin{macrocode}
-\def\XINT_div_littleIII_ab #1#2#3.#4%
+\def\XINT_div_littleIII_ab #1#2#3.#4%
{%
\expandafter\XINT_div_III_b\the\numexpr #2#3.%
}%
@@ -16510,7 +16914,7 @@ $1$ or $-1$.
{#1}{{#3}{#4}}%
}%
% \end{macrocode}
-% \lverb|alpha.q,{yx},L,alpha',Q«c»->L{alpha}alpha'.{yx}{Qq}«c»|
+% \lverb|alpha.q,{yx},L,alpha',Q«c»->L{alpha}alpha'.{yx}{Qq}«c»|
% \begin{macrocode}
\def\XINT_div_littleII_f #1.#2#3#4#5#6%
{%
@@ -16540,7 +16944,7 @@ $1$ or $-1$.
% ont toujours quasiment la même longueur on ne s'embarrasse pas de
% complications pour la fin.|
% \begin{macrocode}
-\def\XINT_div_sub_xpxp #1#2% #1=alpha déjà renversé, #2 se développe en qB
+\def\XINT_div_sub_xpxp #1#2% #1=alpha d\'ej\`a renvers\'e, #2 se d\'eveloppe en qB
{%
\expandafter\XINT_div_sub_xpxp_b #2\W\X\Y\Z #1\W\X\Y\Z
}%
@@ -16548,15 +16952,15 @@ $1$ or $-1$.
{%
\XINT_div_sub_A 1{}%
}%
-\def\XINT_div_sub_A #1#2#3#4#5#6%
+\def\XINT_div_sub_A #1#2#3#4#5#6%
{%
\xint_gob_til_W #3\xint_div_sub_az\W
- \XINT_div_sub_B #1{#3#4#5#6}{#2}%
+ \XINT_div_sub_B #1{#3#4#5#6}{#2}%
}%
-\def\XINT_div_sub_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
+\def\XINT_div_sub_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
{%
\xint_gob_til_W #5\xint_div_sub_bz\W
- \XINT_div_sub_onestep #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+ \XINT_div_sub_onestep #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
}%
\def\XINT_div_sub_onestep #1#2#3#4#5#6%
{%
@@ -16600,21 +17004,1288 @@ $1$ or $-1$.
\if#10% retenue
\expandafter\xint_div_sub_neg
\else\expandafter\xint_div_sub_ok
- \fi
+ \fi
}%
\def\xint_div_sub_neg #1{ -}%
\def\xint_div_sub_ok #1{ #1}%
% \end{macrocode}
+% \subsection{\csh{xintiDivRound}, \csh{xintiiDivRound}}
+% \lverb|v1.1, transferred from first release of bnumexpr.|
+% \begin{macrocode}
+\def\xintiDivRound {\romannumeral0\xintidivround }%
+\def\xintidivround #1{\expandafter\XINT_iidivround\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiDivRound {\romannumeral0\xintiidivround }%
+\def\xintiidivround #1{\expandafter\XINT_iidivround \romannumeral-`0#1\Z }%
+\def\XINT_iidivround #1#2\Z #3{\expandafter\XINT_iidivround_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivround_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iidivround_bneg #1}\fi
+ \xint_orthat{\XINT_iidivround_bpos #1#2}%
+}%
+\def\XINT_iidivround_divbyzero #1\Z #2\Z {\xintError:DivisionByZero\space 0}%
+\def\XINT_iidivround_aiszero #1\Z #2\Z { 0}%
+\def\XINT_iidivround_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iidivround_pos {}}%
+ -{\XINT_iidivround_pos #1}%
+ \krof
+}%
+\def\XINT_iidivround_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\XINT_iidivround_pos {}}%
+ -{\xintiiopp\XINT_iidivround_pos #1}%
+ \krof
+}%
+\def\XINT_iidivround_pos #1#2\Z #3\Z{\expandafter\XINT_iidivround_pos_a
+ \romannumeral0\XINT_div_prepare {#2}{#1#30}}%
+\def\XINT_iidivround_pos_a #1#2{\xintReverseOrder {#1\XINT_iidivround_pos_b}\Z }%
+\def\XINT_iidivround_pos_b #1#2{\xint_gob_til_Z #2\XINT_iidivround_pos_small\Z
+ \XINT_iidivround_pos_c #1#2}%
+\def\XINT_iidivround_pos_c #1#2\Z {\ifnum #1>\xint_c_iv
+ \expandafter\XINT_iidivround_pos_up
+ \else \expandafter\xintreverseorder
+ \fi {#2}}%
+\def\XINT_iidivround_pos_up #1{\xintinc {\xintReverseOrder{#1}}}%
+\def\XINT_iidivround_pos_small\Z\XINT_iidivround_pos_c #1#2%
+ {\ifnum #1>\xint_c_iv\expandafter\xint_secondoftwo\else\expandafter
+ \xint_firstoftwo\fi { 0}{ 1}}%
+% \end{macrocode}
+% \subsection{\csh{xintiDivTrunc}, \csh{xintiiDivTrunc}}
+% \begin{macrocode}
+\def\xintiDivTrunc {\romannumeral0\xintidivtrunc }%
+\def\xintidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiDivTrunc {\romannumeral0\xintiidivtrunc }%
+\def\xintiidivtrunc #1{\expandafter\XINT_iidivtrunc \romannumeral-`0#1\Z }%
+\def\XINT_iidivtrunc #1#2\Z #3{\expandafter\XINT_iidivtrunc_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivtrunc_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iidivtrunc_bneg #1}\fi
+ \xint_orthat{\XINT_iidivtrunc_bpos #1#2}%
+}%
+\def\XINT_iidivtrunc_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iidivtrunc_pos {}}%
+ -{\XINT_iidivtrunc_pos #1}%
+ \krof
+}%
+\def\XINT_iidivtrunc_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\XINT_iidivtrunc_pos {}}%
+ -{\xintiiopp\XINT_iidivtrunc_pos #1}%
+ \krof
+}%
+\def\XINT_iidivtrunc_pos #1#2\Z #3\Z%
+ {\expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_div_prepare {#2}{#1#3}}%
+% \end{macrocode}
+% \subsection{\csh{xintiMod}, csh{xintiiMod}}
+% \begin{macrocode}
+\def\xintiMod {\romannumeral0\xintimod }%
+\def\xintimod #1{\expandafter\XINT_iimod\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiMod {\romannumeral0\xintiimod }%
+\def\xintiimod #1{\expandafter\XINT_iimod \romannumeral-`0#1\Z }%
+\def\XINT_iimod #1#2\Z #3{\expandafter\XINT_iimod_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iimod_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iimod_bneg #1}\fi
+ \xint_orthat{\XINT_iimod_bpos #1#2}%
+}%
+\def\XINT_iimod_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iimod_pos {}}%
+ -{\XINT_iimod_pos #1}%
+ \krof
+}%
+\def\XINT_iimod_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iimod_pos {}}%
+ -{\XINT_iimod_pos #1}%
+ \krof
+}%
+\def\XINT_iimod_pos #1#2\Z #3\Z%
+ {\expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_div_prepare {#2}{#1#3}}%
+% \end{macrocode}
+% \subsection{\csh{xintDec}}
+% \lverb!v1.08!
+% \begin{macrocode}
+\def\xintDec {\romannumeral0\xintdec }%
+\def\xintdec #1%
+{%
+ \expandafter\XINT_dec\romannumeral-`0#1%
+ \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
+}%
+\def\XINT_dec #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_dec_zero
+ 0#1\XINT_dec_neg
+ 0-{\XINT_dec_pos #1}%
+ \krof
+}%
+\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
+\def\XINT_dec_neg
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_inc_pos }%
+\def\XINT_dec_pos
+{%
+ \expandafter\XINT_dec_a \expandafter{\expandafter}%
+ \romannumeral0\XINT_OQ {}%
+}%
+\def\XINT_dec_a #1#2#3#4#5#6#7#8#9%
+{%
+ \expandafter\XINT_dec_b
+ \the\numexpr 11#9#8#7#6#5#4#3#2-\xint_c_i\relax {#1}%
+}%
+\def\XINT_dec_b 1#1%
+{%
+ \xint_gob_til_one #1\XINT_dec_A 1\XINT_dec_c
+}%
+\def\XINT_dec_c #1#2#3#4#5#6#7#8#9{\XINT_dec_a {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_dec_A 1\XINT_dec_c #1#2#3#4#5#6#7#8#9%
+ {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_dec_B #1#2\W\W\W\W\W\W\W\W
+{%
+ \expandafter\XINT_dec_cleanup
+ \romannumeral0\XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1%
+}%
+\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
+% \end{macrocode}
+% \subsection{\csh{xintInc}}
+% \lverb!v1.08!
+% \begin{macrocode}
+\def\xintInc {\romannumeral0\xintinc }%
+\def\xintinc #1%
+{%
+ \expandafter\XINT_inc\romannumeral-`0#1%
+ \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
+}%
+\def\XINT_inc #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_inc_zero
+ 0#1\XINT_inc_neg
+ 0-{\XINT_inc_pos #1}%
+ \krof
+}%
+\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
+\def\XINT_inc_neg {\expandafter\XINT_opp\romannumeral0\XINT_dec_pos }%
+\def\XINT_inc_pos
+{%
+ \expandafter\XINT_inc_a \expandafter{\expandafter}%
+ \romannumeral0\XINT_OQ {}%
+}%
+\def\XINT_inc_a #1#2#3#4#5#6#7#8#9%
+{%
+ \xint_gob_til_W #9\XINT_inc_end\W
+ \expandafter\XINT_inc_b
+ \the\numexpr 10#9#8#7#6#5#4#3#2+\xint_c_i\relax {#1}%
+}%
+\def\XINT_inc_b 1#1%
+{%
+ \xint_gob_til_zero #1\XINT_inc_A 0\XINT_inc_c
+}%
+\def\XINT_inc_c #1#2#3#4#5#6#7#8#9{\XINT_inc_a {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_inc_A 0\XINT_inc_c #1#2#3#4#5#6#7#8#9%
+ {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_inc_end\W #1\relax #2{ 1#2}%
+\XINT_restorecatcodes_endinput%
+% \end{macrocode}
+%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
+%\let</xintcore>\relax
+%\def<*xint>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
+%</xintcore>
+%<*xint>
+% \StoreCodelineNo {xintcore}
+%
+% \section{Package \xintnameimp implementation}
+% \label{sec:xintimp}
+%
+% \localtableofcontents
+%
+% The basic arithmetic routines |\xintiiAdd|, |\xintiiSub|,
+% |\xintiiMul|, |\xintiiQuo| and |\xintiiPow| have been moved to new
+% package \xintcorenameimp.
+% \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xint.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xint}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \ifx\x\relax % plain-TeX, first loading of xintcore.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
+ \fi
+ \else
+ \def\empty {}%
+ \ifx\x\empty % LaTeX, first loading,
+ % variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
+ \fi
+ \else
+ \aftergroup\endinput % xint already loaded.
+ \fi
+ \fi
+ \fi
+\z%
+\XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty)
+% \end{macrocode}
+% \subsection{Package identification}
+% \begin{macrocode}
+\XINT_providespackage
+\ProvidesPackage{xint}%
+ [2014/10/28 v1.1 Expandable operations on big integers (jfB)]%
+% \end{macrocode}
+% \subsection{More token management}
+% \begin{macrocode}
+\long\def\xint_firstofthree #1#2#3{#1}%
+\long\def\xint_secondofthree #1#2#3{#2}%
+\long\def\xint_thirdofthree #1#2#3{#3}%
+\long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i
+\long\def\xint_secondofthree_thenstop #1#2#3{ #2}%
+\long\def\xint_thirdofthree_thenstop #1#2#3{ #3}%
+% \end{macrocode}
+% \subsection{\csh{xintSgnFork}}
+% \lverb|Expandable three-way fork added in 1.07. The argument #1 must expand
+% to -1,0 or 1. 1.09i has _afterstop, renamed _thenstop later, for efficiency.|
+% \begin{macrocode}
+\def\xintSgnFork {\romannumeral0\xintsgnfork }%
+\def\xintsgnfork #1%
+{%
+ \ifcase #1 \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintIsOne}}
+% \lverb|&
+% Added in 1.03. Attention: \XINT_isOne does not do any expansion. Release 1.09a
+% defines \xintIsOne which is more user-friendly. Will be modified if xintfrac
+% is loaded. |
+% \begin{macrocode}
+\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
+\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
+\def\XINT_isone #1#2%
+{%
+ \xint_gob_til_one #1\XINT_isone_b 1%
+ \expandafter\space\expandafter 0\xint_gob_til_Z #2%
+}%
+\def\XINT_isone_b #1\xint_gob_til_Z #2%
+{%
+ \xint_gob_til_W #2\XINT_isone_yes \W
+ \expandafter\space\expandafter 0\xint_gob_til_Z
+}%
+\def\XINT_isone_yes #1\Z { 1}%
+% \end{macrocode}
+% \subsection{\csh{XINT_SQ}}
+% \begin{macrocode}
+\def\XINT_SQ #1#2#3#4#5#6#7#8%
+{%
+ \xint_gob_til_R #8\XINT_SQ_end_a\R\XINT_SQ {#8#7#6#5#4#3#2#1}%
+}%
+\def\XINT_SQ_end_a\R\XINT_SQ #1#2\Z
+{%
+ \XINT_SQ_end_b #1\Z
+}%
+\def\XINT_SQ_end_b #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_R
+ #7\XINT_SQ_end_vii
+ #6\XINT_SQ_end_vi
+ #5\XINT_SQ_end_v
+ #4\XINT_SQ_end_iv
+ #3\XINT_SQ_end_iii
+ #2\XINT_SQ_end_ii
+ \R\XINT_SQ_end_i
+ \Z #2#3#4#5#6#7%
+}%
+\def\XINT_SQ_end_vii #1\Z #2#3#4#5#6#7#8\Z { #8}%
+\def\XINT_SQ_end_vi #1\Z #2#3#4#5#6#7#8\Z { #7#8000000}%
+\def\XINT_SQ_end_v #1\Z #2#3#4#5#6#7#8\Z { #6#7#800000}%
+\def\XINT_SQ_end_iv #1\Z #2#3#4#5#6#7#8\Z { #5#6#7#80000}%
+\def\XINT_SQ_end_iii #1\Z #2#3#4#5#6#7#8\Z { #4#5#6#7#8000}%
+\def\XINT_SQ_end_ii #1\Z #2#3#4#5#6#7#8\Z { #3#4#5#6#7#800}%
+\def\XINT_SQ_end_i \Z #1#2#3#4#5#6#7\Z { #1#2#3#4#5#6#70}%
+% \end{macrocode}
+% \subsection{\csh{xintRev}}
+% \lverb|&
+% \xintRev: expands fully its argument \romannumeral-`0, and checks the sign.
+% However this last aspect does not appear like a very useful thing. And despite
+% the fact that a special check is made for a sign, actually the input is not
+% given to \xintnum, contrarily to \xintLen. This is all a bit incoherent.
+% Should be fixed.|
+% \begin{macrocode}
+\def\xintRev {\romannumeral0\xintrev }%
+\def\xintrev #1%
+{%
+ \expandafter\XINT_rev_fork
+ \romannumeral-`0#1\xint_relax % empty #1 ok, \xint_relax stops expansion
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+}%
+\def\XINT_rev_fork #1%
+{%
+ \xint_UDsignfork
+ #1{\expandafter\xint_minus_thenstop\romannumeral0\XINT_rord_main {}}%
+ -{\XINT_rord_main {}#1}%
+ \krof
+}%
+% \end{macrocode}
+% \subsection{\csh{xintLen}}
+% \lverb|\xintLen is ONLY for (possibly long) integers. Gets extended to
+% fractions by xintfrac.sty|
+% \begin{macrocode}
+\def\xintLen {\romannumeral0\xintlen }%
+\def\xintlen #1%
+{%
+ \expandafter\XINT_len_fork
+ \romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+}%
+\def\XINT_Len #1% variant which does not expand via \xintnum.
+{%
+ \romannumeral0\XINT_len_fork
+ #1\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+}%
+\def\XINT_len_fork #1%
+{%
+ \expandafter\XINT_length_loop
+ \xint_UDsignfork
+ #1{0.}%
+ -{0.#1}%
+ \krof
+}%
+% \end{macrocode}
+% \subsection{\csh{xintBool}, \csh{xintToggle}}
+% \lverb|1.09c|
+% \begin{macrocode}
+\def\xintBool #1{\romannumeral-`0%
+ \csname if#1\endcsname\expandafter1\else\expandafter0\fi }%
+\def\xintToggle #1{\romannumeral-`0\iftoggle{#1}{1}{0}}%
+% \end{macrocode}
+% \subsection{\csh{xintifSgn}}
+% \lverb|Expandable three-way fork added in 1.09a. Branches expandably
+% depending on whether <0, =0, >0. Choice of branch guaranteed in two steps.
+%
+% 1.09i has \xint_firstofthreeafterstop (now _thenstop) etc for faster
+% expansion.
+%
+% 1.1 adds \xintiiifSgn for optimization in xintexpr-essions. Should I move
+% them to xintcore? (for bnumexpr)|
+% \begin{macrocode}
+\def\xintifSgn {\romannumeral0\xintifsgn }%
+\def\xintifsgn #1%
+{%
+ \ifcase \xintSgn{#1}
+ \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
+}%
+\def\xintiiifSgn {\romannumeral0\xintiiifsgn }%
+\def\xintiiifsgn #1%
+{%
+ \ifcase \xintiiSgn{#1}
+ \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifZero}, \csh{xintifNotZero}}
+% \lverb|&
+% Expandable two-way fork added in 1.09a. Branches expandably depending on
+% whether the argument is zero (branch A) or not (branch B). 1.09i restyling. By
+% the way it appears (not thoroughly tested, though) that \if tests are faster
+% than \ifnum tests. |
+% \begin{macrocode}
+\def\xintifZero {\romannumeral0\xintifzero }%
+\def\xintifzero #1%
+{%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+\def\xintifNotZero {\romannumeral0\xintifnotzero }%
+\def\xintifnotzero #1%
+{%
+ \if0\xintSgn{#1}%
+ \expandafter\xint_secondoftwo_thenstop
+ \else
+ \expandafter\xint_firstoftwo_thenstop
+ \fi
+}%
+\def\xintiiifZero {\romannumeral0\xintiiifzero }%
+\def\xintiiifzero #1%
+{%
+ \if0\xintiiSgn{#1}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }%
+\def\xintiiifnotzero #1%
+{%
+ \if0\xintiiSgn{#1}%
+ \expandafter\xint_secondoftwo_thenstop
+ \else
+ \expandafter\xint_firstoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifOne}}
+% \lverb|added in 1.09i.|
+% \begin{macrocode}
+\def\xintifOne {\romannumeral0\xintifone }%
+\def\xintifone #1%
+{%
+ \if1\xintIsOne{#1}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifTrueAelseB}, \csh{xintifFalseAelseB}}
+% \lverb|1.09i. Warning, \xintifTrueFalse, \xintifTrue deprecated, to be
+% removed|
+% \begin{macrocode}
+\let\xintifTrueAelseB\xintifNotZero
+\let\xintifFalseAelseB\xintifZero
+\let\xintifTrue\xintifNotZero
+\let\xintifTrueFalse\xintifNotZero
+% \end{macrocode}
+% \subsection{\csh{xintifCmp}}
+% \lverb|&
+% 1.09e
+% \xintifCmp {n}{m}{if n<m}{if n=m}{if n>m}.|
+% \begin{macrocode}
+\def\xintifCmp {\romannumeral0\xintifcmp }%
+\def\xintifcmp #1#2%
+{%
+ \ifcase\xintCmp {#1}{#2}
+ \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifEq}}
+% \lverb|&
+% 1.09a
+% \xintifEq {n}{m}{YES if n=m}{NO if n<>m}.|
+% \begin{macrocode}
+\def\xintifEq {\romannumeral0\xintifeq }%
+\def\xintifeq #1#2%
+{%
+ \if0\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else\expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifGt}}
+% \lverb|&
+% 1.09a \xintifGt {n}{m}{YES if n>m}{NO if n<=m}.|
+% \begin{macrocode}
+\def\xintifGt {\romannumeral0\xintifgt }%
+\def\xintifgt #1#2%
+{%
+ \if1\xintCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else\expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifLt}}
+% \lverb|&
+% 1.09a \xintifLt {n}{m}{YES if n<m}{NO if n>=m}. Restyled in 1.09i|
+% \begin{macrocode}
+\def\xintifLt {\romannumeral0\xintiflt }%
+\def\xintiflt #1#2%
+{%
+ \ifnum\xintCmp{#1}{#2}<\xint_c_
+ \expandafter\xint_firstoftwo_thenstop
+ \else \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintifOdd}}
+% \lverb|1.09e. Restyled in 1.09i.|
+% \begin{macrocode}
+\def\xintifOdd {\romannumeral0\xintifodd }%
+\def\xintifodd #1%
+{%
+ \if\xintOdd{#1}1%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintCmp}}
+% \lverb|Release 1.09a has \xintnum inserted into \xintCmp. Unnecessary
+% \xintiCmp suppressed in 1.09f.|
+% \begin{macrocode}
+\def\xintCmp {\romannumeral0\xintcmp }%
+\def\xintcmp #1%
+{%
+ \expandafter\xint_cmp\expandafter{\romannumeral0\xintnum{#1}}%
+}%
+\def\xint_cmp #1#2%
+{%
+ \expandafter\XINT_cmp_fork \romannumeral0\xintnum{#2}\Z #1\Z
+}%
+\def\XINT_Cmp #1#2{\romannumeral0\XINT_cmp_fork #2\Z #1\Z }%
+% \end{macrocode}
+% \lverb|&
+% COMPARAISON $\
+% 1 si #3#4>#1#2, 0 si #3#4=#1#2, -1 si #3#4<#1#2$\
+% #3#4 vient du *premier*,$
+% #1#2 vient du *second*|
+% \begin{macrocode}
+\def\XINT_cmp_fork #1#2\Z #3#4\Z
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_cmp_minusminus
+ #1-\XINT_cmp_minusplus
+ #3-\XINT_cmp_plusminus
+ --{\xint_UDzerosfork
+ #1#3\XINT_cmp_zerozero
+ #10\XINT_cmp_zeroplus
+ #30\XINT_cmp_pluszero
+ 00\XINT_cmp_plusplus
+ \krof }%
+ \krof
+ {#2}{#4}#1#3%
+}%
+\def\XINT_cmp_minusplus #1#2#3#4{ 1}%
+\def\XINT_cmp_plusminus #1#2#3#4{ -1}%
+\def\XINT_cmp_zerozero #1#2#3#4{ 0}%
+\def\XINT_cmp_zeroplus #1#2#3#4{ 1}%
+\def\XINT_cmp_pluszero #1#2#3#4{ -1}%
+\def\XINT_cmp_plusplus #1#2#3#4%
+{%
+ \XINT_cmp_pre {#4#2}{#3#1}%
+}%
+\def\XINT_cmp_minusminus #1#2#3#4%
+{%
+ \XINT_cmp_pre {#1}{#2}%
+}%
+\def\XINT_cmp_pre #1%
+{%
+ \expandafter\XINT_cmp_pre_b\expandafter
+ {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
+}%
+\def\XINT_cmp_pre_b #1#2%
+{%
+ \expandafter\XINT_cmp_A
+ \expandafter1\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #1\W\X\Y\Z
+}%
+% \end{macrocode}
+% \lverb|&
+% COMPARAISON$\
+% N1 et N2 sont présentés à l'envers ET ON A RAJOUTÉ DES ZÉROS
+% POUR QUE LEUR LONGUEURS À CHACUN SOIENT MULTIPLES DE 4, MAIS
+% AUCUN NE SE TERMINE EN 0000.
+% routine appelée via$\
+% \XINT_cmp_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
+% ATTENTION RENVOIE 1 SI N1 < N2, 0 si N1 = N2, -1 si N1 > N2|
+% \begin{macrocode}
+\def\XINT_cmp_A #1#2#3\W\X\Y\Z #4#5#6#7%
+{%
+ \xint_gob_til_W #4\xint_cmp_az\W
+ \XINT_cmp_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
+}%
+\def\XINT_cmp_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W#4\xint_cmp_bz\W
+ \XINT_cmp_onestep #1#2{#7#6#5#4}{#3}%
+}%
+\def\XINT_cmp_onestep #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_cmp_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
+}%
+\def\XINT_cmp_backtoA #1#2#3.#4%
+{%
+ \XINT_cmp_A #2{#3#4}%
+}%
+\def\xint_cmp_bz\W\XINT_cmp_onestep #1\Z { 1}%
+\def\xint_cmp_az\W\XINT_cmp_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W #4\xint_cmp_ez\W
+ \XINT_cmp_Eenter #1{#3}#4#5#6#7%
+}%
+\def\XINT_cmp_Eenter #1\Z { -1}%
+\def\xint_cmp_ez\W\XINT_cmp_Eenter #1%
+{%
+ \xint_UDzerofork
+ #1\XINT_cmp_K % il y a une retenue
+ 0\XINT_cmp_L % pas de retenue
+ \krof
+}%
+\def\XINT_cmp_K #1\Z { -1}%
+\def\XINT_cmp_L #1{\XINT_OneIfPositive_main #1}%
+\def\XINT_OneIfPositive #1%
+{%
+ \XINT_OneIfPositive_main #1\W\X\Y\Z%
+}%
+\def\XINT_OneIfPositive_main #1#2#3#4%
+{%
+ \xint_gob_til_Z #4\xint_OneIfPositive_terminated\Z
+ \XINT_OneIfPositive_onestep #1#2#3#4%
+}%
+\def\xint_OneIfPositive_terminated\Z\XINT_OneIfPositive_onestep\W\X\Y\Z { 0}%
+\def\XINT_OneIfPositive_onestep #1#2#3#4%
+{%
+ \expandafter\XINT_OneIfPositive_check\the\numexpr #1#2#3#4\relax
+}%
+\def\XINT_OneIfPositive_check #1%
+{%
+ \xint_gob_til_zero #1\xint_OneIfPositive_backtomain 0%
+ \XINT_OneIfPositive_finish #1%
+}%
+\def\XINT_OneIfPositive_finish #1\W\X\Y\Z{ 1}%
+\def\xint_OneIfPositive_backtomain 0\XINT_OneIfPositive_finish 0%
+ {\XINT_OneIfPositive_main }%
+% \end{macrocode}
+% \subsection{\csh{xintEq}, \csh{xintGt}, \csh{xintLt}}
+% \lverb|1.09a.|
+% \begin{macrocode}
+\def\xintEq {\romannumeral0\xinteq }%
+\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}%
+\def\xintGt {\romannumeral0\xintgt }%
+\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}%
+\def\xintLt {\romannumeral0\xintlt }%
+\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
+% \end{macrocode}
+% \subsection{\csh{xintNEq}, \csh{xintGtorEq}, \csh{xintLtorEq}}
+% \lverb|1.1. Pour xintexpr|
+% \begin{macrocode}
+\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}%
+\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}%
+\def\xintNeq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}%
+% \end{macrocode}
+% \subsection{\csh{xintIsZero}, \csh{xintIsNotZero}}
+% \lverb|1.09a. restyled in 1.09i. 1.1 adds \xintiiIsZero, etc... for
+% optimization in \xintexpr|
+% \begin{macrocode}
+\def\xintIsZero {\romannumeral0\xintiszero }%
+\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
+\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
+\def\xintisnotzero
+ #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
+\def\xintiiIsZero {\romannumeral0\xintiiiszero }%
+\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
+\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }%
+\def\xintiiisnotzero
+ #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
+% \end{macrocode}
+% \subsection{\csh{xintIsTrue}, \csh{xintNot}, \csh{xintIsFalse}}
+% \lverb|1.09c|
+% \begin{macrocode}
+\let\xintIsTrue\xintIsNotZero
+\let\xintNot\xintIsZero
+\let\xintIsFalse\xintIsZero
+% \end{macrocode}
+% \subsection{\csh{xintAND}, \csh{xintOR}, \csh{xintXOR}}
+% \lverb|1.09a. Embarrasing bugs in \xintAND and \xintOR which inserted a space
+% token corrected in 1.09i. \xintxor restyled with \if (faster) in 1.09i|
+% \begin{macrocode}
+\def\xintAND {\romannumeral0\xintand }%
+\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ { 0}{\xintisnotzero{#2}}}%
+\def\xintOR {\romannumeral0\xintor }%
+\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ {\xintisnotzero{#2}}{ 1}}%
+\def\xintXOR {\romannumeral0\xintxor }%
+\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}%
+ \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }%
+% \end{macrocode}
+% \subsection{\csh{xintANDof}}
+% \lverb|New with 1.09a. \xintANDof works also with an empty list.|
+% \begin{macrocode}
+\def\xintANDof {\romannumeral0\xintandof }%
+\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral-`0#1\relax }%
+\def\XINT_andof_a #1{\expandafter\XINT_andof_b\romannumeral-`0#1\Z }%
+\def\XINT_andof_b #1%
+ {\xint_gob_til_relax #1\XINT_andof_e\relax\XINT_andof_c #1}%
+\def\XINT_andof_c #1\Z
+ {\xintifTrueAelseB {#1}{\XINT_andof_a}{\XINT_andof_no}}%
+\def\XINT_andof_no #1\relax { 0}%
+\def\XINT_andof_e #1\Z { 1}%
+% \end{macrocode}
+% \subsection{\csh{xintORof}}
+% \lverb|New with 1.09a. Works also with an empty list.|
+% \begin{macrocode}
+\def\xintORof {\romannumeral0\xintorof }%
+\def\xintorof #1{\expandafter\XINT_orof_a\romannumeral-`0#1\relax }%
+\def\XINT_orof_a #1{\expandafter\XINT_orof_b\romannumeral-`0#1\Z }%
+\def\XINT_orof_b #1%
+ {\xint_gob_til_relax #1\XINT_orof_e\relax\XINT_orof_c #1}%
+\def\XINT_orof_c #1\Z
+ {\xintifTrueAelseB {#1}{\XINT_orof_yes}{\XINT_orof_a}}%
+\def\XINT_orof_yes #1\relax { 1}%
+\def\XINT_orof_e #1\Z { 0}%
+% \end{macrocode}
+% \subsection{\csh{xintXORof}}
+% \lverb|New with 1.09a. Works with an empty list, too. \XINT_xorof_c more
+% efficient in 1.09i|
+% \begin{macrocode}
+\def\xintXORof {\romannumeral0\xintxorof }%
+\def\xintxorof #1{\expandafter\XINT_xorof_a\expandafter
+ 0\romannumeral-`0#1\relax }%
+\def\XINT_xorof_a #1#2{\expandafter\XINT_xorof_b\romannumeral-`0#2\Z #1}%
+\def\XINT_xorof_b #1%
+ {\xint_gob_til_relax #1\XINT_xorof_e\relax\XINT_xorof_c #1}%
+\def\XINT_xorof_c #1\Z #2%
+ {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof_a 1}%
+ \else\xint_afterfi{\XINT_xorof_a 0}\fi}%
+ {\XINT_xorof_a #2}%
+ }%
+\def\XINT_xorof_e #1\Z #2{ #2}%
+% \end{macrocode}
+% \subsection{\csh{xintGeq}}
+% \lverb|&
+% Release 1.09a has \xintnum added into \xintGeq. Unused and useless \xintiGeq
+% removed in 1.09e.
+% PLUS GRAND OU ÉGAL
+% attention compare les **valeurs absolues**|
+% \begin{macrocode}
+\def\xintGeq {\romannumeral0\xintgeq }%
+\def\xintgeq #1%
+{%
+ \expandafter\xint_geq\expandafter {\romannumeral0\xintnum{#1}}%
+}%
+\def\xint_geq #1#2%
+{%
+ \expandafter\XINT_geq_fork \romannumeral0\xintnum{#2}\Z #1\Z
+}%
+\def\XINT_Geq #1#2{\romannumeral0\XINT_geq_fork #2\Z #1\Z }%
+% \end{macrocode}
+% \lverb|&
+% PLUS GRAND OU ÉGAL
+% ATTENTION, TESTE les VALEURS ABSOLUES|
+% \begin{macrocode}
+\def\XINT_geq_fork #1#2\Z #3#4\Z
+{%
+ \xint_UDzerofork
+ #1\XINT_geq_secondiszero % |#1#2|=0
+ #3\XINT_geq_firstiszero % |#1#2|>0
+ 0{\xint_UDsignsfork
+ #1#3\XINT_geq_minusminus
+ #1-\XINT_geq_minusplus
+ #3-\XINT_geq_plusminus
+ --\XINT_geq_plusplus
+ \krof }%
+ \krof
+ {#2}{#4}#1#3%
+}%
+\def\XINT_geq_secondiszero #1#2#3#4{ 1}%
+\def\XINT_geq_firstiszero #1#2#3#4{ 0}%
+\def\XINT_geq_plusplus #1#2#3#4{\XINT_geq_pre {#4#2}{#3#1}}%
+\def\XINT_geq_minusminus #1#2#3#4{\XINT_geq_pre {#2}{#1}}%
+\def\XINT_geq_minusplus #1#2#3#4{\XINT_geq_pre {#4#2}{#1}}%
+\def\XINT_geq_plusminus #1#2#3#4{\XINT_geq_pre {#2}{#3#1}}%
+\def\XINT_geq_pre #1%
+{%
+ \expandafter\XINT_geq_pre_b\expandafter
+ {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
+}%
+\def\XINT_geq_pre_b #1#2%
+{%
+ \expandafter\XINT_geq_A
+ \expandafter1\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #1 \W\X\Y\Z
+}%
+% \end{macrocode}
+% \lverb|&
+% PLUS GRAND OU ÉGAL$\
+% N1 et N2 sont présentés à l'envers ET ON A RAJOUTÉ DES ZÉROS
+% POUR QUE LEURS LONGUEURS À CHACUN SOIENT MULTIPLES DE 4, MAIS
+% AUCUN NE SE TERMINE EN 0000$\
+% routine appelée via$\
+% \romannumeral0\XINT_geq_A 1{}<N1>\W\X\Y\Z<N2>\W\X\Y\Z$\
+% ATTENTION RENVOIE 1 SI N1 < N2 ou N1 = N2 et 0 si N1 > N2|
+% \begin{macrocode}
+\def\XINT_geq_A #1#2#3\W\X\Y\Z #4#5#6#7%
+{%
+ \xint_gob_til_W #4\xint_geq_az\W
+ \XINT_geq_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
+}%
+\def\XINT_geq_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W #4\xint_geq_bz\W
+ \XINT_geq_onestep #1#2{#7#6#5#4}{#3}%
+}%
+\def\XINT_geq_onestep #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_geq_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
+}%
+\def\XINT_geq_backtoA #1#2#3.#4%
+{%
+ \XINT_geq_A #2{#3#4}%
+}%
+\def\xint_geq_bz\W\XINT_geq_onestep #1\W\X\Y\Z { 1}%
+\def\xint_geq_az\W\XINT_geq_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W #4\xint_geq_ez\W
+ \XINT_geq_Eenter #1%
+}%
+\def\XINT_geq_Eenter #1\W\X\Y\Z { 0}%
+\def\xint_geq_ez\W\XINT_geq_Eenter #1%
+{%
+ \xint_UDzerofork
+ #1{ 0} % il y a une retenue
+ 0{ 1} % pas de retenue
+ \krof
+}%
+% \end{macrocode}
+% \subsection{\csh{xintiMax}, \csh{xintiiMax}}
+% \lverb|&
+% The rationale is that it is more efficient than using \xintCmp.
+% 1.03 makes the code a tiny bit slower but easier to re-use for fractions.
+% Note: actually since 1.08a code for fractions does not all reduce to these
+% entry points, so perhaps I should revert the changes made in 1.03. Release
+% 1.09a has \xintnum added into \xintiMax.
+%
+% 1.1 adds the missing \xintiiMax. Using \xintMax and not \xintiMax in xint is
+% deprecated.|
+% \begin{macrocode}
+\def\xintiMax {\romannumeral0\xintimax }%
+\def\xintimax #1%
+{%
+ \expandafter\xint_max\expandafter {\romannumeral0\xintnum{#1}}%
+}%
+\def\xint_max #1#2%
+{%
+ \expandafter\XINT_max_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
+}%
+\def\xintiiMax {\romannumeral0\xintiimax }%
+\def\xintiimax #1%
+{%
+ \expandafter\xint_iimax\expandafter {\romannumeral-`0#1}%
+}%
+\def\xint_iimax #1#2%
+{%
+ \expandafter\XINT_max_pre\expandafter {\romannumeral-`0#2}{#1}%
+}%
+\let\xintMax\xintiMax \let\xintmax\xintimax % deprecated, should be only with xintfrac
+\def\XINT_max_pre #1#2{\XINT_max_fork #1\Z #2\Z {#2}{#1}}%
+\def\XINT_Max #1#2{\romannumeral0\XINT_max_fork #2\Z #1\Z {#1}{#2}}%
+% \end{macrocode}
+% \lverb|&
+% #3#4 vient du *premier*,
+% #1#2 vient du *second*|
+% \begin{macrocode}
+\def\XINT_max_fork #1#2\Z #3#4\Z
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_max_minusminus % A < 0, B < 0
+ #1-\XINT_max_minusplus % B < 0, A >= 0
+ #3-\XINT_max_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_max_zerozero % A = B = 0
+ #10\XINT_max_zeroplus % B = 0, A > 0
+ #30\XINT_max_pluszero % A = 0, B > 0
+ 00\XINT_max_plusplus % A, B > 0
+ \krof }%
+ \krof
+ {#2}{#4}#1#3%
+}%
+% \end{macrocode}
+% \lverb|&
+% A = #4#2, B = #3#1|
+% \begin{macrocode}
+\def\XINT_max_zerozero #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_max_zeroplus #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_max_pluszero #1#2#3#4{\xint_secondoftwo_thenstop }%
+\def\XINT_max_minusplus #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_max_plusminus #1#2#3#4{\xint_secondoftwo_thenstop }%
+\def\XINT_max_plusplus #1#2#3#4%
+{%
+ \ifodd\XINT_Geq {#4#2}{#3#1}
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \lverb+#3=-, #4=-, #1 = |B| = -B, #2 = |A| = -A+
+% \begin{macrocode}
+\def\XINT_max_minusminus #1#2#3#4%
+{%
+ \ifodd\XINT_Geq {#1}{#2}
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintMaxof}}
+% \lverb|New with 1.09a.|
+% \begin{macrocode}
+\def\xintiMaxof {\romannumeral0\xintimaxof }%
+\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral-`0#1\relax }%
+\def\XINT_imaxof_a #1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}\Z }%
+\def\XINT_imaxof_b #1\Z #2%
+ {\expandafter\XINT_imaxof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_imaxof_c #1%
+ {\xint_gob_til_relax #1\XINT_imaxof_e\relax\XINT_imaxof_d #1}%
+\def\XINT_imaxof_d #1\Z
+ {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}%
+\def\XINT_imaxof_e #1\Z #2\Z { #2}%
+\let\xintMaxof\xintiMaxof \let\xintmaxof\xintimaxof
+% \end{macrocode}
+% \subsection{\csh{xintiMin}, \csh{xintiiMin}}
+% \lverb|\xintnum added New with 1.09a. I add \xintiiMin in 1.1 and mark as
+% deprecated \xintMin, renamed \xintiMin.|
+% \begin{macrocode}
+\def\xintiMin {\romannumeral0\xintimin }%
+\def\xintimin #1%
+{%
+ \expandafter\xint_min\expandafter {\romannumeral0\xintnum{#1}}%
+}%
+\def\xint_min #1#2%
+{%
+ \expandafter\XINT_min_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
+}%
+\def\xintiiMin {\romannumeral0\xintiimin }%
+\def\xintiimin #1%
+{%
+ \expandafter\xint_iimin\expandafter {\romannumeral-`0#1}%
+}%
+\def\xint_iimin #1#2%
+{%
+ \expandafter\XINT_min_pre\expandafter {\romannumeral-`0#2}{#1}%
+}%
+\let\xintMin\xintiMin \let\xintmin\xintimin % deprecated
+\def\XINT_min_pre #1#2{\XINT_min_fork #1\Z #2\Z {#2}{#1}}%
+\def\XINT_Min #1#2{\romannumeral0\XINT_min_fork #2\Z #1\Z {#1}{#2}}%
+% \end{macrocode}
+% \lverb|&
+% #3#4 vient du *premier*,
+% #1#2 vient du *second*|
+% \begin{macrocode}
+\def\XINT_min_fork #1#2\Z #3#4\Z
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_min_minusminus % A < 0, B < 0
+ #1-\XINT_min_minusplus % B < 0, A >= 0
+ #3-\XINT_min_plusminus % A < 0, B >= 0
+ --{\xint_UDzerosfork
+ #1#3\XINT_min_zerozero % A = B = 0
+ #10\XINT_min_zeroplus % B = 0, A > 0
+ #30\XINT_min_pluszero % A = 0, B > 0
+ 00\XINT_min_plusplus % A, B > 0
+ \krof }%
+ \krof
+ {#2}{#4}#1#3%
+}%
+% \end{macrocode}
+% \lverb|&
+% A = #4#2, B = #3#1|
+% \begin{macrocode}
+\def\XINT_min_zerozero #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_min_zeroplus #1#2#3#4{\xint_secondoftwo_thenstop }%
+\def\XINT_min_pluszero #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_min_minusplus #1#2#3#4{\xint_secondoftwo_thenstop }%
+\def\XINT_min_plusminus #1#2#3#4{\xint_firstoftwo_thenstop }%
+\def\XINT_min_plusplus #1#2#3#4%
+{%
+ \ifodd\XINT_Geq {#4#2}{#3#1}
+ \expandafter\xint_secondoftwo_thenstop
+ \else
+ \expandafter\xint_firstoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \lverb+#3=-, #4=-, #1 = |B| = -B, #2 = |A| = -A+
+% \begin{macrocode}
+\def\XINT_min_minusminus #1#2#3#4%
+{%
+ \ifodd\XINT_Geq {#1}{#2}
+ \expandafter\xint_secondoftwo_thenstop
+ \else
+ \expandafter\xint_firstoftwo_thenstop
+ \fi
+}%
+% \end{macrocode}
+% \subsection{\csh{xintMinof}}
+% \lverb|1.09a|
+% \begin{macrocode}
+\def\xintiMinof {\romannumeral0\xintiminof }%
+\def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral-`0#1\relax }%
+\def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}\Z }%
+\def\XINT_iminof_b #1\Z #2%
+ {\expandafter\XINT_iminof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_iminof_c #1%
+ {\xint_gob_til_relax #1\XINT_iminof_e\relax\XINT_iminof_d #1}%
+\def\XINT_iminof_d #1\Z
+ {\expandafter\XINT_iminof_b\romannumeral0\xintimin {#1}}%
+\def\XINT_iminof_e #1\Z #2\Z { #2}%
+\let\xintMinof\xintiMinof \let\xintminof\xintiminof
+% \end{macrocode}
+% \subsection{\csh{xintSum}}
+% \lverb|&
+% \xintSum {{a}{b}...{z}}$\
+% \xintSumExpr {a}{b}...{z}\relax$\
+% 1.03 (drastically) simplifies and makes the routines more efficient (for big
+% 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 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%
+{%
+ \expandafter\XINT_sum_checksign\romannumeral-`0#3\Z {#1}{#2}%
+}%
+\def\XINT_sum_checksign #1%
+{%
+ \xint_gob_til_relax #1\XINT_sum_finished\relax
+ \xint_gob_til_zero #1\XINT_sum_skipzeroinput0%
+ \xint_UDsignfork
+ #1\XINT_sum_N
+ -{\XINT_sum_P #1}%
+ \krof
+}%
+\def\XINT_sum_finished #1\Z #2#3%
+{%
+ \XINT_sub_A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
+}%
+\def\XINT_sum_skipzeroinput #1\krof #2\Z {\XINT_sum_loop }%
+\def\XINT_sum_P #1\Z #2%
+{%
+ \expandafter\XINT_sum_loop\expandafter
+ {\romannumeral0\expandafter
+ \XINT_addr_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #2\W\X\Y\Z }%
+}%
+\def\XINT_sum_N #1\Z #2#3%
+{%
+ \expandafter\XINT_sum_NN\expandafter
+ {\romannumeral0\expandafter
+ \XINT_addr_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #3\W\X\Y\Z }{#2}%
+}%
+\def\XINT_sum_NN #1#2{\XINT_sum_loop {#2}{#1}}%
+% \end{macrocode}
+% \subsection{\csh{xintPrd}}
+% \lverb|&
+% \xintPrd {{a}...{z}}$\
+% \xintPrdExpr {a}...{z}\relax$\
+% Release 1.02 modified the product routine. The earlier version was faster in
+% situations where each new term is bigger than the product of all previous
+% terms, a situation which arises in the algorithm for computing powers. The
+% 1.02 version was changed to be more efficient on big products, where the new
+% term is small compared to what has been computed so far (the power algorithm
+% now has its own product routine).
+%
+% Finally, the 1.03 version just simplifies everything as the multiplication now
+% decides what is best, with the price of a little overhead. So the code has
+% been dramatically reduced here.
+%
+% In 1.03 I also modify the way \xintPrd and \xintPrdExpr ...\relax are
+% related. Now \xintPrdExpr \z \relax is accepted input when \z expands
+% to a list of braced terms (prior only \xintPrd {\z} or \xintPrd \z was
+% possible).
+%
+% 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.
+%
+% 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%
+ {\expandafter\XINT_prod_loop_b \romannumeral-`0#2\Z #1\Z \Z}%
+\def\XINT_prod_loop_b #1%
+ {\xint_gob_til_relax #1\XINT_prod_finished\relax\XINT_prod_loop_c #1}%
+\def\XINT_prod_loop_c
+ {\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork }%
+\def\XINT_prod_finished #1\Z #2\Z \Z { #2}%
+% \end{macrocode}
+% \subsection{\csh{xintFac}}
+% \lverb|&
+% Modified with 1.02 and again in 1.03 for greater efficiency. I am
+% tempted,
+% here and elsewhere, to use \ifcase\XINT_Geq {#1}{1000000000} rather than
+% \ifnum\xintLength {#1}>9 but for the time being I leave things as they stand.
+% With release 1.05, rather than using \xintLength I opt finally for direct use
+% of \numexpr (which will throw a suitable number too big message), and to raise
+% the \xintError:$\ FactorialOfTooBigNumber for argument larger than 1000000
+% (rather than 1000000000). With 1.09a, \xintFac uses \xintnum.
+%
+% 1.09j for no special reason, I lower the maximal number from 999999 to 100000.
+% Any how this computation would need more memory than TL2013 standard allows to
+% TeX. And I don't even mention time... |
+% \begin{macrocode}
+\def\xintiFac {\romannumeral0\xintifac }%
+\def\xintifac #1%
+{%
+ \expandafter\XINT_fac_fork\expandafter{\the\numexpr #1}%
+}%
+\let\xintFac\xintiFac \let\xintfac\xintifac
+\def\XINT_fac_fork #1%
+{%
+ \ifcase\XINT_cntSgn #1\Z
+ \xint_afterfi{\expandafter\space\expandafter 1\xint_gobble_i }%
+ \or
+ \expandafter\XINT_fac_checklength
+ \else
+ \xint_afterfi{\expandafter\xintError:FactorialOfNegativeNumber
+ \expandafter\space\expandafter 1\xint_gobble_i }%
+ \fi
+ {#1}%
+}%
+\def\XINT_fac_checklength #1%
+{%
+ \ifnum #1>100000
+ \xint_afterfi{\expandafter\xintError:FactorialOfTooBigNumber
+ \expandafter\space\expandafter 1\xint_gobble_i }%
+ \else
+ \xint_afterfi{\ifnum #1>\xint_c_ixixixix
+ \expandafter\XINT_fac_big_loop
+ \else
+ \expandafter\XINT_fac_loop
+ \fi }%
+ \fi
+ {#1}%
+}%
+\def\XINT_fac_big_loop #1{\XINT_fac_big_loop_main {10000}{#1}{}}%
+\def\XINT_fac_big_loop_main #1#2#3%
+{%
+ \ifnum #1<#2
+ \expandafter
+ \XINT_fac_big_loop_main
+ \expandafter
+ {\the\numexpr #1+1\expandafter }%
+ \else
+ \expandafter\XINT_fac_big_docomputation
+ \fi
+ {#2}{#3{#1}}%
+}%
+\def\XINT_fac_big_docomputation #1#2%
+{%
+ \expandafter \XINT_fac_bigcompute_loop \expandafter
+ {\romannumeral0\XINT_fac_loop {9999}}#2\relax
+}%
+\def\XINT_fac_bigcompute_loop #1#2%
+{%
+ \xint_gob_til_relax #2\XINT_fac_bigcompute_end\relax
+ \expandafter\XINT_fac_bigcompute_loop\expandafter
+ {\expandafter\XINT_mul_enter
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \Z\Z\Z\Z #1\W\W\W\W }%
+}%
+\def\XINT_fac_bigcompute_end #1#2#3#4#5%
+{%
+ \XINT_fac_bigcompute_end_ #5%
+}%
+\def\XINT_fac_bigcompute_end_ #1\R #2\Z \W\X\Y\Z #3\W\X\Y\Z { #3}%
+\def\XINT_fac_loop #1{\XINT_fac_loop_main 1{1000}{#1}}%
+\def\XINT_fac_loop_main #1#2#3%
+{%
+ \ifnum #3>#1
+ \else
+ \expandafter\XINT_fac_loop_exit
+ \fi
+ \expandafter\XINT_fac_loop_main\expandafter
+ {\the\numexpr #1+1\expandafter }\expandafter
+ {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z }%
+ {#3}%
+}%
+\def\XINT_fac_loop_exit #1#2#3#4#5#6#7%
+{%
+ \XINT_fac_loop_exit_ #6%
+}%
+\def\XINT_fac_loop_exit_ #1#2#3%
+{%
+ \XINT_mul_M
+}%
+% \end{macrocode}
% \lverb|&
% &
-% -----------------------------------------------------------------$\
-% -----------------------------------------------------------------$\
+% -----------------------------------------------------------------$\
+% -----------------------------------------------------------------$\
% DECIMAL OPERATIONS: FIRST DIGIT, LASTDIGIT, ODDNESS,
% MULTIPLICATION BY TEN, QUOTIENT BY TEN, QUOTIENT OR
% MULTIPLICATION BY POWER OF TEN, SPLIT OPERATION.|
% \subsection{\csh{xintFDg}}
% \lverb|&
-% FIRST DIGIT. Code simplified in 1.05.
+% FIRST DIGIT. Code simplified in 1.05.
% And prepared for redefinition by xintfrac to parse through \xintNum. Version
% 1.09a inserts the \xintnum already here.|
% \begin{macrocode}
@@ -16707,7 +18378,7 @@ $1$ or $-1$.
% \lverb|1.05 has \xintiOdd, whereas \xintOdd parses through \xintNum.
% Inadvertently, 1.09a redefined \xintiLDg so \xintiOdd also parsed through
% \xintNum. Anyway, having a \xintOdd and a \xintiOdd was silly. Removed in
-% 1.09f |
+% 1.09f, now \xintOdd and \xintiiOdd.|
% \begin{macrocode}
\def\xintiiOdd {\romannumeral0\xintiiodd }%
\def\xintiiodd #1%
@@ -16718,6 +18389,15 @@ $1$ or $-1$.
\xint_afterfi{ 0}%
\fi
}%
+\def\xintiiEven {\romannumeral0\xintiieven }%
+\def\xintiieven #1%
+{%
+ \ifodd\xintiiLDg{#1}
+ \xint_afterfi{ 0}%
+ \else
+ \xint_afterfi{ 1}%
+ \fi
+}%
\def\xintOdd {\romannumeral0\xintodd }%
\def\xintodd #1%
{%
@@ -16727,6 +18407,15 @@ $1$ or $-1$.
\xint_afterfi{ 0}%
\fi
}%
+\def\xintEven {\romannumeral0\xinteven }%
+\def\xinteven #1%
+{%
+ \ifodd\xintLDg{#1}
+ \xint_afterfi{ 0}%
+ \else
+ \xint_afterfi{ 1}%
+ \fi
+}%
% \end{macrocode}
% \subsection{\csh{xintDSL}}
% \lverb|&
@@ -16748,9 +18437,9 @@ $1$ or $-1$.
% \subsection{\csh{xintDSR}}
% \lverb|&
% DECIMAL SHIFT RIGHT (=DIVISION PAR 10). Release 1.06b which replaced all @'s
-% by
+% by
% underscores left undefined the \xint_minus used in \XINT_dsr_b, and this bug
-% was fixed only later in release 1.09b|
+% was fixed only later in release 1.09b|
% \begin{macrocode}
\def\xintDSR {\romannumeral0\xintdsr }%
\def\xintdsr #1%
@@ -16773,11 +18462,11 @@ $1$ or $-1$.
\def\XINT_dsr_removew #1\W { }%
% \end{macrocode}
% \subsection{\csh{xintDSH}, \csh{xintDSHr}}
-% \lverb+DECIMAL SHIFTS \xintDSH {x}{A}$\
-% si x <= 0, fait A -> A.10^(|x|). v1.03 corrige l'oversight pour A=0.$\
-% si x > 0, et A >=0, fait A -> quo(A,10^(x))$\
-% si x > 0, et A < 0, fait A -> -quo(-A,10^(x))$\
-% (donc pour x > 0 c'est comme DSR itéré x fois)$\
+% \lverb+DECIMAL SHIFTS \xintDSH {x}{A}$\
+% si x <= 0, fait A -> A.10^(|x|). v1.03 corrige l'oversight pour A=0.$\
+% si x > 0, et A >=0, fait A -> quo(A,10^(x))$\
+% si x > 0, et A < 0, fait A -> -quo(-A,10^(x))$\
+% (donc pour x > 0 c'est comme DSR itéré x fois)$\
% \xintDSHr donne le `reste' (si x<=0 donne zéro).
%
% Release 1.06 now feeds x to a \numexpr first. I will have to revise this code
@@ -16797,7 +18486,7 @@ $1$ or $-1$.
\krof #1%
}%
\def\XINT_dshr_xzeroorneg #1\Z #2{ 0}%
-\def\XINT_dshr_xpositive #1\Z
+\def\XINT_dshr_xpositive #1\Z
{%
\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintdsx {#1}%
}%
@@ -16827,24 +18516,24 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintDSx}}
% \lverb+Je fais cette routine pour la version 1.01, après modification de
-% \xintDecSplit. Dorénavant \xintDSx fera appel à \xintDecSplit et de même
+% \xintDecSplit. Dorénavant \xintDSx fera appel à \xintDecSplit et de même
% \xintDSH fera appel à \xintDSx. J'ai donc supprimé entièrement l'ancien code
% de \xintDSH et re-écrit entièrement celui de \xintDecSplit pour x positif.
%
-% --> Attention le cas x=0 est traité dans la même catégorie que x > 0 <--$\
-% si x < 0, fait A -> A.10^(|x|)$\
-% si x >= 0, et A >=0, fait A -> {quo(A,10^(x))}{rem(A,10^(x))}$\
-% si x >= 0, et A < 0, d'abord on calcule {quo(-A,10^(x))}{rem(-A,10^(x))}$\
-% puis, si le premier n'est pas nul on lui donne le signe -$\
+% --> Attention le cas x=0 est traité dans la même catégorie que x > 0 <--$\
+% si x < 0, fait A -> A.10^(|x|)$\
+% si x >= 0, et A >=0, fait A -> {quo(A,10^(x))}{rem(A,10^(x))}$\
+% si x >= 0, et A < 0, d'abord on calcule {quo(-A,10^(x))}{rem(-A,10^(x))}$\
+% puis, si le premier n'est pas nul on lui donne le signe -$\
% si le premier est nul on donne le signe - au second.
%
% On peut donc toujours reconstituer l'original A par 10^x Q \pm R
% où il faut prendre le signe plus si Q est positif ou nul et le signe moins si
% Q est strictement négatif.
%
-% Release 1.06 has a faster and more compactly coded \XINT_dsx_zeroloop.
+% Release 1.06 has a faster and more compactly coded \XINT_dsx_zeroloop.
% Also, x is now given to a \numexpr. The earlier code should be then
-% simplified, but I leave as is for the time being.
+% simplified, but I leave as is for the time being.
%
% Release 1.07 modified the coding of \XINT_dsx_zeroloop, to avoid impacting the
% input stack. Indeed the truncating, rounding, and conversion to float routines
@@ -16892,21 +18581,21 @@ $1$ or $-1$.
\def\XINT_dsx_xisNeg_checkx #1%
{%
\ifnum #1>1000000
- \xint_afterfi
+ \xint_afterfi
{\xintError:TooBigDecimalShift
\expandafter\space\expandafter 0\xint_gobble_iv }%
- \else
- \expandafter \XINT_dsx_zeroloop
+ \else
+ \expandafter \XINT_dsx_zeroloop
\fi
}%
\def\XINT_dsx_addzerosnofuss #1{\XINT_dsx_zeroloop {#1}{}\Z }%
\def\XINT_dsx_zeroloop #1#2%
{%
\ifnum #1<\xint_c_ix \XINT_dsx_exita\fi
- \expandafter\XINT_dsx_zeroloop\expandafter
+ \expandafter\XINT_dsx_zeroloop\expandafter
{\the\numexpr #1-\xint_c_viii}{#200000000}%
}%
-\def\XINT_dsx_exita\fi\expandafter\XINT_dsx_zeroloop
+\def\XINT_dsx_exita\fi\expandafter\XINT_dsx_zeroloop
{%
\fi\expandafter\XINT_dsx_exitb
}%
@@ -16980,14 +18669,14 @@ $1$ or $-1$.
% positive the cut location is x slots to the left of the right end of the
% number. If x becomes equal to or larger than the length of the number then L
% becomes empty. If x is negative the location of the cut is |x| slots to the
-% right of the left end of the number.
+% right of the left end of the number.
%
% (*) warning: this may change in a future version. Only the behavior
% for A non-negative is guaranteed to remain the same.
%
% v1.05a: \XINT_split_checksizex does not compute the length anymore, rather the
% error will be from a \numexpr; but the limit of 999999999 does not make much
-% sense.
+% sense.
%
% v1.06: Improvements in \XINT_split_fromleft_loop, \XINT_split_fromright_loop
% and related macros. More readable coding, speed gains.
@@ -17000,15 +18689,15 @@ $1$ or $-1$.
% \begin{macrocode}
\def\xintDecSplitL {\romannumeral0\xintdecsplitl }%
\def\xintDecSplitR {\romannumeral0\xintdecsplitr }%
-\def\xintdecsplitl
+\def\xintdecsplitl
{%
\expandafter\xint_firstoftwo_thenstop
- \romannumeral0\xintdecsplit
+ \romannumeral0\xintdecsplit
}%
-\def\xintdecsplitr
+\def\xintdecsplitr
{%
\expandafter\xint_secondoftwo_thenstop
- \romannumeral0\xintdecsplit
+ \romannumeral0\xintdecsplit
}%
\def\xintDecSplit {\romannumeral0\xintdecsplit }%
\def\xintdecsplit #1#2%
@@ -17018,11 +18707,11 @@ $1$ or $-1$.
}%
\def\xint_split #1#2%
{%
- \expandafter\XINT_split_checksizex\expandafter{\the\numexpr #2}{#1}%
+ \expandafter\XINT_split_checksizex\expandafter{\the\numexpr #2}{#1}%
}%
\def\XINT_split_checksizex #1% 999999999 is anyhow very big, could be reduced
{%
- \ifnum\numexpr\XINT_Abs{#1}>999999999
+ \ifnum\numexpr\XINT_Abs{#1}>999999999
\xint_afterfi {\xintError:TooBigDecimalSplit\XINT_split_bigx }%
\else
\expandafter\XINT_split_xfork
@@ -17033,7 +18722,7 @@ $1$ or $-1$.
{%
\ifcase\XINT_cntSgn #1\Z
\or \xint_afterfi { {}{#2}}% positive big x
- \else
+ \else
\xint_afterfi { {#2}{}}% negative big x
\fi
}%
@@ -17048,7 +18737,7 @@ $1$ or $-1$.
\def\XINT_split_zerosplit #1\Z #2{ {#2}{}}%
\def\XINT_split_fromleft #1\Z #2%
{%
- \XINT_split_fromleft_loop {#1}{}#2\W\W\W\W\W\W\W\W\Z
+ \XINT_split_fromleft_loop {#1}{}#2\W\W\W\W\W\W\W\W\Z
}%
\def\XINT_split_fromleft_loop #1%
{%
@@ -17089,7 +18778,7 @@ $1$ or $-1$.
{\XINT_split_fromleft_checkiftoofar #7{#1#2#3#4#5#6#7}}%
\def\XINT_split_fromleft_endsplit_vii #1#2#3#4#5#6#7#8%
{\XINT_split_fromleft_checkiftoofar #8{#1#2#3#4#5#6#7#8}}%
-\def\XINT_split_fromleft_checkiftoofar #1#2#3\W #4\Z
+\def\XINT_split_fromleft_checkiftoofar #1#2#3\W #4\Z
{%
\xint_gob_til_W #1\XINT_split_fromleft_wenttoofar\W
\space {#2}{#3}%
@@ -17130,7 +18819,7 @@ $1$ or $-1$.
}%
\edef\XINT_split_fromright_endsplit_ #1#2\W #3\Z #4%
{%
- \noexpand\expandafter\space\noexpand\expandafter
+ \noexpand\expandafter\space\noexpand\expandafter
{\noexpand\romannumeral0\noexpand\xintreverseorder {#2}}{#1}%
}%
\def\XINT_split_fromright_endsplit_i #1#2%
@@ -17162,7 +18851,7 @@ $1$ or $-1$.
\def\xintdouble #1%
{%
\expandafter\XINT_dbl\romannumeral-`0#1%
- \R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W
+ \R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W
}%
\def\XINT_dbl #1%
{%
@@ -17173,12 +18862,12 @@ $1$ or $-1$.
\krof
}%
\def\XINT_dbl_zero #1\Z \W\W\W\W\W\W\W { 0}%
-\def\XINT_dbl_neg
+\def\XINT_dbl_neg
{\expandafter\xint_minus_thenstop\romannumeral0\XINT_dbl_pos }%
-\def\XINT_dbl_pos
+\def\XINT_dbl_pos
{%
\expandafter\XINT_dbl_a \expandafter{\expandafter}\expandafter 0%
- \romannumeral0\XINT_SQ {}%
+ \romannumeral0\XINT_SQ {}%
}%
\def\XINT_dbl_a #1#2#3#4#5#6#7#8#9%
{%
@@ -17206,7 +18895,7 @@ $1$ or $-1$.
\def\xinthalf #1%
{%
\expandafter\XINT_half\romannumeral-`0#1%
- \R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W
+ \R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W
}%
\def\XINT_half #1%
{%
@@ -17254,110 +18943,29 @@ $1$ or $-1$.
\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7\relax
}%
% \end{macrocode}
-% \subsection{\csh{xintDec}}
-% \lverb!v1.08!
-% \begin{macrocode}
-\def\xintDec {\romannumeral0\xintdec }%
-\def\xintdec #1%
-{%
- \expandafter\XINT_dec\romannumeral-`0#1%
- \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
-}%
-\def\XINT_dec #1%
-{%
- \xint_UDzerominusfork
- #1-\XINT_dec_zero
- 0#1\XINT_dec_neg
- 0-{\XINT_dec_pos #1}%
- \krof
-}%
-\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
-\def\XINT_dec_neg
- {\expandafter\xint_minus_thenstop\romannumeral0\XINT_inc_pos }%
-\def\XINT_dec_pos
-{%
- \expandafter\XINT_dec_a \expandafter{\expandafter}%
- \romannumeral0\XINT_OQ {}%
-}%
-\def\XINT_dec_a #1#2#3#4#5#6#7#8#9%
-{%
- \expandafter\XINT_dec_b
- \the\numexpr 11#9#8#7#6#5#4#3#2-\xint_c_i\relax {#1}%
-}%
-\def\XINT_dec_b 1#1%
-{%
- \xint_gob_til_one #1\XINT_dec_A 1\XINT_dec_c
-}%
-\def\XINT_dec_c #1#2#3#4#5#6#7#8#9{\XINT_dec_a {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_dec_A 1\XINT_dec_c #1#2#3#4#5#6#7#8#9%
- {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_dec_B #1#2\W\W\W\W\W\W\W\W
-{%
- \expandafter\XINT_dec_cleanup
- \romannumeral0\XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1%
-}%
-\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
- {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
-% \end{macrocode}
-% \subsection{\csh{xintInc}}
-% \lverb!v1.08!
-% \begin{macrocode}
-\def\xintInc {\romannumeral0\xintinc }%
-\def\xintinc #1%
-{%
- \expandafter\XINT_inc\romannumeral-`0#1%
- \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
-}%
-\def\XINT_inc #1%
-{%
- \xint_UDzerominusfork
- #1-\XINT_inc_zero
- 0#1\XINT_inc_neg
- 0-{\XINT_inc_pos #1}%
- \krof
-}%
-\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
-\def\XINT_inc_neg {\expandafter\XINT_opp\romannumeral0\XINT_dec_pos }%
-\def\XINT_inc_pos
-{%
- \expandafter\XINT_inc_a \expandafter{\expandafter}%
- \romannumeral0\XINT_OQ {}%
-}%
-\def\XINT_inc_a #1#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_W #9\XINT_inc_end\W
- \expandafter\XINT_inc_b
- \the\numexpr 10#9#8#7#6#5#4#3#2+\xint_c_i\relax {#1}%
-}%
-\def\XINT_inc_b 1#1%
-{%
- \xint_gob_til_zero #1\XINT_inc_A 0\XINT_inc_c
-}%
-\def\XINT_inc_c #1#2#3#4#5#6#7#8#9{\XINT_inc_a {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_inc_A 0\XINT_inc_c #1#2#3#4#5#6#7#8#9%
- {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_inc_end\W #1\relax #2{ 1#2}%
-% \end{macrocode}
-% \subsection{\csh{xintiSqrt}, \csh{xintiSquareRoot}}
+% \subsection{\csh{xintiiSqrt}, \csh{xintiiSquareRoot}}
% \lverb|v1.08. 1.09a uses \xintnum.
%
% Some overhead was added inadvertently in 1.09a to inner routines when
% \xintiquo and \xintidivision were also promoted to use \xintnum; release 1.09f
-% thus uses \xintiiquo and \xintiidivision xhich avoid this \xintnum overhead.
+% thus uses \xintiiquo and \xintiidivision xhich avoid this \xintnum overhead.
%
% 1.09j replaced the previous long \ifcase from \XINT_sqrt_c by some nested
-% \ifnum's.|
+% \ifnum's.
+%
+% 1.1 Ajout de \xintiiSqrt, etc...|
% \begin{macrocode}
+\def\xintiiSqrt {\romannumeral0\xintiisqrt }%
+\def\xintiisqrt
+ {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }%
+\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z
+ \W\W\W\W\W\W\W\W }%
+\def\xintiiSquareRoot {\romannumeral0\xintiisquareroot }%
+\def\xintiisquareroot #1%
+ {\expandafter\XINT_sqrt_checkin\romannumeral-`0#1\Z}%
\def\xintiSqrt {\romannumeral0\xintisqrt }%
\def\xintisqrt
{\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }%
-\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z
- \W\W\W\W\W\W\W\W }%
\def\xintiSquareRoot {\romannumeral0\xintisquareroot }%
\def\xintisquareroot #1%
{\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\Z}%
@@ -17373,7 +18981,7 @@ $1$ or $-1$.
\edef\XINT_sqrt_isneg #1\Z {\noexpand\xintError:RootOfNegative\space 1.}%
\def\XINT_sqrt #1\Z
{%
- \expandafter\XINT_sqrt_start\expandafter
+ \expandafter\XINT_sqrt_start\expandafter
{\romannumeral0\xintlength {#1}}{#1}%
}%
\def\XINT_sqrt_start #1%
@@ -17400,7 +19008,7 @@ $1$ or $-1$.
{%
\XINT_sqrt_bA_b #3\Z #2{#1}{#3}%
}%
-\def\XINT_sqrt_bA_b #1#2#3\Z
+\def\XINT_sqrt_bA_b #1#2#3\Z
{%
\XINT_sqrt_c {#1#2}%
}%
@@ -17408,17 +19016,17 @@ $1$ or $-1$.
{%
\XINT_sqrt_bB_b #3\Z #2{#1}{#3}%
}%
-\def\XINT_sqrt_bB_b #1#2\Z
+\def\XINT_sqrt_bB_b #1#2\Z
{%
\XINT_sqrt_c #1%
}%
\def\XINT_sqrt_c #1#2%
{%
\expandafter #2\expandafter
- {\the\numexpr\ifnum #1>\xint_c_iii
+ {\the\numexpr\ifnum #1>\xint_c_iii
\ifnum #1>\xint_c_viii
- \ifnum #1>15 \ifnum #1>24 \ifnum #1>35
- \ifnum #1>48 \ifnum #1>63 \ifnum #1>80
+ \ifnum #1>15 \ifnum #1>24 \ifnum #1>35
+ \ifnum #1>48 \ifnum #1>63 \ifnum #1>80
10\else 9\fi \else 8\fi \else 7\fi \else 6\fi
\else 5\fi \else 4\fi \else 3\fi \else 2\fi \relax }%
}%
@@ -17453,20 +19061,20 @@ $1$ or $-1$.
{\the\numexpr #3-#1}%
}%
\def\XINT_sqrt_small_end #1#2#3{ {#3}{#2}}%
-\def\XINT_sqrt_big_d #1#2%
+\def\XINT_sqrt_big_d #1#2%
{%
\ifodd #2
\expandafter\expandafter\expandafter\XINT_sqrt_big_eB
\else
\expandafter\expandafter\expandafter\XINT_sqrt_big_eA
\fi
- \expandafter {\the\numexpr #2/\xint_c_ii }{#1}%
+ \expandafter {\the\numexpr #2/\xint_c_ii }{#1}%
}%
\def\XINT_sqrt_big_eA #1#2#3%
{%
\XINT_sqrt_big_eA_a #3\Z {#2}{#1}{#3}%
}%
-\def\XINT_sqrt_big_eA_a #1#2#3#4#5#6#7#8#9\Z
+\def\XINT_sqrt_big_eA_a #1#2#3#4#5#6#7#8#9\Z
{%
\XINT_sqrt_big_eA_b {#1#2#3#4#5#6#7#8}%
}%
@@ -17492,16 +19100,16 @@ $1$ or $-1$.
{%
\expandafter\XINT_sqrt_big_f_a\expandafter
{\the\numexpr #2+#3\expandafter}\expandafter
- {\romannumeral0\XINT_dsx_addzerosnofuss
+ {\romannumeral0\XINT_dsx_addzerosnofuss
{\numexpr #4-\xint_c_iv\relax}{#1}}{#4}%
}%
\def\XINT_sqrt_big_f_a #1#2#3#4%
{%
\expandafter\XINT_sqrt_big_g\expandafter
- {\romannumeral0\xintiisub
- {\XINT_dsx_addzerosnofuss
+ {\romannumeral0\xintiisub
+ {\XINT_dsx_addzerosnofuss
{\numexpr \xint_c_ii*#3-\xint_c_viii\relax}{#1}}{#4}}%
- {#2}{#3}%
+ {#2}{#3}%
}%
\def\XINT_sqrt_big_g #1#2%
{%
@@ -17529,107 +19137,14 @@ $1$ or $-1$.
}%
\def\XINT_sqrt_big_end #1#2#3#4{ {#3}{#2}}%
% \end{macrocode}
-% \subsection{\csh{xintIsTrue:csv}}
-% \lverb|1.09c. For use by \xinttheboolexpr.(inside \csname, no need for a
-% \romannumeral here). The macros may well be defined already here. I
-% make no advertisement because I have inserted no space parsing in the
-% :csv macros, as they will be used only with privately created comma
-% separated lists, having no space naturally. Nevertheless they exist
-% and can be used.|
-% \begin{macrocode}
-\def\xintIsTrue:csv #1{\expandafter\XINT_istrue:_a\romannumeral-`0#1,,^}%
-\def\XINT_istrue:_a {\XINT_istrue:_b {}}%
-\def\XINT_istrue:_b #1#2,%
- {\expandafter\XINT_istrue:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_istrue:_d\fi #1}%
-\def\XINT_istrue:_d #1,%
- {\expandafter\XINT_istrue:_e\romannumeral0\xintisnotzero {#1},}%
-\def\XINT_istrue:_e #1,#2{\XINT_istrue:_b {#2,#1}}%
-\def\XINT_:_f ,#1#2^{\xint_gobble_i #1}%
-% \end{macrocode}
-% \subsection{\csh{xintANDof:csv}}
-% \lverb|1.09a. For use by \xintexpr (inside \csname, no need for a
-% \romannumeral here).|
+% \subsection{\csh{xintiiE}}
+% \lverb|Originally was used in \xintiiexpr. Transferred from xintfrac for 1.1.|
% \begin{macrocode}
-\def\xintANDof:csv #1{\expandafter\XINT_andof:_a\romannumeral-`0#1,,^}%
-\def\XINT_andof:_a {\expandafter\XINT_andof:_b\romannumeral-`0}%
-\def\XINT_andof:_b #1{\if #1,\expandafter\XINT_andof:_e
- \else\expandafter\XINT_andof:_c\fi #1}%
-\def\XINT_andof:_c #1,{\xintifTrueAelseB {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
-\def\XINT_andof:_no #1^{0}%
-\def\XINT_andof:_e #1^{1}% works with empty list
-% \end{macrocode}
-% \subsection{\csh{xintORof:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintORof:csv #1{\expandafter\XINT_orof:_a\romannumeral-`0#1,,^}%
-\def\XINT_orof:_a {\expandafter\XINT_orof:_b\romannumeral-`0}%
-\def\XINT_orof:_b #1{\if #1,\expandafter\XINT_orof:_e
- \else\expandafter\XINT_orof:_c\fi #1}%
-\def\XINT_orof:_c #1,{\xintifTrueAelseB{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
-\def\XINT_orof:_yes #1^{1}%
-\def\XINT_orof:_e #1^{0}% works with empty list
-% \end{macrocode}
-% \subsection{\csh{xintXORof:csv}}
-% \lverb|1.09a. For use by \xintexpr (inside a \csname..\endcsname).|
-% \begin{macrocode}
-\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter
- 0\romannumeral-`0#1,,^}%
-\def\XINT_xorof:_a #1#2,{\expandafter\XINT_xorof:_b\romannumeral-`0#2,#1}%
-\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_xorof:_c\fi #1}%
-\def\XINT_xorof:_c #1,#2%
- {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
- \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
- {\XINT_xorof:_a #2}%
- }%
-\def\XINT_:_e ,#1#2^{#1}% allows empty list
-% \end{macrocode}
-% \subsection{\csh{xintiMaxof:csv}}
-% \lverb|1.09i. For use by \xintiiexpr.|
-% \begin{macrocode}
-\def\xintiMaxof:csv #1{\expandafter\XINT_imaxof:_b\romannumeral-`0#1,,}%
-\def\XINT_imaxof:_b #1,#2,{\expandafter\XINT_imaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_imaxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_imaxof:_d\fi #1}%
-\def\XINT_imaxof:_d #1,{\expandafter\XINT_imaxof:_b\romannumeral0\xintimax {#1}}%
-\def\XINT_of:_e ,#1,{#1}%
-\let\xintMaxof:csv\xintiMaxof:csv
-% \end{macrocode}
-% \subsection{\csh{xintiMinof:csv}}
-% \lverb|1.09i. For use by \xintiiexpr.|
-% \begin{macrocode}
-\def\xintiMinof:csv #1{\expandafter\XINT_iminof:_b\romannumeral-`0#1,,}%
-\def\XINT_iminof:_b #1,#2,{\expandafter\XINT_iminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_iminof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_iminof:_d\fi #1}%
-\def\XINT_iminof:_d #1,{\expandafter\XINT_iminof:_b\romannumeral0\xintimin {#1}}%
-\let\xintMinof:csv\xintiMinof:csv
-% \end{macrocode}
-% \subsection{\csh{xintiiSum:csv}}
-% \lverb|1.09i. For use by \xintiiexpr.|
-% \begin{macrocode}
-\def\xintiiSum:csv #1{\expandafter\XINT_iisum:_a\romannumeral-`0#1,,^}%
-\def\XINT_iisum:_a {\XINT_iisum:_b {0}}%
-\def\XINT_iisum:_b #1#2,{\expandafter\XINT_iisum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_iisum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_iisum:_d\fi #1}%
-\def\XINT_iisum:_d #1,#2{\expandafter\XINT_iisum:_b\expandafter
- {\romannumeral0\xintiiadd {#2}{#1}}}%
-\let\xintSum:csv\xintiiSum:csv
-% \end{macrocode}
-% \subsection{\csh{xintiiPrd:csv}}
-% \lverb|1.09i. For use by \xintiiexpr.|
-% \begin{macrocode}
-\def\xintiiPrd:csv #1{\expandafter\XINT_iiprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_iiprd:_a {\XINT_iiprd:_b {1}}%
-\def\XINT_iiprd:_b #1#2,{\expandafter\XINT_iiprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_iiprd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_iiprd:_d\fi #1}%
-\def\XINT_iiprd:_d #1,#2{\expandafter\XINT_iiprd:_b\expandafter
- {\romannumeral0\xintiimul {#2}{#1}}}%
-\let\xintPrd:csv\xintiiPrd:csv
+\def\xintiiE {\romannumeral0\xintiie }% used in \xintMod.
+\def\xintiie #1#2%
+ {\expandafter\XINT_iie\the\numexpr #2\expandafter.\expandafter{\romannumeral-`0#1}}%
+\def\XINT_iie #1.#2{\ifnum#1>\xint_c_ \xint_dothis{\xint_dsh {#2}{-#1}}\fi
+ \xint_orthat{ #2}}%
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -17642,18 +19157,18 @@ $1$ or $-1$.
%
% \section{Package \xintbinhexnameimp implementation}
% \label{sec:binheximp}
-%
-% The commenting is currently (\docdate) very sparse.
-%
+%
% \localtableofcontents
+%
+% The commenting is currently (\xintdocdate) very sparse.
+%
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the master \xintname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -17667,10 +19182,9 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintbinhex.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -17683,72 +19197,36 @@ $1$ or $-1$.
\aftergroup\endinput
\else
\ifx\x\relax % plain-TeX, first loading of xintbinhex.sty
- \ifx\w\relax % but xint.sty not yet loaded.
- \y{xintbinhex}{now issuing \string\input\space xint.sty}%
- \def\z{\endgroup\input xint.sty\relax}%
+ \ifx\w\relax % but xintcore.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xint.sty not yet loaded.
- \y{xintbinhex}{now issuing \string\RequirePackage{xint}}%
- \def\z{\endgroup\RequirePackage{xint}}%
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
\fi
\else
- \y{xintbinhex}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintbinhex already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintbinhex}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintbinhex}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2014/04/01 v1.09n Expandable binary and hexadecimal conversions (jfB)]%
+ [2014/10/28 v1.1 Expandable binary and hexadecimal conversions (jfB)]%
% \end{macrocode}
% \subsection{Constants, etc...}
% \lverb!v1.08!
% \begin{macrocode}
\chardef\xint_c_xvi 16
-% \chardef\xint_c_ii^v 32 % already done in xint.sty
-% \chardef\xint_c_ii^vi 64 % already done in xint.sty
+% \chardef\xint_c_ii^v 32 % already in xint.sty
+% \chardef\xint_c_ii^vi 64 % already in xint.sty
\chardef\xint_c_ii^vii 128
\mathchardef\xint_c_ii^viii 256
\mathchardef\xint_c_ii^xii 4096
@@ -17756,19 +19234,19 @@ $1$ or $-1$.
\newcount\xint_c_ii^xvi \xint_c_ii^xvi 65536
\newcount\xint_c_x^v \xint_c_x^v 100000
\newcount\xint_c_x^ix \xint_c_x^ix 1000000000
-\def\XINT_tmpa #1{%
+\def\XINT_tmpa #1{\ifx\relax#1\else
\expandafter\edef\csname XINT_sdth_#1\endcsname
{\ifcase #1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or
- 8\or 9\or A\or B\or C\or D\or E\or F\fi}}%
-\xintApplyInline\XINT_tmpa
- {{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}}%
-\def\XINT_tmpa #1{%
+ 8\or 9\or A\or B\or C\or D\or E\or F\fi}%
+ \expandafter\XINT_tmpa\fi }%
+\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax
+\def\XINT_tmpa #1{\ifx\relax#1\else
\expandafter\edef\csname XINT_sdtb_#1\endcsname
- {\ifcase #1
+ {\ifcase #1
0000\or 0001\or 0010\or 0011\or 0100\or 0101\or 0110\or 0111\or
- 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\fi}}%
-\xintApplyInline\XINT_tmpa
- {{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}}%
+ 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\fi}%
+ \expandafter\XINT_tmpa\fi }%
+\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax
\let\XINT_tmpa\relax
\expandafter\def\csname XINT_sbtd_0000\endcsname {0}%
\expandafter\def\csname XINT_sbtd_0001\endcsname {1}%
@@ -17889,30 +19367,30 @@ $1$ or $-1$.
#2\XINT_dtbh_II_ci
#3\XINT_dtbh_II_cii
\W\XINT_dtbh_II_ciii #1#2#3#4%
-}%
+}%
\def\XINT_dtbh_II_c \W\XINT_dtbh_II_ci
\W\XINT_dtbh_II_cii
\W\XINT_dtbh_II_ciii \W\W\W\W {{}}%
-\def\XINT_dtbh_II_ci #1\XINT_dtbh_II_ciii #2\W\W\W
+\def\XINT_dtbh_II_ci #1\XINT_dtbh_II_ciii #2\W\W\W
{\XINT_dtbh_II_d {}{#2}{0}}%
-\def\XINT_dtbh_II_cii\W\XINT_dtbh_II_ciii #1#2\W\W
+\def\XINT_dtbh_II_cii\W\XINT_dtbh_II_ciii #1#2\W\W
{\XINT_dtbh_II_d {}{#1#2}{00}}%
\def\XINT_dtbh_II_ciii #1#2#3\W
{\XINT_dtbh_II_d {}{#1#2#3}{000}}%
\def\XINT_dtbh_I_a #1#2#3.%
{%
\xint_gob_til_Z #3\XINT_dtbh_I_z\Z
- \expandafter\XINT_dtbh_I_b\the\numexpr #2+#30000.{#1}%
+ \expandafter\XINT_dtbh_I_b\the\numexpr #2+#30000.{#1}%
}%
\def\XINT_dtbh_I_b #1.%
{%
- \expandafter\XINT_dtbh_I_c\the\numexpr
+ \expandafter\XINT_dtbh_I_c\the\numexpr
(#1+\xint_c_ii^xv)/\xint_c_ii^xvi-\xint_c_i.#1.%
}%
\def\XINT_dtbh_I_c #1.#2.%
{%
- \expandafter\XINT_dtbh_I_d\expandafter
- {\the\numexpr #2-\xint_c_ii^xvi*#1}{#1}%
+ \expandafter\XINT_dtbh_I_d\expandafter
+ {\the\numexpr #2-\xint_c_ii^xvi*#1}{#1}%
}%
\def\XINT_dtbh_I_d #1#2#3{\XINT_dtbh_I_a {#3#1.}{#2}}%
\def\XINT_dtbh_I_z\Z\expandafter\XINT_dtbh_I_b\the\numexpr #1+#2.%
@@ -17925,17 +19403,17 @@ $1$ or $-1$.
\def\XINT_dtbh_II_d #1#2#3#4.%
{%
\xint_gob_til_Z #4\XINT_dtbh_II_z\Z
- \expandafter\XINT_dtbh_II_e\the\numexpr #2+#4#3.{#1}{#3}%
+ \expandafter\XINT_dtbh_II_e\the\numexpr #2+#4#3.{#1}{#3}%
}%
\def\XINT_dtbh_II_e #1.%
{%
- \expandafter\XINT_dtbh_II_f\the\numexpr
+ \expandafter\XINT_dtbh_II_f\the\numexpr
(#1+\xint_c_ii^xv)/\xint_c_ii^xvi-\xint_c_i.#1.%
}%
\def\XINT_dtbh_II_f #1.#2.%
{%
- \expandafter\XINT_dtbh_II_g\expandafter
- {\the\numexpr #2-\xint_c_ii^xvi*#1}{#1}%
+ \expandafter\XINT_dtbh_II_g\expandafter
+ {\the\numexpr #2-\xint_c_ii^xvi*#1}{#1}%
}%
\def\XINT_dtbh_II_g #1#2#3{\XINT_dtbh_II_d {#3#1.}{#2}}%
\def\XINT_dtbh_II_z\Z\expandafter\XINT_dtbh_II_e\the\numexpr #1+#2.%
@@ -17957,16 +19435,16 @@ $1$ or $-1$.
{\the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\expandafter}%
\romannumeral-`0\expandafter\XINT_smallhex\expandafter
{\the\numexpr
- #1-((#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i)*\xint_c_ii^viii}%
+ #1-((#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i)*\xint_c_ii^viii}%
}%
-\def\XINT_dth_end\Z\expandafter\XINT_dth_III\expandafter #1#2\T
+\def\XINT_dth_end\Z\expandafter\XINT_dth_III\expandafter #1#2\T
{%
\XINT_dth_end_b #1%
}%
\def\XINT_dth_end_b #1.{\XINT_dth_end_c }%
\def\XINT_dth_end_c #1{\xint_gob_til_zero #1\XINT_dth_end_d 0\space #1}%
\def\XINT_dth_end_d 0\space 0#1%
-{%
+{%
\xint_gob_til_zero #1\XINT_dth_end_e 0\space #1%
}%
\def\XINT_dth_end_e 0\space 0#1%
@@ -17986,9 +19464,9 @@ $1$ or $-1$.
{\the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\expandafter}%
\romannumeral-`0\expandafter\XINT_smallbin\expandafter
{\the\numexpr
- #1-((#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i)*\xint_c_ii^viii}%
+ #1-((#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i)*\xint_c_ii^viii}%
}%
-\def\XINT_dtb_end\Z\expandafter\XINT_dtb_III\expandafter #1#2\T
+\def\XINT_dtb_end\Z\expandafter\XINT_dtb_III\expandafter #1#2\T
{%
\XINT_dtb_end_b #1%
}%
@@ -18030,10 +19508,10 @@ $1$ or $-1$.
#2\XINT_htd_II_ci
#3\XINT_htd_II_cii
\W\XINT_htd_II_ciii #1#2#3#4%
-}%
+}%
\def\XINT_htd_II_c \W\XINT_htd_II_ci
\W\XINT_htd_II_cii
- \W\XINT_htd_II_ciii \W\W\W\W #1\Z\Z\Z\Z\T
+ \W\XINT_htd_II_ciii \W\W\W\W #1\Z\Z\Z\Z\T
{%
\expandafter\xint_cleanupzeros_andstop
\romannumeral0\XINT_rord_main {}#1%
@@ -18042,22 +19520,22 @@ $1$ or $-1$.
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_relax
}%
-\def\XINT_htd_II_ci #1\XINT_htd_II_ciii
+\def\XINT_htd_II_ci #1\XINT_htd_II_ciii
#2\W\W\W {\XINT_htd_II_d {}{"#2}{\xint_c_xvi}}%
-\def\XINT_htd_II_cii\W\XINT_htd_II_ciii
+\def\XINT_htd_II_cii\W\XINT_htd_II_ciii
#1#2\W\W {\XINT_htd_II_d {}{"#1#2}{\xint_c_ii^viii}}%
\def\XINT_htd_II_ciii #1#2#3\W {\XINT_htd_II_d {}{"#1#2#3}{\xint_c_ii^xii}}%
\def\XINT_htd_I_a #1#2#3#4#5#6%
{%
\xint_gob_til_Z #3\XINT_htd_I_end_a\Z
\expandafter\XINT_htd_I_b\the\numexpr
- #2+\xint_c_ii^xvi*#6#5#4#3+\xint_c_x^ix\relax {#1}%
+ #2+\xint_c_ii^xvi*#6#5#4#3+\xint_c_x^ix\relax {#1}%
}%
\def\XINT_htd_I_b 1#1#2#3#4#5#6#7#8#9{\XINT_htd_I_c {#1#2#3#4#5}{#9#8#7#6}}%
\def\XINT_htd_I_c #1#2#3{\XINT_htd_I_a {#3#2}{#1}}%
\def\XINT_htd_I_end_a\Z\expandafter\XINT_htd_I_b\the\numexpr #1+#2\relax
-{%
- \expandafter\XINT_htd_I_end_b\the\numexpr \xint_c_x^v+#1\relax
+{%
+ \expandafter\XINT_htd_I_end_b\the\numexpr \xint_c_x^v+#1\relax
}%
\def\XINT_htd_I_end_b 1#1#2#3#4#5%
{%
@@ -18076,13 +19554,13 @@ $1$ or $-1$.
{%
\xint_gob_til_Z #4\XINT_htd_II_end_a\Z
\expandafter\XINT_htd_II_e\the\numexpr
- #2+#3*#7#6#5#4+\xint_c_x^viii\relax {#1}{#3}%
+ #2+#3*#7#6#5#4+\xint_c_x^viii\relax {#1}{#3}%
}%
\def\XINT_htd_II_e 1#1#2#3#4#5#6#7#8{\XINT_htd_II_f {#1#2#3#4}{#5#6#7#8}}%
\def\XINT_htd_II_f #1#2#3{\XINT_htd_II_d {#2#3}{#1}}%
\def\XINT_htd_II_end_a\Z\expandafter\XINT_htd_II_e
\the\numexpr #1+#2\relax #3#4\T
-{%
+{%
\XINT_htd_II_end_b #1#3%
}%
\edef\XINT_htd_II_end_b #1#2#3#4#5#6#7#8%
@@ -18115,7 +19593,7 @@ $1$ or $-1$.
\def\XINT_btd_II_a #1\W\XINT_btd_I_a #2#3{\XINT_btd_II_b #1}%
\def\XINT_btd_II_b #1#2#3#4#5#6#7#8%
{%
- \xint_gob_til_W
+ \xint_gob_til_W
#1\XINT_btd_II_c
#2\XINT_btd_II_ci
#3\XINT_btd_II_cii
@@ -18165,13 +19643,13 @@ $1$ or $-1$.
{%
\xint_gob_til_Z #4\XINT_btd_II_end_a\Z
\expandafter\XINT_btd_II_e\the\numexpr
- #2+(\xint_c_x^ix+#3*#9#8#7#6#5#4)\relax {#1}{#3}%
+ #2+(\xint_c_x^ix+#3*#9#8#7#6#5#4)\relax {#1}{#3}%
}%
\def\XINT_btd_II_e 1#1#2#3#4#5#6#7#8#9{\XINT_btd_II_f {#1#2#3}{#4#5#6#7#8#9}}%
\def\XINT_btd_II_f #1#2#3{\XINT_btd_II_d {#2#3}{#1}}%
\def\XINT_btd_II_end_a\Z\expandafter\XINT_btd_II_e
\the\numexpr #1+(#2\relax #3#4\T
-{%
+{%
\XINT_btd_II_end_b #1#3%
}%
\edef\XINT_btd_II_end_b #1#2#3#4#5#6#7#8#9%
@@ -18182,14 +19660,14 @@ $1$ or $-1$.
{%
\xint_gob_til_Z #3\XINT_btd_I_end_a\Z
\expandafter\XINT_btd_I_b\the\numexpr
- #2+\xint_c_ii^viii*#8#7#6#5#4#3+\xint_c_x^ix\relax {#1}%
+ #2+\xint_c_ii^viii*#8#7#6#5#4#3+\xint_c_x^ix\relax {#1}%
}%
\def\XINT_btd_I_b 1#1#2#3#4#5#6#7#8#9{\XINT_btd_I_c {#1#2#3}{#9#8#7#6#5#4}}%
\def\XINT_btd_I_c #1#2#3{\XINT_btd_I_a {#3#2}{#1}}%
\def\XINT_btd_I_end_a\Z\expandafter\XINT_btd_I_b
\the\numexpr #1+\xint_c_ii^viii #2\relax
-{%
- \expandafter\XINT_btd_I_end_b\the\numexpr 1000+#1\relax
+{%
+ \expandafter\XINT_btd_I_end_b\the\numexpr 1000+#1\relax
}%
\def\XINT_btd_I_end_b 1#1#2#3%
{%
@@ -18283,7 +19761,7 @@ $1$ or $-1$.
{%
\XINT_num_loop #2#1%
\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
}%
% \end{macrocode}
% \subsection{\csh{xintCHexToBin}}
@@ -18326,9 +19804,9 @@ $1$ or $-1$.
{%
\XINT_chtb_end_b #1%
\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
}%
-\def\XINT_chtb_end_b #1\W#2\W#3\W#4\W#5\W#6\W#7\W#8\W\endcsname
+\def\XINT_chtb_end_b #1\W#2\W#3\W#4\W#5\W#6\W#7\W#8\W\endcsname
{%
\XINT_num_loop
}%
@@ -18344,22 +19822,22 @@ $1$ or $-1$.
%
% \section{Package \xintgcdnameimp implementation}
% \label{sec:gcdimp}
-%
-% The commenting is currently (\docdate) very sparse. Release |1.09h| has
+%
+% \localtableofcontents
+%
+% The commenting is currently (\xintdocdate) 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}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the master \xintname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -18373,10 +19851,9 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintgcd.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -18389,69 +19866,33 @@ $1$ or $-1$.
\aftergroup\endinput
\else
\ifx\x\relax % plain-TeX, first loading of xintgcd.sty
- \ifx\w\relax % but xint.sty not yet loaded.
- \y{xintgcd}{now issuing \string\input\space xint.sty}%
- \def\z{\endgroup\input xint.sty\relax}%
+ \ifx\w\relax % but xintcore.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xint.sty not yet loaded.
- \y{xintgcd}{now issuing \string\RequirePackage{xint}}%
- \def\z{\endgroup\RequirePackage{xint}}%
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
\fi
\else
- \y{xintgcd}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintgcd already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintgcd}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintgcd}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2014/04/01 v1.09n Euclide algorithm with xint package (jfB)]%
+ [2014/10/28 v1.1 Euclide algorithm with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintGCD}}
% The macros of |1.09a| benefits from the |\xintnum| which has been inserted
-% inside |\xintiabs| in \xintname;
+% inside |\xintiabs| in \xintnameimp;
% this is a little overhead but is more convenient for the
% user and also makes it easier to use into |\xintexpr|essions.
% \begin{macrocode}
@@ -18492,27 +19933,14 @@ $1$ or $-1$.
\expandafter\expandafter\expandafter
\XINT_gcd_CheckRem
\expandafter\xint_secondoftwo
- \romannumeral0\XINT_div_prepare {#1}{#2}\Z
+ \romannumeral0\XINT_div_prepare {#1}{#2}\Z
{#1}%
}%
% \end{macrocode}
-% \subsection{\csh{xintGCDof}}
-% \lverb|New with 1.09a. I also tried an optimization (not working two by two)
-% which I thought was clever but
-% it seemed to be less efficient ...|
-% \begin{macrocode}
-\def\xintGCDof {\romannumeral0\xintgcdof }%
-\def\xintgcdof #1{\expandafter\XINT_gcdof_a\romannumeral-`0#1\relax }%
-\def\XINT_gcdof_a #1{\expandafter\XINT_gcdof_b\romannumeral-`0#1\Z }%
-\def\XINT_gcdof_b #1\Z #2{\expandafter\XINT_gcdof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_gcdof_c #1{\xint_gob_til_relax #1\XINT_gcdof_e\relax\XINT_gcdof_d #1}%
-\def\XINT_gcdof_d #1\Z {\expandafter\XINT_gcdof_b\romannumeral0\xintgcd {#1}}%
-\def\XINT_gcdof_e #1\Z #2\Z { #2}%
-% \end{macrocode}
% \subsection{\csh{xintLCM}}
% \lverb|New with 1.09a. Inadvertent use of \xintiQuo which was promoted at the
% same time to add the \xintnum overhead. So with 1.09f \xintiiQuo without the
-% overhead.|
+% overhead.|
% \begin{macrocode}
\def\xintLCM {\romannumeral0\xintlcm}%
\def\xintlcm #1%
@@ -18537,17 +19965,6 @@ $1$ or $-1$.
\def\XINT_lcm_BisZero #1#2#3#4#5{ 0}%
\def\XINT_lcm_notzero #1#2#3{\xintiimul {#2}{\xintiiQuo{#3}{#1}}}%
% \end{macrocode}
-% \subsection{\csh{xintLCMof}}
-% \lverb|New with 1.09a|
-% \begin{macrocode}
-\def\xintLCMof {\romannumeral0\xintlcmof }%
-\def\xintlcmof #1{\expandafter\XINT_lcmof_a\romannumeral-`0#1\relax }%
-\def\XINT_lcmof_a #1{\expandafter\XINT_lcmof_b\romannumeral-`0#1\Z }%
-\def\XINT_lcmof_b #1\Z #2{\expandafter\XINT_lcmof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_lcmof_c #1{\xint_gob_til_relax #1\XINT_lcmof_e\relax\XINT_lcmof_d #1}%
-\def\XINT_lcmof_d #1\Z {\expandafter\XINT_lcmof_b\romannumeral0\xintlcm {#1}}%
-\def\XINT_lcmof_e #1\Z #2\Z { #2}%
-% \end{macrocode}
% \subsection{\csh{xintBezout}}
% \lverb|1.09a inserts use of \xintnum|
% \begin{macrocode}
@@ -18584,7 +20001,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% attention première entrée doit être ici (-1)^n donc 1$\
+% attention première entrée doit être ici (-1)^n donc 1$\
% #4#2 = 0 = A, B = #3#1|
% \begin{macrocode}
\def\XINT_bezout_firstiszero #1#2#3#4#5#6%
@@ -18676,9 +20093,9 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% n = 0: 1BAalpha(0)beta(0)alpha(-1)beta(-1)$\
+% n = 0: 1BAalpha(0)beta(0)alpha(-1)beta(-1)$\
% n général:
-% {(-1)^n}{r(n-1)}{r(n-2)}{alpha(n-1)}{beta(n-1)}{alpha(n-2)}{beta(n-2)}$\
+% {(-1)^n}{r(n-1)}{r(n-2)}{alpha(n-1)}{beta(n-1)}{alpha(n-2)}{beta(n-2)}$\
% #2 = B, #3 = A|
% \begin{macrocode}
\def\XINT_bezout_loop_a #1#2#3%
@@ -18692,7 +20109,7 @@ $1$ or $-1$.
% Le q(n) a ici une existence éphémère, dans le version Bezout Algorithm
% il faudra le conserver. On voudra à la fin
% {{q(n)}{r(n)}{alpha(n)}{beta(n)}}.
-% De plus ce n'est plus (-1)^n que l'on veut mais n. (ou dans un autre ordre)$\
+% De plus ce n'est plus (-1)^n que l'on veut mais n. (ou dans un autre ordre)$\
% {-(-1)^n}{q(n)}{r(n)}{r(n-1)}{alpha(n-1)}{beta(n-1)}{alpha(n-2)}{beta(n-2)}|
% \begin{macrocode}
\def\XINT_bezout_loop_b #1#2#3#4#5#6#7#8%
@@ -18720,7 +20137,7 @@ $1$ or $-1$.
% \end{macrocode}
% \lverb|r(n)\Z {(-1)^(n+1)}{r(n-1)}{alpha(n)}{beta(n)}{alpha(n-1)}{beta(n-1)}|
% \begin{macrocode}
-\def\XINT_bezout_loop_e #1#2\Z
+\def\XINT_bezout_loop_e #1#2\Z
{%
\xint_gob_til_zero #1\xint_bezout_loop_exit0\XINT_bezout_loop_f
{#1#2}%
@@ -18754,8 +20171,8 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintEuclideAlgorithm}}
% \lverb|&
-% Pour Euclide:
-% {N}{A}{D=r(n)}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}$\
+% Pour Euclide:
+% {N}{A}{D=r(n)}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}$\
% u<2n> = u<2n+3>u<2n+2> + u<2n+4> à la n ième étape|
% \begin{macrocode}
\def\xintEuclideAlgorithm {\romannumeral0\xinteuclidealgorithm }%
@@ -18783,15 +20200,15 @@ $1$ or $-1$.
% \lverb|&
% Le {} pour protéger {{A}{B}} si on s'arrête après une étape (B divise
% A).
-% On va renvoyer:$\
+% On va renvoyer:$\
% {N}{A}{D=r(n)}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}|
% \begin{macrocode}
\def\XINT_euc_AisZero #1#2#3#4#5#6{ {1}{0}{#2}{#2}{0}{0}}%
\def\XINT_euc_BisZero #1#2#3#4#5#6{ {1}{0}{#3}{#3}{0}{0}}%
% \end{macrocode}
% \lverb|&
-% {n}{rn}{an}{{qn}{rn}}...{{A}{B}}{}\Z$\
-% a(n) = r(n-1). Pour n=0 on a juste {0}{B}{A}{{A}{B}}{}\Z$\
+% {n}{rn}{an}{{qn}{rn}}...{{A}{B}}{}\Z$\
+% a(n) = r(n-1). Pour n=0 on a juste {0}{B}{A}{{A}{B}}{}\Z$\
% \XINT_div_prepare {u}{v} divise v par u|
% \begin{macrocode}
\def\XINT_euc_a #1#2#3%
@@ -18808,10 +20225,10 @@ $1$ or $-1$.
\XINT_euc_c #3\Z {#1}{#3}{#4}{{#2}{#3}}%
}%
% \end{macrocode}
-% \lverb|r(n+1)\Z {n+1}{r(n+1)}{r(n)}{{q(n+1)}{r(n+1)}}{{qn}{rn}}...$\
+% \lverb|r(n+1)\Z {n+1}{r(n+1)}{r(n)}{{q(n+1)}{r(n+1)}}{{qn}{rn}}...$\
% Test si r(n+1) est nul.|
% \begin{macrocode}
-\def\XINT_euc_c #1#2\Z
+\def\XINT_euc_c #1#2\Z
{%
\xint_gob_til_zero #1\xint_euc_end0\XINT_euc_a
}%
@@ -18819,7 +20236,7 @@ $1$ or $-1$.
% \lverb|&
% {n+1}{r(n+1)}{r(n)}{{q(n+1)}{r(n+1)}}...{}\Z
% Ici r(n+1) = 0. On arrête on se prépare à inverser
-% {n+1}{0}{r(n)}{{q(n+1)}{r(n+1)}}.....{{q1}{r1}}{{A}{B}}{}\Z$\
+% {n+1}{0}{r(n)}{{q(n+1)}{r(n+1)}}.....{{q1}{r1}}{{A}{B}}{}\Z$\
% On veut renvoyer: {N=n+1}{A}{D=r(n)}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}|
% \begin{macrocode}
\def\xint_euc_end0\XINT_euc_a #1#2#3#4\Z%
@@ -18839,9 +20256,9 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintBezoutAlgorithm}}
% \lverb|&
-% Pour Bezout: objectif, renvoyer$\
-% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
-% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}$\
+% Pour Bezout: objectif, renvoyer$\
+% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
+% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}$\
% alpha0=1, beta0=0, alpha(-1)=0, beta(-1)=1|
% \begin{macrocode}
\def\xintBezoutAlgorithm {\romannumeral0\xintbezoutalgorithm }%
@@ -18907,8 +20324,8 @@ $1$ or $-1$.
\XINT_bezalg_e #4\Z {#2}{#4}{#5}{#1}{#6}{#7}{#8}{{#3}{#4}{#1}{#6}}%
}%
% \end{macrocode}
-% \lverb|r(n+1)\Z {n+1}{r(n+1)}{r(n)}{alpha(n+1)}{beta(n+1)}$\
-% {alpha(n)}{beta(n)}{q,r,alpha,beta(n+1)}$\
+% \lverb|r(n+1)\Z {n+1}{r(n+1)}{r(n)}{alpha(n+1)}{beta(n+1)}$\
+% {alpha(n)}{beta(n)}{q,r,alpha,beta(n+1)}$\
% Test si r(n+1) est nul.|
% \begin{macrocode}
\def\XINT_bezalg_e #1#2\Z
@@ -18917,14 +20334,14 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% Ici r(n+1) = 0. On arrête on se prépare à inverser.$\
-% {n+1}{r(n+1)}{r(n)}{alpha(n+1)}{beta(n+1)}{alpha(n)}{beta(n)}$\
-% {q,r,alpha,beta(n+1)}...{{A}{B}}{}\Z$\
-% On veut renvoyer$\
-% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
+% Ici r(n+1) = 0. On arrête on se prépare à inverser.$\
+% {n+1}{r(n+1)}{r(n)}{alpha(n+1)}{beta(n+1)}{alpha(n)}{beta(n)}$\
+% {q,r,alpha,beta(n+1)}...{{A}{B}}{}\Z$\
+% On veut renvoyer$\
+% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}|
% \begin{macrocode}
-\def\xint_bezalg_end0\XINT_bezalg_a #1#2#3#4#5#6#7#8\Z
+\def\xint_bezalg_end0\XINT_bezalg_a #1#2#3#4#5#6#7#8\Z
{%
\expandafter\xint_bezalg_end_
\romannumeral0%
@@ -18936,10 +20353,10 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \lverb|&
-% {N}{D}{A}{B}{q1}{r1}{alpha1=q1}{beta1=1}{q2}{r2}{alpha2}{beta2}$\
-% ....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}$\
-% On veut renvoyer$\
-% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
+% {N}{D}{A}{B}{q1}{r1}{alpha1=q1}{beta1=1}{q2}{r2}{alpha2}{beta2}$\
+% ....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}$\
+% On veut renvoyer$\
+% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}|
% \begin{macrocode}
\edef\xint_bezalg_end_ #1#2#3#4%
@@ -18947,26 +20364,58 @@ $1$ or $-1$.
\space {#1}{#3}{0}{1}{#2}{#4}{1}{0}%
}%
% \end{macrocode}
+% \subsection{\csh{xintGCDof}}
+% \lverb|New with 1.09a. I also tried an optimization (not working two by two)
+% which I thought was clever but
+% it seemed to be less efficient ...|
+% \begin{macrocode}
+\def\xintGCDof {\romannumeral0\xintgcdof }%
+\def\xintgcdof #1{\expandafter\XINT_gcdof_a\romannumeral-`0#1\relax }%
+\def\XINT_gcdof_a #1{\expandafter\XINT_gcdof_b\romannumeral-`0#1\Z }%
+\def\XINT_gcdof_b #1\Z #2{\expandafter\XINT_gcdof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_gcdof_c #1{\xint_gob_til_relax #1\XINT_gcdof_e\relax\XINT_gcdof_d #1}%
+\def\XINT_gcdof_d #1\Z {\expandafter\XINT_gcdof_b\romannumeral0\xintgcd {#1}}%
+\def\XINT_gcdof_e #1\Z #2\Z { #2}%
+% \end{macrocode}
+% \subsection{\csh{xintLCMof}}
+% \lverb|New with 1.09a|
+% \begin{macrocode}
+\def\xintLCMof {\romannumeral0\xintlcmof }%
+\def\xintlcmof #1{\expandafter\XINT_lcmof_a\romannumeral-`0#1\relax }%
+\def\XINT_lcmof_a #1{\expandafter\XINT_lcmof_b\romannumeral-`0#1\Z }%
+\def\XINT_lcmof_b #1\Z #2{\expandafter\XINT_lcmof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_lcmof_c #1{\xint_gob_til_relax #1\XINT_lcmof_e\relax\XINT_lcmof_d #1}%
+\def\XINT_lcmof_d #1\Z {\expandafter\XINT_lcmof_b\romannumeral0\xintlcm {#1}}%
+\def\XINT_lcmof_e #1\Z #2\Z { #2}%
+% \end{macrocode}
% \subsection{\csh{xintTypesetEuclideAlgorithm}}
% \lverb|&
% TYPESETTING
%
-% Organisation:
+% Organisation:
%
-% {N}{A}{D}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}$\
+% {N}{A}{D}{B}{q1}{r1}{q2}{r2}{q3}{r3}....{qN}{rN=0}$\
% \U1 = N = nombre d'étapes, \U3 = PGCD, \U2 = A, \U4=B
% q1 = \U5, q2 = \U7 --> qn = \U<2n+3>, rn = \U<2n+4>
% bn = rn. B = r0. A=r(-1)
%
-% r(n-2) = q(n)r(n-1)+r(n) (n e étape)
+% 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)
%
% 1.09h uses \xintloop, and \par rather than \endgraf; and \par rather than
-% \hfill\break|
+% \hfill\break|
% \begin{macrocode}
-\def\xintTypesetEuclideAlgorithm #1#2%
+\def\xintTypesetEuclideAlgorithm {%
+ \unless\ifdefined\xintAssignArray
+ \errmessage
+ {xintgcd: package xinttools is required for \string\xintTypesetEuclideAlgorithm}%
+ \expandafter\xint_gobble_iii
+ \fi
+ \XINT_TypesetEuclideAlgorithm
+}%
+\def\XINT_TypesetEuclideAlgorithm #1#2%
{% l'algo remplace #1 et #2 par |#1| et |#2|
\par
\begingroup
@@ -18988,19 +20437,27 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintTypesetBezoutAlgorithm}}
% \lverb|&
-% Pour Bezout on a:
-% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
+% Pour Bezout on a:
+% {N}{A}{0}{1}{D=r(n)}{B}{1}{0}{q1}{r1}{alpha1=q1}{beta1=1}$\
% {q2}{r2}{alpha2}{beta2}....{qN}{rN=0}{alphaN=A/D}{betaN=B/D}%
% Donc 4N+8 termes:
-% 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$\
+% 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
%
% 1.09h uses \xintloop, and \par rather than \endgraf; and no more \parindent0pt
-% |
+% |
% \begin{macrocode}
-\def\xintTypesetBezoutAlgorithm #1#2%
+\def\xintTypesetBezoutAlgorithm {%
+ \unless\ifdefined\xintAssignArray
+ \errmessage
+ {xintgcd: package xinttools is required for \string\xintTypesetBezoutAlgorithm}%
+ \expandafter\xint_gobble_iii
+ \fi
+ \XINT_TypesetBezoutAlgorithm
+}%
+\def\XINT_TypesetBezoutAlgorithm #1#2%
{%
\par
\begingroup
@@ -19017,7 +20474,7 @@ $1$ or $-1$.
${} = \BEZ{4*\count255 + 5}
\times \BEZ{4*\count255 + 3}
+ \BEZ{4*\count255 - 1}$\hfill\break
- \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +8}$}%
+ \hbox to \wd 0 {\hfil$\BEZ{4*\count255 +8}$}%
${} = \BEZ{4*\count255 + 5}
\times \BEZ{4*\count255 + 4}
+ \BEZ{4*\count255 }$
@@ -19036,24 +20493,6 @@ $1$ or $-1$.
\par
\endgroup
}%
-% \end{macrocode}
-% \subsection{\csh{xintGCDof:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintGCDof:csv #1{\expandafter\XINT_gcdof:_b\romannumeral-`0#1,,}%
-\def\XINT_gcdof:_b #1,#2,{\expandafter\XINT_gcdof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_gcdof:_d\fi #1}%
-\def\XINT_gcdof:_d #1,{\expandafter\XINT_gcdof:_b\romannumeral0\xintgcd {#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintLCMof:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintLCMof:csv #1{\expandafter\XINT_lcmof:_a\romannumeral-`0#1,,}%
-\def\XINT_lcmof:_a #1,#2,{\expandafter\XINT_lcmof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_lcmof:_d\fi #1}%
-\def\XINT_lcmof:_d #1,{\expandafter\XINT_lcmof:_a\romannumeral0\xintlcm {#1}}%
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -19066,18 +20505,18 @@ $1$ or $-1$.
%
% \section{Package \xintfracnameimp implementation}
% \label{sec:fracimp}
-%
-% The commenting is currently (\docdate) very sparse.
%
% \localtableofcontents
+%
+% The commenting is currently (\xintdocdate) very sparse.
+%
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the master \xintname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -19091,7 +20530,6 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintfrac.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
@@ -19108,7 +20546,6 @@ $1$ or $-1$.
\else
\ifx\x\relax % plain-TeX, first loading of xintfrac.sty
\ifx\w\relax % but xint.sty not yet loaded.
- \y{xintfrac}{now issuing \string\input\space xint.sty}%
\def\z{\endgroup\input xint.sty\relax}%
\fi
\else
@@ -19116,58 +20553,35 @@ $1$ or $-1$.
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xint.sty not yet loaded.
- \y{xintfrac}{now issuing \string\RequirePackage{xint}}%
\def\z{\endgroup\RequirePackage{xint}}%
\fi
\else
- \y{xintfrac}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintfrac already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintfrac}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintfrac}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2014/04/01 v1.09n Expandable operations on fractions (jfB)]%
+ [2014/10/28 v1.1 Expandable operations on fractions (jfB)]%
\chardef\xint_c_xviii 18
% \end{macrocode}
+% \subsection{\csh{XINT_cntSgnFork}}
+% \lverb|1.09i. Used internally, #1 must expand to \m@ne, \z@, or \@ne or
+% equivalent. Does not insert a space token to stop a romannumeral0 expansion.|
+% \begin{macrocode}
+\def\XINT_cntSgnFork #1%
+{%
+ \ifcase #1\expandafter\xint_secondofthree
+ \or\expandafter\xint_thirdofthree
+ \else\expandafter\xint_firstofthree
+ \fi
+}%
+% \end{macrocode}
% \subsection{\csh{xintLen}}
% \begin{macrocode}
\def\xintLen {\romannumeral0\xintlen }%
@@ -19181,12 +20595,12 @@ $1$ or $-1$.
\the\numexpr -1+\XINT_Abs {#1}+\XINT_Len {#2}+\XINT_Len {#3}\relax
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_lenrord\_loop}}
+% \subsection{\csh{XINT_lenrord_loop}}
% \begin{macrocode}
-\def\XINT_lenrord_loop #1#2#3#4#5#6#7#8#9%
+\def\XINT_lenrord_loop #1#2#3#4#5#6#7#8#9%
{% faire \romannumeral-`0\XINT_lenrord_loop 0{}#1\Z\W\W\W\W\W\W\W\Z
\xint_gob_til_W #9\XINT_lenrord_W\W
- \expandafter\XINT_lenrord_loop\expandafter
+ \expandafter\XINT_lenrord_loop\expandafter
{\the\numexpr #1+7}{#9#8#7#6#5#4#3#2}%
}%
\def\XINT_lenrord_W\W\expandafter\XINT_lenrord_loop\expandafter #1#2#3\Z
@@ -19199,7 +20613,7 @@ $1$ or $-1$.
}%
\def\XINT_lenrord_Y #1#2#3#4#5#6#7#8\T
{%
- \xint_gob_til_W
+ \xint_gob_til_W
#7\XINT_lenrord_Z \xint_c_viii
#6\XINT_lenrord_Z \xint_c_vii
#5\XINT_lenrord_Z \xint_c_vi
@@ -19213,7 +20627,7 @@ $1$ or $-1$.
\expandafter{\the\numexpr #3-#1\relax}%
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_outfrac}}
+% \subsection{\csh{XINT_outfrac}}
% \lverb|&
% 1.06a version now outputs 0/1[0] and not 0[0] in case of zero. More generally
% all macros have been checked in xintfrac, xintseries, xintcfrac, to make sure
@@ -19221,7 +20635,13 @@ $1$ or $-1$.
% \xintJrr, \xintRawWithZeros)
%
% The problem with statements like those in the previous paragraph is that it is
-% hard to maintain consistencies across relases. |
+% hard to maintain consistencies across relases.
+%
+% Months later (2014/10/22): perhaps I should document what this macro does
+% before I forget? from {e}{N}{D} it output N/D[e], checking in passing if
+% D=0 or if N=0. It also makes sure D is not < 0. I am not sure but I don't
+% think there is any place in the code which could call \XINT_outfrac with a D
+% < 0, but I should check.|
% \begin{macrocode}
\def\XINT_outfrac #1#2#3%
{%
@@ -19230,7 +20650,7 @@ $1$ or $-1$.
\or
\expandafter \XINT_outfrac_P
\else
- \expandafter \XINT_outfrac_N
+ \expandafter \XINT_outfrac_N
\fi
{#2}{#3}[#1]%
}%
@@ -19253,9 +20673,12 @@ $1$ or $-1$.
\expandafter\XINT_outfrac_P\expandafter {#2}{#1}%
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_inFrac}}
+% \subsection{\csh{XINT_inFrac}}
% \lverb|Extended in 1.07 to accept scientific notation on input. With lowercase
-% e only. The \xintexpr parser does accept uppercase E also.|
+% e only. The \xintexpr parser does accept uppercase E also. Ah, by the way,
+% perhaps I should at least say what this macro does? (belated addition
+% 2014/10/22...), before I forget! It prepares the fraction in the internal
+% format {exponent}{Numerator}{Denominator} where Denominator is at least 1.|
% \begin{macrocode}
\def\XINT_inFrac {\romannumeral0\XINT_infrac }%
\def\XINT_infrac #1%
@@ -19270,16 +20693,16 @@ $1$ or $-1$.
\krof
#1[#2#3]#4%
}%
-\def\XINT_infrac_A #1[\W]\T
+\def\XINT_infrac_A #1[\W]\T
{%
- \XINT_frac #1/\W\Z
+ \XINT_frac #1/\W\Z
}%
\def\XINT_infrac_B #1%
{%
\xint_gob_til_zero #1\XINT_infrac_Zero0\XINT_infrac_BB #1%
}%
\def\XINT_infrac_BB #1[\W]\T {\XINT_infrac_BC #1/\W\Z }%
-\def\XINT_infrac_BC #1/#2#3\Z
+\def\XINT_infrac_BC #1/#2#3\Z
{%
\xint_UDwfork
#2\XINT_infrac_BCa
@@ -19291,7 +20714,7 @@ $1$ or $-1$.
\def\XINT_infrac_BCb #1[#2]/\W\Z #3\Z { {#2}{#3}{#1}}%
\def\XINT_infrac_Zero #1\T { {0}{0}{1}}%
% \end{macrocode}
-% \subsection{\csh{XINT\_frac}}
+% \subsection{\csh{XINT_frac}}
% \lverb|Extended in 1.07 to recognize and accept scientific notation both at
% the numerator and (possible) denominator. Only a lowercase e will do here, but
% uppercase E is possible within an \xintexpr..\relax |
@@ -19348,7 +20771,7 @@ $1$ or $-1$.
#3\Z #1\Z
}%
\def\XINT_frac_Ca \Z #1\Z {\XINT_frac_D {0}{#1}}%
-\def\XINT_frac_Cb #1.\W\Z #2\Z
+\def\XINT_frac_Cb #1.\W\Z #2\Z
{%
\expandafter\XINT_frac_D\expandafter
{\romannumeral0\xintlength {#1}}{#2#1}%
@@ -19387,7 +20810,7 @@ $1$ or $-1$.
\def\XINT_frac_H #1#2{ {#2}{#1}}%
\def\XINT_frac_Gpos #1\Z #2#3{ {#3}{#2}{#1}}%
% \end{macrocode}
-% \subsection{\csh{XINT\_factortens}, \csh{XINT\_cuz\_cnt}}
+% \subsection{\csh{XINT_factortens}, \csh{XINT_cuz_cnt}}
% \begin{macrocode}
\def\XINT_factortens #1%
{%
@@ -19452,7 +20875,7 @@ $1$ or $-1$.
\xint_gob_til_zero #1\expandafter\XINT_cuz_cnt_loop\xint_gob_til_Z
0\XINT_cuz_cnt_stopa #1%
}%
-\def\XINT_cuz_cnt_stopa #1\Z
+\def\XINT_cuz_cnt_stopa #1\Z
{%
\XINT_cuz_cnt_stopb #1\R\R\R\R\R\R\R\R\Z %
}%
@@ -19485,7 +20908,7 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintRaw}}
% \lverb|&
-% 1.07: this macro simply prints in a user readable form the fraction after its
+% 1.07: this macro simply prints in a user readable form the fraction after its
% initial scanning. Useful when put inside braces in an \xintexpr, when the
% input is not yet in the A/B[n] form.|
% \begin{macrocode}
@@ -19497,9 +20920,7 @@ $1$ or $-1$.
\def\XINT_raw #1#2#3{ #2/#3[#1]}%
% \end{macrocode}
% \subsection{\csh{xintPRaw}}
-% \lverb|&
-% 1.09b: these [n]'s and especially the possible /1 are truly annoying at
-% times.|
+% \lverb|1.09b|
% \begin{macrocode}
\def\xintPRaw {\romannumeral0\xintpraw }%
\def\xintpraw
@@ -19540,7 +20961,7 @@ $1$ or $-1$.
\expandafter\XINT_rawz_A
\else
\expandafter\XINT_rawz_Ba
- \fi
+ \fi
{#1}%
}%
\def\XINT_rawz_A #1#2#3{\xint_dsh {#2}{-#1}/#3}%
@@ -19549,23 +20970,29 @@ $1$ or $-1$.
\def\XINT_rawz_Bb #1#2{ #2/#1}%
% \end{macrocode}
% \subsection{\csh{xintFloor}}
-% \lverb|1.09a|
+% \lverb|1.09a, 1.1 for \xintiFloor/\xintFloor. Not efficient if big negative
+% decimal exponent. Also sub-efficient if big positive decimal exponent.|
% \begin{macrocode}
\def\xintFloor {\romannumeral0\xintfloor }%
-\def\xintfloor #1{\expandafter\XINT_floor
- \romannumeral0\xintrawwithzeros {#1}.}%
-\def\XINT_floor #1/#2.{\xintiiquo {#1}{#2}}%
+\def\xintfloor #1% devrais-je faire \xintREZ?
+ {\expandafter\XINT_ifloor \romannumeral0\xintrawwithzeros {#1}./1[0]}%
+\def\xintiFloor {\romannumeral0\xintifloor }%
+\def\xintifloor #1%
+ {\expandafter\XINT_ifloor \romannumeral0\xintrawwithzeros {#1}.}%
+\def\XINT_ifloor #1/#2.{\xintiiquo {#1}{#2}}%
% \end{macrocode}
% \subsection{\csh{xintCeil}}
% \lverb|1.09a|
% \begin{macrocode}
\def\xintCeil {\romannumeral0\xintceil }%
\def\xintceil #1{\xintiiopp {\xintFloor {\xintOpp{#1}}}}%
+\def\xintiCeil {\romannumeral0\xinticeil }%
+\def\xinticeil #1{\xintiiopp {\xintiFloor {\xintOpp{#1}}}}%
% \end{macrocode}
% \subsection{\csh{xintNumerator}}
% \begin{macrocode}
\def\xintNumerator {\romannumeral0\xintnumerator }%
-\def\xintnumerator
+\def\xintnumerator
{%
\expandafter\XINT_numer\romannumeral0\XINT_infrac
}%
@@ -19577,7 +21004,7 @@ $1$ or $-1$.
\expandafter\XINT_numer_A
\else
\expandafter\XINT_numer_B
- \fi
+ \fi
{#1}%
}%
\def\XINT_numer_A #1#2#3{\xint_dsh {#2}{-#1}}%
@@ -19586,7 +21013,7 @@ $1$ or $-1$.
% \subsection{\csh{xintDenominator}}
% \begin{macrocode}
\def\xintDenominator {\romannumeral0\xintdenominator }%
-\def\xintdenominator
+\def\xintdenominator
{%
\expandafter\XINT_denom\romannumeral0\XINT_infrac
}%
@@ -19598,7 +21025,7 @@ $1$ or $-1$.
\expandafter\XINT_denom_A
\else
\expandafter\XINT_denom_B
- \fi
+ \fi
{#1}%
}%
\def\XINT_denom_A #1#2#3{ #3}%
@@ -19613,11 +21040,11 @@ $1$ or $-1$.
}%
\def\XINT_fracfrac_A #1{\XINT_fracfrac_B #1\Z }%
\catcode`^=7
-\def\XINT_fracfrac_B #1#2\Z
+\def\XINT_fracfrac_B #1#2\Z
{%
\xint_gob_til_zero #1\XINT_fracfrac_C 0\XINT_fracfrac_D {10^{#1#2}}%
}%
-\def\XINT_fracfrac_C 0\XINT_fracfrac_D #1#2#3%
+\def\XINT_fracfrac_C 0\XINT_fracfrac_D #1#2#3%
{%
\if1\XINT_isOne {#3}%
\xint_afterfi {\expandafter\xint_firstoftwo_thenstop\xint_gobble_ii }%
@@ -19657,7 +21084,7 @@ $1$ or $-1$.
}%
\def\XINT_sgnfrac_N
{%
- \expandafter\xint_minus_thenstop\romannumeral0\XINT_sgnfrac_P
+ \expandafter\xint_minus_thenstop\romannumeral0\XINT_sgnfrac_P
}%
% \end{macrocode}
% \subsection{\csh{xintFwOver}}
@@ -19668,12 +21095,12 @@ $1$ or $-1$.
\expandafter\XINT_fwover_A\romannumeral0\XINT_infrac {#1}%
}%
\def\XINT_fwover_A #1{\XINT_fwover_B #1\Z }%
-\def\XINT_fwover_B #1#2\Z
+\def\XINT_fwover_B #1#2\Z
{%
\xint_gob_til_zero #1\XINT_fwover_C 0\XINT_fwover_D {10^{#1#2}}%
}%
\catcode`^=11
-\def\XINT_fwover_C #1#2#3#4#5%
+\def\XINT_fwover_C #1#2#3#4#5%
{%
\if0\XINT_isOne {#5}\xint_afterfi { {#4\over #5}}%
\else\xint_afterfi { #4}%
@@ -19711,7 +21138,7 @@ $1$ or $-1$.
}%
\def\XINT_sgnfwover_N
{%
- \expandafter\xint_minus_thenstop\romannumeral0\XINT_sgnfwover_P
+ \expandafter\xint_minus_thenstop\romannumeral0\XINT_sgnfwover_P
}%
% \end{macrocode}
% \subsection{\csh{xintREZ}}
@@ -19735,7 +21162,7 @@ $1$ or $-1$.
}%
\def\XINT_rez_zero #1\Z #2#3{ 0/1[0]}%
\def\XINT_rez_neg {\expandafter\xint_minus_thenstop\romannumeral0\XINT_rez_B }%
-\def\XINT_rez_B #1\Z
+\def\XINT_rez_B #1\Z
{%
\expandafter\XINT_rez_C\romannumeral0\XINT_factortens {#1}%
}%
@@ -19750,9 +21177,9 @@ $1$ or $-1$.
}%
\def\XINT_rez_E #1#2#3{ #3/#2[#1]}%
% \end{macrocode}
-% \subsection{\csh{xintE}}
+% \subsection{\csh{xintE}, \csh{xintFloatE}, \csh{XINTinFloatE}}
% \lverb|1.07: The fraction is the first argument contrarily to \xintTrunc and
-% \xintRound.
+% \xintRound.
%
% \xintfE (1.07) and \xintiE (1.09i) are for \xintexpr and cousins. It is quite
% annoying that \numexpr does not know how to deal correctly with a minus sign -
@@ -19765,13 +21192,17 @@ $1$ or $-1$.
% 1.09i also adds \xintFloatE and modifies \XINTinFloatfE, although currently
% the latter is only used from \xintfloatexpr hence always with \XINTdigits, it
% comes equipped with its first argument withing brackets as the other
-% \XINTinFloat... macros.
+% \XINTinFloat... macros.
%
% 1.09m ceases here and elsewhere, also in \xintcfracname, to use \Z as
% delimiter in the code for the optional argument, as this is unsafe (it
% makes impossible to the user to employ \Z as argument to the macro).
% Replaced by \xint_relax. 1.09e had already done that in \xintSeq, but
-% this should have been systematic. |
+% this should have been systematic.
+%
+% 1.1 modifies and moves \xintiiE to xint.sty, and cleans up some unneeded
+% stuff, now that expressions implement scientific notation directly at the
+% number parsing level.|
% \begin{macrocode}
\def\xintE {\romannumeral0\xinte }%
\def\xinte #1%
@@ -19783,15 +21214,6 @@ $1$ or $-1$.
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+#4}{#2}{#3}%
}%
\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
-\def\xintfE {\romannumeral0\xintfe }%
-\def\xintfe #1%
-{%
- \expandafter\XINT_fe \romannumeral0\XINT_infrac {#1}%
-}%
-\def\XINT_fe #1#2#3#4%
-{%
- \expandafter\XINT_e_end\expandafter{\the\numexpr #1+\xintNum{#4}}{#2}{#3}%
-}%
\def\xintFloatE {\romannumeral0\xintfloate }%
\def\xintfloate #1{\XINT_floate_chkopt #1\xint_relax }%
\def\XINT_floate_chkopt #1%
@@ -19816,33 +21238,17 @@ $1$ or $-1$.
\expandafter\xint_exchangetwo_keepbraces\expandafter
{\the\numexpr #2+#5}{#1}{#3}{#4}\XINT_float_Q
}%
-\def\XINTinFloatfE {\romannumeral0\XINTinfloatfe }%
-\def\XINTinfloatfe [#1]#2%
-{%
- \expandafter\XINT_infloatfe_a\expandafter
- {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
-}%
-\def\XINT_infloatfe_a #1#2#3#4#5%
-{%
- \expandafter\expandafter\expandafter\XINT_infloat_a
- \expandafter\xint_exchangetwo_keepbraces\expandafter
- {\the\numexpr #2+\xintNum{#5}}{#1}{#3}{#4}\XINT_infloat_Q
-}%
-\def\xintiE {\romannumeral0\xintie }% for \xintiiexpr only
-\def\xintie #1%
-{%
- \expandafter\XINT_ie \romannumeral0\XINT_infrac {#1}% allows 3.123e3
-}%
-\def\XINT_ie #1#2#3#4% assumes #3=1 and uses \xint_dsh with its \numexpr
-{%
- \xint_dsh {#2}{0-(#1+#4)}% could have \xintNum{#4} for a bit more general
-}%
+\def\XINTinFloatE {\romannumeral0\XINTinfloate }%
+\def\XINTinfloate {\expandafter\XINT_infloate\romannumeral0\XINTinfloat [\XINTdigits]}%
+\def\XINT_infloate #1[#2]#3%
+ {\expandafter\XINT_infloate_end\expandafter {\the\numexpr #3+#2}{#1}}%
+\def\XINT_infloate_end #1#2{ #2[#1]}%
% \end{macrocode}
% \subsection{\csh{xintIrr}}
% \lverb|&
-% 1.04 fixes a buggy \xintIrr {0}.
+% 1.04 fixes a buggy \xintIrr {0}.
% 1.05 modifies the initial parsing and post-processing to use \xintrawwithzeros
-% and to
+% and to
% more quickly deal with an input denominator equal to 1. 1.08 version does
% not remove a /1 denominator.|
% \begin{macrocode}
@@ -19856,12 +21262,12 @@ $1$ or $-1$.
\if0\XINT_isOne {#3}%
\xint_afterfi
{\xint_UDsignfork
- #1\XINT_irr_negative
- -{\XINT_irr_nonneg #1}%
+ #1\XINT_irr_negative
+ -{\XINT_irr_nonneg #1}%
\krof}%
\else
\xint_afterfi{\XINT_irr_denomisone #1}%
- \fi
+ \fi
#2\Z {#3}%
}%
\def\XINT_irr_denomisone #1\Z #2{ #1/1}% changed in 1.08
@@ -19870,11 +21276,11 @@ $1$ or $-1$.
\def\XINT_irr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\XINT_irr_indeterminate
- #30\XINT_irr_divisionbyzero
- #10\XINT_irr_zero
+ #3#1\XINT_irr_indeterminate
+ #30\XINT_irr_divisionbyzero
+ #10\XINT_irr_zero
00\XINT_irr_loop_a
- \krof
+ \krof
{#3#4}{#1#2}{#3#4}{#1#2}%
}%
\def\XINT_irr_indeterminate #1#2#3#4#5{\xintError:NaN\space 0/0}%
@@ -19887,7 +21293,7 @@ $1$ or $-1$.
}%
\def\XINT_irr_loop_d #1#2%
{%
- \XINT_irr_loop_e #2\Z
+ \XINT_irr_loop_e #2\Z
}%
\def\XINT_irr_loop_e #1#2\Z
{%
@@ -19905,34 +21311,16 @@ $1$ or $-1$.
}%
\def\XINT_irr_finish #1#2#3{#3#1/#2}% changed in 1.08
% \end{macrocode}
-% \subsection{\csh{xintNum}}
-% \lverb|&
-% This extension of the xint original xintNum is added in 1.05, as a
-% synonym to
-% \xintIrr, but raising an error when the input does not evaluate to an integer.
-% Usable with not too much overhead on integer input as \xintIrr
-% checks quickly for a denominator equal to 1 (which will be put there by the
-% \XINT_infrac called by \xintrawwithzeros). This way, macros such as \xintQuo
-% can be
-% modified with minimal overhead to accept fractional input as long as it
-% evaluates to an integer. |
-% \begin{macrocode}
-\def\xintNum {\romannumeral0\xintnum }%
-\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}\Z }%
-\edef\XINT_intcheck #1/#2\Z
-{%
- \noexpand\if 0\noexpand\XINT_isOne {#2}\noexpand\xintError:NotAnInteger
- \noexpand\fi\space #1%
-}%
-% \end{macrocode}
% \subsection{\csh{xintifInt}}
-% \lverb|1.09e. xintfrac.sty only.|
+% \lverb|1.09e. xintfrac.sty only.
+% Nota bene (22/06/14) I just don't understand
+% why this went through the costly xintIrr overhead !! shame on the author.|
% \begin{macrocode}
-\def\xintifInt {\romannumeral0\xintifint }%
-\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintirr {#1}\Z }%
-\def\XINT_ifint #1/#2\Z
+\def\xintifInt {\romannumeral0\xintifint }%
+\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintrawwithzeros {#1}.}%
+\def\XINT_ifint #1/#2.%
{%
- \if\XINT_isOne {#2}1%
+ \if 0\xintiiRem {#1}{#2}%
\expandafter\xint_firstoftwo_thenstop
\else
\expandafter\xint_secondoftwo_thenstop
@@ -19953,12 +21341,12 @@ $1$ or $-1$.
{%
\if0\XINT_isOne {#3}\xint_afterfi
{\xint_UDsignfork
- #1\XINT_jrr_negative
- -{\XINT_jrr_nonneg #1}%
+ #1\XINT_jrr_negative
+ -{\XINT_jrr_nonneg #1}%
\krof}%
\else
\xint_afterfi{\XINT_jrr_denomisone #1}%
- \fi
+ \fi
#2\Z {#3}%
}%
\def\XINT_jrr_denomisone #1\Z #2{ #1/1}% changed in 1.08
@@ -19967,11 +21355,11 @@ $1$ or $-1$.
\def\XINT_jrr_D #1#2\Z #3#4\Z
{%
\xint_UDzerosfork
- #3#1\XINT_jrr_indeterminate
- #30\XINT_jrr_divisionbyzero
- #10\XINT_jrr_zero
+ #3#1\XINT_jrr_indeterminate
+ #30\XINT_jrr_divisionbyzero
+ #10\XINT_jrr_zero
00\XINT_jrr_loop_a
- \krof
+ \krof
{#3#4}{#1#2}1001%
}%
\def\XINT_jrr_indeterminate #1#2#3#4#5#6#7{\xintError:NaN\space 0/0}%
@@ -20016,47 +21404,47 @@ $1$ or $-1$.
% fact such a thing for each rounding function, trunc, round, floor, ceil. |
% \begin{macrocode}
\def\xintTFrac {\romannumeral0\xinttfrac }%
-\def\xinttfrac #1%
- {\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
+\def\xinttfrac #1{\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
\def\XINT_tfrac_fork #1%
{%
\xint_UDzerominusfork
#1-\XINT_tfrac_zero
- 0#1\XINT_tfrac_N
- 0-{\XINT_tfrac_P #1}%
+ 0#1{\xintiiopp\XINT_tfrac_P }%
+ 0-{\XINT_tfrac_P #1}%
\krof
}%
\def\XINT_tfrac_zero #1\Z { 0/1[0]}%
-\def\XINT_tfrac_N {\expandafter\XINT_opp\romannumeral0\XINT_tfrac_P }%
-\def\XINT_tfrac_P #1/#2\Z
-{%
- \expandafter\XINT_rez_AB\romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}%
-}%
+\def\XINT_tfrac_P #1/#2\Z {\expandafter\XINT_rez_AB
+ \romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}}%
% \end{macrocode}
% \subsection{\csh{XINTinFloatFrac}}
% \lverb|1.09i, for frac in \xintfloatexpr. This version computes
% exactly from the input the fractional part and then only converts it
% into a float with the asked-for number of digits. I will have to think
-% it again some day, certainly. |
+% it again some day, certainly.
+%
+% 1.1 removes possibility of optional argument, for technical reasons having
+% to do with \xintNewExpr.|
% \begin{macrocode}
-\def\XINTinFloatFrac {\romannumeral0\XINTinfloatfrac }%
+\def\XINTinFloatFrac {\romannumeral0\XINTinfloatfrac [\XINTdigits]}%
\def\XINTinfloatfrac [#1]#2%
{%
- \expandafter\XINT_infloatfrac_a\expandafter
- {\romannumeral0\xinttfrac{#2}}{#1}%
+ \expandafter\XINT_infloatfrac_a\expandafter {\romannumeral0\xinttfrac{#2}}{#1}%
}%
\def\XINT_infloatfrac_a #1#2{\XINTinFloat [#2]{#1}}%
% \end{macrocode}
% \subsection{\csh{xintTrunc}, \csh{xintiTrunc}}
% \lverb|&
-% Modified in 1.06 to give the first argument to a \numexpr.
+% Modified in 1.06 to give the first argument to a \numexpr.
%
% 1.09f fixes the overhead added in 1.09a to some inner routines when \xintiquo
% was redefined to use \xintnum. Now uses \xintiiquo, rather.
%
% 1.09j: minor improvements, \XINT_trunc_E was very strange and defined two
% never occuring branches; also, optimizes the call to the division routine, and
-% the zero loops.|
+% the zero loops.
+%
+% 1.1 adds \xintTTrunc as a shortcut to what \xintiTrunc 0 does, and maps \xintNum to it.|
% \begin{macrocode}
\def\xintTrunc {\romannumeral0\xinttrunc }%
\def\xintiTrunc {\romannumeral0\xintitrunc }%
@@ -20085,7 +21473,7 @@ $1$ or $-1$.
\expandafter\XINT_trunc_checkifzero
\expandafter{\the\numexpr #1+#4}#2\Z {#3}%
}%
-\def\XINT_trunc_checkifzero #1#2#3\Z
+\def\XINT_trunc_checkifzero #1#2#3\Z
{%
\xint_gob_til_zero #2\XINT_trunc_iszero0\XINT_trunc_B {#1}{#2#3}%
}%
@@ -20098,7 +21486,7 @@ $1$ or $-1$.
\expandafter\XINT_trunc_D
\else
\expandafter\XINT_trunc_C
- \fi
+ \fi
{#1}%
}%
\def\XINT_trunc_C #1#2#3%
@@ -20109,7 +21497,7 @@ $1$ or $-1$.
\def\XINT_trunc_CE #1#2{\XINT_trunc_E #2.{#1}}%
\def\XINT_trunc_D #1#2%
{%
- \expandafter\XINT_trunc_E
+ \expandafter\XINT_trunc_E
\romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {#2}.%
}%
\def\XINT_trunc_E #1%
@@ -20117,7 +21505,7 @@ $1$ or $-1$.
\xint_UDsignfork
#1\XINT_trunc_Fneg
-{\XINT_trunc_Fpos #1}%
- \krof
+ \krof
}%
\def\XINT_trunc_Fneg #1.#2{\expandafter\xint_firstoftwo_thenstop
\romannumeral0\XINT_div_prepare {#2}{#1}\Z \xint_minus_thenstop}%
@@ -20153,8 +21541,41 @@ $1$ or $-1$.
\def\XINT_trunc_Hb #1#2#3%
{%
\expandafter #3\expandafter0\expandafter.%
- \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {}#2% #1=-0 autorisé !
+ \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {}#2% #1=-0 autoris\'e !
+}%
+% \end{macrocode}
+% \subsection{\csh{xintTTrunc}}
+% \lverb|1.1, a tiny bit more efficient than doing \xintiTrunc0. I map \xintNum
+% to it, and I use it in \xintexpr for various things. Faster I guess than the \xintiFloor.|
+% \begin{macrocode}
+\def\xintTTrunc {\romannumeral0\xintttrunc }%
+\def\xintttrunc #1%
+{%
+ \expandafter\XINT_itrunc_G
+ \romannumeral0\expandafter\XINT_ttrunc_A
+ \romannumeral0\XINT_infrac {#1}0% this last 0 to let \XINT_itrunc_G be happy
}%
+\def\XINT_ttrunc_A #1#2#3{\XINT_trunc_checkifzero {#1}#2\Z {#3}}%
+% \end{macrocode}
+% \subsection{\csh{xintNum}}
+% \lverb|This extension of the xint original xintNum is added in 1.05, as a
+% synonym to \xintIrr, but raising an error when the input does not evaluate to
+% an integer. Usable with not too much overhead on integer input as \xintIrr
+% checks quickly for a denominator equal to 1 (which will be put there by the
+% \XINT_infrac called by \xintrawwithzeros). This way, macros such as \xintQuo
+% can be modified with minimal overhead to accept fractional input as long as
+% it evaluates to an integer.
+%
+% 22 june 2014 (1.1) I just don't understand what was the point of going through
+% \xintIrr if to raise an arror afterwards... and raising errors is silly, so
+% let's do it sanely at last. In between I added \xintiFloor, thus, let's just
+% let it to it.
+%
+% 24 october 2014, just before releasing 1.1 (I left it taking dust since
+% June...), I did \xintTTrunc, and will map \xintNum to it|
+% \begin{macrocode}
+\let\xintNum \xintTTrunc
+\let\xintnum \xintttrunc
% \end{macrocode}
% \subsection{\csh{xintRound}, \csh{xintiRound}}
% \lverb|Modified in 1.06 to give the first argument to a \numexpr.|
@@ -20190,8 +21611,8 @@ $1$ or $-1$.
\xint_relax
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- \Z
+ \xint_relax
+ \Z
}%
\def\XINT_round_C #1%
{%
@@ -20206,13 +21627,13 @@ $1$ or $-1$.
\xint_gob_til_Z #1\XINT_round_Daz\Z \XINT_round_Da #1%
}%
\def\XINT_round_Daz\Z \XINT_round_Da \Z { 0\Z }%
-\def\XINT_round_Da #1\Z
+\def\XINT_round_Da #1\Z
{%
\XINT_rord_main {}#1%
\xint_relax
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax \Z
+ \xint_relax \Z
}%
\def\XINT_round_Dba #1%
{%
@@ -20225,7 +21646,7 @@ $1$ or $-1$.
}%
% \end{macrocode}
% \subsection{\csh{xintXTrunc}}
-% \lverb|1.09j [2014/01/06] This is completely expandable but not f-expandable.
+% \lverb@1.09j [2014/01/06] This is completely expandable but not f-expandable.
% Designed be used inside an \edef or a \write, if one is interested in getting
% tens of thousands of digits from the decimal expansion of some fraction... it
% is not worth using it rather than \xintTrunc if for less than *hundreds* of
@@ -20258,11 +21679,11 @@ $1$ or $-1$.
% D-|N| last digits from Q, etc.. we compare D-|N| with the length M of Q etc...
% (well in this last, very uncommon, branch, I stopped trying to optimize things
% and I even do an \xintnum to ensure a 0 if something comes out empty from
-% \xintDecSplit).|
+% \xintDecSplit).@
% \begin{macrocode}
\def\xintXTrunc #1#2%
{%
- \expandafter\XINT_xtrunc_a\expandafter
+ \expandafter\XINT_xtrunc_a\expandafter
{\the\numexpr #1\expandafter}\romannumeral0\xintraw {#2}%
}%
\def\XINT_xtrunc_a #1%
@@ -20305,7 +21726,7 @@ $1$ or $-1$.
\def\XINT_xtrunc_N {-\XINT_xtrunc_P }%
\def\XINT_xtrunc_P #1.#2%
{%
- \ifnum #2<\xint_c_
+ \ifnum #2<\xint_c_
\expandafter\XINT_xtrunc_negN_Q
\else
\expandafter\XINT_xtrunc_Q
@@ -20316,7 +21737,7 @@ $1$ or $-1$.
\expandafter\XINT_xtrunc_negN_R
\romannumeral0\XINT_div_prepare {#3}{#2}{#3}{#1}{#4}%
}%
-% #1=Q, #2=R, #3=B, #4=N<0, #5=D
+% #1=Q, #2=R, #3=B, #4=N<0, #5=D
\def\XINT_xtrunc_negN_R #1#2#3#4#5%
{%
\expandafter\XINT_xtrunc_negN_S\expandafter
@@ -20343,7 +21764,7 @@ $1$ or $-1$.
{\romannumeral0\expandafter\expandafter\expandafter
\XINT_xtrunc_unlock\expandafter\string
\csname\XINT_xtrunc_b {#1}#4/#5[0]\expandafter\endcsname
- \expandafter}\expandafter
+ \expandafter}\expandafter
{\the\numexpr\xintLength{#6}-#2}{#6}%
}%
\def\XINT_xtrunc_negNB #1#2#3{\XINT_xtrunc_negNC {#2}{#3}#1}%
@@ -20372,14 +21793,14 @@ $1$ or $-1$.
{\romannumeral0\xintnum{\xintDecSplitL {-#1}{#6}}}{#3}%
}%
\def\XINT_xtrunc_negNX #1#2%
-{%
+{%
\expandafter\XINT_xtrunc_negNC\expandafter
{\the\numexpr\xintLength {#1}-#2}{#1}%
}%
\def\XINT_xtrunc_Q #1%
{%
\expandafter\XINT_xtrunc_prepare_I
- \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z
+ \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z
}%
\def\XINT_xtrunc_prepare_I #1.#2#3%
{%
@@ -20414,14 +21835,14 @@ $1$ or $-1$.
}%
\def\XINT_xtrunc_BisTwo #1#2#3#4#5#6#7%
{%
- \xintHalf {#5}.\ifodd\xintiiLDg{#5} 5\else 0\fi
+ \xintHalf {#5}.\ifodd\xintiiLDg{#5} 5\else 0\fi
\romannumeral0\expandafter\XINT_dsx_zeroloop\expandafter
{\the\numexpr #7-\xint_c_i}{}\Z {}%
\xintiloop [#6+-1]
\ifnum \xintiloopindex>\xint_c_
0000000000000000000000000000000000000000000000000000000000000000%
\repeat
-}%
+}%
\def\XINT_xtrunc_prepareB_PaBa #1#2%
{%
\expandafter\XINT_xtrunc_Pa\expandafter
@@ -20449,7 +21870,7 @@ $1$ or $-1$.
\def\XINT_xtrunc_prepareB_e #1#2#3#4%
{%
\ifnum#3=\xint_c_iv\expandafter\XINT_xtrunc_prepareLittleB_f
- \else\expandafter\XINT_xtrunc_prepareB_f
+ \else\expandafter\XINT_xtrunc_prepareB_f
\fi
#4#1{#3}{#2}{#1}%
}%
@@ -20471,7 +21892,7 @@ $1$ or $-1$.
\def\XINT_xtrunc_Pb #1#2#3#4{#1.\XINT_xtrunc_A {#4}{#2}{#3}}%
\def\XINT_xtrunc_A #1%
{%
- \unless\ifnum #1>\xint_c_ \XINT_xtrunc_transition\fi
+ \unless\ifnum #1>\xint_c_ \XINT_xtrunc_transition\fi
\expandafter\XINT_xtrunc_B\expandafter{\the\numexpr #1-\xint_c_i}%
}%
\def\XINT_xtrunc_B #1#2#3%
@@ -20521,7 +21942,7 @@ $1$ or $-1$.
% inputs having a big power of ten. Again some modifications in 1.08b
% for a better treatment of cases with long explicit numerators or
% denominators.
-%
+%
% Here again some inner macros used the \xintiquo with extra \xintnum overhead
% in 1.09a, 1.09f reinstalled use of \xintiiquo without this overhead.|
% \begin{macrocode}
@@ -20540,7 +21961,7 @@ $1$ or $-1$.
}%
\def\XINT_float_opt [\xint_relax #1]#2%
{%
- \expandafter\XINT_float_a\expandafter
+ \expandafter\XINT_float_a\expandafter
{\the\numexpr #1\expandafter}%
\romannumeral0\XINT_infrac {#2}\XINT_float_Q
}%
@@ -20699,6 +22120,61 @@ $1$ or $-1$.
}%
\def\XINT_float_Y #1#2{ #2e#1}%
% \end{macrocode}
+% \subsection{\csh{xintPFloat}}
+% \lverb|1.1|
+% \begin{macrocode}
+\def\xintPFloat {\romannumeral0\xintpfloat }%
+\def\xintpfloat #1{\XINT_pfloat_chkopt #1\xint_relax }%
+\def\XINT_pfloat_chkopt #1%
+{%
+ \ifx [#1\expandafter\XINT_pfloat_opt
+ \else\expandafter\XINT_pfloat_noopt
+ \fi #1%
+}%
+\def\XINT_pfloat_noopt #1\xint_relax
+{%
+ \expandafter\XINT_pfloat_a\expandafter\XINTdigits
+ \romannumeral0\XINTinfloat [\XINTdigits]{#1}%
+}%
+\def\XINT_pfloat_opt [\xint_relax #1]%#2%
+{%
+ \expandafter\XINT_pfloat_a\expandafter {\the\numexpr #1\expandafter}%
+ \romannumeral0\XINTinfloat [\numexpr #1\relax]%{#2}%
+}%
+\def\XINT_pfloat_a #1#2%
+{%
+ \xint_UDzerominusfork
+ #2-\XINT_pfloat_zero
+ 0#2\XINT_pfloat_neg
+ 0-{\XINT_pfloat_pos #2}%
+ \krof {#1}%
+}%
+\def\XINT_pfloat_zero #1[#2]{ 0}%
+\def\XINT_pfloat_neg
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_pfloat_pos {}}%
+\def\XINT_pfloat_pos #1#2#3[#4]%
+{%
+ \ifnum#4>0 \xint_dothis\XINT_pfloat_no\fi
+ \ifnum#4>\numexpr-#2\relax \xint_dothis\XINT_pfloat_b\fi
+ \ifnum#4>\numexpr-#2-\xint_c_v\relax \xint_dothis\XINT_pfloat_B\fi
+ \xint_orthat\XINT_pfloat_no {#2}{#4}{#1#3}%
+}%
+\def\XINT_pfloat_no #1#2%
+{%
+ \expandafter\XINT_pfloat_no_b\expandafter{\the\numexpr #2+#1-\xint_c_i\relax}%
+}%
+\def\XINT_pfloat_no_b #1#2{\XINT_pfloat_no_c #2e#1}%
+\def\XINT_pfloat_no_c #1{ #1.}%
+\def\XINT_pfloat_b #1#2#3%
+ {\expandafter\XINT_pfloat_c
+ \romannumeral0\expandafter\XINT_split_fromleft_loop
+ \expandafter {\the\numexpr #1+#2-\xint_c_i}#3\W\W\W\W\W\W\W\W\Z }%
+\def\XINT_pfloat_c #1#2{ #1.#2}% #2 peut être vide
+\def\XINT_pfloat_B #1#2#3%
+ {\expandafter\XINT_pfloat_C
+ \romannumeral0\XINT_dsx_zeroloop {\numexpr -#1-#2}{}\Z {}#3}%
+\def\XINT_pfloat_C { 0.}%
+% \end{macrocode}
% \subsection{\csh{XINTinFloat}}
% \lverb|1.07. Completely rewritten in 1.08a for immensely greater efficiency
% when the power of ten is big: previous version had some very serious
@@ -20723,7 +22199,7 @@ $1$ or $-1$.
\def\XINTinFloat {\romannumeral0\XINTinfloat }%
\def\XINTinfloat [#1]#2%
{%
- \expandafter\XINT_infloat_a\expandafter
+ \expandafter\XINT_infloat_a\expandafter
{\the\numexpr #1\expandafter}%
\romannumeral0\XINT_infrac {#2}\XINT_infloat_Q
}%
@@ -20813,71 +22289,115 @@ $1$ or $-1$.
\def\XINT_infloat_X #1#2{ #2[#1]}%
% \end{macrocode}
% \subsection{\csh{xintAdd}}
+% \lverb|modified in v1.1. Et aussi 25 juin pour intercepter summand nul.|
% \begin{macrocode}
\def\xintAdd {\romannumeral0\xintadd }%
-\def\xintadd #1%
+\def\xintadd #1{\expandafter\xint_fadd\romannumeral0\xintraw {#1}}%
+\def\xint_fadd #1{\xint_gob_til_zero #1\XINT_fadd_Azero 0\XINT_fadd_a #1}%
+\def\XINT_fadd_Azero #1]{\xintraw }%
+\def\XINT_fadd_a #1/#2[#3]#4%
+ {\expandafter\XINT_fadd_b\romannumeral0\xintraw {#4}{#3}{#1}{#2}}%
+\def\XINT_fadd_b #1{\xint_gob_til_zero #1\XINT_fadd_Bzero 0\XINT_fadd_c #1}%
+\def\XINT_fadd_Bzero #1]#2#3#4{ #3/#4[#2]}%
+\def\XINT_fadd_c #1/#2[#3]#4%
{%
- \expandafter\xint_fadd\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fadd_Aa\expandafter{\the\numexpr #4-#3}{#3}{#4}{#1}{#2}%
}%
-\def\xint_fadd #1#2{\expandafter\XINT_fadd_A\romannumeral0\XINT_infrac{#2}#1}%
-\def\XINT_fadd_A #1#2#3#4%
+\def\XINT_fadd_Aa #1%
{%
- \ifnum #4 > #1
- \xint_afterfi {\XINT_fadd_B {#1}}%
+ \ifcase\XINT_cntSgn #1\Z
+ \expandafter\XINT_fadd_B
+ \or
+ \expandafter \XINT_fadd_Ba
\else
- \xint_afterfi {\XINT_fadd_B {#4}}%
- \fi
- {#1}{#4}{#2}{#3}%
+ \expandafter \XINT_fadd_Bb
+ \fi {#1}%
}%
-\def\XINT_fadd_B #1#2#3#4#5#6#7%
+\def\XINT_fadd_B #1#2#3#4#5#6#7{\XINT_fadd_C {#4}{#5}{#7}{#6}[#3]}%
+\def\XINT_fadd_Ba #1#2#3#4#5#6#7%
{%
\expandafter\XINT_fadd_C\expandafter
- {\romannumeral0\xintiimul {#7}{#5}}%
- {\romannumeral0\xintiiadd
- {\romannumeral0\xintiimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
- {\romannumeral0\xintiimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
- }%
- {#1}%
+ {\romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {#6}}%
+ {#7}{#5}{#4}[#2]%
+}%
+\def\XINT_fadd_Bb #1#2#3#4#5#6#7%
+{%
+ \expandafter\XINT_fadd_C\expandafter
+ {\romannumeral0\XINT_dsx_zeroloop {-#1}{}\Z {#4}}%
+ {#5}{#7}{#6}[#3]%
}%
\def\XINT_fadd_C #1#2#3%
{%
- \expandafter\XINT_fadd_D\expandafter {#2}{#3}{#1}%
+ \ifcase\romannumeral0\XINT_cmp_pre {#2}{#3} %<- intentional space here.
+ \expandafter\XINT_fadd_eq
+ \or\expandafter\XINT_fadd_D
+ \else\expandafter\XINT_fadd_Da
+ \fi {#2}{#3}{#1}%
}%
-\def\XINT_fadd_D #1#2{\XINT_outfrac {#2}{#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintSub}}
-% \begin{macrocode}
-\def\xintSub {\romannumeral0\xintsub }%
-\def\xintsub #1%
+\def\XINT_fadd_eq #1#2#3#4%#5%
{%
- \expandafter\xint_fsub\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {#3}{#4}/#1%[#5]%
}%
-\def\xint_fsub #1#2%
- {\expandafter\XINT_fsub_A\romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fsub_A #1#2#3#4%
+\def\XINT_fadd_D #1#2%
{%
- \ifnum #4 > #1
- \xint_afterfi {\XINT_fsub_B {#1}}%
- \else
- \xint_afterfi {\XINT_fsub_B {#4}}%
- \fi
- {#1}{#4}{#2}{#3}%
+ \expandafter\XINT_fadd_E\romannumeral0\XINT_div_prepare {#2}{#1}{#1}{#2}%
}%
-\def\XINT_fsub_B #1#2#3#4#5#6#7%
+\def\XINT_fadd_E #1#2%
{%
- \expandafter\XINT_fsub_C\expandafter
- {\romannumeral0\xintiimul {#7}{#5}}%
- {\romannumeral0\xintiisub
- {\romannumeral0\xintiimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
- {\romannumeral0\xintiimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
- }%
- {#1}%
+ \if0\XINT_Sgn #2\Z
+ \expandafter\XINT_fadd_F
+ \else\expandafter\XINT_fadd_K
+ \fi {#1}%
+}%
+\def\XINT_fadd_F #1#2#3#4#5%#6%
+{%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {\xintiiMul {#5}{#1}}{#4}/#2%[#6]%
+}%
+\def\XINT_fadd_Da #1#2%
+{%
+ \expandafter\XINT_fadd_Ea\romannumeral0\XINT_div_prepare {#1}{#2}{#1}{#2}%
+}%
+\def\XINT_fadd_Ea #1#2%
+{%
+ \if0\XINT_Sgn #2\Z
+ \expandafter\XINT_fadd_Fa
+ \else\expandafter\XINT_fadd_K
+ \fi {#1}%
+}%
+\def\XINT_fadd_Fa #1#2#3#4#5%#6%
+{%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {\xintiiMul {#4}{#1}}{#5}/#3%[#6]%
}%
-\def\XINT_fsub_C #1#2#3%
+\def\XINT_fadd_G #1{\if0#1\XINT_fadd_iszero\fi\space #1}%
+\def\XINT_fadd_K #1#2#3#4#5%
{%
- \expandafter\XINT_fsub_D\expandafter {#2}{#3}{#1}%
+ \expandafter\XINT_fadd_L
+ \romannumeral0\xintiiadd {\xintiiMul {#2}{#5}}{\xintiiMul {#3}{#4}}.%
+ {{#2}{#3}}%
}%
-\def\XINT_fsub_D #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fadd_L #1{\if0#1\XINT_fadd_iszero\fi \XINT_fadd_M #1}%
+\def\XINT_fadd_M #1.#2{\expandafter\XINT_fadd_N \expandafter
+ {\romannumeral0\xintiimul #2}{#1}}%
+\def\XINT_fadd_N #1#2{ #2/#1}%
+\edef\XINT_fadd_iszero\fi #1[#2]{\noexpand\fi\space 0/1[0]}% ou [#2] originel?
+% \end{macrocode}
+% \subsection{\csh{xintSub}}
+% \lverb|refait dans 1.1 pour vérifier si summands nuls.|
+% \begin{macrocode}
+\def\xintSub {\romannumeral0\xintsub }%
+\def\xintsub #1{\expandafter\xint_fsub\romannumeral0\xintraw {#1}}%
+\def\xint_fsub #1{\xint_gob_til_zero #1\XINT_fsub_Azero 0\XINT_fsub_a #1}%
+\def\XINT_fsub_Azero #1]{\xintopp }%
+\def\XINT_fsub_a #1/#2[#3]#4%
+ {\expandafter\XINT_fsub_b\romannumeral0\xintraw {#4}{#3}{#1}{#2}}%
+\def\XINT_fsub_b #1{\xint_UDzerominusfork
+ #1-\XINT_fadd_Bzero
+ 0#1\XINT_fadd_c
+ 0-{\XINT_fadd_c -#1}%
+ \krof }%
% \end{macrocode}
% \subsection{\csh{xintSum}}
% \begin{macrocode}
@@ -20902,35 +22422,43 @@ $1$ or $-1$.
\def\XINT_fsum_finished #1\Z #2{ #2}%
% \end{macrocode}
% \subsection{\csh{xintMul}}
+% \lverb|modif 1.1 25-juin-14 pour vérifier plus tôt si nul|
% \begin{macrocode}
\def\xintMul {\romannumeral0\xintmul }%
-\def\xintmul #1%
+\def\xintmul #1{\expandafter\xint_fmul\romannumeral0\xintraw {#1}.}%
+\def\xint_fmul #1{\xint_gob_til_zero #1\XINT_fmul_zero 0\XINT_fmul_a #1}%
+\def\XINT_fmul_a #1[#2].#3%
+ {\expandafter\XINT_fmul_b\romannumeral0\xintraw {#3}#1[#2.]}%
+\def\XINT_fmul_b #1{\xint_gob_til_zero #1\XINT_fmul_zero 0\XINT_fmul_c #1}%
+\def\XINT_fmul_c #1/#2[#3]#4/#5[#6.]%
{%
- \expandafter\xint_fmul\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fmul_d
+ \expandafter{\the\numexpr #3+#6\expandafter}%
+ \expandafter{\romannumeral0\xintiimul {#5}{#2}}%
+ {\romannumeral0\xintiimul {#4}{#1}}%
}%
-\def\xint_fmul #1#2%
- {\expandafter\XINT_fmul_A\romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fmul_A #1#2#3#4#5#6%
+\def\XINT_fmul_d #1#2#3%
{%
- \expandafter\XINT_fmul_B
- \expandafter{\the\numexpr #1+#4\expandafter}%
- \expandafter{\romannumeral0\xintiimul {#6}{#3}}%
- {\romannumeral0\xintiimul {#5}{#2}}%
+ \expandafter \XINT_fmul_e \expandafter{#3}{#1}{#2}%
}%
-\def\XINT_fmul_B #1#2#3%
-{%
- \expandafter \XINT_fmul_C \expandafter{#3}{#1}{#2}%
-}%
-\def\XINT_fmul_C #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fmul_e #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fmul_zero #1.#2{ 0/1[0]}%
% \end{macrocode}
% \subsection{\csh{xintSqr}}
+% \lverb|1.1 modifs comme xintMul|
% \begin{macrocode}
\def\xintSqr {\romannumeral0\xintsqr }%
-\def\xintsqr #1%
+\def\xintsqr #1{\expandafter\xint_fsqr\romannumeral0\xintraw {#1}}%
+\def\xint_fsqr #1{\xint_gob_til_zero #1\XINT_fsqr_zero 0\XINT_fsqr_a #1}%
+\def\xint_fsqr_a #1/#2[#3]%
{%
- \expandafter\xint_fsqr\expandafter{\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fsqr_b
+ \expandafter{\the\numexpr #3+#3\expandafter}%
+ \expandafter{\romannumeral0\xintiisqr {#2}}%
+ {\romannumeral0\xintiisqr {#1}}%
}%
-\def\xint_fsqr #1{\XINT_fmul_A #1#1}%
+\def\XINT_fsqr_b #1#2#3{\expandafter \XINT_fmul_e \expandafter{#3}{#1}{#2}}%
+\def\XINT_fsqr_zero #1]{ 0/1[0]}%
% \end{macrocode}
% \subsection{\csh{xintPow}}
% \lverb|&
@@ -20939,12 +22467,12 @@ $1$ or $-1$.
% With 1.07 and for use within the \xintexpr parser, we must allow
% fractions (which are integers in disguise) as input to the exponent, so we
% must have a variant which uses \xintNum and not only \numexpr
-% for normalizing the input. Hence the \xintfPow here.
+% for normalizing the input. Hence the \xintfPow here.
%
% 1.08b: well actually I
% think that with xintfrac.sty loaded the exponent should always be allowed to
% be a fraction giving an integer. So I do as for \xintFac, and remove here the
-% duplicated. Then \xintexpr can use the \xintPow as defined here.|
+% duplicated. Then \xintexpr can use the \xintPow as defined here.|
% \begin{macrocode}
\def\xintPow {\romannumeral0\xintpow }%
\def\xintpow #1%
@@ -20991,7 +22519,7 @@ $1$ or $-1$.
% to a fraction which is an integer in disguise; so we use \xintNum and not only
% \numexpr. Je modifie cela dans 1.08b, au lieu d'avoir un \xintfFac
% spécialement pour \xintexpr, tout simplement j'étends \xintFac comme les
-% autres macros, pour qu'elle utilise \xintNum. |
+% autres macros, pour qu'elle utilise \xintNum. |
% \begin{macrocode}
\def\xintFac {\romannumeral0\xintfac }%
\def\xintfac #1%
@@ -21044,12 +22572,82 @@ $1$ or $-1$.
}%
\def\XINT_fdiv_C #1#2{\XINT_outfrac {#2}{#1}}%
% \end{macrocode}
+% \subsection{\csh{xintDivFloor}}
+% \lverb|1.1|
+% \begin{macrocode}
+\def\xintDivFloor {\romannumeral0\xintdivfloor }%
+\def\xintdivfloor #1#2{\xintfloor{\xintDiv {#1}{#2}}}%
+% \end{macrocode}
+% \subsection{\csh{xintDivTrunc}}
+% \lverb|1.1|
+% \begin{macrocode}
+\def\xintDivTrunc {\romannumeral0\xintdivtrunc }%
+\def\xintdivtrunc #1#2{\xintitrunc 0{\xintDiv {#1}{#2}}}%
+% \end{macrocode}
+% \subsection{\csh{xintDivRound}}
+% \lverb|1.1|
+% \begin{macrocode}
+\def\xintDivRound {\romannumeral0\xintdivround }%
+\def\xintdivround #1#2{\xintiround 0{\xintDiv {#1}{#2}}}%
+% \end{macrocode}
+% \subsection{\csh{xintMod}}
+% \lverb|1.1. \xintMod {q1}{q2} computes q2*t(q1/q2) with t(q1/q2) truncated
+% division of two arbitrary fractions q1 and q2. We put some efforts into
+% minimizing the amount of computations.|
+% \begin{macrocode}
+\def\xintMod {\romannumeral0\xintmod }%
+\def\xintmod #1{\expandafter\XINT_mod_a\romannumeral0\xintraw{#1}.}%
+\def\XINT_mod_a #1#2.#3%
+ {\expandafter\XINT_mod_b\expandafter #1\romannumeral0\xintraw{#3}#2.}%
+\def\XINT_mod_b #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_mod_divbyzero\fi
+ \if0#1\xint_dothis\XINT_mod_aiszero\fi
+ \if-#2\xint_dothis{\XINT_mod_bneg #1}\fi
+ \xint_orthat{\XINT_mod_bpos #1#2}%
+}%
+\def\XINT_mod_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_mod_pos {}}%
+ -{\XINT_mod_pos #1}%
+ \krof
+}%
+\def\XINT_mod_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_mod_pos {}}%
+ -{\XINT_mod_pos #1}%
+ \krof
+}%
+\def\XINT_mod_divbyzero #1.{\xintError:DivisionByZero\space 0/1[0]}%
+\def\XINT_mod_aiszero #1.{ 0/1[0]}%
+\def\XINT_mod_pos #1#2/#3[#4]#5/#6[#7].%
+{%
+ \expandafter\XINT_mod_pos_a
+ \the\numexpr\ifnum#7>#4 #4\else #7\fi\expandafter.\expandafter
+ {\romannumeral0\xintiimul {#6}{#3}}% n fois u
+ {\xintiiE{\xintiiMul {#1#5}{#3}}{#7-#4}}% m fois u
+ {\xintiiE{\xintiiMul {#2}{#6}}{#4-#7}}% t fois n
+}%
+\def\XINT_mod_pos_a #1.#2#3#4{\xintiirem {#3}{#4}/#2[#1]}%
+% \end{macrocode}
+% \subsection{\csh{XINTinFloatMod}}
+% \lverb|Pour emploi dans xintexpr 1.1|
+% \begin{macrocode}
+\def\XINTinFloatMod {\romannumeral0\XINTinfloatmod [\XINTdigits]}%
+\def\XINTinfloatmod [#1]#2#3{\expandafter\XINT_infloatmod\expandafter
+ {\romannumeral0\XINTinfloat[#1]{#2}}%
+ {\romannumeral0\XINTinfloat[#1]{#3}}{#1}}%
+\def\XINT_infloatmod #1#2{\expandafter\XINT_infloatmod_a\expandafter {#2}{#1}}%
+\def\XINT_infloatmod_a #1#2#3{\XINTinfloat [#3]{\xintMod {#2}{#1}}}%
+% \end{macrocode}
% \subsection{\csh{xintIsOne}}
% \lverb|&
% New with 1.09a. Could be more efficient. For fractions with big powers of
-% tens, it is better to use \xintCmp{f}{1}. Restyled in 1.09i.|
+% tens, it is better to use \xintCmp{f}{1}. Restyled in 1.09i.|
% \begin{macrocode}
-\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintIsOne {\romannumeral0\xintisone }%
\def\xintisone #1{\expandafter\XINT_fracisone
\romannumeral0\xintrawwithzeros{#1}\Z }%
\def\XINT_fracisone #1/#2\Z
@@ -21092,7 +22690,7 @@ $1$ or $-1$.
\def\XINT_fgeq_D #1#2#3%
{%
\expandafter\XINT_cntSgnFork\romannumeral-`0\expandafter\XINT_cntSgn
- \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
+ \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z
{ 0}{\XINT_fgeq_E #2\Z {#3}{#1}}{ 1}%
}%
\def\XINT_fgeq_E #1%
@@ -21110,7 +22708,7 @@ $1$ or $-1$.
\def\XINT_fgeq_Fe #1#2{\XINT_geq_pre {#2}{#1}}%
\def\XINT_fgeq_Fn #1\Z #2#3%
{%
- \expandafter\XINT_geq_pre\expandafter
+ \expandafter\XINT_geq_pre\expandafter
{\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}%
}%
% \end{macrocode}
@@ -21162,7 +22760,7 @@ $1$ or $-1$.
{\expandafter\XINT_maxof_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_maxof_c #1%
{\xint_gob_til_relax #1\XINT_maxof_e\relax\XINT_maxof_d #1}%
-\def\XINT_maxof_d #1\Z
+\def\XINT_maxof_d #1\Z
{\expandafter\XINT_maxof_b\romannumeral0\xintmax {#1}}%
\def\XINT_maxof_e #1\Z #2\Z { #2}%
% \end{macrocode}
@@ -21214,7 +22812,7 @@ $1$ or $-1$.
{\expandafter\XINT_minof_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_minof_c #1%
{\xint_gob_til_relax #1\XINT_minof_e\relax\XINT_minof_d #1}%
-\def\XINT_minof_d #1\Z
+\def\XINT_minof_d #1\Z
{\expandafter\XINT_minof_b\romannumeral0\xintmin {#1}}%
\def\XINT_minof_e #1\Z #2\Z { #2}%
% \end{macrocode}
@@ -21225,10 +22823,10 @@ $1$ or $-1$.
% delimited arguments making the macro just non-functional when one of the input
% was zero! I
% did not detect this until working on release 1.09a, somehow I had not tested
-% that
+% that
% \xintCmp just did NOT work! I must have done some last minute change... |
% \begin{macrocode}
-\def\xintCmp {\romannumeral0\xintcmp }%
+%\def\xintCmp {\romannumeral0\xintcmp }%
\def\xintcmp #1%
{%
\expandafter\xint_fcmp\expandafter {\romannumeral0\xintraw {#1}}%
@@ -21262,7 +22860,7 @@ $1$ or $-1$.
}%
\def\XINT_fcmp_zerozero #1#2#3#4{ 0}% 1.08b had some [ and ] here!!!
\def\XINT_fcmp_firstzero #1#2#3#4{ -1}% incredibly I never saw that until
-\def\XINT_fcmp_secondzero #1#2#3#4{ 1}% preparing 1.09a.
+\def\XINT_fcmp_secondzero #1#2#3#4{ 1}% preparing 1.09a.
\def\XINT_fcmp_pos #1#2#3#4%
{%
\XINT_fcmp_B #1#3#2#4%
@@ -21300,25 +22898,25 @@ $1$ or $-1$.
\def\XINT_fcmp_Fe #1#2{\XINT_cmp_pre {#2}{#1}}%
\def\XINT_fcmp_Fn #1\Z #2#3%
{%
- \expandafter\XINT_cmp_pre\expandafter
+ \expandafter\XINT_cmp_pre\expandafter
{\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}%
}%
% \end{macrocode}
% \subsection{\csh{xintAbs}}
-% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
+% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
\def\xintAbs {\romannumeral0\xintabs }%
\def\xintabs #1{\expandafter\XINT_abs\romannumeral0\xintraw {#1}}%
% \end{macrocode}
% \subsection{\csh{xintOpp}}
% \lverb|caution that -#1 would not be ok if #1 has [n]
-% stuff. Simplified in 1.09i. (original macro was written before \xintRaw)|
+% stuff. Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
\def\xintOpp {\romannumeral0\xintopp }%
\def\xintopp #1{\expandafter\XINT_opp\romannumeral0\xintraw {#1}}%
% \end{macrocode}
% \subsection{\csh{xintSgn}}
-% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
+% \lverb|Simplified in 1.09i. (original macro was written before \xintRaw)|
% \begin{macrocode}
\def\xintSgn {\romannumeral0\xintsgn }%
\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\Z }%
@@ -21364,10 +22962,10 @@ $1$ or $-1$.
}%
\def\XINT_FL_Add_d #1[#2]#3[#4]#5%
{%
- \ifnum \numexpr #2-#4-#5>\xint_c_i
+ \ifnum \numexpr #2-#4-#5>\xint_c_i
\expandafter \xint_secondofthree_thenstop
\else
- \ifnum \numexpr #4-#2-#5>\xint_c_i
+ \ifnum \numexpr #4-#2-#5>\xint_c_i
\expandafter\expandafter\expandafter\xint_thirdofthree_thenstop
\fi
\fi
@@ -21475,7 +23073,7 @@ $1$ or $-1$.
{\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
+\def\XINT_floatsum_d #1\Z
{\expandafter\XINT_floatsum_b\romannumeral0\XINTinfloatadd {#1}}%
\def\XINT_floatsum_e #1\Z #2\Z { #2}%
% \end{macrocode}
@@ -21492,7 +23090,7 @@ $1$ or $-1$.
{\expandafter\XINT_floatprd_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_floatprd_c #1%
{\xint_gob_til_relax #1\XINT_floatprd_e\relax\XINT_floatprd_d #1}%
-\def\XINT_floatprd_d #1\Z
+\def\XINT_floatprd_d #1\Z
{\expandafter\XINT_floatprd_b\romannumeral0\XINTinfloatmul {#1}}%
\def\XINT_floatprd_e #1\Z #2\Z { #2}%
% \end{macrocode}
@@ -21562,7 +23160,7 @@ $1$ or $-1$.
\XINT_flpow_loopI {#5}{#2[#3]}{\romannumeral0\XINTinfloatmul [#4]}%
{#1*\ifodd #5 1\else 0\fi}%
}%
-\def\XINT_flpow_zero [#1]#2#3#4#5%
+\def\XINT_flpow_zero [#1]#2#3#4#5%
% xint is not equipped to signal infinity, the 2^31 will provoke
% deliberately a number too big and arithmetic overflow in \XINT_float_Xb
{%
@@ -21582,11 +23180,11 @@ $1$ or $-1$.
\def\XINT_flpow_ItoIII\fi #1\fi #2#3#4#5%
{%
\fi\expandafter\XINT_flpow_III\the\numexpr #5\relax #3%
-}%
+}%
\def\XINT_flpow_loopI_even #1#2#3%
{%
\expandafter\XINT_flpow_loopI\expandafter
- {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
+ {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
{#3{#2}{#2}}{#3}%
}%
\def\XINT_flpow_loopI_odd #1#2#3%
@@ -21723,7 +23321,7 @@ $1$ or $-1$.
\def\XINT_flpower_ItoIII\fi #1\fi\expandafter #2#3#4#5%
{%
\fi\expandafter\XINT_flpow_III \the\numexpr #5\relax #3%
-}%
+}%
\def\XINT_flpower_loopI_even #1#2#3%
{%
\expandafter\XINT_flpower_toI\expandafter {#3{#2}{#2}}{#1}{#3}%
@@ -21788,14 +23386,14 @@ $1$ or $-1$.
}%
\def\XINT_FL_sqrt #1%
{%
- \ifnum\numexpr #1<\xint_c_xviii
+ \ifnum\numexpr #1<\xint_c_xviii
\xint_afterfi {\XINT_FL_sqrt_a\xint_c_xviii}%
\else
\xint_afterfi {\XINT_FL_sqrt_a {#1+\xint_c_i}}%
\fi
}%
\def\XINT_FL_sqrt_a #1#2%
-{%
+{%
\expandafter\XINT_FL_sqrt_checkifzeroorneg
\romannumeral0\XINTinfloat [#1]{#2}%
}%
@@ -21827,7 +23425,7 @@ $1$ or $-1$.
\expandafter\XINT_sqrt_a
\expandafter{\romannumeral0\xintlength {#2}}\XINT_flsqrt_big_d {#2}{#1}%
}%
-\def\XINT_flsqrt_big_d #1#2%
+\def\XINT_flsqrt_big_d #1#2%
{%
\ifodd #2
\expandafter\expandafter\expandafter\XINT_flsqrt_big_eB
@@ -21840,7 +23438,7 @@ $1$ or $-1$.
{%
\XINT_flsqrt_big_eA_a #3\Z {#2}{#1}{#3}%
}%
-\def\XINT_flsqrt_big_eA_a #1#2#3#4#5#6#7#8#9\Z
+\def\XINT_flsqrt_big_eA_a #1#2#3#4#5#6#7#8#9\Z
{%
\XINT_flsqrt_big_eA_b {#1#2#3#4#5#6#7#8}%
}%
@@ -21895,16 +23493,16 @@ $1$ or $-1$.
}%
\def\XINT_flsqrt_big_f #1%
{%
- \expandafter\XINT_flsqrt_big_fa\expandafter
+ \expandafter\XINT_flsqrt_big_fa\expandafter
{\romannumeral0\xintiisqr {#1}}{#1}%
}%
\def\XINT_flsqrt_big_fa #1#2#3#4%
{%
\expandafter\XINT_flsqrt_big_fb\expandafter
- {\romannumeral0\XINT_dsx_addzerosnofuss
+ {\romannumeral0\XINT_dsx_addzerosnofuss
{\numexpr #3-\xint_c_viii\relax}{#2}}%
{\romannumeral0\xintiisub
- {\XINT_dsx_addzerosnofuss
+ {\XINT_dsx_addzerosnofuss
{\numexpr \xint_c_ii*(#3-\xint_c_viii)\relax}{#1}}{#4}}%
{#3}%
}%
@@ -21940,7 +23538,7 @@ $1$ or $-1$.
{%
\expandafter\XINT_flsqrt_big_end_b\expandafter
{\the\numexpr -#4+#5/\xint_c_ii\expandafter}\expandafter
- {\romannumeral0\xintiisub
+ {\romannumeral0\xintiisub
{\XINT_dsx_addzerosnofuss {#4}{#3}}%
{\xintHalf{\xintiiQuo{\XINT_dsx_addzerosnofuss {#4}{#2}}{#3}}}}%
}%
@@ -21957,7 +23555,7 @@ $1$ or $-1$.
{\expandafter\XINT_flmaxof_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_flmaxof_c #1%
{\xint_gob_til_relax #1\XINT_flmaxof_e\relax\XINT_flmaxof_d #1}%
-\def\XINT_flmaxof_d #1\Z
+\def\XINT_flmaxof_d #1\Z
{\expandafter\XINT_flmaxof_b\romannumeral0\xintmax
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flmaxof_e #1\Z #2\Z { #2}%
@@ -21973,129 +23571,10 @@ $1$ or $-1$.
{\expandafter\XINT_flminof_c\romannumeral-`0#2\Z {#1}\Z}%
\def\XINT_flminof_c #1%
{\xint_gob_til_relax #1\XINT_flminof_e\relax\XINT_flminof_d #1}%
-\def\XINT_flminof_d #1\Z
+\def\XINT_flminof_d #1\Z
{\expandafter\XINT_flminof_b\romannumeral0\xintmin
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flminof_e #1\Z #2\Z { #2}%
-% \end{macrocode}
-% \subsection{\csh{xintRound:csv}}
-% \lverb|1.09a. For use by \xinttheiexpr.|
-% \begin{macrocode}
-\def\xintRound:csv #1{\expandafter\XINT_round:_a\romannumeral-`0#1,,^}%
-\def\XINT_round:_a {\XINT_round:_b {}}%
-\def\XINT_round:_b #1#2,%
- {\expandafter\XINT_round:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_round:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_round:_d\fi #1}%
-\def\XINT_round:_d #1,%
- {\expandafter\XINT_round:_e\romannumeral0\xintiround 0{#1},}%
-\def\XINT_round:_e #1,#2{\XINT_round:_b {#2,#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintFloat:csv}}
-% \lverb|1.09a. For use by \xintthefloatexpr.|
-% \begin{macrocode}
-\def\xintFloat:csv #1{\expandafter\XINT_float:_a\romannumeral-`0#1,,^}%
-\def\XINT_float:_a {\XINT_float:_b {}}%
-\def\XINT_float:_b #1#2,%
- {\expandafter\XINT_float:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_float:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_float:_d\fi #1}%
-\def\XINT_float:_d #1,%
- {\expandafter\XINT_float:_e\romannumeral0\xintfloat {#1},}%
-\def\XINT_float:_e #1,#2{\XINT_float:_b {#2,#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintSum:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintSum:csv #1{\expandafter\XINT_sum:_a\romannumeral-`0#1,,^}%
-\def\XINT_sum:_a {\XINT_sum:_b {0/1[0]}}%
-\def\XINT_sum:_b #1#2,{\expandafter\XINT_sum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_sum:_d\fi #1}%
-\def\XINT_sum:_d #1,#2{\expandafter\XINT_sum:_b\expandafter
- {\romannumeral0\xintadd {#2}{#1}}}%
-% \end{macrocode}
-% \subsection{\csh{xintPrd:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintPrd:csv #1{\expandafter\XINT_prd:_a\romannumeral-`0#1,,^}%
-\def\XINT_prd:_a {\XINT_prd:_b {1/1[0]}}%
-\def\XINT_prd:_b #1#2,{\expandafter\XINT_prd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_prd:_d\fi #1}%
-\def\XINT_prd:_d #1,#2{\expandafter\XINT_prd:_b\expandafter
- {\romannumeral0\xintmul {#2}{#1}}}%
-% \end{macrocode}
-% \subsection{\csh{xintMaxof:csv}}
-% \lverb|1.09a. For use by \xintexpr. Even with only one
-% argument, there does not seem to be really a motive for using \xintraw?|
-% \begin{macrocode}
-\def\xintMaxof:csv #1{\expandafter\XINT_maxof:_b\romannumeral-`0#1,,}%
-\def\XINT_maxof:_b #1,#2,{\expandafter\XINT_maxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_maxof:_d\fi #1}%
-\def\XINT_maxof:_d #1,{\expandafter\XINT_maxof:_b\romannumeral0\xintmax {#1}}%
-% \end{macrocode}
-% \subsection{\csh{xintMinof:csv}}
-% \lverb|1.09a. For use by \xintexpr.|
-% \begin{macrocode}
-\def\xintMinof:csv #1{\expandafter\XINT_minof:_b\romannumeral-`0#1,,}%
-\def\XINT_minof:_b #1,#2,{\expandafter\XINT_minof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_minof:_d\fi #1}%
-\def\XINT_minof:_d #1,{\expandafter\XINT_minof:_b\romannumeral0\xintmin {#1}}%
-% \end{macrocode}
-% \subsection{\csh{XINTinFloatMinof:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr. Name changed in 1.09h|
-% \begin{macrocode}
-\def\XINTinFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
-\def\XINT_flminof:_a #1,{\expandafter\XINT_flminof:_b
- \romannumeral0\XINTinfloat [\XINTdigits]{#1},}%
-\def\XINT_flminof:_b #1,#2,%
- {\expandafter\XINT_flminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_flminof:_d\fi #1}%
-\def\XINT_flminof:_d #1,%
- {\expandafter\XINT_flminof:_b\romannumeral0\xintmin
- {\XINTinFloat [\XINTdigits]{#1}}}%
-% \end{macrocode}
-% \subsection{\csh{XINTinFloatMaxof:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr. Name changed in 1.09h|
-% \begin{macrocode}
-\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
-\def\XINT_flmaxof:_a #1,{\expandafter\XINT_flmaxof:_b
- \romannumeral0\XINTinfloat [\XINTdigits]{#1},}%
-\def\XINT_flmaxof:_b #1,#2,%
- {\expandafter\XINT_flmaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_flmaxof:_d\fi #1}%
-\def\XINT_flmaxof:_d #1,%
- {\expandafter\XINT_flmaxof:_b\romannumeral0\xintmax
- {\XINTinFloat [\XINTdigits]{#1}}}%
-% \end{macrocode}
-% \subsection{\csh{XINTinFloatSum:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
-% \begin{macrocode}
-\def\XINTinFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0[0]}}%
-\def\XINT_floatsum:_b #1#2,%
- {\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_floatsum:_d\fi #1}%
-\def\XINT_floatsum:_d #1,#2{\expandafter\XINT_floatsum:_b\expandafter
- {\romannumeral0\XINTinfloatadd {#2}{#1}}}%
-% \end{macrocode}
-% \subsection{\csh{XINTinFloatPrd:csv}}
-% \lverb|1.09a. For use by \xintfloatexpr. Renamed in 1.09h|
-% \begin{macrocode}
-\def\XINTinFloatPred:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1[0]}}%
-\def\XINT_floatprd:_b #1#2,%
- {\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_floatprd:_d\fi #1}%
-\def\XINT_floatprd:_d #1,#2{\expandafter\XINT_floatprd:_b\expandafter
- {\romannumeral0\XINTinfloatmul {#2}{#1}}}%
\XINT_restorecatcodes_endinput%
% \end{macrocode}
%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -22108,18 +23587,18 @@ $1$ or $-1$.
%
% \section{Package \xintseriesnameimp implementation}
% \label{sec:seriesimp}
-%
-% The commenting is currently (\docdate) very sparse.
%
% \localtableofcontents
+%
+% The commenting is currently (\xintdocdate) very sparse.
+%
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the \xintfracname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -22133,7 +23612,6 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintseries.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
@@ -22150,7 +23628,6 @@ $1$ or $-1$.
\else
\ifx\x\relax % plain-TeX, first loading of xintseries.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintseries}{now issuing \string\input\space xintfrac.sty}%
\def\z{\endgroup\input xintfrac.sty\relax}%
\fi
\else
@@ -22158,62 +23635,27 @@ $1$ or $-1$.
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintseries}{now issuing \string\RequirePackage{xintfrac}}%
\def\z{\endgroup\RequirePackage{xintfrac}}%
\fi
\else
- \y{xintseries}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintseries already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintfracnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintseries}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintseries}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2014/04/01 v1.09n Expandable partial sums with xint package (jfB)]%
+ [2014/10/28 v1.1 Expandable partial sums with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintSeries}}
% \lverb|&
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintSeries {\romannumeral0\xintseries }%
\def\xintseries #1#2%
@@ -22246,12 +23688,12 @@ $1$ or $-1$.
% \lverb|&
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintiSeries {\romannumeral0\xintiseries }%
\def\xintiseries #1#2%
{%
- \expandafter\XINT_iseries\expandafter
+ \expandafter\XINT_iseries\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_iseries #1#2#3%
@@ -22283,12 +23725,12 @@ $1$ or $-1$.
% of the macro.
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintPowerSeries {\romannumeral0\xintpowerseries }%
\def\xintpowerseries #1#2%
{%
- \expandafter\XINT_powseries\expandafter
+ \expandafter\XINT_powseries\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_powseries #1#2#3#4%
@@ -22326,12 +23768,12 @@ $1$ or $-1$.
% Same as \xintPowerSeries except for the initial expansion of the x parameter.
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintPowerSeriesX {\romannumeral0\xintpowerseriesx }%
\def\xintpowerseriesx #1#2%
{%
- \expandafter\XINT_powseriesx\expandafter
+ \expandafter\XINT_powseriesx\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_powseriesx #1#2#3#4%
@@ -22340,7 +23782,7 @@ $1$ or $-1$.
\xint_afterfi { 0/1[0]}%
\else
\xint_afterfi
- {\expandafter\XINT_powseriesx_pre\expandafter
+ {\expandafter\XINT_powseriesx_pre\expandafter
{\romannumeral-`0#4}{#1}{#2}{#3}%
}%
\fi
@@ -22356,16 +23798,16 @@ $1$ or $-1$.
% ratios F(n)/F(n-1). As in \xintPowerSeries we use an iterative scheme which
% has the great advantage to avoid denominator build-up. This makes exact
% computations possible with exponential type series, which would be completely
-% inaccessible to \xintSeries.
+% inaccessible to \xintSeries.
% #1=a, #2=b, #3=F(a), #4=ratio function
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintRationalSeries {\romannumeral0\xintratseries }%
\def\xintratseries #1#2%
{%
- \expandafter\XINT_ratseries\expandafter
+ \expandafter\XINT_ratseries\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_ratseries #1#2#3#4%
@@ -22399,11 +23841,11 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintRationalSeriesX}}
% \lverb|&
-% a,b,initial,ratiofunction,x$\
+% a,b,initial,ratiofunction,x$\
% This computes F(a,x)+...+F(b,x) on the basis of the value of F(a,x) and the
% ratios F(n,x)/F(n-1,x). The argument x is first expanded and it is the value
% resulting from this which is used then throughout. The initial term F(a,x)
-% must be defined as one-parameter macro which will be given x.
+% must be defined as one-parameter macro which will be given x.
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
% 1.08a adds the forgotten optimization following that previous change.|
@@ -22411,7 +23853,7 @@ $1$ or $-1$.
\def\xintRationalSeriesX {\romannumeral0\xintratseriesx }%
\def\xintratseriesx #1#2%
{%
- \expandafter\XINT_ratseriesx\expandafter
+ \expandafter\XINT_ratseriesx\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_ratseriesx #1#2#3#4#5%
@@ -22420,7 +23862,7 @@ $1$ or $-1$.
\xint_afterfi { 0/1[0]}%
\else
\xint_afterfi
- {\expandafter\XINT_ratseriesx_pre\expandafter
+ {\expandafter\XINT_ratseriesx_pre\expandafter
{\romannumeral-`0#5}{#2}{#1}{#4}{#3}%
}%
\fi
@@ -22433,7 +23875,7 @@ $1$ or $-1$.
% \subsection{\csh{xintFxPtPowerSeries}}
% \lverb|&
% I am not two happy with this piece of code. Will make it more economical
-% another day.
+% another day.
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
% 1.08a: forgot last time some optimization from the change to \numexpr.|
@@ -22441,7 +23883,7 @@ $1$ or $-1$.
\def\xintFxPtPowerSeries {\romannumeral0\xintfxptpowerseries }%
\def\xintfxptpowerseries #1#2%
{%
- \expandafter\XINT_fppowseries\expandafter
+ \expandafter\XINT_fppowseries\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_fppowseries #1#2#3#4#5%
@@ -22459,7 +23901,7 @@ $1$ or $-1$.
\def\XINT_fppowseries_loop_pre #1#2#3#4#5#6%
{%
\ifnum #4>#2 \else\XINT_fppowseries_dont_i \fi
- \expandafter\XINT_fppowseries_loop_i\expandafter
+ \expandafter\XINT_fppowseries_loop_i\expandafter
{\the\numexpr #2+\xint_c_i\expandafter}\expandafter
{\romannumeral0\xintitrunc {#6}{\xintMul {#5{#2}}{#1}}}%
{#1}{#3}{#4}{#5}{#6}%
@@ -22491,15 +23933,15 @@ $1$ or $-1$.
% \end{macrocode}
% \subsection{\csh{xintFxPtPowerSeriesX}}
% \lverb|&
-% a,b,coeff,x,D$\
+% a,b,coeff,x,D$\
% Modified in 1.06 to give the indices first to a \numexpr rather than expanding
% twice. I just use \the\numexpr and maintain the previous code after that.
-% 1.08a adds the forgotten optimization following that previous change.|
+% 1.08a adds the forgotten optimization following that previous change.|
% \begin{macrocode}
\def\xintFxPtPowerSeriesX {\romannumeral0\xintfxptpowerseriesx }%
\def\xintfxptpowerseriesx #1#2%
{%
- \expandafter\XINT_fppowseriesx\expandafter
+ \expandafter\XINT_fppowseriesx\expandafter
{\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
}%
\def\XINT_fppowseriesx #1#2#3#4#5%
@@ -22535,13 +23977,13 @@ $1$ or $-1$.
}%
\def\XINT_flpowseries_noopt #1\xint_relax #2%
{%
- \expandafter\XINT_flpowseries\expandafter
+ \expandafter\XINT_flpowseries\expandafter
{\the\numexpr #1\expandafter}\expandafter
- {\the\numexpr #2}\XINTdigits
+ {\the\numexpr #2}\XINTdigits
}%
\def\XINT_flpowseries_opt [\xint_relax #1]#2#3%
{%
- \expandafter\XINT_flpowseries\expandafter
+ \expandafter\XINT_flpowseries\expandafter
{\the\numexpr #2\expandafter}\expandafter
{\the\numexpr #3\expandafter}{\the\numexpr #1}%
}%
@@ -22560,7 +24002,7 @@ $1$ or $-1$.
\def\XINT_flpowseries_loop_pre #1#2#3#4#5#6%
{%
\ifnum #4>#2 \else\XINT_flpowseries_dont_i \fi
- \expandafter\XINT_flpowseries_loop_i\expandafter
+ \expandafter\XINT_flpowseries_loop_i\expandafter
{\the\numexpr #2+\xint_c_i\expandafter}\expandafter
{\romannumeral0\XINTinfloatmul [#6]{#5{#2}}{#1}}%
{#1}{#3}{#4}{#5}{#6}%
@@ -22604,13 +24046,13 @@ $1$ or $-1$.
}%
\def\XINT_flpowseriesx_noopt #1\xint_relax #2%
{%
- \expandafter\XINT_flpowseriesx\expandafter
+ \expandafter\XINT_flpowseriesx\expandafter
{\the\numexpr #1\expandafter}\expandafter
- {\the\numexpr #2}\XINTdigits
+ {\the\numexpr #2}\XINTdigits
}%
\def\XINT_flpowseriesx_opt [\xint_relax #1]#2#3%
{%
- \expandafter\XINT_flpowseriesx\expandafter
+ \expandafter\XINT_flpowseriesx\expandafter
{\the\numexpr #2\expandafter}\expandafter
{\the\numexpr #3\expandafter}{\the\numexpr #1}%
}%
@@ -22643,8 +24085,10 @@ $1$ or $-1$.
%
% \section{Package \xintcfracnameimp implementation}
% \label{sec:cfracimp}
-%
-% The commenting is currently (\docdate) very sparse. Release |1.09m|
+%
+% \localtableofcontents
+%
+% The commenting is currently (\xintdocdate) very sparse. Release |1.09m|
% (|2014/02/26|) has modified a few things: |\xintFtoCs| and
% |\xintCntoCs| insert spaces after the commas, |\xintCstoF| and
% |\xintCstoCv| authorize spaces in the input also before the commas,
@@ -22657,15 +24101,13 @@ $1$ or $-1$.
% the treatment of macros with optional arguments with the safer
% |\xint_relax| (the more recent |\xintSeq| already used |\xint_bye|).
%
-% \localtableofcontents
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the \xintfracname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -22679,7 +24121,6 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintcfrac.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
@@ -22696,7 +24137,6 @@ $1$ or $-1$.
\else
\ifx\x\relax % plain-TeX, first loading of xintcfrac.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintcfrac}{now issuing \string\input\space xintfrac.sty}%
\def\z{\endgroup\input xintfrac.sty\relax}%
\fi
\else
@@ -22704,56 +24144,21 @@ $1$ or $-1$.
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintcfrac}{now issuing \string\RequirePackage{xintfrac}}%
\def\z{\endgroup\RequirePackage{xintfrac}}%
\fi
\else
- \y{xintcfrac}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintcfrac already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintfracnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2014/04/01 v1.09n Expandable continued fractions with xint package (jfB)]%
+ [2014/10/28 v1.1 Expandable continued fractions with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintCFrac}}
% \begin{macrocode}
@@ -22763,7 +24168,7 @@ $1$ or $-1$.
\XINT_cfrac_opt_a #1\xint_relax
}%
\def\XINT_cfrac_opt_a #1%
-{%
+{%
\ifx[#1\XINT_cfrac_opt_b\fi \XINT_cfrac_noopt #1%
}%
\def\XINT_cfrac_noopt #1\xint_relax
@@ -22803,8 +24208,8 @@ $1$ or $-1$.
\xint_gob_til_zero #1\XINT_cfrac_integer 0\XINT_cfrac_D #1%
}%
\def\XINT_cfrac_integer 0\XINT_cfrac_D 0#1\Z #2#3#4#5{ #2}%
-\def\XINT_cfrac_D #1\Z #2#3{\XINT_cfrac_loop_a {#1}{#3}{#1}{{#2}}}%
-\def\XINT_cfrac_loop_a
+\def\XINT_cfrac_D #1\Z #2#3{\XINT_cfrac_loop_a {#1}{#3}{#1}{{#2}}}%
+\def\XINT_cfrac_loop_a
{%
\expandafter\XINT_cfrac_loop_d\romannumeral0\XINT_div_prepare
}%
@@ -22837,7 +24242,7 @@ $1$ or $-1$.
\def\xintGCFrac {\romannumeral0\xintgcfrac }%
\def\xintgcfrac #1{\XINT_gcfrac_opt_a #1\xint_relax }%
\def\XINT_gcfrac_opt_a #1%
-{%
+{%
\ifx[#1\XINT_gcfrac_opt_b\fi \XINT_gcfrac_noopt #1%
}%
\def\XINT_gcfrac_noopt #1\xint_relax
@@ -22860,7 +24265,7 @@ $1$ or $-1$.
{%
\XINT_gcfrac #1+\xint_relax/\hfill\relax
}%
-\def\XINT_gcfrac
+\def\XINT_gcfrac
{%
\expandafter\XINT_gcfrac_enter\romannumeral-`0%
}%
@@ -22877,7 +24282,7 @@ $1$ or $-1$.
\def\XINT_gcfrac_T #1#2#3#4{\XINT_gcfrac_U #1#2{\xintFrac{#4}}}%
\def\XINT_gcfrac_U #1#2#3#4#5%
{%
- \xint_gob_til_xint_relax #5\XINT_gcfrac_end\xint_relax\XINT_gcfrac_U
+ \xint_gob_til_xint_relax #5\XINT_gcfrac_end\xint_relax\XINT_gcfrac_U
#1#2{\xintFrac{#5}%
\ifcase\xintSgn{#4}
+\or+\else-\fi
@@ -22895,7 +24300,7 @@ $1$ or $-1$.
\def\xintGGCFrac {\romannumeral0\xintggcfrac }%
\def\xintggcfrac #1{\XINT_ggcfrac_opt_a #1\xint_relax }%
\def\XINT_ggcfrac_opt_a #1%
-{%
+{%
\ifx[#1\XINT_ggcfrac_opt_b\fi \XINT_ggcfrac_noopt #1%
}%
\def\XINT_ggcfrac_noopt #1\xint_relax
@@ -22935,7 +24340,7 @@ $1$ or $-1$.
\def\XINT_ggcfrac_T #1#2#3#4{\XINT_ggcfrac_U #1#2{#4}}%
\def\XINT_ggcfrac_U #1#2#3#4#5%
{%
- \xint_gob_til_xint_relax #5\XINT_ggcfrac_end\xint_relax\XINT_ggcfrac_U
+ \xint_gob_til_xint_relax #5\XINT_ggcfrac_end\xint_relax\XINT_ggcfrac_U
#1#2{#5+\cfrac{#1#4#2}{#3}}%
}%
\def\XINT_ggcfrac_end\xint_relax\XINT_ggcfrac_U #1#2#3%
@@ -22960,7 +24365,7 @@ $1$ or $-1$.
\def\XINT_gctgcx_loop_b #1#2%
{%
\XINT_gctgcx_loop_a {#1#2}%
-}%
+}%
\def\XINT_gctgcx_end\xint_relax\XINT_gctgcx_loop_b #1#2#3#4{ #1}%
% \end{macrocode}
% \subsection{\csh{xintFtoCs}}
@@ -22984,8 +24389,8 @@ $1$ or $-1$.
\xint_gob_til_zero #1\XINT_ftc_integer 0\XINT_ftc_D #1%
}%
\def\XINT_ftc_integer 0\XINT_ftc_D 0#1.#2#3{ #2}%
-\def\XINT_ftc_D #1.#2#3{\XINT_ftc_loop_a {#1}{#3}{#1}{#2, }}% 1.09m adds a space
-\def\XINT_ftc_loop_a
+\def\XINT_ftc_D #1.#2#3{\XINT_ftc_loop_a {#1}{#3}{#1}{#2, }}% 1.09m adds a space
+\def\XINT_ftc_loop_a
{%
\expandafter\XINT_ftc_loop_d\romannumeral0\XINT_div_prepare
}%
@@ -23023,8 +24428,8 @@ $1$ or $-1$.
\xint_gob_til_zero #1\XINT_ftcx_integer 0\XINT_ftcx_D #1%
}%
\def\XINT_ftcx_integer 0\XINT_ftcx_D 0#1.#2#3#4{ #2}%
-\def\XINT_ftcx_D #1.#2#3#4{\XINT_ftcx_loop_a {#1}{#3}{#1}{{#2}#4}{#4}}%
-\def\XINT_ftcx_loop_a
+\def\XINT_ftcx_D #1.#2#3#4{\XINT_ftcx_loop_a {#1}{#3}{#1}{{#2}#4}{#4}}%
+\def\XINT_ftcx_loop_a
{%
\expandafter\XINT_ftcx_loop_d\romannumeral0\XINT_div_prepare
}%
@@ -23076,7 +24481,7 @@ $1$ or $-1$.
}%
\def\XINT_fgtc_c #1#2#3#4/#5\Z
{%
- \expandafter\XINT_fgtc_d\romannumeral0\xintiidivision
+ \expandafter\XINT_fgtc_d\romannumeral0\xintiidivision
{#4}{#5}{#5}{#1}{#2}{#3}%
}%
\def\XINT_fgtc_d #1#2#3#4%#5#6#7%
@@ -23103,7 +24508,7 @@ $1$ or $-1$.
}%
\def\XINT_fgtc_h #1#2#3#4#5%
{%
- \expandafter\XINT_fgtc_d\romannumeral0\XINT_div_prepare
+ \expandafter\XINT_fgtc_d\romannumeral0\XINT_div_prepare
{#4}{#5}{#4}{#1}{#2}{#3}%
}%
% \end{macrocode}
@@ -23119,7 +24524,7 @@ $1$ or $-1$.
\expandafter\XINT_ftcc_B
\romannumeral0\xintrawwithzeros {\xintAdd {1/2[0]}{#1[0]}}\Z {#1[0]}%
}%
-\def\XINT_ftcc_B #1/#2\Z
+\def\XINT_ftcc_B #1/#2\Z
{%
\expandafter\XINT_ftcc_C\expandafter {\romannumeral0\xintiiquo {#1}{#2}}%
}%
@@ -23153,7 +24558,7 @@ $1$ or $-1$.
}%
\def\XINT_ftcc_loop_b #1/#2\Z
{%
- \expandafter\XINT_ftcc_loop_c\expandafter
+ \expandafter\XINT_ftcc_loop_c\expandafter
{\romannumeral0\xintiiquo {#1}{#2}}%
}%
\def\XINT_ftcc_loop_c #1#2%
@@ -23298,7 +24703,7 @@ $1$ or $-1$.
\def\XINT_gctf_loop_f #1#2/%
{%
\xint_gob_til_xint_relax #2\XINT_gctf_end\xint_relax
- \expandafter\XINT_gctf_loop_g
+ \expandafter\XINT_gctf_loop_g
\romannumeral0\xintrawwithzeros {#2}.#1%
}%
\def\XINT_gctf_loop_g #1/#2.#3#4#5#6%
@@ -23353,7 +24758,7 @@ $1$ or $-1$.
\def\XINT_igctf_loop_f #1#2#3#4/%
{%
\xint_gob_til_xint_relax #4\XINT_igctf_end\xint_relax
- \expandafter\XINT_igctf_loop_g
+ \expandafter\XINT_igctf_loop_g
\romannumeral-`0#4.{#2}{#3}#1%
}%
\def\XINT_igctf_loop_g #1.#2#3%
@@ -23420,7 +24825,7 @@ $1$ or $-1$.
}%
\def\XINT_ctcv_loop_f #1#2#3#4#5%
{%
- \expandafter\XINT_ctcv_loop_g\expandafter
+ \expandafter\XINT_ctcv_loop_g\expandafter
{\romannumeral0\xintrawwithzeros {#1/#2}}{#5}{#1}{#2}{#3}{#4}%
}%
\def\XINT_ctcv_loop_g #1#2{\XINT_ctcv_loop_a {#2{#1}}}% 1.09b removes [0]
@@ -23566,7 +24971,7 @@ $1$ or $-1$.
\def\XINT_igctcv_loop_f #1#2#3#4/%
{%
\xint_gob_til_xint_relax #4\XINT_igctcv_end_a\xint_relax
- \expandafter\XINT_igctcv_loop_g
+ \expandafter\XINT_igctcv_loop_g
\romannumeral-`0#4.#1#2{#3}%
}%
\def\XINT_igctcv_loop_g #1.#2#3#4#5%
@@ -23624,11 +25029,11 @@ $1$ or $-1$.
\def\XINT_cntf #1#2%
{%
\ifnum #1>\xint_c_
- \xint_afterfi {\expandafter\XINT_cntf_loop\expandafter
+ \xint_afterfi {\expandafter\XINT_cntf_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
{\romannumeral-`0#2{#1}}{#2}}%
\else
- \xint_afterfi
+ \xint_afterfi
{\ifnum #1=\xint_c_
\xint_afterfi {\expandafter\space \romannumeral-`0#2{0}}%
\else \xint_afterfi { }% 1.09m now returns nothing.
@@ -23643,7 +25048,7 @@ $1$ or $-1$.
{\romannumeral0\xintadd {\xintDiv {1[0]}{#2}}{#3{#1}}}%
{#3}%
}%
-\def\XINT_cntf_exit \fi
+\def\XINT_cntf_exit \fi
\expandafter\XINT_cntf_loop\expandafter
#1\expandafter #2#3%
{%
@@ -23663,11 +25068,11 @@ $1$ or $-1$.
\def\XINT_gcntf #1#2#3%
{%
\ifnum #1>\xint_c_
- \xint_afterfi {\expandafter\XINT_gcntf_loop\expandafter
+ \xint_afterfi {\expandafter\XINT_gcntf_loop\expandafter
{\the\numexpr #1-1\expandafter}\expandafter
{\romannumeral-`0#2{#1}}{#2}{#3}}%
\else
- \xint_afterfi
+ \xint_afterfi
{\ifnum #1=\xint_c_
\xint_afterfi {\expandafter\space\romannumeral-`0#2{0}}%
\else \xint_afterfi { }% 1.09m now returns nothing rather than 0/1[0]
@@ -23682,7 +25087,7 @@ $1$ or $-1$.
{\romannumeral0\xintadd {\xintDiv {#4{#1}}{#2}}{#3{#1}}}%
{#3}{#4}%
}%
-\def\XINT_gcntf_exit \fi
+\def\XINT_gcntf_exit \fi
\expandafter\XINT_gcntf_loop\expandafter
#1\expandafter #2#3#4%
{%
@@ -23692,7 +25097,7 @@ $1$ or $-1$.
% \subsection{\csh{xintCntoCs}}
% \lverb|Modified in 1.09m: added spaces after the commas in the produced list.
% Moreover the coefficients are not braced anymore. A slight induced limitation
-% is that the macro argument should not contain some explicit comma (cf.
+% is that the macro argument should not contain some explicit comma (cf.
% \XINT_cntcs_exit_b), hence \xintCntoCs {\macro,} with \def\macro,#1{<stuff>}
% would crash. Not a very serious limitation, I believe. |
% \begin{macrocode}
@@ -23705,8 +25110,8 @@ $1$ or $-1$.
{%
\ifnum #1<0
\xint_afterfi { }% 1.09i: a 0/1[0] was here, now the macro returns nothing
- \else
- \xint_afterfi {\expandafter\XINT_cntcs_loop\expandafter
+ \else
+ \xint_afterfi {\expandafter\XINT_cntcs_loop\expandafter
{\the\numexpr #1-\xint_c_i\expandafter}\expandafter
{\romannumeral-`0#2{#1}}{#2}}% produced coeff not braced
\fi
@@ -23715,10 +25120,10 @@ $1$ or $-1$.
{%
\ifnum #1>-\xint_c_i \else \XINT_cntcs_exit \fi
\expandafter\XINT_cntcs_loop\expandafter
- {\the\numexpr #1-\xint_c_i\expandafter}\expandafter
+ {\the\numexpr #1-\xint_c_i\expandafter}\expandafter
{\romannumeral-`0#3{#1}, #2}{#3}% space added, 1.09m
}%
-\def\XINT_cntcs_exit \fi
+\def\XINT_cntcs_exit \fi
\expandafter\XINT_cntcs_loop\expandafter
#1\expandafter #2#3%
{%
@@ -23745,8 +25150,8 @@ $1$ or $-1$.
{%
\ifnum #1<0
\xint_afterfi { }% 1.09i there was as strange 0/1[0] here, removed
- \else
- \xint_afterfi {\expandafter\XINT_cntgc_loop\expandafter
+ \else
+ \xint_afterfi {\expandafter\XINT_cntgc_loop\expandafter
{\the\numexpr #1-\xint_c_i\expandafter}\expandafter
{\expandafter{\romannumeral-`0#2{#1}}}{#2}}%
\fi
@@ -23755,10 +25160,10 @@ $1$ or $-1$.
{%
\ifnum #1>-\xint_c_i \else \XINT_cntgc_exit \fi
\expandafter\XINT_cntgc_loop\expandafter
- {\the\numexpr #1-\xint_c_i\expandafter }\expandafter
+ {\the\numexpr #1-\xint_c_i\expandafter }\expandafter
{\expandafter{\romannumeral-`0#3{#1}}+1/#2}{#3}%
}%
-\def\XINT_cntgc_exit \fi
+\def\XINT_cntgc_exit \fi
\expandafter\XINT_cntgc_loop\expandafter
#1\expandafter #2#3%
{%
@@ -23780,8 +25185,8 @@ $1$ or $-1$.
{%
\ifnum #1<0
\xint_afterfi { }% 1.09i now returns nothing
- \else
- \xint_afterfi {\expandafter\XINT_gcntgc_loop\expandafter
+ \else
+ \xint_afterfi {\expandafter\XINT_gcntgc_loop\expandafter
{\the\numexpr #1-\xint_c_i\expandafter}\expandafter
{\expandafter{\romannumeral-`0#2{#1}}}{#2}{#3}}%
\fi
@@ -23861,7 +25266,12 @@ $1$ or $-1$.
%
% \section{Package \xintexprnameimp implementation}
% \label{sec:exprimp}
-%
+%
+% \etocstandarddisplaystyle
+% \etocstandardlines
+% \localtableofcontents
+% \etocmarkbothnouc {Package \xintexprnameimp implementation}
+%
% The first version was released in June 2013. I was greatly helped in this task
% of writing an expandable parser of infix operations by the comments provided
% in |l3fp-parse.dtx| (in its version as available in April-May 2013). One will
@@ -23874,19 +25284,110 @@ $1$ or $-1$.
% retrieving data expandably as \emph{names} of control sequences. Intermediate
% computation results are stored as control sequences |\.=a/b[n]|.
%
-% Another peculiarity is that the input is allowed to contain (but only where
-% the scanner looks for a number or fraction) material within braces |{...}|.
-% This will be expanded completely and must give an integer, decimal number or
-% fraction (not in scientific notation). Conversely any explict fraction
-% |A/B[n]| \emph{with the brackets} or macro expanding to such a thing
-% \textbf{must} be enclosed within such braces: square brackets are not
-% acceptable by the expression parser.
-%
-% These two things are a bit \emph{experimental} and perhaps I will opt for
-% another approach at a later stage. To circumvent the potential hash-table
-% impact of the |\.=a/b[n]| I have provided the macro creators |\xintNewExpr|
-% and |\xintNewFloatExpr|.
-%
+% Release |1.1| |[2014/10/28]| has made many extensions, some bug fixes, and
+% some breaking changes:
+% \begin{description}
+% \item[bug fixes] \begin{itemize}
+% \item |\xintiiexpr| did not strip leading zeroes,
+% \item |\xinttheexpr \xintiexpr 1.23\relax\relax| should have produced |1|,
+% but it produced |1.23|
+% \item the catcode of |;| was not set at package launching time.
+% \end{itemize}
+% \item[breaking changes] \begin{itemize}
+% \item in |\xintiiexpr|, |/| does \emph{rounded} division, rather than the
+% Euclidean division (for positive arguments, this is truncated division).
+% The new |//| operator does truncated division,
+% \item the |:| operator for three-way branching is gone, replaced with |??|,
+% \item |1e(3+5)| is now illegal. The number parser identifies |e| and |E|
+% in the same way it does for the decimal mark, earlier versions treated
+% |e| as |E| rather as postfix operators,
+% \item the |add| and |mul| have a new syntax, old syntax is with |`+`| and
+% |`*`| (quotes mandatory), |sum| and |prd| are gone,
+% \item no more special treatment for encountered brace pairs |{..}| by the
+% number scanner, |a/b[N]| notation can be used without use of braces (the
+% |N| will end up as is in a |\numexpr|, it is not parsed by the
+% |\xintexpr|-ession scanner).
+% \end{itemize}
+% \item[novelties] They are quite a few. \begin{itemize}
+% \item |\xintiexpr|, |\xinttheiexpr| admit an optional argument within brackets
+% |[d]|, they round the computation result (or results, if comma separated)
+% to |d| digits after decimal mark, (the whole computation is done exactly,
+% as in |xintexpr|),
+%
+% \item |\xintfloatexpr|, |\xintthefloatexpr| similarly admit an optional
+% argument which serves to keep only |d| digits of precision, getting rid
+% of cumulated uncertainties in the last digits (the whole computation is
+% done according to the precision set via |\xintDigits|),
+%
+% \item |\xinttheexpr| and |\xintthefloatexpr| ''pretty-print'' if possible,
+% the former removing unit denominator or |[0]| brackets, the latter
+% avoiding scientific notation if decimal notation is practical,
+%
+% \item the |//| does truncated division and |/:| is the associated modulo,
+%
+% \item multi-character operators |&&|, \verb+|+, |==|, |<=|, |>=|, |!=|,
+% |**|,
+%
+% \item multi-letter infix binary words |'and'|, |'or'|, |'xor'|, |'mod'|
+% (quotes mandatory),
+%
+% \item functions |even|, |odd|,
+%
+% \item |\xintdefvar A3:=3.1415;| for variable definitions (non expandable,
+% naturally), usable in subsequent expressions; variable names may contain
+% letters, digits, underscores. They should not start with a digit, the
+% |@| is reserved, and single lowercase and uppercase Latin letters are
+% predefined to work as dummy variables (see next),
+%
+% \item generation of comma separated lists |a..b|, |a..[d]..b|,
+%
+% \item Python syntax-like list extractors |[list][n:]|, |[list][:n]|,
+% |[list][a:b]| allowing negative indices, but no optional step argument,
+% and |[list][n]| (|n=0| for the number of items in the list),
+%
+% \item functions |first|, |last|, |reversed|,
+%
+% \item itemwise operations on comma separated lists |a*[list]|, etc.., possible
+% on both sides |a*[list]^b|, an obeying the same precedence rules as with
+% numbers,
+%
+% \item |add| and |mul| must use a dummy variable: |add(x(x+1)(x-1), x=-10..10)|,
+%
+% \item variable substitutions with |subs|: |subs(subs(add(x^2+y^2,x=1..y),y=t),t=20)|,
+%
+% \item sequence generation using |seq| with a dummy variable: |seq(x^3, x=-10..10)|,
+%
+% \item simple recursive lists with |rseq|, with |@| given the last value,
+% |rseq(1;2@+1,i=1..10)|,
+%
+% \item higher recursion with |rrseq|, |@1|, |@2|, |@3|, |@4|, and |@@(n)|
+% for earlier values, up to |n=K| where |K| is the number of terms of the
+% initial stretch |rrseq(0,1;@1+@2,i=2..100)|,
+%
+% \item iteration with |iter| which is like |rrseq| but outputs only the
+% last |K| terms, where |K| was the number of initial terms,
+%
+% \item inside |seq|, |rseq|, |rrseq|, |iter|, possibility to use |omit|,
+% |abort| and |break| to control termination,
+%
+% \item |n++| potentially infinite index generation for |seq|, |rseq|,
+% |rrseq|, and |iter|, it is advised to use |abort| or |break(..)| at
+% some point,
+%
+% \item the |add|, |mul|, |seq|, ... are nestable,
+%
+% \item |\xintthecoords| converts a comma separated list of an even number
+% of items to the format as expected by the |TikZ| |coordinates| syntax,
+%
+% \item completely rewritten |\xintNewExpr|, |protect| function to handle
+% external macros. However not all constructs are compatible with
+% |\xintNewExpr|.
+%
+% \end{itemize}
+% \end{description}
+%
+% Comments dating back to earlier releases:
+%
% Roughly speaking, the parser mechanism is as follows: at any given time the
% last found ``operator'' has its associated |until| macro awaiting some news
% from the token flow; first |getnext| expands forward in the hope to construct
@@ -23897,10 +25398,10 @@ $1$ or $-1$.
% precedence level of the new found operator (which may be an end of expression
% marker), the second is the operator character token (earlier versions had here
% already some macro name, but in order to keep as much common code to expr and
-% floatexpr common as possible, this was modied) of the new found operator, and
+% floatexpr common as possible, this was modified) of the new found operator, and
% the third one is the newly found number (which was encountered just before the
% new operator).
-%
+%
% The |until| macro of the earlier operator examines the precedence level of the
% new found one, and either executes the earlier operator (in the case of a
% binary operation, with the found number and a previously stored one) or it
@@ -23911,17 +25412,19 @@ $1$ or $-1$.
% inheriting the precedence level of the previous operator.
%
% Once the end of the expression is found (it has to be marked by a |\relax|)
-% the final result is output as four tokens: the first one a catcode 11
-% exclamation mark, the second one an error generating macro, the third one a
-% printing macro and the fourth is |\.=a/b[n]|. The prefix |\xintthe| makes the
-% output printable by killing the first two tokens.
-%
-% Version |1.08b| |[2013/06/14]| corrected a problem originating in the attempt
+% the final result is output as four tokens (five tokens since |1.09j|) the
+% first one a catcode 11 exclamation mark, the second one an error generating
+% macro, the third one is a protection mechanism, the fourth one a printing
+% macro and the fifth is |\.=a/b[n]|. The prefix |\xintthe| makes the output
+% printable by killing the first three tokens.
+%
+% \begin{description}
+% \item[{|1.08b [2013/06/14]|}] corrected a problem originating in the attempt
% to attribute a special rôle to braces: expansion could be stopped by space
% tokens, as various macros tried to expand without grabbing what came next.
% They now have a doubled |\romannumeral-`0|.
%
-% Version |1.09a| |[2013/09/24]| has a better mechanism regarding |\xintthe|,
+% \item[{|1.09a| |[2013/09/24]|}] has a better mechanism regarding |\xintthe|,
% more commenting and better organization of the code, and most importantly it
% implements functions, comparison operators, logic operators, conditionals. The
% code was reorganized and expansion proceeds a bit differently in order to have
@@ -23930,22 +25433,22 @@ $1$ or $-1$.
% standard macro parameter character |#|, to be catcode protected and to also
% allow comma separated expressions.
%
-% Version |1.09c| |[2013/10/09]| added the |bool| and |togl| operators,
+% \item[{|1.09c| |[2013/10/09]|}] added the |bool| and |togl| operators,
% |\xintboolexpr|, and |\xintNewNumExpr|, |\xintNewBoolExpr|. The code for
% |\xintNewExpr| is shared with |float|, |num|, and |bool|-expressions. Also the
% precedence level of the postfix operators |!|, |?| and |:| has been made lower
-% than the one of functions.
+% than the one of functions.
%
-% Version |1.09i| |[2013/12/18]| unpacks count and dimen registers and control
+% \item[{|1.09i| |[2013/12/18]|}] unpacks count and dimen registers and control
% squences, with tacit multiplication. It has also made small improvements.
% (speed gains in macro expansions in quite a few places.)
%
% Also, |1.09i| implements |\xintiiexpr|, |\xinttheiiexpr|. New function |frac|.
% And encapsulation in |\csname..\endcsname| is done with |.=| as first tokens,
% so unpacking with |\string| can be done in a completely escape char agnostic
-% way.
+% way.
%
-% Version |1.09j| |[2014/01/09]| extends the tacit multiplication to the case of
+% \item[{|1.09j| |[2014/01/09]|}] extends the tacit multiplication to the case of
% a sub |\xintexpr|-essions. Also, it now |\xint_protect|s the result of the
% |\xintexpr| full expansions, thus, an |\xintexpr| without |\xintthe| prefix
% can be used not only as the first item within an ``|\fdef|'' as previously but
@@ -23959,7 +25462,7 @@ $1$ or $-1$.
% |\xintexpr| computations are otherwise in no way affected if such control
% sequences have a meaning.
%
-% Version |1.09k| |[2014/01/21]| does tacit multiplication also for an opening
+% \item[{|1.09k| |[2014/01/21]|}] does tacit multiplication also for an opening
% parenthesis encountered during the scanning of a number, or at a time when the
% parser expects an infix operator.
%
@@ -23967,20 +25470,23 @@ $1$ or $-1$.
% |"|, and having possibly a fractional part (except in |\xintiiexpr|,
% naturally).
%
-% Release |1.09kb| fixes the bug introduced in |\xintNewExpr| in |1.09i| of
-% December 2013: an |\endlinechar -1| was removed, but without it there is a
-% spurious trailing space token in the outputs of the created macros, and
-% nesting is then impossible.
+% \item[{|1.09kb| |[2014/02/13]|}] fixes the bug introduced in |\xintNewExpr|
+% in |1.09i| of December 2013: an |\endlinechar -1| was removed, but without
+% it there is a spurious trailing space token in the outputs of the created
+% macros, and nesting is then impossible.
+%
+% \end{description}
+%
+% This is release \expandafter|\xintbndlversion| of
+% \expandafter|\expandafter[\xintbndldate]|.
%
-% \localtableofcontents
% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
-% The code for reload detection is copied from \textsc{Heiko
-% Oberdiek}'s packages, and adapted here to check for previous
-% loading of the \xintfracname package.
+% The code for reload detection was initially copied from \textsc{Heiko
+% Oberdiek}'s packages, then modified.
%
-% The method for catcodes is slightly different, but still
-% directly inspired by these packages.
+% The method for catcodes was also initially directly inspired by these
+% packages.
%
% \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -23994,10 +25500,10 @@ $1$ or $-1$.
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
- \let\z\endgroup
+ \def\z {\endgroup}%
\expandafter\let\expandafter\x\csname ver@xintexpr.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \expandafter\let\expandafter\t\csname ver@xinttools.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -24011,430 +25517,479 @@ $1$ or $-1$.
\else
\ifx\x\relax % plain-TeX, first loading of xintexpr.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintexpr}{now issuing \string\input\space xintfrac.sty}%
- \def\z{\endgroup\input xintfrac.sty\relax}%
+ \expandafter\def\expandafter\z\expandafter
+ {\z\input xintfrac.sty\relax}%
+ \fi
+ \ifx\t\relax % but xinttools.sty not yet loaded.
+ \expandafter\def\expandafter\z\expandafter
+ {\z\input xinttools.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintexpr}{now issuing \string\RequirePackage{xintfrac}}%
- \def\z{\endgroup\RequirePackage{xintfrac}}%
+ \expandafter\def\expandafter\z\expandafter
+ {\z\RequirePackage{xintfrac}}%
+ \fi
+ \ifx\t\relax % xinttools.sty not yet loaded.
+ \expandafter\def\expandafter\z\expandafter
+ {\z\RequirePackage{xinttools}}%
\fi
\else
- \y{xintexpr}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintexpr already loaded.
\fi
\fi
\fi
\z%
-% \end{macrocode}
-% \subsection{Confirmation of \xintfracnameimp loading}
-% \begin{macrocode}
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintexpr}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintexpr}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-% \end{macrocode}
-% \subsection{Catcodes}
-% \begin{macrocode}
\XINTsetupcatcodes%
% \end{macrocode}
% \subsection{Package identification}
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2014/04/01 v1.09n Expandable expression parser (jfB)]%
-% \end{macrocode}
-% \subsection{Encapsulation in pseudo cs names, helper macros}
-% \lverb|1.09i uses .= for encapsulation, thus allowing \escapechar to be
-% anything (all previous releases were with ., so \escapechar 46 was forbidden).
-% Besides, the \edef definition has \space already expanded, perhaps this will
-% compensate a tiny bit the time penalty of `.=' viz `.' in unlocking... well
-% not really, I guess. (for no special reason 1.09k uses some \expandafter's
-% rather than \edef+\noexpand's for the definition of \XINT_expr_lock)|
-% \begin{macrocode}
-\def\xint_gob_til_! #1!{}% nota bene: this ! has catcode 11
-\expandafter\def\expandafter
-\XINT_expr_lock\expandafter#\expandafter1\expandafter !\expandafter
- {\expandafter\expandafter\space\csname .=#1\endcsname }%
+ [2014/10/28 v1.1 Expandable expression parser (jfB)]%
+% \end{macrocode}
+% \subsection{Locking and unlocking}
+% \begin{macrocode}
+\def\xint_gob_til_! #1!{}% this ! has catcode 11
+\edef\XINT_expr_lockscan#1!{\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
+\edef\XINT_expr_lockit #1{\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
+\def\XINT_expr_inintpart #1!{\XINT_num{#1}}%
+\def\XINT_expr_infracpart #1e#2!{#1![\the\numexpr#2-\xintLength{#1}]!}%
+\def\XINT_expr_inexppart e#1!{![\the\numexpr #1]!}%
+% je dois réfléchir si je dois bloquer expansion après unlock_a, à cause de nil.
\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }%
\def\XINT_expr_unlock_a #1.={}%
-\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
-\def\XINT_newexpr_setprefix #1>{\noexpand\romannumeral-`0}%
-\def\xint_UDxintrelaxfork #1\xint_relax #2#3\krof {#2}%
+\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
+\let\XINT_expr_done\space
% \end{macrocode}
-% \subsection{\csh{xintexpr}, \csh{xinttheexpr}, \csh{xintthe}, ...}
-% \lverb|\xintthe is defined with a parameter, I guess I wanted to make sure no
-% stray space tokens could cause a problem.
-%
-% With 1.09i, \xintiexpr replaces
-% \xintnumexpr which is kept for compatibility but will be removed at some
-% point. Should perhaps issue a warning, but well, people can also read the
-% documentation. Also 1.09i removes \xinttheeval.
-%
-% 1.09i has re-organized the material here.
-%
-% 1.09j modifies the mechanism of \XINT_expr_usethe and
-% \XINT_expr_print, etc... in order for \xintexpr-essions to be usable
-% within \edef'initions. I hesitated quite a bit with adding
-% \xint_protect in front of the \.=digits macros, which will in
-% 99.99999$% of use cases supposed all have \relax meaning; and it is a
-% bit of a pain, really, it is quite a pain to add these extra tokens
-% only for \edef contexts and for situations which will never occur...
-% well no damn'it let's *NOT* add this extra \xint_protect. Just one
-% before the printing macro (which can not be \protected, else \xintthe
-% could not work).|
-% \begin{macrocode}
-\def\xint_protect {\noexpand\xint_protect\noexpand }% 1.09j
-\def\XINT_expr_done {!\XINT_expr_usethe\xint_protect\XINT_expr_print }%
-\let\XINT_iiexpr_done \XINT_expr_done
-\def\XINT_iexpr_done {!\XINT_expr_usethe\xint_protect\XINT_iexpr_print }%
-\def\XINT_flexpr_done {!\XINT_expr_usethe\xint_protect\XINT_flexpr_print }%
-\def\XINT_boolexpr_done {!\XINT_expr_usethe\xint_protect\XINT_boolexpr_print }%
-\protected\def\XINT_expr_usethe #1#2#3% modified in 1.09j
- {\xintError:missing_xintthe!\show#3missing xintthe (see log)!}%
-\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}%
-\let\XINT_expr_print \XINT_expr_unlock
-\def\XINT_iexpr_print #1{\xintRound:csv {\XINT_expr_unlock #1}}%
-\def\XINT_flexpr_print #1{\xintFloat:csv {\XINT_expr_unlock #1}}%
-\def\XINT_boolexpr_print #1{\xintIsTrue:csv{\XINT_expr_unlock #1}}%
+% \subsection{\csh{XINT_expr_wrap}, \csh{XINT_iiexpr_wrap}}
+% \begin{macrocode}
+\def\XINT_expr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_expr_print }%
+\def\XINT_iiexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_iiexpr_print }%
+% \end{macrocode}
+% \subsection{\csh{XINT_protectii}, \csh{XINT_expr_usethe}}
+% \begin{macrocode}
+\def\XINT_protectii #1{\noexpand\XINT_protectii\noexpand #1\noexpand }%
+\protected\def\XINT_expr_usethe\XINT_protectii {\xintError:missing_xintthe!}%
+% \catcode`. 11 \catcode32=11 \catcode`=11\relax%
+% \def\XINT_expr_nil{!\XINT_expr_usethe\XINT_protectii\XINT_expr_unlock\.= }%
+% \catcode`=12\catcode32=10\relax\catcode`. 12
+% \end{macrocode}
+% \subsection{\csh{XINT_expr_print}, \csh{XINT_iiexpr_print}, \csh{XINT_boolexpr_print}}
+% \lverb|See also the \XINT_flexpr_print which is special, below.|
+% \begin{macrocode}
+\def\XINT_expr_print #1{\xintSPRaw::csv {\XINT_expr_unlock #1}}%
+\def\XINT_iiexpr_print #1{\xintCSV::csv {\XINT_expr_unlock #1}}%
+\def\XINT_boolexpr_print #1{\xintIsTrue::csv {\XINT_expr_unlock #1}}%
+% \end{macrocode}
+% \subsection{\csh{xintexpr}, \csh{xintiexpr}, \csh{xintfloatexpr},
+% \csh{xintiiexpr}, \csh{xinttheexpr}, etc\dots}
+% \begin{macrocode}
\def\xintexpr {\romannumeral0\xinteval }%
+\def\xintiexpr {\romannumeral0\xintieval }%
\def\xintfloatexpr {\romannumeral0\xintfloateval }%
\def\xintiiexpr {\romannumeral0\xintiieval }%
-\def\xinteval
- {\expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext }%
-\def\xintfloateval
- {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
-\def\xintiieval
- {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
-\def\xinttheexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
-\def\xintthefloatexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintfloateval }%
+\def\xinttheexpr
+ {\romannumeral-`0\expandafter\XINT_expr_print\romannumeral0\xintbareeval }%
+\def\xinttheiexpr {\romannumeral-`0\xintthe\xintiexpr }%
+\def\xintthefloatexpr {\romannumeral-`0\xintthe\xintfloatexpr }%
\def\xinttheiiexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintiieval }%
-\def\xintiexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_iexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xinttheiexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_iexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\let\xintnumexpr \xintiexpr % deprecated
-\let\xintthenumexpr\xinttheiexpr % deprecated
-% \end{macrocode}
-% \subsection{\csh{xintifboolexpr}, \csh{xintifboolfloatexpr}, csh{xintifbooliiexpr}}
-% \lverb|1.09c. Does not work with comma separated expressions. I could
-% make use \xintORof:csv (or AND, or XOR) to allow it, but don't know it the
-% overhead is worth it.
-%
-% 1.09i adds \xintifbooliiexpr |
-% \begin{macrocode}
-\def\xintifboolexpr #1%
- {\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
-\def\xintifboolfloatexpr #1%
- {\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
-\def\xintifbooliiexpr #1%
- {\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
-% \end{macrocode}
-% \subsection{\csh{XINT\_get\_next}: looking for a number}
-% \lverb|June 14: 1.08b adds a second \romannumeral-`0 to \XINT_expr_getnext in
-% an attempt to solve a problem with space tokens stopping the \romannumeral and
-% thus preventing expansion of the following token. For example: 1+ \the\cnta
-% caused a problem, as `\the' was not expanded. I did not define
-% \XINT_expr_getnext as a macro with parameter (which would have cured
-% preventively this), precisely to try to recognize brace pairs. The second
-% \romannumeral-`0 is added for the same reason in other places.
-%
-% The get-next scans forward to find a number: after expansion of what comes
-% next, an opening parenthesis signals a parenthesized sub-expression, a ! with
-% catcode 11 signals there was there an \xintexpr.. \relax sub-expression (now
-% evaluated), a minus is a prefix operator, a plus is silently ignored, a digit
-% or decimal point signals to start gathering a number, braced material {...} is
-% allowed and will be directly fed into a \csname..\endcsname for complete
-% expansion which must delivers a (fractional) number, possibly ending in [n];
-% explicit square brackets must be enclosed into such braces. Once a number
-% issues from the previous procedures, it is a locked into a
-% \csname...\endcsname, and the flow then proceeds with \XINT_expr_getop which
-% will scan for an infix or postfix operator following the number.
-%
-% A special r\^ole is played by underscores _ for use with \xintNewExpr
-% to input macro parameters.
-%
-% Release 1.09a implements functions; the idea is that a letter (actually,
-% anything not otherwise recognized!) triggers the function name gatherer, the
-% comma is promoted to a binary operator of priority intermediate between
-% parentheses and infix operators. The code had some other revisions in order
-% for all the _getnext and _getop macros to now be shared by \xintexpr and
-% \xintfloatexpr.
+ {\romannumeral-`0\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval }%
+% \let\xintnumexpr \xintiexpr % was deprecated, now obsolete with 1.1
+% \let\xintthenumexpr\xinttheiexpr % was deprecated, now obsolete with 1.1
+% \end{macrocode}
+% \subsection{\csh{xintthe}}
+% \begin{macrocode}
+\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}%
+% \end{macrocode}
+% \subsection{\csh{xintthecoords}}
+% \lverb|1.1 Wraps up an even number of comma separated items into pairs of
+% TikZ coordinates; for use in the following way:
%
-% 1.09i now allows direct insertion of \count's, \dimen's and \skip's which will
-% be unpacked using \number.
+% coordinates {\xintthecoords\xintfloatexpr ... \relax}
%
-% 1.09i speeds up a bit the recognition of a braced thing: the case of a single
-% braced control sequence makes a third expansion mandatory, let's do it
-% immediately and not wait. So macros got shuffled and modified a bit.
+% The crazyness with the \csname and unlock is due to TikZ somewhat STRANGE
+% control of the TOTAL number of expansions which should not exceed the very low
+% value of 100 !! As we implemented \XINT_thecoords_b in an "inline" style for
+% efficiency, we need to hide its expansions.
%
-% \XINT_expr_unpackvariable does not insert a [0] for compatibility with
-% \xintiiexpr. A [0] would have made a bit faster \xintexpr macros when dealing
-% with an unpacked count control sequence, as without it the \xintnum will be
-% used in the parsing by xintfrac macros when the number is used. But [0] is not
-% accepted by most macros ultimately called by \xintiiexpr.|
+% Not to be used as \xintthecoords\xintthefloatexpr, only as
+% \xintthecoords\xintfloatexpr (or \xintiexpr etc...). Perhaps \xintthecoords
+% could make an extra check, but one should not accustome users to too loose
+% requirements!|
+% \begin{macrocode}
+\def\xintthecoords #1{\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_thecoords_a
+ \expandafter\xint_gobble_iii\romannumeral0#1}%
+\def\XINT_thecoords_a #1#2% #1=print macro, indispensible for scientific notation
+ {\expandafter\XINT_expr_unlock\csname.=\expandafter\XINT_thecoords_b
+ \romannumeral-`0#1#2,!,!,^\endcsname }%
+\def\XINT_thecoords_b #1#2,#3#4,%
+ {\xint_gob_til_! #3\XINT_thecoords_c ! (#1#2, #3#4)\XINT_thecoords_b }%
+\def\XINT_thecoords_c #1^{}%
+% \end{macrocode}
+% \subsection{\csh{xintbareeval}, \csh{xintbarefloateval}, \csh{xintbareiieval}}
+% \begin{macrocode}
+\def\xintbareeval
+ {\expandafter\XINT_expr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintbarefloateval
+ {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintbareiieval
+ {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+% \end{macrocode}
+% \subsection{\csh{xinteval}, \csh{xintiieval}}
+% \begin{macrocode}
+\def\xinteval {\expandafter\XINT_expr_wrap\romannumeral0\xintbareeval }%
+\def\xintiieval {\expandafter\XINT_iiexpr_wrap\romannumeral0\xintbareiieval }%
+% \end{macrocode}
+% \subsection{\csh{xintieval}, \csh{XINT_iexpr_wrap}}
+% \lverb|Optional argument since 1.1|
+% \begin{macrocode}
+\def\xintieval #1%
+ {\ifx [#1\expandafter\XINT_iexpr_withopt\else\expandafter\XINT_iexpr_noopt \fi #1}%
+\def\XINT_iexpr_noopt
+ {\expandafter\XINT_iexpr_wrap \expandafter 0\romannumeral0\xintbareeval }%
+\def\XINT_iexpr_withopt [#1]%
+{%
+ \expandafter\XINT_iexpr_wrap\expandafter
+ {\the\numexpr \xint_zapspaces #1 \xint_bye\xint_bye\expandafter}%
+ \romannumeral0\xintbareeval
+}%
+\def\XINT_iexpr_wrap #1#2%
+{%
+ \expandafter\XINT_expr_wrap
+ \csname .=\xintRound::csv {#1}{\XINT_expr_unlock #2}\endcsname
+}%
+% \end{macrocode}
+% \subsection{\csh{xintfloateval}, \csh{XINT_flexpr_wrap}, \csh{XINT_flexpr_print}}
+% \lverb|Optional argument since 1.1|
% \begin{macrocode}
-\def\XINT_expr_getnext
+\def\xintfloateval #1%
{%
- \expandafter\XINT_expr_getnext_checkforbraced_a
- \romannumeral-`0\romannumeral-`0%
+ \ifx [#1\expandafter\XINT_flexpr_withopt_a\else\expandafter\XINT_flexpr_noopt
+ \fi #1%
}%
-\def\XINT_expr_getnext_checkforbraced_a #1% was done later in <1.09i
+\def\XINT_flexpr_noopt
{%
- \expandafter\XINT_expr_getnext_checkforbraced_b\expandafter
- {\romannumeral-`0#1}%
+ \expandafter\XINT_flexpr_withopt_b\expandafter\xinttheDigits
+ \romannumeral0\xintbarefloateval
}%
-\def\XINT_expr_getnext_checkforbraced_b #1%
+\def\XINT_flexpr_withopt_a [#1]%
{%
- \XINT_expr_getnext_checkforbraced_c #1\xint_relax\Z {#1}%
+ \expandafter\XINT_flexpr_withopt_b\expandafter
+ {\the\numexpr\xint_zapspaces #1 \xint_bye\xint_bye\expandafter}%
+ \romannumeral0\xintbarefloateval
}%
-\def\XINT_expr_getnext_checkforbraced_c #1#2%
+\def\XINT_flexpr_withopt_b #1#2%
{%
- \xint_UDxintrelaxfork
- #1\XINT_expr_getnext_wasemptyorspace
- #2\XINT_expr_getnext_gotonetoken_wehope
- \xint_relax\XINT_expr_getnext_gotbracedstuff
- \krof
-}% doubly braced things are not acceptable, will cause errors.
-\def\XINT_expr_getnext_wasemptyorspace #1{\XINT_expr_getnext }%
-\def\XINT_expr_getnext_gotbracedstuff #1\xint_relax\Z #2%
+ \expandafter\XINT_flexpr_wrap\csname .;#1.=% ; and not : as before b'cause NewExpr
+ \XINTinFloat::csv {#1}{\XINT_expr_unlock #2}\endcsname
+}%
+\def\XINT_flexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_flexpr_print }%
+\def\XINT_flexpr_print #1%
{%
- \expandafter\XINT_expr_getop\csname .=#2\endcsname
+ \expandafter\xintPFloat::csv
+ \romannumeral-`0\expandafter\XINT_expr_unlock_sp\string #1!%
}%
-\def\XINT_expr_getnext_gotonetoken_wehope\Z #1%
+\catcode`: 12
+ \def\XINT_expr_unlock_sp #1.;#2.=#3!{{#2}{#3}}%
+\catcode`: 11
+% \end{macrocode}
+% \subsection{\csh{xintboolexpr}, \csh{xinttheboolexpr}}
+% \begin{macrocode}
+\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
+\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
+\def\XINT_boolexpr_done { !\XINT_expr_usethe\XINT_protectii\XINT_boolexpr_print }%
+% \end{macrocode}
+% \subsection{\csh{xintifboolexpr}, \csh{xintifboolfloatexpr}, \csh{xintifbooliiexpr}}
+% \lverb|Do not work with comma separated expressions.|
+% \begin{macrocode}
+\def\xintifboolexpr #1{\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
+\def\xintifboolfloatexpr #1{\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
+\def\xintifbooliiexpr #1{\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
+% \end{macrocode}
+% \subsection{Macros handling csv lists on output (for \csh{XINT_expr_print} et
+% al. routines)}
+% \lverb|Changed completely for 1.1, which adds the optional arguments to
+% \xintiexpr and \xintfloatexpr.|
+% \subsubsection{\csh{XINT_::_end}}
+% \lverb|Le mécanisme est le suivant, #2 est dans des accolades et commence par
+% ,<sp>. Donc le gobble se débarrasse du, et le <sp> après brace stripping
+% arrête un \romannumeral0 ou \romannumeral-`0|
+% \begin{macrocode}
+\def\XINT_::_end #1,#2{\xint_gobble_i #2}%
+% \end{macrocode}
+% \subsubsection{\csh{xintCSV::csv}}
+% \lverb|pour \xinttheiiexpr|
+% \begin{macrocode}
+\def\xintCSV::csv #1{\expandafter\XINT_csv::_a\romannumeral-`0#1,^,}%
+\def\XINT_csv::_a {\XINT_csv::_b {}}%
+\def\XINT_csv::_b #1#2,{\XINT_csv::_c #2,{#1}}%
+\def\XINT_csv::_c #1{\if ^#1\expandafter\XINT_::_end\fi\XINT_csv::_d #1}%
+\def\XINT_csv::_d #1,#2{\XINT_csv::_b {#2, #1}}% possibly, item #1 is empty.
+% \end{macrocode}
+% \subsubsection{\csh{xintSPRaw}, \csh{xintSPRaw::csv}}
+% \lverb|Pour \xinttheexpr.
+% J'avais voulu optimiser en testant si présence ou non de [N],
+% cependant reduce() produit résultat sans, et du coup, le /1 peut ne pas
+% être retiré. Bon je rajoute un [0] dans reduce. 14/10/25 au moment de boucler.|
+% \begin{macrocode}
+\def\xintSPRaw {\romannumeral0\xintspraw }%
+\def\xintspraw #1{\expandafter\XINT_spraw\romannumeral-`0#1[\W]}%
+\def\XINT_spraw #1[#2#3]{\xint_gob_til_W #2\XINT_spraw_a\W\XINT_spraw_p #1[#2#3]}%
+\def\XINT_spraw_a\W\XINT_spraw_p #1[\W]{ #1}%
+\def\XINT_spraw_p #1[\W]{\xintpraw {#1}}%
+\def\xintSPRaw::csv #1{\romannumeral0\expandafter\XINT_spraw::_a\romannumeral-`0#1,^,}%
+\def\XINT_spraw::_a {\XINT_spraw::_b {}}%
+\def\XINT_spraw::_b #1#2,{\XINT_spraw::_c #2,{#1}}%
+\def\XINT_spraw::_c #1{\if ,#1\xint_dothis\XINT_spraw::_e\fi
+ \if ^#1\xint_dothis\XINT_::_end\fi
+ \xint_orthat\XINT_spraw::_d #1}%
+\def\XINT_spraw::_d #1,{\expandafter\XINT_spraw::_e\romannumeral0\XINT_spraw #1[\W],}%
+\def\XINT_spraw::_e #1,#2{\XINT_spraw::_b {#2, #1}}%
+% \end{macrocode}
+% \subsubsection{\csh{xintIsTrue::csv}}
+% \begin{macrocode}
+\def\xintIsTrue::csv #1{\romannumeral0\expandafter\XINT_istrue::_a\romannumeral-`0#1,^,}%
+\def\XINT_istrue::_a {\XINT_istrue::_b {}}%
+\def\XINT_istrue::_b #1#2,{\XINT_istrue::_c #2,{#1}}%
+\def\XINT_istrue::_c #1{\if ,#1\xint_dothis\XINT_istrue::_e\fi
+ \if ^#1\xint_dothis\XINT_::_end\fi
+ \xint_orthat\XINT_istrue::_d #1}%
+\def\XINT_istrue::_d #1,{\expandafter\XINT_istrue::_e\romannumeral0\xintisnotzero {#1},}%
+\def\XINT_istrue::_e #1,#2{\XINT_istrue::_b {#2, #1}}%
+% \end{macrocode}
+% \subsubsection{\csh{xintRound::csv}}
+% \lverb|Pour \xintiexpr avec argument optionnel (finalement, malgré un
+% certain overhead lors de l'exécution, pour économiser du code je ne
+% distingue plus les deux cas). Reason for annoying expansion bridge is
+% related to \xintNewExpr. Attention utilise \XINT_:::_end.|
+% \begin{macrocode}
+\def\XINT_:::_end #1,#2#3{\xint_gobble_i #3}%
+\def\xintRound::csv #1#2{\romannumeral0\expandafter\XINT_round::_b\expandafter
+ {\the\numexpr#1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_round::_b #1#2#3,{\XINT_round::_c #3,{#1}{#2}}%
+\def\XINT_round::_c #1{\if ,#1\xint_dothis\XINT_round::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_round::_d #1}%
+\def\XINT_round::_d #1,#2{%
+ \expandafter\XINT_round::_e\romannumeral0\ifnum#2>\xint_c_
+ \expandafter\xintround\else\expandafter\xintiround\fi {#2}{#1},{#2}}%
+\def\XINT_round::_e #1,#2#3{\XINT_round::_b {#2}{#3, #1}}%
+% \end{macrocode}
+% \subsubsection{\csh{XINTinFloat::csv}}
+% \lverb|Pour \xintfloatexpr. Attention, prépare sous la forme digits[N] pour
+% traitement par les macros. Pas utilisé en sortie. Utilise \XINT_:::_end.|
+% \begin{macrocode}
+\def\XINTinFloat::csv #1#2{\romannumeral0\expandafter\XINT_infloat::_b\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_infloat::_b #1#2#3,{\XINT_infloat::_c #3,{#1}{#2}}%
+\def\XINT_infloat::_c #1{\if ,#1\xint_dothis\XINT_infloat::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_infloat::_d #1}%
+\def\XINT_infloat::_d #1,#2%
+ {\expandafter\XINT_infloat::_e\romannumeral0\XINTinfloat [#2]{#1},{#2}}%
+\def\XINT_infloat::_e #1,#2#3{\XINT_infloat::_b {#2}{#3, #1}}%
+% \end{macrocode}
+% \subsubsection{\csh{xintPFloat::csv}}
+% \lverb|Expansion à cause de \xintNewExpr. Attention à l'ordre, pas le même que pour
+% \XINTinFloat::csv. Donc c'est cette routine qui imprime. Utilise \XINT_:::_end|
+% \begin{macrocode}
+\def\xintPFloat::csv #1#2{\romannumeral0\expandafter\XINT_pfloat::_b\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_pfloat::_b #1#2#3,{\XINT_pfloat::_c #3,{#1}{#2}}%
+\def\XINT_pfloat::_c #1{\if ,#1\xint_dothis\XINT_pfloat::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_pfloat::_d #1}%
+\def\XINT_pfloat::_d #1,#2%
+ {\expandafter\XINT_pfloat::_e\romannumeral0\XINT_pfloat_opt [\xint_relax #2]{#1},{#2}}%
+\def\XINT_pfloat::_e #1,#2#3{\XINT_pfloat::_b {#2}{#3, #1}}%
+% \end{macrocode}
+% \subsection{\csh{XINT_expr_getnext}: fetching some number then an operator}
+% \lverb|Big change in 1.1, no attempt to detect braced stuff anymore as the
+% [N] notation is implemented otherwise. Now, braces should not be used at
+% all; one level removed, then \romannumeral-`0 expansion.|
+% \begin{macrocode}
+\def\XINT_expr_getnext #1%
+{%
+ \expandafter\XINT_expr_getnext_a\romannumeral-`0#1%
+}%
+\def\XINT_expr_getnext_a #1%
{% screens out sub-expressions and \count or \dimen registers/variables
\xint_gob_til_! #1\XINT_expr_subexpr !% recall this ! has catcode 11
\ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs
- \expandafter\XINT_expr_countdimenetc_fork
+ \expandafter\XINT_expr_countetc
\else
- \expandafter\expandafter\expandafter
- \XINT_expr_getnext_onetoken_fork\expandafter\string
+ \expandafter\expandafter\expandafter\XINT_expr_getnextfork\expandafter\string
\fi
#1%
}%
\def\XINT_expr_subexpr !#1\fi !{\expandafter\XINT_expr_getop\xint_gobble_iii }%
-\def\XINT_expr_countdimenetc_fork #1%
+\def\XINT_expr_countetc #1%
{%
\ifx\count#1\else\ifx#1\dimen\else\ifx#1\numexpr\else\ifx#1\dimexpr\else
- \ifx\skip#1\else\ifx\glueexpr#1\else
- \XINT_expr_unpackvariable
- \fi\fi\fi\fi\fi\fi
+ \ifx\skip#1\else\ifx\glueexpr#1\else\ifx\fontdimen#1\else
+ \XINT_expr_unpackvar
+ \fi\fi\fi\fi\fi\fi\fi
\expandafter\XINT_expr_getnext\number #1%
}%
-\def\XINT_expr_unpackvariable\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext
- \number #1{\fi\fi\fi\fi\fi\fi
- \expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
-% \end{macrocode}
-% \lverb|1.09a: In order to have this code shared by \xintexpr and
-% \xintfloatexpr, I have moved to the until macros the responsability to choose
-% expr or floatexpr, hence here, the opening parenthesis for example can not be
-% triggered directly as it would not know in which context it works. Hence the
-% \xint_c_xviii ({}. And also the mechanism of \xintNewExpr has been modified to
-% allow use of #.
-%
-% 1.09i also has \xintiiexpr. |
-% \begin{macrocode}
+\def\XINT_expr_unpackvar\fi\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext\number #1%
+ {\fi\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
\begingroup
\lccode`*=`#
\lowercase{\endgroup
-\def\XINT_expr_sixwayfork #1(-.+*#2#3\krof {#2}%
-\def\XINT_expr_getnext_onetoken_fork #1%
-{% The * is in truth catcode 12 #. For (hacking) use with \xintNewExpr.
- \XINT_expr_sixwayfork
- #1-.+*{\xint_c_xviii ({}}% back to until for oparen triggering
- (#1.+*{-}%
- (-#1+*{\XINT_expr_scandec_II .}%
- (-.#1*{\XINT_expr_getnext }%
- (-.+#1{\XINT_expr_scandec_II }%
- (-.+*{\XINT_expr_scan_dec_or_func #1}%
- \krof
+\def\XINT_expr_getnextfork #1{%
+ \if#1*\xint_dothis {\XINT_expr_scan_macropar *}\fi
+ \if#1[\xint_dothis {\xint_c_xviii ({}}\fi
+ \if#1+\xint_dothis \XINT_expr_getnext \fi
+ \if#1.\xint_dothis {\XINT_expr_scandec_II\XINT_expr_infracpart}\fi
+ \if#1-\xint_dothis -\fi
+ \if#1(\xint_dothis {\xint_c_xviii ({}}\fi
+ \xint_orthat {\XINT_expr_scan_nbr_or_func #1}%
}}%
+\def\XINT_expr_scan_macropar #1#2{\expandafter\XINT_expr_getop\csname .=#1#2\endcsname }%
% \end{macrocode}
-% \subsection{\csh{XINT\_expr\_scan\_dec\_or\_func}: collecting an integer or
-% decimal number or hexa-decimal number or function name}
-% \lverb|\XINT_expr_scanfunc_b rewritten in 1.09i. And 1.09k adds hexadecimal
-% numbers to the syntax, with " as prefix, and possibly a fractional part.
-% Naturally to postfix with an E in scientific notation, one would need to
-% surround the hexadecimal number in parentheses to avoid ambiguities; or
-% rather, just use a lowercase e. By the way, if I allowed only lowercase e for
-% scientific notation I could possibly fuse together the scanning in the dec and
-% hexa cases; up to some loss of syntax control in the dec case.|
+% \subsection{The integer or decimal number or hexa-decimal number or
+% function name or variable name or special hacky things big parser}
% \begin{macrocode}
-\def\XINT_expr_scan_dec_or_func #1% this #1 has necessarily here catcode 12
+\catcode96 11 % `
+\def\XINT_expr_scan_nbr_or_func #1% this #1 has necessarily here catcode 12
{%
- \ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scandec_I
- \else
- \if #1"\expandafter\expandafter\expandafter\XINT_expr_scanhex_I
- \else % We assume we are dealing with a function name!!
- \expandafter\expandafter\expandafter\XINT_expr_scanfunc
- \fi
- \fi #1%
+ \if "#1\xint_dothis \XINT_expr_scanhex_I\fi
+ \if `#1\xint_dothis {\XINT_expr_onlitteral_`}\fi
+ \ifnum \xint_c_ix<1#1 \xint_dothis \XINT_expr_scandec_I\fi
+ \xint_orthat \XINT_expr_scanfunc #1%
}%
-\def\XINT_expr_scanfunc
+\catcode96 12 % `
+\def\XINT_expr_scandec_I
{%
- \expandafter\XINT_expr_func\romannumeral-`0\XINT_expr_scanfunc_c
+ \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
+ \XINT_expr_lockscan\romannumeral0\expandafter\XINT_expr_inintpart
+ \romannumeral-`0\XINT_expr_scanintpart_b
}%
-\def\XINT_expr_scanfunc_c #1%
+\def\XINT_expr_scandec_II
{%
- \expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanfunc_a\romannumeral-`0\romannumeral-`0%
+ \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
+ \XINT_expr_lockscan\romannumeral0\expandafter\XINT_expr_inintpart
+ \romannumeral-`0\XINT_expr_scanfracpart_b
+}%
+% \end{macrocode}
+% \subsubsection{Integral part}
+% \begin{macrocode}
+\def\XINT_expr_scanintpart_a #1%
+{% careful that ! has catcode letter here
+ \ifcat \relax #1\xint_dothis{!!#1}\fi % stops the scan
+ \if e#1\xint_dothis{\expandafter\XINT_expr_inexppart
+ \romannumeral-`0\XINT_expr_scanexppart_a e}\fi
+ \if E#1\xint_dothis{\expandafter\XINT_expr_inexppart
+ \romannumeral-`0\XINT_expr_scanexppart_a e}\fi
+ % \if @#1\xint_dothis{!*#1}\fi % tacit multiplication later
+ % \if _#1\xint_dothis{!*#1}\fi % tacit multiplication for variables
+ \ifcat a#1\xint_dothis{!!*#1}\fi % includes subexpressions (#1=! letter)
+ \xint_orthat {\expandafter\XINT_expr_scanintpart_aa\string #1}%
}%
-\def\XINT_expr_scanfunc_a #1% please no braced things here!
+\def\XINT_expr_scanintpart_aa #1%
{%
- \ifcat #1\relax % missing opening parenthesis, probably
- \expandafter\XINT_expr_scanfunc_panic
- \else
- \xint_afterfi{\expandafter\XINT_expr_scanfunc_b \string #1}%
- \fi
+ \if .#1\xint_dothis\XINT_expr_scandec_transition\fi
+ \ifnum \xint_c_ix<1#1 \xint_dothis\XINT_expr_scanintpart_b\fi
+ \xint_orthat {!!}#1%
}%
-\def\xint_UDparenfork #1()#2#3\krof {#2}%
-\def\XINT_expr_scanfunc_b #1%
+\def\XINT_expr_scanintpart_b #1#2%
{%
- \xint_UDparenfork
- #1){(}% and then \XINT_expr_func
- (#1{(}% and then \XINT_expr_func (this is for bool/toggle names)
- (){\XINT_expr_scanfunc_c #1}%
- \krof
+ \expandafter #1\romannumeral-`0\expandafter
+ \XINT_expr_scanintpart_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scanfunc_panic {\xintError:bigtroubleahead(0\relax }%
-\def\XINT_expr_func #1(% common to expr and flexpr and iiexpr
+\def\XINT_expr_scandec_transition .#1%
{%
- \xint_c_xviii @{#1}% functions have the highest priority.
+ \expandafter\XINT_expr_scandec_trans_a\romannumeral-`0#1%
}%
-% \end{macrocode}
-% \lverb|Scanning for a number of fraction. Once gathered, lock it and do
-% _getop. 1.09i modifies \XINT_expr_scanintpart_a (splits _aa) and also
-% \XINT_expr_scanfracpart_a in
-% order for the tacit multiplication of \count's and \dimen's to be compatible
-% with escape-char=a digit.
-%
-% 1.09j further extends for recognition of an \xint..expr and then insertion
-% of a * (which is done in \XINT_expr_getop_a).|
-% \begin{macrocode}
-\def\XINT_expr_scandec_I
+\def\XINT_expr_scandec_trans_a #1%
{%
- \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\romannumeral-`0\XINT_expr_scanintpart_b
+ \if .#1\xint_dothis{!!..}\fi
+ \xint_orthat {\expandafter\XINT_expr_infracpart
+ \romannumeral-`0\XINT_expr_scanfracpart_a #1}%
}%
-\def\XINT_expr_scandec_II
+% \end{macrocode}
+% \subsubsection{Fractional part}
+% \begin{macrocode}
+\def\XINT_expr_scanfracpart_a #1%
{%
- \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b
-}%
-\def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN}
-{% careful that ! has catcode letter here
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo !% this stops the scan
- {\expandafter\XINT_expr_scanintpart_aa\string }#1%
+ \ifcat \relax #1\xint_dothis{e!#1}\fi % stops the scan
+ \if e#1\xint_dothis{\XINT_expr_scanexppart_a e}\fi
+ \if E#1\xint_dothis{\XINT_expr_scanexppart_a e}\fi
+ \ifcat a#1\xint_dothis{e!*#1}\fi % and also the case of subexpressions (!)
+ \xint_orthat {\expandafter\XINT_expr_scanfracpart_aa\string #1}%
}%
-\def\XINT_expr_scanintpart_aa #1%
+\def\XINT_expr_scanfracpart_aa #1%
{%
\ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scanintpart_b
+ \expandafter\XINT_expr_scanfracpart_b
\else
- \if .#1%
- \expandafter\expandafter\expandafter
- \XINT_expr_scandec_transition
- \else % gather what we got so far, leave catcode 12 #1 in stream
- \expandafter\expandafter\expandafter !% ! of catcode 11, space needed
- \fi
+ \xint_afterfi {e!}%
\fi
#1%
}%
-\def\XINT_expr_scanintpart_b #1%
+\def\XINT_expr_scanfracpart_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanintpart_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanfracpart_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scandec_transition .%
+% \end{macrocode}
+% \subsubsection{Scientific notation}
+% \begin{macrocode}
+\def\XINT_expr_scanexppart_a #1#2%
{%
- \expandafter.\romannumeral-`0\expandafter
- \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0%
+ \expandafter #1\romannumeral-`0\expandafter
+ \XINT_expr_scanexppart_b\romannumeral-`0#2%
}%
-\def\XINT_expr_scanfracpart_a #1%
-{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo !% this stops the scan
- {\expandafter\XINT_expr_scanfracpart_aa\string }#1%
+\def\XINT_expr_scanexppart_b #1%
+{%
+ \ifcat \relax #1\xint_dothis{0!#1}\fi % stops the scan (incorrect syntax)
+ \ifcat a#1\xint_dothis{0!*#1}\fi % idem
+ \if +#1\xint_dothis {\XINT_expr_scanexppart_a +}\fi
+ \if -#1\xint_dothis {\XINT_expr_scanexppart_a -}\fi
+ \xint_orthat {\expandafter\XINT_expr_scanexppart_c\string #1}%
}%
-\def\XINT_expr_scanfracpart_aa #1%
+\def\XINT_expr_scanexppart_c #1%
{%
\ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scanfracpart_b
+ \expandafter\XINT_expr_scanexppart_d
\else
\expandafter !%
\fi
#1%
}%
-\def\XINT_expr_scanfracpart_b #1%
+\def\XINT_expr_scanexppart_d #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanexppart_e\romannumeral-`0#2%
+}%
+\def\XINT_expr_scanexppart_e #1%
+{%
+ \ifcat \relax #1\xint_dothis{!#1}\fi % stops the scan
+ \ifcat a#1\xint_dothis{!*#1}\fi % idem
+ \xint_orthat {\expandafter\XINT_expr_scanexppart_f\string #1}%
+}%
+\def\XINT_expr_scanexppart_f #1%
+{%
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanexppart_d
+ \else
+ \expandafter !%
+ \fi
+ #1%
}%
% \end{macrocode}
-% \lverb|1.09k [2014/01/21]: added scanning for an hexadecimal number, possibly
-% with a "hexa-decimal" part, only with uppercase ABCDEF (xintbinhex.sty works
-% with ABCDEF, as tex itself requires uppercase letters after ", thus at least I
-% feel comfortable with not bothering allowing abcdef... which would be possible
-% but would complicate things; although perhaps there could be some use for
-% lowercase. If needed, can be implemented, but I will probably long be dead
-% when an archivist droid will be the first around circa 2500 AD to read these
-% lines).
-%
-% For compatibility with \xintiiexpr, the [] thing is incorporated only if there
-% the parser encounters a . indicating a fractional part (this fractional part
-% may be empty). Thus for (infinitesimally) faster further processing by
-% \xintexpr, "ABC.+ etc... is better than "ABC+ etc... on the other hand the
-% initial processing with a . followed by an empty fractional part adds its bit
-% of overhead... The . is not allowed in \xintiiexpr, as it will provoke
-% insertion of [0] which is incompatible with it.|
+% \subsubsection{Hexadecimal numbers}
% \begin{macrocode}
\def\XINT_expr_scanhex_I #1%
{%
\expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\expandafter\XINT_expr_inhex
+ \XINT_expr_lockscan\expandafter\XINT_expr_inhex
\romannumeral-`0\XINT_expr_scanhexI_a
}%
\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname
@@ -24446,14 +26001,10 @@ $1$ or $-1$.
\fi
}%
\def\XINT_expr_scanhexI_a #1%
-{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo {.I;!}%
- {\expandafter\XINT_expr_scanhexI_aa\string }#1%
+{%
+ \ifcat #1\relax\xint_dothis{.I;!#1}\fi
+ \ifx !#1\xint_dothis{.I;!*!}\fi % tacit multiplication
+ \xint_orthat {\expandafter\XINT_expr_scanhexI_aa\string #1}%
}%
\def\XINT_expr_scanhexI_aa #1%
{%
@@ -24474,25 +26025,21 @@ $1$ or $-1$.
\fi
#1%
}%
-\def\XINT_expr_scanhexI_b #1%
+\def\XINT_expr_scanhexI_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanhexI_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexI_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scanhex_transition .%
+\def\XINT_expr_scanhex_transition .#1%
{%
\expandafter.\expandafter.\romannumeral-`0\expandafter
- \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexII_a\romannumeral-`0#1%
}%
\def\XINT_expr_scanhexII_a #1%
-{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo {;!}% this stops the scan
- {\expandafter\XINT_expr_scanhexII_aa\string }#1%
+{%
+ \ifcat #1\relax\xint_dothis{;!#1}\fi
+ \ifx !#1\xint_dothis{;!*!}\fi % tacit multiplication
+ \xint_orthat {\expandafter\XINT_expr_scanhexII_aa\string #1}%
}%
\def\XINT_expr_scanhexII_aa #1%
{%
@@ -24507,248 +26054,763 @@ $1$ or $-1$.
\fi
#1%
}%
-\def\XINT_expr_scanhexII_b #1%
+\def\XINT_expr_scanhexII_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexII_a\romannumeral-`0#2%
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_expr\_getop}: looking for an operator}
-% \lverb|June 14 (1.08b): I add here a second \romannumeral-`0, because
-% \XINT_expr_getnext and others try to expand the next token
-% but without grabbing it.
-%
-% This finds the next infix operator or closing parenthesis or postfix
-% exclamation mark !
-% or expression end. It then leaves in the token flow
-% <precedence> <operator> <locked number>. The <precedence> is generally
-% a character command which thus stops expansion and gives back control to an
-% \XINT_expr_until_<op> command; or it is the minus sign which will be
-% converted by a suitable \XINT_expr_checkifprefix_<p> into an operator
-% with a given inherited precedence. Earlier releases than 1.09c used tricks for
-% the postfix !, ?, :, with <precedence> being in fact a macro to act
-% immediately, and then re-activate \XINT_expr_getop.
-%
-% In versions earlier than 1.09a the <operator> was already made in to a control
-% sequence; but now it is a left as a token and will be (generally) converted by
-% the until macro which knows if it is in a \xintexpr or an \xintfloatexpr. (or
-% an \xintiiexpr, since 1.09i)
-%
-% 1.09i allows \count's, \dimen's, \skip's with tacit multiplication.
-%
-% 1.09j extends the mechanism of tacit multiplication to the case of a sub
-% xintexpression in its various variants. Careful that our ! has catcode 11 so
-% \ifx! would be a disaster...
-%
-% 1.09k extends tacit multiplication to the case of an encountered opening
-% parenthesis.
-%
-% |
+% \subsubsection{Function and variable names}
+% \begin{macrocode}
+\def\XINT_expr_scanfunc
+{%
+ \expandafter\XINT_expr_func\romannumeral-`0\XINT_expr_scanfunc_a
+}%
+\def\XINT_expr_scanfunc_a #1#2%
+{%
+ \expandafter #1\romannumeral-`0\expandafter\XINT_expr_scanfunc_b\romannumeral-`0#2%
+}%
+\def\XINT_expr_scanfunc_b #1%
+{%
+ \ifx !#1\xint_dothis{\xint_firstoftwo{(_*!}}\fi
+ \ifcat \relax#1\xint_dothis{(_}\fi
+ \if (#1\xint_dothis{\xint_firstoftwo{(`}}\fi
+ \if _#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \if @#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \ifnum \xint_c_ix<1\string#1 \xint_dothis \XINT_expr_scanfunc_a \fi
+ \ifcat a#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \xint_orthat {(_}%
+ #1%
+}%
+\def\XINT_expr_func #1(#2%
+{% #2=` pour une fonction, #2=_ pour une variable
+ \if #2`\ifcsname XINT_expr_var_#1\endcsname
+ \expandafter\expandafter\expandafter\xint_thirdofthree
+ \fi\fi
+ \xint_firstoftwo {\xint_c_xviii #2{#1}}{\xint_c_xviii _{#1}*(}%
+}%
+% \end{macrocode}
+% \subsection{\csh{XINT_expr_getop}: finding the next operator or closing
+% parenthesis or end of expression}
+% \lverb|Release 1.1 implements multi-character operators.|
% \begin{macrocode}
-\def\XINT_expr_getop #1% this #1 is the current locked computed value
-{% full expansion of next token, first swallowing a possible space
- \expandafter\XINT_expr_getop_a\expandafter #1%
- \romannumeral-`0\romannumeral-`0%
+\def\XINT_expr_getop #1#2% this #1 is the current locked computed value
+{%
+ \expandafter\XINT_expr_getop_a\expandafter #1\romannumeral-`0#2%
}%
+\catcode`* 11
\def\XINT_expr_getop_a #1#2%
-{% if a control sequence is found, must be either \relax or register|variable
- \ifcat #2\relax\expandafter\xint_firstoftwo
- \else \expandafter\xint_secondoftwo
- \fi
- {\ifx #2\relax\expandafter\xint_firstofthree
- \else\expandafter\xint_secondofthree % tacit multiplication
- \fi }%
- {\ifx !#2\expandafter\xint_secondofthree % tacit multiplication
- \else % 1.09k adds tacit multiplication in front of (
- \if (#2\expandafter\expandafter\expandafter\xint_secondofthree
- \else
- \expandafter\expandafter\expandafter\xint_thirdofthree
- \fi
- \fi }%
+{%
+ \ifx \relax #2\xint_dothis\xint_firstofthree\fi
+ \ifcat \relax #2\xint_dothis\xint_secondofthree\fi
+ \if _#2\xint_dothis \xint_secondofthree\fi
+ \if @#2\xint_dothis \xint_secondofthree\fi
+ \if (#2\xint_dothis \xint_secondofthree\fi
+ \ifx !#2\xint_dothis \xint_secondofthree\fi
+ \xint_orthat \xint_thirdofthree
{\XINT_expr_foundend #1}%
- {\XINT_expr_foundop *#1#2}%
- {\XINT_expr_foundop #2#1}%
+ {\XINT_expr_precedence_* *#1#2}% tacit multiplication
+ {\XINT_expr_getop_b #2#1}%
}%
+\catcode`* 12
\def\XINT_expr_foundend {\xint_c_ \relax }% \relax is a place holder here.
-\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.=f>
-{% 1.09a: no control sequence \XINT_expr_op_#1, code common to expr/flexpr
+\def\XINT_expr_getop_b #1%
+{% ? and : a special syntax in \xintexpr as they are
+ % followed by braced arguments, and thus we must intercept them here.
+ % I wanted to change this but now I don't have time to think about it.
+ % 1.1 removes : as logic operator. Replaced by ??.
+ \if '#1\xint_dothis{\XINT_expr_binopwrd }\fi
+ \if ?#1\xint_dothis{\XINT_expr_precedence_? ?}\fi
+% \if :#1\xint_dothis{\XINT_expr_precedence_: :}\fi % must preserve braces!
+ \xint_orthat {\XINT_expr_scanop_a #1}%
+}%
+\def\XINT_expr_binopwrd #1#2'{\expandafter\XINT_expr_foundop_a
+ \csname XINT_expr_itself_\xint_zapspaces #2 \xint_bye\xint_bye\endcsname #1}%
+\def\XINT_expr_scanop_a #1#2#3%
+ {\expandafter\XINT_expr_scanop_b\expandafter #1\expandafter #2\romannumeral-`0#3}%
+\def\XINT_expr_scanop_b #1#2#3%
+{%
+ \ifcat#3\relax\xint_dothis{\XINT_expr_foundop_a #1#2#3}\fi
+ \ifcsname XINT_expr_itself_#1#3\endcsname
+ \xint_dothis
+ {\expandafter\XINT_expr_scanop_c\csname XINT_expr_itself_#1#3\endcsname #2}\fi
+ \xint_orthat {\XINT_expr_foundop_a #1#2#3}%
+}%
+\def\XINT_expr_scanop_c #1#2#3%
+{%
+ \expandafter\XINT_expr_scanop_d\expandafter #1\expandafter #2\romannumeral-`0#3%
+}%
+\def\XINT_expr_scanop_d #1#2#3%
+{%
+ \ifcat#3\relax \xint_dothis{\XINT_expr_foundop #1#2#3}\fi
+ \ifcsname XINT_expr_itself_#1#3\endcsname
+ \xint_dothis
+ {\expandafter\XINT_expr_scanop_c\csname XINT_expr_itself_#1#3\endcsname #2}\fi
+ \xint_orthat {\csname XINT_expr_precedence_#1\endcsname #1#2#3}%
+}%
+\def\XINT_expr_foundop_a #1%
+{%
\ifcsname XINT_expr_precedence_#1\endcsname
- \expandafter\xint_afterfi\expandafter
- {\csname XINT_expr_precedence_#1\endcsname #1}%
+ \csname XINT_expr_precedence_#1\expandafter\endcsname
+ \expandafter #1%
\else
- \XINT_expr_unexpectedtoken
- \expandafter\XINT_expr_getop
+ \xint_afterfi{\XINT_expr_unknown_operator {#1}\XINT_expr_getop}%
\fi
}%
+\def\XINT_expr_unknown_operator #1{\xintError:removed \xint_gobble_i {#1}}%
+\def\XINT_expr_foundop #1{\csname XINT_expr_precedence_#1\endcsname #1}%
% \end{macrocode}
-% \subsection{Parentheses}
-% \lverb|1.09a removes some doubling of \romannumeral-`\0 from 1.08b
-% which served no useful purpose here (I think...). |
+% \subsection{Opening and closing parentheses, square brackets for lists, the
+% \unexpanded{\unexpanded{\detokenize{^C}}} for omit and abort within seq or rseq}
% \begin{macrocode}
-\def\XINT_tmpa #1#2#3#4#5%
+\catcode`) 11
+\def\XINT_tmpa #1#2#3#4% (avant #4#5)
{%
\def#1##1%
{%
\xint_UDsignfork
##1{\expandafter#1\romannumeral-`0#3}%
-{#2##1}%
- \krof
+ \krof
}%
\def#2##1##2%
{%
- \ifcase ##1\expandafter #4%
- \or\xint_afterfi{%
- \XINT_expr_extra_closing_paren
- \expandafter #1\romannumeral-`0\XINT_expr_getop
- }%
- \else
- \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname }%
+ \ifcase ##1\xint_afterfi
+ {\ifx\XINT_expr_itself_^C ##2\xint_dothis
+ {\expandafter#1\romannumeral-`0\expandafter\XINT_expr_getnext\xint_gobble_i}\fi
+ \xint_orthat \XINT_expr_done }%
+ \or\xint_afterfi{\XINT_expr_extra_)
+ \expandafter #1\romannumeral-`0\XINT_expr_getop }%
+ \else
+ \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#4_op_##2\endcsname }%
\fi
}%
}%
+\def\XINT_expr_extra_) {\xintError:removed }%
\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+ \expandafter\XINT_tmpa
\csname XINT_#1_until_end_a\expandafter\endcsname
\csname XINT_#1_until_end_b\expandafter\endcsname
- \csname XINT_#1_op_-vi\expandafter\endcsname
- \csname XINT_#1_done\endcsname
+ \csname XINT_#1_op_-vi\endcsname
{#1}%
}%
-\def\XINT_expr_extra_closing_paren {\xintError:removed }%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
- \def #1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
- \let #2#1%
+ \def #1##1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
+ \def #2{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
\def #3##1{\xint_UDsignfork
##1{\expandafter #3\romannumeral-`0#5}%
-{#4##1}%
\krof }%
- \def #4##1##2%
- {%
- \ifcase ##1\expandafter \XINT_expr_missing_cparen
- \or \expandafter \XINT_expr_getop
- \else \xint_afterfi
- {\expandafter #3\romannumeral-`0\csname XINT_#6_op_##2\endcsname }%
- \fi
+ \def #4##1##2{\ifcase ##1%
+ \xint_afterfi{\ifx\XINT_expr_itself_^C ##2\xint_dothis{\xint_c_ ##2}\fi
+ \xint_orthat\XINT_expr_missing_) }%
+ \or \csname XINT_#6_op_##2\expandafter\endcsname
+ \else
+ \xint_afterfi{\expandafter #3\romannumeral-`0\csname XINT_#6_op_##2\endcsname }%
+ \fi
}%
}%
+\def\XINT_expr_missing_) {\xintError:inserted \xint_c_ \XINT_expr_done }%
+\catcode`) 12
\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+ \expandafter\XINT_tmpa
\csname XINT_#1_op_(\expandafter\endcsname
\csname XINT_#1_oparen\expandafter\endcsname
\csname XINT_#1_until_)_a\expandafter\endcsname
\csname XINT_#1_until_)_b\expandafter\endcsname
- \csname XINT_#1_op_-vi\endcsname
+ \csname XINT_#1_op_-vi\endcsname
{#1}%
}%
-\def\XINT_expr_missing_cparen {\xintError:inserted \xint_c_ \XINT_expr_done }%
-\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_flexpr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_iiexpr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_expr_op_)\endcsname \XINT_expr_getop
-\expandafter\let\csname XINT_flexpr_op_)\endcsname\XINT_expr_getop
-\expandafter\let\csname XINT_iiexpr_op_)\endcsname\XINT_expr_getop
-% \end{macrocode}
-% \subsection{The \csh{XINT\_expr\_until\_<op>} macros for boolean operators,
-% comparison operators, arithmetic operators, scientfic notation.}
-% \lverb|Extended in 1.09a with comparison and boolean operators.
-% 1.09i adds \xintiiexpr and incorporates optional part [\XINTdigits] for a tiny
-% bit faster float operations now already equipped with their optional
-% argument|.
-% \begin{macrocode}
-\def\XINT_tmpb #1#2#3#4#5#6%#7%
-{%
- \expandafter\XINT_tmpc
- \csname XINT_#1_op_#3\expandafter\endcsname
- \csname XINT_#1_until_#3_a\expandafter\endcsname
- \csname XINT_#1_until_#3_b\expandafter\endcsname
- \csname XINT_#1_op_-#5\expandafter\endcsname
- \csname xint_c_#4\expandafter\endcsname
- \csname #2#6\expandafter\endcsname
- \csname XINT_expr_precedence_#3\endcsname {#1}%{#7}%
-}%
-\def\XINT_tmpc #1#2#3#4#5#6#7#8#9%
-{%
- \def #1##1% \XINT_expr_op_<op>
- {% keep value, get next number and operator, then do until
- \expandafter #2\expandafter ##1%
- \romannumeral-`0\expandafter\XINT_expr_getnext
- }%
- \def #2##1##2% \XINT_expr_until_<op>_a
- {\xint_UDsignfork
- ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -{#3##1##2}%
- \krof }%
- \def #3##1##2##3##4% \XINT_expr_until_<op>_b
- {% either execute next operation now, or first do next (possibly unary)
- \ifnum ##2>#5%
- \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
- \csname XINT_#8_op_##3\endcsname {##4}}%
- \else
- \xint_afterfi
- {\expandafter ##2\expandafter ##3%
- \csname .=#6#9{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
- \fi
- }%
- \let #7#5%
+\expandafter\let\csname XINT_expr_precedence_)\endcsname\xint_c_i
+\expandafter\let\csname XINT_expr_precedence_]\endcsname\xint_c_i
+\expandafter\let\csname XINT_expr_precedence_;\endcsname\xint_c_i
+\let\XINT_expr_precedence_a \xint_c_xviii
+\expandafter\let\csname XINT_expr_precedence_^C\endcsname \xint_c_
+\expandafter\let\csname XINT_expr_precedence_++)\endcsname \xint_c_i
+\catcode`. 11 \catcode`= 11 \catcode`+ 11
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_)\endcsname \XINT_expr_getop
+ \expandafter\let\csname XINT_#1_op_;\endcsname \space
+ \expandafter\def\csname XINT_#1_op_]\endcsname ##1{\XINT_expr_getop ##1a}%
+ \expandafter\let\csname XINT_#1_op_a\endcsname \XINT_expr_getop
+ \expandafter\def\csname XINT_#1_op_++)\endcsname ##1##2\relax
+ {\expandafter\XINT_expr_foundend \expandafter
+ {\expandafter\.=+\xintiCeil{\XINT_expr_unlock ##1}}}%
+}%
+\catcode`. 12 \catcode`= 12 \catcode`+ 12
+% \end{macrocode}
+% \subsection{\unexpanded{\unexpanded{The \detokenize{|, ||, &, &&, <, >, =,
+% ==, <=, >=, !=, +, -, *, /, ^, **, //, /:, .., ..[, ].., ][, ][:, :], ^C, and ++}
+% operators}}}
+% \begin{macrocode}
+\xintFor* #1 in {{==}{<=}{>=}{!=}{&&}{||}{**}{//}{/:}{..}{..[}{].}{]..}%
+ {+[}{-[}{*[}{/[}{**[}{^[}{a+}{a-}{a*}{a/}{a**}{a^}%
+ {][}{][:}{:]}{^C}{++}{++)}}
+ \do {\expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}}%
+% \subsubsection{\unexpanded{\unexpanded{The \detokenize{|, &, xor, <, >, =,
+% <=, >=, !=, //, /:, .., ..[, and ]..} operators}}}
+% \begin{macrocode}
+\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+{%
+ \def #1##1% \XINT_expr_op_<op> ou flexpr ou iiexpr
+ {% keep value, get next number and operator, then do until
+ \expandafter #2\expandafter ##1%
+ \romannumeral-`0\expandafter\XINT_expr_getnext }%
+ \def #2##1##2% \XINT_expr_until_<op>_a ou flexpr ou iiexpr
+ {\xint_UDsignfork ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_<op>_b ou flexpr ou iiexpr
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#5%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#8_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=#6{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
+ \fi }%
+ \let #7#5%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1{}}%
+\def\XINT_tmpb #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#3\expandafter\endcsname
+ \csname XINT_#1_until_#3_a\expandafter\endcsname
+ \csname XINT_#1_until_#3_b\expandafter\endcsname
+ \csname XINT_#1_op_-#5\expandafter\endcsname
+ \csname xint_c_#4\expandafter\endcsname
+ \csname #2#6\expandafter\endcsname
+ \csname XINT_expr_precedence_#3\endcsname {#1}%
+}%
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \def\XINT_tmpa ##1{\XINT_tmpb {#1}{xint}##1}%
+ \xintApplyInline {\XINT_tmpa }{%
+ {|{iii}{vi}{OR}}%
+ {&{iv}{vi}{AND}}%
+ {{xor}{iii}{vi}{XOR}}%
+ {<{v}{vi}{Lt}}%
+ {>{v}{vi}{Gt}}%
+ {={v}{vi}{Eq}}%
+ {{<=}{v}{vi}{LtorEq}}%
+ {{>=}{v}{vi}{GtorEq}}%
+ {{!=}{v}{vi}{Neq}}%
+ {{..}{iii}{vi}{Seq::csv}}% will get redefined to use \xintiiSeq::csv in xintiiexpr
+ {{//}{vii}{vii}{DivTrunc}}% will get redefined for xintiiexpr
+ {{/:}{vii}{vii}{Mod}}%
+ }%
+}%
+\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1}%
\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
{*{vii}{vii}{Mul}}%
{/{vii}{vii}{Div}}%
{^{viii}{viii}{Pow}}%
- {e{ix}{ix}{fE}}%
- {E{ix}{ix}{fE}}%
-}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1{}}%
-\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
+ {{..[}{iii}{vi}{SeqA::csv}}%
+ {{]..}{iii}{vi}{SeqB::csv}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1{[\XINTdigits]}}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1}%
\xintApplyInline {\XINT_tmpa }{%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
{*{vii}{vii}{Mul}}%
{/{vii}{vii}{Div}}%
{^{viii}{viii}{Power}}%
- {e{ix}{ix}{fE}}%
- {E{ix}{ix}{fE}}%
+ {{..[}{iii}{vi}{SeqA::csv}}%
+ {{]..}{iii}{vi}{SeqB::csv}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1{}}%
+\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1}%
\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
{+{vi}{vi}{iiAdd}}%
{-{vi}{vi}{iiSub}}%
{*{vii}{vii}{iiMul}}%
- {/{vii}{vii}{iiQuo}}%
+ {/{vii}{vii}{iiDivRound}}% CHANGED IN 1.1! PREVIOUSLY DID EUCLIDEAN QUOTIENT
{^{viii}{viii}{iiPow}}%
- {e{ix}{ix}{iE}}%
- {E{ix}{ix}{iE}}%
+ {{..[}{iii}{vi}{iiSeqA::csv}}%
+ {{]..}{iii}{vi}{iiSeqB::csv}}%
+ {{..}{iii}{vi}{iiSeq::csv}}%
+ {{//}{vii}{vii}{iiDivTrunc}}%
+ {{/:}{vii}{vii}{iiMod}}%
+}%
+% \end{macrocode}
+% \subsubsection{\unexpanded{\unexpanded{The \detokenize{]+, ]-, ]*, ]/, ]^,
+% +[, -[, *[, /[, and ^[} list operators}}}
+% \paragraph{\csh{XINT_expr_binop_inline_b}}\par
+% \begin{macrocode}
+\def\XINT_expr_binop_inline_a
+ {\expandafter\xint_gobble_i\romannumeral-`0\XINT_expr_binop_inline_b }%
+\def\XINT_expr_binop_inline_b #1#2,{\XINT_expr_binop_inline_c #2,{#1}}%
+\def\XINT_expr_binop_inline_c #1{%
+ \if ,#1\xint_dothis\XINT_expr_binop_inline_e\fi
+ \if ^#1\xint_dothis\XINT_expr_binop_inline_end\fi
+ \xint_orthat\XINT_expr_binop_inline_d #1}%
+\def\XINT_expr_binop_inline_d #1,#2{,#2{#1}\XINT_expr_binop_inline_b {#2}}%
+\def\XINT_expr_binop_inline_e #1,#2{,\XINT_expr_binop_inline_b {#2}}%
+\def\XINT_expr_binop_inline_end #1,#2{}%
+\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+{%
+ \def #1##1% \XINT_expr_op_<op> ou flexpr ou iiexpr
+ {% keep value, get next number and operator, then do until
+ \expandafter #2\expandafter ##1%
+ \romannumeral-`0\expandafter\XINT_expr_getnext }%
+ \def #2##1##2% \XINT_expr_until_<op>_a ou flexpr ou iiexpr
+ {\xint_UDsignfork ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_<op>_b ou flexpr ou iiexpr
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#5%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#8_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=\expandafter\XINT_expr_binop_inline_a\expandafter
+ {\expandafter\expandafter\expandafter#6\expandafter
+ \xint_exchangetwo_keepbraces\expandafter
+ {\expandafter\XINT_expr_unlock\expandafter ##4\expandafter}\expandafter}%
+ \romannumeral-`0\XINT_expr_unlock ##1,^,\endcsname }%
+ \fi }%
+ \let #7#5%
+}%
+\def\XINT_tmpb #1#2#3#4%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#2\expandafter\endcsname
+ \csname XINT_#1_until_#2_a\expandafter\endcsname
+ \csname XINT_#1_until_#2_b\expandafter\endcsname
+ \csname XINT_#1_op_-#3\expandafter\endcsname
+ \csname xint_c_#3\expandafter\endcsname
+ \csname #4\expandafter\endcsname
+ \csname XINT_expr_precedence_#2\endcsname {#1}%
+}%
+\xintApplyInline {\expandafter\XINT_tmpb \xint_firstofone}{%
+ {{expr}{a+}{vi}{xintAdd}}%
+ {{expr}{a-}{vi}{xintSub}}%
+ {{expr}{a*}{vii}{xintMul}}%
+ {{expr}{a/}{vii}{xintDiv}}%
+ {{expr}{a^}{viii}{xintPow}}%
+ {{iiexpr}{a+}{vi}{xintiiAdd}}%
+ {{iiexpr}{a-}{vi}{xintiiSub}}%
+ {{iiexpr}{a*}{vii}{xintiiMul}}%
+ {{iiexpr}{a/}{vii}{xintiiDivRound}}%
+ {{iiexpr}{a^}{viii}{xintiiPow}}%
+ {{flexpr}{a+}{vi}{XINTinFloatAdd}}%
+ {{flexpr}{a-}{vi}{XINTinFloatSub}}%
+ {{flexpr}{a*}{vii}{XINTinFloatMul}}%
+ {{flexpr}{a/}{vii}{XINTinFloatDiv}}%
+ {{flexpr}{a^}{viii}{XINTinFloatPower}}%
+}%
+\def\XINT_tmpc #1#2#3#4#5#6#7%
+{%
+ \def #1##1{\expandafter#2\expandafter##1\romannumeral-`0%
+ \expandafter #3\romannumeral-`0\XINT_expr_getnext }%
+ \def #2##1##2##3##4%
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#4%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#7_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=\expandafter\XINT_expr_binop_inline_a\expandafter
+ {\expandafter#5\expandafter
+ {\expandafter\XINT_expr_unlock\expandafter ##1\expandafter}\expandafter}%
+ \romannumeral-`0\XINT_expr_unlock ##4,^,\endcsname }%
+ \fi }%
+ \let #6#4%
+}%
+\def\XINT_tmpb #1#2#3#4%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#2\expandafter\endcsname
+ \csname XINT_#1_until_#2\expandafter\endcsname
+ \csname XINT_#1_until_)_a\expandafter\endcsname
+ \csname xint_c_#3\expandafter\endcsname
+ \csname #4\expandafter\endcsname
+ \csname XINT_expr_precedence_#2\endcsname {#1}%
+}%
+\xintApplyInline {\expandafter\XINT_tmpb\xint_firstofone }{%
+ {{expr}{+[}{vi}{xintAdd}}%
+ {{expr}{-[}{vi}{xintSub}}%
+ {{expr}{*[}{vii}{xintMul}}%
+ {{expr}{/[}{vii}{xintDiv}}%
+ {{expr}{^[}{viii}{xintPow}}%
+ {{iiexpr}{+[}{vi}{xintiiAdd}}%
+ {{iiexpr}{-[}{vi}{xintiiSub}}%
+ {{iiexpr}{*[}{vii}{xintiiMul}}%
+ {{iiexpr}{/[}{vii}{xintiiDivRound}}%
+ {{iiexpr}{^[}{viii}{xintiiPow}}%
+ {{flexpr}{+[}{vi}{XINTinFloatAdd}}%
+ {{flexpr}{-[}{vi}{XINTinFloatSub}}%
+ {{flexpr}{*[}{vii}{XINTinFloatMul}}%
+ {{flexpr}{/[}{vii}{XINTinFloatDiv}}%
+ {{flexpr}{^[}{viii}{XINTinFloatPower}}%
+}%
+% \end{macrocode}
+% \subsubsection{The 'and', 'or', 'xor', and 'mod' as infix operator words}
+% \begin{macrocode}
+\xintFor #1 in {and,or,xor,mod} \do {%
+ \expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}}%
+\expandafter\let\csname XINT_expr_precedence_and\expandafter\endcsname
+ \csname XINT_expr_precedence_&\endcsname
+\expandafter\let\csname XINT_expr_precedence_or\expandafter\endcsname
+ \csname XINT_expr_precedence_|\endcsname
+\expandafter\let\csname XINT_expr_precedence_mod\expandafter\endcsname
+ \csname XINT_expr_precedence_/:\endcsname
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_and\expandafter\endcsname
+ \csname XINT_#1_op_&\endcsname
+ \expandafter\let\csname XINT_#1_op_or\expandafter\endcsname
+ \csname XINT_#1_op_|\endcsname
+ \expandafter\let\csname XINT_#1_op_mod\expandafter\endcsname
+ \csname XINT_#1_op_/:\endcsname
+}%
+% \subsubsection{\unexpanded{\unexpanded{The \detokenize{||, &&, **, **[, ]**}
+% operators as synonyms}}}
+\expandafter\let\csname XINT_expr_precedence_==\expandafter\endcsname
+ \csname XINT_expr_precedence_=\endcsname
+\expandafter\let\csname XINT_expr_precedence_&&\expandafter\endcsname
+ \csname XINT_expr_precedence_&\endcsname
+\expandafter\let\csname XINT_expr_precedence_||\expandafter\endcsname
+ \csname XINT_expr_precedence_|\endcsname
+\expandafter\let\csname XINT_expr_precedence_**\expandafter\endcsname
+ \csname XINT_expr_precedence_^\endcsname
+\expandafter\let\csname XINT_expr_precedence_a**\expandafter\endcsname
+ \csname XINT_expr_precedence_a^\endcsname
+\expandafter\let\csname XINT_expr_precedence_**[\expandafter\endcsname
+ \csname XINT_expr_precedence_^[\endcsname
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_==\expandafter\endcsname
+ \csname XINT_#1_op_=\endcsname
+ \expandafter\let\csname XINT_#1_op_&&\expandafter\endcsname
+ \csname XINT_#1_op_&\endcsname
+ \expandafter\let\csname XINT_#1_op_||\expandafter\endcsname
+ \csname XINT_#1_op_|\endcsname
+ \expandafter\let\csname XINT_#1_op_**\expandafter\endcsname
+ \csname XINT_#1_op_^\endcsname
+ \expandafter\let\csname XINT_#1_op_a**\expandafter\endcsname
+ \csname XINT_#1_op_a^\endcsname
+ \expandafter\let\csname XINT_#1_op_**[\expandafter\endcsname
+ \csname XINT_#1_op_^[\endcsname
+}%
+% \end{macrocode}
+% \subsubsection{List selectors: [list][N], [list][:b], [list][a:], [list][a:b]}
+% \lverb|1.1 (27 octobre 2014) I implement Python syntax, see
+% http://stackoverflow.com/a/13005464/4184837. Do not implement third
+% argument giving the step. Also, I gather that [5:2] selector returns empty
+% and not, as I could have been tempted to do, (list[5], list[4], list[3]).
+% Anyway, it is simpler not to go that way. For reversing I could implement
+% [::-1] but this would get confusing, better to do function "reversed".
+%
+% This gets the job done, but I would definitely need \xintTrim::csv, \xintKeep::csv,
+% \xintNthElt::csv for better efficiency. Not for 1.1.|
+% \begin{macrocode}
+\def\XINT_tmpa #1#2#3#4#5#6%
+{%
+ \def #1##1% \XINT_expr_op_][
+ {%
+ \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
+ }%
+ \def #2##1##2% \XINT_expr_until_][_a
+ {\xint_UDsignfork
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_][_b
+ {%
+ \ifnum ##2>\xint_c_ii
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#6_op_##3\endcsname {##4}}%
+ \else
+ \xint_afterfi
+ {\expandafter ##2\expandafter ##3\csname
+ .=\expandafter\xintListSel:csv \romannumeral-`0\XINT_expr_unlock ##4;%
+ \XINT_expr_unlock ##1;\endcsname % unlock for \xintNewExpr
+ }%
+ \fi
+ }%
+ \let #5\xint_c_ii
}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+\expandafter\XINT_tmpa
+ \csname XINT_#1_op_][\expandafter\endcsname
+ \csname XINT_#1_until_][_a\expandafter\endcsname
+ \csname XINT_#1_until_][_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_][\endcsname {#1}%
+}%
+\def\XINT_tmpa #1#2#3#4#5#6%
+{%
+ \def #1##1% \XINT_expr_op_:
+ {%
+ \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
+ }%
+ \def #2##1##2% \XINT_expr_until_:_a
+ {\xint_UDsignfork
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_:_b
+ {%
+ \ifnum ##2>\xint_c_iii
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#6_op_##3\endcsname {##4}}%
+ \else
+ \xint_afterfi
+ {\expandafter ##2\expandafter ##3\csname
+ .=:\xintiiifSgn{\XINT_expr_unlock ##1}NPP.% : and dots for expansion
+ \xintiiifSgn{\XINT_expr_unlock ##4}NPP.% in \xintNewExpr context
+% reason for \xintNum is a/1[x] format, but -0.5 will not work, seen <0, but 0 after
+ \xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}\endcsname
+ }%
+ \fi
+ }%
+ \let #5\xint_c_iii
+}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+\expandafter\XINT_tmpa
+ \csname XINT_#1_op_:\expandafter\endcsname
+ \csname XINT_#1_until_:_a\expandafter\endcsname
+ \csname XINT_#1_until_:_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_:\endcsname {#1}%
+}%
+\catcode`[ 11 \catcode`] 11
+\let\XINT_expr_precedence_:] \xint_c_iii
+\def\XINT_expr_op_:] #1{\expandafter\xint_c_i\expandafter )%
+ \csname .=]\xintiiifSgn{\XINT_expr_unlock #1}npp\XINT_expr_unlock #1\endcsname }%
+\let\XINT_flexpr_op_:] \XINT_expr_op_:]
+\let\XINT_iiexpr_op_:] \XINT_expr_op_:]
+\let\XINT_expr_precedence_][: \xint_c_iii
+\edef\XINT_expr_op_][: #1{\xint_c_ii \expandafter\noexpand
+ \csname XINT_expr_itself_][\endcsname #10\string :}%
+% : must be catcode 12, else will be mistaken for start of variable by expression parser
+\let\XINT_flexpr_op_][: \XINT_expr_op_][:
+\let\XINT_iiexpr_op_][: \XINT_expr_op_][:
+\catcode`[ 12 \catcode`] 12
+\def\xintListSel:csv #1{% these complications are due to \xintNewExpr matters
+ \if ]\noexpand#1\xint_dothis{\expandafter\XINT_listsel:_s\romannumeral-`0}\fi
+ \if :\noexpand#1\xint_dothis{\XINT_listsel:_:}\fi
+ \xint_orthat {\XINT_listsel:_nth #1}%
+}%
+\def\XINT_listsel:_s #1{\if p#1\expandafter\XINT_listsel:_trim\else
+ \expandafter\XINT_listsel:_keep\fi }%
+\def\XINT_listsel:_: #1.#2.{\csname XINT_listsel:_#1#2\endcsname }%
+\def\XINT_listsel:_trim #1;#2;%
+ {\xintListWithSep,{\xintTrim {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}}%
+\def\XINT_listsel:_keep #1;#2;%
+ {\xintListWithSep,{\xintKeep {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}}%
+\def\XINT_listsel:_nth#1;#2;%
+ {\xintNthElt {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}%
+\def\XINT_listsel:_PP #1;#2;#3;%
+ {\xintListWithSep,%
+ {\xintTrim {\xintNum{#1}}%
+ {\xintKeep {\xintNum{#2}}%
+ {\xintCSVtoListNonStripped{#3}}%
+ }%
+ }%
+ }%
+\def\XINT_listsel:_NN #1;#2;#3;%
+ {\xintListWithSep,%
+ {\xintTrim {\xintNum{#2}}%
+ {\xintKeep {\xintNum{#1}}%
+ {\xintCSVtoListNonStripped{#3}}%
+ }%
+ }%
+ }%
+\def\XINT_listsel:_NP #1;#2;#3;%
+ {\expandafter\XINT_listsel:_NP_a \the\numexpr #1+%
+ \xintNthElt{0}{\xintCSVtoListNonStripped{#3}};#2;#3;}%
+\def\XINT_listsel:_NP_a #1#2;{\if -#1\expandafter\XINT_listsel:_OP\fi
+ \XINT_listsel:_PP #1#2;}%
+\def\XINT_listsel:_OP\XINT_listsel:_PP #1;{\XINT_listsel:_PP 0;}%
+\def\XINT_listsel:_PN #1;#2;#3;%
+ {\expandafter\XINT_listsel:_PN_a \the\numexpr #2+%
+ \xintNthElt{0}{\xintCSVtoListNonStripped{#3}};#1;#3;}%
+\def\XINT_listsel:_PN_a #1#2;#3;{\if -#1\expandafter\XINT_listsel:_PO\fi
+ \XINT_listsel:_PP #3;#1#2;}%
+\def\XINT_listsel:_PO\XINT_listsel:_PP #1;#2;{\XINT_listsel:_PP #1;0;}%
+% \end{macrocode}
+%\subsection{Macros for a..b list generation}
+%\lverb|Attention, ne produit que des listes de petits entiers!|
+%\subsubsection{\csh{xintSeq::csv}}
+%\lverb|Commence par remplacer a par ceil(a) et b par floor(b) et renvoie
+% ensuite les entiers entre les deux, possiblement en décroissant, et
+% extrémités comprises. Si a=b est non entier en obtient donc ceil(a) et
+% floor(a). Ne renvoie jamais une liste vide.|
+% \begin{macrocode}
+\def\xintSeq::csv {\romannumeral0\xintseq::csv }%
+\def\xintseq::csv #1#2%
+{%
+ \expandafter\XINT_seq::csv\expandafter
+ {\the\numexpr \xintiCeil{#1}\expandafter}\expandafter
+ {\the\numexpr \xintiFloor{#2}}%
+}%
+\def\XINT_seq::csv #1#2%
+{%
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
+ \expandafter\XINT_seq::csv_z
+ \or
+ \expandafter\XINT_seq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_n
+ \fi
+ {#2}{#1}%
+}%
+\def\XINT_seq::csv_z #1#2{ #1/1[0]}%
+\def\XINT_seq::csv_p #1#2%
+{%
+ \ifnum #1>#2
+ \expandafter\expandafter\expandafter\XINT_seq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1-\xint_c_i}{#2},#1/1[0]%
+}%
+\def\XINT_seq::csv_n #1#2%
+{%
+ \ifnum #1<#2
+ \expandafter\expandafter\expandafter\XINT_seq::csv_n
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1+\xint_c_i}{#2},#1/1[0]%
+}%
+\def\XINT_seq::csv_e #1,{ }%
+% \end{macrocode}
+%\subsubsection{\csh{xintiiSeq::csv}}
+% \begin{macrocode}
+\def\xintiiSeq::csv {\romannumeral0\xintiiseq::csv }%
+\def\xintiiseq::csv #1#2%
+{%
+ \expandafter\XINT_iiseq::csv\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
+}%
+\def\XINT_iiseq::csv #1#2%
+{%
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
+ \expandafter\XINT_iiseq::csv_z
+ \or
+ \expandafter\XINT_iiseq::csv_p
+ \else
+ \expandafter\XINT_iiseq::csv_n
+ \fi
+ {#2}{#1}%
+}%
+\def\XINT_iiseq::csv_z #1#2{ #1}%
+\def\XINT_iiseq::csv_p #1#2%
+{%
+ \ifnum #1>#2
+ \expandafter\expandafter\expandafter\XINT_iiseq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1-\xint_c_i}{#2},#1%
+}%
+\def\XINT_iiseq::csv_n #1#2%
+{%
+ \ifnum #1<#2
+ \expandafter\expandafter\expandafter\XINT_iiseq::csv_n
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1+\xint_c_i}{#2},#1%
+}%
+\def\XINT_seq::csv_e #1,{ }%
+% \end{macrocode}
+%\subsection{Macros for a..[d]..b list generation}
+%\lverb|Contrarily to a..b which is limited to small integers, this works with a, b, and d
+%(big) fractions. It will produce a «nil» list, if a>b and d<0 or a<b and d>0.|
+%\subsubsection{\csh{xintSeqA::csv}, \csh{xintiiSeqA::csv}, \csh{XINTinFloatSeqA::csv}}
+% \begin{macrocode}
+\def\xintSeqA::csv #1%
+ {\expandafter\XINT_seqa::csv\expandafter{\romannumeral0\xintraw {#1}}}%
+\def\XINT_seqa::csv #1#2{\expandafter\XINT_seqa::csv_a \romannumeral0\xintraw {#2};#1;}%
+\def\xintiiSeqA::csv #1#2{\XINT_iiseqa::csv #1#2}%
+\def\XINT_iiseqa::csv #1#2#3#4{\expandafter\XINT_seqa::csv_a
+ \romannumeral-`0\expandafter \XINT_expr_unlock\expandafter#4%
+ \expandafter;\romannumeral-`0\XINT_expr_unlock #2;}%
+\def\XINTinFloatSeqA::csv #1{\expandafter\XINT_flseqa::csv\expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#1}}}%
+\def\XINT_flseqa::csv #1#2%
+ {\expandafter\XINT_seqa::csv_a\romannumeral0\XINTinfloat [\XINTdigits]{#2};#1;}%
+\def\XINT_seqa::csv_a #1{\xint_UDzerominusfork
+ #1-{z}%
+ 0#1{n}%
+ 0-{p}%
+ \krof #1}%
+% \end{macrocode}
+%\subsubsection{\csh{xintSeqB::csv}}
+% \begin{macrocode}
+\def\xintSeqB::csv #1#2%
+ {\expandafter\XINT_seqb::csv \expandafter{\romannumeral0\xintraw{#2}}{#1}}%
+\def\XINT_seqb::csv #1#2{\expandafter\XINT_seqb::csv_a\romannumeral-`0#2#1!}%
+\def\XINT_seqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral0\csname XINT_seqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_seqb::csv_p #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{,#1\expandafter\XINT_seqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+% \romannumeral0 stopped by \endcsname, XINT_expr_seq_empty? constructs "nil".
+ {\romannumeral0\xintadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_seqb::csv_n #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_seqb::csv_n\expandafter}%
+ {\romannumeral0\xintadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_seqb::csv_z #1#2#3{,#1}%
+% \end{macrocode}
+%\subsubsection{\csh{xintiiSeqB::csv}}
+% \begin{macrocode}
+\def\xintiiSeqB::csv #1#2{\XINT_iiseqb::csv #1#2}%
+\def\XINT_iiseqb::csv #1#2#3#4%
+ {\expandafter\XINT_iiseqb::csv_a
+ \romannumeral-`0\expandafter \XINT_expr_unlock\expandafter#2%
+ \romannumeral-`0\XINT_expr_unlock #4!}%
+\def\XINT_iiseqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral-`0\csname XINT_iiseqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_iiseqb::csv_p #1#2#3%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}{,#1\expandafter\XINT_iiseqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+ {\romannumeral0\xintiiadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_iiseqb::csv_n #1#2#3%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_iiseqb::csv_n\expandafter}%
+ {\romannumeral0\xintiiadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_iiseqb::csv_z #1#2#3{,#1}%
+% \end{macrocode}
+%\subsubsection{\csh{XINTinFloatSeqB::csv}}
+% \begin{macrocode}
+\def\XINTinFloatSeqB::csv #1#2{\expandafter\XINT_flseqb::csv \expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#2}}{#1}}%
+\def\XINT_flseqb::csv #1#2{\expandafter\XINT_flseqb::csv_a\romannumeral-`0#2#1!}%
+\def\XINT_flseqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral-`0\csname XINT_flseqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_flseqb::csv_p #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{,#1\expandafter\XINT_flseqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+ {\romannumeral0\XINTinfloatadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_flseqb::csv_n #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_flseqb::csv_n\expandafter}%
+ {\romannumeral0\XINTinfloatadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_flseqb::csv_z #1#2#3{,#1}%
% \end{macrocode}
% \subsection{The comma as binary operator}
% \lverb|New with 1.09a.|
% \begin{macrocode}
\def\XINT_tmpa #1#2#3#4#5#6%
{%
- \def #1##1% \XINT_expr_op_,_a
+ \def #1##1% \XINT_expr_op_,
{%
- \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
+ \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
}%
\def #2##1##2% \XINT_expr_until_,_a
{\xint_UDsignfork
@@ -24761,7 +26823,7 @@ $1$ or $-1$.
\xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
\csname XINT_#6_op_##3\endcsname {##4}}%
\else
- \xint_afterfi
+ \xint_afterfi
{\expandafter ##2\expandafter ##3%
\csname .=\XINT_expr_unlock ##1,\XINT_expr_unlock ##4\endcsname }%
\fi
@@ -24773,14 +26835,11 @@ $1$ or $-1$.
\csname XINT_#1_op_,\expandafter\endcsname
\csname XINT_#1_until_,_a\expandafter\endcsname
\csname XINT_#1_until_,_b\expandafter\endcsname
- \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
\csname XINT_expr_precedence_,\endcsname {#1}%
}%
% \end{macrocode}
-% \subsection{\csh{XINT\_expr\_op\_-<level>}: minus as prefix inherits its
-% precedence level}
-% \lverb|1.09i: \xintiiexpr must use \xintiiOpp (or at least \xintiOpp, but that
-% would be a waste; however impacts round and trunc as I allow them).|
+% \subsection{The minus as prefix operator of variable precedence level}
% \begin{macrocode}
\def\XINT_tmpa #1#2#3%
{%
@@ -24792,9 +26851,9 @@ $1$ or $-1$.
}%
\def\XINT_tmpb #1#2#3#4#5#6%
{%
- \def #1% \XINT_expr_op_-<level>
+ \def #1% \XINT_expr_op_-<level>
{% get next number+operator then switch to _until macro
- \expandafter #2\romannumeral-`0\XINT_expr_getnext
+ \expandafter #2\romannumeral-`0\XINT_expr_getnext
}%
\def #2##1% \XINT_expr_until_-<l>_a
{\xint_UDsignfork
@@ -24816,471 +26875,1398 @@ $1$ or $-1$.
\xintApplyInline{\XINT_tmpa {flexpr}\xintOpp}{{vi}{vii}{viii}{ix}}%
\xintApplyInline{\XINT_tmpa {iiexpr}\xintiiOpp}{{vi}{vii}{viii}{ix}}%
% \end{macrocode}
-% \subsection{? as two-way conditional}
-% \lverb|New with 1.09a. Modified in 1.09c to have less precedence than
-% functions. Code is cleaner as it does not play tricks with _precedence. There
-% is no associated until macro, because action is immediate once activated (only
-% a previously scanned function can delay activation).|
+% \subsection{? as two-way and ?? as three-way conditionals with braced branches}
+% \lverb|In 1.1, I overload ? with ??, as : will be used for list extraction,
+% problem with (stuff)?{?(1)}{0} for example, one should put a space (stuff)?{
+% ?(1)}{0} will work. Small idiosyncrasy. ?{yes}{no} and ??{<0}{=0}{>0}|
% \begin{macrocode}
\let\XINT_expr_precedence_? \xint_c_x
-\def \XINT_expr_op_? #1#2#3%
+\def\XINT_expr_op_? #1#2{\if ?#2\expandafter \XINT_expr_op_??\fi
+ \XINT_expr_op_?a #1{#2}}%
+\def\XINT_expr_op_?a #1#2#3%
{%
- \xintifZero{\XINT_expr_unlock #1}%
- {\XINT_expr_getnext #3}%
- {\XINT_expr_getnext #2}%
+ \xintiiifNotZero{\XINT_expr_unlock #1}{\XINT_expr_getnext #2}{\XINT_expr_getnext #3}%
}%
\let\XINT_flexpr_op_?\XINT_expr_op_?
\let\XINT_iiexpr_op_?\XINT_expr_op_?
-% \end{macrocode}
-% \subsection{: as three-way conditional}
-% \lverb|New with 1.09a. Modified in 1.09c to have less precedence than
-% functions. |
-% \begin{macrocode}
-\let\XINT_expr_precedence_: \xint_c_x
-\def \XINT_expr_op_: #1#2#3#4%
+\def\XINT_expr_op_?? #1#2#3#4#5#6%
{%
- \xintifSgn {\XINT_expr_unlock #1}%
- {\XINT_expr_getnext #2}%
- {\XINT_expr_getnext #3}%
- {\XINT_expr_getnext #4}%
+ \xintiiifSgn {\XINT_expr_unlock #2}{\XINT_expr_getnext #4}{\XINT_expr_getnext #5}%
+ {\XINT_expr_getnext #6}%
}%
-\let\XINT_flexpr_op_:\XINT_expr_op_:
-\let\XINT_iiexpr_op_:\XINT_expr_op_:
% \end{macrocode}
% \subsection{! as postfix factorial operator}
-% \lverb|The factorial is currently the exact one, there is no float version.
-% Starting with 1.09c, it has lower priority than functions, it is not executed
-% immediately anymore. The code is cleaner and does not abuse _precedence, but
-% does assign it a true level. There is no until macro, because the factorial
-% acts on what precedes it.|
+% \lverb|As of 2014/10/28, not yet a float version of factorial. I must do it!|
% \begin{macrocode}
\let\XINT_expr_precedence_! \xint_c_x
\def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop
- \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
+ \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
\let\XINT_flexpr_op_!\XINT_expr_op_!
\def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop
- \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
+ \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
+% \end{macrocode}
+% \subsection{The A/B[N] mechanism}
+% \lverb|Releases earlier than 1.1 required the use of braces around A/B[N]
+% input. The [N] is now implemented directly. *BUT* uses a delimited macro!
+% thus N is not allowed to be itself an expression (I could add it...).
+% \xintE, \xintiiE, and \XINTinFloatE all put #2 in a \numexpr. BUT ATTENTION
+% TO CRAZYNESS OF NUMEXPR: \the\numexpr 3 + 7 9 \relax !! Hence we have to do
+% the job ourselves.|
+% \begin{macrocode}
+\catcode`[ 11
+\catcode`* 11
+\let\XINT_expr_precedence_[ \xint_c_vii
+\def\XINT_expr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\xintE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\def\XINT_iiexpr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\xintiiE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\def\XINT_flexpr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\XINTinFloatE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\catcode`[ 12
+\catcode`* 12
+% \end{macrocode}
+% \subsection{For variables}
+% \begin{macrocode}
+\def\XINT_expr_op__ #1% op__ with two _'s
+ {%
+ \ifcsname XINT_expr_var_#1\endcsname
+ \expandafter\xint_firstoftwo
+ \else
+ \expandafter\xint_secondoftwo
+ \fi
+ {\expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \XINT_expr_getop\csname XINT_expr_var_#1\endcsname}%
+ {\XINT_expr_unknown_variable {#1}%
+ \expandafter\XINT_expr_getop\csname .=0\endcsname}%
+ }%
+\def\XINT_expr_unknown_variable #1{\xintError:removed \xint_gobble_i {#1}}%
+\let\XINT_flexpr_op__ \XINT_expr_op__
+\let\XINT_iiexpr_op__ \XINT_expr_op__
% \end{macrocode}
-% \subsection{Functions}
-% \lverb|New with 1.09a. Names of ..Float..:csv macros have been changed in
-% 1.09h |
+% \subsubsection{Defining variables}
+% \lverb|1.1 An active : character will be a pain and I almot decided not to
+% use := but rather = as affectation operator, but this is the same problem
+% inside expressions with the modulo operator /:, or with babel+frenchb with
+% all high punctuation ?, !, :, ;.
+%
+% It is not recommended to overwrite single Latin letters which are
+% pre-defined to serve as dummy variables. Variable names may contains
+% letters, digits, underscores, and must not start with a digit.|
% \begin{macrocode}
-\def\XINT_tmpa #1#2#3#4{%
- \def #1##1%
- {%
- \ifcsname XINT_expr_onlitteral_##1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter #2%
- \fi {##1}%
- }%
- \def #2##1%
- {%
- \ifcsname XINT_#4_func_##1\endcsname
- \xint_afterfi
- {\expandafter\expandafter\csname XINT_#4_func_##1\endcsname}%
- \else \csname xintError:unknown `##1\string'\endcsname
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0#3%
- }%
+\catcode`: 12
+\def\xintdefvar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbareeval #2\relax }}%
+\def\xintdefiivar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbareiieval #2\relax }%
}%
-\xintFor #1 in {expr,flexpr,iiexpr} \do {%
- \expandafter\XINT_tmpa
- \csname XINT_#1_op_@\expandafter\endcsname
- \csname XINT_#1_op_@@\expandafter\endcsname
- \csname XINT_#1_oparen\endcsname {#1}%
+\def\xintdeffloatvar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbarefloateval #2\relax }%
}%
-\def\XINT_expr_funcoflitteral #1%
+\catcode`: 11
+% \end{macrocode}
+% \subsubsection{Letters as dummy variables; the nil list}
+% \begin{macrocode}
+\def\XINT_tmpa #1%
{%
- \expandafter\expandafter\csname XINT_expr_onlitteral_#1\endcsname
- \romannumeral-`0\XINT_expr_scanfunc
+ \expandafter\def\csname XINT_expr_var_#1\endcsname ##1\relax !#1##2%
+ {\romannumeral0\XINT_expr_lockscan ##2!##1\relax !#1{##2}}%
}%
-\def\XINT_expr_onlitteral_bool #1#2#3{\expandafter\XINT_expr_getop
- \csname .=\xintBool{#3}\endcsname }%
-\def\XINT_expr_onlitteral_togl #1#2#3{\expandafter\XINT_expr_getop
- \csname .=\xintToggle{#3}\endcsname }%
-\def\XINT_expr_func_unknown #1#2#3% 1.09i removes [0], because \xintiiexpr
- {\expandafter #1\expandafter #2\csname .=0\endcsname }%
-\def\XINT_expr_func_reduce #1#2#3%
+\xintApplyUnbraced \XINT_tmpa {abcdefghijklmnopqrstuvwxyz}%
+\xintApplyUnbraced \XINT_tmpa {ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
+\expandafter\def\expandafter\XINT_expr_var_nil\expandafter
+ {\expandafter\empty\csname .= \endcsname}%
+% \end{macrocode}
+% \subsubsection{The omit and abort constructs}
+% \begin{macrocode}
+\catcode`. 11 \catcode`= 11
+\def\XINT_expr_var_omit #1\relax !{1^C!{}{}{}\.=!\relax !}% 24 juin
+\def\XINT_expr_var_abort #1\relax !{1^C!{}{}{}\.=^\relax !}% 25 juin
+\catcode`. 12 \catcode`= 12
+% \end{macrocode}
+% \subsubsection{The @, @1, @2, @3, @4, @@, @@(1), \dots, @@@, @@@(1), \dots
+% for recursion}
+% \lverb|I had completely forgotten what the @@@ etc... stuff were supposed to
+% do: this is for nesting recursions! (I was mad back in June 2014). @@(N)
+% gives the Nth back, @@@(N) gives the Nth back of the higher recursion!|
+% \begin{macrocode}
+\catcode`? 3
+\def\XINT_expr_var_@ #1~#2{ #2#1~#2}%
+\expandafter\let\csname XINT_expr_var_@1\endcsname \XINT_expr_var_@
+\expandafter\def\csname XINT_expr_var_@2\endcsname #1~#2#3{ #3#1~#2#3}%
+\expandafter\def\csname XINT_expr_var_@3\endcsname #1~#2#3#4{ #4#1~#2#3#4}%
+\expandafter\def\csname XINT_expr_var_@4\endcsname #1~#2#3#4#5{ #5#1~#2#3#4#5}%
+\def\XINT_expr_func_@@ #1#2#3#4~#5?%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintIrr {\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#5}#4~#5?%
}%
-\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
-% \XINT_iiexpr_func_reduce not defined
-\def\XINT_expr_func_frac #1#2#3%
+\def\XINT_expr_func_@@@ #1#2#3#4~#5~#6?%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintTFrac {\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#6}#4~#5~#6?%
}%
-\def\XINT_flexpr_func_frac #1#2#3%
+\def\XINT_expr_func_@@@@ #1#2#3#4~#5~#6~#7?%
{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatFrac [\XINTdigits]{\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#7}#4~#5~#6~#7?%
}%
-% \XINT_iiexpr_func_frac not defined
-\def\XINT_expr_func_sqr #1#2#3%
+\let\XINT_flexpr_func_@@\XINT_expr_func_@@
+\let\XINT_flexpr_func_@@@\XINT_expr_func_@@@
+\let\XINT_flexpr_func_@@@@\XINT_expr_func_@@@@
+\def\XINT_iiexpr_func_@@ #1#2#3#4~#5?%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintSqr {\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#5}#4~#5?%
}%
-\def\XINT_flexpr_func_sqr #1#2#3%
+\def\XINT_iiexpr_func_@@@ #1#2#3#4~#5~#6?%
{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMul [\XINTdigits]%
- {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#6}#4~#5~#6?%
}%
-\def\XINT_iiexpr_func_sqr #1#2#3%
+\def\XINT_iiexpr_func_@@@@ #1#2#3#4~#5~#6~#7?%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSqr {\XINT_expr_unlock #3}\endcsname
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#7}#4~#5~#6~#7?%
}%
-\def\XINT_expr_func_abs #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintAbs {\XINT_expr_unlock #3}\endcsname
+\catcode`? 11
+% \end{macrocode}
+% \subsection{For functions}
+% \begin{macrocode}
+\def\XINT_tmpa #1#2#3{%
+ \def #1##1% \XINT_expr_op_`, #2=\XINT_expr_oparen
+ {%
+ \ifcsname XINT_expr_onlitteral_##1\endcsname
+ \xint_dothis{\csname XINT_expr_onlitteral_##1\endcsname}\fi
+ \ifcsname XINT_#3_func_##1\endcsname
+ \xint_dothis{\expandafter\expandafter
+ \csname XINT_#3_func_##1\endcsname\romannumeral-`0#2}\fi
+ \xint_orthat{\XINT_expr_unknown_function {##1}%
+ \expandafter\XINT_expr_func_unknown\romannumeral-`0#2}%
+ }%
}%
-\let\XINT_flexpr_func_abs\XINT_expr_func_abs
-\def\XINT_iiexpr_func_abs #1#2#3%
+\def\XINT_expr_unknown_function #1{\xintError:removed \xint_gobble_i {#1}}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+ \expandafter\XINT_tmpa
+ \csname XINT_#1_op_`\expandafter\endcsname
+ \csname XINT_#1_oparen\endcsname
+ {#1}%
+}%
+\expandafter\def\csname XINT_expr_onlitteral_`\endcsname #1#2#3({\xint_c_xviii `{#2}}%
+% \end{macrocode}
+% \subsection{The bool, togl, protect, unknown, and break "functions"}
+% \lverb|bool, togl and protect use delimited macros. Only unknown and break
+% are true functions with a more flexible parsing of the opening and closing
+% parentheses, which may possibly arise from expansion itself.|
+% \begin{macrocode}
+\def\XINT_expr_onlitteral_bool #1)%
+ {\expandafter\XINT_expr_getop\csname .=\xintBool{#1}\endcsname }%
+\def\XINT_expr_onlitteral_togl #1)%
+ {\expandafter\XINT_expr_getop\csname .=\xintToggle{#1}\endcsname }%
+\def\XINT_expr_onlitteral_protect #1)%
+ {\expandafter\XINT_expr_getop\csname .=\detokenize{#1}\endcsname }%
+\def\XINT_expr_func_unknown #1#2#3{\expandafter #1\expandafter #2\csname .=0\endcsname }%
+\def\XINT_expr_func_break #1#2#3%
+{\expandafter #1\expandafter #2\csname.=?\romannumeral-`0\XINT_expr_unlock #3\endcsname }%
+\let\XINT_flexpr_func_break \XINT_expr_func_break
+\let\XINT_iiexpr_func_break \XINT_expr_func_break
+% \end{macrocode}
+% \subsection{seq and the implementation of dummy variables}
+% \lverb|All of seq, add, mul, rseq, etc... (actually all of the extensive
+% changes from xintexpr 1.09n to 1.1) was done around June 15-25th 2014, but the
+% problem is that I did not document the code enough, and I had a hard time
+% understanding in October what I had done in June. Despite the lesson, again
+% being short on time, I do not document enough my current understanding of the
+% innards of the beast...
+%
+% I added subs, and iter in October (also the [:n], [n:] list extractors),
+% proving I did at least understand a bit (or rather could imitate) my earlier
+% code (but don't ask me to explain \xintNewExpr !)
+%
+% The \XINT_expr_onlitteral_seq_a parses: "expression, variable=list)" (when it is called
+% the opening ( has been swallowed, and it looks for the ending one.) Both expression and
+% list may themselves contain parentheses and commas, we allow nesting. For example
+% "x^2,x=1..10)", at the end of seq_a we have {variable{expression}}{list}, in this
+% example {x{x^2}}{1..10}, or more complicated "seq(add(y,y=1..x),x=1..10)" will work
+% too. The variable is a single lowercase Latin letter.
+%
+% The complications with \xint_c_xviii in seq_f is for the recurrent thing that we don't
+% know in what type of expressions we are, hence we must move back up, with some loss of
+% efficiency (superfluous check for minus sign, etc...). But the code manages
+% simultaneously expr, flexpr and iiexpr.|
+%
+% \subsubsection{\csh{XINT_expr_onlitteral_seq}}
+% \begin{macrocode}
+\def\XINT_expr_onlitteral_seq
+ {\expandafter\XINT_expr_onlitteral_seq_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_seq_f #1#2{\xint_c_xviii `{seqx}#2)\relax #1}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_onlitteral_seq_a}}
+% \begin{macrocode}
+\def\XINT_expr_onlitteral_seq_a #1#2,%
+{% checks balancing of parentheses
+ \ifcase\XINT_isbalanced_a \relax #1#2(\xint_bye)\xint_bye
+ \expandafter\XINT_expr_onlitteral_seq_c
+ \or\expandafter\XINT_expr_onlitteral_seq_b
+ \else\expandafter\xintError:we_are_doomed
+ \fi {#1#2},%
+}%
+\def\XINT_expr_onlitteral_seq_b #1,{\XINT_expr_onlitteral_seq_a {#1,}}%
+\def\XINT_expr_onlitteral_seq_c #1,#2#3% #3 pour absorber le =
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiAbs {\XINT_expr_unlock #3}\endcsname
+ \XINT_expr_onlitteral_seq_d {#2{#1}}{}%
}%
-\def\XINT_expr_func_sgn #1#2#3%
+\def\XINT_expr_onlitteral_seq_d #1#2#3)%
+{%
+ \ifcase\XINT_isbalanced_a \relax #2#3(\xint_bye)\xint_bye
+ \or\expandafter\XINT_expr_onlitteral_seq_e
+ \else\expandafter\xintError:we_are_doomed
+ \fi
+ {#1}{#2#3}%
+}%
+\def\XINT_expr_onlitteral_seq_e #1#2{\XINT_expr_onlitteral_seq_d {#1}{#2)}}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_isbalanced_a} for \csh{XINT_expr_onlitteral_seq_a}}
+%\lverb|Expands to \m@ne in case a closing ) had no opening ( matching it, to
+% \@ne if opening ) had no closing ) matching it, to \z@ if expression was
+% balanced.|
+% \begin{macrocode}
+% use as \XINT_isbalanced_a \relax #1(\xint_bye)\xint_bye
+\def\XINT_isbalanced_a #1({\XINT_isbalanced_b #1)\xint_bye }%
+\def\XINT_isbalanced_b #1)#2%
+ {\xint_bye #2\XINT_isbalanced_c\xint_bye\XINT_isbalanced_error }%
+% \end{macrocode}
+% \lverb|if #2 is not \xint_bye, a ) was found, but there was no (. Hence error -> -1|
+% \begin{macrocode}
+\def\XINT_isbalanced_error #1)\xint_bye {\m@ne}%
+% \end{macrocode}
+% \lverb|#2 was \xint_bye, was there a ) in original #1?|
+% \begin{macrocode}
+\def\XINT_isbalanced_c\xint_bye\XINT_isbalanced_error #1%
+ {\xint_bye #1\XINT_isbalanced_yes\xint_bye\XINT_isbalanced_d #1}%
+% \end{macrocode}
+% \lverb|#1 is \xint_bye, there was never ( nor ) in original #1, hence OK.|
+% \begin{macrocode}
+\def\XINT_isbalanced_yes\xint_bye\XINT_isbalanced_d\xint_bye )\xint_bye {\xint_c_ }%
+% \end{macrocode}
+% \lverb|#1 is not \xint_bye, there was indeed a ( in original #1. We check if
+% we see a ). If we do, we then loop until no ( nor ) is to be found.|
+% \begin{macrocode}
+\def\XINT_isbalanced_d #1)#2%
+ {\xint_bye #2\XINT_isbalanced_no\xint_bye\XINT_isbalanced_a #1#2}%
+% \end{macrocode}
+% \lverb|#2 was \xint_bye, we did not find a closing ) in original #1. Error.|
+% \begin{macrocode}
+\def\XINT_isbalanced_no\xint_bye #1\xint_bye\xint_bye {\xint_c_i }%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_allexpr_func_seqx}, \csh{XINT_allexpr_func_subx}}
+% \begin{macrocode}
+\def\XINT_expr_func_seqx #1#2{\XINT_allexpr_seqx \xintbareeval }%
+\def\XINT_flexpr_func_seqx #1#2{\XINT_allexpr_seqx \xintbarefloateval}%
+\def\XINT_iiexpr_func_seqx #1#2{\XINT_allexpr_seqx \xintbareiieval }%
+\def\XINT_allexpr_seqx #1#2#3#4% #2 is the index list, fully evaluated and encapsulated
+{% #3 is the Latin letter serving as dummy variable, #4 is the expression to evaluate
+ \expandafter \XINT_expr_getop
+ \csname .=\expandafter\XINT_expr_seq:_aa
+ \romannumeral-`0\XINT_expr_unlock #2!{#1#4\relax !#3},^,\endcsname
+}%
+\def\XINT_expr_seq:_aa #1{\if +#1\expandafter\XINT_expr_seq:_A\else
+ \expandafter\XINT_expr_seq:_a\fi #1}%
+% \end{macrocode}
+% \subsubsection{break, abort, omit within seq}
+% \lverb|when evaluation is done in seq:_d, after the ! we find: the Latin
+% letter, the braced evaluated value to which it will be assigned, a saved copy of the
+% the \xintexpr stuff, the braced accumulated comma separated list of previous
+% computations, and the rest of the list of comma separated values to assign to
+% the dummy letter and at the very end there is ^ and the final comma.|
+% \begin{macrocode}
+\def\XINT_expr_seq:_a #1!#2{\expandafter\XINT_expr_seq_empty?
+ \romannumeral0\XINT_expr_seq:_b {#2}#1}%
+\def\XINT_expr_seq:_b #1#2,{\XINT_expr_seq:_c #2,{#1}}%
+\def\XINT_expr_seq:_c #1{\if ,#1\xint_dothis\XINT_expr_seq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_seq:_end\fi
+ \xint_orthat\XINT_expr_seq:_d #1}%
+\def\XINT_expr_seq:_d #1,#2{\expandafter\XINT_expr_seq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#2{#1}{#2}}%
+\def\XINT_expr_seq:_e #1{\if #1^\xint_dothis\XINT_expr_seq:_abort\fi
+ \if #1?\xint_dothis\XINT_expr_seq:_break\fi
+ \if #1!\xint_dothis\XINT_expr_seq:_omit\fi
+ \xint_orthat{\XINT_expr_seq:_goon #1}}%
+\def\XINT_expr_seq:_goon #1!#2#3#4{,#1\XINT_expr_seq:_b {#4}}%
+\def\XINT_expr_seq:_omit #1!#2#3#4{\XINT_expr_seq:_b {#4}}%
+\def\XINT_expr_seq:_abort #1!#2#3#4#5^,{}%
+\def\XINT_expr_seq:_break #1!#2#3#4#5^,{,#1}%
+\def\XINT_expr_seq:_noop ,#1{\XINT_expr_seq:_b {#1}}%
+\def\XINT_expr_seq:_end ^,#1{}% if all is omit, _empty? constructs "nil"
+\def\XINT_expr_seq_empty? #1{%
+\def\XINT_expr_seq_empty? ##1{\if ,##1\expandafter\xint_gobble_i\fi #1\endcsname }}%
+\XINT_expr_seq_empty? { }%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_seq:_A}}
+% \lverb|This is for index lists generated by ++. The starting point will have
+% been replaced by its ceil. For efficiency I use \numexpr rather than
+% \xintInc, hence the indexing is limited to small integers.|
+% \begin{macrocode}
+\def\XINT_expr_seq:_A +#1!#2,^,%
+ {\expandafter\XINT_expr_seq_empty?\romannumeral0\XINT_expr_seq:_D {#1}{#2}}%
+\def\XINT_expr_seq:_D #1#2{\expandafter\XINT_expr_seq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#2{#1}{#2}}%
+\def\XINT_expr_seq:_E #1{\if #1^\xint_dothis\XINT_expr_seq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_seq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_seq:_Omit\fi
+ \xint_orthat{\XINT_expr_seq:_Goon #1}}%
+\def\XINT_expr_seq:_Goon #1!#2#3#4%
+ {,#1\expandafter\XINT_expr_seq:_D\expandafter{\the\numexpr #3+\xint_c_i}{#4}}%
+\def\XINT_expr_seq:_Omit #1!#2#3#4%
+ {\expandafter\XINT_expr_seq:_D\expandafter{\the\numexpr #3+\xint_c_i}{#4}}%
+\def\XINT_expr_seq:_Abort #1!#2#3#4{}%
+\def\XINT_expr_seq:_Break #1!#2#3#4{,#1}%
+% \end{macrocode}
+% \subsubsection{add and mul, , \csh{XINT_expr_onlitteral_add},
+% \csh{XINT_expr_onlitteral_mul}}
+% \begin{macrocode}
+\def\XINT_expr_onlitteral_add
+ {\expandafter\XINT_expr_onlitteral_add_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_add_f #1#2{\xint_c_xviii `{opx}#2)\relax #1+}%
+\def\XINT_expr_onlitteral_mul
+ {\expandafter\XINT_expr_onlitteral_mul_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_mul_f #1#2{\xint_c_xviii `{opx}#2)\relax #1*}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_func_opx}, \csh{XINT_flexpr_func_opx},
+% \csh{XINT_iiexpr_func_opx}}
+% \begin{macrocode}
+\expandafter\edef\csname XINT_expr_op:_+\endcsname
+ {\noexpand\xint_gobble_v {}{}{}\expandafter\noexpand\csname .=0\endcsname}%
+\expandafter\edef\csname XINT_expr_op:_*\endcsname
+ {\noexpand\xint_gobble_v {}{}{}\expandafter\noexpand\csname .=1\endcsname}%
+\def\XINT_expr_func_opx #1#2{\XINT_allexpr_opx \xintexpr }%
+\def\XINT_flexpr_func_opx #1#2{\XINT_allexpr_opx \xintfloatexpr }%
+\def\XINT_iiexpr_func_opx #1#2{\XINT_allexpr_opx \xintiiexpr }%
+\def\XINT_allexpr_opx #1#2#3#4#5%
+{% au départ on avait op(#4,#3=#2 (évalué ici)) #3=la variable, #4=expression, #5=+ ou*.
+ \expandafter\XINT_expr_getop\romannumeral0\expandafter\XINT_expr_op:_a
+ \csname XINT_expr_op:_#5\expandafter\endcsname
+ \romannumeral-`0\XINT_expr_unlock #2!#5#1#3{#4}%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_op:_a}, \dots}
+% \begin{macrocode}
+\def\XINT_expr_op:_a #1#2!#3#4#5#6{\XINT_expr_op:_b {#1#4#3{#6\relax\relax !#5}}#2,^,}%
+% #1=op_+ ou op_*, #2=liste, #3=+ou*,#4=\xintexpr, etc, #5=la var,#6=expression
+\def\XINT_expr_op:_b #1#2,{\XINT_expr_op:_c #2,#1}%
+\def\XINT_expr_op:_c #1{\if ,#1\xint_dothis\XINT_expr_op:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_op:_end\fi
+ \xint_orthat\XINT_expr_op:_d #1}%
+\def\XINT_expr_op:_noop #1,#2#3#4#5{\XINT_expr_op:_b {{#2}#3#4{#5}}}%
+\def\XINT_expr_op:_d #1,#2#3#4#5%
+% #1=valeur, #2=partiel, #3=\xintexpr #4=+ ou *, #5 = expression
+ {\expandafter\expandafter\expandafter\XINT_expr_op:_e #3#2#4#3#5{#1}{#3#4{#5}}}%
+% #2=nom de la variable, #3=ancienne valeur variable,
+\def\XINT_expr_op:_e !#1!#2#3#4{\XINT_expr_op:_b {{!#1}#4}}%
+\def\XINT_expr_op:_end ^,#1#2#3#4{\expandafter\expandafter\expandafter\space
+ \expandafter\xint_gobble_iv #1}%
+% \end{macrocode}
+% \subsubsection{subs, \csh{XINT_expr_onlitteral_subs}}
+% \begin{macrocode}
+\def\XINT_expr_onlitteral_subs
+ {\expandafter\XINT_expr_onlitteral_subs_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_subs_f #1#2{\xint_c_xviii `{subx}#2)\relax #1}%
+\def\XINT_expr_func_subx #1#2{\XINT_allexpr_subx \xintbareeval }%
+\def\XINT_flexpr_func_subx #1#2{\XINT_allexpr_subx \xintbarefloateval}%
+\def\XINT_iiexpr_func_subx #1#2{\XINT_allexpr_subx \xintbareiieval }%
+\def\XINT_allexpr_subx #1#2#3#4% #2 is the value to assign to the dummy variable
+{% #3 is the dummy variable, #4 is the expression to evaluate
+ \expandafter \XINT_expr_getop
+ \csname .=\expandafter\XINT_expr_subx:_a
+ \romannumeral-`0\XINT_expr_unlock #2!{#1#4\relax !#3}\endcsname
+}%
+\def\XINT_expr_subx:_a #1!#2% 10/25 that was a quick addition!
+ {\expandafter\XINT_expr_subx:_end \romannumeral0#2{#1}}%
+% attention, if one day I add a space in unlock, will need \romannumeral-`0
+\def\XINT_expr_subx:_end #1!#2#3{\XINT_expr_unlock #1}%
+% \end{macrocode}
+% \subsection{rseq}
+% \lverb|When func_rseq has its turn, initial segment has been scanned by oparen, the ;
+% mimicking the rôle of a closing parenthesis, and stopping further expansion.|
+% \begin{macrocode}
+\def\XINT_expr_func_rseq {\XINT_allexpr_rseq \xintbareeval }%
+\def\XINT_flexpr_func_rseq {\XINT_allexpr_rseq \xintbarefloateval }%
+\def\XINT_iiexpr_func_rseq {\XINT_allexpr_rseq \xintbareiieval }%
+\def\XINT_allexpr_rseq #1#2%
+{%
+ \expandafter\XINT_expr_rseqx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rseqx}}
+% \lverb|The (#4) is for ++ mechanism which must have its closing parenthesis.|
+% \begin{macrocode}
+\def\XINT_expr_rseqx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_rseqy\romannumeral0#1(#4)\relax
+ #2#3#1%
+}%
+% \def\XINT_expr_getlast #1,#2%
+% {%
+% \if ^#2\xint_dothis{\XINT_expr_lockscan #1}\fi\xint_orthat{\XINT_expr_getlast #2}%
+% }%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rseqy}}
+% \begin{macrocode}
+\def\XINT_expr_rseqy #1#2#3#4#5% #1=valeurs pour variable (locked),
+ % #2=toutes les valeurs initiales (csv,locked),
+ % #3=variable, #4=expr,
+ % #5=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=\XINT_expr_unlock #2%
+ \expandafter\XINT_expr_rseq:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#5#4\relax !#3}#2,^,\endcsname
+}%
+\def\XINT_expr_rseq:_aa #1{\if +#1\expandafter\XINT_expr_rseq:_A\else
+ \expandafter\XINT_expr_rseq:_a\fi #1}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rseq:_a} etc\dots}
+% \begin{macrocode}
+\def\XINT_expr_rseq:_a #1!#2#3{\XINT_expr_rseq:_b #3{#2}#1}%
+\def\XINT_expr_rseq:_b #1#2#3,{\XINT_expr_rseq:_c #3,~#1{#2}}%
+\def\XINT_expr_rseq:_c #1{\if ,#1\xint_dothis\XINT_expr_rseq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_rseq:_end\fi
+ \xint_orthat\XINT_expr_rseq:_d #1}%
+\def\XINT_expr_rseq:_d #1,~#2#3{\expandafter\XINT_expr_rseq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2{#3}}%
+\def\XINT_expr_rseq:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_rseq:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_rseq:_break\fi
+ \if !#1\xint_dothis\XINT_expr_rseq:_omit\fi
+ \xint_orthat{\XINT_expr_rseq:_goon #1}}%
+\def\XINT_expr_rseq:_goon #1!#2#3~#4#5{,#1\expandafter\XINT_expr_rseq:_b
+ \romannumeral0\XINT_expr_lockit {#1}{#5}}%
+\def\XINT_expr_rseq:_omit #1!#2#3~{\XINT_expr_rseq:_b }%
+\def\XINT_expr_rseq:_abort #1!#2#3~#4#5#6^,{}%
+\def\XINT_expr_rseq:_break #1!#2#3~#4#5#6^,{,#1}%
+\def\XINT_expr_rseq:_noop ,~#1#2{\XINT_expr_rseq:_b #1{#2}}%
+\def\XINT_expr_rseq:_end ^,~#1#2{}% no nil for rseq
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rseq:_A} etc\dots}
+% \lverb |n++ for rseq|.
+% \begin{macrocode}
+\def\XINT_expr_rseq:_A +#1!#2#3,^,{\XINT_expr_rseq:_D {#1}#3{#2}}%
+\def\XINT_expr_rseq:_D #1#2#3{\expandafter\XINT_expr_rseq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2{#3}}%
+\def\XINT_expr_rseq:_E #1{\if #1^\xint_dothis\XINT_expr_rseq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_rseq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_rseq:_Omit\fi
+ \xint_orthat{\XINT_expr_rseq:_Goon #1}}%
+\def\XINT_expr_rseq:_Goon #1!#2#3~#4#5%
+ {,#1\expandafter\XINT_expr_rseq:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \romannumeral0\XINT_expr_lockit{#1}{#5}}%
+\def\XINT_expr_rseq:_Omit #1!#2#3~%#4#5%
+ {\expandafter\XINT_expr_rseq:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_rseq:_Abort #1!#2#3~#4#5{}%
+\def\XINT_expr_rseq:_Break #1!#2#3~#4#5{,#1}%
+% \end{macrocode}
+% \subsection{rrseq}
+% \lverb|When func_rrseq has its turn, initial segment has been scanned by oparen, the ;
+% mimicking the rôle of a closing parenthesis, and stopping further expansion.|
+% \begin{macrocode}
+\def\XINT_expr_func_rrseq {\XINT_allexpr_rrseq \xintbareeval }%
+\def\XINT_flexpr_func_rrseq {\XINT_allexpr_rrseq \xintbarefloateval }%
+\def\XINT_iiexpr_func_rrseq {\XINT_allexpr_rrseq \xintbareiieval }%
+\def\XINT_allexpr_rrseq #1#2%
+{%
+ \expandafter\XINT_expr_rrseqx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rrseqx}}
+% \lverb|The (#4) is for ++ mechanism which must have its closing parenthesis.|
+% \begin{macrocode}
+\def\XINT_expr_rrseqx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_rrseqy\romannumeral0#1(#4)\expandafter\relax
+ \expandafter{\romannumeral0\xintapply \XINT_expr_lockit
+ {\xintRevWithBraces{\xintCSVtoListNonStripped{\XINT_expr_unlock #2}}}}%
+ #2#3#1%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rrseqy}}
+% \begin{macrocode}
+\def\XINT_expr_rrseqy #1#2#3#4#5#6% #1=valeurs pour variable (locked),
+ % #2=initial values (reversed, one (braced) token each)
+ % #3=toutes les valeurs initiales (csv,locked),
+ % #4=variable, #5=expr,
+ % #6=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=\XINT_expr_unlock #3%
+ \expandafter\XINT_expr_rrseq:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#6#5\relax !#4}{#2},^,\endcsname
+}%
+\def\XINT_expr_rrseq:_aa #1{\if +#1\expandafter\XINT_expr_rrseq:_A\else
+ \expandafter\XINT_expr_rrseq:_a\fi #1}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rrseq:_a} etc\dots}
+% \begin{macrocode}
+\catcode`? 3
+\def\XINT_expr_rrseq:_a #1!#2#3{\XINT_expr_rrseq:_b {#3}{#2}#1}%
+\def\XINT_expr_rrseq:_b #1#2#3,{\XINT_expr_rrseq:_c #3,~#1?{#2}}%
+\def\XINT_expr_rrseq:_c #1{\if ,#1\xint_dothis\XINT_expr_rrseq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_rrseq:_end\fi
+ \xint_orthat\XINT_expr_rrseq:_d #1}%
+\def\XINT_expr_rrseq:_d #1,~#2?#3{\expandafter\XINT_expr_rrseq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_rrseq:_goon #1!#2#3~#4?#5{,#1\expandafter\XINT_expr_rrseq:_b\expandafter
+ {\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_rrseq:_omit #1!#2#3~{\XINT_expr_rrseq:_b }%
+\def\XINT_expr_rrseq:_abort #1!#2#3~#4?#5#6^,{}%
+\def\XINT_expr_rrseq:_break #1!#2#3~#4?#5#6^,{,#1}%
+\def\XINT_expr_rrseq:_noop ,~#1?#2{\XINT_expr_rrseq:_b {#1}{#2}}%
+\def\XINT_expr_rrseq:_end ^,~#1?#2{}% No nil for rrseq.
+\catcode`? 11
+\def\XINT_expr_rrseq:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_rrseq:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_rrseq:_break\fi
+ \if !#1\xint_dothis\XINT_expr_rrseq:_omit\fi
+ \xint_orthat{\XINT_expr_rrseq:_goon #1}%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_rrseq:_A} etc\dots}
+% \lverb |n++ for rrseq|.
+% \begin{macrocode}
+\catcode`? 3
+\def\XINT_expr_rrseq:_A +#1!#2#3,^,{\XINT_expr_rrseq:_D {#1}{#3}{#2}}%
+\def\XINT_expr_rrseq:_D #1#2#3{\expandafter\XINT_expr_rrseq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_rrseq:_Goon #1!#2#3~#4?#5%
+ {,#1\expandafter\XINT_expr_rrseq:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \expandafter{\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_rrseq:_Omit #1!#2#3~%#4?#5%
+ {\expandafter\XINT_expr_rrseq:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_rrseq:_Abort #1!#2#3~#4?#5{}%
+\def\XINT_expr_rrseq:_Break #1!#2#3~#4?#5{,#1}%
+\catcode`? 11
+\def\XINT_expr_rrseq:_E #1{\if #1^\xint_dothis\XINT_expr_rrseq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_rrseq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_rrseq:_Omit\fi
+ \xint_orthat{\XINT_expr_rrseq:_Goon #1}}%
+% \end{macrocode}
+% \subsection{iter}
+% \begin{macrocode}
+\def\XINT_expr_func_iter {\XINT_allexpr_iter \xintbareeval }%
+\def\XINT_flexpr_func_iter {\XINT_allexpr_iter \xintbarefloateval }%
+\def\XINT_iiexpr_func_iter {\XINT_allexpr_iter \xintbareiieval }%
+\def\XINT_allexpr_iter #1#2%
+{%
+ \expandafter\XINT_expr_iterx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_iterx}}
+% \lverb|The (#4) is for ++ mechanism which must have its closing parenthesis.|
+% \begin{macrocode}
+\def\XINT_expr_iterx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_itery\romannumeral0#1(#4)\expandafter\relax
+ \expandafter{\romannumeral0\xintapply \XINT_expr_lockit
+ {\xintRevWithBraces{\xintCSVtoListNonStripped{\XINT_expr_unlock #2}}}}%
+ #2#3#1%
+}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_itery}}
+% \begin{macrocode}
+\def\XINT_expr_itery #1#2#3#4#5#6% #1=valeurs pour variable (locked),
+ % #2=initial values (reversed, one (braced) token each)
+ % #3=toutes les valeurs initiales (csv,locked),
+ % #4=variable, #5=expr,
+ % #6=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=%
+ \expandafter\XINT_expr_iter:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#6#5\relax !#4}{#2},^,\endcsname
+}%
+\def\XINT_expr_iter:_aa #1{\if +#1\expandafter\XINT_expr_iter:_A\else
+ \expandafter\XINT_expr_iter:_a\fi #1}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_iter:_a} etc\dots}
+% \begin{macrocode}
+\catcode`? 3
+\def\XINT_expr_iter:_a #1!#2#3{\XINT_expr_iter:_b {#3}{#2}#1}%
+\def\XINT_expr_iter:_b #1#2#3,{\XINT_expr_iter:_c #3,~#1?{#2}}%
+\def\XINT_expr_iter:_c #1{\if ,#1\xint_dothis\XINT_expr_iter:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_iter:_end\fi
+ \xint_orthat\XINT_expr_iter:_d #1}%
+\def\XINT_expr_iter:_d #1,~#2?#3{\expandafter\XINT_expr_iter:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_iter:_goon #1!#2#3~#4?#5{\expandafter\XINT_expr_iter:_b\expandafter
+ {\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_iter:_omit #1!#2#3~{\XINT_expr_iter:_b }%
+\def\XINT_expr_iter:_abort #1!#2#3~#4?#5#6^,%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}}}%
+\def\XINT_expr_iter:_break #1!#2#3~#4?#5#6^,%
+ {\expandafter\xint_gobble_iv\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}},#1}%
+\def\XINT_expr_iter:_noop ,~#1?#2{\XINT_expr_iter:_b {#1}{#2}}%
+\def\XINT_expr_iter:_end ^,~#1?#2%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#1\space}}}%
+\catcode`? 11
+\def\XINT_expr_iter:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_iter:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_iter:_break\fi
+ \if !#1\xint_dothis\XINT_expr_iter:_omit\fi
+ \xint_orthat{\XINT_expr_iter:_goon #1}%
+}%
+\def\XINT_expr:_unlock #1{\XINT_expr_unlock #1}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_iter:_A} etc\dots}
+% \lverb |n++ for iter|.
+% \begin{macrocode}
+\catcode`? 3
+\def\XINT_expr_iter:_A +#1!#2#3,^,{\XINT_expr_iter:_D {#1}{#3}{#2}}%
+\def\XINT_expr_iter:_D #1#2#3{\expandafter\XINT_expr_iter:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_iter:_Goon #1!#2#3~#4?#5%
+ {\expandafter\XINT_expr_iter:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \expandafter{\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_iter:_Omit #1!#2#3~%#4?#5%
+ {\expandafter\XINT_expr_iter:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_iter:_Abort #1!#2#3~#4?#5%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}}}%
+\def\XINT_expr_iter:_Break #1!#2#3~#4?#5%
+ {\expandafter\xint_gobble_iv\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}},#1}%
+\catcode`? 11
+\def\XINT_expr_iter:_E #1{\if #1^\xint_dothis\XINT_expr_iter:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_iter:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_iter:_Omit\fi
+ \xint_orthat{\XINT_expr_iter:_Goon #1}}%
+% \end{macrocode}
+% \subsection{Macros handling csv lists for functions with multiple comma
+% separated arguments in expressions}
+% \lverb|These 17 macros are used inside \csname...\endcsname. These things
+% are not initiated by a romannumeral in general, but in some cases they are,
+% especially when involved in an \xintNewExpr. They will then be protected
+% against expansion will expand only later in in contexts governed by an
+% initial \romannumeral-`0. There each new item may need to be expanded, which
+% would not be the case in the use for the _func_ things.|
+% \begin{macrocode}
+% \end{macrocode}
+% \subsubsection{\csh{xintANDof:csv}}
+% \lverb|1.09a. For use by \xintexpr inside \csname. 1.1, je remplace
+% ifTrueAelseB par iiNotZero pour des raisons d'optimisations.|
+% \begin{macrocode}
+\def\xintANDof:csv #1{\expandafter\XINT_andof:_a\romannumeral-`0#1,,^}%
+\def\XINT_andof:_a #1{\if ,#1\expandafter\XINT_andof:_e
+ \else\expandafter\XINT_andof:_c\fi #1}%
+\def\XINT_andof:_c #1,{\xintiiifNotZero {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
+\def\XINT_andof:_no #1^{0}%
+\def\XINT_andof:_e #1^{1}% works with empty list
+% \end{macrocode}
+% \subsubsection{\csh{xintORof:csv}}
+% \lverb|1.09a. For use by \xintexpr.|
+% \begin{macrocode}
+\def\xintORof:csv #1{\expandafter\XINT_orof:_a\romannumeral-`0#1,,^}%
+\def\XINT_orof:_a #1{\if ,#1\expandafter\XINT_orof:_e
+ \else\expandafter\XINT_orof:_c\fi #1}%
+\def\XINT_orof:_c #1,{\xintiiifNotZero{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
+\def\XINT_orof:_yes #1^{1}%
+\def\XINT_orof:_e #1^{0}% works with empty list
+% \end{macrocode}
+% \subsubsection{\csh{xintXORof:csv}}
+% \lverb|1.09a. For use by \xintexpr (inside a \csname..\endcsname).|
+% \begin{macrocode}
+\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter 0\romannumeral-`0#1,,^}%
+\def\XINT_xorof:_a #1#2,{\XINT_xorof:_b #2,#1}%
+\def\XINT_xorof:_b #1{\if ,#1\expandafter\XINT_xorof:_e
+ \else\expandafter\XINT_xorof:_c\fi #1}%
+\def\XINT_xorof:_c #1,#2%
+ {\xintiiifNotZero {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
+ \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
+ {\XINT_xorof:_a #2}%
+ }%
+\def\XINT_xorof:_e ,#1#2^{#1}% allows empty list (then returns 0)
+% \end{macrocode}
+% \subsubsection{Generic csv routine}
+% \lverb|1.1. generic routine. up to the loss of some efficiency, especially
+% for Sum:csv and Prod:csv, where \XINTinFloat will be done twice for each
+% argument.|
+% \begin{macrocode}
+\def\XINT_oncsv:_empty #1,^,#2{#2}%
+\def\XINT_oncsv:_end ^,#1#2#3#4{#1}%
+\def\XINT_oncsv:_a #1#2#3%
+ {\if ,#3\expandafter\XINT_oncsv:_empty\else\expandafter\XINT_oncsv:_b\fi #1#2#3}%
+\def\XINT_oncsv:_b #1#2#3,%
+ {\expandafter\XINT_oncsv:_c \expandafter{\romannumeral-`0#2{#3}}#1#2}%
+\def\XINT_oncsv:_c #1#2#3#4,{\expandafter\XINT_oncsv:_d \romannumeral-`0#4,{#1}#2#3}%
+\def\XINT_oncsv:_d #1%
+ {\if ^#1\expandafter\XINT_oncsv:_end\else\expandafter\XINT_oncsv:_e\fi #1}%
+\def\XINT_oncsv:_e #1,#2#3#4%
+ {\expandafter\XINT_oncsv:_c\expandafter {\romannumeral-`0#3{#4{#1}}{#2}}#3#4}%
+% \end{macrocode}
+% \subsubsection{\csh{xintMaxof:csv}, \csh{xintiiMaxof:csv}}
+% \lverb|1.09i. Rewritten for 1.1. Compatible avec liste vide donnant valeur par
+% défaut. Pas compatible avec items manquants.
+% ah je m'aperçois au dernier moment que je n'ai pas en effet de \xintiiMax.
+% Je devrais le rajouter. En tout cas ici c'est uniquement pour xintiiexpr,
+% dans il faut bien sûr ne pas faire de xintNum, donc il faut un iimax.|
+% \begin{macrocode}
+\def\xintMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmax
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimax
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+% \end{macrocode}
+% \subsubsection{\csh{xintMinof:csv}, \csh{xintiiMinof:csv}}
+% \lverb|1.09i. Rewritten for 1.1. For use by \xintiiexpr.|
+% \begin{macrocode}
+\def\xintMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmin
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimin
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+% \end{macrocode}
+% \subsubsection{\csh{xintSum:csv}, csh{xintiiSum:csv}}
+% \lverb|1.09a. Rewritten for 1.1. For use by \xintexpr.|
+% \begin{macrocode}
+\def\xintSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintadd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiiadd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+% \end{macrocode}
+% \subsubsection{\csh{xintPrd:csv}, \csh{xintiiPrd:csv}}
+% \lverb|1.09a. Rewritten for 1.1. For use by \xintexpr.|
+% \begin{macrocode}
+\def\xintPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmul
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{1/1[0]}}%
+\def\xintiiPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimul
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,1}%
+% \end{macrocode}
+% \subsubsection{\csh{xintGCDof:csv}, \csh{xintLCMof:csv}}
+% \lverb|1.09a. Rewritten for 1.1. For use by \xintexpr. Expansion réinstaurée
+% pour besoins de xintNewExpr de version 1.1|
+% \begin{macrocode}
+\def\xintGCDof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintgcd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,1}%
+\def\xintLCMof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintlcm
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+% \end{macrocode}
+% \subsubsection{\csh{XINTinFloatdigits}, \csh{XINTinFloatSqrtdigits}}
+% \lverb|for \xintNewExpr matters, mainly.|
+% \begin{macrocode}
+\def\XINTinFloatdigits {\XINTinFloat [\XINTdigits]}%
+\def\XINTinFloatSqrtdigits {\XINTinFloatSqrt [\XINTdigits]}%
+% \end{macrocode}
+% \subsubsection{\csh{XINTinFloatMaxof:csv}, \csh{XINTinFloatMinof:csv}}
+% \lverb|1.09a. Rewritten for 1.1. For use by \xintfloatexpr. Name changed in 1.09h|
+% \begin{macrocode}
+\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmax
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+\def\XINTinFloatMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmin
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+% \end{macrocode}
+% \subsubsection{\csh{XINTinFloatSum:csv}, \csh{XINTinFloatPrd:csv}}
+% \lverb|1.09a. Rewritten for 1.1. For use by \xintfloatexpr.|
+% \begin{macrocode}
+\def\XINTinFloatSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatadd
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+\def\XINTinFloatPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatmul
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{1[0]}}%
+% \end{macrocode}
+% \subsection{The num, reduce, abs, sgn, frac, floor, ceil, sqr, sqrt, float, round,
+% trunc, mod, quo, rem, gcd, lcm, max, min, `+`, `*`, ?, !, not, all, any, xor,
+% if, ifsgn, first, last, even, odd, and reversed functions}
+% \begin{macrocode}
+\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
+\def\XINT_expr_argandopt #1,#2,#3.#4#5%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintSgn {\XINT_expr_unlock #3}\endcsname
+ \if\relax#3\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#4}{#5[\xintNum {#2}]}{#1}%
}%
-\let\XINT_flexpr_func_sgn\XINT_expr_func_sgn
-\def\XINT_iiexpr_func_sgn #1#2#3%
+\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSgn {\XINT_expr_unlock #3}\endcsname
+ \if\relax#5\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#2{\xintNum {#4}}}{#3}%
}%
-\def\XINT_expr_func_floor #1#2#3%
+\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintFloor {\XINT_expr_unlock #3}\endcsname
+ \if\relax#4\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#1{#3}}{#2}%
}%
+\def\XINT_expr_func_num #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintNum {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_num\XINT_expr_func_num
+\let\XINT_iiexpr_func_num\XINT_expr_func_num
+% [0] added Oct 25. For interaction with SPRaw::csv
+\def\XINT_expr_func_reduce #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintIrr {\XINT_expr_unlock #3}[0]\endcsname }%
+\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
+% no \XINT_iiexpr_func_reduce
+\def\XINT_expr_func_abs #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintAbs {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_abs\XINT_expr_func_abs
+\def\XINT_iiexpr_func_abs #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiAbs {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_sgn #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintSgn {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_sgn\XINT_expr_func_sgn
+\def\XINT_iiexpr_func_sgn #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSgn {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_frac #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintTFrac {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_frac #1#2#3{\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatFrac {\XINT_expr_unlock #3}\endcsname }%
+% no \XINT_iiexpr_func_frac
+\def\XINT_expr_func_floor #1#2#3%
+ {\expandafter #1\expandafter #2\csname .=\xintFloor {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_floor\XINT_expr_func_floor
-\let\XINT_iiexpr_func_floor\XINT_expr_func_floor
+\def\XINT_iiexpr_func_floor #1#2#3%
+{% mais absurde si on ne peut pas avoir quotient comme input
+ \expandafter #1\expandafter #2\csname.=\xintiFloor {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_ceil #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintCeil {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname .=\xintCeil {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_ceil\XINT_expr_func_ceil
-\let\XINT_iiexpr_func_ceil\XINT_expr_func_ceil
-\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
-\def\XINT_expr_func_quo #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintQuo
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\let\XINT_flexpr_func_quo\XINT_expr_func_quo
-\def\XINT_iiexpr_func_quo #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintiiQuo
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\def\XINT_expr_func_rem #1#2#3%
+\def\XINT_iiexpr_func_ceil #1#2#3%
+{% mais absurde si on ne peut pas avoir quotient comme input
+ \expandafter #1\expandafter #2\csname.=\xintiCeil {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_sqr #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintSqr {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_sqr #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintRem
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+ \expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMul % [\XINTdigits]% pour simplifier mes affaires avec \xintNewExpr
+ {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
}%
-\let\XINT_flexpr_func_rem\XINT_expr_func_rem
-\def\XINT_iiexpr_func_rem #1#2#3%
+\def\XINT_iiexpr_func_sqr #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSqr {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_sqrt #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintiiRem
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
-{%
- \if\relax#5\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {#1{0}}{#2{\xintNum {#4}}}{#3}%
+ \expandafter\XINT_expr_argandopt
+ \romannumeral-`0\XINT_expr_unlock#3,,.\XINTinFloatSqrtdigits\XINTinFloatSqrt
+ \endcsname
}%
+\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
+\def\XINT_iiexpr_func_sqrt #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSqrt {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_round #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
- \expandafter\xintiRound\expandafter\xintRound
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \expandafter\xintiRound\expandafter\xintRound
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_round\XINT_expr_func_round
-\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
-{%
- \if\relax#4\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {#1{0}}{#1{#3}}{#2}%
-}%
\def\XINT_iiexpr_func_round #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_iiexpr_oneortwo\expandafter\xintiRound
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\def\XINT_expr_func_trunc #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_expr_oneortwo
\expandafter\xintiTrunc\expandafter\xintTrunc
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_trunc\XINT_expr_func_trunc
\def\XINT_iiexpr_func_trunc #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
\expandafter\XINT_iiexpr_oneortwo\expandafter\xintiTrunc
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
-}%
-\def\XINT_expr_argandopt #1,#2,#3.%
-{%
- \if\relax#3\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {[\XINTdigits]}{[\xintNum {#2}]}{#1}%
+ \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\def\XINT_expr_func_float #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\XINTinFloat
- \romannumeral-`0\expandafter\XINT_expr_argandopt
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \expandafter\XINT_expr_argandopt
+ \romannumeral-`0\XINT_expr_unlock #3,,.\XINTinFloatdigits\XINTinFloat
+ \endcsname
}%
\let\XINT_flexpr_func_float\XINT_expr_func_float
% \XINT_iiexpr_func_float not defined
-\def\XINT_expr_func_sqrt #1#2#3%
+\def\XINT_expr_func_mod #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\XINTinFloatSqrt
- \romannumeral-`0\expandafter\XINT_expr_argandopt
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \expandafter\expandafter\expandafter\xintMod
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
-\def\XINT_iiexpr_func_sqrt #1#2#3%
+\def\XINT_flexpr_func_mod #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiSqrt {\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINTinFloatMod
+ \romannumeral-`0\expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_expr_func_gcd #1#2#3%
+\def\XINT_iiexpr_func_mod #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiMod
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
-\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
-\def\XINT_expr_func_lcm #1#2#3%
+\def\XINT_expr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
-\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
-\def\XINT_expr_func_max #1#2#3%
+\let\XINT_flexpr_func_quo\XINT_expr_func_quo
+\def\XINT_iiexpr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_iiexpr_func_max #1#2#3%
+\def\XINT_expr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_flexpr_func_max #1#2#3%
+\let\XINT_flexpr_func_rem\XINT_expr_func_rem
+\def\XINT_iiexpr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
+\def\XINT_expr_func_gcd #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
+\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
+\def\XINT_expr_func_lcm #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
+\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
+\def\XINT_expr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_iiexpr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_iiexpr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiMinof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_flexpr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_expr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_flexpr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_iiexpr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_expr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_flexpr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_iiexpr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\let\XINT_expr_func_add\XINT_expr_func_sum
-\let\XINT_expr_func_mul\XINT_expr_func_prd
-\let\XINT_flexpr_func_add\XINT_flexpr_func_sum
-\let\XINT_flexpr_func_mul\XINT_flexpr_func_prd
-\let\XINT_iiexpr_func_add\XINT_iiexpr_func_sum
-\let\XINT_iiexpr_func_mul\XINT_iiexpr_func_prd
-\def\XINT_expr_func_? #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_expr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_flexpr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_iiexpr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_expr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_flexpr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_iiexpr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_? #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiIsNotZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_? \XINT_expr_func_?
\let\XINT_iiexpr_func_? \XINT_expr_func_?
-\def\XINT_expr_func_! #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
-}%
+\def\XINT_expr_func_! #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiIsZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_! \XINT_expr_func_!
\let\XINT_iiexpr_func_! \XINT_expr_func_!
-\def\XINT_expr_func_not #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
-}%
+\def\XINT_expr_func_not #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiIsZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_not \XINT_expr_func_not
\let\XINT_iiexpr_func_not \XINT_expr_func_not
\def\XINT_expr_func_all #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_all\XINT_expr_func_all
\let\XINT_iiexpr_func_all\XINT_expr_func_all
\def\XINT_expr_func_any #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_any\XINT_expr_func_any
\let\XINT_iiexpr_func_any\XINT_expr_func_any
\def\XINT_expr_func_xor #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_xor\XINT_expr_func_xor
\let\XINT_iiexpr_func_xor\XINT_expr_func_xor
-\def\xintifNotZero:: #1,#2,#3,{\xintifNotZero{#1}{#2}{#3}}%
+\def\xintifNotZero: #1,#2,#3,{\xintiiifNotZero{#1}{#2}{#3}}%
\def\XINT_expr_func_if #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\expandafter\xintifNotZero::
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\expandafter\xintifNotZero:\romannumeral-`0\XINT_expr_unlock #3,\endcsname }%
\let\XINT_flexpr_func_if\XINT_expr_func_if
\let\XINT_iiexpr_func_if\XINT_expr_func_if
-\def\xintifSgn:: #1,#2,#3,#4,{\xintifSgn{#1}{#2}{#3}{#4}}%
+\def\xintifSgn: #1,#2,#3,#4,{\xintiiifSgn{#1}{#2}{#3}{#4}}%
\def\XINT_expr_func_ifsgn #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\expandafter\xintifSgn::
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+ \expandafter #1\expandafter #2\csname
+ .=\expandafter\xintifSgn:\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_ifsgn\XINT_expr_func_ifsgn
\let\XINT_iiexpr_func_ifsgn\XINT_expr_func_ifsgn
-% \end{macrocode}
-% \subsection{\csh{xintNewExpr}, \csh{xintNewFloatExpr}\dots}
-% \lverb|&
-% Rewritten in 1.09a. Now, the parameters of the formula are entered in the
-% usual way by the user, with # not _. And _ is assigned to make macros
-% not expand. This way, : is freed, as we now need it for the ternary operator.
-% (on numeric data; if use with macro parameters, should be coded with the
-% functionn ifsgn , rather)
-%
-% Code unified in 1.09c, and \xintNewNumExpr, \xintNewBoolExpr added. 1.09i
-% renames \xintNewNumExpr to \xintNewIExpr, and defines \xintNewIIExpr.|
-% \begin{macrocode}
-\def\XINT_newexpr_print #1{\ifnum\xintNthElt{0}{#1}>1
- \expandafter\xint_firstoftwo
- \else
- \expandafter\xint_secondoftwo
- \fi
- {_xintListWithSep,{#1}}{\xint_firstofone#1}}%
-\xintForpair #1#2 in {(fl,Float),(i,iRound0),(bool,IsTrue)}\do {%
- \expandafter\def\csname XINT_new#1expr_print\endcsname
- ##1{\ifnum\xintNthElt{0}{##1}>1
- \expandafter\xint_firstoftwo
- \else
- \expandafter\xint_secondoftwo
- \fi
- {_xintListWithSep,{\xintApply{_xint#2}{##1}}}
- {_xint#2##1}}}%
+\def\XINT_expr_func_first #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\expandafter\XINT_expr_func_firsta
+ \romannumeral-`0\XINT_expr_unlock #3,^\endcsname }%
+\def\XINT_expr_func_firsta #1,#2^{#1}%
+\let\XINT_flexpr_func_first\XINT_expr_func_first
+\let\XINT_iiexpr_func_first\XINT_expr_func_first
+\def\XINT_expr_func_last #1#2#3% will not work in \xintNewExpr if macro param involved
+ {\expandafter #1\expandafter #2\csname.=\expandafter\XINT_expr_func_lasta
+ \romannumeral-`0\XINT_expr_unlock #3,^\endcsname }%
+\def\XINT_expr_func_lasta #1,#2%
+ {\if ^#2 #1\expandafter\xint_gobble_ii\fi \XINT_expr_func_lasta #2}%
+\let\XINT_flexpr_func_last\XINT_expr_func_last
+\let\XINT_iiexpr_func_last\XINT_expr_func_last
+\def\XINT_expr_func_odd #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintOdd{\XINT_expr_unlock #3}\endcsname}%
+\let\XINT_flexpr_func_odd\XINT_expr_func_odd
+\def\XINT_iiexpr_func_odd #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiOdd{\XINT_expr_unlock #3}\endcsname}%
+\def\XINT_expr_func_even #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintEven{\XINT_expr_unlock #3}\endcsname}%
+\let\XINT_flexpr_func_even\XINT_expr_func_even
+\def\XINT_iiexpr_func_even #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiEven{\XINT_expr_unlock #3}\endcsname}%
+\def\XINT_expr_func_nuple #1#2#3%
+ {\expandafter #1\expandafter #2\csname .=\XINT_expr_unlock #3\endcsname }%
+\let\XINT_flexpr_func_nuple\XINT_expr_func_nuple
+\let\XINT_iiexpr_func_nuple\XINT_expr_func_nuple
+\def\XINT_expr_func_reversed #1#2#3%
+ {\expandafter #1\expandafter #2\csname .=\xintReversed::csv
+ {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_reversed\XINT_expr_func_reversed
+\let\XINT_iiexpr_func_reversed\XINT_expr_func_reversed
+\def\xintReversed::csv #1% should be done directly, of course
+ {\xintListWithSep,{\xintRevWithBraces {\xintCSVtoListNonStripped{#1}}}}%
+% \end{macrocode}
+%\subsection{f-expandable versions of the SeqB::csv routines, for \char92 xintNewExpr }
+%\subsubsection{\csh{xintSeqB:f:csv}}
+% \lverb|Produces in f-expandable way. If the step is zero, gives empty result
+% except if start and end coincide.|
+% \begin{macrocode}
+\def\xintSeqB:f:csv #1#2%
+ {\expandafter\XINT_seqb:f:csv \expandafter{\romannumeral0\xintraw{#2}}{#1}}%
+\def\XINT_seqb:f:csv #1#2{\expandafter\XINT_seqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_seqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintifCmp {#3}{#4}\XINT_seqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_seqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_seqb:f:csv_be #1#2#3#4#5{,#2}%
+\def\XINT_seqb:f:csv_bl #1{\if #1p\expandafter\XINT_seqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_seqb:f:csv_pa #1#2#3#4{\expandafter\XINT_seqb:f:csv_p\expandafter
+ {\romannumeral0\xintadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_seqb:f:csv_p #1#2%
+{%
+ \xintifCmp {#1}{#2}\XINT_seqb:f:csv_pa\XINT_seqb:f:csv_pb\XINT_seqb:f:csv_pc
+ {#1}{#2}%
+}%
+\def\XINT_seqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_seqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_seqb:f:csv_bg #1{\if #1n\expandafter\XINT_seqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_seqb:f:csv_na #1#2#3#4{\expandafter\XINT_seqb:f:csv_n\expandafter
+ {\romannumeral0\xintadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_seqb:f:csv_n #1#2%
+{%
+ \xintifCmp {#1}{#2}\XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_seqb:f:csv_na
+ {#1}{#2}%
+}%
+\def\XINT_seqb:f:csv_nb #1#2#3#4{#3,#1}%
+\def\XINT_seqb:f:csv_nc #1#2#3#4{#3}%
+% \end{macrocode}
+%\subsubsection{\csh{xintiiSeqB:f:csv}}
+% \lverb|Produces in f-expandable way. If the step is zero, gives empty result
+% except if start and end coincide.|
+% \begin{macrocode}
+\def\xintiiSeqb:f:csv #1#2%
+ {\expandafter\XINT_iiseqb:f:csv \expandafter{\romannumeral-`0#2}{#1}}%
+\def\XINT_iiseqb:f:csv #1#2{\expandafter\XINT_iiseqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_iiseqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintSgnFork{\XINT_Cmp {#3}{#4}}%
+ \XINT_iiseqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_iiseqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_iiseqb:f:csv_bl #1{\if #1p\expandafter\XINT_iiseqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_iiseqb:f:csv_pa #1#2#3#4{\expandafter\XINT_iiseqb:f:csv_p\expandafter
+ {\romannumeral0\xintiiadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_iiseqb:f:csv_p #1#2%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}%
+ \XINT_iiseqb:f:csv_pa\XINT_iiseqb:f:csv_pb\XINT_iiseqb:f:csv_pc {#1}{#2}%
+}%
+\def\XINT_iiseqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_iiseqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_iiseqb:f:csv_bg #1{\if #1n\expandafter\XINT_iiseqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_iiseqb:f:csv_na #1#2#3#4{\expandafter\XINT_iiseqb:f:csv_n\expandafter
+ {\romannumeral0\xintiiadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_iiseqb:f:csv_n #1#2%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}%
+ \XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_iiseqb:f:csv_na {#1}{#2}%
+}%
+% \end{macrocode}
+%\subsubsection{\csh{XINTinFloatSeqB:f:csv}}
+% \lverb|Produces in f-expandable way. If the step is zero, gives empty result
+% except if start and end coincide. This is all for \xintNewExpr.|
+% \begin{macrocode}
+\def\XINTinFloatSeqB:f:csv #1#2{\expandafter\XINT_flseqb:f:csv \expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#2}}{#1}}%
+\def\XINT_flseqb:f:csv #1#2{\expandafter\XINT_flseqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_flseqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintifCmp {#3}{#4}\XINT_flseqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_flseqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_flseqb:f:csv_bl #1{\if #1p\expandafter\XINT_flseqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_flseqb:f:csv_pa #1#2#3#4{\expandafter\XINT_flseqb:f:csv_p\expandafter
+ {\romannumeral0\XINTinfloatadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_flseqb:f:csv_p #1#2%
+{%
+ \xintifCmp {#1}{#2}%
+ \XINT_flseqb:f:csv_pa\XINT_flseqb:f:csv_pb\XINT_flseqb:f:csv_pc {#1}{#2}%
+}%
+\def\XINT_flseqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_flseqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_flseqb:f:csv_bg #1{\if #1n\expandafter\XINT_flseqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_flseqb:f:csv_na #1#2#3#4{\expandafter\XINT_flseqb:f:csv_n\expandafter
+ {\romannumeral0\XINTinfloatadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_flseqb:f:csv_n #1#2%
+{%
+ \xintifCmp {#1}{#2}%
+ \XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_flseqb:f:csv_na {#1}{#2}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintNewExpr}, \csh{xintNewIExpr}, \csh{xintNewFloatExpr},
+% \csh{xintNewIIExpr}}
+% \subsubsection{\csh{xintApply::csv}}
+% \lverb|Don't ask me what this if for. I wrote it in June, and we are now
+% late October.|
+% \begin{macrocode}
+\def\xintApply::csv #1#2%
+ {\expandafter\XINT_applyon::_a\expandafter {\romannumeral-`0#2}{#1}}%
+\def\XINT_applyon::_a #1#2{\XINT_applyon::_b {#2}{}#1,,}%
+\def\XINT_applyon::_b #1#2#3,{\expandafter\XINT_applyon::_c \romannumeral-`0#3,{#1}{#2}}%
+\def\XINT_applyon::_c #1{\if #1,\expandafter\XINT_applyon::_end
+ \else\expandafter\XINT_applyon::_d\fi #1}%
+\def\XINT_applyon::_d #1,#2{\expandafter\XINT_applyon::_e\romannumeral-`0#2{#1},{#2}}%
+\def\XINT_applyon::_e #1,#2#3{\XINT_applyon::_b {#2}{#3, #1}}%
+\def\XINT_applyon::_end #1,#2#3{\xint_secondoftwo #3}%
+% \end{macrocode}
+% \subsubsection{\csh{xintApply:::csv}}
+% \begin{macrocode}
+\def\xintApply:::csv #1#2#3%
+ {\expandafter\XINT_applyon:::_a\expandafter{\romannumeral-`0#2}{#1}{#3}}%
+\def\XINT_applyon:::_a #1#2#3{\XINT_applyon:::_b {#2}{#3}{}#1,,}%
+\def\XINT_applyon:::_b #1#2#3#4,%
+ {\expandafter\XINT_applyon:::_c \romannumeral-`0#4,{#1}{#2}{#3}}%
+\def\XINT_applyon:::_c #1{\if #1,\expandafter\XINT_applyon:::_end
+ \else\expandafter\XINT_applyon:::_d\fi #1}%
+\def\XINT_applyon:::_d #1,#2#3%
+ {\expandafter\XINT_applyon:::_e\expandafter
+ {\romannumeral-`0\xintApply::csv {#2{#1}}{#3}},{#2}{#3}}%
+\def\XINT_applyon:::_e #1,#2#3#4{\XINT_applyon:::_b {#2}{#3}{#4, #1}}%
+\def\XINT_applyon:::_end #1,#2#3#4{\xint_secondoftwo #4}%
+% \end{macrocode}
+% \subsubsection{\csh{XINT_expr_RApply::csv}, \csh{XINT_expr_LApply::csv}, \csh{XINT_expr_RLApply:::csv}}
+% \begin{macrocode}
+\def\XINT_expr_RApply::csv #1#2#3#4%
+ {~xintApply::csv{~expandafter#1~xint_exchangetwo_keepbraces{#4}}{#3}}%
+\def\XINT_expr_LApply::csv #1#2#3#4{~xintApply::csv{#1{#3}}{#4}}%
+\def\XINT_expr_RLApply:::csv #1#2{~xintApply:::csv{#1}}%
+% \end{macrocode}
+% \subsubsection{Mysterious stuff}
+% \lverb|actually I dimly remember that the whole point is to allow maximal
+% evaluation as long as macro parameters not encountered. Else it would be
+% easier. \xintNewIExpr \f [2]{[12] #1+#2+3*6*1} will correctly compute the 18.
+% Lists are a pain.|
+% \begin{macrocode}
+\catcode`~ 12 % by the way, catcode is set to 3 in \XINTsetupcatcodes
+\catcode`$ 12 % $
+\def\XINT_xptwo_getab_b #1#2!#3%
+ {\expandafter\XINT_xptwo_getab_c\romannumeral-`0#3!#1{#1#2}}%
+\def\XINT_xptwo_getab_c #1#2!#3#4#5#6{#1#3{#5}{#6}{#1#2}{#4}}%
+\def\xint_ddfork #1$$#2#3\krof {#2}%
+\def\XINT_NEfork #1#2{\xint_ddfork
+ #1#2\XINT_expr_RLApply:::csv
+ #1$\XINT_expr_RApply::csv% $
+ $#2\XINT_expr_LApply::csv% $
+ $${\XINT_NEfork_nn #1#2}%
+ \krof }%
+\def\XINT_NEfork_nn #1#2#3#4{%
+ \if #1##\xint_dothis{#3}\fi
+ \if #1~\xint_dothis{#3}\fi
+ \if #2##\xint_dothis{#3}\fi
+ \if #2~\xint_dothis{#3}\fi
+ \xint_orthat {\csname #4NE\endcsname }%
+ }%
+\def\XINT_NEfork_one #1#2!#3#4#5#6{%
+ \if ###1\xint_dothis {#3}\fi
+ \if ~#1\xint_dothis {#3}\fi
+ \if $#1\xint_dothis {~xintApply::csv{#3#5}}\fi %$
+ \xint_orthat {\csname #4NE\endcsname #6}{#1#2}%
+}%
\toks0 {}%
-\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,TFrac,%
- Lt,Gt,Eq,AND,OR,IsNotZero,IsZero,ifNotZero,ifSgn,%
- Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE,iSqrt,%
- iiAdd,iiSub,iiMul,iiSqr,iiPow,iiQuo,iiRem,iiSgn,iiAbs,iiOpp,iE}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE,Frac}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
- {_XINTinFloat#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd,%
- iMaxof,iMinof,iiSum,iiPrd}\do
+\xintFor #1 in {DivTrunc,iiDivTrunc,iiDivRound,Mod,iiMod,iRound,Round,iTrunc,Trunc,%
+ Lt,Gt,Eq,LtorEq,GtorEq,Neq,AND,OR,XOR,iQuo,iRem,Add,Sub,Mul,Div,Pow,E,%
+ iiAdd,iiSub,iiMul,iiPow,iiQuo,iiRem,iiE,SeqA::csv,iiSeqA::csv}\do
{\toks0
- \expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
- ####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
+ \expandafter{\the\toks0
+ \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\endcsname
+ \expandafter\def\csname xint#1\endcsname ####1####2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0####2!{####1}{~xint#1}{xint#1}}%
+ }%
+}%
+\xintFor #1 in {Num,Irr,Abs,iiAbs,Sgn,iiSgn,TFrac,Floor,iFloor,Ceil,iCeil,%
+ Sqr,iiSqr,iSqrt,iiIsZero,iiIsNotZero,iiifNotZero,iiifSgn,Odd,Even,iiOdd,iiEven,%
+ Opp,iiOpp,iiifZero,Fac,iFac,Bool,Toggle}\do
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\endcsname
+ \expandafter\def\csname xint#1\endcsname ####1{%
+ \expandafter\XINT_NEfork_one\romannumeral-`0####1!{~xint#1}{xint#1}{}{}}%
+ }%
+}%
+\xintFor #1 in {Add,Sub,Mul,Div,Power,E,Mod,SeqA::csv}\do
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\let\csname XINTinFloat#1NE\expandafter\endcsname
+ \csname XINTinFloat#1\endcsname
+ \expandafter\def\csname XINTinFloat#1\endcsname ####1####2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0####2!{####1}{~XINTinFloat#1}{XINTinFloat#1}}%
+ }%
+}%
+\toks0
+ \expandafter{\the\toks0
+ \let\xintSeqB::csvNE\xintSeqB::csv
+ \def\xintSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintSeqB:f:csv}{xintSeqB::csv}}%
+ \let\xintiiSeqB::csvNE\xintiiSeqB::csv
+ \def\xintiiSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintiiSeqB:f:csv}{xintiiSeqB::csv}}%
+ \let\XINTinFloatSeqB::csvNE\XINTinFloatSeqB::csv
+ \def\XINTinFloatSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$XINTinFloatSeqB:f:csv}{XINTinFloatSeqB::csv}}%
+ \let\xintSeq::csvNE\xintSeq::csv
+ \def\xintSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintSeq::csv}{xintSeq::csv}}%
+ \let\xintiiSeq::csvNE\xintiiSeq::csv
+ \def\xintiiSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintiiSeq::csv}{xintiiSeq::csv}}%
+ \let\XINTinFloatSeq::csvNE\XINTinFloatSeq::csv
+ \def\XINTinFloatSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$XINTinFloatSeq::csv}{XINTinFloatSeq::csv}}%
+ \let\XINTinFloatFracNE\XINTinFloatFrac
+ \def\XINTinFloatFrac ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatFrac}{XINTinFloatFrac}{}{}}%
+ \let\XINTinFloatdigitsNE\XINTinFloatdigits
+ \def\XINTinFloatdigits ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatdigits}{XINTinFloatdigits}{}{}}%
+ \let\XINTinFloatSqrtdigitsNE\XINTinFloatSqrtdigits
+ \def\XINTinFloatSqrtdigits ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatSqrtdigits}{XINTinFloatSqrtdigits}{}{}}%
+ \let\XINTinFloatNE\XINTinFloat
+ \def\XINTinFloat [##1]##2{% not ultimately general, but got tired
+ \expandafter\XINT_NEfork_one
+ \romannumeral-`0##2!{~XINTinFloat[##1]}{XINTinFloat}{}{[##1]}}%
+ \let\XINTinFloatSqrtNE\XINTinFloatSqrt
+ \def\XINTinFloatSqrt [##1]##2{%
+ \expandafter\XINT_NEfork_one
+ \romannumeral-`0##2!{~XINTinFloatSqrt[##1]}{XINTinFloatSqrt}{}{[##1]}}%
+}%
+\xintFor #1 in {ANDof,ORof,XORof,iiMaxof,iiMinof,iiSum,iiPrd,
+ GCDof,LCMof,Sum,Prd,Maxof,Minof}\do
+{\toks0
+ \expandafter{\the\toks0 \expandafter\def\csname xint#1:csv\endcsname {~xint#1:csv}}%
+}%
\xintFor #1 in {Maxof,Minof,Sum,Prd}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1:csv\endcsname
- ####1{_XINTinFloat#1{\xintCSVtoListNonStripped {####1}}}}}%
-\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
- \def\XINTdigits {_XINTdigits}%
- \def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_flexpr_print ##1{\expandafter\XINT_newflexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_iexpr_print ##1{\expandafter\XINT_newiexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_boolexpr_print ##1{\expandafter\XINT_newboolexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\def\csname XINTinFloat#1:csv\endcsname {~XINTinFloat#1:csv}}%
+}%
+\expandafter\def\expandafter\XINT_expr_redefinemacros\expandafter
+ {\the\toks0
+ \def\XINT_flexpr_noopt {\expandafter\XINT_flexpr_withopt_b\expandafter-%
+ \romannumeral0\xintbarefloateval }%
+ \def\XINT_flexpr_withopt_b ##1##2%
+ {\expandafter\XINT_flexpr_wrap\csname .;##1.=\XINT_expr_unlock ##2\endcsname }%
+ \def\XINT_expr_unlock_sp ##1.;##2##3.=##4!{\if -##2\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi \XINTdigits{{##2##3}}{##4}}%
+ \def\XINT_expr_print ##1{\expandafter\xintSPRaw::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\XINT_iiexpr_print ##1{\expandafter\xintCSV::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\XINT_boolexpr_print ##1{\expandafter\xintIsTrue::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\xintCSV::csv {~xintCSV::csv }% spaces to separate from possible catcode 11
+ \def\xintSPRaw::csv {~xintSPRaw::csv }% stuff after
+ \def\xintPFloat::csv {~xintPFloat::csv }%
+ \def\xintIsTrue::csv {~xintIsTrue::csv }%
+ \def\xintRound::csv {~xintRound::csv }%
+% \def\XINTinFloat::csv {~XINTinFloat::csv }% should not be needed.
+ \def\xintReversed::csv {~xintReversed::csv }%
+ \def\xintListSel:csv {~xintListSel:csv }%
}%
\toks0 {}%
\def\xintNewExpr {\xint_NewExpr\xinttheexpr }%
\def\xintNewFloatExpr {\xint_NewExpr\xintthefloatexpr }%
\def\xintNewIExpr {\xint_NewExpr\xinttheiexpr }%
-\let\xintNewNumExpr\xintNewIExpr
+% \let\xintNewNumExpr\xintNewIExpr % made obsolte for 1.1 release
\def\xintNewIIExpr {\xint_NewExpr\xinttheiiexpr }%
\def\xintNewBoolExpr {\xint_NewExpr\xinttheboolexpr }%
% \end{macrocode}
-% \lverb|1.09i has added \escapechar 92, as \meaning is used in \XINT_NewExpr,
-% and a non existent escape-char would be a problem with \scantokens. Also
-% \catcode32 is set to 10 in \xintexprSafeCatcodes for being extra-safe.|
% \begin{macrocode}
+\def\XINT_newexpr_finish #1>{\noexpand\romannumeral-`0}%
\def\xint_NewExpr #1#2[#3]%
{%
\begingroup
@@ -25297,38 +28283,32 @@ $1$ or $-1$.
\or \toks0 {\xdef #2##1##2##3##4##5##6##7##8##9}%
\fi
\xintexprSafeCatcodes
- \escapechar92
\XINT_NewExpr #1%
}%
-\catcode`* 13
-\def\XINT_NewExpr #1#2%
-{%
- \def\XINT_tmpa ##1##2##3##4##5##6##7##8##9{#2}%
- \XINT_expr_protect
- \lccode`*=`_ \lowercase {\def*}{!noexpand!}%
- \catcode`_ 13 \catcode`: 11
- \endlinechar -1 % 1.09i, 2013/12/18 not sure why I had that? removed.
- % 2014/02/13: you idiot, if not then spurious extra ending space
- % token makes impossible nesting of created macros!
- \everyeof {\noexpand }%
- \edef\XINT_tmpb ##1##2##3##4##5##6##7##8##9%
- {\scantokens
- \expandafter{\romannumeral-`0#1%
- \XINT_tmpa {####1}{####2}{####3}%
- {####4}{####5}{####6}%
- {####7}{####8}{####9}%
- \relax}}%
- \lccode`*=`\$ \lowercase {\def*}{####}%
- \catcode`\$ 13 \catcode`! 0 \catcode`_ 11 %
- \the\toks0
- {\scantokens\expandafter{\expandafter
- \XINT_newexpr_setprefix\meaning\XINT_tmpb}}%
+\catcode`~ 13 \catcode`@ 14 \catcode`\% 6 \catcode`# 12 \catcode`$ 11 @ $
+\def\XINT_NewExpr %1%2@
+{@
+ \def\XINT_tmpa %%1%%2%%3%%4%%5%%6%%7%%8%%9{%2}@
+ \XINT_expr_redefinemacros
+ \def~{$noexpand$}@ vvv vérifier si vraiment besoin pour ^ et !
+ \catcode`: 11 \catcode`_ 11 @ \catcode`^ 11 \catcode`! 11
+ \catcode`# 12 \catcode`~ 13 \escapechar 126
+ \endlinechar -1 \everyeof {\noexpand }@
+ \edef\XINT_tmpb
+ {\scantokens\expandafter
+ {\romannumeral-`0\expandafter%1\XINT_tmpa {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}\relax}@
+ }@
+ \escapechar 92 \catcode`# 6 \catcode`$ 0 @ $
+ \the\toks0
+ {\scantokens\expandafter{\expandafter\XINT_newexpr_finish\meaning\XINT_tmpb}}@
\endgroup
-}%
+}@
+\catcode`% 14
\let\xintexprRestoreCatcodes\empty
\def\xintexprSafeCatcodes
-{% for end user.
- \edef\xintexprRestoreCatcodes {%
+{%
+ \edef\xintexprRestoreCatcodes {%
+ \catcode59=\the\catcode59 % ;
\catcode34=\the\catcode34 % "
\catcode63=\the\catcode63 % ?
\catcode124=\the\catcode124 % |
@@ -25351,7 +28331,8 @@ $1$ or $-1$.
\catcode44=\the\catcode44 % ,
\catcode61=\the\catcode61 % =
\catcode32=\the\catcode32\relax % space
- }% it's hard to know where to stop...
+ }%
+ \catcode59=12 % ;
\catcode34=12 % "
\catcode63=12 % ?
\catcode124=12 % |
@@ -25374,8 +28355,8 @@ $1$ or $-1$.
\catcode44=12 % ,
\catcode61=12 % =
\catcode32=10 % space
-}%
-\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
+}%
+\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
% \end{macrocode}
% \DeleteShortVerb{\|}
@@ -25384,8 +28365,8 @@ $1$ or $-1$.
%<*dtx>
\StoreCodelineNo {xintexpr}
-\def\mymacro #1{\mymacroaux #1}
-\def\mymacroaux #1#2{\strut \texttt{#1:}& \digitstt{ #2.}\tabularnewline }
+\def\mymacro #1{\mymacroaux #1}
+\def\mymacroaux #1#2{\strut \csname #1nameimp\endcsname:& \dtt{ #2.}\tabularnewline }
\indent
\begin{tabular}[t]{r@{}r}
\xintApplyInline\mymacro\storedlinecounts
@@ -25393,12 +28374,12 @@ $1$ or $-1$.
\def\mymacroaux #1#2{#2}%
%
\parbox[t]{10cm}{Total number of code lines:
- \digitstt{\xintiiSum{\xintApply\mymacro\storedlinecounts}}. Each
- package starts
- with circa \digitstt{80} lines dealing with catcodes, package identification
+ \dtt{\the\numexpr
+ \xintListWithSep+{\xintApply\mymacro\storedlinecounts}\relax }. Each
+ package starts
+ with circa \dtt{50} lines dealing with catcodes, package identification
and reloading management, also for Plain \TeX\strut. Version
- \texttt{\xintversion} of \texttt{\xintdate}.\par}
-
+ {\xintbndlversion} of {\xintbndldate}.\par}
\CharacterTable
{Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -25415,7 +28396,7 @@ $1$ or $-1$.
Right bracket \] Circumflex \^ Underscore \_
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum {21871}
+\CheckSum {25545}
\makeatletter\check@checksum\makeatother
\Finale
%% End of file xint.dtx
diff --git a/Master/texmf-dist/source/generic/xint/xint.ins b/Master/texmf-dist/source/generic/xint/xint.ins
index 344d82245d3..1bbab612e21 100644
--- a/Master/texmf-dist/source/generic/xint/xint.ins
+++ b/Master/texmf-dist/source/generic/xint/xint.ins
@@ -1,22 +1,51 @@
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
+%%
+%% This is file `xint.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xint.dtx (with options: `ins')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from xint.ins.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file xint.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
-%% This is a generated file.
-%% "tex xint.ins" extracts from xint.dtx:
-%% xinttools.sty, xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty,
-%% xintgcd.sty, xintseries.sty and xintcfrac.sty as well as xint.tex
-%% (for typesetting the documentation).
+%% ---------------------------------------------------------------
+%%
+%% tex xint.ins extracts all package files from xint.dtx, as well as
+%% xint.tex, README.md, CHANGES.md, doPDFs.sh, doHTMLs.sh.
%%
-%% See xint.dtx for the copyright and the conditions for distribution
-%% and/or modification of this work.
+%% tex xint.ins does not extract Makefile.mk, but etex xint.ins does
%%
\input docstrip.tex
\askforoverwritefalse
-\generate{\nopreamble
-\file{xint.tex}{\from{xint.dtx}{drv}}
+\generate{\nopreamble\nopostamble
+\file{README.md}{\from{xint.dtx}{readme}}
+\file{CHANGES.md}{\from{xint.dtx}{changes}}
+\file{doHTMLs.sh}{\from{xint.dtx}{dohtmlsh}}
+\file{doPDFs.sh}{\from{xint.dtx}{dopdfsh}}
+\ifx\numexpr\undefined\else\catcode9 11
+ \file{Makefile.mk}{\from{xint.dtx}{makefile}}\fi
\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble
+\file{pandoctpl.latex}{\from{xint.dtx}{pandoctpl}}
+\file{xint.tex}{\from{xint.dtx}{drv}}
+\file{xintkernel.sty}{\from{xint.dtx}{xintkernel}}
\file{xinttools.sty}{\from{xint.dtx}{xinttools}}
+\file{xintcore.sty}{\from{xint.dtx}{xintcore}}
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintbinhex.sty}{\from{xint.dtx}{xintbinhex}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
@@ -31,7 +60,8 @@
\Msg{* To finish the installation you have to move the following}
\Msg{* files into a directory searched by TeX:}
\Msg{*}
-\Msg{* xinttools.sty}
+\Msg{* xintkernel.sty}
+\Msg{* xintcore.sty}
\Msg{* xint.sty}
\Msg{* xintbinhex.sty}
\Msg{* xintgcd.sty}
@@ -39,10 +69,13 @@
\Msg{* xintseries.sty}
\Msg{* xintcfrac.sty}
\Msg{* xintexpr.sty}
+\Msg{* xinttools.sty}
\Msg{*}
\Msg{* To produce the documentation run latex thrice on xint.tex}
\Msg{* then dvipdfmx on xint.dvi. Edit xint.tex to get the code}
-\Msg{* source included. (ignore the dvipdfmx warnings)}
+\Msg{* source included.}
+\Msg{* dvipdfmx warnings may be ignored, but if the produced pdf}
+\Msg{* has font problems, run rather pdflatex on xint.tex}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index 28cbf05146e..b105b592d96 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xint: Expandable operations on long numbers
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xint: Expandable operations on big integers
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,10 +36,9 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xint.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xinttools.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -51,150 +50,55 @@
\y{xint}{\numexpr not available, aborting input}%
\aftergroup\endinput
\else
- \ifx\x\relax % plain-TeX, first loading of xint.sty
- \ifx\w\relax % but xinttools.sty not yet loaded.
- \y{xint}{now issuing \string\input\space xinttools.sty}%
- \def\z{\endgroup\input xinttools.sty\relax}%
+ \ifx\x\relax % plain-TeX, first loading of xintcore.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xinttools.sty not yet loaded.
- \y{xint}{now issuing \string\RequirePackage{xinttools}}%
- \def\z{\endgroup\RequirePackage{xinttools}}%
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
\fi
\else
- \y{xint}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xint already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xinttools.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xint}{Loading of package xinttools failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xint}{Loading of package xinttools failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty)
\XINT_providespackage
\ProvidesPackage{xint}%
- [2014/04/01 v1.09n Expandable operations on long numbers (jfB)]%
+ [2014/10/28 v1.1 Expandable operations on big integers (jfB)]%
\long\def\xint_firstofthree #1#2#3{#1}%
\long\def\xint_secondofthree #1#2#3{#2}%
\long\def\xint_thirdofthree #1#2#3{#3}%
\long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i
\long\def\xint_secondofthree_thenstop #1#2#3{ #2}%
\long\def\xint_thirdofthree_thenstop #1#2#3{ #3}%
-\def\xint_gob_til_zeros_iii #1000{}%
-\def\xint_gob_til_zeros_iv #10000{}%
-\def\xint_gob_til_one #11{}%
-\def\xint_gob_til_G #1G{}%
-\def\xint_gob_til_minus #1-{}%
-\def\xint_gob_til_relax #1\relax {}%
-\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
-\def\xint_exchangetwo_keepbraces_thenstop #1#2{ {#2}{#1}}%
-\def\xint_UDzerofork #10#2#3\krof {#2}%
-\def\xint_UDsignfork #1-#2#3\krof {#2}%
-\def\xint_UDwfork #1\W#2#3\krof {#2}%
-\def\xint_UDzerosfork #100#2#3\krof {#2}%
-\def\xint_UDonezerofork #110#2#3\krof {#2}%
-\def\xint_UDsignsfork #1--#2#3\krof {#2}%
-\chardef\xint_c_ix 9
-\chardef\xint_c_x 10
-\chardef\xint_c_ii^v 32 % not used in xint, common to xintfrac and xintbinhex
-\chardef\xint_c_ii^vi 64
-\mathchardef\xint_c_ixixixix 9999
-\mathchardef\xint_c_x^iv 10000
-\newcount\xint_c_x^viii \xint_c_x^viii 100000000
-\def\xintRev {\romannumeral0\xintrev }%
-\def\xintrev #1%
-{%
- \expandafter\XINT_rev_fork
- \romannumeral-`0#1\xint_relax % empty #1 ok, \xint_relax stops expansion
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
-}%
-\def\XINT_rev_fork #1%
-{%
- \xint_UDsignfork
- #1{\expandafter\xint_minus_thenstop\romannumeral0\XINT_rord_main {}}%
- -{\XINT_rord_main {}#1}%
- \krof
-}%
-\def\xintLen {\romannumeral0\xintlen }%
-\def\xintlen #1%
-{%
- \expandafter\XINT_len_fork
- \romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
-}%
-\def\XINT_Len #1% variant which does not expand via \xintnum.
-{%
- \romannumeral0\XINT_len_fork
- #1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
-}%
-\def\XINT_len_fork #1%
+\def\xintSgnFork {\romannumeral0\xintsgnfork }%
+\def\xintsgnfork #1%
{%
- \expandafter\XINT_length_loop
- \xint_UDsignfork
- #1{0.}%
- -{0.#1}%
- \krof
+ \ifcase #1 \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
}%
-\def\XINT_RQ #1#2#3#4#5#6#7#8#9%
+\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
+\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
+\def\XINT_isone #1#2%
{%
- \xint_gob_til_R #9\XINT_RQ_end_a\R\XINT_RQ {#9#8#7#6#5#4#3#2#1}%
+ \xint_gob_til_one #1\XINT_isone_b 1%
+ \expandafter\space\expandafter 0\xint_gob_til_Z #2%
}%
-\def\XINT_RQ_end_a\R\XINT_RQ #1#2\Z
+\def\XINT_isone_b #1\xint_gob_til_Z #2%
{%
- \XINT_RQ_end_b #1\Z
+ \xint_gob_til_W #2\XINT_isone_yes \W
+ \expandafter\space\expandafter 0\xint_gob_til_Z
}%
-\def\XINT_RQ_end_b #1#2#3#4#5#6#7#8%
-{%
- \xint_gob_til_R
- #8\XINT_RQ_end_viii
- #7\XINT_RQ_end_vii
- #6\XINT_RQ_end_vi
- #5\XINT_RQ_end_v
- #4\XINT_RQ_end_iv
- #3\XINT_RQ_end_iii
- #2\XINT_RQ_end_ii
- \R\XINT_RQ_end_i
- \Z #2#3#4#5#6#7#8%
-}%
-\def\XINT_RQ_end_viii #1\Z #2#3#4#5#6#7#8#9\Z { #9}%
-\def\XINT_RQ_end_vii #1\Z #2#3#4#5#6#7#8#9\Z { #8#9000}%
-\def\XINT_RQ_end_vi #1\Z #2#3#4#5#6#7#8#9\Z { #7#8#900}%
-\def\XINT_RQ_end_v #1\Z #2#3#4#5#6#7#8#9\Z { #6#7#8#90}%
-\def\XINT_RQ_end_iv #1\Z #2#3#4#5#6#7#8#9\Z { #5#6#7#8#9}%
-\def\XINT_RQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
-\def\XINT_RQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
-\def\XINT_RQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
+\def\XINT_isone_yes #1\Z { 1}%
\def\XINT_SQ #1#2#3#4#5#6#7#8%
{%
\xint_gob_til_R #8\XINT_SQ_end_a\R\XINT_SQ {#8#7#6#5#4#3#2#1}%
@@ -222,190 +126,59 @@
\def\XINT_SQ_end_iii #1\Z #2#3#4#5#6#7#8\Z { #4#5#6#7#8000}%
\def\XINT_SQ_end_ii #1\Z #2#3#4#5#6#7#8\Z { #3#4#5#6#7#800}%
\def\XINT_SQ_end_i \Z #1#2#3#4#5#6#7\Z { #1#2#3#4#5#6#70}%
-\def\XINT_OQ #1#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_R #9\XINT_OQ_end_a\R\XINT_OQ {#9#8#7#6#5#4#3#2#1}%
-}%
-\def\XINT_OQ_end_a\R\XINT_OQ #1#2\Z
-{%
- \XINT_OQ_end_b #1\Z
-}%
-\def\XINT_OQ_end_b #1#2#3#4#5#6#7#8%
+\def\xintRev {\romannumeral0\xintrev }%
+\def\xintrev #1%
{%
- \xint_gob_til_R
- #8\XINT_OQ_end_viii
- #7\XINT_OQ_end_vii
- #6\XINT_OQ_end_vi
- #5\XINT_OQ_end_v
- #4\XINT_OQ_end_iv
- #3\XINT_OQ_end_iii
- #2\XINT_OQ_end_ii
- \R\XINT_OQ_end_i
- \Z #2#3#4#5#6#7#8%
-}%
-\def\XINT_OQ_end_viii #1\Z #2#3#4#5#6#7#8#9\Z { #9}%
-\def\XINT_OQ_end_vii #1\Z #2#3#4#5#6#7#8#9\Z { #8#90000000}%
-\def\XINT_OQ_end_vi #1\Z #2#3#4#5#6#7#8#9\Z { #7#8#9000000}%
-\def\XINT_OQ_end_v #1\Z #2#3#4#5#6#7#8#9\Z { #6#7#8#900000}%
-\def\XINT_OQ_end_iv #1\Z #2#3#4#5#6#7#8#9\Z { #5#6#7#8#90000}%
-\def\XINT_OQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
-\def\XINT_OQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
-\def\XINT_OQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
-\edef\xint_cleanupzeros_andstop #1#2#3#4%
-{%
- \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
-}%
-\def\xint_cleanupzeros_nostop #1#2#3#4%
-{%
- \the\numexpr #1#2#3#4\relax
-}%
-\def\XINT_rev_andcuz #1%
-{%
- \expandafter\xint_cleanupzeros_andstop
- \romannumeral0\XINT_rord_main {}#1%
- \xint_relax
+ \expandafter\XINT_rev_fork
+ \romannumeral-`0#1\xint_relax % empty #1 ok, \xint_relax stops expansion
\xint_bye\xint_bye\xint_bye\xint_bye
\xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
-}%
-\def\XINT_cuz #1%
-{%
- \XINT_cuz_loop #1\W\W\W\W\W\W\W\Z%
-}%
-\def\XINT_cuz_loop #1#2#3#4#5#6#7#8%
-{%
- \xint_gob_til_W #8\xint_cuz_end_a\W
- \xint_gob_til_Z #8\xint_cuz_end_A\Z
- \XINT_cuz_check_a {#1#2#3#4#5#6#7#8}%
-}%
-\def\xint_cuz_end_a #1\XINT_cuz_check_a #2%
-{%
- \xint_cuz_end_b #2%
-}%
-\edef\xint_cuz_end_b #1#2#3#4#5\Z
-{%
- \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
-}%
-\def\xint_cuz_end_A \Z\XINT_cuz_check_a #1{ 0}%
-\def\XINT_cuz_check_a #1%
-{%
- \expandafter\XINT_cuz_check_b\the\numexpr #1\relax
-}%
-\def\XINT_cuz_check_b #1%
-{%
- \xint_gob_til_zero #1\xint_cuz_backtoloop 0\XINT_cuz_stop #1%
-}%
-\def\XINT_cuz_stop #1\W #2\Z{ #1}%
-\def\xint_cuz_backtoloop 0\XINT_cuz_stop 0{\XINT_cuz_loop }%
-\def\xintIsOne {\romannumeral0\xintisone }%
-\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
-\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
-\def\XINT_isone #1#2%
-{%
- \xint_gob_til_one #1\XINT_isone_b 1%
- \expandafter\space\expandafter 0\xint_gob_til_Z #2%
-}%
-\def\XINT_isone_b #1\xint_gob_til_Z #2%
-{%
- \xint_gob_til_W #2\XINT_isone_yes \W
- \expandafter\space\expandafter 0\xint_gob_til_Z
-}%
-\def\XINT_isone_yes #1\Z { 1}%
-\def\xintiNum {\romannumeral0\xintinum }%
-\def\xintinum #1%
-{%
- \expandafter\XINT_num_loop
- \romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
-}%
-\let\xintNum\xintiNum \let\xintnum\xintinum
-\def\XINT_num #1%
-{%
- \XINT_num_loop #1\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\Z
-}%
-\def\XINT_num_loop #1#2#3#4#5#6#7#8%
-{%
- \xint_gob_til_xint_relax #8\XINT_num_end\xint_relax
- \XINT_num_NumEight #1#2#3#4#5#6#7#8%
-}%
-\edef\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
-{%
- \noexpand\expandafter\space\noexpand\the\numexpr #1+\xint_c_\relax
-}%
-\def\XINT_num_NumEight #1#2#3#4#5#6#7#8%
-{%
- \ifnum \numexpr #1#2#3#4#5#6#7#8+\xint_c_= \xint_c_
- \xint_afterfi {\expandafter\XINT_num_keepsign_a
- \the\numexpr #1#2#3#4#5#6#7#81\relax}%
- \else
- \xint_afterfi {\expandafter\XINT_num_finish
- \the\numexpr #1#2#3#4#5#6#7#8\relax}%
- \fi
-}%
-\def\XINT_num_keepsign_a #1%
-{%
- \xint_gob_til_one#1\XINT_num_gobacktoloop 1\XINT_num_keepsign_b
-}%
-\def\XINT_num_gobacktoloop 1\XINT_num_keepsign_b {\XINT_num_loop }%
-\def\XINT_num_keepsign_b #1{\XINT_num_loop -}%
-\def\XINT_num_finish #1\xint_relax #2\Z { #1}%
-\def\xintiiSgn {\romannumeral0\xintiisgn }%
-\def\xintiisgn #1%
-{%
- \expandafter\XINT_sgn \romannumeral-`0#1\Z%
+ \xint_relax
}%
-\def\xintSgn {\romannumeral0\xintsgn }%
-\def\xintsgn #1%
+\def\XINT_rev_fork #1%
{%
- \expandafter\XINT_sgn \romannumeral0\xintnum{#1}\Z%
+ \xint_UDsignfork
+ #1{\expandafter\xint_minus_thenstop\romannumeral0\XINT_rord_main {}}%
+ -{\XINT_rord_main {}#1}%
+ \krof
}%
-\def\XINT_sgn #1#2\Z
+\def\xintLen {\romannumeral0\xintlen }%
+\def\xintlen #1%
{%
- \xint_UDzerominusfork
- #1-{ 0}%
- 0#1{ -1}%
- 0-{ 1}%
- \krof
+ \expandafter\XINT_len_fork
+ \romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_Sgn #1#2\Z
+\def\XINT_Len #1% variant which does not expand via \xintnum.
{%
- \xint_UDzerominusfork
- #1-{0}%
- 0#1{-1}%
- 0-{1}%
- \krof
+ \romannumeral0\XINT_len_fork
+ #1\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
}%
-\def\XINT_cntSgn #1#2\Z
+\def\XINT_len_fork #1%
{%
- \xint_UDzerominusfork
- #1-\z@
- 0#1\m@ne
- 0-\@ne
+ \expandafter\XINT_length_loop
+ \xint_UDsignfork
+ #1{0.}%
+ -{0.#1}%
\krof
}%
\def\xintBool #1{\romannumeral-`0%
\csname if#1\endcsname\expandafter1\else\expandafter0\fi }%
\def\xintToggle #1{\romannumeral-`0\iftoggle{#1}{1}{0}}%
-\def\xintSgnFork {\romannumeral0\xintsgnfork }%
-\def\xintsgnfork #1%
+\def\xintifSgn {\romannumeral0\xintifsgn }%
+\def\xintifsgn #1%
{%
- \ifcase #1 \expandafter\xint_secondofthree_thenstop
+ \ifcase \xintSgn{#1}
+ \expandafter\xint_secondofthree_thenstop
\or\expandafter\xint_thirdofthree_thenstop
\else\expandafter\xint_firstofthree_thenstop
\fi
}%
-\def\XINT_cntSgnFork #1%
-{%
- \ifcase #1\expandafter\xint_secondofthree
- \or\expandafter\xint_thirdofthree
- \else\expandafter\xint_firstofthree
- \fi
-}%
-\def\xintifSgn {\romannumeral0\xintifsgn }%
-\def\xintifsgn #1%
+\def\xintiiifSgn {\romannumeral0\xintiiifsgn }%
+\def\xintiiifsgn #1%
{%
- \ifcase \romannumeral0\xintsgn{#1}
+ \ifcase \xintiiSgn{#1}
\expandafter\xint_secondofthree_thenstop
\or\expandafter\xint_thirdofthree_thenstop
\else\expandafter\xint_firstofthree_thenstop
@@ -429,6 +202,24 @@
\expandafter\xint_firstoftwo_thenstop
\fi
}%
+\def\xintiiifZero {\romannumeral0\xintiiifzero }%
+\def\xintiiifzero #1%
+{%
+ \if0\xintiiSgn{#1}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }%
+\def\xintiiifnotzero #1%
+{%
+ \if0\xintiiSgn{#1}%
+ \expandafter\xint_secondoftwo_thenstop
+ \else
+ \expandafter\xint_firstoftwo_thenstop
+ \fi
+}%
\def\xintifOne {\romannumeral0\xintifone }%
\def\xintifone #1%
{%
@@ -484,694 +275,6 @@
\expandafter\xint_secondoftwo_thenstop
\fi
}%
-\def\xintiiOpp {\romannumeral0\xintiiopp }%
-\def\xintiiopp #1%
-{%
- \expandafter\XINT_opp \romannumeral-`0#1%
-}%
-\def\xintiOpp {\romannumeral0\xintiopp }%
-\def\xintiopp #1%
-{%
- \expandafter\XINT_opp \romannumeral0\xintnum{#1}%
-}%
-\let\xintOpp\xintiOpp \let\xintopp\xintiopp
-\def\XINT_Opp #1{\romannumeral0\XINT_opp #1}%
-\def\XINT_opp #1%
-{%
- \xint_UDzerominusfork
- #1-{ 0}% zero
- 0#1{ }% negative
- 0-{ -#1}% positive
- \krof
-}%
-\def\xintiiAbs {\romannumeral0\xintiiabs }%
-\def\xintiiabs #1%
-{%
- \expandafter\XINT_abs \romannumeral-`0#1%
-}%
-\def\xintiAbs {\romannumeral0\xintiabs }%
-\def\xintiabs #1%
-{%
- \expandafter\XINT_abs \romannumeral0\xintnum{#1}%
-}%
-\let\xintAbs\xintiAbs \let\xintabs\xintiabs
-\def\XINT_Abs #1{\romannumeral0\XINT_abs #1}%
-\def\XINT_abs #1%
-{%
- \xint_UDsignfork
- #1{ }%
- -{ #1}%
- \krof
-}%
-\def\XINT_add_A #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_add_az\W
- \XINT_add_AB #1{#3#4#5#6}{#2}%
-}%
-\def\xint_add_az\W\XINT_add_AB #1#2%
-{%
- \XINT_add_AC_checkcarry #1%
-}%
-\def\XINT_add_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \xint_gob_til_W #5\xint_add_bz\W
- \XINT_add_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
-}%
-\def\XINT_add_ABE #1#2#3#4#5#6%
-{%
- \expandafter\XINT_add_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
-}%
-\def\XINT_add_ABEA #1#2#3.#4%
-{%
- \XINT_add_A #2{#3#4}%
-}%
-\def\xint_add_bz\W\XINT_add_ABE #1#2#3#4#5#6%
-{%
- \expandafter\XINT_add_CC\the\numexpr #1+10#5#4#3#2.%
-}%
-\def\XINT_add_CC #1#2#3.#4%
-{%
- \XINT_add_AC_checkcarry #2{#3#4}% on va examiner et \'eliminer #2
-}%
-\def\XINT_add_AC_checkcarry #1%
-{%
- \xint_gob_til_zero #1\xint_add_AC_nocarry 0\XINT_add_C
-}%
-\def\xint_add_AC_nocarry 0\XINT_add_C #1#2\W\X\Y\Z
-{%
- \expandafter
- \xint_cleanupzeros_andstop
- \romannumeral0%
- \XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1%
-}%
-\def\XINT_add_C #1#2#3#4#5%
-{%
- \xint_gob_til_W #2\xint_add_cz\W
- \XINT_add_CD {#5#4#3#2}{#1}%
-}%
-\def\XINT_add_CD #1%
-{%
- \expandafter\XINT_add_CC\the\numexpr 1+10#1.%
-}%
-\def\xint_add_cz\W\XINT_add_CD #1#2{ 1#2}%
-\def\XINT_addr_A #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_addr_az\W
- \XINT_addr_B #1{#3#4#5#6}{#2}%
-}%
-\def\xint_addr_az\W\XINT_addr_B #1#2%
-{%
- \XINT_addr_AC_checkcarry #1%
-}%
-\def\XINT_addr_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \xint_gob_til_W #5\xint_addr_bz\W
- \XINT_addr_E #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
-}%
-\def\XINT_addr_E #1#2#3#4#5#6%
-{%
- \expandafter\XINT_addr_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
-}%
-\def\XINT_addr_ABEA #1#2#3#4#5#6#7%
-{%
- \XINT_addr_A #2{#7#6#5#4#3}%
-}%
-\def\xint_addr_bz\W\XINT_addr_E #1#2#3#4#5#6%
-{%
- \expandafter\XINT_addr_CC\the\numexpr #1+10#5#4#3#2\relax
-}%
-\def\XINT_addr_CC #1#2#3#4#5#6#7%
-{%
- \XINT_addr_AC_checkcarry #2{#7#6#5#4#3}%
-}%
-\def\XINT_addr_AC_checkcarry #1%
-{%
- \xint_gob_til_zero #1\xint_addr_AC_nocarry 0\XINT_addr_C
-}%
-\def\xint_addr_AC_nocarry 0\XINT_addr_C #1#2\W\X\Y\Z { #1#2}%
-\def\XINT_addr_C #1#2#3#4#5%
-{%
- \xint_gob_til_W #2\xint_addr_cz\W
- \XINT_addr_D {#5#4#3#2}{#1}%
-}%
-\def\XINT_addr_D #1%
-{%
- \expandafter\XINT_addr_CC\the\numexpr 1+10#1\relax
-}%
-\def\xint_addr_cz\W\XINT_addr_D #1#2{ #21000}%
-\def\XINT_addm_A #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_addm_az\W
- \XINT_addm_AB #1{#3#4#5#6}{#2}%
-}%
-\def\xint_addm_az\W\XINT_addm_AB #1#2%
-{%
- \XINT_addm_AC_checkcarry #1%
-}%
-\def\XINT_addm_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \XINT_addm_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
-}%
-\def\XINT_addm_ABE #1#2#3#4#5#6%
-{%
- \expandafter\XINT_addm_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
-}%
-\def\XINT_addm_ABEA #1#2#3.#4%
-{%
- \XINT_addm_A #2{#3#4}%
-}%
-\def\XINT_addm_AC_checkcarry #1%
-{%
- \xint_gob_til_zero #1\xint_addm_AC_nocarry 0\XINT_addm_C
-}%
-\def\xint_addm_AC_nocarry 0\XINT_addm_C #1#2\W\X\Y\Z
-{%
- \expandafter
- \xint_cleanupzeros_andstop
- \romannumeral0%
- \XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1%
-}%
-\def\XINT_addm_C #1#2#3#4#5%
-{%
- \xint_gob_til_W
- #5\xint_addm_cw
- #4\xint_addm_cx
- #3\xint_addm_cy
- #2\xint_addm_cz
- \W\XINT_addm_CD {#5#4#3#2}{#1}%
-}%
-\def\XINT_addm_CD #1%
-{%
- \expandafter\XINT_addm_CC\the\numexpr 1+10#1.%
-}%
-\def\XINT_addm_CC #1#2#3.#4%
-{%
- \XINT_addm_AC_checkcarry #2{#3#4}%
-}%
-\def\xint_addm_cw
- #1\xint_addm_cx
- #2\xint_addm_cy
- #3\xint_addm_cz
- \W\XINT_addm_CD
-{%
- \expandafter\XINT_addm_CDw\the\numexpr 1+#1#2#3.%
-}%
-\def\XINT_addm_CDw #1.#2#3\X\Y\Z
-{%
- \XINT_addm_end #1#3%
-}%
-\def\xint_addm_cx
- #1\xint_addm_cy
- #2\xint_addm_cz
- \W\XINT_addm_CD
-{%
- \expandafter\XINT_addm_CDx\the\numexpr 1+#1#2.%
-}%
-\def\XINT_addm_CDx #1.#2#3\Y\Z
-{%
- \XINT_addm_end #1#3%
-}%
-\def\xint_addm_cy
- #1\xint_addm_cz
- \W\XINT_addm_CD
-{%
- \expandafter\XINT_addm_CDy\the\numexpr 1+#1.%
-}%
-\def\XINT_addm_CDy #1.#2#3\Z
-{%
- \XINT_addm_end #1#3%
-}%
-\def\xint_addm_cz\W\XINT_addm_CD #1#2#3{\XINT_addm_end #1#3}%
-\edef\XINT_addm_end #1#2#3#4#5%
- {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5\relax}%
-\def\XINT_addp_A #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_addp_az\W
- \XINT_addp_AB #1{#3#4#5#6}{#2}%
-}%
-\def\xint_addp_az\W\XINT_addp_AB #1#2%
-{%
- \XINT_addp_AC_checkcarry #1%
-}%
-\def\XINT_addp_AC_checkcarry #1%
-{%
- \xint_gob_til_zero #1\xint_addp_AC_nocarry 0\XINT_addp_C
-}%
-\def\xint_addp_AC_nocarry 0\XINT_addp_C
-{%
- \XINT_addp_F
-}%
-\def\XINT_addp_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \XINT_addp_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
-}%
-\def\XINT_addp_ABE #1#2#3#4#5#6%
-{%
- \expandafter\XINT_addp_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
-}%
-\def\XINT_addp_ABEA #1#2#3#4#5#6#7%
-{%
- \XINT_addp_A #2{#7#6#5#4#3}%<-- attention on met donc \`a droite
-}%
-\def\XINT_addp_C #1#2#3#4#5%
-{%
- \xint_gob_til_W
- #5\xint_addp_cw
- #4\xint_addp_cx
- #3\xint_addp_cy
- #2\xint_addp_cz
- \W\XINT_addp_CD {#5#4#3#2}{#1}%
-}%
-\def\XINT_addp_CD #1%
-{%
- \expandafter\XINT_addp_CC\the\numexpr 1+10#1\relax
-}%
-\def\XINT_addp_CC #1#2#3#4#5#6#7%
-{%
- \XINT_addp_AC_checkcarry #2{#7#6#5#4#3}%
-}%
-\def\xint_addp_cw
- #1\xint_addp_cx
- #2\xint_addp_cy
- #3\xint_addp_cz
- \W\XINT_addp_CD
-{%
- \expandafter\XINT_addp_CDw\the\numexpr \xint_c_i+10#1#2#3\relax
-}%
-\def\XINT_addp_CDw #1#2#3#4#5#6%
-{%
- \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDw_zeros
- 0000\XINT_addp_endDw #2#3#4#5%
-}%
-\def\XINT_addp_endDw_zeros 0000\XINT_addp_endDw 0000#1\X\Y\Z{ #1}%
-\def\XINT_addp_endDw #1#2#3#4#5\X\Y\Z{ #5#4#3#2#1}%
-\def\xint_addp_cx
- #1\xint_addp_cy
- #2\xint_addp_cz
- \W\XINT_addp_CD
-{%
- \expandafter\XINT_addp_CDx\the\numexpr \xint_c_i+100#1#2\relax
-}%
-\def\XINT_addp_CDx #1#2#3#4#5#6%
-{%
- \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDx_zeros
- 0000\XINT_addp_endDx #2#3#4#5%
-}%
-\def\XINT_addp_endDx_zeros 0000\XINT_addp_endDx 0000#1\Y\Z{ #1}%
-\def\XINT_addp_endDx #1#2#3#4#5\Y\Z{ #5#4#3#2#1}%
-\def\xint_addp_cy #1\xint_addp_cz\W\XINT_addp_CD
-{%
- \expandafter\XINT_addp_CDy\the\numexpr \xint_c_i+1000#1\relax
-}%
-\def\XINT_addp_CDy #1#2#3#4#5#6%
-{%
- \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDy_zeros
- 0000\XINT_addp_endDy #2#3#4#5%
-}%
-\def\XINT_addp_endDy_zeros 0000\XINT_addp_endDy 0000#1\Z{ #1}%
-\def\XINT_addp_endDy #1#2#3#4#5\Z{ #5#4#3#2#1}%
-\def\xint_addp_cz\W\XINT_addp_CD #1#2{ #21000}%
-\def\XINT_addp_F #1#2#3#4#5%
-{%
- \xint_gob_til_W
- #5\xint_addp_Gw
- #4\xint_addp_Gx
- #3\xint_addp_Gy
- #2\xint_addp_Gz
- \W\XINT_addp_G {#2#3#4#5}{#1}%
-}%
-\def\XINT_addp_G #1#2%
-{%
- \XINT_addp_F {#2#1}%
-}%
-\def\xint_addp_Gw
- #1\xint_addp_Gx
- #2\xint_addp_Gy
- #3\xint_addp_Gz
- \W\XINT_addp_G #4%
-{%
- \xint_gob_til_zeros_iv #3#2#10\XINT_addp_endGw_zeros
- 0000\XINT_addp_endGw #3#2#10%
-}%
-\def\XINT_addp_endGw_zeros 0000\XINT_addp_endGw 0000#1\X\Y\Z{ #1}%
-\def\XINT_addp_endGw #1#2#3#4#5\X\Y\Z{ #5#1#2#3#4}%
-\def\xint_addp_Gx
- #1\xint_addp_Gy
- #2\xint_addp_Gz
- \W\XINT_addp_G #3%
-{%
- \xint_gob_til_zeros_iv #2#100\XINT_addp_endGx_zeros
- 0000\XINT_addp_endGx #2#100%
-}%
-\def\XINT_addp_endGx_zeros 0000\XINT_addp_endGx 0000#1\Y\Z{ #1}%
-\def\XINT_addp_endGx #1#2#3#4#5\Y\Z{ #5#1#2#3#4}%
-\def\xint_addp_Gy
- #1\xint_addp_Gz
- \W\XINT_addp_G #2%
-{%
- \xint_gob_til_zeros_iv #1000\XINT_addp_endGy_zeros
- 0000\XINT_addp_endGy #1000%
-}%
-\def\XINT_addp_endGy_zeros 0000\XINT_addp_endGy 0000#1\Z{ #1}%
-\def\XINT_addp_endGy #1#2#3#4#5\Z{ #5#1#2#3#4}%
-\def\xint_addp_Gz\W\XINT_addp_G #1#2{ #2}%
-\def\xintiiAdd {\romannumeral0\xintiiadd }%
-\def\xintiiadd #1%
-{%
- \expandafter\xint_iiadd\expandafter{\romannumeral-`0#1}%
-}%
-\def\xint_iiadd #1#2%
-{%
- \expandafter\XINT_add_fork \romannumeral-`0#2\Z #1\Z
-}%
-\def\xintiAdd {\romannumeral0\xintiadd }%
-\def\xintiadd #1%
-{%
- \expandafter\xint_add\expandafter{\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_add #1#2%
-{%
- \expandafter\XINT_add_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\let\xintAdd\xintiAdd \let\xintadd\xintiadd
-\def\XINT_Add #1#2{\romannumeral0\XINT_add_fork #2\Z #1\Z }%
-\def\XINT_add #1#2{\XINT_add_fork #2\Z #1\Z }%
-\def\XINT_add_fork #1#2\Z #3#4\Z
-{%
- \xint_UDzerofork
- #1\XINT_add_secondiszero
- #3\XINT_add_firstiszero
- 0
- {\xint_UDsignsfork
- #1#3\XINT_add_minusminus % #1 = #3 = -
- #1-\XINT_add_minusplus % #1 = -
- #3-\XINT_add_plusminus % #3 = -
- --\XINT_add_plusplus
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-\def\XINT_add_secondiszero #1#2#3#4{ #4#2}%
-\def\XINT_add_firstiszero #1#2#3#4{ #3#1}%
-\def\XINT_add_minusminus #1#2#3#4%
-{%
- \expandafter\xint_minus_thenstop%
- \romannumeral0\XINT_add_pre {#2}{#1}%
-}%
-\def\XINT_add_minusplus #1#2#3#4%
-{%
- \XINT_sub_pre {#4#2}{#1}%
-}%
-\def\XINT_add_plusminus #1#2#3#4%
-{%
- \XINT_sub_pre {#3#1}{#2}%
-}%
-\def\XINT_add_plusplus #1#2#3#4%
-{%
- \XINT_add_pre {#4#2}{#3#1}%
-}%
-\def\XINT_add_pre #1%
-{%
- \expandafter\XINT_add_pre_b\expandafter
- {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
-}%
-\def\XINT_add_pre_b #1#2%
-{%
- \expandafter\XINT_add_A
- \expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #1\W\X\Y\Z
-}%
-\def\xintiiSub {\romannumeral0\xintiisub }%
-\def\xintiisub #1%
-{%
- \expandafter\xint_iisub\expandafter{\romannumeral-`0#1}%
-}%
-\def\xint_iisub #1#2%
-{%
- \expandafter\XINT_sub_fork \romannumeral-`0#2\Z #1\Z
-}%
-\def\xintiSub {\romannumeral0\xintisub }%
-\def\xintisub #1%
-{%
- \expandafter\xint_sub\expandafter{\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_sub #1#2%
-{%
- \expandafter\XINT_sub_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\def\XINT_Sub #1#2{\romannumeral0\XINT_sub_fork #2\Z #1\Z }%
-\def\XINT_sub #1#2{\XINT_sub_fork #2\Z #1\Z }%
-\let\xintSub\xintiSub \let\xintsub\xintisub
-\def\XINT_sub_fork #1#2\Z #3#4\Z
-{%
- \xint_UDsignsfork
- #1#3\XINT_sub_minusminus
- #1-\XINT_sub_minusplus % attention, #3=0 possible
- #3-\XINT_sub_plusminus % attention, #1=0 possible
- --{\xint_UDzerofork
- #1\XINT_sub_secondiszero
- #3\XINT_sub_firstiszero
- 0\XINT_sub_plusplus
- \krof }%
- \krof
- {#2}{#4}#1#3%
-}%
-\def\XINT_sub_secondiszero #1#2#3#4{ #4#2}%
-\def\XINT_sub_firstiszero #1#2#3#4{ -#3#1}%
-\def\XINT_sub_plusplus #1#2#3#4%
-{%
- \XINT_sub_pre {#4#2}{#3#1}%
-}%
-\def\XINT_sub_minusminus #1#2#3#4%
-{%
- \XINT_sub_pre {#1}{#2}%
-}%
-\def\XINT_sub_minusplus #1#2#3#4%
-{%
- \xint_gob_til_zero #4\xint_sub_mp0\XINT_add_pre {#4#2}{#1}%
-}%
-\def\xint_sub_mp0\XINT_add_pre #1#2{ #2}%
-\def\XINT_sub_plusminus #1#2#3#4%
-{%
- \xint_gob_til_zero #3\xint_sub_pm0\expandafter\xint_minus_thenstop%
- \romannumeral0\XINT_add_pre {#2}{#3#1}%
-}%
-\def\xint_sub_pm #1\XINT_add_pre #2#3{ -#2}%
-\def\XINT_sub_pre #1%
-{%
- \expandafter\XINT_sub_pre_b\expandafter
- {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
-}%
-\def\XINT_sub_pre_b #1#2%
-{%
- \expandafter\XINT_sub_A
- \expandafter1\expandafter{\expandafter}%
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \W\X\Y\Z #1 \W\X\Y\Z
-}%
-\def\XINT_sub_A #1#2#3\W\X\Y\Z #4#5#6#7%
-{%
- \xint_gob_til_W
- #4\xint_sub_az
- \W\XINT_sub_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
-}%
-\def\XINT_sub_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W
- #4\xint_sub_bz
- \W\XINT_sub_onestep #1#2{#7#6#5#4}{#3}%
-}%
-\def\XINT_sub_onestep #1#2#3#4#5#6%
-{%
- \expandafter\XINT_sub_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
-}%
-\def\XINT_sub_backtoA #1#2#3.#4%
-{%
- \XINT_sub_A #2{#3#4}%
-}%
-\def\xint_sub_bz
- \W\XINT_sub_onestep #1#2#3#4#5#6#7%
-{%
- \xint_UDzerofork
- #1\XINT_sub_C % une retenue
- 0\XINT_sub_D % pas de retenue
- \krof
- {#7}#2#3#4#5%
-}%
-\def\XINT_sub_D #1#2\W\X\Y\Z
-{%
- \expandafter
- \xint_cleanupzeros_andstop
- \romannumeral0%
- \XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1%
-}%
-\def\XINT_sub_C #1#2#3#4#5%
-{%
- \xint_gob_til_W
- #2\xint_sub_cz
- \W\XINT_sub_AC_onestep {#5#4#3#2}{#1}%
-}%
-\def\XINT_sub_AC_onestep #1%
-{%
- \expandafter\XINT_sub_backtoC\the\numexpr 11#1-\xint_c_i.%
-}%
-\def\XINT_sub_backtoC #1#2#3.#4%
-{%
- \XINT_sub_AC_checkcarry #2{#3#4}% la retenue va \^etre examin\'ee
-}%
-\def\XINT_sub_AC_checkcarry #1%
-{%
- \xint_gob_til_one #1\xint_sub_AC_nocarry 1\XINT_sub_C
-}%
-\def\xint_sub_AC_nocarry 1\XINT_sub_C #1#2\W\X\Y\Z
-{%
- \expandafter
- \XINT_cuz_loop
- \romannumeral0%
- \XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1\W\W\W\W\W\W\W\Z
-}%
-\def\xint_sub_cz\W\XINT_sub_AC_onestep #1%
-{%
- \XINT_cuz
-}%
-\def\xint_sub_az\W\XINT_sub_B #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_W
- #4\xint_sub_ez
- \W\XINT_sub_Eenter #1{#3}#4#5#6#7%
-}%
-\def\XINT_sub_Eenter #1#2%
-{%
- \expandafter
- \XINT_sub_E\expandafter1\expandafter{\expandafter}%
- \romannumeral0%
- \XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- \W\X\Y\Z #1%
-}%
-\def\XINT_sub_E #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_sub_F\W
- \XINT_sub_Eonestep #1{#6#5#4#3}{#2}%
-}%
-\def\XINT_sub_Eonestep #1#2%
-{%
- \expandafter\XINT_sub_backtoE\the\numexpr 109999-#2+#1.%
-}%
-\def\XINT_sub_backtoE #1#2#3.#4%
-{%
- \XINT_sub_E #2{#3#4}%
-}%
-\def\xint_sub_F\W\XINT_sub_Eonestep #1#2#3#4%
-{%
- \xint_UDonezerofork
- #4#1{\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
- #1#4{\XINT_sub_Finc 1}% additionner 1. Et faire signe -
- 10\XINT_sub_DD % terminer. Mais avec signe -
- \krof
- {#3}%
-}%
-\def\XINT_sub_DD {\expandafter\xint_minus_thenstop\romannumeral0\XINT_sub_D }%
-\def\XINT_sub_Fdec #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_sub_Fdec_finish\W
- \XINT_sub_Fdec_onestep #1{#6#5#4#3}{#2}%
-}%
-\def\XINT_sub_Fdec_onestep #1#2%
-{%
- \expandafter\XINT_sub_backtoFdec\the\numexpr 11#2+#1-\xint_c_i.%
-}%
-\def\XINT_sub_backtoFdec #1#2#3.#4%
-{%
- \XINT_sub_Fdec #2{#3#4}%
-}%
-\def\xint_sub_Fdec_finish\W\XINT_sub_Fdec_onestep #1#2%
-{%
- \expandafter\xint_minus_thenstop\romannumeral0\XINT_cuz
-}%
-\def\XINT_sub_Finc #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_sub_Finc_finish\W
- \XINT_sub_Finc_onestep #1{#6#5#4#3}{#2}%
-}%
-\def\XINT_sub_Finc_onestep #1#2%
-{%
- \expandafter\XINT_sub_backtoFinc\the\numexpr 10#2+#1.%
-}%
-\def\XINT_sub_backtoFinc #1#2#3.#4%
-{%
- \XINT_sub_Finc #2{#3#4}%
-}%
-\def\xint_sub_Finc_finish\W\XINT_sub_Finc_onestep #1#2#3%
-{%
- \xint_UDzerofork
- #1{\expandafter\expandafter\expandafter
- \xint_minus_thenstop\xint_cleanupzeros_nostop}%
- 0{ -1}%
- \krof
- #3%
-}%
-\def\xint_sub_ez\W\XINT_sub_Eenter #1%
-{%
- \xint_UDzerofork
- #1\XINT_sub_K % il y a une retenue
- 0\XINT_sub_L % pas de retenue
- \krof
-}%
-\def\XINT_sub_L #1\W\X\Y\Z {\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z }%
-\def\XINT_sub_K #1%
-{%
- \expandafter
- \XINT_sub_KK\expandafter1\expandafter{\expandafter}%
- \romannumeral0%
- \XINT_rord_main {}#1%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
-}%
-\def\XINT_sub_KK #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_sub_KK_finish\W
- \XINT_sub_KK_onestep #1{#6#5#4#3}{#2}%
-}%
-\def\XINT_sub_KK_onestep #1#2%
-{%
- \expandafter\XINT_sub_backtoKK\the\numexpr 109999-#2+#1.%
-}%
-\def\XINT_sub_backtoKK #1#2#3.#4%
-{%
- \XINT_sub_KK #2{#3#4}%
-}%
-\def\xint_sub_KK_finish\W\XINT_sub_KK_onestep #1#2#3%
-{%
- \expandafter\xint_minus_thenstop
- \romannumeral0\XINT_cuz_loop #3\W\W\W\W\W\W\W\Z
-}%
\def\xintCmp {\romannumeral0\xintcmp }%
\def\xintcmp #1%
{%
@@ -1284,11 +387,19 @@
\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}%
\def\xintLt {\romannumeral0\xintlt }%
\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
+\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}%
+\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}%
+\def\xintNeq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}%
\def\xintIsZero {\romannumeral0\xintiszero }%
\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
\def\xintisnotzero
#1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
+\def\xintiiIsZero {\romannumeral0\xintiiiszero }%
+\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
+\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }%
+\def\xintiiisnotzero
+ #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}%
\let\xintIsTrue\xintIsNotZero
\let\xintNot\xintIsZero
\let\xintIsFalse\xintIsZero
@@ -1412,11 +523,20 @@
{%
\expandafter\xint_max\expandafter {\romannumeral0\xintnum{#1}}%
}%
-\let\xintMax\xintiMax \let\xintmax\xintimax
\def\xint_max #1#2%
{%
\expandafter\XINT_max_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
}%
+\def\xintiiMax {\romannumeral0\xintiimax }%
+\def\xintiimax #1%
+{%
+ \expandafter\xint_iimax\expandafter {\romannumeral-`0#1}%
+}%
+\def\xint_iimax #1#2%
+{%
+ \expandafter\XINT_max_pre\expandafter {\romannumeral-`0#2}{#1}%
+}%
+\let\xintMax\xintiMax \let\xintmax\xintimax % deprecated, should be only with xintfrac
\def\XINT_max_pre #1#2{\XINT_max_fork #1\Z #2\Z {#2}{#1}}%
\def\XINT_Max #1#2{\romannumeral0\XINT_max_fork #2\Z #1\Z {#1}{#2}}%
\def\XINT_max_fork #1#2\Z #3#4\Z
@@ -1471,11 +591,20 @@
{%
\expandafter\xint_min\expandafter {\romannumeral0\xintnum{#1}}%
}%
-\let\xintMin\xintiMin \let\xintmin\xintimin
\def\xint_min #1#2%
{%
\expandafter\XINT_min_pre\expandafter {\romannumeral0\xintnum{#2}}{#1}%
}%
+\def\xintiiMin {\romannumeral0\xintiimin }%
+\def\xintiimin #1%
+{%
+ \expandafter\xint_iimin\expandafter {\romannumeral-`0#1}%
+}%
+\def\xint_iimin #1#2%
+{%
+ \expandafter\XINT_min_pre\expandafter {\romannumeral-`0#2}{#1}%
+}%
+\let\xintMin\xintiMin \let\xintmin\xintimin % deprecated
\def\XINT_min_pre #1#2{\XINT_min_fork #1\Z #2\Z {#2}{#1}}%
\def\XINT_Min #1#2{\romannumeral0\XINT_min_fork #2\Z #1\Z {#1}{#2}}%
\def\XINT_min_fork #1#2\Z #3#4\Z
@@ -1567,401 +696,6 @@
\W\X\Y\Z #3\W\X\Y\Z }{#2}%
}%
\def\XINT_sum_NN #1#2{\XINT_sum_loop {#2}{#1}}%
-\def\xintiiMul {\romannumeral0\xintiimul }%
-\def\xintiimul #1%
-{%
- \expandafter\xint_iimul\expandafter {\romannumeral-`0#1}%
-}%
-\def\xint_iimul #1#2%
-{%
- \expandafter\XINT_mul_fork \romannumeral-`0#2\Z #1\Z
-}%
-\def\xintiMul {\romannumeral0\xintimul }%
-\def\xintimul #1%
-{%
- \expandafter\xint_mul\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_mul #1#2%
-{%
- \expandafter\XINT_mul_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\let\xintMul\xintiMul \let\xintmul\xintimul
-\def\XINT_Mul #1#2{\romannumeral0\XINT_mul_fork #2\Z #1\Z }%
-\def\XINT_mul_fork #1#2\Z #3#4\Z
-{%
- \xint_UDzerofork
- #1\XINT_mul_zero
- #3\XINT_mul_zero
- 0{\xint_UDsignsfork
- #1#3\XINT_mul_minusminus % #1 = #3 = -
- #1-{\XINT_mul_minusplus #3}% % #1 = -
- #3-{\XINT_mul_plusminus #1}% % #3 = -
- --{\XINT_mul_plusplus #1#3}%
- \krof }%
- \krof
- {#2}{#4}%
-}%
-\def\XINT_mul_zero #1#2{ 0}%
-\def\XINT_mul_minusminus #1#2%
-{%
- \expandafter\XINT_mul_choice_a
- \expandafter{\romannumeral0\xintlength {#2}}%
- {\romannumeral0\xintlength {#1}}{#1}{#2}%
-}%
-\def\XINT_mul_minusplus #1#2#3%
-{%
- \expandafter\xint_minus_thenstop\romannumeral0\expandafter
- \XINT_mul_choice_a
- \expandafter{\romannumeral0\xintlength {#1#3}}%
- {\romannumeral0\xintlength {#2}}{#2}{#1#3}%
-}%
-\def\XINT_mul_plusminus #1#2#3%
-{%
- \expandafter\xint_minus_thenstop\romannumeral0\expandafter
- \XINT_mul_choice_a
- \expandafter{\romannumeral0\xintlength {#3}}%
- {\romannumeral0\xintlength {#1#2}}{#1#2}{#3}%
-}%
-\def\XINT_mul_plusplus #1#2#3#4%
-{%
- \expandafter\XINT_mul_choice_a
- \expandafter{\romannumeral0\xintlength {#2#4}}%
- {\romannumeral0\xintlength {#1#3}}{#1#3}{#2#4}%
-}%
-\def\XINT_mul_choice_a #1#2%
-{%
- \expandafter\XINT_mul_choice_b\expandafter{#2}{#1}%
-}%
-\def\XINT_mul_choice_b #1#2%
-{%
- \ifnum #1<\xint_c_v
- \expandafter\XINT_mul_choice_littlebyfirst
- \else
- \ifnum #2<\xint_c_v
- \expandafter\expandafter\expandafter\XINT_mul_choice_littlebysecond
- \else
- \expandafter\expandafter\expandafter\XINT_mul_choice_compare
- \fi
- \fi
- {#1}{#2}%
-}%
-\def\XINT_mul_choice_littlebyfirst #1#2#3#4%
-{%
- \expandafter\XINT_mul_M
- \expandafter{\the\numexpr #3\expandafter}%
- \romannumeral0\XINT_RQ {}#4\R\R\R\R\R\R\R\R\Z \Z\Z\Z\Z
-}%
-\def\XINT_mul_choice_littlebysecond #1#2#3#4%
-{%
- \expandafter\XINT_mul_M
- \expandafter{\the\numexpr #4\expandafter}%
- \romannumeral0\XINT_RQ {}#3\R\R\R\R\R\R\R\R\Z \Z\Z\Z\Z
-}%
-\def\XINT_mul_choice_compare #1#2%
-{%
- \ifnum #1>#2
- \expandafter \XINT_mul_choice_i
- \else
- \expandafter \XINT_mul_choice_ii
- \fi
- {#1}{#2}%
-}%
-\def\XINT_mul_choice_i #1#2%
-{%
- \ifnum #1<\numexpr\ifcase \numexpr (#2-\xint_c_iii)/\xint_c_iv\relax
- \or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
- \expandafter\XINT_mul_choice_same
- \else
- \expandafter\XINT_mul_choice_permute
- \fi
-}%
-\def\XINT_mul_choice_ii #1#2%
-{%
- \ifnum #2<\numexpr\ifcase \numexpr (#1-\xint_c_iii)/\xint_c_iv\relax
- \or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
- \expandafter\XINT_mul_choice_permute
- \else
- \expandafter\XINT_mul_choice_same
- \fi
-}%
-\def\XINT_mul_choice_same #1#2%
-{%
- \expandafter\XINT_mul_enter
- \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
- \Z\Z\Z\Z #2\W\W\W\W
-}%
-\def\XINT_mul_choice_permute #1#2%
-{%
- \expandafter\XINT_mul_enter
- \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
- \Z\Z\Z\Z #1\W\W\W\W
-}%
-\def\XINT_mul_Ar #1#2#3#4#5#6%
-{%
- \xint_gob_til_Z #6\xint_mul_br\Z\XINT_mul_Br #1{#6#5#4#3}{#2}%
-}%
-\def\xint_mul_br\Z\XINT_mul_Br #1#2%
-{%
- \XINT_addr_AC_checkcarry #1%
-}%
-\def\XINT_mul_Br #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \expandafter\XINT_mul_ABEAr
- \the\numexpr #1+10#2+#8#7#6#5.{#3}#4\W\X\Y\Z
-}%
-\def\XINT_mul_ABEAr #1#2#3#4#5#6.#7%
-{%
- \XINT_mul_Ar #2{#7#6#5#4#3}%
-}%
-\def\XINT_mul_Mr #1%
-{%
- \expandafter\XINT_mul_Mr_checkifzeroorone\expandafter{\the\numexpr #1}%
-}%
-\def\XINT_mul_Mr_checkifzeroorone #1%
-{%
- \ifcase #1
- \expandafter\XINT_mul_Mr_zero
- \or
- \expandafter\XINT_mul_Mr_one
- \else
- \expandafter\XINT_mul_Nr
- \fi
- {0000}{}{#1}%
-}%
-\def\XINT_mul_Mr_zero #1\Z\Z\Z\Z { 0000}%
-\def\XINT_mul_Mr_one #1#2#3#4\Z\Z\Z\Z { #4}%
-\def\XINT_mul_Nr #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_Z #4\xint_mul_pr\Z\XINT_mul_Pr {#1}{#3}{#7#6#5#4}{#2}{#3}%
-}%
-\def\XINT_mul_Pr #1#2#3%
-{%
- \expandafter\XINT_mul_Lr\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
-}%
-\def\XINT_mul_Lr 1#1#2#3#4#5#6#7#8#9%
-{%
- \XINT_mul_Nr {#1#2#3#4}{#9#8#7#6#5}%
-}%
-\def\xint_mul_pr\Z\XINT_mul_Pr #1#2#3#4#5%
-{%
- \xint_gob_til_zeros_iv #1\XINT_mul_Mr_end_nocarry 0000%
- \XINT_mul_Mr_end_carry #1{#4}%
-}%
-\def\XINT_mul_Mr_end_nocarry 0000\XINT_mul_Mr_end_carry 0000#1{ #1}%
-\def\XINT_mul_Mr_end_carry #1#2#3#4#5{ #5#4#3#2#1}%
-\def\XINT_mul_M #1%
-{%
- \expandafter\XINT_mul_M_checkifzeroorone\expandafter{\the\numexpr #1}%
-}%
-\def\XINT_mul_M_checkifzeroorone #1%
-{%
- \ifcase #1
- \expandafter\XINT_mul_M_zero
- \or
- \expandafter\XINT_mul_M_one
- \else
- \expandafter\XINT_mul_N
- \fi
- {0000}{}{#1}%
-}%
-\def\XINT_mul_M_zero #1\Z\Z\Z\Z { 0}%
-\def\XINT_mul_M_one #1#2#3#4\Z\Z\Z\Z
-{%
- \expandafter\xint_cleanupzeros_andstop\romannumeral0\xintreverseorder{#4}%
-}%
-\def\XINT_mul_N #1#2#3#4#5#6#7%
-{%
- \xint_gob_til_Z #4\xint_mul_p\Z\XINT_mul_P {#1}{#3}{#7#6#5#4}{#2}{#3}%
-}%
-\def\XINT_mul_P #1#2#3%
-{%
- \expandafter\XINT_mul_L\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
-}%
-\def\XINT_mul_L 1#1#2#3#4#5#6#7#8#9%
-{%
- \XINT_mul_N {#1#2#3#4}{#5#6#7#8#9}%
-}%
-\def\xint_mul_p\Z\XINT_mul_P #1#2#3#4#5%
-{%
- \XINT_mul_M_end #1#4%
-}%
-\edef\XINT_mul_M_end #1#2#3#4#5#6#7#8%
-{%
- \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
-}%
-\def\XINT_mul_enter #1\Z\Z\Z\Z #2#3#4#5%
-{%
- \xint_gob_til_W #5\XINT_mul_exit_a\W
- \XINT_mul_start {#2#3#4#5}#1\Z\Z\Z\Z
-}%
-\def\XINT_mul_exit_a\W\XINT_mul_start #1%
-{%
- \XINT_mul_exit_b #1%
-}%
-\def\XINT_mul_exit_b #1#2#3#4%
-{%
- \xint_gob_til_W
- #2\XINT_mul_exit_ci
- #3\XINT_mul_exit_cii
- \W\XINT_mul_exit_ciii #1#2#3#4%
-}%
-\def\XINT_mul_exit_ciii #1\W #2\Z\Z\Z\Z \W\W\W
-{%
- \XINT_mul_M {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mul_exit_cii\W\XINT_mul_exit_ciii #1\W\W #2\Z\Z\Z\Z \W\W
-{%
- \XINT_mul_M {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mul_exit_ci\W\XINT_mul_exit_cii
- \W\XINT_mul_exit_ciii #1\W\W\W #2\Z\Z\Z\Z \W
-{%
- \XINT_mul_M {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mul_start #1#2\Z\Z\Z\Z
-{%
- \expandafter\XINT_mul_main\expandafter
- {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
-}%
-\def\XINT_mul_main #1#2\Z\Z\Z\Z #3#4#5#6%
-{%
- \xint_gob_til_W #6\XINT_mul_finish_a\W
- \XINT_mul_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mul_compute #1#2#3\Z\Z\Z\Z
-{%
- \expandafter\XINT_mul_main\expandafter
- {\romannumeral0\expandafter
- \XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
- \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
-}%
-\def\XINT_mul_finish_a\W\XINT_mul_compute #1%
-{%
- \XINT_mul_finish_b #1%
-}%
-\def\XINT_mul_finish_b #1#2#3#4%
-{%
- \xint_gob_til_W
- #1\XINT_mul_finish_c
- #2\XINT_mul_finish_ci
- #3\XINT_mul_finish_cii
- \W\XINT_mul_finish_ciii #1#2#3#4%
-}%
-\def\XINT_mul_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
-{%
- \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
-}%
-\def\XINT_mul_finish_cii
- \W\XINT_mul_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
-{%
- \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
-}%
-\def\XINT_mul_finish_ci #1\XINT_mul_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
-{%
- \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
-}%
-\def\XINT_mul_finish_c #1\XINT_mul_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z
-{%
- \expandafter\xint_cleanupzeros_andstop\romannumeral0\xintreverseorder{#2}%
-}%
-\def\XINT_mulr_enter #1\Z\Z\Z\Z #2#3#4#5%
-{%
- \xint_gob_til_W #5\XINT_mulr_exit_a\W
- \XINT_mulr_start {#2#3#4#5}#1\Z\Z\Z\Z
-}%
-\def\XINT_mulr_exit_a\W\XINT_mulr_start #1%
-{%
- \XINT_mulr_exit_b #1%
-}%
-\def\XINT_mulr_exit_b #1#2#3#4%
-{%
- \xint_gob_til_W
- #2\XINT_mulr_exit_ci
- #3\XINT_mulr_exit_cii
- \W\XINT_mulr_exit_ciii #1#2#3#4%
-}%
-\def\XINT_mulr_exit_ciii #1\W #2\Z\Z\Z\Z \W\W\W
-{%
- \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mulr_exit_cii\W\XINT_mulr_exit_ciii #1\W\W #2\Z\Z\Z\Z \W\W
-{%
- \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mulr_exit_ci\W\XINT_mulr_exit_cii
- \W\XINT_mulr_exit_ciii #1\W\W\W #2\Z\Z\Z\Z \W
-{%
- \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mulr_start #1#2\Z\Z\Z\Z
-{%
- \expandafter\XINT_mulr_main\expandafter
- {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
-}%
-\def\XINT_mulr_main #1#2\Z\Z\Z\Z #3#4#5#6%
-{%
- \xint_gob_til_W #6\XINT_mulr_finish_a\W
- \XINT_mulr_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
-}%
-\def\XINT_mulr_compute #1#2#3\Z\Z\Z\Z
-{%
- \expandafter\XINT_mulr_main\expandafter
- {\romannumeral0\expandafter
- \XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
- \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
-}%
-\def\XINT_mulr_finish_a\W\XINT_mulr_compute #1%
-{%
- \XINT_mulr_finish_b #1%
-}%
-\def\XINT_mulr_finish_b #1#2#3#4%
-{%
- \xint_gob_til_W
- #1\XINT_mulr_finish_c
- #2\XINT_mulr_finish_ci
- #3\XINT_mulr_finish_cii
- \W\XINT_mulr_finish_ciii #1#2#3#4%
-}%
-\def\XINT_mulr_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
-{%
- \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
-}%
-\def\XINT_mulr_finish_cii
- \W\XINT_mulr_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
-{%
- \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
-}%
-\def\XINT_mulr_finish_ci #1\XINT_mulr_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
-{%
- \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
- \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
-}%
-\def\XINT_mulr_finish_c #1\XINT_mulr_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z { #2}%
-\def\xintiiSqr {\romannumeral0\xintiisqr }%
-\def\xintiisqr #1%
-{%
- \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiiabs{#1}}%
-}%
-\def\xintiSqr {\romannumeral0\xintisqr }%
-\def\xintisqr #1%
-{%
- \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiabs{#1}}%
-}%
-\let\xintSqr\xintiSqr \let\xintsqr\xintisqr
-\def\XINT_sqr #1%
-{%
- \expandafter\XINT_mul_enter
- \romannumeral0%
- \XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
- \Z\Z\Z\Z #1\W\W\W\W
-}%
\def\xintiiPrd {\romannumeral0\xintiiprd }%
\def\xintiiprd #1{\xintiiprdexpr #1\relax }%
\let\xintPrd\xintiiPrd
@@ -2061,635 +795,6 @@
{%
\XINT_mul_M
}%
-\def\xintiiPow {\romannumeral0\xintiipow }%
-\def\xintiipow #1%
-{%
- \expandafter\xint_pow\romannumeral-`0#1\Z%
-}%
-\def\xintiPow {\romannumeral0\xintipow }%
-\def\xintipow #1%
-{%
- \expandafter\xint_pow\romannumeral0\xintnum{#1}\Z%
-}%
-\let\xintPow\xintiPow \let\xintpow\xintipow
-\def\xint_pow #1#2\Z
-{%
- \xint_UDsignfork
- #1\XINT_pow_Aneg
- -\XINT_pow_Anonneg
- \krof
- #1{#2}%
-}%
-\def\XINT_pow_Aneg #1#2#3%
-{%
- \expandafter\XINT_pow_Aneg_\expandafter{\the\numexpr #3}{#2}%
-}%
-\def\XINT_pow_Aneg_ #1%
-{%
- \ifodd #1
- \expandafter\XINT_pow_Aneg_Bodd
- \fi
- \XINT_pow_Anonneg_ {#1}%
-}%
-\def\XINT_pow_Aneg_Bodd #1%
-{%
- \expandafter\XINT_opp\romannumeral0\XINT_pow_Anonneg_
-}%
-\def\XINT_pow_Anonneg #1#2#3%
-{%
- \expandafter\XINT_pow_Anonneg_\expandafter {\the\numexpr #3}{#1#2}%
-}%
-\def\XINT_pow_Anonneg_ #1#2%
-{%
- \ifcase\XINT_Cmp {#2}{1}
- \expandafter\XINT_pow_AisOne
- \or
- \expandafter\XINT_pow_AatleastTwo
- \else
- \expandafter\XINT_pow_AisZero
- \fi
- {#1}{#2}%
-}%
-\def\XINT_pow_AisOne #1#2{ 1}%
-\def\XINT_pow_AisZero #1#2%
-{%
- \ifcase\XINT_cntSgn #1\Z
- \xint_afterfi { 1}%
- \or
- \xint_afterfi { 0}%
- \else
- \xint_afterfi {\xintError:DivisionByZero\space 0}%
- \fi
-}%
-\def\XINT_pow_AatleastTwo #1%
-{%
- \ifcase\XINT_cntSgn #1\Z
- \expandafter\XINT_pow_BisZero
- \or
- \expandafter\XINT_pow_checkBsize
- \else
- \expandafter\XINT_pow_BisNegative
- \fi
- {#1}%
-}%
-\edef\XINT_pow_BisNegative #1#2%
- {\noexpand\xintError:FractionRoundedToZero\space 0}%
-\def\XINT_pow_BisZero #1#2{ 1}%
-\def\XINT_pow_checkBsize #1%
-{%
- \ifnum #1>100000
- \expandafter\XINT_pow_BtooBig
- \else
- \expandafter\XINT_pow_loopI
- \fi
- {#1}%
-}%
-\edef\XINT_pow_BtooBig #1#2{\noexpand\xintError:ExponentTooBig\space 0}%
-\def\XINT_pow_loopI #1%
-{%
- \ifnum #1=\xint_c_i\XINT_pow_Iend\fi
- \ifodd #1
- \expandafter\XINT_pow_loopI_odd
- \else
- \expandafter\XINT_pow_loopI_even
- \fi
- {#1}%
-}%
-\edef\XINT_pow_Iend\fi #1\fi #2#3{\noexpand\fi\space #3}%
-\def\XINT_pow_loopI_even #1#2%
-{%
- \expandafter\XINT_pow_loopI\expandafter
- {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
- {\romannumeral0\xintiisqr {#2}}%
-}%
-\def\XINT_pow_loopI_odd #1#2%
-{%
- \expandafter\XINT_pow_loopI_odda\expandafter
- {\romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z }{#1}{#2}%
-}%
-\def\XINT_pow_loopI_odda #1#2#3%
-{%
- \expandafter\XINT_pow_loopII\expandafter
- {\the\numexpr #2/\xint_c_ii-\xint_c_i\expandafter}\expandafter
- {\romannumeral0\xintiisqr {#3}}{#1}%
-}%
-\def\XINT_pow_loopII #1%
-{%
- \ifnum #1 = \xint_c_i\XINT_pow_IIend\fi
- \ifodd #1
- \expandafter\XINT_pow_loopII_odd
- \else
- \expandafter\XINT_pow_loopII_even
- \fi
- {#1}%
-}%
-\def\XINT_pow_loopII_even #1#2%
-{%
- \expandafter\XINT_pow_loopII\expandafter
- {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
- {\romannumeral0\xintiisqr {#2}}%
-}%
-\def\XINT_pow_loopII_odd #1#2#3%
-{%
- \expandafter\XINT_pow_loopII_odda\expandafter
- {\romannumeral0\XINT_mulr_enter #3\Z\Z\Z\Z #2\W\W\W\W}{#1}{#2}%
-}%
-\def\XINT_pow_loopII_odda #1#2#3%
-{%
- \expandafter\XINT_pow_loopII\expandafter
- {\the\numexpr #2/\xint_c_ii-\xint_c_i\expandafter}\expandafter
- {\romannumeral0\xintiisqr {#3}}{#1}%
-}%
-\def\XINT_pow_IIend\fi #1\fi #2#3#4%
-{%
- \fi\XINT_mul_enter #4\Z\Z\Z\Z #3\W\W\W\W
-}%
-\def\xintiiQuo {\romannumeral0\xintiiquo }%
-\def\xintiiRem {\romannumeral0\xintiirem }%
-\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop
- \romannumeral0\xintiidivision }%
-\def\xintiirem {\expandafter\xint_secondoftwo_thenstop
- \romannumeral0\xintiidivision }%
-\def\xintQuo {\romannumeral0\xintquo }%
-\def\xintRem {\romannumeral0\xintrem }%
-\def\xintquo {\expandafter\xint_firstoftwo_thenstop
- \romannumeral0\xintdivision }%
-\def\xintrem {\expandafter\xint_secondoftwo_thenstop
- \romannumeral0\xintdivision }%
-\def\xintiiDivision {\romannumeral0\xintiidivision }%
-\def\xintiidivision #1%
-{%
- \expandafter\xint_iidivision\expandafter {\romannumeral-`0#1}%
-}%
-\def\xint_iidivision #1#2%
-{%
- \expandafter\XINT_div_fork \romannumeral-`0#2\Z #1\Z
-}%
-\def\xintDivision {\romannumeral0\xintdivision }%
-\def\xintdivision #1%
-{%
- \expandafter\xint_division\expandafter {\romannumeral0\xintnum{#1}}%
-}%
-\def\xint_division #1#2%
-{%
- \expandafter\XINT_div_fork \romannumeral0\xintnum{#2}\Z #1\Z
-}%
-\def\XINT_div_fork #1#2\Z #3#4\Z
-{%
- \xint_UDzerofork
- #1\XINT_div_BisZero
- #3\XINT_div_AisZero
- 0{\xint_UDsignfork
- #1\XINT_div_BisNegative % B < 0
- #3\XINT_div_AisNegative % A < 0, B > 0
- -\XINT_div_plusplus % B > 0, A > 0
- \krof }%
- \krof
- {#2}{#4}#1#3% #1#2=B, #3#4=A
-}%
-\edef\XINT_div_BisZero #1#2#3#4{\noexpand\xintError:DivisionByZero\space {0}{0}}%
-\def\XINT_div_AisZero #1#2#3#4{ {0}{0}}%
-\def\XINT_div_plusplus #1#2#3#4{\XINT_div_prepare {#3#1}{#4#2}}%
-\def\XINT_div_BisNegative #1#2#3#4%
-{%
- \expandafter\XINT_div_BisNegative_b
- \romannumeral0\XINT_div_fork #1\Z #4#2\Z
-}%
-\edef\XINT_div_BisNegative_b #1%
-{%
- \noexpand\expandafter\space\noexpand\expandafter
- {\noexpand\romannumeral0\noexpand\XINT_opp #1}%
-}%
-\def\XINT_div_AisNegative #1#2#3#4%
-{%
- \expandafter\XINT_div_AisNegative_b
- \romannumeral0\XINT_div_prepare {#3#1}{#2}{#3#1}%
-}%
-\def\XINT_div_AisNegative_b #1#2%
-{%
- \if0\XINT_Sgn #2\Z
- \expandafter \XINT_div_AisNegative_Rzero
- \else
- \expandafter \XINT_div_AisNegative_Rpositive
- \fi
- {#1}{#2}%
-}%
-\edef\XINT_div_AisNegative_Rzero #1#2#3%
-{%
- \noexpand\expandafter\space\noexpand\expandafter
- {\noexpand\romannumeral0\noexpand\XINT_opp #1}{0}%
-}%
-\def\XINT_div_AisNegative_Rpositive #1%
-{%
- \expandafter \XINT_div_AisNegative_Rpositive_b \expandafter
- {\romannumeral0\xintiiopp{\xintInc {#1}}}%
-}%
-\def\XINT_div_AisNegative_Rpositive_b #1#2#3%
-{%
- \expandafter \xint_exchangetwo_keepbraces_thenstop \expandafter
- {\romannumeral0\XINT_sub {#3}{#2}}{#1}%
-}%
-\def\XINT_div_prepare #1%
-{%
- \expandafter \XINT_div_prepareB_aa \expandafter
- {\romannumeral0\xintlength {#1}}{#1}% B > 0 ici
-}%
-\def\XINT_div_prepareB_aa #1%
-{%
- \ifnum #1=\xint_c_i
- \expandafter\XINT_div_prepareB_onedigit
- \else
- \expandafter\XINT_div_prepareB_a
- \fi
- {#1}%
-}%
-\def\XINT_div_prepareB_a #1%
-{%
- \expandafter\XINT_div_prepareB_c\expandafter
- {\the\numexpr \xint_c_iv*((#1+\xint_c_i)/\xint_c_iv)}{#1}%
-}%
-\def\XINT_div_prepareB_onedigit #1#2%
-{%
- \ifcase#2
- \or\expandafter\XINT_div_BisOne
- \or\expandafter\XINT_div_BisTwo
- \else\expandafter\XINT_div_prepareB_e
- \fi {000}{0}{4}{#2}%
-}%
-\def\XINT_div_BisOne #1#2#3#4#5{ {#5}{0}}%
-\def\XINT_div_BisTwo #1#2#3#4#5%
-{%
- \expandafter\expandafter\expandafter\XINT_div_BisTwo_a
- \ifodd\xintiiLDg{#5} \expandafter1\else \expandafter0\fi {#5}%
-}%
-\edef\XINT_div_BisTwo_a #1#2%
-{%
- \noexpand\expandafter\space\noexpand\expandafter
- {\noexpand\romannumeral0\noexpand\xinthalf {#2}}{#1}%
-}%
-\def\XINT_div_prepareB_c #1#2%
-{%
- \csname XINT_div_prepareB_d\romannumeral\numexpr#1-#2\endcsname
- {#1}%
-}%
-\def\XINT_div_prepareB_d {\XINT_div_prepareB_e {}{0000}}%
-\def\XINT_div_prepareB_di {\XINT_div_prepareB_e {0}{000}}%
-\def\XINT_div_prepareB_dii {\XINT_div_prepareB_e {00}{00}}%
-\def\XINT_div_prepareB_diii {\XINT_div_prepareB_e {000}{0}}%
-\def\XINT_div_cleanR #10000.{{#1}}%
-\def\XINT_div_prepareB_e #1#2#3#4%
-{%
- \ifnum#3=\xint_c_iv\expandafter\XINT_div_prepareLittleB_f
- \else\expandafter\XINT_div_prepareB_f
- \fi
- #4#1{#3}{#2}{#1}%
-}%
-\def\XINT_div_prepareB_f #1#2#3#4#5#{%
- \expandafter\XINT_div_prepareB_g
- \the\numexpr #1#2#3#4+\xint_c_i\expandafter
- .\the\numexpr (#1#2#3#4+\xint_c_i)/\xint_c_ii\expandafter
- .\romannumeral0\xintreverseorder {#1#2#3#4#5}.{#1#2#3#4}%
-}%
-\def\XINT_div_prepareLittleB_f #1#{%
- \expandafter\XINT_div_prepareB_g \the\numexpr #1/\xint_c_ii.{}.{}.{#1}%
-}%
-\def\XINT_div_prepareB_g #1.#2.#3.#4#5#6#7#8%
-{%
- \XINT_div_prepareA_a {#8#7}{#5}{{#1}{#2}{#4}}{#3}{#6}%
-}%
-\def\XINT_div_prepareA_a #1%
-{%
- \expandafter\XINT_div_prepareA_b\expandafter
- {\romannumeral0\xintlength {#1}}{#1}%
-}%
-\def\XINT_div_prepareA_b #1%
-{%
- \expandafter\XINT_div_prepareA_c\expandafter
- {\the\numexpr \xint_c_iv*((#1+\xint_c_i)/\xint_c_iv)}{#1}%
-}%
-\def\XINT_div_prepareA_c #1#2%
-{%
- \csname XINT_div_prepareA_d\romannumeral\numexpr #1-#2\endcsname
- {#1}%
-}%
-\def\XINT_div_prepareA_d {\XINT_div_prepareA_e {}}%
-\def\XINT_div_prepareA_di {\XINT_div_prepareA_e {0}}%
-\def\XINT_div_prepareA_dii {\XINT_div_prepareA_e {00}}%
-\def\XINT_div_prepareA_diii {\XINT_div_prepareA_e {000}}%
-\def\XINT_div_prepareA_e #1#2#3#4#5%
-{%
- \XINT_div_start_a {#2}{#4}{#1#3}#5%
-}%
-\def\XINT_div_start_a #1#2%
-{%
- \ifnum #2=\xint_c_iv \expandafter\XINT_div_little_b
- \else
- \ifnum #1 < #2
- \expandafter\expandafter\expandafter\XINT_div_III_aa
- \else
- \expandafter\expandafter\expandafter\XINT_div_start_b
- \fi
- \fi
- {#1}{#2}%
-}%
-\def\XINT_div_III_aa #1#2#3#4#5#6#7%
-{%
- \expandafter\expandafter\expandafter
- \XINT_div_III_b\xint_cleanupzeros_nostop #3.{0000}%
-}%
-\def\XINT_div_III_b #1%
-{%
- \if0#1%
- \expandafter\XINT_div_III_bRzero
- \else
- \expandafter\XINT_div_III_bRpos
- \fi
- #1%
-}%
-\def\XINT_div_III_bRzero 0.#1#2%
-{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z}{0}%
-}%
-\def\XINT_div_III_bRpos #1.#2#3%
-{%
- \expandafter\XINT_div_III_c \XINT_div_cleanR #1#3.{#2}%
-}%
-\def\XINT_div_III_c #1#2%
-{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT_cuz_loop #2\W\W\W\W\W\W\W\Z}{#1}%
-}%
-\def\XINT_div_start_b #1#2#3#4#5#6%
-{%
- \XINT_div_start_c {#2}.#3.{#6}{{#1}{#2}{{#4}{#5}}{#6}}%
-}%
-\def\XINT_div_start_c #1#2.#3#4#5#6%
-{%
- \ifnum #1=\xint_c_iv\XINT_div_start_ca\fi
- \expandafter\XINT_div_start_c\expandafter
- {\the\numexpr #1-\xint_c_iv}#2#3#4#5#6.%
-}%
-\def\XINT_div_start_ca\fi\expandafter\XINT_div_start_c\expandafter
- #1#2#3#4#5{\fi\XINT_div_start_d {#2#3#4#5}#2#3#4#5}%
-\def\XINT_div_start_d #1#2.#3.#4#5#6%
-{%
- \XINT_div_I_a {#1}{#4}{#2}{#6}{0000}#5{#3}{#6}{}%
-}%
-\def\XINT_div_I_a #1#2%
-{%
- \expandafter\XINT_div_I_b\the\numexpr #1/#2.{#1}{#2}%
-}%
-\def\XINT_div_I_b #1%
-{%
- \xint_gob_til_zero #1\XINT_div_I_czero 0\XINT_div_I_c #1%
-}%
-\def\XINT_div_I_czero 0%
- \XINT_div_I_c 0.#1#2#3#4#5{\XINT_div_I_g {#5}{#3}}%
-\def\XINT_div_I_c #1.#2#3%
-{%
- \expandafter\XINT_div_I_da\the\numexpr #2-#1*#3.#1.%
-}%
-\def\XINT_div_I_da #1.%
-{%
- \ifnum #1>\xint_c_ix
- \expandafter\XINT_div_I_dP
- \else
- \ifnum #1<\xint_c_
- \expandafter\expandafter\expandafter\XINT_div_I_dN
- \else
- \expandafter\expandafter\expandafter\XINT_div_I_db
- \fi
- \fi
-}%
-\def\XINT_div_I_dN #1.%
-{%
- \expandafter\XINT_div_I_dP\the\numexpr #1-\xint_c_i.%
-}%
-\def\XINT_div_I_db #1.#2#3% #1=q=un chiffre, #2=alpha, #3=B
-{%
- \expandafter\XINT_div_I_dc\expandafter
- {\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
- {\romannumeral0\xintreverseorder{#2}}%
- {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}%
- #1{#2}{#3}%
-}%
-\def\XINT_div_I_dc #1#2%
-{%
- \if-#1% s'arranger pour que si n^^e9gatif on ait renvoy^^e9 alpha=-.
- \expandafter\xint_firstoftwo
- \else\expandafter\xint_secondoftwo\fi
- {\expandafter\XINT_div_I_dP\the\numexpr #2-\xint_c_i.}%
- {\XINT_div_I_e {#1}#2}%
-}%
-\def\XINT_div_I_e #1#2#3#4#5%
-{%
- \expandafter\XINT_div_I_f \the\numexpr \xint_c_x^iv+#2+#5{#1}%
-}%
-\def\XINT_div_I_dP #1.#2#3#4%
-{%
- \expandafter \XINT_div_I_f \the\numexpr \xint_c_x^iv+#1+#4\expandafter
- {\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
- {\romannumeral0\xintreverseorder{#2}}%
- {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}%
-}%
-\def\XINT_div_I_f 1#1#2#3#4{\XINT_div_I_g {#1#2#3#4}}%
-\def\XINT_div_I_g #1#2#3#4#5#6#7#8#9%
-{%
- \ifnum#3=#4
- \expandafter\XINT_div_III_ab
- \else
- \expandafter\XINT_div_I_h
- \fi
- {#5}#2.#7.{{#5}{#6}{#4}{#3}}{#8}{#9#1}%
-}%
-\def\XINT_div_III_ab #1#2.#3.#4#5%
-{%
- \expandafter\XINT_div_III_b
- \romannumeral0\XINT_cuz_loop #2#3\W\W\W\W\W\W\W\Z.%
-}%
-\def\XINT_div_I_h #1.#2#3#4#5#6.#7#8%
-{%
- \XINT_div_II_b #1#2#3#4#5.{#8}{#7}{#6}{#8}%
-}%
-\def\XINT_div_II_b #1#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_zeros_iv #2#3#4#5\XINT_div_II_skipc 0000%
- \XINT_div_II_c #1{#2#3#4#5}{#6#7#8#9}%
-}%
-\def\XINT_div_II_skipc 0000\XINT_div_II_c #1#2#3#4#5.#6#7%
-{%
- \XINT_div_II_k #7{#4#5}{#6}{0000}%
-}%
-\def\XINT_div_II_c #1#2#3#4%
-{%
- \expandafter\XINT_div_II_d\the\numexpr (#3#4+#2)/#1+\xint_c_ixixixix\relax
- {#1}{#2}#3#4%
-}%
-\def\XINT_div_II_d 1#1#2#3#4#5#6#7.#8%
-{%
- \expandafter\XINT_div_II_e
- \romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
- {\romannumeral0\xintreverseorder{#7}}%
- {\romannumeral0\XINT_mul_Mr {#1#2#3#4}#8\Z\Z\Z\Z }.%
- {#5}{#6}{#8}{#1#2#3#4}%
-}%
-\def\XINT_div_II_e #1#2#3#4%
-{%
- \xint_gob_til_zeros_iv #1#2#3#4\XINT_div_II_skipf 0000%
- \XINT_div_II_f #1#2#3#4%
-}%
-\def\XINT_div_II_skipf 0000\XINT_div_II_f 0000#1.#2#3#4#5#6%
-{%
- \XINT_div_II_k #6{#1}{#4}{#5}%
-}%
-\def\XINT_div_II_f #1#2#3#4#5#6#7#8#9.%
-{%
- \XINT_div_II_fa {#1#2#3#4#5#6#7#8}{#1#2#3#4#5#6#7#8#9}%
-}%
-\def\XINT_div_II_fa #1#2#3#4%
-{%
- \expandafter\XINT_div_II_g\expandafter
- {\the\numexpr (#1+#4)/#3-\xint_c_i}{#2}%
-}%
-\def\XINT_div_II_g #1#2#3#4%
-{%
- \expandafter \XINT_div_II_h
- \the\numexpr #4+#1+\xint_c_x^iv\expandafter\expandafter\expandafter
- {\expandafter\xint_gobble_iv
- \romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
- {\romannumeral0\xintreverseorder{#2}}%
- {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}{#3}%
-}%
-\def\XINT_div_II_h 1#1#2#3#4#5#6#7%
-{%
- \XINT_div_II_k #7{#5}{#6}{#1#2#3#4}%
-}%
-\def\XINT_div_II_k #1#2#3#4#5%
-{%
- \expandafter\XINT_div_II_l \the\numexpr #4-\xint_c_iv.{#3}#1{#2}#5.%
-}%
-\def\XINT_div_II_l #1.#2#3#4#5#6#7#8#9%
-{%
- \XINT_div_II_m {{#1}{#2}{{#3}{#4}}{#5}}{#5}{#6#7#8#9}#6#7#8#9%
-}%
-\def\XINT_div_II_m #1#2#3#4.#5#6%
-{%
- \XINT_div_I_a {#3}{#2}{#4}{#5}{#6}#1%
-}%
-\def\XINT_div_little_b #1#2#3#4#5#6#7%
-{%
- \XINT_div_little_c #3.{{#4}{#6}}{#1}%
-}%
-\def\XINT_div_little_c #1#2#3#4#5.#6#7%
-{%
- \XINT_div_littleI_a {#1#2#3#4}#6{#7}{#5}%
-}%
-\def\XINT_div_littleI_a #1#2#3%
-{%
- \expandafter\XINT_div_littleI_b
- \the\numexpr (#1+#2)/#3-\xint_c_i{#1}{#2}{#3}%
-}%
-\def\XINT_div_littleI_b #1%
-{%
- \xint_gob_til_zero #1\XINT_div_littleI_skip 0\XINT_div_littleI_c #1%
-}%
-\def\XINT_div_littleI_skip 0\XINT_div_littleI_c 0#1#2#3#4#5%
- {\XINT_div_littleII_a {#4}{#1}#5.{{#2}{#3}}{0000}}%
-\def\XINT_div_littleI_c #1#2#3#4%
-{%
- \expandafter\expandafter\expandafter\XINT_div_littleI_e
- \expandafter\expandafter\expandafter
- {\expandafter\xint_gobble_i\the\numexpr \xint_c_x^iv+#2-#1*#4}#1{{#3}{#4}}%
-}%
-\def\XINT_div_littleI_e #1#2#3#4#5%
- {\XINT_div_littleII_a {#4}{#1}#5.{#3}{000#2}}%
-\def\XINT_div_littleII_a #1%
-{%
- \ifnum#1=\xint_c_iv
- \expandafter\XINT_div_littleIII_ab
- \else
- \expandafter\XINT_div_littleII_b
- \fi {#1}%
-}%
-\def\XINT_div_littleIII_ab #1#2#3.#4%
-{%
- \expandafter\XINT_div_III_b\the\numexpr #2#3.%
-}%
-\def\XINT_div_littleII_b #1%
-{%
- \expandafter\XINT_div_littleII_c\expandafter {\the\numexpr #1-\xint_c_iv}%
-}%
-\def\XINT_div_littleII_c #1#2#3#4#5#6#7.#8%
-{%
- \XINT_div_littleII_d {#2#3#4#5#6}#8{#1}{#7}%
-}%
-\def\XINT_div_littleII_d #1#2#3%
-{%
- \expandafter\XINT_div_littleII_e\the\numexpr (#1+#2)/#3+\xint_c_ixixixix.%
- {#1}{#2}{#3}%
-}%
-\def\XINT_div_littleII_e 1#1.#2#3#4%
-{%
- \expandafter\expandafter\expandafter\XINT_div_littleII_f
- \expandafter\xint_gobble_i\the\numexpr \xint_c_x^iv+#2-#1*#4.%
- {#1}{{#3}{#4}}%
-}%
-\def\XINT_div_littleII_f #1.#2#3#4#5#6%
-{%
- \XINT_div_littleII_a {#4}{#1}#5.{#3}{#6#2}%
-}%
-\def\XINT_div_sub_xpxp #1#2% #1=alpha d^^e9j^^e0 renvers^^e9, #2 se d^^e9veloppe en qB
-{%
- \expandafter\XINT_div_sub_xpxp_b #2\W\X\Y\Z #1\W\X\Y\Z
-}%
-\def\XINT_div_sub_xpxp_b
-{%
- \XINT_div_sub_A 1{}%
-}%
-\def\XINT_div_sub_A #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_div_sub_az\W
- \XINT_div_sub_B #1{#3#4#5#6}{#2}%
-}%
-\def\XINT_div_sub_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
-{%
- \xint_gob_til_W #5\xint_div_sub_bz\W
- \XINT_div_sub_onestep #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
-}%
-\def\XINT_div_sub_onestep #1#2#3#4#5#6%
-{%
- \expandafter\XINT_div_sub_backtoA
- \the\numexpr 11#6-#5#4#3#2+#1-\xint_c_i.%
-}%
-\def\XINT_div_sub_backtoA #1#2#3.#4%
-{%
- \XINT_div_sub_A #2{#3#4}%
-}%
-\def\xint_div_sub_bz\W\XINT_div_sub_onestep #1\Z { -}%
-\def\xint_div_sub_az\W\XINT_div_sub_B #1#2{\XINT_div_sub_C #1}%
-\def\XINT_div_sub_C #1#2#3#4#5#6%
-{%
- \xint_gob_til_W #3\xint_div_sub_cz\W
- \XINT_div_sub_C_onestep #1{#6#5#4#3}{#2}%
-}%
-\def\XINT_div_sub_C_onestep #1#2%
-{%
- \expandafter\XINT_div_sub_backtoC \the\numexpr 11#2+#1-\xint_c_i.%
-}%
-\def\XINT_div_sub_backtoC #1#2#3.#4%
-{%
- \XINT_div_sub_C #2{#3#4}%
-}%
-\def\xint_div_sub_cz\W\XINT_div_sub_C_onestep #1#2%
-{%
- \if#10% retenue
- \expandafter\xint_div_sub_neg
- \else\expandafter\xint_div_sub_ok
- \fi
-}%
-\def\xint_div_sub_neg #1{ -}%
-\def\xint_div_sub_ok #1{ #1}%
\def\xintiiFDg {\romannumeral0\xintiifdg }%
\def\xintiifdg #1%
{%
@@ -2770,6 +875,15 @@
\xint_afterfi{ 0}%
\fi
}%
+\def\xintiiEven {\romannumeral0\xintiieven }%
+\def\xintiieven #1%
+{%
+ \ifodd\xintiiLDg{#1}
+ \xint_afterfi{ 0}%
+ \else
+ \xint_afterfi{ 1}%
+ \fi
+}%
\def\xintOdd {\romannumeral0\xintodd }%
\def\xintodd #1%
{%
@@ -2779,6 +893,15 @@
\xint_afterfi{ 0}%
\fi
}%
+\def\xintEven {\romannumeral0\xinteven }%
+\def\xinteven #1%
+{%
+ \ifodd\xintLDg{#1}
+ \xint_afterfi{ 0}%
+ \else
+ \xint_afterfi{ 1}%
+ \fi
+}%
\def\xintDSL {\romannumeral0\xintdsl }%
\def\xintdsl #1%
{%
@@ -3208,92 +1331,17 @@
{%
\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7\relax
}%
-\def\xintDec {\romannumeral0\xintdec }%
-\def\xintdec #1%
-{%
- \expandafter\XINT_dec\romannumeral-`0#1%
- \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
-}%
-\def\XINT_dec #1%
-{%
- \xint_UDzerominusfork
- #1-\XINT_dec_zero
- 0#1\XINT_dec_neg
- 0-{\XINT_dec_pos #1}%
- \krof
-}%
-\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
-\def\XINT_dec_neg
- {\expandafter\xint_minus_thenstop\romannumeral0\XINT_inc_pos }%
-\def\XINT_dec_pos
-{%
- \expandafter\XINT_dec_a \expandafter{\expandafter}%
- \romannumeral0\XINT_OQ {}%
-}%
-\def\XINT_dec_a #1#2#3#4#5#6#7#8#9%
-{%
- \expandafter\XINT_dec_b
- \the\numexpr 11#9#8#7#6#5#4#3#2-\xint_c_i\relax {#1}%
-}%
-\def\XINT_dec_b 1#1%
-{%
- \xint_gob_til_one #1\XINT_dec_A 1\XINT_dec_c
-}%
-\def\XINT_dec_c #1#2#3#4#5#6#7#8#9{\XINT_dec_a {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_dec_A 1\XINT_dec_c #1#2#3#4#5#6#7#8#9%
- {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_dec_B #1#2\W\W\W\W\W\W\W\W
-{%
- \expandafter\XINT_dec_cleanup
- \romannumeral0\XINT_rord_main {}#2%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
- #1%
-}%
-\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
- {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
-\def\xintInc {\romannumeral0\xintinc }%
-\def\xintinc #1%
-{%
- \expandafter\XINT_inc\romannumeral-`0#1%
- \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
-}%
-\def\XINT_inc #1%
-{%
- \xint_UDzerominusfork
- #1-\XINT_inc_zero
- 0#1\XINT_inc_neg
- 0-{\XINT_inc_pos #1}%
- \krof
-}%
-\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
-\def\XINT_inc_neg {\expandafter\XINT_opp\romannumeral0\XINT_dec_pos }%
-\def\XINT_inc_pos
-{%
- \expandafter\XINT_inc_a \expandafter{\expandafter}%
- \romannumeral0\XINT_OQ {}%
-}%
-\def\XINT_inc_a #1#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_W #9\XINT_inc_end\W
- \expandafter\XINT_inc_b
- \the\numexpr 10#9#8#7#6#5#4#3#2+\xint_c_i\relax {#1}%
-}%
-\def\XINT_inc_b 1#1%
-{%
- \xint_gob_til_zero #1\XINT_inc_A 0\XINT_inc_c
-}%
-\def\XINT_inc_c #1#2#3#4#5#6#7#8#9{\XINT_inc_a {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_inc_A 0\XINT_inc_c #1#2#3#4#5#6#7#8#9%
- {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
-\def\XINT_inc_end\W #1\relax #2{ 1#2}%
+\def\xintiiSqrt {\romannumeral0\xintiisqrt }%
+\def\xintiisqrt
+ {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }%
+\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z
+ \W\W\W\W\W\W\W\W }%
+\def\xintiiSquareRoot {\romannumeral0\xintiisquareroot }%
+\def\xintiisquareroot #1%
+ {\expandafter\XINT_sqrt_checkin\romannumeral-`0#1\Z}%
\def\xintiSqrt {\romannumeral0\xintisqrt }%
\def\xintisqrt
{\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }%
-\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z
- \W\W\W\W\W\W\W\W }%
\def\xintiSquareRoot {\romannumeral0\xintisquareroot }%
\def\xintisquareroot #1%
{\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\Z}%
@@ -3464,70 +1512,11 @@
{#2}{#1}%
}%
\def\XINT_sqrt_big_end #1#2#3#4{ {#3}{#2}}%
-\def\xintIsTrue:csv #1{\expandafter\XINT_istrue:_a\romannumeral-`0#1,,^}%
-\def\XINT_istrue:_a {\XINT_istrue:_b {}}%
-\def\XINT_istrue:_b #1#2,%
- {\expandafter\XINT_istrue:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_istrue:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_istrue:_d\fi #1}%
-\def\XINT_istrue:_d #1,%
- {\expandafter\XINT_istrue:_e\romannumeral0\xintisnotzero {#1},}%
-\def\XINT_istrue:_e #1,#2{\XINT_istrue:_b {#2,#1}}%
-\def\XINT_:_f ,#1#2^{\xint_gobble_i #1}%
-\def\xintANDof:csv #1{\expandafter\XINT_andof:_a\romannumeral-`0#1,,^}%
-\def\XINT_andof:_a {\expandafter\XINT_andof:_b\romannumeral-`0}%
-\def\XINT_andof:_b #1{\if #1,\expandafter\XINT_andof:_e
- \else\expandafter\XINT_andof:_c\fi #1}%
-\def\XINT_andof:_c #1,{\xintifTrueAelseB {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
-\def\XINT_andof:_no #1^{0}%
-\def\XINT_andof:_e #1^{1}% works with empty list
-\def\xintORof:csv #1{\expandafter\XINT_orof:_a\romannumeral-`0#1,,^}%
-\def\XINT_orof:_a {\expandafter\XINT_orof:_b\romannumeral-`0}%
-\def\XINT_orof:_b #1{\if #1,\expandafter\XINT_orof:_e
- \else\expandafter\XINT_orof:_c\fi #1}%
-\def\XINT_orof:_c #1,{\xintifTrueAelseB{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
-\def\XINT_orof:_yes #1^{1}%
-\def\XINT_orof:_e #1^{0}% works with empty list
-\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter
- 0\romannumeral-`0#1,,^}%
-\def\XINT_xorof:_a #1#2,{\expandafter\XINT_xorof:_b\romannumeral-`0#2,#1}%
-\def\XINT_xorof:_b #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_xorof:_c\fi #1}%
-\def\XINT_xorof:_c #1,#2%
- {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
- \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
- {\XINT_xorof:_a #2}%
- }%
-\def\XINT_:_e ,#1#2^{#1}% allows empty list
-\def\xintiMaxof:csv #1{\expandafter\XINT_imaxof:_b\romannumeral-`0#1,,}%
-\def\XINT_imaxof:_b #1,#2,{\expandafter\XINT_imaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_imaxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_imaxof:_d\fi #1}%
-\def\XINT_imaxof:_d #1,{\expandafter\XINT_imaxof:_b\romannumeral0\xintimax {#1}}%
-\def\XINT_of:_e ,#1,{#1}%
-\let\xintMaxof:csv\xintiMaxof:csv
-\def\xintiMinof:csv #1{\expandafter\XINT_iminof:_b\romannumeral-`0#1,,}%
-\def\XINT_iminof:_b #1,#2,{\expandafter\XINT_iminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_iminof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_iminof:_d\fi #1}%
-\def\XINT_iminof:_d #1,{\expandafter\XINT_iminof:_b\romannumeral0\xintimin {#1}}%
-\let\xintMinof:csv\xintiMinof:csv
-\def\xintiiSum:csv #1{\expandafter\XINT_iisum:_a\romannumeral-`0#1,,^}%
-\def\XINT_iisum:_a {\XINT_iisum:_b {0}}%
-\def\XINT_iisum:_b #1#2,{\expandafter\XINT_iisum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_iisum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_iisum:_d\fi #1}%
-\def\XINT_iisum:_d #1,#2{\expandafter\XINT_iisum:_b\expandafter
- {\romannumeral0\xintiiadd {#2}{#1}}}%
-\let\xintSum:csv\xintiiSum:csv
-\def\xintiiPrd:csv #1{\expandafter\XINT_iiprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_iiprd:_a {\XINT_iiprd:_b {1}}%
-\def\XINT_iiprd:_b #1#2,{\expandafter\XINT_iiprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_iiprd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_iiprd:_d\fi #1}%
-\def\XINT_iiprd:_d #1,#2{\expandafter\XINT_iiprd:_b\expandafter
- {\romannumeral0\xintiimul {#2}{#1}}}%
-\let\xintPrd:csv\xintiiPrd:csv
+\def\xintiiE {\romannumeral0\xintiie }% used in \xintMod.
+\def\xintiie #1#2%
+ {\expandafter\XINT_iie\the\numexpr #2\expandafter.\expandafter{\romannumeral-`0#1}}%
+\def\XINT_iie #1.#2{\ifnum#1>\xint_c_ \xint_dothis{\xint_dsh {#2}{-#1}}\fi
+ \xint_orthat{ #2}}%
\XINT_restorecatcodes_endinput%
\endinput
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
index 38ccb72f41b..001062ba53a 100644
--- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintbinhex: Expandable binary and hexadecimal conversions
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintbinhex: Expandable binary and hexadecimal conversions
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,10 +36,9 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintbinhex.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -52,56 +51,26 @@
\aftergroup\endinput
\else
\ifx\x\relax % plain-TeX, first loading of xintbinhex.sty
- \ifx\w\relax % but xint.sty not yet loaded.
- \y{xintbinhex}{now issuing \string\input\space xint.sty}%
- \def\z{\endgroup\input xint.sty\relax}%
+ \ifx\w\relax % but xintcore.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xint.sty not yet loaded.
- \y{xintbinhex}{now issuing \string\RequirePackage{xint}}%
- \def\z{\endgroup\RequirePackage{xint}}%
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
\fi
\else
- \y{xintbinhex}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintbinhex already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintbinhex}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintbinhex}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2014/04/01 v1.09n Expandable binary and hexadecimal conversions (jfB)]%
+ [2014/10/28 v1.1 Expandable binary and hexadecimal conversions (jfB)]%
\chardef\xint_c_xvi 16
\chardef\xint_c_ii^vii 128
\mathchardef\xint_c_ii^viii 256
@@ -110,19 +79,19 @@
\newcount\xint_c_ii^xvi \xint_c_ii^xvi 65536
\newcount\xint_c_x^v \xint_c_x^v 100000
\newcount\xint_c_x^ix \xint_c_x^ix 1000000000
-\def\XINT_tmpa #1{%
+\def\XINT_tmpa #1{\ifx\relax#1\else
\expandafter\edef\csname XINT_sdth_#1\endcsname
{\ifcase #1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or
- 8\or 9\or A\or B\or C\or D\or E\or F\fi}}%
-\xintApplyInline\XINT_tmpa
- {{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}}%
-\def\XINT_tmpa #1{%
+ 8\or 9\or A\or B\or C\or D\or E\or F\fi}%
+ \expandafter\XINT_tmpa\fi }%
+\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax
+\def\XINT_tmpa #1{\ifx\relax#1\else
\expandafter\edef\csname XINT_sdtb_#1\endcsname
{\ifcase #1
0000\or 0001\or 0010\or 0011\or 0100\or 0101\or 0110\or 0111\or
- 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\fi}}%
-\xintApplyInline\XINT_tmpa
- {{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}}%
+ 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\fi}%
+ \expandafter\XINT_tmpa\fi }%
+\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax
\let\XINT_tmpa\relax
\expandafter\def\csname XINT_sbtd_0000\endcsname {0}%
\expandafter\def\csname XINT_sbtd_0001\endcsname {1}%
diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
index 8aa2b5c2b53..c9db663a45d 100644
--- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintcfrac: Expandable continued fractions with xint package
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintcfrac: Expandable continued fractions with xint package
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,7 +36,6 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintcfrac.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
@@ -53,7 +52,6 @@
\else
\ifx\x\relax % plain-TeX, first loading of xintcfrac.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintcfrac}{now issuing \string\input\space xintfrac.sty}%
\def\z{\endgroup\input xintfrac.sty\relax}%
\fi
\else
@@ -61,47 +59,18 @@
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintcfrac}{now issuing \string\RequirePackage{xintfrac}}%
\def\z{\endgroup\RequirePackage{xintfrac}}%
\fi
\else
- \y{xintcfrac}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintcfrac already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2014/04/01 v1.09n Expandable continued fractions with xint package (jfB)]%
+ [2014/10/28 v1.1 Expandable continued fractions with xint package (jfB)]%
\def\xintCFrac {\romannumeral0\xintcfrac }%
\def\xintcfrac #1%
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xintcore.sty b/Master/texmf-dist/tex/generic/xint/xintcore.sty
new file mode 100644
index 00000000000..a23eb23cb84
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/xint/xintcore.sty
@@ -0,0 +1,2104 @@
+%%
+%% This is file `xintcore.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xint.dtx (with options: `xintcore')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from xintcore.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file xint.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
+%% Copyright (C) 2013-2014 by Jean-Francois Burnol
+%% xintcore: Expandable arithmetic on big integers
+%% ---------------------------------------------------------------
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xintcore.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintkernel.sty\endcsname
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xintcore}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \ifx\x\relax % plain-TeX, first loading of xintcore.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintkernel.sty\relax}%
+ \fi
+ \else
+ \def\empty {}%
+ \ifx\x\empty % LaTeX, first loading,
+ % variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintkernel.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintkernel}}%
+ \fi
+ \else
+ \aftergroup\endinput % xinttools already loaded.
+ \fi
+ \fi
+ \fi
+\z%
+\XINTsetupcatcodes% defined in xintkernel.sty
+\XINT_providespackage
+\ProvidesPackage{xintcore}%
+ [2014/10/28 v1.1 Expandable arithmetic on big integers (jfB)]%
+\def\xint_minus_thenstop { -}%
+\def\xint_gob_til_zeros_iii #1000{}%
+\def\xint_gob_til_zeros_iv #10000{}%
+\def\xint_gob_til_one #11{}%
+\def\xint_gob_til_G #1G{}%
+\def\xint_gob_til_minus #1-{}%
+\def\xint_gob_til_relax #1\relax {}%
+\def\xint_exchangetwo_keepbraces #1#2{{#2}{#1}}%
+\def\xint_exchangetwo_keepbraces_thenstop #1#2{ {#2}{#1}}%
+\def\xint_UDzerofork #10#2#3\krof {#2}%
+\def\xint_UDsignfork #1-#2#3\krof {#2}%
+\def\xint_UDwfork #1\W#2#3\krof {#2}%
+\def\xint_UDzerosfork #100#2#3\krof {#2}%
+\def\xint_UDonezerofork #110#2#3\krof {#2}%
+\def\xint_UDsignsfork #1--#2#3\krof {#2}%
+\chardef\xint_c_ix 9
+\chardef\xint_c_x 10
+\chardef\xint_c_ii^v 32 % not used in xint, common to xintfrac and xintbinhex
+\chardef\xint_c_ii^vi 64
+\mathchardef\xint_c_ixixixix 9999
+\mathchardef\xint_c_x^iv 10000
+\newcount\xint_c_x^viii \xint_c_x^viii 100000000
+\def\XINT_RQ #1#2#3#4#5#6#7#8#9%
+{%
+ \xint_gob_til_R #9\XINT_RQ_end_a\R\XINT_RQ {#9#8#7#6#5#4#3#2#1}%
+}%
+\def\XINT_RQ_end_a\R\XINT_RQ #1#2\Z
+{%
+ \XINT_RQ_end_b #1\Z
+}%
+\def\XINT_RQ_end_b #1#2#3#4#5#6#7#8%
+{%
+ \xint_gob_til_R
+ #8\XINT_RQ_end_viii
+ #7\XINT_RQ_end_vii
+ #6\XINT_RQ_end_vi
+ #5\XINT_RQ_end_v
+ #4\XINT_RQ_end_iv
+ #3\XINT_RQ_end_iii
+ #2\XINT_RQ_end_ii
+ \R\XINT_RQ_end_i
+ \Z #2#3#4#5#6#7#8%
+}%
+\def\XINT_RQ_end_viii #1\Z #2#3#4#5#6#7#8#9\Z { #9}%
+\def\XINT_RQ_end_vii #1\Z #2#3#4#5#6#7#8#9\Z { #8#9000}%
+\def\XINT_RQ_end_vi #1\Z #2#3#4#5#6#7#8#9\Z { #7#8#900}%
+\def\XINT_RQ_end_v #1\Z #2#3#4#5#6#7#8#9\Z { #6#7#8#90}%
+\def\XINT_RQ_end_iv #1\Z #2#3#4#5#6#7#8#9\Z { #5#6#7#8#9}%
+\def\XINT_RQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
+\def\XINT_RQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
+\def\XINT_RQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
+\def\XINT_OQ #1#2#3#4#5#6#7#8#9%
+{%
+ \xint_gob_til_R #9\XINT_OQ_end_a\R\XINT_OQ {#9#8#7#6#5#4#3#2#1}%
+}%
+\def\XINT_OQ_end_a\R\XINT_OQ #1#2\Z
+{%
+ \XINT_OQ_end_b #1\Z
+}%
+\def\XINT_OQ_end_b #1#2#3#4#5#6#7#8%
+{%
+ \xint_gob_til_R
+ #8\XINT_OQ_end_viii
+ #7\XINT_OQ_end_vii
+ #6\XINT_OQ_end_vi
+ #5\XINT_OQ_end_v
+ #4\XINT_OQ_end_iv
+ #3\XINT_OQ_end_iii
+ #2\XINT_OQ_end_ii
+ \R\XINT_OQ_end_i
+ \Z #2#3#4#5#6#7#8%
+}%
+\def\XINT_OQ_end_viii #1\Z #2#3#4#5#6#7#8#9\Z { #9}%
+\def\XINT_OQ_end_vii #1\Z #2#3#4#5#6#7#8#9\Z { #8#90000000}%
+\def\XINT_OQ_end_vi #1\Z #2#3#4#5#6#7#8#9\Z { #7#8#9000000}%
+\def\XINT_OQ_end_v #1\Z #2#3#4#5#6#7#8#9\Z { #6#7#8#900000}%
+\def\XINT_OQ_end_iv #1\Z #2#3#4#5#6#7#8#9\Z { #5#6#7#8#90000}%
+\def\XINT_OQ_end_iii #1\Z #2#3#4#5#6#7#8#9\Z { #4#5#6#7#8#9000}%
+\def\XINT_OQ_end_ii #1\Z #2#3#4#5#6#7#8#9\Z { #3#4#5#6#7#8#900}%
+\def\XINT_OQ_end_i \Z #1#2#3#4#5#6#7#8\Z { #1#2#3#4#5#6#7#80}%
+\edef\xint_cleanupzeros_andstop #1#2#3#4%
+{%
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
+}%
+\def\xint_cleanupzeros_nostop #1#2#3#4%
+{%
+ \the\numexpr #1#2#3#4\relax
+}%
+\def\XINT_rev_andcuz #1%
+{%
+ \expandafter\xint_cleanupzeros_andstop
+ \romannumeral0\XINT_rord_main {}#1%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+}%
+\def\XINT_cuz #1%
+{%
+ \XINT_cuz_loop #1\W\W\W\W\W\W\W\Z%
+}%
+\def\XINT_cuz_loop #1#2#3#4#5#6#7#8%
+{%
+ \xint_gob_til_W #8\xint_cuz_end_a\W
+ \xint_gob_til_Z #8\xint_cuz_end_A\Z
+ \XINT_cuz_check_a {#1#2#3#4#5#6#7#8}%
+}%
+\def\xint_cuz_end_a #1\XINT_cuz_check_a #2%
+{%
+ \xint_cuz_end_b #2%
+}%
+\edef\xint_cuz_end_b #1#2#3#4#5\Z
+{%
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax
+}%
+\def\xint_cuz_end_A \Z\XINT_cuz_check_a #1{ 0}%
+\def\XINT_cuz_check_a #1%
+{%
+ \expandafter\XINT_cuz_check_b\the\numexpr #1\relax
+}%
+\def\XINT_cuz_check_b #1%
+{%
+ \xint_gob_til_zero #1\xint_cuz_backtoloop 0\XINT_cuz_stop #1%
+}%
+\def\XINT_cuz_stop #1\W #2\Z{ #1}%
+\def\xint_cuz_backtoloop 0\XINT_cuz_stop 0{\XINT_cuz_loop }%
+\def\xintiNum {\romannumeral0\xintinum }%
+\def\xintinum #1%
+{%
+ \expandafter\XINT_num_loop
+ \romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
+}%
+\let\xintNum\xintiNum \let\xintnum\xintinum
+\def\XINT_num #1%
+{%
+ \XINT_num_loop #1\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\Z
+}%
+\def\XINT_num_loop #1#2#3#4#5#6#7#8%
+{%
+ \xint_gob_til_xint_relax #8\XINT_num_end\xint_relax
+ \XINT_num_NumEight #1#2#3#4#5#6#7#8%
+}%
+\edef\XINT_num_end\xint_relax\XINT_num_NumEight #1\xint_relax #2\Z
+{%
+ \noexpand\expandafter\space\noexpand\the\numexpr #1+\xint_c_\relax
+}%
+\def\XINT_num_NumEight #1#2#3#4#5#6#7#8%
+{%
+ \ifnum \numexpr #1#2#3#4#5#6#7#8+\xint_c_= \xint_c_
+ \xint_afterfi {\expandafter\XINT_num_keepsign_a
+ \the\numexpr #1#2#3#4#5#6#7#81\relax}%
+ \else
+ \xint_afterfi {\expandafter\XINT_num_finish
+ \the\numexpr #1#2#3#4#5#6#7#8\relax}%
+ \fi
+}%
+\def\XINT_num_keepsign_a #1%
+{%
+ \xint_gob_til_one#1\XINT_num_gobacktoloop 1\XINT_num_keepsign_b
+}%
+\def\XINT_num_gobacktoloop 1\XINT_num_keepsign_b {\XINT_num_loop }%
+\def\XINT_num_keepsign_b #1{\XINT_num_loop -}%
+\def\XINT_num_finish #1\xint_relax #2\Z { #1}%
+\def\xintiiSgn {\romannumeral0\xintiisgn }%
+\def\xintiisgn #1%
+{%
+ \expandafter\XINT_sgn \romannumeral-`0#1\Z%
+}%
+\def\xintSgn {\romannumeral0\xintsgn }%
+\def\xintsgn #1%
+{%
+ \expandafter\XINT_sgn \romannumeral0\xintnum{#1}\Z%
+}%
+\def\XINT_sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-{ 0}%
+ 0#1{ -1}%
+ 0-{ 1}%
+ \krof
+}%
+\def\XINT_Sgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-{0}%
+ 0#1{-1}%
+ 0-{1}%
+ \krof
+}%
+\def\XINT_cntSgn #1#2\Z
+{%
+ \xint_UDzerominusfork
+ #1-\xint_c_
+ 0#1\m@ne % I will not allocate a count only for -1?
+ 0-\xint_c_i
+ \krof
+}%
+\def\xintiiOpp {\romannumeral0\xintiiopp }%
+\def\xintiiopp #1%
+{%
+ \expandafter\XINT_opp \romannumeral-`0#1%
+}%
+\def\xintiOpp {\romannumeral0\xintiopp }%
+\def\xintiopp #1%
+{%
+ \expandafter\XINT_opp \romannumeral0\xintnum{#1}%
+}%
+\let\xintOpp\xintiOpp \let\xintopp\xintiopp
+\def\XINT_Opp #1{\romannumeral0\XINT_opp #1}%
+\def\XINT_opp #1%
+{%
+ \xint_UDzerominusfork
+ #1-{ 0}% zero
+ 0#1{ }% negative
+ 0-{ -#1}% positive
+ \krof
+}%
+\def\xintiiAbs {\romannumeral0\xintiiabs }%
+\def\xintiiabs #1%
+{%
+ \expandafter\XINT_abs \romannumeral-`0#1%
+}%
+\def\xintiAbs {\romannumeral0\xintiabs }%
+\def\xintiabs #1%
+{%
+ \expandafter\XINT_abs \romannumeral0\xintnum{#1}%
+}%
+\let\xintAbs\xintiAbs \let\xintabs\xintiabs
+\def\XINT_Abs #1{\romannumeral0\XINT_abs #1}%
+\def\XINT_abs #1%
+{%
+ \xint_UDsignfork
+ #1{ }%
+ -{ #1}%
+ \krof
+}%
+\def\XINT_add_A #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_add_az\W
+ \XINT_add_AB #1{#3#4#5#6}{#2}%
+}%
+\def\xint_add_az\W\XINT_add_AB #1#2%
+{%
+ \XINT_add_AC_checkcarry #1%
+}%
+\def\XINT_add_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \xint_gob_til_W #5\xint_add_bz\W
+ \XINT_add_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+}%
+\def\XINT_add_ABE #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_add_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
+}%
+\def\XINT_add_ABEA #1#2#3.#4%
+{%
+ \XINT_add_A #2{#3#4}%
+}%
+\def\xint_add_bz\W\XINT_add_ABE #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_add_CC\the\numexpr #1+10#5#4#3#2.%
+}%
+\def\XINT_add_CC #1#2#3.#4%
+{%
+ \XINT_add_AC_checkcarry #2{#3#4}% on va examiner et \'eliminer #2
+}%
+\def\XINT_add_AC_checkcarry #1%
+{%
+ \xint_gob_til_zero #1\xint_add_AC_nocarry 0\XINT_add_C
+}%
+\def\xint_add_AC_nocarry 0\XINT_add_C #1#2\W\X\Y\Z
+{%
+ \expandafter
+ \xint_cleanupzeros_andstop
+ \romannumeral0%
+ \XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1%
+}%
+\def\XINT_add_C #1#2#3#4#5%
+{%
+ \xint_gob_til_W #2\xint_add_cz\W
+ \XINT_add_CD {#5#4#3#2}{#1}%
+}%
+\def\XINT_add_CD #1%
+{%
+ \expandafter\XINT_add_CC\the\numexpr 1+10#1.%
+}%
+\def\xint_add_cz\W\XINT_add_CD #1#2{ 1#2}%
+\def\XINT_addr_A #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_addr_az\W
+ \XINT_addr_B #1{#3#4#5#6}{#2}%
+}%
+\def\xint_addr_az\W\XINT_addr_B #1#2%
+{%
+ \XINT_addr_AC_checkcarry #1%
+}%
+\def\XINT_addr_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \xint_gob_til_W #5\xint_addr_bz\W
+ \XINT_addr_E #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+}%
+\def\XINT_addr_E #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_addr_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
+}%
+\def\XINT_addr_ABEA #1#2#3#4#5#6#7%
+{%
+ \XINT_addr_A #2{#7#6#5#4#3}%
+}%
+\def\xint_addr_bz\W\XINT_addr_E #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_addr_CC\the\numexpr #1+10#5#4#3#2\relax
+}%
+\def\XINT_addr_CC #1#2#3#4#5#6#7%
+{%
+ \XINT_addr_AC_checkcarry #2{#7#6#5#4#3}%
+}%
+\def\XINT_addr_AC_checkcarry #1%
+{%
+ \xint_gob_til_zero #1\xint_addr_AC_nocarry 0\XINT_addr_C
+}%
+\def\xint_addr_AC_nocarry 0\XINT_addr_C #1#2\W\X\Y\Z { #1#2}%
+\def\XINT_addr_C #1#2#3#4#5%
+{%
+ \xint_gob_til_W #2\xint_addr_cz\W
+ \XINT_addr_D {#5#4#3#2}{#1}%
+}%
+\def\XINT_addr_D #1%
+{%
+ \expandafter\XINT_addr_CC\the\numexpr 1+10#1\relax
+}%
+\def\xint_addr_cz\W\XINT_addr_D #1#2{ #21000}%
+\def\XINT_addm_A #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_addm_az\W
+ \XINT_addm_AB #1{#3#4#5#6}{#2}%
+}%
+\def\xint_addm_az\W\XINT_addm_AB #1#2%
+{%
+ \XINT_addm_AC_checkcarry #1%
+}%
+\def\XINT_addm_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \XINT_addm_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+}%
+\def\XINT_addm_ABE #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_addm_ABEA\the\numexpr #1+10#5#4#3#2+#6.%
+}%
+\def\XINT_addm_ABEA #1#2#3.#4%
+{%
+ \XINT_addm_A #2{#3#4}%
+}%
+\def\XINT_addm_AC_checkcarry #1%
+{%
+ \xint_gob_til_zero #1\xint_addm_AC_nocarry 0\XINT_addm_C
+}%
+\def\xint_addm_AC_nocarry 0\XINT_addm_C #1#2\W\X\Y\Z
+{%
+ \expandafter
+ \xint_cleanupzeros_andstop
+ \romannumeral0%
+ \XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1%
+}%
+\def\XINT_addm_C #1#2#3#4#5%
+{%
+ \xint_gob_til_W
+ #5\xint_addm_cw
+ #4\xint_addm_cx
+ #3\xint_addm_cy
+ #2\xint_addm_cz
+ \W\XINT_addm_CD {#5#4#3#2}{#1}%
+}%
+\def\XINT_addm_CD #1%
+{%
+ \expandafter\XINT_addm_CC\the\numexpr 1+10#1.%
+}%
+\def\XINT_addm_CC #1#2#3.#4%
+{%
+ \XINT_addm_AC_checkcarry #2{#3#4}%
+}%
+\def\xint_addm_cw
+ #1\xint_addm_cx
+ #2\xint_addm_cy
+ #3\xint_addm_cz
+ \W\XINT_addm_CD
+{%
+ \expandafter\XINT_addm_CDw\the\numexpr 1+#1#2#3.%
+}%
+\def\XINT_addm_CDw #1.#2#3\X\Y\Z
+{%
+ \XINT_addm_end #1#3%
+}%
+\def\xint_addm_cx
+ #1\xint_addm_cy
+ #2\xint_addm_cz
+ \W\XINT_addm_CD
+{%
+ \expandafter\XINT_addm_CDx\the\numexpr 1+#1#2.%
+}%
+\def\XINT_addm_CDx #1.#2#3\Y\Z
+{%
+ \XINT_addm_end #1#3%
+}%
+\def\xint_addm_cy
+ #1\xint_addm_cz
+ \W\XINT_addm_CD
+{%
+ \expandafter\XINT_addm_CDy\the\numexpr 1+#1.%
+}%
+\def\XINT_addm_CDy #1.#2#3\Z
+{%
+ \XINT_addm_end #1#3%
+}%
+\def\xint_addm_cz\W\XINT_addm_CD #1#2#3{\XINT_addm_end #1#3}%
+\edef\XINT_addm_end #1#2#3#4#5%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5\relax}%
+\def\XINT_addp_A #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_addp_az\W
+ \XINT_addp_AB #1{#3#4#5#6}{#2}%
+}%
+\def\xint_addp_az\W\XINT_addp_AB #1#2%
+{%
+ \XINT_addp_AC_checkcarry #1%
+}%
+\def\XINT_addp_AC_checkcarry #1%
+{%
+ \xint_gob_til_zero #1\xint_addp_AC_nocarry 0\XINT_addp_C
+}%
+\def\xint_addp_AC_nocarry 0\XINT_addp_C
+{%
+ \XINT_addp_F
+}%
+\def\XINT_addp_AB #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \XINT_addp_ABE #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+}%
+\def\XINT_addp_ABE #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_addp_ABEA\the\numexpr #1+10#5#4#3#2+#6\relax
+}%
+\def\XINT_addp_ABEA #1#2#3#4#5#6#7%
+{%
+ \XINT_addp_A #2{#7#6#5#4#3}%<-- attention on met donc \`a droite
+}%
+\def\XINT_addp_C #1#2#3#4#5%
+{%
+ \xint_gob_til_W
+ #5\xint_addp_cw
+ #4\xint_addp_cx
+ #3\xint_addp_cy
+ #2\xint_addp_cz
+ \W\XINT_addp_CD {#5#4#3#2}{#1}%
+}%
+\def\XINT_addp_CD #1%
+{%
+ \expandafter\XINT_addp_CC\the\numexpr 1+10#1\relax
+}%
+\def\XINT_addp_CC #1#2#3#4#5#6#7%
+{%
+ \XINT_addp_AC_checkcarry #2{#7#6#5#4#3}%
+}%
+\def\xint_addp_cw
+ #1\xint_addp_cx
+ #2\xint_addp_cy
+ #3\xint_addp_cz
+ \W\XINT_addp_CD
+{%
+ \expandafter\XINT_addp_CDw\the\numexpr \xint_c_i+10#1#2#3\relax
+}%
+\def\XINT_addp_CDw #1#2#3#4#5#6%
+{%
+ \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDw_zeros
+ 0000\XINT_addp_endDw #2#3#4#5%
+}%
+\def\XINT_addp_endDw_zeros 0000\XINT_addp_endDw 0000#1\X\Y\Z{ #1}%
+\def\XINT_addp_endDw #1#2#3#4#5\X\Y\Z{ #5#4#3#2#1}%
+\def\xint_addp_cx
+ #1\xint_addp_cy
+ #2\xint_addp_cz
+ \W\XINT_addp_CD
+{%
+ \expandafter\XINT_addp_CDx\the\numexpr \xint_c_i+100#1#2\relax
+}%
+\def\XINT_addp_CDx #1#2#3#4#5#6%
+{%
+ \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDx_zeros
+ 0000\XINT_addp_endDx #2#3#4#5%
+}%
+\def\XINT_addp_endDx_zeros 0000\XINT_addp_endDx 0000#1\Y\Z{ #1}%
+\def\XINT_addp_endDx #1#2#3#4#5\Y\Z{ #5#4#3#2#1}%
+\def\xint_addp_cy #1\xint_addp_cz\W\XINT_addp_CD
+{%
+ \expandafter\XINT_addp_CDy\the\numexpr \xint_c_i+1000#1\relax
+}%
+\def\XINT_addp_CDy #1#2#3#4#5#6%
+{%
+ \xint_gob_til_zeros_iv #2#3#4#5\XINT_addp_endDy_zeros
+ 0000\XINT_addp_endDy #2#3#4#5%
+}%
+\def\XINT_addp_endDy_zeros 0000\XINT_addp_endDy 0000#1\Z{ #1}%
+\def\XINT_addp_endDy #1#2#3#4#5\Z{ #5#4#3#2#1}%
+\def\xint_addp_cz\W\XINT_addp_CD #1#2{ #21000}%
+\def\XINT_addp_F #1#2#3#4#5%
+{%
+ \xint_gob_til_W
+ #5\xint_addp_Gw
+ #4\xint_addp_Gx
+ #3\xint_addp_Gy
+ #2\xint_addp_Gz
+ \W\XINT_addp_G {#2#3#4#5}{#1}%
+}%
+\def\XINT_addp_G #1#2%
+{%
+ \XINT_addp_F {#2#1}%
+}%
+\def\xint_addp_Gw
+ #1\xint_addp_Gx
+ #2\xint_addp_Gy
+ #3\xint_addp_Gz
+ \W\XINT_addp_G #4%
+{%
+ \xint_gob_til_zeros_iv #3#2#10\XINT_addp_endGw_zeros
+ 0000\XINT_addp_endGw #3#2#10%
+}%
+\def\XINT_addp_endGw_zeros 0000\XINT_addp_endGw 0000#1\X\Y\Z{ #1}%
+\def\XINT_addp_endGw #1#2#3#4#5\X\Y\Z{ #5#1#2#3#4}%
+\def\xint_addp_Gx
+ #1\xint_addp_Gy
+ #2\xint_addp_Gz
+ \W\XINT_addp_G #3%
+{%
+ \xint_gob_til_zeros_iv #2#100\XINT_addp_endGx_zeros
+ 0000\XINT_addp_endGx #2#100%
+}%
+\def\XINT_addp_endGx_zeros 0000\XINT_addp_endGx 0000#1\Y\Z{ #1}%
+\def\XINT_addp_endGx #1#2#3#4#5\Y\Z{ #5#1#2#3#4}%
+\def\xint_addp_Gy
+ #1\xint_addp_Gz
+ \W\XINT_addp_G #2%
+{%
+ \xint_gob_til_zeros_iv #1000\XINT_addp_endGy_zeros
+ 0000\XINT_addp_endGy #1000%
+}%
+\def\XINT_addp_endGy_zeros 0000\XINT_addp_endGy 0000#1\Z{ #1}%
+\def\XINT_addp_endGy #1#2#3#4#5\Z{ #5#1#2#3#4}%
+\def\xint_addp_Gz\W\XINT_addp_G #1#2{ #2}%
+\def\xintiiAdd {\romannumeral0\xintiiadd }%
+\def\xintiiadd #1{\expandafter\xint_iiadd\romannumeral-`0#1\Z }%
+\def\xint_iiadd #1#2\Z #3%
+{%
+ \expandafter\XINT_add_fork\expandafter #1\romannumeral-`0#3\Z #2\Z
+}%
+\def\xintiAdd {\romannumeral0\xintiadd }%
+\def\xintiadd #1%
+{%
+ \expandafter\xint_add\romannumeral0\xintnum{#1}\Z
+}%
+\def\xint_add #1#2\Z #3%
+{%
+ \expandafter\XINT_add_fork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z
+}%
+\let\xintAdd\xintiAdd \let\xintadd\xintiadd
+\def\XINT_add_fork #1#2%
+{%
+ \xint_UDzerofork
+ #1\XINT_add_firstiszero
+ #2\XINT_add_secondiszero
+ 0{}%
+ \krof
+ \xint_UDsignsfork
+ #1#2\XINT_add_minusminus
+ #1-\XINT_add_minusplus
+ #2-\XINT_add_plusminus
+ --\XINT_add_plusplus
+ \krof #1#2%
+}%
+\def\XINT_add_firstiszero #1\krof #2#3\Z #4\Z { #3}%
+\def\XINT_add_secondiszero #1\krof #2#3\Z #4\Z { #2#4}%
+\def\XINT_add_plusplus #1#2#3\Z #4\Z {\XINT_add_pre {#1#4}{#2#3}}%
+\def\XINT_add_minusminus #1#2#3\Z #4\Z
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_add_pre {#4}{#3}}%
+\def\XINT_add_minusplus #1#2#3\Z #4\Z {\XINT_sub_pre {#2#3}{#4}}%
+\def\XINT_add_plusminus #1#2#3\Z #4\Z {\XINT_sub_pre {#1#4}{#3}}%
+\def\XINT_add_pre #1%
+{%
+ \expandafter\XINT_add_pre_b\expandafter
+ {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
+}%
+\def\XINT_add_pre_b #1#2%
+{%
+ \expandafter\XINT_add_A
+ \expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #1\W\X\Y\Z
+}%
+\def\xintiiSub {\romannumeral0\xintiisub }%
+\def\xintiisub #1{\expandafter\xint_iisub\romannumeral-`0#1\Z }%
+\def\xint_iisub #1#2\Z #3%
+{%
+ \expandafter\XINT_sub_fork\expandafter #1\romannumeral-`0#3\Z #2\Z
+}%
+\def\xintiSub {\romannumeral0\xintisub }%
+\def\xintisub #1%
+{%
+ \expandafter\xint_sub\romannumeral0\xintnum{#1}\Z
+}%
+\def\xint_sub #1#2\Z #3%
+{%
+ \expandafter\XINT_sub_fork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z
+}%
+\let\xintSub\xintiSub \let\xintsub\xintisub
+\def\XINT_sub_fork #1#2%
+{%
+ \xint_UDzerofork
+ #1\XINT_sub_firstiszero
+ #2\XINT_sub_secondiszero
+ 0{}%
+ \krof
+ \xint_UDsignsfork
+ #1#2\XINT_sub_minusminus
+ #1-\XINT_sub_minusplus
+ #2-\XINT_sub_plusminus
+ --\XINT_sub_plusplus
+ \krof #1#2%
+}%
+\def\XINT_sub_firstiszero #1\krof #2#3\Z #4\Z {\XINT_opp #3}%
+\def\XINT_sub_secondiszero #1\krof #2#3\Z #4\Z { #2#4}%
+\def\XINT_sub_plusplus #1#2#3\Z #4\Z {\XINT_sub_pre {#1#4}{#2#3}}%
+\def\XINT_sub_minusminus #1#2#3\Z #4\Z {\XINT_sub_pre {#3}{#4}}%
+\def\XINT_sub_minusplus #1#2#3\Z #4\Z
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_add_pre {#4}{#2#3}}%
+\def\XINT_sub_plusminus #1#2#3\Z #4\Z {\XINT_add_pre {#1#4}{#3}}%
+\def\XINT_sub_pre #1%
+{%
+ \expandafter\XINT_sub_pre_b\expandafter
+ {\romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z }%
+}%
+\def\XINT_sub_pre_b #1#2%
+{%
+ \expandafter\XINT_sub_A
+ \expandafter1\expandafter{\expandafter}%
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \W\X\Y\Z #1 \W\X\Y\Z
+}%
+\def\XINT_sub_A #1#2#3\W\X\Y\Z #4#5#6#7%
+{%
+ \xint_gob_til_W
+ #4\xint_sub_az
+ \W\XINT_sub_B #1{#4#5#6#7}{#2}#3\W\X\Y\Z
+}%
+\def\XINT_sub_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W
+ #4\xint_sub_bz
+ \W\XINT_sub_onestep #1#2{#7#6#5#4}{#3}%
+}%
+\def\XINT_sub_onestep #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_sub_backtoA\the\numexpr 11#5#4#3#2-#6+#1-\xint_c_i.%
+}%
+\def\XINT_sub_backtoA #1#2#3.#4%
+{%
+ \XINT_sub_A #2{#3#4}%
+}%
+\def\xint_sub_bz
+ \W\XINT_sub_onestep #1#2#3#4#5#6#7%
+{%
+ \xint_UDzerofork
+ #1\XINT_sub_C % une retenue
+ 0\XINT_sub_D % pas de retenue
+ \krof
+ {#7}#2#3#4#5%
+}%
+\def\XINT_sub_D #1#2\W\X\Y\Z
+{%
+ \expandafter
+ \xint_cleanupzeros_andstop
+ \romannumeral0%
+ \XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1%
+}%
+\def\XINT_sub_C #1#2#3#4#5%
+{%
+ \xint_gob_til_W
+ #2\xint_sub_cz
+ \W\XINT_sub_AC_onestep {#5#4#3#2}{#1}%
+}%
+\def\XINT_sub_AC_onestep #1%
+{%
+ \expandafter\XINT_sub_backtoC\the\numexpr 11#1-\xint_c_i.%
+}%
+\def\XINT_sub_backtoC #1#2#3.#4%
+{%
+ \XINT_sub_AC_checkcarry #2{#3#4}% la retenue va \^etre examin\'ee
+}%
+\def\XINT_sub_AC_checkcarry #1%
+{%
+ \xint_gob_til_one #1\xint_sub_AC_nocarry 1\XINT_sub_C
+}%
+\def\xint_sub_AC_nocarry 1\XINT_sub_C #1#2\W\X\Y\Z
+{%
+ \expandafter
+ \XINT_cuz_loop
+ \romannumeral0%
+ \XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1\W\W\W\W\W\W\W\Z
+}%
+\def\xint_sub_cz\W\XINT_sub_AC_onestep #1%
+{%
+ \XINT_cuz
+}%
+\def\xint_sub_az\W\XINT_sub_B #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_W
+ #4\xint_sub_ez
+ \W\XINT_sub_Eenter #1{#3}#4#5#6#7%
+}%
+\def\XINT_sub_Eenter #1#2%
+{%
+ \expandafter
+ \XINT_sub_E\expandafter1\expandafter{\expandafter}%
+ \romannumeral0%
+ \XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ \W\X\Y\Z #1%
+}%
+\def\XINT_sub_E #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_sub_F\W
+ \XINT_sub_Eonestep #1{#6#5#4#3}{#2}%
+}%
+\def\XINT_sub_Eonestep #1#2%
+{%
+ \expandafter\XINT_sub_backtoE\the\numexpr 109999-#2+#1.%
+}%
+\def\XINT_sub_backtoE #1#2#3.#4%
+{%
+ \XINT_sub_E #2{#3#4}%
+}%
+\def\xint_sub_F\W\XINT_sub_Eonestep #1#2#3#4%
+{%
+ \xint_UDonezerofork
+ #4#1{\XINT_sub_Fdec 0}% soustraire 1. Et faire signe -
+ #1#4{\XINT_sub_Finc 1}% additionner 1. Et faire signe -
+ 10\XINT_sub_DD % terminer. Mais avec signe -
+ \krof
+ {#3}%
+}%
+\def\XINT_sub_DD {\expandafter\xint_minus_thenstop\romannumeral0\XINT_sub_D }%
+\def\XINT_sub_Fdec #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_sub_Fdec_finish\W
+ \XINT_sub_Fdec_onestep #1{#6#5#4#3}{#2}%
+}%
+\def\XINT_sub_Fdec_onestep #1#2%
+{%
+ \expandafter\XINT_sub_backtoFdec\the\numexpr 11#2+#1-\xint_c_i.%
+}%
+\def\XINT_sub_backtoFdec #1#2#3.#4%
+{%
+ \XINT_sub_Fdec #2{#3#4}%
+}%
+\def\xint_sub_Fdec_finish\W\XINT_sub_Fdec_onestep #1#2%
+{%
+ \expandafter\xint_minus_thenstop\romannumeral0\XINT_cuz
+}%
+\def\XINT_sub_Finc #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_sub_Finc_finish\W
+ \XINT_sub_Finc_onestep #1{#6#5#4#3}{#2}%
+}%
+\def\XINT_sub_Finc_onestep #1#2%
+{%
+ \expandafter\XINT_sub_backtoFinc\the\numexpr 10#2+#1.%
+}%
+\def\XINT_sub_backtoFinc #1#2#3.#4%
+{%
+ \XINT_sub_Finc #2{#3#4}%
+}%
+\def\xint_sub_Finc_finish\W\XINT_sub_Finc_onestep #1#2#3%
+{%
+ \xint_UDzerofork
+ #1{\expandafter\expandafter\expandafter
+ \xint_minus_thenstop\xint_cleanupzeros_nostop}%
+ 0{ -1}%
+ \krof
+ #3%
+}%
+\def\xint_sub_ez\W\XINT_sub_Eenter #1%
+{%
+ \xint_UDzerofork
+ #1\XINT_sub_K % il y a une retenue
+ 0\XINT_sub_L % pas de retenue
+ \krof
+}%
+\def\XINT_sub_L #1\W\X\Y\Z {\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z }%
+\def\XINT_sub_K #1%
+{%
+ \expandafter
+ \XINT_sub_KK\expandafter1\expandafter{\expandafter}%
+ \romannumeral0%
+ \XINT_rord_main {}#1%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+}%
+\def\XINT_sub_KK #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_sub_KK_finish\W
+ \XINT_sub_KK_onestep #1{#6#5#4#3}{#2}%
+}%
+\def\XINT_sub_KK_onestep #1#2%
+{%
+ \expandafter\XINT_sub_backtoKK\the\numexpr 109999-#2+#1.%
+}%
+\def\XINT_sub_backtoKK #1#2#3.#4%
+{%
+ \XINT_sub_KK #2{#3#4}%
+}%
+\def\xint_sub_KK_finish\W\XINT_sub_KK_onestep #1#2#3%
+{%
+ \expandafter\xint_minus_thenstop
+ \romannumeral0\XINT_cuz_loop #3\W\W\W\W\W\W\W\Z
+}%
+\def\xintiiMul {\romannumeral0\xintiimul }%
+\def\xintiimul #1%
+{%
+ \expandafter\xint_iimul\expandafter {\romannumeral-`0#1}%
+}%
+\def\xint_iimul #1#2%
+{%
+ \expandafter\XINT_mul_fork \romannumeral-`0#2\Z #1\Z
+}%
+\def\xintiMul {\romannumeral0\xintimul }%
+\def\xintimul #1%
+{%
+ \expandafter\xint_mul\expandafter {\romannumeral0\xintnum{#1}}%
+}%
+\def\xint_mul #1#2%
+{%
+ \expandafter\XINT_mul_fork \romannumeral0\xintnum{#2}\Z #1\Z
+}%
+\let\xintMul\xintiMul \let\xintmul\xintimul
+\def\XINT_Mul #1#2{\romannumeral0\XINT_mul_fork #2\Z #1\Z }%
+\def\XINT_mul_fork #1#2\Z #3#4\Z
+{%
+ \xint_UDzerofork
+ #1\XINT_mul_zero
+ #3\XINT_mul_zero
+ 0{}%
+ \krof
+ \xint_UDsignsfork
+ #1#3\XINT_mul_minusminus % #1 = #3 = -
+ #1-{\XINT_mul_minusplus #3}% % #1 = -
+ #3-{\XINT_mul_plusminus #1}% % #3 = -
+ --{\XINT_mul_plusplus #1#3}%
+ \krof
+ {#2}{#4}%
+}%
+\def\XINT_mul_zero #1\krof #2#3{ 0}%
+\def\XINT_mul_minusminus #1#2%
+{%
+ \expandafter\XINT_mul_choice_a
+ \expandafter{\romannumeral0\xintlength {#2}}%
+ {\romannumeral0\xintlength {#1}}{#1}{#2}%
+}%
+\def\XINT_mul_minusplus #1#2#3%
+{%
+ \expandafter\xint_minus_thenstop\romannumeral0\expandafter
+ \XINT_mul_choice_a
+ \expandafter{\romannumeral0\xintlength {#1#3}}%
+ {\romannumeral0\xintlength {#2}}{#2}{#1#3}%
+}%
+\def\XINT_mul_plusminus #1#2#3%
+{%
+ \expandafter\xint_minus_thenstop\romannumeral0\expandafter
+ \XINT_mul_choice_a
+ \expandafter{\romannumeral0\xintlength {#3}}%
+ {\romannumeral0\xintlength {#1#2}}{#1#2}{#3}%
+}%
+\def\XINT_mul_plusplus #1#2#3#4%
+{%
+ \expandafter\XINT_mul_choice_a
+ \expandafter{\romannumeral0\xintlength {#2#4}}%
+ {\romannumeral0\xintlength {#1#3}}{#1#3}{#2#4}%
+}%
+\def\XINT_mul_choice_a #1#2%
+{%
+ \expandafter\XINT_mul_choice_b\expandafter{#2}{#1}%
+}%
+\def\XINT_mul_choice_b #1#2%
+{%
+ \ifnum #1<\xint_c_v
+ \expandafter\XINT_mul_choice_littlebyfirst
+ \else
+ \ifnum #2<\xint_c_v
+ \expandafter\expandafter\expandafter\XINT_mul_choice_littlebysecond
+ \else
+ \expandafter\expandafter\expandafter\XINT_mul_choice_compare
+ \fi
+ \fi
+ {#1}{#2}%
+}%
+\def\XINT_mul_choice_littlebyfirst #1#2#3#4%
+{%
+ \expandafter\XINT_mul_M
+ \expandafter{\the\numexpr #3\expandafter}%
+ \romannumeral0\XINT_RQ {}#4\R\R\R\R\R\R\R\R\Z \Z\Z\Z\Z
+}%
+\def\XINT_mul_choice_littlebysecond #1#2#3#4%
+{%
+ \expandafter\XINT_mul_M
+ \expandafter{\the\numexpr #4\expandafter}%
+ \romannumeral0\XINT_RQ {}#3\R\R\R\R\R\R\R\R\Z \Z\Z\Z\Z
+}%
+\def\XINT_mul_choice_compare #1#2%
+{%
+ \ifnum #1>#2
+ \expandafter \XINT_mul_choice_i
+ \else
+ \expandafter \XINT_mul_choice_ii
+ \fi
+ {#1}{#2}%
+}%
+\def\XINT_mul_choice_i #1#2%
+{%
+ \ifnum #1<\numexpr\ifcase \numexpr (#2-\xint_c_iii)/\xint_c_iv\relax
+ \or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
+ \expandafter\XINT_mul_choice_same
+ \else
+ \expandafter\XINT_mul_choice_permute
+ \fi
+}%
+\def\XINT_mul_choice_ii #1#2%
+{%
+ \ifnum #2<\numexpr\ifcase \numexpr (#1-\xint_c_iii)/\xint_c_iv\relax
+ \or 330\or 168\or 109\or 80\or 66\or 52\else 0\fi\relax
+ \expandafter\XINT_mul_choice_permute
+ \else
+ \expandafter\XINT_mul_choice_same
+ \fi
+}%
+\def\XINT_mul_choice_same #1#2%
+{%
+ \expandafter\XINT_mul_enter
+ \romannumeral0\XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
+ \Z\Z\Z\Z #2\W\W\W\W
+}%
+\def\XINT_mul_choice_permute #1#2%
+{%
+ \expandafter\XINT_mul_enter
+ \romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z
+ \Z\Z\Z\Z #1\W\W\W\W
+}%
+\def\XINT_mul_Ar #1#2#3#4#5#6%
+{%
+ \xint_gob_til_Z #6\xint_mul_br\Z\XINT_mul_Br #1{#6#5#4#3}{#2}%
+}%
+\def\xint_mul_br\Z\XINT_mul_Br #1#2%
+{%
+ \XINT_addr_AC_checkcarry #1%
+}%
+\def\XINT_mul_Br #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \expandafter\XINT_mul_ABEAr
+ \the\numexpr #1+10#2+#8#7#6#5.{#3}#4\W\X\Y\Z
+}%
+\def\XINT_mul_ABEAr #1#2#3#4#5#6.#7%
+{%
+ \XINT_mul_Ar #2{#7#6#5#4#3}%
+}%
+\def\XINT_mul_Mr #1%
+{%
+ \expandafter\XINT_mul_Mr_checkifzeroorone\expandafter{\the\numexpr #1}%
+}%
+\def\XINT_mul_Mr_checkifzeroorone #1%
+{%
+ \ifcase #1
+ \expandafter\XINT_mul_Mr_zero
+ \or
+ \expandafter\XINT_mul_Mr_one
+ \else
+ \expandafter\XINT_mul_Nr
+ \fi
+ {0000}{}{#1}%
+}%
+\def\XINT_mul_Mr_zero #1\Z\Z\Z\Z { 0000}%
+\def\XINT_mul_Mr_one #1#2#3#4\Z\Z\Z\Z { #4}%
+\def\XINT_mul_Nr #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_Z #4\xint_mul_pr\Z\XINT_mul_Pr {#1}{#3}{#7#6#5#4}{#2}{#3}%
+}%
+\def\XINT_mul_Pr #1#2#3%
+{%
+ \expandafter\XINT_mul_Lr\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
+}%
+\def\XINT_mul_Lr 1#1#2#3#4#5#6#7#8#9%
+{%
+ \XINT_mul_Nr {#1#2#3#4}{#9#8#7#6#5}%
+}%
+\def\xint_mul_pr\Z\XINT_mul_Pr #1#2#3#4#5%
+{%
+ \xint_gob_til_zeros_iv #1\XINT_mul_Mr_end_nocarry 0000%
+ \XINT_mul_Mr_end_carry #1{#4}%
+}%
+\def\XINT_mul_Mr_end_nocarry 0000\XINT_mul_Mr_end_carry 0000#1{ #1}%
+\def\XINT_mul_Mr_end_carry #1#2#3#4#5{ #5#4#3#2#1}%
+\def\XINT_mul_M #1%
+{%
+ \expandafter\XINT_mul_M_checkifzeroorone\expandafter{\the\numexpr #1}%
+}%
+\def\XINT_mul_M_checkifzeroorone #1%
+{%
+ \ifcase #1
+ \expandafter\XINT_mul_M_zero
+ \or
+ \expandafter\XINT_mul_M_one
+ \else
+ \expandafter\XINT_mul_N
+ \fi
+ {0000}{}{#1}%
+}%
+\def\XINT_mul_M_zero #1\Z\Z\Z\Z { 0}%
+\def\XINT_mul_M_one #1#2#3#4\Z\Z\Z\Z
+{%
+ \expandafter\xint_cleanupzeros_andstop\romannumeral0\xintreverseorder{#4}%
+}%
+\def\XINT_mul_N #1#2#3#4#5#6#7%
+{%
+ \xint_gob_til_Z #4\xint_mul_p\Z\XINT_mul_P {#1}{#3}{#7#6#5#4}{#2}{#3}%
+}%
+\def\XINT_mul_P #1#2#3%
+{%
+ \expandafter\XINT_mul_L\the\numexpr \xint_c_x^viii+#1+#2*#3\relax
+}%
+\def\XINT_mul_L 1#1#2#3#4#5#6#7#8#9%
+{%
+ \XINT_mul_N {#1#2#3#4}{#5#6#7#8#9}%
+}%
+\def\xint_mul_p\Z\XINT_mul_P #1#2#3#4#5%
+{%
+ \XINT_mul_M_end #1#4%
+}%
+\edef\XINT_mul_M_end #1#2#3#4#5#6#7#8%
+{%
+ \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax
+}%
+\def\XINT_mul_enter #1\Z\Z\Z\Z #2#3#4#5%
+{%
+ \xint_gob_til_W #5\XINT_mul_exit_a\W
+ \XINT_mul_start {#2#3#4#5}#1\Z\Z\Z\Z
+}%
+\def\XINT_mul_exit_a\W\XINT_mul_start #1%
+{%
+ \XINT_mul_exit_b #1%
+}%
+\def\XINT_mul_exit_b #1#2#3#4%
+{%
+ \xint_gob_til_W
+ #2\XINT_mul_exit_ci
+ #3\XINT_mul_exit_cii
+ \W\XINT_mul_exit_ciii #1#2#3#4%
+}%
+\def\XINT_mul_exit_ciii #1\W #2\Z\Z\Z\Z \W\W\W
+{%
+ \XINT_mul_M {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mul_exit_cii\W\XINT_mul_exit_ciii #1\W\W #2\Z\Z\Z\Z \W\W
+{%
+ \XINT_mul_M {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mul_exit_ci\W\XINT_mul_exit_cii
+ \W\XINT_mul_exit_ciii #1\W\W\W #2\Z\Z\Z\Z \W
+{%
+ \XINT_mul_M {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mul_start #1#2\Z\Z\Z\Z
+{%
+ \expandafter\XINT_mul_main\expandafter
+ {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
+}%
+\def\XINT_mul_main #1#2\Z\Z\Z\Z #3#4#5#6%
+{%
+ \xint_gob_til_W #6\XINT_mul_finish_a\W
+ \XINT_mul_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mul_compute #1#2#3\Z\Z\Z\Z
+{%
+ \expandafter\XINT_mul_main\expandafter
+ {\romannumeral0\expandafter
+ \XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
+ \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
+}%
+\def\XINT_mul_finish_a\W\XINT_mul_compute #1%
+{%
+ \XINT_mul_finish_b #1%
+}%
+\def\XINT_mul_finish_b #1#2#3#4%
+{%
+ \xint_gob_til_W
+ #1\XINT_mul_finish_c
+ #2\XINT_mul_finish_ci
+ #3\XINT_mul_finish_cii
+ \W\XINT_mul_finish_ciii #1#2#3#4%
+}%
+\def\XINT_mul_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
+{%
+ \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
+}%
+\def\XINT_mul_finish_cii
+ \W\XINT_mul_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
+{%
+ \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
+}%
+\def\XINT_mul_finish_ci #1\XINT_mul_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
+{%
+ \expandafter\XINT_addm_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
+}%
+\def\XINT_mul_finish_c #1\XINT_mul_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z
+{%
+ \expandafter\xint_cleanupzeros_andstop\romannumeral0\xintreverseorder{#2}%
+}%
+\def\XINT_mulr_enter #1\Z\Z\Z\Z #2#3#4#5%
+{%
+ \xint_gob_til_W #5\XINT_mulr_exit_a\W
+ \XINT_mulr_start {#2#3#4#5}#1\Z\Z\Z\Z
+}%
+\def\XINT_mulr_exit_a\W\XINT_mulr_start #1%
+{%
+ \XINT_mulr_exit_b #1%
+}%
+\def\XINT_mulr_exit_b #1#2#3#4%
+{%
+ \xint_gob_til_W
+ #2\XINT_mulr_exit_ci
+ #3\XINT_mulr_exit_cii
+ \W\XINT_mulr_exit_ciii #1#2#3#4%
+}%
+\def\XINT_mulr_exit_ciii #1\W #2\Z\Z\Z\Z \W\W\W
+{%
+ \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mulr_exit_cii\W\XINT_mulr_exit_ciii #1\W\W #2\Z\Z\Z\Z \W\W
+{%
+ \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mulr_exit_ci\W\XINT_mulr_exit_cii
+ \W\XINT_mulr_exit_ciii #1\W\W\W #2\Z\Z\Z\Z \W
+{%
+ \XINT_mul_Mr {#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mulr_start #1#2\Z\Z\Z\Z
+{%
+ \expandafter\XINT_mulr_main\expandafter
+ {\romannumeral0\XINT_mul_Mr {#1}#2\Z\Z\Z\Z}#2\Z\Z\Z\Z
+}%
+\def\XINT_mulr_main #1#2\Z\Z\Z\Z #3#4#5#6%
+{%
+ \xint_gob_til_W #6\XINT_mulr_finish_a\W
+ \XINT_mulr_compute {#3#4#5#6}{#1}#2\Z\Z\Z\Z
+}%
+\def\XINT_mulr_compute #1#2#3\Z\Z\Z\Z
+{%
+ \expandafter\XINT_mulr_main\expandafter
+ {\romannumeral0\expandafter
+ \XINT_mul_Ar\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z
+ \W\X\Y\Z 0000#2\W\X\Y\Z }#3\Z\Z\Z\Z
+}%
+\def\XINT_mulr_finish_a\W\XINT_mulr_compute #1%
+{%
+ \XINT_mulr_finish_b #1%
+}%
+\def\XINT_mulr_finish_b #1#2#3#4%
+{%
+ \xint_gob_til_W
+ #1\XINT_mulr_finish_c
+ #2\XINT_mulr_finish_ci
+ #3\XINT_mulr_finish_cii
+ \W\XINT_mulr_finish_ciii #1#2#3#4%
+}%
+\def\XINT_mulr_finish_ciii #1\W #2#3\Z\Z\Z\Z \W\W\W
+{%
+ \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 000#2\W\X\Y\Z
+}%
+\def\XINT_mulr_finish_cii
+ \W\XINT_mulr_finish_ciii #1\W\W #2#3\Z\Z\Z\Z \W\W
+{%
+ \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z \W\X\Y\Z 00#2\W\X\Y\Z
+}%
+\def\XINT_mulr_finish_ci #1\XINT_mulr_finish_ciii #2\W\W\W #3#4\Z\Z\Z\Z \W
+{%
+ \expandafter\XINT_addp_A\expandafter0\expandafter{\expandafter}%
+ \romannumeral0\XINT_mul_Mr {#2}#4\Z\Z\Z\Z \W\X\Y\Z 0#3\W\X\Y\Z
+}%
+\def\XINT_mulr_finish_c #1\XINT_mulr_finish_ciii \W\W\W\W #2#3\Z\Z\Z\Z { #2}%
+\def\xintiiSqr {\romannumeral0\xintiisqr }%
+\def\xintiisqr #1%
+{%
+ \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiiabs{#1}}%
+}%
+\def\xintiSqr {\romannumeral0\xintisqr }%
+\def\xintisqr #1%
+{%
+ \expandafter\XINT_sqr\expandafter {\romannumeral0\xintiabs{#1}}%
+}%
+\let\xintSqr\xintiSqr \let\xintsqr\xintisqr
+\def\XINT_sqr #1%
+{%
+ \expandafter\XINT_mul_enter
+ \romannumeral0%
+ \XINT_RQ {}#1\R\R\R\R\R\R\R\R\Z
+ \Z\Z\Z\Z #1\W\W\W\W
+}%
+\def\xintiiPow {\romannumeral0\xintiipow }%
+\def\xintiipow #1%
+{%
+ \expandafter\xint_pow\romannumeral-`0#1\Z%
+}%
+\def\xintiPow {\romannumeral0\xintipow }%
+\def\xintipow #1%
+{%
+ \expandafter\xint_pow\romannumeral0\xintnum{#1}\Z%
+}%
+\let\xintPow\xintiPow \let\xintpow\xintipow
+\def\xint_pow #1#2\Z
+{%
+ \xint_UDsignfork
+ #1\XINT_pow_Aneg
+ -\XINT_pow_Anonneg
+ \krof
+ #1{#2}%
+}%
+\def\XINT_pow_Aneg #1#2#3%
+{%
+ \expandafter\XINT_pow_Aneg_\expandafter{\the\numexpr #3}#2\Z
+}%
+\def\XINT_pow_Aneg_ #1%
+{%
+ \ifodd #1
+ \expandafter\XINT_pow_Aneg_Bodd
+ \fi
+ \XINT_pow_Anonneg_ {#1}%
+}%
+\def\XINT_pow_Aneg_Bodd #1%
+{%
+ \expandafter\XINT_opp\romannumeral0\XINT_pow_Anonneg_
+}%
+\def\XINT_pow_Anonneg #1#2#3%
+{%
+ \expandafter\XINT_pow_Anonneg_\expandafter {\the\numexpr #3}#1#2\Z
+}%
+\def\XINT_pow_Anonneg_ #1#2#3\Z
+{%
+ \if\relax #3\relax\xint_dothis
+ {\ifcase #2 \expandafter\XINT_pow_AisZero
+ \or\expandafter\XINT_pow_AisOne
+ \else\expandafter\XINT_pow_AatleastTwo
+ \fi }\fi
+ \xint_orthat \XINT_pow_AatleastTwo {#1}{#2#3}%
+}%
+\def\XINT_pow_AisOne #1#2{ 1}%
+\def\XINT_pow_AisZero #1#2%
+{%
+ \ifcase\XINT_cntSgn #1\Z
+ \xint_afterfi { 1}%
+ \or
+ \xint_afterfi { 0}%
+ \else
+ \xint_afterfi {\xintError:DivisionByZero\space 0}%
+ \fi
+}%
+\def\XINT_pow_AatleastTwo #1%
+{%
+ \ifcase\XINT_cntSgn #1\Z
+ \expandafter\XINT_pow_BisZero
+ \or
+ \expandafter\XINT_pow_checkBsize
+ \else
+ \expandafter\XINT_pow_BisNegative
+ \fi
+ {#1}%
+}%
+\edef\XINT_pow_BisNegative #1#2%
+ {\noexpand\xintError:FractionRoundedToZero\space 0}%
+\def\XINT_pow_BisZero #1#2{ 1}%
+\def\XINT_pow_checkBsize #1%
+{%
+ \ifnum #1>100000
+ \expandafter\XINT_pow_BtooBig
+ \else
+ \expandafter\XINT_pow_loopI
+ \fi
+ {#1}%
+}%
+\edef\XINT_pow_BtooBig #1#2{\noexpand\xintError:ExponentTooBig\space 0}%
+\def\XINT_pow_loopI #1%
+{%
+ \ifnum #1=\xint_c_i\XINT_pow_Iend\fi
+ \ifodd #1
+ \expandafter\XINT_pow_loopI_odd
+ \else
+ \expandafter\XINT_pow_loopI_even
+ \fi
+ {#1}%
+}%
+\edef\XINT_pow_Iend\fi #1\fi #2#3{\noexpand\fi\space #3}%
+\def\XINT_pow_loopI_even #1#2%
+{%
+ \expandafter\XINT_pow_loopI\expandafter
+ {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
+ {\romannumeral0\xintiisqr {#2}}%
+}%
+\def\XINT_pow_loopI_odd #1#2%
+{%
+ \expandafter\XINT_pow_loopI_odda\expandafter
+ {\romannumeral0\XINT_RQ {}#2\R\R\R\R\R\R\R\R\Z }{#1}{#2}%
+}%
+\def\XINT_pow_loopI_odda #1#2#3%
+{%
+ \expandafter\XINT_pow_loopII\expandafter
+ {\the\numexpr #2/\xint_c_ii-\xint_c_i\expandafter}\expandafter
+ {\romannumeral0\xintiisqr {#3}}{#1}%
+}%
+\def\XINT_pow_loopII #1%
+{%
+ \ifnum #1 = \xint_c_i\XINT_pow_IIend\fi
+ \ifodd #1
+ \expandafter\XINT_pow_loopII_odd
+ \else
+ \expandafter\XINT_pow_loopII_even
+ \fi
+ {#1}%
+}%
+\def\XINT_pow_loopII_even #1#2%
+{%
+ \expandafter\XINT_pow_loopII\expandafter
+ {\the\numexpr #1/\xint_c_ii\expandafter}\expandafter
+ {\romannumeral0\xintiisqr {#2}}%
+}%
+\def\XINT_pow_loopII_odd #1#2#3%
+{%
+ \expandafter\XINT_pow_loopII_odda\expandafter
+ {\romannumeral0\XINT_mulr_enter #3\Z\Z\Z\Z #2\W\W\W\W}{#1}{#2}%
+}%
+\def\XINT_pow_loopII_odda #1#2#3%
+{%
+ \expandafter\XINT_pow_loopII\expandafter
+ {\the\numexpr #2/\xint_c_ii-\xint_c_i\expandafter}\expandafter
+ {\romannumeral0\xintiisqr {#3}}{#1}%
+}%
+\def\XINT_pow_IIend\fi #1\fi #2#3#4%
+{%
+ \fi\XINT_mul_enter #4\Z\Z\Z\Z #3\W\W\W\W
+}%
+\def\xintiiQuo {\romannumeral0\xintiiquo }%
+\def\xintiiRem {\romannumeral0\xintiirem }%
+\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }%
+\def\xintiirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }%
+\def\xintiQuo {\romannumeral0\xintiquo }%
+\def\xintiRem {\romannumeral0\xintirem }%
+\def\xintiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }%
+\def\xintirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }%
+\let\xintQuo\xintiQuo\let\xintquo\xintiquo % deprecated (1.1)
+\let\xintRem\xintiRem\let\xintrem\xintirem % deprecated (1.1)
+\def\xintiDivision {\romannumeral0\xintidivision }%
+\def\xintidivision #1{\expandafter\XINT_division\romannumeral0\xintnum{#1}\Z }%
+\let\xintDivision\xintiDivision \let\xintdivision\xintidivision % deprecated
+\def\XINT_division #1#2\Z #3{\expandafter\XINT_iidivision_a\expandafter #1%
+ \romannumeral0\xintnum{#3}\Z #2\Z }%
+\def\xintiiDivision {\romannumeral0\xintiidivision }%
+\def\xintiidivision #1{\expandafter\XINT_iidivision \romannumeral-`0#1\Z }%
+\def\XINT_iidivision #1#2\Z #3{\expandafter\XINT_iidivision_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivision_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivision_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivision_aiszero\fi
+ \if-#2\xint_dothis{\expandafter\XINT_iidivision_bneg
+ \romannumeral0\XINT_iidivision_bpos #1}\fi
+ \xint_orthat{\XINT_iidivision_bpos #1#2}%
+}%
+\def\XINT_iidivision_divbyzero #1\Z #2\Z {\xintError:DivisionByZero\space {0}{0}}%
+\def\XINT_iidivision_aiszero #1\Z #2\Z { {0}{0}}%
+\def\XINT_iidivision_bneg #1% q->-q, r unchanged
+ {\expandafter\space\expandafter{\romannumeral0\XINT_opp #1}}%
+\def\XINT_iidivision_bpos #1%
+{%
+ \xint_UDsignfork
+ #1\XINT_iidivision_aneg
+ -{\XINT_iidivision_apos #1}%
+ \krof
+}%
+\def\XINT_iidivision_apos #1#2\Z #3\Z{\XINT_div_prepare {#2}{#1#3}}%
+\def\XINT_iidivision_aneg #1\Z #2\Z
+ {\expandafter
+ \XINT_iidivision_aneg_b\romannumeral0\XINT_div_prepare {#1}{#2}{#1}}%
+\def\XINT_iidivision_aneg_b #1#2{\if0\XINT_Sgn #2\Z
+ \expandafter\XINT_iidivision_aneg_rzero
+ \else
+ \expandafter\XINT_iidivision_aneg_rpos
+ \fi {#1}{#2}}%
+\def\XINT_iidivision_aneg_rzero #1#2#3{ {-#1}{0}}% necessarily q was >0
+\def\XINT_iidivision_aneg_rpos #1%
+{%
+ \expandafter\XINT_iidivision_aneg_end\expandafter
+ {\expandafter-\romannumeral0\xintinc {#1}}% q-> -(1+q)
+}%
+\def\XINT_iidivision_aneg_end #1#2#3%
+{%
+ \expandafter\xint_exchangetwo_keepbraces_thenstop
+ \expandafter{\romannumeral0\XINT_sub_pre {#3}{#2}}{#1}% r-> b-r
+}%
+\def\XINT_div_prepare #1%
+{%
+ \expandafter \XINT_div_prepareB_aa \expandafter
+ {\romannumeral0\xintlength {#1}}{#1}% B > 0 ici
+}%
+\def\XINT_div_prepareB_aa #1%
+{%
+ \ifnum #1=\xint_c_i
+ \expandafter\XINT_div_prepareB_onedigit
+ \else
+ \expandafter\XINT_div_prepareB_a
+ \fi
+ {#1}%
+}%
+\def\XINT_div_prepareB_a #1%
+{%
+ \expandafter\XINT_div_prepareB_c\expandafter
+ {\the\numexpr \xint_c_iv*((#1+\xint_c_i)/\xint_c_iv)}{#1}%
+}%
+\def\XINT_div_prepareB_onedigit #1#2%
+{%
+ \ifcase#2
+ \or\expandafter\XINT_div_BisOne
+ \or\expandafter\XINT_div_BisTwo
+ \else\expandafter\XINT_div_prepareB_e
+ \fi {000}{0}{4}{#2}%
+}%
+\def\XINT_div_BisOne #1#2#3#4#5{ {#5}{0}}%
+\def\XINT_div_BisTwo #1#2#3#4#5%
+{%
+ \expandafter\expandafter\expandafter\XINT_div_BisTwo_a
+ \ifodd\xintiiLDg{#5} \expandafter1\else \expandafter0\fi {#5}%
+}%
+\edef\XINT_div_BisTwo_a #1#2%
+{%
+ \noexpand\expandafter\space\noexpand\expandafter
+ {\noexpand\romannumeral0\noexpand\xinthalf {#2}}{#1}%
+}%
+\def\XINT_div_prepareB_c #1#2%
+{%
+ \csname XINT_div_prepareB_d\romannumeral\numexpr#1-#2\endcsname
+ {#1}%
+}%
+\def\XINT_div_prepareB_d {\XINT_div_prepareB_e {}{0000}}%
+\def\XINT_div_prepareB_di {\XINT_div_prepareB_e {0}{000}}%
+\def\XINT_div_prepareB_dii {\XINT_div_prepareB_e {00}{00}}%
+\def\XINT_div_prepareB_diii {\XINT_div_prepareB_e {000}{0}}%
+\def\XINT_div_cleanR #10000.{{#1}}%
+\def\XINT_div_prepareB_e #1#2#3#4%
+{%
+ \ifnum#3=\xint_c_iv\expandafter\XINT_div_prepareLittleB_f
+ \else\expandafter\XINT_div_prepareB_f
+ \fi
+ #4#1{#3}{#2}{#1}%
+}%
+\def\XINT_div_prepareB_f #1#2#3#4#5#{%
+ \expandafter\XINT_div_prepareB_g
+ \the\numexpr #1#2#3#4+\xint_c_i\expandafter
+ .\the\numexpr (#1#2#3#4+\xint_c_i)/\xint_c_ii\expandafter
+ .\romannumeral0\xintreverseorder {#1#2#3#4#5}.{#1#2#3#4}%
+}%
+\def\XINT_div_prepareLittleB_f #1#{%
+ \expandafter\XINT_div_prepareB_g \the\numexpr #1/\xint_c_ii.{}.{}.{#1}%
+}%
+\def\XINT_div_prepareB_g #1.#2.#3.#4#5#6#7#8%
+{%
+ \XINT_div_prepareA_a {#8#7}{#5}{{#1}{#2}{#4}}{#3}{#6}%
+}%
+\def\XINT_div_prepareA_a #1%
+{%
+ \expandafter\XINT_div_prepareA_b\expandafter
+ {\romannumeral0\xintlength {#1}}{#1}%
+}%
+\def\XINT_div_prepareA_b #1%
+{%
+ \expandafter\XINT_div_prepareA_c\expandafter
+ {\the\numexpr \xint_c_iv*((#1+\xint_c_i)/\xint_c_iv)}{#1}%
+}%
+\def\XINT_div_prepareA_c #1#2%
+{%
+ \csname XINT_div_prepareA_d\romannumeral\numexpr #1-#2\endcsname
+ {#1}%
+}%
+\def\XINT_div_prepareA_d {\XINT_div_prepareA_e {}}%
+\def\XINT_div_prepareA_di {\XINT_div_prepareA_e {0}}%
+\def\XINT_div_prepareA_dii {\XINT_div_prepareA_e {00}}%
+\def\XINT_div_prepareA_diii {\XINT_div_prepareA_e {000}}%
+\def\XINT_div_prepareA_e #1#2#3#4#5%
+{%
+ \XINT_div_start_a {#2}{#4}{#1#3}#5%
+}%
+\def\XINT_div_start_a #1#2%
+{%
+ \ifnum #2=\xint_c_iv \expandafter\XINT_div_little_b
+ \else
+ \ifnum #1 < #2
+ \expandafter\expandafter\expandafter\XINT_div_III_aa
+ \else
+ \expandafter\expandafter\expandafter\XINT_div_start_b
+ \fi
+ \fi
+ {#1}{#2}%
+}%
+\def\XINT_div_III_aa #1#2#3#4#5#6#7%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT_div_III_b\xint_cleanupzeros_nostop #3.{0000}%
+}%
+\def\XINT_div_III_b #1%
+{%
+ \if0#1%
+ \expandafter\XINT_div_III_bRzero
+ \else
+ \expandafter\XINT_div_III_bRpos
+ \fi
+ #1%
+}%
+\def\XINT_div_III_bRzero 0.#1#2%
+{%
+ \expandafter\space\expandafter
+ {\romannumeral0\XINT_cuz_loop #1\W\W\W\W\W\W\W\Z}{0}%
+}%
+\def\XINT_div_III_bRpos #1.#2#3%
+{%
+ \expandafter\XINT_div_III_c \XINT_div_cleanR #1#3.{#2}%
+}%
+\def\XINT_div_III_c #1#2%
+{%
+ \expandafter\space\expandafter
+ {\romannumeral0\XINT_cuz_loop #2\W\W\W\W\W\W\W\Z}{#1}%
+}%
+\def\XINT_div_start_b #1#2#3#4#5#6%
+{%
+ \XINT_div_start_c {#2}.#3.{#6}{{#1}{#2}{{#4}{#5}}{#6}}%
+}%
+\def\XINT_div_start_c #1#2.#3#4#5#6%
+{%
+ \ifnum #1=\xint_c_iv\XINT_div_start_ca\fi
+ \expandafter\XINT_div_start_c\expandafter
+ {\the\numexpr #1-\xint_c_iv}#2#3#4#5#6.%
+}%
+\def\XINT_div_start_ca\fi\expandafter\XINT_div_start_c\expandafter
+ #1#2#3#4#5{\fi\XINT_div_start_d {#2#3#4#5}#2#3#4#5}%
+\def\XINT_div_start_d #1#2.#3.#4#5#6%
+{%
+ \XINT_div_I_a {#1}{#4}{#2}{#6}{0000}#5{#3}{#6}{}%
+}%
+\def\XINT_div_I_a #1#2%
+{%
+ \expandafter\XINT_div_I_b\the\numexpr #1/#2.{#1}{#2}%
+}%
+\def\XINT_div_I_b #1%
+{%
+ \xint_gob_til_zero #1\XINT_div_I_czero 0\XINT_div_I_c #1%
+}%
+\def\XINT_div_I_czero 0%
+ \XINT_div_I_c 0.#1#2#3#4#5{\XINT_div_I_g {#5}{#3}}%
+\def\XINT_div_I_c #1.#2#3%
+{%
+ \expandafter\XINT_div_I_da\the\numexpr #2-#1*#3.#1.%
+}%
+\def\XINT_div_I_da #1.%
+{%
+ \ifnum #1>\xint_c_ix
+ \expandafter\XINT_div_I_dP
+ \else
+ \ifnum #1<\xint_c_
+ \expandafter\expandafter\expandafter\XINT_div_I_dN
+ \else
+ \expandafter\expandafter\expandafter\XINT_div_I_db
+ \fi
+ \fi
+}%
+\def\XINT_div_I_dN #1.%
+{%
+ \expandafter\XINT_div_I_dP\the\numexpr #1-\xint_c_i.%
+}%
+\def\XINT_div_I_db #1.#2#3% #1=q=un chiffre, #2=alpha, #3=B
+{%
+ \expandafter\XINT_div_I_dc\expandafter
+ {\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
+ {\romannumeral0\xintreverseorder{#2}}%
+ {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}%
+ #1{#2}{#3}%
+}%
+\def\XINT_div_I_dc #1#2%
+{%
+ \if-#1% s'arranger pour que si n\'egatif on ait renvoy\'e alpha=-.
+ \expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi
+ {\expandafter\XINT_div_I_dP\the\numexpr #2-\xint_c_i.}%
+ {\XINT_div_I_e {#1}#2}%
+}%
+\def\XINT_div_I_e #1#2#3#4#5%
+{%
+ \expandafter\XINT_div_I_f \the\numexpr \xint_c_x^iv+#2+#5{#1}%
+}%
+\def\XINT_div_I_dP #1.#2#3#4%
+{%
+ \expandafter \XINT_div_I_f \the\numexpr \xint_c_x^iv+#1+#4\expandafter
+ {\romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
+ {\romannumeral0\xintreverseorder{#2}}%
+ {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}%
+}%
+\def\XINT_div_I_f 1#1#2#3#4{\XINT_div_I_g {#1#2#3#4}}%
+\def\XINT_div_I_g #1#2#3#4#5#6#7#8#9%
+{%
+ \ifnum#3=#4
+ \expandafter\XINT_div_III_ab
+ \else
+ \expandafter\XINT_div_I_h
+ \fi
+ {#5}#2.#7.{{#5}{#6}{#4}{#3}}{#8}{#9#1}%
+}%
+\def\XINT_div_III_ab #1#2.#3.#4#5%
+{%
+ \expandafter\XINT_div_III_b
+ \romannumeral0\XINT_cuz_loop #2#3\W\W\W\W\W\W\W\Z.%
+}%
+\def\XINT_div_I_h #1.#2#3#4#5#6.#7#8%
+{%
+ \XINT_div_II_b #1#2#3#4#5.{#8}{#7}{#6}{#8}%
+}%
+\def\XINT_div_II_b #1#2#3#4#5#6#7#8#9%
+{%
+ \xint_gob_til_zeros_iv #2#3#4#5\XINT_div_II_skipc 0000%
+ \XINT_div_II_c #1{#2#3#4#5}{#6#7#8#9}%
+}%
+\def\XINT_div_II_skipc 0000\XINT_div_II_c #1#2#3#4#5.#6#7%
+{%
+ \XINT_div_II_k #7{#4#5}{#6}{0000}%
+}%
+\def\XINT_div_II_c #1#2#3#4%
+{%
+ \expandafter\XINT_div_II_d\the\numexpr (#3#4+#2)/#1+\xint_c_ixixixix\relax
+ {#1}{#2}#3#4%
+}%
+\def\XINT_div_II_d 1#1#2#3#4#5#6#7.#8%
+{%
+ \expandafter\XINT_div_II_e
+ \romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
+ {\romannumeral0\xintreverseorder{#7}}%
+ {\romannumeral0\XINT_mul_Mr {#1#2#3#4}#8\Z\Z\Z\Z }.%
+ {#5}{#6}{#8}{#1#2#3#4}%
+}%
+\def\XINT_div_II_e #1#2#3#4%
+{%
+ \xint_gob_til_zeros_iv #1#2#3#4\XINT_div_II_skipf 0000%
+ \XINT_div_II_f #1#2#3#4%
+}%
+\def\XINT_div_II_skipf 0000\XINT_div_II_f 0000#1.#2#3#4#5#6%
+{%
+ \XINT_div_II_k #6{#1}{#4}{#5}%
+}%
+\def\XINT_div_II_f #1#2#3#4#5#6#7#8#9.%
+{%
+ \XINT_div_II_fa {#1#2#3#4#5#6#7#8}{#1#2#3#4#5#6#7#8#9}%
+}%
+\def\XINT_div_II_fa #1#2#3#4%
+{%
+ \expandafter\XINT_div_II_g\expandafter
+ {\the\numexpr (#1+#4)/#3-\xint_c_i}{#2}%
+}%
+\def\XINT_div_II_g #1#2#3#4%
+{%
+ \expandafter \XINT_div_II_h
+ \the\numexpr #4+#1+\xint_c_x^iv\expandafter\expandafter\expandafter
+ {\expandafter\xint_gobble_iv
+ \romannumeral0\expandafter\XINT_div_sub_xpxp\expandafter
+ {\romannumeral0\xintreverseorder{#2}}%
+ {\romannumeral0\XINT_mul_Mr {#1}#3\Z\Z\Z\Z }}{#3}%
+}%
+\def\XINT_div_II_h 1#1#2#3#4#5#6#7%
+{%
+ \XINT_div_II_k #7{#5}{#6}{#1#2#3#4}%
+}%
+\def\XINT_div_II_k #1#2#3#4#5%
+{%
+ \expandafter\XINT_div_II_l \the\numexpr #4-\xint_c_iv.{#3}#1{#2}#5.%
+}%
+\def\XINT_div_II_l #1.#2#3#4#5#6#7#8#9%
+{%
+ \XINT_div_II_m {{#1}{#2}{{#3}{#4}}{#5}}{#5}{#6#7#8#9}#6#7#8#9%
+}%
+\def\XINT_div_II_m #1#2#3#4.#5#6%
+{%
+ \XINT_div_I_a {#3}{#2}{#4}{#5}{#6}#1%
+}%
+\def\XINT_div_little_b #1#2#3#4#5#6#7%
+{%
+ \XINT_div_little_c #3.{{#4}{#6}}{#1}%
+}%
+\def\XINT_div_little_c #1#2#3#4#5.#6#7%
+{%
+ \XINT_div_littleI_a {#1#2#3#4}#6{#7}{#5}%
+}%
+\def\XINT_div_littleI_a #1#2#3%
+{%
+ \expandafter\XINT_div_littleI_b
+ \the\numexpr (#1+#2)/#3-\xint_c_i{#1}{#2}{#3}%
+}%
+\def\XINT_div_littleI_b #1%
+{%
+ \xint_gob_til_zero #1\XINT_div_littleI_skip 0\XINT_div_littleI_c #1%
+}%
+\def\XINT_div_littleI_skip 0\XINT_div_littleI_c 0#1#2#3#4#5%
+ {\XINT_div_littleII_a {#4}{#1}#5.{{#2}{#3}}{0000}}%
+\def\XINT_div_littleI_c #1#2#3#4%
+{%
+ \expandafter\expandafter\expandafter\XINT_div_littleI_e
+ \expandafter\expandafter\expandafter
+ {\expandafter\xint_gobble_i\the\numexpr \xint_c_x^iv+#2-#1*#4}#1{{#3}{#4}}%
+}%
+\def\XINT_div_littleI_e #1#2#3#4#5%
+ {\XINT_div_littleII_a {#4}{#1}#5.{#3}{000#2}}%
+\def\XINT_div_littleII_a #1%
+{%
+ \ifnum#1=\xint_c_iv
+ \expandafter\XINT_div_littleIII_ab
+ \else
+ \expandafter\XINT_div_littleII_b
+ \fi {#1}%
+}%
+\def\XINT_div_littleIII_ab #1#2#3.#4%
+{%
+ \expandafter\XINT_div_III_b\the\numexpr #2#3.%
+}%
+\def\XINT_div_littleII_b #1%
+{%
+ \expandafter\XINT_div_littleII_c\expandafter {\the\numexpr #1-\xint_c_iv}%
+}%
+\def\XINT_div_littleII_c #1#2#3#4#5#6#7.#8%
+{%
+ \XINT_div_littleII_d {#2#3#4#5#6}#8{#1}{#7}%
+}%
+\def\XINT_div_littleII_d #1#2#3%
+{%
+ \expandafter\XINT_div_littleII_e\the\numexpr (#1+#2)/#3+\xint_c_ixixixix.%
+ {#1}{#2}{#3}%
+}%
+\def\XINT_div_littleII_e 1#1.#2#3#4%
+{%
+ \expandafter\expandafter\expandafter\XINT_div_littleII_f
+ \expandafter\xint_gobble_i\the\numexpr \xint_c_x^iv+#2-#1*#4.%
+ {#1}{{#3}{#4}}%
+}%
+\def\XINT_div_littleII_f #1.#2#3#4#5#6%
+{%
+ \XINT_div_littleII_a {#4}{#1}#5.{#3}{#6#2}%
+}%
+\def\XINT_div_sub_xpxp #1#2% #1=alpha d\'ej\`a renvers\'e, #2 se d\'eveloppe en qB
+{%
+ \expandafter\XINT_div_sub_xpxp_b #2\W\X\Y\Z #1\W\X\Y\Z
+}%
+\def\XINT_div_sub_xpxp_b
+{%
+ \XINT_div_sub_A 1{}%
+}%
+\def\XINT_div_sub_A #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_div_sub_az\W
+ \XINT_div_sub_B #1{#3#4#5#6}{#2}%
+}%
+\def\XINT_div_sub_B #1#2#3#4\W\X\Y\Z #5#6#7#8%
+{%
+ \xint_gob_til_W #5\xint_div_sub_bz\W
+ \XINT_div_sub_onestep #1#2{#8#7#6#5}{#3}#4\W\X\Y\Z
+}%
+\def\XINT_div_sub_onestep #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_div_sub_backtoA
+ \the\numexpr 11#6-#5#4#3#2+#1-\xint_c_i.%
+}%
+\def\XINT_div_sub_backtoA #1#2#3.#4%
+{%
+ \XINT_div_sub_A #2{#3#4}%
+}%
+\def\xint_div_sub_bz\W\XINT_div_sub_onestep #1\Z { -}%
+\def\xint_div_sub_az\W\XINT_div_sub_B #1#2{\XINT_div_sub_C #1}%
+\def\XINT_div_sub_C #1#2#3#4#5#6%
+{%
+ \xint_gob_til_W #3\xint_div_sub_cz\W
+ \XINT_div_sub_C_onestep #1{#6#5#4#3}{#2}%
+}%
+\def\XINT_div_sub_C_onestep #1#2%
+{%
+ \expandafter\XINT_div_sub_backtoC \the\numexpr 11#2+#1-\xint_c_i.%
+}%
+\def\XINT_div_sub_backtoC #1#2#3.#4%
+{%
+ \XINT_div_sub_C #2{#3#4}%
+}%
+\def\xint_div_sub_cz\W\XINT_div_sub_C_onestep #1#2%
+{%
+ \if#10% retenue
+ \expandafter\xint_div_sub_neg
+ \else\expandafter\xint_div_sub_ok
+ \fi
+}%
+\def\xint_div_sub_neg #1{ -}%
+\def\xint_div_sub_ok #1{ #1}%
+\def\xintiDivRound {\romannumeral0\xintidivround }%
+\def\xintidivround #1{\expandafter\XINT_iidivround\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiDivRound {\romannumeral0\xintiidivround }%
+\def\xintiidivround #1{\expandafter\XINT_iidivround \romannumeral-`0#1\Z }%
+\def\XINT_iidivround #1#2\Z #3{\expandafter\XINT_iidivround_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivround_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iidivround_bneg #1}\fi
+ \xint_orthat{\XINT_iidivround_bpos #1#2}%
+}%
+\def\XINT_iidivround_divbyzero #1\Z #2\Z {\xintError:DivisionByZero\space 0}%
+\def\XINT_iidivround_aiszero #1\Z #2\Z { 0}%
+\def\XINT_iidivround_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iidivround_pos {}}%
+ -{\XINT_iidivround_pos #1}%
+ \krof
+}%
+\def\XINT_iidivround_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\XINT_iidivround_pos {}}%
+ -{\xintiiopp\XINT_iidivround_pos #1}%
+ \krof
+}%
+\def\XINT_iidivround_pos #1#2\Z #3\Z{\expandafter\XINT_iidivround_pos_a
+ \romannumeral0\XINT_div_prepare {#2}{#1#30}}%
+\def\XINT_iidivround_pos_a #1#2{\xintReverseOrder {#1\XINT_iidivround_pos_b}\Z }%
+\def\XINT_iidivround_pos_b #1#2{\xint_gob_til_Z #2\XINT_iidivround_pos_small\Z
+ \XINT_iidivround_pos_c #1#2}%
+\def\XINT_iidivround_pos_c #1#2\Z {\ifnum #1>\xint_c_iv
+ \expandafter\XINT_iidivround_pos_up
+ \else \expandafter\xintreverseorder
+ \fi {#2}}%
+\def\XINT_iidivround_pos_up #1{\xintinc {\xintReverseOrder{#1}}}%
+\def\XINT_iidivround_pos_small\Z\XINT_iidivround_pos_c #1#2%
+ {\ifnum #1>\xint_c_iv\expandafter\xint_secondoftwo\else\expandafter
+ \xint_firstoftwo\fi { 0}{ 1}}%
+\def\xintiDivTrunc {\romannumeral0\xintidivtrunc }%
+\def\xintidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiDivTrunc {\romannumeral0\xintiidivtrunc }%
+\def\xintiidivtrunc #1{\expandafter\XINT_iidivtrunc \romannumeral-`0#1\Z }%
+\def\XINT_iidivtrunc #1#2\Z #3{\expandafter\XINT_iidivtrunc_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iidivtrunc_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iidivtrunc_bneg #1}\fi
+ \xint_orthat{\XINT_iidivtrunc_bpos #1#2}%
+}%
+\def\XINT_iidivtrunc_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iidivtrunc_pos {}}%
+ -{\XINT_iidivtrunc_pos #1}%
+ \krof
+}%
+\def\XINT_iidivtrunc_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\XINT_iidivtrunc_pos {}}%
+ -{\xintiiopp\XINT_iidivtrunc_pos #1}%
+ \krof
+}%
+\def\XINT_iidivtrunc_pos #1#2\Z #3\Z%
+ {\expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_div_prepare {#2}{#1#3}}%
+\def\xintiMod {\romannumeral0\xintimod }%
+\def\xintimod #1{\expandafter\XINT_iimod\romannumeral0\xintnum{#1}\Z }%
+\def\xintiiMod {\romannumeral0\xintiimod }%
+\def\xintiimod #1{\expandafter\XINT_iimod \romannumeral-`0#1\Z }%
+\def\XINT_iimod #1#2\Z #3{\expandafter\XINT_iimod_a\expandafter #1%
+ \romannumeral-`0#3\Z #2\Z }%
+\def\XINT_iimod_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_iidivround_divbyzero\fi
+ \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iimod_bneg #1}\fi
+ \xint_orthat{\XINT_iimod_bpos #1#2}%
+}%
+\def\XINT_iimod_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iimod_pos {}}%
+ -{\XINT_iimod_pos #1}%
+ \krof
+}%
+\def\XINT_iimod_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_iimod_pos {}}%
+ -{\XINT_iimod_pos #1}%
+ \krof
+}%
+\def\XINT_iimod_pos #1#2\Z #3\Z%
+ {\expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_div_prepare {#2}{#1#3}}%
+\def\xintDec {\romannumeral0\xintdec }%
+\def\xintdec #1%
+{%
+ \expandafter\XINT_dec\romannumeral-`0#1%
+ \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
+}%
+\def\XINT_dec #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_dec_zero
+ 0#1\XINT_dec_neg
+ 0-{\XINT_dec_pos #1}%
+ \krof
+}%
+\def\XINT_dec_zero #1\W\W\W\W\W\W\W\W { -1}%
+\def\XINT_dec_neg
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_inc_pos }%
+\def\XINT_dec_pos
+{%
+ \expandafter\XINT_dec_a \expandafter{\expandafter}%
+ \romannumeral0\XINT_OQ {}%
+}%
+\def\XINT_dec_a #1#2#3#4#5#6#7#8#9%
+{%
+ \expandafter\XINT_dec_b
+ \the\numexpr 11#9#8#7#6#5#4#3#2-\xint_c_i\relax {#1}%
+}%
+\def\XINT_dec_b 1#1%
+{%
+ \xint_gob_til_one #1\XINT_dec_A 1\XINT_dec_c
+}%
+\def\XINT_dec_c #1#2#3#4#5#6#7#8#9{\XINT_dec_a {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_dec_A 1\XINT_dec_c #1#2#3#4#5#6#7#8#9%
+ {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_dec_B #1#2\W\W\W\W\W\W\W\W
+{%
+ \expandafter\XINT_dec_cleanup
+ \romannumeral0\XINT_rord_main {}#2%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+ #1%
+}%
+\edef\XINT_dec_cleanup #1#2#3#4#5#6#7#8%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7#8\relax }%
+\def\xintInc {\romannumeral0\xintinc }%
+\def\xintinc #1%
+{%
+ \expandafter\XINT_inc\romannumeral-`0#1%
+ \R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W
+}%
+\def\XINT_inc #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_inc_zero
+ 0#1\XINT_inc_neg
+ 0-{\XINT_inc_pos #1}%
+ \krof
+}%
+\def\XINT_inc_zero #1\W\W\W\W\W\W\W\W { 1}%
+\def\XINT_inc_neg {\expandafter\XINT_opp\romannumeral0\XINT_dec_pos }%
+\def\XINT_inc_pos
+{%
+ \expandafter\XINT_inc_a \expandafter{\expandafter}%
+ \romannumeral0\XINT_OQ {}%
+}%
+\def\XINT_inc_a #1#2#3#4#5#6#7#8#9%
+{%
+ \xint_gob_til_W #9\XINT_inc_end\W
+ \expandafter\XINT_inc_b
+ \the\numexpr 10#9#8#7#6#5#4#3#2+\xint_c_i\relax {#1}%
+}%
+\def\XINT_inc_b 1#1%
+{%
+ \xint_gob_til_zero #1\XINT_inc_A 0\XINT_inc_c
+}%
+\def\XINT_inc_c #1#2#3#4#5#6#7#8#9{\XINT_inc_a {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_inc_A 0\XINT_inc_c #1#2#3#4#5#6#7#8#9%
+ {\XINT_dec_B {#1#2#3#4#5#6#7#8#9}}%
+\def\XINT_inc_end\W #1\relax #2{ 1#2}%
+\XINT_restorecatcodes_endinput%
+\endinput
+%%
+%% End of file `xintcore.sty'.
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 3f60831f485..a73c5736307 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintexpr: Expandable expression parser
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintexpr: Expandable expression parser
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,10 +36,10 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
- \let\z\endgroup
+ \def\z {\endgroup}%
\expandafter\let\expandafter\x\csname ver@xintexpr.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \expandafter\let\expandafter\t\csname ver@xinttools.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -53,287 +53,349 @@
\else
\ifx\x\relax % plain-TeX, first loading of xintexpr.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintexpr}{now issuing \string\input\space xintfrac.sty}%
- \def\z{\endgroup\input xintfrac.sty\relax}%
+ \expandafter\def\expandafter\z\expandafter
+ {\z\input xintfrac.sty\relax}%
+ \fi
+ \ifx\t\relax % but xinttools.sty not yet loaded.
+ \expandafter\def\expandafter\z\expandafter
+ {\z\input xinttools.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintexpr}{now issuing \string\RequirePackage{xintfrac}}%
- \def\z{\endgroup\RequirePackage{xintfrac}}%
+ \expandafter\def\expandafter\z\expandafter
+ {\z\RequirePackage{xintfrac}}%
+ \fi
+ \ifx\t\relax % xinttools.sty not yet loaded.
+ \expandafter\def\expandafter\z\expandafter
+ {\z\RequirePackage{xinttools}}%
\fi
\else
- \y{xintexpr}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintexpr already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintexpr}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintexpr}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2014/04/01 v1.09n Expandable expression parser (jfB)]%
-\def\xint_gob_til_! #1!{}% nota bene: this ! has catcode 11
-\expandafter\def\expandafter
-\XINT_expr_lock\expandafter#\expandafter1\expandafter !\expandafter
- {\expandafter\expandafter\space\csname .=#1\endcsname }%
+ [2014/10/28 v1.1 Expandable expression parser (jfB)]%
+\def\xint_gob_til_! #1!{}% this ! has catcode 11
+\edef\XINT_expr_lockscan#1!{\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
+\edef\XINT_expr_lockit #1{\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
+\def\XINT_expr_inintpart #1!{\XINT_num{#1}}%
+\def\XINT_expr_infracpart #1e#2!{#1![\the\numexpr#2-\xintLength{#1}]!}%
+\def\XINT_expr_inexppart e#1!{![\the\numexpr #1]!}%
\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }%
\def\XINT_expr_unlock_a #1.={}%
\def\XINT_expr_unexpectedtoken {\xintError:ignored }%
-\def\XINT_newexpr_setprefix #1>{\noexpand\romannumeral-`0}%
-\def\xint_UDxintrelaxfork #1\xint_relax #2#3\krof {#2}%
-\def\xint_protect {\noexpand\xint_protect\noexpand }% 1.09j
-\def\XINT_expr_done {!\XINT_expr_usethe\xint_protect\XINT_expr_print }%
-\let\XINT_iiexpr_done \XINT_expr_done
-\def\XINT_iexpr_done {!\XINT_expr_usethe\xint_protect\XINT_iexpr_print }%
-\def\XINT_flexpr_done {!\XINT_expr_usethe\xint_protect\XINT_flexpr_print }%
-\def\XINT_boolexpr_done {!\XINT_expr_usethe\xint_protect\XINT_boolexpr_print }%
-\protected\def\XINT_expr_usethe #1#2#3% modified in 1.09j
- {\xintError:missing_xintthe!\show#3missing xintthe (see log)!}%
-\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}%
-\let\XINT_expr_print \XINT_expr_unlock
-\def\XINT_iexpr_print #1{\xintRound:csv {\XINT_expr_unlock #1}}%
-\def\XINT_flexpr_print #1{\xintFloat:csv {\XINT_expr_unlock #1}}%
-\def\XINT_boolexpr_print #1{\xintIsTrue:csv{\XINT_expr_unlock #1}}%
+\let\XINT_expr_done\space
+\def\XINT_expr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_expr_print }%
+\def\XINT_iiexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_iiexpr_print }%
+\def\XINT_protectii #1{\noexpand\XINT_protectii\noexpand #1\noexpand }%
+\protected\def\XINT_expr_usethe\XINT_protectii {\xintError:missing_xintthe!}%
+\def\XINT_expr_print #1{\xintSPRaw::csv {\XINT_expr_unlock #1}}%
+\def\XINT_iiexpr_print #1{\xintCSV::csv {\XINT_expr_unlock #1}}%
+\def\XINT_boolexpr_print #1{\xintIsTrue::csv {\XINT_expr_unlock #1}}%
\def\xintexpr {\romannumeral0\xinteval }%
+\def\xintiexpr {\romannumeral0\xintieval }%
\def\xintfloatexpr {\romannumeral0\xintfloateval }%
\def\xintiiexpr {\romannumeral0\xintiieval }%
-\def\xinteval
- {\expandafter\XINT_expr_until_end_a \romannumeral-`0\XINT_expr_getnext }%
-\def\xintfloateval
- {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
-\def\xintiieval
- {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
\def\xinttheexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xinteval }%
-\def\xintthefloatexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintfloateval }%
+ {\romannumeral-`0\expandafter\XINT_expr_print\romannumeral0\xintbareeval }%
+\def\xinttheiexpr {\romannumeral-`0\xintthe\xintiexpr }%
+\def\xintthefloatexpr {\romannumeral-`0\xintthe\xintfloatexpr }%
\def\xinttheiiexpr
- {\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral0\xintiieval }%
-\def\xintiexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_iexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xinttheiexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_iexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
- \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
- \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
-\let\xintnumexpr \xintiexpr % deprecated
-\let\xintthenumexpr\xinttheiexpr % deprecated
-\def\xintifboolexpr #1%
- {\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
-\def\xintifboolfloatexpr #1%
- {\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
-\def\xintifbooliiexpr #1%
- {\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
-\def\XINT_expr_getnext
-{%
- \expandafter\XINT_expr_getnext_checkforbraced_a
- \romannumeral-`0\romannumeral-`0%
+ {\romannumeral-`0\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval }%
+\def\xintthe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}%
+\def\xintthecoords #1{\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_thecoords_a
+ \expandafter\xint_gobble_iii\romannumeral0#1}%
+\def\XINT_thecoords_a #1#2% #1=print macro, indispensible for scientific notation
+ {\expandafter\XINT_expr_unlock\csname.=\expandafter\XINT_thecoords_b
+ \romannumeral-`0#1#2,!,!,^\endcsname }%
+\def\XINT_thecoords_b #1#2,#3#4,%
+ {\xint_gob_til_! #3\XINT_thecoords_c ! (#1#2, #3#4)\XINT_thecoords_b }%
+\def\XINT_thecoords_c #1^{}%
+\def\xintbareeval
+ {\expandafter\XINT_expr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintbarefloateval
+ {\expandafter\XINT_flexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xintbareiieval
+ {\expandafter\XINT_iiexpr_until_end_a\romannumeral-`0\XINT_expr_getnext }%
+\def\xinteval {\expandafter\XINT_expr_wrap\romannumeral0\xintbareeval }%
+\def\xintiieval {\expandafter\XINT_iiexpr_wrap\romannumeral0\xintbareiieval }%
+\def\xintieval #1%
+ {\ifx [#1\expandafter\XINT_iexpr_withopt\else\expandafter\XINT_iexpr_noopt \fi #1}%
+\def\XINT_iexpr_noopt
+ {\expandafter\XINT_iexpr_wrap \expandafter 0\romannumeral0\xintbareeval }%
+\def\XINT_iexpr_withopt [#1]%
+{%
+ \expandafter\XINT_iexpr_wrap\expandafter
+ {\the\numexpr \xint_zapspaces #1 \xint_bye\xint_bye\expandafter}%
+ \romannumeral0\xintbareeval
+}%
+\def\XINT_iexpr_wrap #1#2%
+{%
+ \expandafter\XINT_expr_wrap
+ \csname .=\xintRound::csv {#1}{\XINT_expr_unlock #2}\endcsname
+}%
+\def\xintfloateval #1%
+{%
+ \ifx [#1\expandafter\XINT_flexpr_withopt_a\else\expandafter\XINT_flexpr_noopt
+ \fi #1%
}%
-\def\XINT_expr_getnext_checkforbraced_a #1% was done later in <1.09i
+\def\XINT_flexpr_noopt
{%
- \expandafter\XINT_expr_getnext_checkforbraced_b\expandafter
- {\romannumeral-`0#1}%
+ \expandafter\XINT_flexpr_withopt_b\expandafter\xinttheDigits
+ \romannumeral0\xintbarefloateval
}%
-\def\XINT_expr_getnext_checkforbraced_b #1%
+\def\XINT_flexpr_withopt_a [#1]%
{%
- \XINT_expr_getnext_checkforbraced_c #1\xint_relax\Z {#1}%
+ \expandafter\XINT_flexpr_withopt_b\expandafter
+ {\the\numexpr\xint_zapspaces #1 \xint_bye\xint_bye\expandafter}%
+ \romannumeral0\xintbarefloateval
}%
-\def\XINT_expr_getnext_checkforbraced_c #1#2%
+\def\XINT_flexpr_withopt_b #1#2%
{%
- \xint_UDxintrelaxfork
- #1\XINT_expr_getnext_wasemptyorspace
- #2\XINT_expr_getnext_gotonetoken_wehope
- \xint_relax\XINT_expr_getnext_gotbracedstuff
- \krof
-}% doubly braced things are not acceptable, will cause errors.
-\def\XINT_expr_getnext_wasemptyorspace #1{\XINT_expr_getnext }%
-\def\XINT_expr_getnext_gotbracedstuff #1\xint_relax\Z #2%
+ \expandafter\XINT_flexpr_wrap\csname .;#1.=% ; and not : as before b'cause NewExpr
+ \XINTinFloat::csv {#1}{\XINT_expr_unlock #2}\endcsname
+}%
+\def\XINT_flexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_flexpr_print }%
+\def\XINT_flexpr_print #1%
{%
- \expandafter\XINT_expr_getop\csname .=#2\endcsname
+ \expandafter\xintPFloat::csv
+ \romannumeral-`0\expandafter\XINT_expr_unlock_sp\string #1!%
}%
-\def\XINT_expr_getnext_gotonetoken_wehope\Z #1%
+\catcode`: 12
+ \def\XINT_expr_unlock_sp #1.;#2.=#3!{{#2}{#3}}%
+\catcode`: 11
+\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }%
+\def\xinttheboolexpr {\romannumeral-`0\expandafter\expandafter\expandafter
+ \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }%
+\def\XINT_boolexpr_done { !\XINT_expr_usethe\XINT_protectii\XINT_boolexpr_print }%
+\def\xintifboolexpr #1{\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}%
+\def\xintifboolfloatexpr #1{\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}%
+\def\xintifbooliiexpr #1{\romannumeral0\xintifnotzero {\xinttheiiexpr #1\relax}}%
+\def\XINT_::_end #1,#2{\xint_gobble_i #2}%
+\def\xintCSV::csv #1{\expandafter\XINT_csv::_a\romannumeral-`0#1,^,}%
+\def\XINT_csv::_a {\XINT_csv::_b {}}%
+\def\XINT_csv::_b #1#2,{\XINT_csv::_c #2,{#1}}%
+\def\XINT_csv::_c #1{\if ^#1\expandafter\XINT_::_end\fi\XINT_csv::_d #1}%
+\def\XINT_csv::_d #1,#2{\XINT_csv::_b {#2, #1}}% possibly, item #1 is empty.
+\def\xintSPRaw {\romannumeral0\xintspraw }%
+\def\xintspraw #1{\expandafter\XINT_spraw\romannumeral-`0#1[\W]}%
+\def\XINT_spraw #1[#2#3]{\xint_gob_til_W #2\XINT_spraw_a\W\XINT_spraw_p #1[#2#3]}%
+\def\XINT_spraw_a\W\XINT_spraw_p #1[\W]{ #1}%
+\def\XINT_spraw_p #1[\W]{\xintpraw {#1}}%
+\def\xintSPRaw::csv #1{\romannumeral0\expandafter\XINT_spraw::_a\romannumeral-`0#1,^,}%
+\def\XINT_spraw::_a {\XINT_spraw::_b {}}%
+\def\XINT_spraw::_b #1#2,{\XINT_spraw::_c #2,{#1}}%
+\def\XINT_spraw::_c #1{\if ,#1\xint_dothis\XINT_spraw::_e\fi
+ \if ^#1\xint_dothis\XINT_::_end\fi
+ \xint_orthat\XINT_spraw::_d #1}%
+\def\XINT_spraw::_d #1,{\expandafter\XINT_spraw::_e\romannumeral0\XINT_spraw #1[\W],}%
+\def\XINT_spraw::_e #1,#2{\XINT_spraw::_b {#2, #1}}%
+\def\xintIsTrue::csv #1{\romannumeral0\expandafter\XINT_istrue::_a\romannumeral-`0#1,^,}%
+\def\XINT_istrue::_a {\XINT_istrue::_b {}}%
+\def\XINT_istrue::_b #1#2,{\XINT_istrue::_c #2,{#1}}%
+\def\XINT_istrue::_c #1{\if ,#1\xint_dothis\XINT_istrue::_e\fi
+ \if ^#1\xint_dothis\XINT_::_end\fi
+ \xint_orthat\XINT_istrue::_d #1}%
+\def\XINT_istrue::_d #1,{\expandafter\XINT_istrue::_e\romannumeral0\xintisnotzero {#1},}%
+\def\XINT_istrue::_e #1,#2{\XINT_istrue::_b {#2, #1}}%
+\def\XINT_:::_end #1,#2#3{\xint_gobble_i #3}%
+\def\xintRound::csv #1#2{\romannumeral0\expandafter\XINT_round::_b\expandafter
+ {\the\numexpr#1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_round::_b #1#2#3,{\XINT_round::_c #3,{#1}{#2}}%
+\def\XINT_round::_c #1{\if ,#1\xint_dothis\XINT_round::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_round::_d #1}%
+\def\XINT_round::_d #1,#2{%
+ \expandafter\XINT_round::_e\romannumeral0\ifnum#2>\xint_c_
+ \expandafter\xintround\else\expandafter\xintiround\fi {#2}{#1},{#2}}%
+\def\XINT_round::_e #1,#2#3{\XINT_round::_b {#2}{#3, #1}}%
+\def\XINTinFloat::csv #1#2{\romannumeral0\expandafter\XINT_infloat::_b\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_infloat::_b #1#2#3,{\XINT_infloat::_c #3,{#1}{#2}}%
+\def\XINT_infloat::_c #1{\if ,#1\xint_dothis\XINT_infloat::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_infloat::_d #1}%
+\def\XINT_infloat::_d #1,#2%
+ {\expandafter\XINT_infloat::_e\romannumeral0\XINTinfloat [#2]{#1},{#2}}%
+\def\XINT_infloat::_e #1,#2#3{\XINT_infloat::_b {#2}{#3, #1}}%
+\def\xintPFloat::csv #1#2{\romannumeral0\expandafter\XINT_pfloat::_b\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral-`0#2,^,}%
+\def\XINT_pfloat::_b #1#2#3,{\XINT_pfloat::_c #3,{#1}{#2}}%
+\def\XINT_pfloat::_c #1{\if ,#1\xint_dothis\XINT_pfloat::_e\fi
+ \if ^#1\xint_dothis\XINT_:::_end\fi
+ \xint_orthat\XINT_pfloat::_d #1}%
+\def\XINT_pfloat::_d #1,#2%
+ {\expandafter\XINT_pfloat::_e\romannumeral0\XINT_pfloat_opt [\xint_relax #2]{#1},{#2}}%
+\def\XINT_pfloat::_e #1,#2#3{\XINT_pfloat::_b {#2}{#3, #1}}%
+\def\XINT_expr_getnext #1%
+{%
+ \expandafter\XINT_expr_getnext_a\romannumeral-`0#1%
+}%
+\def\XINT_expr_getnext_a #1%
{% screens out sub-expressions and \count or \dimen registers/variables
\xint_gob_til_! #1\XINT_expr_subexpr !% recall this ! has catcode 11
\ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs
- \expandafter\XINT_expr_countdimenetc_fork
+ \expandafter\XINT_expr_countetc
\else
- \expandafter\expandafter\expandafter
- \XINT_expr_getnext_onetoken_fork\expandafter\string
+ \expandafter\expandafter\expandafter\XINT_expr_getnextfork\expandafter\string
\fi
#1%
}%
\def\XINT_expr_subexpr !#1\fi !{\expandafter\XINT_expr_getop\xint_gobble_iii }%
-\def\XINT_expr_countdimenetc_fork #1%
+\def\XINT_expr_countetc #1%
{%
\ifx\count#1\else\ifx#1\dimen\else\ifx#1\numexpr\else\ifx#1\dimexpr\else
- \ifx\skip#1\else\ifx\glueexpr#1\else
- \XINT_expr_unpackvariable
- \fi\fi\fi\fi\fi\fi
+ \ifx\skip#1\else\ifx\glueexpr#1\else\ifx\fontdimen#1\else
+ \XINT_expr_unpackvar
+ \fi\fi\fi\fi\fi\fi\fi
\expandafter\XINT_expr_getnext\number #1%
}%
-\def\XINT_expr_unpackvariable\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext
- \number #1{\fi\fi\fi\fi\fi\fi
- \expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
+\def\XINT_expr_unpackvar\fi\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getnext\number #1%
+ {\fi\fi\fi\fi\fi\fi\fi\expandafter\XINT_expr_getop\csname .=\number#1\endcsname }%
\begingroup
\lccode`*=`#
\lowercase{\endgroup
-\def\XINT_expr_sixwayfork #1(-.+*#2#3\krof {#2}%
-\def\XINT_expr_getnext_onetoken_fork #1%
-{% The * is in truth catcode 12 #. For (hacking) use with \xintNewExpr.
- \XINT_expr_sixwayfork
- #1-.+*{\xint_c_xviii ({}}% back to until for oparen triggering
- (#1.+*{-}%
- (-#1+*{\XINT_expr_scandec_II .}%
- (-.#1*{\XINT_expr_getnext }%
- (-.+#1{\XINT_expr_scandec_II }%
- (-.+*{\XINT_expr_scan_dec_or_func #1}%
- \krof
+\def\XINT_expr_getnextfork #1{%
+ \if#1*\xint_dothis {\XINT_expr_scan_macropar *}\fi
+ \if#1[\xint_dothis {\xint_c_xviii ({}}\fi
+ \if#1+\xint_dothis \XINT_expr_getnext \fi
+ \if#1.\xint_dothis {\XINT_expr_scandec_II\XINT_expr_infracpart}\fi
+ \if#1-\xint_dothis -\fi
+ \if#1(\xint_dothis {\xint_c_xviii ({}}\fi
+ \xint_orthat {\XINT_expr_scan_nbr_or_func #1}%
}}%
-\def\XINT_expr_scan_dec_or_func #1% this #1 has necessarily here catcode 12
+\def\XINT_expr_scan_macropar #1#2{\expandafter\XINT_expr_getop\csname .=#1#2\endcsname }%
+\catcode96 11 % `
+\def\XINT_expr_scan_nbr_or_func #1% this #1 has necessarily here catcode 12
{%
- \ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scandec_I
- \else
- \if #1"\expandafter\expandafter\expandafter\XINT_expr_scanhex_I
- \else % We assume we are dealing with a function name!!
- \expandafter\expandafter\expandafter\XINT_expr_scanfunc
- \fi
- \fi #1%
+ \if "#1\xint_dothis \XINT_expr_scanhex_I\fi
+ \if `#1\xint_dothis {\XINT_expr_onlitteral_`}\fi
+ \ifnum \xint_c_ix<1#1 \xint_dothis \XINT_expr_scandec_I\fi
+ \xint_orthat \XINT_expr_scanfunc #1%
}%
-\def\XINT_expr_scanfunc
+\catcode96 12 % `
+\def\XINT_expr_scandec_I
{%
- \expandafter\XINT_expr_func\romannumeral-`0\XINT_expr_scanfunc_c
+ \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
+ \XINT_expr_lockscan\romannumeral0\expandafter\XINT_expr_inintpart
+ \romannumeral-`0\XINT_expr_scanintpart_b
}%
-\def\XINT_expr_scanfunc_c #1%
+\def\XINT_expr_scandec_II
{%
- \expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanfunc_a\romannumeral-`0\romannumeral-`0%
+ \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
+ \XINT_expr_lockscan\romannumeral0\expandafter\XINT_expr_inintpart
+ \romannumeral-`0\XINT_expr_scanfracpart_b
+}%
+\def\XINT_expr_scanintpart_a #1%
+{% careful that ! has catcode letter here
+ \ifcat \relax #1\xint_dothis{!!#1}\fi % stops the scan
+ \if e#1\xint_dothis{\expandafter\XINT_expr_inexppart
+ \romannumeral-`0\XINT_expr_scanexppart_a e}\fi
+ \if E#1\xint_dothis{\expandafter\XINT_expr_inexppart
+ \romannumeral-`0\XINT_expr_scanexppart_a e}\fi
+ % \if @#1\xint_dothis{!*#1}\fi % tacit multiplication later
+ % \if _#1\xint_dothis{!*#1}\fi % tacit multiplication for variables
+ \ifcat a#1\xint_dothis{!!*#1}\fi % includes subexpressions (#1=! letter)
+ \xint_orthat {\expandafter\XINT_expr_scanintpart_aa\string #1}%
}%
-\def\XINT_expr_scanfunc_a #1% please no braced things here!
+\def\XINT_expr_scanintpart_aa #1%
{%
- \ifcat #1\relax % missing opening parenthesis, probably
- \expandafter\XINT_expr_scanfunc_panic
- \else
- \xint_afterfi{\expandafter\XINT_expr_scanfunc_b \string #1}%
- \fi
+ \if .#1\xint_dothis\XINT_expr_scandec_transition\fi
+ \ifnum \xint_c_ix<1#1 \xint_dothis\XINT_expr_scanintpart_b\fi
+ \xint_orthat {!!}#1%
}%
-\def\xint_UDparenfork #1()#2#3\krof {#2}%
-\def\XINT_expr_scanfunc_b #1%
+\def\XINT_expr_scanintpart_b #1#2%
{%
- \xint_UDparenfork
- #1){(}% and then \XINT_expr_func
- (#1{(}% and then \XINT_expr_func (this is for bool/toggle names)
- (){\XINT_expr_scanfunc_c #1}%
- \krof
+ \expandafter #1\romannumeral-`0\expandafter
+ \XINT_expr_scanintpart_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scanfunc_panic {\xintError:bigtroubleahead(0\relax }%
-\def\XINT_expr_func #1(% common to expr and flexpr and iiexpr
+\def\XINT_expr_scandec_transition .#1%
{%
- \xint_c_xviii @{#1}% functions have the highest priority.
+ \expandafter\XINT_expr_scandec_trans_a\romannumeral-`0#1%
}%
-\def\XINT_expr_scandec_I
+\def\XINT_expr_scandec_trans_a #1%
{%
- \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\romannumeral-`0\XINT_expr_scanintpart_b
+ \if .#1\xint_dothis{!!..}\fi
+ \xint_orthat {\expandafter\XINT_expr_infracpart
+ \romannumeral-`0\XINT_expr_scanfracpart_a #1}%
}%
-\def\XINT_expr_scandec_II
+\def\XINT_expr_scanfracpart_a #1%
{%
- \expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b
-}%
-\def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN}
-{% careful that ! has catcode letter here
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo !% this stops the scan
- {\expandafter\XINT_expr_scanintpart_aa\string }#1%
+ \ifcat \relax #1\xint_dothis{e!#1}\fi % stops the scan
+ \if e#1\xint_dothis{\XINT_expr_scanexppart_a e}\fi
+ \if E#1\xint_dothis{\XINT_expr_scanexppart_a e}\fi
+ \ifcat a#1\xint_dothis{e!*#1}\fi % and also the case of subexpressions (!)
+ \xint_orthat {\expandafter\XINT_expr_scanfracpart_aa\string #1}%
}%
-\def\XINT_expr_scanintpart_aa #1%
+\def\XINT_expr_scanfracpart_aa #1%
{%
\ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scanintpart_b
+ \expandafter\XINT_expr_scanfracpart_b
\else
- \if .#1%
- \expandafter\expandafter\expandafter
- \XINT_expr_scandec_transition
- \else % gather what we got so far, leave catcode 12 #1 in stream
- \expandafter\expandafter\expandafter !% ! of catcode 11, space needed
- \fi
+ \xint_afterfi {e!}%
\fi
#1%
}%
-\def\XINT_expr_scanintpart_b #1%
+\def\XINT_expr_scanfracpart_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanintpart_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanfracpart_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scandec_transition .%
+\def\XINT_expr_scanexppart_a #1#2%
{%
- \expandafter.\romannumeral-`0\expandafter
- \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0%
+ \expandafter #1\romannumeral-`0\expandafter
+ \XINT_expr_scanexppart_b\romannumeral-`0#2%
}%
-\def\XINT_expr_scanfracpart_a #1%
+\def\XINT_expr_scanexppart_b #1%
{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo !% this stops the scan
- {\expandafter\XINT_expr_scanfracpart_aa\string }#1%
+ \ifcat \relax #1\xint_dothis{0!#1}\fi % stops the scan (incorrect syntax)
+ \ifcat a#1\xint_dothis{0!*#1}\fi % idem
+ \if +#1\xint_dothis {\XINT_expr_scanexppart_a +}\fi
+ \if -#1\xint_dothis {\XINT_expr_scanexppart_a -}\fi
+ \xint_orthat {\expandafter\XINT_expr_scanexppart_c\string #1}%
}%
-\def\XINT_expr_scanfracpart_aa #1%
+\def\XINT_expr_scanexppart_c #1%
{%
\ifnum \xint_c_ix<1#1
- \expandafter\XINT_expr_scanfracpart_b
+ \expandafter\XINT_expr_scanexppart_d
\else
\expandafter !%
\fi
#1%
}%
-\def\XINT_expr_scanfracpart_b #1%
+\def\XINT_expr_scanexppart_d #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanexppart_e\romannumeral-`0#2%
+}%
+\def\XINT_expr_scanexppart_e #1%
+{%
+ \ifcat \relax #1\xint_dothis{!#1}\fi % stops the scan
+ \ifcat a#1\xint_dothis{!*#1}\fi % idem
+ \xint_orthat {\expandafter\XINT_expr_scanexppart_f\string #1}%
+}%
+\def\XINT_expr_scanexppart_f #1%
+{%
+ \ifnum \xint_c_ix<1#1
+ \expandafter\XINT_expr_scanexppart_d
+ \else
+ \expandafter !%
+ \fi
+ #1%
}%
\def\XINT_expr_scanhex_I #1%
{%
\expandafter\XINT_expr_getop\romannumeral-`0\expandafter
- \XINT_expr_lock\expandafter\XINT_expr_inhex
+ \XINT_expr_lockscan\expandafter\XINT_expr_inhex
\romannumeral-`0\XINT_expr_scanhexI_a
}%
\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname
@@ -346,13 +408,9 @@
}%
\def\XINT_expr_scanhexI_a #1%
{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo {.I;!}%
- {\expandafter\XINT_expr_scanhexI_aa\string }#1%
+ \ifcat #1\relax\xint_dothis{.I;!#1}\fi
+ \ifx !#1\xint_dothis{.I;!*!}\fi % tacit multiplication
+ \xint_orthat {\expandafter\XINT_expr_scanhexI_aa\string #1}%
}%
\def\XINT_expr_scanhexI_aa #1%
{%
@@ -373,25 +431,21 @@
\fi
#1%
}%
-\def\XINT_expr_scanhexI_b #1%
+\def\XINT_expr_scanhexI_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanhexI_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexI_a\romannumeral-`0#2%
}%
-\def\XINT_expr_scanhex_transition .%
+\def\XINT_expr_scanhex_transition .#1%
{%
\expandafter.\expandafter.\romannumeral-`0\expandafter
- \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexII_a\romannumeral-`0#1%
}%
\def\XINT_expr_scanhexII_a #1%
{%
- \ifcat #1\relax\else
- \ifx !#1\else
- \expandafter\expandafter\expandafter
- \xint_thirdofthree
- \fi\fi
- \xint_firstoftwo {;!}% this stops the scan
- {\expandafter\XINT_expr_scanhexII_aa\string }#1%
+ \ifcat #1\relax\xint_dothis{;!#1}\fi
+ \ifx !#1\xint_dothis{;!*!}\fi % tacit multiplication
+ \xint_orthat {\expandafter\XINT_expr_scanhexII_aa\string #1}%
}%
\def\XINT_expr_scanhexII_aa #1%
{%
@@ -406,47 +460,104 @@
\fi
#1%
}%
-\def\XINT_expr_scanhexII_b #1%
+\def\XINT_expr_scanhexII_b #1#2%
{%
\expandafter #1\romannumeral-`0\expandafter
- \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0%
+ \XINT_expr_scanhexII_a\romannumeral-`0#2%
+}%
+\def\XINT_expr_scanfunc
+{%
+ \expandafter\XINT_expr_func\romannumeral-`0\XINT_expr_scanfunc_a
+}%
+\def\XINT_expr_scanfunc_a #1#2%
+{%
+ \expandafter #1\romannumeral-`0\expandafter\XINT_expr_scanfunc_b\romannumeral-`0#2%
+}%
+\def\XINT_expr_scanfunc_b #1%
+{%
+ \ifx !#1\xint_dothis{\xint_firstoftwo{(_*!}}\fi
+ \ifcat \relax#1\xint_dothis{(_}\fi
+ \if (#1\xint_dothis{\xint_firstoftwo{(`}}\fi
+ \if _#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \if @#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \ifnum \xint_c_ix<1\string#1 \xint_dothis \XINT_expr_scanfunc_a \fi
+ \ifcat a#1\xint_dothis \XINT_expr_scanfunc_a \fi
+ \xint_orthat {(_}%
+ #1%
}%
-\def\XINT_expr_getop #1% this #1 is the current locked computed value
-{% full expansion of next token, first swallowing a possible space
- \expandafter\XINT_expr_getop_a\expandafter #1%
- \romannumeral-`0\romannumeral-`0%
+\def\XINT_expr_func #1(#2%
+{% #2=` pour une fonction, #2=_ pour une variable
+ \if #2`\ifcsname XINT_expr_var_#1\endcsname
+ \expandafter\expandafter\expandafter\xint_thirdofthree
+ \fi\fi
+ \xint_firstoftwo {\xint_c_xviii #2{#1}}{\xint_c_xviii _{#1}*(}%
}%
+\def\XINT_expr_getop #1#2% this #1 is the current locked computed value
+{%
+ \expandafter\XINT_expr_getop_a\expandafter #1\romannumeral-`0#2%
+}%
+\catcode`* 11
\def\XINT_expr_getop_a #1#2%
-{% if a control sequence is found, must be either \relax or register|variable
- \ifcat #2\relax\expandafter\xint_firstoftwo
- \else \expandafter\xint_secondoftwo
- \fi
- {\ifx #2\relax\expandafter\xint_firstofthree
- \else\expandafter\xint_secondofthree % tacit multiplication
- \fi }%
- {\ifx !#2\expandafter\xint_secondofthree % tacit multiplication
- \else % 1.09k adds tacit multiplication in front of (
- \if (#2\expandafter\expandafter\expandafter\xint_secondofthree
- \else
- \expandafter\expandafter\expandafter\xint_thirdofthree
- \fi
- \fi }%
+{%
+ \ifx \relax #2\xint_dothis\xint_firstofthree\fi
+ \ifcat \relax #2\xint_dothis\xint_secondofthree\fi
+ \if _#2\xint_dothis \xint_secondofthree\fi
+ \if @#2\xint_dothis \xint_secondofthree\fi
+ \if (#2\xint_dothis \xint_secondofthree\fi
+ \ifx !#2\xint_dothis \xint_secondofthree\fi
+ \xint_orthat \xint_thirdofthree
{\XINT_expr_foundend #1}%
- {\XINT_expr_foundop *#1#2}%
- {\XINT_expr_foundop #2#1}%
+ {\XINT_expr_precedence_* *#1#2}% tacit multiplication
+ {\XINT_expr_getop_b #2#1}%
}%
+\catcode`* 12
\def\XINT_expr_foundend {\xint_c_ \relax }% \relax is a place holder here.
-\def\XINT_expr_foundop #1% then becomes <prec> <op> and is followed by <\.=f>
-{% 1.09a: no control sequence \XINT_expr_op_#1, code common to expr/flexpr
+\def\XINT_expr_getop_b #1%
+{% ? and : a special syntax in \xintexpr as they are
+ % followed by braced arguments, and thus we must intercept them here.
+ % I wanted to change this but now I don't have time to think about it.
+ % 1.1 removes : as logic operator. Replaced by ??.
+ \if '#1\xint_dothis{\XINT_expr_binopwrd }\fi
+ \if ?#1\xint_dothis{\XINT_expr_precedence_? ?}\fi
+ \xint_orthat {\XINT_expr_scanop_a #1}%
+}%
+\def\XINT_expr_binopwrd #1#2'{\expandafter\XINT_expr_foundop_a
+ \csname XINT_expr_itself_\xint_zapspaces #2 \xint_bye\xint_bye\endcsname #1}%
+\def\XINT_expr_scanop_a #1#2#3%
+ {\expandafter\XINT_expr_scanop_b\expandafter #1\expandafter #2\romannumeral-`0#3}%
+\def\XINT_expr_scanop_b #1#2#3%
+{%
+ \ifcat#3\relax\xint_dothis{\XINT_expr_foundop_a #1#2#3}\fi
+ \ifcsname XINT_expr_itself_#1#3\endcsname
+ \xint_dothis
+ {\expandafter\XINT_expr_scanop_c\csname XINT_expr_itself_#1#3\endcsname #2}\fi
+ \xint_orthat {\XINT_expr_foundop_a #1#2#3}%
+}%
+\def\XINT_expr_scanop_c #1#2#3%
+{%
+ \expandafter\XINT_expr_scanop_d\expandafter #1\expandafter #2\romannumeral-`0#3%
+}%
+\def\XINT_expr_scanop_d #1#2#3%
+{%
+ \ifcat#3\relax \xint_dothis{\XINT_expr_foundop #1#2#3}\fi
+ \ifcsname XINT_expr_itself_#1#3\endcsname
+ \xint_dothis
+ {\expandafter\XINT_expr_scanop_c\csname XINT_expr_itself_#1#3\endcsname #2}\fi
+ \xint_orthat {\csname XINT_expr_precedence_#1\endcsname #1#2#3}%
+}%
+\def\XINT_expr_foundop_a #1%
+{%
\ifcsname XINT_expr_precedence_#1\endcsname
- \expandafter\xint_afterfi\expandafter
- {\csname XINT_expr_precedence_#1\endcsname #1}%
+ \csname XINT_expr_precedence_#1\expandafter\endcsname
+ \expandafter #1%
\else
- \XINT_expr_unexpectedtoken
- \expandafter\XINT_expr_getop
+ \xint_afterfi{\XINT_expr_unknown_operator {#1}\XINT_expr_getop}%
\fi
}%
-\def\XINT_tmpa #1#2#3#4#5%
+\def\XINT_expr_unknown_operator #1{\xintError:removed \xint_gobble_i {#1}}%
+\def\XINT_expr_foundop #1{\csname XINT_expr_precedence_#1\endcsname #1}%
+\catcode`) 11
+\def\XINT_tmpa #1#2#3#4% (avant #4#5)
{%
\def#1##1%
{%
@@ -457,44 +568,46 @@
}%
\def#2##1##2%
{%
- \ifcase ##1\expandafter #4%
- \or\xint_afterfi{%
- \XINT_expr_extra_closing_paren
- \expandafter #1\romannumeral-`0\XINT_expr_getop
- }%
+ \ifcase ##1\xint_afterfi
+ {\ifx\XINT_expr_itself_^C ##2\xint_dothis
+ {\expandafter#1\romannumeral-`0\expandafter\XINT_expr_getnext\xint_gobble_i}\fi
+ \xint_orthat \XINT_expr_done }%
+ \or\xint_afterfi{\XINT_expr_extra_)
+ \expandafter #1\romannumeral-`0\XINT_expr_getop }%
\else
- \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#5_op_##2\endcsname }%
+ \xint_afterfi{\expandafter#1\romannumeral-`0\csname XINT_#4_op_##2\endcsname }%
\fi
}%
}%
+\def\XINT_expr_extra_) {\xintError:removed }%
\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+ \expandafter\XINT_tmpa
\csname XINT_#1_until_end_a\expandafter\endcsname
\csname XINT_#1_until_end_b\expandafter\endcsname
- \csname XINT_#1_op_-vi\expandafter\endcsname
- \csname XINT_#1_done\endcsname
+ \csname XINT_#1_op_-vi\endcsname
{#1}%
}%
-\def\XINT_expr_extra_closing_paren {\xintError:removed }%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
- \def #1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
- \let #2#1%
+ \def #1##1{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
+ \def #2{\expandafter #3\romannumeral-`0\XINT_expr_getnext }%
\def #3##1{\xint_UDsignfork
##1{\expandafter #3\romannumeral-`0#5}%
-{#4##1}%
\krof }%
- \def #4##1##2%
- {%
- \ifcase ##1\expandafter \XINT_expr_missing_cparen
- \or \expandafter \XINT_expr_getop
- \else \xint_afterfi
- {\expandafter #3\romannumeral-`0\csname XINT_#6_op_##2\endcsname }%
- \fi
+ \def #4##1##2{\ifcase ##1%
+ \xint_afterfi{\ifx\XINT_expr_itself_^C ##2\xint_dothis{\xint_c_ ##2}\fi
+ \xint_orthat\XINT_expr_missing_) }%
+ \or \csname XINT_#6_op_##2\expandafter\endcsname
+ \else
+ \xint_afterfi{\expandafter #3\romannumeral-`0\csname XINT_#6_op_##2\endcsname }%
+ \fi
}%
}%
+\def\XINT_expr_missing_) {\xintError:inserted \xint_c_ \XINT_expr_done }%
+\catcode`) 12
\xintFor #1 in {expr,flexpr,iiexpr} \do {%
-\expandafter\XINT_tmpa
+ \expandafter\XINT_tmpa
\csname XINT_#1_op_(\expandafter\endcsname
\csname XINT_#1_oparen\expandafter\endcsname
\csname XINT_#1_until_)_a\expandafter\endcsname
@@ -502,100 +615,529 @@
\csname XINT_#1_op_-vi\endcsname
{#1}%
}%
-\def\XINT_expr_missing_cparen {\xintError:inserted \xint_c_ \XINT_expr_done }%
-\expandafter\let\csname XINT_expr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_flexpr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_iiexpr_precedence_)\endcsname \xint_c_i
-\expandafter\let\csname XINT_expr_op_)\endcsname \XINT_expr_getop
-\expandafter\let\csname XINT_flexpr_op_)\endcsname\XINT_expr_getop
-\expandafter\let\csname XINT_iiexpr_op_)\endcsname\XINT_expr_getop
-\def\XINT_tmpb #1#2#3#4#5#6%#7%
-{%
- \expandafter\XINT_tmpc
- \csname XINT_#1_op_#3\expandafter\endcsname
- \csname XINT_#1_until_#3_a\expandafter\endcsname
- \csname XINT_#1_until_#3_b\expandafter\endcsname
- \csname XINT_#1_op_-#5\expandafter\endcsname
- \csname xint_c_#4\expandafter\endcsname
- \csname #2#6\expandafter\endcsname
- \csname XINT_expr_precedence_#3\endcsname {#1}%{#7}%
-}%
-\def\XINT_tmpc #1#2#3#4#5#6#7#8#9%
-{%
- \def #1##1% \XINT_expr_op_<op>
- {% keep value, get next number and operator, then do until
- \expandafter #2\expandafter ##1%
- \romannumeral-`0\expandafter\XINT_expr_getnext
- }%
- \def #2##1##2% \XINT_expr_until_<op>_a
- {\xint_UDsignfork
- ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
- -{#3##1##2}%
- \krof }%
- \def #3##1##2##3##4% \XINT_expr_until_<op>_b
- {% either execute next operation now, or first do next (possibly unary)
- \ifnum ##2>#5%
- \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
- \csname XINT_#8_op_##3\endcsname {##4}}%
- \else
- \xint_afterfi
- {\expandafter ##2\expandafter ##3%
- \csname .=#6#9{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
- \fi
- }%
- \let #7#5%
+\expandafter\let\csname XINT_expr_precedence_)\endcsname\xint_c_i
+\expandafter\let\csname XINT_expr_precedence_]\endcsname\xint_c_i
+\expandafter\let\csname XINT_expr_precedence_;\endcsname\xint_c_i
+\let\XINT_expr_precedence_a \xint_c_xviii
+\expandafter\let\csname XINT_expr_precedence_^C\endcsname \xint_c_
+\expandafter\let\csname XINT_expr_precedence_++)\endcsname \xint_c_i
+\catcode`. 11 \catcode`= 11 \catcode`+ 11
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_)\endcsname \XINT_expr_getop
+ \expandafter\let\csname XINT_#1_op_;\endcsname \space
+ \expandafter\def\csname XINT_#1_op_]\endcsname ##1{\XINT_expr_getop ##1a}%
+ \expandafter\let\csname XINT_#1_op_a\endcsname \XINT_expr_getop
+ \expandafter\def\csname XINT_#1_op_++)\endcsname ##1##2\relax
+ {\expandafter\XINT_expr_foundend \expandafter
+ {\expandafter\.=+\xintiCeil{\XINT_expr_unlock ##1}}}%
+}%
+\catcode`. 12 \catcode`= 12 \catcode`+ 12
+\xintFor* #1 in {{==}{<=}{>=}{!=}{&&}{||}{**}{//}{/:}{..}{..[}{].}{]..}%
+ {+[}{-[}{*[}{/[}{**[}{^[}{a+}{a-}{a*}{a/}{a**}{a^}%
+ {][}{][:}{:]}{^C}{++}{++)}}
+ \do {\expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}}%
+\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+{%
+ \def #1##1% \XINT_expr_op_<op> ou flexpr ou iiexpr
+ {% keep value, get next number and operator, then do until
+ \expandafter #2\expandafter ##1%
+ \romannumeral-`0\expandafter\XINT_expr_getnext }%
+ \def #2##1##2% \XINT_expr_until_<op>_a ou flexpr ou iiexpr
+ {\xint_UDsignfork ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_<op>_b ou flexpr ou iiexpr
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#5%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#8_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=#6{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname }%
+ \fi }%
+ \let #7#5%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1{}}%
+\def\XINT_tmpb #1#2#3#4#5#6%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#3\expandafter\endcsname
+ \csname XINT_#1_until_#3_a\expandafter\endcsname
+ \csname XINT_#1_until_#3_b\expandafter\endcsname
+ \csname XINT_#1_op_-#5\expandafter\endcsname
+ \csname xint_c_#4\expandafter\endcsname
+ \csname #2#6\expandafter\endcsname
+ \csname XINT_expr_precedence_#3\endcsname {#1}%
+}%
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \def\XINT_tmpa ##1{\XINT_tmpb {#1}{xint}##1}%
+ \xintApplyInline {\XINT_tmpa }{%
+ {|{iii}{vi}{OR}}%
+ {&{iv}{vi}{AND}}%
+ {{xor}{iii}{vi}{XOR}}%
+ {<{v}{vi}{Lt}}%
+ {>{v}{vi}{Gt}}%
+ {={v}{vi}{Eq}}%
+ {{<=}{v}{vi}{LtorEq}}%
+ {{>=}{v}{vi}{GtorEq}}%
+ {{!=}{v}{vi}{Neq}}%
+ {{..}{iii}{vi}{Seq::csv}}% will get redefined to use \xintiiSeq::csv in xintiiexpr
+ {{//}{vii}{vii}{DivTrunc}}% will get redefined for xintiiexpr
+ {{/:}{vii}{vii}{Mod}}%
+ }%
+}%
+\def\XINT_tmpa #1{\XINT_tmpb {expr}{xint}#1}%
\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
{*{vii}{vii}{Mul}}%
{/{vii}{vii}{Div}}%
{^{viii}{viii}{Pow}}%
- {e{ix}{ix}{fE}}%
- {E{ix}{ix}{fE}}%
+ {{..[}{iii}{vi}{SeqA::csv}}%
+ {{]..}{iii}{vi}{SeqB::csv}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{xint}#1{}}%
-\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
-}%
-\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1{[\XINTdigits]}}%
+\def\XINT_tmpa #1{\XINT_tmpb {flexpr}{XINTinFloat}#1}%
\xintApplyInline {\XINT_tmpa }{%
{+{vi}{vi}{Add}}%
{-{vi}{vi}{Sub}}%
{*{vii}{vii}{Mul}}%
{/{vii}{vii}{Div}}%
{^{viii}{viii}{Power}}%
- {e{ix}{ix}{fE}}%
- {E{ix}{ix}{fE}}%
+ {{..[}{iii}{vi}{SeqA::csv}}%
+ {{]..}{iii}{vi}{SeqB::csv}}%
}%
-\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1{}}%
+\def\XINT_tmpa #1{\XINT_tmpb {iiexpr}{xint}#1}%
\xintApplyInline {\XINT_tmpa }{%
- {|{iii}{vi}{OR}}%
- {&{iv}{vi}{AND}}%
- {<{v}{vi}{Lt}}%
- {>{v}{vi}{Gt}}%
- {={v}{vi}{Eq}}%
{+{vi}{vi}{iiAdd}}%
{-{vi}{vi}{iiSub}}%
{*{vii}{vii}{iiMul}}%
- {/{vii}{vii}{iiQuo}}%
+ {/{vii}{vii}{iiDivRound}}% CHANGED IN 1.1! PREVIOUSLY DID EUCLIDEAN QUOTIENT
{^{viii}{viii}{iiPow}}%
- {e{ix}{ix}{iE}}%
- {E{ix}{ix}{iE}}%
+ {{..[}{iii}{vi}{iiSeqA::csv}}%
+ {{]..}{iii}{vi}{iiSeqB::csv}}%
+ {{..}{iii}{vi}{iiSeq::csv}}%
+ {{//}{vii}{vii}{iiDivTrunc}}%
+ {{/:}{vii}{vii}{iiMod}}%
+}%
+\def\XINT_expr_binop_inline_a
+ {\expandafter\xint_gobble_i\romannumeral-`0\XINT_expr_binop_inline_b }%
+\def\XINT_expr_binop_inline_b #1#2,{\XINT_expr_binop_inline_c #2,{#1}}%
+\def\XINT_expr_binop_inline_c #1{%
+ \if ,#1\xint_dothis\XINT_expr_binop_inline_e\fi
+ \if ^#1\xint_dothis\XINT_expr_binop_inline_end\fi
+ \xint_orthat\XINT_expr_binop_inline_d #1}%
+\def\XINT_expr_binop_inline_d #1,#2{,#2{#1}\XINT_expr_binop_inline_b {#2}}%
+\def\XINT_expr_binop_inline_e #1,#2{,\XINT_expr_binop_inline_b {#2}}%
+\def\XINT_expr_binop_inline_end #1,#2{}%
+\def\XINT_tmpc #1#2#3#4#5#6#7#8%
+{%
+ \def #1##1% \XINT_expr_op_<op> ou flexpr ou iiexpr
+ {% keep value, get next number and operator, then do until
+ \expandafter #2\expandafter ##1%
+ \romannumeral-`0\expandafter\XINT_expr_getnext }%
+ \def #2##1##2% \XINT_expr_until_<op>_a ou flexpr ou iiexpr
+ {\xint_UDsignfork ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_<op>_b ou flexpr ou iiexpr
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#5%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#8_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=\expandafter\XINT_expr_binop_inline_a\expandafter
+ {\expandafter\expandafter\expandafter#6\expandafter
+ \xint_exchangetwo_keepbraces\expandafter
+ {\expandafter\XINT_expr_unlock\expandafter ##4\expandafter}\expandafter}%
+ \romannumeral-`0\XINT_expr_unlock ##1,^,\endcsname }%
+ \fi }%
+ \let #7#5%
+}%
+\def\XINT_tmpb #1#2#3#4%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#2\expandafter\endcsname
+ \csname XINT_#1_until_#2_a\expandafter\endcsname
+ \csname XINT_#1_until_#2_b\expandafter\endcsname
+ \csname XINT_#1_op_-#3\expandafter\endcsname
+ \csname xint_c_#3\expandafter\endcsname
+ \csname #4\expandafter\endcsname
+ \csname XINT_expr_precedence_#2\endcsname {#1}%
+}%
+\xintApplyInline {\expandafter\XINT_tmpb \xint_firstofone}{%
+ {{expr}{a+}{vi}{xintAdd}}%
+ {{expr}{a-}{vi}{xintSub}}%
+ {{expr}{a*}{vii}{xintMul}}%
+ {{expr}{a/}{vii}{xintDiv}}%
+ {{expr}{a^}{viii}{xintPow}}%
+ {{iiexpr}{a+}{vi}{xintiiAdd}}%
+ {{iiexpr}{a-}{vi}{xintiiSub}}%
+ {{iiexpr}{a*}{vii}{xintiiMul}}%
+ {{iiexpr}{a/}{vii}{xintiiDivRound}}%
+ {{iiexpr}{a^}{viii}{xintiiPow}}%
+ {{flexpr}{a+}{vi}{XINTinFloatAdd}}%
+ {{flexpr}{a-}{vi}{XINTinFloatSub}}%
+ {{flexpr}{a*}{vii}{XINTinFloatMul}}%
+ {{flexpr}{a/}{vii}{XINTinFloatDiv}}%
+ {{flexpr}{a^}{viii}{XINTinFloatPower}}%
+}%
+\def\XINT_tmpc #1#2#3#4#5#6#7%
+{%
+ \def #1##1{\expandafter#2\expandafter##1\romannumeral-`0%
+ \expandafter #3\romannumeral-`0\XINT_expr_getnext }%
+ \def #2##1##2##3##4%
+ {% either execute next operation now, or first do next (possibly unary)
+ \ifnum ##2>#4%
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#7_op_##3\endcsname {##4}}%
+ \else \xint_afterfi {\expandafter ##2\expandafter ##3%
+ \csname .=\expandafter\XINT_expr_binop_inline_a\expandafter
+ {\expandafter#5\expandafter
+ {\expandafter\XINT_expr_unlock\expandafter ##1\expandafter}\expandafter}%
+ \romannumeral-`0\XINT_expr_unlock ##4,^,\endcsname }%
+ \fi }%
+ \let #6#4%
+}%
+\def\XINT_tmpb #1#2#3#4%
+{%
+ \expandafter\XINT_tmpc
+ \csname XINT_#1_op_#2\expandafter\endcsname
+ \csname XINT_#1_until_#2\expandafter\endcsname
+ \csname XINT_#1_until_)_a\expandafter\endcsname
+ \csname xint_c_#3\expandafter\endcsname
+ \csname #4\expandafter\endcsname
+ \csname XINT_expr_precedence_#2\endcsname {#1}%
+}%
+\xintApplyInline {\expandafter\XINT_tmpb\xint_firstofone }{%
+ {{expr}{+[}{vi}{xintAdd}}%
+ {{expr}{-[}{vi}{xintSub}}%
+ {{expr}{*[}{vii}{xintMul}}%
+ {{expr}{/[}{vii}{xintDiv}}%
+ {{expr}{^[}{viii}{xintPow}}%
+ {{iiexpr}{+[}{vi}{xintiiAdd}}%
+ {{iiexpr}{-[}{vi}{xintiiSub}}%
+ {{iiexpr}{*[}{vii}{xintiiMul}}%
+ {{iiexpr}{/[}{vii}{xintiiDivRound}}%
+ {{iiexpr}{^[}{viii}{xintiiPow}}%
+ {{flexpr}{+[}{vi}{XINTinFloatAdd}}%
+ {{flexpr}{-[}{vi}{XINTinFloatSub}}%
+ {{flexpr}{*[}{vii}{XINTinFloatMul}}%
+ {{flexpr}{/[}{vii}{XINTinFloatDiv}}%
+ {{flexpr}{^[}{viii}{XINTinFloatPower}}%
+}%
+\xintFor #1 in {and,or,xor,mod} \do {%
+ \expandafter\def\csname XINT_expr_itself_#1\endcsname {#1}}%
+\expandafter\let\csname XINT_expr_precedence_and\expandafter\endcsname
+ \csname XINT_expr_precedence_&\endcsname
+\expandafter\let\csname XINT_expr_precedence_or\expandafter\endcsname
+ \csname XINT_expr_precedence_|\endcsname
+\expandafter\let\csname XINT_expr_precedence_mod\expandafter\endcsname
+ \csname XINT_expr_precedence_/:\endcsname
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_and\expandafter\endcsname
+ \csname XINT_#1_op_&\endcsname
+ \expandafter\let\csname XINT_#1_op_or\expandafter\endcsname
+ \csname XINT_#1_op_|\endcsname
+ \expandafter\let\csname XINT_#1_op_mod\expandafter\endcsname
+ \csname XINT_#1_op_/:\endcsname
+}%
+\expandafter\let\csname XINT_expr_precedence_==\expandafter\endcsname
+ \csname XINT_expr_precedence_=\endcsname
+\expandafter\let\csname XINT_expr_precedence_&&\expandafter\endcsname
+ \csname XINT_expr_precedence_&\endcsname
+\expandafter\let\csname XINT_expr_precedence_||\expandafter\endcsname
+ \csname XINT_expr_precedence_|\endcsname
+\expandafter\let\csname XINT_expr_precedence_**\expandafter\endcsname
+ \csname XINT_expr_precedence_^\endcsname
+\expandafter\let\csname XINT_expr_precedence_a**\expandafter\endcsname
+ \csname XINT_expr_precedence_a^\endcsname
+\expandafter\let\csname XINT_expr_precedence_**[\expandafter\endcsname
+ \csname XINT_expr_precedence_^[\endcsname
+\xintFor #1 in {expr, flexpr, iiexpr} \do {%
+ \expandafter\let\csname XINT_#1_op_==\expandafter\endcsname
+ \csname XINT_#1_op_=\endcsname
+ \expandafter\let\csname XINT_#1_op_&&\expandafter\endcsname
+ \csname XINT_#1_op_&\endcsname
+ \expandafter\let\csname XINT_#1_op_||\expandafter\endcsname
+ \csname XINT_#1_op_|\endcsname
+ \expandafter\let\csname XINT_#1_op_**\expandafter\endcsname
+ \csname XINT_#1_op_^\endcsname
+ \expandafter\let\csname XINT_#1_op_a**\expandafter\endcsname
+ \csname XINT_#1_op_a^\endcsname
+ \expandafter\let\csname XINT_#1_op_**[\expandafter\endcsname
+ \csname XINT_#1_op_^[\endcsname
}%
\def\XINT_tmpa #1#2#3#4#5#6%
{%
- \def #1##1% \XINT_expr_op_,_a
+ \def #1##1% \XINT_expr_op_][
+ {%
+ \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
+ }%
+ \def #2##1##2% \XINT_expr_until_][_a
+ {\xint_UDsignfork
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_][_b
+ {%
+ \ifnum ##2>\xint_c_ii
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#6_op_##3\endcsname {##4}}%
+ \else
+ \xint_afterfi
+ {\expandafter ##2\expandafter ##3\csname
+ .=\expandafter\xintListSel:csv \romannumeral-`0\XINT_expr_unlock ##4;%
+ \XINT_expr_unlock ##1;\endcsname % unlock for \xintNewExpr
+ }%
+ \fi
+ }%
+ \let #5\xint_c_ii
+}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+\expandafter\XINT_tmpa
+ \csname XINT_#1_op_][\expandafter\endcsname
+ \csname XINT_#1_until_][_a\expandafter\endcsname
+ \csname XINT_#1_until_][_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_][\endcsname {#1}%
+}%
+\def\XINT_tmpa #1#2#3#4#5#6%
+{%
+ \def #1##1% \XINT_expr_op_:
+ {%
+ \expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
+ }%
+ \def #2##1##2% \XINT_expr_until_:_a
+ {\xint_UDsignfork
+ ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}%
+ -{#3##1##2}%
+ \krof }%
+ \def #3##1##2##3##4% \XINT_expr_until_:_b
+ {%
+ \ifnum ##2>\xint_c_iii
+ \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0%
+ \csname XINT_#6_op_##3\endcsname {##4}}%
+ \else
+ \xint_afterfi
+ {\expandafter ##2\expandafter ##3\csname
+ .=:\xintiiifSgn{\XINT_expr_unlock ##1}NPP.% : and dots for expansion
+ \xintiiifSgn{\XINT_expr_unlock ##4}NPP.% in \xintNewExpr context
+ \xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}\endcsname
+ }%
+ \fi
+ }%
+ \let #5\xint_c_iii
+}%
+\xintFor #1 in {expr,flexpr,iiexpr} \do {%
+\expandafter\XINT_tmpa
+ \csname XINT_#1_op_:\expandafter\endcsname
+ \csname XINT_#1_until_:_a\expandafter\endcsname
+ \csname XINT_#1_until_:_b\expandafter\endcsname
+ \csname XINT_#1_op_-vi\expandafter\endcsname
+ \csname XINT_expr_precedence_:\endcsname {#1}%
+}%
+\catcode`[ 11 \catcode`] 11
+\let\XINT_expr_precedence_:] \xint_c_iii
+\def\XINT_expr_op_:] #1{\expandafter\xint_c_i\expandafter )%
+ \csname .=]\xintiiifSgn{\XINT_expr_unlock #1}npp\XINT_expr_unlock #1\endcsname }%
+\let\XINT_flexpr_op_:] \XINT_expr_op_:]
+\let\XINT_iiexpr_op_:] \XINT_expr_op_:]
+\let\XINT_expr_precedence_][: \xint_c_iii
+\edef\XINT_expr_op_][: #1{\xint_c_ii \expandafter\noexpand
+ \csname XINT_expr_itself_][\endcsname #10\string :}%
+\let\XINT_flexpr_op_][: \XINT_expr_op_][:
+\let\XINT_iiexpr_op_][: \XINT_expr_op_][:
+\catcode`[ 12 \catcode`] 12
+\def\xintListSel:csv #1{% these complications are due to \xintNewExpr matters
+ \if ]\noexpand#1\xint_dothis{\expandafter\XINT_listsel:_s\romannumeral-`0}\fi
+ \if :\noexpand#1\xint_dothis{\XINT_listsel:_:}\fi
+ \xint_orthat {\XINT_listsel:_nth #1}%
+}%
+\def\XINT_listsel:_s #1{\if p#1\expandafter\XINT_listsel:_trim\else
+ \expandafter\XINT_listsel:_keep\fi }%
+\def\XINT_listsel:_: #1.#2.{\csname XINT_listsel:_#1#2\endcsname }%
+\def\XINT_listsel:_trim #1;#2;%
+ {\xintListWithSep,{\xintTrim {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}}%
+\def\XINT_listsel:_keep #1;#2;%
+ {\xintListWithSep,{\xintKeep {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}}%
+\def\XINT_listsel:_nth#1;#2;%
+ {\xintNthElt {\xintNum{#1}}{\xintCSVtoListNonStripped{#2}}}%
+\def\XINT_listsel:_PP #1;#2;#3;%
+ {\xintListWithSep,%
+ {\xintTrim {\xintNum{#1}}%
+ {\xintKeep {\xintNum{#2}}%
+ {\xintCSVtoListNonStripped{#3}}%
+ }%
+ }%
+ }%
+\def\XINT_listsel:_NN #1;#2;#3;%
+ {\xintListWithSep,%
+ {\xintTrim {\xintNum{#2}}%
+ {\xintKeep {\xintNum{#1}}%
+ {\xintCSVtoListNonStripped{#3}}%
+ }%
+ }%
+ }%
+\def\XINT_listsel:_NP #1;#2;#3;%
+ {\expandafter\XINT_listsel:_NP_a \the\numexpr #1+%
+ \xintNthElt{0}{\xintCSVtoListNonStripped{#3}};#2;#3;}%
+\def\XINT_listsel:_NP_a #1#2;{\if -#1\expandafter\XINT_listsel:_OP\fi
+ \XINT_listsel:_PP #1#2;}%
+\def\XINT_listsel:_OP\XINT_listsel:_PP #1;{\XINT_listsel:_PP 0;}%
+\def\XINT_listsel:_PN #1;#2;#3;%
+ {\expandafter\XINT_listsel:_PN_a \the\numexpr #2+%
+ \xintNthElt{0}{\xintCSVtoListNonStripped{#3}};#1;#3;}%
+\def\XINT_listsel:_PN_a #1#2;#3;{\if -#1\expandafter\XINT_listsel:_PO\fi
+ \XINT_listsel:_PP #3;#1#2;}%
+\def\XINT_listsel:_PO\XINT_listsel:_PP #1;#2;{\XINT_listsel:_PP #1;0;}%
+\def\xintSeq::csv {\romannumeral0\xintseq::csv }%
+\def\xintseq::csv #1#2%
+{%
+ \expandafter\XINT_seq::csv\expandafter
+ {\the\numexpr \xintiCeil{#1}\expandafter}\expandafter
+ {\the\numexpr \xintiFloor{#2}}%
+}%
+\def\XINT_seq::csv #1#2%
+{%
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
+ \expandafter\XINT_seq::csv_z
+ \or
+ \expandafter\XINT_seq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_n
+ \fi
+ {#2}{#1}%
+}%
+\def\XINT_seq::csv_z #1#2{ #1/1[0]}%
+\def\XINT_seq::csv_p #1#2%
+{%
+ \ifnum #1>#2
+ \expandafter\expandafter\expandafter\XINT_seq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1-\xint_c_i}{#2},#1/1[0]%
+}%
+\def\XINT_seq::csv_n #1#2%
+{%
+ \ifnum #1<#2
+ \expandafter\expandafter\expandafter\XINT_seq::csv_n
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1+\xint_c_i}{#2},#1/1[0]%
+}%
+\def\XINT_seq::csv_e #1,{ }%
+\def\xintiiSeq::csv {\romannumeral0\xintiiseq::csv }%
+\def\xintiiseq::csv #1#2%
+{%
+ \expandafter\XINT_iiseq::csv\expandafter
+ {\the\numexpr #1\expandafter}\expandafter{\the\numexpr #2}%
+}%
+\def\XINT_iiseq::csv #1#2%
+{%
+ \ifcase\ifnum #1=#2 0\else\ifnum #2>#1 1\else -1\fi\fi\space
+ \expandafter\XINT_iiseq::csv_z
+ \or
+ \expandafter\XINT_iiseq::csv_p
+ \else
+ \expandafter\XINT_iiseq::csv_n
+ \fi
+ {#2}{#1}%
+}%
+\def\XINT_iiseq::csv_z #1#2{ #1}%
+\def\XINT_iiseq::csv_p #1#2%
+{%
+ \ifnum #1>#2
+ \expandafter\expandafter\expandafter\XINT_iiseq::csv_p
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1-\xint_c_i}{#2},#1%
+}%
+\def\XINT_iiseq::csv_n #1#2%
+{%
+ \ifnum #1<#2
+ \expandafter\expandafter\expandafter\XINT_iiseq::csv_n
+ \else
+ \expandafter\XINT_seq::csv_e
+ \fi
+ \expandafter{\the\numexpr #1+\xint_c_i}{#2},#1%
+}%
+\def\XINT_seq::csv_e #1,{ }%
+\def\xintSeqA::csv #1%
+ {\expandafter\XINT_seqa::csv\expandafter{\romannumeral0\xintraw {#1}}}%
+\def\XINT_seqa::csv #1#2{\expandafter\XINT_seqa::csv_a \romannumeral0\xintraw {#2};#1;}%
+\def\xintiiSeqA::csv #1#2{\XINT_iiseqa::csv #1#2}%
+\def\XINT_iiseqa::csv #1#2#3#4{\expandafter\XINT_seqa::csv_a
+ \romannumeral-`0\expandafter \XINT_expr_unlock\expandafter#4%
+ \expandafter;\romannumeral-`0\XINT_expr_unlock #2;}%
+\def\XINTinFloatSeqA::csv #1{\expandafter\XINT_flseqa::csv\expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#1}}}%
+\def\XINT_flseqa::csv #1#2%
+ {\expandafter\XINT_seqa::csv_a\romannumeral0\XINTinfloat [\XINTdigits]{#2};#1;}%
+\def\XINT_seqa::csv_a #1{\xint_UDzerominusfork
+ #1-{z}%
+ 0#1{n}%
+ 0-{p}%
+ \krof #1}%
+\def\xintSeqB::csv #1#2%
+ {\expandafter\XINT_seqb::csv \expandafter{\romannumeral0\xintraw{#2}}{#1}}%
+\def\XINT_seqb::csv #1#2{\expandafter\XINT_seqb::csv_a\romannumeral-`0#2#1!}%
+\def\XINT_seqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral0\csname XINT_seqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_seqb::csv_p #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{,#1\expandafter\XINT_seqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+ {\romannumeral0\xintadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_seqb::csv_n #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_seqb::csv_n\expandafter}%
+ {\romannumeral0\xintadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_seqb::csv_z #1#2#3{,#1}%
+\def\xintiiSeqB::csv #1#2{\XINT_iiseqb::csv #1#2}%
+\def\XINT_iiseqb::csv #1#2#3#4%
+ {\expandafter\XINT_iiseqb::csv_a
+ \romannumeral-`0\expandafter \XINT_expr_unlock\expandafter#2%
+ \romannumeral-`0\XINT_expr_unlock #4!}%
+\def\XINT_iiseqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral-`0\csname XINT_iiseqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_iiseqb::csv_p #1#2#3%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}{,#1\expandafter\XINT_iiseqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+ {\romannumeral0\xintiiadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_iiseqb::csv_n #1#2#3%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_iiseqb::csv_n\expandafter}%
+ {\romannumeral0\xintiiadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_iiseqb::csv_z #1#2#3{,#1}%
+\def\XINTinFloatSeqB::csv #1#2{\expandafter\XINT_flseqb::csv \expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#2}}{#1}}%
+\def\XINT_flseqb::csv #1#2{\expandafter\XINT_flseqb::csv_a\romannumeral-`0#2#1!}%
+\def\XINT_flseqb::csv_a #1#2;#3;#4!{\expandafter\XINT_expr_seq_empty?
+ \romannumeral-`0\csname XINT_flseqb::csv_#1\endcsname {#3}{#4}{#2}}%
+\def\XINT_flseqb::csv_p #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{,#1\expandafter\XINT_flseqb::csv_p\expandafter}%
+ {,#1\xint_gobble_iii}{\xint_gobble_iii}%
+ {\romannumeral0\XINTinfloatadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_flseqb::csv_n #1#2#3%
+{%
+ \xintifCmp {#1}{#2}{\xint_gobble_iii}{,#1\xint_gobble_iii}%
+ {,#1\expandafter\XINT_flseqb::csv_n\expandafter}%
+ {\romannumeral0\XINTinfloatadd {#3}{#1}}{#2}{#3}%
+}%
+\def\XINT_flseqb::csv_z #1#2#3{,#1}%
+\def\XINT_tmpa #1#2#3#4#5#6%
+{%
+ \def #1##1% \XINT_expr_op_,
{%
\expandafter #2\expandafter ##1\romannumeral-`0\XINT_expr_getnext
}%
@@ -659,172 +1201,614 @@
\xintApplyInline{\XINT_tmpa {flexpr}\xintOpp}{{vi}{vii}{viii}{ix}}%
\xintApplyInline{\XINT_tmpa {iiexpr}\xintiiOpp}{{vi}{vii}{viii}{ix}}%
\let\XINT_expr_precedence_? \xint_c_x
-\def \XINT_expr_op_? #1#2#3%
+\def\XINT_expr_op_? #1#2{\if ?#2\expandafter \XINT_expr_op_??\fi
+ \XINT_expr_op_?a #1{#2}}%
+\def\XINT_expr_op_?a #1#2#3%
{%
- \xintifZero{\XINT_expr_unlock #1}%
- {\XINT_expr_getnext #3}%
- {\XINT_expr_getnext #2}%
+ \xintiiifNotZero{\XINT_expr_unlock #1}{\XINT_expr_getnext #2}{\XINT_expr_getnext #3}%
}%
\let\XINT_flexpr_op_?\XINT_expr_op_?
\let\XINT_iiexpr_op_?\XINT_expr_op_?
-\let\XINT_expr_precedence_: \xint_c_x
-\def \XINT_expr_op_: #1#2#3#4%
+\def\XINT_expr_op_?? #1#2#3#4#5#6%
{%
- \xintifSgn {\XINT_expr_unlock #1}%
- {\XINT_expr_getnext #2}%
- {\XINT_expr_getnext #3}%
- {\XINT_expr_getnext #4}%
+ \xintiiifSgn {\XINT_expr_unlock #2}{\XINT_expr_getnext #4}{\XINT_expr_getnext #5}%
+ {\XINT_expr_getnext #6}%
}%
-\let\XINT_flexpr_op_:\XINT_expr_op_:
-\let\XINT_iiexpr_op_:\XINT_expr_op_:
\let\XINT_expr_precedence_! \xint_c_x
\def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop
- \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
+ \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }%
\let\XINT_flexpr_op_!\XINT_expr_op_!
\def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop
- \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
-\def\XINT_tmpa #1#2#3#4{%
- \def #1##1%
+ \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }%
+\catcode`[ 11
+\catcode`* 11
+\let\XINT_expr_precedence_[ \xint_c_vii
+\def\XINT_expr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\xintE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\def\XINT_iiexpr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\xintiiE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\def\XINT_flexpr_op_[ #1#2]{\expandafter\XINT_expr_getop
+ \csname .=\XINTinFloatE{\XINT_expr_unlock #1}%
+ {\xint_zapspaces #2 \xint_bye\xint_bye}\endcsname}%
+\catcode`[ 12
+\catcode`* 12
+\def\XINT_expr_op__ #1% op__ with two _'s
+ {%
+ \ifcsname XINT_expr_var_#1\endcsname
+ \expandafter\xint_firstoftwo
+ \else
+ \expandafter\xint_secondoftwo
+ \fi
+ {\expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \XINT_expr_getop\csname XINT_expr_var_#1\endcsname}%
+ {\XINT_expr_unknown_variable {#1}%
+ \expandafter\XINT_expr_getop\csname .=0\endcsname}%
+ }%
+\def\XINT_expr_unknown_variable #1{\xintError:removed \xint_gobble_i {#1}}%
+\let\XINT_flexpr_op__ \XINT_expr_op__
+\let\XINT_iiexpr_op__ \XINT_expr_op__
+\catcode`: 12
+\def\xintdefvar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbareeval #2\relax }}%
+\def\xintdefiivar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbareiieval #2\relax }%
+}%
+\def\xintdeffloatvar #1:=#2;{\expandafter\odef
+ \csname XINT_expr_var_\xint_zapspaces #1 \xint_bye\xint_bye\endcsname
+ {\expandafter\empty\romannumeral0\xintbarefloateval #2\relax }%
+}%
+\catcode`: 11
+\def\XINT_tmpa #1%
+{%
+ \expandafter\def\csname XINT_expr_var_#1\endcsname ##1\relax !#1##2%
+ {\romannumeral0\XINT_expr_lockscan ##2!##1\relax !#1{##2}}%
+}%
+\xintApplyUnbraced \XINT_tmpa {abcdefghijklmnopqrstuvwxyz}%
+\xintApplyUnbraced \XINT_tmpa {ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
+\expandafter\def\expandafter\XINT_expr_var_nil\expandafter
+ {\expandafter\empty\csname .= \endcsname}%
+\catcode`. 11 \catcode`= 11
+\def\XINT_expr_var_omit #1\relax !{1^C!{}{}{}\.=!\relax !}% 24 juin
+\def\XINT_expr_var_abort #1\relax !{1^C!{}{}{}\.=^\relax !}% 25 juin
+\catcode`. 12 \catcode`= 12
+\catcode`? 3
+\def\XINT_expr_var_@ #1~#2{ #2#1~#2}%
+\expandafter\let\csname XINT_expr_var_@1\endcsname \XINT_expr_var_@
+\expandafter\def\csname XINT_expr_var_@2\endcsname #1~#2#3{ #3#1~#2#3}%
+\expandafter\def\csname XINT_expr_var_@3\endcsname #1~#2#3#4{ #4#1~#2#3#4}%
+\expandafter\def\csname XINT_expr_var_@4\endcsname #1~#2#3#4#5{ #5#1~#2#3#4#5}%
+\def\XINT_expr_func_@@ #1#2#3#4~#5?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#5}#4~#5?%
+}%
+\def\XINT_expr_func_@@@ #1#2#3#4~#5~#6?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#6}#4~#5~#6?%
+}%
+\def\XINT_expr_func_@@@@ #1#2#3#4~#5~#6~#7?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\xintNum{\XINT_expr_unlock#3}}{#7}#4~#5~#6~#7?%
+}%
+\let\XINT_flexpr_func_@@\XINT_expr_func_@@
+\let\XINT_flexpr_func_@@@\XINT_expr_func_@@@
+\let\XINT_flexpr_func_@@@@\XINT_expr_func_@@@@
+\def\XINT_iiexpr_func_@@ #1#2#3#4~#5?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#5}#4~#5?%
+}%
+\def\XINT_iiexpr_func_@@@ #1#2#3#4~#5~#6?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#6}#4~#5~#6?%
+}%
+\def\XINT_iiexpr_func_@@@@ #1#2#3#4~#5~#6~#7?%
+{%
+ \expandafter#1\expandafter#2\romannumeral0\xintntheltnoexpand
+ {\XINT_expr_unlock#3}{#7}#4~#5~#6~#7?%
+}%
+\catcode`? 11
+\def\XINT_tmpa #1#2#3{%
+ \def #1##1% \XINT_expr_op_`, #2=\XINT_expr_oparen
{%
\ifcsname XINT_expr_onlitteral_##1\endcsname
- \expandafter\XINT_expr_funcoflitteral
- \else
- \expandafter #2%
- \fi {##1}%
- }%
- \def #2##1%
- {%
- \ifcsname XINT_#4_func_##1\endcsname
- \xint_afterfi
- {\expandafter\expandafter\csname XINT_#4_func_##1\endcsname}%
- \else \csname xintError:unknown `##1\string'\endcsname
- \xint_afterfi{\expandafter\XINT_expr_func_unknown}%
- \fi
- \romannumeral-`0#3%
+ \xint_dothis{\csname XINT_expr_onlitteral_##1\endcsname}\fi
+ \ifcsname XINT_#3_func_##1\endcsname
+ \xint_dothis{\expandafter\expandafter
+ \csname XINT_#3_func_##1\endcsname\romannumeral-`0#2}\fi
+ \xint_orthat{\XINT_expr_unknown_function {##1}%
+ \expandafter\XINT_expr_func_unknown\romannumeral-`0#2}%
}%
}%
+\def\XINT_expr_unknown_function #1{\xintError:removed \xint_gobble_i {#1}}%
\xintFor #1 in {expr,flexpr,iiexpr} \do {%
\expandafter\XINT_tmpa
- \csname XINT_#1_op_@\expandafter\endcsname
- \csname XINT_#1_op_@@\expandafter\endcsname
- \csname XINT_#1_oparen\endcsname {#1}%
-}%
-\def\XINT_expr_funcoflitteral #1%
-{%
- \expandafter\expandafter\csname XINT_expr_onlitteral_#1\endcsname
- \romannumeral-`0\XINT_expr_scanfunc
-}%
-\def\XINT_expr_onlitteral_bool #1#2#3{\expandafter\XINT_expr_getop
- \csname .=\xintBool{#3}\endcsname }%
-\def\XINT_expr_onlitteral_togl #1#2#3{\expandafter\XINT_expr_getop
- \csname .=\xintToggle{#3}\endcsname }%
-\def\XINT_expr_func_unknown #1#2#3% 1.09i removes [0], because \xintiiexpr
- {\expandafter #1\expandafter #2\csname .=0\endcsname }%
-\def\XINT_expr_func_reduce #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIrr {\XINT_expr_unlock #3}\endcsname
-}%
-\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
-\def\XINT_expr_func_frac #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintTFrac {\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_flexpr_func_frac #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatFrac [\XINTdigits]{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_expr_func_sqr #1#2#3%
+ \csname XINT_#1_op_`\expandafter\endcsname
+ \csname XINT_#1_oparen\endcsname
+ {#1}%
+}%
+\expandafter\def\csname XINT_expr_onlitteral_`\endcsname #1#2#3({\xint_c_xviii `{#2}}%
+\def\XINT_expr_onlitteral_bool #1)%
+ {\expandafter\XINT_expr_getop\csname .=\xintBool{#1}\endcsname }%
+\def\XINT_expr_onlitteral_togl #1)%
+ {\expandafter\XINT_expr_getop\csname .=\xintToggle{#1}\endcsname }%
+\def\XINT_expr_onlitteral_protect #1)%
+ {\expandafter\XINT_expr_getop\csname .=\detokenize{#1}\endcsname }%
+\def\XINT_expr_func_unknown #1#2#3{\expandafter #1\expandafter #2\csname .=0\endcsname }%
+\def\XINT_expr_func_break #1#2#3%
+{\expandafter #1\expandafter #2\csname.=?\romannumeral-`0\XINT_expr_unlock #3\endcsname }%
+\let\XINT_flexpr_func_break \XINT_expr_func_break
+\let\XINT_iiexpr_func_break \XINT_expr_func_break
+\def\XINT_expr_onlitteral_seq
+ {\expandafter\XINT_expr_onlitteral_seq_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_seq_f #1#2{\xint_c_xviii `{seqx}#2)\relax #1}%
+\def\XINT_expr_onlitteral_seq_a #1#2,%
+{% checks balancing of parentheses
+ \ifcase\XINT_isbalanced_a \relax #1#2(\xint_bye)\xint_bye
+ \expandafter\XINT_expr_onlitteral_seq_c
+ \or\expandafter\XINT_expr_onlitteral_seq_b
+ \else\expandafter\xintError:we_are_doomed
+ \fi {#1#2},%
+}%
+\def\XINT_expr_onlitteral_seq_b #1,{\XINT_expr_onlitteral_seq_a {#1,}}%
+\def\XINT_expr_onlitteral_seq_c #1,#2#3% #3 pour absorber le =
+{%
+ \XINT_expr_onlitteral_seq_d {#2{#1}}{}%
+}%
+\def\XINT_expr_onlitteral_seq_d #1#2#3)%
+{%
+ \ifcase\XINT_isbalanced_a \relax #2#3(\xint_bye)\xint_bye
+ \or\expandafter\XINT_expr_onlitteral_seq_e
+ \else\expandafter\xintError:we_are_doomed
+ \fi
+ {#1}{#2#3}%
+}%
+\def\XINT_expr_onlitteral_seq_e #1#2{\XINT_expr_onlitteral_seq_d {#1}{#2)}}%
+\def\XINT_isbalanced_a #1({\XINT_isbalanced_b #1)\xint_bye }%
+\def\XINT_isbalanced_b #1)#2%
+ {\xint_bye #2\XINT_isbalanced_c\xint_bye\XINT_isbalanced_error }%
+\def\XINT_isbalanced_error #1)\xint_bye {\m@ne}%
+\def\XINT_isbalanced_c\xint_bye\XINT_isbalanced_error #1%
+ {\xint_bye #1\XINT_isbalanced_yes\xint_bye\XINT_isbalanced_d #1}%
+\def\XINT_isbalanced_yes\xint_bye\XINT_isbalanced_d\xint_bye )\xint_bye {\xint_c_ }%
+\def\XINT_isbalanced_d #1)#2%
+ {\xint_bye #2\XINT_isbalanced_no\xint_bye\XINT_isbalanced_a #1#2}%
+\def\XINT_isbalanced_no\xint_bye #1\xint_bye\xint_bye {\xint_c_i }%
+\def\XINT_expr_func_seqx #1#2{\XINT_allexpr_seqx \xintbareeval }%
+\def\XINT_flexpr_func_seqx #1#2{\XINT_allexpr_seqx \xintbarefloateval}%
+\def\XINT_iiexpr_func_seqx #1#2{\XINT_allexpr_seqx \xintbareiieval }%
+\def\XINT_allexpr_seqx #1#2#3#4% #2 is the index list, fully evaluated and encapsulated
+{% #3 is the Latin letter serving as dummy variable, #4 is the expression to evaluate
+ \expandafter \XINT_expr_getop
+ \csname .=\expandafter\XINT_expr_seq:_aa
+ \romannumeral-`0\XINT_expr_unlock #2!{#1#4\relax !#3},^,\endcsname
+}%
+\def\XINT_expr_seq:_aa #1{\if +#1\expandafter\XINT_expr_seq:_A\else
+ \expandafter\XINT_expr_seq:_a\fi #1}%
+\def\XINT_expr_seq:_a #1!#2{\expandafter\XINT_expr_seq_empty?
+ \romannumeral0\XINT_expr_seq:_b {#2}#1}%
+\def\XINT_expr_seq:_b #1#2,{\XINT_expr_seq:_c #2,{#1}}%
+\def\XINT_expr_seq:_c #1{\if ,#1\xint_dothis\XINT_expr_seq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_seq:_end\fi
+ \xint_orthat\XINT_expr_seq:_d #1}%
+\def\XINT_expr_seq:_d #1,#2{\expandafter\XINT_expr_seq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#2{#1}{#2}}%
+\def\XINT_expr_seq:_e #1{\if #1^\xint_dothis\XINT_expr_seq:_abort\fi
+ \if #1?\xint_dothis\XINT_expr_seq:_break\fi
+ \if #1!\xint_dothis\XINT_expr_seq:_omit\fi
+ \xint_orthat{\XINT_expr_seq:_goon #1}}%
+\def\XINT_expr_seq:_goon #1!#2#3#4{,#1\XINT_expr_seq:_b {#4}}%
+\def\XINT_expr_seq:_omit #1!#2#3#4{\XINT_expr_seq:_b {#4}}%
+\def\XINT_expr_seq:_abort #1!#2#3#4#5^,{}%
+\def\XINT_expr_seq:_break #1!#2#3#4#5^,{,#1}%
+\def\XINT_expr_seq:_noop ,#1{\XINT_expr_seq:_b {#1}}%
+\def\XINT_expr_seq:_end ^,#1{}% if all is omit, _empty? constructs "nil"
+\def\XINT_expr_seq_empty? #1{%
+\def\XINT_expr_seq_empty? ##1{\if ,##1\expandafter\xint_gobble_i\fi #1\endcsname }}%
+\XINT_expr_seq_empty? { }%
+\def\XINT_expr_seq:_A +#1!#2,^,%
+ {\expandafter\XINT_expr_seq_empty?\romannumeral0\XINT_expr_seq:_D {#1}{#2}}%
+\def\XINT_expr_seq:_D #1#2{\expandafter\XINT_expr_seq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#2{#1}{#2}}%
+\def\XINT_expr_seq:_E #1{\if #1^\xint_dothis\XINT_expr_seq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_seq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_seq:_Omit\fi
+ \xint_orthat{\XINT_expr_seq:_Goon #1}}%
+\def\XINT_expr_seq:_Goon #1!#2#3#4%
+ {,#1\expandafter\XINT_expr_seq:_D\expandafter{\the\numexpr #3+\xint_c_i}{#4}}%
+\def\XINT_expr_seq:_Omit #1!#2#3#4%
+ {\expandafter\XINT_expr_seq:_D\expandafter{\the\numexpr #3+\xint_c_i}{#4}}%
+\def\XINT_expr_seq:_Abort #1!#2#3#4{}%
+\def\XINT_expr_seq:_Break #1!#2#3#4{,#1}%
+\def\XINT_expr_onlitteral_add
+ {\expandafter\XINT_expr_onlitteral_add_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_add_f #1#2{\xint_c_xviii `{opx}#2)\relax #1+}%
+\def\XINT_expr_onlitteral_mul
+ {\expandafter\XINT_expr_onlitteral_mul_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_mul_f #1#2{\xint_c_xviii `{opx}#2)\relax #1*}%
+\expandafter\edef\csname XINT_expr_op:_+\endcsname
+ {\noexpand\xint_gobble_v {}{}{}\expandafter\noexpand\csname .=0\endcsname}%
+\expandafter\edef\csname XINT_expr_op:_*\endcsname
+ {\noexpand\xint_gobble_v {}{}{}\expandafter\noexpand\csname .=1\endcsname}%
+\def\XINT_expr_func_opx #1#2{\XINT_allexpr_opx \xintexpr }%
+\def\XINT_flexpr_func_opx #1#2{\XINT_allexpr_opx \xintfloatexpr }%
+\def\XINT_iiexpr_func_opx #1#2{\XINT_allexpr_opx \xintiiexpr }%
+\def\XINT_allexpr_opx #1#2#3#4#5%
+{% au d^^e9part on avait op(#4,#3=#2 (^^e9valu^^e9 ici)) #3=la variable, #4=expression, #5=+ ou*.
+ \expandafter\XINT_expr_getop\romannumeral0\expandafter\XINT_expr_op:_a
+ \csname XINT_expr_op:_#5\expandafter\endcsname
+ \romannumeral-`0\XINT_expr_unlock #2!#5#1#3{#4}%
+}%
+\def\XINT_expr_op:_a #1#2!#3#4#5#6{\XINT_expr_op:_b {#1#4#3{#6\relax\relax !#5}}#2,^,}%
+\def\XINT_expr_op:_b #1#2,{\XINT_expr_op:_c #2,#1}%
+\def\XINT_expr_op:_c #1{\if ,#1\xint_dothis\XINT_expr_op:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_op:_end\fi
+ \xint_orthat\XINT_expr_op:_d #1}%
+\def\XINT_expr_op:_noop #1,#2#3#4#5{\XINT_expr_op:_b {{#2}#3#4{#5}}}%
+\def\XINT_expr_op:_d #1,#2#3#4#5%
+ {\expandafter\expandafter\expandafter\XINT_expr_op:_e #3#2#4#3#5{#1}{#3#4{#5}}}%
+\def\XINT_expr_op:_e !#1!#2#3#4{\XINT_expr_op:_b {{!#1}#4}}%
+\def\XINT_expr_op:_end ^,#1#2#3#4{\expandafter\expandafter\expandafter\space
+ \expandafter\xint_gobble_iv #1}%
+\def\XINT_expr_onlitteral_subs
+ {\expandafter\XINT_expr_onlitteral_subs_f\romannumeral-`0\XINT_expr_onlitteral_seq_a {}}%
+\def\XINT_expr_onlitteral_subs_f #1#2{\xint_c_xviii `{subx}#2)\relax #1}%
+\def\XINT_expr_func_subx #1#2{\XINT_allexpr_subx \xintbareeval }%
+\def\XINT_flexpr_func_subx #1#2{\XINT_allexpr_subx \xintbarefloateval}%
+\def\XINT_iiexpr_func_subx #1#2{\XINT_allexpr_subx \xintbareiieval }%
+\def\XINT_allexpr_subx #1#2#3#4% #2 is the value to assign to the dummy variable
+{% #3 is the dummy variable, #4 is the expression to evaluate
+ \expandafter \XINT_expr_getop
+ \csname .=\expandafter\XINT_expr_subx:_a
+ \romannumeral-`0\XINT_expr_unlock #2!{#1#4\relax !#3}\endcsname
+}%
+\def\XINT_expr_subx:_a #1!#2% 10/25 that was a quick addition!
+ {\expandafter\XINT_expr_subx:_end \romannumeral0#2{#1}}%
+\def\XINT_expr_subx:_end #1!#2#3{\XINT_expr_unlock #1}%
+\def\XINT_expr_func_rseq {\XINT_allexpr_rseq \xintbareeval }%
+\def\XINT_flexpr_func_rseq {\XINT_allexpr_rseq \xintbarefloateval }%
+\def\XINT_iiexpr_func_rseq {\XINT_allexpr_rseq \xintbareiieval }%
+\def\XINT_allexpr_rseq #1#2%
+{%
+ \expandafter\XINT_expr_rseqx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+\def\XINT_expr_rseqx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_rseqy\romannumeral0#1(#4)\relax
+ #2#3#1%
+}%
+\def\XINT_expr_rseqy #1#2#3#4#5% #1=valeurs pour variable (locked),
+ % #2=toutes les valeurs initiales (csv,locked),
+ % #3=variable, #4=expr,
+ % #5=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=\XINT_expr_unlock #2%
+ \expandafter\XINT_expr_rseq:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#5#4\relax !#3}#2,^,\endcsname
+}%
+\def\XINT_expr_rseq:_aa #1{\if +#1\expandafter\XINT_expr_rseq:_A\else
+ \expandafter\XINT_expr_rseq:_a\fi #1}%
+\def\XINT_expr_rseq:_a #1!#2#3{\XINT_expr_rseq:_b #3{#2}#1}%
+\def\XINT_expr_rseq:_b #1#2#3,{\XINT_expr_rseq:_c #3,~#1{#2}}%
+\def\XINT_expr_rseq:_c #1{\if ,#1\xint_dothis\XINT_expr_rseq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_rseq:_end\fi
+ \xint_orthat\XINT_expr_rseq:_d #1}%
+\def\XINT_expr_rseq:_d #1,~#2#3{\expandafter\XINT_expr_rseq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2{#3}}%
+\def\XINT_expr_rseq:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_rseq:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_rseq:_break\fi
+ \if !#1\xint_dothis\XINT_expr_rseq:_omit\fi
+ \xint_orthat{\XINT_expr_rseq:_goon #1}}%
+\def\XINT_expr_rseq:_goon #1!#2#3~#4#5{,#1\expandafter\XINT_expr_rseq:_b
+ \romannumeral0\XINT_expr_lockit {#1}{#5}}%
+\def\XINT_expr_rseq:_omit #1!#2#3~{\XINT_expr_rseq:_b }%
+\def\XINT_expr_rseq:_abort #1!#2#3~#4#5#6^,{}%
+\def\XINT_expr_rseq:_break #1!#2#3~#4#5#6^,{,#1}%
+\def\XINT_expr_rseq:_noop ,~#1#2{\XINT_expr_rseq:_b #1{#2}}%
+\def\XINT_expr_rseq:_end ^,~#1#2{}% no nil for rseq
+\def\XINT_expr_rseq:_A +#1!#2#3,^,{\XINT_expr_rseq:_D {#1}#3{#2}}%
+\def\XINT_expr_rseq:_D #1#2#3{\expandafter\XINT_expr_rseq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2{#3}}%
+\def\XINT_expr_rseq:_E #1{\if #1^\xint_dothis\XINT_expr_rseq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_rseq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_rseq:_Omit\fi
+ \xint_orthat{\XINT_expr_rseq:_Goon #1}}%
+\def\XINT_expr_rseq:_Goon #1!#2#3~#4#5%
+ {,#1\expandafter\XINT_expr_rseq:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \romannumeral0\XINT_expr_lockit{#1}{#5}}%
+\def\XINT_expr_rseq:_Omit #1!#2#3~%#4#5%
+ {\expandafter\XINT_expr_rseq:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_rseq:_Abort #1!#2#3~#4#5{}%
+\def\XINT_expr_rseq:_Break #1!#2#3~#4#5{,#1}%
+\def\XINT_expr_func_rrseq {\XINT_allexpr_rrseq \xintbareeval }%
+\def\XINT_flexpr_func_rrseq {\XINT_allexpr_rrseq \xintbarefloateval }%
+\def\XINT_iiexpr_func_rrseq {\XINT_allexpr_rrseq \xintbareiieval }%
+\def\XINT_allexpr_rrseq #1#2%
+{%
+ \expandafter\XINT_expr_rrseqx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+\def\XINT_expr_rrseqx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_rrseqy\romannumeral0#1(#4)\expandafter\relax
+ \expandafter{\romannumeral0\xintapply \XINT_expr_lockit
+ {\xintRevWithBraces{\xintCSVtoListNonStripped{\XINT_expr_unlock #2}}}}%
+ #2#3#1%
+}%
+\def\XINT_expr_rrseqy #1#2#3#4#5#6% #1=valeurs pour variable (locked),
+ % #2=initial values (reversed, one (braced) token each)
+ % #3=toutes les valeurs initiales (csv,locked),
+ % #4=variable, #5=expr,
+ % #6=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=\XINT_expr_unlock #3%
+ \expandafter\XINT_expr_rrseq:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#6#5\relax !#4}{#2},^,\endcsname
+}%
+\def\XINT_expr_rrseq:_aa #1{\if +#1\expandafter\XINT_expr_rrseq:_A\else
+ \expandafter\XINT_expr_rrseq:_a\fi #1}%
+\catcode`? 3
+\def\XINT_expr_rrseq:_a #1!#2#3{\XINT_expr_rrseq:_b {#3}{#2}#1}%
+\def\XINT_expr_rrseq:_b #1#2#3,{\XINT_expr_rrseq:_c #3,~#1?{#2}}%
+\def\XINT_expr_rrseq:_c #1{\if ,#1\xint_dothis\XINT_expr_rrseq:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_rrseq:_end\fi
+ \xint_orthat\XINT_expr_rrseq:_d #1}%
+\def\XINT_expr_rrseq:_d #1,~#2?#3{\expandafter\XINT_expr_rrseq:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_rrseq:_goon #1!#2#3~#4?#5{,#1\expandafter\XINT_expr_rrseq:_b\expandafter
+ {\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_rrseq:_omit #1!#2#3~{\XINT_expr_rrseq:_b }%
+\def\XINT_expr_rrseq:_abort #1!#2#3~#4?#5#6^,{}%
+\def\XINT_expr_rrseq:_break #1!#2#3~#4?#5#6^,{,#1}%
+\def\XINT_expr_rrseq:_noop ,~#1?#2{\XINT_expr_rrseq:_b {#1}{#2}}%
+\def\XINT_expr_rrseq:_end ^,~#1?#2{}% No nil for rrseq.
+\catcode`? 11
+\def\XINT_expr_rrseq:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_rrseq:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_rrseq:_break\fi
+ \if !#1\xint_dothis\XINT_expr_rrseq:_omit\fi
+ \xint_orthat{\XINT_expr_rrseq:_goon #1}%
+}%
+\catcode`? 3
+\def\XINT_expr_rrseq:_A +#1!#2#3,^,{\XINT_expr_rrseq:_D {#1}{#3}{#2}}%
+\def\XINT_expr_rrseq:_D #1#2#3{\expandafter\XINT_expr_rrseq:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_rrseq:_Goon #1!#2#3~#4?#5%
+ {,#1\expandafter\XINT_expr_rrseq:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \expandafter{\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_rrseq:_Omit #1!#2#3~%#4?#5%
+ {\expandafter\XINT_expr_rrseq:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_rrseq:_Abort #1!#2#3~#4?#5{}%
+\def\XINT_expr_rrseq:_Break #1!#2#3~#4?#5{,#1}%
+\catcode`? 11
+\def\XINT_expr_rrseq:_E #1{\if #1^\xint_dothis\XINT_expr_rrseq:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_rrseq:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_rrseq:_Omit\fi
+ \xint_orthat{\XINT_expr_rrseq:_Goon #1}}%
+\def\XINT_expr_func_iter {\XINT_allexpr_iter \xintbareeval }%
+\def\XINT_flexpr_func_iter {\XINT_allexpr_iter \xintbarefloateval }%
+\def\XINT_iiexpr_func_iter {\XINT_allexpr_iter \xintbareiieval }%
+\def\XINT_allexpr_iter #1#2%
+{%
+ \expandafter\XINT_expr_iterx\expandafter #1\expandafter
+ #2\romannumeral-`0\XINT_expr_onlitteral_seq_a {}%
+}%
+\def\XINT_expr_iterx #1#2#3#4%
+{%
+ \expandafter\XINT_expr_itery\romannumeral0#1(#4)\expandafter\relax
+ \expandafter{\romannumeral0\xintapply \XINT_expr_lockit
+ {\xintRevWithBraces{\xintCSVtoListNonStripped{\XINT_expr_unlock #2}}}}%
+ #2#3#1%
+}%
+\def\XINT_expr_itery #1#2#3#4#5#6% #1=valeurs pour variable (locked),
+ % #2=initial values (reversed, one (braced) token each)
+ % #3=toutes les valeurs initiales (csv,locked),
+ % #4=variable, #5=expr,
+ % #6=\xintbareeval ou \xintbarefloateval ou \xintbareiieval
+{%
+ \expandafter \XINT_expr_getop
+ \csname .=%
+ \expandafter\XINT_expr_iter:_aa
+ \romannumeral-`0\XINT_expr_unlock #1!{#6#5\relax !#4}{#2},^,\endcsname
+}%
+\def\XINT_expr_iter:_aa #1{\if +#1\expandafter\XINT_expr_iter:_A\else
+ \expandafter\XINT_expr_iter:_a\fi #1}%
+\catcode`? 3
+\def\XINT_expr_iter:_a #1!#2#3{\XINT_expr_iter:_b {#3}{#2}#1}%
+\def\XINT_expr_iter:_b #1#2#3,{\XINT_expr_iter:_c #3,~#1?{#2}}%
+\def\XINT_expr_iter:_c #1{\if ,#1\xint_dothis\XINT_expr_iter:_noop\fi
+ \if ^#1\xint_dothis\XINT_expr_iter:_end\fi
+ \xint_orthat\XINT_expr_iter:_d #1}%
+\def\XINT_expr_iter:_d #1,~#2?#3{\expandafter\XINT_expr_iter:_e
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_iter:_goon #1!#2#3~#4?#5{\expandafter\XINT_expr_iter:_b\expandafter
+ {\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_iter:_omit #1!#2#3~{\XINT_expr_iter:_b }%
+\def\XINT_expr_iter:_abort #1!#2#3~#4?#5#6^,%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}}}%
+\def\XINT_expr_iter:_break #1!#2#3~#4?#5#6^,%
+ {\expandafter\xint_gobble_iv\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}},#1}%
+\def\XINT_expr_iter:_noop ,~#1?#2{\XINT_expr_iter:_b {#1}{#2}}%
+\def\XINT_expr_iter:_end ^,~#1?#2%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#1\space}}}%
+\catcode`? 11
+\def\XINT_expr_iter:_e #1{%
+ \if ^#1\xint_dothis\XINT_expr_iter:_abort\fi
+ \if ?#1\xint_dothis\XINT_expr_iter:_break\fi
+ \if !#1\xint_dothis\XINT_expr_iter:_omit\fi
+ \xint_orthat{\XINT_expr_iter:_goon #1}%
+}%
+\def\XINT_expr:_unlock #1{\XINT_expr_unlock #1}%
+\catcode`? 3
+\def\XINT_expr_iter:_A +#1!#2#3,^,{\XINT_expr_iter:_D {#1}{#3}{#2}}%
+\def\XINT_expr_iter:_D #1#2#3{\expandafter\XINT_expr_iter:_E
+ \romannumeral-`0\expandafter\XINT_expr_unlock\romannumeral0#3{#1}~#2?{#3}}%
+\def\XINT_expr_iter:_Goon #1!#2#3~#4?#5%
+ {\expandafter\XINT_expr_iter:_D\expandafter{\the\numexpr #3+\xint_c_i\expandafter}%
+ \expandafter{\romannumeral0\xinttrim{-1}{\XINT_expr_lockit{#1}#4}}{#5}}%
+\def\XINT_expr_iter:_Omit #1!#2#3~%#4?#5%
+ {\expandafter\XINT_expr_iter:_D\expandafter{\the\numexpr #3+\xint_c_i}}%
+\def\XINT_expr_iter:_Abort #1!#2#3~#4?#5%
+ {\expandafter\xint_gobble_i\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}}}%
+\def\XINT_expr_iter:_Break #1!#2#3~#4?#5%
+ {\expandafter\xint_gobble_iv\romannumeral0\xintapplyunbraced
+ {,\XINT_expr:_unlock}{\xintReverseOrder{#4\space}},#1}%
+\catcode`? 11
+\def\XINT_expr_iter:_E #1{\if #1^\xint_dothis\XINT_expr_iter:_Abort\fi
+ \if #1?\xint_dothis\XINT_expr_iter:_Break\fi
+ \if #1!\xint_dothis\XINT_expr_iter:_Omit\fi
+ \xint_orthat{\XINT_expr_iter:_Goon #1}}%
+\def\xintANDof:csv #1{\expandafter\XINT_andof:_a\romannumeral-`0#1,,^}%
+\def\XINT_andof:_a #1{\if ,#1\expandafter\XINT_andof:_e
+ \else\expandafter\XINT_andof:_c\fi #1}%
+\def\XINT_andof:_c #1,{\xintiiifNotZero {#1}{\XINT_andof:_a}{\XINT_andof:_no}}%
+\def\XINT_andof:_no #1^{0}%
+\def\XINT_andof:_e #1^{1}% works with empty list
+\def\xintORof:csv #1{\expandafter\XINT_orof:_a\romannumeral-`0#1,,^}%
+\def\XINT_orof:_a #1{\if ,#1\expandafter\XINT_orof:_e
+ \else\expandafter\XINT_orof:_c\fi #1}%
+\def\XINT_orof:_c #1,{\xintiiifNotZero{#1}{\XINT_orof:_yes}{\XINT_orof:_a}}%
+\def\XINT_orof:_yes #1^{1}%
+\def\XINT_orof:_e #1^{0}% works with empty list
+\def\xintXORof:csv #1{\expandafter\XINT_xorof:_a\expandafter 0\romannumeral-`0#1,,^}%
+\def\XINT_xorof:_a #1#2,{\XINT_xorof:_b #2,#1}%
+\def\XINT_xorof:_b #1{\if ,#1\expandafter\XINT_xorof:_e
+ \else\expandafter\XINT_xorof:_c\fi #1}%
+\def\XINT_xorof:_c #1,#2%
+ {\xintiiifNotZero {#1}{\if #20\xint_afterfi{\XINT_xorof:_a 1}%
+ \else\xint_afterfi{\XINT_xorof:_a 0}\fi}%
+ {\XINT_xorof:_a #2}%
+ }%
+\def\XINT_xorof:_e ,#1#2^{#1}% allows empty list (then returns 0)
+\def\XINT_oncsv:_empty #1,^,#2{#2}%
+\def\XINT_oncsv:_end ^,#1#2#3#4{#1}%
+\def\XINT_oncsv:_a #1#2#3%
+ {\if ,#3\expandafter\XINT_oncsv:_empty\else\expandafter\XINT_oncsv:_b\fi #1#2#3}%
+\def\XINT_oncsv:_b #1#2#3,%
+ {\expandafter\XINT_oncsv:_c \expandafter{\romannumeral-`0#2{#3}}#1#2}%
+\def\XINT_oncsv:_c #1#2#3#4,{\expandafter\XINT_oncsv:_d \romannumeral-`0#4,{#1}#2#3}%
+\def\XINT_oncsv:_d #1%
+ {\if ^#1\expandafter\XINT_oncsv:_end\else\expandafter\XINT_oncsv:_e\fi #1}%
+\def\XINT_oncsv:_e #1,#2#3#4%
+ {\expandafter\XINT_oncsv:_c\expandafter {\romannumeral-`0#3{#4{#1}}{#2}}#3#4}%
+\def\xintMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmax
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimax
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+\def\xintMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmin
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimin
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+\def\xintSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintadd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{0/1[0]}}%
+\def\xintiiSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiiadd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+\def\xintPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmul
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,{1/1[0]}}%
+\def\xintiiPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiimul
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,1}%
+\def\xintGCDof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintgcd
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,1}%
+\def\xintLCMof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintlcm
+ \expandafter\xint_firstofone\romannumeral-`0#1,^,0}%
+\def\XINTinFloatdigits {\XINTinFloat [\XINTdigits]}%
+\def\XINTinFloatSqrtdigits {\XINTinFloatSqrt [\XINTdigits]}%
+\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmax
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+\def\XINTinFloatMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmin
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+\def\XINTinFloatSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatadd
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{0[0]}}%
+\def\XINTinFloatPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatmul
+ \expandafter\XINTinFloatdigits\romannumeral-`0#1,^,{1[0]}}%
+\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
+\def\XINT_expr_argandopt #1,#2,#3.#4#5%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintSqr {\XINT_expr_unlock #3}\endcsname
+ \if\relax#3\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#4}{#5[\xintNum {#2}]}{#1}%
}%
-\def\XINT_flexpr_func_sqr #1#2#3%
+\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMul [\XINTdigits]%
- {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
+ \if\relax#5\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#2{\xintNum {#4}}}{#3}%
}%
-\def\XINT_iiexpr_func_sqr #1#2#3%
+\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSqr {\XINT_expr_unlock #3}\endcsname
+ \if\relax#4\relax\expandafter\xint_firstoftwo\else
+ \expandafter\xint_secondoftwo\fi
+ {#1{0}}{#1{#3}}{#2}%
}%
+\def\XINT_expr_func_num #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintNum {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_num\XINT_expr_func_num
+\let\XINT_iiexpr_func_num\XINT_expr_func_num
+\def\XINT_expr_func_reduce #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintIrr {\XINT_expr_unlock #3}[0]\endcsname }%
+\let\XINT_flexpr_func_reduce\XINT_expr_func_reduce
\def\XINT_expr_func_abs #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintAbs {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintAbs {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_abs\XINT_expr_func_abs
\def\XINT_iiexpr_func_abs #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiAbs {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintiiAbs {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_sgn #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintSgn {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintSgn {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_sgn\XINT_expr_func_sgn
\def\XINT_iiexpr_func_sgn #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSgn {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSgn {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_frac #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintTFrac {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_frac #1#2#3{\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatFrac {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_floor #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintFloor {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname .=\xintFloor {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_floor\XINT_expr_func_floor
-\let\XINT_iiexpr_func_floor\XINT_expr_func_floor
+\def\XINT_iiexpr_func_floor #1#2#3%
+{% mais absurde si on ne peut pas avoir quotient comme input
+ \expandafter #1\expandafter #2\csname.=\xintiFloor {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_ceil #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintCeil {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname .=\xintCeil {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_ceil\XINT_expr_func_ceil
-\let\XINT_iiexpr_func_ceil\XINT_expr_func_ceil
-\def\XINT_expr_twoargs #1,#2,{{#1}{#2}}%
-\def\XINT_expr_func_quo #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintQuo
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\let\XINT_flexpr_func_quo\XINT_expr_func_quo
-\def\XINT_iiexpr_func_quo #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintiiQuo
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\def\XINT_expr_func_rem #1#2#3%
+\def\XINT_iiexpr_func_ceil #1#2#3%
+{% mais absurde si on ne peut pas avoir quotient comme input
+ \expandafter #1\expandafter #2\csname.=\xintiCeil {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_sqr #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintSqr {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_sqr #1#2#3%
{%
- \expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintRem
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+ \expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMul % [\XINTdigits]% pour simplifier mes affaires avec \xintNewExpr
+ {\XINT_expr_unlock #3}{\XINT_expr_unlock #3}\endcsname
}%
-\let\XINT_flexpr_func_rem\XINT_expr_func_rem
-\def\XINT_iiexpr_func_rem #1#2#3%
+\def\XINT_iiexpr_func_sqr #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSqr {\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_expr_func_sqrt #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\expandafter\expandafter\xintiiRem
- \expandafter\XINT_expr_twoargs
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
-\def\XINT_expr_oneortwo #1#2#3,#4,#5.%
-{%
- \if\relax#5\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {#1{0}}{#2{\xintNum {#4}}}{#3}%
+ \expandafter\XINT_expr_argandopt
+ \romannumeral-`0\XINT_expr_unlock#3,,.\XINTinFloatSqrtdigits\XINTinFloatSqrt
+ \endcsname
}%
+\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
+\def\XINT_iiexpr_func_sqrt #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiSqrt {\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_round #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
@@ -833,12 +1817,6 @@
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
\let\XINT_flexpr_func_round\XINT_expr_func_round
-\def\XINT_iiexpr_oneortwo #1#2,#3,#4.%
-{%
- \if\relax#4\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {#1{0}}{#1{#3}}{#2}%
-}%
\def\XINT_iiexpr_func_round #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
@@ -859,226 +1837,445 @@
\expandafter\XINT_iiexpr_oneortwo\expandafter\xintiTrunc
\romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
}%
-\def\XINT_expr_argandopt #1,#2,#3.%
-{%
- \if\relax#3\relax\expandafter\xint_firstoftwo\else
- \expandafter\xint_secondoftwo\fi
- {[\XINTdigits]}{[\xintNum {#2}]}{#1}%
-}%
\def\XINT_expr_func_float #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\XINTinFloat
- \romannumeral-`0\expandafter\XINT_expr_argandopt
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \expandafter\XINT_expr_argandopt
+ \romannumeral-`0\XINT_expr_unlock #3,,.\XINTinFloatdigits\XINTinFloat
+ \endcsname
}%
\let\XINT_flexpr_func_float\XINT_expr_func_float
-\def\XINT_expr_func_sqrt #1#2#3%
+\def\XINT_expr_func_mod #1#2#3%
{%
\expandafter #1\expandafter #2\csname .=%
- \expandafter\XINTinFloatSqrt
- \romannumeral-`0\expandafter\XINT_expr_argandopt
- \romannumeral-`0\XINT_expr_unlock #3,,.\endcsname
+ \expandafter\expandafter\expandafter\xintMod
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_sqrt\XINT_expr_func_sqrt
-\def\XINT_iiexpr_func_sqrt #1#2#3%
+\def\XINT_flexpr_func_mod #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiSqrt {\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\XINTinFloatMod
+ \romannumeral-`0\expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_expr_func_gcd #1#2#3%
+\def\XINT_iiexpr_func_mod #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiMod
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
-\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
-\def\XINT_expr_func_lcm #1#2#3%
+\def\XINT_expr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
-\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
-\def\XINT_expr_func_max #1#2#3%
+\let\XINT_flexpr_func_quo\XINT_expr_func_quo
+\def\XINT_iiexpr_func_quo #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiQuo
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_iiexpr_func_max #1#2#3%
+\def\XINT_expr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\xintiMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
-\def\XINT_flexpr_func_max #1#2#3%
+\let\XINT_flexpr_func_rem\XINT_expr_func_rem
+\def\XINT_iiexpr_func_rem #1#2#3%
{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname
+ \expandafter #1\expandafter #2\csname .=%
+ \expandafter\expandafter\expandafter\xintiiRem
+ \expandafter\XINT_expr_twoargs
+ \romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
+\def\XINT_expr_func_gcd #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintGCDof:csv{\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_gcd\XINT_expr_func_gcd
+\let\XINT_iiexpr_func_gcd\XINT_expr_func_gcd
+\def\XINT_expr_func_lcm #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintLCMof:csv{\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_lcm\XINT_expr_func_lcm
+\let\XINT_iiexpr_func_lcm\XINT_expr_func_lcm
+\def\XINT_expr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_iiexpr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
+\def\XINT_flexpr_func_max #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMaxof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintMinof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_iiexpr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiMinof:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_flexpr_func_min #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_expr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_flexpr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_iiexpr_func_sum #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_expr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_flexpr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\def\XINT_iiexpr_func_prd #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname
-}%
-\let\XINT_expr_func_add\XINT_expr_func_sum
-\let\XINT_expr_func_mul\XINT_expr_func_prd
-\let\XINT_flexpr_func_add\XINT_flexpr_func_sum
-\let\XINT_flexpr_func_mul\XINT_flexpr_func_prd
-\let\XINT_iiexpr_func_add\XINT_iiexpr_func_sum
-\let\XINT_iiexpr_func_mul\XINT_iiexpr_func_prd
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatMinof:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_expr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_flexpr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_iiexpr_func_+\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiSum:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_expr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintPrd:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_flexpr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\XINTinFloatPrd:csv{\XINT_expr_unlock #3}\endcsname }%
+\expandafter\def\csname XINT_iiexpr_func_*\endcsname #1#2#3%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiPrd:csv{\XINT_expr_unlock #3}\endcsname }%
\def\XINT_expr_func_? #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsNotZero {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintiiIsNotZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_? \XINT_expr_func_?
\let\XINT_iiexpr_func_? \XINT_expr_func_?
\def\XINT_expr_func_! #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintiiIsZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_! \XINT_expr_func_!
\let\XINT_iiexpr_func_! \XINT_expr_func_!
\def\XINT_expr_func_not #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintIsZero {\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname.=\xintiiIsZero {\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_not \XINT_expr_func_not
\let\XINT_iiexpr_func_not \XINT_expr_func_not
\def\XINT_expr_func_all #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintANDof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_all\XINT_expr_func_all
\let\XINT_iiexpr_func_all\XINT_expr_func_all
\def\XINT_expr_func_any #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintORof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_any\XINT_expr_func_any
\let\XINT_iiexpr_func_any\XINT_expr_func_any
\def\XINT_expr_func_xor #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\xintXORof:csv{\XINT_expr_unlock #3}\endcsname }%
\let\XINT_flexpr_func_xor\XINT_expr_func_xor
\let\XINT_iiexpr_func_xor\XINT_expr_func_xor
-\def\xintifNotZero:: #1,#2,#3,{\xintifNotZero{#1}{#2}{#3}}%
+\def\xintifNotZero: #1,#2,#3,{\xintiiifNotZero{#1}{#2}{#3}}%
\def\XINT_expr_func_if #1#2#3%
-{%
- \expandafter #1\expandafter #2\csname
- .=\expandafter\xintifNotZero::
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
-}%
+ {\expandafter #1\expandafter #2\csname
+ .=\expandafter\xintifNotZero:\romannumeral-`0\XINT_expr_unlock #3,\endcsname }%
\let\XINT_flexpr_func_if\XINT_expr_func_if
\let\XINT_iiexpr_func_if\XINT_expr_func_if
-\def\xintifSgn:: #1,#2,#3,#4,{\xintifSgn{#1}{#2}{#3}{#4}}%
+\def\xintifSgn: #1,#2,#3,#4,{\xintiiifSgn{#1}{#2}{#3}{#4}}%
\def\XINT_expr_func_ifsgn #1#2#3%
{%
\expandafter #1\expandafter #2\csname
- .=\expandafter\xintifSgn::
- \romannumeral-`0\XINT_expr_unlock #3,\endcsname
+ .=\expandafter\xintifSgn:\romannumeral-`0\XINT_expr_unlock #3,\endcsname
}%
\let\XINT_flexpr_func_ifsgn\XINT_expr_func_ifsgn
\let\XINT_iiexpr_func_ifsgn\XINT_expr_func_ifsgn
-\def\XINT_newexpr_print #1{\ifnum\xintNthElt{0}{#1}>1
- \expandafter\xint_firstoftwo
- \else
- \expandafter\xint_secondoftwo
- \fi
- {_xintListWithSep,{#1}}{\xint_firstofone#1}}%
-\xintForpair #1#2 in {(fl,Float),(i,iRound0),(bool,IsTrue)}\do {%
- \expandafter\def\csname XINT_new#1expr_print\endcsname
- ##1{\ifnum\xintNthElt{0}{##1}>1
- \expandafter\xint_firstoftwo
- \else
- \expandafter\xint_secondoftwo
- \fi
- {_xintListWithSep,{\xintApply{_xint#2}{##1}}}
- {_xint#2##1}}}%
+\def\XINT_expr_func_first #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\expandafter\XINT_expr_func_firsta
+ \romannumeral-`0\XINT_expr_unlock #3,^\endcsname }%
+\def\XINT_expr_func_firsta #1,#2^{#1}%
+\let\XINT_flexpr_func_first\XINT_expr_func_first
+\let\XINT_iiexpr_func_first\XINT_expr_func_first
+\def\XINT_expr_func_last #1#2#3% will not work in \xintNewExpr if macro param involved
+ {\expandafter #1\expandafter #2\csname.=\expandafter\XINT_expr_func_lasta
+ \romannumeral-`0\XINT_expr_unlock #3,^\endcsname }%
+\def\XINT_expr_func_lasta #1,#2%
+ {\if ^#2 #1\expandafter\xint_gobble_ii\fi \XINT_expr_func_lasta #2}%
+\let\XINT_flexpr_func_last\XINT_expr_func_last
+\let\XINT_iiexpr_func_last\XINT_expr_func_last
+\def\XINT_expr_func_odd #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintOdd{\XINT_expr_unlock #3}\endcsname}%
+\let\XINT_flexpr_func_odd\XINT_expr_func_odd
+\def\XINT_iiexpr_func_odd #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiOdd{\XINT_expr_unlock #3}\endcsname}%
+\def\XINT_expr_func_even #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintEven{\XINT_expr_unlock #3}\endcsname}%
+\let\XINT_flexpr_func_even\XINT_expr_func_even
+\def\XINT_iiexpr_func_even #1#2#3%
+ {\expandafter #1\expandafter #2\csname.=\xintiiEven{\XINT_expr_unlock #3}\endcsname}%
+\def\XINT_expr_func_nuple #1#2#3%
+ {\expandafter #1\expandafter #2\csname .=\XINT_expr_unlock #3\endcsname }%
+\let\XINT_flexpr_func_nuple\XINT_expr_func_nuple
+\let\XINT_iiexpr_func_nuple\XINT_expr_func_nuple
+\def\XINT_expr_func_reversed #1#2#3%
+ {\expandafter #1\expandafter #2\csname .=\xintReversed::csv
+ {\XINT_expr_unlock #3}\endcsname }%
+\let\XINT_flexpr_func_reversed\XINT_expr_func_reversed
+\let\XINT_iiexpr_func_reversed\XINT_expr_func_reversed
+\def\xintReversed::csv #1% should be done directly, of course
+ {\xintListWithSep,{\xintRevWithBraces {\xintCSVtoListNonStripped{#1}}}}%
+\def\xintSeqB:f:csv #1#2%
+ {\expandafter\XINT_seqb:f:csv \expandafter{\romannumeral0\xintraw{#2}}{#1}}%
+\def\XINT_seqb:f:csv #1#2{\expandafter\XINT_seqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_seqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintifCmp {#3}{#4}\XINT_seqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_seqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_seqb:f:csv_be #1#2#3#4#5{,#2}%
+\def\XINT_seqb:f:csv_bl #1{\if #1p\expandafter\XINT_seqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_seqb:f:csv_pa #1#2#3#4{\expandafter\XINT_seqb:f:csv_p\expandafter
+ {\romannumeral0\xintadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_seqb:f:csv_p #1#2%
+{%
+ \xintifCmp {#1}{#2}\XINT_seqb:f:csv_pa\XINT_seqb:f:csv_pb\XINT_seqb:f:csv_pc
+ {#1}{#2}%
+}%
+\def\XINT_seqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_seqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_seqb:f:csv_bg #1{\if #1n\expandafter\XINT_seqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_seqb:f:csv_na #1#2#3#4{\expandafter\XINT_seqb:f:csv_n\expandafter
+ {\romannumeral0\xintadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_seqb:f:csv_n #1#2%
+{%
+ \xintifCmp {#1}{#2}\XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_seqb:f:csv_na
+ {#1}{#2}%
+}%
+\def\XINT_seqb:f:csv_nb #1#2#3#4{#3,#1}%
+\def\XINT_seqb:f:csv_nc #1#2#3#4{#3}%
+\def\xintiiSeqb:f:csv #1#2%
+ {\expandafter\XINT_iiseqb:f:csv \expandafter{\romannumeral-`0#2}{#1}}%
+\def\XINT_iiseqb:f:csv #1#2{\expandafter\XINT_iiseqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_iiseqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintSgnFork{\XINT_Cmp {#3}{#4}}%
+ \XINT_iiseqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_iiseqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_iiseqb:f:csv_bl #1{\if #1p\expandafter\XINT_iiseqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_iiseqb:f:csv_pa #1#2#3#4{\expandafter\XINT_iiseqb:f:csv_p\expandafter
+ {\romannumeral0\xintiiadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_iiseqb:f:csv_p #1#2%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}%
+ \XINT_iiseqb:f:csv_pa\XINT_iiseqb:f:csv_pb\XINT_iiseqb:f:csv_pc {#1}{#2}%
+}%
+\def\XINT_iiseqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_iiseqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_iiseqb:f:csv_bg #1{\if #1n\expandafter\XINT_iiseqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_iiseqb:f:csv_na #1#2#3#4{\expandafter\XINT_iiseqb:f:csv_n\expandafter
+ {\romannumeral0\xintiiadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_iiseqb:f:csv_n #1#2%
+{%
+ \xintSgnFork{\XINT_Cmp {#1}{#2}}%
+ \XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_iiseqb:f:csv_na {#1}{#2}%
+}%
+\def\XINTinFloatSeqB:f:csv #1#2{\expandafter\XINT_flseqb:f:csv \expandafter
+ {\romannumeral0\XINTinfloat [\XINTdigits]{#2}}{#1}}%
+\def\XINT_flseqb:f:csv #1#2{\expandafter\XINT_flseqb:f:csv_a\romannumeral-`0#2#1!}%
+\def\XINT_flseqb:f:csv_a #1#2;#3;#4!{%
+ \expandafter\xint_gobble_i\romannumeral-`0%
+ \xintifCmp {#3}{#4}\XINT_flseqb:f:csv_bl\XINT_seqb:f:csv_be\XINT_flseqb:f:csv_bg
+ #1{#3}{#4}{}{#2}}%
+\def\XINT_flseqb:f:csv_bl #1{\if #1p\expandafter\XINT_flseqb:f:csv_pa\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_flseqb:f:csv_pa #1#2#3#4{\expandafter\XINT_flseqb:f:csv_p\expandafter
+ {\romannumeral0\XINTinfloatadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_flseqb:f:csv_p #1#2%
+{%
+ \xintifCmp {#1}{#2}%
+ \XINT_flseqb:f:csv_pa\XINT_flseqb:f:csv_pb\XINT_flseqb:f:csv_pc {#1}{#2}%
+}%
+\def\XINT_flseqb:f:csv_pb #1#2#3#4{#3,#1}%
+\def\XINT_flseqb:f:csv_pc #1#2#3#4{#3}%
+\def\XINT_flseqb:f:csv_bg #1{\if #1n\expandafter\XINT_flseqb:f:csv_na\else
+ \xint_afterfi{\expandafter,\xint_gobble_iv}\fi }%
+\def\XINT_flseqb:f:csv_na #1#2#3#4{\expandafter\XINT_flseqb:f:csv_n\expandafter
+ {\romannumeral0\XINTinfloatadd{#4}{#1}}{#2}{#3,#1}{#4}}%
+\def\XINT_flseqb:f:csv_n #1#2%
+{%
+ \xintifCmp {#1}{#2}%
+ \XINT_seqb:f:csv_nc\XINT_seqb:f:csv_nb\XINT_flseqb:f:csv_na {#1}{#2}%
+}%
+\def\xintApply::csv #1#2%
+ {\expandafter\XINT_applyon::_a\expandafter {\romannumeral-`0#2}{#1}}%
+\def\XINT_applyon::_a #1#2{\XINT_applyon::_b {#2}{}#1,,}%
+\def\XINT_applyon::_b #1#2#3,{\expandafter\XINT_applyon::_c \romannumeral-`0#3,{#1}{#2}}%
+\def\XINT_applyon::_c #1{\if #1,\expandafter\XINT_applyon::_end
+ \else\expandafter\XINT_applyon::_d\fi #1}%
+\def\XINT_applyon::_d #1,#2{\expandafter\XINT_applyon::_e\romannumeral-`0#2{#1},{#2}}%
+\def\XINT_applyon::_e #1,#2#3{\XINT_applyon::_b {#2}{#3, #1}}%
+\def\XINT_applyon::_end #1,#2#3{\xint_secondoftwo #3}%
+\def\xintApply:::csv #1#2#3%
+ {\expandafter\XINT_applyon:::_a\expandafter{\romannumeral-`0#2}{#1}{#3}}%
+\def\XINT_applyon:::_a #1#2#3{\XINT_applyon:::_b {#2}{#3}{}#1,,}%
+\def\XINT_applyon:::_b #1#2#3#4,%
+ {\expandafter\XINT_applyon:::_c \romannumeral-`0#4,{#1}{#2}{#3}}%
+\def\XINT_applyon:::_c #1{\if #1,\expandafter\XINT_applyon:::_end
+ \else\expandafter\XINT_applyon:::_d\fi #1}%
+\def\XINT_applyon:::_d #1,#2#3%
+ {\expandafter\XINT_applyon:::_e\expandafter
+ {\romannumeral-`0\xintApply::csv {#2{#1}}{#3}},{#2}{#3}}%
+\def\XINT_applyon:::_e #1,#2#3#4{\XINT_applyon:::_b {#2}{#3}{#4, #1}}%
+\def\XINT_applyon:::_end #1,#2#3#4{\xint_secondoftwo #4}%
+\def\XINT_expr_RApply::csv #1#2#3#4%
+ {~xintApply::csv{~expandafter#1~xint_exchangetwo_keepbraces{#4}}{#3}}%
+\def\XINT_expr_LApply::csv #1#2#3#4{~xintApply::csv{#1{#3}}{#4}}%
+\def\XINT_expr_RLApply:::csv #1#2{~xintApply:::csv{#1}}%
+\catcode`~ 12 % by the way, catcode is set to 3 in \XINTsetupcatcodes
+\catcode`$ 12 % $
+\def\XINT_xptwo_getab_b #1#2!#3%
+ {\expandafter\XINT_xptwo_getab_c\romannumeral-`0#3!#1{#1#2}}%
+\def\XINT_xptwo_getab_c #1#2!#3#4#5#6{#1#3{#5}{#6}{#1#2}{#4}}%
+\def\xint_ddfork #1$$#2#3\krof {#2}%
+\def\XINT_NEfork #1#2{\xint_ddfork
+ #1#2\XINT_expr_RLApply:::csv
+ #1$\XINT_expr_RApply::csv% $
+ $#2\XINT_expr_LApply::csv% $
+ $${\XINT_NEfork_nn #1#2}%
+ \krof }%
+\def\XINT_NEfork_nn #1#2#3#4{%
+ \if #1##\xint_dothis{#3}\fi
+ \if #1~\xint_dothis{#3}\fi
+ \if #2##\xint_dothis{#3}\fi
+ \if #2~\xint_dothis{#3}\fi
+ \xint_orthat {\csname #4NE\endcsname }%
+ }%
+\def\XINT_NEfork_one #1#2!#3#4#5#6{%
+ \if ###1\xint_dothis {#3}\fi
+ \if ~#1\xint_dothis {#3}\fi
+ \if $#1\xint_dothis {~xintApply::csv{#3#5}}\fi %$
+ \xint_orthat {\csname #4NE\endcsname #6}{#1#2}%
+}%
\toks0 {}%
-\xintFor #1 in {Bool,Toggle,Floor,Ceil,iRound,Round,iTrunc,Trunc,TFrac,%
- Lt,Gt,Eq,AND,OR,IsNotZero,IsZero,ifNotZero,ifSgn,%
- Irr,Num,Abs,Sgn,Opp,Quo,Rem,Add,Sub,Mul,Sqr,Div,Pow,Fac,fE,iSqrt,%
- iiAdd,iiSub,iiMul,iiSqr,iiPow,iiQuo,iiRem,iiSgn,iiAbs,iiOpp,iE}\do
+\xintFor #1 in {DivTrunc,iiDivTrunc,iiDivRound,Mod,iiMod,iRound,Round,iTrunc,Trunc,%
+ Lt,Gt,Eq,LtorEq,GtorEq,Neq,AND,OR,XOR,iQuo,iRem,Add,Sub,Mul,Div,Pow,E,%
+ iiAdd,iiSub,iiMul,iiPow,iiQuo,iiRem,iiE,SeqA::csv,iiSeqA::csv}\do
{\toks0
- \expandafter{\the\toks0\expandafter\def\csname xint#1\endcsname {_xint#1}}}%
-\xintFor #1 in {,Sqrt,Add,Sub,Mul,Div,Power,fE,Frac}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1\endcsname
- {_XINTinFloat#1}}}%
-\xintFor #1 in {GCDof,LCMof,Maxof,Minof,ANDof,ORof,XORof,Sum,Prd,%
- iMaxof,iMinof,iiSum,iiPrd}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname xint#1:csv\endcsname
- ####1{_xint#1{\xintCSVtoListNonStripped {####1}}}}}%
+ \expandafter{\the\toks0
+ \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\endcsname
+ \expandafter\def\csname xint#1\endcsname ####1####2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0####2!{####1}{~xint#1}{xint#1}}%
+ }%
+}%
+\xintFor #1 in {Num,Irr,Abs,iiAbs,Sgn,iiSgn,TFrac,Floor,iFloor,Ceil,iCeil,%
+ Sqr,iiSqr,iSqrt,iiIsZero,iiIsNotZero,iiifNotZero,iiifSgn,Odd,Even,iiOdd,iiEven,%
+ Opp,iiOpp,iiifZero,Fac,iFac,Bool,Toggle}\do
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\endcsname
+ \expandafter\def\csname xint#1\endcsname ####1{%
+ \expandafter\XINT_NEfork_one\romannumeral-`0####1!{~xint#1}{xint#1}{}{}}%
+ }%
+}%
+\xintFor #1 in {Add,Sub,Mul,Div,Power,E,Mod,SeqA::csv}\do
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\let\csname XINTinFloat#1NE\expandafter\endcsname
+ \csname XINTinFloat#1\endcsname
+ \expandafter\def\csname XINTinFloat#1\endcsname ####1####2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0####2!{####1}{~XINTinFloat#1}{XINTinFloat#1}}%
+ }%
+}%
+\toks0
+ \expandafter{\the\toks0
+ \let\xintSeqB::csvNE\xintSeqB::csv
+ \def\xintSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintSeqB:f:csv}{xintSeqB::csv}}%
+ \let\xintiiSeqB::csvNE\xintiiSeqB::csv
+ \def\xintiiSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintiiSeqB:f:csv}{xintiiSeqB::csv}}%
+ \let\XINTinFloatSeqB::csvNE\XINTinFloatSeqB::csv
+ \def\XINTinFloatSeqB::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$XINTinFloatSeqB:f:csv}{XINTinFloatSeqB::csv}}%
+ \let\xintSeq::csvNE\xintSeq::csv
+ \def\xintSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintSeq::csv}{xintSeq::csv}}%
+ \let\xintiiSeq::csvNE\xintiiSeq::csv
+ \def\xintiiSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$xintiiSeq::csv}{xintiiSeq::csv}}%
+ \let\XINTinFloatSeq::csvNE\XINTinFloatSeq::csv
+ \def\XINTinFloatSeq::csv ##1##2{%
+ \expandafter\XINT_NEfork
+ \romannumeral-`0\expandafter\XINT_xptwo_getab_b
+ \romannumeral-`0##2!{##1}{$noexpand$XINTinFloatSeq::csv}{XINTinFloatSeq::csv}}%
+ \let\XINTinFloatFracNE\XINTinFloatFrac
+ \def\XINTinFloatFrac ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatFrac}{XINTinFloatFrac}{}{}}%
+ \let\XINTinFloatdigitsNE\XINTinFloatdigits
+ \def\XINTinFloatdigits ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatdigits}{XINTinFloatdigits}{}{}}%
+ \let\XINTinFloatSqrtdigitsNE\XINTinFloatSqrtdigits
+ \def\XINTinFloatSqrtdigits ##1{\expandafter\XINT_NEfork_one\romannumeral-`0##1!%
+ {~XINTinFloatSqrtdigits}{XINTinFloatSqrtdigits}{}{}}%
+ \let\XINTinFloatNE\XINTinFloat
+ \def\XINTinFloat [##1]##2{% not ultimately general, but got tired
+ \expandafter\XINT_NEfork_one
+ \romannumeral-`0##2!{~XINTinFloat[##1]}{XINTinFloat}{}{[##1]}}%
+ \let\XINTinFloatSqrtNE\XINTinFloatSqrt
+ \def\XINTinFloatSqrt [##1]##2{%
+ \expandafter\XINT_NEfork_one
+ \romannumeral-`0##2!{~XINTinFloatSqrt[##1]}{XINTinFloatSqrt}{}{[##1]}}%
+}%
+\xintFor #1 in {ANDof,ORof,XORof,iiMaxof,iiMinof,iiSum,iiPrd,
+ GCDof,LCMof,Sum,Prd,Maxof,Minof}\do
+{\toks0
+ \expandafter{\the\toks0 \expandafter\def\csname xint#1:csv\endcsname {~xint#1:csv}}%
+}%
\xintFor #1 in {Maxof,Minof,Sum,Prd}\do
- {\toks0
- \expandafter{\the\toks0\expandafter\def\csname XINTinFloat#1:csv\endcsname
- ####1{_XINTinFloat#1{\xintCSVtoListNonStripped {####1}}}}}%
-\expandafter\def\expandafter\XINT_expr_protect\expandafter{\the\toks0
- \def\XINTdigits {_XINTdigits}%
- \def\XINT_expr_print ##1{\expandafter\XINT_newexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_flexpr_print ##1{\expandafter\XINT_newflexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_iexpr_print ##1{\expandafter\XINT_newiexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
- \def\XINT_boolexpr_print ##1{\expandafter\XINT_newboolexpr_print\expandafter
- {\romannumeral0\xintcsvtolistnonstripped{\XINT_expr_unlock ##1}}}%
+{\toks0
+ \expandafter{\the\toks0
+ \expandafter\def\csname XINTinFloat#1:csv\endcsname {~XINTinFloat#1:csv}}%
+}%
+\expandafter\def\expandafter\XINT_expr_redefinemacros\expandafter
+ {\the\toks0
+ \def\XINT_flexpr_noopt {\expandafter\XINT_flexpr_withopt_b\expandafter-%
+ \romannumeral0\xintbarefloateval }%
+ \def\XINT_flexpr_withopt_b ##1##2%
+ {\expandafter\XINT_flexpr_wrap\csname .;##1.=\XINT_expr_unlock ##2\endcsname }%
+ \def\XINT_expr_unlock_sp ##1.;##2##3.=##4!{\if -##2\expandafter\xint_firstoftwo
+ \else\expandafter\xint_secondoftwo\fi \XINTdigits{{##2##3}}{##4}}%
+ \def\XINT_expr_print ##1{\expandafter\xintSPRaw::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\XINT_iiexpr_print ##1{\expandafter\xintCSV::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\XINT_boolexpr_print ##1{\expandafter\xintIsTrue::csv\expandafter
+ {\romannumeral-`0\XINT_expr_unlock ##1}}%
+ \def\xintCSV::csv {~xintCSV::csv }% spaces to separate from possible catcode 11
+ \def\xintSPRaw::csv {~xintSPRaw::csv }% stuff after
+ \def\xintPFloat::csv {~xintPFloat::csv }%
+ \def\xintIsTrue::csv {~xintIsTrue::csv }%
+ \def\xintRound::csv {~xintRound::csv }%
+ \def\xintReversed::csv {~xintReversed::csv }%
+ \def\xintListSel:csv {~xintListSel:csv }%
}%
\toks0 {}%
\def\xintNewExpr {\xint_NewExpr\xinttheexpr }%
\def\xintNewFloatExpr {\xint_NewExpr\xintthefloatexpr }%
\def\xintNewIExpr {\xint_NewExpr\xinttheiexpr }%
-\let\xintNewNumExpr\xintNewIExpr
\def\xintNewIIExpr {\xint_NewExpr\xinttheiiexpr }%
\def\xintNewBoolExpr {\xint_NewExpr\xinttheboolexpr }%
+\def\XINT_newexpr_finish #1>{\noexpand\romannumeral-`0}%
\def\xint_NewExpr #1#2[#3]%
{%
\begingroup
@@ -1095,38 +2292,32 @@
\or \toks0 {\xdef #2##1##2##3##4##5##6##7##8##9}%
\fi
\xintexprSafeCatcodes
- \escapechar92
\XINT_NewExpr #1%
}%
-\catcode`* 13
-\def\XINT_NewExpr #1#2%
-{%
- \def\XINT_tmpa ##1##2##3##4##5##6##7##8##9{#2}%
- \XINT_expr_protect
- \lccode`*=`_ \lowercase {\def*}{!noexpand!}%
- \catcode`_ 13 \catcode`: 11
- \endlinechar -1 % 1.09i, 2013/12/18 not sure why I had that? removed.
- % 2014/02/13: you idiot, if not then spurious extra ending space
- % token makes impossible nesting of created macros!
- \everyeof {\noexpand }%
- \edef\XINT_tmpb ##1##2##3##4##5##6##7##8##9%
- {\scantokens
- \expandafter{\romannumeral-`0#1%
- \XINT_tmpa {####1}{####2}{####3}%
- {####4}{####5}{####6}%
- {####7}{####8}{####9}%
- \relax}}%
- \lccode`*=`\$ \lowercase {\def*}{####}%
- \catcode`\$ 13 \catcode`! 0 \catcode`_ 11 %
- \the\toks0
- {\scantokens\expandafter{\expandafter
- \XINT_newexpr_setprefix\meaning\XINT_tmpb}}%
+\catcode`~ 13 \catcode`@ 14 \catcode`\% 6 \catcode`# 12 \catcode`$ 11 @ $
+\def\XINT_NewExpr %1%2@
+{@
+ \def\XINT_tmpa %%1%%2%%3%%4%%5%%6%%7%%8%%9{%2}@
+ \XINT_expr_redefinemacros
+ \def~{$noexpand$}@ vvv v^^e9rifier si vraiment besoin pour ^ et !
+ \catcode`: 11 \catcode`_ 11 @ \catcode`^ 11 \catcode`! 11
+ \catcode`# 12 \catcode`~ 13 \escapechar 126
+ \endlinechar -1 \everyeof {\noexpand }@
+ \edef\XINT_tmpb
+ {\scantokens\expandafter
+ {\romannumeral-`0\expandafter%1\XINT_tmpa {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}\relax}@
+ }@
+ \escapechar 92 \catcode`# 6 \catcode`$ 0 @ $
+ \the\toks0
+ {\scantokens\expandafter{\expandafter\XINT_newexpr_finish\meaning\XINT_tmpb}}@
\endgroup
-}%
+}@
+\catcode`% 14
\let\xintexprRestoreCatcodes\empty
\def\xintexprSafeCatcodes
-{% for end user.
+{%
\edef\xintexprRestoreCatcodes {%
+ \catcode59=\the\catcode59 % ;
\catcode34=\the\catcode34 % "
\catcode63=\the\catcode63 % ?
\catcode124=\the\catcode124 % |
@@ -1149,7 +2340,8 @@
\catcode44=\the\catcode44 % ,
\catcode61=\the\catcode61 % =
\catcode32=\the\catcode32\relax % space
- }% it's hard to know where to stop...
+ }%
+ \catcode59=12 % ;
\catcode34=12 % "
\catcode63=12 % ?
\catcode124=12 % |
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index 09d75a2a9b3..1a92682ecc7 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintfrac: Expandable operations on fractions
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintfrac: Expandable operations on fractions
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,7 +36,6 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintfrac.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
@@ -53,7 +52,6 @@
\else
\ifx\x\relax % plain-TeX, first loading of xintfrac.sty
\ifx\w\relax % but xint.sty not yet loaded.
- \y{xintfrac}{now issuing \string\input\space xint.sty}%
\def\z{\endgroup\input xint.sty\relax}%
\fi
\else
@@ -61,48 +59,26 @@
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xint.sty not yet loaded.
- \y{xintfrac}{now issuing \string\RequirePackage{xint}}%
\def\z{\endgroup\RequirePackage{xint}}%
\fi
\else
- \y{xintfrac}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintfrac already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintfrac}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintfrac}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2014/04/01 v1.09n Expandable operations on fractions (jfB)]%
+ [2014/10/28 v1.1 Expandable operations on fractions (jfB)]%
\chardef\xint_c_xviii 18
+\def\XINT_cntSgnFork #1%
+{%
+ \ifcase #1\expandafter\xint_secondofthree
+ \or\expandafter\xint_thirdofthree
+ \else\expandafter\xint_firstofthree
+ \fi
+}%
\def\xintLen {\romannumeral0\xintlen }%
\def\xintlen #1%
{%
@@ -435,11 +411,16 @@
\expandafter{\romannumeral0\xint_dsh {#3}{#1}}{#2}}%
\def\XINT_rawz_Bb #1#2{ #2/#1}%
\def\xintFloor {\romannumeral0\xintfloor }%
-\def\xintfloor #1{\expandafter\XINT_floor
- \romannumeral0\xintrawwithzeros {#1}.}%
-\def\XINT_floor #1/#2.{\xintiiquo {#1}{#2}}%
+\def\xintfloor #1% devrais-je faire \xintREZ?
+ {\expandafter\XINT_ifloor \romannumeral0\xintrawwithzeros {#1}./1[0]}%
+\def\xintiFloor {\romannumeral0\xintifloor }%
+\def\xintifloor #1%
+ {\expandafter\XINT_ifloor \romannumeral0\xintrawwithzeros {#1}.}%
+\def\XINT_ifloor #1/#2.{\xintiiquo {#1}{#2}}%
\def\xintCeil {\romannumeral0\xintceil }%
\def\xintceil #1{\xintiiopp {\xintFloor {\xintOpp{#1}}}}%
+\def\xintiCeil {\romannumeral0\xinticeil }%
+\def\xinticeil #1{\xintiiopp {\xintiFloor {\xintOpp{#1}}}}%
\def\xintNumerator {\romannumeral0\xintnumerator }%
\def\xintnumerator
{%
@@ -617,15 +598,6 @@
\expandafter\XINT_e_end\expandafter{\the\numexpr #1+#4}{#2}{#3}%
}%
\def\XINT_e_end #1#2#3{ #2/#3[#1]}%
-\def\xintfE {\romannumeral0\xintfe }%
-\def\xintfe #1%
-{%
- \expandafter\XINT_fe \romannumeral0\XINT_infrac {#1}%
-}%
-\def\XINT_fe #1#2#3#4%
-{%
- \expandafter\XINT_e_end\expandafter{\the\numexpr #1+\xintNum{#4}}{#2}{#3}%
-}%
\def\xintFloatE {\romannumeral0\xintfloate }%
\def\xintfloate #1{\XINT_floate_chkopt #1\xint_relax }%
\def\XINT_floate_chkopt #1%
@@ -650,27 +622,11 @@
\expandafter\xint_exchangetwo_keepbraces\expandafter
{\the\numexpr #2+#5}{#1}{#3}{#4}\XINT_float_Q
}%
-\def\XINTinFloatfE {\romannumeral0\XINTinfloatfe }%
-\def\XINTinfloatfe [#1]#2%
-{%
- \expandafter\XINT_infloatfe_a\expandafter
- {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
-}%
-\def\XINT_infloatfe_a #1#2#3#4#5%
-{%
- \expandafter\expandafter\expandafter\XINT_infloat_a
- \expandafter\xint_exchangetwo_keepbraces\expandafter
- {\the\numexpr #2+\xintNum{#5}}{#1}{#3}{#4}\XINT_infloat_Q
-}%
-\def\xintiE {\romannumeral0\xintie }% for \xintiiexpr only
-\def\xintie #1%
-{%
- \expandafter\XINT_ie \romannumeral0\XINT_infrac {#1}% allows 3.123e3
-}%
-\def\XINT_ie #1#2#3#4% assumes #3=1 and uses \xint_dsh with its \numexpr
-{%
- \xint_dsh {#2}{0-(#1+#4)}% could have \xintNum{#4} for a bit more general
-}%
+\def\XINTinFloatE {\romannumeral0\XINTinfloate }%
+\def\XINTinfloate {\expandafter\XINT_infloate\romannumeral0\XINTinfloat [\XINTdigits]}%
+\def\XINT_infloate #1[#2]#3%
+ {\expandafter\XINT_infloate_end\expandafter {\the\numexpr #3+#2}{#1}}%
+\def\XINT_infloate_end #1#2{ #2[#1]}%
\def\xintIrr {\romannumeral0\xintirr }%
\def\xintirr #1%
{%
@@ -729,18 +685,11 @@
\expandafter\XINT_irr_finish\expandafter {#2}{#1}%
}%
\def\XINT_irr_finish #1#2#3{#3#1/#2}% changed in 1.08
-\def\xintNum {\romannumeral0\xintnum }%
-\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}\Z }%
-\edef\XINT_intcheck #1/#2\Z
+\def\xintifInt {\romannumeral0\xintifint }%
+\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintrawwithzeros {#1}.}%
+\def\XINT_ifint #1/#2.%
{%
- \noexpand\if 0\noexpand\XINT_isOne {#2}\noexpand\xintError:NotAnInteger
- \noexpand\fi\space #1%
-}%
-\def\xintifInt {\romannumeral0\xintifint }%
-\def\xintifint #1{\expandafter\XINT_ifint\romannumeral0\xintirr {#1}\Z }%
-\def\XINT_ifint #1/#2\Z
-{%
- \if\XINT_isOne {#2}1%
+ \if 0\xintiiRem {#1}{#2}%
\expandafter\xint_firstoftwo_thenstop
\else
\expandafter\xint_secondoftwo_thenstop
@@ -808,27 +757,22 @@
\XINT_irr_finish {#3}{#4}%
}%
\def\xintTFrac {\romannumeral0\xinttfrac }%
-\def\xinttfrac #1%
- {\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
+\def\xinttfrac #1{\expandafter\XINT_tfrac_fork\romannumeral0\xintrawwithzeros {#1}\Z }%
\def\XINT_tfrac_fork #1%
{%
\xint_UDzerominusfork
#1-\XINT_tfrac_zero
- 0#1\XINT_tfrac_N
- 0-{\XINT_tfrac_P #1}%
+ 0#1{\xintiiopp\XINT_tfrac_P }%
+ 0-{\XINT_tfrac_P #1}%
\krof
}%
\def\XINT_tfrac_zero #1\Z { 0/1[0]}%
-\def\XINT_tfrac_N {\expandafter\XINT_opp\romannumeral0\XINT_tfrac_P }%
-\def\XINT_tfrac_P #1/#2\Z
-{%
- \expandafter\XINT_rez_AB\romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}%
-}%
-\def\XINTinFloatFrac {\romannumeral0\XINTinfloatfrac }%
+\def\XINT_tfrac_P #1/#2\Z {\expandafter\XINT_rez_AB
+ \romannumeral0\xintiirem{#1}{#2}\Z {0}{#2}}%
+\def\XINTinFloatFrac {\romannumeral0\XINTinfloatfrac [\XINTdigits]}%
\def\XINTinfloatfrac [#1]#2%
{%
- \expandafter\XINT_infloatfrac_a\expandafter
- {\romannumeral0\xinttfrac{#2}}{#1}%
+ \expandafter\XINT_infloatfrac_a\expandafter {\romannumeral0\xinttfrac{#2}}{#1}%
}%
\def\XINT_infloatfrac_a #1#2{\XINTinFloat [#2]{#1}}%
\def\xintTrunc {\romannumeral0\xinttrunc }%
@@ -926,8 +870,18 @@
\def\XINT_trunc_Hb #1#2#3%
{%
\expandafter #3\expandafter0\expandafter.%
- \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {}#2% #1=-0 autoris^^e9 !
+ \romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {}#2% #1=-0 autoris\'e !
}%
+\def\xintTTrunc {\romannumeral0\xintttrunc }%
+\def\xintttrunc #1%
+{%
+ \expandafter\XINT_itrunc_G
+ \romannumeral0\expandafter\XINT_ttrunc_A
+ \romannumeral0\XINT_infrac {#1}0% this last 0 to let \XINT_itrunc_G be happy
+}%
+\def\XINT_ttrunc_A #1#2#3{\XINT_trunc_checkifzero {#1}#2\Z {#3}}%
+\let\xintNum \xintTTrunc
+\let\xintnum \xintttrunc
\def\xintRound {\romannumeral0\xintround }%
\def\xintiRound {\romannumeral0\xintiround }%
\def\xintround #1%
@@ -1409,6 +1363,57 @@
{\the\numexpr #3+#4+\xint_c_i-#2}{#1}%
}%
\def\XINT_float_Y #1#2{ #2e#1}%
+\def\xintPFloat {\romannumeral0\xintpfloat }%
+\def\xintpfloat #1{\XINT_pfloat_chkopt #1\xint_relax }%
+\def\XINT_pfloat_chkopt #1%
+{%
+ \ifx [#1\expandafter\XINT_pfloat_opt
+ \else\expandafter\XINT_pfloat_noopt
+ \fi #1%
+}%
+\def\XINT_pfloat_noopt #1\xint_relax
+{%
+ \expandafter\XINT_pfloat_a\expandafter\XINTdigits
+ \romannumeral0\XINTinfloat [\XINTdigits]{#1}%
+}%
+\def\XINT_pfloat_opt [\xint_relax #1]%#2%
+{%
+ \expandafter\XINT_pfloat_a\expandafter {\the\numexpr #1\expandafter}%
+ \romannumeral0\XINTinfloat [\numexpr #1\relax]%{#2}%
+}%
+\def\XINT_pfloat_a #1#2%
+{%
+ \xint_UDzerominusfork
+ #2-\XINT_pfloat_zero
+ 0#2\XINT_pfloat_neg
+ 0-{\XINT_pfloat_pos #2}%
+ \krof {#1}%
+}%
+\def\XINT_pfloat_zero #1[#2]{ 0}%
+\def\XINT_pfloat_neg
+ {\expandafter\xint_minus_thenstop\romannumeral0\XINT_pfloat_pos {}}%
+\def\XINT_pfloat_pos #1#2#3[#4]%
+{%
+ \ifnum#4>0 \xint_dothis\XINT_pfloat_no\fi
+ \ifnum#4>\numexpr-#2\relax \xint_dothis\XINT_pfloat_b\fi
+ \ifnum#4>\numexpr-#2-\xint_c_v\relax \xint_dothis\XINT_pfloat_B\fi
+ \xint_orthat\XINT_pfloat_no {#2}{#4}{#1#3}%
+}%
+\def\XINT_pfloat_no #1#2%
+{%
+ \expandafter\XINT_pfloat_no_b\expandafter{\the\numexpr #2+#1-\xint_c_i\relax}%
+}%
+\def\XINT_pfloat_no_b #1#2{\XINT_pfloat_no_c #2e#1}%
+\def\XINT_pfloat_no_c #1{ #1.}%
+\def\XINT_pfloat_b #1#2#3%
+ {\expandafter\XINT_pfloat_c
+ \romannumeral0\expandafter\XINT_split_fromleft_loop
+ \expandafter {\the\numexpr #1+#2-\xint_c_i}#3\W\W\W\W\W\W\W\W\Z }%
+\def\XINT_pfloat_c #1#2{ #1.#2}% #2 peut ^^eatre vide
+\def\XINT_pfloat_B #1#2#3%
+ {\expandafter\XINT_pfloat_C
+ \romannumeral0\XINT_dsx_zeroloop {\numexpr -#1-#2}{}\Z {}#3}%
+\def\XINT_pfloat_C { 0.}%
\def\XINTinFloat {\romannumeral0\XINTinfloat }%
\def\XINTinfloat [#1]#2%
{%
@@ -1499,66 +1504,108 @@
}%
\def\XINT_infloat_X #1#2{ #2[#1]}%
\def\xintAdd {\romannumeral0\xintadd }%
-\def\xintadd #1%
+\def\xintadd #1{\expandafter\xint_fadd\romannumeral0\xintraw {#1}}%
+\def\xint_fadd #1{\xint_gob_til_zero #1\XINT_fadd_Azero 0\XINT_fadd_a #1}%
+\def\XINT_fadd_Azero #1]{\xintraw }%
+\def\XINT_fadd_a #1/#2[#3]#4%
+ {\expandafter\XINT_fadd_b\romannumeral0\xintraw {#4}{#3}{#1}{#2}}%
+\def\XINT_fadd_b #1{\xint_gob_til_zero #1\XINT_fadd_Bzero 0\XINT_fadd_c #1}%
+\def\XINT_fadd_Bzero #1]#2#3#4{ #3/#4[#2]}%
+\def\XINT_fadd_c #1/#2[#3]#4%
{%
- \expandafter\xint_fadd\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fadd_Aa\expandafter{\the\numexpr #4-#3}{#3}{#4}{#1}{#2}%
}%
-\def\xint_fadd #1#2{\expandafter\XINT_fadd_A\romannumeral0\XINT_infrac{#2}#1}%
-\def\XINT_fadd_A #1#2#3#4%
+\def\XINT_fadd_Aa #1%
{%
- \ifnum #4 > #1
- \xint_afterfi {\XINT_fadd_B {#1}}%
+ \ifcase\XINT_cntSgn #1\Z
+ \expandafter\XINT_fadd_B
+ \or
+ \expandafter \XINT_fadd_Ba
\else
- \xint_afterfi {\XINT_fadd_B {#4}}%
- \fi
- {#1}{#4}{#2}{#3}%
+ \expandafter \XINT_fadd_Bb
+ \fi {#1}%
}%
-\def\XINT_fadd_B #1#2#3#4#5#6#7%
+\def\XINT_fadd_B #1#2#3#4#5#6#7{\XINT_fadd_C {#4}{#5}{#7}{#6}[#3]}%
+\def\XINT_fadd_Ba #1#2#3#4#5#6#7%
{%
\expandafter\XINT_fadd_C\expandafter
- {\romannumeral0\xintiimul {#7}{#5}}%
- {\romannumeral0\xintiiadd
- {\romannumeral0\xintiimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
- {\romannumeral0\xintiimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
- }%
- {#1}%
+ {\romannumeral0\XINT_dsx_zeroloop {#1}{}\Z {#6}}%
+ {#7}{#5}{#4}[#2]%
+}%
+\def\XINT_fadd_Bb #1#2#3#4#5#6#7%
+{%
+ \expandafter\XINT_fadd_C\expandafter
+ {\romannumeral0\XINT_dsx_zeroloop {-#1}{}\Z {#4}}%
+ {#5}{#7}{#6}[#3]%
}%
\def\XINT_fadd_C #1#2#3%
{%
- \expandafter\XINT_fadd_D\expandafter {#2}{#3}{#1}%
+ \ifcase\romannumeral0\XINT_cmp_pre {#2}{#3} %<- intentional space here.
+ \expandafter\XINT_fadd_eq
+ \or\expandafter\XINT_fadd_D
+ \else\expandafter\XINT_fadd_Da
+ \fi {#2}{#3}{#1}%
}%
-\def\XINT_fadd_D #1#2{\XINT_outfrac {#2}{#1}}%
-\def\xintSub {\romannumeral0\xintsub }%
-\def\xintsub #1%
+\def\XINT_fadd_eq #1#2#3#4%#5%
{%
- \expandafter\xint_fsub\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {#3}{#4}/#1%[#5]%
}%
-\def\xint_fsub #1#2%
- {\expandafter\XINT_fsub_A\romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fsub_A #1#2#3#4%
+\def\XINT_fadd_D #1#2%
{%
- \ifnum #4 > #1
- \xint_afterfi {\XINT_fsub_B {#1}}%
- \else
- \xint_afterfi {\XINT_fsub_B {#4}}%
- \fi
- {#1}{#4}{#2}{#3}%
+ \expandafter\XINT_fadd_E\romannumeral0\XINT_div_prepare {#2}{#1}{#1}{#2}%
}%
-\def\XINT_fsub_B #1#2#3#4#5#6#7%
+\def\XINT_fadd_E #1#2%
{%
- \expandafter\XINT_fsub_C\expandafter
- {\romannumeral0\xintiimul {#7}{#5}}%
- {\romannumeral0\xintiisub
- {\romannumeral0\xintiimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
- {\romannumeral0\xintiimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
- }%
- {#1}%
+ \if0\XINT_Sgn #2\Z
+ \expandafter\XINT_fadd_F
+ \else\expandafter\XINT_fadd_K
+ \fi {#1}%
+}%
+\def\XINT_fadd_F #1#2#3#4#5%#6%
+{%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {\xintiiMul {#5}{#1}}{#4}/#2%[#6]%
+}%
+\def\XINT_fadd_Da #1#2%
+{%
+ \expandafter\XINT_fadd_Ea\romannumeral0\XINT_div_prepare {#1}{#2}{#1}{#2}%
+}%
+\def\XINT_fadd_Ea #1#2%
+{%
+ \if0\XINT_Sgn #2\Z
+ \expandafter\XINT_fadd_Fa
+ \else\expandafter\XINT_fadd_K
+ \fi {#1}%
+}%
+\def\XINT_fadd_Fa #1#2#3#4#5%#6%
+{%
+ \expandafter\XINT_fadd_G
+ \romannumeral0\xintiiadd {\xintiiMul {#4}{#1}}{#5}/#3%[#6]%
}%
-\def\XINT_fsub_C #1#2#3%
+\def\XINT_fadd_G #1{\if0#1\XINT_fadd_iszero\fi\space #1}%
+\def\XINT_fadd_K #1#2#3#4#5%
{%
- \expandafter\XINT_fsub_D\expandafter {#2}{#3}{#1}%
+ \expandafter\XINT_fadd_L
+ \romannumeral0\xintiiadd {\xintiiMul {#2}{#5}}{\xintiiMul {#3}{#4}}.%
+ {{#2}{#3}}%
}%
-\def\XINT_fsub_D #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fadd_L #1{\if0#1\XINT_fadd_iszero\fi \XINT_fadd_M #1}%
+\def\XINT_fadd_M #1.#2{\expandafter\XINT_fadd_N \expandafter
+ {\romannumeral0\xintiimul #2}{#1}}%
+\def\XINT_fadd_N #1#2{ #2/#1}%
+\edef\XINT_fadd_iszero\fi #1[#2]{\noexpand\fi\space 0/1[0]}% ou [#2] originel?
+\def\xintSub {\romannumeral0\xintsub }%
+\def\xintsub #1{\expandafter\xint_fsub\romannumeral0\xintraw {#1}}%
+\def\xint_fsub #1{\xint_gob_til_zero #1\XINT_fsub_Azero 0\XINT_fsub_a #1}%
+\def\XINT_fsub_Azero #1]{\xintopp }%
+\def\XINT_fsub_a #1/#2[#3]#4%
+ {\expandafter\XINT_fsub_b\romannumeral0\xintraw {#4}{#3}{#1}{#2}}%
+\def\XINT_fsub_b #1{\xint_UDzerominusfork
+ #1-\XINT_fadd_Bzero
+ 0#1\XINT_fadd_c
+ 0-{\XINT_fadd_c -#1}%
+ \krof }%
\def\xintSum {\romannumeral0\xintsum }%
\def\xintsum #1{\xintsumexpr #1\relax }%
\def\xintSumExpr {\romannumeral0\xintsumexpr }%
@@ -1579,30 +1626,36 @@
}%
\def\XINT_fsum_finished #1\Z #2{ #2}%
\def\xintMul {\romannumeral0\xintmul }%
-\def\xintmul #1%
+\def\xintmul #1{\expandafter\xint_fmul\romannumeral0\xintraw {#1}.}%
+\def\xint_fmul #1{\xint_gob_til_zero #1\XINT_fmul_zero 0\XINT_fmul_a #1}%
+\def\XINT_fmul_a #1[#2].#3%
+ {\expandafter\XINT_fmul_b\romannumeral0\xintraw {#3}#1[#2.]}%
+\def\XINT_fmul_b #1{\xint_gob_til_zero #1\XINT_fmul_zero 0\XINT_fmul_c #1}%
+\def\XINT_fmul_c #1/#2[#3]#4/#5[#6.]%
{%
- \expandafter\xint_fmul\expandafter {\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fmul_d
+ \expandafter{\the\numexpr #3+#6\expandafter}%
+ \expandafter{\romannumeral0\xintiimul {#5}{#2}}%
+ {\romannumeral0\xintiimul {#4}{#1}}%
}%
-\def\xint_fmul #1#2%
- {\expandafter\XINT_fmul_A\romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fmul_A #1#2#3#4#5#6%
+\def\XINT_fmul_d #1#2#3%
{%
- \expandafter\XINT_fmul_B
- \expandafter{\the\numexpr #1+#4\expandafter}%
- \expandafter{\romannumeral0\xintiimul {#6}{#3}}%
- {\romannumeral0\xintiimul {#5}{#2}}%
+ \expandafter \XINT_fmul_e \expandafter{#3}{#1}{#2}%
}%
-\def\XINT_fmul_B #1#2#3%
-{%
- \expandafter \XINT_fmul_C \expandafter{#3}{#1}{#2}%
-}%
-\def\XINT_fmul_C #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fmul_e #1#2{\XINT_outfrac {#2}{#1}}%
+\def\XINT_fmul_zero #1.#2{ 0/1[0]}%
\def\xintSqr {\romannumeral0\xintsqr }%
-\def\xintsqr #1%
+\def\xintsqr #1{\expandafter\xint_fsqr\romannumeral0\xintraw {#1}}%
+\def\xint_fsqr #1{\xint_gob_til_zero #1\XINT_fsqr_zero 0\XINT_fsqr_a #1}%
+\def\xint_fsqr_a #1/#2[#3]%
{%
- \expandafter\xint_fsqr\expandafter{\romannumeral0\XINT_infrac {#1}}%
+ \expandafter\XINT_fsqr_b
+ \expandafter{\the\numexpr #3+#3\expandafter}%
+ \expandafter{\romannumeral0\xintiisqr {#2}}%
+ {\romannumeral0\xintiisqr {#1}}%
}%
-\def\xint_fsqr #1{\XINT_fmul_A #1#1}%
+\def\XINT_fsqr_b #1#2#3{\expandafter \XINT_fmul_e \expandafter{#3}{#1}{#2}}%
+\def\XINT_fsqr_zero #1]{ 0/1[0]}%
\def\xintPow {\romannumeral0\xintpow }%
\def\xintpow #1%
{%
@@ -1685,7 +1738,55 @@
\expandafter{#3}{#1}{#2}%
}%
\def\XINT_fdiv_C #1#2{\XINT_outfrac {#2}{#1}}%
-\def\xintIsOne {\romannumeral0\xintisone }%
+\def\xintDivFloor {\romannumeral0\xintdivfloor }%
+\def\xintdivfloor #1#2{\xintfloor{\xintDiv {#1}{#2}}}%
+\def\xintDivTrunc {\romannumeral0\xintdivtrunc }%
+\def\xintdivtrunc #1#2{\xintitrunc 0{\xintDiv {#1}{#2}}}%
+\def\xintDivRound {\romannumeral0\xintdivround }%
+\def\xintdivround #1#2{\xintiround 0{\xintDiv {#1}{#2}}}%
+\def\xintMod {\romannumeral0\xintmod }%
+\def\xintmod #1{\expandafter\XINT_mod_a\romannumeral0\xintraw{#1}.}%
+\def\XINT_mod_a #1#2.#3%
+ {\expandafter\XINT_mod_b\expandafter #1\romannumeral0\xintraw{#3}#2.}%
+\def\XINT_mod_b #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis\XINT_mod_divbyzero\fi
+ \if0#1\xint_dothis\XINT_mod_aiszero\fi
+ \if-#2\xint_dothis{\XINT_mod_bneg #1}\fi
+ \xint_orthat{\XINT_mod_bpos #1#2}%
+}%
+\def\XINT_mod_bpos #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_mod_pos {}}%
+ -{\XINT_mod_pos #1}%
+ \krof
+}%
+\def\XINT_mod_bneg #1%
+{%
+ \xint_UDsignfork
+ #1{\xintiiopp\XINT_mod_pos {}}%
+ -{\XINT_mod_pos #1}%
+ \krof
+}%
+\def\XINT_mod_divbyzero #1.{\xintError:DivisionByZero\space 0/1[0]}%
+\def\XINT_mod_aiszero #1.{ 0/1[0]}%
+\def\XINT_mod_pos #1#2/#3[#4]#5/#6[#7].%
+{%
+ \expandafter\XINT_mod_pos_a
+ \the\numexpr\ifnum#7>#4 #4\else #7\fi\expandafter.\expandafter
+ {\romannumeral0\xintiimul {#6}{#3}}% n fois u
+ {\xintiiE{\xintiiMul {#1#5}{#3}}{#7-#4}}% m fois u
+ {\xintiiE{\xintiiMul {#2}{#6}}{#4-#7}}% t fois n
+}%
+\def\XINT_mod_pos_a #1.#2#3#4{\xintiirem {#3}{#4}/#2[#1]}%
+\def\XINTinFloatMod {\romannumeral0\XINTinfloatmod [\XINTdigits]}%
+\def\XINTinfloatmod [#1]#2#3{\expandafter\XINT_infloatmod\expandafter
+ {\romannumeral0\XINTinfloat[#1]{#2}}%
+ {\romannumeral0\XINTinfloat[#1]{#3}}{#1}}%
+\def\XINT_infloatmod #1#2{\expandafter\XINT_infloatmod_a\expandafter {#2}{#1}}%
+\def\XINT_infloatmod_a #1#2#3{\XINTinfloat [#3]{\xintMod {#2}{#1}}}%
+\def\xintIsOne {\romannumeral0\xintisone }%
\def\xintisone #1{\expandafter\XINT_fracisone
\romannumeral0\xintrawwithzeros{#1}\Z }%
\def\XINT_fracisone #1/#2\Z
@@ -1831,7 +1932,6 @@
\def\XINT_minof_d #1\Z
{\expandafter\XINT_minof_b\romannumeral0\xintmin {#1}}%
\def\XINT_minof_e #1\Z #2\Z { #2}%
-\def\xintCmp {\romannumeral0\xintcmp }%
\def\xintcmp #1%
{%
\expandafter\xint_fcmp\expandafter {\romannumeral0\xintraw {#1}}%
@@ -2514,84 +2614,6 @@
{\expandafter\XINT_flminof_b\romannumeral0\xintmin
{\XINTinFloat [\XINTdigits]{#1}}}%
\def\XINT_flminof_e #1\Z #2\Z { #2}%
-\def\xintRound:csv #1{\expandafter\XINT_round:_a\romannumeral-`0#1,,^}%
-\def\XINT_round:_a {\XINT_round:_b {}}%
-\def\XINT_round:_b #1#2,%
- {\expandafter\XINT_round:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_round:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_round:_d\fi #1}%
-\def\XINT_round:_d #1,%
- {\expandafter\XINT_round:_e\romannumeral0\xintiround 0{#1},}%
-\def\XINT_round:_e #1,#2{\XINT_round:_b {#2,#1}}%
-\def\xintFloat:csv #1{\expandafter\XINT_float:_a\romannumeral-`0#1,,^}%
-\def\XINT_float:_a {\XINT_float:_b {}}%
-\def\XINT_float:_b #1#2,%
- {\expandafter\XINT_float:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_float:_c #1{\if #1,\expandafter\XINT_:_f
- \else\expandafter\XINT_float:_d\fi #1}%
-\def\XINT_float:_d #1,%
- {\expandafter\XINT_float:_e\romannumeral0\xintfloat {#1},}%
-\def\XINT_float:_e #1,#2{\XINT_float:_b {#2,#1}}%
-\def\xintSum:csv #1{\expandafter\XINT_sum:_a\romannumeral-`0#1,,^}%
-\def\XINT_sum:_a {\XINT_sum:_b {0/1[0]}}%
-\def\XINT_sum:_b #1#2,{\expandafter\XINT_sum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_sum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_sum:_d\fi #1}%
-\def\XINT_sum:_d #1,#2{\expandafter\XINT_sum:_b\expandafter
- {\romannumeral0\xintadd {#2}{#1}}}%
-\def\xintPrd:csv #1{\expandafter\XINT_prd:_a\romannumeral-`0#1,,^}%
-\def\XINT_prd:_a {\XINT_prd:_b {1/1[0]}}%
-\def\XINT_prd:_b #1#2,{\expandafter\XINT_prd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_prd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_prd:_d\fi #1}%
-\def\XINT_prd:_d #1,#2{\expandafter\XINT_prd:_b\expandafter
- {\romannumeral0\xintmul {#2}{#1}}}%
-\def\xintMaxof:csv #1{\expandafter\XINT_maxof:_b\romannumeral-`0#1,,}%
-\def\XINT_maxof:_b #1,#2,{\expandafter\XINT_maxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_maxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_maxof:_d\fi #1}%
-\def\XINT_maxof:_d #1,{\expandafter\XINT_maxof:_b\romannumeral0\xintmax {#1}}%
-\def\xintMinof:csv #1{\expandafter\XINT_minof:_b\romannumeral-`0#1,,}%
-\def\XINT_minof:_b #1,#2,{\expandafter\XINT_minof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_minof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_minof:_d\fi #1}%
-\def\XINT_minof:_d #1,{\expandafter\XINT_minof:_b\romannumeral0\xintmin {#1}}%
-\def\XINTinFloatMinof:csv #1{\expandafter\XINT_flminof:_a\romannumeral-`0#1,,}%
-\def\XINT_flminof:_a #1,{\expandafter\XINT_flminof:_b
- \romannumeral0\XINTinfloat [\XINTdigits]{#1},}%
-\def\XINT_flminof:_b #1,#2,%
- {\expandafter\XINT_flminof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flminof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_flminof:_d\fi #1}%
-\def\XINT_flminof:_d #1,%
- {\expandafter\XINT_flminof:_b\romannumeral0\xintmin
- {\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINTinFloatMaxof:csv #1{\expandafter\XINT_flmaxof:_a\romannumeral-`0#1,,}%
-\def\XINT_flmaxof:_a #1,{\expandafter\XINT_flmaxof:_b
- \romannumeral0\XINTinfloat [\XINTdigits]{#1},}%
-\def\XINT_flmaxof:_b #1,#2,%
- {\expandafter\XINT_flmaxof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_flmaxof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_flmaxof:_d\fi #1}%
-\def\XINT_flmaxof:_d #1,%
- {\expandafter\XINT_flmaxof:_b\romannumeral0\xintmax
- {\XINTinFloat [\XINTdigits]{#1}}}%
-\def\XINTinFloatSum:csv #1{\expandafter\XINT_floatsum:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatsum:_a {\XINT_floatsum:_b {0[0]}}%
-\def\XINT_floatsum:_b #1#2,%
- {\expandafter\XINT_floatsum:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatsum:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_floatsum:_d\fi #1}%
-\def\XINT_floatsum:_d #1,#2{\expandafter\XINT_floatsum:_b\expandafter
- {\romannumeral0\XINTinfloatadd {#2}{#1}}}%
-\def\XINTinFloatPred:csv #1{\expandafter\XINT_floatprd:_a\romannumeral-`0#1,,^}%
-\def\XINT_floatprd:_a {\XINT_floatprd:_b {1[0]}}%
-\def\XINT_floatprd:_b #1#2,%
- {\expandafter\XINT_floatprd:_c\romannumeral-`0#2,{#1}}%
-\def\XINT_floatprd:_c #1{\if #1,\expandafter\XINT_:_e
- \else\expandafter\XINT_floatprd:_d\fi #1}%
-\def\XINT_floatprd:_d #1,#2{\expandafter\XINT_floatprd:_b\expandafter
- {\romannumeral0\XINTinfloatmul {#2}{#1}}}%
\XINT_restorecatcodes_endinput%
\endinput
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
index 15f5e156046..ec42410dc1c 100644
--- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintgcd: Euclidean algorithm with xint package
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintgcd: Euclidean algorithm with xint package
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,10 +36,9 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintgcd.sty\endcsname
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -52,56 +51,26 @@
\aftergroup\endinput
\else
\ifx\x\relax % plain-TeX, first loading of xintgcd.sty
- \ifx\w\relax % but xint.sty not yet loaded.
- \y{xintgcd}{now issuing \string\input\space xint.sty}%
- \def\z{\endgroup\input xint.sty\relax}%
+ \ifx\w\relax % but xintcore.sty not yet loaded.
+ \def\z{\endgroup\input xintcore.sty\relax}%
\fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
- \ifx\w\relax % xint.sty not yet loaded.
- \y{xintgcd}{now issuing \string\RequirePackage{xint}}%
- \def\z{\endgroup\RequirePackage{xint}}%
+ \ifx\w\relax % xintcore.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintcore}}%
\fi
\else
- \y{xintgcd}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintgcd already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintgcd}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintgcd}{Loading of package xint failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2014/04/01 v1.09n Euclide algorithm with xint package (jfB)]%
+ [2014/10/28 v1.1 Euclide algorithm with xint package (jfB)]%
\def\xintGCD {\romannumeral0\xintgcd }%
\def\xintgcd #1%
{%
@@ -135,13 +104,6 @@
\romannumeral0\XINT_div_prepare {#1}{#2}\Z
{#1}%
}%
-\def\xintGCDof {\romannumeral0\xintgcdof }%
-\def\xintgcdof #1{\expandafter\XINT_gcdof_a\romannumeral-`0#1\relax }%
-\def\XINT_gcdof_a #1{\expandafter\XINT_gcdof_b\romannumeral-`0#1\Z }%
-\def\XINT_gcdof_b #1\Z #2{\expandafter\XINT_gcdof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_gcdof_c #1{\xint_gob_til_relax #1\XINT_gcdof_e\relax\XINT_gcdof_d #1}%
-\def\XINT_gcdof_d #1\Z {\expandafter\XINT_gcdof_b\romannumeral0\xintgcd {#1}}%
-\def\XINT_gcdof_e #1\Z #2\Z { #2}%
\def\xintLCM {\romannumeral0\xintlcm}%
\def\xintlcm #1%
{%
@@ -164,13 +126,6 @@
\def\XINT_lcm_AisZero #1#2#3#4#5{ 0}%
\def\XINT_lcm_BisZero #1#2#3#4#5{ 0}%
\def\XINT_lcm_notzero #1#2#3{\xintiimul {#2}{\xintiiQuo{#3}{#1}}}%
-\def\xintLCMof {\romannumeral0\xintlcmof }%
-\def\xintlcmof #1{\expandafter\XINT_lcmof_a\romannumeral-`0#1\relax }%
-\def\XINT_lcmof_a #1{\expandafter\XINT_lcmof_b\romannumeral-`0#1\Z }%
-\def\XINT_lcmof_b #1\Z #2{\expandafter\XINT_lcmof_c\romannumeral-`0#2\Z {#1}\Z}%
-\def\XINT_lcmof_c #1{\xint_gob_til_relax #1\XINT_lcmof_e\relax\XINT_lcmof_d #1}%
-\def\XINT_lcmof_d #1\Z {\expandafter\XINT_lcmof_b\romannumeral0\xintlcm {#1}}%
-\def\XINT_lcmof_e #1\Z #2\Z { #2}%
\def\xintBezout {\romannumeral0\xintbezout }%
\def\xintbezout #1%
{%
@@ -421,7 +376,29 @@
{%
\space {#1}{#3}{0}{1}{#2}{#4}{1}{0}%
}%
-\def\xintTypesetEuclideAlgorithm #1#2%
+\def\xintGCDof {\romannumeral0\xintgcdof }%
+\def\xintgcdof #1{\expandafter\XINT_gcdof_a\romannumeral-`0#1\relax }%
+\def\XINT_gcdof_a #1{\expandafter\XINT_gcdof_b\romannumeral-`0#1\Z }%
+\def\XINT_gcdof_b #1\Z #2{\expandafter\XINT_gcdof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_gcdof_c #1{\xint_gob_til_relax #1\XINT_gcdof_e\relax\XINT_gcdof_d #1}%
+\def\XINT_gcdof_d #1\Z {\expandafter\XINT_gcdof_b\romannumeral0\xintgcd {#1}}%
+\def\XINT_gcdof_e #1\Z #2\Z { #2}%
+\def\xintLCMof {\romannumeral0\xintlcmof }%
+\def\xintlcmof #1{\expandafter\XINT_lcmof_a\romannumeral-`0#1\relax }%
+\def\XINT_lcmof_a #1{\expandafter\XINT_lcmof_b\romannumeral-`0#1\Z }%
+\def\XINT_lcmof_b #1\Z #2{\expandafter\XINT_lcmof_c\romannumeral-`0#2\Z {#1}\Z}%
+\def\XINT_lcmof_c #1{\xint_gob_til_relax #1\XINT_lcmof_e\relax\XINT_lcmof_d #1}%
+\def\XINT_lcmof_d #1\Z {\expandafter\XINT_lcmof_b\romannumeral0\xintlcm {#1}}%
+\def\XINT_lcmof_e #1\Z #2\Z { #2}%
+\def\xintTypesetEuclideAlgorithm {%
+ \unless\ifdefined\xintAssignArray
+ \errmessage
+ {xintgcd: package xinttools is required for \string\xintTypesetEuclideAlgorithm}%
+ \expandafter\xint_gobble_iii
+ \fi
+ \XINT_TypesetEuclideAlgorithm
+}%
+\def\XINT_TypesetEuclideAlgorithm #1#2%
{% l'algo remplace #1 et #2 par |#1| et |#2|
\par
\begingroup
@@ -440,7 +417,15 @@
\repeat
\endgroup
}%
-\def\xintTypesetBezoutAlgorithm #1#2%
+\def\xintTypesetBezoutAlgorithm {%
+ \unless\ifdefined\xintAssignArray
+ \errmessage
+ {xintgcd: package xinttools is required for \string\xintTypesetBezoutAlgorithm}%
+ \expandafter\xint_gobble_iii
+ \fi
+ \XINT_TypesetBezoutAlgorithm
+}%
+\def\XINT_TypesetBezoutAlgorithm #1#2%
{%
\par
\begingroup
@@ -476,16 +461,6 @@
\par
\endgroup
}%
-\def\xintGCDof:csv #1{\expandafter\XINT_gcdof:_b\romannumeral-`0#1,,}%
-\def\XINT_gcdof:_b #1,#2,{\expandafter\XINT_gcdof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_gcdof:_c #1{\if #1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_gcdof:_d\fi #1}%
-\def\XINT_gcdof:_d #1,{\expandafter\XINT_gcdof:_b\romannumeral0\xintgcd {#1}}%
-\def\xintLCMof:csv #1{\expandafter\XINT_lcmof:_a\romannumeral-`0#1,,}%
-\def\XINT_lcmof:_a #1,#2,{\expandafter\XINT_lcmof:_c\romannumeral-`0#2,{#1},}%
-\def\XINT_lcmof:_c #1{\if#1,\expandafter\XINT_of:_e
- \else\expandafter\XINT_lcmof:_d\fi #1}%
-\def\XINT_lcmof:_d #1,{\expandafter\XINT_lcmof:_a\romannumeral0\xintlcm {#1}}%
\XINT_restorecatcodes_endinput%
\endinput
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xintkernel.sty b/Master/texmf-dist/tex/generic/xint/xintkernel.sty
new file mode 100644
index 00000000000..16300608b64
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/xint/xintkernel.sty
@@ -0,0 +1,254 @@
+%%
+%% This is file `xintkernel.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xint.dtx (with options: `xintkernel')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from xintkernel.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file xint.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
+%% Copyright (C) 2013-2014 by Jean-Francois Burnol
+%% xintkernel: Paraphernalia for the xint packages
+%% ---------------------------------------------------------------
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \catcode95=11 % _
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xintkernel}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \expandafter
+ \ifx\csname XINTsetupcatcodes\endcsname\relax
+ \else
+ \y{xintkernel}{I was already loaded, aborting input}%
+ \aftergroup\endinput
+ \fi
+ \fi
+ \def\SetCatcodesIfInputNotAborted
+ {%
+ \endgroup
+ \def\XINT_restorecatcodes
+ {% takes care of all, to allow more economical code in modules
+ \catcode59=\the\catcode59 % ; xintexpr
+ \catcode126=\the\catcode126 % ~ xintexpr
+ \catcode39=\the\catcode39 % ' xintexpr
+ \catcode34=\the\catcode34 % " xintbinhex, and xintexpr
+ \catcode63=\the\catcode63 % ? xintexpr
+ \catcode124=\the\catcode124 % | xintexpr
+ \catcode38=\the\catcode38 % & xintexpr
+ \catcode64=\the\catcode64 % @ xintexpr
+ \catcode33=\the\catcode33 % ! xintexpr
+ \catcode93=\the\catcode93 % ] -, xintfrac, xintseries, xintcfrac
+ \catcode91=\the\catcode91 % [ -, xintfrac, xintseries, xintcfrac
+ \catcode36=\the\catcode36 % $ xintgcd only
+ \catcode94=\the\catcode94 % ^
+ \catcode96=\the\catcode96 % `
+ \catcode47=\the\catcode47 % /
+ \catcode41=\the\catcode41 % )
+ \catcode40=\the\catcode40 % (
+ \catcode42=\the\catcode42 % *
+ \catcode43=\the\catcode43 % +
+ \catcode62=\the\catcode62 % >
+ \catcode60=\the\catcode60 % <
+ \catcode58=\the\catcode58 % :
+ \catcode46=\the\catcode46 % .
+ \catcode45=\the\catcode45 % -
+ \catcode44=\the\catcode44 % ,
+ \catcode35=\the\catcode35 % #
+ \catcode95=\the\catcode95 % _
+ \catcode125=\the\catcode125 % }
+ \catcode123=\the\catcode123 % {
+ \endlinechar=\the\endlinechar
+ \catcode13=\the\catcode13 % ^^M
+ \catcode32=\the\catcode32 %
+ \catcode61=\the\catcode61\relax % =
+ }%
+ \edef\XINT_restorecatcodes_endinput
+ {%
+ \XINT_restorecatcodes\noexpand\endinput %
+ }%
+ \def\XINT_setcatcodes
+ {%
+ \catcode61=12 % =
+ \catcode32=10 % space
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode95=11 % _ LETTER
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=11 % : LETTER
+ \catcode60=12 % <
+ \catcode62=12 % >
+ \catcode43=12 % +
+ \catcode42=12 % *
+ \catcode40=12 % (
+ \catcode41=12 % )
+ \catcode47=12 % /
+ \catcode96=12 % `
+ \catcode94=11 % ^ LETTER
+ \catcode36=3 % $
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ \catcode33=11 % ! LETTER
+ \catcode64=11 % @ LETTER
+ \catcode38=12 % &
+ \catcode124=12 % |
+ \catcode63=11 % ? LETTER
+ \catcode34=12 % "
+ \catcode39=12 % '
+ \catcode126=3 % ~
+ \catcode59=12 % ;
+ }%
+ \XINT_setcatcodes
+ }%
+\SetCatcodesIfInputNotAborted
+\def\XINTsetupcatcodes {% for use by other modules
+ \edef\XINT_restorecatcodes_endinput
+ {%
+ \XINT_restorecatcodes\noexpand\endinput %
+ }%
+ \XINT_setcatcodes
+}%
+\ifdefined\ProvidesPackage
+ \let\XINT_providespackage\relax
+\else
+ \def\XINT_providespackage #1#2[#3]%
+ {\immediate\write-1{Package: #2 #3}%
+ \expandafter\xdef\csname ver@#2.sty\endcsname{#3}}%
+\fi
+\XINT_providespackage
+\ProvidesPackage {xintkernel}%
+ [2014/10/28 v1.1 Paraphernalia for the xint packages (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}%
+\long\def\xint_firstoftwo #1#2{#1}%
+\long\def\xint_secondoftwo #1#2{#2}%
+\long\def\xint_firstofone_thenstop #1{ #1}%
+\long\def\xint_firstoftwo_thenstop #1#2{ #1}%
+\long\def\xint_secondoftwo_thenstop #1#2{ #2}%
+\def\xint_gob_til_zero #10{}%
+\def\xint_UDzerominusfork #10-#2#3\krof {#2}%
+\long\def\xint_gob_til_R #1\R {}%
+\long\def\xint_gob_til_W #1\W {}%
+\long\def\xint_gob_til_Z #1\Z {}%
+\let\xint_relax\relax
+\def\xint_brelax {\xint_relax }%
+\long\def\xint_gob_til_xint_relax #1\xint_relax {}%
+\long\def\xint_afterfi #1#2\fi {\fi #1}%
+\long\def\xint_bye #1\xint_bye {}%
+\long\def\xint_dothis #1#2\xint_orthat #3{\fi #1}% v1.1
+\let\xint_orthat \xint_firstofone
+\def\xint_zapspaces #1 #2{#1#2\xint_zapspaces }% v1.1
+\chardef\xint_c_ 0
+\chardef\xint_c_i 1
+\chardef\xint_c_ii 2
+\chardef\xint_c_iii 3
+\chardef\xint_c_iv 4
+\chardef\xint_c_v 5
+\chardef\xint_c_vi 6
+\chardef\xint_c_vii 7
+\chardef\xint_c_viii 8
+\def\xintodef #1{\expandafter\def\expandafter#1\expandafter }%
+\def\xintoodef #1{\expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter }%
+\def\xintfdef #1#2{\expandafter\def\expandafter#1\expandafter
+ {\romannumeral-`0#2}}%
+\ifdefined\odef\else\let\odef\xintodef\fi
+\ifdefined\oodef\else\let\oodef\xintoodef\fi
+\ifdefined\fdef\else\let\fdef\xintfdef\fi
+\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
+\long\def\xintreverseorder #1%
+{%
+ \XINT_rord_main {}#1%
+ \xint_relax
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_bye\xint_bye\xint_bye\xint_bye
+ \xint_relax
+}%
+\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}%
+}%
+\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
+{%
+ \noexpand\expandafter\space\noexpand\xint_gob_til_xint_relax #1%
+}%
+\def\xintLength {\romannumeral0\xintlength }%
+\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
+}%
+\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\the\numexpr #1+\xint_c_viii.%
+}%
+\def\XINT_length_finish_a\xint_relax\expandafter\XINT_length_loop
+ \the\numexpr #1+\xint_c_viii.#2\xint_bye
+{%
+ \XINT_length_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
+}%
+\def\XINT_length_finish_b #1#2#3#4#5#6#7#8\Z
+{%
+ \xint_gob_til_W
+ #1\XINT_length_finish_c \xint_c_
+ #2\XINT_length_finish_c \xint_c_i
+ #3\XINT_length_finish_c \xint_c_ii
+ #4\XINT_length_finish_c \xint_c_iii
+ #5\XINT_length_finish_c \xint_c_iv
+ #6\XINT_length_finish_c \xint_c_v
+ #7\XINT_length_finish_c \xint_c_vi
+ \W\XINT_length_finish_c \xint_c_vii\Z
+}%
+\edef\XINT_length_finish_c #1#2\Z #3%
+ {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
+\XINT_restorecatcodes_endinput%
+\endinput
+%%
+%% End of file `xintkernel.sty'.
diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty
index a17ffd47f83..0f0ceeac680 100644
--- a/Master/texmf-dist/tex/generic/xint/xintseries.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty
@@ -20,11 +20,11 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xintseries: Expandable partial sums with xint package
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xintseries: Expandable partial sums with xint package
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
@@ -36,7 +36,6 @@
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\space { }%
\let\z\endgroup
\expandafter\let\expandafter\x\csname ver@xintseries.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
@@ -53,7 +52,6 @@
\else
\ifx\x\relax % plain-TeX, first loading of xintseries.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
- \y{xintseries}{now issuing \string\input\space xintfrac.sty}%
\def\z{\endgroup\input xintfrac.sty\relax}%
\fi
\else
@@ -61,47 +59,18 @@
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
- \y{xintseries}{now issuing \string\RequirePackage{xintfrac}}%
\def\z{\endgroup\RequirePackage{xintfrac}}%
\fi
\else
- \y{xintseries}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xintseries already loaded.
\fi
\fi
\fi
\z%
-\begingroup\catcode61\catcode48\catcode32=10\relax%
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode64=11 % @
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=12 % :
- \ifdefined\PackageInfo
- \def\y#1#2{\PackageInfo{#1}{#2}}%
- \else
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
- \fi
- \def\empty {}%
- \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
- \ifx\w\relax % Plain TeX, user gave a file name at the prompt
- \y{xintseries}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
- \ifx\w\empty % LaTeX, user gave a file name at the prompt
- \y{xintseries}{Loading of package xintfrac failed, aborting input}%
- \aftergroup\endinput
- \fi
-\endgroup%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2014/04/01 v1.09n Expandable partial sums with xint package (jfB)]%
+ [2014/10/28 v1.1 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 b95a530dc77..9639b665c8b 100644
--- a/Master/texmf-dist/tex/generic/xint/xinttools.sty
+++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty
@@ -20,24 +20,25 @@
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
-%%----------------------------------------------------------------
-%% The xint bundle (version 1.09n of April 1st, 2014)
-%% xinttools: Expandable and non-expandable utilities
+%% ---------------------------------------------------------------
+%% The xint bundle v1.1 (2014/10/28)
%% Copyright (C) 2013-2014 by Jean-Francois Burnol
-%%----------------------------------------------------------------
+%% xinttools: Expandable and non-expandable utilities
+%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
\catcode123=1 % {
\catcode125=2 % }
\catcode64=11 % @
- \catcode95=11 % _
\catcode35=6 % #
\catcode44=12 % ,
\catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \expandafter\let\expandafter\x\csname ver@xint.sty\endcsname
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xinttools.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintkernel.sty\endcsname
\expandafter
\ifx\csname PackageInfo\endcsname\relax
\def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
@@ -49,177 +50,32 @@
\y{xinttools}{\numexpr not available, aborting input}%
\aftergroup\endinput
\else
- \ifx\x\relax % plain-TeX, first loading
+ \ifx\x\relax % plain-TeX, first loading of xinttools.sty
+ \ifx\w\relax % but xintkernel.sty not yet loaded.
+ \def\z{\endgroup\input xintkernel.sty\relax}%
+ \fi
\else
\def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintkernel.sty not yet loaded.
+ \def\z{\endgroup\RequirePackage{xintkernel}}%
+ \fi
\else
- \y{xinttools}{I was already loaded, aborting input}%
- \aftergroup\endinput
+ \aftergroup\endinput % xinttools already loaded.
\fi
\fi
\fi
- \def\ChangeCatcodesIfInputNotAborted
- {%
- \endgroup
- \def\XINT_storecatcodes
- {% takes care of all, to allow more economical code in modules
- \catcode34=\the\catcode34 % " xintbinhex, and 1.09k xintexpr
- \catcode63=\the\catcode63 % ? xintexpr
- \catcode124=\the\catcode124 % | xintexpr
- \catcode38=\the\catcode38 % & xintexpr
- \catcode64=\the\catcode64 % @ xintexpr
- \catcode33=\the\catcode33 % ! xintexpr
- \catcode93=\the\catcode93 % ] -, xintfrac, xintseries, xintcfrac
- \catcode91=\the\catcode91 % [ -, xintfrac, xintseries, xintcfrac
- \catcode36=\the\catcode36 % $ xintgcd only
- \catcode94=\the\catcode94 % ^
- \catcode96=\the\catcode96 % `
- \catcode47=\the\catcode47 % /
- \catcode41=\the\catcode41 % )
- \catcode40=\the\catcode40 % (
- \catcode42=\the\catcode42 % *
- \catcode43=\the\catcode43 % +
- \catcode62=\the\catcode62 % >
- \catcode60=\the\catcode60 % <
- \catcode58=\the\catcode58 % :
- \catcode46=\the\catcode46 % .
- \catcode45=\the\catcode45 % -
- \catcode44=\the\catcode44 % ,
- \catcode35=\the\catcode35 % #
- \catcode95=\the\catcode95 % _
- \catcode125=\the\catcode125 % }
- \catcode123=\the\catcode123 % {
- \endlinechar=\the\endlinechar
- \catcode13=\the\catcode13 % ^^M
- \catcode32=\the\catcode32 %
- \catcode61=\the\catcode61\relax % =
- }%
- \edef\XINT_restorecatcodes_endinput
- {%
- \XINT_storecatcodes\noexpand\endinput %
- }%
- \def\XINT_setcatcodes
- {%
- \catcode61=12 % =
- \catcode32=10 % space
- \catcode13=5 % ^^M
- \endlinechar=13 %
- \catcode123=1 % {
- \catcode125=2 % }
- \catcode95=11 % _ (replaces @ everywhere, starting with 1.06b)
- \catcode35=6 % #
- \catcode44=12 % ,
- \catcode45=12 % -
- \catcode46=12 % .
- \catcode58=11 % : (made letter for error cs)
- \catcode60=12 % <
- \catcode62=12 % >
- \catcode43=12 % +
- \catcode42=12 % *
- \catcode40=12 % (
- \catcode41=12 % )
- \catcode47=12 % /
- \catcode96=12 % ` (for ubiquitous \romannumeral-`0 and some \catcode )
- \catcode94=11 % ^
- \catcode36=3 % $
- \catcode91=12 % [
- \catcode93=12 % ]
- \catcode33=11 % !
- \catcode64=11 % @
- \catcode38=12 % &
- \catcode124=12 % |
- \catcode63=11 % ?
- \catcode34=12 % " missing from v < 1.09k although needed in xintbinhex
- }%
- \XINT_setcatcodes
- }%
-\ChangeCatcodesIfInputNotAborted
-\def\XINTsetupcatcodes {% for use by other modules
- \edef\XINT_restorecatcodes_endinput
- {%
- \XINT_storecatcodes\noexpand\endinput %
- }%
- \XINT_setcatcodes
-}%
-\ifdefined\ProvidesPackage
- \let\XINT_providespackage\relax
-\else
- \def\XINT_providespackage #1#2[#3]%
- {\immediate\write-1{Package: #2 #3}%
- \expandafter\xdef\csname ver@#2.sty\endcsname{#3}}%
-\fi
+\z%
+\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
-\ProvidesPackage {xinttools}%
- [2014/04/01 v1.09n 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}%
-\long\def\xint_firstoftwo #1#2{#1}%
-\long\def\xint_secondoftwo #1#2{#2}%
-\long\def\xint_firstofone_thenstop #1{ #1}%
-\long\def\xint_firstoftwo_thenstop #1#2{ #1}%
-\long\def\xint_secondoftwo_thenstop #1#2{ #2}%
-\def\xint_minus_thenstop { -}%
-\def\xint_gob_til_zero #10{}% no need to make it long, so far
-\def\xint_UDzerominusfork #10-#2#3\krof {#2}% id.
-\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\def\xint_afterfi #1#2\fi {\fi #1}%
-\chardef\xint_c_ 0
-\chardef\xint_c_i 1
-\chardef\xint_c_ii 2
-\chardef\xint_c_iii 3
-\chardef\xint_c_iv 4
-\chardef\xint_c_v 5
-\chardef\xint_c_vi 6
-\chardef\xint_c_vii 7
-\chardef\xint_c_viii 8
+\ProvidesPackage{xinttools}%
+ [2014/10/28 v1.1 Expandable and non-expandable utilities (jfB)]%
\newtoks\XINT_toks
\xint_firstofone{\let\XINT_sptoken= } %<- space here!
-\def\xintodef #1{\expandafter\def\expandafter#1\expandafter }%
-\ifdefined\odef\else\let\odef\xintodef\fi
-\def\xintgodef {\global\xintodef }%
-\def\xintoodef #1{\expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter#1%
- \expandafter\expandafter\expandafter }%
-\ifdefined\oodef\else\let\oodef\xintoodef\fi
+\def\xintgodef {\global\xintodef }%
\def\xintgoodef {\global\xintoodef }%
-\def\xintfdef #1#2{\expandafter\def\expandafter#1\expandafter
- {\romannumeral-`0#2}}%
-\ifdefined\fdef\else\let\fdef\xintfdef\fi
-\def\xintgfdef {\global\xintfdef }% should be \global\fdef if \fdef pre-exists?
-\def\xintReverseOrder {\romannumeral0\xintreverseorder }%
-\long\def\xintreverseorder #1%
-{%
- \XINT_rord_main {}#1%
- \xint_relax
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_bye\xint_bye\xint_bye\xint_bye
- \xint_relax
-}%
-\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}%
-}%
-\long\edef\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax
-{%
- \noexpand\expandafter\space\noexpand\xint_gob_til_xint_relax #1%
-}%
+\def\xintgfdef {\global\xintfdef }%
\def\xintRevWithBraces {\romannumeral0\xintrevwithbraces }%
\def\xintRevWithBracesNoExpand {\romannumeral0\xintrevwithbracesnoexpand }%
\long\def\xintrevwithbraces #1%
@@ -261,72 +117,36 @@
\space
\csname xint_gobble_\romannumeral #1\endcsname
}%
-\def\xintLength {\romannumeral0\xintlength }%
-\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
-}%
-\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\the\numexpr #1+\xint_c_viii.%
-}%
-\def\XINT_length_finish_a\xint_relax\expandafter\XINT_length_loop
- \the\numexpr #1+\xint_c_viii.#2\xint_bye
-{%
- \XINT_length_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
-}%
-\def\XINT_length_finish_b #1#2#3#4#5#6#7#8\Z
-{%
- \xint_gob_til_W
- #1\XINT_length_finish_c \xint_c_
- #2\XINT_length_finish_c \xint_c_i
- #3\XINT_length_finish_c \xint_c_ii
- #4\XINT_length_finish_c \xint_c_iii
- #5\XINT_length_finish_c \xint_c_iv
- #6\XINT_length_finish_c \xint_c_v
- #7\XINT_length_finish_c \xint_c_vi
- \W\XINT_length_finish_c \xint_c_vii\Z
-}%
-\edef\XINT_length_finish_c #1#2\Z #3%
- {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }%
\long\edef\xintzapfirstspaces #1%
- {\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }%
-\xint_firstofone {\long\def\XINT_zapbsp_a #1 } %<- space token here
+ {\noexpand\XINT_zapbsp_a \space #1\xint_relax \space\space\xint_relax }%
+\xint_firstofone {\long\edef\XINT_zapbsp_a #1 } %<- space token here
{%
- \XINT_zapbsp_again? #1\xint_bye\XINT_zapbsp_b {#1}%
+ \noexpand\XINT_zapbsp_again? #1\noexpand\xint_bye\noexpand\XINT_zapbsp_b #1\space\space
}%
\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 }%
-\long\def\XINT_zapbsp_b #1#2\xint_relax
- {\XINT_zapbsp_end? #2\XINT_zapbsp_e\empty #2{#1}}%
-\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}}%
-\long\edef\XINT_zapbsp_f #1#2{#2\space\space #1}%
+\xint_firstofone{\def\XINT_zapbsp_again\XINT_zapbsp_b} {\XINT_zapbsp_a }%
+\long\def\XINT_zapbsp_b #1\xint_relax #2\xint_relax {#1}%
\def\xintZapLastSpaces {\romannumeral0\xintzaplastspaces }%
-\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty
- #1\space\space\noexpand\xint_bye \xint_relax}%
+\long\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {}\noexpand\empty#1%
+ \space\space\noexpand\xint_bye\xint_relax}%
\xint_firstofone {\long\def\XINT_zapesp_a #1#2 } %<- second space here
{\expandafter\XINT_zapesp_b\expandafter{#2}{#1}}%
\long\def\XINT_zapesp_b #1#2#3\xint_relax
{\XINT_zapesp_end? #3\XINT_zapesp_e {#2#1}\empty #3\xint_relax }%
\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\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 }%
-\long\edef\xintzapspaces #1%
- {\noexpand\XINT_zapsp_a \space #1\space\space\noexpand\xint_bye\xint_relax}%
-\xint_firstofone {\long\def\XINT_zapsp_a #1 } %<- space token here
-{%
- \XINT_zapsp_again? #1\xint_bye\XINT_zapesp_b {#1}{}%
-}%
+\long\edef\xintzapspaces #1% like \xintZapFirstSpaces.
+ {\noexpand\XINT_zapsp_a \space #1\xint_relax \space\space\xint_relax }%
+\xint_firstofone {\long\edef\XINT_zapsp_a #1 } %
+ {\noexpand\XINT_zapsp_again? #1\noexpand\xint_bye\noexpand\XINT_zapsp_b #1\space\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 }%
+\xint_firstofone{\def\XINT_zapsp_again\XINT_zapsp_b} {\XINT_zapsp_a }%
+\xint_firstofone{\def\XINT_zapsp_b} {\XINT_zapsp_c }%
+\long\edef\XINT_zapsp_c #1\xint_relax #2\xint_relax {\noexpand\XINT_zapesp_a
+ {}\noexpand \empty #1\space\space\noexpand\xint_bye\xint_relax }%
\def\xintZapSpacesB {\romannumeral0\xintzapspacesb }%
\long\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax
\xint_bye\xintzapspaces {#1}}%