diff options
Diffstat (limited to 'Master')
19 files changed, 5387 insertions, 4448 deletions
diff --git a/Master/texmf-dist/doc/generic/xint/CHANGES.html b/Master/texmf-dist/doc/generic/xint/CHANGES.html index 11c78b02b26..7f7fa5793ca 100644 --- a/Master/texmf-dist/doc/generic/xint/CHANGES.html +++ b/Master/texmf-dist/doc/generic/xint/CHANGES.html @@ -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.2n" /> + <meta name="author" content="xint 1.2o" /> <title>CHANGE LOG</title> <style type="text/css">code{white-space: pre;}</style> <style type="text/css"> @@ -17,17 +17,21 @@ <body> <div id="header"> <h1 class="title">CHANGE LOG</h1> -<h2 class="author">xint 1.2n</h2> -<h3 class="date">2017/08/06</h3> +<h2 class="author">xint 1.2o</h2> +<h3 class="date">2017/08/29</h3> </div> <div id="TOC"> <ul> -<li><a href="#n-20170806"><code>1.2n (2017/08/06)</code></a><ul> +<li><a href="#o-20170829"><code>1.2o (2017/08/29)</code></a><ul> <li><a href="#incompatible-changes">Incompatible changes</a></li> +<li><a href="#deprecated">Deprecated</a></li> +</ul></li> +<li><a href="#n-20170806"><code>1.2n (2017/08/06)</code></a><ul> +<li><a href="#incompatible-changes-1">Incompatible changes</a></li> <li><a href="#improvements-and-new-features">Improvements and new features</a></li> </ul></li> <li><a href="#m-20170731"><code>1.2m (2017/07/31)</code></a><ul> -<li><a href="#incompatible-changes-1">Incompatible changes</a></li> +<li><a href="#incompatible-changes-2">Incompatible changes</a></li> <li><a href="#improvements-and-new-features-1">Improvements and new features</a></li> <li><a href="#bug-fixes">Bug fixes</a></li> </ul></li> @@ -37,7 +41,7 @@ <li><a href="#bug-fixes-1">Bug fixes</a></li> </ul></li> <li><a href="#k-20170106"><code>1.2k (2017/01/06)</code></a><ul> -<li><a href="#incompatible-changes-2">Incompatible changes</a></li> +<li><a href="#incompatible-changes-3">Incompatible changes</a></li> <li><a href="#improvements-and-new-features-3">Improvements and new features</a></li> <li><a href="#bug-fixes-2">Bug fixes</a></li> </ul></li> @@ -46,7 +50,7 @@ <li><a href="#bug-fixes-3">Bug fixes</a></li> </ul></li> <li><a href="#i-20161213"><code>1.2i (2016/12/13)</code></a><ul> -<li><a href="#incompatible-changes-3">Incompatible changes</a></li> +<li><a href="#incompatible-changes-4">Incompatible changes</a></li> <li><a href="#removed-1">Removed</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> @@ -56,11 +60,11 @@ <li><a href="#bug-fixes-5">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-4">Incompatible changes</a></li> +<li><a href="#incompatible-changes-5">Incompatible changes</a></li> <li><a href="#improvements-and-new-features-7">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-5">Incompatible changes</a></li> +<li><a href="#incompatible-changes-6">Incompatible changes</a></li> <li><a href="#improvements-and-new-features-8">Improvements and new features</a></li> <li><a href="#bug-fixes-6">Bug fixes</a></li> </ul></li> @@ -91,9 +95,9 @@ <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><ul> -<li><a href="#incompatible-changes-6">Incompatible changes</a></li> +<li><a href="#incompatible-changes-7">Incompatible changes</a></li> <li><a href="#removed-3">Removed</a></li> -<li><a href="#deprecated">Deprecated</a></li> +<li><a href="#deprecated-1">Deprecated</a></li> <li><a href="#improvements-and-new-features-14">Improvements and new features</a></li> <li><a href="#bug-fixes-12">Bug fixes</a></li> </ul></li> @@ -123,13 +127,29 @@ <li><a href="#section-8"><code>1.0 (2013/03/28)</code></a></li> </ul> </div> -<pre><code>Source: xint.dtx 1.2n 2017/08/06 (doc 2017/08/06) +<pre><code>Source: xint.dtx 1.2o 2017/08/29 (doc 2017/08/29) Author: Jean-Francois Burnol Info: Expandable operations on big integers, decimals, fractions License: LPPL 1.3c</code></pre> -<h2 id="n-20170806"><code>1.2n (2017/08/06)</code></h2> +<h2 id="o-20170829"><code>1.2o (2017/08/29)</code></h2> <h3 id="incompatible-changes">Incompatible changes</h3> <ul> +<li><strong>xint</strong>: <code>\xintAND</code>, <code>\xintOR</code>, ... and similar Boolean logic macros do not apply anymore <code>\xintNum</code> (or <code>\xintRaw</code> if <strong>xintfrac</strong> is loaded), to their arguments (often, from internal usage of <code>\xintSgn</code>), but only f-expand them (using e.g. <code>\xintiiSgn</code>). This is kept un-modified even if loading <strong>xintfrac</strong>.</li> +</ul> +<h3 id="deprecated">Deprecated</h3> +<p>Deprecated macros raise an error but, generally, then expand as in former releases. They will all get removed at some future release.</p> +<ul> +<li><p><strong>xintcore</strong>: <code>\xintiOpp</code>, <code>\xintiAbs</code>, <code>\xintiAdd</code>, <code>\xintiSub</code>, <code>\xintiMul</code>, <code>\xintiDivision</code>, <code>\xintiQuo</code>, <code>\xintiRem</code>, <code>\xintiDivRound</code>, <code>\xintiDivTrunc</code>, <code>\xintiMod</code>, <code>\xintiSqr</code>, <code>\xintiPow</code>, and <code>\xintiFac</code> are deprecated. Only the <code>ii</code>-named variants get defined.</p></li> +<li><p><strong>xintcore</strong>: <code>\xintCmp</code> and <code>\xintSgn</code> are deprecated from <strong>xintcore</strong> (which only defines <code>\xintiiCmp</code> and <code>\xintiiSgn</code>) as they actually belong to <strong>xintfrac</strong>.</p></li> +<li><p><strong>xintcore</strong>: <code>\xintiiFDg</code>, resp. <code>\xintiiLDg</code>, are renamed <code>\xintFDg</code>, resp. <code>\xintLDg</code>. Former denominations are deprecated.</p></li> +<li><p><strong>xint</strong>: <code>\xintMON</code>, <code>\xintMMON</code>, <code>\xintiMax</code>, <code>\xintiMin</code>, <code>\xintiMaxof</code>, <code>\xintiMinof</code>, <code>\xintiSquareRoot</code>, <code>\xintiSqrt</code>, <code>\xintiSqrtR</code>, <code>\xintiBinomial</code>, and <code>\xintiPFactorial</code> are deprecated. Only <code>ii</code>-named variants get defined.</p></li> +<li><p><strong>xint</strong>: <code>\xintEq</code>, <code>\xintGeq</code>, <code>\xintGt</code>, <code>\xintLt</code>, <code>\xintGtorEq</code>, <code>\xintLtorEq</code>, <code>\xintIsZero</code>, <code>\xintIsNotZero</code>, <code>\xintIsOne</code>, <code>\xintOdd</code>, <code>\xintEven</code>, <code>\xintifSgn</code>, <code>\xintifCmp</code>, <code>\xintifEq</code>, <code>\xintifGt</code>, <code>\xintifLt</code>, <code>\xintifZero</code>, <code>\xintifNotZero</code>, <code>\xintifOne</code>, <code>\xintifOdd</code>, are deprecated. These macros belong to <strong>xintfrac</strong>. Package <strong>xint</strong> defines only the <code>ii</code>-named variants.</p></li> +<li><p><strong>xint</strong>: <code>\xintNeq</code> was renamed to <code>\xintNotEq</code> which however is only provided by <strong>xintfrac</strong>. Package <strong>xint</strong> defines <code>\xintiiNotEq</code>, and <code>\xintNeq</code> is deprecated.</p></li> +<li><p><strong>xint</strong>: <code>\xintNot</code> was renamed to <code>\xintNOT</code>, former denomination is deprecated. See also item about Boolean logic macros in the <em>Incompatible Changes</em> section.</p></li> +</ul> +<h2 id="n-20170806"><code>1.2n (2017/08/06)</code></h2> +<h3 id="incompatible-changes-1">Incompatible changes</h3> +<ul> <li><strong>xintbinhex</strong> does not load package <strong>xintcore</strong> anymore, but only <strong>xintkernel</strong>.</li> </ul> <h3 id="improvements-and-new-features">Improvements and new features</h3> @@ -138,7 +158,7 @@ License: LPPL 1.3c</code></pre> <li><p>Macros of <strong>xintbinhex</strong> have been improved for speed and increased maximal sizes of allowable inputs.</p></li> </ul> <h2 id="m-20170731"><code>1.2m (2017/07/31)</code></h2> -<h3 id="incompatible-changes-1">Incompatible changes</h3> +<h3 id="incompatible-changes-2">Incompatible changes</h3> <ul> <li><p><strong>xintbinhex</strong>: the length of the input is now limited. The maximum size depends on the macro and ranges from about <code>4000</code> to about <code>19900</code> digits.</p></li> <li><p><strong>xintbinhex</strong>: <code>\xintCHexToBin</code> is now the variant of <code>\xintHexToBin</code> which does not remove leading binary zeroes: <code>N</code> hex-digits give on output exactly <code>4N</code> binary digits.</p></li> @@ -174,7 +194,7 @@ License: LPPL 1.3c</code></pre> <li><p><strong>xintfrac</strong>: the manual said one could use directly <code>\numexpr</code> compatible expressions in arithmetic macros (without even a <code>\numexpr</code> encapsulation) if they were expressed with up to 8 tokens. There was a bug if these 8 tokens evaluated to zero. The bug has been fixed, and up to 9 tokens are now accepted. But it is simpler to use <code>\the\numexpr</code> prefix and not to worry about the token count... The ending <code>\relax</code> is now un-needed.</p></li> </ul> <h2 id="k-20170106"><code>1.2k (2017/01/06)</code></h2> -<h3 id="incompatible-changes-2">Incompatible changes</h3> +<h3 id="incompatible-changes-3">Incompatible changes</h3> <ul> <li><p>macro <code>\xintFloat</code> which rounds its input to a floating point number does <em>not</em> print anymore <code>10.0...0eN</code> to signal an upwards rounding to the next power of ten. The mantissa has in all cases except the zero input exactly one digit before the decimal mark.</p></li> <li><p>some floating point computations may differ in the least significant digits, due to a change in the rounding algorithm applied to macro arguments expressed as fractions and to an improvement in precision regarding half-integer powers in expressions. See next.</p></li> @@ -207,7 +227,7 @@ License: LPPL 1.3c</code></pre> <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-3">Incompatible changes</h3> +<h3 id="incompatible-changes-4">Incompatible changes</h3> <ul> <li><code>\xintDecSplit</code> second argument must have no sign (former code replaced it with its absolute value, a sign now may cause an error.)</li> </ul> @@ -252,7 +272,7 @@ License: LPPL 1.3c</code></pre> <li><p>the <code>add</code> and <code>mul</code> from <strong>xintexpr</strong>, which work with dummy variables since <code>1.1</code>, raised an error since <code>1.2c 2015/11/16</code> when the dummy variable was given an empty range (or list) of values, rather than producing respectively <code>0</code> and <code>1</code> as formerly.</p></li> </ul> <h2 id="g-20160319"><code>1.2g (2016/03/19)</code></h2> -<h3 id="incompatible-changes-4">Incompatible changes</h3> +<h3 id="incompatible-changes-5">Incompatible changes</h3> <ul> <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> @@ -266,7 +286,7 @@ License: LPPL 1.3c</code></pre> <li><p>the syntax of expressions is described in a devoted chapter of the documentation; an example shows how to implement (expandably) the Brent-Salamin algorithm for computation of Pi using <code>iter</code> in a float expression.</p></li> </ul> <h2 id="f-20160312"><code>1.2f (2016/03/12)</code></h2> -<h3 id="incompatible-changes-5">Incompatible changes</h3> +<h3 id="incompatible-changes-6">Incompatible changes</h3> <ul> <li>no more <code>\xintFac</code> macro but <code>\xintiFac/\xintiiFac/\xintFloatFac</code>.</li> </ul> @@ -380,7 +400,7 @@ License: LPPL 1.3c</code></pre> <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> -<h3 id="incompatible-changes-6">Incompatible changes</h3> +<h3 id="incompatible-changes-7">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> @@ -393,7 +413,7 @@ License: LPPL 1.3c</code></pre> <ul> <li><code>\xintnumexpr</code>, <code>\xintthenumexpr</code>, <code>\xintNewNumExpr</code>: use <code>\xintiexpr</code>, <code>\xinttheiexpr</code>, <code>\xintNewIExpr</code>.</li> </ul> -<h3 id="deprecated">Deprecated</h3> +<h3 id="deprecated-1">Deprecated</h3> <ul> <li><p><code>\xintDivision</code>, <code>\xintQuo</code>, <code>\xintRem</code>: use <code>\xintiDivision</code>, <code>\xintiQuo</code>, <code>\xintiRem</code>.</p></li> <li><p><code>\xintMax</code>, <code>\xintMin</code>, <code>\xintAdd</code>, <code>\xintSub</code>, <code>\xintMul</code> (<strong>xint</strong>): their usage without <strong>xintfrac</strong> is deprecated; use <code>\xintiMax</code>, <code>\xintiMin</code>, <code>\xintiAdd</code>, <code>\xintiSub</code>, <code>\xintiMul</code>.</p></li> diff --git a/Master/texmf-dist/doc/generic/xint/CHANGES.pdf b/Master/texmf-dist/doc/generic/xint/CHANGES.pdf Binary files differindex 2ffcb4c891e..79381e562df 100644 --- a/Master/texmf-dist/doc/generic/xint/CHANGES.pdf +++ b/Master/texmf-dist/doc/generic/xint/CHANGES.pdf diff --git a/Master/texmf-dist/doc/generic/xint/README b/Master/texmf-dist/doc/generic/xint/README index 77813b160d3..9abb2375991 100644 --- a/Master/texmf-dist/doc/generic/xint/README +++ b/Master/texmf-dist/doc/generic/xint/README @@ -1,4 +1,4 @@ - Source: xint.dtx 1.2n 2017/08/06 (doc 2017/08/06) + Source: xint.dtx 1.2o 2017/08/29 (doc 2017/08/29) Author: Jean-Francois Burnol Info: Expandable operations on big integers, decimals, fractions License: LPPL 1.3c diff --git a/Master/texmf-dist/doc/generic/xint/README.html b/Master/texmf-dist/doc/generic/xint/README.html index 0017483bd48..0ee1c1c1f1b 100644 --- a/Master/texmf-dist/doc/generic/xint/README.html +++ b/Master/texmf-dist/doc/generic/xint/README.html @@ -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.2n" /> + <meta name="author" content="xint 1.2o" /> <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.2n</h2> -<h3 class="date">2017/08/06</h3> +<h2 class="author">xint 1.2o</h2> +<h3 class="date">2017/08/29</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.2n 2017/08/06 (doc 2017/08/06) +<pre><code>Source: xint.dtx 1.2o 2017/08/29 (doc 2017/08/29) Author: Jean-Francois Burnol Info: Expandable operations on big integers, decimals, fractions License: LPPL 1.3c</code></pre> diff --git a/Master/texmf-dist/doc/generic/xint/README.pdf b/Master/texmf-dist/doc/generic/xint/README.pdf Binary files differindex c32514301bb..20fed3d9031 100644 --- a/Master/texmf-dist/doc/generic/xint/README.pdf +++ b/Master/texmf-dist/doc/generic/xint/README.pdf diff --git a/Master/texmf-dist/doc/generic/xint/sourcexint.pdf b/Master/texmf-dist/doc/generic/xint/sourcexint.pdf Binary files differindex dfac0804176..5a9060341fa 100644 --- a/Master/texmf-dist/doc/generic/xint/sourcexint.pdf +++ b/Master/texmf-dist/doc/generic/xint/sourcexint.pdf diff --git a/Master/texmf-dist/doc/generic/xint/xint.pdf b/Master/texmf-dist/doc/generic/xint/xint.pdf Binary files differindex 05f09d2145f..fb94ba53a37 100644 --- a/Master/texmf-dist/doc/generic/xint/xint.pdf +++ b/Master/texmf-dist/doc/generic/xint/xint.pdf diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx index 24d5b76835c..9237f390b12 100644 --- a/Master/texmf-dist/source/generic/xint/xint.dtx +++ b/Master/texmf-dist/source/generic/xint/xint.dtx @@ -3,27 +3,27 @@ % Extract all files via "etex xint.dtx" and do "make help" % or follow instructions from extracted README.md. %<*dtx> -\def\xintdtxtimestamp {Time-stamp: <06-08-2017 at 23:22:42 CEST>} +\def\xintdtxtimestamp {Time-stamp: <29-08-2017 at 22:20:23 CEST>} %</dtx> %<*drv> %% --------------------------------------------------------------- -\def\xintdocdate {2017/08/06} -\def\xintbndldate{2017/08/06} -\def\xintbndlversion {1.2n} +\def\xintdocdate {2017/08/29} +\def\xintbndldate{2017/08/29} +\def\xintbndlversion {1.2o} %</drv> %<readme>% README %<changes>% CHANGE LOG -%<readme|changes>% xint 1.2n -%<readme|changes>% 2017/08/06 +%<readme|changes>% xint 1.2o +%<readme|changes>% 2017/08/29 %<readme|changes> -%<readme|changes> Source: xint.dtx 1.2n 2017/08/06 (doc 2017/08/06) +%<readme|changes> Source: xint.dtx 1.2o 2017/08/29 (doc 2017/08/29) %<readme|changes> Author: Jean-Francois Burnol %<readme|changes> Info: Expandable operations on big integers, decimals, fractions %<readme|changes> License: LPPL 1.3c %<readme|changes> %<*!readme&!changes&!dohtmlsh&!dopdfsh&!makefile> %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %<xintkernel>%% xintkernel: Paraphernalia for the xint packages %<xinttools>%% xinttools: Expandable and non-expandable utilities @@ -250,6 +250,56 @@ Makefile.mk.</div> %</readme>-------------------------------------------------------- %<*changes>------------------------------------------------------- +`1.2o (2017/08/29)` +---- + +### Incompatible changes + + - **xint**: `\xintAND`, `\xintOR`, ... and similar Boolean logic macros do + not apply anymore `\xintNum` (or `\xintRaw` if **xintfrac** is loaded), to + their arguments (often, from internal usage of `\xintSgn`), but only + f-expand them (using e.g. `\xintiiSgn`). This is kept un-modified even if + loading **xintfrac**. + +### Deprecated + +Deprecated macros raise an error but, generally, then expand as in former +releases. They will all get removed at some future release. + + - **xintcore**: `\xintiOpp`, `\xintiAbs`, `\xintiAdd`, `\xintiSub`, + `\xintiMul`, `\xintiDivision`, `\xintiQuo`, `\xintiRem`, `\xintiDivRound`, + `\xintiDivTrunc`, `\xintiMod`, `\xintiSqr`, `\xintiPow`, and `\xintiFac` + are deprecated. Only the `ii`-named variants get defined. + + - **xintcore**: `\xintCmp` and `\xintSgn` are deprecated from **xintcore** + (which only defines `\xintiiCmp` and `\xintiiSgn`) as they actually belong + to **xintfrac**. + + - **xintcore**: `\xintiiFDg`, resp. `\xintiiLDg`, are renamed `\xintFDg`, + resp. `\xintLDg`. Former denominations are deprecated. + + - **xint**: `\xintMON`, `\xintMMON`, `\xintiMax`, + `\xintiMin`, `\xintiMaxof`, `\xintiMinof`, `\xintiSquareRoot`, + `\xintiSqrt`, `\xintiSqrtR`, `\xintiBinomial`, and `\xintiPFactorial` are + deprecated. Only `ii`-named variants get defined. + + - **xint**: `\xintEq`, `\xintGeq`, `\xintGt`, `\xintLt`, `\xintGtorEq`, + `\xintLtorEq`, `\xintIsZero`, `\xintIsNotZero`, `\xintIsOne`, + `\xintOdd`, `\xintEven`, `\xintifSgn`, + `\xintifCmp`, `\xintifEq`, `\xintifGt`, `\xintifLt`, `\xintifZero`, + `\xintifNotZero`, `\xintifOne`, `\xintifOdd`, are deprecated. These macros + belong to **xintfrac**. Package **xint** defines only the `ii`-named + variants. + + - **xint**: `\xintNeq` was renamed to `\xintNotEq` which however is only + provided by **xintfrac**. Package **xint** defines `\xintiiNotEq`, and + `\xintNeq` is deprecated. + + - **xint**: `\xintNot` was renamed to `\xintNOT`, former denomination is + deprecated. See also item about Boolean logic macros in the *Incompatible + Changes* section. + + `1.2n (2017/08/06)` ---- @@ -456,6 +506,7 @@ Makefile.mk.</div> cases.) The test files existed but were not executed prior to release. Automation in progress. + `1.2i (2016/12/13)` ---- @@ -519,6 +570,7 @@ Makefile.mk.</div> - `\xintDecSplitL` and `\xintDecSplitR` from **xint** produced their output in a spurious brace pair (bug introduced in `1.2f`). + `1.2h (2016/11/20)` ---- @@ -554,6 +606,7 @@ Makefile.mk.</div> 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)` ---- @@ -595,6 +648,7 @@ Makefile.mk.</div> Brent-Salamin algorithm for computation of Pi using `iter` in a float expression. + `1.2f (2016/03/12)` ---- @@ -660,6 +714,7 @@ Makefile.mk.</div> - the comparison operators were not recognized by `\xintNewIIExpr` and `\xintdefiifunc` constructs. + `1.2e (2015/11/22)` ---- @@ -688,6 +743,7 @@ Makefile.mk.</div> multiplication was not yet always done with enhanced precedence. Now yes. + `1.2d (2015/11/18)` ---- @@ -727,6 +783,7 @@ Makefile.mk.</div> subtraction (happened when 00000001 was found under certain circumstances at certain mod 8 locations). + `1.2b (2015/10/29)` ---- @@ -758,6 +815,7 @@ Makefile.mk.</div> parsing of decimal numbers and as a result `\xinttheexpr 0.01\relax` expanded to `0` ! (sigh...) + `1.2 (2015/10/10)` ---- @@ -816,6 +874,7 @@ Makefile.mk.</div> - an effort at randomly shuffling around various pieces of the documentation has been done. + `1.1c (2015/09/12)` ---- @@ -827,6 +886,7 @@ Makefile.mk.</div> regarding the source code formatting in `sourcexint.pdf`, and minor issues in `Makefile.mk`. + `1.1b (2015/08/31)` ---- @@ -838,6 +898,7 @@ Makefile.mk.</div> - Slight enhancements to the documentation, particularly in the `Read this first` section. + `1.1a (2014/11/07)` ---- @@ -865,6 +926,7 @@ Makefile.mk.</div> of clean up of the code comments. Improved `\Factors` example of nested `subs`, `rseq`, `iter` in `\xintiiexpr`. + `1.1 (2014/10/28)` ---- @@ -1048,6 +1110,7 @@ Makefile.mk.</div> - the `\XINTinFloatPrd:csv` macro name had a typo, hence `prd` was non-functional in `\xintfloatexpr`. + `1.09n (2014/04/01)` ---- @@ -1060,6 +1123,7 @@ Makefile.mk.</div> introduced in `1.09i` of `2013/12/18` and showed up when the index `N` was larger than the number of elements of the list). + `1.09m (2014/02/26)` ---- @@ -1074,6 +1138,7 @@ Makefile.mk.</div> assume that the coefficients of the generalized continued fraction are numeric quantities. Some other minor changes. + `1.09kb (2014/02/13)` ---- @@ -1088,6 +1153,7 @@ Makefile.mk.</div> * bug fix (**xinttools**): `\xintSeq` from `1.09k` needed a `\chardef` which was missing from `xinttools.sty`, it was in `xint.sty`. + `1.09k (2014/01/21)` ---- @@ -1105,6 +1171,7 @@ Makefile.mk.</div> * bug fix (**xinttools**, **xint**, ...): forgotten catcode check of `"` at loading time has been added. + `1.09j (2014/01/09)` ---- @@ -1148,6 +1215,7 @@ Makefile.mk.</div> * bug fix: the `1.09i` `xint.ins` file produced a buggy `xint.tex` file. + `1.09i (2013/12/18)` ---- @@ -1204,6 +1272,7 @@ Makefile.mk.</div> * *deprecated*: `\xintifTrueFalse`, `\xintifTrue`; use `\xintifTrueAelseB`. + `1.09h (2013/11/28)` ---- @@ -1234,6 +1303,7 @@ Makefile.mk.</div> * all macros of **xinttools** for which it makes sense are now declared `\long`. + `1.09g (2013/11/22)` ---- @@ -1246,6 +1316,7 @@ Makefile.mk.</div> * bugfix: `\xintFor` and `\xintFor*` do not modify anymore the value of `\count 255`. + `1.09f (2013/11/04)` ---- @@ -1275,6 +1346,7 @@ Makefile.mk.</div> when working only with (big) integers and not fractions or decimal numbers. + `1.09e (2013/10/29)` ---- @@ -1302,6 +1374,7 @@ Makefile.mk.</div> * the documentation explains with more details various expansion related issues, particularly in relation to conditionals. + `1.09d (2013/10/22)` ---- @@ -1316,6 +1389,7 @@ Makefile.mk.</div> * same bug fix for `\xintApplyInline`. + `1.09c (2013/10/09)` ---- @@ -1346,6 +1420,7 @@ Makefile.mk.</div> * again various improvements and changes in the documentation. + `1.09b (2013/10/03)` ---- @@ -1363,6 +1438,7 @@ Makefile.mk.</div> math mode; i.e. a `\xintRaw` which does not print the denominator if it is one. + `1.09a (2013/09/24)` ---- @@ -1408,6 +1484,7 @@ Makefile.mk.</div> * a bug (**xintfrac**) introduced in `1.08b` made `\xintCmp` crash when one of its arguments was zero. `:-((` + `1.08b (2013/06/14)` ---- @@ -1421,6 +1498,7 @@ Makefile.mk.</div> registers may be directly used in arguments to the macros of **xintfrac**. + `1.08a (2013/06/11)` ---- @@ -1435,6 +1513,7 @@ Makefile.mk.</div> * Macros for floating point numbers added to the **xintseries** package. + `1.08 (2013/06/07)` ---- @@ -1445,6 +1524,7 @@ Makefile.mk.</div> * new package **xintbinhex** providing *conversion routines* to and from binary and hexadecimal bases. + `1.07 (2013/05/25)` ---- @@ -1484,12 +1564,14 @@ Makefile.mk.</div> [^1]: but values higher than 100 or 200 will presumably give too slow evaluations. + `1.06b (2013/05/14)` ---- * Minor code and documentation improvements. Everywhere in the source code, a more modern underscore has replaced the @ sign. + `1.06 (2013/05/07)` ---- @@ -1505,11 +1587,13 @@ evaluations. inserted inside a `\numexpr..\relax`, hence completely expanded, one may use count registers, even infix arithmetic operations, etc... + `1.05 (2013/05/01)` ---- Minor changes and additions to **xintfrac** and **xintcfrac**. + `1.04 (2013/04/25)` ---- @@ -1528,6 +1612,7 @@ deal with the *denominator buildup* plague. * `tex xint.dtx` extracts style files (no need for a `xint.ins`). + `1.03 (2013/04/14)` ---- @@ -1539,6 +1624,7 @@ ordering of the arguments is chosen automatically). * added illustration of Machin algorithm to the documentation. + `1.0 (2013/03/28)` ---- @@ -2503,6 +2589,14 @@ pdfpagemode=UseOutlines} \vtop{\noindent Changed (#1)}\ }}% \vskip\dp\strutbox }\strut\@esphack} +\def\DEPRECATED #1{\@bsphack + \vadjust{\vskip-\dp\strutbox + \smash{\hbox to 0pt {\hss\color[named]{PineGreen}% + \normalfont\small + \hsize 2cm\rightskip.5cm minus.5cm + \vtop{\noindent Deprecated! (#1)}\ }}% + \vskip\dp\strutbox }\strut\@esphack} + \def\CHANGEDf #1{\@bsphack \vadjust{\vskip-\dp\strutbox \smash{\hbox to 0pt {\hss\color[named]{PineGreen}% @@ -3002,7 +3096,11 @@ pdfpagemode=UseOutlines} \leftmarginiv \leftmarginii \parindent\dimexpr2\fontcharwd\font`X\relax \leftmargin\leftmargini % pourquoi pas 0? - \edef\everbatimindent{\the\dimexpr\leftmargini\relax\space }% +% formerly everbatim indent was set to leftmargingi, reduce it (2017/08/26) +% \edef\everbatimindent{\the\dimexpr\leftmargini\relax\space }% +% setting it to \parindent does not work with \everb construct +% \def\everbatimindent{\parindent}% + \edef\everbatimindent{\the\dimexpr2\fontcharwd\font`X\relax\space}% \cftsubsecnumwidth 2\leftmarginii \cftsubsubsecnumwidth 2\leftmargini \cftsubsecindent 0pt @@ -3607,7 +3705,7 @@ not have been obtained in reduced terms: \end{framed} Make sure to read \autoref{sec:expr}, \autoref{sec:xintexprsyntax} and -\autoref{ssec:outputformat}. +\autoref{ssec:outputs}. \subsection{Printing big numbers on the page}\label{ssec:printnumber} When producing very long numbers there is the question of printing them on @@ -3624,7 +3722,7 @@ When producing very long numbers there is the question of printing them on It may be used like this: % -\leftedline{|\printnumber {\xintiiQuo{\xintiiPow {2}{1000}}{\xintiFac{100}}}|} +\leftedline{|\printnumber {\xintiiQuo{\xintiiPow {2}{1000}}{\xintiiFac{100}}}|} % or as |\printnumber\mybiginteger| or |\printnumber{\mybiginteger}| if |\mybiginteger| was previously defined via a |\newcommand|, a |\def| or @@ -3738,14 +3836,14 @@ with floating point numbers. \everb|@ \xintAssign \xintBezout {\xinttheiiexpr 7^200-3^200\relax} {\xinttheiiexpr 2^200-1\relax}\to\A\B\U\V\D -$\U\times(7^{200}-3^{200})+\xintiOpp\V\times(2^{200}-1)=\D$ +$\U\times(7^{200}-3^{200})+\xintiiOpp\V\times(2^{200}-1)=\D$ | \xintAssign \xintBezout {\xinttheiiexpr 7^200-3^200\relax}% {\xinttheiiexpr 2^200-1\relax}\to\A\B\U\V\D \dtt {\printnumber\U$\times(7^{200}-3^{200})+{}$% - \printnumber{\xintiOpp\V}$\times(2^{200}-1)={}$\printnumber\D} + \printnumber{\xintiiOpp\V}$\times(2^{200}-1)={}$\printnumber\D} \item The Euclide algorithm applied to \np{22206980239027589097} and \np{8169486210102119257}: (with \xintgcdname)% @@ -3829,7 +3927,7 @@ We have already mentioned % is $\Temp$. -\edef\x{\xintiiQuo{\xintiiPow {2}{1000}}{\xintiFac{100}}} +\edef\x{\xintiiQuo{\xintiiPow {2}{1000}}{\xintiiFac{100}}} \edef\y{\xintLen{\x}} \item As an example of nesting package macros, let us consider the following @@ -3837,13 +3935,13 @@ code snippet within a file with filename |myfile.tex|: \everb|@ \newwrite\outstream \immediate\openout\outstream \jobname-out\relax -\immediate\write\outstream {\xintiiQuo{\xintiiPow{2}{1000}}{\xintiFac{100}}} +\immediate\write\outstream {\xintiiQuo{\xintiiPow{2}{1000}}{\xintiiFac{100}}} % \immediate\closeout\outstream | \noindent The tex run creates a file |myfile-out.tex|, and then writes to it the quotient from the euclidean division of $2^{1000}$ by $100!$. The number of -digits is |\xintLen{\xintiiQuo{\xintiiPow{2}{1000}}{\xintiFac{100}}}| which +digits is |\xintLen{\xintiiQuo{\xintiiPow{2}{1000}}{\xintiiFac{100}}}| which expands (in two steps) and tells us that $[2^{1000}/100!]$ has \dtt{\y} digits. This is not so many, let us print them here: \dtt{\printnumber\x}.% @@ -3947,10 +4045,21 @@ This is release \expandafter|\xintbndlversion| of \expandafter|\xintbndldate|. -The macros of \xintbinhexname for conversion routines between binary, decimal, -and hexadecimal bases have been entirely re-written. They are faster, the more -so for long inputs. But they have the drawback of now limiting their input to -a maximal length of a few thousands characters. +|1.2o| does mass-deprecation of those macros which were so far defined by +\xintcorename/\xintname to use automatically \csbxint{Num}; users of +\xintfracname (or a fortiori \xintexprname) will see almost nothing of this, +as \xintfracname does the proper definitions. See +\autoref{ssec:coredeprecated}, \autoref{ssec:xintdeprecated}, and +\autoref{ssec:xintdeprecatedNum} for details. + +|1.2n| removed the \xintbinhexname dependency upon \xintcorename: it now loads +only \xintkernelname. + +At |1.2m| (again at |1.2n|) the macros of \xintbinhexname for conversion +routines between binary, decimal, and hexadecimal bases have been entirely +re-written. They are faster, the more so for long inputs. But they have the +drawback of now limiting their input to a maximal length of a few thousands +characters. Since |1.2l|, the underscore |_| is accepted inside the expression parsers as an ignored digit separator\footnote{The space character has already always been accepted @@ -3966,15 +4075,13 @@ from \xintfracname or \xintname though, only in expressions from \xintexprname. Macro usage with non properly terminated inputs such as -|\xintiiAdd{\the\numexpr1}{2}| caused crashes. This has been fixed: the +|\xintiiAdd{\the\numexpr1}{2}| caused crashes. This has been fixed at |1.2l|: the arithmetic macros of \xintcorename, the macros of \xintfracname, those of \xintgcdname, have been made robust against such inputs. Some routines of \xintcorename principally destined to internal usage such as \csbxint{Inc} remain incompatible though (to avoid adding some overhead; check |sourcexint.pdf| for details). -Some refactoring took place at |1.2l| in the sources of \xintcorename for some -efficiency gains, and improvements in the code comments. See |CHANGES.html| or |CHANGES.pdf| for more information (either |texdoc --list xint| or on the internet via @@ -4145,7 +4252,7 @@ when using variables. - \myitem{9} The power operator |^|, or equvalently |**|. It is left + \myitem{9} The power operator |^|, or equivalently |**|. It is left associative: {\restoreMicroFont|\xinttheiexpr 2^2^3\relax|} evaluates to \xinttheiexpr 2^2^3\relax, not \xinttheiexpr 2^(2^3)\relax. See \csbxint{FloatPower} for additional information. @@ -5735,17 +5842,17 @@ generate the list via iterated full expansion. \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {30}{59}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }\vrule \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {60}{89}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }\vrule \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {90}{119}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }}% % \centeredline{Some Fibonacci numbers together with their residues modulo @@ -5761,17 +5868,17 @@ generate the list via iterated full expansion. \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {30}{59}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }\vrule \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {60}{89}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }\vrule \vbox{\halign{\bfseries#.\hfil&#\hfil &\hfil #\cr \xintFor* #1 in {\FibonacciSeq {90}{119}}\do {\theindex &\xintthe#1 & - \xintiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% + \xintiiRem{\xintthe#1}{\xintthe\Fibxxx}\stepcounter{index}\cr }}% }% | \endgroup @@ -6130,7 +6237,7 @@ margin annotation next to the description of the arguments. will indeed absorb the \csa{else} or closing \csa{fi}, else some error will arise in further processing. Therefore it is highly recommended to use the package provided conditionals such as \csbxint{ifEq}, \csbxint{ifGt}, - \csbxint{ifSgn}, \csbxint{ifOdd}\dots, or, for \LaTeX{} users and when dealing + \csbxint{ifSgn},\dots\ or, for \LaTeX{} users and when dealing with short integers the \href{http://www.ctan.org/pkg/etoolbox}{etoolbox}% % @@ -6154,9 +6261,8 @@ margin annotation next to the description of the arguments. \item after the definition |\def\x {12}|, one can not use {\color{blue}|-\x|} as input to one of the package macros: the \fexpan sion will act only on the minus sign, hence do nothing. The only way is to use the - \csbxint{Opp} macro, or perhaps here rather \csbxint{iOpp} which does - maintains integer format on output, as they replace a number with - its opposite. + \csbxint{Opp} macro (or \csbxint{iiOpp} which is integer only) + which obtains the opposite of a given number. \begingroup\slshape Again, this is otherwise inside an \csbxint{theexpr}-ession or @@ -6224,15 +6330,28 @@ steps. \end{enumerate} -\subsection {Input formats for macros}\label{sec:inputs} +\subsection {Input formats for macros}\label{ssec:inputs} -Macros can have different types of arguments. In the description of the macro, -a margin annotation signals what is the argument type. +Macros can have different types of arguments (we do not consider here the +\csbxint{expr}-parsers but only the macros of +\xintcorename/\xintname/\xintfracname). In a macro description, a +margin annotation signals what is the argument type. \begin{enumerate} \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. + hence may be count registers or variables. Beware that |-(1+1)| is not legal + and raises an error, but |0-(1+1)| is. Also |2\cnta| with |\cnta| a |\count| + isn't legal. Integers must be kept less than \dtt{\number "7FFFFFFF} in + absolute value, although the \emph{scaling} operation |(a*b)/c| computes the + intermediate product with twice as many bits. + + The slash |/| does a \fbox{rounded} division which is a fact of life of + |\numexpr| which I have found very annoying in at least nine cases out of + ten, not to say ninety-nine cases out of one hundred. Besides, it is at odds + with \TeX's |\divide| which does a truncated division (non-expandably). + + But to follow-suit |/| also does rounded integer division in + \csbxint{iiexpr}|..\relax|, and the operator |//| does there the truncated + division. \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 @@ -6244,9 +6363,14 @@ a margin annotation signals what is the argument type. \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. + digits. With \xintfracname loaded, \csbxint{Num} is extended to + accept fractions and its action is to truncate them to integers. + + At |1.2o|\CHANGEDf{1.2o} many macros from \xintcorename/\xintname which + use \csbxint{Num} to parse their arguments got deprecated, see + \autoref{ssec:coredeprecated}, \autoref{ssec:xintdeprecated}, and + \autoref{ssec:xintdeprecatedNum}. + \item the fraction input format\ntype{\Ff} applies to the arguments of \xintfracname macros handling genuine fractions. It allows two types @@ -6306,7 +6430,7 @@ macros, there are some cases where spaces could break havoc.% be certain of all possibilities after |1.2| release. One thing to be aware of is that \csa{numexpr} stops on spaces between digits (although it provokes an expansion to see if an infix operator follows); the exponent for - \csbxint{iiPow} or the argument of the factorial \csbxint{iFac} are only + \csbxint{iiPow} or the argument of the factorial \csbxint{iiFac} are only subjected to such a \csa{numexpr} (there are a few other macros with such input types in \xintname). If the input is given as, say |1 2\x| where \csa{x} is a macro, the macro \csa{x} will not be expanded by the @@ -6343,23 +6467,19 @@ signaled in the margin with notations \`a la \LaTeX3. \subsection{Output formats of macros} -\label{ssec:outputformat} +\label{ssec:outputs} -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{There are further cases like \csbxint{iiDivision} which outputs a - token list of two braced items.} +We do not consider here the \csbxint{expr}-parsers but only the macros from \xintcorename, \xintname and \xintfracname. Macros of other +components of the bundle may have their own output formats, for example for +continuous fractions with \xintcfracname. +There are mainly three types of outputs:% \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 +\item arithmetic macros from \xintcorename/\xintname deliver integers + in the strict format as described in the previous section. +\item arithmetic 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, |B| is 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 @@ -6380,10 +6500,6 @@ trimmed. There is one exceptional case: Future versions of the package may modify this. \end{itemize} -Breaking change:\CHANGED{1.2k} releases earlier than |1.2k| used -|10.0...0eN| when the rounding went upwards to the next power of ten, thus -the output had a mantissa with |P+1| digits rather than |P| in these -exceptional cases. See the documentation of \csbxint{Float}. \subsection{Count registers and variables}\label{sec:useofcount} @@ -6659,15 +6775,13 @@ the \xintname bundle expandable macros, or when building up a completely expandable macro of one's own, one needs some \TeX nical expertise (see also \autoref{fn:expansions} on page~\pageref{fn:expansions}). -It is thus much to be recommended to opt rather for already existing expandable -branching macros, such as the ones which are provided by -\xintname/\xintfracname: among them -\csbxint{SgnFork}, \csbxint{ifSgn}, \csbxint{ifZero}, \csbxint{ifOne}, -\csbxint{ifNotZero}, \csbxint{ifTrueAelseB}, \csbxint{ifCmp}, \csbxint{ifGt}, -\csbxint{ifLt}, \csbxint{ifEq}, \csbxint{ifOdd}, and \csbxint{ifInt}. See their -respective documentations. All these conditionals always have either two or -three branches, and empty brace pairs |{}| for unused branches should not be -forgotten. +It is thus much to be recommended to use the expandable branching macros, +provided by \xintfracname succh as \csbxint{ifSgn}, \csbxint{ifZero}, +\csbxint{ifOne}, \csbxint{ifNotZero}, \csbxint{ifTrueAelseB}, \csbxint{ifCmp}, +\csbxint{ifGt}, \csbxint{ifLt}, \csbxint{ifEq}, +\csbxint{ifInt}... See their respective documentations. All these conditionals +always have either two or three branches, and empty brace pairs |{}| for +unused branches should not be forgotten. If these tests are to be applied to standard \TeX{} short integers, it is more efficient to use (under \LaTeX{}) the equivalent conditional tests from the @@ -6796,12 +6910,12 @@ I have no answer: it made definitely sense at the start of \xintname (see Here is a list of imaginable input errors. Some will cause compilation errors, others are more annoying as they may pass through unsignaled. \begin{itemize} -\item using |-| to prefix some macro: |-\xintiSqr{35}/271|.% +\item using |-| to prefix some macro: |-\xintiiSqr{35}/271|.% % \footnote{to the contrary, this \emph{is} allowed inside an |\xintexpr|-ession.} -\item using one pair of braces too many |\xintIrr{{\xintiPow {3}{13}}/243}| (the +\item using one pair of braces too many |\xintIrr{{\xintiiPow {3}{13}}/243}| (the computation goes through with no error signaled, but the result is completely wrong). \item things like |\xintiiAdd { \x}{\y}| as the space will cause \csa{x} to be @@ -6868,18 +6982,20 @@ control sequence) must be left undefined. I trust it will be |;-)|.% {\catcode`/ 11 \catcode`! 11 \catcode32 11 |\ ! /|} was chosen for its shortness.} +Deprecated macros also generate an (expandable) error message. Just hit the +|RETURN| key once to proceed.\IMPORTANT\ Most deprecated macros at |1.2o| are +listed either in \autoref{ssec:coredeprecated} or +\autoref{ssec:xintdeprecated} or \autoref{ssec:xintdeprecatedNum}. They will +get removed at some future release. Replace them with the correctly named ones +(possibly with additional usage of \csbxint{Num} if really needed); in most +cases loading \xintfracname resolves these deprecations from +\xintcorename/\xintname. The expression parsers are at |1.2l| still using a slightly less evolved method which lets \TeX{} display an undefined control sequence name giving some indication of the underlying problem (we copied this method from the |bigintcalc| package). The name of the control sequence is the message. -% The -% error is raised \emph{before} the end of the expansion so as to not disturb -% further processing of the token stream, after completion of the operation. -% Generally the problematic operation will output a zero. Possible such error -% message control sequences: - \begin{multicols}{2}\parskip0pt\relax \begin{everbatim} \xintError:ignored @@ -6892,35 +7008,6 @@ some indication of the underlying problem (we copied this method from the \end{multicols} -Some additional errors are raised when using deprecated macros (or trying to -invoke \csbxint{Add} with only \xintname.sty loaded for example.) -\begin{multicols}{2}\parskip0pt\relax -\begin{everbatim} -\Did_you_mean_iiAbs?or_load_xintfrac! -\Did_you_mean_iiOpp?or_load_xintfrac! -\Did_you_mean_iiAdd?or_load_xintfrac! -\Did_you_mean_iiSub?or_load_xintfrac! -\Did_you_mean_iiMul?or_load_xintfrac! -\Did_you_mean_iiPow?or_load_xintfrac! -\Did_you_mean_iiSqr?or_load_xintfrac! -\Did_you_mean_iiMax?or_load_xintfrac! -\Did_you_mean_iiMin?or_load_xintfrac! -\Did_you_mean_iMaxof?or_load_xintfrac! -\Did_you_mean_iMinof?or_load_xintfrac! -\Did_you_mean_iiSum?or_load_xintfrac! -\Did_you_mean_iiPrd?or_load_xintfrac! -\Removed!use_xintiQuo_or_xintiiQuo! -\Removed!use_xintiRem_or_xintiiRem! -\end{everbatim} -\end{multicols} - -For such type of error sequences one should set |\errorcontextlines| to at -least |2| to get from \LaTeX\ more context. Errors occuring during the parsing -of |\xintexpr-essions| try to provide helpful information about the offending -token. But for the newer |1.2l| type of expandable error messages it is -already ok with |\errorcontextlines| left at its \LaTeX\ default. Future -releases of \xintname will presumably use only the newer method. - Some constructs in \xintexprname-essions use delimited macros and there is thus possibility in case of an ill-formed expression to end up beyond the |\relax| end-marker. Such a situation can also occur from a non-terminated @@ -6955,7 +7042,7 @@ have any underscore in their names (for obscure legacy reasons). \xintkernelname provides \hyperref[odef]{|\odef|}, \hyperref[oodef]{|\oodef|}, \hyperref[fdef]{|\fdef|}: if macros with these names already exist -\xinttoolsname it will not overwrite them. The same meanings are independently +\xinttoolsname will not overwrite them. The same meanings are independently available under the names |\xintodef|, |\xintoodef|, etc... Apart from |\thexintexpr|, |\thexintiexpr|, ... @@ -7053,7 +7140,7 @@ the current common values of the input save stack and maximal expansion depth: $5000$ and $10000$ respectively. -\section{Some utilities from the \xinttoolsname package} +\section{Some utilities from the \xinttoolsname package}\label{sec:sometoolsutils} This is a first overview. Many examples combining these utilities with the arithmetic macros of \xintname are to be found in \autoref{sec:tools}. See @@ -7065,7 +7152,7 @@ also \autoref{sec:examples}. It might not be necessary to maintain at all times complete expandability. A devoted syntax is provided to make these things more efficient, for example when -using the \csbxint{iDivision} macro which computes both quotient and remainder +using the \csbxint{iiDivision} macro which computes both quotient and remainder at the same time: % @@ -7073,7 +7160,7 @@ the same time: |\xintiiDivision{\xintiiPow {2}{1000}}{\xintiiFac{100}}|\csbnolk{to}|\A\B|} % give: -\xintAssign\xintiiDivision{\xintiPow {2}{1000}}{\xintiiFac{100}}\to\A\B +\xintAssign\xintiiDivision{\xintiiPow {2}{1000}}{\xintiiFac{100}}\to\A\B |\meaning\A|\dtt{: \printnumber{\meaning\A}\relax} and |\meaning\B|\dtt{: \printnumber{\meaning\B}\relax}. % @@ -7086,7 +7173,7 @@ Another example (which uses \csbxint{Bezout} from the \xintgcdname package): is equivalent to setting |\A| to \dtt{\tmpA}, |\B| to \dtt{\tmpB}, |\U| to \dtt{\tmpU}, |\V| to \dtt{\tmpV}, and |\D| to \dtt{\tmpD}. And indeed \dtt{(\tmpU)$\times$\tmpA-(\tmpV)$\times$\tmpB$=$% - \xintiSub{\xintiMul\tmpU\tmpA}{\xintiMul\tmpV\tmpB}} is a Bezout Identity. + \xintiiSub{\xintiiMul\tmpU\tmpA}{\xintiiMul\tmpV\tmpB}} is a Bezout Identity. Thus, what |\xintAssign| does is to first apply an \hyperref[ssec:expansions]{\fexpan sion} to what comes next; it then defines one @@ -7106,16 +7193,14 @@ document) is not an opening brace |{|, |\xintAssign| consider that there is {\csbxint{Assign}|\xintBezout{3570902836026}{200467139463}|% \csbnolk{to}|\A\B\U\V\D|} \noindent -gives then |\U|\dtt{: - \printnumber\tmpU}, - |\V|\dtt{: - \printnumber\tmpV} and |\D|\dtt{=\tmpD}. +gives then |\U| with meaning \dtt{\tmpU}, + |\V| with meaning \dtt{\tmpV} and |\D| with meaning \dtt{\tmpD}. % In situations when one does not know in advance the number of items, one has \csbxint{AssignArray} or its synonym \csbxint{DigitsOf}: % -\leftedline{\csbxint{DigitsOf}|\xintiPow{2}{100}|\csbnolk{to}\csa{DIGITS}} +\leftedline{\csbxint{DigitsOf}|\xintiiPow{2}{100}|\csbnolk{to}\csa{DIGITS}} % This defines \csa{DIGITS} to be macro with one parameter, \csa{DIGITS}|{0}| gives the size |N| of the array and \csa{DIGITS}|{n}|, for |n| from |1| to |N| @@ -7131,16 +7216,16 @@ completely expanded and may be a count register, not necessarily prefixed by % \newcount\cnta % \newcount\cntb \begingroup -\xintDigitsOf\xintiPow{2}{100}\to\DIGITS +\xintDigitsOf\xintiiPow{2}{100}\to\DIGITS \cnta = 1 \cntb = 0 \loop -\advance \cntb \xintiSqr{\DIGITS{\cnta}} +\advance \cntb \xintiiSqr{\DIGITS{\cnta}} \ifnum \cnta < \DIGITS{0} \advance\cnta 1 \repeat -|2^{100}| (=\xintiPow {2}{100}) has \DIGITS{0} digits and the sum of their squares is \the\cntb. +|2^{100}| (=\xintiiPow {2}{100}) has \DIGITS{0} digits and the sum of their squares is \the\cntb. These digits are, from the least to the most significant: \cnta = \DIGITS{0} \loop \DIGITS{\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.\endgroup \end{everbatim*} @@ -7167,16 +7252,16 @@ first release, \csbxint{Apply} and \csbxint{ListWithSep} since |1.04|, As an example the following code uses only expandable operations: \begin{everbatim*} -$2^{100}$ (=\xintiPow {2}{100}) has \xintLen{\xintiPow {2}{100}} digits and the sum of their - squares is \xintiiSum{\xintApply {\xintiSqr}{\xintiPow {2}{100}}}. These digits are, from the - least to the most significant: \xintListWithSep {, }{\xintRev{\xintiPow {2}{100}}}. The thirteenth - most significant digit is \xintNthElt{13}{\xintiPow {2}{100}}. The seventh least significant one - is \xintNthElt{7}{\xintRev{\xintiPow {2}{100}}}. +$2^{100}$ (=\xintiiPow {2}{100}) has \xintLen{\xintiiPow {2}{100}} digits and the sum of their +squares is \xintiiSum{\xintApply {\xintiiSqr}{\xintiiPow {2}{100}}}. These digits are, from the +least to the most significant: \xintListWithSep {, }{\xintRev{\xintiiPow {2}{100}}}. The thirteenth +most significant digit is \xintNthElt{13}{\xintiiPow {2}{100}}. The seventh least significant one +is \xintNthElt{7}{\xintRev{\xintiiPow {2}{100}}}. \end{everbatim*} It would be more efficient to do once and for all -|\edef\z{\xintiPow {2}{100}}|, and then use |\z| in place of - |\xintiPow {2}{100}| everywhere as this would spare the CPU some repetitions. +|\edef\z{\xintiiPow {2}{100}}|, and then use |\z| in place of + |\xintiiPow {2}{100}| everywhere as this would spare the CPU some repetitions. Expandably computing primes is done in \autoref{xintSeq}. @@ -7197,7 +7282,7 @@ expandability. Check it out (\autoref{xintiloop} and also in next section). \section {Additional examples using \xinttoolsname or \xintexprname or both} \label{sec:examples} -Actually, recall that \xintexprname.sty automatically loads \xinttoolsname.sty. +Note: \xintexprname.sty automatically loads \xinttoolsname.sty. \subsection{Completely expandable prime test} \label{ssec:primesI} @@ -7207,20 +7292,20 @@ given input is prime and $0$ if not: \everb|@ \def\remainder #1#2{\the\numexpr #1-(#1/#2)*#2\relax } \def\IsPrime #1% - {\xintANDof {\xintApply {\remainder {#1}}{\xintSeq {2}{\xintiSqrt{#1}}}}} + {\xintANDof {\xintApply {\remainder {#1}}{\xintSeq {2}{\xintiiSqrt{#1}}}}} | -This uses \csbxint{iSqrt} and assumes its input is at least $5$. Rather than -\xintname's own \csbxint{iRem} we used a quicker |\numexpr| expression as we +This uses \csbxint{iiSqrt} and assumes its input is at least $5$. Rather than +\xintname's own \csbxint{iiRem} we used a quicker |\numexpr| expression as we are dealing with short integers. Also we used \csbxint{ANDof} which will return $1$ only if all the items are non-zero. The macro is a bit silly with an even input, ok, let's enhance it to detect an even input: \everb|@ \def\IsPrime #1% - {\xintifOdd {#1} + {\xintiiifOdd {#1} {\xintANDof % odd case {\xintApply {\remainder {#1}} - {\xintSeq [2]{3}{\xintiSqrt{#1}}}% + {\xintSeq [2]{3}{\xintiiSqrt{#1}}}% }% } {\xintifEq {#1}{2}{1}{0}}% @@ -7245,7 +7330,7 @@ The macro becomes: \def\IsPrime #1% {\ifnumodd {#1} {\xintANDof % odd case - {\xintApply {\remainder {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}} + {\xintApply {\remainder {#1}}{\xintSeq [2]{3}{\xintiiSqrt{#1}}}}} {\ifnumequal {#1}{2}{1}{0}}} | @@ -7275,7 +7360,7 @@ Let us enhance our prime macro to work also on the small primes: {\ifnumequal{#1}{1}{0}{1}}% 3,5,7 are primes {\xintANDof {\xintApply - { \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}% + { \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiiSqrt{#1}}}}% }}% END OF THE ODD BRANCH {\ifnumequal {#1}{2}{1}{0}}% EVEN BRANCH } @@ -7353,7 +7438,7 @@ $168$). {\ifnumequal{#1}{1}{0}{1}}% 3,5,7 are primes {\xintANDof {\xintApply - { \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiSqrt{#1}}}}% + { \IsNotDivisibleBy {#1}}{\xintSeq [2]{3}{\xintiiSqrt{#1}}}}% }}% END OF THE ODD BRANCH {\ifnumequal {#1}{2}{1}{0}}% EVEN BRANCH } @@ -7700,7 +7785,7 @@ as they are able to deal with arbitrarily big integers. {\edef\TheNumber {\the\numexpr #2}% positive integer \ifnumodd {\TheNumber} {\ifnumgreater {\TheNumber}{1} - {\edef\ItsSquareRoot{\xintiSqrt \TheNumber}% + {\edef\ItsSquareRoot{\xintiiSqrt \TheNumber}% \xintFor ##1 in {\xintintegers [3+2]}\do {\ifnumgreater {##1}{\ItsSquareRoot} {\def#1{1}\xintBreakFor} @@ -7718,7 +7803,7 @@ as they are able to deal with arbitrarily big integers. {\edef\TheNumber {\the\numexpr #2}%"""color[named]{PineGreen} hence #2 may be a count or \numexpr.;! \ifnumodd {\TheNumber} {\ifnumgreater {\TheNumber}{1} - {\edef\ItsSquareRoot{\xintiSqrt \TheNumber}% + {\edef\ItsSquareRoot{\xintiiSqrt \TheNumber}% \xintFor """color{red}##1;! in {"""color{red}\xintintegers;! [3+2]}\do {\ifnumgreater {"""color{red}##1;!}{\ItsSquareRoot} """color[named]{PineGreen}% "textcolor{red}{##1} is a \numexpr.;! {\def#1{1}\xintBreakFor} @@ -8062,23 +8147,26 @@ problems). 7562.6481, 8084.0163, 3481.6319, 8078.8512, 2983.7624, 3925.4026, 4931.5812, 1323.1517, 6253.0945}% -\oodef\z {\QSx \somenumbers}% -\hsize 87\fontcharwd\font`0 \setbox0\hbox{\kern\fontcharwd\font`0}% -\lccode`~=32 \lowercase{\def~}{\discretionary{}{}{\copy0}}\catcode32 13 -\noindent\ \ \ \scantokens\expandafter{\meaning\z}\par +\oodef\z {\QSx \somenumbers}% produced as a comma+space separated list +% black magic as workaround to the shrinkability of spaces in last line... +\hsize 87\fontcharwd\font`0 +\lccode`~=32 +\lowercase{\def~}{\discretionary{}{}{\kern\fontcharwd\font`0}}\catcode32 13 +\noindent\phantom{000}\scantokens\expandafter{\meaning\z}\par \endgroup \end{everbatim*} \fi % fin de si pas xetex -All these examples were with numbers which may have been handled via |\ifdim| -tests rather than \csbxint{ifCmp} from \xintfracname ; naturally that would -have been faster. For a yet faster routine (based however on the Merge Sort -and using the |\pdfescapestring| PDF\TeX{} primitive) see |code 6| at -\url{http://tex.stackexchange.com/a/273084}. + +All the previous examples were with numbers which could have been handled via +|\ifdim| tests rather than the \csbxint{ifCmp} macro from \xintfracname; using +|\ifdim| tests would naturally be faster. Even faster routine is |code 6| at +\url{http://tex.stackexchange.com/a/273084} which uses |\pdfescapestring| and a +Merge Sort algorithm. We then turn to a graphical illustration of the algorithm.% % -\footnote{I have rewritten the routine to do only once (and not thrice) the +\footnote{I have rewritten (2015/11/21) the routine to do only once (and not thrice) the needed calls to \csa{xintifCmp}, up to the price of one additional |\edef|, although due to the context execution time on our side is not an issue and moreover is anyhow overwhelmed by the TikZ's activities. Simultaneously I @@ -8236,6 +8324,10 @@ currently this is implemented by using either |\xintifForFirst| or \renewcommand{\etocaftertochook}{\addvspace{\bigskipamount}} \clearpage +\def\n{|{N}|} +\def\m{|{M}|} +\def\x{|{x}|} + \section{Macros of the \xintkernelname package} \label{sec:kernel} @@ -8294,10 +8386,10 @@ argument and just reverses the order of the tokens in the \meta{list}. Braces are removed once and the enclosed material, now unbraced, does not get reversed. Unprotected spaces (of any character code) are gobbled. % -\leftedline{|\xintReverseOrder{\xintDigitsOf\xintiPow {2}{100}\to\Stuff}|} +\leftedline{|\xintReverseOrder{\xintDigitsOf\xintiiPow {2}{100}\to\Stuff}|} % \leftedline{gives: - \ttfamily{\string\Stuff\string\to1002\string\xintiPow\string\xintDigitsOf}} + \ttfamily{\string\Stuff\string\to1002\string\xintiiPow\string\xintDigitsOf}} \subsection{\csbh{xintLength}} \label{xintLength} @@ -8309,11 +8401,11 @@ to count things in the replacement text of a macro |\x| one should do counted. See also \csbxint{NthElt}|{0}| (from \xinttoolsname) which first \fexpan ds its argument and then applies the same code. % -\leftedline{|\xintLength {\xintiPow {2}{100}}|\dtt{=\xintLength - {\xintiPow{2}{100}}}} +\leftedline{|\xintLength {\xintiiPow {2}{100}}|\dtt{=\xintLength + {\xintiiPow{2}{100}}}} % -\leftedline{${}\neq{}$|\xintLen {\xintiPow {2}{100}}|\dtt{=\xintLen - {\xintiPow{2}{100}}}} +\leftedline{${}\neq{}$|\xintLen {\xintiiPow {2}{100}}|\dtt{=\xintLen + {\xintiiPow{2}{100}}}} \subsection{\csbh{xintLastItem}} \label{xintLastItem} @@ -8370,1664 +8462,181 @@ its salt compared to \csbxint{Length}. \clearpage -\section{Macros of the \xinttoolsname package} - - -\label{sec:tools} +\section{Macros of the \xintcorename package} +\label{sec:core} \localtableofcontents -\def\n{|{N}|} -\def\m{|{M}|} -\def\x{|{x}|} - -These utilities used to be provided within the \xintname package; since |1.09g| -(|2013/11/22|) they have been moved to an independently usable package -\xinttoolsname, which has none of the \xintname facilities regarding big -numbers. Whenever relevant release |1.09h| has made the macros |\long| so they -accept |\par| tokens on input. - -First the completely expandable utilities up to \csbxint{iloop}, then the non -expandable utilities. - -This section contains various concrete examples and ends with a -\hyperref[ssec:quicksort]{completely expandable implementation of the Quick Sort - algorithm} together with a graphical illustration of its action. - -See also \ref{xintReverseOrder} and \ref{xintLength} which come with package -\xintkernelname, automatically loaded by \xinttoolsname. - -\subsection{\csbh{xintRevWithBraces}}\label{xintRevWithBraces} - -%{\small New in release |1.06|.\par} - -\edef\X{\xintRevWithBraces{12345}} -\edef\y{\xintRevWithBraces\X} -\expandafter\def\expandafter\w\expandafter - {\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}} - -% -\csa{xintRevWithBraces}\marg{list}\etype{f} first does the \fexpan sion of its -argument then it reverses the order of the tokens, or braced material, it -encounters, maintaining existing braces and adding a brace pair around each -naked token encountered. Space tokens (in-between top level braces or naked -tokens) are gobbled. This macro is mainly thought out for use on a \meta{list} -of such braced material; with such a list as argument the \fexpan sion will only -hit against the first opening brace, hence do nothing, and the braced stuff may -thus be macros one does not want to expand. -% -\leftedline{|\edef\x{\xintRevWithBraces{12345}}|} -% -\leftedline{|\meaning\x:|\dtt{\meaning\X}} -% -\leftedline{|\edef\y{\xintRevWithBraces\x}|} -% -\leftedline{|\meaning\y:|\dtt{\meaning\y}} -% -The examples above could be defined with |\edef|'s because the braced material -did not contain macros. Alternatively: -% -\leftedline{|\expandafter\def\expandafter\w\expandafter|} -% -\leftedline{|{\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}}|} -% -\leftedline{|\meaning\w:|\dtt{\meaning\w}} -% -The macro \csa{xintReverseWithBracesNoExpand}\etype{n} does the same job -without the initial expansion of its argument. - - -\subsection{\csbh{xintZapFirstSpaces}, \csbh{xintZapLastSpaces}, \csbh{xintZapSpaces}, \csbh{xintZapSpacesB}} -\label{xintZapFirstSpaces} -\label{xintZapLastSpaces} -\label{xintZapSpaces} -\label{xintZapSpacesB} -%{\small New with release |1.09f|.\par} - -\csa{xintZapFirstSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion -of its argument, nor brace removal of any sort, nor does it alter \meta{stuff} -in anyway apart from stripping away all \emph{leading} spaces. - -This macro will be mostly of interest to programmers who will know what I will -now be talking about. \emph{The essential points, naturally, are the complete - expandability and the fact that no brace removal nor any other alteration is - done to the input.} - -\TeX's input scanner already converts consecutive blanks into single space -tokens, but |\xintZapFirstSpaces| handles successfully also inputs with -consecutive multiple space tokens. -However, it is assumed that \meta{stuff} does not contain (except inside braced -sub-material) space tokens of character code distinct from $32$. - -It expands in two steps, and if the goal is to apply it to the -expansion text of |\x| to define |\y|, then one should do: -|\expandafter\def\expandafter\y\expandafter - {\romannumeral0\expandafter\xintzapfirstspaces\expandafter{\x}}|. - -Other use case: inside a macro as |\edef\x{\xintZapFirstSpaces {#1}}| assuming -naturally that |#1| is compatible with such an |\edef| once the leading spaces -have been stripped. - -\begingroup -\def\x { \a { \X } { \b \Y } } -% -\leftedline{|\xintZapFirstSpaces { \a { \X } { \b \Y } }->|% -\dtt{\color{magenta}{}\expandafter\detokenize\expandafter -{\romannumeral0\expandafter\xintzapfirstspaces\expandafter{\x}}}+++} -\endgroup - -\medskip - -\noindent\csbxint{ZapLastSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion of -its argument, nor brace removal of any sort, nor does it alter \meta{stuff} in -anyway apart from stripping away all \emph{ending} spaces. The same remarks as -for \csbxint{ZapFirstSpaces} apply. - -% ATTENTION à l'\ignorespaces fait par \color! -\begingroup -\def\x { \a { \X } { \b \Y } } -% -\leftedline{|\xintZapLastSpaces { \a { \X } { \b \Y } }->|% -\dtt{\color{magenta}{}\expandafter\detokenize\expandafter -{\romannumeral0\expandafter\xintzaplastspaces\expandafter{\x}}}+++} -\endgroup - -\medskip - -\noindent\csbxint{ZapSpaces}\marg{stuff}\etype{n} does not do \emph{any} -expansion of its -argument, nor brace removal of any sort, nor does it alter \meta{stuff} in -anyway apart from stripping away all \emph{leading} and all \emph{ending} -spaces. The same remarks as for \csbxint{ZapFirstSpaces} apply. - -\begingroup -\def\x { \a { \X } { \b \Y } } -% -\leftedline{|\xintZapSpaces { \a { \X } { \b \Y } }->|% -\dtt{\color{magenta}{}\expandafter\detokenize\expandafter -{\romannumeral0\expandafter\xintzapspaces\expandafter{\x}}}+++} -\endgroup - -\medskip - -\noindent\csbxint{ZapSpacesB}\marg{stuff}\etype{n} does not do \emph{any} -expansion of -its argument, nor does it alter \meta{stuff} in anyway apart from stripping away -all leading and all ending spaces and possibly removing one level of braces if -\meta{stuff} had the shape |<spaces>{braced}<spaces>|. The same remarks as for -\csbxint{ZapFirstSpaces} apply. - -\begingroup -\def\x { \a { \X } { \b \Y } } -% -\leftedline{|\xintZapSpacesB { \a { \X } { \b \Y } }->|% -\dtt{\color{magenta}{}\expandafter\detokenize\expandafter -{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++} -\def\x { { \a { \X } { \b \Y } } } -% -\leftedline{|\xintZapSpacesB { { \a { \X } { \b \Y } } }->|% -\dtt{\color{magenta}{}\expandafter\detokenize\expandafter -{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++} -\endgroup - The spaces here at the start and end of the output come from the braced - material, and are not removed (one would need a second application for that; - recall though that the \xintname zapping macros do not expand their argument). - -\subsection{\csbh{xintCSVtoList}} -\label{xintCSVtoList} -\label{xintCSVtoListNoExpand} - - -\csa{xintCSVtoList}|{a,b,c...,z}|\etype{f} returns |{a}{b}{c}...{z}|. A -\emph{list} is by -convention in this manual simply a succession of tokens, where each braced thing -will count as one item (``items'' are defined according to the rules of \TeX{} -for fetching undelimited parameters of a macro, which are exactly the same rules -as for \LaTeX{} and macro arguments [they are the same things]). The word -`list' in `comma separated list of items' has its usual linguistic meaning, -and then an ``item'' is what is delimited by commas. - -So \csa{xintCSVtoList} takes on input a `comma separated list of items' and -converts it into a `\TeX{} list of braced items'. The argument to -|\xintCSVtoList| may be a macro: it will first be -\hyperref[ssec:expansions]{\fexpan ded}. Hence the item before the first comma, -if it is itself a macro, will be expanded which may or may not be a good thing. -A space inserted at the start of the first item serves to stop that expansion -(and disappears). The macro \csbxint{CSVtoListNoExpand}\etype{n} does the same -job without -the initial expansion of the list argument. - -Apart from that no expansion of the items is done and the list items may thus be -completely arbitrary (and even contain perilous stuff such as unmatched |\if| -and |\fi| tokens). - -Contiguous spaces and tab characters, are collapsed by \TeX{} -into single spaces. All such spaces around commas% -% -\footnote{and multiple space tokens are not a problem; but those at the - top level (not hidden inside braces) \emph{must} be of character code - |32|.} -% -\fbox{are removed}, as well as -the spaces at the start and the spaces at the end of the list.% -% -\footnote{let us recall that this is all done completely expandably... - There is absolutely no alteration of any sort of the item apart from - the stripping of initial and final space tokens (of character code - |32|) and brace removal if and only if the item apart from intial and - final spaces (or more generally multiple |char 32| space tokens) is - braced.} -% -The items may contain explicit |\par|'s or -empty lines (converted by the \TeX{} input parsing into |\par| tokens). - -\begingroup - -\edef\X{\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } , { {x , - y} } }} - -% -\leftedline{|\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } , - { {x , y} } }|} -% -\leftedline{|->|% -{\makeatletter\dtt{\expandafter\strip@prefix\meaning\X}}} - -One sees on this example how braces protect commas from -sub-lists to be perceived as delimiters of the top list. Braces around an entire -item are removed, even when surrounded by spaces before and/or after. Braces for -sub-parts of an item are not removed. - -We observe also that there is a slight difference regarding the brace stripping -of an item: if the braces were not surrounded by spaces, also the initial and -final (but no other) spaces of the \emph{enclosed} material are removed. This is -the only situation where spaces protected by braces are nevertheless removed. - -From the rules above: for an empty argument (only spaces, no braces, no comma) -the output is -\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist { }}} -(a list with one empty item), -for ``|<opt. spaces>{}<opt. -spaces>|'' the output is -\dtt{\expandafter\detokenize\expandafter - {\romannumeral0\xintcsvtolist { {} }}} -(again a list with one empty item, the braces were removed), -for ``|{ }|'' the output is -\dtt{\expandafter\detokenize\expandafter - {\romannumeral0\xintcsvtolist {{ }}}} -(again a list with one empty item, the braces were removed and then -the inner space was removed), -for ``| { }|'' the output is -\dtt{\expandafter\detokenize\expandafter -{\romannumeral0\xintcsvtolist { { }}}} (again a list with one empty item, the initial space served only to stop the expansion, so this was like ``|{ }|'' as input, the braces were removed and the inner space was stripped), -for ``\texttt{\ \{\ \ \}\ }'' the output is -\dtt{\expandafter\detokenize\expandafter -{\romannumeral0\xintcsvtolist { { } }}} (this time the ending space of the first -item meant that after brace removal the inner spaces were kept; recall though -that \TeX{} collapses on input consecutive blanks into one space token), -for ``|,|'' the output consists of two consecutive -empty items -\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist - {,}}}. Recall that on output everything is braced, a |{}| is an ``empty'' -item. -% -Most of the above is mainly irrelevant for every day use, apart perhaps from the -fact to be noted that an empty input does not give an empty output but a -one-empty-item list (it is as if an ending comma was always added at the end of -the input). - -\def\y { \a,\b,\c,\d,\e} -\expandafter\def\expandafter\Y\expandafter{\romannumeral0\xintcsvtolist{\y}} -\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode} -\expandafter\def\expandafter\T\expandafter{\romannumeral0\xintcsvtolist{\t}} - -% -\leftedline{|\def\y{ \a,\b,\c,\d,\e} \xintCSVtoList\y->|% - {\makeatletter\dtt{\expandafter\strip@prefix\meaning\Y}}} -% -\leftedline{|\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|} -% -\leftedline -{|\xintCSVtoList\t->|\makeatletter\dtt{\expandafter\strip@prefix\meaning\T}} -% -The results above were automatically displayed using \TeX's primitive -\csa{meaning}, which adds a space after each control sequence name. These spaces -are not in the actual braced items of the produced lists. The first items |\a| -and |\if| were either preceded by a space or braced to prevent expansion. The -macro \csa{xintCSVtoListNoExpand} would have done the same job without the -initial expansion of the list argument, hence no need for such protection but if -|\y| is defined as |\def\y{\a,\b,\c,\d,\e}| we then must do: -% -\leftedline{|\expandafter\xintCSVtoListNoExpand\expandafter {\y}|} Else, we -may have direct use: % -% -\leftedline{|\xintCSVtoListNoExpand - {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|} -% -\leftedline{|->|\dtt{\expandafter\detokenize\expandafter - {\romannumeral0\xintcsvtolistnoexpand - {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}}}} -% -Again these spaces are an artefact from the use in the source of the document of -\csa{meaning} (or rather here, \csa{detokenize}) to display the result of using -\csa{xintCSVtoListNoExpand} (which is done for real in this document -source). - -For the similar conversion from comma separated list to braced items list, but -without removal of spaces around the commas, there is -\csa{xintCSVtoListNonStripped}\etype{f} and -\csa{xintCSVtoListNonStrippedNoExpand}\etype{n}. - -\endgroup - -\subsection{\csbh{xintNthElt}}\label{xintNthElt} - - -\def\macro #1{\the\numexpr 9-#1\relax} - -\csa{xintNthElt\x}\marg{list}\etype{\numx f} gets (expandably) the |x|th -item of the \meta{list}. A braced item will lose one level of brace -pairs. The token list is first \fexpan ded. - -Items are counted starting at one. - -\leftedline{|\xintNthElt {3}{{agh}\u{zzz}\v{Z}}| is - \texttt{\xintNthElt {3}{{agh}\u{zzz}\v{Z}}}} -% -\leftedline{|\xintNthElt {3}{{agh}\u{{zzz}}\v{Z}}| is - \texttt{\expandafter\expandafter\expandafter - \detokenize\expandafter\expandafter\expandafter {\xintNthElt - {3}{{agh}\u{{zzz}}\v{Z}}}}} -% -\leftedline{|\xintNthElt {2}{{agh}\u{{zzz}}\v{Z}}| is - \texttt{\expandafter\expandafter\expandafter - \detokenize\expandafter\expandafter\expandafter {\xintNthElt - {2}{{agh}\u{{zzz}}\v{Z}}}}} -% -\leftedline{|\xintNthElt {37}{\xintiiFac {100}}|\dtt{=\xintNthElt - {37}{\xintiiFac {100}}} is the thirty-seventh digit of $100!$.} -% -\leftedline{|\xintNthElt {10}{\xintFtoCv - {566827/208524}}|\dtt{=\xintNthElt {10}{\xintFtoCv - {566827/208524}}}} -\leftedline{is the tenth convergent of $566827/208524$ (uses \xintcfracname - package).} -% -\leftedline{|\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% - \dtt{=\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} -% -\leftedline{|\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% - \dtt{=\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} -% -\leftedline{|\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% - \dtt{=\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} - -If |x=0|, -the macro returns the \emph{length} of the expanded list: this is not equivalent -to \csbxint{Length} which does no pre-expansion. And it is different from -\csbxint{Len} which is to be used only on integers or fractions. - -If |x<0|, the macro returns the \verb+|x|+th element from the end of the list. -Thus for example |x=-1| will fetch the last item of the list. -% -\leftedline {|\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}| is - \texttt{\expandafter\expandafter\expandafter \detokenize - \expandafter\expandafter\expandafter{\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}}}} - -The macro \csa{xintNthEltNoExpand}\etype{\numx n} does the same job but without -first expanding the list argument: |\xintNthEltNoExpand {-4}{\u\v\w T\x\y\z}| is -\xintNthEltNoExpand {-4}{\a\b\c\u\v\w T\x\y\z}. - -If |x| is strictly larger (in absolute value) than the length of the list -then |\xintNthElt| produces empty contents. - -\subsection{\csbh{xintKeep}}\label{xintKeep} - -\csa{xintKeep\x}\marg{list}\etype{\numx f} expands the token list argument |L| -and produces a new list, depending on the value of |x|: -\begin{itemize}[nosep] -\item if |x>0|, the new list contains the first |x| items from |L| (counting - starts at one.) \emph{Each - such item will be output within a brace pair.} Use \csbxint{KeepUnbraced} is - this is not desired. This means that if the list item was braced to start - with, there is no modification, but if it was a token without braces, - then it acquires them. -\item if |x>=length(L)|, the new list is the old one with all its items now - braced. -\item if |x=0| the empty list is returned. -\item if |x<0| the last \verb+|x|+ elements compose the output in the same - order as in the initial list; as the macro proceeds by removing head items - the kept items end up in output as they were in input: no added braces. -\item if |x<=-length(L)| the output is identical with the input. -\end{itemize} - -\csa{xintKeepNoExpand} does the same without first \fexpan ding its list -argument. -% -\begin{everbatim*} -\fdef\test {\xintKeep {17}{\xintKeep {-69}{\xintSeq {1}{100}}}}\meaning\test\par -\noindent\fdef\test {\xintKeep {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintKeep {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintKeep {7}{123456789}}\meaning\test\par -\noindent\fdef\test {\xintKeep {-7}{123456789}}\meaning\test\par -\end{everbatim*} - - -\subsection{\csbh{xintKeepUnbraced}}\label{xintKeepUnbraced} - -Same as \csbxint{Keep} but no brace pairs are added around the kept items from -the head of the list in the case |x>0|: each such item will lose one level of -braces. Thus, to remove braces from all items of the list, one can use -\csbxint{KeepUnbraced} with its first argument larger than the length of the -list; the same is obtained from \csbxint{ListWithSep}|{}|\marg{list}. But the -new list will then have generally many more items than the original ones, -corresponding to the unbraced original items. - -For |x<0| the macro is no different from \csbxint{Keep}. Hence the name is a -bit misleading because brace removal will happen only if |x>0|. +Package \xintcorename is automatically loaded by \xintname. -\csa{xintKeepUnbracedNoExpand} does the same without first \fexpan ding -its list argument. -% -\begin{everbatim*} -\fdef\test {\xintKeepUnbraced {10}{\xintSeq {1}{100}}}\meaning\test\par -\noindent\fdef\test {\xintKeepUnbraced {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintKeepUnbraced {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintKeepUnbraced {7}{123456789}}\meaning\test\par -\noindent\fdef\test {\xintKeepUnbraced {-7}{123456789}}\meaning\test\par -\end{everbatim*} +\xintcorename provides for big integers the four basic arithmetic operations +(addition, subtraction, multiplication, division), as well as powers and +factorials. -\subsection{\csbh{xintTrim}}\label{xintTrim} +In the descriptions of the macros \texttt{\n} and \texttt{\m} stand +for (big) integers or macros \hyperref[ssec:expansions]{\fexpan ding} to +such big integers in strict format as described in \autoref{ssec:inputs}. -\csa{xintTrim\x}\marg{list}\etype{\numx f} expands the list argument and -gobbles its first |x| elements. +All macros require strict integer format on input and produce +strict integer format on output, except:\IMPORTANT \begin{itemize}[nosep] -\item if |x>0|, the first |x| items from |L| are gobbled. The remaining items - are not modified. -\item if |x>=length(L)|, the returned list is empty. -\item if |x=0| the original list is returned (with no added braces.) -\item if |x<0| the last \verb+|x|+ items of the list are removed. \emph{The - head items end up braced in the output.} Use \csbxint{TrimUnbraced} if - this is not desired. -\item if |x<=-length(L)| the output is empty. -\end{itemize} - -\csa{xintTrimNoExpand} does the same without first \fexpan ding its list -argument. -\begin{everbatim*} -\fdef\test {\xintTrim {17}{\xintTrim {-69}{\xintSeq {1}{100}}}}\meaning\test\par -\noindent\fdef\test {\xintTrim {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintTrim {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintTrim {7}{123456789}}\meaning\test\par -\noindent\fdef\test {\xintTrim {-7}{123456789}}\meaning\test\par -\end{everbatim*} - -\subsection{\csbh{xintTrimUnbraced}}\label{xintTrimUnbraced} - -Same as \csbxint{Trim} but in case of a negative |x| (cutting items from -the tail), the kept items from the head are not enclosed in brace pairs. They -will lose one level of braces. The name is a bit misleading -because when |x>0| there is no brace-stripping done on the kept items, because -the macro works simply by gobbling the head ones. - -\csa{xintTrimUnbracedNoExpand} does the same without first \fexpan ding its list -argument. - -\begin{everbatim*} -\fdef\test {\xintTrimUnbraced {-90}{\xintSeq {1}{100}}}\meaning\test\par -\noindent\fdef\test {\xintTrimUnbraced {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintTrimUnbraced {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par -\noindent\fdef\test {\xintTrimUnbraced {7}{123456789}}\meaning\test\par -\noindent\fdef\test {\xintTrimUnbraced {-7}{123456789}}\meaning\test\par -\end{everbatim*} - -\subsection{\csbh{xintListWithSep}}\label{xintListWithSep} - - -\def\macro #1{\the\numexpr 9-#1\relax} - -\csa{xintListWithSep}|{sep}|\marg{list}\etype{nf} inserts the separator |sep| -in-between all items of the given list. The items will be unbraced. The -separator may be a macro but will not be pre-expanded. The list argument is -\fexpan ded. -\begin{everbatim*} -\edef\foo {\xintListWithSep{,}{{1}{2}{3}}}\meaning\foo\newline -\edef\foo {\xintListWithSep{:}{\xintiiFac{20}}}\meaning\foo\par -\end{everbatim*} -An empty input gives an empty output, a singleton gives a singleton, and the -separator is used starting with at least two elements. Using an empty -separator has the net effect of unbracing the braced items constituting the -\meta{list} (then the new list will generally have many more ``items'' than -the original one). -% - -The macro \csa{xintListWithSepNoExpand}\etype{nn} does the same -job without the initial expansion. - -\subsection{\csbh{xintApply}}\label{xintApply} - - -\def\macro #1{\the\numexpr 9-#1\relax} - -\csa{xintApply}|{\macro}|\marg{list}\etype{ff} expandably applies the one -parameter macro |\macro| to each item in the \meta{list} given as second -argument and returns a new list with these outputs: each item is given one after -the other as parameter to |\macro| which is expanded at that time (as usual, -\emph{i.e.} fully for what comes first), the results are braced and output -together as a succession of braced items (if |\macro| is defined to start with a -space, the space will be gobbled and the |\macro| will not be expanded; it is -allowed to have its own arguments, the list items serve as last arguments to -|\macro|). Hence |\xintApply{\macro}{{1}{2}{3}}| returns -|{\macro{1}}{\macro{2}}{\macro{3}}| where all instances of |\macro| have been -already \fexpan ded. - -Being expandable, |\xintApply| is useful for example inside alignments where -implicit groups make standard loops constructs usually fail. In such situation -it is often not wished that the new list elements be braced, see -\csbxint{ApplyUnbraced}. The |\macro| does not have to be expandable: -|\xintApply| will try to expand it, the expansion may remain partial. - -The \meta{list} may -itself be some macro expanding (in the previously described way) to the list of -tokens to which the macro |\macro| will be applied. For example, if the -\meta{list} expands to some positive number, then each digit will be replaced by -the result of applying |\macro| on it. % -% -\leftedline{|\def\macro #1{\the\numexpr - 9-#1\relax}|} % -% -\leftedline{|\xintApply\macro{\xintiiFac - {20}}|\dtt{=\xintApply\macro{\xintiiFac {20}}}} - -The macro \csa{xintApplyNoExpand}\etype{fn} does the same job without the first -initial expansion which gave the \meta{list} of braced tokens to which |\macro| -is applied. - -\subsection{\csbh{xintApplyUnbraced}}\label{xintApplyUnbraced} - - -\csa{xintApplyUnbraced}|{\macro}|\marg{list}\etype{ff} is like \csbxint{Apply}. -The difference is that after having expanded its list argument, and applied -|\macro| in turn to each item from the list, it reassembles the outputs without -enclosing them in braces. The net effect is the same as doing -% -\leftedline{|\xintListWithSep {}{\xintApply {\macro}|\marg{list}|}|} This is -useful for preparing a macro which will itself define some other macros or make -assignments, as the scope will not be limited by brace pairs. -% -\begin{everbatim*} -\def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}} -\xintApplyUnbraced\macro{{elta}{eltb}{eltc}} -\begin{enumerate}[nosep,label=(\arabic{*})] -\item \meaning\myselfelta -\item \meaning\myselfeltb -\item \meaning\myselfeltc -\end{enumerate} -\end{everbatim*} - -% -The macro \csa{xintApplyUnbracedNoExpand}\etype{fn} does the same job without -the first initial expansion which gave the \meta{list} of braced tokens to which -|\macro| is applied. - -\subsection{\csbh{xintSeq}}\label{xintSeq} - -\csa{xintSeq}|[d]{x}{y}|\etype{{{\upshape[\numx]}}\numx\numx} generates -expandably |{x}{x+d}...| up to and possibly including |{y}| if |d>0| or down -to and including |{y}| if |d<0|. Naturally |{y}| is omitted if |y-x| is not a -multiple of |d|. If |d=0| the macro returns |{x}|. If |y-x| and |d| have -opposite signs, the macro returns nothing. If the optional argument |d| is -omitted it is taken to be the sign of |y-x|. Hence |\xintSeq {1}{0}| is not -empty but |{1}{0}|. But |\xintSeq [1]{1}{0}| is empty. - - -The arguments |x| and |y| are expanded inside a |\numexpr| so they may be -count registers or a \LaTeX{} |\value{countername}|, or arithmetic with such -things. - -% -\begin{everbatim*} -\xintListWithSep{,\hskip2pt plus 1pt minus 1pt }{\xintSeq {12}{-25}} -\end{everbatim*} -% -\begin{everbatim*} -\xintiiSum{\xintSeq [3]{1}{1000}} -\end{everbatim*} - -When the macro is used without the optional argument |d|, it can only generate -up to about $5000$ numbers\IMPORTANT, the precise value depends upon some -\TeX{} memory parameter (input save stack). - -With the optional argument |d| the macro proceeds differently (but less -efficiently) and does not stress the input save stack. - - - -\subsection{\csbh{xintloop}, \csbh{xintbreakloop}, \csbh{xintbreakloopanddo}, \csbh{xintloopskiptonext}} -\label{xintloop} -\label{xintbreakloop} -\label{xintbreakloopanddo} -\label{xintloopskiptonext} - -|\xintloop|\meta{stuff}|\if<test>...\repeat|\retype{} is an expandable loop -compatible with nesting. However to break out of the loop one almost always need -some un-expandable step. The cousin \csbxint{iloop} is \csbxint{loop} with an -embedded expandable mechanism allowing to exit from the loop. The iterated -macros may contain |\par| tokens or empty lines. - -If a sub-loop is to be used all the material from the start of the main loop and -up to the end of the entire subloop should be braced; these braces will be -removed and do not create a group. The simplest to allow the nesting of one or -more sub-loops is to brace everything between \csa{xintloop} and \csa{repeat}, -being careful not to leave a space between the closing brace and |\repeat|. - -As this loop and \csbxint{iloop} will primarily be of interest to experienced -\TeX{} macro programmers, my description will assume that the user is -knowledgeable enough. Some examples in this document will be perhaps more -illustrative than my attemps at explanation of use. - -One can abort the loop with \csbxint{breakloop}; this should not be used inside -the final test, and one should expand the |\fi| from the corresponding test -before. One has also \csbxint{breakloopanddo} whose first argument will be -inserted in the token stream after the loop; one may need a macro such as -|\xint_afterfi| to move the whole thing after the |\fi|, as a simple -|\expandafter| will not be enough. - -One will usually employ some count registers to manage the exit test from the -loop; this breaks expandability, see \csbxint{iloop} for an expandable integer -indexed loop. Use in alignments will be complicated by the fact that cells -create groups, and also from the fact that any encountered unexpandable material -will cause the \TeX{} input scanner to insert |\endtemplate| on each encountered -|&| or |\cr|; thus |\xintbreakloop| may not work as expected, but the situation -can be resolved via |\xint_firstofone{&}| or use of |\TAB| with |\def\TAB{&}|. -It is thus simpler for alignments to use rather than \csbxint{loop} either the -expandable \csbxint{ApplyUnbraced} or the non-expandable but alignment -compatible \csbxint{ApplyInline}, \csbxint{For} or \csbxint{For*}. - -As an example, let us suppose we have two macros |\A|\marg{i}\marg{j} and -|\B|\marg{i}\marg{j} behaving like (small) integer valued matrix entries, and we -want to define a macro |\C|\marg{i}\marg{j} giving the matrix product (|i| and -|j| may be count registers). We will assume that |\A[I]| expands to the number -of rows, |\A[J]| to the number of columns and want the produced |\C| to act in -the same manner. The code is very dispendious in use of |\count| registers, not -optimized in any way, not made very robust (the defined macro can not have the -same name as the first two matrices for example), we just wanted to quickly -illustrate use of the nesting capabilities of |\xintloop|.% -% -\footnote{for a more sophisticated implementation of matrix - multiplication, inclusive of determinants, inverses, and display - utilities, with entries big integers or decimal numbers or even - fractions see \url{http://tex.stackexchange.com/a/143035/4686} from - November 11, 2013.} -% - - -\begin{everbatim*} -\newcount\rowmax \newcount\colmax \newcount\summax -\newcount\rowindex \newcount\colindex \newcount\sumindex -\newcount\tmpcount -\makeatletter -\def\MatrixMultiplication #1#2#3{% - \rowmax #1[I]\relax - \colmax #2[J]\relax - \summax #1[J]\relax - \rowindex 1 - \xintloop % loop over row index i - {\colindex 1 - \xintloop % loop over col index k - {\tmpcount 0 - \sumindex 1 - \xintloop % loop over intermediate index j - \advance\tmpcount \numexpr #1\rowindex\sumindex*#2\sumindex\colindex\relax - \ifnum\sumindex<\summax - \advance\sumindex 1 - \repeat }% - \expandafter\edef\csname\string#3{\the\rowindex.\the\colindex}\endcsname - {\the\tmpcount}% - \ifnum\colindex<\colmax - \advance\colindex 1 - \repeat }% - \ifnum\rowindex<\rowmax - \advance\rowindex 1 - \repeat - \expandafter\edef\csname\string#3{I}\endcsname{\the\rowmax}% - \expandafter\edef\csname\string#3{J}\endcsname{\the\colmax}% - \def #3##1{\ifx[##1\expandafter\Matrix@helper@size - \else\expandafter\Matrix@helper@entry\fi #3{##1}}% -}% -\def\Matrix@helper@size #1#2#3]{\csname\string#1{#3}\endcsname }% -\def\Matrix@helper@entry #1#2#3% - {\csname\string#1{\the\numexpr#2.\the\numexpr#3}\endcsname }% -\def\A #1{\ifx[#1\expandafter\A@size - \else\expandafter\A@entry\fi {#1}}% -\def\A@size #1#2]{\ifx I#23\else4\fi}% 3rows, 4columns -\def\A@entry #1#2{\the\numexpr #1+#2-1\relax}% not pre-computed... -\def\B #1{\ifx[#1\expandafter\B@size - \else\expandafter\B@entry\fi {#1}}% -\def\B@size #1#2]{\ifx I#24\else3\fi}% 4rows, 3columns -\def\B@entry #1#2{\the\numexpr #1-#2\relax}% not pre-computed... -\makeatother -\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D -\MatrixMultiplication\C\D\E \MatrixMultiplication\C\E\F -\begin{multicols}2 - \[\begin{pmatrix} - \A11&\A12&\A13&\A14\\ - \A21&\A22&\A23&\A24\\ - \A31&\A32&\A33&\A34 - \end{pmatrix} - \times - \begin{pmatrix} - \B11&\B12&\B13\\ - \B21&\B22&\B23\\ - \B31&\B32&\B33\\ - \B41&\B42&\B43 - \end{pmatrix} - = - \begin{pmatrix} - \C11&\C12&\C13\\ - \C21&\C22&\C23\\ - \C31&\C32&\C33 - \end{pmatrix}\] - \[\begin{pmatrix} - \C11&\C12&\C13\\ - \C21&\C22&\C23\\ - \C31&\C32&\C33 - \end{pmatrix}^2 = \begin{pmatrix} - \D11&\D12&\D13\\ - \D21&\D22&\D23\\ - \D31&\D32&\D33 - \end{pmatrix}\] - \[\begin{pmatrix} - \C11&\C12&\C13\\ - \C21&\C22&\C23\\ - \C31&\C32&\C33 - \end{pmatrix}^3 = \begin{pmatrix} - \E11&\E12&\E13\\ - \E21&\E22&\E23\\ - \E31&\E32&\E33 - \end{pmatrix}\] - \[\begin{pmatrix} - \C11&\C12&\C13\\ - \C21&\C22&\C23\\ - \C31&\C32&\C33 - \end{pmatrix}^4 = \begin{pmatrix} - \F11&\F12&\F13\\ - \F21&\F22&\F23\\ - \F31&\F32&\F33 - \end{pmatrix}\] -\end{multicols} -\end{everbatim*} - - -\subsection{\csbh{xintiloop}, \csbh{xintiloopindex}, \csbh{xintouteriloopindex}, - \csbh{xintbreakiloop}, \csbh{xintbreakiloopanddo}, \csbh{xintiloopskiptonext}, -\csbh{xintiloopskipandredo}} -\label{xintiloop} -\label{xintbreakiloop} -\label{xintbreakiloopanddo} -\label{xintiloopskiptonext} -\label{xintiloopskipandredo} -\label{xintiloopindex} -\label{xintouteriloopindex} - -\csa{xintiloop}|[start+delta]|\meta{stuff}|\if<test> ... \repeat|\retype{} is a -completely expandable nestable loop. complete expandability depends naturally on -the actual iterated contents, and complete expansion will not be achievable -under a sole \fexpan sion, as is indicated by the hollow star in the margin; -thus the loop can be used inside an |\edef| but not inside arguments to the -package macros. It can be used inside an |\xintexpr..\relax|. The -|[start+delta]| is mandatory, not optional. - -This loop benefits via \csbxint{iloopindex} to (a limited access to) the integer -index of the iteration. The starting value |start| (which may be a |\count|) and -increment |delta| (\emph{id.}) are mandatory arguments. A space after the -closing square bracket is not significant, it will be ignored. Spaces inside the -square brackets will also be ignored as the two arguments are first given to a -|\numexpr...\relax|. Empty lines and explicit |\par| tokens are accepted. - -As with \csbxint{loop}, this tool will mostly be of interest to advanced users. -For nesting, one puts inside braces all the -material from the start (immediately after |[start+delta]|) and up to and -inclusive of the inner loop, these braces will be removed and do not create a -loop. In case of nesting, \csbxint{outeriloopindex} gives access to the index of -the outer loop. If needed one could write on its model a macro giving access to -the index of the outer outer loop (or even to the |nth| outer loop). - -The \csa{xintiloopindex} and \csa{xintouteriloopindex} can not be used inside -braces, and generally speaking this means they should be expanded first when -given as argument to a macro, and that this macro receives them as delimited -arguments, not braced ones. Or, but naturally this will break expandability, one -can assign the value of \csa{xintiloopindex} to some |\count|. Both -\csa{xintiloopindex} and \csa{xintouteriloopindex} extend to the litteral -representation of the index, thus in |\ifnum| tests, if it comes last one has to -correctly end the macro with a |\space|, or encapsulate it in a -|\numexpr..\relax|. - -When the repeat-test of the loop is, for example, |\ifnum\xintiloopindex<10 -\repeat|, this means that the last iteration will be with |\xintiloopindex=10| -(assuming |delta=1|). There is also |\ifnum\xintiloopindex=10 \else\repeat| to -get the last iteration to be the one with |\xintiloopindex=10|. - -One has \csbxint{breakiloop} and \csbxint{breakiloopanddo} to abort the loop. -The syntax of |\xintbreakiloopanddo| is a bit surprising, the sequence of tokens -to be executed after breaking the loop is not within braces but is delimited by -a dot as in: -% -\leftedline{|\xintbreakiloopanddo <afterloop>.etc.. etc... \repeat|} -% -The reason is that one may wish to use the then current value of -|\xintiloopindex| in |<afterloop>| but it can't be within braces at the time it -is evaluated. However, it is not that easy as |\xintiloopindex| must be expanded -before, so one ends up with code like this: -% -\leftedline -{|\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.%|} -% -\leftedline{|etc.. etc.. \repeat|} -% -As moreover the |\fi| from the test leading to the decision of breaking out of -the loop must be cleared out of the way, the above should be -a branch of an expandable conditional test, else one needs something such -as: -% -\leftedline -{|\xint_afterfi{\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.}%|} -% -\leftedline{|\fi etc..etc.. \repeat|} - -There is \csbxint{iloopskiptonext} to abort the current iteration and skip to -the next, \hyperref[xintiloopskipandredo]{\ttfamily\hyphenchar\font45 \char92 - xintiloopskip\-and\-redo} to skip to the end of the current iteration and redo -it with the same value of the index (something else will have to change for this -not to become an eternal loop\dots ). - -Inside alignments, if the looped-over text contains a |&| or a |\cr|, any -un-expandable material before a \csbxint{iloopindex} will make it fail because -of |\endtemplate|; in such cases one can always either replace |&| by a macro -expanding to it or replace it by a suitable |\firstofone{&}|, and similarly for -|\cr|. - -\phantomsection\label{edefprimes} -As an example, let us construct an |\edef\z{...}| which will define |\z| to be a -list of prime numbers: -\begin{everbatim*} -\begingroup -\edef\z -{\xintiloop [10001+2] - {\xintiloop [3+2] - \ifnum\xintouteriloopindex<\numexpr\xintiloopindex*\xintiloopindex\relax - \xintouteriloopindex, - \expandafter\xintbreakiloop - \fi - \ifnum\xintouteriloopindex=\numexpr - (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax - \else - \repeat - }% no space here - \ifnum \xintiloopindex < 10999 \repeat }% -\meaning\z\endgroup -\end{everbatim*}and we should have taken -some steps to not have a trailing comma, but -the point was to show that one can do that in an |\edef|\,! See also -\autoref{ssec:primesII} which extracts from this code its way of testing -primality. - -Let us create an alignment where each row will contain all divisors of its -first entry. -Here is the output, thus obtained without any count register: -\begin{everbatim*} -\begin{multicols}2 -\tabskip1ex \normalcolor -\halign{&\hfil#\hfil\cr - \xintiloop [1+1] - {\expandafter\bfseries\xintiloopindex & - \xintiloop [1+1] - \ifnum\xintouteriloopindex=\numexpr - (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax - \xintiloopindex&\fi - \ifnum\xintiloopindex<\xintouteriloopindex\space % CRUCIAL \space HERE - \repeat \cr }% - \ifnum\xintiloopindex<30 - \repeat -} -\end{multicols} -\end{everbatim*} -We wanted this first entry in bold face, but |\bfseries| leads to -unexpandable tokens, so the |\expandafter| was necessary for |\xintiloopindex| -and |\xintouteriloopindex| not to be confronted with a hard to digest -|\endtemplate|. An alternative way of coding: -% -\begin{everbatim} -\tabskip1ex -\def\firstofone #1{#1}% -\halign{&\hfil#\hfil\cr - \xintiloop [1+1] - {\bfseries\xintiloopindex\firstofone{&}% - \xintiloop [1+1] \ifnum\xintouteriloopindex=\numexpr - (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax - \xintiloopindex\firstofone{&}\fi - \ifnum\xintiloopindex<\xintouteriloopindex\space % \space is CRUCIAL - \repeat \firstofone{\cr}}% - \ifnum\xintiloopindex<30 \repeat } -\end{everbatim} - -\begin{framed} - The next utilities are not compatible with expansion-only context. -\end{framed} - -\subsection{\csbh{xintApplyInline}}\label{xintApplyInline} - - -\csa{xintApplyInline}|{\macro}|\marg{list}\ntype{o{\lowast f}} works non -expandably. It applies the one-parameter |\macro| to the first element of the -expanded list (|\macro| may have itself some arguments, the list item will be -appended as last argument), and is then re-inserted in the input stream after -the tokens resulting from this first expansion of |\macro|. The next item is -then handled. - -This is to be used in situations where one needs to do some repetitive -things. It is not expandable and can not be completely expanded inside a -macro definition, to prepare material for later execution, contrarily to what -\csbxint{Apply} or \csbxint{ApplyUnbraced} achieve. - -\begin{everbatim*} -\def\Macro #1{\advance\cnta #1 , \the\cnta} -\cnta 0 -0\xintApplyInline\Macro {3141592653}. -\end{everbatim*} -The first argument |\macro| does not have to be an expandable macro. - -\csa{xintApplyInline} submits its second, token list parameter to an -\hyperref[ssec:expansions]{\fexpan -sion}. Then, each \emph{unbraced} item will also be \fexpan ded. This provides -an easy way to insert one list inside another. \emph{Braced} items are not -expanded. Spaces in-between items are gobbled (as well as those at the start -or the end of the list), but not the spaces \emph{inside} the braced items. - -\csa{xintApplyInline}, despite being non-expandable, does survive to -contexts where the executed |\macro| closes groups, as happens inside -alignments with the tabulation character |&|. -This tabular provides an example:\par -\begin{everbatim*} -\centerline{\normalcolor\begin{tabular}{ccc} - $N$ & $N^2$ & $N^3$ \\ \hline - \def\Row #1{ #1 & \xintiiSqr {#1} & \xintiiPow {#1}{3} \\ \hline }% - \xintApplyInline \Row {\xintCSVtoList{17,28,39,50,61}} -\end{tabular}}\medskip -\end{everbatim*} - -We see that despite the fact that the first encountered tabulation character in -the first row close a group and thus erases |\Row| from \TeX's memory, -|\xintApplyInline| knows how to deal with this. - -Using \csbxint{ApplyUnbraced} is an alternative: the difference is that -this would have prepared all rows first and only put them back into the -token stream once they are all assembled, whereas with |\xintApplyInline| -each row is constructed and immediately fed back into the token stream: when -one does things with numbers having hundreds of digits, one learns that -keeping on hold and shuffling around hundreds of tokens has an impact on -\TeX{}'s speed (make this ``thousands of tokens'' for the impact to be -noticeable). - -One may nest various |\xintApplyInline|'s. For example (see the -\hyperref[float]{table} \vpageref{float}):\par -\begin{everbatim*} -\begin{figure*}[ht!] - \centering\phantomsection\label{float} - \def\Row #1{#1:\xintApplyInline {\Item {#1}}{0123456789}\\ }% - \def\Item #1#2{&\xintiPow {#1}{#2}}% - \centeredline {\begin{tabular}{ccccccccccc} &0&1&2&3&4&5&6&7&8&9\\ \hline - \xintApplyInline \Row {0123456789} - \end{tabular}} -\end{figure*} -\end{everbatim*} - -One could not move the definition of |\Item| inside the tabular, -as it would get lost after the first |&|. But this -works: -\everb|@ -\begin{tabular}{ccccccccccc} - &0&1&2&3&4&5&6&7&8&9\\ \hline - \def\Row #1{#1:\xintApplyInline {&\xintiPow {#1}}{0123456789}\\ }% - \xintApplyInline \Row {0123456789} -\end{tabular} -| - -A limitation is that, contrarily to what one may have expected, the -|\macro| for an |\xintApplyInline| can not be used to define -the |\macro| for a nested sub-|\xintApplyInline|. For example, -this does not work:\par -\everb|@ - \def\Row #1{#1:\def\Item ##1{&\xintiPow {#1}{##1}}% - \xintApplyInline \Item {0123456789}\\ }% - \xintApplyInline \Row {0123456789} % does not work -| -\noindent But see \csbxint{For}. - -\subsection{\csbh{xintFor}, \csbh{xintFor*}}\label{xintFor}\label{xintFor*} - -\csbxint{For}\ntype{on} is a new kind of for loop.\footnote{first introduced - with \xintname |1.09c| of |2013/10/09|.} Rather than using macros -for encapsulating list items, its behavior is like a macro with parameters: -|#1|, |#2|, \dots, |#9| are used to represent the items for up to nine levels of -nested loops. Here is an example: -% -\everb|@ -\xintFor #9 in {1,2,3} \do {% - \xintFor #1 in {4,5,6} \do {% - \xintFor #3 in {7,8,9} \do {% - \xintFor #2 in {10,11,12} \do {% - $$#9\times#1\times#3\times#2=\xintiiPrd{{#1}{#2}{#3}{#9}}$$}}}} -| -\noindent This example illustrates that one does not have to use |#1| as the -first one: -the order is arbitrary. But each level of nesting should have its specific macro -parameter. Nine levels of nesting is presumably overkill, but I did not know -where it was reasonable to stop. |\par| tokens are accepted in both the comma -separated list and the replacement text. - -\begin{framed} - \TeX nical notes: - -\begin{itemize} - \item The |#1| is replaced in the iterated-over text exactly as in general - \TeX\ macros or \LaTeX\ commands. This spares the user quite a few - |\expandafter|'s or other tricks needed with loops which have the - values encapsulated in macros, like \LaTeX's |\@for| and |\@tfor|. - - \item \csa{xintFor} (and \csa{xintFor*}) isn't purely expandable: one can - not use it inside an |\edef|. But it may be used, as will be shown in - examples, in some contexts such as \LaTeX's |tabular| which are usually - hostile to non-expandable loops. - - \item \csa{xintFor} (and \csa{xintFor*}) does some assignments prior to - executing each iteration of the replacement text, but it acts purely - expandably after the last iteration, hence if for example the replacement - text ends with a |\\|, the loop can be used insided a tabular and be - followed by a |\hline| without creating the dreaded ``|Misplaced - \noalign|'' error. - - \item It does not create groups. - - \item It makes no global assignments. - - \item The iterated replacement text may close a group which was opened even - before the start of the loop (typical example being with |&| in - alignments). -\begin{everbatim*} -\begin{tabular}{rccccc} - \hline - \xintFor #1 in {A, B, C} \do {% - #1:\xintFor #2 in {a, b, c, d, e} \do {&($ #2 \to #1 $)}\\ }% - \hline -\end{tabular} -\end{everbatim*} - - \item There is no facility provided which would give access to a count of - the number of iterations as it is technically not easy to do so it in a - way working with nested loops while maintaining the ``expandable after - done'' property; something in the spirit of \csbxint{iloopindex} is - possible but this approach would bring its own limitations and - complications. Hence the user is invited to update her own count or - \LaTeX{} counter or macro at each iteration, if needed. - - \item A |\macro| whose definition uses internally an \csbxint{For} loop - may be used inside another \csbxint{For} loop even if the two loops both - use the same macro parameter. The loop definition inside |\macro| - must use |##| as is the general rule for definitions done inside macros. - - \item \csbxint{For} is for comma separated values and \csbxint{For*} for - lists of braced items; their respective expansion policies differ. They - are described later. +\item \csbxint{iNum} which converts to strict integer format an input in + \emph{extended} integer format, i.e. admitting multiple leading plus or + minus signs, then possibly leading zeroes, then digits, +\item \csbxint{Num} which is an alias for the former, which gets redefined by + \xintfracname to accept more generally also decimal numbers or fractions as + input and which truncates them to integers. +\item most macros listed in \autoref{ssec:coredeprecated}. They will get + removed at some future release. \end{itemize} -\unskip -\end{framed} - -\noindent Regarding \csbxint{For}: -\begin{itemize}[nosep, listparindent=\leftmarginiii] -\item the spaces between the various declarative elements are all optional, -\item in the list of comma separated values, spaces around the commas or at - the start and end are ignored, -\item if an item must contain itself its own commas, then it should - be braced, and the braces will be removed before feeding the iterated-over - text, -\item the list may be a macro, it is expanded only once, -\item items are not pre-expanded. The first item should be braced or start - with a space if the list is explicit and the item should not be - pre-expanded, -\item empty items give empty |#1|'s in the replacement text, they are not - skipped, -\item an empty list executes once the replacement text with an empty parameter - value, -\item the list, if not a macro, \fbox{must be braced.} -\end{itemize} - -\noindent Regarding \csbxint{For*}:\ntype{{\lowast f}n} -\begin{itemize}[nosep, listparindent=\leftmarginiii] -\item it handles lists of braced items (or naked tokens), -\item it \hyperref[ssec:expansions]{\fexpan ds} the list, -\item and more generally it \hyperref[ssec:expansions]{\fexpan ds} each naked - token encountered - before assigning the |#1| values (gobbling spaces in the process); - this - makes it easy to simulate concatenation of multiple lists|\x|, |\y|: - if |\x| expands to |{1}{2}{3}| and |\y| expands to |{4}{5}{6}| then |{\x\y}| - as argument to |\xintFor*| has the same effect as |{{1}{2}{3}{4}{5}{6}}|. - - For a further illustration see the use of |\xintFor*| at the end of - \autoref{ssec:fibonacci}. -\item spaces at the start, end, or in-between items are gobbled (but naturally - not the spaces inside \emph{braced} items), -\item except if the list argument is a macro (with no parameters), \fbox{it - must be braced.}, -\item an empty list leads to an empty result. -\end{itemize} - -The macro \csbxint{Seq} which generates arithmetic sequences is to be used -with \csbxint{For*} as its output consists of successive braced numbers (given -as digit tokens). -\begin{everbatim*} -\xintFor* #1 in {\xintSeq [+2]{-7}{+2}}\do {stuff - with #1\xintifForLast{\par}{\newline}} -\end{everbatim*} - - -When nesting \csa{xintFor*} loops, using \csa{xintSeq} in the inner loops is -inefficient, as the arithmetic sequence will be re-created each time. A more -efficient style is: -% -\begin{everbatim} - \edef\innersequence {\xintSeq[+2]{-50}{50}}% - \xintFor* #1 in {\xintSeq {13}{27}} \do - {\xintFor* #2 in \innersequence \do {stuff with #1 and #2}% - .. some other macros .. } -\end{everbatim} - -This is a general remark applying for any nesting of loops, one should avoid -recreating the inner lists of arguments at each iteration of the outer loop. - - -When the loop is defined inside a macro for later execution the |#| characters -must be doubled.% -% -\footnote{sometimes what seems to be a macro argument isn't really; in - \csa{raisebox\{1cm\}\{}\csa{xintFor \#1 in \{a,b,c\} }\csa{do - \{\#1\}\}} no doubling should be done.} -% -For example: -% -\begin{everbatim*} -\def\T{\def\z {}% - \xintFor* ##1 in {{u}{v}{w}} \do {% - \xintFor ##2 in {x,y,z} \do {% - \expandafter\def\expandafter\z\expandafter {\z\sep (##1,##2)} }% - }% -}% -\T\def\sep {\def\sep{, }}\z -\end{everbatim*} - -Similarly when the replacement text -of |\xintFor| defines a macro with parameters, the macro character |#| must be -doubled. - - -The iterated macros as well as the list items are allowed to contain explicit -|\par| tokens. - -\subsection{\csbh{xintifForFirst}, \csbh{xintifForLast}} -\label{xintifForFirst}\label{xintifForLast} - -\csbxint{ifForFirst}\,\texttt{\{YES branch\}\{NO branch\}}\etype{nn} - and \csbxint{ifForLast}\,\texttt{\{YES - branch\}\hskip 0pt plus 0.2em \{NO branch\}}\etype{nn} execute the |YES| or -|NO| branch -if the -\csbxint{For} -or \csbxint{For*} loop is currently in its first, respectively last, iteration. - -Designed to work as expected under nesting (but see frame next.) Don't forget -an empty brace pair |{}| if a branch is to do nothing. May be used multiple -times in the replacement text of the loop. +Most deprecated macros listed in \autoref{ssec:coredeprecated} were by design +applying \csbxint{Num} to their inputs. This was signaled in the macro +description by a \smash{\textcolor[named]{PineGreen}{\Numf}} sign in the +margin,\IMPORTANT and typically the macro had a single |i| in its name, for +example \csa{xintiAdd} was such a companion to \csa{xintiiAdd}. \xintfracname +redefined \csbxint{Num} to be the a macro accepting general fractional input +and truncating it to an integer. Hence a macro such as \csa{xintiAdd} was +compatible with the output format of \xintfracname macros, contrarily to +\csbxint{iiAdd} which handles only strict integer format for its inputs. Of +course, \xintfracname defined also its own \csbxint{Add} which did the +addition of its arguments without truncating them to integers... (but whose +output format is the |A/B[N]| format explained in \autoref{ssec:outputs}, +hence even if representing a small integer it can not be used directly in a +\TeX\ context such as |\ifnum|, contrarily to deprecated \csa{xintiAdd} or to +\csbxint{iiAdd}.) \begin{framed} - \noindent Pay attention to these implementation features: - \begin{itemize}[nosep, listparindent=\leftmarginiii] - \item \emph{if an inner \csbxint{For} loop is positioned before the - \csb{xintifForFirst} or \csb{xintifForLast} of the outer loop it will - contaminate their settings. This applies also naturally if the inner loop - arises from the expansion of some macro located before the outer - conditionals.} - - One fix is to make sure that the outer conditionals are expanded before the - inner loop is executed, e.g. this will be the case if the inner loop is - located inside one of the branches of the conditional. - - Another approach is to enclose, if feasible, the inner loop in a group of - its own. - \item \emph{if the replacement text closes a group (e.g. from a |&| inside an - alignment), the conditionals will lose their ascribed meanings and end up - possibly undefined, depending whether there is some outer loop whose - execution started before the opening of the group.} - - The fix is to arrange things so that the conditionals are expanded - before \TeX\ encounters the closing-group token. - \end{itemize} -\end{framed} - -\subsection{ \csbh{xintBreakFor}, \csbh{xintBreakForAndDo}} -\label{xintBreakFor}\label{xintBreakForAndDo} - -One may immediately terminate an \csbxint{For} or \csbxint{For*} loop with -\csbxint{BreakFor}. - -\begin{framed} - As it acts by clearing up all the rest of the replacement text when - encountered, it will not work from inside some |\if...\fi| without - suitable |\expandafter| or swapping technique. - - Also it can't be used from inside braces as from there it can't see the end - of the replacement text. + This situation\CHANGEDf{1.2o} was the result of some early-on design + decisions which now appear misguided and impede further development. Hence, + at |1.2o| it has been decided to deprecate \emph{all} such |i|-macros. \end{framed} +The |ii| in the names of the macros such as \csbxint{iiAdd} serves to stress +that they accept only strict integers as input (this is signaled by the margin +annotation \textcolor[named]{PineGreen}{\emph{f}}), or macros \fexpan ding to +such strict format (big) integers and that they produce strict integers as +output. -There is also \csbxint{BreakForAndDo}. Both are illustrated by various examples -in the next section which is devoted to ``forever'' loops. - -\subsection{\csbh{xintintegers}, \csbh{xintdimensions}, \csbh{xintrationals}} -\label{xintegers}\label{xintintegers} -\label{xintdimensions}\label{xintrationals} - -If the list argument to \csbxint{For} (or \csbxint{For*}, both are equivalent in -this context) is \csbxint{integers} (equivalently \csbxint{egers}) or more -generally \csbxint{integers}|[||start|\allowbreak|+|\allowbreak|delta||]| -(\emph{the whole within braces}!)% -% -\footnote{the |start+delta| optional specification may have extra spaces - around the plus sign of near the square brackets, such spaces are - removed. The same applies with \csa{xintdimensions} and - \csa{xintrationals}.}, -% -then \csbxint{For} does an infinite iteration where -|#1| (or |#2|, \dots, |#9|) will run through the arithmetic sequence of (short) -integers with initial value |start| and increment |delta| (default values: -|start=1|, |delta=1|; if the optional argument is present it must contains both -of them, and they may be explicit integers, or macros or count registers). The -|#1| (or |#2|, \dots, |#9|) will stand for |\numexpr <opt sign><digits>\relax|, -and the litteral representation as a string of digits can thus be obtained as -\fbox{\csa{the\#1}} or |\number#1|. Such a |#1| can be used in an |\ifnum| test -with no need to be postfixed with a space or a |\relax| and one should -\emph{not} add them. - -If the list argument is \csbxint{dimensions} or more generally -\csbxint{dimensions}|[||start|\allowbreak|+|\allowbreak|delta||]| (\emph{within - braces}!), then -\csbxint{For} does an infinite iteration where |#1| (or |#2|, \dots, |#9|) will -run through the arithmetic sequence of dimensions with initial value -|start| and increment |delta|. Default values: |start=0pt|, |delta=1pt|; if -the optional argument is present it must contain both of them, and they may -be explicit specifications, or macros, or dimen registers, or length macros -in \LaTeX{} (the stretch and shrink components will be discarded). The |#1| -will be |\dimexpr <opt sign><digits>sp\relax|, from which one can get the -litteral (approximate) representation in points via |\the#1|. So |#1| can be -used anywhere \TeX{} expects a dimension (and there is no need in conditionals -to insert a |\relax|, and one should \emph{not} do it), and to print its value -one uses \fbox{\csa{the\#1}}. The chosen representation guarantees exact -incrementation with no rounding errors accumulating from converting into -points at each step. - - - - - - -If the list argument to \csbxint{For} (or \csbxint{For*}) is \csbxint{rationals} -or more generally -\csbxint{rationals}|[||start|\allowbreak|+|\allowbreak|delta||]| (\emph{within - braces}!), then \csbxint{For} does an infinite iteration where |#1| (or |#2|, -\dots, |#9|) will run through the arithmetic sequence of \xintfracname fractions -with initial value |start| and increment |delta| (default values: |start=1/1|, -|delta=1/1|). This loop works \emph{only with \xintfracname loaded}. if the -optional argument is present it must contain both of them, and they may be given -in any of the formats recognized by \xintfracname (fractions, decimal -numbers, numbers in scientific notations, numerators and denominators in -scientific notation, etc...) , or as macros or count registers (if they are -short integers). The |#1| (or |#2|, \dots, |#9|) will be an |a/b| fraction -(without a |[n]| part), where -the denominator |b| is the product of the denominators of -|start| and |delta| (for reasons of speed |#1| is not reduced to irreducible -form, and for another reason explained later |start| and |delta| are not put -either into irreducible form; the input may use explicitely \csa{xintIrr} to -achieve that). -\begin{everbatim*} -\begingroup\small -\noindent\parbox{\dimexpr\linewidth-3em}{\color[named]{OrangeRed}% -\xintFor #1 in {\xintrationals [10/21+1/21]} \do -{#1=\xintifInt {#1} - {\textcolor{blue}{\xintTrunc{10}{#1}}} - {\xintTrunc{10}{#1}}% display in blue if an integer - \xintifGt {#1}{1.123}{\xintBreakFor}{, }% - }} -\endgroup\smallskip -\end{everbatim*} - -\smallskip The example above confirms that computations are done exactly, and -illustrates that the two initial (reduced) denominators are not multiplied when -they are found to be equal. It is thus recommended to input |start| and |delta| -with a common smallest possible denominator, or as fixed point numbers with the -same numbers of digits after the decimal mark; and this is also the reason why -|start| and |delta| are not by default made irreducible. As internally the -computations are done with numerators and denominators completely expanded, one -should be careful not to input numbers in scientific notation with exponents in -the hundreds, as they will get converted into as many zeroes. - -\begin{everbatim*} -\noindent\parbox{\dimexpr.7\linewidth}{\raggedright -\xintFor #1 in {\xintrationals [0.000+0.125]} \do -{\edef\tmp{\xintTrunc{3}{#1}}% - \xintifInt {#1} - {\textcolor{blue}{\tmp}} - {\tmp}% - \xintifGt {#1}{2}{\xintBreakFor}{, }% - }}\smallskip -\end{everbatim*} - -We see here that \csbxint{Trunc} outputs (deliberately) zero as $0$, not (here) -$0.000$, the idea being not to lose the information that the truncated thing was -truly zero. Perhaps this behavior should be changed? or made optional? Anyhow -printing of fixed points numbers should be dealt with via dedicated packages -such as |numprint| or |siunitx|.\par - - -\subsection{\csbh{xintForpair}, \csbh{xintForthree}, \csbh{xintForfour}}\label{xintForpair}\label{xintForthree}\label{xintForfour} - -The syntax\ntype{on} is illustrated in this -example. The notation is the usual one for |n|-uples, with parentheses and -commas. Spaces around commas and parentheses are ignored. +Other macros, such as \csbxint{Double}, lack the |ii|, but this is only a +legacy of the history of the package and they have the same requirements for +input and format of output as the |ii|-macros.% % -\begin{everbatim*} -{\centering\begin{tabular}{cccc} - \xintForpair #1#2 in { ( A , a ) , ( B , b ) , ( C , c ) } \do {% - \xintForpair #3#4 in { ( X , x ) , ( Y , y ) , ( Z , z ) } \do {% - $\Biggl($\begin{tabular}{cc} - -#1- & -#3-\\ - -#4- & -#2-\\ - \end{tabular}$\Biggr)$&}\\\noalign{\vskip1\jot}}% -\end{tabular}\\} -\end{everbatim*} +\footnote{Regarding \csbxint{FDg} and \csbxint{LDg}, this is a breaking change + because formerly they used \csbxint{Num}.} -\csbxint{Forpair} must be followed by either |#1#2|, |#2#3|, |#3#4|, \dots, or -|#8#9| with |#1| usable as an alias for |#1#2|, |#2| as alias for |#2#3|, -etc \dots\ and similarly for \csbxint{Forthree} (using |#1#2#3| or simply -|#1|, |#2#3#4| or simply |#2|, \dots) and \csbxint{Forfour} (with |#1#2#3#4| -etc\dots). - -Nesting works as long as the macro parameters are distinct among |#1|, |#2|, -..., |#9|. A macro which expands to an \csa{xintFor} or a -\csa{xintFor(pair,three,four)} can be used in another one with no constraint -about using distinct macro parameters. - -|\par| tokens are accepted in both the comma separated list and the -replacement text. - - -\subsection{\csbh{xintAssign}}\label{xintAssign} - -\csa{xintAssign}\meta{braced things}\csa{to}% -\meta{as many cs as they are things} %\ntype{{(f$\to$\lowast [x)}{\lowast N}} -% -defines (without checking if something gets overwritten) the control sequences -on the right of \csa{to} to expand to the successive tokens or braced items -located to the left of \csa{to}. \csa{xintAssign} is not an expandable macro. - -\fexpan sion is first applied to the material in front of \csa{xintAssign} -which is fetched as one argument if it is braced. Then the expansion of this -argument is examined and successive items are assigned to the macros following -|\to|. There must be exactly as many macros as items. No check is done. The -macro assignments are done with removal of one level of brace pairs from each -item. - -After the initial \fexpan sion, each assigned (brace-stripped) item will be -expanded according to the setting of the optional parameter. - -For example |\xintAssign [e]...| means that all assignments are done using -|\edef|. With |[f]| the assignments will be made using -\hyperref[fdef]{\ttfamily\char92fdef}. The default is simply to make the -definitions with |\def|, corresponding to an empty optional paramter |[]|. -Possibilities for the optional parameter are: |[], [g], [e], [x], [o], [go], -[oo], [goo], [f], [gf]|. For example |[oo]| means a double expansion. -\begin{everbatim*} -\xintAssign \xintiiDivision{1000000000000}{133333333}\to\Q\R -\meaning\Q\newline -\meaning\R\newline -\xintAssign {{\xintiiDivision{1000000000000}{133333333}}}\to\X -\meaning\X\newline -\xintAssign [oo]{{\xintiiDivision{1000000000000}{133333333}}}\to\X -\meaning\X\newline -\xintAssign \xintiiPow{7}{13}\to\SevenToThePowerThirteen -\meaning\SevenToThePowerThirteen\par -\end{everbatim*} - -Two special cases: -\begin{itemize}[nosep] -\item if after this initial expansion no brace is found immediately after - \csa{xintAssign}, it is assumed that there is only one control sequence - following |\to|, and this control sequence is then defined via |\def| (or - what is set-up by the optional parameter) to expand to the material between - \csa{xintAssign} and \csa{to}. -\item if the material between \csa{xintAssign} and |\to| is enclosed in two - brace pairs, the first brace pair is removed, then the \fexpan sion is - immediately stopped by the inner brace pair, hence \csa{xintAssign} now - finds a unique item and thus defines only a single macro to be this item, - which is now stripped of the second pair of braces. -\end{itemize} +The letter \texttt{x} (with margin annotation +\smash{\textcolor[named]{PineGreen}{\numx}}) stands for an argument which will +be handled embedded in |\numexpr..\relax|. It will thus be completely expanded +and must give an integer obeying the \TeX{} bounds. See also +\autoref{sec:useofcount}. This is the case for the argument of \csbxint{iiFac} +or the exponent argument of \csbxint{iiPow}. +The {\color[named]{PineGreen}$\star$}'s in the margin are there to remind of +the complete expandability, even \fexpan dability of the macros, as discussed +in \autoref{ssec:expansions}. -\emph{Note:} prior to release |1.09j|, |\xintAssign| did an |\edef| by default -for each item assignment but it now does |\def| corresponding to no or empty -optional parameter. +\subsection{\csbh{xintiNum}}\label{xintiNum} -It is allowed for the successive braced items to be separated by spaces. They -are removed during the assignments. But if a single macro is defined (which -happens if the argument after \fexpan sion does not start with a brace), -naturally the scooped up material has all intervening spaces, as it is -considered a -single item. But an upfront initial space will have been absorbed by \fexpan -sion. +|\xintiNum|\n\etype{f} removes chains of plus or minus signs, followed by +zeroes. \begin{everbatim*} -\def\X{ {a} {b} {c} {d} }\def\Y { u {a} {b} {c} {d} } -\xintAssign\X\to\A\B\C\D -\xintAssign\Y\to\Z -\meaning\A, \meaning\B, \meaning\C, \meaning\D+++\newline -\meaning\Z+++\par +\xintiNum{+---++----+--000000000367941789479} \end{everbatim*} -As usual successive space characters in input make for a single \TeX\ space token. +\subsection{\csbh{xintDouble}}\label{xintDouble} -\subsection{\csbh{xintAssignArray}}\label{xintAssignArray} +|\xintDouble|\n\etype{f} computes |2N|. -\xintAssignArray \xintBezout {1000}{113}\to\Bez +\subsection{\csbh{xintHalf}}\label{xintHalf} -\csa{xintAssignArray}\meta{braced - things}\csa{to}\csa{myArray} %\ntype{{(f$\to$\lowast x)}N} -% -first expands fully what comes immediately after |\xintAssignArray| and -expects to find a list of braced things |{A}{B}...| (or tokens). It then -defines \csa{myArray} as a macro with one parameter, such that \csa{myArray\x} -expands to give the |x|th braced thing of this original -list (the argument \texttt{\x} itself is fed to a |\numexpr| by |\myArray|, -and |\myArray| expands in two steps to its output). With |0| as parameter, -\csa{myArray}|{0}| returns the number |M| of elements of the array so that the -successive elements are \csa{myArray}|{1}|, \dots, \csa{myArray}|{M}|. -% -\leftedline{|\xintAssignArray \xintBezout {1000}{113}\to\Bez|} will set -|\Bez{0}| to \dtt{\Bez0}, |\Bez{1}| to \dtt{\Bez1}, |\Bez{2}| to -\dtt{\Bez2}, |\Bez{3}| to \dtt{\Bez3}, |\Bez{4}| to -\dtt{\Bez4}, and |\Bez{5}| to \dtt{\Bez5}: -\dtt{(\Bez3)${}\times{}$\Bez1${}-{}$(\Bez4)${}\times{}$\Bez2${}={}$\Bez5.} -This macro is incompatible with expansion-only contexts. +|\xintHalf|\n\etype{f} computes |N/2| +truncated towards zero. -\csa{xintAssignArray} admits an optional parameter, for example -|\xintAssignArray [e]| means that the definitions of the macros will be made -with |\edef|. The empty optional parameter (default) means that definitions -are done with |\def|. Other possibilities: |[], [o], [oo], [f]|. Contrarily to -\csbxint{Assign} one can not use the |g| here to make the definitions global. -For this, one should rather do |\xintAssignArray| within a group starting with -|\globaldefs 1|. +\subsection{\csbh{xintInc}}\label{xintInc} +|\xintInc|\n\etype{f} evaluates |N+1|. -\subsection{\csbh{xintDigitsOf}}\label{xintDigitsOf} +\subsection{\csbh{xintDec}}\label{xintDec} -This is a synonym for \csbxint{AssignArray},\ntype{fN} to be used to define -an array giving all the digits of a given (positive, else the minus sign will -be treated as first item) number. -\begingroup\xintDigitsOf\xintiPow {7}{500}\to\digits -% -\leftedline{|\xintDigitsOf\xintiPow {7}{500}\to\digits|} -\noindent $7^{500}$ has |\digits{0}=|\digits{0} digits, and the 123rd among them -(starting from the most significant) is -|\digits{123}=|\digits{123}. -\endgroup +|\xintDec|\n\etype{f} evaluates |N-1|. -\subsection{\csbh{xintRelaxArray}}\label{xintRelaxArray} - -\csa{xintRelaxArray}\csa{myArray} %\ntype{N} -% -(globally) sets to \csa{relax} all macros which were defined by the previous -\csa{xintAssignArray} with \csa{myArray} as array macro. - - - -\clearpage -\section{Macros of the \xintcorename package} -\label{sec:core} - -\localtableofcontents - -Prior to release |1.1| the macros which are now included in the separate -package \xintcorename were part of \xintname. Package \xintcorename is -automatically loaded by \xintname.\IMPORTANT\ - -\xintcorename provides the five basic arithmetic operations on big integers: -addition, subtraction, multiplication, division and powers. Division may be -either rounded (\csbxint{iiDivRound}) (the rounding of |0.5| is |1| and the -one of |-0.5| is |-1|) or Euclidean (\csbxint{iiQuo}) (which for positive -operands is the same as truncated division), or truncated (\csbxint{iiDivTrunc}). - -In the description of the macros the \texttt{\n} and \texttt{\m} symbols stand -for explicit (big) integers within braces or more generally any control -sequence (possibly within braces) \hyperref[ssec:expansions]{\fexpan ding} to -such a big integer. - -The macros with a single |i| in their names parse their arguments -automatically through \hyperref[xintiNum]{\string\xintNum}. This type of -expansion applied to an argument is signaled by a -\textcolor[named]{PineGreen}{\Numf} in the margin. The accepted input format -is then a sequence of plus and minus signs, followed by some string of zeroes, -followed by digits. - -If \xintfracname additionally to \xintcorename is loaded, \csbxint{Num} -becomes a synonym to \csbxint{TTrunc}; this means that -arbitrary fractions will be accepted as arguments of the -macros with a single |i| in their names, but get truncated to integers before -further processing. The format of the output will be as with only \xintname -loaded. The only extension is in allowing a wider variety of inputs. - -The macros with |ii| in their names have arguments which will only be \fexpan -ded, but will not be parsed via \hyperref[xintiNum]{\string\xintNum}. -Arguments of this type are signaled by the margin annotation -\textcolor[named]{PineGreen}{\emph{f}}. For such big integers only one minus -sign and no plus sign, nor leading zeros, are accepted. |-0| is not valid in -this strict input format. Loading \xintfracname does not bring any -modification to these macros whether for input or output. +\subsection{\csbh{xintDSL}}\label{xintDSL} -The letter \texttt{x} (with margin annotation -\textcolor[named]{PineGreen}{\numx}) stands for something which will be -inserted in-between a |\numexpr| and a |\relax|. It will thus be completely -expanded and must give an integer obeying the \TeX{} bounds. Thus, it may be -for example a count register, or itself a \csa{numexpr} expression, or just a -number written explicitely with digits or something like |4*\count 255 + 17|, -etc... +|\xintDSL|\n\etype{f} is decimal shift left, \emph{i.e.} multiplication by +ten. -For the rules regarding direct use of count registers or \csa{numexpr} -expression, in the arguments to the package macros, see the -\autoref{sec:useofcount} section. +\subsection{\csbh{xintDSR}}\label{xintDSR} -\begin{framed} - The macros \csbxint{iAdd}, \csbxint{iMul}, \dots, respectively - \csbxint{iiAdd}, \csbxint{iiMul}, \dots from \xintcorename are guaranteed to - always output an integer without a trailing |/B| or |[N]|. The |ii| macros - have the lesser overhead; the |i| macros can be used (if \xintfracname is - loaded), with fractions, as they will truncate their arguments to integers. - But their output format remains unmodified: integers with no fraction slash - nor |[N]|. -\end{framed} +|\xintDSR|\n\etype{f} is truncated decimal shift right, \emph{i.e.} it is the +truncation of |N/10| towards zero. -The {\color[named]{PineGreen}$\star$}'s in the margin are there to remind of -the complete expandability, even \fexpan dability of the macros, as discussed -in \autoref{ssec:expansions}. +\subsection{\csbh{xintDSRr}}\label{xintDSRr} +|\xintDSRr|\n\etype{f} is rounded decimal shift right, \emph{i.e.} it is the +rounding of |N/10| away from zero. It is needed in \xintcorename for use by +\csbxint{iiDivRound}.\NewWith {1.2i} -\subsection{\csbh{xintNum}, \csbh{xintiNum}}\label{xintiNum} +\subsection{\csbh{xintFDg}}\label{xintFDg} -|\xintNum|\n\etype{f} removes chains of plus or minus signs, followed by -zeroes. % -% -\leftedline{|\xintNum{+---++----+--000000000367941789479}|\dtt - {=\xintNum{+---++----+--000000000367941789479}}} +|\xintFDg|\n\etype{f} outputs the first digit (most significant) of the +number. -All \xintname macros with a single |i| in their names, such as \csbxint{iAdd}, -\csbxint{iMul} apply \csbxint{Num} to their arguments. +\subsection{\csbh{xintLDg}}\label{xintLDg} -When \xintfracname is loaded, \csbxint{Num} becomes a synonym to -\csbxint{TTrunc}. And \csbxint{iNum} preserved the original integer only -meaning. +|\xintLDg|\n\etype{f} outputs the least significant digit. When the number +is positive, this is the same as the remainder in the euclidean division by +ten. -\subsection{\csbh{xintSgn}, \csbh{xintiiSgn}}\label{xintiiSgn} +\subsection{\csbh{xintiiSgn}}\label{xintiiSgn} |\xintiiSgn|\n\etype{f} returns 1 if the number is positive, 0 if it is zero -and -1 if it is negative. It skips the \csbxint{Num} overhead. - -\csbxint{Sgn}\etype{\Numf} is the variant using \csbxint{Num} and getting -extended by \xintfracname to fractions. - -\subsection{\csbh{xintiOpp}, \csbh{xintiiOpp}}\label{xintiOpp}\label{xintiiOpp} +and -1 if it is negative. -|\xintiOpp|\n\etype{\Numf} return the opposite |-N| of the number |N|. +\subsection{\csbh{xintiiOpp}}\label{xintiiOpp} -\csa{xintiiOpp} is the strict integer-only variant which skips -the \csbxint{Num} overhead.\etype{f} +|\xintiiOpp|\n\etype{f} outputs the opposite |-N| of the number |N|. Important note: an input such as |-\foo| is not legal, generally speaking, as argument to the macros of the \xintname bundle (except, naturally in \csbxint{expr}-essions). The reason is that the minus sign stops the \fexpan sion done during parsing of the inputs. One must use the syntax -|\xintiiOpp{\foo}| or |\xintiOpp{\foo}| when one wants to pass |-\foo| as +|\xintiiOpp{\foo}| if one wants to pass |-\foo| as argument to other macros. -\subsection{\csbh{xintiAbs}, \csbh{xintiiAbs}}\label{xintiAbs}\label{xintiiAbs} +\subsection{\csbh{xintiiAbs}}\label{xintiiAbs} -|\xintiAbs|\n\etype{\Numf} returns the absolute value of the number. - -\csa{xintiiAbs} skips the \csbxint{Num} overhead.\etype{f} - -\subsection{\csbh{xintiiFDg}}\label{xintFDg}\label{xintiiFDg} - -|\xintiiFDg|\n\etype{f} returns the first digit (most significant) of the -decimal expansion. It skips the overhead of parsing via \csbxint{Num}. The -variant \csa{xintFDg}\etype{\Numf} uses |\xintNum| and gets extended by -\xintfracname. - -\subsection{\csbh{xintiiLDg}}\label{xintLDg}\label{xintiiLDg} - -|\xintiiLDg|\n\etype{f} returns the least significant digit. When the number -is positive, this is the same as the remainder in the euclidean division by -ten. It skips the overhead of parsing via \csbxint{Num}. Rewritten with -|1.2i|. +|\xintiiAbs|\n\etype{f} outputs the absolute value of the number. -The variant \csa{xintLDg}\etype{\Numf} uses |\xintNum|. +\subsection{\csbh{xintiiAdd}}\label{xintiiAdd} -\subsection{\csbh{xintiAdd}, \csbh{xintiiAdd}}\label{xintiAdd}\label{xintiiAdd} +|\xintiiAdd|\n\m\etype{ff} computes the sum of the two (big) integers. -|\xintiAdd|\n\m\etype{\Numf\Numf} computes the sum of the two (big) integers. +\subsection{\csbh{xintiiCmp}}\label{xintiiCmp} -\csa{xintiiAdd} skips the \csbxint{Num} overhead.\etype{ff} - -\subsection{\csbh{xintCmp}, \csbh{xintiiCmp}} - -|\xintCmp|\n\m\etype{\Numf\Numf} returns \dtt{1} if |N>M|, \dtt{0} if |N=M|, +|\xintiiCmp|\n\m\etype{ff} produces \dtt{1} if |N>M|, \dtt{0} if |N=M|, and \dtt{-1} if |N<M|. -\csa{xintiiCmp} skips the \csbxint{Num} overhead.\etype{ff} - -\csbxint{Cmp} is re-defined by \xintfracname to accept fractions. - -|1.2l| has moved this macro from \xintname to \xintcorename. - -\subsection{\csbh{xintiSub}, \csbh{xintiiSub}}\label{xintiSub}\label{xintiiSub} - -|\xintiSub|\n\m\etype{\Numf\Numf} computes the difference |N-M|. +At |1.2l| this macro was moved from package \xintname to \xintcorename. -\csa{xintiiSub} skips the \csbxint{Num} overhead.\etype{ff} +\subsection{\csbh{xintiiSub}}\label{xintiiSub} -\subsection{\csbh{xintiMul}, \csbh{xintiiMul}}\label{xintiMul}\label{xintiiMul} +|\xintiiSub|\n\m\etype{ff} computes the difference |N-M|. -|\xintiMul|\n\m\etype{\Numf\Numf} computes the product of two (big) integers. +\subsection{\csbh{xintiiMul}}\label{xintiiMul} -\csa{xintiiMul} skips the \csbxint{Num} overhead.\etype{ff} +|\xintiiMul|\n\m\etype{ff} computes the product of two (big) integers. -\subsection{\csbh{xintiSqr}, \csbh{xintiiSqr}}\label{xintiSqr}\label{xintiiSqr} +\subsection{\csbh{xintiiSqr}}\label{xintiiSqr} -|\xintiSqr|\n\etype{\Numf} returns the square. +|\xintiiSqr|\n\etype{f} produces the square. -\csa{xintiiSqr} skips the \csbxint{Num} overhead.\etype{f} +\subsection{\csbh{xintiiPow}}\label{xintiiPow} -\subsection{\csbh{xintiPow}, \csbh{xintiiPow}}\label{xintiPow}\label{xintiiPow} - -|\xintiPow|\n\x\etype{\Numf\numx} returns |N^x|. When |x| is zero, this is 1. -If |N=0| and |x<0|, if \verb+|N|>1+ and |x<0|, an error is raised. There will -also be an error naturally if |x| exceeds the maximal \eTeX{} number -\dtt{\number"7FFFFFFF}, but the real limit for huge exponents comes from -either the computation time or the settings of some tex memory parameters. +|\xintiiPow|\n\x\etype{f\numx} computes |N^x|. For |x=0|, this is 1. For |N=0| +and |x<0|, or if \verb+|N|>1+ and |x<0|, an error is raised. There will also +be an error if |x| exceeds the maximal \eTeX{} number \dtt{\number"7FFFFFFF}, +but the real limit for exponents comes from either the computation time or the +settings of some \TeX\ memory parameters. \begin{framed} Indeed, the maximal power of $2$ which \xintname is able to compute @@ -10040,25 +8649,14 @@ either the computation time or the settings of some tex memory parameters. products). \end{framed} -Side remark: after all it does pay to think! I almost melted my CPU trying by -dichotomy to pin-point the exact maximal allowable |N| for |\xintiiPow 2{N}| -before finally making the reasoning above. Indeed, each such computation with -|N>130000| activates the fan of my laptop and results in so warm a keyboard -that I can hardly go on working on it! And it takes about 12 minutes for each -|\xintiiPow2{N}| with such |N|'s of the order of $130000$ (a.t.t.o.w.). - -When \xintfracname is loaded the type of the second argument to \csa{xintiPow} -becomes \Numf: fractional input is accepted but will be truncated to an -integer; it still must be non-negative else the macro would produce fractions. -For the version accepting negative (but still integer) exponents see -\csbxint{Pow}. - -\csa{xintiiPow} is the variant which skips the \csbxint{Num} -overhead\etype{f\numx} for the first argument. +% Side remark: after all it does pay to think! I almost melted my CPU trying by +% dichotomy to pin-point the exact maximal allowable |N| for |\xintiiPow 2{N}| +% before finally making the reasoning above. Indeed, each such computation with +% |N>130000| activates the fan of my laptop and results in so warm a keyboard +% that I can hardly go on working on it! And it takes about 12 minutes for each +% |\xintiiPow2{N}| with such |N|'s of the order of $130000$ (a.t.t.o.w.). - -\subsection{\csbh{xintiFac}, \csbh{xintiiFac}} -\label{xintiiFac} +\subsection{\csbh{xintiiFac}}\label{xintiiFac} |\xintiiFac|\x\etype{\numx} computes the factorial. @@ -10073,10 +8671,6 @@ overhead\etype{f\numx} for the first argument. -|\xintiFac| is originally a synonym. With \xintfracname loaded it applies -|\xintNum| to its argument and thus accepts a fractional input but truncates -it to an integer. - The |factorial| function, or equivalently |!| as post-fix operator is available in \csbxint{iiexpr}, \csbxint{expr}: \begin{everbatim*} @@ -10087,360 +8681,401 @@ used in \csbxint{floatexpr}. +\subsection{\csbh{xintiiDivision}}\label{xintiiDivision} -\subsection{\csbh{xintiDivision}, - \csbh{xintiiDivision}}\label{xintiDivision}\label{xintiiDivision} +|\xintiiDivision|\n\m\etype{ff} produces |{quotient}{remainder}|, in the sense +of (mathematical) Euclidean division: |N = QM + R|, +|0|${}\leq{}$\verb+R < |M|+. So the remainder is always non-negative and the +formula |N = QM + R| always holds independently of the signs of |N| or |M|. +Division by zero is an error (even if |N| vanishes) and returns |{0}{0}|. -|\xintiiDivision|\n\m\etype{ff} returns |{quotient Q}{remainder R}|. This is -euclidean division: |N = QM + R|, |0|${}\leq{}$\verb+R < |M|+. So the -remainder is always non-negative and the formula |N = QM + R| always holds -independently of the signs of |N| or |M|. Division by zero is an error (even -if |N| vanishes) and returns |{0}{0}|. It skips the overhead of parsing via -\csbxint{Num}. - -|\xintiDivision|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. - -\subsection{\csbh{xintiQuo}, \csbh{xintiiQuo}}\label{xintiQuo}\label{xintiiQuo} +\subsection{\csbh{xintiiQuo}}\label{xintiiQuo} -|\xintiiQuo|\n\m\etype{ff} returns the quotient from the euclidean division. -It skips the overhead of parsing via \csbxint{Num}. +|\xintiiQuo|\n\m\etype{ff} computes the quotient from the euclidean division. -|\xintiQuo|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. +\subsection{\csbh{xintiiRem}}\label{xintiiRem} -\subsection{\csbh{xintiRem}, \csbh{xintiiRem}}\label{xintiRem}\label{xintiiRem} +|\xintiiRem|\n\m\etype{ff} computes the remainder from the euclidean +division. -|\xintiiRem|\n\m\etype{ff} returns the remainder from the euclidean -division. It skips the overhead of parsing via \csbxint{Num}. - -|\xintiRem|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. - -\subsection{\csbh{xintiDivRound}, \csbh{xintiiDivRound}} -\label{xintiDivRound}\label{xintiiDivRound} +\subsection{\csbh{xintiiDivRound}}\label{xintiiDivRound} |\xintiiDivRound|\n\m\etype{ff} returns the rounded value of the algebraic -quotient $N/M$ of two big integers. The rounding is ``away from zero.'' The -macro skips the overhead of parsing via \csbxint{Num}. +quotient $N/M$ of two big integers. The rounding is ``away from zero.'' \begin{everbatim*} \xintiiDivRound {100}{3}, \xintiiDivRound {101}{3} \end{everbatim*} -|\xintiDivRound|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. - -\subsection{\csbh{xintiDivTrunc}, \csbh{xintiiDivTrunc}} -\label{xintiDivTrunc}\label{xintiiDivTrunc} +\subsection{\csbh{xintiiDivTrunc}}\label{xintiiDivTrunc} |\xintiiDivTrunc|\n\m\etype{ff} computes the truncation towards zero of the -algebraic quotient $N/M$. It skips the overhead of parsing the operands with -\csbxint{Num}. For $M>0$ it is the same as \csbxint{iiQuo}. +algebraic quotient $N/M$. For $M>0$ it is the same as \csbxint{iiQuo}. \begin{everbatim*} $\xintiiQuo {1000}{-57}, \xintiiDivRound {1000}{-57}, \xintiiDivTrunc {1000}{-57}$ \end{everbatim*} -|\xintiDivTrunc|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. - -\subsection{\csbh{xintiMod}, \csbh{xintiiMod}} -\label{xintiMod}\label{xintiiMod} +\subsection{\csbh{xintiiMod}}\label{xintiiMod} |\xintiiMod|\n\m\etype{ff} computes $N - M*t(N/M)$, where $t(N/M)$ is the -algebraic quotient truncated towards zero . The macro skips the overhead of parsing -the operands with \csbxint{Num}. For $M>0$ it is the same as \csbxint{iiRem}. +algebraic quotient truncated towards zero. For $M>0$ it is the same as +\csbxint{iiRem}. \begin{everbatim*} $\xintiiRem {1000}{-57}, \xintiiMod {1000}{-57}, \xintiiRem {-1000}{57}, \xintiiMod {-1000}{57}$ \end{everbatim*} -|\xintiMod|\etype{\Numf\Numf} submits its arguments to \csbxint{Num}. - -\begin{framed} - For legacy reasons the macros next do not have |ii| in their names but they - behave in the corresponding way, \emph{i.e.} their - argument must be a (long) integer in the strict format or a macro \fexpan - ding to such digit tokens. -\end{framed} - -\subsection{\csbh{xintDouble}, \csbh{xintHalf}} -\label{xintDouble} -\label{xintHalf} - -|\xintDouble|\n\etype{f} computes |2N| and |\xintHalf|\n{} computes |N/2| -truncated towards zero. Rewritten for |1.2i|. - -\subsection{\csbh{xintInc}, \csbh{xintDec}} -\label{xintInc} -\label{xintDec} - -|\xintInc|\n\etype{f} evaluates to |N+1| and |\xintDec|\n{} to |N-1|. -Rewritten for |1.2i|. - -\subsection{\csbh{xintDSL}}\label{xintDSL} - -|\xintDSL|\n\etype{f} is decimal shift left, \emph{i.e.} multiplication by -ten. Rewritten with |1.2i| and moved from \xintname to \xintcorename. - -\subsection{\csbh{xintDSR}}\label{xintDSR} - -|\xintDSR|\n\etype{f} is truncated decimal shift right, \emph{i.e.} it is the -truncation of |N/10| towards zero. Rewritten with |1.2i| and moved from -\xintname to \xintcorename. - -\subsection{\csbh{xintDSRr}}\label{xintDSRr} +\subsection{\csbh{xintNum}}\label{xintNum} -|\xintDSRr|\n\etype{f} is rounded decimal shift right, \emph{i.e.} it is the -rounding of |N/10| away from zero. It is needed in \xintcorename for use by -\csbxint{iiDivRound}.\NewWith {1.2i} +|\xintNum|\etype{f} is originally an alias for \csbxint{iNum}. But with +\xintfracname loaded its meaning is \hyperref[xintNumFrac]{modified} to accept +more general inputs. It then becomes an alias to \csbxint{TTrunc} which +truncates the general input to an integer in strict format. + +\subsection{Deprecated macros}\label{ssec:coredeprecated} + +These macros work as in earlier releases but will also generate an error (in +interactive mode, just hit the return key to proceed). They will get removed +at some future release:\DEPRECATED{1.2o} +|\xintiiFDg| (renamed to \csbxint{FDg}), +|\xintiiLDg| (renamed to \csbxint{LDg}), +|\xintiOpp|, +|\xintiAbs|, +|\xintiAdd|, +|\xintCmp| (it gets defined by \xintfracname, so deprecation will usually not be +seen; the macro with this name from former \xintcorename should have been +called |\xintiCmp| actually), +|\xintSgn| (it also gets its proper definition from \xintfracname), +|\xintiSub|, +|\xintiMul|, +|\xintiDivision|, +|\xintiQuo|, +|\xintiRem|, +|\xintiDivRound|, +|\xintiDivTrunc|, +|\xintiMod|, +|\xintiSqr|, +|\xintiPow|, +|\xintiFac|. \clearpage \section{Macros of the \xintname package} \label{sec:xint} -\begin{framed} - This package loads automatically \xintcorename (and \xintkernelname) hence - all macros described in \autoref{sec:core} are still available. Notice - though that it does \emph{not} load package \xinttoolsname. -\end{framed} +This package loads automatically \xintcorename (and \xintkernelname) hence +all macros described in \autoref{sec:core} are still available. +\etocsetnexttocdepth{subsubsection} \localtableofcontents This is \texttt{\xintbndlversion} of \texttt{\xintbndldate}. Version |1.0| was released |2013/03/28|. - Since |1.1 2014/10/28| the core arithmetic macros have been moved to a separate package \xintcorename, which is automatically loaded by \xintname. +Only the \csbxint{iiSum}, \csbxint{iiPrd}, \csbxint{iiSquareRoot}, +\csbxint{iiPFactorial}, \csbxint{iiBinomial} genuinely add to the arithmetic +macros from \xintcorename. (\csbxint{iiFac} which computes factorials is +already in \xintcorename.) + +With the exception of \csbxint{Len}, of the «Boolean logic macros» (see +next paragraph) all macros require inputs being integers in strict format, see \autoref{ssec:inputs}.% +% +\footnote{of +course for conditionals such as \csbxint{iiifCmp} this constraint applies only +to the first two arguments.} +% +The |ii| in the macro names is here as a reminder of that fact. The output is +an integer in strict format, or a pair of two braced such integers for +\csbxint{iiSquareRoot}, with the exception of \csbxint{iiE} which may produce +strings of zero's if its first argument is zero. + +Macros \csbxint{DecSplit} and \csbxint{ReverseDigits} are non-arithmetic and +have their own specific rules. + +For all macros described here for which it makes sense, package \xintfracname +defines a similar one without |ii| in its name. This will handle more general +inputs: decimal, scientific numbers, fractions. The |ii| macros provided here +by \xintname can be nested inside macros of \xintfracname but the opposite +does not apply, because the output format of the \xintfracname macros, even +for representing integers, is not understood by the |ii| macros. The «Boolean +macros» \csbxint{AND} etc... are exceptions though, they work fine if served +as inputs some \xintfracname output, despite doing only \fexpan +sion.\CHANGED{1.2o} Prior to |1.2o|, these macros did apply the \csbxint{Num} +or the more general \xintfracname general parsing, but this overhead was +deemed superfluous as it serves only to handle hand-written input and is not +needed if the input is obtained as a nested chain of \xintfracname macros for +example. + +Prior to release |1.2o|, \xintname defined additional macros which applied +\csbxint{Num} to their input arguments. All these macros are now deprecated +and they will get removed at some future release.\CHANGED{1.2o} + +See \autoref{ssec:expansions} for the significance of the +\textcolor[named]{PineGreen}{\Numf}, \textcolor[named]{PineGreen}{\emph{f}}, +\textcolor[named]{PineGreen}{\numx} and \textcolor[named]{PineGreen}{$\star$} +margin annotations. + -See the documentation of \xintcorename or \autoref{ssec:expansions} for the -significance of the \textcolor[named]{PineGreen}{\Numf}, -\textcolor[named]{PineGreen}{\emph{f}}, \textcolor[named]{PineGreen}{\numx} -and \textcolor[named]{PineGreen}{$\star$} margin annotations and some -important background information. + + + +\subsection{\csbh{xintiLen}}\label{xintiLen} + +|\xintiLen|\n\etype{\Numf} returns the length of the number, after its parsing +via \csbxint{iNum}. The count does not include the sign.\NewWith{1.2o} +\begin{everbatim*} +\xintiLen{-12345678901234567890123456789} +\end{everbatim*} + +Prior to |1.2o|, the package defined only \csbxint{Len}, which is extended by +\xintfracname to fractions or decimal numbers, hence acquires a bit more +overhead then. \subsection{\csbh{xintReverseDigits}} \label{xintReverseDigits} |\xintReverseDigits|\n\etype{f} will reverse the order of the digits of the -number. \csa{xintRev} is the former -denomination and is kept as an alias. Leading zeroes resulting from the -operation are not removed. Contrarily to \csbxint{ReverseOrder} this macro -expands its argument; it is only usable with digit tokens. It does accept a -leading minus sign which is left upfront in output. - +number. \csa{xintRev} is the former denomination and is kept as an alias. +Leading zeroes resulting from the operation are not removed. Contrarily to +\csbxint{ReverseOrder} this macro \fexpan ds its argument; it is only usable +with digit tokens. It does \emph{not} apply \csbxint{Num} to its argument (so +this must be done explicitely if the argument is an integer produced from some +\xintfracname macros). It does accept a leading minus sign which will be left +upfront in the output. \begingroup \begin{everbatim*} -\fdef\x{\xintReverseDigits +\oodef\x{\xintReverseDigits {98765432109876543210987654321098765432109876543210}}\meaning\x\par -\noindent\fdef\x{\xintReverseDigits {\xintReverseDigits +\noindent\oodef\x{\xintReverseDigits {\xintReverseDigits {98765432109876543210987654321098765432109876543210}}}\meaning\x\par \end{everbatim*} \endgroup -\subsection{\csbh{xintLen}}\label{xintiLen} +\subsection{\csbh{xintDecSplit}} +\label{xintDecSplit} -|\xintLen|\n\etype{\Numf} returns the length of the number, not counting the -sign. % -% -\leftedline{|\xintLen{-12345678901234567890123456789}|\dtt - {=\xintLen{-12345678901234567890123456789}}} Extended by \xintfracname to -fractions: the length of |A/B[n]| is the length of |A| plus the -length of |B| plus the absolute value of |n| and minus one (an integer input as -|N| is internally represented in a form equivalent to |N/1[0]| so the minus one -means that the extended \csa{xintLen} behaves the same as the original for -integers). % -% -\leftedline{|\xintLen{-1e3/5.425}|\dtt - {=\xintLen{-1e3/5.425}}} The length is computed on the |A/B[n]| which would -have been returned by \csbxint{Raw}: |\xintRaw {-1e3/5.425}|\dtt{=\xintRaw - {-1e3/5.425}}. +|\xintDecSplit|\x\n\etype{\numx f} cuts the |N| (a list of digits) into two +pieces |L| and |R|: it outputs |{L}{R}| where the original |N| +is the concatenation |LR|. These two pieces are decided according to |x|: +\begin{itemize}[nosep] +\item for |x>0|, |R| coincides with the |x| least significant digits. If |x| + equals or exceeds the length of |N| the first piece |L| will thus be + \emph{empty}, +\item for |x=0|, |R| is empty, and |L| is all of |N|, +\item for |x<0|, the first piece |L| consists of the \verb+|x|+ most + significant digits and the second piece |R| gets the remaining ones. If |x| + equals or exceeds the length of |N| the second piece |R| will thus be + \emph{empty}. +\end{itemize} -Let's point out that the whole thing should sum up to -less than circa $2^{31}$, but this is a bit theoretical. +This macro provides public interface to some functionality which is primarily +of internal interest. It operates only (after \fexpan sion) on ``strings'' of +digits tokens: leading zeroes are allowed but a leading sign (even a minus +sign) will provoke an error. -|\xintLen| is only for numbers or fractions. See also \csbxint{NthElt} from -\xinttoolsname. See also \csbxint{Length} from \xintkernelname for counting -tokens (or rather braced groups), more generally. +Breaking change with |1.2i|:\CHANGED{1.2i} formerly |N<0| was replaced by its + absolute value. Now, a sign (positive or negative) will create an error. -\subsection{\csbh{xintCmp}, \csbh{xintiiCmp}}\label{xintiiCmp} -|\xintCmp|\n\m\etype{\Numf\Numf} returns \dtt{1} if |N>M|, \dtt{0} if |N=M|, -and \dtt{-1} if |N<M|. +\subsection{\csbh{xintDecSplitL}, \csbh{xintDecSplitR}} +\label{xintDecSplitL} +\label{xintDecSplitR} -\csa{xintiiCmp} skips the \csbxint{Num} overhead.\etype{ff} +|\xintDecSplitL|\x\n\etype{\numx f} returns the first piece (unbraced) from +the \csa{xintDecSplit} output. -\csbxint{Cmp} is re-defined by \xintfracname to accept fractions. +\noindent|\xintDecSplitR|\x\n\etype{\numx f} returns the second piece +(unbraced) from the \csa{xintDecSplit} output. -Since |1.2l| these macros are actually provided by package \xintcorename.sty -(which is loaded by \xintname). +\subsection{\csbh{xintiiE}}\label{xintiiE} -\subsection{\csbh{xintEq}, \csbh{xintiiEq}}\label{xintEq} +|\xintiiE|\n\x\etype{f\numx } serves to extend |N| with |x| zeroes. The +parameter |x| must be non-negative. The same output would be obtained via +\csbxint{DSH}|{-x}{N}|, except for |N=0|, as |\xintDSH{-x}{N}| multiplies |N| +by |10^x| hence produces |0| if |N=0| whereas +|\xintiiE{0}{x}| produces |x+1| zeros. +\begin{everbatim*} +\xintiiE {0}{91}\par +\end{everbatim*} -|\xintEq|\n\m\etype{\Numf\Numf} returns 1 if |N=M|, 0 otherwise. Extended -by \xintfracname to fractions. +\subsection{\csbh{xintDSH}}\label{xintDSH} -\csa{xintiiEq} skips the \csbxint{Num} overhead.\etype{ff} +|\xintDSH|\x\n\etype{\numx f} is parametrized decimal shift. When |x| is +negative, it is like iterating \csbxint{DSL} \verb+|x|+ times (\emph{i.e.} +multiplication by $10^{-x}$). When |x| positive, it is like iterating +\csbxint{DSR} |x| times (and is more efficient), and for a non-negative |N| +this is thus the same as the quotient from the euclidean division by |10^x|. -\subsection{\csbh{xintNeq}, \csbh{xintiiNeq}} +\subsection{\csbh{xintDSHr}, \csbh{xintDSx}}\label{xintDSHr}\label{xintDSx} -|\xintNeq|\n\m\etype{\Numf\Numf} returns 0 if |N=M|, 1 otherwise. Extended -by \xintfracname to fractions. +|\xintDSHr|\x\n\etype{\numx f} expects |x| to be zero or positive and it +returns then a value |R| which is correlated to the value |Q| returned by +\csbxint{DSH}\x\n{} in the following manner: +\begin{itemize} +\item if |N| is + positive or zero, |Q| and |R| are the quotient and remainder in + the euclidean division by |10^x| (obtained in a more efficient + manner than using \csa{xintiDivision}), +\item if |N| is negative let + |Q1| and |R1| be the quotient and remainder in the euclidean + division by |10^x| of the absolute value of |N|. If |Q1| + does not vanish, then |Q=-Q1| and |R=R1|. If |Q1| vanishes, then + |Q=0| and |R=-R1|. +\item for |x=0|, |Q=N| and |R=0|. +\end{itemize} +So one has |N = 10^x Q + R| if |Q| turns out to be zero or +positive, and |N = 10^x Q - R| if |Q| turns out to be negative, +which is exactly the case when |N| is at most |-10^x|. -\csa{xintiiNeq} skips the \csbxint{Num} overhead.\etype{ff} +|\xintDSx|\x\n\etype{\numx f} for |x| negative is exactly as +|\xintDSH|\x\n, \emph{i.e.} multiplication by $10^{-|x|}$. For |x| zero or +positive it returns the two numbers |{Q}{R}| described above, each one within +braces. So |Q| is |\xintDSH|\x\n, and |R| is |\xintDSHr|\x\n, but computed +simultaneously. -\subsection{\csbh{xintGt}, \csbh{xintiiGt}}\label{xintGt} +\subsection{\csbh{xintiiEq}}\label{xintiiEq} -|\xintGt|\n\m\etype{\Numf\Numf} returns 1 if |N|$>$|M|, 0 otherwise. -Extended by \xintfracname to fractions. +|\xintiiEq|\n\m\etype{ff} returns 1 if |N=M|, 0 otherwise. -\csa{xintiiGt} skips the \csbxint{Num} overhead.\etype{ff} +\subsection{\csbh{xintiiNotEq}}\label{xintiiNotEq} -\subsection{\csbh{xintLt}, \csbh{xintiiLt}}\label{xintLt} +|\xintiiNotEq|\n\m\etype{ff} returns 0 if |N=M|, 1 otherwise. -|\xintLt|\n\m\etype{\Numf\Numf} returns 1 if |N|$<$|M|, 0 otherwise. -Extended by \xintfracname to fractions. +Former denomination \csa{xintiiNeq} is deprecated. -\csa{xintiiLt} skips the \csbxint{Num} overhead.\etype{ff} +\subsection{\csbh{xintiiGeq}}\label{xintiiGeq} -\subsection{\csbh{xintLtorEq}, \csbh{xintiiLtorEq}} +|\xintiiGeq|\n\m\etype{ff} returns 1 if the \emph{absolute value} +of the first number is at least equal to the absolute value of the second +number. If \verb+|N|<|M|+ it returns 0. -|\xintLtorEq|\n\m\etype{\Numf\Numf} returns 1 if |N|$\leqslant$|M|, 0 otherwise. -Extended by \xintfracname to fractions. +Important: the macro compares \emph{absolute values}. -\csa{xintiiLtorEq} skips the \csbxint{Num} overhead.\etype{ff} +\subsection{\csbh{xintiiGt}}\label{xintiiGt} -\subsection{\csbh{xintGtorEq}, \csbh{xintiiGtorEq}} +|\xintiiGt|\n\m\etype{ff} returns 1 if |N|$>$|M|, 0 otherwise. -|\xintGtorEq|\n\m\etype{\Numf\Numf} returns 1 if |N|$\geqslant$|M|, 0 otherwise. -Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiLt}}\label{xintiiLt} -\csa{xintiiGtorEq} skips the \csbxint{Num} overhead.\etype{ff} +|\xintiiLt|\n\m\etype{ff} returns 1 if |N|$<$|M|, 0 otherwise. -\subsection{\csbh{xintIsZero}, \csbh{xintiiIsZero}}\label{xintIsZero} +\subsection{\csbh{xintiiGtorEq}}\label{xintiiGxstorEq} -|\xintIsZero|\n\etype{\Numf} returns 1 if |N=0|, 0 otherwise. +|\xintiiGtorEq|\n\m\etype{ff} returns 1 if |N|$\geqslant$|M|, 0 otherwise. Extended by \xintfracname to fractions. -\csa{xintiiIsZero} skips the \csbxint{Num} overhead.\etype{f} +\subsection{\csbh{xintiiLtorEq}}\label{xintiiLtorEq} -\subsection{\csbh{xintNot}}\label{xintNot} +|\xintiiLtorEq|\n\m\etype{ff} returns 1 if |N|$\leqslant$|M|, 0 otherwise. -\csa{xintNot}\etype{\Numf} is a synonym for \csa{xintIsZero}. +\subsection{\csbh{xintiiIsZero}}\label{xintiiIsZero} -\subsection{\csbh{xintIsNotZero}, \csbh{xintiiIsNotZero}}\label{xintIsNotZero} +|\xintiiIsZero|\n\etype{f} returns 1 if |N=0|, 0 otherwise. -|\xintIsNotZero|\n\etype{\Numf} returns 1 if |N<>0|, 0 otherwise. -Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiIsNotZero}}\label{xintiiIsNotZero} -\csa{xintiiIsNotZero} skips the \csbxint{Num} overhead.\etype{f} +|\xintiiIsNotZero|\n\etype{f} returns 1 if |N!=0|, 0 otherwise. -\subsection{\csbh{xintIsOne}, - \csbh{xintiiIsOne}}\label{xintIsOne}\label{xintiiIsOne} +\subsection{\csbh{xintiiIsOne}}\label{xintiiIsOne} -|\xintIsOne|\n\etype{\Numf} returns 1 if |N=1|, 0 otherwise. -Extended by \xintfracname to fractions. +|\xintiiIsOne|\n\etype{f} returns 1 if |N=1|, 0 otherwise. -\csa{xintiiIsOne} skips the \csbxint{Num} overhead.\etype{f} +\subsection{\csbh{xintiiOdd}}\label{xintiiOdd} -\subsection{\csbh{xintAND}}\label{xintAND} +|\xintiiOdd|\n\etype{f} is 1 if the number is odd and 0 otherwise. -|\xintAND|\n\m\etype{\Numf\Numf} returns 1 if |N<>0| and |M<>0| and zero -otherwise. Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiEven}}\label{xintiiEven} -\subsection{\csbh{xintOR}}\label{xintOR} +|\xintiiEven|\n\etype{f} is 1 if the number is even and 0 otherwise. -|\xintOR|\n\m\etype{\Numf\Numf} returns 1 if |N<>0| or |M<>0| and zero -otherwise. Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiMON}}\label{xintiiMON} -\subsection{\csbh{xintXOR}}\label{xintXOR} +|\xintiiMON|\n\etype{f} computes |(-1)^N|. +\begin{everbatim*} +\xintiiMON {-280914019374101929} +\end{everbatim*} -|\xintXOR|\n\m\etype{\Numf\Numf} returns 1 if exactly one of |N| or |M| -is true (i.e. non-zero). Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiMMON}}\label{xintiiMMON} -\subsection{\csbh{xintANDof}}\label{xintANDof} +|\xintiiMMON|\n\etype{f} computes |(-1)^{N-1}|. +\begin{everbatim*} +\xintiiMMON {280914019374101929} +\end{everbatim*} -\csa{xintANDof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if all -are true (i.e. non zero) and zero otherwise. The list argument may be a macro, -it (or rather its first token) is \fexpan ded first (each item also is \fexpan -ded). Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiifSgn}}\label{xintiiifSgn} -\subsection{\csbh{xintORof}}\label{xintORof} +\csbh{xintiiifSgn}\marg{N}\marg{A}\marg{B}\marg{C}\etype{fnnn} executes either +the \meta{A}, \meta{B} or \meta{C} code, depending on its first argument being +respectively negative, zero, or positive. -\csa{xintORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if at -least one is true (i.e. does not vanish). The list argument may be a macro, it -is \fexpan ded first. Extended by \xintfracname to fractions. +\subsection{\csbh{xintiiifZero}}\label{xintiiifZero} -\subsection{\csbh{xintXORof}}\label{xintXORof} +\csa{xintiiifZero}\marg{N}\marg{IsZero}\marg{IsNotZero}\etype{fnn} expandably +checks if the first mandatory argument |N| (a number, possibly a fraction if +\xintfracname is loaded, or a macro expanding to one such) is zero or not. It +then either executes the first or the second branch. -\csa{xintXORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns 1 if an odd -number of them are true (i.e. does not vanish). The list argument may be a -macro, it is \fexpan ded first. Extended by \xintfracname to fractions. +Beware that both branches must be present. -\subsection{\csbh{xintGeq}}\label{xintiGeq} +\subsection{\csbh{xintiiifNotZero}}\label{xintiiifNotZero} -|\xintGeq|\n\m\etype{\Numf\Numf} returns 1 if the \emph{absolute value} -of the first number is at least equal to the absolute value of the second -number. If \verb+|N|<|M|+ it returns 0. Extended by \xintfracname to fractions. -%(starting with release |1.07|) -Important: the macro compares \emph{absolute values}. +\csa{xintiiifNotZero}\marg{N}\marg{IsNotZero}\marg{IsZero}\etype{fnn} +expandably checks if the first mandatory argument |N| is not +zero or is zero. It then either executes the first or the second branch. -\subsection{\csbh{xintiMax}, \csbh{xintiiMax}}\label{xintiMax}\label{xintiiMax} +Beware that both branches must be present. -|\xintiMax|\n\m\etype{\Numf\Numf} returns the largest of the two in the sense -of the order structure on the relative integers (\emph{i.e.} the right-most -number if they are put on a line with positive numbers on the right): -|\xintiMax {-5}{-6}|\dtt{=\xintiMax{-5}{-6}}. +\subsection{\csbh{xintiiifOne}}\label{xintiiifOne} -The |\xintiiMax| macro skips the overhead of parsing the operands with -\csbxint{Num}.\etype{ff} +\csa{xintiiifOne}\marg{N}\marg{IsOne}\marg{IsNotOne}\etype{fnn} expandably +checks if the first mandatory argument |N| is one or not one. It +then either executes the first or the second branch. Beware that both branches +must be present. -\subsection{\csbh{xintiMin}, \csbh{xintiiMin}}\label{xintiMin}\label{xintiiMin} +\subsection{\csbh{xintiiifCmp}}\label{xintiiifCmp} -|\xintiMin|\n\m\etype{\Numf\Numf} returns the smallest of the two in the -sense of the order structure on the relative integers (\emph{i.e.} the left-most -number if they are put on a line with positive numbers on the right): |\xintiMin -{-5}{-6}|\dtt{=\xintiMin{-5}{-6}}. +\csa{xintiiifCmp}\marg{A}\marg{B}\marg{A<B}\marg{A=B}\marg{A>B}\etype{ffnnn} +compares its first two arguments and chooses accordingly the correct branch. -The |\xintiiMin| macro skips the overhead of parsing the operands with -\csbxint{Num}.\etype{ff} +\subsection{\csbh{xintiiifEq}}\label{xintiiifEq} -\subsection{\csbh{xintiMaxof}, \csbh{xintiiMaxof}}\label{xintiMaxof}\label{xintiiMaxof} +\csa{xintiiifEq}\marg{A}\marg{B}\marg{A=B}\marg{not(A=B)}\etype{ffnn} checks +equality of its two first arguments and executes the corresponding branch. -\csa{xintiMaxof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the -maximum. The list argument may be a macro, it is \fexpan ded first. Each item -is submitted to |\xintNum| normalization. +\subsection{\csbh{xintiiifGt}}\label{xintiiifGt} -\csa{xintiiMaxof} does the same, skips |\xintNum| normalization of -items. +\csa{xintiiifGt}\marg{A}\marg{B}\marg{A>B}\marg{not(A>B)}\etype{ffnn} +checks if $A>B$ and executes the corresponding branch. -\subsection{\csbh{xintiMinof}, \csbh{xintiiMinof}}\label{xintiMinof}\label{xintiiMinof} +\subsection{\csbh{xintiiifLt}}\label{xintiiifLt} -\csa{xintiMinof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast\Numf} returns the -minimum. The list argument may be a macro, it is \fexpan ded first. Each item -is submitted to |\xintNum| normalization. +\csa{xintiiifLt}\marg{A}\marg{B}\marg{A<B}\marg{not(A<B)}\etype{ffnn} +checks if $A<B$ and executes the corresponding branch. -\csa{xintiiMinof} does the same, skips |\xintNum| normalization of -items. +\subsection{\csbh{xintiiifOdd}}\label{xintiiifOdd} + +\csa{xintiiifOdd}\marg{A}\marg{A odd}\marg{A even}\etype{fnn} checks if $A$ is +and odd integer and executes the corresponding branch. \subsection{\csbh{xintiiSum}}\label{xintiiSum} \csa{xintiiSum}\marg{braced things}\etype{{\lowast f}} after expanding its argument expects to find a sequence of tokens (or braced material). Each is \fexpan ded, and the sum of all these numbers is returned. -Note: the summands are \emph{not} parsed by \csbxint{Num}. +\begin{everbatim*} +\xintiiSum{{123}{-98763450}{\xintiiFac{7}}{\xintiiMul{3347}{591}}}\newline +\xintiiSum{1234567890}\newline +\xintiiSum{1234}\newline +\xintiiSum{} +\end{everbatim*} -% -\leftedline{% - \csa{xintiiSum}|{{123}{-98763450}{\xintiiFac{7}}{\xintiMul{3347}{591}}}|% - \dtt{=\xintiiSum{{123}{-98763450}{\xintiiFac{7}}{\xintiMul{3347}{591}}}}} -% -\leftedline{\csa{xintiiSum}|{1234567890}|\dtt{=\xintiiSum{1234567890}}} -An empty sum is no error and returns zero: |\xintiiSum -{}|\dtt{=\xintiiSum {}}. A sum with only one term returns that +A sum with only one term returns that number: |\xintiiSum {{-1234}}|\dtt{=\xintiiSum {{-1234}}}. -Attention that |\xintiiSum {-1234}| is not legal input and will make the -\TeX{} run fail. On the other hand |\xintiiSum -{1234}|\dtt{=\xintiiSum{1234}}. - +Attention that |\xintiiSum {-1234}| is not legal input and would make the +\TeX{} run fail. \subsection{\csbh{xintiiPrd}}\label{xintiiPrd} @@ -10448,180 +9083,51 @@ Attention that |\xintiiSum {-1234}| is not legal input and will make the argument expects to find a sequence of (of braced items or unbraced single tokens). Each is expanded (with the usual meaning), and the product of all these numbers is -returned. Note: the operands are \emph{not} parsed by \csbxint{Num}. -% -\leftedline{\csa{xintiiPrd}|{{-9876}{\xintiiFac{7}}{\xintiMul{3347}{591}}}|% - \dtt{=% - \xintiiPrd{{-9876}{\xintiiFac{7}}{\xintiMul{3347}{591}}}}} -% -\leftedline{\csa{xintiiPrd}|{123456789123456789}|\dtt{=% - \xintiiPrd{123456789123456789}}} An empty product is no error and returns 1: -|\xintiiPrd {}|\dtt{=\xintiiPrd {}}. A product reduced to a single term -returns this number: |\xintiiPrd {{-1234}}=|\dtt{\xintiiPrd {{-1234}}}. -Attention that |\xintiiPrd {-1234}| is not legal input and will make the \TeX{} -compilation fail. On the other hand |\xintiiPrd {1234}|\dtt{=\xintiiPrd - {1234}}. % -% +returned. \begin{everbatim*} -$2^{200}3^{100}7^{100}=\printnumber - {\xintiiPrd {{\xintiPow {2}{200}}{\xintiPow {3}{100}}{\xintiPow {7}{100}}}}$ +\xintiiPrd{{-9876}{\xintiiFac{7}}{\xintiiMul{3347}{591}}}\newline +\xintiiPrd{123456789123456789}\newline +\xintiiPrd {1234}\newline +\xintiiPrd{} \end{everbatim*} -With \xintexprname, this would be easier: -% -\leftedline {|\xinttheiiexpr 2^200*3^100*7^100\relax |} - - - - -\subsection{\csbh{xintSgnFork}}\label{xintSgnFork} - -\csa{xintSgnFork}\verb+{-1|0|1}+\marg{A}\marg{B}\marg{C}\etype{xnnn} -expandably chooses to execute either the \meta{A}, \meta{B} or \meta{C} code, -depending on its first argument. This first argument should be anything -expanding to either |-1|, |0| or |1| in a non self-delimiting way (i.e. a -count register must be prefixed by |\the| and a |\numexpr...\relax| also must -be prefixed by |\the|). This utility is provided to help construct expandable -macros choosing depending on a condition which one of the package macros to -use, or which values to confer to their arguments. - -\subsection{\csbh{xintifSgn}, \csbh{xintiiifSgn}}\label{xintifSgn} - -Similar to \csa{xintSgnFork}\etype{\Numf nnn} except that the first argument may -expand to a (big) integer (or a fraction if \xintfracname is loaded), and it is -its sign which decides which of the three branches is taken. Furthermore this -first argument may be a count register, with no |\the| or |\number| prefix. - -\csa{xintiiifSgn} skips the \csbxint{Num} overhead.\etype{f} - -\subsection{\csbh{xintifZero}, \csbh{xintiiifZero}}\label{xintifZero} - -\csa{xintifZero}\marg{N}\marg{IsZero}\marg{IsNotZero}\etype{\Numf nn} expandably -checks if the first mandatory argument |N| (a number, possibly a fraction if -\xintfracname is loaded, or a macro expanding to one such) is zero or not. It -then either executes the first or the second branch. Beware that both branches -must be present. - -\csa{xintiiifZero} skips the \csbxint{Num} overhead.\etype{f} - - -\subsection{\csbh{xintifNotZero}, \csbh{xintiiifNotZero}}\label{xintifNotZero} - -\csa{xintifNotZero}\marg{N}\marg{IsNotZero}\marg{IsZero}\etype{\Numf nn} -expandably checks if the first mandatory argument |N| (a number, possibly a -fraction if \xintfracname is loaded, or a macro expanding to one such) is not -zero or is zero. It then either executes the first or the second branch. Beware -that both branches must be present. - -\csa{xintiiifNotZero} skips the \csbxint{Num} overhead.\etype{f} - -\subsection{\csbh{xintifOne}, \csbh{xintiiifOne}}\label{xintifOne} - -\csa{xintifOne}\marg{N}\marg{IsOne}\marg{IsNotOne}\etype{\Numf nn} expandably -checks if the first mandatory argument |N| (a number, possibly a fraction if -\xintfracname is loaded, or a macro expanding to one such) is one or not. It -then either executes the first or the second branch. Beware that both branches -must be present. - -\csa{xintiiifOne} skips the \csbxint{Num} overhead.\etype{f} - -\subsection{\csbh{xintifTrueAelseB}, \csbh{xintifFalseAelseB}} -\label{xintifTrueAelseB} -\label{xintifFalseAelseB} - - -\csa{xintifTrueAelseB}\marg{N}\marg{true branch}\marg{false branch}\etype{\Numf - nn} is a synonym for \csbxint{ifNotZero}. - -{\small - \noindent These macros have no lowercase versions, use |\xintifzero|, - |\xintifnotzero|.\par } - -\csa{xintifFalseAelseB}\marg{N}\marg{false branch}\marg{true branch}\etype{\Numf - nn} is a synonym for \csbxint{ifZero}. - -\subsection{\csbh{xintifCmp}, \csbh{xintiiifCmp}}\label{xintifCmp} - -\csa{xintifCmp}\marg{A}\marg{B}\marg{if A<B}\marg{if A=B}\marg{if - A>B}\etype{\Numf\Numf nnn} compares -its arguments and chooses accordingly the correct branch. - -\csa{xintiiifCmp} skips the \csbxint{Num} overhead.\etype{ff} - -\subsection{\csbh{xintifEq}, \csbh{xintiiifEq}}\label{xintifEq} - -\csa{xintifEq}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn} -checks equality of its two first arguments (numbers, or fractions if -\xintfracname is loaded) and does the |YES| or the |NO| branch. - -\csa{xintiiifEq} skips the \csbxint{Num} overhead.\etype{ff} - -\subsection{\csbh{xintifGt}, \csbh{xintiiifGt}}\label{xintifGt} - -\csa{xintifGt}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn} checks if -$A>B$ and in that case executes the |YES| branch. Extended to fractions (in -particular decimal numbers) by \xintfracname. - -\csa{xintiiifGt} skips the \csbxint{Num} overhead.\etype{ff} - -\subsection{\csbh{xintifLt}, \csbh{xintiiifLt}}\label{xintifLt} - -\csa{xintifLt}\marg{A}\marg{B}\marg{YES}\marg{NO}\etype{\Numf\Numf nn} -checks if $A<B$ and in that case executes the |YES| branch. Extended to -fractions (in particular decimal numbers) by \xintfracname. - -\csa{xintiiifLt} skips the \csbxint{Num} overhead.\etype{ff} - -\subsection{\csbh{xintifOdd}, \csbh{xintiiifOdd}}\label{xintifOdd} - -\csa{xintifOdd}\marg{A}\marg{YES}\marg{NO}\etype{\Numf nn} checks if $A$ is and -odd integer and in that case executes the |YES| branch. - -\csa{xintiiifOdd} skips the \csbxint{Num} overhead.\etype{f} - -\begin{framed} - The macros described next are all integer-only on input. Those with |ii| in - their names skip the \csbxint{Num} parsing. The others, with \xintfracname - loaded, can have fractions as arguments, which will get truncated to - integers via \csbxint{TTrunc}. On output, these macros always produce - integers (with no |/B[N]|). -\end{framed} - - -\subsection{\csbh{xintiiMON}, \csbh{xintiiMMON}} -\label{xintMON}\label{xintMMON}\label{xintiiMON}\label{xintiiMMON} +Attention that |\xintiiPrd {-1234}| is not legal input and would make the \TeX{} +compilation fail. +\begin{everbatim*} +$2^{200}3^{100}7^{100}=\printnumber + {\xintiiPrd {{\xintiiPow {2}{200}}{\xintiiPow {3}{100}}{\xintiiPow {7}{100}}}}$ +\end{everbatim*} -|\xintiiMON|\n\etype{f} returns |(-1)^N| and |\xintiiMMON|\n{} returns -|(-1)^{N-1}|. They skip the overhead of parsing via \csbxint{Num}. -% -\leftedline{|\xintiiMON {-280914019374101929}|\dtt{=\xintiiMON - {280914019374101929}}, |\xintiiMMON - {-280914019374101929}|\dtt{=\xintiiMMON {280914019374101929}}} +With \xintexprname, the syntax is the natural one: +\begin{everbatim*} +$2^{200}3^{100}7^{100}=\printnumber{\xinttheiiexpr 2^200 * 3^100 * 7^100\relax}$ +\end{everbatim*} -The variants -\csa{xintMON}\etype{\Numf} and \csa{xintMMON} use |\xintNum| and get extended -to fractions by \xintfracname. +\subsection{\csbh{xintiiSquareRoot}} +\label{xintiiSquareRoot} -\subsection{\csbh{xintiiOdd}}\label{xintOdd}\label{xintiiOdd} +|\xintiiSquareRoot|\n\etype{f} returns two braced integers |{M}{d}| which +satisfy |d>0| and |M^2-d=N| with +|M| the smallest (hence if |N=k^2| is a perfect square then |M=k+1|, |d=2k+1|). -|\xintiiOdd|\n\etype{f} is 1 if the number is odd and 0 otherwise. It skips -the overhead of parsing via \csbxint{Num}. \csa{xintOdd}\etype{\Numf} is the -variant using |\xintNum| and extended to fractions by \xintfracname. +\begin{everbatim*} +\xintAssign\xintiiSquareRoot {17000000000000000000000000}\to\A\B +\xintiiSub{\xintiiSqr\A}\B=\A\string^2-\B +\end{everbatim*} -\subsection{\csbh{xintiiEven}}\label{xintEven}\label{xintiiEven} +A rational approximation to $\sqrt{|N|}$ is $|M|-\frac{|d|}{|2M|}$ which is a +majorant and the error is at most |1/2M| (if |N| is a perfect square |k^2| +this gives |k+1/(2k+2)|, not |k|.) -|\xintiiEven|\n\etype{f} is 1 if the number is even and 0 otherwise. It skips -the overhead of parsing via \csbxint{Num}. \csa{xintEven}\etype{\Numf} is the -variant using |\xintNum| and extended to fractions by \xintfracname. +Package \xintfracname has \csbxint{FloatSqrt} for square roots of floating +point numbers. -\subsection{\csbh{xintiSqrt}, \csbh{xintiiSqrt}, \csbh{xintiiSqrtR}, \csbh{xintiSquareRoot}, - \csbh{xintiiSquareRoot}}\label{xintiSqrt}\label{xintiiSqrt}\label{xintiiSqrtR} -\label{xintiSquareRoot}\label{xintiiSquareRoot} +\subsection{\csbh{xintiiSqrt}, \csbh{xintiiSqrtR}} +\label{xintiiSqrt}\label{xintiiSqrtR} -\noindent|\xintiSqrt|\n\etype{\Numf} returns the largest integer whose square -is at most equal to |N|. |\xintiiSqrt| is the variant skipping the |\xintNum| -overhead.\etype{f} |\xintiiSqrtR| also skips the |\xintNum| overhead and it -returns the rounded, not truncated, square root.\etype{f} +\noindent|\xintiiSqrt|\n\ computes the largest integer whose square +is at most equal to |N|.\etype{f} |\xintiiSqrtR| +produces the rounded, not truncated, square root.\etype{f} \begin{everbatim*} \begin{itemize}[nosep] \item \xintiiSqrt {3000000000000000000000000000000000000} @@ -10630,48 +9136,21 @@ returns the rounded, not truncated, square root.\etype{f} \end{itemize} \end{everbatim*} -|\xintiSquareRoot|\n\etype{\Numf} returns |{M}{d}| with |d>0|, |M^2-d=N| and -|M| smallest (hence |=1+\xintiSqrt{N}|). - -|\xintiiSquareRoot|\etype{f} is the variant skipping the |\xintNum| overhead. - -\begin{everbatim*} -\xintAssign\xintiiSquareRoot {17000000000000000000000000}\to\A\B -\xintiiSub{\xintiiSqr\A}\B=\A\string^2-\B -\end{everbatim*} - -A rational approximation to $\sqrt{|N|}$ is $|M|-\frac{|d|}{|2M|}$ (this is a -majorant and the error is at most |1/2M|; if |N| is a perfect square |k^2| -then |M=k+1| and this gives |k+1/(2k+2)|, not |k|). - -Package \xintfracname has \csbxint{FloatSqrt} for square -roots of floating point numbers. - -\subsection{\csbh{xintiFac}, \csbh{xintiiFac}} - -Defined in \xintcorename, see \autoref{xintiiFac} for more info. - -\subsection{\csbh{xintiBinomial}, \csbh{xintiiBinomial}} -\label{xintiiBinomial} +\subsection{\csbh{xintiiBinomial}}\label{xintiiBinomial} |\xintiiBinomial{x}{y}|\etype{\numx\numx} computes binomial coefficients. -|\xintiBinomial| is originally a synonym. -With \xintfracname loaded it applies -|\xintNum| to its arguments and thus accepts fractional inputs but truncates -them to an integer. - -When |x<0| an out-of-range error is raised. Else, if |y<0| or if |x<y| the macro -evaluates to \dtt{\xintiiBinomial{1}{-1}}\CHANGED{1.2h} (it was a bit +If |x<0| an out-of-range error is raised. Else, if |y<0| or if |x<y| the macro +evaluates to \dtt{\xintiiBinomial{1}{-1}} (it was a bit unfortunate that the |1.2f| version deliberately raised an out-of-range error for the cases |y<0| and |y>x|, with a positive |x|.) -\begin{framed} +%\begin{framed} The allowable range is $0\leqslant x\leqslant99999999$. -\end{framed} +%\end{framed} % Thus the maximal computable value is ${9999 \choose 5000}$ which turns out % to have \dtt{3008} digits. - This theoretical range includes binomial coefficients with more than the + But this theoretical range includes binomial coefficients with more than the roughly 19950 digits that the arithmetics of \xintname can handle. In such cases, the computation will end up in a low-level \TeX{} error after a long time. @@ -10694,7 +9173,6 @@ See \csbxint{FloatBinomial} from package \xintfracname for the float variant, used in \csbxint{floatexpr}. - In order to evaluate binomial coefficients ${x \choose y}$ with $x>99999999$, or even $x\geqslant 2^{31}$, but $y$ is not too large, one may use an ad hoc function @@ -10718,18 +9196,12 @@ fractions or decimal numbers, and computed the product at the numerator without truncating them to integers; but the factorial at the denominator would truncate its argument. -\subsection{\csbh{xintiPFactorial}, \csbh{xintiiPFactorial}} -\label{xintiiPFactorial} +\subsection{\csbh{xintiiPFactorial}}\label{xintiiPFactorial} |\xintiiPFactorial{a}{b}|\etype{\numx\numx} computes the partial factorial |(a+1)(a+2)...b|. For |a=b| the product is considered empty hence returns |1|. -|\xintiPFactorial| is originally a synonym. -With \xintfracname loaded it applies -|\xintNum| to its arguments and thus accepts fractional inputs but truncates -them to an integer. - -\begin{framed} +%\begin{framed} The allowed range with |1.2f| was $0\leqslant a \leqslant b\leqslant99999999$. It was a bit unfortunate with @@ -10737,7 +9209,7 @@ them to an integer. was not obeyed by the arguments. Starting with |1.2h|, $-100000000\leqslant a, b\leqslant99999999$ is - accepted.\CHANGEDf{1.2h} + accepted. The rule is to interpret the formula as the product of the $j$'s such that $a<j\leqslant b$, hence in particular if $a\geqslant b$ the @@ -10750,15 +9222,13 @@ them to an integer. \begin{everbatim*} \xintiiPFactorial {100}{130} \end{everbatim*} -\end{framed} - +%\end{framed} This theoretical range allows computations whose result values would have more than the roughly 19950 digits that the arithmetics of \xintname can handle. In such cases, the computation will end up in a low-level \TeX{} error after a long time. -% The |pfactorial| function is available in the \xintexprname parsers. \begin{everbatim*} \xinttheiiexpr pfactorial(100,130)\relax @@ -10776,367 +9246,322 @@ $b-a$ is not too large, one may use an ad hoc function definition such as: \printnumber{\xinttheexpr mybigpfac(98765432100,98765432120)\relax} \end{everbatim*} +\subsection{\csbh{xintiiMax}}\label{xintiiMax} -\begin{framed} - The macros described next are strictly for integer-only arguments (which get - only \fexpan ded, not filtered via \csbxint{Num}.) -\end{framed} +|\xintiiMax|\n\m\etype{ff} returns the largest of the two in the sense +of the order structure on the relative integers (\emph{i.e.} the right-most +number if they are put on a line with positive numbers on the right): +|\xintiiMax {-5}{-6}|\dtt{=\xintiiMax{-5}{-6}}. -\subsection{\csbh{xintDSH}}\label{xintDSH} +\subsection{\csbh{xintiiMin}}\label{xintiiMin} -|\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{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|. +|\xintiiMin|\n\m\etype{ff} returns the smallest of the two in the sense of the +order structure on the relative integers (\emph{i.e.} the left-most number if +they are put on a line with positive numbers on the right): |\xintiiMin +{-5}{-6}|\dtt{=\xintiiMin{-5}{-6}}. -\subsection{\csbh{xintDSHr}, \csbh{xintDSx}}\label{xintDSHr}\label{xintDSx} +\subsection{\csbh{xintiiMaxof}}\label{xintiiMaxof} -|\xintDSHr|\x\n\etype{\numx f} expects |x| to be zero or positive and it -returns then a value |R| which is correlated to the value |Q| returned by -|\xintDSH|\x\n{} in the following manner: -\begin{itemize} -\item if |N| is - positive or zero, |Q| and |R| are the quotient and remainder in - the euclidean division by |10^x| (obtained in a more efficient - manner than using \csa{xintiDivision}), -\item if |N| is negative let - |Q1| and |R1| be the quotient and remainder in the euclidean - division by |10^x| of the absolute value of |N|. If |Q1| - does not vanish, then |Q=-Q1| and |R=R1|. If |Q1| vanishes, then - |Q=0| and |R=-R1|. -\item for |x=0|, |Q=N| and |R=0|. -\end{itemize} -So one has |N = 10^x Q + R| if |Q| turns out to be zero or -positive, and |N = 10^x Q - R| if |Q| turns out to be negative, -which is exactly the case when |N| is at most |-10^x|. +\csa{xintiiMaxof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast f} returns the +maximum. The list argument may be a macro, it is \fexpan ded first. -|\xintDSx|\x\n\etype{\numx f} for |x| negative is exactly as -|\xintDSH|\x\n, \emph{i.e.} multiplication by $10^{-|x|}$. For |x| zero or -positive it returns the two numbers |{Q}{R}| described above, each one within -braces. So |Q| is |\xintDSH|\x\n, and |R| is |\xintDSHr|\x\n, but computed -simultaneously. +\subsection{\csbh{xintiiMinof}}\label{xintiiMinof} -\subsection{\csbh{xintDecSplit}, \csbh{xintDecSplitL}, \csbh{xintDecSplitR}} -\label{xintDecSplit} -\label{xintDecSplitL} -\label{xintDecSplitR} +\csa{xintiiMinof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast f} returns the +minimum. The list argument may be a macro, it is \fexpan ded first. -|\xintDecSplit|\x\n\etype{\numx f} cuts the number into two pieces (each one -within a pair of enclosing braces) |{L}{R}| where the decimal writing of |N| -is the concatenation |LR|. +\subsection{\csbh{xintifTrueAelseB}} +\label{xintifTrueAelseB} -For |x| positive or null, |R| coincides with the |x| least -significant digits and is \emph{empty} if |x=0|. If |x| equals or -exceeds the length of |N| the first piece |L| is empty. +\csa{xintifTrueAelseB}\marg{f}\marg{true branch}\marg{false branch}\etype{fnn} +is a synonym for \csbxint{iiifNotZero}. -When |x| is negative the first piece |L| contains the ($-x$) most -significant digits and the second piece the remaining ones. Hence |R| is -\emph{empty} if $|x|$ equals or exceeds the length of |N|. +{\small + \noindent |\xintiiifnotzero| is lowercase companion macro.\par } + +Note 1: as it does only \fexpan sion on its argument it fails with inputs such +as |--0|. But with \xintfracname loaded, it does work fine if nested with +other \xintfracname macros, because the output format of such macros is fine +as input to \csbxint{iiifNotZero}. This remark applies to all other «Boolean +logic» macros next. + +Note 2: prior to |1.2o| this macro was using \csbxint{ifNotZero} which applies +\csbxint{Num} to its argument (or gets redefined by \xintfracname to handle +general decimal numbers or fractions).\CHANGED{1.2o} Hence it would have +worked with input such as |--0|. But it was decided at |1.2o| that the +overhead was not worth it. The same remark applies to the other «Boolean +logic» type macros next. + +\subsection{\csbh{xintifFalseAelseB}} +\label{xintifFalseAelseB} -{\footnotesize Breaking change with |1.2i|: formerly |N<0| was replaced by its - absolute value. Now, a sign (positive or negative) will create an error. - The N must consists only of digit tokens (after \fexpan sion). Leading - zeroes are allowed.\par} +\csa{xintifFalseAelseB}\marg{f}\marg{false branch}\marg{true + branch}\etype{fnn} is a synonym for \csbxint{iiifZero}. +{\small + \noindent |\xintiiifzero| is lowercase companion macro.\par } -|\xintDecSplitL|\x\n\etype{\numx f} returns the first piece (unbraced) from -the \csa{xintDecSplit} output. +\subsection{\csbh{xintNOT}}\label{xintNOT} -|\xintDecSplitR|\x\n\etype{\numx f} returns the second piece (unbraced) from -the \csa{xintDecSplit} output. +\csa{xintNOT}\etype{f} is a synonym for \csa{xintiiIsZero}. -\subsection{\csbh{xintiiE}}\label{xintiiE} +{\small |\xintiiiszero| serves as lowercase companion macro.\par} -|\xintiiE|\n\x\etype{f\numx } serves to add zeros to the right of |N|. -\begin{everbatim*} -\xintiiE {123}{89} -\end{everbatim*} +Its former name was \csa{xintNot} which is now deprecated and will be removed +at some future release. +\subsection{\csbh{xintAND}}\label{xintAND} -%\pagebreak +|\xintAND{f}{g}|\etype{ff} returns \dtt{1} if |f!=0| and |g!=0| and \dtt{0} +otherwise. -\clearpage -\section{Macros of the \xintfracname package} -\label{sec:frac} +\subsection{\csbh{xintOR}}\label{xintOR} -\begin{framed} - This package loads automatically \xintname and \xintcorename, hence all - macros described in \autoref{sec:xint} and \autoref{sec:core} are - 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} +|\xintOR{f}{g}|\etype{ff} returns \dtt{1} if |f!=0| or |g!=0| and \dtt{0} +otherwise. -\localtableofcontents +\subsection{\csbh{xintXOR}}\label{xintXOR} -\def\x{|{x}|} +|\xintXOR{f}{g}|\etype{ff} returns \dtt{1} if exactly one of |f| or |g| +is true (i.e. non-zero), else \dtt{0}. -This package was first included in release |1.03| (|2013/04/14|) of the -\xintname bundle. The general rule of the bundle that each macro first expands -(what comes first, fully) each one of its arguments applies. +\subsection{\csbh{xintANDof}}\label{xintANDof} -|f|\ntype{\Ff} stands for an integer or a fraction (see \autoref{sec:inputs} -for the accepted input formats) or something which expands to an integer or -fraction. It is possible to use in the numerator or the denominator of |f| count -registers and even expressions with infix arithmetic operators, under some rules -which are explained in the \autoref{sec:useofcount} section. +\csa{xintANDof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast f} returns \dtt{1} if +all are true (i.e. non zero) and \dtt{0} otherwise. The list argument may be a +macro, it (or rather its first token) is \fexpan ded first to deliver its +items. -As in the \hyperref[sec:xint]{xint.sty} documentation, |x|\ntype{\numx} -stands for something which will internally be embedded in a \csa{numexpr}. -It -may thus be a count register or something like |4*\count 255 + 17|, etc..., but -must expand to an integer obeying the \TeX{} bound. +\subsection{\csbh{xintORof}}\label{xintORof} -The fraction format on output is the scientific notation for the `float' macros, -and the |A/B[n]| format for all other fraction macros, with the exception of -\csbxint{Trunc}, {\color{blue}\string\xint\-Round} (which produce decimal -numbers) and \csbxint{Irr}, \csbxint{Jrr}, \csbxint{RawWithZeros} (which returns -an |A/B| with no trailing |[n]|, and prints the |B| even if it is |1|), and -\csbxint{PRaw} which does not print the |[n]| if |n=0| or the |B| if |B=1|. +\csa{xintORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast f} returns \dtt{1} if at +least one is true (i.e. does not vanish), else it produces \dtt{0}. The list +argument may be a macro, it is \fexpan ded first. -To be certain to print an integer output without trailing |[n]| nor fraction -slash, one should use either |\xintPRaw {\xintIrr {f}}| or |\xintNum {f}| when -it is already known that |f| evaluates to a (big) integer. For example -|\xintPRaw {\xintAdd {2/5}{3/5}}| gives a perhaps disappointing -\dtt{\xintPRaw {\xintAdd {2/5}{3/5}}} -% -% -% -whereas |\xintPRaw {\xintIrr {\xintAdd - {2/5}{3/5}}}| returns \dtt{\xintPRaw {\xintIrr {\xintAdd - {2/5}{3/5}}}}. As we knew the result was an integer we could have used -|\xintNum {\xintAdd {2/5}{3/5}}=|\xintNum {\xintAdd {2/5}{3/5}}. +\subsection{\csbh{xintXORof}}\label{xintXORof} -Some macros (such as \csbxint{iTrunc}, \csbxint{iRound}, and \csbxint{iFac}) -always produce integers on output. +\csa{xintXORof}|{{a}{b}{c}...}|\etype{f{$\to$}\lowast f} returns \dtt{1} if an +odd number of them are true (i.e. do not vanish), else it produces \dtt{0}. +The list argument may be a macro, it is \fexpan ded first. +\subsection{\csbh{xintLen}}\label{xintLen} -Refer to \autoref{ssec:floatingpoint} for general background information on -how floating point numbers and evaluations are implemented. +|\xintLen|\etype{\Numf} is originally an alias for \csbxint{iLen}. But with +\xintfracname loaded its meaning is \hyperref[xintLenFrac]{modified} to accept +more general inputs. + +\subsection{Deprecated macros (they require \xintfracname)}\label{ssec:xintdeprecated} + +These macros get their definitive definitions only from loading \xintfracname. +With only \xintname loaded they raise an error message (but then +operate as in former releases.) They will get removed +from \xintname at some future release:\DEPRECATED{1.2o} +|\xintEq|, +|\xintNeq|, +|\xintGeq|, +|\xintGt|, +|\xintLt|, +|\xintGtorEq|, +|\xintLtorEq|, +|\xintIsZero|, +|\xintIsNotZero|, +|\xintIsOne|, +|\xintOdd|, +|\xintEven|, +|\xintifSgn|, +|\xintifCmp|, +|\xintifEq|, +|\xintifGt|, +|\xintifLt|, +|\xintifZero|, +|\xintifNotZero|, +|\xintifOne|, +|\xintifOdd|. + +With the exception of |\xintNeq| which is renamed to |\xintNotEq|, the above +listed macros belong to \xintfracname, which extends their scope to handle +decimal numbers and fractions (|\xintOdd|, |\xintEven|, |\xintifOdd| will test +the argument after truncation to an integer.) Thus loading \xintfracname +overrides the \xintname deprecations. + +\subsection{Deprecated macros using \csbh{xintNum}}\label{ssec:xintdeprecatedNum} + +These macros filter their arguments via \csbxint{Num}. They are deprecated and +will be removed at some future release:\DEPRECATED{1.2o} +|\xintMON|, +|\xintMMON|, +|\xintiMax|, +|\xintiMin|, +|\xintiMaxof|, +|\xintiMinof|, +|\xintiSquareRoot|, +|\xintiSqrt|, +|\xintiSqrtR|, +|\xintiBinomial|, +|\xintiPFactorial|. -\subsection{\csbh{xintNum}}\label{xintNum} +\clearpage +\section{Macros of the \xintfracname package} +\label{sec:frac} -The macro\etype{f} from \xintname is made a synonym to \csbxint{TTrunc}.% -\footnote{In earlier releases than - |1.1|, \csbxint{Num} did \csbxint{Irr} and then complained if the - denominator was not |1|, else, it silently removed the denominator.} +First version of this package was in release |1.03| (|2013/04/14|) of the +\xintname bundle. -The original (which -normalizes big integers to strict format) is still available as -\csbxint{iNum}. -It is imprudent to apply \csa{xintNum} to numbers with a large -power of ten given either in scientific notation or with the |[n]| notation, -as the macro will according to its definition add all the needed zeroes to -produce an explicit integer in strict format. +\localtableofcontents -\subsection{\csbh{xintifInt}}\label{xintifInt} +\def\x{|{x}|} -\csa{xintifInt}|{f}{YES branch}{NO branch}|\etype{\Ff nn} expandably chooses -the |YES| branch if |f| reveals itself after expansion and simplification to -be an integer. As with the other \xintname conditionals, both branches must be -present although one of the two (or both, but why then?) may well be an empty -brace pair |{}|. Spaces in-between the braced things do not matter, but a -space after the closing brace of the |NO| branch is significant. -\subsection{\csbh{xintLen}}\label{xintLen} +\xintfracname loads automatically \xintcorename and \xintname and inherits +their macro definitions. Only these two are redefined: +\hyperref[xintNumFrac]{\string\xintNum} and +\hyperref[xintLenFrac]{\string\xintLen}. As explained in \autoref{ssec:inputs} +and \autoref{ssec:outputs} the interchange format for the \xintfracname +macros, i.e. |A/B[N]|, is not understood by the |ii|-named macros of +\xintcorename/\xintname which expect the so-called strict integer format. +Hence, to use such an |ii|-macro with an output from an \xintfracname macro, +an extra \csbxint{Num} wrapper is required. But macros already defined by +\xintfracname cover most use cases hence this should be a rarely needed. -The original macro\etype{\Ff} is extended to accept a fraction on input. -% -\leftedline {|\xintLen {201710/298219}|\dtt{=\xintLen {201710/298219}}, -|\xintLen {1234/1}|\dtt{=\xintLen {1234/1}}, |\xintLen {1234}|% - \dtt{=\xintLen {1234}}} +In the macro descriptions, the variable |f|\ntype{\Ff} and the margin +indicator stand for the \xintfracname input format for integers, scientific +numbers, and fractions as described in \autoref{ssec:inputs}. + +As in the \hyperref[sec:xint]{xint.sty} documentation, |x|\ntype{\numx} stands +for something which internally will be handled in a \csa{numexpr}. It may thus +be an expression as understood by \csa{numexpr} but its evaluation and +intermediate steps must obey the \TeX\ bound. + +The output format for most macros is the |A/B[N]| format but naturally the +float macros use the scientific notation on output. And some macros are +special, for example \csbxint{Trunc} produces decimal numbers, \csbxint{Irr} +produces an |A/B| with no |[N]|, \csbxint{iTrunc} and \csbxint{iRound} produce +integers without trailing |[N]| either, etc\dots + +\subsection{\csbh{xintNum}}\label{xintNumFrac} + +The original \csbxint{Num} \etype{\Ff} from \xintname is made a synonym to +\csbxint{TTrunc} (whose description is to be found farther in this section). + +Attention that for example |\xintNum{1e100000}| expands to the needed +\dtt{100001} digits... + +The original \hyperref[xintiNum]{\string\xintNum} from \xintcorename which +does not understand the fraction slash or the scientific notation is still +available under the name \csbxint{iNum}. \subsection{\csbh{xintRaw}}\label{xintRaw} This macro `prints' the\etype{\Ff} fraction |f| as it is received by the package after its parsing and -expansion, in a form |A/B[n]| equivalent to the internal +expansion, in a form |A/B[N]| equivalent to the internal representation: the denominator |B| is always strictly positive and is printed even if it has value |1|. -% -\leftedline{|\xintRaw{\the\numexpr 571*987\relax.123e-10/\the\numexpr - -201+59\relax e-7}=|} -% -\leftedline{\dtt{\xintRaw{\the\numexpr - 571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}} - -\subsection{\csbh{xintPRaw}}\label{xintPRaw} +\begin{everbatim*} +\xintRaw{\the\numexpr 571*987\relax.123e-10/\the\numexpr-201+59\relax e-7} +\end{everbatim*} -|PRaw|\etype{\Ff} stands for ``pretty raw''. It does \emph{not} show the |[n]| -if |n=0| and does \emph{not} show the |B| if |B=1|. -% % -% -\leftedline{|\xintPRaw {123e10/321e10}=|\dtt{\xintPRaw {123e10/321e10}}, % -|\xintPRaw {123e9/321e10}=|\dtt{\xintPRaw {123e9/321e10}}} -% % -% -\leftedline{|\xintPRaw {\xintIrr{861/123}}=|\dtt{\xintPRaw{\xintIrr{861/123}}}\ vz.\ - |\xintIrr{861/123}=|\dtt{\xintIrr{861/123}}} -% % -See also \csbxint{Frac} (or \csbxint{FwOver}) for math mode. As is examplified -above the \csbxint{Irr} macro which puts the fraction into irreducible form -does not remove the |/1| if the fraction is an integer. One can use -|\xintNum{f}| or |\xintPRaw{\xintIrr{f}}| which produces the same output only -if |f| is an integer (after simplication). +No simplification is done, not even of common zeroes between numerator and +denominator: +\begin{everbatim*} +\xintRaw {178000/25600000} +\end{everbatim*} \subsection{\csbh{xintNumerator}}\label{xintNumerator} -This returns\etype{\Ff} the numerator corresponding to the internal -representation of a fraction, with positive powers of ten converted into zeroes -of this numerator: % -% -\leftedline{|\xintNumerator - {178000/25600000[17]}|\dtt{=\xintNumerator {178000/25600000[17]}}} -% -\leftedline{|\xintNumerator {312.289001/20198.27}|% - \dtt{=\xintNumerator {312.289001/20198.27}}} -% -\leftedline{|\xintNumerator {178000e-3/256e5}|\dtt{=\xintNumerator - {178000e-3/256e5}}} % -% -\leftedline{|\xintNumerator - {178.000/25600000}|\dtt{=\xintNumerator {178.000/25600000}}} As shown by -the examples, no simplification of the input is done. For a result uniquely -associated to the value of the fraction first apply \csa{xintIrr}. +The input data\etype{\Ff} is parsed as if by \csbxint{Raw} into |A/B[N]| +format and +the macro outputs |A| if |N<=0|, or |A| extended by |N| zeroes if |N>0|. +\begin{everbatim*} +\xintNumerator {178000/25600000[17]}\newline +\xintNumerator {312.289001/20198.27}\newline +\xintNumerator {178000e-3/256e5}\newline +\xintNumerator {178.000/25600000} +\end{everbatim*} \subsection{\csbh{xintDenominator}}\label{xintDenominator} -This returns\etype{\Ff} the denominator corresponding to the internal -representation of the fraction:% -% -\footnote{recall that the |[]| construct excludes - presence of a decimal point.} -% -\leftedline{|\xintDenominator - {178000/25600000[17]}|\dtt{=\xintDenominator {178000/25600000[17]}}} -% -\leftedline{|\xintDenominator {312.289001/20198.27}|% - \dtt{=\xintDenominator {312.289001/20198.27}}} -% -\leftedline{|\xintDenominator {178000e-3/256e5}|\dtt{=\xintDenominator - {178000e-3/256e5}}} % -% -\leftedline{|\xintDenominator - {178.000/25600000}|\dtt{=\xintDenominator {178.000/25600000}}} As shown -by the examples, no simplification of the input is done. The denominator looks -wrong in the last example, but the numerator was tacitly multiplied by $1000$ -through the removal of the decimal point. For a result uniquely associated to -the value of the fraction first apply \csa{xintIrr}. +The input data\etype{\Ff} is parsed as if by \csbxint{Raw} into |A/B[N]| +format and +the macro outputs |B| if |N>0|, or |B| extended by \verb+|N|+ zeroes if |N<=0|. +\begin{everbatim*} +\xintDenominator {178000/25600000[17]}\newline +\xintDenominator {312.289001/20198.27}\newline +\xintDenominator {178000e-3/256e5}\newline +\xintDenominator {178.000/25600000} +\end{everbatim*} \subsection{\csbh{xintRawWithZeros}}\label{xintRawWithZeros} -This macro `prints'\etype{\Ff} the -fraction |f| (after its parsing and expansion) in |A/B| form, with |A| -as returned by \csa{xintNumerator}|{f}| and |B| as returned by +This macro parses the input\etype{\Ff} and outputs |A/B|, with |A| +as would be returned by \csa{xintNumerator}|{f}| and |B| as would be returned by \csa{xintDenominator}|{f}|. -% -\leftedline{|\xintRawWithZeros{\the\numexpr 571*987\relax.123e-10/\the\numexpr - -201+59\relax e-7}=|} -% -\leftedline{\dtt{\xintRawWithZeros{\the\numexpr - 571*987\relax.123e-10/\the\numexpr -201+59\relax e-7}}} +\begin{everbatim*} +\xintRawWithZeros{178000/25600000[17]}\newline +\xintRawWithZeros{312.289001/20198.27}\newline +\xintRawWithZeros{178000e-3/256e5}\newline +\xintRawWithZeros{178.000/25600000}\newline +\xintRawWithZeros{\the\numexpr 571*987\relax.123e-10/\the\numexpr-201+59\relax e-7} +\end{everbatim*} \subsection{\csbh{xintREZ}}\label{xintREZ} -This macro\etype{\Ff} normalizes a fraction by removing the powers of ten from -its numerator and denominator: % -% -\leftedline{|\xintREZ - {178000/25600000[17]}|\dtt{=\xintREZ {178000/25600000[17]}}} -% -\leftedline{|\xintREZ {1780000000000e30/2560000000000e15}|\dtt{=\xintREZ - {1780000000000e30/2560000000000e15}}} As shown by the example, it does not -otherwise simplify the fraction. - -\subsection{\csbh{xintFrac}}\label{xintFrac} - -This is a \LaTeX{} only macro,\etype{\Ff} to be used in math mode only. It -will print a fraction, internally represented as something equivalent to -|A/B[n]| as |\frac {A}{B}10^n|. The power of ten is omitted when |n=0|, the -denominator is omitted when it has value one, the number being separated from -the power of ten by a |\cdot|. |$\xintFrac {178.000/25600000}$| gives $\xintFrac -{178.000/25600000}$, |$\xintFrac {178.000/1}$| gives $\xintFrac {178.000/1}$, -|$\xintFrac {3.5/5.7}$| gives $\xintFrac {3.5/5.7}$, and |$\xintFrac {\xintNum - {\xintiiFac{10}/|\allowbreak|\xintiSqr{\xintiiFac {5}}}}$| gives $\xintFrac -{\xintNum {\xintiiFac{10}/\xintiSqr{\xintiiFac {5}}}}$. As shown by the examples, -simplification of the input (apart from removing the decimal points and moving -the minus sign to the numerator) is not done automatically and must be the -result of macros such as |\xintIrr|, |\xintREZ|, or |\xintNum| (for fractions -being in fact integers.) - -\subsection{\csbh{xintSignedFrac}}\label{xintSignedFrac} - - -This is as \csbxint{Frac}\etype{\Ff} except that a negative fraction has the -sign put in front, not in the numerator. % -% -\leftedline{|\[\xintFrac - {-355/113}=\xintSignedFrac {-355/113}\]|} -\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\] - -\subsection{\csbh{xintFwOver}}\label{xintFwOver} - -This does the same as \csa{xintFrac}\etype{\Ff} except that the \csa{over} -primitive is used for the fraction (in case the denominator is not one; and a -pair of braces contains the |A\over B| part). |$\xintFwOver {178.000/25600000}$| -gives $\xintFwOver {178.000/25600000}$, |$\xintFwOver {178.000/1}$| gives -$\xintFwOver {178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver -{3.5/5.7}$, and |$\xintFwOver {\xintNum {\xintiiFac{10}/\xintiSqr{\xintiiFac - {5}}}}$| gives $\xintFwOver {\xintNum {\xintiiFac{10}/\xintiSqr{\xintiiFac - {5}}}}$. - -\subsection{\csbh{xintSignedFwOver}}\label{xintSignedFwOver} - - -This is as \csbxint{FwOver}\etype{\Ff} except that a negative fraction has the -sign put in front, not in the numerator. % -% -\leftedline{|\[\xintFwOver - {-355/113}=\xintSignedFwOver {-355/113}\]|} -\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\] +The input\etype{\Ff} is first parsed into |A/B[N]| as by \csbxint{Raw}, then +trailing zeroes of |A| and |B| are suppressed and |N| is accordingly adjusted. +\begin{everbatim*} +\xintREZ {178000/25600000[17]} +\end{everbatim*} \subsection{\csbh{xintIrr}}\label{xintIrr} This puts the fraction\etype{\Ff} into its unique irreducible form: -% -\leftedline{|\xintIrr {178.256/256.178}|% - \dtt{=\xintIrr {178.256/256.178}}${}=\xintFrac{\xintIrr - {178.256/256.178}[0]}$} -% -Note that the current implementation does not cleverly first factor powers of 2 -and 5, so input such as |\xintIrr {2/3[100]}| will make \xintfracname do the +\begin{everbatim*} +\xintIrr {178.256/256.178}, \xintIrr {178000/25600000[17]} +\end{everbatim*} + +The current implementation does not cleverly first factor powers of +2 and 5, and |\xintIrr {2/3[100]}| will execute the Euclidean division of |2|\raisebox{.5ex}{|.|}|10^{100}| by |3|, which is a bit -stupid. +stupid as it could have known that the \dtt{100} trailing zeros can not bring +any divisibility by \dtt{3}. Starting with release |1.08|, \csa{xintIrr} does not remove the trailing |/1| -when the output is an integer. This was deemed better for various (stupid?) -reasons and thus the output format is now \emph{always} |A/B| with |B>0|. Use -\csbxint{PRaw} on top of \csa{xintIrr} if it is needed to get rid of a possible -trailing |/1|. For display in math mode, use rather |\xintFrac{\xintIrr {f}}| or -|\xintFwOver{\xintIrr {f}}|. +when the output is an integer. This was deemed better for various (questionable?) +reasons, anyway the output format is since \emph{always} |A/B| with |B>0|, even +in cases where it turns out that |B=1|. +Use \csbxint{PRaw} on top of \csa{xintIrr} if it is needed to get rid of such a +trailing |/1|. \subsection{\csbh{xintJrr}}\label{xintJrr} This also puts the fraction\etype{\Ff} into its unique irreducible form: -% -\leftedline{|\xintJrr {178.256/256.178}|% - \dtt{=\xintJrr {178.256/256.178}}} -% -This is faster than \csa{xintIrr} for fractions having some big common -factor in the numerator and the denominator.\par -{\centering |\xintJrr {\xintiPow{\xintiiFac {15}}{3}/\xintiiPrd -{{\xintiiFac{10}}{\xintiiFac{30}}{\xintiiFac{5}}}}|\dtt{=% - \xintJrr {\xintiPow{\xintiiFac {15}}{3}/\xintiiPrd -{{\xintiiFac{10}}{\xintiiFac{30}}{\xintiiFac{5}}}}}\par} But to notice the -difference one would need computations with much bigger numbers than in this -example. -Starting with release |1.08|, \csa{xintJrr} does not remove the trailing |/1| -when the output is an integer. +\begin{everbatim*} +\xintJrr {178.256/256.178} +\end{everbatim*} + +This is (supposedly, not tested for ages) faster than \csa{xintIrr} for +fractions having some big common factor in the numerator and the denominator. +\begin{everbatim*} +\xintJrr {\xintiiPow{\xintiiFac {15}}{3}/% + \xintiiPrd{{\xintiiFac{10}}{\xintiiFac{30}}{\xintiiFac{5}}}} +\end{everbatim*} + +But to notice the difference one would need computations with much bigger +numbers than in this example. As \csbxint{Irr}, \csa{xintJrr} does not remove +the trailing |/1| from a fraction reduced to an integer. + +\subsection{\csbh{xintPRaw}}\label{xintPRaw} + +|PRaw|\etype{\Ff} stands for ``pretty raw''. It does like \csbxint{Raw} apart +from removing the |[N]| part if |N=0| and removing the |B| if |B=1|. +\begin{everbatim*} +\xintPRaw {123e10/321e10}, \xintPRaw {123e9/321e10}, \xintPRaw {\xintIrr{861/123}} +\end{everbatim*} \subsection{\csbh{xintTrunc}}\label{xintTrunc} -\csa{xintTrunc}|{x}{f}|\etype{\numx\Ff} returns the integral part, a dot, and +\csa{xintTrunc}|{x}{f}|\etype{\numx\Ff} returns the integral part, a dot +(standing for the decimal mark), and then the first |x| digits of the decimal expansion of the fraction |f|, except when the fraction is (or evaluates to) zero, then it simply prints \dtt{0} (with no dot). @@ -11152,7 +9577,7 @@ exactly |x| digits after the decimal mark, thus the output may be positive, respectively negative. \begin{framed} - \textbf{Warning:} \emph{it is not yet decided is this behavior is + \textbf{Warning:} \emph{it is not yet decided is this behaviour is definitive.} Currently \xintfracname has no notion of a positive zero or a negative zero. @@ -11173,52 +9598,16 @@ positive, respectively negative. I have multiple times hesitated about what to do and must postpone again final decision. \end{framed} -% -\leftedline{|\xintTrunc - {16}{-803.2028/20905.298}|\dtt{=\xintTrunc {16}{-803.2028/20905.298}}} -% -\leftedline{|\xintTrunc {20}{-803.2028/20905.298}|\dtt{=\xintTrunc - {20}{-803.2028/20905.298}}} -% -\leftedline{|\xintTrunc {10}{\xintPow {-11}{-11}}|\dtt{=\xintTrunc - {10}{\xintPow {-11}{-11}}}} -% -\leftedline{|\xintTrunc {12}{\xintPow {-11}{-11}}|\dtt{=\xintTrunc - {12}{\xintPow {-11}{-11}}}} -% -\leftedline{|\xintTrunc {12}{\xintAdd {-1/3}{3/9}}|\dtt{=\xintTrunc - {12}{\xintAdd {-1/3}{3/9}}}} The digits printed are exact up to and -including the last one. - -The macro is more efficient since |1.2i| in the case where the |{f}| argument -is already a decimal number, and not a general fraction, as it avoids doing -then a division by a possibly big power of ten, replacing it by use of -\csbxint{DecSplit}. - -\subsection{\csbh{xintiTrunc}}\label{xintiTrunc} - -\csa{xintiTrunc}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x| -times what \csa{xintTrunc}|{x}{f}| would produce. -% -\leftedline{|\xintiTrunc - {16}{-803.2028/20905.298}|\dtt{=\xintiTrunc {16}{-803.2028/20905.298}}} -% -\leftedline{|\xintiTrunc {10}{\xintPow {-11}{-11}}|\dtt{=\xintiTrunc - {10}{\xintPow {-11}{-11}}}} -% -\leftedline{|\xintiTrunc {12}{\xintPow {-11}{-11}}|\dtt{=\xintiTrunc - {12}{\xintPow {-11}{-11}}}} -% -The difference between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}| is -that the latter never has the decimal mark always present in the former except -for |f=0|. And \csa{xintTrunc}|{0}{-0.5}| returns ``\dtt{\xintTrunc - 0{-0.5}}'' whereas \csa{xintiTrunc}|{0}{-0.5}| simply returns -``\dtt{\xintiTrunc 0{-0.5}}''. - -\subsection{\csbh{xintTTrunc}}\label{xintTTrunc} +\begin{everbatim*} +\xintTrunc {16}{-803.2028/20905.298}\newline +\xintTrunc {20}{-803.2028/20905.298}\newline +\xintTrunc {10}{\xintPow {-11}{-11}}\newline +\xintTrunc {12}{\xintPow {-11}{-11}}\newline +\xintTrunc {50}{\xintPow {-11}{-11}}\newline +\xintTrunc {12}{\xintAdd {-1/3}{3/9}}\par +\end{everbatim*} +The digits printed are exact up to and including the last one. -\csa{xintTTrunc}|{f}|\etype{\Ff} truncates to an integer (truncation towards -zero). This is the same as |\xintiTrunc {0}{f}| and as \csbxint{Num}. \subsection{\csbh{xintXTrunc}}\label{xintXTrunc} @@ -11255,12 +9644,10 @@ originally present is smaller than what is asked for, thus the routine only has to add trailing zeros, and this has no limitation (apart from \TeX\ main memory). - \csbxint{XTrunc} will expand fully in an |\edef| or a |\write| (|\message|, |\wlog|, \dots) or in an \csbxint{expr}-ession, or as list argument to \csbxint{For*}. - Here is an example session where the user checks that the decimal expansion of $1/66049=1/257^2$ has the maximal period length $257*256=65792$ (this period length must be a divisor of @@ -11374,93 +9761,11 @@ exhibit the symmetry. \begin{framed} Mathematical challenge: prove generally that if the period length of the decimal expansion of |1/p^r| (with |p| a prime distinct from |2| and |5| and - |r| a positive exponent) is even, then the above symmetry applies. + |r| a positive exponent) is even, then the previously observed symmetry + about the two halves of the period adding to a string of nine's applies. \end{framed} -Releases earlier than |1.2i| created a dependency of \xintfracname on -\xinttoolsname only for this macro, this dependency does not exist anymore. - - -\subsection{\csbh{xintRound}}\label{xintRound} - - -\csa{xintRound}|{x}{f}|\etype{\numx\Ff} returns the start of the decimal -expansion of the fraction |f|, rounded to |x| digits precision after the decimal -point. The argument |x| should be non-negative. Only when |f| evaluates exactly -to zero does \csa{xintRound} return |0| without decimal point. When |f| is not -zero, its sign is given in the output, also when the digits printed are all -zero. % -% -\leftedline{|\xintRound {16}{-803.2028/20905.298}|\dtt{=\xintRound - {16}{-803.2028/20905.298}}} -% -\leftedline{|\xintRound {20}{-803.2028/20905.298}|\dtt{=\xintRound - {20}{-803.2028/20905.298}}} -% -\leftedline{|\xintRound {10}{\xintPow {-11}{-11}}|\dtt{=\xintRound - {10}{\xintPow {-11}{-11}}}} -% -\leftedline{|\xintRound {12}{\xintPow {-11}{-11}}|\dtt{=\xintRound - {12}{\xintPow {-11}{-11}}}} -% -\leftedline{|\xintRound {12}{\xintAdd {-1/3}{3/9}}|\dtt{=\xintRound - {12}{\xintAdd {-1/3}{3/9}}}} The identity |\xintRound {x}{-f}=-\xintRound -{x}{f}| holds. And regarding $(-11)^{-11}$ here is some more of its expansion: -% -\leftedline{\dtt{\xintTrunc {50}{\xintPow {-11}{-11}}\dots}} - -\subsection{\csbh{xintiRound}}\label{xintiRound} - - -\csa{xintiRound}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x| -times what \csa{xintRound}|{x}{f}| would return. % -% -\leftedline{|\xintiRound - {16}{-803.2028/20905.298}|\dtt{=\xintiRound {16}{-803.2028/20905.298}}} -% -\leftedline{|\xintiRound {10}{\xintPow {-11}{-11}}|\dtt{=\xintiRound - {10}{\xintPow {-11}{-11}}}} -% -Differences between \csa{xintRound}|{0}{f}| and \csa{xintiRound}|{0}{f}|: the -former cannot be used inside integer-only macros, and the latter removes the -decimal point, and never returns |-0| (and removes all superfluous leading -zeroes.) - -\subsection{\csbh{xintFloor}, \csbh{xintiFloor}} -\label{xintFloor}\label{xintiFloor} - -|\xintFloor {f}|\etype{\Ff} returns the largest relative integer |N| with -|N|${}\leqslant{}$|f|. % -% -\leftedline{|\xintFloor {-2.13}|\dtt{=\xintFloor - {-2.13}}, |\xintFloor {-2}|\dtt{=\xintFloor {-2}}, |\xintFloor - {2.13}|\dtt{=\xintFloor {2.13}} -% -} - -|\xintiFloor {f}|\etype{\Ff} does the same but without adding the -|/1[0]|. -% -\leftedline{|\xintiFloor {-2.13}|\dtt{=\xintiFloor - {-2.13}}, |\xintiFloor {-2}|\dtt{=\xintiFloor {-2}}, |\xintiFloor - {2.13}|\dtt{=\xintiFloor {2.13}}} - -\subsection{\csbh{xintCeil}, \csbh{xintiCeil}} -\label{xintCeil}\label{xintiCeil} - -|\xintCeil {f}|\etype{\Ff} returns the smallest relative integer |N| with -|N|${}>{}$|f|. % -% -\leftedline{|\xintCeil {-2.13}|\dtt{=\xintCeil {-2.13}}, - |\xintCeil {-2}|\dtt{=\xintCeil {-2}}, |\xintCeil - {2.13}|\dtt{=\xintCeil {2.13}} -% -} - -|\xintiCeil {f}|\etype{\Ff} does the same but without adding the -|/1[0]|. - \subsection{\csbh{xintTFrac}}\label{xintTFrac} @@ -11476,8 +9781,7 @@ subtraction from |f|. Notice that the result is filtered through \csbxint{REZ}, and will thus be of the form |A/B[N]|, where neither |A| nor |B| has trailing zeros. But the -output fraction is not reduced to smallest terms.\MyMarginNote{\noindent - Do\-cu\-men\-ta\-tion updated.} +output fraction is not reduced to smallest terms. The function call in expressions (\csbxint{expr}, \csbxint{floatexpr}) is |frac|. Inside |\xintexpr..\relax|, the function |frac| is mapped to @@ -11486,35 +9790,252 @@ The function call in expressions (\csbxint{expr}, \csbxint{floatexpr}) is digits than the floating point precision) and only in a second stage makes the conversion to a floating point number with the precision as set by |\xintDigits| (default is \dtt{16}). -% -\leftedline{|\xintTFrac {1235/97}|\dtt{=\xintTFrac {1235/97}}\quad - |\xintTFrac {-1235/97}|\dtt{=\xintTFrac {-1235/97}}} -% -\leftedline{|\xintTFrac {1235.973}|\dtt{=\xintTFrac {1235.973}}\quad - |\xintTFrac {-1235.973}|\dtt{=\xintTFrac {-1235.973}}} -% -\leftedline{|\xintTFrac {1.122435727e5}|% - \dtt{=\xintTFrac {1.122435727e5}}} +\begin{everbatim*} +\xintTFrac {1235/97}, \xintTFrac {-1235/97}\newline +\xintTFrac {1235.973}, \xintTFrac {-1235.973}\newline +\xintTFrac {1.122435727e5}\par +\end{everbatim*} + +\subsection{\csbh{xintRound}}\label{xintRound} + +\csa{xintRound}|{x}{f}|\etype{\numx\Ff} returns the start of the decimal +expansion of the fraction |f|, rounded to |x| digits precision after the decimal +point. The argument |x| should be non-negative. Only when |f| evaluates exactly +to zero does \csa{xintRound} return |0| without decimal point. When |f| is not +zero, its sign is given in the output, also when the digits printed are all +zero. +\begin{everbatim*} +\xintRound {16}{-803.2028/20905.298}\newline +\xintRound {20}{-803.2028/20905.298}\newline +\xintRound {10}{\xintPow {-11}{-11}}\newline +\xintRound {12}{\xintPow {-11}{-11}}\newline +\xintRound {12}{\xintAdd {-1/3}{3/9}}\par +\end{everbatim*} + +\subsection{\csbh{xintFloor}}\label{xintFloor} + +|\xintFloor {f}|\etype{\Ff} returns the largest relative integer |N| with +|N|${}\leqslant{}$|f|. +\begin{everbatim*} +\xintFloor {-2.13}, \xintFloor {-2}, \xintFloor {2.13} +\end{everbatim*} +Note the trailing |[0]|, see \csbxint{iFloor} if it is not desired. + +\subsection{\csbh{xintCeil}}\label{xintCeil} + +|\xintCeil {f}|\etype{\Ff} returns the smallest relative integer |N| with +|N|${}>{}$|f|. +\begin{everbatim*} +\xintCeil {-2.13}, \xintCeil {-2}, \xintCeil {2.13} +\end{everbatim*} + +\subsection{\csbh{xintiTrunc}}\label{xintiTrunc} + +\csa{xintiTrunc}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x| +times what \csa{xintTrunc}|{x}{f}| would produce. +\begin{everbatim*} +\xintiTrunc {16}{-803.2028/20905.298}\newline +\xintiTrunc {10}{\xintPow {-11}{-11}}\newline +\xintiTrunc {12}{\xintPow {-11}{-11}}\par +\end{everbatim*} + +In particular \csa{xintiTrunc}|{0}{f}|'s output is in strict integer format +contrarily to \csa{xintTrunc}|{0}{f}| which produces an output with a decimal +mark, except if |f| turns out to be zero. + +\subsection{\csbh{xintTTrunc}}\label{xintTTrunc} + +\csa{xintTTrunc}|{f}|\etype{\Ff} truncates to an integer (truncation towards +zero). This is the same as |\xintiTrunc {0}{f}| and also the same as +\csbxint{Num}. + +\subsection{\csbh{xintiRound}}\label{xintiRound} + +\csa{xintiRound}|{x}{f}|\etype{\numx\Ff} returns the integer equal to |10^x| +times what \csa{xintRound}|{x}{f}| would return. +\begin{everbatim*} +\xintiRound {16}{-803.2028/20905.298}\newline +\xintiRound {10}{\xintPow {-11}{-11}}\par +\end{everbatim*} + +In particular \csa{xintiRound}|{0}{f}|'s output is in strict integer format +contrarily to \csa{xintRound}|{0}{f}| which produces an output with a decimal +mark, except if |f| turns out to be zero. + +\subsection{\csbh{xintiFloor}}\label{xintiFloor} + +|\xintiFloor {f}|\etype{\Ff} does the same as \csbxint{Floor} but without the +trailing |/1[0]|. +\begin{everbatim*} +\xintiFloor {-2.13}, \xintiFloor {-2}, \xintiFloor {2.13} +\end{everbatim*} + +\subsection{\csbh{xintiCeil}}\label{xintiCeil} + +|\xintiCeil {f}|\etype{\Ff} does the same as \csbxint{Ceil} but its output is +without the |/1[0]|. +\begin{everbatim*} +\xintiCeil {-2.13}, \xintiCeil {-2}, \xintiCeil {2.13} +\end{everbatim*} \subsection{\csbh{xintE}}\label{xintE} |\xintE {f}{x}|\etype{\Ff\numx} multiplies the fraction |f| by $10^x$. The \emph{second} argument |x| must obey the \TeX{} bounds. Example: -% -\leftedline{|\count 255 123456789 \xintE {10}{\count 255}|\dtt{->\count - 255 123456789 \xintE {10}{\count 255}}} Be careful that for obvious reasons -such gigantic numbers should not be given to \csbxint{Num}, or added to -something with a widely different order of magnitude, as the package always -works to get the \emph{exact} result. There is \emph{no problem} using them for -\emph{float} operations:% -% -\leftedline{|\xintFloatAdd - {1e1234567890}{1}|\dtt{=\xintFloatAdd {1e1234567890}{1}}} +\begin{everbatim*} +\count 255 123456789 \xintE {10}{\count 255} +\end{everbatim*} +Don't feed this example to \csbxint{Num}! + +\subsection{\csbh{xintCmp}}\label{xintCmp} + +This\etype{\Ff\Ff} compares two fractions |F| and |G| and produces +|-1|, |0|, or |1| according to |F<G|, |F=G|, |F>G|. + +For choosing branches according to the result of comparing |f| and |g|, see +\csbxint{ifCmp}. + +\subsection{\csbh{xintEq}}\label{xintEq} + +|\xintEq{f}{g}|\etype{\Ff\Ff} returns 1 if |f=g|, 0 otherwise. + +\subsection{\csbh{xintNotEq}}\label{xintNotEq} + +|\xintNotEq{f}{g}|\etype{\Ff\Ff} returns 0 if |f=g|, 1 otherwise. + +Former denomination \csa{xintNeq} is deprecated. + +\subsection{\csbh{xintGeq}}\label{xintGeq} + +This\etype{\Ff\Ff} compares the \emph{absolute values} of two +fractions. +|\xintGeq{f}{g}| outputs |1| if {\catcode`| 12 $|f|\geqslant|g|$} and |0| +if not. + +Important: the macro compares \emph{absolute values}. + +\subsection{\csbh{xintGt}}\label{xintGt} + +|\xintGt{f}{g}|\etype{\Ff\Ff} returns \dtt{1} if |f|$>$|g|, \dtt{0} otherwise. + +\subsection{\csbh{xintLt}}\label{xintLt} + +|\xintLt{f}{g}|\etype{\Ff\Ff} returns \dtt{1} if |f|$<$|g|, \dtt{0} otherwise. + +\subsection{\csbh{xintGtorEq}}\label{xintGxstorEq} + +|\xintGtorEq{f}{g}|\etype{\Ff\Ff} returns \dtt{1} if |f|$\geqslant$|g|, \dtt{0} otherwise. +Extended by \xintfracname to fractions. + +\subsection{\csbh{xintLtorEq}}\label{xintLtorEq} + +|\xintLtorEq{f}{g}|\etype{\Ff\Ff} returns \dtt{1} if |f|$\leqslant$|g|, \dtt{0} otherwise. + +\subsection{\csbh{xintIsZero}}\label{xintIsZero} + +|\xintIsZero{f}|\etype{f} returns \dtt{1} if |f=0|, \dtt{0} otherwise. + +\subsection{\csbh{xintIsNotZero}}\label{xintIsNotZero} + +|\xintIsNotZero{f}|\etype{f} returns \dtt{1} if |f!=0|, \dtt{0} otherwise. + +\subsection{\csbh{xintIsOne}}\label{xintIsOne} + +|\xintIsOne{f}|\etype{f} returns \dtt{1} if |f=1|, \dtt{0} otherwise. + +\subsection{\csbh{xintOdd}}\label{xintOdd} + +|\xintOdd{f}|\etype{f} returns \dtt{1} if the integer obtained by truncation is +odd, and \dtt{0} otherwise. + +\subsection{\csbh{xintEven}}\label{xintEven} + +|\xintEven{f}|\etype{f} returns \dtt{1} if the integer obtained by truncation is +even, and \dtt{0} otherwise. + +\subsection{\csbh{xintifSgn}}\label{xintifSgn} + +\csbh{xintifSgn}\marg{f}\marg{B}\marg{C}\etype{\Ff nnn} executes either the +\meta{A}, \meta{B} or \meta{C} code, depending on its first argument being +respectively negative, zero, or positive. + +\subsection{\csbh{xintifZero}}\label{xintifZero} + +\csa{xintifZero}\marg{f}\marg{IsZero}\marg{IsNotZero}\etype{\Ff nn} expandably +checks if the first mandatory argument |N| (a number, possibly a fraction if +\xintfracname is loaded, or a macro expanding to one such) is zero or not. It +then either executes the first or the second branch. + +Beware that both branches must be present. + +\subsection{\csbh{xintifNotZero}}\label{xintifNotZero} + +\csa{xintifNotZero}\marg{N}\marg{IsNotZero}\marg{IsZero}\etype{\Ff nn} +expandably checks if the first mandatory argument |f| is not +zero or is zero. It then either executes the first or the second branch. + +Beware that both branches must be present. + +\subsection{\csbh{xintifOne}}\label{xintifOne} + +\csa{xintifOne}\marg{N}\marg{IsOne}\marg{IsNotOne}\etype{\Ff nn} expandably +checks if the first mandatory argument |f| is one or not one. It +then either executes the first or the second branch. Beware that both branches +must be present. + +\subsection{\csbh{xintifOdd}}\label{xintifOdd} + +\csa{xintifOdd}\marg{N}\marg{odd}\marg{not odd}\etype{\Ff nn} expandably +checks if the first mandatory argument |f|, after truncation to an integer, is +odd or even. It then executes accordingly the first or the second branch. +Beware that both branches must be present. + +\subsection{\csbh{xintifCmp}}\label{xintifCmp} + +\csa{xintifCmp}\marg{f}\marg{g}\marg{if f<g}\marg{if f=g}\marg{if + f>g}\etype{\Ff\Ff nnn} compares its first two arguments and chooses accordingly +the correct branch. + +\subsection{\csbh{xintifEq}}\label{xintifEq} + +\csa{xintifEq}\marg{f}\marg{g}\marg{YES}\marg{NO}\etype{\Ff\Ff nn} checks +equality of its two first arguments and executes accordingly the |YES| or the +|NO| branch. + +\subsection{\csbh{xintifGt}}\label{xintifGt} + +\csa{xintifGt}\marg{f}\marg{g}\marg{YES}\marg{NO}\etype{\Ff\Ff nn} +checks if $f>g$ and in that case executes the |YES| branch. + +\subsection{\csbh{xintifLt}}\label{xintifLt} + +\csa{xintifLt}\marg{f}\marg{g}\marg{YES}\marg{NO}\etype{\Ff\Ff nn} +checks if $f<g$ and in that case executes the |YES| branch. + +\subsection{\csbh{xintifInt}}\label{xintifInt} + +\csa{xintifInt}|{f}{YES branch}{NO branch}|\etype{\Ff nn} expandably chooses +the |YES| branch if |f| reveals itself after expansion and simplification to +be an integer. + +\subsection{\csbh{xintSgn}}\label{xintSgn} + +The sign of a fraction.\etype{\Ff} + +\subsection{\csbh{xintOpp}}\label{xintOpp} + +The opposite of a fraction.\etype{\Ff} +Note that |\xintOpp {3}| produces \dtt{\xintOpp + {3}} whereas |\xintiiOpp {3}| produces \dtt{\xintiiOpp {3}}. + +\subsection{\csbh{xintAbs}}\label{xintAbs} + +The absolute value\etype{\Ff}. Note that |\xintAbs {-2}|\dtt{=\xintAbs {-2}} +where |\xintiiAbs {-2}| outputs \dtt{=\xintiiAbs {-2}}. \subsection{\csbh{xintAdd}}\label{xintAdd} -Computes the addition\etype{\Ff\Ff} of two fractions. To keep for integers the -integer format on output use \csbxint{iAdd}. +Computes the addition\etype{\Ff\Ff} of two fractions. Checks if one denominator is a multiple of the other. Else multiplies the denominators. @@ -11522,65 +10043,39 @@ denominators. \subsection{\csbh{xintSub}}\label{xintSub} Computes the difference\etype{\Ff\Ff} of two fractions (|\xintSub{F}{G}| -computes |F-G|). To keep for integers the integer format on output use -\csbxint{iSub}. +computes |F-G|). Checks if one denominator is a multiple of the other. Else multiplies the denominators. \subsection{\csbh{xintMul}}\label{xintMul} -Computes the product\etype{\Ff\Ff} of two fractions. To keep for integers the -integer format on output use \csbxint{iMul}. +Computes the product\etype{\Ff\Ff} of two fractions. No reduction attempted. -\subsection{\csbh{xintSqr}}\label{xintSqr} - -Computes the square\etype{\Ff} of one fraction. To maintain for integer input -an integer format on output use \csbxint{iSqr}. - \subsection{\csbh{xintDiv}}\label{xintDiv} Computes the quotient \etype{\Ff\Ff} of two fractions. -(|\xintDiv{F}{G}| computes |F/G|). To keep for integers the integer format on -output use \csbxint{iMul}. +(|\xintDiv{F}{G}| computes |F/G|). No reduction attempted. -\subsection{\csbh{xintDivTrunc}, \csbh{xintDivRound}} +\subsection{\csbh{xintDivTrunc}} \label{xintDivTrunc} -\label{xintDivRound} - -Computes the quotient \etype{\Ff\Ff} of the two arguments then either -truncates or rounds to an integer. - -\subsection{\csbh{xintiFac}}\label{xintiFac} +Computes the quotient \etype{\Ff\Ff} of two arguments then +truncates to an integer. -With \xintfracname loaded |\xintiFac|\etype{\Numf} is extended to allow a -fraction |f| as input, it will be truncated first to an integer |n| before the -evaluation of the factorial. The output is an integer in strict format, -without a trailing |/1[0]|. See the \hyperref[xintiiFac]{\csa{xintiiFac} doc} -for more info. - -\subsection{\csbh{xintiBinomial}}\label{xintiBinomial} +\subsection{\csbh{xintDivRound}} +\label{xintDivRound} -With \xintfracname loaded |\xintiBinomial|\etype{\Numf\Numf} is extended to -allow fractional inputs which will be truncated to integers before the -evaluation of the binomial. The output is an integer in strict format, without -a trailing |/1[0]|. See the -\hyperref[xintiiBinomial]{\csa{xintiiBinomial} doc} for the current allowable -range. +Computes the quotient \etype{\Ff\Ff} of the two arguments then rounds to an +integer. -\subsection{\csbh{xintiPFactorial}}\label{xintiPFactorial} -% fait 2015/11/29 pour 1.2f. +\subsection{\csbh{xintSqr}}\label{xintSqr} -With \xintfracname loaded |\xintiPFactorial|\etype{\Numf\Numf} is extended to -allow fractional inputs which will be truncated to integers before the -evaluation of the partial factorial. The output is an integer in strict -format, without a trailing |/1[0]|. See the -\hyperref[xintiiPFactorial]{\csa{xintiiPFactorial} doc} for more info. +Computes the square\etype{\Ff} of one fraction. \subsection{\csbh{xintPow}}\label{xintPow} @@ -11588,93 +10083,63 @@ format, without a trailing |/1[0]|. See the |x| possibly also, but |x| will first get truncated to a (positive or negative) integer. -The output will now always be in the form |A/B[n]| (even when the exponent +The output will now always be in the form |A/B[n]| (even if the exponent vanishes: |\xintPow {2/3}{0}|\dtt{=\xintPow{2/3}{0}}). -The macro handling only integers is available as \csbxint{iPow}. Only -\csa{xintPow} accepts negative exponent, as this produces fractions. - Within an \csbxint{iiexpr}|..\relax| the infix operator |^| is mapped to \csa{xintiiPow}; within an \csbxint{expr}-ession it is mapped to \csa{xintPow}. +\subsection{\csbh{xintFac}}\label{xintFac} -\subsection{\csbh{xintSum}}\label{xintSum} +This is a convenience variant of \csbxint{iiFac} which applies \csbxint{Num} +to its argument\etype{\Numf}. Notice however that the output will have a trailing +|[0]| according to the \xintfracname format for integers. -This\etype{f{$\to$}{\lowast\Ff}} computes the sum of fractions. The output -will now always be in the form |A/B[n]|. The original, for big integers only -(in strict format), is available as \csa{xintiiSum}. +The |\xintiFac| variant which does not add this |[0]| +is deprecated and will be removed at some future release. -\begin{everbatim*} -\xintSum {{1282/2196921}{-281710/291927}{4028/28612}} -\end{everbatim*} - -No simplification attempted. - -\subsection{\csbh{xintPrd}}\label{xintPrd} - -TThis\etype{f{$\to$}{\lowast\Ff}} computes the product of fractions. The output -will now always be in the form |A/B[n]|. The original, for big integers only -(in strict format), is available as \csa{xintiiPrd}. - -\begin{everbatim*} -\xintPrd {{1282/2196921}{-281710/291927}{4028/28612}} -\end{everbatim*} - -No simplification attempted. - -\subsection{\csbh{xintCmp}}\label{xintCmp} +\subsection{\csbh{xintBinomial}}\label{xintBinomial} -This\etype{\Ff\Ff} compares two fractions |F| and |G| and produces -|-1|, |0|, or |1| according to |F<G|, |F=G|, |F>G|. - -For choosing branches according to the result of comparing |f| and |g|, see -\csbxint{ifCmp}. - -\subsection{\csbh{xintIsOne}} - -This\etype{\Ff} returns |1| if the fraction is |1| and |0| if not. +This is a convenience variant of \csbxint{iiBinomial} which applies +\csbxint{Num} to its arguments\etype{\Numf\Numf}. Notice however that the +output will have a trailing |[0]| according to the \xintfracname format for +integers. -\begin{everbatim*} -\xintIsOne {21921379213/21921379213} but \xintIsOne {1.00000000000000000000000000000001} -\end{everbatim*} +The |\xintiBinomial| variant which does not add this |[0]| +is deprecated and will be removed at some future release. -\subsection{\csbh{xintGeq}}\label{xintGeq} +\subsection{\csbh{xintPFactorial}}\label{xintPFactorial} -This\etype{\Ff\Ff} compares the \emph{absolute values} of two -fractions.|\xintGeq{f}{g}| returns |1| if {\catcode`| 12 $|f|\geqslant|g|$} and |0| -if not. +This is a convenience variant of \csbxint{iiPFactorial} which applies +\csbxint{Num} to its arguments\etype{\Numf\Numf}. Notice however that the +output will have a trailing |[0]| according to the \xintfracname format for +integers. -May be used for expandably branching as: -\verb+\xintSgnFork{\xintGeq{f}{g}}{}{code for |f|<|g|}{code for - |f|+$\geqslant$\verb+|g|}+ +The |\xintiPFactorial| variant which does not add this |[0]| +is deprecated and will be removed at some future release. \subsection{\csbh{xintMax}}\label{xintMax} -The maximum of two fractions.\etype{\Ff\Ff} But now |\xintMax {2}{3}| -returns \dtt{\xintMax {2}{3}}. The original, for use with (possibly big) +The maximum of two fractions.\etype{\Ff\Ff} Beware that |\xintMax {2}{3}| +produces \dtt{\xintMax {2}{3}}. The original, for use with integers only with no need of normalization, is available as \csbxint{iiMax}: -|\xintiiMax {2}{3}=|\dtt{\xintiMax {2}{3}}.\etype{ff} - -There is also \csbxint{iMax}\etype{\Numf\Numf} which works with fractions but -first truncates them to integers. +|\xintiiMax {2}{3}=|\dtt{\xintiiMax {2}{3}}.\etype{ff} \begin{everbatim*} -\xintMax {2.5}{7.2} but \xintiMax {2.5}{7.2} +\xintMax {2.5}{7.2} \end{everbatim*} \subsection{\csbh{xintMin}}\label{xintMin} -The maximum of two fractions.\etype{\Ff\Ff} The original, for use with (possibly big) +The maximum of two fractions.\etype{\Ff\Ff} Beware that |\xintMax {2}{3}| +produces \dtt{\xintMax {2}{3}}. The original, for use with integers only with no need of normalization, is available as \csbxint{iiMin}: -|\xintiiMin {2}{3}=|\dtt{\xintiMin {2}{3}}.\etype{ff} - -There is also \csbxint{iMin}\etype{\Numf\Numf} which works with fractions but first -truncates them to integers. +|\xintiiMin {2}{3}=|\dtt{\xintiiMin {2}{3}}.\etype{ff} \begin{everbatim*} -\xintMin {2.5}{7.2} but \xintiMin {2.5}{7.2} +\xintMin {2.5}{7.2} \end{everbatim*} \subsection{\csbh{xintMaxof}}\label{xintMaxof} @@ -11695,20 +10160,33 @@ thing within braces. \etype{f{$\to$}{\lowast\Ff}} \xintMinof {{1.23}{1.2299}{1.2301}} and \xintMinof {{-1.23}{-1.2299}{-1.2301}} \end{everbatim*} -\subsection{\csbh{xintAbs}}\label{xintAbs} +\subsection{\csbh{xintSum}}\label{xintSum} -The absolute value\etype{\Ff}. Note that |\xintAbs {-2}|\dtt{=\xintAbs {-2}} -whereas |\xintiAbs {-2}|\dtt{=\xintiAbs {-2}}. +This\etype{f{$\to$}{\lowast\Ff}} computes the sum of fractions. The output +will now always be in the form |A/B[n]|. The original, for big integers only +(in strict format), is available as \csa{xintiiSum}. -\subsection{\csbh{xintSgn}}\label{xintSgn} +\begin{everbatim*} +\xintSum {{1282/2196921}{-281710/291927}{4028/28612}} +\end{everbatim*} -The sign of a fraction.\etype{\Ff} +No simplification attempted. -\subsection{\csbh{xintOpp}}\label{xintOpp} +\subsection{\csbh{xintPrd}}\label{xintPrd} -The opposite of a fraction.\etype{\Ff} -Note that |\xintOpp {3}| now outputs \dtt{\xintOpp - {3}} whereas |\xintiOpp {3}| returns \dtt{\xintiOpp {3}}. +TThis\etype{f{$\to$}{\lowast\Ff}} computes the product of fractions. The output +will now always be in the form |A/B[n]|. The original, for big integers only +(in strict format), is available as \csa{xintiiPrd}. + +\begin{everbatim*} +\xintPrd {{1282/2196921}{-281710/291927}{4028/28612}} +\end{everbatim*} + +No simplification attempted. + +\begin{everbatim*} +$\xintIsOne {21921379213/21921379213}\neq\xintIsOne {1.00000000000000000000000000000001}$ +\end{everbatim*} \subsection{\csbh{xintDigits}, \csbh{xinttheDigits}} \label{xintDigits} @@ -11831,8 +10309,9 @@ Currently trailing zeros are not trimmed. |f| by $10^x$, and converts it to float format according to the optional first argument or current value of |\xinttheDigits|. -% -\leftedline{|\xintFloatE {1.23e37}{53}|\dtt{=\xintFloatE {1.23e37}{53}}} +\begin{everbatim*} +\xintFloatE {1.23e37}{53} +\end{everbatim*} \subsection{\csbh{xintFloatAdd}}\label{xintFloatAdd} @@ -11890,120 +10369,6 @@ exact fraction |f/g|. Indeed the macro arguments are each first individually rounded to |P| digits of precision. The correct syntax to get the correctly rounded integer fraction |f/g| is \csbxint{Float}|[P]{f/g}|. -\subsection{\csbh{xintFloatFac}}\label{xintFloatFac} - -\csa{xintFloatFac}|[P]{f}|\etype{{\upshape[\numx]}\Numf} returns the -factorial with either \csa{xinttheDigits} or |P| digits of precision. - -% je devrais vérifier mais j'ai écrit cela fin novembre 2015 début décembre je -% suppose que je savais ce que je disais. - - -The exact theoretical value differs from the calculated one |Y| by an absolute -error strictly less than |0.6 ulp(Y)|. - -\begin{everbatim*} -$1000!\approx{}$\xintFloatFac [30]{1000} -\end{everbatim*} -The computation proceeds via doing explicitely the product, as -the Stirling formula cannot be used for lack so far of |exp/log|. - -The maximal allowed argument is $99999999$, but already $100000!$ currently -takes, for \dtt{16} digits of precision, a few seconds on my laptop (it -returns \dtt{2.824229407960348e456573}). - -The |factorial| function is available in \csbxint{floatexpr}: -\begin{everbatim*} -\xintthefloatexpr factorial(1000)\relax % same as 1000! -\end{everbatim*} - -\subsection{\csbh{xintFloatBinomial}}\label{xintFloatBinomial} - -\csa{xintFloatBinomial}|[P]{x}{y}|\etype{{\upshape[\numx]}\Numf\Numf} computes -binomial coefficients with either \csa{xinttheDigits} or |P| digits of -precision. - -When |x<0| an out-of-range error is raised. Else (this was changed in |1.2h|, -see \autoref{xintiiBinomial}), if |y<0| or if |x<y| the macro -evaluates to \dtt{\xintFloatBinomial{1}{-1}}. - -The exact theoretical value differs from the calculated one |Y| by an absolute -error strictly less than |0.6 ulp(Y)|. - -\begin{everbatim*} -${3000\choose 1500}\approx{}$\xintFloatBinomial [24]{3000}{1500} -\end{everbatim*} - -% \begin{everbatim*} -% ${9999\choose 5000}\approx{}$\xintFloatBinomial [24]{9999}{5000} -% \end{everbatim*} - -% 2015/11/28 -% 7.95895131766219474168799e3007 -% aparté: (testé avec Maple 16, 2015/11/28) -% > binomial (9999.,5000.); -% 3008 -% 0.795895131768 10 -% -% > Digits:=32; -% Digits := 32 -% -% > binomial (9999.,5000.); -% 3008 -% 0.795895131768 10 -% apparemment le binomial de Maple ne sait pas calculer avec plus de -% précision! -% et son dernier chiffre est faux! Pourtant GAMMA(9999.) fonctionne. Sauf si -% je n'ai pas compris quelque chose il me semble donc que le binomial de Maple -% est bogué...binomial(100.,50.); marche lui et binomial(4999.,2000.); aussi, -% bon clairement on a un bug de Maple ! oui binomial(8999.,5000.); ainsi que -% binomial(10999.,5000.); fonctionnent avec Digits:=32 mais **pas** -% binomial(9999.,5000.)... binomial(10000.,5000.); et binomial(9998.,5000.); -% sont OK. Est-ce qu'on gagne quelque chose pour un bug report ? -% > binomial(9999.,5000.); -% 3008 -% 0.795895131768 10 -% > binomial(10000.,5000.); -% 3009 -% 0.1591790263532438948337597273641521 10 -% > binomial(9998.,5000.); -% 3008 -% 0.3979077671466477799149739359402922 10 -% en plus je lui demande 32 chiffres et il m'en sort 34. - -The |binomial| function is available in \csbxint{floatexpr}: -\begin{everbatim*} -\xintthefloatexpr binomial(3000,1500)\relax -\end{everbatim*} - -The computation is based on the formula |(x-y+1)...x/y!| (here one arranges -|y<=x-y| naturally). - - -\subsection{\csbh{xintFloatPFactorial}}\label{xintFloatPFactorial} - -\csa{xintFloatPFactorial}|[P]{x}{y}|\etype{{\upshape[\numx]}\Numf\Numf} -computes the product |(x+1)...y|. - -The inputs |x| and |y| must evaluate to non-negative integers less in absolute -value than $10^8$. For |x=y| the product is considered empty hence the -returned value is |1|. - -It was a bit unfortunate with |1.2f| that the code deliberately raised an -error if the condition |0<=x<=y<10^8| was violated. See -\autoref{xintiiPFactorial} for the now prevailing rules.\CHANGED{1.2h} - -But only for the range |0<=x<=y<10^8| is it to be considered that the -behaviour is fixed and will not change in the future. - -The exact theoretical value differs from the calculated one |Y| by an absolute -error strictly less than |0.6 ulp(Y)|. - -The |pfactorial| function is available in \csbxint{floatexpr}: -\begin{everbatim*} -\xintthefloatexpr pfactorial(2500,5000)\relax -\end{everbatim*} - \subsection{\csbh{xintFloatPow}}\label{xintFloatPow} |\xintFloatPow [P]{f}{x}|\etype{{\upshape[\numx]}\Ff\numx} uses either the @@ -12017,10 +10382,9 @@ accepted on input for this |x|. And the absolute value \verb+|x|+ must obey the The argument |f| is first rounded to |P| significant places to give |f'|. The output |Z| is such that the exact |f'^x| differs from |Z| by an absolute error less than |0.52 ulp(Z)|. - -% -\leftedline{|\xintFloatPow [8]{3.1415}{1234567890}|% - \dtt{=\xintFloatPow [8]{3.1415}{1234567890}}} +\begin{everbatim*} +\xintFloatPow [8]{3.1415}{1234567890} +\end{everbatim*} \subsection{\csbh{xintFloatPower}}\label{xintFloatPower} @@ -12140,29 +10504,189 @@ transitive.)\par -\xintDigits:=16; +\subsection{\csbh{xintFloatFac}}\label{xintFloatFac} + +\csa{xintFloatFac}|[P]{f}|\etype{{\upshape[\numx]}\Numf} returns the +factorial with either \csa{xinttheDigits} or |P| digits of precision. + +% je devrais vérifier mais j'ai écrit cela fin novembre 2015 début décembre je +% suppose que je savais ce que je disais. + + +The exact theoretical value differs from the calculated one |Y| by an absolute +error strictly less than |0.6 ulp(Y)|. + +\begin{everbatim*} +$1000!\approx{}$\xintFloatFac [30]{1000} +\end{everbatim*} +The computation proceeds via doing explicitely the product, as +the Stirling formula cannot be used for lack so far of |exp/log|. + +The maximal allowed argument is $99999999$, but already $100000!$ currently +takes, for \dtt{16} digits of precision, a few seconds on my laptop (it +returns \dtt{2.824229407960348e456573}). + +The |factorial| function is available in \csbxint{floatexpr}: +\begin{everbatim*} +\xintthefloatexpr factorial(1000)\relax % same as 1000! +\end{everbatim*} -\subsection{\csbh{xintiDivision}, \csbh{xintiQuo}, \csbh{xintiRem}, - \csbh{xintFDg}, \csbh{xintLDg}, \csbh{xintMON}, \csbh{xintMMON}, - \csbh{xintOdd}} +\subsection{\csbh{xintFloatBinomial}}\label{xintFloatBinomial} -These macros\etype{\Ff\Ff} accept a fraction (or two) on input but will -truncate it (them) to an integer using \csbxint{Num} (which is the same as -\csbxint{TTrunc}). On output they produce integers without |/| nor |[N]|. +\csa{xintFloatBinomial}|[P]{x}{y}|\etype{{\upshape[\numx]}\Numf\Numf} computes +binomial coefficients with either \csa{xinttheDigits} or |P| digits of +precision. -All have variants from package \xintname whose names start with |xintii| -rather than |xint|; these variants accept on input only integers in the strict -format (they do not use \csbxint{Num}). They thus have less overhead, and may -be used when one is dealing exclusively with (big) integers. +When |x<0| an out-of-range error is raised. Else (this was changed in |1.2h|, +see \autoref{xintiiBinomial}), if |y<0| or if |x<y| the macro +evaluates to \dtt{\xintFloatBinomial{1}{-1}}. +The exact theoretical value differs from the calculated one |Y| by an absolute +error strictly less than |0.6 ulp(Y)|. + +\begin{everbatim*} +${3000\choose 1500}\approx{}$\xintFloatBinomial [24]{3000}{1500} +\end{everbatim*} + +% \begin{everbatim*} +% ${9999\choose 5000}\approx{}$\xintFloatBinomial [24]{9999}{5000} +% \end{everbatim*} + +% 2015/11/28 +% 7.95895131766219474168799e3007 +% aparté: (testé avec Maple 16, 2015/11/28) +% > binomial (9999.,5000.); +% 3008 +% 0.795895131768 10 % -\leftedline{|\xintNum {1e80}|} +% > Digits:=32; +% Digits := 32 % -\leftedline{\dtt{\xintNum{1e80}}} +% > binomial (9999.,5000.); +% 3008 +% 0.795895131768 10 +% apparemment le binomial de Maple ne sait pas calculer avec plus de +% précision! +% et son dernier chiffre est faux! Pourtant GAMMA(9999.) fonctionne. Sauf si +% je n'ai pas compris quelque chose il me semble donc que le binomial de Maple +% est bogué...binomial(100.,50.); marche lui et binomial(4999.,2000.); aussi, +% bon clairement on a un bug de Maple ! oui binomial(8999.,5000.); ainsi que +% binomial(10999.,5000.); fonctionnent avec Digits:=32 mais **pas** +% binomial(9999.,5000.)... binomial(10000.,5000.); et binomial(9998.,5000.); +% sont OK. Est-ce qu'on gagne quelque chose pour un bug report ? +% > binomial(9999.,5000.); +% 3008 +% 0.795895131768 10 +% > binomial(10000.,5000.); +% 3009 +% 0.1591790263532438948337597273641521 10 +% > binomial(9998.,5000.); +% 3008 +% 0.3979077671466477799149739359402922 10 +% en plus je lui demande 32 chiffres et il m'en sort 34. + +The |binomial| function is available in \csbxint{floatexpr}: +\begin{everbatim*} +\xintthefloatexpr binomial(3000,1500)\relax +\end{everbatim*} + +The computation is based on the formula |(x-y+1)...x/y!| (here one arranges +|y<=x-y| naturally). + + +\subsection{\csbh{xintFloatPFactorial}}\label{xintFloatPFactorial} + +\csa{xintFloatPFactorial}|[P]{x}{y}|\etype{{\upshape[\numx]}\Numf\Numf} +computes the product |(x+1)...y|. + +The inputs |x| and |y| must evaluate to non-negative integers less in absolute +value than $10^8$. For |x=y| the product is considered empty hence the +returned value is |1|. + +It was a bit unfortunate with |1.2f| that the code deliberately raised an +error if the condition |0<=x<=y<10^8| was violated. See +\autoref{xintiiPFactorial} for the now prevailing rules.\CHANGED{1.2h} + +But only for the range |0<=x<=y<10^8| is it to be considered that the +behaviour is fixed and will not change in the future. + +The exact theoretical value differs from the calculated one |Y| by an absolute +error strictly less than |0.6 ulp(Y)|. + +The |pfactorial| function is available in \csbxint{floatexpr}: +\begin{everbatim*} +\xintthefloatexpr pfactorial(2500,5000)\relax +\end{everbatim*} + +\xintDigits:=16; + +\subsection{\csbh{xintFrac}}\label{xintFrac} + +This is a \LaTeX{} only macro,\etype{\Ff} to be used in math mode only. It +will print a fraction, internally represented as something equivalent to +|A/B[n]| as |\frac {A}{B}10^n|. The power of ten is omitted when |n=0|, the +denominator is omitted when it has value one, the number being separated from +the power of ten by a |\cdot|. |$\xintFrac {178.000/25600000}$| gives $\xintFrac +{178.000/25600000}$, |$\xintFrac {178.000/1}$| gives $\xintFrac {178.000/1}$, +|$\xintFrac {3.5/5.7}$| gives $\xintFrac {3.5/5.7}$, and |$\xintFrac {\xintNum + {\xintiiFac{10}/|\allowbreak|\xintiiSqr{\xintiiFac {5}}}}$| gives $\xintFrac +{\xintNum {\xintiiFac{10}/\xintiiSqr{\xintiiFac {5}}}}$. As shown by the examples, +simplification of the input (apart from removing the decimal points and moving +the minus sign to the numerator) is not done automatically and must be the +result of macros such as |\xintIrr|, |\xintREZ|, or |\xintNum| (for fractions +being in fact integers.) + +\subsection{\csbh{xintSignedFrac}}\label{xintSignedFrac} + + +This is as \csbxint{Frac}\etype{\Ff} except that a negative fraction has the +sign put in front, not in the numerator. +\begin{everbatim*} +\[\xintFrac{-355/113}=\xintSignedFrac {-355/113}\] +\end{everbatim*} + +\subsection{\csbh{xintFwOver}}\label{xintFwOver} + +This does the same as \csa{xintFrac}\etype{\Ff} except that the \csa{over} +primitive is used for the fraction (in case the denominator is not one; and a +pair of braces contains the |A\over B| part). |$\xintFwOver {178.000/25600000}$| +gives $\xintFwOver {178.000/25600000}$, |$\xintFwOver {178.000/1}$| gives +$\xintFwOver {178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver +{3.5/5.7}$, and |$\xintFwOver {\xintNum {\xintiiFac{10}/\xintiiSqr{\xintiiFac + {5}}}}$| gives $\xintFwOver {\xintNum {\xintiiFac{10}/\xintiiSqr{\xintiiFac + {5}}}}$. + +\subsection{\csbh{xintSignedFwOver}}\label{xintSignedFwOver} + +This is as \csbxint{FwOver}\etype{\Ff} except that a negative fraction has the +sign put in front, not in the numerator. +\begin{everbatim*} +\[\xintFwOver{-355/113}=\xintSignedFwOver {-355/113}\] +\end{everbatim*} -%\etocdepthtag.toc {xintexpr} +\subsection{\csbh{xintLen}}\label{xintLenFrac} + +The original \csbxint{Len} macro\etype{\Ff} is extended to accept a fraction +on input: the length of |A/B[n]| is the length of |A| plus the length of |B| +plus the absolute value of |n| and minus one (an integer input as |N| is +internally represented in a form equivalent to |N/1[0]| so the minus one means +that the extended \csa{xintLen} behaves the same as the original for +integers). +\begin{everbatim*} +\xintLen{201710/298219}=\xintLen{201710}+\xintLen{298219}-1\newline +\xintLen{1234/1}=\xintLen{1234}=\xintLen{1234[0]}=\xintiLen{1234}\newline +\xintLen{-1e3/5.425} (\xintRaw {-1e3/5.425})\par +\end{everbatim*} +The length is computed on the |A/B[n]| which would have been returned by +\csbxint{Raw}, as illustrated by the last example above. + +|\xintLen| is only for use with such (scientific) numbers or fractions. See +also \csbxint{NthElt} from \xinttoolsname. See also \csbxint{Length} (which +however does not expand its argument) from \xintkernelname for counting more +general tokens (or rather braced items). \clearpage + \section{Macros of the \xintexprname package}% \label{sec:expr} @@ -12813,7 +11337,7 @@ Another example Again, this macro gobbles the false branches, as would have the operator |??| inside an |\xintexpr|-ession. -\subsubsection{External macros and \csbh{NewExpr}; the protect function} +\subsubsection{External macros and \csbh{xintNewExpr}; the protect function} \label{sssec:protect} For macros within such a created \xintname-formula macro, there @@ -13338,12 +11862,12 @@ principles are necessarily different due to the aim of achieving expandability. This package provides expandable conversions of (big) integers to and from binary and hexadecimal. -It was first included in the |1.08| (|2013/06/07|) release of \xintname. Its -routines remained un-modified until their complete rewrite at release |1.2m| -(|2017/07/31|). The new macros are faster, using techniques from the |1.2| -(|2015/10/10|) release of \xintcorename. But the inputs are now limited to a -few thousand digits, whereas the |1.08| could handle (slowly...) tens of -thousands of digits. +First version of this package was in the |1.08| (|2013/06/07|) release of +\xintname. Its routines remained un-modified until their complete rewrite at +release |1.2m| (|2017/07/31|). The new macros are faster, using techniques +from the |1.2| (|2015/10/10|) release of \xintcorename. But the inputs are now +limited to a few thousand digits, whereas the |1.08| could handle (slowly...) +tens of thousands of digits. \autoref{tab:binhexsizes} recapitulates the maximal allowed sizes (they got increased at |1.2n|)\CHANGED{1.2n}: @@ -13419,7 +11943,8 @@ With this package loaded additionally to \xintexprname, hexadecimal input is possible in expressions: simply by using the prefix |"|. Such hexadecimal numbers may have a fractional part. Lowercase hexadecimal letters are currently \emph{not} recognized as such in expressions. -Currently the |p| postfix notation from standard programming languages given a +Currently the |p| postfix notation from standard programming languages +standing for an extra power of two multiplicand is not implemented. % \clearpage @@ -13454,7 +11979,9 @@ Converts from binary to decimal.\etype{f} \subsection{\csbh{xintBinToHex}}\label{xintBinToHex} -Converts from binary to hexadecimal.\etype{f} +Converts from binary to hexadecimal.\etype{f} The input is first zero-filled +to |4N| binary digits, hence the output will have |N| hexadecimal digits +(thus, if the input did not have a leading zero, the output will not either). \texttt{\string\xintBinToHex \string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent @@ -13479,6 +12006,27 @@ binary digits, leading zeroes are not trimmed.\CHANGED{1.2m} \string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent \dtt{->\printnumber{\xintCHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}} +This can be combined with \csbxint{BinToHex} for round-trips preserving +leading zeroes for |4N| binary digits numbers, whereas using +\csbxint{HexToBin} gives reproducing round-trips only for |4N| binary numbers +numbers not starting with |0000|. +\begin{everbatim*} +This zero-fills to 4N digits the input, hence gives here a leading zero in output: +\xintBinToHex{0001111}\newline +Chaining, we end up with 4N-3 digits, as three binary zeroes are trimmed: +\xintHexToBin{\xintBinToHex{0001111}}\newline +But this will always reproduce the initial input zero-filled to length 4N: +\xintCHexToBin{\xintBinToHex{0001111}}\par +Another example (visible space characters manually inserted):\newline +$000000001111101001010001\xrightarrow{\text{\string\xintBinToHex}} +\xintBinToHex{000000001111101001010001}\xrightarrow{\text{\string\xintHexToBin\hphantom{X}}} +\text{\textvisiblespace\textvisiblespace\textvisiblespace} +\xintHexToBin{\xintBinToHex{000000001111101001010001}}$\newline +$000000001111101001010001\xrightarrow{\text{\string\xintBinToHex}} +\xintBinToHex{000000001111101001010001}\xrightarrow{\text{\string\xintCHexToBin}} +\xintCHexToBin{\xintBinToHex{000000001111101001010001}}$ +\par +\end{everbatim*} \clearpage \section{Macros of the \xintgcdname package} \label{sec:gcd} @@ -13534,23 +12082,15 @@ macro, it is \fexpan ded first and must contain at least one item. |\xintBezout|\n\m\etype{\Numf\Numf} returns five numbers |A|, |B|, |U|, |V|, |D| within braces. |A| is the first (expanded, as usual) input number, |B| the -second, |D| is the GCD, and \dtt{UA - VB = D}. +second, |D| is the GCD, and \dtt{UA - VB = D}. \begin{everbatim*} -\xintAssign[oo]{{\xintBezout {10000}{1113}}}\to\X -\meaning\X\newline +\oodef\X{\xintBezout {10000}{1113}}\meaning\X\par \xintAssign {\xintBezout {10000}{1113}}\to\A\B\U\V\D A: \meaning\A\newline B: \meaning\B\newline U: \meaning\U\newline V: \meaning\V\newline D: \meaning\D\par -\end{everbatim*} -For more than three years (from |1.09j 2014/01/09| to |1.2l| in 2017...) this -documentation looked strange (also in the next two sub-sections,) because -\csbxint{Assign} was modified at |1.09j| but the example above was missing the -now needed |[oo]| (or |[f]|, or |[e]|) hence |\X| was simply displayed as -|\xintBezout {10000}{1113}|. -\begin{everbatim*} \xintAssign {\xintBezout {123456789012345}{9876543210321}}\to\A\B\U\V\D A: \meaning\A\newline B: \meaning\B\newline @@ -13564,8 +12104,7 @@ D: \meaning\D\par |\xintEuclideAlgorithm|\n\m\etype{\Numf\Numf} applies the Euclide algorithm and keeps a copy of all quotients and remainders. \begin{everbatim*} -\xintAssign [oo]{{\xintEuclideAlgorithm {10000}{1113}}}\to\X -\meaning\X +\edef\X{\xintEuclideAlgorithm {10000}{1113}}\meaning\X \end{everbatim*} The first token is the number of steps, the second is |N|, the @@ -13581,8 +12120,7 @@ entries of the successive products of the 2 by 2 matrices $\left(\vcenter{\halign {\,#&\,#\cr q & 1 \cr 1 & 0 \cr}}\right)$ formed from the quotients arising in the algorithm. \begin{everbatim*} -\xintAssign [oo]{{\xintBezoutAlgorithm {10000}{1113}}}\to\X -\printnumber{\meaning\X} +\edef\X{\xintBezoutAlgorithm {10000}{1113}}\printnumber{\meaning\X} \end{everbatim*} The first token is the number of steps, the second is |N|, then @@ -13644,11 +12182,6 @@ input an explicit number |n| and producing some number or fraction |\coeff{n}|; it is expanded at the time it is needed.% % -\footnote{\label{fn:xintiiMON}\csbxint{iiMON} is like \csbxint{MON} but - does not parse its argument through \csbxint{Num}, for efficiency; - other macros of this type are \csbxint{iiAdd}, \csbxint{iiMul}, - \csbxint{iiSum}, \csbxint{iiPrd}, \csbxint{iiMMON}, \csbxint{iiLDg}, - \csbxint{iiFDg}, \csbxint{iiOdd}, \dots} \begin{everbatim*} \def\coeff #1{\xintiiMON{#1}/#1.5} % (-1)^n/(n+1/2) @@ -13713,7 +12246,7 @@ factor of \dtt{\xintNum {\xintDenominator\w/\xintDenominator\z}}. $\sum_{\text{|n=A|}}^{\text{|n=B|}}$|\coeff{n}| where |\coeff{n}| must \fexpan d to a (possibly long) integer in the strict format. \everb|@ -\def\coeff #1{\xintiTrunc {40}{\xintMON{#1}/#1.5}}% +\def\coeff #1{\xintiTrunc {40}{\xintiiMON{#1}/#1.5}}% % better: \def\coeff #1{\xintiTrunc {40} {\the\numexpr 2*\xintiiMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}% @@ -13848,7 +12381,7 @@ Here is a slightly more complicated evaluation: \loop \fdef\z {\xintRationalSeries {\cnta} {2*\cnta-1} - {\xintiPow {\the\cnta}{\cnta}/\xintiiFac{\cnta}} + {\xintiiPow {\the\cnta}{\cnta}/\xintiiFac{\cnta}} {\ratioexp{\the\cnta}}}% \fdef\w {\xintRationalSeries {0}{2*\cnta-1}{1}{\ratioexp{\the\cnta}}}% \noindent @@ -14560,7 +13093,7 @@ always do it on a value computed with |D+1| truncation. \localtableofcontents -This package was first included in release |1.04| (|2013/04/25|) of the +First version of this package was included in release |1.04| (|2013/04/25|) of the \xintname bundle. It was kept almost unchanged until |1.09m| of |2014/02/26| which brings some new macros: \csbxint{FtoC}, \csbxint{CtoF}, \csbxint{CtoCv}, dealing with sequences of braced partial quotients rather than comma separated @@ -14652,12 +13185,12 @@ signs are mandatory). No spaces are allowed around the plus and fraction symbols. The coefficients may themselves be macros, as long as these macros are \fexpan dable. \begin{everbatim*} -\[ \xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}} - = \xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}\] +\[ \xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiiQuo {132}{25}}} + = \xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintiiQuo {132}{25}}\] \end{everbatim*} To compute the actual fraction one has \csbxint{GCtoF}: \begin{everbatim*} -\[\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiQuo {132}{25}}}\] +\[\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintiiQuo {132}{25}}}\] \end{everbatim*} For non-numeric input there is \csbxint{GGCFrac}. \begin{everbatim*} @@ -14731,7 +13264,7 @@ and indeed: \[\begin{vmatrix} ^2897319801297630107^ & ^328124887710626729^\\ ^20197107104701740^ & ^2287346221788023^ - \end{vmatrix} = \mbox{\dtt{\xintiSub {\xintiMul {2897319801297630107}{2287346221788023}}{\xintiMul{20197107104701740}{328124887710626729}}}}\] + \end{vmatrix} = \mbox{\dtt{\xintiiSub {\xintiiMul {2897319801297630107}{2287346221788023}}{\xintiiMul{20197107104701740}{328124887710626729}}}}\] \endgroup @@ -15295,6 +13828,1488 @@ One can also use a centered continued fraction: we get more digits but there are also more computations as the numerators may be either $1$ or $-1$. +\clearpage +\section{Macros of the \xinttoolsname package} + +\label{sec:tools} + +\localtableofcontents + +\def\n{|{N}|} +\def\m{|{M}|} +\def\x{|{x}|} + +These utilities used to be provided within the \xintname package; since |1.09g| +(|2013/11/22|) they have been moved to an independently usable package +\xinttoolsname, which has none of the \xintname facilities regarding big +numbers. Whenever relevant release |1.09h| has made the macros |\long| so they +accept |\par| tokens on input. + +The completely expandable utilities (up to \csbxint{iloop}) are documented +first, then the non expandable utilities. + +A brief overview is in \autoref{sec:sometoolsutils} and \autoref{sec:examples} +has more examples of use of macros of this package. + +\subsection{\csbh{xintRevWithBraces}}\label{xintRevWithBraces} + +%{\small New in release |1.06|.\par} + +\edef\X{\xintRevWithBraces{12345}} +\edef\y{\xintRevWithBraces\X} +\expandafter\def\expandafter\w\expandafter + {\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}} + +% +\csa{xintRevWithBraces}\marg{list}\etype{f} first does the \fexpan sion of its +argument then it reverses the order of the tokens, or braced material, it +encounters, maintaining existing braces and adding a brace pair around each +naked token encountered. Space tokens (in-between top level braces or naked +tokens) are gobbled. This macro is mainly thought out for use on a \meta{list} +of such braced material; with such a list as argument the \fexpan sion will only +hit against the first opening brace, hence do nothing, and the braced stuff may +thus be macros one does not want to expand. +% +\leftedline{|\edef\x{\xintRevWithBraces{12345}}|} +% +\leftedline{|\meaning\x:|\dtt{\meaning\X}} +% +\leftedline{|\edef\y{\xintRevWithBraces\x}|} +% +\leftedline{|\meaning\y:|\dtt{\meaning\y}} +% +The examples above could be defined with |\edef|'s because the braced material +did not contain macros. Alternatively: +% +\leftedline{|\expandafter\def\expandafter\w\expandafter|} +% +\leftedline{|{\romannumeral0\xintrevwithbraces{{\A}{\B}{\C}{\D}{\E}}}|} +% +\leftedline{|\meaning\w:|\dtt{\meaning\w}} +% +The macro \csa{xintReverseWithBracesNoExpand}\etype{n} does the same job +without the initial expansion of its argument. + + +\subsection{\csbh{xintZapFirstSpaces}, \csbh{xintZapLastSpaces}, \csbh{xintZapSpaces}, \csbh{xintZapSpacesB}} +\label{xintZapFirstSpaces} +\label{xintZapLastSpaces} +\label{xintZapSpaces} +\label{xintZapSpacesB} +%{\small New with release |1.09f|.\par} + +\csa{xintZapFirstSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion +of its argument, nor brace removal of any sort, nor does it alter \meta{stuff} +in anyway apart from stripping away all \emph{leading} spaces. + +This macro will be mostly of interest to programmers who will know what I will +now be talking about. \emph{The essential points, naturally, are the complete + expandability and the fact that no brace removal nor any other alteration is + done to the input.} + +\TeX's input scanner already converts consecutive blanks into single space +tokens, but |\xintZapFirstSpaces| handles successfully also inputs with +consecutive multiple space tokens. +However, it is assumed that \meta{stuff} does not contain (except inside braced +sub-material) space tokens of character code distinct from $32$. + +It expands in two steps, and if the goal is to apply it to the +expansion text of |\x| to define |\y|, then one should do: +|\expandafter\def\expandafter\y\expandafter + {\romannumeral0\expandafter\xintzapfirstspaces\expandafter{\x}}|. + +Other use case: inside a macro as |\edef\x{\xintZapFirstSpaces {#1}}| assuming +naturally that |#1| is compatible with such an |\edef| once the leading spaces +have been stripped. + +\begingroup +\def\x { \a { \X } { \b \Y } } +% +\leftedline{|\xintZapFirstSpaces { \a { \X } { \b \Y } }->|% +\dtt{\color{magenta}{}\expandafter\detokenize\expandafter +{\romannumeral0\expandafter\xintzapfirstspaces\expandafter{\x}}}+++} +\endgroup + +\medskip + +\noindent\csbxint{ZapLastSpaces}\marg{stuff}\etype{n} does not do \emph{any} expansion of +its argument, nor brace removal of any sort, nor does it alter \meta{stuff} in +anyway apart from stripping away all \emph{ending} spaces. The same remarks as +for \csbxint{ZapFirstSpaces} apply. + +% ATTENTION à l'\ignorespaces fait par \color! +\begingroup +\def\x { \a { \X } { \b \Y } } +% +\leftedline{|\xintZapLastSpaces { \a { \X } { \b \Y } }->|% +\dtt{\color{magenta}{}\expandafter\detokenize\expandafter +{\romannumeral0\expandafter\xintzaplastspaces\expandafter{\x}}}+++} +\endgroup + +\medskip + +\noindent\csbxint{ZapSpaces}\marg{stuff}\etype{n} does not do \emph{any} +expansion of its +argument, nor brace removal of any sort, nor does it alter \meta{stuff} in +anyway apart from stripping away all \emph{leading} and all \emph{ending} +spaces. The same remarks as for \csbxint{ZapFirstSpaces} apply. + +\begingroup +\def\x { \a { \X } { \b \Y } } +% +\leftedline{|\xintZapSpaces { \a { \X } { \b \Y } }->|% +\dtt{\color{magenta}{}\expandafter\detokenize\expandafter +{\romannumeral0\expandafter\xintzapspaces\expandafter{\x}}}+++} +\endgroup + +\medskip + +\noindent\csbxint{ZapSpacesB}\marg{stuff}\etype{n} does not do \emph{any} +expansion of +its argument, nor does it alter \meta{stuff} in anyway apart from stripping away +all leading and all ending spaces and possibly removing one level of braces if +\meta{stuff} had the shape |<spaces>{braced}<spaces>|. The same remarks as for +\csbxint{ZapFirstSpaces} apply. + +\begingroup +\def\x { \a { \X } { \b \Y } } +% +\leftedline{|\xintZapSpacesB { \a { \X } { \b \Y } }->|% +\dtt{\color{magenta}{}\expandafter\detokenize\expandafter +{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++} +\def\x { { \a { \X } { \b \Y } } } +% +\leftedline{|\xintZapSpacesB { { \a { \X } { \b \Y } } }->|% +\dtt{\color{magenta}{}\expandafter\detokenize\expandafter +{\romannumeral0\expandafter\xintzapspacesb\expandafter{\x}}}+++} +\endgroup + The spaces here at the start and end of the output come from the braced + material, and are not removed (one would need a second application for that; + recall though that the \xintname zapping macros do not expand their argument). + +\subsection{\csbh{xintCSVtoList}} +\label{xintCSVtoList} +\label{xintCSVtoListNoExpand} + + +\csa{xintCSVtoList}|{a,b,c...,z}|\etype{f} returns |{a}{b}{c}...{z}|. A +\emph{list} is by +convention in this manual simply a succession of tokens, where each braced thing +will count as one item (``items'' are defined according to the rules of \TeX{} +for fetching undelimited parameters of a macro, which are exactly the same rules +as for \LaTeX{} and macro arguments [they are the same things]). The word +`list' in `comma separated list of items' has its usual linguistic meaning, +and then an ``item'' is what is delimited by commas. + +So \csa{xintCSVtoList} takes on input a `comma separated list of items' and +converts it into a `\TeX{} list of braced items'. The argument to +|\xintCSVtoList| may be a macro: it will first be +\hyperref[ssec:expansions]{\fexpan ded}. Hence the item before the first comma, +if it is itself a macro, will be expanded which may or may not be a good thing. +A space inserted at the start of the first item serves to stop that expansion +(and disappears). The macro \csbxint{CSVtoListNoExpand}\etype{n} does the same +job without +the initial expansion of the list argument. + +Apart from that no expansion of the items is done and the list items may thus be +completely arbitrary (and even contain perilous stuff such as unmatched |\if| +and |\fi| tokens). + +Contiguous spaces and tab characters, are collapsed by \TeX{} +into single spaces. All such spaces around commas% +% +\footnote{and multiple space tokens are not a problem; but those at the + top level (not hidden inside braces) \emph{must} be of character code + |32|.} +% +\fbox{are removed}, as well as +the spaces at the start and the spaces at the end of the list.% +% +\footnote{let us recall that this is all done completely expandably... + There is absolutely no alteration of any sort of the item apart from + the stripping of initial and final space tokens (of character code + |32|) and brace removal if and only if the item apart from intial and + final spaces (or more generally multiple |char 32| space tokens) is + braced.} +% +The items may contain explicit |\par|'s or +empty lines (converted by the \TeX{} input parsing into |\par| tokens). + +\begingroup + +\edef\X{\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } , { {x , + y} } }} + +% +\leftedline{|\xintCSVtoList { 1 ,{ 2 , 3 , 4 , 5 }, a , {b,T} U , { c , d } , + { {x , y} } }|} +% +\leftedline{|->|% +{\makeatletter\dtt{\expandafter\strip@prefix\meaning\X}}} + +One sees on this example how braces protect commas from +sub-lists to be perceived as delimiters of the top list. Braces around an entire +item are removed, even when surrounded by spaces before and/or after. Braces for +sub-parts of an item are not removed. + +We observe also that there is a slight difference regarding the brace stripping +of an item: if the braces were not surrounded by spaces, also the initial and +final (but no other) spaces of the \emph{enclosed} material are removed. This is +the only situation where spaces protected by braces are nevertheless removed. + +From the rules above: for an empty argument (only spaces, no braces, no comma) +the output is +\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist { }}} +(a list with one empty item), +for ``|<opt. spaces>{}<opt. +spaces>|'' the output is +\dtt{\expandafter\detokenize\expandafter + {\romannumeral0\xintcsvtolist { {} }}} +(again a list with one empty item, the braces were removed), +for ``|{ }|'' the output is +\dtt{\expandafter\detokenize\expandafter + {\romannumeral0\xintcsvtolist {{ }}}} +(again a list with one empty item, the braces were removed and then +the inner space was removed), +for ``| { }|'' the output is +\dtt{\expandafter\detokenize\expandafter +{\romannumeral0\xintcsvtolist { { }}}} (again a list with one empty item, the initial space served only to stop the expansion, so this was like ``|{ }|'' as input, the braces were removed and the inner space was stripped), +for ``\texttt{\ \{\ \ \}\ }'' the output is +\dtt{\expandafter\detokenize\expandafter +{\romannumeral0\xintcsvtolist { { } }}} (this time the ending space of the first +item meant that after brace removal the inner spaces were kept; recall though +that \TeX{} collapses on input consecutive blanks into one space token), +for ``|,|'' the output consists of two consecutive +empty items +\dtt{\expandafter\detokenize\expandafter{\romannumeral0\xintcsvtolist + {,}}}. Recall that on output everything is braced, a |{}| is an ``empty'' +item. +% +Most of the above is mainly irrelevant for every day use, apart perhaps from the +fact to be noted that an empty input does not give an empty output but a +one-empty-item list (it is as if an ending comma was always added at the end of +the input). + +\def\y { \a,\b,\c,\d,\e} +\expandafter\def\expandafter\Y\expandafter{\romannumeral0\xintcsvtolist{\y}} +\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode} +\expandafter\def\expandafter\T\expandafter{\romannumeral0\xintcsvtolist{\t}} + +% +\leftedline{|\def\y{ \a,\b,\c,\d,\e} \xintCSVtoList\y->|% + {\makeatletter\dtt{\expandafter\strip@prefix\meaning\Y}}} +% +\leftedline{|\def\t {{\if},\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|} +% +\leftedline +{|\xintCSVtoList\t->|\makeatletter\dtt{\expandafter\strip@prefix\meaning\T}} +% +The results above were automatically displayed using \TeX's primitive +\csa{meaning}, which adds a space after each control sequence name. These spaces +are not in the actual braced items of the produced lists. The first items |\a| +and |\if| were either preceded by a space or braced to prevent expansion. The +macro \csa{xintCSVtoListNoExpand} would have done the same job without the +initial expansion of the list argument, hence no need for such protection but if +|\y| is defined as |\def\y{\a,\b,\c,\d,\e}| we then must do: +% +\leftedline{|\expandafter\xintCSVtoListNoExpand\expandafter {\y}|} Else, we +may have direct use: % +% +\leftedline{|\xintCSVtoListNoExpand + {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}|} +% +\leftedline{|->|\dtt{\expandafter\detokenize\expandafter + {\romannumeral0\xintcsvtolistnoexpand + {\if,\ifnum,\ifx,\ifdim,\ifcat,\ifmmode}}}} +% +Again these spaces are an artefact from the use in the source of the document of +\csa{meaning} (or rather here, \csa{detokenize}) to display the result of using +\csa{xintCSVtoListNoExpand} (which is done for real in this document +source). + +For the similar conversion from comma separated list to braced items list, but +without removal of spaces around the commas, there is +\csa{xintCSVtoListNonStripped}\etype{f} and +\csa{xintCSVtoListNonStrippedNoExpand}\etype{n}. + +\endgroup + +\subsection{\csbh{xintNthElt}}\label{xintNthElt} + + +\def\macro #1{\the\numexpr 9-#1\relax} + +\csa{xintNthElt\x}\marg{list}\etype{\numx f} gets (expandably) the |x|th +item of the \meta{list}. A braced item will lose one level of brace +pairs. The token list is first \fexpan ded. + +Items are counted starting at one. + +\leftedline{|\xintNthElt {3}{{agh}\u{zzz}\v{Z}}| is + \texttt{\xintNthElt {3}{{agh}\u{zzz}\v{Z}}}} +% +\leftedline{|\xintNthElt {3}{{agh}\u{{zzz}}\v{Z}}| is + \texttt{\expandafter\expandafter\expandafter + \detokenize\expandafter\expandafter\expandafter {\xintNthElt + {3}{{agh}\u{{zzz}}\v{Z}}}}} +% +\leftedline{|\xintNthElt {2}{{agh}\u{{zzz}}\v{Z}}| is + \texttt{\expandafter\expandafter\expandafter + \detokenize\expandafter\expandafter\expandafter {\xintNthElt + {2}{{agh}\u{{zzz}}\v{Z}}}}} +% +\leftedline{|\xintNthElt {37}{\xintiiFac {100}}|\dtt{=\xintNthElt + {37}{\xintiiFac {100}}} is the thirty-seventh digit of $100!$.} +% +\leftedline{|\xintNthElt {10}{\xintFtoCv + {566827/208524}}|\dtt{=\xintNthElt {10}{\xintFtoCv + {566827/208524}}}} +\leftedline{is the tenth convergent of $566827/208524$ (uses \xintcfracname + package).} +% +\leftedline{|\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% + \dtt{=\xintNthElt {7}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} +% +\leftedline{|\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% + \dtt{=\xintNthElt {0}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} +% +\leftedline{|\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}|% + \dtt{=\xintNthElt {-3}{\xintCSVtoList {1,2,3,4,5,6,7,8,9}}}} + +If |x=0|, +the macro returns the \emph{length} of the expanded list: this is not equivalent +to \csbxint{Length} which does no pre-expansion. And it is different from +\csbxint{Len} which is to be used only on integers or fractions. + +If |x<0|, the macro returns the \verb+|x|+th element from the end of the list. +Thus for example |x=-1| will fetch the last item of the list. +% +\leftedline {|\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}| is + \texttt{\expandafter\expandafter\expandafter \detokenize + \expandafter\expandafter\expandafter{\xintNthElt {-5}{{{agh}}\u{zzz}\v{Z}}}}} + +The macro \csa{xintNthEltNoExpand}\etype{\numx n} does the same job but without +first expanding the list argument: |\xintNthEltNoExpand {-4}{\u\v\w T\x\y\z}| is +\xintNthEltNoExpand {-4}{\a\b\c\u\v\w T\x\y\z}. + +If |x| is strictly larger (in absolute value) than the length of the list +then |\xintNthElt| produces empty contents. + +\subsection{\csbh{xintKeep}}\label{xintKeep} + +\csa{xintKeep\x}\marg{list}\etype{\numx f} expands the token list argument |L| +and produces a new list, depending on the value of |x|: +\begin{itemize}[nosep] +\item if |x>0|, the new list contains the first |x| items from |L| (counting + starts at one.) \emph{Each + such item will be output within a brace pair.} Use \csbxint{KeepUnbraced} is + this is not desired. This means that if the list item was braced to start + with, there is no modification, but if it was a token without braces, + then it acquires them. +\item if |x>=length(L)|, the new list is the old one with all its items now + braced. +\item if |x=0| the empty list is returned. +\item if |x<0| the last \verb+|x|+ elements compose the output in the same + order as in the initial list; as the macro proceeds by removing head items + the kept items end up in output as they were in input: no added braces. +\item if |x<=-length(L)| the output is identical with the input. +\end{itemize} + +\csa{xintKeepNoExpand} does the same without first \fexpan ding its list +argument. +% +\begin{everbatim*} +\fdef\test {\xintKeep {17}{\xintKeep {-69}{\xintSeq {1}{100}}}}\meaning\test\par +\noindent\fdef\test {\xintKeep {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintKeep {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintKeep {7}{123456789}}\meaning\test\par +\noindent\fdef\test {\xintKeep {-7}{123456789}}\meaning\test\par +\end{everbatim*} + + +\subsection{\csbh{xintKeepUnbraced}}\label{xintKeepUnbraced} + +Same as \csbxint{Keep} but no brace pairs are added around the kept items from +the head of the list in the case |x>0|: each such item will lose one level of +braces. Thus, to remove braces from all items of the list, one can use +\csbxint{KeepUnbraced} with its first argument larger than the length of the +list; the same is obtained from \csbxint{ListWithSep}|{}|\marg{list}. But the +new list will then have generally many more items than the original ones, +corresponding to the unbraced original items. + +For |x<0| the macro is no different from \csbxint{Keep}. Hence the name is a +bit misleading because brace removal will happen only if |x>0|. + +\csa{xintKeepUnbracedNoExpand} does the same without first \fexpan ding +its list argument. +% +\begin{everbatim*} +\fdef\test {\xintKeepUnbraced {10}{\xintSeq {1}{100}}}\meaning\test\par +\noindent\fdef\test {\xintKeepUnbraced {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintKeepUnbraced {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintKeepUnbraced {7}{123456789}}\meaning\test\par +\noindent\fdef\test {\xintKeepUnbraced {-7}{123456789}}\meaning\test\par +\end{everbatim*} + +\subsection{\csbh{xintTrim}}\label{xintTrim} + +\csa{xintTrim\x}\marg{list}\etype{\numx f} expands the list argument and +gobbles its first |x| elements. +\begin{itemize}[nosep] +\item if |x>0|, the first |x| items from |L| are gobbled. The remaining items + are not modified. +\item if |x>=length(L)|, the returned list is empty. +\item if |x=0| the original list is returned (with no added braces.) +\item if |x<0| the last \verb+|x|+ items of the list are removed. \emph{The + head items end up braced in the output.} Use \csbxint{TrimUnbraced} if + this is not desired. +\item if |x<=-length(L)| the output is empty. +\end{itemize} + +\csa{xintTrimNoExpand} does the same without first \fexpan ding its list +argument. +\begin{everbatim*} +\fdef\test {\xintTrim {17}{\xintTrim {-69}{\xintSeq {1}{100}}}}\meaning\test\par +\noindent\fdef\test {\xintTrim {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintTrim {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintTrim {7}{123456789}}\meaning\test\par +\noindent\fdef\test {\xintTrim {-7}{123456789}}\meaning\test\par +\end{everbatim*} + +\subsection{\csbh{xintTrimUnbraced}}\label{xintTrimUnbraced} + +Same as \csbxint{Trim} but in case of a negative |x| (cutting items from +the tail), the kept items from the head are not enclosed in brace pairs. They +will lose one level of braces. The name is a bit misleading +because when |x>0| there is no brace-stripping done on the kept items, because +the macro works simply by gobbling the head ones. + +\csa{xintTrimUnbracedNoExpand} does the same without first \fexpan ding its list +argument. + +\begin{everbatim*} +\fdef\test {\xintTrimUnbraced {-90}{\xintSeq {1}{100}}}\meaning\test\par +\noindent\fdef\test {\xintTrimUnbraced {7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintTrimUnbraced {-7}{{1}{2}{3}{4}{5}{6}{7}{8}{9}}}\meaning\test\par +\noindent\fdef\test {\xintTrimUnbraced {7}{123456789}}\meaning\test\par +\noindent\fdef\test {\xintTrimUnbraced {-7}{123456789}}\meaning\test\par +\end{everbatim*} + +\subsection{\csbh{xintListWithSep}}\label{xintListWithSep} + + +\def\macro #1{\the\numexpr 9-#1\relax} + +\csa{xintListWithSep}|{sep}|\marg{list}\etype{nf} inserts the separator |sep| +in-between all items of the given list. The items will be unbraced. The +separator may be a macro but will not be pre-expanded. The list argument is +\fexpan ded. +\begin{everbatim*} +\edef\foo {\xintListWithSep{,}{{1}{2}{3}}}\meaning\foo\newline +\edef\foo {\xintListWithSep{:}{\xintiiFac{20}}}\meaning\foo\par +\end{everbatim*} +An empty input gives an empty output, a singleton gives a singleton, and the +separator is used starting with at least two elements. Using an empty +separator has the net effect of unbracing the braced items constituting the +\meta{list} (then the new list will generally have many more ``items'' than +the original one). +% + +The macro \csa{xintListWithSepNoExpand}\etype{nn} does the same +job without the initial expansion. + +\subsection{\csbh{xintApply}}\label{xintApply} + + +\def\macro #1{\the\numexpr 9-#1\relax} + +\csa{xintApply}|{\macro}|\marg{list}\etype{ff} expandably applies the one +parameter macro |\macro| to each item in the \meta{list} given as second +argument and returns a new list with these outputs: each item is given one after +the other as parameter to |\macro| which is expanded at that time (as usual, +\emph{i.e.} fully for what comes first), the results are braced and output +together as a succession of braced items (if |\macro| is defined to start with a +space, the space will be gobbled and the |\macro| will not be expanded; it is +allowed to have its own arguments, the list items serve as last arguments to +|\macro|). Hence |\xintApply{\macro}{{1}{2}{3}}| returns +|{\macro{1}}{\macro{2}}{\macro{3}}| where all instances of |\macro| have been +already \fexpan ded. + +Being expandable, |\xintApply| is useful for example inside alignments where +implicit groups make standard loops constructs usually fail. In such situation +it is often not wished that the new list elements be braced, see +\csbxint{ApplyUnbraced}. The |\macro| does not have to be expandable: +|\xintApply| will try to expand it, the expansion may remain partial. + +The \meta{list} may +itself be some macro expanding (in the previously described way) to the list of +tokens to which the macro |\macro| will be applied. For example, if the +\meta{list} expands to some positive number, then each digit will be replaced by +the result of applying |\macro| on it. % +% +\leftedline{|\def\macro #1{\the\numexpr + 9-#1\relax}|} % +% +\leftedline{|\xintApply\macro{\xintiiFac + {20}}|\dtt{=\xintApply\macro{\xintiiFac {20}}}} + +The macro \csa{xintApplyNoExpand}\etype{fn} does the same job without the first +initial expansion which gave the \meta{list} of braced tokens to which |\macro| +is applied. + +\subsection{\csbh{xintApplyUnbraced}}\label{xintApplyUnbraced} + + +\csa{xintApplyUnbraced}|{\macro}|\marg{list}\etype{ff} is like \csbxint{Apply}. +The difference is that after having expanded its list argument, and applied +|\macro| in turn to each item from the list, it reassembles the outputs without +enclosing them in braces. The net effect is the same as doing +% +\leftedline{|\xintListWithSep {}{\xintApply {\macro}|\marg{list}|}|} This is +useful for preparing a macro which will itself define some other macros or make +assignments, as the scope will not be limited by brace pairs. +% +\begin{everbatim*} +\def\macro #1{\expandafter\def\csname myself#1\endcsname {#1}} +\xintApplyUnbraced\macro{{elta}{eltb}{eltc}} +\begin{enumerate}[nosep,label=(\arabic{*})] +\item \meaning\myselfelta +\item \meaning\myselfeltb +\item \meaning\myselfeltc +\end{enumerate} +\end{everbatim*} + +% +The macro \csa{xintApplyUnbracedNoExpand}\etype{fn} does the same job without +the first initial expansion which gave the \meta{list} of braced tokens to which +|\macro| is applied. + +\subsection{\csbh{xintSeq}}\label{xintSeq} + +\csa{xintSeq}|[d]{x}{y}|\etype{{{\upshape[\numx]}}\numx\numx} generates +expandably |{x}{x+d}...| up to and possibly including |{y}| if |d>0| or down +to and including |{y}| if |d<0|. Naturally |{y}| is omitted if |y-x| is not a +multiple of |d|. If |d=0| the macro returns |{x}|. If |y-x| and |d| have +opposite signs, the macro returns nothing. If the optional argument |d| is +omitted it is taken to be the sign of |y-x|. Hence |\xintSeq {1}{0}| is not +empty but |{1}{0}|. But |\xintSeq [1]{1}{0}| is empty. + + +The arguments |x| and |y| are expanded inside a |\numexpr| so they may be +count registers or a \LaTeX{} |\value{countername}|, or arithmetic with such +things. + +% +\begin{everbatim*} +\xintListWithSep{,\hskip2pt plus 1pt minus 1pt }{\xintSeq {12}{-25}} +\end{everbatim*} +% +\begin{everbatim*} +\xintiiSum{\xintSeq [3]{1}{1000}} +\end{everbatim*} + +When the macro is used without the optional argument |d|, it can only generate +up to about $5000$ numbers\IMPORTANT, the precise value depends upon some +\TeX{} memory parameter (input save stack). + +With the optional argument |d| the macro proceeds differently (but less +efficiently) and does not stress the input save stack. + + + +\subsection{\csbh{xintloop}, \csbh{xintbreakloop}, \csbh{xintbreakloopanddo}, \csbh{xintloopskiptonext}} +\label{xintloop} +\label{xintbreakloop} +\label{xintbreakloopanddo} +\label{xintloopskiptonext} + +|\xintloop|\meta{stuff}|\if<test>...\repeat|\retype{} is an expandable loop +compatible with nesting. However to break out of the loop one almost always need +some un-expandable step. The cousin \csbxint{iloop} is \csbxint{loop} with an +embedded expandable mechanism allowing to exit from the loop. The iterated +macros may contain |\par| tokens or empty lines. + +If a sub-loop is to be used all the material from the start of the main loop and +up to the end of the entire subloop should be braced; these braces will be +removed and do not create a group. The simplest to allow the nesting of one or +more sub-loops is to brace everything between \csa{xintloop} and \csa{repeat}, +being careful not to leave a space between the closing brace and |\repeat|. + +As this loop and \csbxint{iloop} will primarily be of interest to experienced +\TeX{} macro programmers, my description will assume that the user is +knowledgeable enough. Some examples in this document will be perhaps more +illustrative than my attemps at explanation of use. + +One can abort the loop with \csbxint{breakloop}; this should not be used inside +the final test, and one should expand the |\fi| from the corresponding test +before. One has also \csbxint{breakloopanddo} whose first argument will be +inserted in the token stream after the loop; one may need a macro such as +|\xint_afterfi| to move the whole thing after the |\fi|, as a simple +|\expandafter| will not be enough. + +One will usually employ some count registers to manage the exit test from the +loop; this breaks expandability, see \csbxint{iloop} for an expandable integer +indexed loop. Use in alignments will be complicated by the fact that cells +create groups, and also from the fact that any encountered unexpandable material +will cause the \TeX{} input scanner to insert |\endtemplate| on each encountered +|&| or |\cr|; thus |\xintbreakloop| may not work as expected, but the situation +can be resolved via |\xint_firstofone{&}| or use of |\TAB| with |\def\TAB{&}|. +It is thus simpler for alignments to use rather than \csbxint{loop} either the +expandable \csbxint{ApplyUnbraced} or the non-expandable but alignment +compatible \csbxint{ApplyInline}, \csbxint{For} or \csbxint{For*}. + +As an example, let us suppose we have two macros |\A|\marg{i}\marg{j} and +|\B|\marg{i}\marg{j} behaving like (small) integer valued matrix entries, and we +want to define a macro |\C|\marg{i}\marg{j} giving the matrix product (|i| and +|j| may be count registers). We will assume that |\A[I]| expands to the number +of rows, |\A[J]| to the number of columns and want the produced |\C| to act in +the same manner. The code is very dispendious in use of |\count| registers, not +optimized in any way, not made very robust (the defined macro can not have the +same name as the first two matrices for example), we just wanted to quickly +illustrate use of the nesting capabilities of |\xintloop|.% +% +\footnote{for a more sophisticated implementation of matrix + multiplication, inclusive of determinants, inverses, and display + utilities, with entries big integers or decimal numbers or even + fractions see \url{http://tex.stackexchange.com/a/143035/4686} from + November 11, 2013.} +% + + +\begin{everbatim*} +\newcount\rowmax \newcount\colmax \newcount\summax +\newcount\rowindex \newcount\colindex \newcount\sumindex +\newcount\tmpcount +\makeatletter +\def\MatrixMultiplication #1#2#3{% + \rowmax #1[I]\relax + \colmax #2[J]\relax + \summax #1[J]\relax + \rowindex 1 + \xintloop % loop over row index i + {\colindex 1 + \xintloop % loop over col index k + {\tmpcount 0 + \sumindex 1 + \xintloop % loop over intermediate index j + \advance\tmpcount \numexpr #1\rowindex\sumindex*#2\sumindex\colindex\relax + \ifnum\sumindex<\summax + \advance\sumindex 1 + \repeat }% + \expandafter\edef\csname\string#3{\the\rowindex.\the\colindex}\endcsname + {\the\tmpcount}% + \ifnum\colindex<\colmax + \advance\colindex 1 + \repeat }% + \ifnum\rowindex<\rowmax + \advance\rowindex 1 + \repeat + \expandafter\edef\csname\string#3{I}\endcsname{\the\rowmax}% + \expandafter\edef\csname\string#3{J}\endcsname{\the\colmax}% + \def #3##1{\ifx[##1\expandafter\Matrix@helper@size + \else\expandafter\Matrix@helper@entry\fi #3{##1}}% +}% +\def\Matrix@helper@size #1#2#3]{\csname\string#1{#3}\endcsname }% +\def\Matrix@helper@entry #1#2#3% + {\csname\string#1{\the\numexpr#2.\the\numexpr#3}\endcsname }% +\def\A #1{\ifx[#1\expandafter\A@size + \else\expandafter\A@entry\fi {#1}}% +\def\A@size #1#2]{\ifx I#23\else4\fi}% 3rows, 4columns +\def\A@entry #1#2{\the\numexpr #1+#2-1\relax}% not pre-computed... +\def\B #1{\ifx[#1\expandafter\B@size + \else\expandafter\B@entry\fi {#1}}% +\def\B@size #1#2]{\ifx I#24\else3\fi}% 4rows, 3columns +\def\B@entry #1#2{\the\numexpr #1-#2\relax}% not pre-computed... +\makeatother +\MatrixMultiplication\A\B\C \MatrixMultiplication\C\C\D +\MatrixMultiplication\C\D\E \MatrixMultiplication\C\E\F +\begin{multicols}2 + \[\begin{pmatrix} + \A11&\A12&\A13&\A14\\ + \A21&\A22&\A23&\A24\\ + \A31&\A32&\A33&\A34 + \end{pmatrix} + \times + \begin{pmatrix} + \B11&\B12&\B13\\ + \B21&\B22&\B23\\ + \B31&\B32&\B33\\ + \B41&\B42&\B43 + \end{pmatrix} + = + \begin{pmatrix} + \C11&\C12&\C13\\ + \C21&\C22&\C23\\ + \C31&\C32&\C33 + \end{pmatrix}\] + \[\begin{pmatrix} + \C11&\C12&\C13\\ + \C21&\C22&\C23\\ + \C31&\C32&\C33 + \end{pmatrix}^2 = \begin{pmatrix} + \D11&\D12&\D13\\ + \D21&\D22&\D23\\ + \D31&\D32&\D33 + \end{pmatrix}\] + \[\begin{pmatrix} + \C11&\C12&\C13\\ + \C21&\C22&\C23\\ + \C31&\C32&\C33 + \end{pmatrix}^3 = \begin{pmatrix} + \E11&\E12&\E13\\ + \E21&\E22&\E23\\ + \E31&\E32&\E33 + \end{pmatrix}\] + \[\begin{pmatrix} + \C11&\C12&\C13\\ + \C21&\C22&\C23\\ + \C31&\C32&\C33 + \end{pmatrix}^4 = \begin{pmatrix} + \F11&\F12&\F13\\ + \F21&\F22&\F23\\ + \F31&\F32&\F33 + \end{pmatrix}\] +\end{multicols} +\end{everbatim*} + + +\subsection{\csbh{xintiloop}, \csbh{xintiloopindex}, \csbh{xintouteriloopindex}, + \csbh{xintbreakiloop}, \csbh{xintbreakiloopanddo}, \csbh{xintiloopskiptonext}, +\csbh{xintiloopskipandredo}} +\label{xintiloop} +\label{xintbreakiloop} +\label{xintbreakiloopanddo} +\label{xintiloopskiptonext} +\label{xintiloopskipandredo} +\label{xintiloopindex} +\label{xintouteriloopindex} + +\csa{xintiloop}|[start+delta]|\meta{stuff}|\if<test> ... \repeat|\retype{} is a +completely expandable nestable loop. complete expandability depends naturally on +the actual iterated contents, and complete expansion will not be achievable +under a sole \fexpan sion, as is indicated by the hollow star in the margin; +thus the loop can be used inside an |\edef| but not inside arguments to the +package macros. It can be used inside an |\xintexpr..\relax|. The +|[start+delta]| is mandatory, not optional. + +This loop benefits via \csbxint{iloopindex} to (a limited access to) the integer +index of the iteration. The starting value |start| (which may be a |\count|) and +increment |delta| (\emph{id.}) are mandatory arguments. A space after the +closing square bracket is not significant, it will be ignored. Spaces inside the +square brackets will also be ignored as the two arguments are first given to a +|\numexpr...\relax|. Empty lines and explicit |\par| tokens are accepted. + +As with \csbxint{loop}, this tool will mostly be of interest to advanced users. +For nesting, one puts inside braces all the +material from the start (immediately after |[start+delta]|) and up to and +inclusive of the inner loop, these braces will be removed and do not create a +loop. In case of nesting, \csbxint{outeriloopindex} gives access to the index of +the outer loop. If needed one could write on its model a macro giving access to +the index of the outer outer loop (or even to the |nth| outer loop). + +The \csa{xintiloopindex} and \csa{xintouteriloopindex} can not be used inside +braces, and generally speaking this means they should be expanded first when +given as argument to a macro, and that this macro receives them as delimited +arguments, not braced ones. Or, but naturally this will break expandability, one +can assign the value of \csa{xintiloopindex} to some |\count|. Both +\csa{xintiloopindex} and \csa{xintouteriloopindex} extend to the litteral +representation of the index, thus in |\ifnum| tests, if it comes last one has to +correctly end the macro with a |\space|, or encapsulate it in a +|\numexpr..\relax|. + +When the repeat-test of the loop is, for example, |\ifnum\xintiloopindex<10 +\repeat|, this means that the last iteration will be with |\xintiloopindex=10| +(assuming |delta=1|). There is also |\ifnum\xintiloopindex=10 \else\repeat| to +get the last iteration to be the one with |\xintiloopindex=10|. + +One has \csbxint{breakiloop} and \csbxint{breakiloopanddo} to abort the loop. +The syntax of |\xintbreakiloopanddo| is a bit surprising, the sequence of tokens +to be executed after breaking the loop is not within braces but is delimited by +a dot as in: +% +\leftedline{|\xintbreakiloopanddo <afterloop>.etc.. etc... \repeat|} +% +The reason is that one may wish to use the then current value of +|\xintiloopindex| in |<afterloop>| but it can't be within braces at the time it +is evaluated. However, it is not that easy as |\xintiloopindex| must be expanded +before, so one ends up with code like this: +% +\leftedline +{|\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.%|} +% +\leftedline{|etc.. etc.. \repeat|} +% +As moreover the |\fi| from the test leading to the decision of breaking out of +the loop must be cleared out of the way, the above should be +a branch of an expandable conditional test, else one needs something such +as: +% +\leftedline +{|\xint_afterfi{\expandafter\xintbreakiloopanddo\expandafter\macro\xintiloopindex.}%|} +% +\leftedline{|\fi etc..etc.. \repeat|} + +There is \csbxint{iloopskiptonext} to abort the current iteration and skip to +the next, \hyperref[xintiloopskipandredo]{\ttfamily\hyphenchar\font45 \char92 + xintiloopskip\-and\-redo} to skip to the end of the current iteration and redo +it with the same value of the index (something else will have to change for this +not to become an eternal loop\dots ). + +Inside alignments, if the looped-over text contains a |&| or a |\cr|, any +un-expandable material before a \csbxint{iloopindex} will make it fail because +of |\endtemplate|; in such cases one can always either replace |&| by a macro +expanding to it or replace it by a suitable |\firstofone{&}|, and similarly for +|\cr|. + +\phantomsection\label{edefprimes} +As an example, let us construct an |\edef\z{...}| which will define |\z| to be a +list of prime numbers: +\begin{everbatim*} +\begingroup +\edef\z +{\xintiloop [10001+2] + {\xintiloop [3+2] + \ifnum\xintouteriloopindex<\numexpr\xintiloopindex*\xintiloopindex\relax + \xintouteriloopindex, + \expandafter\xintbreakiloop + \fi + \ifnum\xintouteriloopindex=\numexpr + (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax + \else + \repeat + }% no space here + \ifnum \xintiloopindex < 10999 \repeat }% +\meaning\z\endgroup +\end{everbatim*}and we should have taken +some steps to not have a trailing comma, but +the point was to show that one can do that in an |\edef|\,! See also +\autoref{ssec:primesII} which extracts from this code its way of testing +primality. + +Let us create an alignment where each row will contain all divisors of its +first entry. +Here is the output, thus obtained without any count register: +\begin{everbatim*} +\begin{multicols}2 +\tabskip1ex \normalcolor +\halign{&\hfil#\hfil\cr + \xintiloop [1+1] + {\expandafter\bfseries\xintiloopindex & + \xintiloop [1+1] + \ifnum\xintouteriloopindex=\numexpr + (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax + \xintiloopindex&\fi + \ifnum\xintiloopindex<\xintouteriloopindex\space % CRUCIAL \space HERE + \repeat \cr }% + \ifnum\xintiloopindex<30 + \repeat +} +\end{multicols} +\end{everbatim*} +We wanted this first entry in bold face, but |\bfseries| leads to +unexpandable tokens, so the |\expandafter| was necessary for |\xintiloopindex| +and |\xintouteriloopindex| not to be confronted with a hard to digest +|\endtemplate|. An alternative way of coding: +% +\begin{everbatim} +\tabskip1ex +\def\firstofone #1{#1}% +\halign{&\hfil#\hfil\cr + \xintiloop [1+1] + {\bfseries\xintiloopindex\firstofone{&}% + \xintiloop [1+1] \ifnum\xintouteriloopindex=\numexpr + (\xintouteriloopindex/\xintiloopindex)*\xintiloopindex\relax + \xintiloopindex\firstofone{&}\fi + \ifnum\xintiloopindex<\xintouteriloopindex\space % \space is CRUCIAL + \repeat \firstofone{\cr}}% + \ifnum\xintiloopindex<30 \repeat } +\end{everbatim} + +\begin{framed} + The next utilities are not compatible with expansion-only context. +\end{framed} + +\subsection{\csbh{xintApplyInline}}\label{xintApplyInline} + + +\csa{xintApplyInline}|{\macro}|\marg{list}\ntype{o{\lowast f}} works non +expandably. It applies the one-parameter |\macro| to the first element of the +expanded list (|\macro| may have itself some arguments, the list item will be +appended as last argument), and is then re-inserted in the input stream after +the tokens resulting from this first expansion of |\macro|. The next item is +then handled. + +This is to be used in situations where one needs to do some repetitive +things. It is not expandable and can not be completely expanded inside a +macro definition, to prepare material for later execution, contrarily to what +\csbxint{Apply} or \csbxint{ApplyUnbraced} achieve. + +\begin{everbatim*} +\def\Macro #1{\advance\cnta #1 , \the\cnta} +\cnta 0 +0\xintApplyInline\Macro {3141592653}. +\end{everbatim*} +The first argument |\macro| does not have to be an expandable macro. + +\csa{xintApplyInline} submits its second, token list parameter to an +\hyperref[ssec:expansions]{\fexpan +sion}. Then, each \emph{unbraced} item will also be \fexpan ded. This provides +an easy way to insert one list inside another. \emph{Braced} items are not +expanded. Spaces in-between items are gobbled (as well as those at the start +or the end of the list), but not the spaces \emph{inside} the braced items. + +\csa{xintApplyInline}, despite being non-expandable, does survive to +contexts where the executed |\macro| closes groups, as happens inside +alignments with the tabulation character |&|. +This tabular provides an example:\par +\begin{everbatim*} +\centerline{\normalcolor\begin{tabular}{ccc} + $N$ & $N^2$ & $N^3$ \\ \hline + \def\Row #1{ #1 & \xintiiSqr {#1} & \xintiiPow {#1}{3} \\ \hline }% + \xintApplyInline \Row {\xintCSVtoList{17,28,39,50,61}} +\end{tabular}}\medskip +\end{everbatim*} + +We see that despite the fact that the first encountered tabulation character in +the first row close a group and thus erases |\Row| from \TeX's memory, +|\xintApplyInline| knows how to deal with this. + +Using \csbxint{ApplyUnbraced} is an alternative: the difference is that +this would have prepared all rows first and only put them back into the +token stream once they are all assembled, whereas with |\xintApplyInline| +each row is constructed and immediately fed back into the token stream: when +one does things with numbers having hundreds of digits, one learns that +keeping on hold and shuffling around hundreds of tokens has an impact on +\TeX{}'s speed (make this ``thousands of tokens'' for the impact to be +noticeable). + +One may nest various |\xintApplyInline|'s. For example (see the +\hyperref[float]{table} \vpageref{float}):\par +\begin{everbatim*} +\begin{figure*}[ht!] + \centering\phantomsection\label{float} + \def\Row #1{#1:\xintApplyInline {\Item {#1}}{0123456789}\\ }% + \def\Item #1#2{&\xintiiPow {#1}{#2}}% + \centeredline {\begin{tabular}{ccccccccccc} &0&1&2&3&4&5&6&7&8&9\\ \hline + \xintApplyInline \Row {0123456789} + \end{tabular}} +\end{figure*} +\end{everbatim*} + +One could not move the definition of |\Item| inside the tabular, +as it would get lost after the first |&|. But this +works: +\everb|@ +\begin{tabular}{ccccccccccc} + &0&1&2&3&4&5&6&7&8&9\\ \hline + \def\Row #1{#1:\xintApplyInline {&\xintiiPow {#1}}{0123456789}\\ }% + \xintApplyInline \Row {0123456789} +\end{tabular} +| + +A limitation is that, contrarily to what one may have expected, the +|\macro| for an |\xintApplyInline| can not be used to define +the |\macro| for a nested sub-|\xintApplyInline|. For example, +this does not work:\par +\everb|@ + \def\Row #1{#1:\def\Item ##1{&\xintiiPow {#1}{##1}}% + \xintApplyInline \Item {0123456789}\\ }% + \xintApplyInline \Row {0123456789} % does not work +| +\noindent But see \csbxint{For}. + +\subsection{\csbh{xintFor}, \csbh{xintFor*}}\label{xintFor}\label{xintFor*} + +\csbxint{For}\ntype{on} is a new kind of for loop.\footnote{first introduced + with \xintname |1.09c| of |2013/10/09|.} Rather than using macros +for encapsulating list items, its behavior is like a macro with parameters: +|#1|, |#2|, \dots, |#9| are used to represent the items for up to nine levels of +nested loops. Here is an example: +% +\everb|@ +\xintFor #9 in {1,2,3} \do {% + \xintFor #1 in {4,5,6} \do {% + \xintFor #3 in {7,8,9} \do {% + \xintFor #2 in {10,11,12} \do {% + $$#9\times#1\times#3\times#2=\xintiiPrd{{#1}{#2}{#3}{#9}}$$}}}} +| +\noindent This example illustrates that one does not have to use |#1| as the +first one: +the order is arbitrary. But each level of nesting should have its specific macro +parameter. Nine levels of nesting is presumably overkill, but I did not know +where it was reasonable to stop. |\par| tokens are accepted in both the comma +separated list and the replacement text. + +\begin{framed} + \TeX nical notes: + +\begin{itemize} + \item The |#1| is replaced in the iterated-over text exactly as in general + \TeX\ macros or \LaTeX\ commands. This spares the user quite a few + |\expandafter|'s or other tricks needed with loops which have the + values encapsulated in macros, like \LaTeX's |\@for| and |\@tfor|. + + \item \csa{xintFor} (and \csa{xintFor*}) isn't purely expandable: one can + not use it inside an |\edef|. But it may be used, as will be shown in + examples, in some contexts such as \LaTeX's |tabular| which are usually + hostile to non-expandable loops. + + \item \csa{xintFor} (and \csa{xintFor*}) does some assignments prior to + executing each iteration of the replacement text, but it acts purely + expandably after the last iteration, hence if for example the replacement + text ends with a |\\|, the loop can be used insided a tabular and be + followed by a |\hline| without creating the dreaded ``|Misplaced + \noalign|'' error. + + \item It does not create groups. + + \item It makes no global assignments. + + \item The iterated replacement text may close a group which was opened even + before the start of the loop (typical example being with |&| in + alignments). +\begin{everbatim*} +\begin{tabular}{rccccc} + \hline + \xintFor #1 in {A, B, C} \do {% + #1:\xintFor #2 in {a, b, c, d, e} \do {&($ #2 \to #1 $)}\\ }% + \hline +\end{tabular} +\end{everbatim*} + + \item There is no facility provided which would give access to a count of + the number of iterations as it is technically not easy to do so it in a + way working with nested loops while maintaining the ``expandable after + done'' property; something in the spirit of \csbxint{iloopindex} is + possible but this approach would bring its own limitations and + complications. Hence the user is invited to update her own count or + \LaTeX{} counter or macro at each iteration, if needed. + + \item A |\macro| whose definition uses internally an \csbxint{For} loop + may be used inside another \csbxint{For} loop even if the two loops both + use the same macro parameter. The loop definition inside |\macro| + must use |##| as is the general rule for definitions done inside macros. + + \item \csbxint{For} is for comma separated values and \csbxint{For*} for + lists of braced items; their respective expansion policies differ. They + are described later. +\end{itemize} +\unskip +\end{framed} + +\noindent Regarding \csbxint{For}: +\begin{itemize}[nosep, listparindent=\leftmarginiii] +\item the spaces between the various declarative elements are all optional, +\item in the list of comma separated values, spaces around the commas or at + the start and end are ignored, +\item if an item must contain itself its own commas, then it should + be braced, and the braces will be removed before feeding the iterated-over + text, +\item the list may be a macro, it is expanded only once, +\item items are not pre-expanded. The first item should be braced or start + with a space if the list is explicit and the item should not be + pre-expanded, +\item empty items give empty |#1|'s in the replacement text, they are not + skipped, +\item an empty list executes once the replacement text with an empty parameter + value, +\item the list, if not a macro, \fbox{must be braced.} +\end{itemize} + +\noindent Regarding \csbxint{For*}:\ntype{{\lowast f}n} +\begin{itemize}[nosep, listparindent=\leftmarginiii] +\item it handles lists of braced items (or naked tokens), +\item it \hyperref[ssec:expansions]{\fexpan ds} the list, +\item and more generally it \hyperref[ssec:expansions]{\fexpan ds} each naked + token encountered + before assigning the |#1| values (gobbling spaces in the process); + this + makes it easy to simulate concatenation of multiple lists|\x|, |\y|: + if |\x| expands to |{1}{2}{3}| and |\y| expands to |{4}{5}{6}| then |{\x\y}| + as argument to |\xintFor*| has the same effect as |{{1}{2}{3}{4}{5}{6}}|. + + For a further illustration see the use of |\xintFor*| at the end of + \autoref{ssec:fibonacci}. +\item spaces at the start, end, or in-between items are gobbled (but naturally + not the spaces inside \emph{braced} items), +\item except if the list argument is a macro (with no parameters), \fbox{it + must be braced.}, +\item an empty list leads to an empty result. +\end{itemize} + +The macro \csbxint{Seq} which generates arithmetic sequences is to be used +with \csbxint{For*} as its output consists of successive braced numbers (given +as digit tokens). +\begin{everbatim*} +\xintFor* #1 in {\xintSeq [+2]{-7}{+2}}\do {stuff + with #1\xintifForLast{\par}{\newline}} +\end{everbatim*} + + +When nesting \csa{xintFor*} loops, using \csa{xintSeq} in the inner loops is +inefficient, as the arithmetic sequence will be re-created each time. A more +efficient style is: +% +\begin{everbatim} + \edef\innersequence {\xintSeq[+2]{-50}{50}}% + \xintFor* #1 in {\xintSeq {13}{27}} \do + {\xintFor* #2 in \innersequence \do {stuff with #1 and #2}% + .. some other macros .. } +\end{everbatim} + +This is a general remark applying for any nesting of loops, one should avoid +recreating the inner lists of arguments at each iteration of the outer loop. + + +When the loop is defined inside a macro for later execution the |#| characters +must be doubled.% +% +\footnote{sometimes what seems to be a macro argument isn't really; in + \csa{raisebox\{1cm\}\{}\csa{xintFor \#1 in \{a,b,c\} }\csa{do + \{\#1\}\}} no doubling should be done.} +% +For example: +% +\begin{everbatim*} +\def\T{\def\z {}% + \xintFor* ##1 in {{u}{v}{w}} \do {% + \xintFor ##2 in {x,y,z} \do {% + \expandafter\def\expandafter\z\expandafter {\z\sep (##1,##2)} }% + }% +}% +\T\def\sep {\def\sep{, }}\z +\end{everbatim*} + +Similarly when the replacement text +of |\xintFor| defines a macro with parameters, the macro character |#| must be +doubled. + + +The iterated macros as well as the list items are allowed to contain explicit +|\par| tokens. + + +\subsection{\csbh{xintifForFirst}, \csbh{xintifForLast}} +\label{xintifForFirst}\label{xintifForLast} + +\csbxint{ifForFirst}\,\texttt{\{YES branch\}\{NO branch\}}\etype{nn} + and \csbxint{ifForLast}\,\texttt{\{YES + branch\}\hskip 0pt plus 0.2em \{NO branch\}}\etype{nn} execute the |YES| or +|NO| branch +if the +\csbxint{For} +or \csbxint{For*} loop is currently in its first, respectively last, iteration. + +Designed to work as expected under nesting (but see frame next.) Don't forget +an empty brace pair |{}| if a branch is to do nothing. May be used multiple +times in the replacement text of the loop. + +\begin{framed} + \noindent Pay attention to these implementation features: + \begin{itemize}[nosep, listparindent=\leftmarginiii] + \item \emph{if an inner \csbxint{For} loop is positioned before the + \csb{xintifForFirst} or \csb{xintifForLast} of the outer loop it will + contaminate their settings. This applies also naturally if the inner loop + arises from the expansion of some macro located before the outer + conditionals.} + + One fix is to make sure that the outer conditionals are expanded before the + inner loop is executed, e.g. this will be the case if the inner loop is + located inside one of the branches of the conditional. + + Another approach is to enclose, if feasible, the inner loop in a group of + its own. + \item \emph{if the replacement text closes a group (e.g. from a |&| inside an + alignment), the conditionals will lose their ascribed meanings and end up + possibly undefined, depending whether there is some outer loop whose + execution started before the opening of the group.} + + The fix is to arrange things so that the conditionals are expanded + before \TeX\ encounters the closing-group token. + \end{itemize} +\end{framed} + +\subsection{ \csbh{xintBreakFor}, \csbh{xintBreakForAndDo}} +\label{xintBreakFor}\label{xintBreakForAndDo} + +One may immediately terminate an \csbxint{For} or \csbxint{For*} loop with +\csbxint{BreakFor}. + +\begin{framed} + As it acts by clearing up all the rest of the replacement text when + encountered, it will not work from inside some |\if...\fi| without + suitable |\expandafter| or swapping technique. + + Also it can't be used from inside braces as from there it can't see the end + of the replacement text. +\end{framed} + +There is also \csbxint{BreakForAndDo}. Both are illustrated by various examples +in the next section which is devoted to ``forever'' loops. + +\subsection{\csbh{xintintegers}, \csbh{xintdimensions}, \csbh{xintrationals}} +\label{xintegers}\label{xintintegers} +\label{xintdimensions}\label{xintrationals} + +If the list argument to \csbxint{For} (or \csbxint{For*}, both are equivalent in +this context) is \csbxint{integers} (equivalently \csbxint{egers}) or more +generally \csbxint{integers}|[||start|\allowbreak|+|\allowbreak|delta||]| +(\emph{the whole within braces}!)% +% +\footnote{the |start+delta| optional specification may have extra spaces + around the plus sign of near the square brackets, such spaces are + removed. The same applies with \csa{xintdimensions} and + \csa{xintrationals}.}, +% +then \csbxint{For} does an infinite iteration where +|#1| (or |#2|, \dots, |#9|) will run through the arithmetic sequence of (short) +integers with initial value |start| and increment |delta| (default values: +|start=1|, |delta=1|; if the optional argument is present it must contains both +of them, and they may be explicit integers, or macros or count registers). The +|#1| (or |#2|, \dots, |#9|) will stand for |\numexpr <opt sign><digits>\relax|, +and the litteral representation as a string of digits can thus be obtained as +\fbox{\csa{the\#1}} or |\number#1|. Such a |#1| can be used in an |\ifnum| test +with no need to be postfixed with a space or a |\relax| and one should +\emph{not} add them. + +If the list argument is \csbxint{dimensions} or more generally +\csbxint{dimensions}|[||start|\allowbreak|+|\allowbreak|delta||]| (\emph{within + braces}!), then +\csbxint{For} does an infinite iteration where |#1| (or |#2|, \dots, |#9|) will +run through the arithmetic sequence of dimensions with initial value +|start| and increment |delta|. Default values: |start=0pt|, |delta=1pt|; if +the optional argument is present it must contain both of them, and they may +be explicit specifications, or macros, or dimen registers, or length macros +in \LaTeX{} (the stretch and shrink components will be discarded). The |#1| +will be |\dimexpr <opt sign><digits>sp\relax|, from which one can get the +litteral (approximate) representation in points via |\the#1|. So |#1| can be +used anywhere \TeX{} expects a dimension (and there is no need in conditionals +to insert a |\relax|, and one should \emph{not} do it), and to print its value +one uses \fbox{\csa{the\#1}}. The chosen representation guarantees exact +incrementation with no rounding errors accumulating from converting into +points at each step. + + + + + + +If the list argument to \csbxint{For} (or \csbxint{For*}) is \csbxint{rationals} +or more generally +\csbxint{rationals}|[||start|\allowbreak|+|\allowbreak|delta||]| (\emph{within + braces}!), then \csbxint{For} does an infinite iteration where |#1| (or |#2|, +\dots, |#9|) will run through the arithmetic sequence of \xintfracname fractions +with initial value |start| and increment |delta| (default values: |start=1/1|, +|delta=1/1|). This loop works \emph{only with \xintfracname loaded}. if the +optional argument is present it must contain both of them, and they may be given +in any of the formats recognized by \xintfracname (fractions, decimal +numbers, numbers in scientific notations, numerators and denominators in +scientific notation, etc...) , or as macros or count registers (if they are +short integers). The |#1| (or |#2|, \dots, |#9|) will be an |a/b| fraction +(without a |[n]| part), where +the denominator |b| is the product of the denominators of +|start| and |delta| (for reasons of speed |#1| is not reduced to irreducible +form, and for another reason explained later |start| and |delta| are not put +either into irreducible form; the input may use explicitely \csa{xintIrr} to +achieve that). +\begin{everbatim*} +\begingroup\small +\noindent\parbox{\dimexpr\linewidth-3em}{\color[named]{OrangeRed}% +\xintFor #1 in {\xintrationals [10/21+1/21]} \do +{#1=\xintifInt {#1} + {\textcolor{blue}{\xintTrunc{10}{#1}}} + {\xintTrunc{10}{#1}}% display in blue if an integer + \xintifGt {#1}{1.123}{\xintBreakFor}{, }% + }} +\endgroup\smallskip +\end{everbatim*} + +\smallskip The example above confirms that computations are done exactly, and +illustrates that the two initial (reduced) denominators are not multiplied when +they are found to be equal. It is thus recommended to input |start| and |delta| +with a common smallest possible denominator, or as fixed point numbers with the +same numbers of digits after the decimal mark; and this is also the reason why +|start| and |delta| are not by default made irreducible. As internally the +computations are done with numerators and denominators completely expanded, one +should be careful not to input numbers in scientific notation with exponents in +the hundreds, as they will get converted into as many zeroes. + +\begin{everbatim*} +\noindent\parbox{\dimexpr.7\linewidth}{\raggedright +\xintFor #1 in {\xintrationals [0.000+0.125]} \do +{\edef\tmp{\xintTrunc{3}{#1}}% + \xintifInt {#1} + {\textcolor{blue}{\tmp}} + {\tmp}% + \xintifGt {#1}{2}{\xintBreakFor}{, }% + }}\smallskip +\end{everbatim*} + +We see here that \csbxint{Trunc} outputs (deliberately) zero as $0$, not (here) +$0.000$, the idea being not to lose the information that the truncated thing was +truly zero. Perhaps this behavior should be changed? or made optional? Anyhow +printing of fixed points numbers should be dealt with via dedicated packages +such as |numprint| or |siunitx|.\par + + +\subsection{\csbh{xintForpair}, \csbh{xintForthree}, \csbh{xintForfour}}\label{xintForpair}\label{xintForthree}\label{xintForfour} + +The syntax\ntype{on} is illustrated in this +example. The notation is the usual one for |n|-uples, with parentheses and +commas. Spaces around commas and parentheses are ignored. +% +\begin{everbatim*} +{\centering\begin{tabular}{cccc} + \xintForpair #1#2 in { ( A , a ) , ( B , b ) , ( C , c ) } \do {% + \xintForpair #3#4 in { ( X , x ) , ( Y , y ) , ( Z , z ) } \do {% + $\Biggl($\begin{tabular}{cc} + -#1- & -#3-\\ + -#4- & -#2-\\ + \end{tabular}$\Biggr)$&}\\\noalign{\vskip1\jot}}% +\end{tabular}\\} +\end{everbatim*} + +\csbxint{Forpair} must be followed by either |#1#2|, |#2#3|, |#3#4|, \dots, or +|#8#9| with |#1| usable as an alias for |#1#2|, |#2| as alias for |#2#3|, +etc \dots\ and similarly for \csbxint{Forthree} (using |#1#2#3| or simply +|#1|, |#2#3#4| or simply |#2|, \dots) and \csbxint{Forfour} (with |#1#2#3#4| +etc\dots). + +Nesting works as long as the macro parameters are distinct among |#1|, |#2|, +..., |#9|. A macro which expands to an \csa{xintFor} or a +\csa{xintFor(pair,three,four)} can be used in another one with no constraint +about using distinct macro parameters. + +|\par| tokens are accepted in both the comma separated list and the +replacement text. + + +\subsection{\csbh{xintAssign}}\label{xintAssign} + +\csa{xintAssign}\meta{braced things}\csa{to}% +\meta{as many cs as they are things} %\ntype{{(f$\to$\lowast [x)}{\lowast N}} +% +defines (without checking if something gets overwritten) the control sequences +on the right of \csa{to} to expand to the successive tokens or braced items +located to the left of \csa{to}. \csa{xintAssign} is not an expandable macro. + +\fexpan sion is first applied to the material in front of \csa{xintAssign} +which is fetched as one argument if it is braced. Then the expansion of this +argument is examined and successive items are assigned to the macros following +|\to|. There must be exactly as many macros as items. No check is done. The +macro assignments are done with removal of one level of brace pairs from each +item. + +After the initial \fexpan sion, each assigned (brace-stripped) item will be +expanded according to the setting of the optional parameter. + +For example |\xintAssign [e]...| means that all assignments are done using +|\edef|. With |[f]| the assignments will be made using +\hyperref[fdef]{\ttfamily\char92fdef}. The default is simply to make the +definitions with |\def|, corresponding to an empty optional paramter |[]|. +Possibilities for the optional parameter are: |[], [g], [e], [x], [o], [go], +[oo], [goo], [f], [gf]|. For example |[oo]| means a double expansion. +\begin{everbatim*} +\xintAssign \xintiiDivision{1000000000000}{133333333}\to\Q\R +\meaning\Q\newline +\meaning\R\newline +\xintAssign {{\xintiiDivision{1000000000000}{133333333}}}\to\X +\meaning\X\newline +\xintAssign [oo]{{\xintiiDivision{1000000000000}{133333333}}}\to\X +\meaning\X\newline +\xintAssign \xintiiPow{7}{13}\to\SevenToThePowerThirteen +\meaning\SevenToThePowerThirteen\par +\end{everbatim*} + +Two special cases: +\begin{itemize}[nosep] +\item if after this initial expansion no brace is found immediately after + \csa{xintAssign}, it is assumed that there is only one control sequence + following |\to|, and this control sequence is then defined via |\def| (or + what is set-up by the optional parameter) to expand to the material between + \csa{xintAssign} and \csa{to}. +\item if the material between \csa{xintAssign} and |\to| is enclosed in two + brace pairs, the first brace pair is removed, then the \fexpan sion is + immediately stopped by the inner brace pair, hence \csa{xintAssign} now + finds a unique item and thus defines only a single macro to be this item, + which is now stripped of the second pair of braces. +\end{itemize} + + +\emph{Note:} prior to release |1.09j|, |\xintAssign| did an |\edef| by default +for each item assignment but it now does |\def| corresponding to no or empty +optional parameter. + +It is allowed for the successive braced items to be separated by spaces. They +are removed during the assignments. But if a single macro is defined (which +happens if the argument after \fexpan sion does not start with a brace), +naturally the scooped up material has all intervening spaces, as it is +considered a +single item. But an upfront initial space will have been absorbed by \fexpan +sion. +\begin{everbatim*} +\def\X{ {a} {b} {c} {d} }\def\Y { u {a} {b} {c} {d} } +\xintAssign\X\to\A\B\C\D +\xintAssign\Y\to\Z +\meaning\A, \meaning\B, \meaning\C, \meaning\D+++\newline +\meaning\Z+++\par +\end{everbatim*} +As usual successive space characters in input make for a single \TeX\ space token. + + +\subsection{\csbh{xintAssignArray}}\label{xintAssignArray} + +\xintAssignArray \xintBezout {1000}{113}\to\Bez + +\csa{xintAssignArray}\meta{braced + things}\csa{to}\csa{myArray} %\ntype{{(f$\to$\lowast x)}N} +% +first expands fully what comes immediately after |\xintAssignArray| and +expects to find a list of braced things |{A}{B}...| (or tokens). It then +defines \csa{myArray} as a macro with one parameter, such that \csa{myArray\x} +expands to give the |x|th braced thing of this original +list (the argument \texttt{\x} itself is fed to a |\numexpr| by |\myArray|, +and |\myArray| expands in two steps to its output). With |0| as parameter, +\csa{myArray}|{0}| returns the number |M| of elements of the array so that the +successive elements are \csa{myArray}|{1}|, \dots, \csa{myArray}|{M}|. +% +\leftedline{|\xintAssignArray \xintBezout {1000}{113}\to\Bez|} will set +|\Bez{0}| to \dtt{\Bez0}, |\Bez{1}| to \dtt{\Bez1}, |\Bez{2}| to +\dtt{\Bez2}, |\Bez{3}| to \dtt{\Bez3}, |\Bez{4}| to +\dtt{\Bez4}, and |\Bez{5}| to \dtt{\Bez5}: +\dtt{(\Bez3)${}\times{}$\Bez1${}-{}$(\Bez4)${}\times{}$\Bez2${}={}$\Bez5.} +This macro is incompatible with expansion-only contexts. + +\csa{xintAssignArray} admits an optional parameter, for example +|\xintAssignArray [e]| means that the definitions of the macros will be made +with |\edef|. The empty optional parameter (default) means that definitions +are done with |\def|. Other possibilities: |[], [o], [oo], [f]|. Contrarily to +\csbxint{Assign} one can not use the |g| here to make the definitions global. +For this, one should rather do |\xintAssignArray| within a group starting with +|\globaldefs 1|. + + +\subsection{\csbh{xintDigitsOf}}\label{xintDigitsOf} + +This is a synonym for \csbxint{AssignArray},\ntype{fN} to be used to define +an array giving all the digits of a given (positive, else the minus sign will +be treated as first item) number. +\begingroup\xintDigitsOf\xintiiPow {7}{500}\to\digits +% +\leftedline{|\xintDigitsOf\xintiiPow {7}{500}\to\digits|} +\noindent $7^{500}$ has |\digits{0}=|\digits{0} digits, and the 123rd among them +(starting from the most significant) is +|\digits{123}=|\digits{123}. +\endgroup + +\subsection{\csbh{xintRelaxArray}}\label{xintRelaxArray} + +\csa{xintRelaxArray}\csa{myArray} %\ntype{N} +% +(globally) sets to \csa{relax} all macros which were defined by the previous +\csa{xintAssignArray} with \csa{myArray} as array macro. + + \ifnum\NoSourceCode=1 \bigskip \begin{framed} @@ -15368,20 +15383,27 @@ $1$ or $-1$. % This is \expandafter|\xintbndlversion| of \expandafter|\xintbndldate|. % % \begin{itemize} -% -% \item Release |1.2n| of |2017/08/06| modified \xintbinhexnameimp to depend -% only on \xintkernelnameimp: it does not load \xintcorenameimp anymore. -% Also, macros were rewritten and in particular conversion from decimal -% allows bigger arguments (up to around |6000| rather than |4000| digits as -% in |1.2m|). +% \item Release |1.2o| of |2017/08/29| deprecated those macros from +% \xintcorenameimp and \xintnameimp which filtered their arguments via +% |\xintNum|. Currently these macros execute as formerly but raise an error +% message. This deprecation is overruled for most if \xintfracnameimp is +% loaded as it provides their proper definitions. Some however (like +% |\xintiAdd|) remain deprecated even if loading \xintfracnameimp. All these +% deprecated macros are destined to be removed at some future release. +% +% A few macros got renamed (e.g. |\xintNot| became |\xintNOT|.) Former names +% emit a deprecation error and will get removed at some future release. +% +% \item Release |1.2n| of |2017/08/06| suppressed the \xintbinhexnameimp +% dependencies upon \xintcorenameimp; the package now depends upon, and +% loads, only \xintkernelnameimp. Also, the allowed maximal input lengths +% and the efficiency of its macros got improved. % % \item Release |1.2m| of |2017/07/31| has rewritten entirely the % \xintbinhexnameimp module. The new routines (in the style of the |1.2| -% from \xintcorenameimp) are faster (depending on the macro |1.5x--2.5x| -% faster at |100| digits, |5x--9x| times faster at |1000| digits) but they -% limit the maximal size of the inputs to a few thousand characters, from -% 4000 to about 19900 depending on the macro. The |1.08| routines could -% handle (slowly) tens of thousands of digits. +% from \xintcorenameimp) are faster but limit the maximal size of the inputs +% to a few thousand characters. The |1.08| routines could handle (slowly) +% tens of thousands of digits. % % \item Release |1.2l| of |2017/07/26| refactored the subtraction and also % |\xintiiCmp| got a rewrite. It should certainly use |\pdfstrcmp| for @@ -15613,7 +15635,7 @@ $1$ or $-1$. \fi \XINT_providespackage \ProvidesPackage {xintkernel}% - [2017/08/06 1.2n Paraphernalia for the xint packages (JFB)]% + [2017/08/29 1.2o Paraphernalia for the xint packages (JFB)]% % \end{macrocode} % \subsection{Constants} % \begin{macrocode} @@ -16199,7 +16221,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xinttools}% - [2017/08/06 1.2n Expandable and non-expandable utilities (JFB)]% + [2017/08/29 1.2o 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.| @@ -18103,7 +18125,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintcore}% - [2017/08/06 1.2n Expandable arithmetic on big integers (JFB)]% + [2017/08/29 1.2o Expandable arithmetic on big integers (JFB)]% % \end{macrocode} % \subsection{(WIP!) Error conditions and exceptions} % \lverb|As per the Mike Cowlishaw/IBM's General Decimal Arithmetic Specification @@ -18225,6 +18247,7 @@ $1$ or $-1$. \XINT_resetFlag{Overflow}% not encountered so far in xint code 1.2l % .. others .. }% +\def\XINT_RaiseFlag #1{\expandafter\xint_gobble_i\csname XINT_#1Flag_ON\endcsname}% %% NOT IMPLEMENTED! WORK IN PROGRESS! (ALL SIGNALS TRAPPED, NO HANDLERS USED) \catcode`. 11 \let\XINT_Clamped.handler\xint_firstofone % WIP @@ -18253,11 +18276,35 @@ $1$ or $-1$. \newcount\xint_c_xii_e_viii \xint_c_xii_e_viii 1200000000 \newcount\xint_c_xi_e_viii_mone \xint_c_xi_e_viii_mone 1099999999 % \end{macrocode} +% \subsection*{Routines handling integers as lists of token digits} +% \addcontentsline{toc}{subsection}{Routines handling integers as lists of token digits} +% \lverb|& +% Routines handling big integers which are lists of digit tokens with no +% special additional structure. +% +% Some +% routines do not accept non properly terminated inputs like "\the\numexpr1", +% or "\the\mathcode`\-", others do. +% +% These routines or their sub-routines are mainly for internal usage. +% | +% +% \subsection{\csh{XINT_cuz_small}} +% \lverb|& +% \XINT_cuz_small removes leading zeroes from the first eight digits. Expands +% following \romannumeral0. At least one digit is produced.| +% \begin{macrocode} +\def\XINT_cuz_small#1{% +\def\XINT_cuz_small ##1##2##3##4##5##6##7##8% +{% + \expandafter#1\the\numexpr ##1##2##3##4##5##6##7##8\relax +}}\XINT_cuz_small{ }% +% \end{macrocode} % \subsection{\csh{xintNum}} % \lverb|& % For example \xintNum {----+-+++---+----000000000000003} % -% Very old routine got completely rewritten for 1.2l. +% Very old routine got completely rewritten at 1.2l. % % New code uses \numexpr governed expansion and fixes some issues of former % version particularly regarding inputs of the \numexpr...\relax type without @@ -18278,7 +18325,8 @@ $1$ or $-1$. \expandafter\XINT_num_cleanup\the\numexpr\expandafter\XINT_num_loop \romannumeral`&&@#1\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z }% -\let\xintNum\xintiNum \let\xintnum\xintinum +\def\xintNum {\romannumeral0\xintnum }% +\let\xintnum\xintinum \def\XINT_num #1% {% \expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop @@ -18311,37 +18359,11 @@ $1$ or $-1$. \def\XINT_num_end\xint:#1\xint:{#1+\xint_c_\xint:}% empty input ok \def\XINT_num_cleanup #1\xint:#2\Z { #1}% % \end{macrocode} -% \subsection*{Routines handling integers as lists of token digits} -% \addcontentsline{toc}{subsection}{Routines handling integers as lists of token digits} +% \subsection{\csh{xintiiSgn}} % \lverb|& -% Routines handling big integers which are lists of digit tokens with no -% special additional structure. The argument is only subjected to a -% \romannumeral`^^@ expansion when macros have "ii" in their names. -% -% Some -% routines do not accept non properly terminated inputs like "\the\numexpr1", -% or "\the\mathcode`\-", others do. +% 1.2l made \xintiiSgn robust against non terminated input. % -% These routines or their sub-routines are mainly for internal usage. -% | -% -% \subsection{\csh{XINT_cuz_small}} -% \lverb|& -% \XINT_cuz_small removes leading zeroes from the first eight digits. Expands -% following \romannumeral0. At least one digit is produced.| -% \begin{macrocode} -\def\XINT_cuz_small#1{% -\def\XINT_cuz_small ##1##2##3##4##5##6##7##8% -{% - \expandafter#1\the\numexpr ##1##2##3##4##5##6##7##8\relax -}}\XINT_cuz_small{ }% -% \end{macrocode} -% \subsection{\csh{xintSgn}, \csh{xintiiSgn}, \csh{XINT_Sgn}, \csh{XINT_cntSgn}} -% \lverb|& -% xintfrac.sty will rewrite \xintSgn to let it accept general input as recognized by -% xintfrac.sty macros -% -% 1.2l: \xintiiSgn made robust against non terminated input. +% 1.2o deprecates here \xintSgn (it requires xintfrac.sty). % | % \begin{macrocode} \def\xintiiSgn {\romannumeral0\xintiisgn }% @@ -18349,7 +18371,7 @@ $1$ or $-1$. {% \expandafter\XINT_sgn \romannumeral`&&@#1\xint: }% -\def\xintSgn {\romannumeral0\xintsgn }% +\def\xintSgn {\romannumeral0\XINT_signaldeprecated{xintcore}{xintSgn}\xintsgn }% \def\xintsgn #1% {% \expandafter\XINT_sgn \romannumeral0\xintnum{#1}\xint: @@ -18379,7 +18401,7 @@ $1$ or $-1$. \krof }% % \end{macrocode} -% \subsection{\csh{xintiOpp}, \csh{xintiiOpp}} +% \subsection{\csh{xintiiOpp}} % \lverb|Attention, \xintiiOpp non robust against non terminated inputs. % Reason is I don't want to have to grab a delimiter at the end, as everything % happens "upfront".| @@ -18389,7 +18411,7 @@ $1$ or $-1$. {% \expandafter\XINT_opp \romannumeral`&&@#1% }% -\def\xintiOpp {\romannumeral0\xintiopp }% +\def\xintiOpp {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiOpp}\xintiopp }% \def\xintiopp #1% {% \expandafter\XINT_opp \romannumeral0\xintnum{#1}% @@ -18404,15 +18426,17 @@ $1$ or $-1$. \krof }% % \end{macrocode} -% \subsection{\csh{xintiAbs}, \csh{xintiiAbs}} -% \lverb|Attention \xintiiAbs non robust against non terminated input.| +% \subsection{\csh{xintiiAbs}} +% \lverb|& +% Attention \xintiiAbs non robust against non terminated input. +%| % \begin{macrocode} \def\xintiiAbs {\romannumeral0\xintiiabs }% \def\xintiiabs #1% {% \expandafter\XINT_abs \romannumeral`&&@#1% }% -\def\xintiAbs {\romannumeral0\xintiabs }% +\def\xintiAbs {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiAbs}\xintiabs }% \def\xintiabs #1% {% \expandafter\XINT_abs \romannumeral0\xintnum{#1}% @@ -18425,23 +18449,20 @@ $1$ or $-1$. \krof }% % \end{macrocode} -% \subsection{\csh{xintFDg}, \csh{xintiiFDg}} +% \subsection{\csh{xintFDg}} % \lverb|& % FIRST DIGIT. % -% 1.2l: \xintiiFDg made robust against non terminated input.| +% 1.2l: \xintiiFDg made robust against non terminated input. +% +% 1.2o deprecates \xintiiFDg, gives to \xintFDg former meaning of \xintiiFDg.| % \begin{macrocode} -\def\xintiiFDg {\romannumeral0\xintiifdg }% -\def\xintiifdg #1% -{% - \expandafter\XINT_fdg \romannumeral`&&@#1\xint:\Z -}% \def\xintFDg {\romannumeral0\xintfdg }% -\def\xintfdg #1% -{% - \expandafter\XINT_fdg \romannumeral0\xintnum{#1}\xint:\Z -}% -\def\XINT_FDg #1{\romannumeral0\XINT_fdg #1\xint:\Z }% +\def\xintfdg #1{\expandafter\XINT_fdg \romannumeral`&&@#1\xint:\Z}% +\def\xintiiFDg {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiiFDg}\xintiifdg }% +\let\xintiifdg\xintfdg +\def\XINT_FDg #1% + {\romannumeral0\expandafter\XINT_fdg\romannumeral`&&@\xintnum{#1}\xint:\Z }% \def\XINT_fdg #1#2#3\Z {% \xint_UDzerominusfork @@ -18451,22 +18472,23 @@ $1$ or $-1$. \krof }% % \end{macrocode} -% \subsection{\csh{xintLDg}, \csh{xintiiLDg}} +% \subsection{\csh{xintLDg}} % \lverb|& % LAST DIGIT. % % Rewritten for 1.2i (2016/12/10). Surprisingly perhaps, it is faster than % \xintLastItem from xintkernel.sty despite the \numexpr operations. % -% Attention \xintiiLDg non robust against non terminated input. +% 1.2o deprecates \xintiiLDg, gives to \xintLDg former meaning of \xintiiLDg. +% +% Attention \xintLDg non robust against non terminated input. % | % \begin{macrocode} -\def\xintLDg {\romannumeral0\xintldg }% -\def\xintldg #1{\expandafter\XINT_ldg_fork\romannumeral0\xintnum{#1}% - \XINT_ldg_c{}{}{}{}{}{}{}{}\xint_bye\relax}% -\def\xintiiLDg {\romannumeral0\xintiildg }% -\def\xintiildg #1{\expandafter\XINT_ldg_fork\romannumeral`&&@#1% +\def\xintLDg {\romannumeral0\xintldg }% +\def\xintldg #1{\expandafter\XINT_ldg_fork\romannumeral`&&@#1% \XINT_ldg_c{}{}{}{}{}{}{}{}\xint_bye\relax}% +\def\xintiiLDg {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiiLDg}\xintiildg }% +\let\xintiildg\xintldg \def\XINT_ldg_fork #1% {% \xint_UDsignfork @@ -19034,10 +19056,10 @@ $1$ or $-1$. % it reduced the allowable numbers for addition from 19976 digits to 19968 % digits.| % -% \subsection{\csbh{xintiAdd}, \csbh{xintiiAdd}} +% \subsection{\csbh{xintiiAdd}} % \lverb|1.2l: \xintiiAdd made robust against non terminated input.| % \begin{macrocode} -\def\xintiAdd {\romannumeral0\xintiadd }% +\def\xintiAdd {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiAdd}\xintiadd }% \def\xintiadd #1{\expandafter\XINT_iadd\romannumeral0\xintnum{#1}\xint:}% \def\xintiiAdd {\romannumeral0\xintiiadd }% \def\xintiiadd #1{\expandafter\XINT_iiadd\romannumeral`&&@#1\xint:}% @@ -19222,13 +19244,15 @@ $1$ or $-1$. % \begin{macrocode} \def\XINT_add_o #1{\if #12\expandafter\XINT_add_l\else\expandafter\XINT_add_ke \fi}% % \end{macrocode} -% \subsection{\csh{xintCmp}, \csh{xintiiCmp}} +% \subsection{\csh{xintiiCmp}} % \lverb|Moved from xint.sty to xintcore.sty and rewritten for 1.2l. % % 1.2l's \xintiiCmp is robust against non terminated input. -% | +% +% 1.2o deprecates \xintCmp, with xintfrac loaded it will get overwritten anyhow. +%| % \begin{macrocode} -\def\xintCmp {\romannumeral0\xintcmp }% +\def\xintCmp {\romannumeral0\XINT_signaldeprecated{xintcore}{xintCmp}\xintcmp }% \def\xintcmp #1{\expandafter\XINT_icmp\romannumeral0\xintnum{#1}\xint:}% \def\xintiiCmp {\romannumeral0\xintiicmp }% \def\xintiicmp #1{\expandafter\XINT_iicmp\romannumeral`&&@#1\xint:}% @@ -19333,7 +19357,7 @@ $1$ or $-1$. \def\XINT_cmp_gt#1{\def\XINT_cmp_gt\fi ##1\W ##2\W {\fi#11}}\XINT_cmp_gt{ }% \def\XINT_cmp_equal #1\W #2\W { 0}% % \end{macrocode} -% \subsection{\csh{xintiSub}, \csh{xintiiSub}} +% \subsection{\csh{xintiiSub}} % \lverb|Entirely rewritten for 1.2. % % Refactored at 1.2l. I was initially aiming at clinching some internal format @@ -19365,7 +19389,7 @@ $1$ or $-1$. \expandafter\XINT_sub_nfork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: }% -\def\xintiSub {\romannumeral0\xintisub }% +\def\xintiSub {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiSub}\xintisub }% \def\xintisub #1{\expandafter\XINT_isub\romannumeral0\xintnum{#1}\xint:}% \def\XINT_isub #1#2\xint:#3% {% @@ -19678,12 +19702,12 @@ $1$ or $-1$. % \begin{macrocode} \def\XINT_sub_comp_clean 1#1{+#1\relax}% % \end{macrocode} -% \subsection{\csh{xintiMul}, \csh{xintiiMul}} +% \subsection{\csh{xintiiMul}} % \lverb|Completely rewritten for 1.2. % % 1.2l: \xintiiMul made robust against non terminated input.| % \begin{macrocode} -\def\xintiMul {\romannumeral0\xintimul }% +\def\xintiMul {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMul}\xintimul }% \def\xintimul #1% {% \expandafter\XINT_imul\romannumeral0\xintnum{#1}\xint: @@ -19918,8 +19942,7 @@ $1$ or $-1$. 1#6#7\expandafter!\the\numexpr \xint_c_x^viii+#1#2#3#4#5+#8!% }% % \end{macrocode} -% \subsection{\csh{xintiDivision}, \csh{xintiQuo}, \csh{xintiRem}, -% \csh{xintiiDivision}, \csh{xintiiQuo}, \csh{xintiiRem}} +% \subsection{\csh{xintiiDivision}} % \lverb|Completely rewritten for 1.2. % % WARNING: some comments below try to describe the flow of tokens but they @@ -19939,23 +19962,12 @@ $1$ or $-1$. % the way the code was structured has disappeared. % % -% 1.2l: \xintiiDivision et al. made robust against non terminated input.| -% \begin{macrocode} -\def\xintiiQuo {\romannumeral0\xintiiquo }% -\def\xintiiRem {\romannumeral0\xintiirem }% -\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }% -\def\xintiirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }% -\def\xintiQuo {\romannumeral0\xintiquo }% -\def\xintiRem {\romannumeral0\xintirem }% -\def\xintiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }% -\def\xintirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }% -%%\let\xintQuo\xintiQuo\let\xintquo\xintiquo % now removed -%%\let\xintRem\xintiRem\let\xintrem\xintirem % now removed -% \end{macrocode} +% 1.2l: \xintiiDivision et al. made robust against non terminated input. +% | % \lverb-#1 = A, #2 = B. On calcule le quotient et le reste dans la division % euclidienne de A par B: A=BQ+R, 0<= R < |B|.- % \begin{macrocode} -\def\xintiDivision {\romannumeral0\xintidivision }% +\def\xintiDivision {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivision}\xintidivision }% \def\xintidivision #1{\expandafter\XINT_idivision\romannumeral0\xintnum{#1}\xint:}% \def\XINT_idivision #1#2\xint:#3{\expandafter\XINT_iidivision_a\expandafter #1% \romannumeral0\xintnum{#3}\xint:#2\xint:}% @@ -20047,7 +20059,7 @@ $1$ or $-1$. \def\XINT_div_BisTwo #1#2% {% \expandafter\expandafter\expandafter\XINT_div_BisTwo_a - \ifodd\xintiiLDg{#2} \expandafter1\else \expandafter0\fi {#2}% + \ifodd\xintLDg{#2} \expandafter1\else \expandafter0\fi {#2}% }% \def\XINT_div_BisTwo_a #1#2% {% @@ -20800,13 +20812,28 @@ $1$ or $-1$. % \end{macrocode} % \subsection*{Derived arithmetic} % \addcontentsline{toc}{subsection}{Derived arithmetic} -% \subsection{\csh{xintiDivRound}, \csh{xintiiDivRound}} +% \subsection{\csh{xintiiQuo}, \csh{xintiiRem}} +% \begin{macrocode} +\def\xintiiQuo {\romannumeral0\xintiiquo }% +\def\xintiiRem {\romannumeral0\xintiirem }% +\def\xintiiquo + {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }% +\def\xintiirem + {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }% +\def\xintiQuo {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiQuo}\xintiquo }% +\def\xintiRem {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiRem}\xintirem }% +\def\xintiquo + {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }% +\def\xintirem + {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }% +% \end{macrocode} +% \subsection{\csh{xintiiDivRound}} % \lverb|1.1, transferred from first release of bnumexpr. Rewritten for 1.2. % Ending rewritten for 1.2i. (new \xintDSRr). % % 1.2l: \xintiiDivRound made robust against non terminated input.| % \begin{macrocode} -\def\xintiDivRound {\romannumeral0\xintidivround }% +\def\xintiDivRound {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivRound}\xintidivround }% \def\xintidivround #1% {\expandafter\XINT_idivround\romannumeral0\xintnum{#1}\xint:}% \def\xintiiDivRound {\romannumeral0\xintiidivround }% @@ -20848,10 +20875,10 @@ $1$ or $-1$. \xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax }% % \end{macrocode} -% \subsection{\csh{xintiDivTrunc}, \csh{xintiiDivTrunc}} +% \subsection{\csh{xintiiDivTrunc}} % \lverb|1.2l: \xintiiDivTrunc made robust against non terminated input.| % \begin{macrocode} -\def\xintiDivTrunc {\romannumeral0\xintidivtrunc }% +\def\xintiDivTrunc {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivTrunc}\xintidivtrunc }% \def\xintidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral0\xintnum{#1}\xint:}% \def\xintiiDivTrunc {\romannumeral0\xintiidivtrunc }% \def\xintiidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral`&&@#1\xint:}% @@ -20882,9 +20909,9 @@ $1$ or $-1$. {\expandafter\xint_firstoftwo_thenstop \romannumeral0\XINT_div_prepare {#2}{#1#3}}% % \end{macrocode} -% \subsection{\csh{xintiMod}, \csh{xintiiMod}} +% \subsection{\csh{xintiiMod}} % \begin{macrocode} -\def\xintiMod {\romannumeral0\xintimod }% +\def\xintiMod {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMod}\xintimod }% \def\xintimod #1{\expandafter\XINT_iimod\romannumeral0\xintnum{#1}\xint:}% \def\xintiiMod {\romannumeral0\xintiimod }% \def\xintiimod #1{\expandafter\XINT_iimod\romannumeral`&&@#1\xint:}% @@ -20915,7 +20942,7 @@ $1$ or $-1$. {\expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_div_prepare {#2}{#1#3}}% % \end{macrocode} -% \subsection{\csh{xintiSqr}, \csh{xintiiSqr}} +% \subsection{\csh{xintiiSqr}} % \lverb|1.2l: \xintiiSqr made robust against non terminated input.| % \begin{macrocode} \def\xintiiSqr {\romannumeral0\xintiisqr }% @@ -20923,7 +20950,7 @@ $1$ or $-1$. {% \expandafter\XINT_sqr\romannumeral0\xintiiabs{#1}\xint: }% -\def\xintiSqr {\romannumeral0\xintisqr }% +\def\xintiSqr {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiSqr}\xintisqr }% \def\xintisqr #1% {% \expandafter\XINT_sqr\romannumeral0\xintiabs{#1}\xint: @@ -20976,7 +21003,7 @@ $1$ or $-1$. 1\R!1\R!1\R!1\R!1\R!1\R!1\R!1\R!\W }% % \end{macrocode} -% \subsection{\csh{xintiPow}, \csh{xintiiPow}} +% \subsection{\csh{xintiiPow}} % \lverb|& % The exponent is not limited but with current default settings of tex memory, % with xint 1.2, the maximal exponent for 2^N is N = 2^17 = 131072. @@ -20995,7 +21022,7 @@ $1$ or $-1$. \expandafter\xint_pow\the\numexpr #2\expandafter .\romannumeral`&&@#1\xint: }% -\def\xintiPow {\romannumeral0\xintipow }% +\def\xintiPow {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiPow}\xintipow }% \def\xintipow #1#2% {% \expandafter\xint_pow\the\numexpr #2\expandafter @@ -21144,9 +21171,15 @@ $1$ or $-1$. \the\numexpr\XINT_pow_mulbutcheckifsmall #3\W #3\W #2\W }% % \end{macrocode} -% \subsection{\csh{xintiFac}, \csh{xintiiFac}} +% \subsection{\csh{xintiiFac}} % \lverb|Moved here from xint.sty with release 1.2 (to be usable by \bnumexpr). % +% An \xintiFac is needed by xintexpr.sty. Prior to 1.2o it was defined here +% as an alias to \xintiiFac, then redefined by xintfrac to use \xintNum. This +% was incoherent. Contrarily to other similarly named macros, +% \xintiiFac uses \numexpr on its input. This is also incoherent with the +% naming scheme, alas. +% % Partially rewritten with release 1.2 to benefit from the inner format of the % 1.2 multiplication. % @@ -21199,12 +21232,16 @@ $1$ or $-1$. % untouched. % % +% +% 1.2o modifies \xintiFac to be coherent with \xintiBinomial: only with +% xintfrac.sty loaded does it use \xintNum. It is documented only as macro of +% xintfrac.sty, not as macro of xint.sty. % | % \begin{macrocode} \def\xintiiFac {\romannumeral0\xintiifac }% \def\xintiifac #1{\expandafter\XINT_fac_fork\the\numexpr#1.}% -\def\xintiFac {\romannumeral0\xintifac }% -\let\xintifac\xintiifac +\def\xintiFac {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiFac}\xintifac }% +\let\xintifac \xintiifac % redefined by xintfrac \def\XINT_fac_fork #1#2.% {% \xint_UDzerominusfork @@ -21311,21 +21348,61 @@ $1$ or $-1$. }% \def\XINT_fac_loop_exit #1!#2;!#3{#3#2;!}% % \end{macrocode} -% \subsection*{``Load \xintfracnameimp'' macros} -% \addcontentsline{toc}{subsection}{``Load \xintfracnameimp'' macros} -% \lverb|Originally was used in \xintiiexpr. Transferred from xintfrac for 1.1.| +% \subsection{\csh{XINT_signaldeprecated}} +% \lverb|1.2o| +% \begin{macrocode} +\def\XINT_signaldeprecated #1#2% +{% + \XINT_ifFlagRaised{#2}% + {}% already encountered (if not hidden in a group...) + {\XINT_RaiseFlag{Deprecated-#1}\XINT_RaiseFlag{#2}% + \expandafter\XINT_expandableerror\expandafter + {\csname#2\endcsname (#1) is deprecated! (RET to proceed)}}% +}% +% \end{macrocode} +% \subsection*{At End of \LaTeX\ Document deprecation message} +% \addcontentsline{toc}{subsection}{At End of \LaTeX\ Document deprecation message} +% \lverb|1.2o| +% \begin{macrocode} +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xintcore}% + {\PackageError{xintcore} +{Usage of deprecated macros!} +{These deprecated macros from xintcore.sty have been detected:\MessageBreak +\XINT_useiimessage{xintSgn}% +\XINT_useiimessage{xintCmp}% +\XINT_ifFlagRaised{xintiOpp}{\string\xintiOpp\MessageBreak}{}% +\XINT_ifFlagRaised{xintiAbs}{\string\xintiAbs\MessageBreak}{}% +\XINT_ifFlagRaised{xintiiFDg}{\string\xintiiFDg\space(renamed to \string\xintFDg!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintiiLDg}{\string\xintiiLDg\space(renamed to \string\xintLDg!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintiAdd}{\string\xintiAdd\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSub}{\string\xintiSub\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMul}{\string\xintiMul\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivision}{\string\xintiDivision\MessageBreak}{}% +\XINT_ifFlagRaised{xintiQuo}{\string\xintiQuo\MessageBreak}{}% +\XINT_ifFlagRaised{xintiRem}{\string\xintiRem\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivRound}{\string\xintiDivRound\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivTrunc}{\string\xintiDivTrunc\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMod}{\string\xintiMod\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqr}{\string\xintiSqr\MessageBreak}{}% +\XINT_ifFlagRaised{xintiPow}{\string\xintiPow\MessageBreak}{}% +\XINT_ifFlagRaised{xintiFac}{\string\xintiFac\MessageBreak}{}% +They will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi +% \end{macrocode} +% \subsection{\csh{XINT_useiimessage}} +% \lverb|1.2o| % \begin{macrocode} -\catcode`! 11 -\def\xintAbs {\Did_you_mean_iiAbs?or_load_xintfrac!}% -\def\xintOpp {\Did_you_mean_iiOpp?or_load_xintfrac!}% -\def\xintAdd {\Did_you_mean_iiAdd?or_load_xintfrac!}% -\def\xintSub {\Did_you_mean_iiSub?or_load_xintfrac!}% -\def\xintMul {\Did_you_mean_iiMul?or_load_xintfrac!}% -\def\xintPow {\Did_you_mean_iiPow?or_load_xintfrac!}% -\def\xintSqr {\Did_you_mean_iiSqr?or_load_xintfrac!}% -\def\xintQuo {\Removed!use_xintiQuo_or_xintiiQuo!}% -\def\xintRem {\Removed!use_xintiRem_or_xintiiRem!}% -\catcode`! 12 +\def\XINT_useiimessage #1% used in LaTeX only +{% + \XINT_ifFlagRaised {#1}% + {\@backslashchar#1 + (load xintfrac or use \@backslashchar xintii\xint_gobble_iv#1!)\MessageBreak}% + {}% +}% \XINT_restorecatcodes_endinput% % \end{macrocode} % @@ -21395,7 +21472,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xint}% - [2017/08/06 1.2n Expandable operations on big integers (JFB)]% + [2017/08/29 1.2o Expandable operations on big integers (JFB)]% % \end{macrocode} % \subsection{More token management} % \begin{macrocode} @@ -21406,45 +21483,33 @@ $1$ or $-1$. \long\def\xint_secondofthree_thenstop #1#2#3{ #2}% \long\def\xint_thirdofthree_thenstop #1#2#3{ #3}% % \end{macrocode} -% \subsection{\csh{xintSgnFork}} -% \lverb|Expandable three-way fork added in 1.07. The argument #1 must expand -% to non-self-ending -1,0 or 1. 1.09i with _thenstop.| -% \begin{macrocode} -\def\xintSgnFork {\romannumeral0\xintsgnfork }% -\def\xintsgnfork #1% -{% - \ifcase #1 \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop - \fi -}% -% \end{macrocode} -% \subsection{\csh{xintIsOne}, \csh{xintiiIsOne}} -% \lverb|Added in 1.03. 1.09a defines \xintIsOne. 1.1a adds \xintiiIsOne. -% -% \XINT_isOne rewritten for 1.2g. Works with expanded strict integers, -% positive or negative. -% +% \subsection{\csh{xintLen}} +% \lverb|\xintLen gets extended to fractions by xintfrac.sty: A/B is given +% length len(A)+len(B)-1 (somewhat arbitrary). It applies \xintNum to its +% argument. A minus sign is accepted and ignored. % % -%| +% For parallelism with \xintiNum/\xintNum, 1.2o defines \xintiLen. +% | % \begin{macrocode} -\def\xintiiIsOne {\romannumeral0\xintiiisone }% -\def\xintiiisone #1{\expandafter\XINT_isone\romannumeral`&&@#1XY}% -\def\xintIsOne {\romannumeral0\xintisone }% -\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% -\def\XINT_isone #1#2#3Y% +\def\xintiLen {\romannumeral0\xintilen }% +\def\xintilen #1{\def\xintilen ##1% {% - \unless\if#2X\xint_dothis{ 0}\fi - \unless\if#11\xint_dothis{ 0}\fi - \xint_orthat{ 1}% -}% -\def\XINT_isOne #1{\XINT_is_One#1XY}% -\def\XINT_is_One #1#2#3Y% + \expandafter#1\the\numexpr + \expandafter\XINT_len_fork\romannumeral0\xintinum{##1}% + \xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: + \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 +}}\xintilen{ }% +\def\xintLen {\romannumeral0\xintlen }% +\let\xintlen\xintilen +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_len_fork #1% {% - \unless\if#2X\xint_dothis0\fi - \unless\if#11\xint_dothis0\fi - \xint_orthat1% + \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof }% % \end{macrocode} % \subsection{\csh{xintReverseDigits}} @@ -21498,141 +21563,637 @@ $1$ or $-1$. }\XINT_revdigits_end{ }% \let\xintRev\xintReverseDigits % \end{macrocode} -% \subsection{\csh{xintLen}} -% \lverb|\xintLen is ONLY for (possibly long) integers. Gets extended to -% fractions by xintfrac.sty. It applies \xintNum to its argument. A minus sign -% is accepted and ignored. +% \subsection{\csh{xintiiE}} +% \lverb|Originally was used in \xintiiexpr. Transferred from xintfrac for +% 1.1. +% Code rewritten for 1.2i. +%%÷ Used in \xintMod +% | +% \begin{macrocode} +\def\xintiiE {\romannumeral0\xintiie }% +\def\xintiie #1#2% + {\expandafter\XINT_iie_fork\the\numexpr #2\expandafter.\romannumeral`&&@#1;}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_iie_fork #1% +{% + \xint_UDsignfork + #1\XINT_iie_neg + -\XINT_iie_a + \krof #1% +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_iie_a #1.% + {\expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_iie_neg #1.#2;{ #2}% +% \end{macrocode} +% \subsection{\csh{xintDecSplit}} +% \lverb!DECIMAL SPLIT +% +% The macro \xintDecSplit {x}{A} cuts A which is composed of digits (leading +% zeroes ok, but no sign) (*) into two (each possibly empty) pieces L and R. +% The concatenation LR always reproduces A. +% +% The position of the cut is specified by the first argument x. If x is zero +% or positive the cut location is x slots to the left of the right end of the +% number. If x becomes equal to or larger than the length of the number then L +% becomes empty. If x is negative the location of the cut is |x| slots to the +% right of the left end of the number. +% +% (*) versions earlier than 1.2i first replaced A with its absolute value. +% This is not the case anymore. This macro should NOT be used for A with a +% leading sign (+ or -). +% +% Entirely rewritten for 1.2i (2016/12/11). % +% Attention: \xintDecSplit not robust against non terminated second argument. +% ! +% \begin{macrocode} +\def\xintDecSplit {\romannumeral0\xintdecsplit }% +\def\xintdecsplit #1#2% +{% + \expandafter\XINT_split_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_split_finish #1.#2.{{#1}{#2}}% +% \end{macrocode} +% \lverb|& % | % \begin{macrocode} -\def\xintLen {\romannumeral0\xintlen }% -\def\xintlen #1{\def\xintlen ##1% +\def\XINT_split_xfork #1% {% - \expandafter#1\the\numexpr - \expandafter\XINT_len_fork\romannumeral0\xintnum{##1}% - \xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: + \xint_UDzerominusfork + #1-\XINT_split_zerosplit + 0#1\XINT_split_fromleft + 0-{\XINT_split_fromright #1}% + \krof +}% +\def\XINT_split_zerosplit .#1\xint_bye#2\xint_bye..{ #1..}% +\def\XINT_split_fromleft + {\expandafter\XINT_split_fromleft_a\the\numexpr\xint_c_viii-}% +\def\XINT_split_fromleft_a #1% +{% + \xint_UDsignfork + #1\XINT_split_fromleft_b + -{\XINT_split_fromleft_end_a #1}% + \krof +}% +\def\XINT_split_fromleft_b #1.#2#3#4#5#6#7#8#9% +{% + \expandafter\XINT_split_fromleft_clean + \the\numexpr1#2#3#4#5#6#7#8#9\expandafter + \XINT_split_fromleft_a\the\numexpr\xint_c_viii-#1.% +}% +\def\XINT_split_fromleft_end_a #1.% +{% + \expandafter\XINT_split_fromleft_clean + \the\numexpr1\csname XINT_split_fromleft_end#1\endcsname +}% +\def\XINT_split_fromleft_clean 1{ }% +\expandafter\def\csname XINT_split_fromleft_end7\endcsname #1% + {#1\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end6\endcsname #1#2% + {#1#2\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end5\endcsname #1#2#3% + {#1#2#3\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end4\endcsname #1#2#3#4% + {#1#2#3#4\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end3\endcsname #1#2#3#4#5% + {#1#2#3#4#5\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end2\endcsname #1#2#3#4#5#6% + {#1#2#3#4#5#6\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end1\endcsname #1#2#3#4#5#6#7% + {#1#2#3#4#5#6#7\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end0\endcsname #1#2#3#4#5#6#7#8% + {#1#2#3#4#5#6#7#8\XINT_split_fromleft_end_b}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_split_fromleft_end_b #1\xint_bye#2\xint_bye.{.#1}% puis . +\def\XINT_split_fromright #1.#2\xint_bye +{% + \expandafter\XINT_split_fromright_a + \the\numexpr#1-\numexpr\XINT_length_loop + #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \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 -}}\xintlen{ }% -\def\XINT_len_fork #1% + \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye + .#2\xint_bye +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_split_fromright_a #1% {% - \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof + \xint_UDsignfork + #1\XINT_split_fromleft + -\XINT_split_fromright_Lempty + \krof }% +\def\XINT_split_fromright_Lempty #1.#2\xint_bye#3..{.#2.}% % \end{macrocode} -% \subsection{\csh{xintBool}, \csh{xintToggle}} -% \lverb|1.09c| +% \subsection{\csh{xintDecSplitL}} % \begin{macrocode} -\def\xintBool #1{\romannumeral`&&@% - \csname if#1\endcsname\expandafter1\else\expandafter0\fi }% -\def\xintToggle #1{\romannumeral`&&@\iftoggle{#1}{1}{0}}% +\def\xintDecSplitL {\romannumeral0\xintdecsplitl }% +\def\xintdecsplitl #1#2% +{% + \expandafter\XINT_splitl_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_splitl_finish #1.#2.{ #1}% % \end{macrocode} -% \subsection{\csh{xintifSgn}, \csh{xintiiifSgn}} -% \lverb|Expandable three-way fork added in 1.09a. Branches expandably -% depending on whether <0, =0, >0. Choice of branch guaranteed in two steps. +% \subsection{\csh{xintDecSplitR}} +% \begin{macrocode} +\def\xintDecSplitR {\romannumeral0\xintdecsplitr }% +\def\xintdecsplitr #1#2% +{% + \expandafter\XINT_splitr_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_splitr_finish #1.#2.{ #2}% +% \end{macrocode} +% \subsection{\csh{xintDSHr}} +% \lverb!DECIMAL SHIFTS \xintDSH {x}{A}$\ +% si x <= 0, fait A -> A.10^(|x|). +% si x > 0, et A >=0, fait A -> quo(A,10^(x))$\ +% si x > 0, et A < 0, fait A -> -quo(-A,10^(x))$\ +% (donc pour x > 0 c'est comme DSR itéré x fois)$\ +% \xintDSHr donne le `reste' (si x<=0 donne zéro). % -% 1.09i has \xint_firstofthreeafterstop (now _thenstop) etc for faster -% expansion. +% Badly named macros. +% +% Rewritten for 1.2i, this was old code and \xintDSx has changed interface. +% ! +% \begin{macrocode} +\def\xintDSHr {\romannumeral0\xintdshr }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\xintdshr #1#2% +{% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + \expandafter\XINT_dshr_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dshr_fork #1% +{% + \xint_UDzerominusfork + 0#1\XINT_dshr_xzeroorneg + #1-\XINT_dshr_xzeroorneg + 0-\XINT_dshr_xpositive + \krof #1% +}% +\def\XINT_dshr_xzeroorneg #1;{ 0}% +\def\XINT_dshr_xpositive +{% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + \expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_dsx_xisPos +}% +% \end{macrocode} +% \subsection{\csh{xintDSH}} +% \begin{macrocode} +\def\xintDSH {\romannumeral0\xintdsh }% +\def\xintdsh #1#2% +{% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + \expandafter\XINT_dsh_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dsh_fork #1% +{% + \xint_UDzerominusfork + #1-\XINT_dsh_xiszero +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + 0#1\XINT_dsx_xisNeg_checkA + 0-{\XINT_dsh_xisPos #1}% + \krof +}% +\def\XINT_dsh_xiszero #1.#2;{ #2}% +\def\XINT_dsh_xisPos +{% +% \end{macrocode} +% \lverb|& + \expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_dsx_xisPos +% | +% \begin{macrocode} +}% +% \end{macrocode} +% \subsection{\csh{xintDSx}} +% \lverb!& +% --> Attention le cas x=0 est traité dans la même catégorie que x > 0 <--$\ +% si x < 0, fait A -> A.10^(|x|)$\ +% si x >= 0, et A >=0, fait A -> {quo(A,10^(x))}{rem(A,10^(x))}$\ +% si x >= 0, et A < 0, d'abord on calcule {quo(-A,10^(x))}{rem(-A,10^(x))}$\ +% puis, si le premier n'est pas nul on lui donne le signe -$\ +% si le premier est nul on donne le signe - au second. % -% 1.1 adds \xintiiifSgn for optimization in xintexpr-essions. Should I move -% them to xintcore? (for bnumexpr)| +% On peut donc toujours reconstituer l'original A par 10^x Q \pm R +% où il faut prendre le signe plus si Q est positif ou nul et le signe moins si +% Q est strictement négatif. +% +% Rewritten for 1.2i, this was old code. +% +% ! % \begin{macrocode} -\def\xintifSgn {\romannumeral0\xintifsgn }% -\def\xintifsgn #1% +\def\xintDSx {\romannumeral0\xintdsx }% +\def\xintdsx #1#2% {% - \ifcase \xintSgn{#1} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + \expandafter\XINT_dsx_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dsx_fork #1% +{% + \xint_UDzerominusfork + #1-\XINT_dsx_xisZero + 0#1\XINT_dsx_xisNeg_checkA + 0-{\XINT_dsx_xisPos #1}% + \krof +}% +\def\XINT_dsx_xisZero #1.#2;{{#2}{0}}% +\def\XINT_dsx_xisNeg_checkA #1.#2% +{% + \xint_gob_til_zero #2\XINT_dsx_xisNeg_Azero 0% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} + \expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.#2% +}% +\def\XINT_dsx_xisNeg_Azero #1;{ 0}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_addzeros #1% + {\expandafter\XINT_dsx_append\romannumeral\XINT_rep#1\endcsname0.}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_addzerosnofuss #1% + {\expandafter\XINT_dsx_append\romannumeral\xintreplicate{#1}0.}% +\def\XINT_dsx_append #1.#2;{ #2#1}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_xisPos #1.#2% +{% + \xint_UDzerominusfork + #2-\XINT_dsx_AisZero + 0#2\XINT_dsx_AisNeg + 0-\XINT_dsx_AisPos + \krof #1.#2% +}% +\def\XINT_dsx_AisZero #1;{{0}{0}}% +\def\XINT_dsx_AisNeg #1.-#2;% +{% + \expandafter\XINT_dsx_AisNeg_checkiffirstempty + \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_AisNeg_checkiffirstempty #1% +{% + \xint_gob_til_dot #1\XINT_dsx_AisNeg_finish_zero.% + \XINT_dsx_AisNeg_finish_notzero #1% +}% +\def\XINT_dsx_AisNeg_finish_zero.\XINT_dsx_AisNeg_finish_notzero.#1.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {-#1}}{0}% +}% +\def\XINT_dsx_AisNeg_finish_notzero #1.#2.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {#2}}{-#1}% +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_AisPos #1.#2;% +{% + \expandafter\XINT_dsx_AisPos_finish + \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_dsx_AisPos_finish #1.#2.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {#2}}% + {\romannumeral0\XINT_num {#1}}% +}% +\def\XINT_dsx_end #1#2{\expandafter{#2}{#1}}% +% \end{macrocode} +% \subsection{\csh{xintiiEq}} +% \lverb|no \xintiieq.| +% \begin{macrocode} +\def\xintEq {\romannumeral0\XINT_signaldeprecated{xint}{xintEq}\xinteq }% +\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% +\def\xintiiEq #1#2{\romannumeral0\xintiiifeq{#1}{#2}{1}{0}}% +% \end{macrocode} +% \subsection{\csh{xintiiNotEq}} +% \lverb|Pour xintexpr. Pas de version en lowercase.| +% \begin{macrocode} +\def\xintNeq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintNeq}\xintifeq {#1}{#2}{0}{1}}% +\def\xintiiNotEq #1#2{\romannumeral0\xintiiifeq {#1}{#2}{0}{1}}% +% \end{macrocode} +% \subsection{\csh{xintiiGeq}} +% \lverb|& +% PLUS GRAND OU ÉGAL +% attention compare les **valeurs absolues** +% +% 1.2l made \xintiiGeq robust against non terminated items. +% +% 1.2l rewrote \xintiiCmp, but forgot to handle \xintiiGeq too. Done at 1.2m. +% +% This macro should have been called \xintGEq for example. +% | +% \begin{macrocode} +\def\xintGeq {\romannumeral0\XINT_signaldeprecated{xint}{xintGeq}\xintgeq }% +\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\xint:}% +\def\xintiiGeq {\romannumeral0\xintiigeq }% +\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\xint:}% +\def\XINT_iigeq #1#2\xint:#3% +{% + \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: +}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} +\def\XINT_geq #1#2\xint:#3% +{% + \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\xint:#2\xint: +}% +\def\XINT_geq_fork #1#2% +{% + \xint_UDzerofork + #1\XINT_geq_firstiszero + #2\XINT_geq_secondiszero + 0{}% + \krof + \xint_UDsignsfork + #1#2\XINT_geq_minusminus + #1-\XINT_geq_minusplus + #2-\XINT_geq_plusminus + --\XINT_geq_plusplus + \krof #1#2% +}% +\def\XINT_geq_firstiszero #1\krof 0#2#3\xint:#4\xint: + {\xint_UDzerofork #2{ 1}0{ 0}\krof }% +\def\XINT_geq_secondiszero #1\krof #20#3\xint:#4\xint:{ 1}% +\def\XINT_geq_plusminus #1-{\XINT_geq_plusplus #1{}}% +\def\XINT_geq_minusplus -#1{\XINT_geq_plusplus {}#1}% +\def\XINT_geq_minusminus --{\XINT_geq_plusplus {}{}}% +\def\XINT_geq_plusplus + {\expandafter\XINT_geq_finish\romannumeral0\XINT_cmp_plusplus}% +\def\XINT_geq_finish #1{\if-#1\expandafter\XINT_geq_no + \else\expandafter\XINT_geq_yes\fi}% +\def\XINT_geq_no 1{ 0}% +\def\XINT_geq_yes { 1}% +% \end{macrocode} +% \subsection{\csh{xintiiGt}} +% \begin{macrocode} +\def\xintGt {\romannumeral0\XINT_signaldeprecated{xint}{xintGt}\xintgt }% +\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}% +\def\xintiiGt #1#2{\romannumeral0\xintiiifgt{#1}{#2}{1}{0}}% +% \end{macrocode} +% \subsection{\csh{xintiiLt}} +% \begin{macrocode} +\def\xintLt {\romannumeral0\XINT_signaldeprecated{xint}{xintLt}\xintlt }% +\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}% +\def\xintiiLt #1#2{\romannumeral0\xintiiiflt{#1}{#2}{1}{0}}% +% \end{macrocode} +% \subsection{\csh{xintiiGtorEq}} +% \begin{macrocode} +\def\xintGtorEq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintGtorEq}\xintiflt {#1}{#2}{0}{1}}% +\def\xintiiGtorEq #1#2{\romannumeral0\xintiiiflt {#1}{#2}{0}{1}}% +% \end{macrocode} +% \subsection{\csh{xintiiLtorEq}} +% \begin{macrocode} +\def\xintLtorEq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintLtorEq}\xintifgt {#1}{#2}{0}{1}}% +\def\xintiiLtorEq #1#2{\romannumeral0\xintiiifgt {#1}{#2}{0}{1}}% +% \end{macrocode} +% \subsection{\csh{xintiiIsZero}} +% \lverb|1.09a. restyled in 1.09i. 1.1 adds \xintiiIsZero, etc... for +% optimization in \xintexpr| +% \begin{macrocode} +\def\xintIsZero {\romannumeral0\XINT_signaldeprecated{xint}{xintIsZero}\xintiszero }% +\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% +\def\xintiiIsZero {\romannumeral0\xintiiiszero }% +\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% +% \end{macrocode} +% \subsection{\csh{xintiiIsNotZero}} +% \lverb|1.09a. restyled in 1.09i. 1.1 adds \xintiiIsZero, etc... for +% optimization in \xintexpr| +% \begin{macrocode} +\def\xintIsNotZero {\romannumeral0\XINT_signaldeprecated{xint}{xintIsNotZero}\xintisnotzero }% +\def\xintisnotzero + #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }% +\def\xintiiisnotzero + #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +% \end{macrocode} +% \subsection{\csh{xintiiIsOne}} +% \lverb|Added in 1.03. 1.09a defines \xintIsOne. 1.1a adds \xintiiIsOne. +% +% \XINT_isOne rewritten for 1.2g. Works with expanded strict integers, +% positive or negative. +% +% +% +%| +% \begin{macrocode} +\def\xintiiIsOne {\romannumeral0\xintiiisone }% +\def\xintiiisone #1{\expandafter\XINT_isone\romannumeral`&&@#1XY}% +\def\xintIsOne {\romannumeral0\XINT_signaldeprecated{xint}{xintIsOne}\xintisone }% +\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% +\def\XINT_isone #1#2#3Y% +{% + \unless\if#2X\xint_dothis{ 0}\fi + \unless\if#11\xint_dothis{ 0}\fi + \xint_orthat{ 1}% +}% +\def\XINT_isOne #1{\XINT_is_One#1XY}% +\def\XINT_is_One #1#2#3Y% +{% + \unless\if#2X\xint_dothis0\fi + \unless\if#11\xint_dothis0\fi + \xint_orthat1% +}% +% \end{macrocode} +% \subsection{\csh{xintiiOdd}} +% \lverb|\xintOdd is needed for the xintexpr-essions even() and odd() +% functions (and also by \xintNewExpr).| +% \begin{macrocode} +\def\xintiiOdd {\romannumeral0\xintiiodd }% +\def\xintiiodd #1% +{% + \ifodd\xintLDg{#1} %<- intentional space + \xint_afterfi{ 1}% + \else + \xint_afterfi{ 0}% \fi }% -\def\xintiiifSgn {\romannumeral0\xintiiifsgn }% -\def\xintiiifsgn #1% +\def\xintOdd {\romannumeral0\XINT_signaldeprecated{xint}{xintOdd}\xintodd }% +\def\xintodd #1% {% - \ifcase \xintiiSgn{#1} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 1}% + \else + \xint_afterfi{ 0}% \fi }% % \end{macrocode} -% \subsection{\csh{xintifZero}, \csh{xintifNotZero}, \csh{xintiiifZero}, \csh{xintiiifNotZero}} -% \lverb|Expandable two-way fork added in 1.09a. Branches expandably depending on -% whether the argument is zero (branch A) or not (branch B). 1.09i restyling. By -% the way it appears (not thoroughly tested, though) that \if tests are faster -% than \ifnum tests. 1.1 adds ii versions.| +% \subsection{\csh{xintiiEven}} % \begin{macrocode} -\def\xintifZero {\romannumeral0\xintifzero }% -\def\xintifzero #1% +\def\xintiiEven {\romannumeral0\xintiieven }% +\def\xintiieven #1% {% - \if0\xintSgn{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg{#1} %<- intentional space + \xint_afterfi{ 0}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintifNotZero {\romannumeral0\xintifnotzero }% -\def\xintifnotzero #1% +\def\xintEven {\romannumeral0\XINT_signaldeprecated{xint}{xintEven}\xinteven }% +\def\xinteven #1% {% - \if0\xintSgn{#1}% - \expandafter\xint_secondoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 0}% \else - \expandafter\xint_firstoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintiiifZero {\romannumeral0\xintiiifzero }% -\def\xintiiifzero #1% +% \end{macrocode} +% \subsection{\csh{xintiiMON}} +% \lverb|MINUS ONE TO THE POWER N| +% \begin{macrocode} +\def\xintiiMON {\romannumeral0\xintiimon }% +\def\xintiimon #1% {% - \if0\xintiiSgn{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg {#1} %<- intentional space + \xint_afterfi{ -1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }% -\def\xintiiifnotzero #1% +\def\xintMON {\romannumeral0\XINT_signaldeprecated{xint}{xintMON}\xintmon }% +\def\xintmon #1% {% - \if0\xintiiSgn{#1}% - \expandafter\xint_secondoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ -1}% \else - \expandafter\xint_firstoftwo_thenstop + \xint_afterfi{ 1}% \fi }% % \end{macrocode} -% \subsection{\csh{xintifOne},\csh{xintiiifOne}} -% \lverb|added in 1.09i. 1.1a adds \xintiiifOne.| +% \subsection{\csh{xintiiMMON}} +% \lverb|MINUS ONE TO THE POWER N-1| % \begin{macrocode} -\def\xintiiifOne {\romannumeral0\xintiiifone }% -\def\xintiiifone #1% +\def\xintiiMMON {\romannumeral0\xintiimmon }% +\def\xintiimmon #1% {% - \if1\xintiiIsOne{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg {#1} %<- intentional space + \xint_afterfi{ 1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ -1}% \fi }% -\def\xintifOne {\romannumeral0\xintifone }% -\def\xintifone #1% +\def\xintMMON {\romannumeral0\XINT_signaldeprecated{xint}{xintMMON}\xintmmon }% +\def\xintmmon #1% {% - \if1\xintIsOne{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ -1}% \fi }% % \end{macrocode} -% \subsection{\csh{xintifTrueAelseB}, \csh{xintifFalseAelseB}} -% \lverb|1.09i. 1.2i has removed deprecated \xintifTrueFalse, \xintifTrue.| +% \subsection{\csh{xintSgnFork}} +% \lverb|Expandable three-way fork added in 1.07. The argument #1 must expand +% to non-self-ending -1,0 or 1. 1.09i with _thenstop.| % \begin{macrocode} -\let\xintifTrueAelseB\xintifNotZero -\let\xintifFalseAelseB\xintifZero -%%\let\xintifTrue\xintifNotZero % now removed -%%\let\xintifTrueFalse\xintifNotZero % now removed +\def\xintSgnFork {\romannumeral0\xintsgnfork }% +\def\xintsgnfork #1% +{% + \ifcase #1 \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% +% \end{macrocode} +% \subsection{\csh{xintiiifSgn}} +% \lverb|Expandable three-way fork added in 1.09a. Branches expandably +% depending on whether <0, =0, >0. Choice of branch guaranteed in two steps. +% +% 1.09i has \xint_firstofthreeafterstop (now _thenstop) etc for faster +% expansion. +% +% 1.1 adds \xintiiifSgn for optimization in xintexpr-essions. Should I move +% them to xintcore? (for bnumexpr)| +% \begin{macrocode} +\def\xintifSgn {\romannumeral0\XINT_signaldeprecated{xint}{xintifSgn}\xintifsgn }% +\def\xintifsgn #1% +{% + \ifcase \xintSgn{#1} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% +\def\xintiiifSgn {\romannumeral0\xintiiifsgn }% +\def\xintiiifsgn #1% +{% + \ifcase \xintiiSgn{#1} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% % \end{macrocode} -% \subsection{\csh{xintifCmp}, \csh{xintiiifCmp}} +% \subsection{\csh{xintiiifCmp}} % \lverb|1.09e % \xintifCmp {n}{m}{if n<m}{if n=m}{if n>m}. 1.1a adds ii variant| % \begin{macrocode} -\def\xintifCmp {\romannumeral0\xintifcmp }% +\def\xintifCmp {\romannumeral0\XINT_signaldeprecated{xint}{xintifCmp}\xintifcmp }% \def\xintifcmp #1#2% {% \ifcase\xintCmp {#1}{#2} @@ -21651,10 +22212,10 @@ $1$ or $-1$. \fi }% % \end{macrocode} -% \subsection{\csh{xintifEq}, \csh{xintiiifEq}} +% \subsection{\csh{xintiiifEq}} % \lverb|1.09a \xintifEq {n}{m}{YES if n=m}{NO if n<>m}. 1.1a adds ii variant| % \begin{macrocode} -\def\xintifEq {\romannumeral0\xintifeq }% +\def\xintifEq {\romannumeral0\XINT_signaldeprecated{xint}{xintifEq}\xintifeq }% \def\xintifeq #1#2% {% \if0\xintCmp{#1}{#2}% @@ -21671,10 +22232,10 @@ $1$ or $-1$. \fi }% % \end{macrocode} -% \subsection{\csh{xintifGt}, \csh{xintiiifGt}} +% \subsection{\csh{xintiiifGt}} % \lverb|1.09a \xintifGt {n}{m}{YES if n>m}{NO if n<=m}. 1.1a adds ii variant| % \begin{macrocode} -\def\xintifGt {\romannumeral0\xintifgt }% +\def\xintifGt {\romannumeral0\XINT_signaldeprecated{xint}{xintifGt}\xintifgt }% \def\xintifgt #1#2% {% \if1\xintCmp{#1}{#2}% @@ -21691,11 +22252,11 @@ $1$ or $-1$. \fi }% % \end{macrocode} -% \subsection{\csh{xintifLt}, \csh{xintiiifLt}} +% \subsection{\csh{xintiiifLt}} % \lverb|1.09a \xintifLt {n}{m}{YES if n<m}{NO if n>=m}. Restyled in 1.09i. % 1.1a adds ii variant| % \begin{macrocode} -\def\xintifLt {\romannumeral0\xintiflt }% +\def\xintifLt {\romannumeral0\XINT_signaldeprecated{xint}{xintifLt}\xintiflt }% \def\xintiflt #1#2% {% \ifnum\xintCmp{#1}{#2}<\xint_c_ @@ -21712,99 +22273,153 @@ $1$ or $-1$. \fi }% % \end{macrocode} -% \subsection{\csh{xintifOdd}, \csh{xintiiifOdd}} -% \lverb|1.09e. Restyled in 1.09i. 1.1a adds \xintiiifOdd.| +% \subsection{\csh{xintiiifZero}} +% \lverb|Expandable two-way fork added in 1.09a. Branches expandably depending on +% whether the argument is zero (branch A) or not (branch B). 1.09i restyling. By +% the way it appears (not thoroughly tested, though) that \if tests are faster +% than \ifnum tests. 1.1 adds ii versions. +% +% 1.2o deprecates \xintifZero.| % \begin{macrocode} -\def\xintiiifOdd {\romannumeral0\xintiiifodd }% -\def\xintiiifodd #1% +\def\xintifZero {\romannumeral0\XINT_signaldeprecated{xint}{xintifZero}\xintifzero }% +\def\xintifzero #1% {% - \if\xintiiOdd{#1}1% + \if0\xintSgn{#1}% \expandafter\xint_firstoftwo_thenstop \else \expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintifOdd {\romannumeral0\xintifodd }% -\def\xintifodd #1% +\def\xintiiifZero {\romannumeral0\xintiiifzero }% +\def\xintiiifzero #1% {% - \if\xintOdd{#1}1% + \if0\xintiiSgn{#1}% \expandafter\xint_firstoftwo_thenstop \else \expandafter\xint_secondoftwo_thenstop \fi }% % \end{macrocode} -% \subsection{\csh{xintEq}, \csh{xintGt}, \csh{xintLt}} -% \lverb|1.09a.| +% \subsection{\csh{xintiiifNotZero}} % \begin{macrocode} -\def\xintEq {\romannumeral0\xinteq }\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% -\def\xintGt {\romannumeral0\xintgt }\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}% -\def\xintLt {\romannumeral0\xintlt }\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}% +\def\xintifNotZero {\romannumeral0\XINT_signaldeprecated{xint}{xintifNotZero}\xintifnotzero }% +\def\xintifnotzero #1% +{% + \if0\xintSgn{#1}% + \expandafter\xint_secondoftwo_thenstop + \else + \expandafter\xint_firstoftwo_thenstop + \fi +}% +\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }% +\def\xintiiifnotzero #1% +{% + \if0\xintiiSgn{#1}% + \expandafter\xint_secondoftwo_thenstop + \else + \expandafter\xint_firstoftwo_thenstop + \fi +}% % \end{macrocode} -% \subsection{\csh{xintNeq}, \csh{xintGtorEq}, \csh{xintLtorEq}} -% \lverb|1.1. Pour xintexpr. No lowercase macros| +% \subsection{\csh{xintiiifOne}} +% \lverb|added in 1.09i. 1.1a adds \xintiiifOne.| % \begin{macrocode} -\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% -\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% -\def\xintNeq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% +\def\xintiiifOne {\romannumeral0\xintiiifone }% +\def\xintiiifone #1% +{% + \if1\xintiiIsOne{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% +\def\xintifOne {\romannumeral0\XINT_signaldeprecated{xint}{xintifOne}\xintifone }% +\def\xintifone #1% +{% + \if1\xintIsOne{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% % \end{macrocode} -% \subsection{\csh{xintiiEq}, \csh{xintiiGt}, \csh{xintiiLt}} -% \lverb|1.1a Pour \xintiiexpr. No lowercase macros.| +% \subsection{\csh{xintiiifOdd}} +% \lverb|1.09e. Restyled in 1.09i. 1.1a adds \xintiiifOdd.| % \begin{macrocode} -\def\xintiiEq #1#2{\romannumeral0\xintiiifeq{#1}{#2}{1}{0}}% -\def\xintiiGt #1#2{\romannumeral0\xintiiifgt{#1}{#2}{1}{0}}% -\def\xintiiLt #1#2{\romannumeral0\xintiiiflt{#1}{#2}{1}{0}}% +\def\xintiiifOdd {\romannumeral0\xintiiifodd }% +\def\xintiiifodd #1% +{% + \if\xintiiOdd{#1}1% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% +\def\xintifOdd {\romannumeral0\XINT_signaldeprecated{xint}{xintifOdd}\xintifodd }% +\def\xintifodd #1% +{% + \if\xintOdd{#1}1% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% % \end{macrocode} -% \subsection{\csh{xintiiNeq}, \csh{xintiiGtorEq}, \csh{xintiiLtorEq}} -% \lverb|1.1a. Pour \xintiiexpr. No lowercase macros.| +% \subsection{\csh{xintifTrueAelseB}, \csh{xintifFalseAelseB}} +% \lverb|1.09i. 1.2i has removed deprecated \xintifTrueFalse, \xintifTrue. +% +% 1.2o uses \xintiiifNotZero, see comments to \xintAND etc... This will work +% fine with arguments being nested xintfrac.sty macros, without the overhead +% of \xintNum or \xintRaw parsing.| % \begin{macrocode} -\def\xintiiLtorEq #1#2{\romannumeral0\xintiiifgt {#1}{#2}{0}{1}}% -\def\xintiiGtorEq #1#2{\romannumeral0\xintiiiflt {#1}{#2}{0}{1}}% -\def\xintiiNeq #1#2{\romannumeral0\xintiiifeq {#1}{#2}{0}{1}}% +\def\xintifTrueAelseB {\romannumeral0\xintiiifnotzero}% +\def\xintifFalseAelseB{\romannumeral0\xintiiifzero}% % \end{macrocode} -% \subsection{\csh{xintIsZero}, \csh{xintIsNotZero}, \csh{xintiiIsZero}, -% \csh{xintiiIsNotZero}} -% \lverb|1.09a. restyled in 1.09i. 1.1 adds \xintiiIsZero, etc... for -% optimization in \xintexpr| +% \subsection{\csh{xintIsTrue}, \csh{xintIsFalse}} +% \lverb|1.09c. Suppressed at 1.2o. They seem not to have been documented, fortunately.| % \begin{macrocode} -\def\xintIsZero {\romannumeral0\xintiszero }% -\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% -\def\xintIsNotZero {\romannumeral0\xintisnotzero }% -\def\xintisnotzero - #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% -\def\xintiiIsZero {\romannumeral0\xintiiiszero }% -\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% -\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }% -\def\xintiiisnotzero - #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +%\let\xintIsTrue \xintIsNotZero +%\let\xintIsFalse\xintIsZero % \end{macrocode} -% \subsection{\csh{xintIsTrue}, \csh{xintNot}, \csh{xintIsFalse}} -% \lverb|1.09c| +% \subsection{\csh{xintNOT}} +% \lverb|1.09c. But it should have been called \xintNOT, not \xintNot. Former +% denomination deprecated at 1.2o. Besides, the macro is now defined as ii-type. +% | % \begin{macrocode} -\let\xintIsTrue\xintIsNotZero -\let\xintNot\xintIsZero -\let\xintIsFalse\xintIsZero +\def\xintNot{\romannumeral0\XINT_signaldeprecated{xint}{xintNot}\xintiiiszero}% +\def\xintNOT{\romannumeral0\xintiiiszero}% % \end{macrocode} % \subsection{\csh{xintAND}, \csh{xintOR}, \csh{xintXOR}} -% \lverb|1.09a. Embarrasing bugs in \xintAND and \xintOR which inserted a space -% token corrected in 1.09i. \xintxor restyled with \if (faster) in 1.09i| +% \lverb|Added with 1.09a. But they used \xintSgn, etc... rather than +% \xintiiSgn. This brings \xintNum overhead which is not really desired, and +% which is not needed for use by xintexpr.sty. At 1.2o I modify them to use +% only ii macros. This is enough for sign or zeroness even for xintfrac +% format, as manipulated inside the \xintexpr. Big hesitation whether there +% should be however \xintiiAND outputting 1 or 0 versus an \xintAND outputting +% 1[0] versus 0[0] for example.| % \begin{macrocode} \def\xintAND {\romannumeral0\xintand }% -\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo +\def\xintand #1#2{\if0\xintiiSgn{#1}\expandafter\xint_firstoftwo \else\expandafter\xint_secondoftwo\fi - { 0}{\xintisnotzero{#2}}}% + { 0}{\xintiiisnotzero{#2}}}% \def\xintOR {\romannumeral0\xintor }% -\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo +\def\xintor #1#2{\if0\xintiiSgn{#1}\expandafter\xint_firstoftwo \else\expandafter\xint_secondoftwo\fi - {\xintisnotzero{#2}}{ 1}}% + {\xintiiisnotzero{#2}}{ 1}}% \def\xintXOR {\romannumeral0\xintxor }% -\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}% +\def\xintxor #1#2{\if\xintiiIsZero{#1}\xintiiIsZero{#2}% \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }% % \end{macrocode} % \subsection{\csh{xintANDof}} % \lverb|New with 1.09a. \xintANDof works also with an empty list. Empty items -% however are not accepted.| -% \lverb|1.2l made \xintANDof robust against non terminated items.| +% however are not accepted. +% +% 1.2l made \xintANDof robust against non terminated items. +% +% 1.2o's \xintifTrueAelseB is now an ii macro, actually. +% +% This macro as well as ORof and XORof are actually not used by xintexpr, +% which has its own csv handling macros.| % \begin{macrocode} \def\xintANDof {\romannumeral0\xintandof }% \def\xintandof #1{\expandafter\XINT_andof_a\romannumeral`&&@#1\xint:}% @@ -21818,8 +22433,9 @@ $1$ or $-1$. % \end{macrocode} % \subsection{\csh{xintORof}} % \lverb|New with 1.09a. Works also with an empty list. Empty items -% however are not accepted.| -% \lverb|1.2l made \xintORof robust against non terminated items.| +% however are not accepted. +% +% 1.2l made \xintORof robust against non terminated items.| % \begin{macrocode} \def\xintORof {\romannumeral0\xintorof }% \def\xintorof #1{\expandafter\XINT_orof_a\romannumeral`&&@#1\xint:}% @@ -21834,8 +22450,9 @@ $1$ or $-1$. % \subsection{\csh{xintXORof}} % \lverb|New with 1.09a. Works with an empty list, too. Empty items % however are not accepted. \XINT_xorof_c more -% efficient in 1.09i.| -% \lverb|1.2l made \xintXORof robust against non terminated items.| +% efficient in 1.09i. +% +% 1.2l made \xintXORof robust against non terminated items.| % \begin{macrocode} \def\xintXORof {\romannumeral0\xintxorof }% \def\xintxorof #1{\expandafter\XINT_xorof_a\expandafter @@ -21850,56 +22467,7 @@ $1$ or $-1$. }% \def\XINT_xorof_e #1!#2{ #2}% % \end{macrocode} -% \subsection{\csh{xintGeq}, \csh{xintiiGeq}} -% \lverb|& -% PLUS GRAND OU ÉGAL -% attention compare les **valeurs absolues** -% -% 1.2l made \xintiiGeq robust against non terminated items. -% -% 1.2l rewrote \xintiiCmp, but forgot to handle \xintiiGeq too. Done at 1.2m. -% | -% \begin{macrocode} -\def\xintGeq {\romannumeral0\xintgeq }% -\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\xint:}% -\def\xintiiGeq {\romannumeral0\xintiigeq }% -\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\xint:}% -\def\XINT_iigeq #1#2\xint:#3% -{% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: -}% -\def\XINT_geq #1#2\xint:#3% -{% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\xint:#2\xint: -}% -\def\XINT_geq_fork #1#2% -{% - \xint_UDzerofork - #1\XINT_geq_firstiszero - #2\XINT_geq_secondiszero - 0{}% - \krof - \xint_UDsignsfork - #1#2\XINT_geq_minusminus - #1-\XINT_geq_minusplus - #2-\XINT_geq_plusminus - --\XINT_geq_plusplus - \krof #1#2% -}% -\def\XINT_geq_firstiszero #1\krof 0#2#3\xint:#4\xint: - {\xint_UDzerofork #2{ 1}0{ 0}\krof }% -\def\XINT_geq_secondiszero #1\krof #20#3\xint:#4\xint:{ 1}% -\def\XINT_geq_plusminus #1-{\XINT_geq_plusplus #1{}}% -\def\XINT_geq_minusplus -#1{\XINT_geq_plusplus {}#1}% -\def\XINT_geq_minusminus --{\XINT_geq_plusplus {}{}}% -\def\XINT_geq_plusplus - {\expandafter\XINT_geq_finish\romannumeral0\XINT_cmp_plusplus}% -\def\XINT_geq_finish #1{\if-#1\expandafter\XINT_geq_no - \else\expandafter\XINT_geq_yes\fi}% -\def\XINT_geq_no 1{ 0}% -\def\XINT_geq_yes { 1}% -% \end{macrocode} -% \subsection{\csh{xintiMax}, \csh{xintiiMax}} +% \subsection{\csh{xintiiMax}} % \lverb|& % At 1.2m, a long-standing bug was fixed: \xintiiMax had the overhead of % applying \xintNum to its arguments due to use of a sub-macro of \xintGeq @@ -21908,7 +22476,7 @@ $1$ or $-1$. % And on this occasion I reduced even more number of times input is grabbed. % | % \begin{macrocode} -\def\xintiMax {\romannumeral0\xintimax }% +\def\xintiMax {\romannumeral0\XINT_signaldeprecated{xint}{xintiMax}\xintimax }% \def\xintimax #1% {% \expandafter\xint_max\romannumeral0\xintnum{#1}\xint: @@ -21976,41 +22544,7 @@ $1$ or $-1$. \unless\if1\romannumeral0\XINT_geq_plusplus{}{}% }% % \end{macrocode} -% \subsection{\csh{xintiMaxof}, \csh{xintiiMaxof}} -% \lverb|New with 1.09a. 1.2 has NO MORE \xintMaxof, requires \xintfracname. -% 1.2a adds \xintiiMaxof, as \xintiiMaxof:csv is not public. -% -% NOT compatible with empty list. -% -% 1.2l made \xintiiMaxof robust against non terminated items.| -% \begin{macrocode} -\def\xintiMaxof {\romannumeral0\xintimaxof }% -\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\xint:}% -\def\XINT_imaxof_a -#1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}!}% -% \end{macrocode} -% \lverb|No \xintnum on #2 which might be \xint:, of course. But if list not -% terminated the \xintNum will be done via \xintimax.| -% \begin{macrocode} -\def\XINT_imaxof_b #1!#2% - {\expandafter\XINT_imaxof_c\romannumeral`&&@#2!{#1}!}% -\def\XINT_imaxof_c #1% - {\xint_gob_til_xint: #1\XINT_imaxof_e\xint:\XINT_imaxof_d #1}% -\def\XINT_imaxof_d #1!% - {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}% -\def\XINT_imaxof_e #1!#2!{ #2}% -\def\xintiiMaxof {\romannumeral0\xintiimaxof }% -\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\xint:}% -\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1!}% -\def\XINT_iimaxof_b #1!#2% - {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2!{#1}!}% -\def\XINT_iimaxof_c #1% - {\xint_gob_til_xint: #1\XINT_iimaxof_e\xint:\XINT_iimaxof_d #1}% -\def\XINT_iimaxof_d #1!% - {\expandafter\XINT_iimaxof_b\romannumeral0\xintiimax {#1}}% -\def\XINT_iimaxof_e #1!#2!{ #2}% -% \end{macrocode} -% \subsection{\csh{xintiMin}, \csh{xintiiMin}} +% \subsection{\csh{xintiiMin}} % \lverb|\xintnum added New with 1.09a. I add \xintiiMin in 1.1 and mark as % deprecated \xintMin, renamed \xintiMin. \xintMin NOW REMOVED (1.2, as % \xintMax, \xintMaxof), only provided by \xintfracnameimp. @@ -22022,7 +22556,7 @@ $1$ or $-1$. % And on this occasion I reduced even more number of times input is grabbed. % | % \begin{macrocode} -\def\xintiMin {\romannumeral0\xintimin }% +\def\xintiMin {\romannumeral0\XINT_signaldeprecated{xint}{xintiMin}\xintimin }% \def\xintimin #1% {% \expandafter\xint_min\romannumeral0\xintnum{#1}\xint: @@ -22074,10 +22608,44 @@ $1$ or $-1$. \unless\if1\romannumeral0\XINT_geq_plusplus{}{}% }% % \end{macrocode} -% \subsection{\csh{xintiMinof}, \csh{xintiiMinof}} +% \subsection{\csh{xintiiMaxof}} +% \lverb|New with 1.09a. 1.2 has NO MORE \xintMaxof, requires \xintfracname. +% 1.2a adds \xintiiMaxof, as \xintiiMaxof:csv is not public. +% +% NOT compatible with empty list. +% +% 1.2l made \xintiiMaxof robust against non terminated items.| +% \begin{macrocode} +\def\xintiMaxof {\romannumeral0\XINT_signaldeprecated{xint}{xintiMaxof}\xintimaxof }% +\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_imaxof_a +#1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}!}% +% \end{macrocode} +% \lverb|No \xintnum on #2 which might be \xint:, of course. But if list not +% terminated the \xintNum will be done via \xintimax.| +% \begin{macrocode} +\def\XINT_imaxof_b #1!#2% + {\expandafter\XINT_imaxof_c\romannumeral`&&@#2!{#1}!}% +\def\XINT_imaxof_c #1% + {\xint_gob_til_xint: #1\XINT_imaxof_e\xint:\XINT_imaxof_d #1}% +\def\XINT_imaxof_d #1!% + {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}% +\def\XINT_imaxof_e #1!#2!{ #2}% +\def\xintiiMaxof {\romannumeral0\xintiimaxof }% +\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1!}% +\def\XINT_iimaxof_b #1!#2% + {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2!{#1}!}% +\def\XINT_iimaxof_c #1% + {\xint_gob_til_xint: #1\XINT_iimaxof_e\xint:\XINT_iimaxof_d #1}% +\def\XINT_iimaxof_d #1!% + {\expandafter\XINT_iimaxof_b\romannumeral0\xintiimax {#1}}% +\def\XINT_iimaxof_e #1!#2!{ #2}% +% \end{macrocode} +% \subsection{\csh{xintiiMinof}} % \lverb|1.09a. 1.2a adds \xintiiMinof which was lacking.| % \begin{macrocode} -\def\xintiMinof {\romannumeral0\xintiminof }% +\def\xintiMinof {\romannumeral0\XINT_signaldeprecated{xint}{xintiMinof}\xintiminof }% \def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral`&&@#1\xint:}% \def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}!}% \def\XINT_iminof_b #1!#2% @@ -22128,345 +22696,7 @@ $1$ or $-1$. {\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork }% \def\XINT_prod_finished\xint:\XINT_prod_loop_c\xint:\xint:#1\xint:\Z { #1}% % \end{macrocode} -% \lverb|& -% & -% -----------------------------------------------------------------$\ -% -----------------------------------------------------------------$\ -% DECIMAL OPERATIONS: FIRST DIGIT, LASTDIGIT, (<- moved to xintcore -% because xintiiLDg needed by division macros) -% ODDNESS, -% MULTIPLICATION BY TEN, QUOTIENT BY TEN, (moved to xintcore 1.2i) -% QUOTIENT OR -% MULTIPLICATION BY POWER OF TEN, SPLIT OPERATION.| -% \subsection{\csh{xintMON}, \csh{xintMMON}, \csh{xintiiMON}, \csh{xintiiMMON}} -% \lverb|& -% MINUS ONE TO THE POWER N and (-1)^{N-1}| -% \begin{macrocode} -\def\xintiiMON {\romannumeral0\xintiimon }% -\def\xintiimon #1% -{% - \ifodd\xintiiLDg {#1} %<- intentional space - \xint_afterfi{ -1}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintiiMMON {\romannumeral0\xintiimmon }% -\def\xintiimmon #1% -{% - \ifodd\xintiiLDg {#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ -1}% - \fi -}% -\def\xintMON {\romannumeral0\xintmon }% -\def\xintmon #1% -{% - \ifodd\xintLDg {#1} %<- intentional space - \xint_afterfi{ -1}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintMMON {\romannumeral0\xintmmon }% -\def\xintmmon #1% -{% - \ifodd\xintLDg {#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ -1}% - \fi -}% -% \end{macrocode} -% \subsection{\csh{xintOdd}, \csh{xintiiOdd}, \csh{xintEven}, \csh{xintiiEven}} -% \begin{macrocode} -\def\xintiiOdd {\romannumeral0\xintiiodd }% -\def\xintiiodd #1% -{% - \ifodd\xintiiLDg{#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ 0}% - \fi -}% -\def\xintiiEven {\romannumeral0\xintiieven }% -\def\xintiieven #1% -{% - \ifodd\xintiiLDg{#1} %<- intentional space - \xint_afterfi{ 0}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintOdd {\romannumeral0\xintodd }% -\def\xintodd #1% -{% - \ifodd\xintLDg{#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ 0}% - \fi -}% -\def\xintEven {\romannumeral0\xinteven }% -\def\xinteven #1% -{% - \ifodd\xintLDg{#1} %<- intentional space - \xint_afterfi{ 0}% - \else - \xint_afterfi{ 1}% - \fi -}% -% \end{macrocode} -% \subsection{\csh{xintDSH}, \csh{xintDSHr}} -% \lverb!DECIMAL SHIFTS \xintDSH {x}{A}$\ -% si x <= 0, fait A -> A.10^(|x|). -% si x > 0, et A >=0, fait A -> quo(A,10^(x))$\ -% si x > 0, et A < 0, fait A -> -quo(-A,10^(x))$\ -% (donc pour x > 0 c'est comme DSR itéré x fois)$\ -% \xintDSHr donne le `reste' (si x<=0 donne zéro). -% -% Badly named macros. -% -% Rewritten for 1.2i, this was old code and \xintDSx has changed interface. -% ! -% \begin{macrocode} -\def\xintDSHr {\romannumeral0\xintdshr }% -\def\xintdshr #1#2% -{% - \expandafter\XINT_dshr_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dshr_fork #1% -{% - \xint_UDzerominusfork - 0#1\XINT_dshr_xzeroorneg - #1-\XINT_dshr_xzeroorneg - 0-\XINT_dshr_xpositive - \krof #1% -}% -\def\XINT_dshr_xzeroorneg #1;{ 0}% -\def\XINT_dshr_xpositive -{% - \expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_dsx_xisPos -}% -\def\xintDSH {\romannumeral0\xintdsh }% -\def\xintdsh #1#2% -{% - \expandafter\XINT_dsh_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dsh_fork #1% -{% - \xint_UDzerominusfork - #1-\XINT_dsh_xiszero - 0#1\XINT_dsx_xisNeg_checkA - 0-{\XINT_dsh_xisPos #1}% - \krof -}% -\def\XINT_dsh_xiszero #1.#2;{ #2}% -\def\XINT_dsh_xisPos -{% - \expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_dsx_xisPos -}% -% \end{macrocode} -% \subsection{\csh{xintDSx}} -% \lverb!& -% --> Attention le cas x=0 est traité dans la même catégorie que x > 0 <--$\ -% si x < 0, fait A -> A.10^(|x|)$\ -% si x >= 0, et A >=0, fait A -> {quo(A,10^(x))}{rem(A,10^(x))}$\ -% si x >= 0, et A < 0, d'abord on calcule {quo(-A,10^(x))}{rem(-A,10^(x))}$\ -% puis, si le premier n'est pas nul on lui donne le signe -$\ -% si le premier est nul on donne le signe - au second. -% -% On peut donc toujours reconstituer l'original A par 10^x Q \pm R -% où il faut prendre le signe plus si Q est positif ou nul et le signe moins si -% Q est strictement négatif. -% -% Rewritten for 1.2i, this was old code. -% -% ! -% \begin{macrocode} -\def\xintDSx {\romannumeral0\xintdsx }% -\def\xintdsx #1#2% -{% - \expandafter\XINT_dsx_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dsx_fork #1% -{% - \xint_UDzerominusfork - #1-\XINT_dsx_xisZero - 0#1\XINT_dsx_xisNeg_checkA - 0-{\XINT_dsx_xisPos #1}% - \krof -}% -\def\XINT_dsx_xisZero #1.#2;{{#2}{0}}% -\def\XINT_dsx_xisNeg_checkA #1.#2% -{% - \xint_gob_til_zero #2\XINT_dsx_xisNeg_Azero 0% - \expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.#2% -}% -\def\XINT_dsx_xisNeg_Azero #1;{ 0}% -\def\XINT_dsx_addzeros #1% - {\expandafter\XINT_dsx_append\romannumeral\XINT_rep#1\endcsname0.}% -\def\XINT_dsx_addzerosnofuss #1% - {\expandafter\XINT_dsx_append\romannumeral\xintreplicate{#1}0.}% -\def\XINT_dsx_append #1.#2;{ #2#1}% -\def\XINT_dsx_xisPos #1.#2% -{% - \xint_UDzerominusfork - #2-\XINT_dsx_AisZero - 0#2\XINT_dsx_AisNeg - 0-\XINT_dsx_AisPos - \krof #1.#2% -}% -\def\XINT_dsx_AisZero #1;{{0}{0}}% -\def\XINT_dsx_AisNeg #1.-#2;% -{% - \expandafter\XINT_dsx_AisNeg_checkiffirstempty - \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% -}% -\def\XINT_dsx_AisNeg_checkiffirstempty #1% -{% - \xint_gob_til_dot #1\XINT_dsx_AisNeg_finish_zero.% - \XINT_dsx_AisNeg_finish_notzero #1% -}% -\def\XINT_dsx_AisNeg_finish_zero.\XINT_dsx_AisNeg_finish_notzero.#1.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {-#1}}{0}% -}% -\def\XINT_dsx_AisNeg_finish_notzero #1.#2.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {#2}}{-#1}% -}% -\def\XINT_dsx_AisPos #1.#2;% -{% - \expandafter\XINT_dsx_AisPos_finish - \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% -}% -\def\XINT_dsx_AisPos_finish #1.#2.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {#2}}% - {\romannumeral0\XINT_num {#1}}% -}% -\def\XINT_dsx_end #1#2{\expandafter{#2}{#1}}% -% \end{macrocode} -% \subsection{\csh{xintDecSplit}, \csh{xintDecSplitL}, \csh{xintDecSplitR}} -% \lverb!DECIMAL SPLIT -% -% The macro \xintDecSplit {x}{A} cuts A which is composed of digits (leading -% zeroes ok, but no sign) (*) into two (each possibly empty) pieces L and R. -% The concatenation LR always reproduces A. -% -% The position of the cut is specified by the first argument x. If x is zero -% or positive the cut location is x slots to the left of the right end of the -% number. If x becomes equal to or larger than the length of the number then L -% becomes empty. If x is negative the location of the cut is |x| slots to the -% right of the left end of the number. -% -% (*) versions earlier than 1.2i first replaced A with its absolute value. -% This is not the case anymore. This macro should NOT be used for A with a -% leading sign (+ or -). -% -% Entirely rewritten for 1.2i (2016/12/11). -% -% Attention: \xintDecSplit not robust against non terminated second argument. -% ! -% \begin{macrocode} -\def\xintDecSplit {\romannumeral0\xintdecsplit }% -\def\xintdecsplit #1#2% -{% - \expandafter\XINT_split_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\xintDecSplitL {\romannumeral0\xintdecsplitl }% -\def\xintdecsplitl #1#2% -{% - \expandafter\XINT_splitl_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\xintDecSplitR {\romannumeral0\xintdecsplitr }% -\def\xintdecsplitr #1#2% -{% - \expandafter\XINT_splitr_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\XINT_split_finish #1.#2.{{#1}{#2}}% -\def\XINT_splitl_finish #1.#2.{ #1}% -\def\XINT_splitr_finish #1.#2.{ #2}% -\def\XINT_split_xfork #1% -{% - \xint_UDzerominusfork - #1-\XINT_split_zerosplit - 0#1\XINT_split_fromleft - 0-{\XINT_split_fromright #1}% - \krof -}% -\def\XINT_split_zerosplit .#1\xint_bye#2\xint_bye..{ #1..}% -\def\XINT_split_fromleft - {\expandafter\XINT_split_fromleft_a\the\numexpr\xint_c_viii-}% -\def\XINT_split_fromleft_a #1% -{% - \xint_UDsignfork - #1\XINT_split_fromleft_b - -{\XINT_split_fromleft_end_a #1}% - \krof -}% -\def\XINT_split_fromleft_b #1.#2#3#4#5#6#7#8#9% -{% - \expandafter\XINT_split_fromleft_clean - \the\numexpr1#2#3#4#5#6#7#8#9\expandafter - \XINT_split_fromleft_a\the\numexpr\xint_c_viii-#1.% -}% -\def\XINT_split_fromleft_end_a #1.% -{% - \expandafter\XINT_split_fromleft_clean - \the\numexpr1\csname XINT_split_fromleft_end#1\endcsname -}% -\def\XINT_split_fromleft_clean 1{ }% -\expandafter\def\csname XINT_split_fromleft_end7\endcsname #1% - {#1\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end6\endcsname #1#2% - {#1#2\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end5\endcsname #1#2#3% - {#1#2#3\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end4\endcsname #1#2#3#4% - {#1#2#3#4\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end3\endcsname #1#2#3#4#5% - {#1#2#3#4#5\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end2\endcsname #1#2#3#4#5#6% - {#1#2#3#4#5#6\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end1\endcsname #1#2#3#4#5#6#7% - {#1#2#3#4#5#6#7\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end0\endcsname #1#2#3#4#5#6#7#8% - {#1#2#3#4#5#6#7#8\XINT_split_fromleft_end_b}% -\def\XINT_split_fromleft_end_b #1\xint_bye#2\xint_bye.{.#1}% puis . -\def\XINT_split_fromright #1.#2\xint_bye -{% - \expandafter\XINT_split_fromright_a - \the\numexpr#1-\numexpr\XINT_length_loop - #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: - \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% -{% - \xint_UDsignfork - #1\XINT_split_fromleft - -\XINT_split_fromright_Lempty - \krof -}% -\def\XINT_split_fromright_Lempty #1.#2\xint_bye#3..{.#2.}% -% \end{macrocode} -% \subsection{\csh{xintiiSqrt}, \csh{xintiiSqrtR}, \csh{xintiiSquareRoot}} +% \subsection{\csh{xintiiSquareRoot}} % \lverb|First done with 1.08. % % 1.1 added \xintiiSquareRoot. @@ -22505,24 +22735,8 @@ $1$ or $-1$. % | % % \begin{macrocode} -\def\xintiiSqrt {\romannumeral0\xintiisqrt }% -\def\xintiiSqrtR {\romannumeral0\xintiisqrtr }% \def\xintiiSquareRoot {\romannumeral0\xintiisquareroot }% -\def\xintiSqrt {\romannumeral0\xintisqrt }% -\def\xintiSqrtR {\romannumeral0\xintisqrtr }% -\def\xintiSquareRoot {\romannumeral0\xintisquareroot }% -\def\xintisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }% -\def\xintisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintisquareroot }% -\def\xintiisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }% -\def\xintiisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintiisquareroot }% -\def\XINT_sqrt_post #1#2{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}% -% \end{macrocode} -% \lverb|N = (#1)^2 - #2 avec #1 le plus petit possible et #2>0 (hence #2<2*#1). -% (#1-.5)^2=#1^2-#1+.25=N+#2-#1+.25. Si 0<#2<#1, <= N-0.75<N, donc rounded->#1 -% si #2>=#1, (#1-.5)^2>=N+.25>N, donc rounded->#1-1.| -% \begin{macrocode} -\def\XINT_sqrtr_post #1#2{\xintiiifLt {#2}{#1}% - { #1}{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}}% +\def\xintiSquareRoot{\romannumeral0\XINT_signaldeprecated{xint}{xintiSquareRoot}\xintisquareroot}% \def\xintisquareroot #1% {\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\xint:}% \def\xintiisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral`&&@#1\xint:}% @@ -22557,14 +22771,26 @@ $1$ or $-1$. \fi #1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_bE #1.#2#3#4% {% \XINT_sqrt_c {#3#4}#2{#1}#3#4% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_bO #1.#2#3% {% \XINT_sqrt_c #3#2{#1}#3% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_c #1#2% {% \expandafter #2% @@ -22576,16 +22802,28 @@ $1$ or $-1$. 10\else 9\fi \else 8\fi \else 7\fi \else 6\fi \else 5\fi \else 4\fi \else 3\fi \else 2\fi \else 1\fi .% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_d #1.#2% {% \expandafter\XINT_sqrt_small_e \the\numexpr #1\ifcase \numexpr #2/\xint_c_ii-\xint_c_i\relax \or 0\or 00\or 000\or 0000\fi .% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_e #1.#2.% {% \expandafter\XINT_sqrt_small_ea\the\numexpr #1*#1-#2.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_ea #1% {% \if0#1\xint_dothis\XINT_sqrt_small_ez\fi @@ -22594,21 +22832,37 @@ $1$ or $-1$. }% \def\XINT_sqrt_small_ez 0.#1.{\expandafter{\the\numexpr#1+\xint_c_i \expandafter}\expandafter{\the\numexpr #1*\xint_c_ii+\xint_c_i}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_eb -#1.#2.% {% \expandafter\XINT_sqrt_small_ec \the\numexpr (#1-\xint_c_i+#2)/(\xint_c_ii*#2).#1.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_ec #1.#2.#3.% {% \expandafter\XINT_sqrt_small_f \the\numexpr -#2+\xint_c_ii*#3*#1+#1*#1\expandafter.\the\numexpr #3+#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_f #1.#2.% {% \expandafter\XINT_sqrt_small_g \the\numexpr (#1+#2)/(\xint_c_ii*#2)-\xint_c_i.#1.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_g #1#2.% {% \if 0#1% @@ -22618,6 +22872,10 @@ $1$ or $-1$. \fi #1#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_small_h #1.#2.#3.% {% \expandafter\XINT_sqrt_small_f @@ -22625,21 +22883,41 @@ $1$ or $-1$. \the\numexpr #3-#1.% }% \def\XINT_sqrt_small_end #1.#2.#3.{{#3}{#2}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_d #1.#2% {% \ifodd #2 \xint_dothis{\expandafter\XINT_sqrt_big_eO}\fi \xint_orthat{\expandafter\XINT_sqrt_big_eE}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \the\numexpr (#2-\xint_c_i)/\xint_c_ii.#1;% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_eE #1;#2#3#4#5#6#7#8#9% {% \XINT_sqrt_big_eE_a #1;{#2#3#4#5#6#7#8#9}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_eE_a #1.#2;#3% {% \expandafter\XINT_sqrt_bigormed_f \romannumeral0\XINT_sqrt_small_e #2000.#3.#1;% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_eO #1;#2#3#4#5#6#7#8#9% {% \XINT_sqrt_big_eO_a #1;{#2#3#4#5#6#7#8#9}% @@ -22649,6 +22927,10 @@ $1$ or $-1$. \expandafter\XINT_sqrt_bigormed_f \romannumeral0\XINT_sqrt_small_e #20000.#3#4.#1;% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_bigormed_f #1#2#3;% {% \ifnum#3<\xint_c_ix @@ -22660,28 +22942,48 @@ $1$ or $-1$. \def\XINT_sqrt_med_fvi {\XINT_sqrt_med_fa 0.}% \def\XINT_sqrt_med_fvii {\XINT_sqrt_med_fa 00.}% \def\XINT_sqrt_med_fviii{\XINT_sqrt_med_fa 000.}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_med_fa #1.#2.#3.#4;% {% \expandafter\XINT_sqrt_med_fb \the\numexpr (#30#1-5#1)/(\xint_c_ii*#2).#1.#2.#3.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_med_fb #1.#2.#3.#4.#5.% {% \expandafter\XINT_sqrt_small_ea \the\numexpr (#40#2-\xint_c_ii*#3*#1)*10#2+(#1*#1-#5)\expandafter.% \the\numexpr #30#2-#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_f #1;#2#3#4#5#6#7#8#9% {% \XINT_sqrt_big_fa #1;{#2#3#4#5#6#7#8#9}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_fa #1.#2.#3;#4% {% \expandafter\XINT_sqrt_big_ga \the\numexpr #3-\xint_c_viii\expandafter.% \romannumeral0\XINT_sqrt_med_fa 000.#1.#2.;#4.% }% +% \end{macrocode} +% \lverb|& % +% | +% \begin{macrocode} \def\XINT_sqrt_big_ga #1.#2#3% {% \ifnum #1>\xint_c_viii @@ -22689,12 +22991,20 @@ $1$ or $-1$. \expandafter\XINT_sqrt_big_ka \fi #1.#3.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gb #1.#2.#3.% {% \expandafter\XINT_sqrt_big_gc \the\numexpr (\xint_c_ii*#2-\xint_c_i)*\xint_c_x^viii/(\xint_c_iv*#3).% #3.#2.#1;% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gc #1.#2.#3.% {% \expandafter\XINT_sqrt_big_gd @@ -22703,14 +23013,26 @@ $1$ or $-1$. {\xintiiSqr {#1}}.% \romannumeral0\xintiisub{#200000000}{#1}.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gd #1.#2.% {% \expandafter\XINT_sqrt_big_ge #2.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_ge #1;#2#3#4#5#6#7#8#9% {\XINT_sqrt_big_gf #1.#2#3#4#5#6#7#8#9;}% \def\XINT_sqrt_big_gf #1;#2#3#4#5#6#7#8#9% {\XINT_sqrt_big_gg #1#2#3#4#5#6#7#8#9.}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gg #1.#2.#3.#4.% {% \expandafter\XINT_sqrt_big_gloop @@ -22718,15 +23040,27 @@ $1$ or $-1$. \the\numexpr #3-\xint_c_viii\expandafter.% \romannumeral0\xintiisub {#2}{\xintiNum{#4}}.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gloop #1.#2.% {% \unless\ifnum #1<#2 \xint_dothis\XINT_sqrt_big_ka \fi \xint_orthat{\XINT_sqrt_big_gi #1.}#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gi #1.% {% \expandafter\XINT_sqrt_big_gj\romannumeral\xintreplicate{#1}0.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gj #1.#2.#3.#4.#5.% {% \expandafter\XINT_sqrt_big_gk @@ -22734,22 +23068,42 @@ $1$ or $-1$. {\XINT_dbl #5\xint_bye2345678\xint_bye*\xint_c_ii\relax}.% #1.#5.#2.#3.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gk #1#2.#3.#4.% {% \expandafter\XINT_sqrt_big_gl \romannumeral0\xintiiadd {#2#3}{\xintiiSqr{#1}}.% \romannumeral0\xintiisub {#4#3}{#1}.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gl #1.#2.% {% \expandafter\XINT_sqrt_big_gm #2.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gm #1.#2.#3.#4.#5.% {% \expandafter\XINT_sqrt_big_gn +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral0\XINT_split_fromleft\xint_c_ii*#3.#5\xint_bye2345678\xint_bye..% #1.#2.#3.#4.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_gn #1.#2.#3.#4.#5.#6.% {% \expandafter\XINT_sqrt_big_gloop @@ -22757,9 +23111,17 @@ $1$ or $-1$. \the\numexpr #6-#5\expandafter.% \romannumeral0\xintiisub{#4}{\xintiNum{#1}}.#3.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_ka #1.#2.#3.#4.% {% \expandafter\XINT_sqrt_big_kb +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral0\XINT_dsx_addzeros {#1}#3;.% \romannumeral0\xintiisub {\XINT_dsx_addzerosnofuss {\xint_c_ii*#1}#2;}% @@ -22769,6 +23131,10 @@ $1$ or $-1$. {% \expandafter\XINT_sqrt_big_kc #2.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_kc #1% {% \if0#1\xint_dothis\XINT_sqrt_big_kz\fi @@ -22784,12 +23150,20 @@ $1$ or $-1$. {% \expandafter{\romannumeral0\xintinc{#2}}{#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_kloop #1.#2.% {% \expandafter\XINT_sqrt_big_ke \romannumeral0\xintiidivision{#1}% {\romannumeral0\XINT_dbl #2\xint_bye2345678\xint_bye*\xint_c_ii\relax}{#2}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_ke #1% {% \if0\XINT_Sgn #1\xint: @@ -22797,6 +23171,10 @@ $1$ or $-1$. \else \expandafter \XINT_sqrt_big_kf \fi {#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_kf #1#2#3% {% \expandafter\XINT_sqrt_big_kg @@ -22807,9 +23185,32 @@ $1$ or $-1$. {% \expandafter\XINT_sqrt_big_kloop #2.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_sqrt_big_end #1#2#3{{#3}{#2}}% % \end{macrocode} -% \subsection{\csh{xintiiBinomial}, \csh{xintiBinomial}} +% \subsection{\csh{xintiiSqrt}, \csh{xintiiSqrtR}} +% \begin{macrocode} +\def\xintiiSqrt {\romannumeral0\xintiisqrt }% +\def\xintiisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }% +\def\XINT_sqrt_post #1#2{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}% +\def\xintiiSqrtR {\romannumeral0\xintiisqrtr }% +\def\xintiisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintiisquareroot }% +% \end{macrocode} +% \lverb|N = (#1)^2 - #2 avec #1 le plus petit possible et #2>0 (hence #2<2*#1). +% (#1-.5)^2=#1^2-#1+.25=N+#2-#1+.25. Si 0<#2<#1, <= N-0.75<N, donc rounded->#1 +% si #2>=#1, (#1-.5)^2>=N+.25>N, donc rounded->#1-1.| +% \begin{macrocode} +\def\XINT_sqrtr_post #1#2% + {\xintiiifLt {#2}{#1}{ #1}{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}}% +\def\xintiSqrt {\romannumeral0\XINT_signaldeprecated{xint}{xintiSqrt}\xintisqrt}% +\def\xintisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }% +\def\xintiSqrtR{\romannumeral0\XINT_signaldeprecated{xint}{xintiSqrtr}\xintisqrtr}% +\def\xintisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintisquareroot }% +% \end{macrocode} +% \subsection{\csh{xintiiBinomial}} % \lverb|2015/11/28-29 for 1.2f. % % 2016/11/19 for 1.2h: I truly can't understand why I hard-coded last @@ -22817,7 +23218,11 @@ $1$ or $-1$. % formula. Naturally there should be no error but a rather a 0 return % value for binomial(x,y), if y<0 or x<y ! % -% I really lack some kind of infinity or NaN value.| +% I really lack some kind of infinity or NaN value. +% +% 1.2o deprecates \xintiBinomial. (which xintfrac.sty redefined to use +% \xintNum) +% | % \begin{macrocode} \def\xintiiBinomial {\romannumeral0\xintiibinomial }% \def\xintiibinomial #1#2% @@ -22828,7 +23233,7 @@ $1$ or $-1$. {% \expandafter\XINT_binom_fork \the\numexpr#1-#2.#2.#1.% }% -\def\xintiBinomial{\romannumeral0\xintibinomial}% +\def\xintiBinomial{\romannumeral0\XINT_signaldeprecated{xint}{xintiBinomial}\xintibinomial}% \let\xintibinomial\xintiibinomial % \end{macrocode} % \lverb|k.x-k.x. I hesitated to restrict maximal allowed value of x to 10000. @@ -23141,7 +23546,7 @@ $1$ or $-1$. \def\XINT_binom_vsmallfinish1##1!1!;!0!{\expandafter#1\the\numexpr##1\relax}% }\XINT_binom_vsmallfinish{ }% % \end{macrocode} -% \subsection{\csh{xintiiPFactorial}, \csh{xintiPFactorial}} +% \subsection{\csh{xintiiPFactorial}} % \lverb?2015/11/29 for 1.2f. Partial factorial pfac(a,b)=(a+1)...b, only for % non-negative integers with a<=b<10^8. % @@ -23158,8 +23563,10 @@ $1$ or $-1$. {% \expandafter\XINT_pfac_fork\the\numexpr#1\expandafter.\the\numexpr #2.% }% -\def\xintiPFactorial{\romannumeral0\xintipfactorial}% +\def\xintiPFactorial{\romannumeral0\XINT_signaldeprecated{xint}{xintiPFactorial}\xintipfactorial}% \let\xintipfactorial\xintiipfactorial +\def\xintPFactorial{\romannumeral0\xintpfactorial}% +\let\xintpfactorial\xintiipfactorial % \end{macrocode} % \lverb|Code is a simplified version of the one for \xintiiBinomial, with no % attempt at implementing a "very small" branch.| @@ -23301,37 +23708,62 @@ $1$ or $-1$. \the\numexpr\expandafter\XINT_smallmul\the\numexpr \xint_c_x^viii+#1!% }% % \end{macrocode} -% \subsection{\csh{xintiiE}} -% \lverb|Originally was used in \xintiiexpr. Transferred from xintfrac for -% 1.1. -% Code rewritten for 1.2i.| +% \subsection{\csh{xintBool}, \csh{xintToggle}} +% \lverb|1.09c| % \begin{macrocode} -\def\xintiiE {\romannumeral0\xintiie }% used in \xintMod. -\def\xintiie #1#2% - {\expandafter\XINT_iie_fork\the\numexpr #2\expandafter.\romannumeral`&&@#1;}% -\def\XINT_iie_fork #1% -{% - \xint_UDsignfork - #1\XINT_iie_neg - -\XINT_iie_a - \krof #1% -}% -\def\XINT_iie_a #1.% - {\expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.}% -\def\XINT_iie_neg #1.#2;{ #2}% +\def\xintBool #1{\romannumeral`&&@% + \csname if#1\endcsname\expandafter1\else\expandafter0\fi }% +\def\xintToggle #1{\romannumeral`&&@\iftoggle{#1}{1}{0}}% % \end{macrocode} -% \subsection*{``Load \xintfracnameimp'' macros} -% \addcontentsline{toc}{subsection}{``Load \xintfracnameimp'' macros} -% \lverb|Originally was used in \xintiiexpr. Transferred from xintfrac for 1.1.| -% \begin{macrocode} -\catcode`! 11 -\def\xintMax {\Did_you_mean_iiMax?or_load_xintfrac!}% -\def\xintMin {\Did_you_mean_iiMin?or_load_xintfrac!}% -\def\xintMaxof {\Did_you_mean_iMaxof?or_load_xintfrac!}% -\def\xintMinof {\Did_you_mean_iMinof?or_load_xintfrac!}% -\def\xintSum {\Did_you_mean_iiSum?or_load_xintfrac!}% -\def\xintPrd {\Did_you_mean_iiPrd?or_load_xintfrac!}% -\catcode`! 12 +% \subsection*{At End of \LaTeX\ Document deprecation message} +% \addcontentsline{toc}{subsection}{At End of \LaTeX\ Document deprecation message} +% \lverb|1.2o| +% \begin{macrocode} +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xint}% + {\PackageError{xint} +{Usage of deprecated macros!} +{These deprecated macros from xint.sty have been detected:\MessageBreak +\XINT_useiimessage{xintEq}% +\XINT_useiimessage{xintGeq}% +\XINT_useiimessage{xintGt}% +\XINT_useiimessage{xintLt}% +\XINT_useiimessage{xintGtorEq}% +\XINT_useiimessage{xintLtorEq}% +\XINT_useiimessage{xintIsZero}% +\XINT_useiimessage{xintIsNotZero}% +\XINT_useiimessage{xintIsOne}% +\XINT_useiimessage{xintOdd}% +\XINT_useiimessage{xintEven}% +\XINT_useiimessage{xintifSgn}% +\XINT_useiimessage{xintifCmp}% +\XINT_useiimessage{xintifEq}% +\XINT_useiimessage{xintifGt}% +\XINT_useiimessage{xintifLt}% +\XINT_useiimessage{xintifZero}% +\XINT_useiimessage{xintifNotZero}% +\XINT_useiimessage{xintifOne}% +\XINT_useiimessage{xintifOdd}% +\XINT_ifFlagRaised{xintNeq}% + {\string\xintNeq\space(use \string\xintiiNotEq\space or \string\xintNotEq\space from xintfrac!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintNot}% + {\string\xintNot\space(renamed to \string\xintNOT!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintMON}{\string\xintMON\MessageBreak}{}% +\XINT_ifFlagRaised{xintMMON}{\string\xintMMON\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMax}{\string\xintiMax\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMin}{\string\xintiMin\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMaxof}{\string\xintiMaxof\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMinof}{\string\xintiMinof\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSquareRoot}{\string\xintiSquareRoot\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqrt}{\string\xintiSqrt\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqrtR}{\string\xintiSqrtR\MessageBreak}{}% +\XINT_ifFlagRaised{xintiBinomial}{\string\xintiBinomial\MessageBreak}{}% +\XINT_ifFlagRaised{xintiPFactorial}{\string\xintiPFactorial\MessageBreak}{}% +They will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi \XINT_restorecatcodes_endinput% % \end{macrocode} % @@ -23418,7 +23850,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintbinhex}% - [2017/08/06 1.2n Expandable binary and hexadecimal conversions (JFB)]% + [2017/08/29 1.2o Expandable binary and hexadecimal conversions (JFB)]% % \end{macrocode} % \subsection{Constants, etc...} % \lverb|1.2n switches to \csname-governed expansion at various places.| @@ -23491,39 +23923,12 @@ $1$ or $-1$. {\XINT_zeroes_foriv_done #1}% \def\XINT_zeroes_foriv_done #1\R{ #1}% % \end{macrocode} -% \subsubsection{\csh{XINT_unsepb_loop}} -% -% \lverb|This is used as -%( \the\numexpr0\XINT_unsepb_loop (blocks of digits with ! as separator)% -%: \xint_bye!2!3!4!5!6!7!8!9!\xint_bye\xint_c_i\relax -%) -% It removes the !'s and outputs the digits (being careful not to suppress -% leading zeroes) with a 0 prefix to remove later. Each block is allowed up to -% nine digits. -% -% This is the same as \XINT_unsep_loop from xintcore.sty except that the -% digits blocks have no 1-prefix. Was done for \xintHexToDec at 1.2m.| -% \begin{macrocode} -\def\XINT_unsepb_loop #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_unsep_clean - \the\numexpr 1#1\expandafter\XINT_unsep_clean - \the\numexpr 1#2\expandafter\XINT_unsep_clean - \the\numexpr 1#3\expandafter\XINT_unsep_clean - \the\numexpr 1#4\expandafter\XINT_unsep_clean - \the\numexpr 1#5\expandafter\XINT_unsep_clean - \the\numexpr 1#6\expandafter\XINT_unsep_clean - \the\numexpr 1#7\expandafter\XINT_unsep_clean - \the\numexpr 1#8\expandafter\XINT_unsep_clean - \the\numexpr 1#9\XINT_unsepb_loop -}% -\def\XINT_unsep_clean 1{\relax}% also in xintcore -% \end{macrocode} % \subsection{\csh{xintDecToHex}} % \lverb|Complete rewrite at 1.2m in the 1.2 style. Also, 1.2m is robust % against non terminated inputs. % -% Improvements of coding at 1.2n, increased maximal size. +% Improvements of coding at 1.2n, increased maximal size. Again some coding +% improvement at 1.2o, about 6$% speed gain. % % An input without leading zeroes gives an output without leading zeroes.| % \begin{macrocode} @@ -23558,9 +23963,21 @@ $1$ or $-1$. \expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_update \the\numexpr#1#2#3#4% \xint_bye#9\XINT_dthb_lastpass\xint_bye - #5#6#7#8!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #9% + #5#6#7#8!\XINT_dthb_exclam\relax\XINT_dthb_nextfour #9% }% -\def\XINT_dthb_exclam {!\XINT_dthb_exclam!}% +% \end{macrocode} +% \lverb|The 1.2n inserted +% exclamations marks, which when bumping back from \XINT_dthb_again gave rise +% to a \numexpr-loop which gathered the ! delimited arguments and inserted +% \expandafter\XINT_dthb_update\the\numexpr dynamically. The 1.2o trick is to +% insert it here immediately. Then at \XINT_dthb_again the \numexpr will +% trigger an already prepared chain. +% +% The crux of the thing is handling of #3 at \XINT_dthb_update_a. +% | +% \begin{macrocode} +\def\XINT_dthb_exclam {!\XINT_dthb_exclam\relax + \expandafter\XINT_dthb_update\the\numexpr}% \def\XINT_dthb_update #1!% {% \expandafter\XINT_dthb_update_a @@ -23571,10 +23988,16 @@ $1$ or $-1$. {% 0000+#1\expandafter#3\the\numexpr#2-#1*\xint_c_ii^xvi }% -\def\XINT_dthb_nextfour #1\Z #2#3#4#5#6% +% \end{macrocode} +% \lverb|1.2m and 1.2n had some unduly complicated ending pattern for +% \XINT_dthb_nextfour as inheritance of a loop needing ! separators which was +% pruned out at 1.2o (see previous comment). +% | +% \begin{macrocode} +\def\XINT_dthb_nextfour #1#2#3#4#5% {% - \xint_bye#6\XINT_dthb_lastpass\xint_bye - #2#3#4#5!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #6% + \xint_bye#5\XINT_dthb_lastpass\xint_bye + #1#2#3#4!\XINT_dthb_exclam\relax\XINT_dthb_nextfour#5% }% \def\XINT_dthb_lastpass\xint_bye #1!#2\xint_bye#3{#1!#3!}% \def\XINT_dth_tohex @@ -23582,28 +24005,18 @@ $1$ or $-1$. \expandafter\expandafter\expandafter\XINT_dth_tohex_a\csname\XINT_tofourhex }% \def\XINT_dth_tohex_a\endcsname{!\XINT_dth_tohex!}% -\def\XINT_dthb_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_dthb_update - \the\numexpr #1\expandafter\XINT_dthb_update - \the\numexpr #2\expandafter\XINT_dthb_update - \the\numexpr #3\expandafter\XINT_dthb_update - \the\numexpr #4\expandafter\XINT_dthb_update - \the\numexpr #5\expandafter\XINT_dthb_update - \the\numexpr #6\expandafter\XINT_dthb_update - \the\numexpr #7\expandafter\XINT_dthb_update - \the\numexpr #8\expandafter\XINT_dthb_update - \the\numexpr #9\XINT_dthb_a -}% -\def\XINT_dthb_again #1!#2!% +\def\XINT_dthb_again #1!#2#3% {% - \ifx\XINT_dthb_exclam#2% + \ifx#3\relax \expandafter\xint_firstoftwo \else \expandafter\xint_secondoftwo \fi - {\expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_a - \romannumeral`&&@\ifnum #1>\xint_c_ \xint_dothis{#1!}\fi\xint_orthat{}}% + {\expandafter\XINT_dthb_again + \the\numexpr + \ifnum #1>\xint_c_ + \xint_afterfi{\expandafter\XINT_dthb_update\the\numexpr#1}% + \fi}% {\ifnum #1>\xint_c_ \xint_dothis{#2#1!}\fi\xint_orthat{!#2!}}% }% \def\XINT_tofourhex #1!% @@ -24086,7 +24499,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintgcd}% - [2017/08/06 1.2n Euclide algorithm with xint package (JFB)]% + [2017/08/29 1.2o Euclide algorithm with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintGCD}, \csh{xintiiGCD}} % \begin{macrocode} @@ -24753,7 +25166,36 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintfrac}% - [2017/08/06 1.2n Expandable operations on fractions (JFB)]% + [2017/08/29 1.2o Expandable operations on fractions (JFB)]% +% \end{macrocode} +% \subsection{Macros now deprecated in \xintcorenameimp or \xintnameimp} +% \lverb|1.2o| +% \begin{macrocode} +\def\xintSgn {\romannumeral0\xintsgn }% deprecated from xintcore +\def\xintCmp {\romannumeral0\xintcmp }% deprecated from xintcore +\def\xintEq {\romannumeral0\xinteq }% deprecated from xint +\def\xintNeq #1#2% renamed into \xintNotEq + {\romannumeral0\XINT_signaldeprecated{xintfrac}{xintNeq}\xintifeq {#1}{#2}{0}{1}}% +\def\xintNotEq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% +%\def\xintGeq {\romannumeral0\xintgeq }% further down +\def\xintGt {\romannumeral0\xintgt }% +\def\xintLt {\romannumeral0\xintlt }% +\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% +\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% +\def\xintIsZero {\romannumeral0\xintiszero }% +\def\xintIsNotZero{\romannumeral0\xintisnotzero }% +\def\xintIsOne {\romannumeral0\xintisone }% +\def\xintOdd {\romannumeral0\xintodd }% +\def\xintEven {\romannumeral0\xinteven }% +\def\xintifSgn{\romannumeral0\xintifsgn }% +\def\xintifCmp{\romannumeral0\xintifcmp }% +\def\xintifEq {\romannumeral0\xintifeq }% +\def\xintifGt {\romannumeral0\xintifgt }% +\def\xintifLt {\romannumeral0\xintiflt }% +\def\xintifZero {\romannumeral0\xintifzero }% +\def\xintifNotZero{\romannumeral0\xintifnotzero }% +\def\xintifOne {\romannumeral0\xintifone }% +\def\xintifOdd {\romannumeral0\xintifodd }% % \end{macrocode} % \subsection{\csh{XINT_cntSgnFork}} % \lverb|1.09i. Used internally, #1 must expand to \m@ne, \z@, or \@ne or @@ -24781,6 +25223,10 @@ $1$ or $-1$. \def\XINT_flen#1{\def\XINT_flen ##1##2##3% {% \expandafter#1% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \the\numexpr \XINT_abs##1+% \XINT_len_fork ##2##3\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v @@ -25015,10 +25461,18 @@ $1$ or $-1$. \def\XINT_frac_gen_Cc #1.#2~#3!#4e#5e#6\XINT_T {% \expandafter\XINT_frac_gen_F\the\numexpr #5-#2-% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \numexpr\XINT_length_loop #1\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \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 +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \relax\expandafter~% \romannumeral0\expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop #3\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z @@ -25199,6 +25653,10 @@ $1$ or $-1$. {% \expandafter\XINT_rawz_fork\romannumeral0\XINT_infrac }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_rawz_fork #1% {% \ifnum#1<\xint_c_ @@ -25263,6 +25721,10 @@ $1$ or $-1$. }% \def\XINT_denom_fork #1% {% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \ifnum#1<\xint_c_ \expandafter\XINT_denom_B \else @@ -25640,8 +26102,16 @@ $1$ or $-1$. \xint_orthat\XINT_trunc_b #1+#4.{#2}{#3}#5#4.% }% \def\XINT_trunc_zero #1.#2.{ 0}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_trunc_b {\expandafter\XINT_trunc_B\the\numexpr}% \def\XINT_trunc_sp_b {\expandafter\XINT_trunc_sp_B\the\numexpr}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_trunc_B #1% {% \xint_UDsignfork @@ -25649,6 +26119,10 @@ $1$ or $-1$. -\XINT_trunc_D \krof #1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_trunc_sp_B #1% {% \xint_UDsignfork @@ -25656,12 +26130,20 @@ $1$ or $-1$. -\XINT_trunc_sp_D \krof #1% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_trunc_C -#1.#2#3% {% \expandafter\XINT_trunc_CE \romannumeral0\XINT_dsx_addzeros{#1}#3;.{#2}% }% \def\XINT_trunc_CE #1.#2{\XINT_trunc_E #2.{#1}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_trunc_sp_C -#1.#2#3{\XINT_trunc_sp_Ca #2.#1.}% \def\XINT_trunc_sp_Ca #1% {% @@ -25673,6 +26155,10 @@ $1$ or $-1$. \def\XINT_trunc_sp_Cb #1#2.#3.% {% \expandafter\XINT_trunc_sp_Cc +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral0\expandafter\XINT_split_fromright_a \the\numexpr#3-\numexpr\XINT_length_loop #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: @@ -25680,6 +26166,10 @@ $1$ or $-1$. \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye .#2\xint_bye2345678\xint_bye..#1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_trunc_sp_Cc #1% {% \if.#1\xint_dothis{\XINT_trunc_sp_Cd 0.}\fi @@ -25736,6 +26226,10 @@ $1$ or $-1$. \def\XINT_trunc_Hb #1#2#3% {% \expandafter #3\expandafter0\expandafter.% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral\xintreplicate{#1}0#2% }% % \end{macrocode} @@ -25749,7 +26243,6 @@ $1$ or $-1$. % \end{macrocode} % \subsection{\csh{xintNum}} % \begin{macrocode} -\let\xintNum \xintTTrunc \let\xintnum \xintttrunc % \end{macrocode} % \subsection{\csh{xintRound}, \csh{xintiRound}} @@ -25805,7 +26298,15 @@ $1$ or $-1$. {% \expandafter\XINT_xtrunc_b\the\numexpr\ifnum#1<\xint_c_i \xint_c_i-\fi #1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_b #1.#2{\XINT_xtrunc_c #2{#1}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_c #1% {% \xint_UDzerominusfork @@ -25815,6 +26316,10 @@ $1$ or $-1$. \krof }%[ \def\XINT_xtrunc_zero #1#2]{0.\romannumeral\xintreplicate{#1}0}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_d #1#2#3/#4[#5]% {% \XINT_xtrunc_prepare_a#4\R\R\R\R\R\R\R\R {10}0000001\W @@ -25838,6 +26343,10 @@ $1$ or $-1$. \or\expandafter\XINT_xtrunc_BisEight \fi\XINT_xtrunc_BisSmall {#2}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_BisOne\XINT_xtrunc_BisSmall #1#2#3#4% {\XINT_xtrunc_sp_e {#2}{#4}{#3}}% \def\XINT_xtrunc_BisTwo\XINT_xtrunc_BisSmall #1#2#3#4% @@ -25871,6 +26380,10 @@ $1$ or $-1$. \the\numexpr #1/\xint_c_ii\expandafter .\the\numexpr \xint_c_x^viii+#1!}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_small_a #1.#2!#3% {% \expandafter\XINT_div_small_b\the\numexpr #1\expandafter @@ -25878,6 +26391,10 @@ $1$ or $-1$. \romannumeral0\XINT_div_small_ba #3\R\R\R\R\R\R\R\R{10}0000001\W #3\XINT_sepbyviii_Z_end 2345678\relax }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_prepare_b {\expandafter\XINT_xtrunc_prepare_c\romannumeral0\XINT_zeroes_forviii }% \def\XINT_xtrunc_prepare_c #1!% @@ -25907,7 +26424,15 @@ $1$ or $-1$. \R\xint:\xint_c_iv \R\xint:\xint_c_ii \R\xint:\xint_c_\W \X }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_prepare_g #1;{\XINT_xtrunc_e {#1}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_e #1#2% {% \ifnum #2<\xint_c_ @@ -25916,14 +26441,26 @@ $1$ or $-1$. \expandafter\XINT_xtrunc_II \fi #2\xint:{#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_I -#1\xint:#2#3#4% {% \expandafter\XINT_xtrunc_I_a\romannumeral0#2{#4}{#2}{#1}{#3}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_I_a #1#2#3#4#5% {% \expandafter\XINT_xtrunc_I_b\the\numexpr #4-#5\xint:#4\xint:{#5}{#2}{#3}{#1}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_I_b #1% {% \xint_UDsignfork @@ -25931,6 +26468,10 @@ $1$ or $-1$. -\XINT_xtrunc_IB_c \krof #1% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IA_c -#1\xint:#2\xint:#3#4#5#6% {% \expandafter\XINT_xtrunc_IA_d @@ -25938,6 +26479,10 @@ $1$ or $-1$. \expandafter\XINT_xtrunc_IA_xd \the\numexpr (#1+\xint_c_ii^v)/\xint_c_ii^vi-\xint_c_i\xint:#1\xint:{#5}{#4}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IA_d #1% {% \xint_UDsignfork @@ -25945,32 +26490,60 @@ $1$ or $-1$. -\XINT_xtrunc_IAB_e \krof #1% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IAA_e -#1\xint:#2% {% \romannumeral0\XINT_split_fromleft #1.#2\xint_gobble_i\xint_bye2345678\xint_bye..% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IAB_e #1\xint:#2% {% 0.\romannumeral\XINT_rep#1\endcsname0#2% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IA_xd #1\xint:#2\xint:% {% \expandafter\XINT_xtrunc_IA_xe\the\numexpr #2-\xint_c_ii^vi*#1\xint:#1\xint:% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_IA_xe #1\xint:#2\xint:#3#4% {% \XINT_xtrunc_loop {#2}{#4}{#3}{#1}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_IB_c #1\xint:#2\xint:#3#4#5#6% {% \expandafter\XINT_xtrunc_IB_d \romannumeral0\XINT_split_xfork #1.#6\xint_bye2345678\xint_bye..{#3}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_IB_d #1.#2.#3% {% \expandafter\XINT_xtrunc_IA_d\the\numexpr#3-\xintLength {#1}\xint:{#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_II #1\xint:% {% \expandafter\XINT_xtrunc_II_a\romannumeral\xintreplicate{#1}0\xint:% @@ -25985,10 +26558,18 @@ $1$ or $-1$. {% \expandafter\XINT_xtrunc_II_c\the\numexpr #2-\xint_c_ii^vi*#1\xint:#1\xint:% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_II_c #1\xint:#2\xint:#3#4#5% {% #3.\XINT_xtrunc_loop {#2}{#4}{#5}{#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_loop #1% {% \ifnum #1=\xint_c_ \expandafter\XINT_xtrunc_transition\fi @@ -26005,6 +26586,10 @@ $1$ or $-1$. \romannumeral\xintreplicate{\xint_c_ii^vi-\xintLength{#1}}0#1% \XINT_xtrunc_loop {#3}{#2}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_transition \expandafter\XINT_xtrunc_loop_a\the\numexpr #1\xint:#2#3#4% {% @@ -26020,6 +26605,10 @@ $1$ or $-1$. {% \romannumeral\xintreplicate{#3-\xintLength{#1}}0#1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_sp_e #1% {% \ifnum #1<\xint_c_ @@ -26028,10 +26617,18 @@ $1$ or $-1$. \expandafter\XINT_xtrunc_sp_II \fi #1\xint:% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_I -#1\xint:#2#3% {% \expandafter\XINT_xtrunc_sp_I_a\the\numexpr #1-#3\xint:#1\xint:{#3}{#2}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_I_a #1% {% \xint_UDsignfork @@ -26039,11 +26636,19 @@ $1$ or $-1$. -\XINT_xtrunc_sp_IB_b \krof #1% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_IA_b -#1\xint:#2\xint:#3#4% {% \expandafter\XINT_xtrunc_sp_IA_c \the\numexpr#2-\xintLength{#4}\xint:{#4}\romannumeral\XINT_rep#1\endcsname0% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_IA_c #1% {% \xint_UDsignfork @@ -26051,24 +26656,44 @@ $1$ or $-1$. -\XINT_xtrunc_sp_IAB \krof #1% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_IAA -#1\xint:#2% {% \romannumeral0\XINT_split_fromleft #1.#2\xint_gobble_i\xint_bye2345678\xint_bye..% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_IAB #1\xint:#2% {% 0.\romannumeral\XINT_rep#1\endcsname0#2% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_IB_b #1\xint:#2\xint:#3#4% {% \expandafter\XINT_xtrunc_sp_IB_c \romannumeral0\XINT_split_xfork #1.#4\xint_bye2345678\xint_bye..{#3}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_xtrunc_sp_IB_c #1.#2.#3% {% \expandafter\XINT_xtrunc_sp_IA_c\the\numexpr#3-\xintLength {#1}\xint:{#1}% }% +% \end{macrocode} +% \lverb@& +% @ +% \begin{macrocode} \def\XINT_xtrunc_sp_II #1\xint:#2#3% {% #2\romannumeral\XINT_rep#1\endcsname0.\romannumeral\XINT_rep#3\endcsname0% @@ -26309,37 +26934,44 @@ $1$ or $-1$. }% \def\XINT_fpow_pos_B #1#2{\XINT_outfrac {#2}{#1}}% % \end{macrocode} -% \subsection{\csh{xintiFac}} -% \lverb|& -% -% Note pour 1.2f: il y avait un peu de confusion avec \xintFac, \xintiFac, -% \xintiiFac, car \xintiFac aurait dû aussi utiliser \xintNum une fois -% xintfrac.sty chargé ce qu'elle ne faisait pas. \xintNum est nécessaire pour -% gérer des inputs fractionnaires ou avec [N], car il les transforme en entiers -% stricts, et la doc dit que les macros avec "i" l'utilise. Maintenant -% \xintiFac fait la chose correcte. \xintFac est synonyme. -% -% 2015/11/29: NO MORE a \xintFac, only \xintiFac/\xintiiFac.| +% \subsection{\csh{xintFac}} +% \lverb|Factorial coefficients: variant which can be chained with other +% xintfrac macros. \xintiFac deprecated at 1.2o; \xintFac used by xintexpr.sty.| % \begin{macrocode} -\def\xintifac #1{\expandafter\XINT_fac_fork\the\numexpr \xintNum{#1}.}% +\def\xintifac #1{\expandafter\XINT_fac_fork\the\numexpr\xintNum{#1}.}% +\def\xintFac {\romannumeral0\xintfac}% +\def\xintfac #1{\expandafter\XINT_fac_fork\the\numexpr\xintNum{#1}.[0]}% % \end{macrocode} -% \subsection{\csh{xintiBinomial}} -% \lverb|1.2f. Binomial coefficients.| +% \subsection{\csh{xintBinomial}} +% \lverb|1.2f. Binomial coefficients. \xintiBinomial deprecated at 1.2o; +% \xintBinomial needed by xintexpr.sty.| % \begin{macrocode} \def\xintibinomial #1#2% {% \expandafter\XINT_binom_pre \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.% }% +\def\xintBinomial {\romannumeral0\xintbinomial}% +\def\xintbinomial #1#2% +{% + \expandafter\XINT_binom_pre + \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.[0]% +}% % \end{macrocode} -% \subsection{\csh{xintiPFactorial}} -% \lverb|1.2f. Partial factorial.| +% \subsection{\csh{xintPFactorial}} +% \lverb|1.2f. Partial factorial. For needs of xintexpr.sty.| % \begin{macrocode} \def\xintipfactorial #1#2% {% \expandafter\XINT_pfac_fork \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.% }% +\def\xintPFactorial {\romannumeral0\xintpfactorial}% +\def\xintpfactorial #1#2% +{% + \expandafter\XINT_pfac_fork + \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.[0]% +}% % \end{macrocode} % \subsection{\csh{xintPrd}} % \lverb|There was (not documented anymore since 1.09d, 2013/10/22) a macro @@ -26504,6 +27136,10 @@ $1$ or $-1$. -{\XINT_fgeq_Fn #1}% \krof }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_fgeq_Fd #1\Z #2#3% {% \expandafter\XINT_fgeq_Fe @@ -26691,6 +27327,10 @@ $1$ or $-1$. -{\XINT_fcmp_Fn #1}% \krof }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_fcmp_Fd #1\Z #2#3% {% \expandafter\XINT_fcmp_Fe @@ -27259,6 +27899,10 @@ $1$ or $-1$. \expandafter\XINT_pfloat_a \romannumeral0\xintfloat [\XINTdigits]{#1};\XINTdigits.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_pfloat_opt [\xint:#1]% {% \expandafter\XINT_pfloat_opt_a \the\numexpr #1.% @@ -27275,8 +27919,16 @@ $1$ or $-1$. 0-\XINT_pfloat_pos \krof #1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_pfloat_zero #1;#2.{ 0.}% \def\XINT_pfloat_neg-{\expandafter-\romannumeral0\XINT_pfloat_pos }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_pfloat_pos #1.#2e#3;#4.% {% \ifnum #3>\xint_c_v \xint_dothis\XINT_pfloat_no\fi @@ -27288,7 +27940,8 @@ $1$ or $-1$. \def\XINT_pfloat_no #1#2;{ #1.#2}% % \end{macrocode} % \lverb|This is all simpler coded, now that 1.2k's \xintFloat always -% outputs a mantissa with exactly one digits before decimal mark always.| +% outputs a mantissa with exactly one digits before decimal mark always. +% | % \begin{macrocode} \def\XINT_pfloat_N #1e-#2;% {% @@ -27299,6 +27952,10 @@ $1$ or $-1$. \def\XINT_pfloat_N_iii{ 0.00}% \def\XINT_pfloat_N_iv { 0.000}% \def\XINT_pfloat_N_v { 0.0000}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_pfloat_P #1e#2;% {% \csname XINT_pfloat_P_\romannumeral#2\endcsname #1% @@ -27309,6 +27966,10 @@ $1$ or $-1$. \def\XINT_pfloat_P_iii#1#2#3#4{ #1#2#3#4.}% \def\XINT_pfloat_P_iv #1#2#3#4#5{ #1#2#3#4#5.}% \def\XINT_pfloat_P_v #1#2#3#4#5#6{ #1#2#3#4#5#6.}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_pfloat_Ps #1e#2;% {% \csname XINT_pfloat_Ps\romannumeral#2\endcsname #100000;% @@ -27383,15 +28044,27 @@ $1$ or $-1$. {% \xint_gob_til_zero #1\XINT_FL_add_zero 0\XINT_FL_add_b #1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_FL_add_zero #1.#2{#2}%[[ \def\XINT_FL_add_b #1]#2.#3% {% \expandafter\XINT_FL_add_c\romannumeral0\XINTinfloat[#2]{#3}#2.#1]% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_FL_add_c #1% {% \xint_gob_til_zero #1\XINT_FL_add_zero 0\XINT_FL_add_d #1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_FL_add_d #1[#2]#3.#4[#5]% {% \ifnum\numexpr #2-#3-#5>\xint_c_\xint_dothis\xint_firstoftwo\fi @@ -27473,6 +28146,10 @@ $1$ or $-1$. {% \expandafter\XINT_FL_mul_b\romannumeral0\XINTinfloatS[#3]{#4}#1[#2]% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_FL_mul_b #1[#2]#3[#4]{\xintiiMul{#3}{#1}/1[#4+#2]}% % \end{macrocode} % \subsection{\csh{xintFloatDiv}, \csh{XINTinFloatDiv}} @@ -27501,6 +28178,10 @@ $1$ or $-1$. \else\expandafter\XINT_fldiv_noopt \fi #1#2% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_fldiv_noopt #1#2\xint:#3% {% #1[\XINTdigits]% @@ -27511,6 +28192,10 @@ $1$ or $-1$. {% \expandafter\XINT_fldiv_opt_a\the\numexpr #2.#1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_fldiv_opt_a #1.#2#3#4% {% #2[#1]{\expandafter\XINT_FL_div_a\romannumeral0\XINTinfloatS[#1]{#4}#1.{#3}}% @@ -27519,6 +28204,10 @@ $1$ or $-1$. {% \expandafter\XINT_FL_div_b\romannumeral0\XINTinfloatS[#3]{#4}/#1e#2% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_FL_div_b #1[#2]{#1e#2}% % \end{macrocode} % \subsection{\csh{xintFloatPow}, \csh{XINTinFloatPow}} @@ -27570,6 +28259,10 @@ $1$ or $-1$. \krof }% \def\XINT_flpow_BisZero .#1.#2#3{#3{1[0]}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_checkB_b #1#2.#3.% {% \expandafter\XINT_flpow_checkB_c @@ -27582,19 +28275,34 @@ $1$ or $-1$. \expandafter\XINT_flpow_checkB_d\the\numexpr#1+#2.#1.#2.% }% % \end{macrocode} -%\lverb|1.2f rounds input to P digits, first.| +% \lverb|& +% +% 1.2f rounds input to P digits, first. +% | % \begin{macrocode} \def\XINT_flpow_checkB_d #1.#2.#3.#4.#5#6% {% \expandafter \XINT_flpow_aa \romannumeral0\XINTinfloat [#3]{#6}{#2}{#1}{#4}{#5}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_aa #1[#2]#3% {% \expandafter\XINT_flpow_ab\the\numexpr #2-#3\expandafter.% \romannumeral\XINT_rep #3\endcsname0.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_ab #1.#2.#3.{\XINT_flpow_a #3#2[#1]}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_a #1% {% \xint_UDzerominusfork @@ -27610,16 +28318,28 @@ $1$ or $-1$. {\XINT_signalcondition{DivisionByZero}{0 to the power #4}{}{0[0]}}% }% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_b #1#2[#3]#4#5% {% \XINT_flpow_loopI #5.#3.#2.#4.{#1\ifodd #5 \xint_c_i\fi\fi}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_truncate #1.#2.#3.% {% \expandafter\XINT_flpow_truncate_a \romannumeral0\XINT_split_fromleft #3.#2\xint_bye2345678\xint_bye..#1.#3.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_truncate_a #1.#2.#3.{#3+\xintLength{#2}.#1.}% \def\XINT_flpow_loopI #1.% {% @@ -27631,10 +28351,18 @@ $1$ or $-1$. \fi #1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_ItoIII\ifodd #1\fi #2.#3.#4.#5.#6% {% \expandafter\XINT_flpow_III\the\numexpr #6+\xint_c_.#3.#4.#5.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_loopI_even #1.#2.#3.%#4.% {% \expandafter\XINT_flpow_loopI @@ -27681,6 +28409,10 @@ $1$ or $-1$. \the\numexpr\xint_c_ii*#5\expandafter.\romannumeral0\xintiisqr{#6}.#3.% #1.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_IItoIII\ifodd #1\fi #2.#3.#4.#5.#6.#7.#8% {% \expandafter\XINT_flpow_III\the\numexpr #8+\xint_c_\expandafter.% @@ -27717,6 +28449,10 @@ $1$ or $-1$. -{{#3[#2]}}% \krof #1% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpow_IIIend #1#2#3% {#3{\if#21\xint_afterfi{\expandafter-\romannumeral`&&@}\fi#1}}% % \end{macrocode} @@ -27755,14 +28491,22 @@ $1$ or $-1$. % through \xintiTrunc1.| % \begin{macrocode} \def\XINTinFloatPowerH {\romannumeral0\XINTinfloatpowerh }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINTinfloatpowerh #1#2% {% \expandafter\XINT_flpowerh_a\romannumeral0\xintitrunc1{#2};% \XINTdigits.{#1}{\XINTinfloatS[\XINTdigits]}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpowerh_a #1;% {% - \if0\xintiiLDg{#1}\expandafter\XINT_flpowerh_int + \if0\xintLDg{#1}\expandafter\XINT_flpowerh_int \else\expandafter\XINT_flpowerh_b \fi #1.% }% @@ -27779,7 +28523,7 @@ $1$ or $-1$. }% \def\XINT_flpowerh_c #1.% {% - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \expandafter\XINT_flpowerh_d\else\expandafter\XINT_flpowerh_e \fi #1.% }% @@ -27829,15 +28573,27 @@ $1$ or $-1$. \expandafter\XINT_flpower_checkB_c \the\numexpr\xintLength{#2}+\xint_c_iii.#3.#2.{#1}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpower_checkB_c #1.#2.% {% \expandafter\XINT_flpower_checkB_d\the\numexpr#1+#2.#1.#2.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpower_checkB_d #1.#2.#3.#4.#5#6% {% \expandafter \XINT_flpower_aa \romannumeral0\XINTinfloat [#3]{#6}{#2}{#1}{#4}{#5}% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flpower_aa #1[#2]#3% {% \expandafter\XINT_flpower_ab\the\numexpr #2-#3\expandafter.% @@ -27859,9 +28615,13 @@ $1$ or $-1$. \def\XINT_flpower_loopI #1.% {% \if1\XINT_isOne {#1}\xint_dothis\XINT_flpower_ItoIII\fi - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \xint_dothis{\expandafter\XINT_flpower_loopI_odd}\fi \xint_orthat{\expandafter\XINT_flpower_loopI_even}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral0\XINT_half #1\xint_bye\xint_Bye345678\xint_bye *\xint_c_v+\xint_c_v)/\xint_c_x-\xint_c_i\relax.% @@ -27888,9 +28648,13 @@ $1$ or $-1$. \def\XINT_flpower_loopII #1.% {% \if1\XINT_isOne{#1}\xint_dothis\XINT_flpower_IItoIII\fi - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \xint_dothis{\expandafter\XINT_flpower_loopII_odd}\fi \xint_orthat{\expandafter\XINT_flpower_loopII_even}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \romannumeral0\XINT_half#1\xint_bye\xint_Bye345678\xint_bye *\xint_c_v+\xint_c_v)/\xint_c_x-\xint_c_i\relax.% }% @@ -28557,17 +29321,29 @@ $1$ or $-1$. \the\numexpr #3\ifodd #2 \xint_dothis {+\xint_c_iii.(#2+\xint_c_i).0}\fi \xint_orthat {+\xint_c_ii.#2.{}}#100.#3.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt #1.#2.% {% \expandafter\XINT_flsqrt_a \the\numexpr #2/\xint_c_ii-(#1-\xint_c_i)/\xint_c_ii.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_a #1.#2.#3#4.#5.% {% \expandafter\XINT_flsqrt_b \the\numexpr (#2-\xint_c_i)/\xint_c_ii\expandafter.% \romannumeral0\XINT_sqrt_start #2.#4#3.#5.#2.#4#3.#5.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_b #1.#2#3% {% \expandafter\XINT_flsqrt_c @@ -28576,28 +29352,52 @@ $1$ or $-1$. {\xintiiDivRound{\XINT_dsx_addzeros {#1}#3;}% {\XINT_dbl#2\xint_bye2345678\xint_bye*\xint_c_ii\relax}}.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_c #1.#2.% {% \expandafter\XINT_flsqrt_d \romannumeral0\XINT_split_fromleft#2.#1\xint_bye2345678\xint_bye..% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_d #1.#2#3.% {% \ifnum #2=\xint_c_v \expandafter\XINT_flsqrt_f\else\expandafter\XINT_flsqrt_finish\fi #2#3.#1.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_finish #1#2.#3.#4.#5.#6.#7.#8{#8[#6]{#3#1[#7]}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_f 5#1.% {\expandafter\XINT_flsqrt_g\romannumeral0\xintinum{#1}\relax.}% \def\XINT_flsqrt_g #1#2#3.{\if\relax#2\xint_dothis{\XINT_flsqrt_h #1}\fi \xint_orthat{\XINT_flsqrt_finish 5.}}% \def\XINT_flsqrt_h #1{\ifnum #1<\xint_c_iii\xint_dothis{\XINT_flsqrt_again}\fi \xint_orthat{\XINT_flsqrt_finish 5.}}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_again #1.#2.% {% \expandafter\XINT_flsqrt_again_a\the\numexpr #2+\xint_c_viii.% }% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_flsqrt_again_a #1.#2.#3.% {% \expandafter\XINT_flsqrt_b @@ -28648,6 +29448,10 @@ $1$ or $-1$. }%[ \def\XINT_floate_zero #1]#2.#3{ 0.e0}% \def\XINT_floate_neg-{\expandafter-\romannumeral0\XINT_floate_pos}% +% \end{macrocode} +% \lverb|& +% | +% \begin{macrocode} \def\XINT_floate_pos #1#2[#3]#4.#5% {% \expandafter\XINT_float_pos_done\the\numexpr#3+#4+#5-\xint_c_i.#1.#2;% @@ -28667,6 +29471,24 @@ $1$ or $-1$. {\romannumeral0\XINTinfloat[#1]{#3}}{#1}}% \def\XINT_infloatmod #1#2{\expandafter\XINT_infloatmod_a\expandafter {#2}{#1}}% \def\XINT_infloatmod_a #1#2#3{\XINTinfloat [#3]{\xintMod {#2}{#1}}}% +% \end{macrocode} +% \subsection*{At End of \LaTeX\ Document deprecation message} +% \addcontentsline{toc}{subsection}{At End of \LaTeX\ Document deprecation message} +% \lverb|1.2o| +% \begin{macrocode} +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xintfrac}% + {\PackageError{xintfrac} +{Usage of deprecated macros!} +{This deprecated macro from xintfrac.sty has been detected:\MessageBreak +%\XINT_ifFlagRaised{xintNeq}{% +\string\xintNeq\space(use \string\xintNotEq\space or xint's \string\xintiiNotEq!)\MessageBreak +%}{}% +It will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi \XINT_restorecatcodes_endinput% % \end{macrocode} % @@ -28742,7 +29564,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintseries}% - [2017/08/06 1.2n Expandable partial sums with xint package (JFB)]% + [2017/08/29 1.2o Expandable partial sums with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintSeries}} % \begin{macrocode} @@ -29240,7 +30062,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintcfrac}% - [2017/08/06 1.2n Expandable continued fractions with xint package (JFB)]% + [2017/08/29 1.2o Expandable continued fractions with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintCFrac}} % \begin{macrocode} @@ -29577,12 +30399,12 @@ $1$ or $-1$. }% \def\XINT_fgtc_e #1% {% - \xintifZero {#1}{\expandafter\xint_firstofone\xint_gobble_iii}% + \xintiiifZero {#1}{\expandafter\xint_firstofone\xint_gobble_iii}% {\XINT_fgtc_f {#1}}% }% \def\XINT_fgtc_f #1#2% {% - \xintifZero {#2}{\xint_thirdofthree}{\XINT_fgtc_g {#1}{#2}}% + \xintiiifZero {#2}{\xint_thirdofthree}{\XINT_fgtc_g {#1}{#2}}% }% \def\XINT_fgtc_g #1#2#3% {% @@ -30491,7 +31313,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintexpr}% - [2017/08/06 1.2n Expandable expression parser (JFB)]% + [2017/08/29 1.2o Expandable expression parser (JFB)]% \catcode`! 11 \let\XINT_Cmp \xintiiCmp % \end{macrocode} @@ -31551,9 +32373,9 @@ $1$ or $-1$. \XINT_expr_defbin_b {expr} {>=} {v}{vi} {xintGtorEq}% \XINT_expr_defbin_b {flexpr}{>=} {v}{vi} {xintGtorEq}% \XINT_expr_defbin_b {iiexpr}{>=} {v}{vi} {xintiiGtorEq}% -\XINT_expr_defbin_b {expr} {!=} {v}{vi} {xintNeq}% -\XINT_expr_defbin_b {flexpr}{!=} {v}{vi} {xintNeq}% -\XINT_expr_defbin_b {iiexpr}{!=} {v}{vi} {xintiiNeq}% +\XINT_expr_defbin_b {expr} {!=} {v}{vi} {xintNotEq}% +\XINT_expr_defbin_b {flexpr}{!=} {v}{vi} {xintNotEq}% +\XINT_expr_defbin_b {iiexpr}{!=} {v}{vi} {xintiiNotEq}% \XINT_expr_defbin_b {expr} {..} {iii}{vi} {xintSeq::csv}% \XINT_expr_defbin_b {flexpr}{..} {iii}{vi} {xintSeq::csv}% \XINT_expr_defbin_b {iiexpr}{..} {iii}{vi} {xintiiSeq::csv}% @@ -32333,12 +33155,12 @@ $1$ or $-1$. }% % \end{macrocode} % \subsection{! as postfix factorial operator} -% \lverb|A float version \xintFloatFac was at last done 2015/10/06 for 1.2. -% Attention 2015/11/29 for 1.2f: no more \xintFac, but \xintiFac.| +% \lverb|& +% | % \begin{macrocode} \let\XINT_expr_precedence_! \xint_c_x \def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop - \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }% + \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }% \def\XINT_flexpr_op_! #1{\expandafter\XINT_expr_getop \csname .=\XINTinFloatFac{\XINT_expr_unlock #1}\endcsname }% \def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop @@ -33562,7 +34384,7 @@ $1$ or $-1$. {% \expandafter #1\expandafter #2\csname .=% \expandafter\XINT_expr_argandopt - \romannumeral`&&@\XINT_expr_unlock#3,,.\xintiFac\XINTinFloatFac + \romannumeral`&&@\XINT_expr_unlock#3,,.\xintFac\XINTinFloatFac \endcsname }% \def\XINT_flexpr_func_factorial #1#2#3% @@ -33651,7 +34473,7 @@ $1$ or $-1$. \def\XINT_expr_func_binomial #1#2#3% {% \expandafter #1\expandafter #2\csname .=% - \expandafter\expandafter\expandafter\xintiBinomial + \expandafter\expandafter\expandafter\xintBinomial \expandafter\XINT_expr_twoargs \romannumeral`&&@\XINT_expr_unlock #3,\endcsname }% @@ -33672,7 +34494,7 @@ $1$ or $-1$. \def\XINT_expr_func_pfactorial #1#2#3% {% \expandafter #1\expandafter #2\csname .=% - \expandafter\expandafter\expandafter\xintiPFactorial + \expandafter\expandafter\expandafter\xintPFactorial \expandafter\XINT_expr_twoargs \romannumeral`&&@\XINT_expr_unlock #3,\endcsname }% @@ -34196,8 +35018,8 @@ $1$ or $-1$. \xintFor #1 in {DivTrunc,Mod,Round,Trunc,iRound,iTrunc,iQuo,iRem, iiDivTrunc,iiDivRound,iiMod,iiQuo,iiRem,% - Lt,Gt,Eq,LtorEq,GtorEq,Neq,% - iiLt,iiGt,iiEq,iiLtorEq,iiGtorEq,iiNeq,% + Lt,Gt,Eq,LtorEq,GtorEq,NotEq,% + iiLt,iiGt,iiEq,iiLtorEq,iiGtorEq,iiNotEq,% Add,Sub,Mul,Div,Pow,E,% iiAdd,iiSub,iiMul,iiPow,iiE,% AND,OR,XOR,% @@ -34215,8 +35037,8 @@ $1$ or $-1$. % qfloat?). Pas le temps d'y réfléchir. Je ne fais rien. \xintFor #1 in {Num,Irr,Abs,iiAbs,Sgn,iiSgn,TFrac,Floor,iFloor,Ceil,iCeil,% Sqr,iiSqr,iiSqrt,iiSqrtR,iiIsZero,iiIsNotZero,iiifNotZero,iiifSgn,% - Odd,Even,iiOdd,iiEven,Opp,iiOpp,iiifZero,iFac,iBinomial,% - iPFactorial,iiFac,iiBinomial,iiPFactorial,Bool,Toggle}\do + Odd,Even,iiOdd,iiEven,Opp,iiOpp,iiifZero,Fac,Binomial,% + PFactorial,iiFac,iiBinomial,iiPFactorial,Bool,Toggle}\do {\toks0 \expandafter{\the\toks0% \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\expandafter @@ -34493,11 +35315,11 @@ $1$ or $-1$. \iffalse % grep -c -e "^{%" xint*sty xint.sty:178 -xintbinhex.sty:55 +xintbinhex.sty:53 xintcfrac.sty:183 xintcore.sty:278 xintexpr.sty:168 -xintfrac.sty:439 +xintfrac.sty:441 xintgcd.sty:50 xintkernel.sty:13 xintseries.sty:48 @@ -34508,11 +35330,11 @@ xinttools.sty:138 \iffalse % grep -c -e "^}%" xint*sty xint.sty:177 -xintbinhex.sty:54 +xintbinhex.sty:52 xintcfrac.sty:183 xintcore.sty:275 xintexpr.sty:199 -xintfrac.sty:437 +xintfrac.sty:439 xintgcd.sty:52 xintkernel.sty:14 xintseries.sty:48 @@ -34556,8 +35378,8 @@ xinttools.sty:137 Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum {30253}% 30303 pour 1.2h, 30403 pour 1.2i, 30750 pour 1.2j, - % 30677 pour 1.2k, 30931 pour 1.2l, 30439 pour 1.2m +\CheckSum {30524}% 30303 pour 1.2h, 30403 pour 1.2i, 30750 pour 1.2j, + % 30677 pour 1.2k, 30931 pour 1.2l, 30439 pour 1.2m, 30253 pour 1.2n \makeatletter\check@checksum\makeatother \Finale %% End of file xint.dtx diff --git a/Master/texmf-dist/source/generic/xint/xint.ins b/Master/texmf-dist/source/generic/xint/xint.ins index ef332270ab9..b1e9a341ec5 100644 --- a/Master/texmf-dist/source/generic/xint/xint.ins +++ b/Master/texmf-dist/source/generic/xint/xint.ins @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% --------------------------------------------------------------- %% diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty index 0b4ddd99c34..3cbe8373d14 100644 --- a/Master/texmf-dist/tex/generic/xint/xint.sty +++ b/Master/texmf-dist/tex/generic/xint/xint.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xint: Expandable operations on big integers %% --------------------------------------------------------------- @@ -70,37 +70,27 @@ \XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty) \XINT_providespackage \ProvidesPackage{xint}% - [2017/08/06 1.2n Expandable operations on big integers (JFB)]% + [2017/08/29 1.2o Expandable operations on big integers (JFB)]% \long\def\xint_firstofthree #1#2#3{#1}% \long\def\xint_secondofthree #1#2#3{#2}% \long\def\xint_thirdofthree #1#2#3{#3}% \long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i \long\def\xint_secondofthree_thenstop #1#2#3{ #2}% \long\def\xint_thirdofthree_thenstop #1#2#3{ #3}% -\def\xintSgnFork {\romannumeral0\xintsgnfork }% -\def\xintsgnfork #1% +\def\xintiLen {\romannumeral0\xintilen }% +\def\xintilen #1{\def\xintilen ##1% {% - \ifcase #1 \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop - \fi -}% -\def\xintiiIsOne {\romannumeral0\xintiiisone }% -\def\xintiiisone #1{\expandafter\XINT_isone\romannumeral`&&@#1XY}% -\def\xintIsOne {\romannumeral0\xintisone }% -\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% -\def\XINT_isone #1#2#3Y% -{% - \unless\if#2X\xint_dothis{ 0}\fi - \unless\if#11\xint_dothis{ 0}\fi - \xint_orthat{ 1}% -}% -\def\XINT_isOne #1{\XINT_is_One#1XY}% -\def\XINT_is_One #1#2#3Y% + \expandafter#1\the\numexpr + \expandafter\XINT_len_fork\romannumeral0\xintinum{##1}% + \xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: + \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 +}}\xintilen{ }% +\def\xintLen {\romannumeral0\xintlen }% +\let\xintlen\xintilen +\def\XINT_len_fork #1% {% - \unless\if#2X\xint_dothis0\fi - \unless\if#11\xint_dothis0\fi - \xint_orthat1% + \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof }% \def\xintReverseDigits {\romannumeral0\xintreversedigits }% \def\xintreversedigits #1% @@ -139,99 +129,392 @@ {\expandafter#1\xint_gob_til_Z ##1}% }\XINT_revdigits_end{ }% \let\xintRev\xintReverseDigits -\def\xintLen {\romannumeral0\xintlen }% -\def\xintlen #1{\def\xintlen ##1% +%%÷ Used in \xintMod +\def\xintiiE {\romannumeral0\xintiie }% +\def\xintiie #1#2% + {\expandafter\XINT_iie_fork\the\numexpr #2\expandafter.\romannumeral`&&@#1;}% +\def\XINT_iie_fork #1% {% - \expandafter#1\the\numexpr - \expandafter\XINT_len_fork\romannumeral0\xintnum{##1}% - \xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: + \xint_UDsignfork + #1\XINT_iie_neg + -\XINT_iie_a + \krof #1% +}% +\def\XINT_iie_a #1.% + {\expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.}% +\def\XINT_iie_neg #1.#2;{ #2}% +\def\xintDecSplit {\romannumeral0\xintdecsplit }% +\def\xintdecsplit #1#2% +{% + \expandafter\XINT_split_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_split_finish #1.#2.{{#1}{#2}}% +\def\XINT_split_xfork #1% +{% + \xint_UDzerominusfork + #1-\XINT_split_zerosplit + 0#1\XINT_split_fromleft + 0-{\XINT_split_fromright #1}% + \krof +}% +\def\XINT_split_zerosplit .#1\xint_bye#2\xint_bye..{ #1..}% +\def\XINT_split_fromleft + {\expandafter\XINT_split_fromleft_a\the\numexpr\xint_c_viii-}% +\def\XINT_split_fromleft_a #1% +{% + \xint_UDsignfork + #1\XINT_split_fromleft_b + -{\XINT_split_fromleft_end_a #1}% + \krof +}% +\def\XINT_split_fromleft_b #1.#2#3#4#5#6#7#8#9% +{% + \expandafter\XINT_split_fromleft_clean + \the\numexpr1#2#3#4#5#6#7#8#9\expandafter + \XINT_split_fromleft_a\the\numexpr\xint_c_viii-#1.% +}% +\def\XINT_split_fromleft_end_a #1.% +{% + \expandafter\XINT_split_fromleft_clean + \the\numexpr1\csname XINT_split_fromleft_end#1\endcsname +}% +\def\XINT_split_fromleft_clean 1{ }% +\expandafter\def\csname XINT_split_fromleft_end7\endcsname #1% + {#1\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end6\endcsname #1#2% + {#1#2\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end5\endcsname #1#2#3% + {#1#2#3\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end4\endcsname #1#2#3#4% + {#1#2#3#4\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end3\endcsname #1#2#3#4#5% + {#1#2#3#4#5\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end2\endcsname #1#2#3#4#5#6% + {#1#2#3#4#5#6\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end1\endcsname #1#2#3#4#5#6#7% + {#1#2#3#4#5#6#7\XINT_split_fromleft_end_b}% +\expandafter\def\csname XINT_split_fromleft_end0\endcsname #1#2#3#4#5#6#7#8% + {#1#2#3#4#5#6#7#8\XINT_split_fromleft_end_b}% +\def\XINT_split_fromleft_end_b #1\xint_bye#2\xint_bye.{.#1}% puis . +\def\XINT_split_fromright #1.#2\xint_bye +{% + \expandafter\XINT_split_fromright_a + \the\numexpr#1-\numexpr\XINT_length_loop + #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \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 -}}\xintlen{ }% -\def\XINT_len_fork #1% + \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% {% - \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof + \xint_UDsignfork + #1\XINT_split_fromleft + -\XINT_split_fromright_Lempty + \krof }% -\def\xintBool #1{\romannumeral`&&@% - \csname if#1\endcsname\expandafter1\else\expandafter0\fi }% -\def\xintToggle #1{\romannumeral`&&@\iftoggle{#1}{1}{0}}% -\def\xintifSgn {\romannumeral0\xintifsgn }% -\def\xintifsgn #1% +\def\XINT_split_fromright_Lempty #1.#2\xint_bye#3..{.#2.}% +\def\xintDecSplitL {\romannumeral0\xintdecsplitl }% +\def\xintdecsplitl #1#2% {% - \ifcase \xintSgn{#1} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop + \expandafter\XINT_splitl_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_splitl_finish #1.#2.{ #1}% +\def\xintDecSplitR {\romannumeral0\xintdecsplitr }% +\def\xintdecsplitr #1#2% +{% + \expandafter\XINT_splitr_finish + \romannumeral0\expandafter\XINT_split_xfork + \the\numexpr #1\expandafter.\romannumeral`&&@#2% + \xint_bye2345678\xint_bye..% +}% +\def\XINT_splitr_finish #1.#2.{ #2}% +\def\xintDSHr {\romannumeral0\xintdshr }% +\def\xintdshr #1#2% +{% + \expandafter\XINT_dshr_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dshr_fork #1% +{% + \xint_UDzerominusfork + 0#1\XINT_dshr_xzeroorneg + #1-\XINT_dshr_xzeroorneg + 0-\XINT_dshr_xpositive + \krof #1% +}% +\def\XINT_dshr_xzeroorneg #1;{ 0}% +\def\XINT_dshr_xpositive +{% + \expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_dsx_xisPos +}% +\def\xintDSH {\romannumeral0\xintdsh }% +\def\xintdsh #1#2% +{% + \expandafter\XINT_dsh_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dsh_fork #1% +{% + \xint_UDzerominusfork + #1-\XINT_dsh_xiszero + 0#1\XINT_dsx_xisNeg_checkA + 0-{\XINT_dsh_xisPos #1}% + \krof +}% +\def\XINT_dsh_xiszero #1.#2;{ #2}% +\def\XINT_dsh_xisPos +{% + \expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_dsx_xisPos +}% +\def\xintDSx {\romannumeral0\xintdsx }% +\def\xintdsx #1#2% +{% + \expandafter\XINT_dsx_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% +}% +\def\XINT_dsx_fork #1% +{% + \xint_UDzerominusfork + #1-\XINT_dsx_xisZero + 0#1\XINT_dsx_xisNeg_checkA + 0-{\XINT_dsx_xisPos #1}% + \krof +}% +\def\XINT_dsx_xisZero #1.#2;{{#2}{0}}% +\def\XINT_dsx_xisNeg_checkA #1.#2% +{% + \xint_gob_til_zero #2\XINT_dsx_xisNeg_Azero 0% + \expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.#2% +}% +\def\XINT_dsx_xisNeg_Azero #1;{ 0}% +\def\XINT_dsx_addzeros #1% + {\expandafter\XINT_dsx_append\romannumeral\XINT_rep#1\endcsname0.}% +\def\XINT_dsx_addzerosnofuss #1% + {\expandafter\XINT_dsx_append\romannumeral\xintreplicate{#1}0.}% +\def\XINT_dsx_append #1.#2;{ #2#1}% +\def\XINT_dsx_xisPos #1.#2% +{% + \xint_UDzerominusfork + #2-\XINT_dsx_AisZero + 0#2\XINT_dsx_AisNeg + 0-\XINT_dsx_AisPos + \krof #1.#2% +}% +\def\XINT_dsx_AisZero #1;{{0}{0}}% +\def\XINT_dsx_AisNeg #1.-#2;% +{% + \expandafter\XINT_dsx_AisNeg_checkiffirstempty + \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% +}% +\def\XINT_dsx_AisNeg_checkiffirstempty #1% +{% + \xint_gob_til_dot #1\XINT_dsx_AisNeg_finish_zero.% + \XINT_dsx_AisNeg_finish_notzero #1% +}% +\def\XINT_dsx_AisNeg_finish_zero.\XINT_dsx_AisNeg_finish_notzero.#1.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {-#1}}{0}% +}% +\def\XINT_dsx_AisNeg_finish_notzero #1.#2.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {#2}}{-#1}% +}% +\def\XINT_dsx_AisPos #1.#2;% +{% + \expandafter\XINT_dsx_AisPos_finish + \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% +}% +\def\XINT_dsx_AisPos_finish #1.#2.% +{% + \expandafter\XINT_dsx_end + \expandafter {\romannumeral0\XINT_num {#2}}% + {\romannumeral0\XINT_num {#1}}% +}% +\def\XINT_dsx_end #1#2{\expandafter{#2}{#1}}% +\def\xintEq {\romannumeral0\XINT_signaldeprecated{xint}{xintEq}\xinteq }% +\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% +\def\xintiiEq #1#2{\romannumeral0\xintiiifeq{#1}{#2}{1}{0}}% +\def\xintNeq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintNeq}\xintifeq {#1}{#2}{0}{1}}% +\def\xintiiNotEq #1#2{\romannumeral0\xintiiifeq {#1}{#2}{0}{1}}% +\def\xintGeq {\romannumeral0\XINT_signaldeprecated{xint}{xintGeq}\xintgeq }% +\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\xint:}% +\def\xintiiGeq {\romannumeral0\xintiigeq }% +\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\xint:}% +\def\XINT_iigeq #1#2\xint:#3% +{% + \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: +}% +\def\XINT_geq #1#2\xint:#3% +{% + \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\xint:#2\xint: +}% +\def\XINT_geq_fork #1#2% +{% + \xint_UDzerofork + #1\XINT_geq_firstiszero + #2\XINT_geq_secondiszero + 0{}% + \krof + \xint_UDsignsfork + #1#2\XINT_geq_minusminus + #1-\XINT_geq_minusplus + #2-\XINT_geq_plusminus + --\XINT_geq_plusplus + \krof #1#2% +}% +\def\XINT_geq_firstiszero #1\krof 0#2#3\xint:#4\xint: + {\xint_UDzerofork #2{ 1}0{ 0}\krof }% +\def\XINT_geq_secondiszero #1\krof #20#3\xint:#4\xint:{ 1}% +\def\XINT_geq_plusminus #1-{\XINT_geq_plusplus #1{}}% +\def\XINT_geq_minusplus -#1{\XINT_geq_plusplus {}#1}% +\def\XINT_geq_minusminus --{\XINT_geq_plusplus {}{}}% +\def\XINT_geq_plusplus + {\expandafter\XINT_geq_finish\romannumeral0\XINT_cmp_plusplus}% +\def\XINT_geq_finish #1{\if-#1\expandafter\XINT_geq_no + \else\expandafter\XINT_geq_yes\fi}% +\def\XINT_geq_no 1{ 0}% +\def\XINT_geq_yes { 1}% +\def\xintGt {\romannumeral0\XINT_signaldeprecated{xint}{xintGt}\xintgt }% +\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}% +\def\xintiiGt #1#2{\romannumeral0\xintiiifgt{#1}{#2}{1}{0}}% +\def\xintLt {\romannumeral0\XINT_signaldeprecated{xint}{xintLt}\xintlt }% +\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}% +\def\xintiiLt #1#2{\romannumeral0\xintiiiflt{#1}{#2}{1}{0}}% +\def\xintGtorEq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintGtorEq}\xintiflt {#1}{#2}{0}{1}}% +\def\xintiiGtorEq #1#2{\romannumeral0\xintiiiflt {#1}{#2}{0}{1}}% +\def\xintLtorEq #1#2{\romannumeral0\XINT_signaldeprecated{xint}{xintLtorEq}\xintifgt {#1}{#2}{0}{1}}% +\def\xintiiLtorEq #1#2{\romannumeral0\xintiiifgt {#1}{#2}{0}{1}}% +\def\xintIsZero {\romannumeral0\XINT_signaldeprecated{xint}{xintIsZero}\xintiszero }% +\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% +\def\xintiiIsZero {\romannumeral0\xintiiiszero }% +\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% +\def\xintIsNotZero {\romannumeral0\XINT_signaldeprecated{xint}{xintIsNotZero}\xintisnotzero }% +\def\xintisnotzero + #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }% +\def\xintiiisnotzero + #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +\def\xintiiIsOne {\romannumeral0\xintiiisone }% +\def\xintiiisone #1{\expandafter\XINT_isone\romannumeral`&&@#1XY}% +\def\xintIsOne {\romannumeral0\XINT_signaldeprecated{xint}{xintIsOne}\xintisone }% +\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% +\def\XINT_isone #1#2#3Y% +{% + \unless\if#2X\xint_dothis{ 0}\fi + \unless\if#11\xint_dothis{ 0}\fi + \xint_orthat{ 1}% +}% +\def\XINT_isOne #1{\XINT_is_One#1XY}% +\def\XINT_is_One #1#2#3Y% +{% + \unless\if#2X\xint_dothis0\fi + \unless\if#11\xint_dothis0\fi + \xint_orthat1% +}% +\def\xintiiOdd {\romannumeral0\xintiiodd }% +\def\xintiiodd #1% +{% + \ifodd\xintLDg{#1} %<- intentional space + \xint_afterfi{ 1}% + \else + \xint_afterfi{ 0}% \fi }% -\def\xintiiifSgn {\romannumeral0\xintiiifsgn }% -\def\xintiiifsgn #1% +\def\xintOdd {\romannumeral0\XINT_signaldeprecated{xint}{xintOdd}\xintodd }% +\def\xintodd #1% {% - \ifcase \xintiiSgn{#1} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 1}% + \else + \xint_afterfi{ 0}% \fi }% -\def\xintifZero {\romannumeral0\xintifzero }% -\def\xintifzero #1% +\def\xintiiEven {\romannumeral0\xintiieven }% +\def\xintiieven #1% {% - \if0\xintSgn{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg{#1} %<- intentional space + \xint_afterfi{ 0}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintifNotZero {\romannumeral0\xintifnotzero }% -\def\xintifnotzero #1% +\def\xintEven {\romannumeral0\XINT_signaldeprecated{xint}{xintEven}\xinteven }% +\def\xinteven #1% {% - \if0\xintSgn{#1}% - \expandafter\xint_secondoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 0}% \else - \expandafter\xint_firstoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintiiifZero {\romannumeral0\xintiiifzero }% -\def\xintiiifzero #1% +\def\xintiiMON {\romannumeral0\xintiimon }% +\def\xintiimon #1% {% - \if0\xintiiSgn{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg {#1} %<- intentional space + \xint_afterfi{ -1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }% -\def\xintiiifnotzero #1% +\def\xintMON {\romannumeral0\XINT_signaldeprecated{xint}{xintMON}\xintmon }% +\def\xintmon #1% {% - \if0\xintiiSgn{#1}% - \expandafter\xint_secondoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ -1}% \else - \expandafter\xint_firstoftwo_thenstop + \xint_afterfi{ 1}% \fi }% -\def\xintiiifOne {\romannumeral0\xintiiifone }% -\def\xintiiifone #1% +\def\xintiiMMON {\romannumeral0\xintiimmon }% +\def\xintiimmon #1% {% - \if1\xintiiIsOne{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg {#1} %<- intentional space + \xint_afterfi{ 1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ -1}% \fi }% -\def\xintifOne {\romannumeral0\xintifone }% -\def\xintifone #1% +\def\xintMMON {\romannumeral0\XINT_signaldeprecated{xint}{xintMMON}\xintmmon }% +\def\xintmmon #1% {% - \if1\xintIsOne{#1}% - \expandafter\xint_firstoftwo_thenstop + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 1}% \else - \expandafter\xint_secondoftwo_thenstop + \xint_afterfi{ -1}% \fi }% -\let\xintifTrueAelseB\xintifNotZero -\let\xintifFalseAelseB\xintifZero -%%\let\xintifTrue\xintifNotZero % now removed -%%\let\xintifTrueFalse\xintifNotZero % now removed -\def\xintifCmp {\romannumeral0\xintifcmp }% +\def\xintSgnFork {\romannumeral0\xintsgnfork }% +\def\xintsgnfork #1% +{% + \ifcase #1 \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% +\def\xintifSgn {\romannumeral0\XINT_signaldeprecated{xint}{xintifSgn}\xintifsgn }% +\def\xintifsgn #1% +{% + \ifcase \xintSgn{#1} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% +\def\xintiiifSgn {\romannumeral0\xintiiifsgn }% +\def\xintiiifsgn #1% +{% + \ifcase \xintiiSgn{#1} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi +}% +\def\xintifCmp {\romannumeral0\XINT_signaldeprecated{xint}{xintifCmp}\xintifcmp }% \def\xintifcmp #1#2% {% \ifcase\xintCmp {#1}{#2} @@ -249,7 +532,7 @@ \else\expandafter\xint_firstofthree_thenstop \fi }% -\def\xintifEq {\romannumeral0\xintifeq }% +\def\xintifEq {\romannumeral0\XINT_signaldeprecated{xint}{xintifEq}\xintifeq }% \def\xintifeq #1#2% {% \if0\xintCmp{#1}{#2}% @@ -265,7 +548,7 @@ \else\expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintifGt {\romannumeral0\xintifgt }% +\def\xintifGt {\romannumeral0\XINT_signaldeprecated{xint}{xintifGt}\xintifgt }% \def\xintifgt #1#2% {% \if1\xintCmp{#1}{#2}% @@ -281,7 +564,7 @@ \else\expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintifLt {\romannumeral0\xintiflt }% +\def\xintifLt {\romannumeral0\XINT_signaldeprecated{xint}{xintifLt}\xintiflt }% \def\xintiflt #1#2% {% \ifnum\xintCmp{#1}{#2}<\xint_c_ @@ -297,6 +580,60 @@ \else \expandafter\xint_secondoftwo_thenstop \fi }% +\def\xintifZero {\romannumeral0\XINT_signaldeprecated{xint}{xintifZero}\xintifzero }% +\def\xintifzero #1% +{% + \if0\xintSgn{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% +\def\xintiiifZero {\romannumeral0\xintiiifzero }% +\def\xintiiifzero #1% +{% + \if0\xintiiSgn{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% +\def\xintifNotZero {\romannumeral0\XINT_signaldeprecated{xint}{xintifNotZero}\xintifnotzero }% +\def\xintifnotzero #1% +{% + \if0\xintSgn{#1}% + \expandafter\xint_secondoftwo_thenstop + \else + \expandafter\xint_firstoftwo_thenstop + \fi +}% +\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }% +\def\xintiiifnotzero #1% +{% + \if0\xintiiSgn{#1}% + \expandafter\xint_secondoftwo_thenstop + \else + \expandafter\xint_firstoftwo_thenstop + \fi +}% +\def\xintiiifOne {\romannumeral0\xintiiifone }% +\def\xintiiifone #1% +{% + \if1\xintiiIsOne{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% +\def\xintifOne {\romannumeral0\XINT_signaldeprecated{xint}{xintifOne}\xintifone }% +\def\xintifone #1% +{% + \if1\xintIsOne{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi +}% \def\xintiiifOdd {\romannumeral0\xintiiifodd }% \def\xintiiifodd #1% {% @@ -306,7 +643,7 @@ \expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintifOdd {\romannumeral0\xintifodd }% +\def\xintifOdd {\romannumeral0\XINT_signaldeprecated{xint}{xintifOdd}\xintifodd }% \def\xintifodd #1% {% \if\xintOdd{#1}1% @@ -315,41 +652,20 @@ \expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintEq {\romannumeral0\xinteq }\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% -\def\xintGt {\romannumeral0\xintgt }\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}% -\def\xintLt {\romannumeral0\xintlt }\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}% -\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% -\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% -\def\xintNeq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% -\def\xintiiEq #1#2{\romannumeral0\xintiiifeq{#1}{#2}{1}{0}}% -\def\xintiiGt #1#2{\romannumeral0\xintiiifgt{#1}{#2}{1}{0}}% -\def\xintiiLt #1#2{\romannumeral0\xintiiiflt{#1}{#2}{1}{0}}% -\def\xintiiLtorEq #1#2{\romannumeral0\xintiiifgt {#1}{#2}{0}{1}}% -\def\xintiiGtorEq #1#2{\romannumeral0\xintiiiflt {#1}{#2}{0}{1}}% -\def\xintiiNeq #1#2{\romannumeral0\xintiiifeq {#1}{#2}{0}{1}}% -\def\xintIsZero {\romannumeral0\xintiszero }% -\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% -\def\xintIsNotZero {\romannumeral0\xintisnotzero }% -\def\xintisnotzero - #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% -\def\xintiiIsZero {\romannumeral0\xintiiiszero }% -\def\xintiiiszero #1{\if0\xintiiSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% -\def\xintiiIsNotZero {\romannumeral0\xintiiisnotzero }% -\def\xintiiisnotzero - #1{\if0\xintiiSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% -\let\xintIsTrue\xintIsNotZero -\let\xintNot\xintIsZero -\let\xintIsFalse\xintIsZero +\def\xintifTrueAelseB {\romannumeral0\xintiiifnotzero}% +\def\xintifFalseAelseB{\romannumeral0\xintiiifzero}% +\def\xintNot{\romannumeral0\XINT_signaldeprecated{xint}{xintNot}\xintiiiszero}% +\def\xintNOT{\romannumeral0\xintiiiszero}% \def\xintAND {\romannumeral0\xintand }% -\def\xintand #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo +\def\xintand #1#2{\if0\xintiiSgn{#1}\expandafter\xint_firstoftwo \else\expandafter\xint_secondoftwo\fi - { 0}{\xintisnotzero{#2}}}% + { 0}{\xintiiisnotzero{#2}}}% \def\xintOR {\romannumeral0\xintor }% -\def\xintor #1#2{\if0\xintSgn{#1}\expandafter\xint_firstoftwo +\def\xintor #1#2{\if0\xintiiSgn{#1}\expandafter\xint_firstoftwo \else\expandafter\xint_secondoftwo\fi - {\xintisnotzero{#2}}{ 1}}% + {\xintiiisnotzero{#2}}{ 1}}% \def\xintXOR {\romannumeral0\xintxor }% -\def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}% +\def\xintxor #1#2{\if\xintiiIsZero{#1}\xintiiIsZero{#2}% \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }% \def\xintANDof {\romannumeral0\xintandof }% \def\xintandof #1{\expandafter\XINT_andof_a\romannumeral`&&@#1\xint:}% @@ -381,45 +697,7 @@ {\XINT_xorof_a #2}% }% \def\XINT_xorof_e #1!#2{ #2}% -\def\xintGeq {\romannumeral0\xintgeq }% -\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\xint:}% -\def\xintiiGeq {\romannumeral0\xintiigeq }% -\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\xint:}% -\def\XINT_iigeq #1#2\xint:#3% -{% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: -}% -\def\XINT_geq #1#2\xint:#3% -{% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\xint:#2\xint: -}% -\def\XINT_geq_fork #1#2% -{% - \xint_UDzerofork - #1\XINT_geq_firstiszero - #2\XINT_geq_secondiszero - 0{}% - \krof - \xint_UDsignsfork - #1#2\XINT_geq_minusminus - #1-\XINT_geq_minusplus - #2-\XINT_geq_plusminus - --\XINT_geq_plusplus - \krof #1#2% -}% -\def\XINT_geq_firstiszero #1\krof 0#2#3\xint:#4\xint: - {\xint_UDzerofork #2{ 1}0{ 0}\krof }% -\def\XINT_geq_secondiszero #1\krof #20#3\xint:#4\xint:{ 1}% -\def\XINT_geq_plusminus #1-{\XINT_geq_plusplus #1{}}% -\def\XINT_geq_minusplus -#1{\XINT_geq_plusplus {}#1}% -\def\XINT_geq_minusminus --{\XINT_geq_plusplus {}{}}% -\def\XINT_geq_plusplus - {\expandafter\XINT_geq_finish\romannumeral0\XINT_cmp_plusplus}% -\def\XINT_geq_finish #1{\if-#1\expandafter\XINT_geq_no - \else\expandafter\XINT_geq_yes\fi}% -\def\XINT_geq_no 1{ 0}% -\def\XINT_geq_yes { 1}% -\def\xintiMax {\romannumeral0\xintimax }% +\def\xintiMax {\romannumeral0\XINT_signaldeprecated{xint}{xintiMax}\xintimax }% \def\xintimax #1% {% \expandafter\xint_max\romannumeral0\xintnum{#1}\xint: @@ -470,28 +748,7 @@ {% \unless\if1\romannumeral0\XINT_geq_plusplus{}{}% }% -\def\xintiMaxof {\romannumeral0\xintimaxof }% -\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\xint:}% -\def\XINT_imaxof_a -#1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}!}% -\def\XINT_imaxof_b #1!#2% - {\expandafter\XINT_imaxof_c\romannumeral`&&@#2!{#1}!}% -\def\XINT_imaxof_c #1% - {\xint_gob_til_xint: #1\XINT_imaxof_e\xint:\XINT_imaxof_d #1}% -\def\XINT_imaxof_d #1!% - {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}% -\def\XINT_imaxof_e #1!#2!{ #2}% -\def\xintiiMaxof {\romannumeral0\xintiimaxof }% -\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\xint:}% -\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1!}% -\def\XINT_iimaxof_b #1!#2% - {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2!{#1}!}% -\def\XINT_iimaxof_c #1% - {\xint_gob_til_xint: #1\XINT_iimaxof_e\xint:\XINT_iimaxof_d #1}% -\def\XINT_iimaxof_d #1!% - {\expandafter\XINT_iimaxof_b\romannumeral0\xintiimax {#1}}% -\def\XINT_iimaxof_e #1!#2!{ #2}% -\def\xintiMin {\romannumeral0\xintimin }% +\def\xintiMin {\romannumeral0\XINT_signaldeprecated{xint}{xintiMin}\xintimin }% \def\xintimin #1% {% \expandafter\xint_min\romannumeral0\xintnum{#1}\xint: @@ -542,7 +799,28 @@ {% \unless\if1\romannumeral0\XINT_geq_plusplus{}{}% }% -\def\xintiMinof {\romannumeral0\xintiminof }% +\def\xintiMaxof {\romannumeral0\XINT_signaldeprecated{xint}{xintiMaxof}\xintimaxof }% +\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_imaxof_a +#1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}!}% +\def\XINT_imaxof_b #1!#2% + {\expandafter\XINT_imaxof_c\romannumeral`&&@#2!{#1}!}% +\def\XINT_imaxof_c #1% + {\xint_gob_til_xint: #1\XINT_imaxof_e\xint:\XINT_imaxof_d #1}% +\def\XINT_imaxof_d #1!% + {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}% +\def\XINT_imaxof_e #1!#2!{ #2}% +\def\xintiiMaxof {\romannumeral0\xintiimaxof }% +\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1!}% +\def\XINT_iimaxof_b #1!#2% + {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2!{#1}!}% +\def\XINT_iimaxof_c #1% + {\xint_gob_til_xint: #1\XINT_iimaxof_e\xint:\XINT_iimaxof_d #1}% +\def\XINT_iimaxof_d #1!% + {\expandafter\XINT_iimaxof_b\romannumeral0\xintiimax {#1}}% +\def\XINT_iimaxof_e #1!#2!{ #2}% +\def\xintiMinof {\romannumeral0\XINT_signaldeprecated{xint}{xintiMinof}\xintiminof }% \def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral`&&@#1\xint:}% \def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}!}% \def\XINT_iminof_b #1!#2% @@ -582,284 +860,8 @@ \def\XINT_prod_loop_c {\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork }% \def\XINT_prod_finished\xint:\XINT_prod_loop_c\xint:\xint:#1\xint:\Z { #1}% -\def\xintiiMON {\romannumeral0\xintiimon }% -\def\xintiimon #1% -{% - \ifodd\xintiiLDg {#1} %<- intentional space - \xint_afterfi{ -1}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintiiMMON {\romannumeral0\xintiimmon }% -\def\xintiimmon #1% -{% - \ifodd\xintiiLDg {#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ -1}% - \fi -}% -\def\xintMON {\romannumeral0\xintmon }% -\def\xintmon #1% -{% - \ifodd\xintLDg {#1} %<- intentional space - \xint_afterfi{ -1}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintMMON {\romannumeral0\xintmmon }% -\def\xintmmon #1% -{% - \ifodd\xintLDg {#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ -1}% - \fi -}% -\def\xintiiOdd {\romannumeral0\xintiiodd }% -\def\xintiiodd #1% -{% - \ifodd\xintiiLDg{#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ 0}% - \fi -}% -\def\xintiiEven {\romannumeral0\xintiieven }% -\def\xintiieven #1% -{% - \ifodd\xintiiLDg{#1} %<- intentional space - \xint_afterfi{ 0}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintOdd {\romannumeral0\xintodd }% -\def\xintodd #1% -{% - \ifodd\xintLDg{#1} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ 0}% - \fi -}% -\def\xintEven {\romannumeral0\xinteven }% -\def\xinteven #1% -{% - \ifodd\xintLDg{#1} %<- intentional space - \xint_afterfi{ 0}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintDSHr {\romannumeral0\xintdshr }% -\def\xintdshr #1#2% -{% - \expandafter\XINT_dshr_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dshr_fork #1% -{% - \xint_UDzerominusfork - 0#1\XINT_dshr_xzeroorneg - #1-\XINT_dshr_xzeroorneg - 0-\XINT_dshr_xpositive - \krof #1% -}% -\def\XINT_dshr_xzeroorneg #1;{ 0}% -\def\XINT_dshr_xpositive -{% - \expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_dsx_xisPos -}% -\def\xintDSH {\romannumeral0\xintdsh }% -\def\xintdsh #1#2% -{% - \expandafter\XINT_dsh_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dsh_fork #1% -{% - \xint_UDzerominusfork - #1-\XINT_dsh_xiszero - 0#1\XINT_dsx_xisNeg_checkA - 0-{\XINT_dsh_xisPos #1}% - \krof -}% -\def\XINT_dsh_xiszero #1.#2;{ #2}% -\def\XINT_dsh_xisPos -{% - \expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_dsx_xisPos -}% -\def\xintDSx {\romannumeral0\xintdsx }% -\def\xintdsx #1#2% -{% - \expandafter\XINT_dsx_fork\the\numexpr#1\expandafter.\romannumeral`&&@#2;% -}% -\def\XINT_dsx_fork #1% -{% - \xint_UDzerominusfork - #1-\XINT_dsx_xisZero - 0#1\XINT_dsx_xisNeg_checkA - 0-{\XINT_dsx_xisPos #1}% - \krof -}% -\def\XINT_dsx_xisZero #1.#2;{{#2}{0}}% -\def\XINT_dsx_xisNeg_checkA #1.#2% -{% - \xint_gob_til_zero #2\XINT_dsx_xisNeg_Azero 0% - \expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.#2% -}% -\def\XINT_dsx_xisNeg_Azero #1;{ 0}% -\def\XINT_dsx_addzeros #1% - {\expandafter\XINT_dsx_append\romannumeral\XINT_rep#1\endcsname0.}% -\def\XINT_dsx_addzerosnofuss #1% - {\expandafter\XINT_dsx_append\romannumeral\xintreplicate{#1}0.}% -\def\XINT_dsx_append #1.#2;{ #2#1}% -\def\XINT_dsx_xisPos #1.#2% -{% - \xint_UDzerominusfork - #2-\XINT_dsx_AisZero - 0#2\XINT_dsx_AisNeg - 0-\XINT_dsx_AisPos - \krof #1.#2% -}% -\def\XINT_dsx_AisZero #1;{{0}{0}}% -\def\XINT_dsx_AisNeg #1.-#2;% -{% - \expandafter\XINT_dsx_AisNeg_checkiffirstempty - \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% -}% -\def\XINT_dsx_AisNeg_checkiffirstempty #1% -{% - \xint_gob_til_dot #1\XINT_dsx_AisNeg_finish_zero.% - \XINT_dsx_AisNeg_finish_notzero #1% -}% -\def\XINT_dsx_AisNeg_finish_zero.\XINT_dsx_AisNeg_finish_notzero.#1.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {-#1}}{0}% -}% -\def\XINT_dsx_AisNeg_finish_notzero #1.#2.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {#2}}{-#1}% -}% -\def\XINT_dsx_AisPos #1.#2;% -{% - \expandafter\XINT_dsx_AisPos_finish - \romannumeral0\XINT_split_xfork #1.#2\xint_bye2345678\xint_bye..% -}% -\def\XINT_dsx_AisPos_finish #1.#2.% -{% - \expandafter\XINT_dsx_end - \expandafter {\romannumeral0\XINT_num {#2}}% - {\romannumeral0\XINT_num {#1}}% -}% -\def\XINT_dsx_end #1#2{\expandafter{#2}{#1}}% -\def\xintDecSplit {\romannumeral0\xintdecsplit }% -\def\xintdecsplit #1#2% -{% - \expandafter\XINT_split_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\xintDecSplitL {\romannumeral0\xintdecsplitl }% -\def\xintdecsplitl #1#2% -{% - \expandafter\XINT_splitl_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\xintDecSplitR {\romannumeral0\xintdecsplitr }% -\def\xintdecsplitr #1#2% -{% - \expandafter\XINT_splitr_finish - \romannumeral0\expandafter\XINT_split_xfork - \the\numexpr #1\expandafter.\romannumeral`&&@#2% - \xint_bye2345678\xint_bye..% -}% -\def\XINT_split_finish #1.#2.{{#1}{#2}}% -\def\XINT_splitl_finish #1.#2.{ #1}% -\def\XINT_splitr_finish #1.#2.{ #2}% -\def\XINT_split_xfork #1% -{% - \xint_UDzerominusfork - #1-\XINT_split_zerosplit - 0#1\XINT_split_fromleft - 0-{\XINT_split_fromright #1}% - \krof -}% -\def\XINT_split_zerosplit .#1\xint_bye#2\xint_bye..{ #1..}% -\def\XINT_split_fromleft - {\expandafter\XINT_split_fromleft_a\the\numexpr\xint_c_viii-}% -\def\XINT_split_fromleft_a #1% -{% - \xint_UDsignfork - #1\XINT_split_fromleft_b - -{\XINT_split_fromleft_end_a #1}% - \krof -}% -\def\XINT_split_fromleft_b #1.#2#3#4#5#6#7#8#9% -{% - \expandafter\XINT_split_fromleft_clean - \the\numexpr1#2#3#4#5#6#7#8#9\expandafter - \XINT_split_fromleft_a\the\numexpr\xint_c_viii-#1.% -}% -\def\XINT_split_fromleft_end_a #1.% -{% - \expandafter\XINT_split_fromleft_clean - \the\numexpr1\csname XINT_split_fromleft_end#1\endcsname -}% -\def\XINT_split_fromleft_clean 1{ }% -\expandafter\def\csname XINT_split_fromleft_end7\endcsname #1% - {#1\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end6\endcsname #1#2% - {#1#2\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end5\endcsname #1#2#3% - {#1#2#3\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end4\endcsname #1#2#3#4% - {#1#2#3#4\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end3\endcsname #1#2#3#4#5% - {#1#2#3#4#5\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end2\endcsname #1#2#3#4#5#6% - {#1#2#3#4#5#6\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end1\endcsname #1#2#3#4#5#6#7% - {#1#2#3#4#5#6#7\XINT_split_fromleft_end_b}% -\expandafter\def\csname XINT_split_fromleft_end0\endcsname #1#2#3#4#5#6#7#8% - {#1#2#3#4#5#6#7#8\XINT_split_fromleft_end_b}% -\def\XINT_split_fromleft_end_b #1\xint_bye#2\xint_bye.{.#1}% puis . -\def\XINT_split_fromright #1.#2\xint_bye -{% - \expandafter\XINT_split_fromright_a - \the\numexpr#1-\numexpr\XINT_length_loop - #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: - \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% -{% - \xint_UDsignfork - #1\XINT_split_fromleft - -\XINT_split_fromright_Lempty - \krof -}% -\def\XINT_split_fromright_Lempty #1.#2\xint_bye#3..{.#2.}% -\def\xintiiSqrt {\romannumeral0\xintiisqrt }% -\def\xintiiSqrtR {\romannumeral0\xintiisqrtr }% \def\xintiiSquareRoot {\romannumeral0\xintiisquareroot }% -\def\xintiSqrt {\romannumeral0\xintisqrt }% -\def\xintiSqrtR {\romannumeral0\xintisqrtr }% -\def\xintiSquareRoot {\romannumeral0\xintisquareroot }% -\def\xintisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }% -\def\xintisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintisquareroot }% -\def\xintiisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }% -\def\xintiisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintiisquareroot }% -\def\XINT_sqrt_post #1#2{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}% -\def\XINT_sqrtr_post #1#2{\xintiiifLt {#2}{#1}% - { #1}{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}}% +\def\xintiSquareRoot{\romannumeral0\XINT_signaldeprecated{xint}{xintiSquareRoot}\xintisquareroot}% \def\xintisquareroot #1% {\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\xint:}% \def\xintiisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral`&&@#1\xint:}% @@ -1144,6 +1146,17 @@ \expandafter\XINT_sqrt_big_kloop #2.#1.% }% \def\XINT_sqrt_big_end #1#2#3{{#3}{#2}}% +\def\xintiiSqrt {\romannumeral0\xintiisqrt }% +\def\xintiisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }% +\def\XINT_sqrt_post #1#2{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}% +\def\xintiiSqrtR {\romannumeral0\xintiisqrtr }% +\def\xintiisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintiisquareroot }% +\def\XINT_sqrtr_post #1#2% + {\xintiiifLt {#2}{#1}{ #1}{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}}% +\def\xintiSqrt {\romannumeral0\XINT_signaldeprecated{xint}{xintiSqrt}\xintisqrt}% +\def\xintisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }% +\def\xintiSqrtR{\romannumeral0\XINT_signaldeprecated{xint}{xintiSqrtr}\xintisqrtr}% +\def\xintisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintisquareroot }% \def\xintiiBinomial {\romannumeral0\xintiibinomial }% \def\xintiibinomial #1#2% {% @@ -1153,7 +1166,7 @@ {% \expandafter\XINT_binom_fork \the\numexpr#1-#2.#2.#1.% }% -\def\xintiBinomial{\romannumeral0\xintibinomial}% +\def\xintiBinomial{\romannumeral0\XINT_signaldeprecated{xint}{xintiBinomial}\xintibinomial}% \let\xintibinomial\xintiibinomial \def\XINT_binom_fork #1#2.#3#4.#5#6.% {% @@ -1400,8 +1413,10 @@ {% \expandafter\XINT_pfac_fork\the\numexpr#1\expandafter.\the\numexpr #2.% }% -\def\xintiPFactorial{\romannumeral0\xintipfactorial}% +\def\xintiPFactorial{\romannumeral0\XINT_signaldeprecated{xint}{xintiPFactorial}\xintipfactorial}% \let\xintipfactorial\xintiipfactorial +\def\xintPFactorial{\romannumeral0\xintpfactorial}% +\let\xintpfactorial\xintiipfactorial \def\XINT_pfac_fork #1#2.#3#4.% {% \unless\ifnum #1#2<#3#4 \xint_dothis\XINT_pfac_one\fi @@ -1538,27 +1553,54 @@ \expandafter\XINT_mul_out \the\numexpr\expandafter\XINT_smallmul\the\numexpr \xint_c_x^viii+#1!% }% -\def\xintiiE {\romannumeral0\xintiie }% used in \xintMod. -\def\xintiie #1#2% - {\expandafter\XINT_iie_fork\the\numexpr #2\expandafter.\romannumeral`&&@#1;}% -\def\XINT_iie_fork #1% -{% - \xint_UDsignfork - #1\XINT_iie_neg - -\XINT_iie_a - \krof #1% -}% -\def\XINT_iie_a #1.% - {\expandafter\XINT_dsx_append\romannumeral\XINT_rep #1\endcsname 0.}% -\def\XINT_iie_neg #1.#2;{ #2}% -\catcode`! 11 -\def\xintMax {\Did_you_mean_iiMax?or_load_xintfrac!}% -\def\xintMin {\Did_you_mean_iiMin?or_load_xintfrac!}% -\def\xintMaxof {\Did_you_mean_iMaxof?or_load_xintfrac!}% -\def\xintMinof {\Did_you_mean_iMinof?or_load_xintfrac!}% -\def\xintSum {\Did_you_mean_iiSum?or_load_xintfrac!}% -\def\xintPrd {\Did_you_mean_iiPrd?or_load_xintfrac!}% -\catcode`! 12 +\def\xintBool #1{\romannumeral`&&@% + \csname if#1\endcsname\expandafter1\else\expandafter0\fi }% +\def\xintToggle #1{\romannumeral`&&@\iftoggle{#1}{1}{0}}% +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xint}% + {\PackageError{xint} +{Usage of deprecated macros!} +{These deprecated macros from xint.sty have been detected:\MessageBreak +\XINT_useiimessage{xintEq}% +\XINT_useiimessage{xintGeq}% +\XINT_useiimessage{xintGt}% +\XINT_useiimessage{xintLt}% +\XINT_useiimessage{xintGtorEq}% +\XINT_useiimessage{xintLtorEq}% +\XINT_useiimessage{xintIsZero}% +\XINT_useiimessage{xintIsNotZero}% +\XINT_useiimessage{xintIsOne}% +\XINT_useiimessage{xintOdd}% +\XINT_useiimessage{xintEven}% +\XINT_useiimessage{xintifSgn}% +\XINT_useiimessage{xintifCmp}% +\XINT_useiimessage{xintifEq}% +\XINT_useiimessage{xintifGt}% +\XINT_useiimessage{xintifLt}% +\XINT_useiimessage{xintifZero}% +\XINT_useiimessage{xintifNotZero}% +\XINT_useiimessage{xintifOne}% +\XINT_useiimessage{xintifOdd}% +\XINT_ifFlagRaised{xintNeq}% + {\string\xintNeq\space(use \string\xintiiNotEq\space or \string\xintNotEq\space from xintfrac!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintNot}% + {\string\xintNot\space(renamed to \string\xintNOT!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintMON}{\string\xintMON\MessageBreak}{}% +\XINT_ifFlagRaised{xintMMON}{\string\xintMMON\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMax}{\string\xintiMax\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMin}{\string\xintiMin\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMaxof}{\string\xintiMaxof\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMinof}{\string\xintiMinof\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSquareRoot}{\string\xintiSquareRoot\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqrt}{\string\xintiSqrt\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqrtR}{\string\xintiSqrtR\MessageBreak}{}% +\XINT_ifFlagRaised{xintiBinomial}{\string\xintiBinomial\MessageBreak}{}% +\XINT_ifFlagRaised{xintiPFactorial}{\string\xintiPFactorial\MessageBreak}{}% +They will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi \XINT_restorecatcodes_endinput% \endinput %% diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty index 4a3be168fc7..4888a8124cb 100644 --- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty +++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintbinhex: Expandable binary and hexadecimal conversions %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintbinhex}% - [2017/08/06 1.2n Expandable binary and hexadecimal conversions (JFB)]% + [2017/08/29 1.2o 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 \def\XINT_tmpa #1{\ifx\relax#1\else @@ -128,20 +128,6 @@ \def\XINT_zeroes_foriv_end\R\XINT_zeroes_foriv #1#2\W {\XINT_zeroes_foriv_done #1}% \def\XINT_zeroes_foriv_done #1\R{ #1}% -\def\XINT_unsepb_loop #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_unsep_clean - \the\numexpr 1#1\expandafter\XINT_unsep_clean - \the\numexpr 1#2\expandafter\XINT_unsep_clean - \the\numexpr 1#3\expandafter\XINT_unsep_clean - \the\numexpr 1#4\expandafter\XINT_unsep_clean - \the\numexpr 1#5\expandafter\XINT_unsep_clean - \the\numexpr 1#6\expandafter\XINT_unsep_clean - \the\numexpr 1#7\expandafter\XINT_unsep_clean - \the\numexpr 1#8\expandafter\XINT_unsep_clean - \the\numexpr 1#9\XINT_unsepb_loop -}% -\def\XINT_unsep_clean 1{\relax}% also in xintcore \def\xintDecToHex {\romannumeral0\xintdectohex }% \def\xintdectohex #1% {% @@ -173,9 +159,10 @@ \expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_update \the\numexpr#1#2#3#4% \xint_bye#9\XINT_dthb_lastpass\xint_bye - #5#6#7#8!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #9% + #5#6#7#8!\XINT_dthb_exclam\relax\XINT_dthb_nextfour #9% }% -\def\XINT_dthb_exclam {!\XINT_dthb_exclam!}% +\def\XINT_dthb_exclam {!\XINT_dthb_exclam\relax + \expandafter\XINT_dthb_update\the\numexpr}% \def\XINT_dthb_update #1!% {% \expandafter\XINT_dthb_update_a @@ -186,10 +173,10 @@ {% 0000+#1\expandafter#3\the\numexpr#2-#1*\xint_c_ii^xvi }% -\def\XINT_dthb_nextfour #1\Z #2#3#4#5#6% +\def\XINT_dthb_nextfour #1#2#3#4#5% {% - \xint_bye#6\XINT_dthb_lastpass\xint_bye - #2#3#4#5!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #6% + \xint_bye#5\XINT_dthb_lastpass\xint_bye + #1#2#3#4!\XINT_dthb_exclam\relax\XINT_dthb_nextfour#5% }% \def\XINT_dthb_lastpass\xint_bye #1!#2\xint_bye#3{#1!#3!}% \def\XINT_dth_tohex @@ -197,28 +184,18 @@ \expandafter\expandafter\expandafter\XINT_dth_tohex_a\csname\XINT_tofourhex }% \def\XINT_dth_tohex_a\endcsname{!\XINT_dth_tohex!}% -\def\XINT_dthb_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_dthb_update - \the\numexpr #1\expandafter\XINT_dthb_update - \the\numexpr #2\expandafter\XINT_dthb_update - \the\numexpr #3\expandafter\XINT_dthb_update - \the\numexpr #4\expandafter\XINT_dthb_update - \the\numexpr #5\expandafter\XINT_dthb_update - \the\numexpr #6\expandafter\XINT_dthb_update - \the\numexpr #7\expandafter\XINT_dthb_update - \the\numexpr #8\expandafter\XINT_dthb_update - \the\numexpr #9\XINT_dthb_a -}% -\def\XINT_dthb_again #1!#2!% -{% - \ifx\XINT_dthb_exclam#2% +\def\XINT_dthb_again #1!#2#3% +{% + \ifx#3\relax \expandafter\xint_firstoftwo \else \expandafter\xint_secondoftwo \fi - {\expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_a - \romannumeral`&&@\ifnum #1>\xint_c_ \xint_dothis{#1!}\fi\xint_orthat{}}% + {\expandafter\XINT_dthb_again + \the\numexpr + \ifnum #1>\xint_c_ + \xint_afterfi{\expandafter\XINT_dthb_update\the\numexpr#1}% + \fi}% {\ifnum #1>\xint_c_ \xint_dothis{#2#1!}\fi\xint_orthat{!#2!}}% }% \def\XINT_tofourhex #1!% diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty index f9e6c5f5241..fb5a8744899 100644 --- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintcfrac: Expandable continued fractions with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintcfrac}% - [2017/08/06 1.2n Expandable continued fractions with xint package (JFB)]% + [2017/08/29 1.2o Expandable continued fractions with xint package (JFB)]% \def\xintCFrac {\romannumeral0\xintcfrac }% \def\xintcfrac #1% {% @@ -371,12 +371,12 @@ }% \def\XINT_fgtc_e #1% {% - \xintifZero {#1}{\expandafter\xint_firstofone\xint_gobble_iii}% + \xintiiifZero {#1}{\expandafter\xint_firstofone\xint_gobble_iii}% {\XINT_fgtc_f {#1}}% }% \def\XINT_fgtc_f #1#2% {% - \xintifZero {#2}{\xint_thirdofthree}{\XINT_fgtc_g {#1}{#2}}% + \xintiiifZero {#2}{\xint_thirdofthree}{\XINT_fgtc_g {#1}{#2}}% }% \def\XINT_fgtc_g #1#2#3% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintcore.sty b/Master/texmf-dist/tex/generic/xint/xintcore.sty index 579e8de0ff0..b1f73e6a6c6 100644 --- a/Master/texmf-dist/tex/generic/xint/xintcore.sty +++ b/Master/texmf-dist/tex/generic/xint/xintcore.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintcore: Expandable arithmetic on big integers %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintcore}% - [2017/08/06 1.2n Expandable arithmetic on big integers (JFB)]% + [2017/08/29 1.2o Expandable arithmetic on big integers (JFB)]% \csname XINT_Clamped_istrapped\endcsname \csname XINT_ConversionSyntax_istrapped\endcsname \csname XINT_DivisionByZero_istrapped\endcsname @@ -123,6 +123,7 @@ \XINT_resetFlag{Overflow}% not encountered so far in xint code 1.2l % .. others .. }% +\def\XINT_RaiseFlag #1{\expandafter\xint_gobble_i\csname XINT_#1Flag_ON\endcsname}% %% NOT IMPLEMENTED! WORK IN PROGRESS! (ALL SIGNALS TRAPPED, NO HANDLERS USED) \catcode`. 11 \let\XINT_Clamped.handler\xint_firstofone % WIP @@ -147,13 +148,19 @@ \newcount\xint_c_x^viii_mone \xint_c_x^viii_mone 99999999 \newcount\xint_c_xii_e_viii \xint_c_xii_e_viii 1200000000 \newcount\xint_c_xi_e_viii_mone \xint_c_xi_e_viii_mone 1099999999 +\def\XINT_cuz_small#1{% +\def\XINT_cuz_small ##1##2##3##4##5##6##7##8% +{% + \expandafter#1\the\numexpr ##1##2##3##4##5##6##7##8\relax +}}\XINT_cuz_small{ }% \def\xintiNum {\romannumeral0\xintinum }% \def\xintinum #1% {% \expandafter\XINT_num_cleanup\the\numexpr\expandafter\XINT_num_loop \romannumeral`&&@#1\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z }% -\let\xintNum\xintiNum \let\xintnum\xintinum +\def\xintNum {\romannumeral0\xintnum }% +\let\xintnum\xintinum \def\XINT_num #1% {% \expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop @@ -171,17 +178,12 @@ }% \def\XINT_num_end\xint:#1\xint:{#1+\xint_c_\xint:}% empty input ok \def\XINT_num_cleanup #1\xint:#2\Z { #1}% -\def\XINT_cuz_small#1{% -\def\XINT_cuz_small ##1##2##3##4##5##6##7##8% -{% - \expandafter#1\the\numexpr ##1##2##3##4##5##6##7##8\relax -}}\XINT_cuz_small{ }% \def\xintiiSgn {\romannumeral0\xintiisgn }% \def\xintiisgn #1% {% \expandafter\XINT_sgn \romannumeral`&&@#1\xint: }% -\def\xintSgn {\romannumeral0\xintsgn }% +\def\xintSgn {\romannumeral0\XINT_signaldeprecated{xintcore}{xintSgn}\xintsgn }% \def\xintsgn #1% {% \expandafter\XINT_sgn \romannumeral0\xintnum{#1}\xint: @@ -215,7 +217,7 @@ {% \expandafter\XINT_opp \romannumeral`&&@#1% }% -\def\xintiOpp {\romannumeral0\xintiopp }% +\def\xintiOpp {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiOpp}\xintiopp }% \def\xintiopp #1% {% \expandafter\XINT_opp \romannumeral0\xintnum{#1}% @@ -234,7 +236,7 @@ {% \expandafter\XINT_abs \romannumeral`&&@#1% }% -\def\xintiAbs {\romannumeral0\xintiabs }% +\def\xintiAbs {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiAbs}\xintiabs }% \def\xintiabs #1% {% \expandafter\XINT_abs \romannumeral0\xintnum{#1}% @@ -246,17 +248,12 @@ -{ #1}% \krof }% -\def\xintiiFDg {\romannumeral0\xintiifdg }% -\def\xintiifdg #1% -{% - \expandafter\XINT_fdg \romannumeral`&&@#1\xint:\Z -}% \def\xintFDg {\romannumeral0\xintfdg }% -\def\xintfdg #1% -{% - \expandafter\XINT_fdg \romannumeral0\xintnum{#1}\xint:\Z -}% -\def\XINT_FDg #1{\romannumeral0\XINT_fdg #1\xint:\Z }% +\def\xintfdg #1{\expandafter\XINT_fdg \romannumeral`&&@#1\xint:\Z}% +\def\xintiiFDg {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiiFDg}\xintiifdg }% +\let\xintiifdg\xintfdg +\def\XINT_FDg #1% + {\romannumeral0\expandafter\XINT_fdg\romannumeral`&&@\xintnum{#1}\xint:\Z }% \def\XINT_fdg #1#2#3\Z {% \xint_UDzerominusfork @@ -265,12 +262,11 @@ 0-{ #1}% positive \krof }% -\def\xintLDg {\romannumeral0\xintldg }% -\def\xintldg #1{\expandafter\XINT_ldg_fork\romannumeral0\xintnum{#1}% - \XINT_ldg_c{}{}{}{}{}{}{}{}\xint_bye\relax}% -\def\xintiiLDg {\romannumeral0\xintiildg }% -\def\xintiildg #1{\expandafter\XINT_ldg_fork\romannumeral`&&@#1% +\def\xintLDg {\romannumeral0\xintldg }% +\def\xintldg #1{\expandafter\XINT_ldg_fork\romannumeral`&&@#1% \XINT_ldg_c{}{}{}{}{}{}{}{}\xint_bye\relax}% +\def\xintiiLDg {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiiLDg}\xintiildg }% +\let\xintiildg\xintldg \def\XINT_ldg_fork #1% {% \xint_UDsignfork @@ -575,7 +571,7 @@ {% \expandafter\XINT_cuz_small\xint_gob_til_sc #8#7#6#5#4#3#2#1% }% -\def\xintiAdd {\romannumeral0\xintiadd }% +\def\xintiAdd {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiAdd}\xintiadd }% \def\xintiadd #1{\expandafter\XINT_iadd\romannumeral0\xintnum{#1}\xint:}% \def\xintiiAdd {\romannumeral0\xintiiadd }% \def\xintiiadd #1{\expandafter\XINT_iiadd\romannumeral`&&@#1\xint:}% @@ -730,7 +726,7 @@ \def\XINT_add_m #1!{\expandafter\XINT_add_n\the\numexpr\xint_c_i+#1\xint:}% \def\XINT_add_n #1#2\xint:{1#2\expandafter!\the\numexpr\XINT_add_o #1}% \def\XINT_add_o #1{\if #12\expandafter\XINT_add_l\else\expandafter\XINT_add_ke \fi}% -\def\xintCmp {\romannumeral0\xintcmp }% +\def\xintCmp {\romannumeral0\XINT_signaldeprecated{xintcore}{xintCmp}\xintcmp }% \def\xintcmp #1{\expandafter\XINT_icmp\romannumeral0\xintnum{#1}\xint:}% \def\xintiiCmp {\romannumeral0\xintiicmp }% \def\xintiicmp #1{\expandafter\XINT_iicmp\romannumeral`&&@#1\xint:}% @@ -841,7 +837,7 @@ \expandafter\XINT_sub_nfork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: }% -\def\xintiSub {\romannumeral0\xintisub }% +\def\xintiSub {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiSub}\xintisub }% \def\xintisub #1{\expandafter\XINT_isub\romannumeral0\xintnum{#1}\xint:}% \def\XINT_isub #1#2\xint:#3% {% @@ -1039,7 +1035,7 @@ \the\numexpr \xint_c_xi_e_viii_mone-#1#2#3#4#5#6#7#8\XINT_sub_comp_loop }% \def\XINT_sub_comp_clean 1#1{+#1\relax}% -\def\xintiMul {\romannumeral0\xintimul }% +\def\xintiMul {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMul}\xintimul }% \def\xintimul #1% {% \expandafter\XINT_imul\romannumeral0\xintnum{#1}\xint: @@ -1215,17 +1211,7 @@ {% 1#6#7\expandafter!\the\numexpr \xint_c_x^viii+#1#2#3#4#5+#8!% }% -\def\xintiiQuo {\romannumeral0\xintiiquo }% -\def\xintiiRem {\romannumeral0\xintiirem }% -\def\xintiiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }% -\def\xintiirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }% -\def\xintiQuo {\romannumeral0\xintiquo }% -\def\xintiRem {\romannumeral0\xintirem }% -\def\xintiquo {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }% -\def\xintirem {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }% -%%\let\xintQuo\xintiQuo\let\xintquo\xintiquo % now removed -%%\let\xintRem\xintiRem\let\xintrem\xintirem % now removed -\def\xintiDivision {\romannumeral0\xintidivision }% +\def\xintiDivision {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivision}\xintidivision }% \def\xintidivision #1{\expandafter\XINT_idivision\romannumeral0\xintnum{#1}\xint:}% \def\XINT_idivision #1#2\xint:#3{\expandafter\XINT_iidivision_a\expandafter #1% \romannumeral0\xintnum{#3}\xint:#2\xint:}% @@ -1296,7 +1282,7 @@ \def\XINT_div_BisTwo #1#2% {% \expandafter\expandafter\expandafter\XINT_div_BisTwo_a - \ifodd\xintiiLDg{#2} \expandafter1\else \expandafter0\fi {#2}% + \ifodd\xintLDg{#2} \expandafter1\else \expandafter0\fi {#2}% }% \def\XINT_div_BisTwo_a #1#2% {% @@ -1822,7 +1808,19 @@ {% \xint_c_x^viii_mone+#3+(#1#2+#5)/#4!% }% -\def\xintiDivRound {\romannumeral0\xintidivround }% +\def\xintiiQuo {\romannumeral0\xintiiquo }% +\def\xintiiRem {\romannumeral0\xintiirem }% +\def\xintiiquo + {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintiidivision }% +\def\xintiirem + {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintiidivision }% +\def\xintiQuo {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiQuo}\xintiquo }% +\def\xintiRem {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiRem}\xintirem }% +\def\xintiquo + {\expandafter\xint_firstoftwo_thenstop\romannumeral0\xintidivision }% +\def\xintirem + {\expandafter\xint_secondoftwo_thenstop\romannumeral0\xintidivision }% +\def\xintiDivRound {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivRound}\xintidivround }% \def\xintidivround #1% {\expandafter\XINT_idivround\romannumeral0\xintnum{#1}\xint:}% \def\xintiiDivRound {\romannumeral0\xintiidivround }% @@ -1863,7 +1861,7 @@ \romannumeral0\XINT_div_prepare {#2}{#1#30}% \xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax }% -\def\xintiDivTrunc {\romannumeral0\xintidivtrunc }% +\def\xintiDivTrunc {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiDivTrunc}\xintidivtrunc }% \def\xintidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral0\xintnum{#1}\xint:}% \def\xintiiDivTrunc {\romannumeral0\xintiidivtrunc }% \def\xintiidivtrunc #1{\expandafter\XINT_iidivtrunc\romannumeral`&&@#1\xint:}% @@ -1893,7 +1891,7 @@ \def\XINT_iidivtrunc_pos #1#2\xint:#3\xint: {\expandafter\xint_firstoftwo_thenstop \romannumeral0\XINT_div_prepare {#2}{#1#3}}% -\def\xintiMod {\romannumeral0\xintimod }% +\def\xintiMod {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMod}\xintimod }% \def\xintimod #1{\expandafter\XINT_iimod\romannumeral0\xintnum{#1}\xint:}% \def\xintiiMod {\romannumeral0\xintiimod }% \def\xintiimod #1{\expandafter\XINT_iimod\romannumeral`&&@#1\xint:}% @@ -1928,7 +1926,7 @@ {% \expandafter\XINT_sqr\romannumeral0\xintiiabs{#1}\xint: }% -\def\xintiSqr {\romannumeral0\xintisqr }% +\def\xintiSqr {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiSqr}\xintisqr }% \def\xintisqr #1% {% \expandafter\XINT_sqr\romannumeral0\xintiabs{#1}\xint: @@ -1977,7 +1975,7 @@ \expandafter\xint_pow\the\numexpr #2\expandafter .\romannumeral`&&@#1\xint: }% -\def\xintiPow {\romannumeral0\xintipow }% +\def\xintiPow {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiPow}\xintipow }% \def\xintipow #1#2% {% \expandafter\xint_pow\the\numexpr #2\expandafter @@ -2116,8 +2114,8 @@ }% \def\xintiiFac {\romannumeral0\xintiifac }% \def\xintiifac #1{\expandafter\XINT_fac_fork\the\numexpr#1.}% -\def\xintiFac {\romannumeral0\xintifac }% -\let\xintifac\xintiifac +\def\xintiFac {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiFac}\xintifac }% +\let\xintifac \xintiifac % redefined by xintfrac \def\XINT_fac_fork #1#2.% {% \xint_UDzerominusfork @@ -2221,17 +2219,49 @@ \xint_c_x^viii+#1*(#1+\xint_c_i)*(#1+\xint_c_ii)*(#1+\xint_c_iii)!% }% \def\XINT_fac_loop_exit #1!#2;!#3{#3#2;!}% -\catcode`! 11 -\def\xintAbs {\Did_you_mean_iiAbs?or_load_xintfrac!}% -\def\xintOpp {\Did_you_mean_iiOpp?or_load_xintfrac!}% -\def\xintAdd {\Did_you_mean_iiAdd?or_load_xintfrac!}% -\def\xintSub {\Did_you_mean_iiSub?or_load_xintfrac!}% -\def\xintMul {\Did_you_mean_iiMul?or_load_xintfrac!}% -\def\xintPow {\Did_you_mean_iiPow?or_load_xintfrac!}% -\def\xintSqr {\Did_you_mean_iiSqr?or_load_xintfrac!}% -\def\xintQuo {\Removed!use_xintiQuo_or_xintiiQuo!}% -\def\xintRem {\Removed!use_xintiRem_or_xintiiRem!}% -\catcode`! 12 +\def\XINT_signaldeprecated #1#2% +{% + \XINT_ifFlagRaised{#2}% + {}% already encountered (if not hidden in a group...) + {\XINT_RaiseFlag{Deprecated-#1}\XINT_RaiseFlag{#2}% + \expandafter\XINT_expandableerror\expandafter + {\csname#2\endcsname (#1) is deprecated! (RET to proceed)}}% +}% +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xintcore}% + {\PackageError{xintcore} +{Usage of deprecated macros!} +{These deprecated macros from xintcore.sty have been detected:\MessageBreak +\XINT_useiimessage{xintSgn}% +\XINT_useiimessage{xintCmp}% +\XINT_ifFlagRaised{xintiOpp}{\string\xintiOpp\MessageBreak}{}% +\XINT_ifFlagRaised{xintiAbs}{\string\xintiAbs\MessageBreak}{}% +\XINT_ifFlagRaised{xintiiFDg}{\string\xintiiFDg\space(renamed to \string\xintFDg!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintiiLDg}{\string\xintiiLDg\space(renamed to \string\xintLDg!)\MessageBreak}{}% +\XINT_ifFlagRaised{xintiAdd}{\string\xintiAdd\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSub}{\string\xintiSub\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMul}{\string\xintiMul\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivision}{\string\xintiDivision\MessageBreak}{}% +\XINT_ifFlagRaised{xintiQuo}{\string\xintiQuo\MessageBreak}{}% +\XINT_ifFlagRaised{xintiRem}{\string\xintiRem\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivRound}{\string\xintiDivRound\MessageBreak}{}% +\XINT_ifFlagRaised{xintiDivTrunc}{\string\xintiDivTrunc\MessageBreak}{}% +\XINT_ifFlagRaised{xintiMod}{\string\xintiMod\MessageBreak}{}% +\XINT_ifFlagRaised{xintiSqr}{\string\xintiSqr\MessageBreak}{}% +\XINT_ifFlagRaised{xintiPow}{\string\xintiPow\MessageBreak}{}% +\XINT_ifFlagRaised{xintiFac}{\string\xintiFac\MessageBreak}{}% +They will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi +\def\XINT_useiimessage #1% used in LaTeX only +{% + \XINT_ifFlagRaised {#1}% + {\@backslashchar#1 + (load xintfrac or use \@backslashchar xintii\xint_gobble_iv#1!)\MessageBreak}% + {}% +}% \XINT_restorecatcodes_endinput% \endinput %% diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty index c9a92005f23..15789f2d24e 100644 --- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty +++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintexpr: Expandable expression parser %% --------------------------------------------------------------- @@ -81,7 +81,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintexpr}% - [2017/08/06 1.2n Expandable expression parser (JFB)]% + [2017/08/29 1.2o Expandable expression parser (JFB)]% \catcode`! 11 \let\XINT_Cmp \xintiiCmp \def\xint_gob_til_! #1!{}% ! with catcode 11 @@ -737,9 +737,9 @@ \XINT_expr_defbin_b {expr} {>=} {v}{vi} {xintGtorEq}% \XINT_expr_defbin_b {flexpr}{>=} {v}{vi} {xintGtorEq}% \XINT_expr_defbin_b {iiexpr}{>=} {v}{vi} {xintiiGtorEq}% -\XINT_expr_defbin_b {expr} {!=} {v}{vi} {xintNeq}% -\XINT_expr_defbin_b {flexpr}{!=} {v}{vi} {xintNeq}% -\XINT_expr_defbin_b {iiexpr}{!=} {v}{vi} {xintiiNeq}% +\XINT_expr_defbin_b {expr} {!=} {v}{vi} {xintNotEq}% +\XINT_expr_defbin_b {flexpr}{!=} {v}{vi} {xintNotEq}% +\XINT_expr_defbin_b {iiexpr}{!=} {v}{vi} {xintiiNotEq}% \XINT_expr_defbin_b {expr} {..} {iii}{vi} {xintSeq::csv}% \XINT_expr_defbin_b {flexpr}{..} {iii}{vi} {xintSeq::csv}% \XINT_expr_defbin_b {iiexpr}{..} {iii}{vi} {xintiiSeq::csv}% @@ -1360,7 +1360,7 @@ }% \let\XINT_expr_precedence_! \xint_c_x \def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop - \csname .=\xintiFac{\XINT_expr_unlock #1}\endcsname }% + \csname .=\xintFac{\XINT_expr_unlock #1}\endcsname }% \def\XINT_flexpr_op_! #1{\expandafter\XINT_expr_getop \csname .=\XINTinFloatFac{\XINT_expr_unlock #1}\endcsname }% \def\XINT_iiexpr_op_! #1{\expandafter\XINT_expr_getop @@ -2062,7 +2062,7 @@ {% \expandafter #1\expandafter #2\csname .=% \expandafter\XINT_expr_argandopt - \romannumeral`&&@\XINT_expr_unlock#3,,.\xintiFac\XINTinFloatFac + \romannumeral`&&@\XINT_expr_unlock#3,,.\xintFac\XINTinFloatFac \endcsname }% \def\XINT_flexpr_func_factorial #1#2#3% @@ -2150,7 +2150,7 @@ \def\XINT_expr_func_binomial #1#2#3% {% \expandafter #1\expandafter #2\csname .=% - \expandafter\expandafter\expandafter\xintiBinomial + \expandafter\expandafter\expandafter\xintBinomial \expandafter\XINT_expr_twoargs \romannumeral`&&@\XINT_expr_unlock #3,\endcsname }% @@ -2171,7 +2171,7 @@ \def\XINT_expr_func_pfactorial #1#2#3% {% \expandafter #1\expandafter #2\csname .=% - \expandafter\expandafter\expandafter\xintiPFactorial + \expandafter\expandafter\expandafter\xintPFactorial \expandafter\XINT_expr_twoargs \romannumeral`&&@\XINT_expr_unlock #3,\endcsname }% @@ -2568,8 +2568,8 @@ \xintFor #1 in {DivTrunc,Mod,Round,Trunc,iRound,iTrunc,iQuo,iRem, iiDivTrunc,iiDivRound,iiMod,iiQuo,iiRem,% - Lt,Gt,Eq,LtorEq,GtorEq,Neq,% - iiLt,iiGt,iiEq,iiLtorEq,iiGtorEq,iiNeq,% + Lt,Gt,Eq,LtorEq,GtorEq,NotEq,% + iiLt,iiGt,iiEq,iiLtorEq,iiGtorEq,iiNotEq,% Add,Sub,Mul,Div,Pow,E,% iiAdd,iiSub,iiMul,iiPow,iiE,% AND,OR,XOR,% @@ -2585,8 +2585,8 @@ }% \xintFor #1 in {Num,Irr,Abs,iiAbs,Sgn,iiSgn,TFrac,Floor,iFloor,Ceil,iCeil,% Sqr,iiSqr,iiSqrt,iiSqrtR,iiIsZero,iiIsNotZero,iiifNotZero,iiifSgn,% - Odd,Even,iiOdd,iiEven,Opp,iiOpp,iiifZero,iFac,iBinomial,% - iPFactorial,iiFac,iiBinomial,iiPFactorial,Bool,Toggle}\do + Odd,Even,iiOdd,iiEven,Opp,iiOpp,iiifZero,Fac,Binomial,% + PFactorial,iiFac,iiBinomial,iiPFactorial,Bool,Toggle}\do {\toks0 \expandafter{\the\toks0% \expandafter\let\csname xint#1NE\expandafter\endcsname\csname xint#1\expandafter diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty index 7bd7db6272c..4dda12fb0c2 100644 --- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintfrac: Expandable operations on fractions %% --------------------------------------------------------------- @@ -70,7 +70,31 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintfrac}% - [2017/08/06 1.2n Expandable operations on fractions (JFB)]% + [2017/08/29 1.2o Expandable operations on fractions (JFB)]% +\def\xintSgn {\romannumeral0\xintsgn }% deprecated from xintcore +\def\xintCmp {\romannumeral0\xintcmp }% deprecated from xintcore +\def\xintEq {\romannumeral0\xinteq }% deprecated from xint +\def\xintNeq #1#2% renamed into \xintNotEq + {\romannumeral0\XINT_signaldeprecated{xintfrac}{xintNeq}\xintifeq {#1}{#2}{0}{1}}% +\def\xintNotEq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% +\def\xintGt {\romannumeral0\xintgt }% +\def\xintLt {\romannumeral0\xintlt }% +\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% +\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% +\def\xintIsZero {\romannumeral0\xintiszero }% +\def\xintIsNotZero{\romannumeral0\xintisnotzero }% +\def\xintIsOne {\romannumeral0\xintisone }% +\def\xintOdd {\romannumeral0\xintodd }% +\def\xintEven {\romannumeral0\xinteven }% +\def\xintifSgn{\romannumeral0\xintifsgn }% +\def\xintifCmp{\romannumeral0\xintifcmp }% +\def\xintifEq {\romannumeral0\xintifeq }% +\def\xintifGt {\romannumeral0\xintifgt }% +\def\xintifLt {\romannumeral0\xintiflt }% +\def\xintifZero {\romannumeral0\xintifzero }% +\def\xintifNotZero{\romannumeral0\xintifnotzero }% +\def\xintifOne {\romannumeral0\xintifone }% +\def\xintifOdd {\romannumeral0\xintifodd }% \def\XINT_cntSgnFork #1% {% \ifcase #1\expandafter\xint_secondofthree @@ -843,7 +867,6 @@ }% \def\xintTTrunc {\romannumeral0\xintttrunc }% \def\xintttrunc {\xintitrunc\xint_c_}% -\let\xintNum \xintTTrunc \let\xintnum \xintttrunc \def\xintRound {\romannumeral0\xintround }% \def\xintiRound {\romannumeral0\xintiround }% @@ -1338,17 +1361,31 @@ \expandafter\XINT_fpow_pos_B\expandafter {#3}{#1}{#2}% }% \def\XINT_fpow_pos_B #1#2{\XINT_outfrac {#2}{#1}}% -\def\xintifac #1{\expandafter\XINT_fac_fork\the\numexpr \xintNum{#1}.}% +\def\xintifac #1{\expandafter\XINT_fac_fork\the\numexpr\xintNum{#1}.}% +\def\xintFac {\romannumeral0\xintfac}% +\def\xintfac #1{\expandafter\XINT_fac_fork\the\numexpr\xintNum{#1}.[0]}% \def\xintibinomial #1#2% {% \expandafter\XINT_binom_pre \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.% }% +\def\xintBinomial {\romannumeral0\xintbinomial}% +\def\xintbinomial #1#2% +{% + \expandafter\XINT_binom_pre + \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.[0]% +}% \def\xintipfactorial #1#2% {% \expandafter\XINT_pfac_fork \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.% }% +\def\xintPFactorial {\romannumeral0\xintpfactorial}% +\def\xintpfactorial #1#2% +{% + \expandafter\XINT_pfac_fork + \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.[0]% +}% \def\xintPrd {\romannumeral0\xintprd }% \def\xintprd #1{\expandafter\XINT_fprdexpr \romannumeral`&&@#1\xint:}% \def\XINT_fprdexpr {\XINT_fprod_loop_a {1/1[0]}}% @@ -2263,7 +2300,7 @@ }% \def\XINT_flpowerh_a #1;% {% - \if0\xintiiLDg{#1}\expandafter\XINT_flpowerh_int + \if0\xintLDg{#1}\expandafter\XINT_flpowerh_int \else\expandafter\XINT_flpowerh_b \fi #1.% }% @@ -2280,7 +2317,7 @@ }% \def\XINT_flpowerh_c #1.% {% - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \expandafter\XINT_flpowerh_d\else\expandafter\XINT_flpowerh_e \fi #1.% }% @@ -2357,7 +2394,7 @@ \def\XINT_flpower_loopI #1.% {% \if1\XINT_isOne {#1}\xint_dothis\XINT_flpower_ItoIII\fi - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \xint_dothis{\expandafter\XINT_flpower_loopI_odd}\fi \xint_orthat{\expandafter\XINT_flpower_loopI_even}% \romannumeral0\XINT_half @@ -2386,7 +2423,7 @@ \def\XINT_flpower_loopII #1.% {% \if1\XINT_isOne{#1}\xint_dothis\XINT_flpower_IItoIII\fi - \ifodd\xintiiLDg{#1} %<- intentional space + \ifodd\xintLDg{#1} %<- intentional space \xint_dothis{\expandafter\XINT_flpower_loopII_odd}\fi \xint_orthat{\expandafter\XINT_flpower_loopII_even}% \romannumeral0\XINT_half#1\xint_bye\xint_Bye345678\xint_bye @@ -3025,6 +3062,17 @@ {\romannumeral0\XINTinfloat[#1]{#3}}{#1}}% \def\XINT_infloatmod #1#2{\expandafter\XINT_infloatmod_a\expandafter {#2}{#1}}% \def\XINT_infloatmod_a #1#2#3{\XINTinfloat [#3]{\xintMod {#2}{#1}}}% +\ifdefined\documentclass\ifdefined\AtEndDocument + \AtEndDocument{% +\XINT_ifFlagRaised{Deprecated-xintfrac}% + {\PackageError{xintfrac} +{Usage of deprecated macros!} +{This deprecated macro from xintfrac.sty has been detected:\MessageBreak +\string\xintNeq\space(use \string\xintNotEq\space or xint's \string\xintiiNotEq!)\MessageBreak +It will get removed at some future release.}}% + {% no deprecated macro used (at top level...) + }% +}\fi\fi \XINT_restorecatcodes_endinput% \endinput %% diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty index 9c58b540367..981520a4909 100644 --- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty +++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintgcd: Euclidean algorithm with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintgcd}% - [2017/08/06 1.2n Euclide algorithm with xint package (JFB)]% + [2017/08/29 1.2o Euclide algorithm with xint package (JFB)]% \def\xintGCD {\romannumeral0\xintgcd }% \def\xintgcd #1% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintkernel.sty b/Master/texmf-dist/tex/generic/xint/xintkernel.sty index b74070c1f66..2a9707aab89 100644 --- a/Master/texmf-dist/tex/generic/xint/xintkernel.sty +++ b/Master/texmf-dist/tex/generic/xint/xintkernel.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintkernel: Paraphernalia for the xint packages %% --------------------------------------------------------------- @@ -156,7 +156,7 @@ \fi \XINT_providespackage \ProvidesPackage {xintkernel}% - [2017/08/06 1.2n Paraphernalia for the xint packages (JFB)]% + [2017/08/29 1.2o Paraphernalia for the xint packages (JFB)]% \chardef\xint_c_ 0 \chardef\xint_c_i 1 \chardef\xint_c_ii 2 diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty index 9e2716e98ba..7adc2b328da 100644 --- a/Master/texmf-dist/tex/generic/xint/xintseries.sty +++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xintseries: Expandable partial sums with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintseries}% - [2017/08/06 1.2n Expandable partial sums with xint package (JFB)]% + [2017/08/29 1.2o Expandable partial sums with xint package (JFB)]% \def\xintSeries {\romannumeral0\xintseries }% \def\xintseries #1#2% {% diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty index c1729296949..2c522f602f7 100644 --- a/Master/texmf-dist/tex/generic/xint/xinttools.sty +++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2n 2017/08/06 +%% The xint bundle 1.2o 2017/08/29 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xinttools: Expandable and non-expandable utilities %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xinttools}% - [2017/08/06 1.2n Expandable and non-expandable utilities (JFB)]% + [2017/08/29 1.2o Expandable and non-expandable utilities (JFB)]% \newtoks\XINT_toks \xint_firstofone{\let\XINT_sptoken= } %<- space here! \def\xintgodef {\global\xintodef }% |