texlive[42782] Master/texmf-dist: xint (23dec16)
commits+karl at tug.org
commits+karl at tug.org
Sat Dec 24 00:05:36 CET 2016
Revision: 42782
http://tug.org/svn/texlive?view=revision&revision=42782
Author: karl
Date: 2016-12-24 00:05:36 +0100 (Sat, 24 Dec 2016)
Log Message:
-----------
xint (23dec16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/generic/xint/CHANGES.html
trunk/Master/texmf-dist/doc/generic/xint/CHANGES.pdf
trunk/Master/texmf-dist/doc/generic/xint/README
trunk/Master/texmf-dist/doc/generic/xint/README.html
trunk/Master/texmf-dist/doc/generic/xint/README.pdf
trunk/Master/texmf-dist/doc/generic/xint/sourcexint.pdf
trunk/Master/texmf-dist/doc/generic/xint/xint.pdf
trunk/Master/texmf-dist/source/generic/xint/xint.dtx
trunk/Master/texmf-dist/source/generic/xint/xint.ins
trunk/Master/texmf-dist/tex/generic/xint/xint.sty
trunk/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
trunk/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
trunk/Master/texmf-dist/tex/generic/xint/xintcore.sty
trunk/Master/texmf-dist/tex/generic/xint/xintexpr.sty
trunk/Master/texmf-dist/tex/generic/xint/xintfrac.sty
trunk/Master/texmf-dist/tex/generic/xint/xintgcd.sty
trunk/Master/texmf-dist/tex/generic/xint/xintkernel.sty
trunk/Master/texmf-dist/tex/generic/xint/xintseries.sty
trunk/Master/texmf-dist/tex/generic/xint/xinttools.sty
Modified: trunk/Master/texmf-dist/doc/generic/xint/CHANGES.html
===================================================================
--- trunk/Master/texmf-dist/doc/generic/xint/CHANGES.html 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/doc/generic/xint/CHANGES.html 2016-12-23 23:05:36 UTC (rev 42782)
@@ -4,7 +4,7 @@
<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 1.2i" />
+ <meta name="author" content="xint 1.2j" />
<title>CHANGE LOG</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
@@ -17,55 +17,63 @@
<body>
<div id="header">
<h1 class="title">CHANGE LOG</h1>
-<h2 class="author">xint 1.2i</h2>
-<h3 class="date">2016/12/13</h3>
+<h2 class="author">xint 1.2j</h2>
+<h3 class="date">2016/12/22</h3>
</div>
<div id="TOC">
<ul>
-<li><a href="#i-20161213"><code>1.2i (2016/12/13)</code></a><ul>
-<li><a href="#incompatible-changes">Incompatible changes</a></li>
+<li><a href="#j-20161222"><code>1.2j (2016/12/22)</code></a><ul>
<li><a href="#improvements-and-new-features">Improvements and new features</a></li>
<li><a href="#bug-fixes">Bug fixes</a></li>
</ul></li>
-<li><a href="#h-20161120"><code>1.2h (2016/11/20)</code></a><ul>
+<li><a href="#i-20161213"><code>1.2i (2016/12/13)</code></a><ul>
+<li><a href="#incompatible-changes">Incompatible changes</a></li>
<li><a href="#improvements-and-new-features-1">Improvements and new features</a></li>
<li><a href="#bug-fixes-1">Bug fixes</a></li>
</ul></li>
+<li><a href="#h-20161120"><code>1.2h (2016/11/20)</code></a><ul>
+<li><a href="#improvements-and-new-features-2">Improvements and new features</a></li>
+<li><a href="#bug-fixes-2">Bug fixes</a></li>
+</ul></li>
<li><a href="#g-20160319"><code>1.2g (2016/03/19)</code></a><ul>
<li><a href="#incompatible-changes-1">Incompatible changes</a></li>
-<li><a href="#improvements-and-new-features-2">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-3">Improvements and new features</a></li>
</ul></li>
<li><a href="#f-20160312"><code>1.2f (2016/03/12)</code></a><ul>
<li><a href="#incompatible-changes-2">Incompatible changes</a></li>
-<li><a href="#bug-fixes-2">Bug fixes</a></li>
-<li><a href="#improvements-and-new-features-3">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-4">Improvements and new features</a></li>
+<li><a href="#bug-fixes-3">Bug fixes</a></li>
</ul></li>
<li><a href="#e-20151122"><code>1.2e (2015/11/22)</code></a><ul>
-<li><a href="#bug-fixes-3">Bug fixes</a></li>
-<li><a href="#improvements-and-new-features-4">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-5">Improvements and new features</a></li>
+<li><a href="#bug-fixes-4">Bug fixes</a></li>
</ul></li>
<li><a href="#d-20151118"><code>1.2d (2015/11/18)</code></a><ul>
-<li><a href="#bug-fixes-4">Bug fixes</a></li>
-<li><a href="#improvements-and-new-features-5">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-6">Improvements and new features</a></li>
+<li><a href="#bug-fixes-5">Bug fixes</a></li>
</ul></li>
<li><a href="#c-20151116"><code>1.2c (2015/11/16)</code></a><ul>
-<li><a href="#bug-fixes-5">Bug fixes</a></li>
-<li><a href="#improvements-and-new-features-6">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-7">Improvements and new features</a></li>
+<li><a href="#bug-fixes-6">Bug fixes</a></li>
</ul></li>
<li><a href="#b-20151029"><code>1.2b (2015/10/29)</code></a><ul>
-<li><a href="#bug-fixes-6">Bug fixes</a></li>
+<li><a href="#bug-fixes-7">Bug fixes</a></li>
</ul></li>
<li><a href="#a-20151019"><code>1.2a (2015/10/19)</code></a><ul>
-<li><a href="#bug-fixes-7">Bug fixes</a></li>
-<li><a href="#improvements-and-new-features-7">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-8">Improvements and new features</a></li>
+<li><a href="#bug-fixes-8">Bug fixes</a></li>
</ul></li>
<li><a href="#section"><code>1.2 (2015/10/10)</code></a><ul>
-<li><a href="#improvements-and-new-features-8">Improvements and new features</a></li>
+<li><a href="#improvements-and-new-features-9">Improvements and new features</a></li>
</ul></li>
<li><a href="#c-20150912"><code>1.1c (2015/09/12)</code></a></li>
<li><a href="#b-20150831"><code>1.1b (2015/08/31)</code></a></li>
<li><a href="#a-20141107"><code>1.1a (2014/11/07)</code></a></li>
-<li><a href="#section-1"><code>1.1 (2014/10/28)</code></a></li>
+<li><a href="#section-1"><code>1.1 (2014/10/28)</code></a><ul>
+<li><a href="#incompatible-changes-3">Incompatible changes</a></li>
+<li><a href="#improvements-and-new-features-10">Improvements and new features</a></li>
+<li><a href="#bug-fixes-9">Bug fixes</a></li>
+</ul></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>
@@ -92,10 +100,24 @@
<li><a href="#section-8"><code>1.0 (2013/03/28)</code></a></li>
</ul>
</div>
-<pre><code>Source: xint.dtx 1.2i 2016/12/13 (doc 2016/12/13)
+<pre><code>Source: xint.dtx 1.2j 2016/12/22 (doc 2016/12/22)
Author: Jean-Francois Burnol
Info: Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c</code></pre>
+<h2 id="j-20161222"><code>1.2j (2016/12/22)</code></h2>
+<h3 id="improvements-and-new-features">Improvements and new features</h3>
+<ul>
+<li><p><strong>xinttools</strong> and <strong>xintexpr</strong>:</p>
+<ol style="list-style-type: decimal">
+<li><p>slightly improves the speed of <code>\xintTrim</code>.</p></li>
+<li><p>speed gains for the handlers of comma separated lists implementing Python-like slicing and item extraction. Relevant non (user) documented macros better documented in <code>sourcexint.pdf</code>.</p></li>
+</ol></li>
+<li><p>significant documentations tweaks (inclusive of suppressing things!), and among them two beautiful hyperlinked tables with both horizontal and vertical rules which bring the documentation of the <strong>xintexpr</strong> syntax to a kind of awe-inspiring perfection... except that implementation of some math functions is still lacking.</p></li>
+</ul>
+<h3 id="bug-fixes">Bug fixes</h3>
+<ul>
+<li>fix two <code>1.2i</code> regressions caused by undefined macros (<code>\xintNthElt</code> in certain branches and <code>[list][N]</code> item extraction in certain cases.) The test files existed but were not executed prior to release. Automation in progress.</li>
+</ul>
<h2 id="i-20161213"><code>1.2i (2016/12/13)</code></h2>
<h3 id="incompatible-changes">Incompatible changes</h3>
<ul>
@@ -102,7 +124,7 @@
<li><p>some macros which had been marked as deprecated are removed (they are available under different names): <code>\xintifTrue</code>, <code>\xintifTrueFalse</code>, <code>\xintQuo</code>, <code>\xintRem</code>, <code>\xintquo</code>, <code>\xintrem</code>.</p></li>
<li><p><code>\xintDecSplit</code> second argument must have no sign (former code replaced it with its absolute value, a sign now may cause an error.)</p></li>
</ul>
-<h3 id="improvements-and-new-features">Improvements and new features</h3>
+<h3 id="improvements-and-new-features-1">Improvements and new features</h3>
<ul>
<li><p><strong>xintkernel</strong>: <code>\xintLength</code> is faster. New macros:</p>
<ul>
@@ -121,17 +143,17 @@
<li><p>the documentation has again been (slightly) re-organized; it has a new sub-section on the Miller-Rabin primality test, to illustrate some use of <code>\xintNewFunction</code> for recursive definitions.</p></li>
<li><p>the documentation has dropped the LaTeX "command" terminology (which had been used initially in 2013 for some forgotten reasons and should have been removed long ago) and uses only the more apt "macro", as after all, all of <strong>xint</strong> is about expansion of macros (plus the use of <code>\numexpr</code>).</p></li>
</ul>
-<h3 id="bug-fixes">Bug fixes</h3>
+<h3 id="bug-fixes-1">Bug fixes</h3>
<ul>
<li><code>\xintDecSplitL</code> and <code>\xintDecSplitR</code> from <strong>xint</strong> produced their output in a spurious brace pair (bug introduced in <code>1.2f</code>).</li>
</ul>
<h2 id="h-20161120"><code>1.2h (2016/11/20)</code></h2>
-<h3 id="improvements-and-new-features-1">Improvements and new features</h3>
+<h3 id="improvements-and-new-features-2">Improvements and new features</h3>
<ul>
<li><p>new macro <code>\xintNewFunction</code> in <strong>xintexpr</strong> which allows to extend the parser syntax with functions in situations where <code>\xintdeffunc</code> is not usable (typically, because dummy variables are used over a not yet determined range of values because it depends on the variables).</p></li>
<li><p>after three years of strict obedience to <code>xint</code> prefix, now <code>\thexintexpr</code>, <code>\thexintiexpr</code>, <code>\thexintfloatexpr</code>, and <code>\thexintiiexpr</code> are provided as synonyms to <code>\xinttheexpr</code>, etc...</p></li>
</ul>
-<h3 id="bug-fixes-1">Bug fixes</h3>
+<h3 id="bug-fixes-2">Bug fixes</h3>
<ul>
<li><p>the <code>(cond)?{foo}{bar}</code> operator from <strong>xintexpr</strong> mis-behaved in certain circumstances (such as an empty <code>foo</code>).</p></li>
<li><p>the <strong>xintexpr</strong> <code>1.2f</code> <code>binomial</code> function (which uses <code>\xintiiBinomial</code> from <strong>xint.sty</strong> or <code>\xintFloatBinomial</code> from <strong>xintfrac.sty</strong>) deliberately raised an error for <code>binomial(x,y)</code> with <code>y<0</code> or <code>x<y</code>. This was unfortunate, and it now simply evaluates to zero in such cases.</p></li>
@@ -144,7 +166,7 @@
<li><p>inside expressions, list item selector <code>[L][n]</code> counts starting at zero, not at one. This is more coherent with <code>[L][a:b]</code> which was already exactly like in Python since its introduction. A function len(L) replaces earlier <code>[L][0]</code>.</p></li>
<li><p>former <code>iter</code> keyword now called <code>iterr</code>. Indeed it matched with <code>rrseq</code>, the new <code>iter</code> (which was somehow missing from <code>1.1</code>) is the one matching <code>rseq</code>. Allows to iterate more easily with a "list" variable.</p></li>
</ul>
-<h3 id="improvements-and-new-features-2">Improvements and new features</h3>
+<h3 id="improvements-and-new-features-3">Improvements and new features</h3>
<ul>
<li><p>in <strong>xintexpr.sty</strong>: list selectors <code>[L][n]</code> and <code>[L][a:b]</code> are more efficient: the earlier <code>1.1</code> routines did back and forth conversions from comma separated values to braced tokens, the <code>1.2g</code> routines use macros from <strong>xinttools.sty</strong> handling directly the encountered lists of comma separated values.</p></li>
<li><p>in <strong>xinttools.sty</strong>: slight improvements in the efficiency of the <code>\xintNthElt</code>, <code>\xintKeep</code>, <code>\xintTrim</code> routines and new routines handling directly comma separated values. The latter are not included in the user manual (they are not <code>\long</code>, they don't make efforts to preserve some braces, do not worry about spaces, all those worries being irrelevant to the use in expressions for list selectors).</p></li>
@@ -157,14 +179,8 @@
<ul>
<li>no more <code>\xintFac</code> macro but <code>\xintiFac/\xintiiFac/\xintFloatFac</code>.</li>
</ul>
-<h3 id="bug-fixes-2">Bug fixes</h3>
+<h3 id="improvements-and-new-features-4">Improvements and new features</h3>
<ul>
-<li><p>squaring macro <code>\xintSqr</code> from <strong>xintfrac.sty</strong> was broken due to a misspelled sub-macro name. Dates back to <code>1.1</code> release of <code>2014/10/28</code> <code>:-((</code>.</p></li>
-<li><p><code>1.2c</code>'s fix to the subtraction bug from <code>1.2</code> introduced another bug, which in some cases could create leading zeroes in the output, or even worse. This could invalidate other routines using subtractions, like <code>\xintiiSquareRoot</code>.</p></li>
-<li><p>the comparison operators were not recognized by <code>\xintNewIIExpr</code> and <code>\xintdefiifunc</code> constructs.</p></li>
-</ul>
-<h3 id="improvements-and-new-features-3">Improvements and new features</h3>
-<ul>
<li><p>functions <code>binomial</code>, <code>pfactorial</code> and <code>factorial</code> in both integer and float versions.</p></li>
<li><p>macros <code>\xintiiBinomial</code>, <code>\xintiiPFactorial</code> (<strong>xint.sty</strong>) and <code>\xintFloatBinomial</code>, <code>\xintFloatPFactorial</code> (<strong>xintfrac.sty</strong>). Improvements to <code>\xintFloatFac</code>.</p></li>
<li><p>faster implementation and increased accuracy of float power macros. Half-integer exponents are now accepted inside float expressions.</p></li>
@@ -177,14 +193,14 @@
<li><p>(TeXperts only) the macros defined (internally) from <code>\xintdeffunc</code> et al. constructs do not incorporate an initial <code>\romannumeral</code> anymore.</p></li>
<li><p>renewed desperate efforts at improving the documentation by random shuffling of sections and well thought additions; cuts were considered and even performed.</p></li>
</ul>
-<h2 id="e-20151122"><code>1.2e (2015/11/22)</code></h2>
<h3 id="bug-fixes-3">Bug fixes</h3>
<ul>
-<li><p>in <strong>xintfrac</strong>: the <code>\xintFloatFac</code> from release <code>1.2</code> parsed its argument only through <code>\numexpr</code> but it should have used <code>\xintNum</code>.</p></li>
-<li><p>in <strong>xintexpr</strong>: release <code>1.2d</code> had broken the recognition of sub-expressions immediately after variable names (with tacit multiplication).</p></li>
-<li><p>in <strong>xintexpr</strong>: contrarily to what <code>1.2d</code> documentation said, tacit multiplication was not yet always done with enhanced precedence. Now yes.</p></li>
+<li><p>squaring macro <code>\xintSqr</code> from <strong>xintfrac.sty</strong> was broken due to a misspelled sub-macro name. Dates back to <code>1.1</code> release of <code>2014/10/28</code> <code>:-((</code>.</p></li>
+<li><p><code>1.2c</code>'s fix to the subtraction bug from <code>1.2</code> introduced another bug, which in some cases could create leading zeroes in the output, or even worse. This could invalidate other routines using subtractions, like <code>\xintiiSquareRoot</code>.</p></li>
+<li><p>the comparison operators were not recognized by <code>\xintNewIIExpr</code> and <code>\xintdefiifunc</code> constructs.</p></li>
</ul>
-<h3 id="improvements-and-new-features-4">Improvements and new features</h3>
+<h2 id="e-20151122"><code>1.2e (2015/11/22)</code></h2>
+<h3 id="improvements-and-new-features-5">Improvements and new features</h3>
<ul>
<li><p>macro <code>\xintunassignvar</code>.</p></li>
<li><p>slight modifications of the logged messages in case of <code>\xintverbosetrue</code>.</p></li>
@@ -191,45 +207,51 @@
<li><p>a space in <code>\xintdeffunc f(x)<space>:= expression ;</code> is now accepted.</p></li>
<li><p>documentation enhancements: the <em>Quick Sort</em> section with its included code samples has been entirely re-written; the <em>Commands of the xintexpr package</em> section has been extended and reviewed entirely.</p></li>
</ul>
-<h2 id="d-20151118"><code>1.2d (2015/11/18)</code></h2>
<h3 id="bug-fixes-4">Bug fixes</h3>
<ul>
-<li>in <strong>xintcore</strong>: release <code>1.2c</code> had inadvertently broken the <code>\xintiiDivRound</code> macro.</li>
+<li><p>in <strong>xintfrac</strong>: the <code>\xintFloatFac</code> from release <code>1.2</code> parsed its argument only through <code>\numexpr</code> but it should have used <code>\xintNum</code>.</p></li>
+<li><p>in <strong>xintexpr</strong>: release <code>1.2d</code> had broken the recognition of sub-expressions immediately after variable names (with tacit multiplication).</p></li>
+<li><p>in <strong>xintexpr</strong>: contrarily to what <code>1.2d</code> documentation said, tacit multiplication was not yet always done with enhanced precedence. Now yes.</p></li>
</ul>
-<h3 id="improvements-and-new-features-5">Improvements and new features</h3>
+<h2 id="d-20151118"><code>1.2d (2015/11/18)</code></h2>
+<h3 id="improvements-and-new-features-6">Improvements and new features</h3>
<ul>
<li><p>the function definitions done by <code>\xintdeffunc</code> et al., as well as the macro declarations by <code>\xintNewExpr</code> et al. now have only local scope.</p></li>
<li><p>tacit multiplication applies to more cases, for example (x+y)z, and always ties more than standard * infix operator, e.g. x/2y is like x/(2*y).</p></li>
<li><p>some documentation enhancements, particularly in the chapter on xintexpr.sty, and also in the code source comments.</p></li>
</ul>
-<h2 id="c-20151116"><code>1.2c (2015/11/16)</code></h2>
<h3 id="bug-fixes-5">Bug fixes</h3>
<ul>
-<li>in <strong>xintcore</strong>: recent release <code>1.2</code> introduced a bug in the subtraction (happened when 00000001 was found under certain circumstances at certain mod 8 locations).</li>
+<li>in <strong>xintcore</strong>: release <code>1.2c</code> had inadvertently broken the <code>\xintiiDivRound</code> macro.</li>
</ul>
-<h3 id="improvements-and-new-features-6">Improvements and new features</h3>
+<h2 id="c-20151116"><code>1.2c (2015/11/16)</code></h2>
+<h3 id="improvements-and-new-features-7">Improvements and new features</h3>
<ul>
<li><p>macros <code>\xintdeffunc</code>, <code>\xintdefiifunc</code>, <code>\xintdeffloatfunc</code> and boolean <code>\ifxintverbose</code>.</p></li>
<li><p>on-going code improvements and documentation enhancements, but stopped in order to issue this bugfix release.</p></li>
</ul>
-<h2 id="b-20151029"><code>1.2b (2015/10/29)</code></h2>
<h3 id="bug-fixes-6">Bug fixes</h3>
<ul>
-<li>in <strong>xintcore</strong>: recent release <code>1.2</code> introduced a bug in the division macros, causing a crash when the divisor started with 99999999 (it was attempted to use with 1+99999999 a subroutine expecting only 8-digits numbers).</li>
+<li>in <strong>xintcore</strong>: recent release <code>1.2</code> introduced a bug in the subtraction (happened when 00000001 was found under certain circumstances at certain mod 8 locations).</li>
</ul>
-<h2 id="a-20151019"><code>1.2a (2015/10/19)</code></h2>
+<h2 id="b-20151029"><code>1.2b (2015/10/29)</code></h2>
<h3 id="bug-fixes-7">Bug fixes</h3>
<ul>
-<li>in <strong>xintexpr</strong>: recent release <code>1.2</code> introduced a bad bug in the parsing of decimal numbers and as a result <code>\xinttheexpr 0.01\relax</code> expanded to <code>0</code> ! (sigh...)</li>
+<li>in <strong>xintcore</strong>: recent release <code>1.2</code> introduced a bug in the division macros, causing a crash when the divisor started with 99999999 (it was attempted to use with 1+99999999 a subroutine expecting only 8-digits numbers).</li>
</ul>
-<h3 id="improvements-and-new-features-7">Improvements and new features</h3>
+<h2 id="a-20151019"><code>1.2a (2015/10/19)</code></h2>
+<h3 id="improvements-and-new-features-8">Improvements and new features</h3>
<ul>
<li><p>added <code>\xintKeepUnbraced</code>, <code>\xintTrimUnbraced</code> (<strong>xinttools</strong>) and fixed documentation of <code>\xintKeep</code> and <code>\xintTrim</code> regarding brace stripping.</p></li>
<li><p>added <code>\xintiiMaxof/\xintiiMinof</code> (<strong>xint</strong>).</p></li>
<li><p>TeX hackers only: replaced all code uses of <code>\romannumeral-`0</code> by the quicker <code>\romannumeral`&&@</code> (<code>^</code> being used as letter, had to find another character usable with catcode 7).</p></li>
</ul>
+<h3 id="bug-fixes-8">Bug fixes</h3>
+<ul>
+<li>in <strong>xintexpr</strong>: recent release <code>1.2</code> introduced a bad bug in the parsing of decimal numbers and as a result <code>\xinttheexpr 0.01\relax</code> expanded to <code>0</code> ! (sigh...)</li>
+</ul>
<h2 id="section"><code>1.2 (2015/10/10)</code></h2>
-<h3 id="improvements-and-new-features-8">Improvements and new features</h3>
+<h3 id="improvements-and-new-features-9">Improvements and new features</h3>
<ul>
<li><p>the basic arithmetic implemented in <strong>xintcore</strong> has been entirely rewritten. The mathematics remains the elementary school one, but the <code>TeX</code> implementation achieves higher speed (except, regarding addition/subtraction, for numbers up to about thirty digits), the gains becoming quite significant for numbers with hundreds of digits.</p></li>
<li><p>the inputs must have less than 19959 digits. But computations with thousands of digits take time.</p></li>
@@ -264,18 +286,8 @@
<li><p>various typographical fixes throughout the documentation, and a bit of clean up of the code comments. Improved <code>\Factors</code> example of nested <code>subs</code>, <code>rseq</code>, <code>iter</code> in <code>\xintiiexpr</code>.</p></li>
</ul>
<h2 id="section-1"><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>
+<h3 id="incompatible-changes-3">Incompatible changes</h3>
+<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 <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 infix operators of highest precedence,</p></li>
@@ -284,9 +296,7 @@
<li><p>although <code>&</code> and <code>|</code> are still available as Boolean operators the use of <code>&&</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>
<li><p>in earlier releases, place holders for <code>\xintNewExpr</code> could either be denoted <code>#1</code>, <code>#2</code>, ... or also <code>$1</code>, <code>$2</code>, ... Only the usual <code>#</code> form is now accepted and the special cases previously treated via the second form are now managed via a <code>protect(...)</code> function.</p></li>
</ul>
-</dd>
-</dl>
-<p><strong>novelties :</strong></p>
+<h3 id="improvements-and-new-features-10">Improvements and new features</h3>
<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>
@@ -323,6 +333,14 @@
<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. The dollar sign <code>$</code> for place holders is not accepted anymore, only the standard macro parameter <code>#</code>. Not all constructs are compatible with <code>\xintNewExpr</code>.</p></li>
</ul>
+<h3 id="bug-fixes-9">Bug fixes</h3>
+<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>
<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 (later release <code>1.1</code> made source code available as <code>sourcexint.pdf</code>).</p></li>
Modified: trunk/Master/texmf-dist/doc/generic/xint/CHANGES.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/xint/README
===================================================================
--- trunk/Master/texmf-dist/doc/generic/xint/README 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/doc/generic/xint/README 2016-12-23 23:05:36 UTC (rev 42782)
@@ -1,4 +1,4 @@
- Source: xint.dtx 1.2i 2016/12/13 (doc 2016/12/13)
+ Source: xint.dtx 1.2j 2016/12/22 (doc 2016/12/22)
Author: Jean-Francois Burnol
Info: Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c
Modified: trunk/Master/texmf-dist/doc/generic/xint/README.html
===================================================================
--- trunk/Master/texmf-dist/doc/generic/xint/README.html 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/doc/generic/xint/README.html 2016-12-23 23:05:36 UTC (rev 42782)
@@ -4,7 +4,7 @@
<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 1.2i" />
+ <meta name="author" content="xint 1.2j" />
<title>README</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
@@ -17,8 +17,8 @@
<body>
<div id="header">
<h1 class="title">README</h1>
-<h2 class="author">xint 1.2i</h2>
-<h3 class="date">2016/12/13</h3>
+<h2 class="author">xint 1.2j</h2>
+<h3 class="date">2016/12/22</h3>
</div>
<div id="TOC">
<ul>
@@ -36,7 +36,7 @@
<li><a href="#license">License</a></li>
</ul>
</div>
-<pre><code>Source: xint.dtx 1.2i 2016/12/13 (doc 2016/12/13)
+<pre><code>Source: xint.dtx 1.2j 2016/12/22 (doc 2016/12/22)
Author: Jean-Francois Burnol
Info: Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c</code></pre>
Modified: trunk/Master/texmf-dist/doc/generic/xint/README.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/xint/sourcexint.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/xint/xint.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/generic/xint/xint.dtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/xint/xint.dtx 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/source/generic/xint/xint.dtx 2016-12-23 23:05:36 UTC (rev 42782)
@@ -3,20 +3,20 @@
% Extract all files via "etex xint.dtx" and do "make help"
% or follow instructions from extracted README.md.
%<*dtx>
-\def\xintdtxtimestamp {Time-stamp: <13-12-2016 at 12:22:08 CET>}
+\def\xintdtxtimestamp {Time-stamp: <22-12-2016 at 22:59:29 CET>}
%</dtx>
%<*drv>
%% ---------------------------------------------------------------
-\def\xintdocdate {2016/12/13}
-\def\xintbndldate{2016/12/13}
-\def\xintbndlversion {1.2i}
+\def\xintdocdate {2016/12/22}
+\def\xintbndldate{2016/12/22}
+\def\xintbndlversion {1.2j}
%</drv>
%<readme>% README
%<changes>% CHANGE LOG
-%<readme|changes>% xint 1.2i
-%<readme|changes>% 2016/12/13
+%<readme|changes>% xint 1.2j
+%<readme|changes>% 2016/12/22
%<readme|changes>
-%<readme|changes> Source: xint.dtx 1.2i 2016/12/13 (doc 2016/12/13)
+%<readme|changes> Source: xint.dtx 1.2j 2016/12/22 (doc 2016/12/22)
%<readme|changes> Author: Jean-Francois Burnol
%<readme|changes> Info: Expandable operations on big integers, decimals, fractions
%<readme|changes> License: LPPL 1.3c
@@ -23,7 +23,7 @@
%<readme|changes>
%<*!readme&!changes&!dohtmlsh&!dopdfsh&!makefile>
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%<xintkernel>%% xintkernel: Paraphernalia for the xint packages
%<xinttools>%% xinttools: Expandable and non-expandable utilities
@@ -243,6 +243,33 @@
%</readme>--------------------------------------------------------
%<*changes>-------------------------------------------------------
+`1.2j (2016/12/22)`
+----
+
+### Improvements and new features
+
+ - **xinttools** and **xintexpr**:
+
+ 1. slightly improves the speed of `\xintTrim`.
+
+ 2. speed gains for the handlers of comma separated lists
+ implementing Python-like slicing and item extraction. Relevant
+ non (user) documented macros better documented in
+ `sourcexint.pdf`.
+
+ - significant documentations tweaks (inclusive of suppressing things!),
+ and among them two beautiful hyperlinked tables with both horizontal
+ and vertical rules which bring the documentation of the **xintexpr**
+ syntax to a kind of awe-inspiring perfection... except that
+ implementation of some math functions is still lacking.
+
+### Bug fixes
+
+ - fix two `1.2i` regressions caused by undefined macros (`\xintNthElt`
+ in certain branches and `[list][N]` item extraction in certain
+ cases.) The test files existed but were not executed prior to
+ release. Automation in progress.
+
`1.2i (2016/12/13)`
----
@@ -340,7 +367,6 @@
the dummy variable was given an empty range (or list) of values,
rather than producing respectively `0` and `1` as formerly.
-
`1.2g (2016/03/19)`
----
@@ -382,7 +408,6 @@
Brent-Salamin algorithm for computation of Pi using `iter` in a float
expression.
-
`1.2f (2016/03/12)`
----
@@ -390,20 +415,6 @@
- no more `\xintFac` macro but `\xintiFac/\xintiiFac/\xintFloatFac`.
-### Bug fixes
-
- - squaring macro `\xintSqr` from **xintfrac.sty** was broken due to a
- misspelled sub-macro name. Dates back to `1.1` release of `2014/10/28`
- `:-((`.
-
- - `1.2c`'s fix to the subtraction bug from `1.2` introduced another bug,
- which in some cases could create leading zeroes in the output, or even
- worse. This could invalidate other routines using subtractions, like
- `\xintiiSquareRoot`.
-
- - the comparison operators were not recognized by `\xintNewIIExpr` and
- `\xintdefiifunc` constructs.
-
### Improvements and new features
- functions `binomial`, `pfactorial` and `factorial` in both integer
@@ -448,10 +459,35 @@
shuffling of sections and well thought additions; cuts were considered and
even performed.
+### Bug fixes
+ - squaring macro `\xintSqr` from **xintfrac.sty** was broken due to a
+ misspelled sub-macro name. Dates back to `1.1` release of `2014/10/28`
+ `:-((`.
+
+ - `1.2c`'s fix to the subtraction bug from `1.2` introduced another bug,
+ which in some cases could create leading zeroes in the output, or even
+ worse. This could invalidate other routines using subtractions, like
+ `\xintiiSquareRoot`.
+
+ - the comparison operators were not recognized by `\xintNewIIExpr` and
+ `\xintdefiifunc` constructs.
+
`1.2e (2015/11/22)`
----
+### Improvements and new features
+
+ - macro `\xintunassignvar`.
+
+ - slight modifications of the logged messages in case of `\xintverbosetrue`.
+
+ - a space in `\xintdeffunc f(x)<space>:= expression ;` is now accepted.
+
+ - documentation enhancements: the _Quick Sort_ section with its included
+ code samples has been entirely re-written; the _Commands of the xintexpr
+ package_ section has been extended and reviewed entirely.
+
### Bug fixes
- in **xintfrac**: the `\xintFloatFac` from release `1.2` parsed its
@@ -465,26 +501,9 @@
multiplication was not yet always done with enhanced precedence. Now
yes.
-### Improvements and new features
-
- - macro `\xintunassignvar`.
-
- - slight modifications of the logged messages in case of `\xintverbosetrue`.
-
- - a space in `\xintdeffunc f(x)<space>:= expression ;` is now accepted.
-
- - documentation enhancements: the _Quick Sort_ section with its included
- code samples has been entirely re-written; the _Commands of the xintexpr
- package_ section has been extended and reviewed entirely.
-
`1.2d (2015/11/18)`
----
-### Bug fixes
-
- - in **xintcore**: release `1.2c` had inadvertently broken the
- `\xintiiDivRound` macro.
-
### Improvements and new features
- the function definitions done by `\xintdeffunc` et al., as well as
@@ -498,15 +517,15 @@
- some documentation enhancements, particularly in the chapter on
xintexpr.sty, and also in the code source comments.
+### Bug fixes
+
+ - in **xintcore**: release `1.2c` had inadvertently broken the
+ `\xintiiDivRound` macro.
+
+
`1.2c (2015/11/16)`
----
-### Bug fixes
-
- - in **xintcore**: recent release `1.2` introduced a bug in the
- subtraction (happened when 00000001 was found under certain
- circumstances at certain mod 8 locations).
-
### Improvements and new features
- macros `\xintdeffunc`, `\xintdefiifunc`, `\xintdeffloatfunc` and
@@ -515,6 +534,12 @@
- on-going code improvements and documentation enhancements, but
stopped in order to issue this bugfix release.
+### Bug fixes
+
+ - in **xintcore**: recent release `1.2` introduced a bug in the
+ subtraction (happened when 00000001 was found under certain
+ circumstances at certain mod 8 locations).
+
`1.2b (2015/10/29)`
----
@@ -525,15 +550,10 @@
attempted to use with 1+99999999 a subroutine expecting only 8-digits
numbers).
+
`1.2a (2015/10/19)`
----
-### Bug fixes
-
- - in **xintexpr**: recent release `1.2` introduced a bad bug in the
- parsing of decimal numbers and as a result `\xinttheexpr 0.01\relax`
- expanded to `0` ! (sigh...)
-
### Improvements and new features
- added `\xintKeepUnbraced`, `\xintTrimUnbraced` (**xinttools**) and fixed
@@ -545,6 +565,12 @@
by the quicker ``\romannumeral`&&@`` (`^` being used as letter,
had to find another character usable with catcode 7).
+### Bug fixes
+
+ - in **xintexpr**: recent release `1.2` introduced a bad bug in the
+ parsing of decimal numbers and as a result `\xinttheexpr 0.01\relax`
+ expanded to `0` ! (sigh...)
+
`1.2 (2015/10/10)`
----
@@ -652,55 +678,38 @@
`1.1 (2014/10/28)`
----
-bug fixes
+### Incompatible changes
-: - `\xintZapFirstSpaces` hence also `\xintZapSpaces` from package **xinttools**
- were buggy when used with an argument either empty or containing only
- space tokens.
+ - in `\xintiiexpr`, `/` does _rounded_ division, rather than the
+ Euclidean division (for positive arguments, this is truncated division).
+ The `//` operator does truncated division,
- - `\xintiiexpr` did not strip leading zeroes, hence
- `\xinttheiiexpr 001+1\relax` did not obtain the expected result ...
+ - the `:` operator for three-way branching is gone, replaced with `??`,
- - `\xinttheexpr \xintiexpr 1.23\relax\relax` should have produced `1`,
- but it produced `1.23`
+ - `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 infix operators of highest precedence,
- - the catcode of `;` was not set at package launching time.
+ - the `add` and `mul` have a new syntax, old syntax is with `` `+` `` and
+ `` `*` `` (left quotes mandatory), `sum` and `prd` are gone,
- - the `\XINTinFloatPrd:csv` macro name had a typo, hence `prd` was
- non-functional in `\xintfloatexpr`.
+ - 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),
-breaking changes
+ - 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.
-: - in `\xintiiexpr`, `/` does _rounded_ division, rather than the
- Euclidean division (for positive arguments, this is truncated division).
- The `//` operator does truncated division,
+ - in earlier releases, place holders for `\xintNewExpr` could either
+ be denoted `#1`, `#2`, ... or also `$1`, `$2`, ...
+ Only the usual `#` form is now accepted and the special cases previously
+ treated via the second form are now managed via a `protect(...)` function.
- - the `:` operator for three-way branching is gone, replaced with `??`,
+### Improvements and new features
- - `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 infix operators of highest precedence,
-
- - the `add` and `mul` have a new syntax, old syntax is with `` `+` `` and
- `` `*` `` (left 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.
-
- - in earlier releases, place holders for `\xintNewExpr` could either
- be denoted `#1`, `#2`, ... or also `$1`, `$2`, ...
- Only the usual `#` form is now accepted and the special cases previously
- treated via the second form are now managed via a `protect(...)` function.
-
-**novelties :**
-
* new package **xintcore** has been split off **xint**. It contains the
core arithmetic macros. It is loaded by package **bnumexpr**,
@@ -818,6 +827,23 @@
parameter `#`. Not all constructs are compatible with `\xintNewExpr`.
% $ this docstripped line for emacs buffer fontification issues in doctex-mode
+### 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`.
+
`1.09n (2014/04/01)`
----
@@ -2948,7 +2974,7 @@
\centeredline{%
\begin{tikzpicture}[node distance = 2.5cm]
% Place nodes
- \node [block] (kernel) {xintkernel};
+ \node [block] (kernel) {\xintkernelname};
\node [left of=kernel] (A) {};
\node [right of=kernel] (B) {};
\node [block, below right of=B] (core) {\xintcorename};
@@ -3258,17 +3284,18 @@
must be loaded additionally to \xintexprname),
%\item |'| for octal input (\emph{not yet}),
\item functions \xintFor #1 in {num, reduce, abs, sgn, frac, floor, ceil, sqr, sqrt,
- sqrtr, float, round, trunc, mod, quo, rem, gcd, lcm,
+ sqrtr, float, round, trunc, mod, quo, rem,
max, min, |`+`|, |`*`|, not, all, any, xor, if, ifsgn, even, odd, first,
last, reversed, bool, togl, factorial, binomial, pfactorial}\do {\dtt{#1}, }
+\item multi-arguments \dtt{gcd} and \dtt{lcm} are available if \xintgcdname is
+ loaded,
\item functions with dummy variables \xintFor #1 in {add, mul, seq, subs,
rseq, iter, rrseq, iterr}\do {\dtt{#1}\xintifForLast{.}{, }}
\end{itemize}
-See \autoref{sec:xintexprsyntax} (and \autoref{ssec:syntax}) for the complete
-syntax, as well as \autoref{ssec:moredummies} which contains examples
-illustrating further some features which were added at the time of release
-|1.1 2014/10/28|.
+See \autoref{xintexpr} for basic information and \autoref{sec:xintexprsyntax}
+for the built-in syntax elements.
+
The normal mode of operation of the parsers is to unveil the parsed material
token by token. This means that all elements may arise from expansion of
encountered macros (or active characters). For example a closing parenthesis
@@ -3327,8 +3354,8 @@
|B| divides |D| or |D| divides |B|.
\end{framed}
-Make sure to read \autoref{ssec:userinterface}, \autoref{sec:xintexprsyntax}
-and also \autoref{sec:expr}.
+Make sure to read \autoref{sec:expr}, \autoref{sec:xintexprsyntax} and
+\autoref{ssec:outputformat}.
\subsection{Printing big numbers on the page}\label{ssec:printnumber}
When producing very long numbers there is the question of printing them on
@@ -3605,8 +3632,8 @@
\item The functionalities of \xintexprname are illustrated with various
- examples, and in locations such as in \autoref{xintdeffunc} and
- \autoref{ssec:dummies}.
+ examples, found in locations such as in \autoref{xintdeffunc} and
+ \hyperlink{ssec:dummies}{functions with dummy variables} and \autoref{ssec:moredummies}.
\end{itemize}
Almost all of the computational results interspersed throughout the
documentation are not hard-coded in the source file of this document but are
@@ -3673,9 +3700,11 @@
xint| on the command line.
This is release \expandafter|\xintbndlversion| of \expandafter|\xintbndldate|.
-It principally brings across-the-board speed improvements to under the hood
-auxiliary routines, see |CHANGES.html| or |CHANGES.pdf| for more.
+Releases |1.2i| and |1.2j| brought principally across-the-board speed
+improvements to various token or digits handling routines, and refactored the
+documentation somewhat. See |CHANGES.html| or |CHANGES.pdf| for more.
+
The last major release was |1.2 (2015/10/10)|. It came with a complete rewrite
of the core arithmetic routines. The efficiency for numbers with less than
$20$ or $30$ digits was slightly compromised (for addition/subtraction) but it
@@ -3708,76 +3737,115 @@
\localtableofcontents
-\subsection{Precedence levels}
+\subsection{Built-in operators and precedences}
% \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}
-We go through the various syntax elements from highest to lowest precedence.
-Strictly speaking we should speak of precedence only for operators (binary or
-postfix unary).
+% Dimanche 18 décembre 2016 à 09:45:11
-Functions and variables may arise only when the parser expect to start
-building a number (but see the section
-\hyperref[ssec:tacit multiplication]{Tacit multiplication} next about what
-happens when the parser has \emph{already started} building a number.) We
-approximately describe the situation as saying they have highest precedence,
-because they put the parser in a state of immediate attention. When the name
-is terminated (hopefully by an opening parenthesis -- which may arise from
-expansion -- in the case of a function)
-the parser will check if the name is the one of a function or of a variable.
+% hallucinant, table fait passer en \normalfont, on croit rêver !
+% J'EN AI VRAIMENT MARRE DE LATEX ! C'EST MONSTRUEUX SON ESPRIT NORMALISATEUR !
+% \@floatboxreset fait \reset at font=\normalfont. Pourquoi ne pas laisser
+% cela à l'utilisateur **si nécessaire** ??
-Note: there may be some evolution in future, perhaps to distinguish some of
-the constructs which currently share the same precedence (e.g. there are many
-things at the same level \textbf{3}).
+% Et bien sûr à nouveau 10 minutes de perdues à essayer de me dépatouiller des
+% DÉLIRES DE LATEX. Et \@floatboxreset fait \normalsize, ça j'y avais déjà
+% fait attention.
-In case of equal precedence, the general rule is left-associativity (i.e.
-earlier encountered operators are executed first).
+% ancienne version utilisait \ttfamily et ne faisait pas \makestarlowast
+\def\MicroFont
+{\ttbfamily\makestarlowast\color[named]{DarkOrchid}}
+\def\myitem#1{\item[$#1$]\hypertarget{\detokenize{prec-$#1$}}{}}%
+\def\mylink#1{\hyperlink{\detokenize{prec-#1}}{#1}}
+
+\makeatletter
+\def\@floatboxreset{\@setminipage}% faudra contrôler celui-là
+\makeatother
+\begin{table}[htbp]\ht\strutbox12pt\dp\strutbox5pt
+ \centering\begin{tabular}{|c|p{.5\textwidth}|}
+ \hline
+ Precedence&``Operators'' at this level\strut\\
+ \hline\hline
+ \mylink{$\infty$}&
+ functions and variables, decimal mark |.|, |e| and |E| of scientific notation, hexadecimal prefix |"|.\strut\\\hline
+ \mylink{$10$}& postfix |!| (factorial) and conditional branching operators |?| and |??| \strut\\\hline
+ \mylink{$=$}& minus sign |-| as unary operator acquires the
+ precedence level of the previous infix operator.\strut\\\hline
+ \mylink{$9$}&|^|, |**| and list operators |^[|, |**[|, |]^|, |]**|.\strut\\\hline
+ \mylink{$8$}&tacit multiplication.\strut\\\hline
+ \mylink{$7$}&|*|, |/|, and list operators |*[|, |/[|, |]*|, |]/|.\strut\\\hline
+ \mylink{$6$}&|+|, |-|, and list operators |+[|, |-[|, |]+|, |]-|.\strut\\\hline
+ \mylink{$5$}&|<|, |>|, |==| (or |=|), |<=|, |>=|, |!=|.\strut\\\hline
+ \mylink{$4$}&|&&| and its equivalent |'and'|.\strut\\\hline
+ \mylink{$3$}&\verb+||+, its equivalent |'or'|, and |'xor'|; also the
+ sequence generators |..|, |..[|, |]..|, and the Python slicer |:|.\strut\\\hline
+ \mylink{$2$}& the comma |,|.\strut\\\hline
+ \mylink{$1$}& the parentheses |(|, |)|, list brackets |[|, |]|, and semi-colon |;| in an |iter| or
+ |rseq|.\strut\\\hline
+ \end{tabular}
+ \caption{Precedence levels}
+ \label{tab:precedences}
+\end{table}
+
+The \autoref{tab:precedences} is hyperlinked to the more detailed discussion
+at each level. The levels are indicative and there may be some evolution in
+future, perhaps to distinguish some of the constructs which currently share
+the same precedence.
+
+In case of equal precedence, the general rule is left-associativity: the first
+encountered operation is executed first.
+\hyperref[ssec:tacit multiplication]{Tacit multiplication} has an elevated
+precedence level hence seemingly breaks left-associativity: |(1+2)/(3+4)(5+6)|
+is computed as |(1+2)/((3+4)*(5+6))| and |x/2y| is interpreted as |x/(2*y)|
+when using variables.
+
+
\begin{description}[parsep=0pt,align=left,itemindent=0pt,
leftmargin=\leftmarginii, labelwidth=\leftmarginii, labelsep=0pt,
labelindent=0pt, listparindent=\leftmarginiii]
-\item[$\infty$] Functions and variables are all at the same highest
- precedence.
-
-\item[$\infty$]\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
+\myitem{\infty} At this highest level of precedence, one finds:
+\begin{itemize}[parsep=0pt,align=left,itemindent=0pt,
+ leftmargin=\leftmarginii, labelwidth=\leftmarginii, labelsep=0pt,
+ labelindent=0pt, listparindent=\leftmarginiii]
+\item functions and variables: we approximately describe the situation as
+ saying they have highest precedence. Functions (even the logic functions |!|
+ and |?| which are expressed as a single character) must be used with
+ parentheses. These parentheses may arise from expansion after the function
+ name is parsed (there are exceptions which are documented at the relevant
+ locations.)
+\item 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 0.^2+2^.0\relax|}
%
which is |0^2+2^0| and produces \dtt{\xinttheexpr 0.^2+2^.0\relax}.
- Since release |1.2|\IMPORTANT\ an isolated decimal mark |"."| such as in
- |\xinttheexpr .^2\relax| is illegal input.\footnote{A sole decimal mark is
- still valid as argument to macros from package \xintfracname.}
-
-\item[$\infty$] The |e| and |E| for scientific notation. They are parsed
+ Since release |1.2| an isolated decimal mark |"."| is illegal
+ input in |\xintexpr..\relax|, although it remains legal as argument to the
+ macros of \xintfracname.
+\item the |e|, equivalently |E|, for scientific notation are parsed
like the decimal mark is.
-\begingroup
-\restoreMicroFont |1e3^2| is \dtt{\xinttheexpr 1e3^2\relax}
-\endgroup
+\item the |"| for hexadecimal numbers: it is 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; letters
+ (only |ABCDEF|, not |abcdef|), an optional dot
+ (allowed directly in front) and an optional (possibly empty) fractional
+ part. The |"| functionality
+ \fbox{requires to load package \xintbinhexname}.%
+%
+\begin{everbatim*}
+\xinttheexpr "FEDCBA9876543210\relax\newline
+\xinttheiexpr 16^5-("F75DE.0A8B9+"8A21.F5746+16^-5)\relax
+\end{everbatim*}
+\end{itemize}
-\item[$\infty$] 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; letters |A|, ..., |F|,
- but not |a|, ..., |f|) 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[10] The postfix operators \ctexttt{!} and the branching conditionals \ctexttt{?, ??}.
+\myitem{10} The postfix operators |!| and the branching conditionals |?|, |??|.
\begin{description}[parsep=0pt,align=left,itemindent=0pt,
leftmargin=\leftmarginii, labelwidth=\leftmarginii, labelsep=0pt,
labelindent=0pt, listparindent=\leftmarginiii]
@@ -3784,41 +3852,29 @@
\item[{\color[named]{DarkOrchid}!}] computes the factorial of an integer.
- \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
+ \item[{\color[named]{DarkOrchid}?}] is used as |(stuff)?{yes}{no}|. It
+ evaluates |stuff| and chooses the |yes| branch if the result is
+ non-zero, else it executes |no|. After evaluation of |stuff| it acts as
+ a macro with two mandatory arguments within braces, 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.
+ |5+62^3=|\dtt{\xinttheiexpr(3>2)?{5+(6}{7-(1}2^3)\relax}. 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.}
- Prior to |1.2h|, inputs such as |(cond)?{?(x)}{bar}| were misinterpreted
- as involving the |??| operator and the work-around was to write |(cond)?{
- ?(x)}{bar}|, with an extra space. This is unneeded now.\CHANGED{1.2h}
- Also |(cond)?{\foo}{bar}| led to premature expansion of |\foo| and gain
- the fix was to insert an extra space. This has been corrected. Note though
- that the input |(cond)?{?}{!}(x)| will still confuse the parser but
- |(cond)?{?(x)}{!(x)}| or even |(cond)?{?(}{!(}x)| are ok.
- \item[{\color[named]{DarkOrchid}??}] is used as |(cond)??{<0}{=0}{>0}|.
- |cond| is anything, its sign is evaluated 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.
+ \item[{\color[named]{DarkOrchid}??}] is used as |(stuff)??{<0}{=0}{>0}|,
+ where |stuff| is anything, its sign is evaluated and depending on the sign
+ the correct branch is un-braced, the two others are discarded with no
+ evaluation of their contents. The un-braced branch will then be parsed as
+ usual.
%
\leftedline{|\def\x{0.33}\def\y{1/3}|}
%
@@ -3828,14 +3884,16 @@
%
\end{description}
-\item[=] The minus sign |-| as prefix unary operator inherits the precedence of
- the infix operator it follows. With things such as |5+------2*3|, the
- \xintexprname parsers don't try to be efficient: once |2*3| is evaluated the
- opposite function will be applied the necessary number of times. On the other
- hand the plus sign |+| as prefix unary operator as in, for example
- |5-++++++2*3|, is immediately gobbled.
+\myitem{=} The minus sign |-| as prefix unary operator inherits the
+ precedence of the infix operator it follows. |\xintexpr -3-4*-5^-7\relax|
+ evaluates as |(-3)-(4*(-(5^(-7))))| and |-3^-4*-5-7| as
+ |(-((3^(-4))*(-5)))-7|.
-\item[9] The power operator |^|, or |**|. It is left associative:
+ |2^-10| is perfectly accepted input, no need for parentheses
+
+
+
+\myitem{9} The power operator |^|, or equvalently |**|. 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 within |\xintfloatexpr..\relax| may
@@ -3861,7 +3919,9 @@
Also at this level the list operators |^[|, |**[|, |]^|, and |]**|.
-\item[7] Multiplication and division \raisebox{-.3\height}{|*|}, |/|. The
+\myitem{8} see \hyperref[ssec:tacit multiplication]{Tacit multiplication}.
+
+\myitem{7} Multiplication and division |*|, |/|. The
division is left associative, too:
%
\begingroup\restoreMicroFont
@@ -3870,9 +3930,7 @@
not \xinttheiexpr 100/(50/2)\relax.
%
\endgroup
- Inside \csbxint{iiexpr}, |/| does \emph{rounded} division. Tacit
- multiplication (see \autoref{ssec:tacit multiplication}) has an elevated
- precedence level \textbf{8}.
+ Inside \csbxint{iiexpr}, |/| does \emph{rounded} division.
Also at this level the list operators |*[|, |/[|, |]*| and |]/|.
@@ -3884,7 +3942,7 @@
trunc(100000/:13/13,10)\relax
\end{everbatim*}
-\item[6] Addition and subtraction |+|, |-|. According to the rule above, |-|
+\myitem{6} Addition and subtraction |+|, |-|. According to the rule above, |-|
is left associative:
%
\begingroup\restoreMicroFont
@@ -3896,13 +3954,19 @@
Also the list operators |+[|, |-[|, |]+|, |]-| are at this precedence level.
-\item[5] Comparison operators |<|, |>|, |=| (same as |==|), |<=|, |>=|, |!=| all
+\myitem{5} Comparison operators |<|, |>|, |=| (same as |==|), |<=|, |>=|, |!=| all
at the same level of precedence, use parentheses for disambiguation.
-\item[4] Conjunction (logical and): |&&| or equivalently
- |'and'| (quotes mandatory).
+\myitem{4} Conjunction (logical and) |&&| or equivalently
+ |'and'| (quotes mandatory).%
+%
+\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{} and they may be assigned some new meaning in the
+ future.}
-\item[3] Inclusive disjunction (logical or): \verb+||+
+\myitem{3} Inclusive disjunction (logical or) \verb+||+
and equivalently |'or'| (quotes mandatory).
Also the |'xor'| operator (quotes mandatory) is at this level.
@@ -3911,8 +3975,8 @@
Also the |:| for Python slicing of lists.
-\item[2] The comma: \restoreMicroFont with |\xinttheexpr 2^3,3^4,5^6\relax|
- one obtains as output \xinttheexpr 2^3,3^4,5^6\relax{}.\footnote{The comma
+\myitem{2} The comma: {\restoreMicroFont with |\xinttheexpr 2^3,3^4,5^6\relax|
+ one obtains as output \xinttheexpr 2^3,3^4,5^6\relax{}.}\footnote{The comma
is really like a binary operator, which may be called ``join''. It has
lowest precedence of all (apart the parentheses) because when it is
encountered all postponed operations are executed in order to finalize its
@@ -3919,7 +3983,7 @@
\emph{first} operand; only a new comma or a closing parenthesis or the end
of the expression will finalize its \emph{second} operand.}
-\item[1] The parentheses. The list outer brackets |[|, |]| share the same
+\myitem{1} The parentheses. The list outer brackets |[|, |]| share the same
functional precedence as parentheses. The semi-colon |;| in an |iter| or
|rseq| has the same precedence as a closing parenthesis.\footnote{It is not
apt to describle the opening parenthesis as an operator, but the closing
@@ -3930,114 +3994,67 @@
\end{description}
-\subsection{Tacit multiplication}
-\label{ssec:tacit multiplication}
+\restoreMicroFont
-Tacit multiplication (insertion of a |*|) applies when the parser is currently
-either scanning the digits of a number (or its decimal part or scientific
-part, or hexadecimal input), or is looking for an infix operator, and:
-(1.)~\emph{encounters a count or dimen or skip register or variable or an
- \eTeX{} expression}, or (2.)~\emph{encounters a sub-\csa{xintexpr}ession},
-or (3.)~\emph{encounters an opening parenthesis}, or (4.)~\emph{encounters a
- letter (which is interpreted as signaling the start of either a variable or
- a function name)}.
+\def\myitem#1{\item[#1]\hypertarget{\detokenize{builtinfunc-#1}}{}}%
-\begin{framed}
- For example, if |x, y, z| are variables all three of |(x+y)z|, |x(y+z)|,
- |(x+y)(x+z)| will create a tacit multiplication.
+\subsection{Built-in functions}
- Furthermore starting with release
- |1.2e|,\MyMarginNote[\kern\dimexpr\FrameSep+\FrameRule\relax]{Changed}
- whenever tacit multiplication is applied, in all cases it \emph{always}
- ``ties'' more\IMPORTANT{} than normal multiplication or division, but
- still less than power. Thus |x/2y| is interpreted as |x/(2y)| and
- similarly for |x/2max(3,5)| but |x^2y| is still interpreted as |(x^2)*y|
- and |2n!| as |2*n!|.
+ Functions are at the same top level of priority. All functions even
+ |?| and |!| (as prefix) require parentheses around their arguments.
-\begin{everbatim*}
-\xintdefvar x:=30;\xintdefvar y:=5;%
-\xinttheexpr (x+y)x, x/2y, x^2y, x!, 2x!, x/2max(x,y)\relax
-\end{everbatim*}
+\begin{table}[htbp]
+ \centering
+\cnta0
+\begin{tabular}{|c|c|c|c|c|c|}
+ \hline
+ \xintFor #1 in {abs, sgn, num, reduce, float, round, trunc, floor, ceil,
+ frac, sqr, sqrt, sqrtr, factorial, binomial, pfactorial, mod, quo, rem, gcd,
+ lcm, max, min, |`+`|, |`*`|, ?, !, not, all, any, xor, if, ifsgn, even, odd,
+ first, last, reversed, len, subs, add, mul, seq, rseq, iter, rrseq, iterr,
+ bool, togl, qint, qfrac, qfloat}\do
+ {\hyperlink{\detokenize{builtinfunc-#1}}{#1}\global\advance\cnta1
+ \ifnumequal{\cnta}{6}{\global\cnta0 \\\hline}{&}}%
+ \ifnumgreater{\cnta}{0}{\xintFor*#1in{\xintSeq[1]{\cnta}{4}}\do{&}\\\hline}{}%
+\end{tabular}
+\caption{Functions}\label{tab:functions}
+\end{table}
- The ``tie more'' rule applies to all cases of tacit multiplication. It
- impacts only situations when a division was the last seen operator, as the
- normal rule for the \xintexprname parsers is left-associativity in case of
- equal precedence.
-\begin{everbatim*}
-\xinttheexpr (1+2)/(3+4)(5+6), 2/x(10), 2/10x, 3/y\xintiiexpr 5+6\relax, 1/x(y)\relax
-\end{everbatim*}
-\end{framed}
+See \autoref{tab:functions} whose elements are hyperlinked to the
+corresponding definitions.
- Note that |y\xinttheiiexpr 5+6\relax| would have tried to use a variable
- with name |y11| rather than doing |y*11|: tacit multiplication works only
- in front of sub-\csbxint{expr}essions, not in front of
- \csbxint{theexpr}essions which are unlocked into explicit digits.
+Miscellaneous notes:
+\begin{itemize}[nosep]
+ \item \fbox{|gcd| and |lcm| require explicit loading of \xintgcdname},
+ \item |togl| is provided for the case |etoolbox| package is loaded,
-Here is an expression whose meaning is
- completely modified by the ``tie more'' property of tacit multiplication:
+ \item |bool|, |togl| use delimited macros to fetch their argument and the
+ closing parenthesis must be explicit, it can not arise from
+ on the spot expansion. The same holds for |qint|, |qfrac|, |qfloat|.
-%\IMPORTANT
+ \item Also \hyperlink{ssec:dummies}{functions with dummy variables} use
+ delimited macros for some tasks. See the relevant explanations there.
+\end{itemize}
-\begin{everbatim}
-\xintdeffunc e(z):=1+z(1+z/2(1+z/3(1+z/4)));
-\end{everbatim}
-will be parsed as |1+z*(1+z/(2*(1+z/(3*(1+z/4)))))| which is
- not at all like the presumably hoped:
-\begin{everbatim}
-\xintdeffunc e(z):=1+z(1+z/2*(1+z/3*(1+z/4)));
-\end{everbatim}
-This form can also be used, alternatively:
-\begin{everbatim}
-\xintdeffunc e(z):=(((z/4+1)z/3+1)z/2+1)z+1;
-\end{everbatim}
- Attention! tacit multiplication before an opening parenthesis applies
- always, but tacit multiplication after a closing parenthesis \emph{does
- not} apply in front of digits: |(1+1)5| is not legal. But
- |subs((1+1)x,x=5)| is, because in that case a variable is following the
- closing parenthesis.
-
-
-\subsection{Predefined functions}
-
- Functions are at the same top level of priority. All functions even
- |?| and |!| (as prefix) require parentheses around their arguments.
-
- \begin{snugframed}
- \xintFor #1 in {num, qint, qfrac, qfloat, reduce, abs, sgn, frac, floor,
- ceil, sqr, sqrt, sqrtr, factorial, binomial, pfactorial, float, round,
- trunc, mod, quo, rem, gcd, lcm, max, min, `+`, `*`, ?, !, not, all,
- any, xor, if, ifsgn, even, odd, first, last, reversed, len,
- bool, togl}\do
- {\ctexttt{#1}\xintifForLast{}{, }}
-
- |factorial|, |binomial|, |pfactorial|, |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|, |min|, |first|,
- |last|, |reversed| and |len| are functions with arbitrarily many comma
- separated arguments.
-
- |bool|, |togl| use delimited macros to fetch their argument and the
- closing parenthesis which thus must be explicit, not arising from
- expansion.
-
- The same holds for |qint|, |qfrac|, |qfloat|.\NewWithf{1.2}
- \end{snugframed}
-
-\begin{description}[parsep=0pt,% pas le temps de regarder labelwidth=\leftmarginiii,
- itemindent=0pt, listparindent=\leftmarginiii,
- leftmargin=\leftmarginii]
- \item[functions with a single (numeric) argument]
-\noindent\par
+\begin{description}[parsep=0pt,align=left,
+ leftmargin=0pt, itemindent=0pt,
+ labelwidth=-\fontdimen2\font, labelsep=\fontdimen2\font, labelindent=0pt,
+% leftmargin+itemindent="labelindent"+labelwidth+labelsep
+% leftmargin=labelindent+labelwidth+labelsep* (enumitem)
+% Utiliser \mbox{} et non pas \noindent\par pour bon display
+% (enfin c'était nécessaire avant chgt dans keys ci-dessus, ai oublié ancien
+% attention que listparindent n'est apparemment pas hérité, faut le refaire
+ listparindent=\leftmarginiii]
+ \item[functions with a single (numeric) argument:]\mbox{}
\begin{description}
- \item[num] truncates to the nearest integer (truncation towards zero).
+ \myitem{num} truncates to the nearest integer (truncation towards zero).
\begin{everbatim*}
\xinttheexpr num(3.1415^20)\relax
\end{everbatim*}
- \item[qint] skips the token by token parsing of the input. The ending
+ \myitem{qint} skips the token by token parsing of the input. The ending
parenthesis must be physically present rather than arising from
expansion.\NewWith{1.2} The |q| stands for ``quick''. This ``function''
handles the input exactly like do the |i| macros of \xintcorename, via
@@ -4044,7 +4061,7 @@
\csbxint{iNum}. Hence leading signs and the leading zeroes (coming next)
will be handled appropriately but spaces will not be systematically
stripped. They should cause no harm and will be removed as soon as the
- number is used with one of the basic operators. This input form \emph{does
+ number is used with one of the basic operators. This input mode \emph{does
not accept decimal part or scientific part}.
\begin{everbatim}
\def\x{....many many many ... digits}\def\y{....also many many many digits...}
@@ -4051,55 +4068,61 @@
\xinttheiiexpr qint(\x)*qint(\y)+qint(\y)^2\relax
\end{everbatim}
- \item[qfrac] does the same as \dtt{qint} excepts that it accepts fractions,
+ Testing showed that using |qint()| starts getting advantageous for inputs
+ having more (or \fexpan ding to more) than circa \dtt{20} explicit digits.
+ But for hundreds of digits the input gain becomes a negligible
+ proportion of (for example) the cost of a multiplication.
+
+ \myitem{qfrac} does the same as \dtt{qint} excepts that it accepts fractions,
decimal numbers, scientific numbers as they are understood by the macros of
package\NewWith{1.2} \xintfracname. Not to be used within an
|\xintiiexpr|-ession, except if hidden inside functions such as
\dtt{round} or \dtt{trunc} which produce integers from fractions.
- \item[qfloat] does the same as \dtt{qfrac} and converts to a float with the
+ \myitem{qfloat} does the same as \dtt{qfrac} and converts to a float with the
precision given by the setting of |\xintDigits|.
- \item[reduce] reduces a fraction to smallest terms
+ \myitem{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
+ \myitem{abs} absolute value
+ \myitem{sgn} sign
+ \myitem{frac} fractional part (it has nothing to do with |qfrac|... sigh...)
\begin{everbatim*}
\xinttheexpr frac(-355/113), frac(-1129.218921791279)\relax
\end{everbatim*}
- \item[floor] floor function.
- \item[ceil] ceil function.
- \item[sqr] square.
- \item[sqrt] in |\xintiiexpr|, truncated square root; in |\xintexpr| or
+ \myitem{floor} floor function.
+ \myitem{ceil} ceil function.
+ \myitem{sqr} square.
+ \myitem{sqrt} in |\xintiiexpr|, truncated square root; in |\xintexpr| or
|\xintfloatexpr| this is the floating point square root, and there is an
optional second argument for the precision.
- \item[sqrtr] in |\xintiiexpr| only, rounded square root.
- \item[factorial] factorial function (like the
+ \myitem{sqrtr} in |\xintiiexpr| only, rounded square root.
+ \myitem{factorial} factorial function (like the
post-fix |!| operator.) When used in |\xintexpr| or
|\xintfloatexpr| there is an optional second argument. See discussion later.
- \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.
+ \myitem{?} |?(x)| is the truth value, $1$ if non zero, $0$ if zero. Must use parentheses.
+ \myitem{!} |!(x)| is logical not, $0$ if non zero, $1$ if zero. Must use parentheses.
+ \myitem{not} logical not.
+ \myitem{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.
+ \myitem{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
+\item[functions with an alphabetical argument:]\mbox{}
+\begin{description}[listparindent=\leftmarginiii]
+\myitem{bool}
+ \ctexttt{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
@@ -4122,9 +4145,9 @@
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}%
+\myitem{togl}
+ Similarly \ctexttt{togl}|(name)| returns $1$
+ if the \LaTeX{} package \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}%
%
%
%
@@ -4168,17 +4191,16 @@
|\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
+\end{description}
+\item[functions with one mandatory and a second but optional argument:]\mbox{}
+ \begin{description}[listparindent=\leftmarginiii]
+ \myitem{round} For example
|round(-2^9/3^5,12)=|\dtt{\xinttheexpr round(-2^9/3^5,12)\relax.}
- \item[trunc] For example
+ \myitem{trunc} For example
|trunc(-2^9/3^5,12)=|\dtt{\xinttheexpr trunc(-2^9/3^5,12)\relax.}
- \item[float] For example
+ \myitem{float} For example
|float(-2^9/3^5,12)=|\dtt{\xinttheexpr float(-2^9/3^5,12)\relax.}
- \item [sqrt] in \csa{xintexpr}|...\relax| and \csa{xintfloatexpr}|...\relax|
+ \item[sqrt] in \csa{xintexpr}|...\relax| and \csa{xintfloatexpr}|...\relax|
it achieves the precision given by the optional second argument. For
legacy reasons the |sqrt| function in \csa{xintiiexpr} \emph{truncates}
(to an integer), whereas |sqrt| in \csa{xintfloatexpr}|...\relax| (and in
@@ -4199,18 +4221,17 @@
\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
+ \item[functions with two arguments:]\mbox{}
+ \begin{description}[listparindent=\leftmarginiii]
+ \myitem{quo} first truncates the arguments then computes the Euclidean quotient.
+ \myitem{rem} first truncates the arguments then computes the Euclidean remainder.
+ \myitem{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*}
- \item[binomial] computes binomial coefficients.\NewWith {1.2f} For some
+ \myitem{binomial} computes binomial coefficients.\NewWith {1.2f} For some
obscure reason the initial version rather than returning zero for
|binomial(x,y)| with |y<0| or |x<y| deliberately raised an out-of-range
error. This has been fixed in |1.2h|. An error is raised only for
@@ -4219,10 +4240,11 @@
\xinttheexpr seq(binomial(20, i), i=0..20)\relax
\end{everbatim*}
\begin{everbatim*}
-\xintthefloatexpr seq(binomial(100, 50+i), i=-5..+5)\relax
+\printnumber{\xintthefloatexpr seq(binomial(100, 50+i), i=-5..+5)\relax}%
\end{everbatim*}
+
The arguments must be (expand to) short integers.
- \item[pfactorial] computes partial factorials\NewWith {1.2f} i.e.
+ \myitem{pfactorial} computes partial factorials\NewWith {1.2f} i.e.
|pfactorial(a,b)| evaluates the product |(a+1)...b|.
\begin{everbatim*}
\xinttheexpr seq(pfactorial(20, i), i=20..30)\relax
@@ -4233,8 +4255,8 @@
\end{description}
- \item[the if conditional (twofold way)]
-\noindent\par
+ \myitem{if} (twofold-way conditional)\mbox{}
+
\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
@@ -4241,45 +4263,45 @@
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
+ \myitem{ifsgn} (threefold-way conditional)\mbox{}
+
\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
+ \item[functions with an arbitrary number of arguments:]\mbox{}
+
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):
+ \begin{description}[listparindent=\leftmarginiii]
+\myitem{all} inserts a logical |AND| in between arguments and evaluates,
+\myitem{any} inserts a logical |OR| in between all arguments and evaluates,
+\myitem{xor} inserts a logical |XOR| in between all arguments and evaluates,
+\myitem{|`+`|} adds (left ticks mandatory):
\begin{everbatim*}
\xinttheexpr `+`(1,3,19), `+`(1*2,3*4,19*20)\relax
\end{everbatim*}
-\item[|`*`|] multiplies (left ticks mandatory):
+\myitem{|`*`|} multiplies (left ticks mandatory):
\begin{everbatim*}
\xinttheexpr `*`(1,3,19), `*`(1^2,3^2,19^2), `*`(1*2,3*4,19*20)\relax
\end{everbatim*}
-\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]|.
+\myitem{max} maximum,
+\myitem{min} minimum,
+\myitem{gcd} first truncates to integers then computes the |GCD|, requires \xintgcdname,
+\myitem{lcm} first truncates to integers then computes the |LCM|, requires \xintgcdname,
+\myitem{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:]|.
+\myitem{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
+\myitem{reversed} reverses the order
\begin{everbatim*}
\xinttheiiexpr reversed(123..150)\relax
\end{everbatim*}
-\item[len] computes\NewWith{1.2g} the number of items in a comma separated
+\myitem{len} computes\NewWith{1.2g} the number of items in a comma separated
list. Earlier syntax was |[a,b,...,z][0]| but since |1.2g| this now returns
the first element of the list.
\begin{everbatim*}
@@ -4286,10 +4308,8 @@
\xinttheiiexpr len(1..50, 101..150, 1001..1050)\relax
\end{everbatim*}
\end{description}
-\end{description}
-\subsection{Constructs with dummy variables}
-\label{ssec:dummies}
+\item[functions requiring dummy variables:]\hypertarget{ssec:dummies}{}\mbox{}
The ``functions'' \xintFor #1 in {add, mul, seq, subs, rseq, iter, rrseq,
iterr} \do {\ctexttt{#1}\xintifForLast{}{, }} use delimited macros to
@@ -4322,10 +4342,10 @@
Dummy variables are necessarily single-character letters, and all lowercase and
uppercase Latin letters are pre-configured for that usage.
-\begin{description}[parsep=0pt,% labelwidth=\leftmarginii,
- itemindent=0pt, listparindent=\leftmarginiii,
- leftmargin=\leftmarginii]
-\item [subs] for variable substitution
+% nécessaire de re-spécifier listparindent
+
+\begin{description}[listparindent=\leftmarginiii]
+\myitem{subs} for variable substitution
\begin{everbatim*}
\xinttheexpr subs(subs(seq(x*z,x=1..10),z=y^2),y=10)\relax\newline
\end{everbatim*}%
@@ -4345,19 +4365,19 @@
See the examples related to the |3x3| determinant in the
\autoref{xintNewExpr} for an illustration of list substitution.
-\item[add] addition
+\myitem{add} addition
\begin{everbatim*}
\xinttheiiexpr add(x^3,x=1..50), add(x(x+1), x=1,3,19)\relax\newline
\end{everbatim*}%
See |`+`| for syntax without a dummy variable.
-\item[mul] multiplication
+\myitem{mul} multiplication
\begin{everbatim*}
\xinttheiiexpr mul(x^2, x=1,3,19), mul(2n+1,n=1..10)\relax\newline
\end{everbatim*}%
See |`*`| for syntax without a dummy variable.
-\item[seq] comma separated values generated according to a formula
+\myitem{seq} comma separated values generated according to a formula
\begin{everbatim*}
\xinttheiiexpr seq(x(x+1)(x+2)(x+3),x=1..10), `*`(seq(3x+2,x=1..10))\relax
\end{everbatim*}
@@ -4365,7 +4385,7 @@
\xinttheiiexpr seq(seq(i^2+j^2, i=0..j), j=0..10)\relax
\end{everbatim*}
-\item[rseq] recursive sequence, |@| for the previous value.
+\myitem{rseq} recursive sequence, |@| for the previous value.
\begin{everbatim*}
\printnumber {\xintthefloatexpr subs(rseq (1; @/2+y/2@, i=1..10),y=1000)\relax }\newline
\end{everbatim*}%
@@ -4381,7 +4401,7 @@
(sqrt([@][0]*[@][1]),([@][0]+[@][1])/2), i=1..7)\relax }
\end{everbatim*}
-\item[iter] is exactly like |rseq|\CHANGED{1.2g}, except that it only prints
+\myitem{iter} is exactly like |rseq|\CHANGED{1.2g}, except that it only prints
the last iteration. Strangely it was lacking from |1.1| release, or rather
what was available from |1.1| to |1.2f| is what is called now |iterr|
(described below).
@@ -4400,14 +4420,17 @@
{BS(@)}, % else do iteration via pre-defined (for convenience) function BS.
i=1++) % This generates infinite iteration. The i is not used.
\relax
-\xintDigits:=16;
-\end{everbatim*}
+\xintDigits:=16;%
+\end{everbatim*}\newline
+ You can try with |\xintDigits:=1001;| and |2[-501]| in place of
+ |\xintDigits:=91;| and |2[-45]|, but don't make a final rounding to only
+ |88| digits of course ... and better wrap the whole thing in |\message| or
+ |\immediate\write128| because it will run in the right margin (about
+ \dtt{7}s on my laptop last time I tried).
- You can try with |\xintDigits:=1001;| and |2[-501]|, but don't round to |88|
- digits of course ... and better wrap the whole thing in |\message| because
- it will run in the right margin (about \dtt{7.4}s on my laptop last time I tried).
-\item[rrseq] recursive sequence with multiple initial terms. Say, there are
+
+\myitem{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 and may
@@ -4434,7 +4457,7 @@
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[iterr] same as |rrseq| but does not print any value until the last |K|.
+\myitem{iterr} same as |rrseq| but does not print any value until the last |K|.
\begin{everbatim*}
\xinttheiiexpr iterr(0,1; @1+ at 2, i=2..5, 6..10)\relax
% the iterated over list is allowed to have disjoint defining parts.
@@ -4448,10 +4471,10 @@
With |seq|, |rseq|, |iter|, |rrseq|, |iterr|, \textbf{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. The |n++| construct
+\myitem{abort} stop here and now.
+\myitem{omit} omit this value.
+\myitem{break} |break(stuff)| to abort and have |stuff| as last value.
+\myitem{n++} serves to generate a potentially infinite list. 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*}
@@ -4468,8 +4491,209 @@
\end{everbatim*}
\end{description}
+\end{description}
+
Some additional examples are to be found in \autoref{ssec:moredummies}.
+\subsection{Tacit multiplication}
+\label{ssec:tacit multiplication}
+
+Tacit multiplication (insertion of a |*|) applies when the parser is currently
+either scanning the digits of a number (or its decimal part or scientific
+part, or hexadecimal input), or is looking for an infix operator, and:
+(1.)~\emph{encounters a count or dimen or skip register or variable or an
+ \eTeX{} expression}, or (2.)~\emph{encounters a sub-\csa{xintexpr}ession},
+or (3.)~\emph{encounters an opening parenthesis}, or (4.)~\emph{encounters a
+ letter (which is interpreted as signaling the start of either a variable or
+ a function name)}.
+
+\begin{framed}
+ For example, if |x, y, z| are variables all three of |(x+y)z|, |x(y+z)|,
+ |(x+y)(x+z)| will create a tacit multiplication.
+
+ Furthermore starting with release
+ |1.2e|,\MyMarginNote[\kern\dimexpr\FrameSep+\FrameRule\relax]{Changed}
+ whenever tacit multiplication is applied, in all cases it \emph{always}
+ ``ties'' more\IMPORTANT{} than normal multiplication or division, but
+ still less than power. Thus |x/2y| is interpreted as |x/(2y)| and
+ similarly for |x/2max(3,5)| but |x^2y| is still interpreted as |(x^2)*y|
+ and |2n!| as |2*n!|.
+
+\begin{everbatim*}
+\xintdefvar x:=30;\xintdefvar y:=5;%
+\xinttheexpr (x+y)x, x/2y, x^2y, x!, 2x!, x/2max(x,y)\relax
+\end{everbatim*}
+
+ The ``tie more'' rule applies to all cases of tacit multiplication. It
+ impacts only situations when a division was the last seen operator, as the
+ normal rule for the \xintexprname parsers is left-associativity in case of
+ equal precedence.
+\begin{everbatim*}
+\xinttheexpr (1+2)/(3+4)(5+6), 2/x(10), 2/10x, 3/y\xintiiexpr 5+6\relax, 1/x(y)\relax
+\end{everbatim*}
+\end{framed}
+
+ Note that |y\xinttheiiexpr 5+6\relax| would have tried to use a variable
+ with name |y11| rather than doing |y*11|: tacit multiplication works only
+ in front of sub-\csbxint{expr}essions, not in front of
+ \csbxint{theexpr}essions which are unlocked into explicit digits.
+
+
+Here is an expression whose meaning is
+ completely modified by the ``tie more'' property of tacit multiplication:
+
+%\IMPORTANT
+
+\begin{everbatim}
+\xintdeffunc e(z):=1+z(1+z/2(1+z/3(1+z/4)));
+\end{everbatim}
+will be parsed as |1+z*(1+z/(2*(1+z/(3*(1+z/4)))))| which is
+ not at all like the presumably hoped:
+\begin{everbatim}
+\xintdeffunc e(z):=1+z(1+z/2*(1+z/3*(1+z/4)));
+\end{everbatim}
+This form can also be used, alternatively:
+\begin{everbatim}
+\xintdeffunc e(z):=(((z/4+1)z/3+1)z/2+1)z+1;
+\end{everbatim}
+
+ Attention! tacit multiplication before an opening parenthesis applies
+ always, but tacit multiplication after a closing parenthesis \emph{does
+ not} apply in front of digits: |(1+1)5| is not legal. But
+ |subs((1+1)x,x=5)| is, because in that case a variable is following the
+ closing parenthesis.
+
+
+\subsection{More examples with dummy variables}
+\label{ssec:moredummies}
+
+These examples were first added to this manual at the time of the |1.1|
+release (|2014/10/29|).
+
+\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 (... and it is so I
+admit). 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.
+
+\begin{everbatim*}
+The first Fibonacci number beyond |2^64| bound is
+\xinttheiiexpr subs(iterr(0,1;(@1>N)?{break(i)}{@1+ at 2},i=1++),N=2^64)\relax{}
+and the previous number was its index.
+\end{everbatim*}
+
+% 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
+
+One more recursion:
+\begin{everbatim*}
+\def\syr #1{\xinttheiiexpr rseq(#1; (@<=1)?{break(i)}{odd(@)?{3 at +1}{@//2}},i=0++)\relax}
+The 3x+1 problem: \syr{231}\par
+\end{everbatim*}
+
+OK, a final one:
+\begin{everbatim*}
+\def\syrMax #1{\xinttheiiexpr iterr(#1,#1;even(i)?
+ {(@2<=1)?{break(i/2)}{odd(@2)?{3 at 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 (but recall that |gcd| is already available as a multi-argument
+function if \xintgcdname is loaded):
+
+\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*}
+
+Look at the
+ \hyperlink{BrentSalamin}{Brent-Salamin algorithm implementation} for a more
+ interesting recursion.
+
+% \begin{everbatim*}
+% \newcommand\Factors [1]{\xinttheiiexpr
+% subs(seq((i/:3=1)?{omit}{[L][i]},i=0..len(L)-1),
+% L=rseq(#1;(p^2>[@][0])?{([@][0]>1)?{break(1,[@][0],1)}{abort}}
+% {(([@][0])/:p)?{omit}
+% {iter(([@][0])//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.%
+% %
+% \footnote{Look at the
+% \hyperlink{BrentSalamin}{Brent-Salamin algorithm implementation} for a much
+% saner example.}
+% %
+
+% \xintexprname has minimal tools and
+% is obstinate about doing everything expandably! We are hampered by absence of a
+% notion of ``nuple''. The algorithm divides |N| by |2| until no more possible,
+% then by |3|, then by |4| (which is silly), then by |5|, then by |6| (silly
+% again), \dots.
+
+% The variable |L=rseq(#1;...)| expands, if one follows the steps, to a comma
+% separated list starting with the initial (evaluated) |N=#1| and then
+% pseudo-triplets where the first item is |N| trimmed of small primes, the
+% second item is the last prime divisor found, and the third item is its
+% exponent in original |N|.
+
+% The algorithm needs to keep handy the last computed quotient by prime powers,
+% hence all of them, but at the very end it will be cleaner to get rid of them
+% (this corresponds to the first line in the code above). This is achieved in a
+% cumbersome inefficient way; indeed each item extraction |[L][i]| is costly: it
+% is not like accessing an array stored in memory, due to expandability, nothing
+% can be stored in memory! Nevertheless, this step could be done here in a far
+% less inefficient manner if there was a variant of |seq| which, in the spirit
+% of \csbxint{iloopindex}, would know how many steps it had been through so far.
+% This is a feature to be added to |\xintexpr|! (as well as a |++| construct
+% allowing a non unit step).
+
+% Notice that in |iter(([@][0])//p;| the |@| 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|.
+
+% \begin{snugframed}
+% Parentheses are essential in |..([y][0])| else the parser will see |..[| and
+% end up in ultimate confusion, and also in |([@][0])/: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}
+
+% See \autoref{ssec:factorize} for a routine |\Factorize| written directly with
+% \xintname macros. Last time I checked |\Factors| was about seven times slower
+% than |\Factorize| in test cases such as
+% |16246355912554185673266068721806243461403654781833| and others. Among the
+% various things explaining the speed difference, there is fact that the
+% |\Factorize| algorithm step by increments of two, not one, and also it divides
+% only once, obtaining quotient and remainder in one go. These two things
+% already make for a speed-up factor of about four. Thus, |\Factors| is not
+% completely inefficient in comparison, and was quite easier to come up with
+% than |\Factorize|.
+
\subsection{User defined variables}
\label{xintdefvar}
\label{xintdefiivar}
@@ -4575,12 +4799,11 @@
\end{everbatim*}
\subsection{User defined functions}
+
+\subsubsection{\csbh{xintdeffunc}}
\label{xintdeffunc}
\label{xintdefiifunc}
\label{xintdeffloatfunc}
-\label{xintverbosetrue}
-\label{xintverbosefalse}
-\label{ifxintverbose}
Since release |1.2c| it is possible to declare functions:
\begin{everbatim*}
@@ -4702,6 +4925,11 @@
\end{everbatim*}
+\subsubsection{\csbh{ifxintverbose} conditional}
+\label{xintverbosetrue}
+\label{xintverbosefalse}
+\label{ifxintverbose}
+
With |\xintverbosetrue| the meanings of the
functions (or rather their associated macros) will be written to the log. For
example the first |Rump| declaration above generates this in the log file:
@@ -4759,7 +4987,7 @@
\xinttheexpr add(f*(f+f), f= 1..10)\relax % f is used as variable, not as a function.
\end{everbatim*}
-\subsection{\csbh{xintNewFunction}}
+\subsubsection{\csbh{xintNewFunction}}
\label{xintNewFunction}
The syntax is analogous to the one of \csbxint{NewExpr} but achieves something
@@ -4800,7 +5028,6 @@
One can declare a function |foo| with |[0]| arguments but it must be used
as |foo(nil)|, as |foo()| with no argument would generate an error.
-
\subsection{List operations}
\label{ssec:lists}
@@ -4989,9 +5216,6 @@
bigger |\numexpr| which will be the one to have to be prefixed\dots .)
\item |\the\numexpr| or |\number\numexpr| expands in one step, but
|\xintthe\xintiiexpr| needs two steps.
-\item The \csbxint{the} prefix should not be applied to a sub
- |\xintiiexpr|ession, as this forces the parsers to gather again one by one
- the corresponding digits.
\item |\numexpr -(1)\relax| is illegal.
But |\xintiiexpr -(1)\relax| is perfectly legal and gives the expected
result (what else ?).
@@ -5233,29 +5457,39 @@
\section{The \xintname bundle}
+\localtableofcontents
-
-
\subsection{Characteristics}
\begin{framed}
The main characteristics are:
\begin{enumerate}
- \item exact algebra on arbitrarily big numbers, integers as well as
+ \item exact algebra on ``big numbers'', integers as well as
fractions,
\item floating point variants with user-chosen precision,
- \item implemented via macros compatible with expansion-only context,
- \item and with a parser of infix operations implementing features such as
- dummy variables, and coming in various incarnations depending on the kind
- of computation desired: purely on integers, on integers and fractions, or
- on floating point numbers.
+ \item the computational macros are compatible with expansion-only context,
+ \item the bundle comes with parsers (integer-only, or handling fractions, or
+ doing floating point computations) of infix operations implementing
+ beyond infix operations extra features such as dummy variables.
\end{enumerate}
- `Arbitrarily big' currently means with less than about \dtt{19950} digits: the
- maximal
- number of digits for addition is at \dtt{19968} digits,
- and it is \dtt{19959} for multiplication.
+
+ Since |1.2| ``big numbers'' must have less than about \dtt{19950} digits:
+ the maximal number of digits for addition is at \dtt{19968} digits, and it
+ is \dtt{19959} for multiplication. The reasonable range of use of the
+ package is with numbers of up to a few hundred digits.\footnotemark
+
+ \TeX\ does not know off-hand how to print on the page such very long
+ numbers, see \autoref{ssec:printnumber}.
\end{framed}
+\footnotetext{For example multiplication of integers having from \dtt{50} to
+ \dtt{100} digits takes roughly of the order of the millisecond on a 2012
+ desktop computer. This is, I guess, at least about 1000 times slower than
+ what can be expected with any reasonable programming language, nevertheless
+ as compilation of a typical \LaTeX\ document already takes of the order of
+ seconds if not dozens of seconds, this leaves room for reasonably many
+ computations via \xintexprname or via direct use of the macros of
+ \xintname/\xintfracname.}
Integers with only $10$ digits and starting with a $3$ already exceed the
\TeX{} bound; and \TeX{} does not have a native processing of floating point
@@ -5273,26 +5507,24 @@
The \href{http://www.ctan.org/pkg/bigintcalc}{bigintcalc} package by
\textsc{Heiko Oberdiek} provided expandable macros (using some of |\numexpr|
possibilities, when available) on arbitrarily big integers, beyond the \TeX{}
-bound.%
+bound. It does not provide an expression parser.%
%
-\footnote{The package \href{http://www.ctan.org/pkg/bigintcalc}{bigintcalc}
- does not provide a parser of expressions. One can use package
+\footnote{One can currently use package
\href{http://ctan.org/pkg/bnumexpr}{bnumexpr} to associate the |bigintcalc|
- macros with an expression parser.}
+ macros with an expression parser. This may be unavailable in future if
+ |bnumexpr| becomes more tightly associated with future evolutions or
+ variants of \xintcorename.}
%
-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.%
+\xintname did it again using more of |\numexpr| for higher speed, and in a
+later evolution added handling of exact fractions, of scientific numbers, and
+an expression parser. Arbitrary precision floating points operations were
+added as a derivative, and not part of the initial design goal. Currently
+(\expandafter|\xintbndlversion|), the only non-elementary operation
+implemented for floating point numbers is the square-root extraction; no
+signed infinities, signed zeroes, |NaN|'s, error traps\dots, have been
+implemented, only the notion of `scientific notation with a given number of
+significant figures'.%
%
-\footnote{currently (|1.08|), the only non-elementary operation
- implemented for floating point numbers is the square-root extraction;
- no signed infinities, signed zeroes, |NaN|'s, error traps\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
@@ -5300,61 +5532,45 @@
multiplication result with |2P| or |2P-1| digits.)}
The \LaTeX3 project has implemented expandably floating-point computations with
-16 significant figures
+\dtt{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 (2014/10/28) the
+functions such as exp, log, sine and cosine.\footnote{at the time of writing (2014/10/28) the
\href{http://www.ctan.org/pkg/l3kernel}{l3fp} (exactly represented) floating
point numbers have their exponents limited to $\pm$\dtt{9999}.}
%
-More directly related to the \xintname bundle, there is the promising new
-version of the \liiibigint{} package. It was still in development a.t.t.o.w
-(2015/10/09, no division yet) and is part of the experimental trunk of the
-\href{http://latex-project.org}{\LaTeX3 Project}. It is devoted to expandable
-computations on big integers with an associated expression parser. Its author
-(Bruno \textsc{Le Floch}) succeeded brilliantly into implementing expandably
-the Karatsuba multiplication algorithm and he achieves \emph{sub-quadratic
- growth for the computation time}. This shows up very clearly with numbers
-having more than one thousand digits (up to the maximum which a.t.t.o.w was at
-$8192$ digits).
+More directly related to the \xintname bundle there is the \liiibigint{}
+package, also devoted to big integers and in development a.t.t.o.w (2015/10/09,
+no division yet). It is part of the experimental trunk of the
+\href{http://latex-project.org}{\LaTeX3 Project} and provides an expression
+parser for expandable arithmetic with big integers. Its author Bruno
+\textsc{Le Floch} succeeded brilliantly into implementing expandably the
+Karatsuba multiplication algorithm and he achieves \emph{sub-quadratic growth
+ for the computation time}. This shows up very clearly with numbers having
+thousands of digits, up to the maximum which a.t.t.o.w is at $8192$ digits.
-I report here briefly on a quick comparison, although as \liiibigint{} is work
-in progress, the reported results could well have to be modified soon. The
-test was on a comparison of |\bigint_eval:n {#1*#2}| from the \liiibigint{} as
-available in September 2015, on one hand, and on the other hand
-|\xinttheiiexpr #1*#2\relax| from \xintexprname 1.2 (rather than directly
-|\xintiiMul|, to be fairer to the parsing time induced by use of
-|\bigint_eval:n|) and the computations were done with
-|#1=#2=9999888877999988877...repeated...|. I observed:
-\begin{itemize}
-\item \csbxint{iiexpr}'s multiplication appears slightly faster (about |1.5x|
- or |2x| to give an average order of magnitude) up to about
- $900$ digits,
-\item at $1000$ digits, \liiibigint{} runs between |15%| and |25%| faster,
-\item then its sub-quadratic growth shows up, and at $8000$ digits I observed
- it to be about |7.5x--9x| faster (I got quite varying results depending on
- which computer the trial was conducted). Its computation time increased from
- $1000$ digits to $8000$ digits by a factor smaller than |30|, whereas for
- \csbxint{iiexpr} it was a factor only slightly inferior to |200| (|225| on
- my laptop) ... Karatsuba multiplication brilliantly pays off !
-\item One observes the transition at the powers of two for the \liiibigint{}
- algorithm, for example I observed \liiibigint{} to be |3.5x--4x| faster at
- $4000$ digits but only |3x--3.5x| faster at $5000$ digits.
-\end{itemize}
-Once one accepts a small overhead, one can on the basis of the lengths decide
-for the best algorithm to use, and it is tempting viewing the above to imagine
-that some mixed approach could combine the best of both. But again all this is
-a bit premature as both packages may still evolve further.
+The \liiibigint{} multiplication from late |2015| is observed to be roughly
+|3x--4x| faster than the one from \csbxint{iiexpr} in the range of \dtt{4000}
+to \dtt{5000} digits integers, and isn't far from being |9x| faster at
+\dtt{8000} digits. On the other hand \csbxint{iiexpr}'s multiplication is
+found to be on average roughly |2.5x| faster than \liiibigint's for numbers up
+to \dtt{100} digits and the two packages achieve about the same speed at
+\dtt{900} digits: but each such multiplication of numbers of \dtt{900} digits
+costs about one or two tenths of a second on a 2012 desktop computer, whereas
+the order of magnitude is rather the |ms| for numbers with \dtt{50--100}
+digits.\footnote{I have tested this again on |2016/12/19|, but the macros have
+ not changed on the \liiibigint{} side and barely on the \xintcorename side,
+ hence I got again the same results\dots}
-Anyhow, all this being said, even the superior multiplication implementation
-from \liiibigint{} takes of the order of seconds on my laptop for a single
-multiplication of two $5000$-digits numbers. Hence it is not possible to do
-routinely such computations in a document. I have long been thinking that
-without the expandability constraint much higher speeds could be achieved, but
-perhaps I have not given enough thought to sustain that optimistic
-stance.\footnote{The \href{http://www.ctan.org/pkg/apnum}{apnum} package
- implements (non-expandably) arbitrary precision fixed point algebra and (v1.6)
+Even with the superior \liiibigint{} Karatsuba multiplication it takes about
+|3.5s| on this 2012 desktop computer for a single multiplication of two
+\dtt{5000}-digits numbers. Hence it is not possible to do routinely such
+computations in a document. I have long been thinking that without the
+expandability constraint much higher speeds could be achieved, but perhaps I
+have not given enough thought to sustain that optimistic stance.\footnote{The
+ \href{http://www.ctan.org/pkg/apnum}{apnum} package implements
+ (non-expandably) arbitrary precision fixed point algebra and (v1.6)
functions exp, log, sqrt, the trigonometrical direct and inverse functions.}
I remain of the opinion that if one really wants to do computations with
@@ -5366,15 +5582,10 @@
another seems a necessity for this kind of speed and one has to renounce at
the complete expandability.%
%
-\footnote{2015/09/15: as I said the latest developments on the \liiibigint{}
- side do not really modify this conclusion, because the computations remain
- extremely slow compared to what one can do in other programming structures.
- Another remark one could do is that it would be tremendously easier to
- enhance \eTeX{} than it is to embark into writing hundreds of lines of
- sometimes very clever \TeX{} macro programming.}
-%
-\footnote{The Lua\TeX{} project possibly makes endeavours such as
- \xintname appear even more insane that they are, in truth.}
+\footnote{The Lua\TeX{} project possibly makes endeavours such as \xintname
+ appear even more insane that they are, in truth: \xintname is able to handle
+ fast enough computations involving numbers with less than one hundred digits
+ and brings this to all engines.}
\subsection{Floating point evaluations}
\label{ssec:floatingpoint}
@@ -5381,7 +5592,7 @@
Floating point macros are provided by package \xintfracname to work with a
given arbitrary precision |P|. The default value is $P=16$ meaning that the
-significands of the produced (non-zero) numbers have $16$ decimal
+significands of the produced (non-zero) numbers have \dtt{16} decimal
digits.\footnote{Currently in the cases when the rounding to nearest goes to
the next power of ten, the result is |10.0....0eN| with |P-1| zeroes after
decimal mark, hence a total of |P+1|, not |P|, digits.} The syntax to set
@@ -5394,10 +5605,10 @@
Most floating point macros accept an optional first argument |[P]| which then
sets the target precision and replaces the |\xintDigits| assigned
-value.\footnote{the |[P]| must be repeated for the macro arguments, if
+value.\footnote{the |[P]| must be repeated inside the arguments, if
the latter are also \xintfracname macros with arguments of their own.}
-\csbxint{floatexpr}|...\relax| also admits an optional argument |[Q]| but it
+\csbxint{floatexpr}|[Q]...\relax| also admits an optional argument |[Q]| but it
has an altogether different meaning: the computations are always done with the
prevailing |\xinttheDigits| precision and the optional argument says to round
the final result to |Q| digits of precision. This makes sense only if
@@ -5404,17 +5615,6 @@
|Q<\xinttheDigits| and is intended to clean up the result from dubious last
digits.
-{\footnotesize
-The maximal allowed value for |P| in a |\xintDigits:=P;| assignment is
-\dtt{32767}. It was even possible earlier to use bigger |P|'s as optional
-argument to \csbxint{Float} for a one-short conversion\MyMarginNote{Changed
- with 1.2} to a gigantic float. However since release |1.2| this can't work
-in complete generality: a fractional input will trigger internally the
-division macro which can't handle arguments of more than about \dtt{19900}
-digits. For example (tested 2015/11/07 with |1.2b|) |\message{\xintFloat
- [19942]{1/7}}| works but not |\message{\xintFloat [19943]{1/7}}|. On the
-other hand |\xintFloat [50000]{1}| does work (slowly..), but there isn't much
-one can do afterwards with it...\par}
More reasonably, working with significands of $24$, $32$, $48$, $64$, or even
@@ -5424,12 +5624,6 @@
\begin{framed}
- % Floating point multiplication of two numbers with |P| digits of precision
- % evaluates \emph{exactly} the exact product with |2P| or |2P-1| digits,
- % before rounding to |P| digits: obviously this is very wasteful when |P| is
- % large. But \xintname is initially an exact algebraic operator, not a
- % floating point one with a fixed maximal size for operands, and the author
- % hasn't yet had the opportunity to re-examine that point.
The |IEEE 754|\footnotemark\ requirement of \emph{correct rounding} for
addition, subtraction, multiplication, division and square root is achieved
(in arbitrary precision) by the macros of \xintfracname hence also
@@ -5455,165 +5649,76 @@
standards are only indirectly relevant to libraries like \xintname dealing
with arbitrary precision.}
+Currently, the only non-elementary operation is the square root.%
+%
+\footnote{Since |1.2f| square root extraction achieves \emph{correct rounding}
+in arbitrary precision.}
+%
+The elementary transcendantal functions are not yet implemented. The power
+function accepts integer exponents (in all parsers, naturally \csbxint{iiexpr}
+requires non-negative exponents) and half-integer exponents in
+\csbxint{floatexpr}.\footnote{Half-integer exponents work inside expressions,
+ but not via the \csbxint{FloatPower} macro.}
-Currently, the only non-elementary operation is the square root. The
-elementary transcendantal functions are not yet implemented. The power
-function accepts integer and half-integer exponents.\footnote{Half-integer
- exponents work only inside \csbxint{floatexpr}|...\relax| expressions, not
- directly via the \csbxint{FloatPower} macro.}
-
-The maximal theoretically allowed exponent is currently set at
-\dtt{\number"7FFFFFFF} (the minimal exponent is its opposite) which is the
-maximal number handled by \TeX. But this means that overflow or underflow are
-detected only via low-level |\numexpr| arithmetic overflows which are
+The maximal floating point decimal exponent is currently
+\dtt{\number"7FFFFFFF} which is the maximal number handled by \TeX. The
+minimal exponent is its opposite. But this means that overflow or underflow
+are detected only via low-level |\numexpr| arithmetic overflows which are
basically un-recoverable. Besides there are some border effects as the
routines need to add or subtract lengths of numbers from exponents, possibly
triggering the low-level overflows. In the future not only the Precision but
-also the maximal and minimal exponents |Emin| and |Emax| will be specifiable
+also the maximal and minimal exponents |Emin| and |Emax| will be specifiable
by the user.
-\xintfracname is confronted with the problem that its float macros have to
-handle inputs which not only may have much more digits than the target float
-precision, but may even be fractions (which in a way means infinite
-precision). As fractions should be handled as first class citizens, the float
-macros should give the same result independently of whether an
-argument is given as |A/B| or as |C/D| as long as |A/B=C/D| as rational numbers.
-This was briefly the case when \xintfracname was first released, but very
-shortly thereafter the fraction-to-float parsing (via \csbxint{Float}) was
-modified for speed and as a result, currently this is not the case.%
+Another point is that \xintfracname float macros have to handle inputs which
+not only may have much more digits than the target float precision, but may
+even be fractions, which in a way means infinite precision. As fractions
+should be handled as first class citizens for \xintfracname, the float macros
+should give the same result independently of whether an argument is given as
+|A/B| or as |C/D| as long as |A/B=C/D| as rational numbers. This was briefly
+the case when \xintfracname was first released, but very shortly thereafter
+the fraction-to-float parsing (via \csbxint{Float}) was modified for speed and
+as a result, currently this is not the case.%
%
\IMPORTANT{}\footnote{The author
had forgotten that the initial situation had been quickly modified, and for
some time this documentation wrongly asserted that the \xintfracname basic
- floating point operations produced a value depending solely on the inputs as
- abstract fractions.}
+ floating point operations produced an output depending solely on the inputs as
+ abstract fractions. Future version of \xintfracname will make this valid again.}
+The current situation is that for a fraction $A/B\cdot 10^N$ its numerator and
+denominator are each first truncated (not rounded, but that would not change
+the issue) to |P+2| digits of precision if |P| is the asked-for precision.
+Then the new fraction is correctly rounded to |P| digits. This is not like
+correctly rounding the initial fraction, except of course if its numerator and
+denominator already had at most |P+2| digits.%
%
+\footnote{%
+If $B=1$ there is no issue because truncating to |P+2| digits then rounding to
+nearest |P|-float is like rounding directly to nearest |P|-float. But for
+$A=1$ for example the issue is there.}
-Next major release of \xintname packages will adopt a definitive model for
-floats, and it will have the property above of handling fractions
-intrinsically. Most probably this will go via first correctly rounding the
-inputs (inclusive of arbitrary fractions) to the target precision.
+Next major release the \xintname bundle will provide floating point macros
+handling intrinsically their inputs, if expressed as fractions.
-The current situation is that for a fraction $A/B\cdot 10^N$ its numerator and
-denominator are each first \emph{truncated} (not rounded, but that would not
-change the issue) to |P+2| digits of precision if |P| is the asked-for
-precision. Imagine that the original fraction was close to a boundary value
-between rounding up or rounding down to a |P|-float. Changing even a tiny bit
-the numerator and denominator moves the fraction, and as a result the rounding
-to a |P|-float may be altered.
+Also, probably, these macros will first correctly round the inputs to the
+target precision before doing the actual computation.
-If $B=1$ there is no issue because
-truncating to |P+2| digits then rounding to nearest |P|-float is like rounding
-directly to nearest |P|-float (that would not have applied if we had first
-rounded, not truncated, to a |P+2|-float). For $A=1$ on the contrary
-the issue is already there. Here is an illustration of the problem:
-\begin{everbatim*}
-Precision: \xinttheDigits\par
-\xintFloat {1/1858798855725191} ("reduced" fraction)\par
-\xintFloat {5379818246175219/10000000000000000980336298241829} ("big" fraction)\par
-We check that the fractions are identical:\par
-\xinttheexpr 1/1858798855725191 - 5379818246175219/10000000000000000980336298241829\relax\par
-And we also examine more digits of the decimal expansion:\par
-\xinttheexpr trunc(1/1858798855725191, 48)\relax\dots\par
-But truncating the denominator of the "big" fraction to 18 digits leads to:\par
-\xinttheexpr trunc(5379818246175219/10000000000000000900000000000000, 48)\relax\dots\par
-The two values rounded to 16 significant places differ.\par
-\end{everbatim*}
-
-Here is a summary of the situation regarding floats which was prevailing from
-release |1.08a| to release |1.2e|. Next, we will explain the new situation
-since |1.2f|.
-\begin{itemize}
-\item As explained above the |\xintFloat| macro which converts an input to a
- P-float does the following in case of fraction $A/B[N]$: it truncates both
- $A$ and $B$ to P+2 digits say $A'$ and $B'$ then computed the correct
- rounding of $A'/B'$ to P digits. (not changed in |1.2f| and |1.2g|)
-\item The |\xintFloatAdd|, |\xintFloatSub|, |\xintFloatMul|, |\xintFloatDiv|
- routines each first rounded their inputs to P+2 digits (thus
- applying the previous item, but with P replaced by P+2).
-\item The |\xintFloatPow| and |\xintFloatPower| routines rounded their inputs
- to Q > P+2 digits, with Q a temporary increased precision for intermediate
- computations, then they rounded the end result to the asked-for P digits (in
- the case of a negative exponent the final rounding was applied to something
- of the |1/C| shape, up to powers of ten naturally).
-\item The multiplication and division produced the correctly rounded value
- from the (P+2)-rounded inputs. Thus, not only did these
- routines produce the correctly rounded result for P-digits inputs, they
- actually achieved it for (P+2)-digits inputs (again, for fractional inputs,
- the initial rounding viciates any hope of having the final result be the
- correctly rounded exact one).
-\item For addition and subtraction having now to deal with $A.10^M\pm B.10^N$,
- with $A$ and $B$ having (P+2) digits, the rule was that if $M-N\geqslant
- P+4$, then $B$ was dropped altogether, if $N-M\geqslant P+4$ then $A$ was
- dropped, else the operation was done exactly then rounded to P digits. But
- in those cases where one of the summands was dropped, correct rounding was not
- guaranteed, because say $A$ having P+2 digits could be at a
- mid-point between two P-floats, thus neglecting $B$ (however small it may
- be) could viciate the final rounding. Also, when adding $B=0$ to $A$, as $A$
- is already the P+2 rounded original input, the final P-digit value could
- end up not being the correct rounding of the original input (rounding to
- nearest is not transitive; this is independent of the issues of handling
- fractions as mentioned above).
-\end{itemize}
-For |1.2f| I have decided that the two digits added on input to the
-asked-for precision by the
-four basic operations do not make much sense after all.\IMPORTANT{} Especially
-as since |1.2| the basic core operations are handled by blocks of eight
-digits, this procedure was adding a systematic overhead for inputs already of
-the default 16-digits precision, forcing computations as if for 24 digits.
-Besides, when used in \cs{xintfloatexpr}, most of the time the inputs will
-already be results of earlier computations hence have P digits. It appears
-wasteful to extend them by two zeros prior to each operation.
-Thus, |1.2f| adopts the policy that the inputs will always be rounded first to
-P-floats, not (P+2)-floats.\CHANGED{1.2f} This does not change the behaviour
-for inputs being already P-floats. All four operations then and now produce
-the correctly rounded value. For coherence also the square root and the power
-macros now first round their argument to a P-float.%
-%
-\footnote{The power macros do not aim at correct rounding, currently. But the
- change fixes the issue that there was a possible difference between the
- evaluation of |x*x| and |x^2| or |1/x| vs |x^-1| in the \csbxint{floatexpr}
- parser due to the fact that in the latter cases |x| was initially rounded
- to P+3 digits but in the former cases only to P+2 digits.}
-%
-Also,\NewWith {1.2f} |1.2f| has implemented \emph{correct rounding} (in
-arbitrary precision) for the square root extraction.
-What is yet lacking from |1.2f| (now |1.2g|) is the improved handling via
-\csbxint{Float} of fractions to achieve independence from the chosen
-representatives (which currently only applies if numerators and denominators
-are of lengths at most the target precision plus two -- the exponent is
-arbitrary).
-Next major release will decide if this initial rounding of the inputs is kept;
-the more ambitious model would be for the basic operations to compute the
-correct rounding of the value corresponding to the original inputs, whatever
-their original lengths\footnote{The |MPFR| library
- \url{http://www.mpfr.org/} implements this ...}, or nature\footnote{... but it
- does not know fractions!}. This is definitely feasible as \xintfracname
-knows how to compute exactly, but the question is how efficiently though. I
-don't think that this will be the choice made.
-
-
-
-
-
-
-
\subsection{Expansion matters}
\subsubsection{Full expansion of the first token}
@@ -5776,122 +5881,42 @@
\end{enumerate}
-\subsection{User interface}
-\label{ssec:userinterface}
+\subsection {Input formats for macros}\label{sec:inputs}
-
-The next sections will explain the various inputs which are recognized by the
-package macros and the format for their outputs. Inputs have mainly five
-possible shapes:
+Macros can have different types of arguments. In the description of the macro,
+a margin annotation signals what is the argument type.
\begin{enumerate}
-\item expressions which will end up inside a |\numexpr..\relax|,
+\item \TeX\ integers\ntype{\numx} are handled inside a |\numexpr..\relax|
+ hencee may be count registers or variables.
+ Beware that |-(1+1)| is not legal (but |0-(1+1)| is). Such integers must be
+ less than \dtt{\number "7FFFFFFF} in absolute value.
-\item long integers in the strict format (no |+|, no leading zeroes, a count
- register or variable must be prefixed by |\the| or |\number|)
+\item the strict format\ntype{f} applies to macros handling big integers but
+ only \fexpan ding their arguments. After this \fexpan sion the input should
+ be a string of digits, optionally preceded by a unique minus sign. The first
+ digit can be zero only if it is the only digit. A plus sign is not accepted.
+ |-0| is not legal in the strict format. Macros of \xintname with a double
+ |ii| require this `strict' format for the inputs.
-\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 the extended integer format\ntype{\Numf} applies when the macro parses
+ its arguments via \csbxint{Num}. The input may then have arbitrarily many
+ leading minus and plus signs, followed by leading zeroes, and further
+ digits. Macros with a single |i| in their names always filter their
+ arguments via \csbxint{Num}. When \xintfracname is loaded \csbxint{Num}
+ accepts fractions and truncates them to integers.
-\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.
-\end{enumerate}
-
-\subsection{No declaration of variables for macros}
-
- There is no notion of a \emph{declaration of a variable}.
-
- To do a computation and assign its result to some macro |\z|, the user will employ the |\def|, |\edef|, or |\newcommand| (in \LaTeX)
- as usual, keeping in mind that two expansion steps are needed, thus |\edef|
- is initially the main tool:
-%
-\begin{everbatim*}
-\def\x{1729728} \def\y{352827927} \edef\z{\xintiiMul {\x}{\y}}
-\meaning\z
-\end{everbatim*}
-
-As an alternative to |\edef| the package provides |\oodef| which expands
-exactly twice the replacement text, and |\fdef| which applies \fexpan sion to
-the replacement text during the definition.
-\begin{everbatim*}
-\def\x{1729728} \def\y{352827927} \oodef\w {\xintiiMul\x\y} \fdef\z{\xintiiMul {\x}{\y}}
-\meaning\w, \meaning\z
-\end{everbatim*}
-
-In practice |\oodef| is slower than |\edef|, except for computations ending in
-very big final replacement texts (thousands of digits). On the other hand
-|\fdef|\IMPORTANT{} appears to be slightly faster than |\edef| already in the
-case of expansions leading to only a few dozen digits.
-
-\xintexprname does provide an interface to declare and assign values to
-identifiers which can then be used in expressions: \autoref{xintdefvar}.
-
-\subsection {Input formats}\label{sec:inputs}
-
-Some macro arguments are by nature `short' integers,\ntype{\numx} \emph{i.e.}
-less than (or equal to) in absolute value \np{\number "7FFFFFFF}. This is
-generally the case for arguments which serve to count or index something. They
-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;
-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
- \fexpan d their arguments. After this \fexpan sion the input should be a
- string of digits, optionally preceded by a unique minus sign. The first
- digit can be zero only if the number is zero. A plus sign is not accepted.
- |-0| is not legal in the strict format. A count register can serve as
- argument of such a macro only if prefixed by |\the| or |\number|. Macros of
- \xintname such as \csbxint{iiAdd} with a double |ii| require this `strict'
- format for the inputs. The macros such as \csbxint{iAdd} with a single |i|
- will apply the \csbxint{Num} normalizer described in the next item.
-
-\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:%
- %
- \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{} |\value{countername}| is accepted as macro
- argument.}
-
-\item the fraction format\ntype{\Ff} is what is expected on input by the
- macros of \xintfracname. It has two variants:
+\item the fraction input format\ntype{\Ff} applies to the arguments of
+ \xintfracname macros handling genuine fractions. It allows two types
+ of inputs: general and restricted. The restricted type is parsed faster,
+ but... is restricted.
\begin{description}
- \item[general:] these are inputs of the shape |A.BeC/D.EeF|. Example:
+ \item[general:] inputs of the shape |A.BeC/D.EeF|. Example:
\begin{everbatim*}
\noindent\xintRaw{+--0367.8920280e17/-++278.289287e-15}\newline
\xintRaw{+--+1253.2782e++--3/---0087.123e---5}\par
\end{everbatim*}
- Notice that the input process does not reduce fractions to smallest terms.
- Here are the rules of the format:\footnote{Earlier releases were slightly
- more strict, the optional decimal parts |B|, |E| were not individually
- \fexpan ded.}
+ The input parser does not reduce fractions to smallest terms.
+ Here are the rules of this general fraction format:
\begin{itemize}
\item everything is optional, absent numbers are treated as zero, here are
some extreme cases:
@@ -5912,33 +5937,19 @@
and |e| should all come from this initial expansion. The |e| of
scientific notation is mandatorily lowercased.
\end{itemize}
- \item[restricted:] these are inputs either of the shape |A[N]| or |A/B[N]|
- (representing the fraction |A/B| times |10^N|) where the whole thing or
+ \item[restricted:] inputs either of the shape |A[N]| or |A/B[N]|, which
+ represents the fraction |A/B| times |10^N|. The whole thing or
each of |A|, |B|, |N| (but then not |/| or |[|) may arise from \fexpan
sion, |A| (after expansion) \emph{must} have a unique optional minus sign
and no leading zeroes, |B| (after expansion) if present \emph{must} be a
positive integer with no signs and no leading zeroes, |[N]| if present
- will be given to |\numexpr|. This format is parsed with smaller
- overhead than the general one, thus allowing more efficient nesting of
- macros as it is the one used on output (except for the floating macros).
- Any deviation from the rules above will result in errors.\footnote{With
- releases earlier than |1.2| the |N| had to be necessarily
- given as explicit digits, not some macro or expression expanded in
- |\numexpr|. From |1.2| to |1.2e| an empty |N| was allowed, but |1.2f|
- removed that.}
+ will be given to |\numexpr|. Any deviation from the rules above will
+ result in errors.
\end{description}
Notice that |*|, |+| and |-| contrarily to the |/| (which is treated simply
as a kind of delimiter) are not acceptable within arguments of this
- type\ntype{\Ff}
- (see however \autoref{sec:useofcount} for some exceptions).
-
-\item the \hyperref[xintexpr]{expression format} is for inclusion in an
- \csbxint{expr}|...\relax|, it uses infix notations, function names, complete
- expansion, recognizes decimal and scientific numbers, and is described in
- \autoref{sec:xintexprsyntax} and \autoref{ssec:syntax}.%
-%
- \footnote{Starting with release |1.2|, the isolated dot |"."| is not legal
- anymore in expressions: there must be digits either before or after.}
+ type\ntype{\Ff} (see \autoref{sec:useofcount}
+ for some exceptions to this.)
\end{enumerate}
Generally speaking, there should be no spaces among the digits in the inputs
@@ -5969,21 +5980,8 @@
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}.
+escaping the |\xintexpr| parser). See the \autoref{sec:expr}.
-Arithmetic macros of \xintname which parse their arguments automatically through
-\csbxint{Num} are signaled by a special
-symbol%\ntype{\Numf{\unskip\kern\dimexpr\FrameSep+\FrameRule\relax}}
-\ntype{\Numf} in the margin. This symbol also means that these arguments may
-contain to some extent infix algebra with count registers, see the section
-\hyperref[sec:useofcount]{Use of count registers}.
-
- With \xintfracname loaded the symbol \smash{\Numf} means that a fraction is
- accepted if it is a whole number in disguise; and for macros accepting the
- full fraction format with no restriction there is the corresponding symbol
- in the margin\ntype{\Ff}.
-%
-
There are also some slighly more obscure expansion types: in particular, the
\csbxint{ApplyInline} and \csbxint{For*} macros from \xinttoolsname apply a
special iterated \fexpan sion, which gobbles spaces, to the non-braced items
@@ -6000,117 +5998,50 @@
argument\ntype{n{{\color{black}\upshape, resp.}} o}. This is also
signaled in the margin with notations \`a la \LaTeX3.
-As the computations are done by \fexpan dable macros which \fexpan d their
-argument they may be chained up to arbitrary depths and still produce expandable
-macros.
-Conversely, wherever the package expects on input a ``big'' integers, or a
-``fraction'', \fexpan sion of the argument \emph{must result in a complete
- expansion} for this argument to be acceptable.%
+\subsection{Output formats of macros}
+\label{ssec:outputformat}
+
+We do not consider here the \csbxint{expr}-parsers but only the macros as
+described in the documentation of \xintname and \xintfracname. Macros of other
+components of the bundle have their own output formats (for example for
+continuous fractions with \xintcfracname).
+There are mainly three types of output formats:%
%
-\footnote{this is not quite as
- stringent as claimed here, see \autoref{sec:useofcount} for more details.}
-The
-main exception is inside \csbxint{expr}|...\relax| where everything will be
-expanded from left to right, completely.
+\footnote{There are further cases like \csbxint{iiDivision} which outputs a
+ token list of two braced items.}
-
-\subsection{Output formats}
-
-Package \xintcorename provides macros \csbxint{iiAdd}, \csbxint{iiSub},
-\csbxint{iiMul}, \csbxint{iiPow}, which only \fexpan d their arguments and
-\csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, \csbxint{iPow} which
-normalize them first to strict format, thus have a bit of overhead. These
-macros always produce integers on output.
-
-With \xintfracname loaded \csbxint{iiAdd}, \csbxint{iiSub}, \csbxint{iiMul},
-... are not modified, and \csbxint{iAdd}, \csbxint{iSub}, \csbxint{iMul}, ...
-are only extended to the extent of accepting fraction inputs but they will be
-truncated to integers.%
+\begin{itemize}[nosep,listparindent=\leftmarginiii]
+\item macros from \xintname with |i| or |ii| in their names produce on output
+integers in the strict format described in the previous section.
+\item fraction handling macros from \xintfracname produce on output the strict
+fraction format |A/B[N]| (which stands for |(A/B)|$\times$|10^N|) where |A|
+and |B| are integers, with |B| positive, and |N| is a ``short'' integer. The
+output is not reduced to smallest terms. The |A| and |B| may end with zeroes
+(\emph{i.e}, |N| does not represent all powers of ten). The denominator |B| is
+always strictly positive. There is no |+| sign. The |-| is always first if
+present (i.e. the denominator on output is always positive.) The output will
+be expressed as such a fraction even if the inputs are both integers and the
+mathematical result is an integer. The |B=1| is not removed.%
%
-\footnote{the power function does not accept a fractional exponent. Or rather,
- does not expect, and errors will result if one is provided.}
-%
-The output will be an integer.
-
-\begin{framed}
- The fraction handling macros from \xintfracname are called \csbxint{Add},
- \csbxint{Sub}, \csbxint{Mul}, etc... they are \emph{not} defined in the
- absence of \xintfracname.
-
- They produce on output a fractional number |f=A/B[n]| (which stands for
- |(A/B)|$\times$|10^n|) where |A| and |B| are integers, with |B| positive,
- and |n| is a ``short'' integer (\emph{i.e} less in absolute value than
- \dtt{\number"7FFFFFFF}.)
-
- The output fraction is not reduced to smallest terms. The |A| and |B| may
- end in zeroes (\emph{i.e}, |n| does not represent all powers of ten). The
- denominator |B| is always strictly positive. There is no |+| sign on output
- but only possibly a |-| at the numerator. The output will be expressed as
- a fraction even if the inputs are both integers.
-\end{framed}
-
-\begin{itemize}
-\item A macro \csbxint{Frac} is provided for the typesetting (math-mode
- only) of such a `raw' output. The macro \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 integers, with no fraction slash nor
- trailing |[n]|.
-
+\footnote{refer to the documentation of \csbxint{PRaw} for an alternative.}
+\item macros with |Float| in their names produce on output scientific
+format with |P=|\nobreak\csbxint{theDigits} digits, a lowercase |e| and an
+exponent |N|. The first digit is not zero, it is preceded by an optional minus
+sign and is followed by a dot and |P-1| digits. Trailing zeroes are not
+trimmed. There are two exceptional cases:
+\begin{itemize}[nosep]
+\item if the rounding went to the next power of ten, the output
+is |10.0...0eN| (with |P+1| digits; and possibly a minus sign).
+\item if the value is mathematically zero, it is output as |0.e0|,
+ i.e. zeros after the decimal mark are removed and the exponent is always |0|.
\end{itemize}
+Future versions of the package may modify these rules.
+\end{itemize}
-Some macros return a token list of two or more numbers or fractions; they are
-then each enclosed in braces. Examples are \csbxint{iiDivision} 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.
+\subsection{Count registers and variables}\label{sec:useofcount}
-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.
-
-
-
-\subsection{Use of count registers}\label{sec:useofcount}
-
Inside |\xintexpr..\relax| and its variants, a count register or count control
sequence is automatically unpacked using |\number|, with tacit multiplication:
|1.23\counta| is like |1.23*\number\counta|. There
@@ -6159,9 +6090,10 @@
%
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|.
+\begin{enumerate}[nosep]
+\item let the numerator and the denominator be presented as |\the\numexpr...\relax|,
+\item or as |\numexpr {...}\relax| (the braces are removed during processing;
+ they are not legal for |\numexpr...\relax| syntax.)
\end{enumerate}
\everb|@
\cnta 100 \cntb 10 \cntc 1
@@ -6175,13 +6107,8 @@
{\cnta*\cnta+\cntb*\cntb+\cntc*\cntc+
2*\cnta*\cntb+2*\cnta*\cntc+2*\cntb*\cntc}\relax/%
\numexpr {\cnta*\cnta+\cntb*\cntb+\cntc*\cntc}\relax }}}
-%
-The braces would not be accepted
- as regular
-|\numexpr|-syntax: and indeed, they
- are removed at some point in the processing.
-\subsection{Dimensions}
+\subsection{Dimension registers and variables}
\label{sec:Dimensions}
\meta{dimen} variables can be converted into (short) integers suitable for the
@@ -6206,12 +6133,12 @@
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
-\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).
+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
+\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| (\TeX{}
+truncates to get an integral multiple of the |sp| unit; see at the end of this
+section the exact rules applied internally by \TeX).
\begin{figure*}[ht!]
\phantomsection\label{tableofdimensions}
@@ -6245,12 +6172,12 @@
pc&12 pt&12*65536&&&1pc&&\\
pt&1/72.27 in&65536&&&1pt&&\\
bp&1/72 in&72.27*65536/72&&&1bp&&\\
- \omit\hfil\llap{3}bp\hfil&1/24 in&72.27*65536/24&&&3bp&&\\
- \omit\hfil\llap{12}bp\hfil&1/6 in&72.27*65536/6&&&12bp&&\\
- \omit\hfil\llap{72}bp\hfil&1 in&72.27*65536&&&72bp&&\\
+ \omit\hfil\llap{3}bp\strut\hfil&1/24 in&72.27*65536/24&&&3bp&&\\
+ \omit\hfil\llap{12}bp\strut\hfil&1/6 in&72.27*65536/6&&&12bp&&\\
+ \omit\hfil\llap{72}bp\strut\hfil&1 in&72.27*65536&&&72bp&&\\
dd&1238/1157 pt&1238/1157*65536&&&1dd&&\\
- \omit\hfil\llap{11}dd\hfil&11*1238/1157 pt&11*1238/1157*65536&&&11dd&&\\
- \omit\hfil\llap{12}dd\hfil&12*1238/1157 pt&12*1238/1157*65536&&&12dd&&\\
+ \omit\hfil\llap{11}dd\strut\hfil&11*1238/1157 pt&11*1238/1157*65536&&&11dd&&\\
+ \omit\hfil\llap{12}dd\strut\hfil&12*1238/1157 pt&12*1238/1157*65536&&&12dd&&\\
sp&1/65536 pt&1&&&1sp&&\\\hline
\multicolumn{8}{c}{\bfseries\large\TeX{} \strut dimensions}\\\hline
\end{tabular}}
@@ -6295,12 +6222,12 @@
\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 $1238/1157$ as a conversion
+factor (and necessarily intermediate computations simulate higher precision
+than a priori available with integers less than $2^{31}$ or rather $2^{30}$ for
+dimensions). Hence the $1452/1357$ ratio is irrelevant, an artefact
+of the rounding (or rather, as we see, truncating) for one |dd| to be
+expressed as an integral number of |sp|'s.
Let us now
use |\xintexpr| to compute the value of the Didot point in millimeters, if
@@ -6342,14 +6269,17 @@
{\xintFtoCCv{543564351/508000000}}\do {\dtt{\printnumber{#1}}\xintifForLast{.}{, }} We do
recover the $1238/1157$ therein!
-Note: here is how \TeX\ converts |abc.xyz...<unit>|. First the decimal is
-\emph{rounded} to the nearest integral multiple of |1/65536|, say |X/65536|.
-The |<unit>| is associated to a ratio |N/D|, which represents |<unit>/pt|. For
-the Didot point the ratio is indeed |1238/1157|. \TeX\ \emph{truncates} the
-fraction |XN/D| to an integer |M|. The dimension is represented by |M sp|. For
-additional details see
-\url{http://tex.stackexchange.com/questions/338297/why-pdf-file-cannot-be-reproduced/338510#338510}.
+\begin{framed}
+ Here is how \TeX\ converts |abc.xyz...<unit>|. First the decimal is
+ \emph{rounded} to the nearest integral multiple of |1/65536|, say |X/65536|.
+ The |<unit>| is associated to a ratio |N/D|, which represents |<unit>/pt|.
+ For the Didot point the ratio is indeed |1238/1157|. \TeX\ \emph{truncates}
+ the fraction |XN/D| to an integer |M|. The dimension is represented by |M
+ sp|.
+ For more details refer to:\newline
+ \url{http://tex.stackexchange.com/questions/338297/why-pdf-file-cannot-be-reproduced/338510#338510}.
+\end{framed}
\subsection{\csh{ifcase}, \csh{ifnum}, ... constructs}\label{sec:ifcase}
@@ -6393,6 +6323,36 @@
\footnote{\url{http://www.ctan.org/pkg/etoolbox}}
package.
+\subsection{No variable declarations are needed}
+
+ There is no notion of a \emph{declaration of a variable}.
+
+ To do a computation and assign its result to some macro |\z|, the user will employ the |\def|, |\edef|, or |\newcommand| (in \LaTeX)
+ as usual, keeping in mind that two expansion steps are needed, thus |\edef|
+ is initially the main tool:
+%
+\begin{everbatim*}
+\def\x{1729728} \def\y{352827927} \edef\z{\xintiiMul {\x}{\y}}
+\meaning\z
+\end{everbatim*}
+
+As an alternative to |\edef| the package provides |\oodef| which expands
+exactly twice the replacement text, and |\fdef| which applies \fexpan sion to
+the replacement text during the definition.
+\begin{everbatim*}
+\def\x{1729728} \def\y{352827927} \oodef\w {\xintiiMul\x\y} \fdef\z{\xintiiMul {\x}{\y}}
+\meaning\w, \meaning\z
+\end{everbatim*}
+
+In practice |\oodef| is slower than |\edef|, except for computations ending in
+very big final replacement texts (thousands of digits). On the other hand
+|\fdef|\IMPORTANT{} appears to be slightly faster than |\edef| already in the
+case of expansions leading to only a few dozen digits.
+
+\xintexprname does provide an interface to declare and assign values to
+identifiers which can then be used in expressions: \autoref{xintdefvar}.
+
+
\subsection{When expandability is too much}
Let's use the macros of \autoref{ssec:fibonacci} related to Fibonacci numbers.
@@ -9539,7 +9499,7 @@
For the rules regarding direct use of count registers or \csa{numexpr}
expression, in the arguments to the package macros, see the
-\hyperref[sec:useofcount]{Use of count} section.
+\autoref{sec:useofcount} section.
\begin{framed}
The macros \csbxint{iAdd}, \csbxint{iMul}, \dots, respectively
@@ -10393,8 +10353,8 @@
|\xintDSH|\x\n\etype{\numx f} is parametrized decimal shift. When |x| is
negative, it is like iterating \csa{xintDSL} \verb+|x|+ times (\emph{i.e.}
multiplication by $10^{-x}$). When |x| positive, it is like iterating
-\csa{DSR} |x| times (and is more efficient), and for a non-negative |N| this is
-thus the same as the quotient from the euclidean division by |10^x|.
+\csa{xintDSR} |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}
@@ -10469,9 +10429,9 @@
\begin{framed}
This package loads automatically \xintname and \xintcorename, hence all
macros described in \autoref{sec:xint} and \autoref{sec:core} are
- available; but some among them will only accept integers on input, not
- fractions or numbers in scientific notation. This is the case
- particularly for all those having |ii| in their names.
+ available. Note that macros of those packages whose names contain |ii| are
+ for integers only, not fractions. Those with a single |i| accept fractions
+ but truncate them to integers.
\end{framed}
\localtableofcontents
@@ -10486,8 +10446,7 @@
for the accepted input formats) or something which expands to an integer or
fraction. It is possible to use in the numerator or the denominator of |f| count
registers and even expressions with infix arithmetic operators, under some rules
-which are explained in the previous \hyperref[sec:useofcount]{Use of count
- registers} section.
+which are explained in the \autoref{sec:useofcount} section.
As in the \hyperref[sec:xint]{xint.sty} documentation, |x|\ntype{\numx}
stands for something which will internally be embedded in a \csa{numexpr}.
@@ -11788,16 +11747,6 @@
result. See \csbxint{floatexpr} for a similar parser which rounds each
operation inside the expression to \csbxint{theDigits} digits of precision.
-It is possible to wrap the whole expression (or only some portions) inside the
-|\xintexpr...\relax| in one of the functions |round|, |trunc|, or |float|: 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.
-
-The |reduce| will reduce the fraction to smallest terms, or more precisely it
-reduces to smallest terms the |A/B| part from its argument evaluating to
-|A/B[N]|.
-
As an alternative and equivalent syntax to
\begin{everbatim}
\xintexpr round(<expression>, D)\relax
@@ -11807,7 +11756,7 @@
\begin{everbatim}
\xintiexpr [D] <expression> \relax
\end{everbatim}
-The parameter |D| must be zero or positive.\footnote{Notice that |D=0|
+The parameter |D| must be zero or positive.\footnote{|D=0|
corresponds to using |round(<expression>)| not |round(<expression>,0)| which
would leave a trailing dot. Same for |trunc|. There is also function |float|
for floating point rounding to \csbxint{theDigits} or the given number of
@@ -11819,49 +11768,31 @@
\begin{itemize}
\item the expression may contain arbitrarily many levels of nested parenthesized
- sub-expressions.
-\item to let sub-contents evaluate as a sub-unit it should be either
+ sub-expressions,
+\item the expression may contain explicitely or from a macro expansion a
+ sub-expression |\xintexpr...\relax|, which itself may contain a
+ sub-expressions etc\dots
+\item to let sub-contents evaluate as a sub-unit it should thus be either
\begin{enumerate}
\item parenthesized,
\item or a sub-expression |\xintexpr...\relax|.
\end{enumerate}
- \item to either give an expression as argument to the other package macros,
+ \item to use 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,
+ |\xinttheexpr...\relax| or |\xintthe\xintexpr...\relax| forms.
+ \item 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\IMPORTANT{} only the
+ |\xintexpr...\relax| but only the
|\xintexpr...\relax| form which is more efficient in this context.
\item each \xintexprname{}ession, whether prefixed or not with |\xintthe|, is
completely expandable and obtains its result in two expansion steps.
\end{itemize}
-\subsection{Expression syntax overview}
-\label{ssec:syntax}
+See \autoref{sec:xintexprsyntax} for the primary information on built-in
+operators and functions. This section now adds some complementary information.
+
-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. Well I got used to it after three years of practice but as I am
-generous, release |1.2h| now provides |\thexintexpr| etc... \CHANGED{1.2h}
-
-|\xintexpr|-essions and |\xinttheexpr|-essions are completely expandable, in two steps.
-
\begin{itemize}[parsep=0pt, labelwidth=\leftmarginii,
itemindent=0pt, listparindent=\leftmarginiii, leftmargin=\leftmarginii]
\item An expression is built the standard way with opening and closing
@@ -11871,7 +11802,7 @@
output each comma will be followed by a space. A decimal number must have
digits either before or after the decimal mark.
-\item as everything gets expanded, the characters |.|, |+|, |-|, |*|, |/|, |^|,
+\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 |!|,
@@ -11882,39 +11813,6 @@
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 (currently, only integer and half-integer
- exponents are allowed for float 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. In \csbxint{floatexpr} it is
- mapped to \csbxint{FloatFac}, else it computes the exact factorial.
-
-\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. The input
- |(cond)?{?}{!}(x)| will confuse the parser as it will think to have found
- the |??| branching operator. But |(cond)?{?(x)}{!(x)}| or even
- |(cond)?{?(}{!(}x)| are ok.
-
-\item There is also |??| which branches according to the scheme
- |(x)??{<0}{=0}{>0}|. The wrong branches are not evaluated.
-
-\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 bracket. See
- \autoref{ssec:lists}. There is no real concept of a list object, nor list
- operations, although itemwise manipulation are possible. There is no notion
- of an ``nuple'' object. The variable |nil| is reserved, it represents an
- empty list.
-
\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
@@ -11924,9 +11822,7 @@
units ($1/65536$th of a \TeX{} point). Furthermore, tacit multiplication is
implied, when the (count or dimen or glue) register or variable, or the
(|\numexpr| or |\dimexpr| or |\glueexpr|) expression is immediately prefixed
- by a (decimal) number.
-
-\item See \autoref{ssec:tacit multiplication} for the complete rules
+ by a (decimal) number. See \autoref{ssec:tacit multiplication} for the complete rules
of tacit multiplication.\IMPORTANT
\item With a macro |\x| defined like this:
@@ -11948,7 +11844,7 @@
\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
+ \hyperlink{builtinfunc-bool}{|bool|} and \hyperlink{builtinfunc-togl}{|togl|} functions
in \autoref{sec:expr}. Here is an example:
\catcode`| 12 %
\begin{everbatim*}
@@ -11978,9 +11874,8 @@
second argument:
%
\begin{everbatim*}
-\xinttheexpr sqrt(2,60)\relax
-
-Here the [60] is to avoid truncation to |\xinttheDigits| of precision on output.
+\xinttheexpr sqrt(2,60)\relax\newline
+Here the [60] is to avoid truncation to |\xinttheDigits| of precision on output.\newline
\printnumber{\xintthefloatexpr [60] sqrt(2,60)\relax}
\end{everbatim*}
@@ -11991,207 +11886,17 @@
\xintDigits:=48;\xintthefloatexpr 2^100000\relax
\end{everbatim*}
-Only integer and half-integer exponents are allowed.
+ Only integer and (in |\xintfloatexpr...\relax|) half-integer exponents are
+ allowed.
-\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.
-
-\item |2^-10| is perfectly accepted input, no need for parentheses; and
- 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|.
-
- An exception to left associativity is applied in case of tacit
- multiplication |x/2y| is interpreted as |x/(2y)| and
- |(1+2)/(3+4)(5+6)| is computed as |(1+2)/((3+4)*(5+6))|. See
- \autoref{ssec:tacit multiplication}.
-
\item if one uses \emph{macros} within |\xintexpr..\relax| one should
obviously take into account that the parser will \emph{not} see the macro
- arguments. This applies also to macros defined via \csbxint{NewExpr}.
- Functions declared with \csbxint{deffunc} on the other hand behave exactly
- like the native functions of the package.
-
+ arguments, hence once cannot use the syntax there, except if the arguments
+ are themselves wrapped as |\xinttheexpr...\relax| and assuming the macro
+ \fexpan ds these arguments.
\end{itemize}
-\subsection{More examples with dummy variables}
-\label{ssec:moredummies}
-These examples were first added to this manual at the time of the |1.1|
-release (|2014/10/29|).
-
-\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.
-
-\begin{everbatim*}
-The first Fibonacci number beyond |2^64| bound is
-\xinttheiiexpr subs(iterr(0,1;(@1>N)?{break(i)}{@1+ at 2},i=1++),N=2^64)\relax{}
-and the previous number was its index.
-\end{everbatim*}
-
-% 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
-
-One more recursion:
-\begin{everbatim*}
-\def\syr #1{\xinttheiiexpr rseq(#1; (@<=1)?{break(i)}{odd(@)?{3 at +1}{@//2}},i=0++)\relax}
-The 3x+1 problem: \syr{231}\par
-\end{everbatim*}
-
-OK, a final one:
-\begin{everbatim*}
-\def\syrMax #1{\xinttheiiexpr iterr(#1,#1;even(i)?
- {(@2<=1)?{break(i/2)}{odd(@2)?{3 at 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=1)?{omit}{[L][i]},i=0..len(L)-1),
- L=rseq(#1;(p^2>[@][0])?{([@][0]>1)?{break(1,[@][0],1)}{abort}}
- {(([@][0])/:p)?{omit}
- {iter(([@][0])//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.%
-%
-\footnote{Look at the
- \hyperlink{BrentSalamin}{Brent-Salamin algorithm implementation} for a much
- saner example.}
-%
-
-\xintexprname has minimal tools and
-is obstinate about doing everything expandably! We are hampered by absence of a
-notion of ``nuple''. The algorithm divides |N| by |2| until no more possible,
-then by |3|, then by |4| (which is silly), then by |5|, then by |6| (silly
-again), \dots.
-
-The variable |L=rseq(#1;...)| expands, if one follows the steps, to a comma
-separated list starting with the initial (evaluated) |N=#1| and then
-pseudo-triplets where the first item is |N| trimmed of small primes, the
-second item is the last prime divisor found, and the third item is its
-exponent in original |N|.
-
-The algorithm needs to keep handy the last computed quotient by prime powers,
-hence all of them, but at the very end it will be cleaner to get rid of them
-(this corresponds to the first line in the code above). This is achieved in a
-cumbersome inefficient way; indeed each item extraction |[L][i]| is costly: it
-is not like accessing an array stored in memory, due to expandability, nothing
-can be stored in memory! Nevertheless, this step could be done here in a far
-less inefficient manner if there was a variant of |seq| which, in the spirit
-of \csbxint{iloopindex}, would know how many steps it had been through so far.
-This is a feature to be added to |\xintexpr|! (as well as a |++| construct
-allowing a non unit step).
-
-Notice that in |iter(([@][0])//p;| the |@| 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|.
-
-\begin{snugframed}
- Parentheses are essential in |..([y][0])| else the parser will see |..[| and
- end up in ultimate confusion, and also in |([@][0])/: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}
-
-See \autoref{ssec:factorize} for a routine |\Factorize| written directly with
-\xintname macros. Last time I checked |\Factors| was about seven times slower
-than |\Factorize| in test cases such as
-|16246355912554185673266068721806243461403654781833| and others. Among the
-various things explaining the speed difference, there is fact that the
-|\Factorize| algorithm step by increments of two, not one, and also it divides
-only once, obtaining quotient and remainder in one go. These two things
-already make for a speed-up factor of about four. Thus, |\Factors| is not
-completely inefficient in comparison, and was quite easier to come up with
-than |\Factorize|.
-
-\subsection{The \csbh{xintthecoords} macro}
-\label{xintthecoords}
-
-It converts a comma separated list into the format for list of coordinates as
-expected by the |TikZ| |coordinates| syntax. The code had to work around the
-problem that |TikZ| seemingly allows only a maximal number of about one
-hundred expansion steps for the list to be entirely produced. Presumably to
-catch an infinite loop, but one hundred is ridiculously low a number of
-expansion steps for any serious work in \TeX{} for dealing with tokens.
-
-\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 [red] 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*}
-\edef\x{\xintthecoords \xintexpr rrseq(1/2,1/3; @1+ at 2, x=1..20)\relax }
-\meaning\x +++
-\end{everbatim*}
-
-
\subsection{\texorpdfstring{\texttt{\protect\string\numexpr}}{\textbackslash
numexpr} or \texorpdfstring{\texttt{\protect\string\dimexpr}}{\textbackslash
dimexpr} expressions, count and dimension registers and variables}
@@ -12944,6 +12649,46 @@
\end{everbatim*}
+\subsection{The \csbh{xintthecoords} macro}
+\label{xintthecoords}
+
+It converts a comma separated list into the format for list of coordinates as
+expected by the |TikZ| |coordinates| syntax. The code had to work around the
+problem that |TikZ| seemingly allows only a maximal number of about one
+hundred expansion steps for the list to be entirely produced. Presumably to
+catch an infinite loop.
+\begin{everbatim*}
+\begin{figure}[htbp]
+\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 [red] plot[smooth] coordinates {%
+ \xintthecoords % (converts what is next 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}
+\caption{Coordinates with \cs{xintthecoords}.}
+\end{figure}
+\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*}
+\edef\x{\xintthecoords \xintexpr rrseq(1/2,1/3; @1+ at 2, x=1..20)\relax }
+\meaning\x +++
+\end{everbatim*}
+
+
\subsection{\csbh{xintifboolexpr}}\label{xintifboolexpr}
\csh{xintifboolexpr}|{<expr>}{YES}{NO}|\etype{xnn} does |\xinttheexpr
@@ -15090,7 +14835,7 @@
% stack size at \dtt{5000} and the maximal expansion depth at \dtt{10000}.)
% This is not really an issue from the point of view of calling macros (such
% as |\xintTrunc|, |\xintRound|), because they usually had since |1.2| their
-% own limitation at about \dtt{19970} digits from other code parts (such as
+% own limitation at about \dtt{19950} digits from other code parts (such as
% division.) The macro |\xintXTrunc| (which is not f-expandable however) can
% produce tens of thousands of digits and it escapes these limitations. Old
% macros such as |\xintLength| are not limited either (incidentally it got a
@@ -15302,7 +15047,7 @@
\fi
\XINT_providespackage
\ProvidesPackage {xintkernel}%
- [2016/12/13 1.2i Paraphernalia for the xint packages (JFB)]%
+ [2016/12/22 1.2j Paraphernalia for the xint packages (JFB)]%
% \end{macrocode}
% \subsection{Constants}
% |1.2| decides to move them to \xintkernelnameimp from \xintcorenameimp and
@@ -15483,7 +15228,7 @@
% some \expandafter if argument is a macro. Attention: removes braces.
%
% A faster reverse, but only usable with digits, is provided by
-% \csh{xintReverseDigits} macro from 1.2 xintcore.sty.
+% \xintReverseDigits macro from 1.2 xintcore.sty.
%
% 1.2g has (not user documented) \xintCSVReverse in xinttools.sty.|
% \begin{macrocode}
@@ -15513,28 +15258,28 @@
% 1.2g has (not user documented) \xintCSVLength in xinttools.sty.
%
% 1.2i has rewritten this venerable macro. New code is about 40$% faster
-% across all lengths.|
+% across all lengths. Was again slightly changed for 1.2j (cosmetic).|
% \begin{macrocode}
\def\xintLength {\romannumeral0\xintlength }%
\long\edef\xintlength #1%
{%
\noexpand\expandafter\space
- \noexpand\the\numexpr\xint_c_ix\noexpand\XINT_length_loop
+ \noexpand\the\numexpr\noexpand\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\noexpand\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\noexpand\xint_bye
\relax
}%
\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
- +\xint_c_ix\XINT_length_loop
+ \xint_c_ix+\XINT_length_loop
}%
-\def\XINT_length_finish_a\xint_relax+\xint_c_ix\XINT_length_loop
+\def\XINT_length_finish_a\xint_relax\xint_c_ix+\XINT_length_loop
#1#2#3#4#5#6#7#8#9%
{%
- -#9\xint_bye
+ #9\xint_bye
}%
% \end{macrocode}
% \subsection{\csh{xintLastItem}}
@@ -15569,8 +15314,12 @@
% \subsection{\csh{xintLengthUpTo}}
% \lverb|1.2i for use by \xintKeep and \xintTrim.
%
-% \xintLengthUpTo{N}{L} produces -0 if length(L)>N, else it returns
-% N-length(L). Hence subtracting it from N always computes min(N,length(L)).|
+% \xintLengthUpTo{N}{List} produces -0 if length(List)>N, else it returns
+% N-length(List). Hence subtracting it from N always computes min(N,length(List)).
+%
+% Does not expand its second argument (it is used by \xintKeep and \xintTrim
+% with already expanded argument). Not a user macro. 1.2j rewrote the ending
+% and changed the loop interface. The argument N **must be non-negative**.|
% \begin{macrocode}
\def\xintLengthUpTo {\romannumeral0\xintlengthupto}%
\long\def\xintlengthupto #1#2%
@@ -15577,50 +15326,52 @@
{%
\expandafter\XINT_lengthupto_loop
\the\numexpr#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
}%
-\def\XINT_lengthupto_loop #1%
+\def\XINT_lengthupto_loop_a #1%
{%
- \xint_UDsignfork #1\XINT_lengthupto_gt-{\XINT_lengthupto_loop_a#1}\krof
+ \xint_UDsignfork
+ #1\XINT_lengthupto_gt
+ -\XINT_lengthupto_loop
+ \krof #1%
}%
-\long\def\XINT_lengthupto_gt #1\xint_bye{-0}%
-\long\def\XINT_lengthupto_loop_a #1.#2#3#4#5#6#7#8#9%
+\long\def\XINT_lengthupto_gt #1\xint_bye.{-0}%
+\long\def\XINT_lengthupto_loop #1.#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_lengthupto_finish_a\xint_relax
- \expandafter\XINT_lengthupto_loop\the\numexpr #1-\xint_c_viii.%
+ \expandafter\XINT_lengthupto_loop_a\the\numexpr #1-\xint_c_viii.%
}%
-\def\XINT_lengthupto_finish_a\xint_relax\expandafter\XINT_lengthupto_loop
- \the\numexpr #1-\xint_c_viii.#2\xint_bye
+\def\XINT_lengthupto_finish_a\xint_relax\expandafter\XINT_lengthupto_loop_a
+ \the\numexpr #1-\xint_c_viii.#2#3#4#5#6#7#8#9%
{%
- \XINT_lengthupto_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
+ \expandafter\XINT_lengthupto_finish_b\the\numexpr #1-#9\xint_bye
}%
-\def\XINT_lengthupto_finish_b #1#2#3#4#5#6#7#8\Z
+\def\XINT_lengthupto_finish_b #1#2.%
{%
- \xint_gob_til_W
- #1\XINT_lengthupto_finish_c \xint_c_
- #2\XINT_lengthupto_finish_c \xint_c_i
- #3\XINT_lengthupto_finish_c \xint_c_ii
- #4\XINT_lengthupto_finish_c \xint_c_iii
- #5\XINT_lengthupto_finish_c \xint_c_iv
- #6\XINT_lengthupto_finish_c \xint_c_v
- #7\XINT_lengthupto_finish_c \xint_c_vi
- \W\XINT_lengthupto_finish_c \xint_c_vii\Z
+ \xint_UDsignfork
+ #1{-0}%
+ -{ #1#2}%
+ \krof
}%
-\def\XINT_lengthupto_finish_c #1#2\Z #3%
- {\ifnum #1>#3 \xint_dothis{-0}\fi
- \xint_orthat{\expandafter\space\the\numexpr#3-#1\relax}}%
% \end{macrocode}
% \subsection{\csh{xintreplicate}}
-% \lverb|Added with 1.2i. This is cloned from \prg_replicate:nn from expl3, see Joseph's post
+% \lverb+Added with 1.2i. This is cloned from \prg_replicate:nn from expl3, see Joseph's post
% at
% $centeredline{$catcode125=2 http://tex.stackexchange.com/questions/16189/repeat-command-n-times}
% I
% posted there an alternative not using the chained \csname's but it is a bit
-% less efficient (except perhaps for thousands of repetitions). Notice that
-% the code in Joseph's post is inefficient when input #1 is negative. The
-% variant here filters it out upfront, at the time when #1=0 is also handled.
+% less efficient (except perhaps for thousands of repetitions).
+% The code in Joseph's post does |#1| replications when input #1 is negative
+% and then activates an error triggering macro; here we simply do nothing when
+% #1 is negative.
%
-% Expansion must be triggered by a \romannumeral.|
+% When #1 is already explicit digits (even #1=0, but non-negative) one can
+% call the macro directly
+% as \romannumeral\XINT_rep #1\endcsname {foo} to skip the \numexpr.
+%
+% Expansion must be triggered by a \romannumeral.+
% \begin{macrocode}
\def\xintreplicate#1%
{\expandafter\XINT_replicate\the\numexpr#1\endcsname}%
@@ -15876,7 +15627,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xinttools}%
- [2016/12/13 1.2i Expandable and non-expandable utilities (JFB)]%
+ [2016/12/22 1.2j 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.|
@@ -16149,23 +15900,18 @@
\long\def\XINT_lws_end\xint_bye\XINT_lws_loop_b #1#2#3{ #1}%
% \end{macrocode}
% \subsection{\csh{xintNthElt}}
-% \lverb?First included in release 1.06.
+% \lverb?First included in release 1.06. Last refactored in 1.2j.
%
-% \xintNthElt {i}{stuff f-expanding to {a}{b}...{z}} (or `tokens'
-% abcd...z)returns the i th element (one pair of braces removed). The list is
-% first f-expanded. The \xintNthEltNoExpand does no expansion of its second
-% argument. Both variants expand the first argument inside \numexpr.
+% \xintNthElt {i}{List} returns the i th item from List (one pair of braces
+% removed). The list is first f-expanded. The \xintNthEltNoExpand does no
+% expansion of its second argument. Both variants expand i inside \numexpr.
%
-% 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 f-expand its argument.
+% With i = 0, the number of items is returned using \xintLength but with the
+% List argument f-expanded first.
%
% Negative values return the |i|th element from the end.
%
% When i is out of range, an empty value is returned.
-%
-%
-%
% ?
% \begin{macrocode}
\def\xintNthElt {\romannumeral0\xintnthelt }%
@@ -16181,21 +15927,21 @@
0-{\XINT_nthelt_pos #1}%
\krof
}%
-\def\XINT_nthelt_zero .{\xintlength }%
+\def\XINT_nthelt_zero #1.{\xintlength }%
\long\def\XINT_nthelt_neg #1.#2%
{%
- \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_x\XINT_length_loop
+ \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_i+\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
-#1.#2\xint_bye
}%
\def\XINT_nthelt_neg_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_byeandstop
- 0#1\xint_byeandstop
+ #1-\xint_bye_thenstop
+ 0#1\xint_bye_thenstop
0-{}%
\krof
\expandafter\XINT_nthelt_neg_b
@@ -16204,30 +15950,16 @@
\long\def\XINT_nthelt_neg_b #1#2\xint_bye{ #1}%
\long\def\XINT_nthelt_pos #1.#2%
{%
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_ix-#1.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \expandafter\XINT_nthelt_pos_done
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_x.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\def\XINT_nthelt_loop #1%
-{%
- \xint_UDsignfork
- #1\XINT_nthelt_loop_a
- -{\XINT_nthelt_getit #1}%
- \krof
-}%
-\long\def\XINT_nthelt_loop_a #1.#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_xint_relax #9\xint_byeandstop\xint_relax
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_viii-#1.%
-}%
-\def\XINT_nthelt_getit #1.%
-{%
- \expandafter\expandafter\expandafter\XINT_nthelt_finish
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
-}%
-\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}%
+\def\XINT_nthelt_pos_done #1{%
+\long\def\XINT_nthelt_pos_done ##1##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\expandafter#1\xint_gobble_ii\xint_relax#1##1}%
+}\XINT_nthelt_pos_done{ }%
% \end{macrocode}
% \subsection{\csh{xintKeep}}
% \lverb@&
@@ -16272,11 +16004,11 @@
\long\def\XINT_keep_neg #1.#2%
{%
\expandafter\XINT_keep_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye.#2%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.#2%
}%
\def\XINT_keep_neg_a #1%
{%
@@ -16291,7 +16023,9 @@
\expandafter\XINT_keep_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keep_loop #1#2.%
@@ -16305,21 +16039,21 @@
\def\XINT_keep_loop_end-\expandafter\XINT_keep_loop
\the\numexpr-#1-\xint_c_viii\expandafter.\XINT_keep_loop_pickeight
{\csname XINT_keep_end#1\endcsname}%
-\long\expandafter\def\csname XINT_keep_end1\endcsname
+\long\expandafter\def\csname XINT_keep_end1\endcsname
#1#2#3#4#5#6#7#8#9\xint_bye { #1{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
-\long\expandafter\def\csname XINT_keep_end2\endcsname
+\long\expandafter\def\csname XINT_keep_end2\endcsname
#1#2#3#4#5#6#7#8\xint_bye { #1{#2}{#3}{#4}{#5}{#6}{#7}}%
-\long\expandafter\def\csname XINT_keep_end3\endcsname
+\long\expandafter\def\csname XINT_keep_end3\endcsname
#1#2#3#4#5#6#7\xint_bye { #1{#2}{#3}{#4}{#5}{#6}}%
-\long\expandafter\def\csname XINT_keep_end4\endcsname
+\long\expandafter\def\csname XINT_keep_end4\endcsname
#1#2#3#4#5#6\xint_bye { #1{#2}{#3}{#4}{#5}}%
-\long\expandafter\def\csname XINT_keep_end5\endcsname
+\long\expandafter\def\csname XINT_keep_end5\endcsname
#1#2#3#4#5\xint_bye { #1{#2}{#3}{#4}}%
-\long\expandafter\def\csname XINT_keep_end6\endcsname
+\long\expandafter\def\csname XINT_keep_end6\endcsname
#1#2#3#4\xint_bye { #1{#2}{#3}}%
-\long\expandafter\def\csname XINT_keep_end7\endcsname
+\long\expandafter\def\csname XINT_keep_end7\endcsname
#1#2#3\xint_bye { #1{#2}}%
-\long\expandafter\def\csname XINT_keep_end8\endcsname
+\long\expandafter\def\csname XINT_keep_end8\endcsname
#1#2\xint_bye { #1}%
% \end{macrocode}
% \subsection{\csh{xintKeepUnbraced}}
@@ -16352,7 +16086,9 @@
\expandafter\XINT_keepunbr_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keepunbr_loop #1#2.%
@@ -16366,21 +16102,21 @@
\def\XINT_keepunbr_loop_end-\expandafter\XINT_keepunbr_loop
\the\numexpr-#1-\xint_c_viii\expandafter.\XINT_keepunbr_loop_pickeight
{\csname XINT_keepunbr_end#1\endcsname}%
-\long\expandafter\def\csname XINT_keepunbr_end1\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end1\endcsname
#1#2#3#4#5#6#7#8#9\xint_bye { #1#2#3#4#5#6#7#8}%
-\long\expandafter\def\csname XINT_keepunbr_end2\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end2\endcsname
#1#2#3#4#5#6#7#8\xint_bye { #1#2#3#4#5#6#7}%
-\long\expandafter\def\csname XINT_keepunbr_end3\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end3\endcsname
#1#2#3#4#5#6#7\xint_bye { #1#2#3#4#5#6}%
-\long\expandafter\def\csname XINT_keepunbr_end4\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end4\endcsname
#1#2#3#4#5#6\xint_bye { #1#2#3#4#5}%
-\long\expandafter\def\csname XINT_keepunbr_end5\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end5\endcsname
#1#2#3#4#5\xint_bye { #1#2#3#4}%
-\long\expandafter\def\csname XINT_keepunbr_end6\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end6\endcsname
#1#2#3#4\xint_bye { #1#2#3}%
-\long\expandafter\def\csname XINT_keepunbr_end7\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end7\endcsname
#1#2#3\xint_bye { #1#2}%
-\long\expandafter\def\csname XINT_keepunbr_end8\endcsname
+\long\expandafter\def\csname XINT_keepunbr_end8\endcsname
#1#2\xint_bye { #1}%
% \end{macrocode}
% \subsection{\csh{xintTrim}}
@@ -16397,8 +16133,9 @@
%
% \xintTrimNoExpand does not expand the L argument.
%
-% Speed improvements for 1.2i mainly for i<0 branch (which hands over to
-% \xintKeep).
+% Speed improvements with 1.2i for i<0 branch (which hands over to
+% \xintKeep). Speed improvements with 1.2j for i>0 branch which gobbles items
+% nine by nine despite not knowing in advance if it will go too far.
% ?
% \begin{macrocode}
\def\xintTrim {\romannumeral0\xinttrim }%
@@ -16418,11 +16155,11 @@
\long\def\XINT_trim_neg #1.#2%
{%
\expandafter\XINT_trim_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trim_neg_a #1%
@@ -16434,33 +16171,36 @@
}%
\edef\XINT_trim_trimall {\noexpand\expandafter\space\noexpand\xint_bye}%
% \end{macrocode}
-% \lverb|This branch doesn't pre-evaluate the length of the list argument.|
+% \lverb|This branch doesn't pre-evaluate the length of the list argument.
+% Redone again for 1.2j, manages to trim nine by nine. Some non optimal
+% looking aspect of the code is for allowing sharing with \xintNthElt.|
% \begin{macrocode}
\long\def\XINT_trim_pos #1.#2%
{%
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \expandafter\XINT_trim_pos_done\expandafter\space
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\def\XINT_trim_loop #1%
+\def\XINT_trim_loop #1#2.%
{%
- \xint_UDsignfork
- #1\XINT_trim_finish
- -\XINT_trim_loop_a
- \krof #1%
+ \xint_gob_til_minus#1\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr#1#2\XINT_trim_loop_trimnine
}%
-\long\def\XINT_trim_loop_a #1.#2#3#4#5#6#7#8#9%
+\long\def\XINT_trim_loop_trimnine #1#2#3#4#5#6#7#8#9%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_trim_toofew\xint_relax-\xint_c_ix.%
}%
-\def\XINT_trim_finish -#1.%
+\def\XINT_trim_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim_finish#1{%
+\def\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr-##1\XINT_trim_loop_trimnine
{%
- \expandafter\expandafter\expandafter\XINT_trim_finish_a
- \expandafter\expandafter\expandafter\space
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
-}%
-\long\def\XINT_trim_finish_a #1\xint_relax #2\xint_bye {#1}%
+ \expandafter\expandafter\expandafter#1%
+ \csname xint_gobble_\romannumeral\numexpr\xint_c_ix-##1\endcsname
+}}\XINT_trim_finish{ }%
+\long\def\XINT_trim_pos_done #1\xint_relax #2\xint_bye {#1}%
% \end{macrocode}
% \subsection{\csh{xintTrimUnbraced}}
% \lverb?1.2a. Modified in 1.2i like \xintTrim?
@@ -16483,11 +16223,11 @@
\long\def\XINT_trimunbr_neg #1.#2%
{%
\expandafter\XINT_trimunbr_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trimunbr_neg_a #1%
@@ -17232,237 +16972,412 @@
}%
\let\xintDigitsOf\xintAssignArray
% \end{macrocode}
-%\subsection{CSV (non user documented) variants of Trim, Keep, NthElt, Reverse, Length}
+%\subsection{CSV (non user documented) variants of Length, Keep, Trim, NthElt, Reverse}
%
-% These routines are for use by |\xintListSel:f:csv| from \xintexprnameimp. We
-% don't take any precaution here regarding brace stripping or spaces. And the
-% macros are short. They will remain undocumented in the user manual for the
-% time being for the reasons above and to preserve the possibility to modify
-% the interface in case some evolution on the \xintexprnameimp side requires
-% it.
+% These routines are for use by |\xintListSel:x:csv| and |\xintListSel:f:csv|
+% from \xintexprnameimp, and also for the |reversed| and |len| functions.
+% Refactored for |1.2j| release, following |1.2i| updates to |\xintKeep|,
+% |\xintTrim|, ...
+%
+% These macros will remain undocumented in the user manual:
%
-% Nevertheless, directly usable names are also provided.
+% -- they exist primarily for internal use by the \xintexprnameimp parsers,
+% hence don't have to be general purpose; for example, they a priori need to
+% handle only catcode 12 tokens (not true in |\xintNewExpr|, though)
+% hence they are not really worried about
+% controlling brace stripping (nevertheless |1.2j| has paid some secondary
+% attention to it, see below.) They are not worried about normalizing leading
+% spaces either, because none will be encountered when the macros are used as
+% auxiliaries to the expression parsers.
%
-% All these macros are in the |O(N^2)| style when they need to accumulate
-% things. They handle comma separated values. There is no final comma, neither
-% on input nor on output. Special care has been taken to handle safely the
-% case of an empty list.
+% -- crucial design elements may change in future:
%
-%\subsubsection{\csh{xintTrim:f:csv}}
-% \lverb|1.2g 2016/03/17.
+% 1. whether the handled lists must have or not have a final comma. Currently,
+% the model is the one of comma separated lists with **no** final comma. But
+% this means that there can not be a distinction of principle between a truly
+% empty list and a list which contains one item which turns out to be empty.
+% More importantly it makes the coding more complicated as it is needed to
+% distinguish the empty list from the single-item list, both lacking commas.
%
-%|
+% For the internal use of \xintexprnameimp, it would be ok to require all list
+% items to be terminated by a comma, and this would bring quite some
+% simplications here, but as initially I started with non-terminated lists, I
+% have left it this way in the |1.2j| refactoring.
+%
+% 2. the way to represent the empty list. I was tempted for matter of
+% optimization and synchronization with \xintexprnameimp context to require
+% the empty list to be always represented by a space token and to not let the
+% macros admit a completely empty input. But there were complications so for
+% the time being |1.2j| does accept truly empty output (it is not
+% distinguished from an input equal to a space token) and produces empty
+% output for empty list. This means that the status of the «nil» object for
+% the \xintexprnameimp parsers is not completely clarified (currently it is
+% represented by a space token).
+%
+% The original Python slicing code in \xintexprnameimp |1.1| used
+% |\xintCSVtoList| and |\xintListWithSep{,}| to convert back and forth to
+% token lists and apply |\xintKeep/\xintTrim|. Release |1.2g| switched to
+% devoted \fexpan dable macros added to \xinttoolsnameimp. Release |1.2j|
+% refactored all these macros as a follow-up to |1.2i| improvements to
+% |\xintKeep/\xintTrim|. They were made |\long| on this occasion and
+% auxiliary |\xintLengthUpTo:f:csv| was added.
+%
+% Leading spaces in items are currently maintained as is by the |1.2j|
+% macros, even by |\xintNthEltPy:f:csv|, with the exception of the first item,
+% as the list is \fexpan ded. Perhaps |\xintNthEltPy:f:csv| should remove a
+% leading space if present in the picked item; anyway, there are no spaces
+% for the lists handled internally by the Python slicer of \xintexprnameimp,
+% except the «nil» object currently represented by exactly one space.
+%
+% Kept items (with no leading spaces; but first item special as it will have
+% lost a leading space due to \fexpan sion) will lose a brace pair under
+% |\xintKeep:f:csv| if the first argument was positive and strictly less than
+% the length of the list. This differs of course from |\xintKeep| (which
+% always braces items it outputs when used with positive first argument) and
+% also from |\xintKeepUnbraced| in the case when the whole list is kept.
+% Actually the case of singleton list is special, and brace removal will
+% happen then.
+%
+% This behaviour was otherwise for releases earlier than |1.2j| and may
+% change again.
+%
+% Directly usable names are provided, but these macros (and the behaviour as
+% described above) are to be considered \emph{unstable} for the time being.
+%
+% \subsubsection{\csh{xintLength:f:csv}}
+% \lverb|1.2g. Redone for 1.2j. Contrarily to \xintLength from xintkernel.sty,
+% this one expands its argument.|
% \begin{macrocode}
-\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
-\def\xinttrim:f:csv #1#2%
+\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv}%
+\def\xintlength:f:csv #1%
+{\long\def\xintlength:f:csv ##1{%
+ \expandafter#1\the\numexpr\expandafter\XINT_length:f:csv_a
+ \romannumeral`&&@##1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ \relax
+}}\xintlength:f:csv { }%
+% \end{macrocode}
+% \lverb|Must first check if empty list.|
+% \begin{macrocode}
+\long\def\XINT_length:f:csv_a #1%
+{%
+ \xint_gob_til_xint_relax #1\xint_c_\xint_bye\xint_relax
+ \XINT_length:f:csv_loop #1%
+}%
+\long\def\XINT_length:f:csv_loop #1,#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \expandafter\XINT_trim:f:csv_a\the\numexpr #1\expandafter.%
- \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish\xint_relax
+ \xint_c_ix+\XINT_length:f:csv_loop
}%
-\def\XINT_trim:f:csv_a #1%
+\def\XINT_length:f:csv_finish\xint_relax\xint_c_ix+\XINT_length:f:csv_loop
+ #1,#2,#3,#4,#5,#6,#7,#8,#9,{#9\xint_bye}%
+% \end{macrocode}
+% \subsubsection{\csh{xintLengthUpTo:f:csv}}
+% \lverb|1.2j. \xintLengthUpTo:f:csv{N}{comma-list}. No ending comma. Returns
+% -0 if length>N, else returns difference N-length. **N must be non-negative!!**
+%
+% Attention to the dot after \xint_bye for the loop interface.|
+% \begin{macrocode}
+\def\xintLengthUpTo:f:csv {\romannumeral0\xintlengthupto:f:csv}%
+\long\def\xintlengthupto:f:csv #1#2%
{%
- \xint_UDzerominusfork
- #1-{\XINT_trim:f:csv_zero }%
- 0#1{\XINT_trim:f:csv_neg }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
- \krof
+ \expandafter\XINT_lengthupto:f:csv_a
+ \the\numexpr#1\expandafter.%
+ \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
}%
-\def\XINT_trim:f:csv_zero .#1\xint_relax #2\xint_bye{ #1}%
-\def\XINT_trim:f:csv_neg #1.#2\xint_relax%
+% \end{macrocode}
+% \lverb|Must first recognize if empty list. If this is the case, return N.|
+% \begin{macrocode}
+\long\def\XINT_lengthupto:f:csv_a #1.#2%
{%
- \expandafter\XINT_trim:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \xint_gob_til_xint_relax #2\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2%
}%
-\def\XINT_trim:f:csv_neg_b #1%
+\def\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2\xint_bye.{ #1}%
+\def\XINT_lengthupto:f:csv_loop_a #1%
{%
- \xint_UDzerominusfork
- #1-{\expandafter\space\xint_bye }%
- 0#1{\expandafter\space\xint_bye }%
- 0-{\XINT_keep:f:csv_pos #1}%
- \krof
+ \xint_UDsignfork
+ #1\XINT_lengthupto:f:csv_gt
+ -\XINT_lengthupto:f:csv_loop_b
+ \krof #1%
}%
-\def\XINT_trim:f:csv_loop_a #1.%
+\long\def\XINT_lengthupto:f:csv_gt #1\xint_bye.{-0}%
+\long\def\XINT_lengthupto:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \ifnum #1>\xint_c_vii
- \expandafter\XINT_trim:f:csv_loop_b
- \else
- \expandafter\XINT_trim:f:csv_finish
- \fi
- #1.%
+ \xint_gob_til_xint_relax #9\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
}%
-\def\XINT_trim:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\def\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a
+ \the\numexpr #1-\xint_c_viii.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \expandafter\XINT_lengthupto:f:csv_finish_b\the\numexpr #1-#9\xint_bye
}%
-\def\XINT_trim:f:csv_finish #1.%
+\def\XINT_lengthupto:f:csv_finish_b #1#2.%
{%
- \expandafter\XINT_trim:f:csv_finish_a
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral#1\endcsname
+ \xint_UDsignfork
+ #1{-0}%
+ -{ #1#2}%
+ \krof
}%
-\def\xint_gobble:csv_ {}%
-\def\xint_gobble:csv_i #1,{}%
-\def\xint_gobble:csv_ii #1,#2,{}%
-\def\xint_gobble:csv_iii #1,#2,#3,{}%
-\def\xint_gobble:csv_iv #1,#2,#3,#4,{}%
-\def\xint_gobble:csv_v #1,#2,#3,#4,#5,{}%
-\def\xint_gobble:csv_vi #1,#2,#3,#4,#5,#6,{}%
-\def\xint_gobble:csv_vii #1,#2,#3,#4,#5,#6,#7,{}%
-\def\XINT_trim:f:csv_finish_a #1\xint_relax #2\xint_bye { #1}%
% \end{macrocode}
%\subsubsection{\csh{xintKeep:f:csv}}
-% \lverb|1.2g 2016/03/17.
+% \lverb|1.2g 2016/03/17. Redone for 1.2j with use of \xintLengthUpTo:f:csv.
+% Same code skeleton as \xintKeep but handling comma separated but non
+% terminated lists has complications. The \xintKeep in case of a negative #1
+% uses \xintgobble, we don't have that for comma delimited items, hence we do
+% a special loop here (this style of loop is surely competitive with
+% xintgobble for a few dozens items and even more). The loop knows before
+% starting that it will not go too far.
+%
%|
% \begin{macrocode}
\def\xintKeep:f:csv {\romannumeral0\xintkeep:f:csv }%
-\def\xintkeep:f:csv #1#2%
+\long\def\xintkeep:f:csv #1#2%
{%
- \expandafter\XINT_keep:f:csv_a\the\numexpr #1\expandafter.%
- \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_keep:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
\def\XINT_keep:f:csv_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_bye_thenstop
+ #1-\XINT_keep:f:csv_keepnone
0#1\XINT_keep:f:csv_neg
0-{\XINT_keep:f:csv_pos #1}%
\krof
}%
-\def\XINT_keep:f:csv_neg #1.#2\xint_relax%
+\long\def\XINT_keep:f:csv_keepnone .#1{,}%
+\long\def\XINT_keep:f:csv_neg #1.#2%
{%
- \expandafter\XINT_keep:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \expandafter\XINT_keep:f:csv_neg_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .#2\xint_bye
}%
-\def\XINT_keep:f:csv_neg_b #1%
+\def\XINT_keep:f:csv_neg_a #1%
{%
- \xint_UDzerominusfork
- #1-{\XINT_keep:f:csv_all }%
- 0#1{\XINT_keep:f:csv_all }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+}%
+ -\XINT_keep:f:csv_keepall
\krof
}%
-\def\XINT_keep:f:csv_all #1.#2\xint_relax #3\xint_bye { #2}%
-\def\XINT_keep:f:csv_pos #1.{\expandafter\xint_gobble_thenstop
- \romannumeral`&&@\XINT_keep:f:csv_loop_a #1.{}}%
-\def\XINT_keep:f:csv_loop_a #1.%
+\def\XINT_keep:f:csv_keepall #1.{ }%
+\long\def\XINT_keep:f:csv_neg_done #1\xint_bye{#1}%
+\def\XINT_keep:f:csv_trimloop #1#2.%
{%
- \ifnum #1>\xint_c_vi
- \expandafter\XINT_keep:f:csv_loop_b
- \else
- \expandafter\XINT_keep:f:csv_finish
- \fi
- #1.%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr#1#2-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
}%
-\def\XINT_keep:f:csv_loop_b #1.#2#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_keep:f:csv_trimloop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,{}%
+\def\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr-#1-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
+ {\csname XINT_trim:f:csv_finish#1\endcsname}%
+\long\def\XINT_keep:f:csv_pos #1.#2%
{%
- \xint_gob_til_xint_relax #9\XINT_keep:f:csv_enda\xint_relax
- \expandafter\XINT_keep:f:csv_loop_c\the\numexpr #1-\xint_c_vii.%
- {,#3,#4,#5,#6,#7,#8,#9}{#2}%
+ \expandafter\XINT_keep:f:csv_pos_fork
+ \romannumeral0\XINT_lengthupto:f:csv_a
+ #1.#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
+ .#1.{}#2\xint_bye%
}%
-\def\XINT_keep:f:csv_loop_c #1.#2#3{\XINT_keep:f:csv_loop_a #1.{#3#2}}%
-\def\XINT_keep:f:csv_enda #1.#2#3#4\xint_bye
+\def\XINT_keep:f:csv_pos_fork #1#2.%
{%
- \XINT_keep:f:csv_endb #2\xint_bye {#3}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_keep:f:csv_pos_keepall
+ \krof
}%
-\def\XINT_keep:f:csv_endb #1\xint_relax #2\xint_bye #3{ #3#1}%
-\def\XINT_keep:f:csv_finish #1.#2#3,#4,#5,#6,#7,#8,#9\xint_bye
+\long\def\XINT_keep:f:csv_pos_keepall #1.#2#3\xint_bye{,#3}%
+\def\XINT_keep:f:csv_loop #1#2.%
{%
- \csname XINT_keep:f:csv_finish_\romannumeral#1\endcsname
- ,#3,#4,#5,#6,#7,#8,\Z {#2}%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_loop_end-%
+ \expandafter\XINT_keep:f:csv_loop
+ \the\numexpr#1#2-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
}%
-\def\XINT_keep:f:csv_finish_ #1\Z #2{#2}%
-\def\XINT_keep:f:csv_finish_i ,#1,#2\Z
- {\XINT_keep:f:csv_finish_f ,#1\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_ii ,#1,#2,#3\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iii ,#1,#2,#3,#4\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iv ,#1,#2,#3,#4,#5\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_v ,#1,#2,#3,#4,#5,#6\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_vi ,#1,#2,#3,#4,#5,#6,#7\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5,#6\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_f #1\xint_relax #2\Z #3{#3#1}%
+\long\def\XINT_keep:f:csv_loop_pickeight
+ #1#2,#3,#4,#5,#6,#7,#8,#9,{{#1,#2,#3,#4,#5,#6,#7,#8,#9}}%
+\def\XINT_keep:f:csv_loop_end-\expandafter\XINT_keep:f:csv_loop
+ \the\numexpr-#1-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
+ {\csname XINT_keep:f:csv_end#1\endcsname}%
+\long\expandafter\def\csname XINT_keep:f:csv_end1\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8,#9\xint_bye {#1,#2,#3,#4,#5,#6,#7,#8}%
+\long\expandafter\def\csname XINT_keep:f:csv_end2\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8\xint_bye {#1,#2,#3,#4,#5,#6,#7}%
+\long\expandafter\def\csname XINT_keep:f:csv_end3\endcsname
+ #1#2,#3,#4,#5,#6,#7\xint_bye {#1,#2,#3,#4,#5,#6}%
+\long\expandafter\def\csname XINT_keep:f:csv_end4\endcsname
+ #1#2,#3,#4,#5,#6\xint_bye {#1,#2,#3,#4,#5}%
+\long\expandafter\def\csname XINT_keep:f:csv_end5\endcsname
+ #1#2,#3,#4,#5\xint_bye {#1,#2,#3,#4}%
+\long\expandafter\def\csname XINT_keep:f:csv_end6\endcsname
+ #1#2,#3,#4\xint_bye {#1,#2,#3}%
+\long\expandafter\def\csname XINT_keep:f:csv_end7\endcsname
+ #1#2,#3\xint_bye {#1,#2}%
+\long\expandafter\def\csname XINT_keep:f:csv_end8\endcsname
+ #1#2\xint_bye {#1}%
% \end{macrocode}
-% \subsubsection{\csh{xintNthEltPy:f:csv}}
-% \lverb|1.2g. 2016/03/17. Counts like Python starting at zero.
-% |
+%\subsubsection{\csh{xintTrim:f:csv}}
+% \lverb|1.2g 2016/03/17. Redone for 1.2j 2016/12/20 on the basis of new
+% \xintTrim.|
% \begin{macrocode}
-\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
-\def\xintntheltpy:f:csv #1{\expandafter\XINT_ntheltpy:f:csv\the\numexpr #1.}%
-\def\XINT_ntheltpy:f:csv #1%
+\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
+\long\def\xinttrim:f:csv #1#2%
{%
- \xint_UDsignfork
- #1{\XINT_nthelt:f:csv_neg }%
- -{\XINT_nthelt:f:csv_pos #1}%
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_trim:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
+}%
+\def\XINT_trim:f:csv_a #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_trim:f:csv_trimnone
+ 0#1\XINT_trim:f:csv_neg
+ 0-{\XINT_trim:f:csv_pos #1}%
\krof
}%
-\long\def\XINT_nthelt:f:csv_neg #1.#2%
+\long\def\XINT_trim:f:csv_trimnone .#1{,#1}%
+\long\def\XINT_trim:f:csv_neg #1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_neg_a
- \the\numexpr\expandafter\XINT_length:f:csv_a\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1+\xint_c_i\expandafter.\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\XINT_trim:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .{}#2\xint_bye
}%
-\def\XINT_nthelt:f:csv_neg_a #1%
+\def\XINT_trim:f:csv_neg_a #1%
{%
- \xint_UDzerominusfork
- #1-\xint_bye_thenstop
- 0#1\xint_bye_thenstop
- 0-{\XINT_nthelt:f:csv_loop_a #1}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_trim:f:csv_trimall
\krof
}%
-\long\def\XINT_nthelt:f:csv_pos #1.#2%
+\def\XINT_trim:f:csv_trimall {\expandafter,\xint_bye}%
+\long\def\XINT_trim:f:csv_pos #1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1+\xint_c_i\expandafter.%
- \romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\XINT_trim:f:csv_pos_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax\xint_bye
}%
-\def\XINT_nthelt:f:csv_loop_a #1.%
+\def\XINT_trim:f:csv_loop #1#2.%
{%
- \ifnum #1>\xint_c_viii
- \expandafter\XINT_nthelt:f:csv_loop_b
- \else
- \expandafter\XINT_nthelt:f:csv_getit
- \fi #1.%
+ \xint_gob_til_minus#1\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1#2\XINT_trim:f:csv_loop_trimnine
}%
-\long\def\XINT_nthelt:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_trim:f:csv_loop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_gob_til_xint_relax #9\XINT_nthelt:f:csv_none\xint_relax
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_trim:f:csv_toofew\xint_relax-\xint_c_ix.%
}%
-\def\XINT_nthelt:f:csv_getit #1.%
+\def\XINT_trim:f:csv_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr-#1\XINT_trim:f:csv_loop_trimnine
{%
- \expandafter\XINT_nthelt:f:csv_finish
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral
- \numexpr#1-\xint_c_i\endcsname
+ \csname XINT_trim:f:csv_finish#1\endcsname
}%
-\def\XINT_nthelt:f:csv_finish #1,#2\xint_bye
+\long\expandafter\def\csname XINT_trim:f:csv_finish1\endcsname
+ #1,#2,#3,#4,#5,#6,#7,#8,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish2\endcsname
+ #1,#2,#3,#4,#5,#6,#7,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish3\endcsname
+ #1,#2,#3,#4,#5,#6,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish4\endcsname
+ #1,#2,#3,#4,#5,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish5\endcsname
+ #1,#2,#3,#4,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish6\endcsname
+ #1,#2,#3,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish7\endcsname
+ #1,#2,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish8\endcsname
+ #1,{ }%
+\expandafter\let\csname XINT_trim:f:csv_finish9\endcsname\space
+\long\def\XINT_trim:f:csv_pos_done #1\xint_relax #2\xint_bye{#1}%
+% \end{macrocode}
+% \subsubsection{\csh{xintNthEltPy:f:csv}}
+% \lverb|Counts like Python starting at zero. Last refactored with 1.2j.
+% Attention, makes currently no effort at removing leading spaces in the
+% picked item.|
+% \begin{macrocode}
+\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
+\long\def\xintntheltpy:f:csv #1#2%
{%
- \XINT_nthelt:f:csv_finishb #1\xint_relax\xint_bye
+ \expandafter\XINT_nthelt:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
-\def\XINT_nthelt:f:csv_finishb #1\xint_relax #2\xint_bye { #1}%
+\def\XINT_nthelt:f:csv_a #1%
+{%
+ \xint_UDsignfork
+ #1\XINT_nthelt:f:csv_neg
+ -\XINT_nthelt:f:csv_pos
+ \krof #1%
+}%
+\long\def\XINT_nthelt:f:csv_neg -#1.#2%
+{%
+ \expandafter\XINT_nthelt:f:csv_neg_fork
+ \the\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ -#1.#2,\xint_bye
+}%
+\def\XINT_nthelt:f:csv_neg_fork #1%
+{%
+ \if#1-\expandafter\xint_bye_thenstop\fi
+ \expandafter\XINT_nthelt:f:csv_neg_done
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+#1%
+}%
+\long\def\XINT_nthelt:f:csv_neg_done#1,#2\xint_bye{ #1}%
+\long\def\XINT_nthelt:f:csv_pos #1.#2%
+{%
+ \expandafter\XINT_nthelt:f:csv_pos_done
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+}%
+\def\XINT_nthelt:f:csv_pos_done #1{%
+\long\def\XINT_nthelt:f:csv_pos_done ##1,##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\XINT_nthelt:f:csv_pos_cleanup\xint_relax#1##1}%
+}\XINT_nthelt:f:csv_pos_done{ }%
% \end{macrocode}
+% \lverb|This strange thing is in case the picked item was the last one, hence
+% there was an ending \xint_relax (we could not put a comma earlier for
+% matters of not confusing empty list with a singleton list), and we do this
+% here to activate brace-stripping of item as all other items may be
+% brace-stripped if picked. This is done for coherence. Of course, in the
+% context of the xintexpr.sty parsers, there are no braces in list items...|
+% \begin{macrocode}
+\xint_firstofone{\long\def\XINT_nthelt:f:csv_pos_cleanup\xint_relax} %
+ #1\xint_relax{ #1}%
+% \end{macrocode}
% \subsubsection{\csh{xintReverse:f:csv}}
% \lverb|1.2g. Contrarily to \xintReverseOrder from xintkernel.sty, this
% one expands its argument. Handles empty list too. 2016/03/17.
-% |
+% Made \long for 1.2j.|
% \begin{macrocode}
\def\xintReverse:f:csv {\romannumeral0\xintreverse:f:csv }%
-\def\xintreverse:f:csv #1%
+\long\def\xintreverse:f:csv #1%
{%
\expandafter\XINT_reverse:f:csv_loop
\expandafter{\expandafter}\romannumeral`&&@#1,%
@@ -17471,68 +17386,29 @@
\xint_bye,\xint_bye,\xint_bye,\xint_bye,%
\xint_relax
}%
-\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
{%
\xint_bye #9\XINT_reverse:f:csv_cleanup\xint_bye
\XINT_reverse:f:csv_loop {,#9,#8,#7,#6,#5,#4,#3,#2#1}%
}%
-\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
+\long\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
{%
\XINT_reverse:f:csv_finish #1%
}%
-\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
+\long\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
% \end{macrocode}
-% \subsubsection{\csh{xintLength:f:csv}}
-% \lverb|1.2g. Contrarily to ancestor \xintLength from xintkernel.sty, this
-% one expands its argument. 2016/03/17.
-% |
-% \begin{macrocode}
-\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv }%
-\def\xintlength:f:csv #1%
-{%
- \expandafter\XINT_length:f:csv_a
- \romannumeral`&&@#1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
-}%
-\def\XINT_length:f:csv_a #1%
-{%
- \xint_gob_til_xint_relax #1\XINT_length:f:csv_empty\xint_relax
- \XINT_length:f:csv_loop 0.#1%
-}%
-\def\XINT_length:f:csv_empty #1\xint_bye { 0}%
-\def\XINT_length:f:csv_loop #1.#2,#3,#4,#5,#6,#7,#8,#9,%
-{%
- \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.%
-}%
-\def\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.#2\xint_bye
-{%
- \XINT_length:f:csv_finish_b #2\W,\W,\W,\W,\W,\W,\W,\Z {#1}%
-}%
-\def\XINT_length:f:csv_finish_b #1,#2,#3,#4,#5,#6,#7,#8\Z
-{%
- \xint_gob_til_W
- #1\XINT_length:f:csv_finish_c \xint_c_i
- #2\XINT_length:f:csv_finish_c \xint_c_ii
- #3\XINT_length:f:csv_finish_c \xint_c_iii
- #4\XINT_length:f:csv_finish_c \xint_c_iv
- #5\XINT_length:f:csv_finish_c \xint_c_v
- #6\XINT_length:f:csv_finish_c \xint_c_vi
- #7\XINT_length:f:csv_finish_c \xint_c_vii
- \W\XINT_length:f:csv_finish_c \xint_c_viii\Z
-}%
-\edef\XINT_length:f:csv_finish_c #1#2\Z #3%
- {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
-% \end{macrocode}
% \subsubsection{Public names for the undocumented csv macros}
-% \lverb|1.2g. 2016/03/17.|
+% \lverb|Completely unstable macros: currently they expand the list argument
+% and want no final comma. But for matters of xintexpr.sty I could as well
+% decide to require a final comma, and then I could simplify implementation
+% but of course this would break the macros if used with current
+% functionalities.|
% \begin{macrocode}
+\let\xintCSVLength \xintLength:f:csv
+\let\xintCSVKeep \xintKeep:f:csv
\let\xintCSVTrim \xintTrim:f:csv
-\let\xintCSVKeep \xintKeep:f:csv
\let\xintCSVNthEltPy \xintNthEltPy:f:csv
\let\xintCSVReverse \xintReverse:f:csv
-\let\xintCSVLength \xintLength:f:csv
\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
% \end{macrocode}
@@ -17625,7 +17501,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintcore}%
- [2016/12/13 1.2i Expandable arithmetic on big integers (JFB)]%
+ [2016/12/22 1.2j Expandable arithmetic on big integers (JFB)]%
% \end{macrocode}
% \subsection{Counts for holding needed constants}
% \begin{macrocode}
@@ -20491,7 +20367,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xint}%
- [2016/12/13 1.2i Expandable operations on big integers (JFB)]%
+ [2016/12/22 1.2j Expandable operations on big integers (JFB)]%
% \end{macrocode}
% \subsection{More token management}
% \begin{macrocode}
@@ -20570,13 +20446,13 @@
\expandafter\XINT_len_fork
\romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye\relax
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye\relax
}%
\edef\XINT_len_fork #1%
{%
\noexpand\expandafter\space
- \unexpanded{\the\numexpr\xint_c_ix\expandafter
+ \unexpanded{\the\numexpr\expandafter
\XINT_length_loop\xint_UDsignfork#1{}-{#1}\krof}%
}%
% \end{macrocode}
@@ -21777,11 +21653,11 @@
\def\XINT_split_fromright #1.#2\xint_bye
{%
\expandafter\XINT_split_fromright_a
- \the\numexpr#1-\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr#1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.#2\xint_bye
}%
\def\XINT_split_fromright_a #1%
@@ -22717,7 +22593,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2016/12/13 1.2i Expandable binary and hexadecimal conversions (JFB)]%
+ [2016/12/22 1.2j Expandable binary and hexadecimal conversions (JFB)]%
% \end{macrocode}
% \subsection{Constants, etc...}
% \lverb!1.08!
@@ -23417,7 +23293,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2016/12/13 1.2i Euclide algorithm with xint package (JFB)]%
+ [2016/12/22 1.2j Euclide algorithm with xint package (JFB)]%
% \end{macrocode}
% \subsection{\csh{xintGCD}, \csh{xintiiGCD}}
% \begin{macrocode}
@@ -24104,7 +23980,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2016/12/13 1.2i Expandable operations on fractions (JFB)]%
+ [2016/12/22 1.2j Expandable operations on fractions (JFB)]%
% \end{macrocode}
% \subsection{\csh{XINT_cntSgnFork}}
% \lverb|1.09i. Used internally, #1 must expand to \m at ne, \z@, or \@ne or
@@ -24130,12 +24006,11 @@
\def\XINT_flen #1#2#3%
{%
\expandafter\space
- \the\numexpr \XINT_abs#1+\xint_c_viii
- \XINT_length_loop
+ \the\numexpr \XINT_abs#1+\XINT_length_loop
#2#3\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-\xint_c_i
\relax
}%
% \end{macrocode}
@@ -24324,11 +24199,11 @@
\def\XINT_frac_gen_Bd #1.#2e#3e#4\XINT_Z
{%
\expandafter\XINT_frac_gen_C\the\numexpr #3-%
- \numexpr\xint_c_ix\XINT_length_loop
+ \numexpr\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
~#2#1!%
}%
\def\XINT_frac_gen_C #1!#2.#3%
@@ -24353,11 +24228,11 @@
\def\XINT_frac_gen_Cc #1.#2~#3!#4e#5e#6\XINT_T
{%
\expandafter\XINT_frac_gen_F\the\numexpr #5-#2-%
- \numexpr\xint_c_ix\XINT_length_loop
+ \numexpr\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
\relax\expandafter~\romannumeral0\XINT_num_loop
#3\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\Z
@@ -25003,11 +24878,11 @@
{%
\expandafter\XINT_trunc_sp_Cc
\romannumeral0\expandafter\XINT_split_fromright_a
- \the\numexpr#3-\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr#3-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.#2\xint_bye2345678\xint_bye..#1%
}%
\def\XINT_trunc_sp_Cc #1%
@@ -26365,11 +26240,11 @@
\def\XINT_float_Sb #1#2\Z #3#4%
{%
\expandafter\XINT_float_T
- \the\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye-#4.%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
{#2}#1{#3}{#4}%
}%
% \end{macrocode}
@@ -26582,11 +26457,11 @@
\def\XINT_infloat_Sb #1#2\Z #3#4%
{%
\expandafter\XINT_infloat_T
- \the\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye-#4.%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
{#2}#1{#3}%
}%
% \end{macrocode}
@@ -28015,7 +27890,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2016/12/13 1.2i Expandable partial sums with xint package (JFB)]%
+ [2016/12/22 1.2j Expandable partial sums with xint package (JFB)]%
% \end{macrocode}
% \subsection{\csh{xintSeries}}
% \begin{macrocode}
@@ -28513,7 +28388,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2016/12/13 1.2i Expandable continued fractions with xint package (JFB)]%
+ [2016/12/22 1.2j Expandable continued fractions with xint package (JFB)]%
% \end{macrocode}
% \subsection{\csh{xintCFrac}}
% \begin{macrocode}
@@ -29754,7 +29629,7 @@
% \begin{macrocode}
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2016/12/13 1.2i Expandable expression parser (JFB)]%
+ [2016/12/22 1.2j Expandable expression parser (JFB)]%
\catcode`! 11
% \end{macrocode}
% \subsection{Locking and unlocking}
@@ -30991,30 +30866,23 @@
% \subsection{Macros for list selectors: [list][N], [list][:b], [list][a:], [list][a:b]}
% \localtableofcontents
%
-% \lverb|1.1 (27 octobre 2014) I implement Python syntax, see
-% http://stackoverflow.com/a/13005464/4184837. I do not implement third
-% argument giving the step. Also, Python [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 do that. For reversing I could allow
-% [::-1] syntax but this would get confusing, better to do function "reversed".
+% \lverb|Python slicing was first implemented for 1.1 (27 octobre 2014). But
+% it used \xintCSVtoList and \xintListWithSep{,} to convert back and forth to
+% token lists for use of \xintKeep, \xintTrim, \xintNthElt. Not very
+% efficient! Also [list][a:b] was Python like but not [list][N] which counted
+% items starting at one, and returned the length for N=0.
%
-% This gets the job done, but I would definitely need \xintTrim::csv,
-% \xintKeep::csv, \xintNthElt::csv for better efficiency. Not for 1.1.
+% Release 1.2g changed this so [list][N] now counts starting at zero and
+% len(list) computes the number of items. Also 1.2g had its own f-expandable
+% macros handling directly the comma separated lists. They are located into
+% $xinttoolsnameimp.sty.
%
-% 2016/03/16. 1.2g decides that as [list][a:b] obeyed already Python syntax,
-% for example [list][:n] keeps the first n elements, it was annoying that
-% elements were tacitly numbered starting from 1 and not from 0 in the context
-% of the [list][N] syntax. Thus now [list][n] returns the (n-1)-eth element.
-% And one must use len(list) for the length.
-%
-% 2016/03/17. I had forgotten the 1.1 code comment above and 1.2g does it at
-% last, in f-expandable versions \xintTrim:f:csv, \xintKeep:f:csv,
-% \xintNthELtPy:f:csv and \xintLength:f:csv, which are all f-expandable for
-% easier use with \xintNewExpr. Also \xintReverse:f:csv. I end up moving them
-% all to xinttools.sty.
-%
-%
-%|
+% 1.2j improved the $xinttoolsnameimp.sty macros and furthermore it made the
+% Python slicing in expressions a bit more efficient still by exploiting in
+% some cases that expansion happens in \csname...\endcsname and does not have
+% to be f-expandable. But the f-expandable variants must be kept for use by
+% \xintNewExpr and \xintdeffunc.
+% |
% \begin{macrocode}
\def\XINT_tmpa #1#2#3#4#5#6%
{%
@@ -31035,9 +30903,9 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3\csname
- .=\expandafter\xintListSel:f:csv
- \romannumeral`&&@\XINT_expr_unlock ##4;%
- \XINT_expr_unlock ##1;\endcsname % unlock for \xintNewExpr
+ .=\expandafter\xintListSel:x:csv % will be \xintListSel:f:csv in \xintNewExpr output
+ \romannumeral`&&@\XINT_expr_unlock ##4;% selector
+ \XINT_expr_unlock ##1;\endcsname % unlock already pre-positioned for \xintNewExpr
}%
\fi
}%
@@ -31070,9 +30938,8 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3\csname
- .=:\xintiiifSgn{\XINT_expr_unlock ##1}NPP.%
- \xintiiifSgn{\XINT_expr_unlock ##4}NPP.%
- \xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}\endcsname
+ .=:\xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}%
+ \endcsname
}%
\fi
}%
@@ -31088,8 +30955,11 @@
}%
\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 }%
+\def\XINT_expr_op_:] #1%
+{%
+ \expandafter\xint_c_i\expandafter )%
+ \csname .=]\xintNum{\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
@@ -31103,58 +30973,166 @@
\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
% \end{macrocode}
% \subsubsection{\csh{xintListSel:f:csv}}
-% \lverb|Some complications here are due to \xintNewExpr matters.
-%
-% 2016/03/17.
-% 1.2g uses Python numbering not only for slices but also item extractors.
-%
-% It also implements faster extractors, acting directly on comma separated
-% values with custom sub-macros \xintTrim:f:csv, \xintKeep:f:csv,
-% \xintNthEltPy:f:csv and \xintLength:f:csv. We currently use here
-% f-expandable versions for easier compatibility with \xintNewExpr. Also
-% sub-optimal is the way the list argument is grabbed. But still better than
-% the 1.1 version which used \xintCSVtoList everywhere for access to the
-% routines provided with \xinttoolsnameimp.|
+% \lverb|1.2g. Since 1.2j this is needed only for \xintNewExpr and user
+% defined functions. Some extras compared to \xintListSel:x:csv because things
+% may not yet have been expanded in the \xintNewExpr context.|
% \begin{macrocode}
-\catcode`[ 12 \catcode`] 12
-\def\xintListSel:f:csv #1{%
+\def\xintListSel:f:csv #1%
+{%
\if ]\noexpand#1\xint_dothis{\expandafter\XINT_listsel:_s\romannumeral`&&@}\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;{\xintTrim:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_keep #1;#2;{\xintKeep:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_nth#1;#2;{\xintNthEltPy:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_PP #1;#2;#3;%
- {\xintTrim:f:csv {\xintNum{#1}}{\xintKeep:f:csv {\xintNum{#2}}{#3}}}%
-\def\XINT_listsel:_NN #1;#2;#3;%
- {\xintTrim:f:csv {\xintNum{#2}}{\xintKeep:f:csv {\xintNum{#1}}{#3}}}%
-\def\XINT_listsel:_NP #1;#2;#3;{\expandafter\XINT_listsel:_NP_a
+\def\XINT_listsel:_nth #1;#2;{\xintNthEltPy:f:csv {\xintNum{#1}}{#2}}%
+\def\XINT_listsel:_s #1#2;#3;%
+{%
+ \if-#1\expandafter\xintKeep:f:csv\else\expandafter\xintTrim:f:csv\fi
+ {#1#2}{#3}%
+}%
+\def\XINT_listsel:_: #1;#2;%
+{%
+ \expandafter\XINT_listsel:_:a
+ \the\numexpr #1\expandafter;\the\numexpr #2\expandafter;\romannumeral`&&@%
+}%
+\def\XINT_listsel:_:a #1#2;#3#4;%
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_listsel:_N:N
+ #1-\XINT_listsel:_N:P
+ -#3\XINT_listsel:_P:N
+ --\XINT_listsel:_P:P
+ \krof #1#2;#3#4;%
+}%
+\def\XINT_listsel:_P:P #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \xint_afterfi{\expandafter\space\xint_gobble_iii}\fi
+ \xintKeep:f:csv{#2-#1}{\xintTrim:f:csv{#1}{#3}}%
+}%
+\def\XINT_listsel:_N:N #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \expandafter\XINT_listsel:_N:N_abort\fi
+ \expandafter\XINT_listsel:_N:N_a
+ \the\numexpr#1+\xintLength:f:csv{#3}\expandafter;\the\numexpr#2-#1;#3;%
+}%
+\def\XINT_listsel:_N:N_abort #1;#2;#3;{ }%
+\def\XINT_listsel:_N:N_a #1;#2;#3;%
+{%
+ \xintKeep:f:csv{#2}{\xintTrim:f:csv{\ifnum#1<\xint_c_\xint_c_\else#1\fi}{#3}}%
+}%
+\def\XINT_listsel:_N:P #1;#2;#3;{\expandafter\XINT_listsel:_N:P_a
\the\numexpr #1+\xintLength:f:csv{#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
+\def\XINT_listsel:_N:P_a #1#2;%
+ {\if -#1\expandafter\XINT_listsel:_O:P\fi\XINT_listsel:_P:P #1#2;}%
+\def\XINT_listsel:_O:P\XINT_listsel:_P:P #1;{\XINT_listsel:_P:P 0;}%
+\def\XINT_listsel:_P:N #1;#2;#3;{\expandafter\XINT_listsel:_P:N_a
\the\numexpr #2+\xintLength:f:csv{#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\XINT_listsel:_P:N_a #1#2;#3;%
+ {\if -#1\expandafter\XINT_listsel:_P:O\fi\XINT_listsel:_P:P #3;#1#2;}%
+\def\XINT_listsel:_P:O\XINT_listsel:_P:P #1;#2;{\XINT_listsel:_P:P #1;0;}%
% \end{macrocode}
+% \subsubsection{\csh{xintListSel:x:csv}}
+% \lverb|1.2j. Because there is \xintKeep:x:csv which is faster than
+% \xintKeep:f:csv.|
+% \begin{macrocode}
+\def\xintListSel:x:csv #1%
+{%
+ \if ]\noexpand#1\xint_dothis\XINT_listsel:_s\fi
+ \if :\noexpand#1\xint_dothis\XINT_listxsel:_:\fi
+ \xint_orthat {\XINT_listsel:_nth #1}%
+}%
+\def\XINT_listxsel:_: #1#2;#3#4;%
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_listxsel:_N:N
+ #1-\XINT_listxsel:_N:P
+ -#3\XINT_listxsel:_P:N
+ --\XINT_listxsel:_P:P
+ \krof #1#2;#3#4;%
+}%
+\def\XINT_listxsel:_P:P #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \expandafter\xint_gobble_iii\fi
+ \xintKeep:x:csv{#2-#1}{\xintTrim:f:csv{#1}{#3}}%
+}%
+\def\XINT_listxsel:_N:N #1;#2;#3;%
+{%
+ \expandafter\XINT_listxsel:_N:N_a
+ \the\numexpr #2-#1\expandafter;\the\numexpr#1+\xintLength:f:csv{#3};#3;%
+}%
+\def\XINT_listxsel:_N:N_a #1;#2;#3;%
+{%
+ \unless\ifnum #1>\xint_c_ \expandafter\xint_gobble_iii\fi
+ \xintKeep:x:csv{#1}{\xintTrim:f:csv{\ifnum#2<\xint_c_\xint_c_\else#2\fi}{#3}}%
+}%
+\def\XINT_listxsel:_N:P #1;#2;#3;{\expandafter\XINT_listxsel:_N:P_a
+ \the\numexpr #1+\xintLength:f:csv{#3};#2;#3;}%
+\def\XINT_listxsel:_N:P_a #1#2;%
+ {\if -#1\expandafter\XINT_listxsel:_O:P\fi\XINT_listxsel:_P:P #1#2;}%
+\def\XINT_listxsel:_O:P\XINT_listxsel:_P:P #1;{\XINT_listxsel:_P:P 0;}%
+\def\XINT_listxsel:_P:N #1;#2;#3;{\expandafter\XINT_listxsel:_P:N_a
+ \the\numexpr #2+\xintLength:f:csv{#3};#1;#3;}%
+\def\XINT_listxsel:_P:N_a #1#2;#3;%
+ {\if -#1\expandafter\XINT_listxsel:_P:O\fi\XINT_listxsel:_P:P #3;#1#2;}%
+\def\XINT_listxsel:_P:O\XINT_listxsel:_P:P #1;#2;{\XINT_listxsel:_P:P #1;0;}%
+% \end{macrocode}
+% \subsubsection{\csh{xintKeep:x:csv}}
+% \lverb|1.2j. This macro is used only with positive first argument.|
+% \begin{macrocode}
+\def\xintKeep:x:csv #1#2%
+{%
+ \expandafter\xint_gobble_i
+ \romannumeral0\expandafter\XINT_keep:x:csv_pos
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
+}%
+\def\XINT_keep:x:csv_pos #1.#2%
+{%
+ \expandafter\XINT_keep:x:csv_loop\the\numexpr#1-\xint_c_viii.%
+ #2\xint_Bye,\xint_Bye,\xint_Bye,\xint_Bye,%
+ \xint_Bye,\xint_Bye,\xint_Bye,\xint_Bye,\xint_bye
+}%
+\def\XINT_keep:x:csv_loop #1%
+{%
+ \xint_gob_til_minus#1\XINT_keep:x:csv_finish-%
+ \XINT_keep:x:csv_loop_pickeight #1%
+}%
+\def\XINT_keep:x:csv_loop_pickeight #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+{%
+ ,#2,#3,#4,#5,#6,#7,#8,#9%
+ \expandafter\XINT_keep:x:csv_loop\the\numexpr#1-\xint_c_viii.%
+}%
+\def\XINT_keep:x:csv_finish-\XINT_keep:x:csv_loop_pickeight -#1.%
+{%
+ \csname XINT_keep:x:csv_finish#1\endcsname
+}%
+\expandafter\def\csname XINT_keep:x:csv_finish1\endcsname
+ #1,#2,#3,#4,#5,#6,#7,{,#1,#2,#3,#4,#5,#6,#7\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish2\endcsname
+ #1,#2,#3,#4,#5,#6,{,#1,#2,#3,#4,#5,#6\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish3\endcsname
+ #1,#2,#3,#4,#5,{,#1,#2,#3,#4,#5\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish4\endcsname
+ #1,#2,#3,#4,{,#1,#2,#3,#4\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish5\endcsname
+ #1,#2,#3,{,#1,#2,#3\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish6\endcsname
+ #1,#2,{,#1,#2\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish7\endcsname
+ #1,{,#1\xint_Bye}%
+\expandafter\let\csname XINT_keep:x:csv_finish8\endcsname\xint_Bye
+% \end{macrocode}
+% \subsubsection{\csh{xintKeep:f:csv}}
+% \lverb|1.2g, code in xinttools.sty. Refactored in 1.2j.|
% \subsubsection{\csh{xintTrim:f:csv}}
-% \lverb|1.2g 2016/03/17. Code in xinttools.sty|
-% \subsubsection{\csh{xintKeep:f:csv}}
-% \lverb|1.2g 2016/03/17. Code in xinttools.sty|
+% \lverb|1.2g, code in xinttools.sty. Refactored in 1.2j.|
% \subsubsection{\csh{xintNthEltPy:f:csv}}
-% \lverb|1.2g 2016/03/17. Code in xinttools.sty|
+% \lverb|1.2g, code in xinttools.sty. Refactored in 1.2j.|
+% \subsubsection{\csh{xintLength:f:csv}}
+% \lverb|1.2g, code in xinttools.sty. Refactored in 1.2j.|
% \subsubsection{\csh{xintReverse:f:csv}}
-% \lverb|1.2g 2016/03/17. Code in xinttools.sty|
-% \subsubsection{\csh{xintLength:f:csv}}
-% \lverb|1.2g 2016/03/17. Code in xinttools.sty|
+% \lverb|1.2g, code in xinttools.sty.|
%
%\subsection{Macros for a..b list generation}
% \localtableofcontents
@@ -33416,15 +33394,13 @@
% \end{macrocode}
% \lverb|~xintListSel:f:csv must have space after it, the reason being in
% \XINT_expr_until_:_b which inserts a : as fist token of something which will
-% reappear later following ~xintListSel:f:csv.
-%
-% Notice that 1.1 was chicken and did not even try to expand the Reverse and
-% ListSel by fear of the complexities and overhead of checking whether it
-% contained macro parameters (possibly embedded in sub-macros).|
+% reappear later following ~xintListSel:f:csv. There must be some deep wisdom
+% in previous sentence but I find it barely comprehensible now. Anyway, 1.2j
+% has \xintListSel:x:csv which is thus mapped here to f-expandable variant.|
% \begin{macrocode}
\toks0 \expandafter{\the\toks0
\def\xintReverse:f:csv {~xintReverse:f:csv }%
- \def\xintListSel:f:csv {~xintListSel:f:csv }%
+ \def\xintListSel:x:csv {~xintListSel:f:csv }%
}%
\odef\XINT_expr_redefinemacros {\the\toks0}% Not \edef ! (subtle)
\def\XINT_expr_redefineprints
@@ -33611,15 +33587,15 @@
xintbinhex.sty:69
xintcfrac.sty:183
xintcore.sty:272
-xintexpr.sty:147
+xintexpr.sty:165
xintfrac.sty:433
xintgcd.sty:59
xintkernel.sty:13
xintseries.sty:48
-xinttools.sty:138
+xinttools.sty:136
\fi
% grep -o "^{%" xint*sty | wc -l
-\def\totala{ 1577}
+\def\totala{ 1593}
\iffalse
% grep -c -e "^}%" xint*sty
xint.sty:215
@@ -33626,15 +33602,15 @@
xintbinhex.sty:69
xintcfrac.sty:183
xintcore.sty:272
-xintexpr.sty:178
+xintexpr.sty:195
xintfrac.sty:433
xintgcd.sty:61
xintkernel.sty:15
xintseries.sty:48
-xinttools.sty:138
+xinttools.sty:135
\fi
% grep -o "^}%" xint*sty | wc -l
-\def\totalb{ 1612}
+\def\totalb{ 1626}
\DeleteShortVerb{\|}
\def\mymacro #1{\mymacroaux #1}
\def\mymacroaux #1#2{\strut \csname #1nameimp\endcsname:& \dtt{ #2.}\tabularnewline }
@@ -33671,7 +33647,7 @@
Right bracket \] Circumflex \^ Underscore \_
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum {30403}% était 30303 pour 1.2h
+\CheckSum {30750}% était 30303 pour 1.2h, 30403 pour 1.2i
\makeatletter\check at checksum\makeatother
\Finale
%% End of file xint.dtx
Modified: trunk/Master/texmf-dist/source/generic/xint/xint.ins
===================================================================
--- trunk/Master/texmf-dist/source/generic/xint/xint.ins 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/source/generic/xint/xint.ins 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% ---------------------------------------------------------------
%%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xint.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xint.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xint.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xint: Expandable operations on big integers
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty)
\XINT_providespackage
\ProvidesPackage{xint}%
- [2016/12/13 1.2i Expandable operations on big integers (JFB)]%
+ [2016/12/22 1.2j 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}%
@@ -113,13 +113,13 @@
\expandafter\XINT_len_fork
\romannumeral0\xintnum{#1}\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye\relax
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye\relax
}%
\edef\XINT_len_fork #1%
{%
\noexpand\expandafter\space
- \unexpanded{\the\numexpr\xint_c_ix\expandafter
+ \unexpanded{\the\numexpr\expandafter
\XINT_length_loop\xint_UDsignfork#1{}-{#1}\krof}%
}%
\def\xintBool #1{\romannumeral`&&@%
@@ -1089,11 +1089,11 @@
\def\XINT_split_fromright #1.#2\xint_bye
{%
\expandafter\XINT_split_fromright_a
- \the\numexpr#1-\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr#1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.#2\xint_bye
}%
\def\XINT_split_fromright_a #1%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintbinhex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintbinhex.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintbinhex.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintbinhex: Expandable binary and hexadecimal conversions
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintbinhex}%
- [2016/12/13 1.2i Expandable binary and hexadecimal conversions (JFB)]%
+ [2016/12/22 1.2j Expandable binary and hexadecimal conversions (JFB)]%
\newcount\xint_c_ii^xv \xint_c_ii^xv 32768
\newcount\xint_c_ii^xvi \xint_c_ii^xvi 65536
\newcount\xint_c_x^v \xint_c_x^v 100000
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintcfrac.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintcfrac.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintcfrac: Expandable continued fractions with xint package
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintcfrac}%
- [2016/12/13 1.2i Expandable continued fractions with xint package (JFB)]%
+ [2016/12/22 1.2j Expandable continued fractions with xint package (JFB)]%
\def\xintCFrac {\romannumeral0\xintcfrac }%
\def\xintcfrac #1%
{%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintcore.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintcore.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintcore.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintcore: Expandable arithmetic on big integers
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintcore}%
- [2016/12/13 1.2i Expandable arithmetic on big integers (JFB)]%
+ [2016/12/22 1.2j Expandable arithmetic on big integers (JFB)]%
\ifdefined\m at ne\let\xint_c_mone\m at ne
\else\csname newcount\endcsname\xint_c_mone \xint_c_mone -1 \fi
\newcount\xint_c_x^viii \xint_c_x^viii 100000000
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintexpr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintexpr.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintexpr.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintexpr: Expandable expression parser
%% ---------------------------------------------------------------
@@ -81,7 +81,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2016/12/13 1.2i Expandable expression parser (JFB)]%
+ [2016/12/22 1.2j Expandable expression parser (JFB)]%
\catcode`! 11
\def\xint_gob_til_! #1!{}% catcode 11 ! default in xintexpr.sty code.
\edef\XINT_expr_lockscan#1!% not used for decimal numbers in xintexpr 1.2
@@ -915,9 +915,9 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3\csname
- .=\expandafter\xintListSel:f:csv
- \romannumeral`&&@\XINT_expr_unlock ##4;%
- \XINT_expr_unlock ##1;\endcsname % unlock for \xintNewExpr
+ .=\expandafter\xintListSel:x:csv % will be \xintListSel:f:csv in \xintNewExpr output
+ \romannumeral`&&@\XINT_expr_unlock ##4;% selector
+ \XINT_expr_unlock ##1;\endcsname % unlock already pre-positioned for \xintNewExpr
}%
\fi
}%
@@ -950,9 +950,8 @@
\else
\xint_afterfi
{\expandafter ##2\expandafter ##3\csname
- .=:\xintiiifSgn{\XINT_expr_unlock ##1}NPP.%
- \xintiiifSgn{\XINT_expr_unlock ##4}NPP.%
- \xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}\endcsname
+ .=:\xintNum{\XINT_expr_unlock ##1};\xintNum{\XINT_expr_unlock ##4}%
+ \endcsname
}%
\fi
}%
@@ -968,8 +967,11 @@
}%
\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 }%
+\def\XINT_expr_op_:] #1%
+{%
+ \expandafter\xint_c_i\expandafter )%
+ \csname .=]\xintNum{\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
@@ -978,31 +980,139 @@
\let\XINT_flexpr_op_][: \XINT_expr_op_][:
\let\XINT_iiexpr_op_][: \XINT_expr_op_][:
\catcode`[ 12 \catcode`] 12
-\def\xintListSel:f:csv #1{%
+\def\xintListSel:f:csv #1%
+{%
\if ]\noexpand#1\xint_dothis{\expandafter\XINT_listsel:_s\romannumeral`&&@}\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;{\xintTrim:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_keep #1;#2;{\xintKeep:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_nth#1;#2;{\xintNthEltPy:f:csv {\xintNum{#1}}{#2}}%
-\def\XINT_listsel:_PP #1;#2;#3;%
- {\xintTrim:f:csv {\xintNum{#1}}{\xintKeep:f:csv {\xintNum{#2}}{#3}}}%
-\def\XINT_listsel:_NN #1;#2;#3;%
- {\xintTrim:f:csv {\xintNum{#2}}{\xintKeep:f:csv {\xintNum{#1}}{#3}}}%
-\def\XINT_listsel:_NP #1;#2;#3;{\expandafter\XINT_listsel:_NP_a
+\def\XINT_listsel:_nth #1;#2;{\xintNthEltPy:f:csv {\xintNum{#1}}{#2}}%
+\def\XINT_listsel:_s #1#2;#3;%
+{%
+ \if-#1\expandafter\xintKeep:f:csv\else\expandafter\xintTrim:f:csv\fi
+ {#1#2}{#3}%
+}%
+\def\XINT_listsel:_: #1;#2;%
+{%
+ \expandafter\XINT_listsel:_:a
+ \the\numexpr #1\expandafter;\the\numexpr #2\expandafter;\romannumeral`&&@%
+}%
+\def\XINT_listsel:_:a #1#2;#3#4;%
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_listsel:_N:N
+ #1-\XINT_listsel:_N:P
+ -#3\XINT_listsel:_P:N
+ --\XINT_listsel:_P:P
+ \krof #1#2;#3#4;%
+}%
+\def\XINT_listsel:_P:P #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \xint_afterfi{\expandafter\space\xint_gobble_iii}\fi
+ \xintKeep:f:csv{#2-#1}{\xintTrim:f:csv{#1}{#3}}%
+}%
+\def\XINT_listsel:_N:N #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \expandafter\XINT_listsel:_N:N_abort\fi
+ \expandafter\XINT_listsel:_N:N_a
+ \the\numexpr#1+\xintLength:f:csv{#3}\expandafter;\the\numexpr#2-#1;#3;%
+}%
+\def\XINT_listsel:_N:N_abort #1;#2;#3;{ }%
+\def\XINT_listsel:_N:N_a #1;#2;#3;%
+{%
+ \xintKeep:f:csv{#2}{\xintTrim:f:csv{\ifnum#1<\xint_c_\xint_c_\else#1\fi}{#3}}%
+}%
+\def\XINT_listsel:_N:P #1;#2;#3;{\expandafter\XINT_listsel:_N:P_a
\the\numexpr #1+\xintLength:f:csv{#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
+\def\XINT_listsel:_N:P_a #1#2;%
+ {\if -#1\expandafter\XINT_listsel:_O:P\fi\XINT_listsel:_P:P #1#2;}%
+\def\XINT_listsel:_O:P\XINT_listsel:_P:P #1;{\XINT_listsel:_P:P 0;}%
+\def\XINT_listsel:_P:N #1;#2;#3;{\expandafter\XINT_listsel:_P:N_a
\the\numexpr #2+\xintLength:f:csv{#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\XINT_listsel:_P:N_a #1#2;#3;%
+ {\if -#1\expandafter\XINT_listsel:_P:O\fi\XINT_listsel:_P:P #3;#1#2;}%
+\def\XINT_listsel:_P:O\XINT_listsel:_P:P #1;#2;{\XINT_listsel:_P:P #1;0;}%
+\def\xintListSel:x:csv #1%
+{%
+ \if ]\noexpand#1\xint_dothis\XINT_listsel:_s\fi
+ \if :\noexpand#1\xint_dothis\XINT_listxsel:_:\fi
+ \xint_orthat {\XINT_listsel:_nth #1}%
+}%
+\def\XINT_listxsel:_: #1#2;#3#4;%
+{%
+ \xint_UDsignsfork
+ #1#3\XINT_listxsel:_N:N
+ #1-\XINT_listxsel:_N:P
+ -#3\XINT_listxsel:_P:N
+ --\XINT_listxsel:_P:P
+ \krof #1#2;#3#4;%
+}%
+\def\XINT_listxsel:_P:P #1;#2;#3;%
+{%
+ \unless\ifnum #1<#2 \expandafter\xint_gobble_iii\fi
+ \xintKeep:x:csv{#2-#1}{\xintTrim:f:csv{#1}{#3}}%
+}%
+\def\XINT_listxsel:_N:N #1;#2;#3;%
+{%
+ \expandafter\XINT_listxsel:_N:N_a
+ \the\numexpr #2-#1\expandafter;\the\numexpr#1+\xintLength:f:csv{#3};#3;%
+}%
+\def\XINT_listxsel:_N:N_a #1;#2;#3;%
+{%
+ \unless\ifnum #1>\xint_c_ \expandafter\xint_gobble_iii\fi
+ \xintKeep:x:csv{#1}{\xintTrim:f:csv{\ifnum#2<\xint_c_\xint_c_\else#2\fi}{#3}}%
+}%
+\def\XINT_listxsel:_N:P #1;#2;#3;{\expandafter\XINT_listxsel:_N:P_a
+ \the\numexpr #1+\xintLength:f:csv{#3};#2;#3;}%
+\def\XINT_listxsel:_N:P_a #1#2;%
+ {\if -#1\expandafter\XINT_listxsel:_O:P\fi\XINT_listxsel:_P:P #1#2;}%
+\def\XINT_listxsel:_O:P\XINT_listxsel:_P:P #1;{\XINT_listxsel:_P:P 0;}%
+\def\XINT_listxsel:_P:N #1;#2;#3;{\expandafter\XINT_listxsel:_P:N_a
+ \the\numexpr #2+\xintLength:f:csv{#3};#1;#3;}%
+\def\XINT_listxsel:_P:N_a #1#2;#3;%
+ {\if -#1\expandafter\XINT_listxsel:_P:O\fi\XINT_listxsel:_P:P #3;#1#2;}%
+\def\XINT_listxsel:_P:O\XINT_listxsel:_P:P #1;#2;{\XINT_listxsel:_P:P #1;0;}%
+\def\xintKeep:x:csv #1#2%
+{%
+ \expandafter\xint_gobble_i
+ \romannumeral0\expandafter\XINT_keep:x:csv_pos
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
+}%
+\def\XINT_keep:x:csv_pos #1.#2%
+{%
+ \expandafter\XINT_keep:x:csv_loop\the\numexpr#1-\xint_c_viii.%
+ #2\xint_Bye,\xint_Bye,\xint_Bye,\xint_Bye,%
+ \xint_Bye,\xint_Bye,\xint_Bye,\xint_Bye,\xint_bye
+}%
+\def\XINT_keep:x:csv_loop #1%
+{%
+ \xint_gob_til_minus#1\XINT_keep:x:csv_finish-%
+ \XINT_keep:x:csv_loop_pickeight #1%
+}%
+\def\XINT_keep:x:csv_loop_pickeight #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+{%
+ ,#2,#3,#4,#5,#6,#7,#8,#9%
+ \expandafter\XINT_keep:x:csv_loop\the\numexpr#1-\xint_c_viii.%
+}%
+\def\XINT_keep:x:csv_finish-\XINT_keep:x:csv_loop_pickeight -#1.%
+{%
+ \csname XINT_keep:x:csv_finish#1\endcsname
+}%
+\expandafter\def\csname XINT_keep:x:csv_finish1\endcsname
+ #1,#2,#3,#4,#5,#6,#7,{,#1,#2,#3,#4,#5,#6,#7\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish2\endcsname
+ #1,#2,#3,#4,#5,#6,{,#1,#2,#3,#4,#5,#6\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish3\endcsname
+ #1,#2,#3,#4,#5,{,#1,#2,#3,#4,#5\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish4\endcsname
+ #1,#2,#3,#4,{,#1,#2,#3,#4\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish5\endcsname
+ #1,#2,#3,{,#1,#2,#3\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish6\endcsname
+ #1,#2,{,#1,#2\xint_Bye}%
+\expandafter\def\csname XINT_keep:x:csv_finish7\endcsname
+ #1,{,#1\xint_Bye}%
+\expandafter\let\csname XINT_keep:x:csv_finish8\endcsname\xint_Bye
\def\xintSeq::csv {\romannumeral0\xintseq::csv }%
\def\xintseq::csv #1#2%
{%
@@ -2537,7 +2647,7 @@
}%
\toks0 \expandafter{\the\toks0
\def\xintReverse:f:csv {~xintReverse:f:csv }%
- \def\xintListSel:f:csv {~xintListSel:f:csv }%
+ \def\xintListSel:x:csv {~xintListSel:f:csv }%
}%
\odef\XINT_expr_redefinemacros {\the\toks0}% Not \edef ! (subtle)
\def\XINT_expr_redefineprints
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintfrac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintfrac.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintfrac.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintfrac: Expandable operations on fractions
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2016/12/13 1.2i Expandable operations on fractions (JFB)]%
+ [2016/12/22 1.2j Expandable operations on fractions (JFB)]%
\def\XINT_cntSgnFork #1%
{%
\ifcase #1\expandafter\xint_secondofthree
@@ -86,12 +86,11 @@
\def\XINT_flen #1#2#3%
{%
\expandafter\space
- \the\numexpr \XINT_abs#1+\xint_c_viii
- \XINT_length_loop
+ \the\numexpr \XINT_abs#1+\XINT_length_loop
#2#3\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-\xint_c_i
\relax
}%
\def\XINT_outfrac #1#2#3%
@@ -186,11 +185,11 @@
\def\XINT_frac_gen_Bd #1.#2e#3e#4\XINT_Z
{%
\expandafter\XINT_frac_gen_C\the\numexpr #3-%
- \numexpr\xint_c_ix\XINT_length_loop
+ \numexpr\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
~#2#1!%
}%
\def\XINT_frac_gen_C #1!#2.#3%
@@ -215,11 +214,11 @@
\def\XINT_frac_gen_Cc #1.#2~#3!#4e#5e#6\XINT_T
{%
\expandafter\XINT_frac_gen_F\the\numexpr #5-#2-%
- \numexpr\xint_c_ix\XINT_length_loop
+ \numexpr\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
\relax\expandafter~\romannumeral0\XINT_num_loop
#3\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\Z
@@ -772,11 +771,11 @@
{%
\expandafter\XINT_trunc_sp_Cc
\romannumeral0\expandafter\XINT_split_fromright_a
- \the\numexpr#3-\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr#3-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.#2\xint_bye2345678\xint_bye..#1%
}%
\def\XINT_trunc_sp_Cc #1%
@@ -1792,11 +1791,11 @@
\def\XINT_float_Sb #1#2\Z #3#4%
{%
\expandafter\XINT_float_T
- \the\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye-#4.%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
{#2}#1{#3}{#4}%
}%
\def\XINT_float_T #1.%
@@ -1916,11 +1915,11 @@
\def\XINT_infloat_Sb #1#2\Z #3#4%
{%
\expandafter\XINT_infloat_T
- \the\numexpr\xint_c_ix\XINT_length_loop
+ \the\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye-#4.%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
{#2}#1{#3}%
}%
\def\XINT_infloat_T #1.%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintgcd.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintgcd.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintgcd.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintgcd: Euclidean algorithm with xint package
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintgcd}%
- [2016/12/13 1.2i Euclide algorithm with xint package (JFB)]%
+ [2016/12/22 1.2j Euclide algorithm with xint package (JFB)]%
\def\xintGCD {\romannumeral0\xintgcd }%
\def\xintgcd #1%
{%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintkernel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintkernel.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintkernel.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintkernel: Paraphernalia for the xint packages
%% ---------------------------------------------------------------
@@ -156,7 +156,7 @@
\fi
\XINT_providespackage
\ProvidesPackage {xintkernel}%
- [2016/12/13 1.2i Paraphernalia for the xint packages (JFB)]%
+ [2016/12/22 1.2j Paraphernalia for the xint packages (JFB)]%
\chardef\xint_c_ 0
\chardef\xint_c_i 1
\chardef\xint_c_ii 2
@@ -279,22 +279,22 @@
\long\edef\xintlength #1%
{%
\noexpand\expandafter\space
- \noexpand\the\numexpr\xint_c_ix\noexpand\XINT_length_loop
+ \noexpand\the\numexpr\noexpand\XINT_length_loop
#1\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\noexpand\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\noexpand\xint_bye
\relax
}%
\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
- +\xint_c_ix\XINT_length_loop
+ \xint_c_ix+\XINT_length_loop
}%
-\def\XINT_length_finish_a\xint_relax+\xint_c_ix\XINT_length_loop
+\def\XINT_length_finish_a\xint_relax\xint_c_ix+\XINT_length_loop
#1#2#3#4#5#6#7#8#9%
{%
- -#9\xint_bye
+ #9\xint_bye
}%
\def\xintLastItem {\romannumeral0\xintlastitem }%
\long\def\xintlastitem #1%
@@ -324,38 +324,35 @@
{%
\expandafter\XINT_lengthupto_loop
\the\numexpr#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
}%
-\def\XINT_lengthupto_loop #1%
+\def\XINT_lengthupto_loop_a #1%
{%
- \xint_UDsignfork #1\XINT_lengthupto_gt-{\XINT_lengthupto_loop_a#1}\krof
+ \xint_UDsignfork
+ #1\XINT_lengthupto_gt
+ -\XINT_lengthupto_loop
+ \krof #1%
}%
-\long\def\XINT_lengthupto_gt #1\xint_bye{-0}%
-\long\def\XINT_lengthupto_loop_a #1.#2#3#4#5#6#7#8#9%
+\long\def\XINT_lengthupto_gt #1\xint_bye.{-0}%
+\long\def\XINT_lengthupto_loop #1.#2#3#4#5#6#7#8#9%
{%
\xint_gob_til_xint_relax #9\XINT_lengthupto_finish_a\xint_relax
- \expandafter\XINT_lengthupto_loop\the\numexpr #1-\xint_c_viii.%
+ \expandafter\XINT_lengthupto_loop_a\the\numexpr #1-\xint_c_viii.%
}%
-\def\XINT_lengthupto_finish_a\xint_relax\expandafter\XINT_lengthupto_loop
- \the\numexpr #1-\xint_c_viii.#2\xint_bye
+\def\XINT_lengthupto_finish_a\xint_relax\expandafter\XINT_lengthupto_loop_a
+ \the\numexpr #1-\xint_c_viii.#2#3#4#5#6#7#8#9%
{%
- \XINT_lengthupto_finish_b #2\W\W\W\W\W\W\W\Z {#1}%
+ \expandafter\XINT_lengthupto_finish_b\the\numexpr #1-#9\xint_bye
}%
-\def\XINT_lengthupto_finish_b #1#2#3#4#5#6#7#8\Z
+\def\XINT_lengthupto_finish_b #1#2.%
{%
- \xint_gob_til_W
- #1\XINT_lengthupto_finish_c \xint_c_
- #2\XINT_lengthupto_finish_c \xint_c_i
- #3\XINT_lengthupto_finish_c \xint_c_ii
- #4\XINT_lengthupto_finish_c \xint_c_iii
- #5\XINT_lengthupto_finish_c \xint_c_iv
- #6\XINT_lengthupto_finish_c \xint_c_v
- #7\XINT_lengthupto_finish_c \xint_c_vi
- \W\XINT_lengthupto_finish_c \xint_c_vii\Z
+ \xint_UDsignfork
+ #1{-0}%
+ -{ #1#2}%
+ \krof
}%
-\def\XINT_lengthupto_finish_c #1#2\Z #3%
- {\ifnum #1>#3 \xint_dothis{-0}\fi
- \xint_orthat{\expandafter\space\the\numexpr#3-#1\relax}}%
\def\xintreplicate#1%
{\expandafter\XINT_replicate\the\numexpr#1\endcsname}%
\def\XINT_replicate #1{\xint_UDsignfork
Modified: trunk/Master/texmf-dist/tex/generic/xint/xintseries.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xintseries.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xintseries.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xintseries: Expandable partial sums with xint package
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintseries}%
- [2016/12/13 1.2i Expandable partial sums with xint package (JFB)]%
+ [2016/12/22 1.2j Expandable partial sums with xint package (JFB)]%
\def\xintSeries {\romannumeral0\xintseries }%
\def\xintseries #1#2%
{%
Modified: trunk/Master/texmf-dist/tex/generic/xint/xinttools.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/xint/xinttools.sty 2016-12-23 23:05:18 UTC (rev 42781)
+++ trunk/Master/texmf-dist/tex/generic/xint/xinttools.sty 2016-12-23 23:05:36 UTC (rev 42782)
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xinttools: Expandable and non-expandable utilities
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xinttools}%
- [2016/12/13 1.2i Expandable and non-expandable utilities (JFB)]%
+ [2016/12/22 1.2j Expandable and non-expandable utilities (JFB)]%
\newtoks\XINT_toks
\xint_firstofone{\let\XINT_sptoken= } %<- space here!
\def\xintgodef {\global\xintodef }%
@@ -242,21 +242,21 @@
0-{\XINT_nthelt_pos #1}%
\krof
}%
-\def\XINT_nthelt_zero .{\xintlength }%
+\def\XINT_nthelt_zero #1.{\xintlength }%
\long\def\XINT_nthelt_neg #1.#2%
{%
- \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_x\XINT_length_loop
+ \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_i+\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
-#1.#2\xint_bye
}%
\def\XINT_nthelt_neg_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_byeandstop
- 0#1\xint_byeandstop
+ #1-\xint_bye_thenstop
+ 0#1\xint_bye_thenstop
0-{}%
\krof
\expandafter\XINT_nthelt_neg_b
@@ -265,30 +265,16 @@
\long\def\XINT_nthelt_neg_b #1#2\xint_bye{ #1}%
\long\def\XINT_nthelt_pos #1.#2%
{%
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_ix-#1.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \expandafter\XINT_nthelt_pos_done
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_x.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\def\XINT_nthelt_loop #1%
-{%
- \xint_UDsignfork
- #1\XINT_nthelt_loop_a
- -{\XINT_nthelt_getit #1}%
- \krof
-}%
-\long\def\XINT_nthelt_loop_a #1.#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_xint_relax #9\xint_byeandstop\xint_relax
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_viii-#1.%
-}%
-\def\XINT_nthelt_getit #1.%
-{%
- \expandafter\expandafter\expandafter\XINT_nthelt_finish
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
-}%
-\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}%
+\def\XINT_nthelt_pos_done #1{%
+\long\def\XINT_nthelt_pos_done ##1##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\expandafter#1\xint_gobble_ii\xint_relax#1##1}%
+}\XINT_nthelt_pos_done{ }%
\def\xintKeep {\romannumeral0\xintkeep }%
\def\xintKeepNoExpand {\romannumeral0\xintkeepnoexpand }%
\long\def\xintkeep #1#2{\expandafter\XINT_keep_a\the\numexpr #1\expandafter.%
@@ -306,11 +292,11 @@
\long\def\XINT_keep_neg #1.#2%
{%
\expandafter\XINT_keep_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye.#2%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.#2%
}%
\def\XINT_keep_neg_a #1%
{%
@@ -325,7 +311,9 @@
\expandafter\XINT_keep_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keep_loop #1#2.%
@@ -375,7 +363,9 @@
\expandafter\XINT_keepunbr_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keepunbr_loop #1#2.%
@@ -422,11 +412,11 @@
\long\def\XINT_trim_neg #1.#2%
{%
\expandafter\XINT_trim_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trim_neg_a #1%
@@ -439,29 +429,30 @@
\edef\XINT_trim_trimall {\noexpand\expandafter\space\noexpand\xint_bye}%
\long\def\XINT_trim_pos #1.#2%
{%
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \expandafter\XINT_trim_pos_done\expandafter\space
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\def\XINT_trim_loop #1%
+\def\XINT_trim_loop #1#2.%
{%
- \xint_UDsignfork
- #1\XINT_trim_finish
- -\XINT_trim_loop_a
- \krof #1%
+ \xint_gob_til_minus#1\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr#1#2\XINT_trim_loop_trimnine
}%
-\long\def\XINT_trim_loop_a #1.#2#3#4#5#6#7#8#9%
+\long\def\XINT_trim_loop_trimnine #1#2#3#4#5#6#7#8#9%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_trim_toofew\xint_relax-\xint_c_ix.%
}%
-\def\XINT_trim_finish -#1.%
+\def\XINT_trim_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim_finish#1{%
+\def\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr-##1\XINT_trim_loop_trimnine
{%
- \expandafter\expandafter\expandafter\XINT_trim_finish_a
- \expandafter\expandafter\expandafter\space
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
-}%
-\long\def\XINT_trim_finish_a #1\xint_relax #2\xint_bye {#1}%
+ \expandafter\expandafter\expandafter#1%
+ \csname xint_gobble_\romannumeral\numexpr\xint_c_ix-##1\endcsname
+}}\XINT_trim_finish{ }%
+\long\def\XINT_trim_pos_done #1\xint_relax #2\xint_bye {#1}%
\def\xintTrimUnbraced {\romannumeral0\xinttrimunbraced }%
\def\xintTrimUnbracedNoExpand {\romannumeral0\xinttrimunbracednoexpand }%
\long\def\xinttrimunbraced #1#2%
@@ -480,11 +471,11 @@
\long\def\XINT_trimunbr_neg #1.#2%
{%
\expandafter\XINT_trimunbr_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trimunbr_neg_a #1%
@@ -1120,200 +1111,286 @@
}%
}%
\let\xintDigitsOf\xintAssignArray
-\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
-\def\xinttrim:f:csv #1#2%
+\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv}%
+\def\xintlength:f:csv #1%
+{\long\def\xintlength:f:csv ##1{%
+ \expandafter#1\the\numexpr\expandafter\XINT_length:f:csv_a
+ \romannumeral`&&@##1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ \relax
+}}\xintlength:f:csv { }%
+\long\def\XINT_length:f:csv_a #1%
{%
- \expandafter\XINT_trim:f:csv_a\the\numexpr #1\expandafter.%
- \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \xint_gob_til_xint_relax #1\xint_c_\xint_bye\xint_relax
+ \XINT_length:f:csv_loop #1%
}%
-\def\XINT_trim:f:csv_a #1%
+\long\def\XINT_length:f:csv_loop #1,#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_UDzerominusfork
- #1-{\XINT_trim:f:csv_zero }%
- 0#1{\XINT_trim:f:csv_neg }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
- \krof
+ \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish\xint_relax
+ \xint_c_ix+\XINT_length:f:csv_loop
}%
-\def\XINT_trim:f:csv_zero .#1\xint_relax #2\xint_bye{ #1}%
-\def\XINT_trim:f:csv_neg #1.#2\xint_relax%
+\def\XINT_length:f:csv_finish\xint_relax\xint_c_ix+\XINT_length:f:csv_loop
+ #1,#2,#3,#4,#5,#6,#7,#8,#9,{#9\xint_bye}%
+\def\xintLengthUpTo:f:csv {\romannumeral0\xintlengthupto:f:csv}%
+\long\def\xintlengthupto:f:csv #1#2%
{%
- \expandafter\XINT_trim:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_a
+ \the\numexpr#1\expandafter.%
+ \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
}%
-\def\XINT_trim:f:csv_neg_b #1%
+\long\def\XINT_lengthupto:f:csv_a #1.#2%
{%
- \xint_UDzerominusfork
- #1-{\expandafter\space\xint_bye }%
- 0#1{\expandafter\space\xint_bye }%
- 0-{\XINT_keep:f:csv_pos #1}%
- \krof
+ \xint_gob_til_xint_relax #2\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2%
}%
-\def\XINT_trim:f:csv_loop_a #1.%
+\def\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2\xint_bye.{ #1}%
+\def\XINT_lengthupto:f:csv_loop_a #1%
{%
- \ifnum #1>\xint_c_vii
- \expandafter\XINT_trim:f:csv_loop_b
- \else
- \expandafter\XINT_trim:f:csv_finish
- \fi
- #1.%
+ \xint_UDsignfork
+ #1\XINT_lengthupto:f:csv_gt
+ -\XINT_lengthupto:f:csv_loop_b
+ \krof #1%
}%
-\def\XINT_trim:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_lengthupto:f:csv_gt #1\xint_bye.{-0}%
+\long\def\XINT_lengthupto:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
}%
-\def\XINT_trim:f:csv_finish #1.%
+\def\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a
+ \the\numexpr #1-\xint_c_viii.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \expandafter\XINT_trim:f:csv_finish_a
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral#1\endcsname
+ \expandafter\XINT_lengthupto:f:csv_finish_b\the\numexpr #1-#9\xint_bye
}%
-\def\xint_gobble:csv_ {}%
-\def\xint_gobble:csv_i #1,{}%
-\def\xint_gobble:csv_ii #1,#2,{}%
-\def\xint_gobble:csv_iii #1,#2,#3,{}%
-\def\xint_gobble:csv_iv #1,#2,#3,#4,{}%
-\def\xint_gobble:csv_v #1,#2,#3,#4,#5,{}%
-\def\xint_gobble:csv_vi #1,#2,#3,#4,#5,#6,{}%
-\def\xint_gobble:csv_vii #1,#2,#3,#4,#5,#6,#7,{}%
-\def\XINT_trim:f:csv_finish_a #1\xint_relax #2\xint_bye { #1}%
+\def\XINT_lengthupto:f:csv_finish_b #1#2.%
+{%
+ \xint_UDsignfork
+ #1{-0}%
+ -{ #1#2}%
+ \krof
+}%
\def\xintKeep:f:csv {\romannumeral0\xintkeep:f:csv }%
-\def\xintkeep:f:csv #1#2%
+\long\def\xintkeep:f:csv #1#2%
{%
- \expandafter\XINT_keep:f:csv_a\the\numexpr #1\expandafter.%
- \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_keep:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
\def\XINT_keep:f:csv_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_bye_thenstop
+ #1-\XINT_keep:f:csv_keepnone
0#1\XINT_keep:f:csv_neg
0-{\XINT_keep:f:csv_pos #1}%
\krof
}%
-\def\XINT_keep:f:csv_neg #1.#2\xint_relax%
+\long\def\XINT_keep:f:csv_keepnone .#1{,}%
+\long\def\XINT_keep:f:csv_neg #1.#2%
{%
- \expandafter\XINT_keep:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \expandafter\XINT_keep:f:csv_neg_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .#2\xint_bye
}%
-\def\XINT_keep:f:csv_neg_b #1%
+\def\XINT_keep:f:csv_neg_a #1%
{%
- \xint_UDzerominusfork
- #1-{\XINT_keep:f:csv_all }%
- 0#1{\XINT_keep:f:csv_all }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+}%
+ -\XINT_keep:f:csv_keepall
\krof
}%
-\def\XINT_keep:f:csv_all #1.#2\xint_relax #3\xint_bye { #2}%
-\def\XINT_keep:f:csv_pos #1.{\expandafter\xint_gobble_thenstop
- \romannumeral`&&@\XINT_keep:f:csv_loop_a #1.{}}%
-\def\XINT_keep:f:csv_loop_a #1.%
+\def\XINT_keep:f:csv_keepall #1.{ }%
+\long\def\XINT_keep:f:csv_neg_done #1\xint_bye{#1}%
+\def\XINT_keep:f:csv_trimloop #1#2.%
{%
- \ifnum #1>\xint_c_vi
- \expandafter\XINT_keep:f:csv_loop_b
- \else
- \expandafter\XINT_keep:f:csv_finish
- \fi
- #1.%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr#1#2-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
}%
-\def\XINT_keep:f:csv_loop_b #1.#2#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_keep:f:csv_trimloop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,{}%
+\def\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr-#1-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
+ {\csname XINT_trim:f:csv_finish#1\endcsname}%
+\long\def\XINT_keep:f:csv_pos #1.#2%
{%
- \xint_gob_til_xint_relax #9\XINT_keep:f:csv_enda\xint_relax
- \expandafter\XINT_keep:f:csv_loop_c\the\numexpr #1-\xint_c_vii.%
- {,#3,#4,#5,#6,#7,#8,#9}{#2}%
+ \expandafter\XINT_keep:f:csv_pos_fork
+ \romannumeral0\XINT_lengthupto:f:csv_a
+ #1.#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
+ .#1.{}#2\xint_bye%
}%
-\def\XINT_keep:f:csv_loop_c #1.#2#3{\XINT_keep:f:csv_loop_a #1.{#3#2}}%
-\def\XINT_keep:f:csv_enda #1.#2#3#4\xint_bye
+\def\XINT_keep:f:csv_pos_fork #1#2.%
{%
- \XINT_keep:f:csv_endb #2\xint_bye {#3}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_keep:f:csv_pos_keepall
+ \krof
}%
-\def\XINT_keep:f:csv_endb #1\xint_relax #2\xint_bye #3{ #3#1}%
-\def\XINT_keep:f:csv_finish #1.#2#3,#4,#5,#6,#7,#8,#9\xint_bye
+\long\def\XINT_keep:f:csv_pos_keepall #1.#2#3\xint_bye{,#3}%
+\def\XINT_keep:f:csv_loop #1#2.%
{%
- \csname XINT_keep:f:csv_finish_\romannumeral#1\endcsname
- ,#3,#4,#5,#6,#7,#8,\Z {#2}%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_loop_end-%
+ \expandafter\XINT_keep:f:csv_loop
+ \the\numexpr#1#2-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
}%
-\def\XINT_keep:f:csv_finish_ #1\Z #2{#2}%
-\def\XINT_keep:f:csv_finish_i ,#1,#2\Z
- {\XINT_keep:f:csv_finish_f ,#1\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_ii ,#1,#2,#3\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iii ,#1,#2,#3,#4\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iv ,#1,#2,#3,#4,#5\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_v ,#1,#2,#3,#4,#5,#6\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_vi ,#1,#2,#3,#4,#5,#6,#7\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5,#6\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_f #1\xint_relax #2\Z #3{#3#1}%
-\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
-\def\xintntheltpy:f:csv #1{\expandafter\XINT_ntheltpy:f:csv\the\numexpr #1.}%
-\def\XINT_ntheltpy:f:csv #1%
+\long\def\XINT_keep:f:csv_loop_pickeight
+ #1#2,#3,#4,#5,#6,#7,#8,#9,{{#1,#2,#3,#4,#5,#6,#7,#8,#9}}%
+\def\XINT_keep:f:csv_loop_end-\expandafter\XINT_keep:f:csv_loop
+ \the\numexpr-#1-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
+ {\csname XINT_keep:f:csv_end#1\endcsname}%
+\long\expandafter\def\csname XINT_keep:f:csv_end1\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8,#9\xint_bye {#1,#2,#3,#4,#5,#6,#7,#8}%
+\long\expandafter\def\csname XINT_keep:f:csv_end2\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8\xint_bye {#1,#2,#3,#4,#5,#6,#7}%
+\long\expandafter\def\csname XINT_keep:f:csv_end3\endcsname
+ #1#2,#3,#4,#5,#6,#7\xint_bye {#1,#2,#3,#4,#5,#6}%
+\long\expandafter\def\csname XINT_keep:f:csv_end4\endcsname
+ #1#2,#3,#4,#5,#6\xint_bye {#1,#2,#3,#4,#5}%
+\long\expandafter\def\csname XINT_keep:f:csv_end5\endcsname
+ #1#2,#3,#4,#5\xint_bye {#1,#2,#3,#4}%
+\long\expandafter\def\csname XINT_keep:f:csv_end6\endcsname
+ #1#2,#3,#4\xint_bye {#1,#2,#3}%
+\long\expandafter\def\csname XINT_keep:f:csv_end7\endcsname
+ #1#2,#3\xint_bye {#1,#2}%
+\long\expandafter\def\csname XINT_keep:f:csv_end8\endcsname
+ #1#2\xint_bye {#1}%
+\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
+\long\def\xinttrim:f:csv #1#2%
{%
- \xint_UDsignfork
- #1{\XINT_nthelt:f:csv_neg }%
- -{\XINT_nthelt:f:csv_pos #1}%
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_trim:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
+}%
+\def\XINT_trim:f:csv_a #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_trim:f:csv_trimnone
+ 0#1\XINT_trim:f:csv_neg
+ 0-{\XINT_trim:f:csv_pos #1}%
\krof
}%
-\long\def\XINT_nthelt:f:csv_neg #1.#2%
+\long\def\XINT_trim:f:csv_trimnone .#1{,#1}%
+\long\def\XINT_trim:f:csv_neg #1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_neg_a
- \the\numexpr\expandafter\XINT_length:f:csv_a\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1+\xint_c_i\expandafter.\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\XINT_trim:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .{}#2\xint_bye
}%
-\def\XINT_nthelt:f:csv_neg_a #1%
+\def\XINT_trim:f:csv_neg_a #1%
{%
- \xint_UDzerominusfork
- #1-\xint_bye_thenstop
- 0#1\xint_bye_thenstop
- 0-{\XINT_nthelt:f:csv_loop_a #1}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_trim:f:csv_trimall
\krof
}%
-\long\def\XINT_nthelt:f:csv_pos #1.#2%
+\def\XINT_trim:f:csv_trimall {\expandafter,\xint_bye}%
+\long\def\XINT_trim:f:csv_pos #1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1+\xint_c_i\expandafter.%
- \romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\XINT_trim:f:csv_pos_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax\xint_bye
}%
-\def\XINT_nthelt:f:csv_loop_a #1.%
+\def\XINT_trim:f:csv_loop #1#2.%
{%
- \ifnum #1>\xint_c_viii
- \expandafter\XINT_nthelt:f:csv_loop_b
- \else
- \expandafter\XINT_nthelt:f:csv_getit
- \fi #1.%
+ \xint_gob_til_minus#1\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1#2\XINT_trim:f:csv_loop_trimnine
}%
-\long\def\XINT_nthelt:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_trim:f:csv_loop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_gob_til_xint_relax #9\XINT_nthelt:f:csv_none\xint_relax
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_trim:f:csv_toofew\xint_relax-\xint_c_ix.%
}%
-\def\XINT_nthelt:f:csv_getit #1.%
+\def\XINT_trim:f:csv_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr-#1\XINT_trim:f:csv_loop_trimnine
{%
- \expandafter\XINT_nthelt:f:csv_finish
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral
- \numexpr#1-\xint_c_i\endcsname
+ \csname XINT_trim:f:csv_finish#1\endcsname
}%
-\def\XINT_nthelt:f:csv_finish #1,#2\xint_bye
+\long\expandafter\def\csname XINT_trim:f:csv_finish1\endcsname
+ #1,#2,#3,#4,#5,#6,#7,#8,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish2\endcsname
+ #1,#2,#3,#4,#5,#6,#7,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish3\endcsname
+ #1,#2,#3,#4,#5,#6,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish4\endcsname
+ #1,#2,#3,#4,#5,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish5\endcsname
+ #1,#2,#3,#4,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish6\endcsname
+ #1,#2,#3,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish7\endcsname
+ #1,#2,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish8\endcsname
+ #1,{ }%
+\expandafter\let\csname XINT_trim:f:csv_finish9\endcsname\space
+\long\def\XINT_trim:f:csv_pos_done #1\xint_relax #2\xint_bye{#1}%
+\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
+\long\def\xintntheltpy:f:csv #1#2%
{%
- \XINT_nthelt:f:csv_finishb #1\xint_relax\xint_bye
+ \expandafter\XINT_nthelt:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
-\def\XINT_nthelt:f:csv_finishb #1\xint_relax #2\xint_bye { #1}%
+\def\XINT_nthelt:f:csv_a #1%
+{%
+ \xint_UDsignfork
+ #1\XINT_nthelt:f:csv_neg
+ -\XINT_nthelt:f:csv_pos
+ \krof #1%
+}%
+\long\def\XINT_nthelt:f:csv_neg -#1.#2%
+{%
+ \expandafter\XINT_nthelt:f:csv_neg_fork
+ \the\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ -#1.#2,\xint_bye
+}%
+\def\XINT_nthelt:f:csv_neg_fork #1%
+{%
+ \if#1-\expandafter\xint_bye_thenstop\fi
+ \expandafter\XINT_nthelt:f:csv_neg_done
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+#1%
+}%
+\long\def\XINT_nthelt:f:csv_neg_done#1,#2\xint_bye{ #1}%
+\long\def\XINT_nthelt:f:csv_pos #1.#2%
+{%
+ \expandafter\XINT_nthelt:f:csv_pos_done
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+}%
+\def\XINT_nthelt:f:csv_pos_done #1{%
+\long\def\XINT_nthelt:f:csv_pos_done ##1,##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\XINT_nthelt:f:csv_pos_cleanup\xint_relax#1##1}%
+}\XINT_nthelt:f:csv_pos_done{ }%
+\xint_firstofone{\long\def\XINT_nthelt:f:csv_pos_cleanup\xint_relax} %
+ #1\xint_relax{ #1}%
\def\xintReverse:f:csv {\romannumeral0\xintreverse:f:csv }%
-\def\xintreverse:f:csv #1%
+\long\def\xintreverse:f:csv #1%
{%
\expandafter\XINT_reverse:f:csv_loop
\expandafter{\expandafter}\romannumeral`&&@#1,%
@@ -1322,58 +1399,21 @@
\xint_bye,\xint_bye,\xint_bye,\xint_bye,%
\xint_relax
}%
-\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
{%
\xint_bye #9\XINT_reverse:f:csv_cleanup\xint_bye
\XINT_reverse:f:csv_loop {,#9,#8,#7,#6,#5,#4,#3,#2#1}%
}%
-\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
+\long\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
{%
\XINT_reverse:f:csv_finish #1%
}%
-\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
-\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv }%
-\def\xintlength:f:csv #1%
-{%
- \expandafter\XINT_length:f:csv_a
- \romannumeral`&&@#1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
-}%
-\def\XINT_length:f:csv_a #1%
-{%
- \xint_gob_til_xint_relax #1\XINT_length:f:csv_empty\xint_relax
- \XINT_length:f:csv_loop 0.#1%
-}%
-\def\XINT_length:f:csv_empty #1\xint_bye { 0}%
-\def\XINT_length:f:csv_loop #1.#2,#3,#4,#5,#6,#7,#8,#9,%
-{%
- \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.%
-}%
-\def\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.#2\xint_bye
-{%
- \XINT_length:f:csv_finish_b #2\W,\W,\W,\W,\W,\W,\W,\Z {#1}%
-}%
-\def\XINT_length:f:csv_finish_b #1,#2,#3,#4,#5,#6,#7,#8\Z
-{%
- \xint_gob_til_W
- #1\XINT_length:f:csv_finish_c \xint_c_i
- #2\XINT_length:f:csv_finish_c \xint_c_ii
- #3\XINT_length:f:csv_finish_c \xint_c_iii
- #4\XINT_length:f:csv_finish_c \xint_c_iv
- #5\XINT_length:f:csv_finish_c \xint_c_v
- #6\XINT_length:f:csv_finish_c \xint_c_vi
- #7\XINT_length:f:csv_finish_c \xint_c_vii
- \W\XINT_length:f:csv_finish_c \xint_c_viii\Z
-}%
-\edef\XINT_length:f:csv_finish_c #1#2\Z #3%
- {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
+\long\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
+\let\xintCSVLength \xintLength:f:csv
+\let\xintCSVKeep \xintKeep:f:csv
\let\xintCSVTrim \xintTrim:f:csv
-\let\xintCSVKeep \xintKeep:f:csv
\let\xintCSVNthEltPy \xintNthEltPy:f:csv
\let\xintCSVReverse \xintReverse:f:csv
-\let\xintCSVLength \xintLength:f:csv
\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
\endinput
More information about the tex-live-commits
mailing list