summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-25 22:33:49 +0000
committerKarl Berry <karl@freefriends.org>2013-04-25 22:33:49 +0000
commitcfa2367936c9c7cf864687e098482ca255082a90 (patch)
treeac866948194b95c25e81846f3e653081ef2b2d0d
parent187cc38f863f09d028d2399e7a2b253bb8ba1a51 (diff)
xint (25apr13)
git-svn-id: svn://tug.org/texlive/trunk@30107 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/xint/README51
-rw-r--r--Master/texmf-dist/doc/generic/xint/xint.pdfbin348223 -> 492129 bytes
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.dtx4452
-rw-r--r--Master/texmf-dist/source/generic/xint/xint.ins9
-rw-r--r--Master/texmf-dist/tex/generic/xint/xint.sty171
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcfrac.sty1070
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty288
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintgcd.sty4
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintseries.sty178
9 files changed, 5369 insertions, 854 deletions
diff --git a/Master/texmf-dist/doc/generic/xint/README b/Master/texmf-dist/doc/generic/xint/README
index c313073378d..0ca361f28ca 100644
--- a/Master/texmf-dist/doc/generic/xint/README
+++ b/Master/texmf-dist/doc/generic/xint/README
@@ -4,13 +4,14 @@
% xintgcd.sty Euclidean algorithm with xint package
% xintfrac.sty Expandable operations on fractions
% xintseries.sty Expandable partial sums with xint package
+% xintcfrac Expandable continued fractions with xint package
% Copyright (C) 2013 by Jean-Francois Burnol
-% Version: v1.03 (2013/04/14)
+% Version: v1.04 (2013/04/25)
%----------------------------------------------------------------
-This work consists of the source file xint.dtx and of its derived
-files xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty, xint.ins
-and the documentation xint.pdf (or xint.dvi).
+This work consists of the source file xint.dtx and of its derived files
+xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty, xintcfrac.sty,
+xint.ins and the documentation xint.pdf (or xint.dvi).
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -29,32 +30,38 @@ Installation and Usage:
=======================
Run tex or latex on xint.dtx.
-
+
This will extract the style files xint.sty, xintgcd.sty, xintfrac.sty,
-xintseries.sty (and xint.ins). Files with the same names and in the
-same repertory will be overwritten. The tex (not latex) run will stop
-with the complaint that it does not understand \NeedsTeXFormat, but the
-style files will already have been extracted by that time.
+xintseries.sty, xintcfrac.sty (and xint.ins). Files with the same
+names and in the same repertory will be overwritten. The tex (not
+latex) run will stop with the complaint that it does not understand
+\NeedsTeXFormat, but the style files will already have been extracted
+by that time.
Alternatively, run tex or latex on xint.ins if available.
To get xint.pdf run pdflatex thrice on xint.dtx
- xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty
- -> TDS:tex/generic/xint/
- xint.dtx -> TDS:source/generic/xint/
- xint.pdf -> TDS:doc/generic/xint/
-
-It may be necessary to then refresh the TeX installation filename
-database.
+ xint.sty |
+ xintgcd.sty |
+ xintfrac.sty | --> TDS:tex/generic/xint/
+ xintseries.sty |
+ xintcfrac.sty |
+ xint.dtx --> TDS:source/generic/xint/
+ xint.pdf --> TDS:doc/generic/xint/
+
+ It may be necessary to then refresh the TeX installation filename
+ database.
Usage with LaTeX: \usepackage{xint}
- \usepackage{xintgcd} % (loads xint)
- \usepackage{xintfrac} % (loads xint)
- \usepackage{xintseries} % (loads xintfrac)
+ \usepackage{xintgcd} (loads xint)
+ \usepackage{xintfrac} (loads xint)
+ \usepackage{xintseries} (loads xintfrac)
+ \usepackage{xintcfrac} (loads xintfrac)
Usage with TeX: \input xint.sty\relax
- \input xintgcd.sty\relax % (loads xint)
- \input xintfrac.sty\relax % (loads xint)
- \input xintseries.sty\relax % (loads xintfrac)
+ \input xintgcd.sty\relax (loads xint)
+ \input xintfrac.sty\relax (loads xint)
+ \input xintseries.sty\relax (loads xintfrac)
+ \input xintcfrac.sty\relax (loads xintfrac)
diff --git a/Master/texmf-dist/doc/generic/xint/xint.pdf b/Master/texmf-dist/doc/generic/xint/xint.pdf
index b9a92b732d1..212c6c4ac65 100644
--- a/Master/texmf-dist/doc/generic/xint/xint.pdf
+++ b/Master/texmf-dist/doc/generic/xint/xint.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx
index 0fd44b0b4f1..eefcbb3971e 100644
--- a/Master/texmf-dist/source/generic/xint/xint.dtx
+++ b/Master/texmf-dist/source/generic/xint/xint.dtx
@@ -1,12 +1,13 @@
% -*- coding: iso-latin-1; -*-
-% This file: xint.dtx (1.03, 2013/04/14)
+% This file: xint.dtx (1.04, 2013/04/25)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%<xint>%% xint: Expandable operations on long numbers
%<xintgcd>%% xintgcd: Euclidean algorithm with xint package
%<xintfrac>%% xintfrac: Expandable operations on fractions
%<xintseries>%% xintseries: Expandable partial sums with xint package
+%<xintcfrac>%% xintcfrac: Expandable continued fractions with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
%%
@@ -15,10 +16,11 @@
% xintgcd.sty Euclidean algorithm with xint package
% xintfrac.sty Expandable operations on fractions
% xintseries.sty Expandable partial sums with xint package
+% xintcfrac.sty Expandable continued fractions with xint package
%
% This work consists of the source file xint.dtx and of its derived files
-% xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty, xint.ins and the
-% documentation xint.pdf (or xint.dvi).
+% xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty, xintcfrac.sty, xint.ins
+% and the documentation xint.pdf (or xint.dvi).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -39,19 +41,23 @@
% Run tex or latex on xint.dtx.
%
% This will extract the style files xint.sty, xintgcd.sty, xintfrac.sty,
-% xintseries.sty (and xint.ins). Files with the same names and in the
-% same repertory will be overwritten. The tex (not latex) run will stop
-% with the complaint that it does not understand \NeedsTeXFormat, but the
-% style files will already have been extracted by that time.
+% xintseries.sty, xintcfrac.sty (and xint.ins). Files with the same
+% names and in the same repertory will be overwritten. The tex (not
+% latex) run will stop with the complaint that it does not understand
+% \NeedsTeXFormat, but the style files will already have been extracted
+% by that time.
%
% Alternatively, run tex or latex on xint.ins if available.
%
% To get xint.pdf run pdflatex thrice on xint.dtx
%
-% xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty
-% -> TDS:tex/generic/xint/
-% xint.dtx -> TDS:source/generic/xint/
-% xint.pdf -> TDS:doc/generic/xint/
+% xint.sty |
+% xintgcd.sty |
+% xintfrac.sty | --> TDS:tex/generic/xint/
+% xintseries.sty |
+% xintcfrac.sty |
+% xint.dtx --> TDS:source/generic/xint/
+% xint.pdf --> TDS:doc/generic/xint/
%
% It may be necessary to then refresh the TeX installation filename
% database.
@@ -60,16 +66,18 @@
% \usepackage{xintgcd} % (loads xint)
% \usepackage{xintfrac} % (loads xint)
% \usepackage{xintseries} % (loads xintfrac)
+% \usepackage{xintcfrac} % (loads xintfrac)
%
% Usage with TeX: \input xint.sty\relax
% \input xintgcd.sty\relax % (loads xint)
% \input xintfrac.sty\relax % (loads xint)
% \input xintseries.sty\relax % (loads xintfrac)
+% \input xintcfrac.sty\relax % (loads xintfrac)
%
%<*none>
-\def\pkgversion{1.03}
-\def\pkgdate{2013/04/14}
-\def\lasttimestamp{Time-stamp: <15-04-2013 10:58:29 CEST jfb>}
+\def\lasttimestamp{Time-stamp: <25-04-2013 16:46:28 CEST BURNOL>}
+\def\pkgversion{1.04}
+\def\pkgdate{2013/04/25}
\def\striptimestamp #1 <#2 #3 #4 #5>{#2 at #3 #4}
\def\getdocdate #1 <#2-#3-#4 #5>{#4/#3/#2}
\edef\docdate{\expandafter\getdocdate\lasttimestamp}
@@ -83,7 +91,8 @@
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
\file{xintfrac.sty}{\from{xint.dtx}{xintfrac}}
-\file{xintseries.sty}{\from{xint.dtx}{xintseries}}}
+\file{xintseries.sty}{\from{xint.dtx}{xintseries}}
+\file{xintcfrac.sty}{\from{xint.dtx}{xintcfrac}}}
\endgroup
\iffalse
%</none>
@@ -91,8 +100,8 @@
%----------- to .ins file ----------------------------------------
%%
%% This is a generated file. Run tex or latex on this file to
-%% extract xint.sty, xintgcd.sty, xintfrac.sty and xintseries.sty
-%% from xint.dtx
+%% extract xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty
+%% and xintcfrac.sty from xint.dtx
%%
%% See xint.dtx for the statements of copyright and conditions of
%% distribution and/or modification of this work.
@@ -103,7 +112,8 @@
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
\file{xintfrac.sty}{\from{xint.dtx}{xintfrac}}
-\file{xintseries.sty}{\from{xint.dtx}{xintseries}}}
+\file{xintseries.sty}{\from{xint.dtx}{xintseries}}
+\file{xintcfrac.sty}{\from{xint.dtx}{xintcfrac}}}
\endbatchfile
%----------- end of .ins file ------------------------------------
%</ins>
@@ -113,10 +123,14 @@
\ProvidesFile{xint.dtx}[bundle source and documentation (\dtxtimestamp)]
\documentclass[a4paper,11pt,abstract]{scrdoc}
+%\OnlyDescription
+
\pagestyle{headings}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
+\usepackage{multicol}
+
%---- GEOMETRY WILL BE CHANGED FOR SOURCE CODE SECTIONS
\usepackage[hscale=0.66,vscale=0.75]{geometry}
@@ -128,31 +142,48 @@
%\usepackage{xintgcd}
%\usepackage{xintfrac}
-\usepackage{xintseries}
\usepackage{xintgcd}
+\usepackage{xintseries}
+\usepackage{xintcfrac}
-%---- CHANGING TOCDEPTH MIDWAY THROUGH THE MAIN TOC
+\usepackage{amsmath} % for \cfrac
\usepackage{etoc}
\makeatletter
+%---- CHANGING TOCDEPTH MIDWAY THROUGH THE MAIN TOC (1.04, 18 avril 2013)
+
+
\def\toctransition {%
\addtocontents {toc}{\protect\newtocdepth {1}}%
- % \setcounter{tocdepth}{1}% à cause des bookmarks de hyperref,
- % \def\etocaftertitlehook {\c@tocdepth 2 }% pour les local tocs
- % non finalement puisque je laisse tocdepth à 2 globalement plus besoin
- \let\newtocdepth\@gobble % mais ne pas oublier ça
+ \let\newtocdepth\@gobble
\etocmulticolstyle [1]{\subsection *{Contents}}%
\def\@pnumwidth{2em}% attention ce n'est pas une longueur.
% fait pour problème de overfull box au niveau des numéros de
% page dans les local tocs des sections implémentations
}
-% qu'est-ce qu'il faut pas faire !
-% (à cause de la gestion des bookmarks par hyperref)
-% je ne veux pas le sous-sections de la partie implémentation dans les
-% bookmarks, ou peut-être si en fait je les veux aussi? ce n'est pas gênant
-% dans les bookmarks.
\def\newtocdepth #1{\c@tocdepth #1 } % ainsi on modifie localement seulement
+
+%---- USING ETOC FOR CUSTOM SUBSECTION STYLE (pour 1.04, 21 avril 2013)
+
+% attention comme je crée un groupe pour les sous-sections, je dois donc faire
+% attention de positionner \toctransition *après* le début de la section
+% "implémentation de xint"
+
+\let\savedsectionline\l@section
+\etocsetstyle{section}{}{}
+ {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+\etocsetstyle{subsection}
+ {\begingroup
+ \setlength{\premulticols}{0pt}
+ \setlength{\multicolsep}{0pt}
+ \setlength{\columnsep}{1em}
+ \renewcommand*\etocmulticolpretolerance{-1}
+ \renewcommand*\etocmulticoltolerance{200}
+ \begin{multicols}{2}}{}
+ {\noindent\makebox[2.5em][l]{\etocnumber}\etocname\leaders\etoctoclineleaders\hfill\etocpage\endgraf}
+ {\end{multicols}\endgroup}%
+
\makeatother
%--- TXFONTS, AND TXTT MADE SMALLER AND ALLOWING HYPHENATION
@@ -234,12 +265,13 @@ pdfstartview=FitH,%
pdfpagemode=UseOutlines}
-%---- OUR CLEVER PRIVATE LITTLE MACRO FOR CENTERED LINES
+%---- OUR CLEVER PRIVATE LITTLE MACRO FOR CENTERING LINES
\makeatletter
% 7 mars 2013
% This macro allows to conveniently center a line inside a paragraph and still
% use therein \verb or other commands changing catcodes.
% A proposito, the \LaTeX \centerline uses \hsize and not \linewidth !
+% (which in my humble opinion is bad)
\newcommand*\centeredline {%
\ifhmode \\\relax
@@ -277,7 +309,8 @@ pdfpagemode=UseOutlines}
%
% De plus je retire le \do@noligs qui me gêne plutôt qu'autre chose,
% surtout maintenant que les espaces ne sont pas des control spaces
-% attention au signe - par contre
+%
+% attention au signe - par contre, on ne veut *pas* de ligatures avec lui
%
\def\noligminus {\kern \z@ \char`\-}
\begingroup\catcode`\-\active
@@ -301,29 +334,40 @@ pdfpagemode=UseOutlines}
% Note: il n'y a plus de \hyphenchar-1 dans le \DeclareFontFamily de t1txtt
% ATTENTION CEPENDANT À CE QUI SE PASSE EN CAS DE CHANGEMENT DE TAILLE
-\DeclareRobustCommand\csa[1]{{\ttfamily\char`\\#1}}
-
-\DeclareRobustCommand\csb[1]{\hyperref[#1]{\color{blue}\ttfamily\char`\\#1}}
-
-\DeclareRobustCommand\csbnolk[1]{{\color{blue}\ttfamily\char`\\#1}}
+\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\#1}}
+\DeclareRobustCommand\csb[1]{\hyperref[#1]{\color{blue}\ttfamily
+ \hyphenchar\font45 \char`\\#1}}
+\DeclareRobustCommand\csbnolk[1]{{\color{blue}\ttfamily
+ \hyphenchar\font45 \char`\\#1}}
\newcommand\csh[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
\newcommand\csbh[1]{\texorpdfstring{\csbnolk{#1}}{\textbackslash #1}}
-\newcommand\xintname {\texorpdfstring
- {{\color{joli}\ttfamily\bfseries xint}}
- {xint}\xspace}
+\makeatletter
+\@for\x:=xint,xintgcd,xintfrac,xintseries,xintcfrac\do
+{\expandafter\edef\csname\x name\endcsname
+ {\noexpand\texorpdfstring{{\noexpand\color{joli}\noexpand\ttfamily
+ \hyphenchar\font45
+ \noexpand\bfseries \x}}
+ {\x}\noexpand\xspace}}
+\makeatother
+
+% \newcommand\xintname {\texorpdfstring
+% {{\color{joli}\ttfamily\bfseries xint}}
+% {xint}\xspace}
-\newcommand\xintgcdname{\texorpdfstring
- {{\color{joli}\ttfamily\bfseries xintgcd}}
- {xintgcd}\xspace}
+% \newcommand\xintgcdname{\texorpdfstring
+% {{\color{joli}\ttfamily\bfseries xintgcd}}
+% {xintgcd}\xspace}
+
+% \newcommand\xintfracname{\texorpdfstring
+% {{\color{joli}\ttfamily\bfseries xintfrac}}
+% {xintfrac}\xspace}
+
+% \newcommand\xintseriesname{\texorpdfstring
+% {{\color{joli}\ttfamily\bfseries xintseries}}
+% {xintseries}\xspace}
-\newcommand\xintfracname{\texorpdfstring
- {{\color{joli}\ttfamily\bfseries xintfrac}}
- {xintfrac}\xspace}
-\newcommand\xintseriesname{\texorpdfstring
- {{\color{joli}\ttfamily\bfseries xintseries}}
- {xintseries}\xspace}
\frenchspacing
\renewcommand\familydefault\sfdefault
@@ -341,44 +385,49 @@ pdfpagemode=UseOutlines}
\thispagestyle{empty}
\rmfamily
-\begin{center}
- {\normalfont\Large The \xintname bundle: \xintname, \xintgcdname,
- \xintfracname, and \xintseriesname.\par}%
+\pdfbookmark[1]{Title page}{TOP}
+
+{\normalfont\Large\parindent0pt \parfillskip 0pt\relax
+ \leftskip 2cm plus 1fil \rightskip 2cm plus 1fil
+ The \xintname bundle: \xintname,
+ \xintgcdname, \xintfracname, \xintseriesname and \xintcfracname.\par}%
+{\centering
\textsc{Jean-François Burnol}\par
- \footnotesize \ttfamily
+ \footnotesize \ttfamily
jfbu (at) free (dot) fr\\
Package version: \pkgversion\ (\pkgdate)\\
Documentation generated from the source file\\
- with timestamp ``\dtxtimestamp''
-\end{center}
+ with timestamp ``\dtxtimestamp''\par
+}
\begin{abstract}
The \xintname package implements with expandable \TeX{} macros
the basic arithmetic operations of addition, subtraction,
multiplication and division, as applied to arbitrarily long
numbers represented as chains of digits with an optional minus
- sign.
-
- The \xintgcdname package provides implementations of the
- Euclidean algorithm and of its typesetting. The \xintfracname
- package extends the scope of \xintname to fractional numbers of
- arbitrary sizes ; \xintseriesname provides some basic
- functionality based on the \xintname and \xintfracname packages
- for computing in an expandable manner partial sums of series and
- power series with fractional coefficients.
-
- The packages may be used with Plain and with \LaTeX. All macros
- dealing with computations work purely by expansion, and may thus
- be used almost everywhere in \TeX{}.
+ sign. The \xintgcdname package provides implementations of the
+ Euclidean algorithm and of its typesetting.
+
+ The \xintfracname package extends the scope of \xintname to
+ fractional numbers of arbitrary sizes ; \xintseriesname provides
+ some basic functionality for computing in an expandable manner
+ partial sums of series and power series with fractional
+ coefficients. And \xintcfracname deals with the computation of
+ continued fractions.
+
+ The packages may be used with Plain and with \LaTeX. Most macros, and
+ all of those doing computations, work purely by expansion without
+ assignments, and may thus be used almost everywhere in \TeX{}.
\end{abstract}
% à cause des XX.YY, mais franchement tout ce qui concerne la
% table des matières est une catastrophe de conception avec LaTeX
% et scrartcl n'améliore pas les choses tant que ça ici.
-\makeatletter
-\def\l@subsection {\bprot@dottedtocline {2}{1.5em}{2.8em}}
-\makeatother
+% \makeatletter
+% \def\l@subsection {\bprot@dottedtocline {2}{1.5em}{2.8em}}
+% \makeatother
+% retiré car maintenant j'utilise etoc.
\tableofcontents
@@ -424,13 +473,6 @@ The present package is the result of this initial questioning.
I have aimed at speed wherever I could, and to the extent that I
could guess what was more efficient for \TeX{}.
-% After a while
-% though I did opt for more readable coding style in those parts of
-% the code which were not at the heart of repeatedly used loops. In
-% particular I started using \csa{ifnum} and \csa{ifcase} constructs
-% which I had completely avoided so far, working only with macro
-% expansions.
-
I wrote a version of addition which does \csa{numexpr} operations eight
digits at a time, but its additional overhead made it a bit slower
for numbers of up to a few hundreds digits and it became faster only for
@@ -439,12 +481,6 @@ taking a noticeable time, so I have chosen to retain the addition routine
which was most efficient for numbers having a few dozens to a few
hundreds digits.
-% This implementation is thus a \TeX nical thing, quite different
-% from what one would do in a structured programming language like
-% |C|, although the underlying algorithms are just the standard
-% steps applied to hand computations (nothing fancy like
-% Fast Fourier Transform...).
-
By the way, I used the word `speed', and yes \xintname enjoys
working `fast and efficiently' (within many quotes...) with 200
digits numbers, but surely any program in |C| using the |CPU| and
@@ -471,10 +507,10 @@ computation methods, nothing fancy like Fast Fourier Transform.
time.
\end{framed}
-To see \xintname in action on the traditional computations of
-$\pi$ and $\log 2$, jump to the
-\hyperref[xintFxPtPowerSeries]{\color{blue}{\csa{xintFxPtPowerSeries}
- documentation}}.
+To see \xintname in action, jump to the {\color{niceone}\autoref{sec:series}}
+describing the commands of the \xintseriesname{} package, especially as
+illustrated with the \hyperref[ssec:Machin]{\color{niceone}{traditional
+ computations of $\pi$ and $\log 2$}}.
\footnotetext[2]{this is well demonstrated by the
\href{http://www.ctan.org/pkg/pi}{\color{niceone}pi computing file} by
@@ -524,21 +560,31 @@ For the sake of typesetting this documentation and not have big numbers
extend into the margin and go beyond the page physical limits, I use
these commands (not provided by the package):
\begin{verbatim}
-\def\allownumbersplit #1%
-{%
- \ifx #1\relax \else #1\hskip 0pt plus 1pt\relax
- \expandafter\allownumbersplit\fi
-}%
-\def\printnumber #1%
-{\expandafter\expandafter\expandafter\allownumbersplit #1\relax }%
+\def\allowsplits #1{\ifx #1\relax \else #1\hskip 0pt plus 1pt \relax
+ \expandafter\allowsplits\fi}%
+\def\printnumber #1{\expandafter\expandafter\expandafter
+ \allowsplits #1\relax }%
% Expands twice before printing.
\end{verbatim}
-which is used for example as |\printnumber {\xintQuo{\xintiPow
-{2}{1000}}{\xintFac{100}}}|. Or, the computation can be done inside
-an \csa{edef}: |\edef\mynumber {\|\texttt{xint\-Quo}|{\xintiPow
-{2}{1000}}{\xintFac{100}}}| followed by |\printnumber\mynumber|. The macro
-is not part of the package and would need additional thinking for more
-general use.
+
+The |\printnumber| macro is not part of the package and would need
+additional thinking for more general use. It may be used as
+|\printnumber {\xintQuo{\xintiPow {2}{1000}}{\xintFac{100}}}|, or
+as |\printnumber\mynumber| if the macro |\mynumber| was previously
+defined via |\edef\mynumber {\|\texttt{xintQuo}|{\xintiPow
+ {2}{1000}}{\xintFac{100}}}|. A |\newcommand| or |\def| for the
+definition of |\mynumber| would not do for the reason which is
+explained in \autoref{item:xpxp} below (it would if we had inserted
+seven, and not only three |\expandafter|'s in the definition of |\printnumber|).
+
+Just to show off, let's print 300 digits (after the decimal point) of
+the decimal expansion of &0.7^{-25}&:
+\centeredline{|\printnumber {\xintTrunc {300}{\xintPow{.7}{-25}}}\dots|}
+\printnumber {\xintTrunc {300}{\xintPow{.7}{-25}}}\dots
+
+This computation uses \xintfracname wich extends to fractions the basic
+arithmetic operations defined for integers by \xintname.
+
Important points, to be noted, related to the double expansion of arguments:
\begin{enumerate}
@@ -563,15 +609,15 @@ Important points, to be noted, related to the double expansion of arguments:
{\xint|\-|iOpp\x}{\x}|\,=\,{\xintiAdd {\xintiOpp\x}{\x}}.
\def\x {12}%
-\item With the definition \centeredline{%
- |\def\AplusBC #1#2#3{\xintiAdd {#1}{\xintiMul {#2}{#3}}}|} one
+\item \label{item:xpxp} With the definition \centeredline{%
+ |\def\AplusBC #1#2#3{\xintAdd {#1}{\xintMul {#2}{#3}}}|} one
obtains an expandable macro producing the expected result, not
in two, but rather in three steps: a first expansion is consumed
- by the macro expanding to its definition. As a result {|\xintiAdd
+ by the macro expanding to its definition. As a result {|\xintAdd
{\AplusBC {1}{2}{3}}{4}|} would then miserably fail. The
solution is to use the \emph{lowercase} form of
- \csa{xintiAdd}: \smallskip\centeredline {|\def\AplusBC
- #1#2#3{|{\color{blue}|\romannumeral0\xintiadd |}|{#1}{\xintiMul {#2}{#3}}}|}
+ \csa{xintAdd}: \smallskip\centeredline {|\def\AplusBC
+ #1#2#3{|{\color{blue}|\romannumeral0\xintadd |}|{#1}{\xintMul {#2}{#3}}}|}
and then \csa{AplusBC} will share the same properties as do the
other \xintname `primitive' macros.
@@ -583,6 +629,7 @@ Important points, to be noted, related to the double expansion of arguments:
precisely to facilitate building-up higher level macros based on them.
\end{enumerate}
+
\section {Inputs (integers)}
\begin{framed}
@@ -591,21 +638,19 @@ Important points, to be noted, related to the double expansion of arguments:
expressions.
\end{framed}
-Each one of the package macros first does a double expansion of its
-arguments, and it expects the ensuing numbers to be strings of digits
-with one (and not more) optional minus sign (and not a plus
-sign).\footnote{these conditions are relaxed (\emph{only} for the
- extended macros) when \xintfracname is loaded: the number, even zero,
- may start with many minus signs; but plus signs are still forbidden.}
-The first digit is not zero if there are more than one digit. And |-0|
-is not legal input. Syntax such as |\xintMul\A\B| is accepted and
-equivalent\footnote{see however near the end of
- \hyperref[sec:outputs]{\color{niceone}this later section} for the
- important difference when used in contexts where \TeX{} expects a
- number, such as following an \csa{ifcase} or an \csa{ifnum}.} to
-|\xintMul {\A}{\B}|. Or course |\xintAdd\xintMul\A\B\C| does not work,
-the product operation must be put within braces:
-|\xintAdd{\xintMul\A\B}\C|.
+Each one of the package macros first does a double expansion of its arguments,
+and it expects the ensuing numbers to be strings of digits with one (and not
+more) optional minus sign (and not a plus sign).\footnote{with \xintfracname
+ loaded these conditions are relaxed for the macros which are extended to
+ accept fractions on input; the number or fraction, even zero, may then start
+ with multiple minus or plus signs.} The first digit is not zero if there are
+more than one digit. And |-0| is not legal input. Syntax such as |\xintMul\A\B|
+is accepted and equivalent\footnote{see however near the end of
+ \hyperref[sec:outputs]{\color{niceone}this later section} for the important
+ difference when used in contexts where \TeX{} expects a number, such as
+ following an \csa{ifcase} or an \csa{ifnum}.} to |\xintMul {\A}{\B}|. Or
+course |\xintAdd\xintMul\A\B\C| does not work, the product operation must be put
+within braces: |\xintAdd{\xintMul\A\B}\C|.
It would be nice to have a functional form |\add(x,\mul(y,z))| but
this is not provided by the package. Arguments must be either
@@ -672,25 +717,31 @@ computes the quotient in an euclidean division, remain
``integer-only'', and the previous section applies).
\edef\z {\xintAdd
- {367.8920280/---278.289287}{-109.2882/270.12898}}
+ {+--0367.8920280/-++278.289287}{-109.2882/+270.12898}}
-Here is a typical computation: \centeredline{|\xintAdd
- {367.8920280/---278.289287}{-109.2882/270.12898}|}%
+ Here is a typical computation: \centeredline{|\xintAdd
+ {+--0367.8920280/-++278.289287}{-109.2882/+270.12898}|}%
\centeredline{\texttt{=\z}}%
\centeredline{\texttt{=\xintIrr\z{} (irreducible)}}%
- \centeredline{\texttt{=\xintTrunc {50}{\z}\dots}} Signs (on
- input) may thus be either at the numerator or denominator, or at
- both (chains of |-| are ok, but still no |+| sign).
-An optional decimal point is
- authorized, both in the numerator and the denominator. It is
- also licit to use |\A/\B| as input if each of |\A| and |\B|
- expands in at most two steps to a ``decimal number'' as
- examplified above by the numerators and denominators. Or one may
- have just one macro |\C| which expands to such a ``fraction with
- optional decimal points'', or mixed things such as |\A
- 245/7.77|, where the numerator will be the concatenation of the
- expansion of |\A| and |245|. But, as explained already |123\A|
- is a no-go.
+ \centeredline{\texttt{=\xintTrunc {50}{\z}\dots}} Signs (on input) may
+ thus be either at the numerator or denominator, or at both; chains of
+ |-| and |+| signs are also ok\footnote{the documentation of version
+ |1.03| said wrongly not to use |+| signs, but in fact they were, and still
+ are, ok. This flexibility is only for macros accepting fractions on
+ input (the exponent of the power function may have neither a
+ |+| sign nor a decimal point). And |-| and |+| are allowed only as
+ unary operators, not as binary ones. Furthermore recall that they
+ can only prefix actual numbers, not macros expanding to numbers. }.
+ An optional decimal point is authorized, both in the numerator and the
+ denominator. A number can start directly with a decimal point:
+ |\xintPow{-.3/.7}{11}=|\texttt{\xintPow{-.3/+.7}{11}}. It is
+ also licit to use |\A/\B| as input if each of |\A| and |\B| expands in
+ at most two steps to a ``decimal number'' as examplified above by the
+ numerators and denominators. Or one may have just one macro |\C| which
+ expands to such a ``fraction with optional decimal points'', or mixed
+ things such as |\A 245/7.77|, where the numerator will be the
+ concatenation of the expansion of |\A| and |245|. But, as explained
+ already |123\A| is a no-go.
Lastly, input such as |16000/289072[17]| (or |3[-4]|) is
accepted and represents, respectively |(16000/289072)10^{17}|
@@ -703,10 +754,11 @@ An optional decimal point is
IMPORTANT!\ $\Bigg\{$\ }}}\vskip\dp\strutbox }
And, for this format,
ONLY the numerator may carry a UNIQUE minus sign (and no
- superfluous zeros).
+ superfluous zeros; and NO plus sign).
- This format with a power of ten represented by a number within
- square brackets is used by the \xintfracname macros for output.
+ The, more demanding, format with a power of ten represented by a number within
+ square brackets is the ouput format used by (almost all) \xintfracname
+ macros dealing with fractions.
It is allowed for user input but the parsing is minimal and it
is very important to follow the above rules. This reduced
flexibility, compared to the format without the square brackets,
@@ -739,31 +791,29 @@ example:
\section{Outputs (integers)}\label{sec:outputs}
-The output of macros of the \xintname package, when it consists of
-a single integer number, is in the normalized form previously
+The output of an integer-only macro of the \xintname package,
+when it consists of a single integer, is always in
+the unique normalized writing previously
described.\footnote{see the next section for the modifications
brought by loading the \xintfracname package.}
-Some macros
-have an output consisting of more than one number, each one is
-then within braces. For example \csb{xintDivision} gives first the
-quotient and then the remainder, each of them within braces. This
-is for programming purposes to avoid having to do twice the
-division, once for the quotient, the other one for the remainder: but
-of course macros \csb{xintQuo} and \csb{xintRem} are provided for easier
-direct access.
+Some macros have an output consisting of more than one number, each one
+is then within braces. This is case for the Euclidean division macro
+\csb{xintDivision} which gives first the quotient and then the
+remainder, both of them within braces. This is for programming purposes
+to avoid having to do twice the division, once for the quotient, the
+other one for the remainder: macros \csb{xintQuo} and
+\csb{xintRem} serve for easier direct access.
\def\n{\string{N\string}}
\def\x{\string{x\string}}
-The macro \csb{xintDecSplit}\x\n\ cuts its second
-argument |N| at a location specified by its first argument |x|, and returns the
-two pieces one after the other, each within braces. Depending on the value of
-|x| and the length of |N|, the first, or the second, output of
-\csa{xintDecSplit} may be \emph{empty}. Leading zeros in the second
-string of digits are neither removed. This is the only situation where a package
-macro may output something which would need to be input to \csa{xintNum} before
-further processing by the other package macros.
+See the \autoref{xintDecSplit} for a rare example of a
+bundle macro which may return an empty string, or a number prefixed by a
+chain of zeros. This is the only situation where a macro from package
+\xintname may output something which could need parsing through
+\csa{xintNum} before further processing by the other (integer-only)
+package macros.
When using things such as |\ifcase \xintSgn{\A}| one has to leave
a space after the closing brace for \TeX{} to
@@ -784,7 +834,7 @@ With |\def\A{1}|:
\section{Outputs (fractions)}
-When the package \xintfracname is loaded, the routines
+With package \xintfracname loaded, the routines
\csb{xintAdd}, \csb{xintSub}, \csb{xintMul}, \csb{xintPow},
\csb{xintSum}, \csb{xintPrd} are modified to allow fractions on
input,\footnote{of course, the power function does not accept a
@@ -809,46 +859,46 @@ points).\footnote{at each stage of the computations, the sum of
the length of |B|, must be kept less than
|2\string^\string{31\string}-9|.}
-As the present document loads the \xintfracname package, most
-examples with integers will use the \csb{xintiAdd},
-\csb{xintiSub}, \csb{xintiMul}, \csb{xintiPow}, \csb{xintiSum},
-\csb{xintiPrd}, macros which are the original un-modified
-integer-only versions. This is mandatory in particular when using
-their ouput as input to integer-only macros such as \csb{xintQuo}.
+The \csb{xintiAdd}, \csb{xintiSub}, \csb{xintiMul}, \csb{xintiPow},
+\csb{xintiSum}, \csb{xintiPrd} are the original un-modified integer-only
+versions. Their use is mandatory when inside integer-only macros such as
+\csb{xintQuo}.
The macro \csb{xintREZ} (remove zeros) puts all powers of ten into
-the |[n]|, and removes the |B| if it is less than |1|. The macro
+the |[n]|, and removes the |B| if it is then |1|. The macro
\csb{xintIrr} transforms |f| into its unique irreducible
-representative |C/D|, and prints |C| if |D=1|.
-
-The macro \csb{xintTrunc}|{N}{f}| prints\footnote{`prints' does
- not mean that this macro is only for outputting; to the contrary
- it is recommended to use it in intermediate results when doing
- things such as computing $\sum_{n=1}^{1000} \frac1n$, else the
- numbers manipulated by \xintname will be as big as $1000!$.
- Besides the package does not provide any `printing' facility;
- such facilities are necessary as \TeX{} by default will print a
- long number on a single line extending beyond the page limits.
- The \csa{printnumber} macro used in this documentation is just
- one way to deal with this problem (some other method should be
- used to guarantee that digits occupy the same width always.)}
-the decimal expansion of |f| with |N| digits after the decimal
-point.\footnote{the current release does not provide a macro to
- get the period of the decimal expansion.} Currently, it does not
-verify that |N| is non-negative and strange things could happen
-with a negative |N|. Of course a negative |f| is no problem,
-needless to say. When the original fraction is negative and its
-truncation has only zeros, it is printed as |-0.0...0|, with |N|
-zeros following the decimal point:
-\centeredline{|\xintTrunc {5}{\xintPow {-13}{-9}}=|\texttt{\xintTrunc {5}{\xintPow {-13}{-9}}}}%
-\centeredline{|\xintTrunc {20}{\xintPow {-13}{-9}}=|\texttt{\xintTrunc {20}{\xintPow {-13}{-9}}}}
-The output always contains a
-decimal point (even for |N=0|) followed by |N| digits, except when
-the original fraction was zero. In that case the output is |0|,
-with no decimal point.
-\centeredline{|\xintTrunc {10}{\xintSum {{1/2}{1/3}{1/5}{-31/30}}}=|%
-\texttt{\xintTrunc {10}{\xintSum {{1/2}{1/3}{1/5}{-31/30}}}}}
+representative |C/D|, and prints only the |C| if |D=1|.
+
+The macro \csb{xintTrunc}|{N}{f}| prints\footnote{`prints' does not at
+ all mean that this macro is designed for typesetting; I am just using
+ the verb here in analogy to the effect of a command of a command shell
+ computing software. The use of \csa{xintTrunc} is recommended when
+ attempting things such as computing $\sum_{n=1}^{1000} \frac1n$, else
+ the numbers manipulated by \xintname will be as big as $1000!$. The
+ exact computation is possible but does take a few dozens seconds;
+ computing an approximate value, say with 100 digits, is much faster.
+ Besides the package does not provide any `printing' facility; such
+ facilities are necessary as \TeX{} by default will print a long number
+ on a single line extending beyond the page limits. The
+ \csa{printnumber} macro used in this documentation is just one way to
+ deal with this problem (some other method should be used to guarantee
+ that digits occupy the same width always.)} the decimal expansion of
+|f| with |N| digits after the decimal point.\footnote{the current
+ release does not provide a macro to get the period of the decimal
+ expansion.} Currently, it does not verify that |N| is non-negative and
+strange things could happen with a negative |N|. Of course a negative
+|f| is no problem, needless to say. When the original fraction is
+negative and its truncation has only zeros, it is printed as |-0.0...0|,
+with |N| zeros following the decimal point: \centeredline{|\xintTrunc
+ {5}{\xintPow {-13}{-9}}=|\texttt{\xintTrunc {5}{\xintPow {-13}{-9}}}}%
+\centeredline{|\xintTrunc {20}{\xintPow {-13}{-9}}=|\texttt{\xintTrunc
+ {20}{\xintPow {-13}{-9}}}} The output always contains a decimal
+point (even for |N=0|) followed by |N| digits, except when the original
+fraction was zero. In that case the output is |0|, with no decimal
+point. \centeredline{|\xintTrunc {10}{\xintSum
+ {{1/2}{1/3}{1/5}{-31/30}}}=|%
+ \texttt{\xintTrunc {10}{\xintSum {{1/2}{1/3}{1/5}{-31/30}}}}}
The output of \csb{xintTrunc} may of course serve as input to the other
macros. And this is almost necessary when summing hundreds of
@@ -862,7 +912,8 @@ value without too much toll on the compilation time.
The macro \csb{xintiTrunc}|{N}{f}| is like \csa{xintTrunc}|{N}{f}|
followed by multiplication by |10^N|. Thus, it ouputs an integer
in a format acceptable by the integer-only macros. This is also
-convenient when computing partial sums of series: it is a bit
+convenient when computing partial sums of series, with a fixed number of
+digits after the decimal point: it is a bit
faster to sum with \csb{xintiSeries} the integers produced by
\csa{xintiTrunc}|{N}| than it is to use the general
\csb{xintSeries} on the decimal numbers produced by
@@ -879,8 +930,8 @@ fraction an exact computation would have produced.
To get the integer part of the decimal expansion of |f|, use
|\xintiTrunc{0}{f}|: \centeredline{|\xintiTrunc {0}{\xintPow
{1.01}{100}}=|\texttt{\xintiTrunc {0}\z}}%
-\centeredline{|\xintTrunc {10}{\xintPow
- {1.01}{100}}=|\texttt{\xintTrunc {10}\z}}
+\centeredline{|\xintTrunc {30}{\xintPow
+ {1.01}{100}}=|\texttt{\xintTrunc {30}\z}}
\section{Assignments}
@@ -947,10 +998,12 @@ the most significant: \cnta = \Out{0}
\endgroup
\end{verbatim}
+\edef\z{\xintiPow {2}{100}}
+
\newcount\cnta
\newcount\cntb
\begingroup
-\xintDigitsOf\xintiPow{2}{100}\to\Out
+\xintDigitsOf\z\to\Out
\cnta = 1
\cntb = 0
\loop
@@ -959,7 +1012,7 @@ the most significant: \cnta = \Out{0}
\advance\cnta 1
\repeat
-&2^{100}& (=\xintiPow {2}{100}) has \Out{0} digits and the sum of
+&2^{100}& (=\z) has \Out{0} digits and the sum of
their squares is \the\cntb. These digits are, from the least to
the most significant: \cnta = \Out{0}
\loop \Out{\the\cnta}\ifnum \cnta > 1 \advance\cnta -1 , \repeat.
@@ -983,7 +1036,7 @@ In the example above, we deliberately broke all rules of complete
expandability, but had we wanted to compute the sum of the digits,
not the sum of the squares, we could just have written:
\centeredline{\csb{xintiSum}|{\xintiPow{2}{100}}=|\texttt{%
- \xintiSum{\xintiPow{2}{100}}}} Indeed, \csa{xintiSum} is usually
+ \xintiSum\z}} Indeed, \csa{xintiSum} is usually
used as in \centeredline{%
\csb{xintiSum}|{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}=|\texttt{%
\xintiSum{{123}{-345}{\xintFac{7}}{\xintiOpp{\xintRem{3347}{591}}}}}}
@@ -996,8 +1049,32 @@ the double expansion will apply only to the minus sign and leave
unaffected the |\xintRem|. So we used \csa{xint}\-|iOpp| which replaces
a number with its opposite.
-As a last example of use of \csa{xintAssignArray} here is one line
-from the source code of the \xintgcdname macro
+\def\justone #1{1}%
+
+Release |1.04| of \xintname has more macros returning lists of things (each one
+within group braces, or a single token) such as the convergents of a continued
+fraction. The two new expandable commands \csb{xintApply} and
+\csb{xintListWithSep} help manipulate and display such lists without having to
+go through the un-expandable \csb{xintAssignArray}.
+\begin{verbatim}
+\newcommand{\justone}[1]{1}%
+|2^{100}| (=\xintiPow {2}{100}) has
+\xintiSum{\xintApply {\justone}{\xintiPow {2}{100}}}
+digits and the sum of their squares is
+\xintiSum{\xintApply {\xintiSqr}{\xintiPow {2}{100}}}.
+These digits are, from the least to the most significant:
+\xintListWithSep {, }{\xintRev{\xintiPow {2}{100}}}.
+\end{verbatim}
+|2^{100}| (=\z) has \xintiSum{\xintApply\justone\z} digits and the sum of
+their squares is \xintiSum{\xintApply\xintiSqr\z}. These digits are, from the
+least to the most significant: \xintListWithSep {, }{\xintRev\z}.
+
+Of course, one could spare the CPU some repetitions with an earlier
+|\edef\z{\xintiPow {2}{100}}|, and using |\z| in place of
+ |\xintiPow {2}{100}| everywhere in the above.
+
+As a last example with \csa{xintAssignArray} here is one line
+extracted from the source code of the \xintgcdname macro
\csb{xintTypesetEuclideAlgorithm}:
\centeredline{|\xintAssignArray\xintEuclideAlgorithm
{#1}{#2}\to\U|}
@@ -1036,62 +1113,90 @@ errors:
\xintError:NoBezoutForZeros
\end{verbatim}
+\section{Common errors when using the package macros}
+
+Here is a list of common 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 one pair of braces too many |\xintIrr{{\xintiPow {3}{13}}/243}| (the
+ computation goes through with no error signaled, but the result is completely
+ wrong).
+\item using |[]| and decimal points at the same time |1.5/3.5[2]|.
+\item using |[]| with a sign in the denominator |3/-5[7]|.
+\item defining macros which do not expand in only two steps and then use them as
+ arguments: |\def\x #1{\xintMON {#1}}|, |\xintAdd {\x{3}}{\x{2}}|.
+\item making a mistake in a macro name |\xintProduct {{2}{3}{4}}|. Well I should
+ |\let| it to be |\xintPrd|... at least such errors are not dangerous because
+ they do provoke compilation errors.
+\item loading \xintfracname and using expressions previously producing integers
+ but now in fraction format, as input to integer-only macros or as numerators
+ or denominators: |\edef\x{\xintMul {3}{5}/\xintMul{7}{9}}|. Using then this
+ |\x| in a fraction macro will most certainly cause a compilation error, with
+ its usual arcane and undecipherable accompanying message.
+\end{itemize}
+
+
\section{Package namespace}
-Inner macros of \xintname, \xintgcdname, \xintfracname, and
-\xintseriesname all begin either with |\XINT@| or with |\xint@|.
-The package public commands all start with |\xint|. The major
-forms have their initials capitalized, and lowercase forms,
-prefixed with |\romannumeral0|, allow definitions of further
-macros expanding in two steps to their full expansion (and can
-thus be chained with the `primitive' \xintname macros). Some other
-control sequence names are used only as delimiters, and left
-undefined.
-
-The |\xintReverseOrder|\marg{tokens} macro uses |\xint@UNDEF| and
-|\xint@undef| as dummy tokens and can be used on arbitrary token
-strings not containing these control sequence names. Anything
-within braces is treated as one unit: one level of exterior braces
-is removed and the contents are not reverted.
-
-% \clearpage
+Inner macros of \xintname, \xintgcdname, \xintfracname, \xintseriesname,
+and \xintcfracname{} all begin either with |\XINT@| or with |\xint@|. The
+package public commands all start with |\xint|. The major forms have
+their initials capitalized, and lowercase forms, prefixed with
+|\romannumeral0|, allow definitions of further macros expanding in two
+steps to their full expansion (and can thus be chained with the
+`primitive' \xintname macros). Some other control sequence names are
+used only as delimiters, and left undefined.
+
+% The |\xintReverseOrder|\marg{tokens} macro uses |\xint@UNDEF| and
+% |\xint@undef| as dummy tokens and can be used on arbitrary token
+% strings not containing these control sequence names. Anything
+% within braces is treated as one unit: one level of exterior braces
+% is removed and the contents are not reverted.
+
+
\section{Loading and usage}
\begin{verbatim}
- Usage with LaTeX: \usepackage{xint}
- \usepackage{xintgcd} % (loads xint)
- \usepackage{xintfrac} % (loads xint)
- \usepackage{xintseries} % (loads xintfrac)
-
- Usage with TeX: \input xint.sty\relax
- \input xintgcd.sty\relax % (loads xint)
- \input xintfrac.sty\relax % (loads xint)
- \input xintseries.sty\relax % (loads xintfrac)
+Usage with LaTeX: \usepackage{xint}
+ \usepackage{xintgcd} % (loads xint)
+ \usepackage{xintfrac} % (loads xint)
+ \usepackage{xintseries} % (loads xintfrac)
+ \usepackage{xintcfrac} % (loads xintfrac)
+
+Usage with TeX: \input xint.sty\relax
+ \input xintgcd.sty\relax % (loads xint)
+ \input xintfrac.sty\relax % (loads xint)
+ \input xintseries.sty\relax % (loads xintfrac)
+ \input xintcfrac.sty\relax % (loads xintfrac)
\end{verbatim}
We have added, directly copied from packages by \textsc{Heiko
- Oberdiek}, a mecanism of re-load and \eTeX{} detection,
+ Oberdiek}, a mecanism of re-load and \eTeX{} detection,
especially for Plain \TeX{}. As \eTeX{} is required, the
executable |tex| can not be used, |etex| or |pdftex| (version
|1.40| or later) or ..., must
be invoked.
-Furthermore, the packages \xintgcdname and \xintfracname will
-check for previous loading of \xintname, and will try to load it
-if this was not already done. And package \xintseriesname loads
-\xintfracname.
+Furthermore, the packages \xintgcdname and \xintfracname will check for
+the previous loading of \xintname, and will try to load it if this was
+not already done. Similarly \xintseriesname and \xintcfracname do the
+necessary loading of \xintfracname.
-Also inspired from the \textsc{Heiko Oberdiek} packages we have
-included a complete catcode protection mecanism. The packages may
-be loaded in any catcode configuration satisfying these
-requirements: the percent is comment character, the backslash is
+Also inspired from the \textsc{Heiko Oberdiek} packages we have included
+a complete catcode protection mecanism. The packages may be loaded in
+any catcode configuration satisfying these requirements: the percent is
+of category code comment character, the backslash is of category code
escape character, digits have category code other and letters have
category code letter. Nothing else is assumed, and the previous
-configuration is restored after the loading of the packages.
+configuration is restored after the loading of each one of the packages.
This is for the loading of the packages. For the actual use of the
macros, note that when feeding them with negative numbers the
-minus sign must have category code other, as is standard.
+minus sign must have category code other, as is standard. Similarly the
+slash used for inputting fractions must be of category other, as usual.
+And the square brackets also must be of category code other, if used on
+input.
The components of the \xintname bundle presuppose that the usual
\csa{space} and \csa{empty} macros are pre-defined, which is the case in
@@ -1108,23 +1213,27 @@ compatible. \csa{xintTypesetBezoutAlgorithm} also uses the
\section{Installation}
\begin{verbatim}
- Run tex or latex on xint.dtx.
-
- This will extract the style files xint.sty, xintgcd.sty, xintfrac.sty,
- xintseries.sty (and xint.ins). Files with the same names and in the
- same repertory will be overwritten. The tex (not latex) run will stop
- with the complaint that it does not understand \NeedsTeXFormat, but the
- style files will already have been extracted by that time.
-
- Alternatively, run tex or latex on xint.ins if available.
-
- To get xint.pdf run pdflatex thrice on xint.dtx
+Run tex or latex on xint.dtx.
+
+This will extract the style files xint.sty, xintgcd.sty, xintfrac.sty,
+xintseries.sty, xintcfrac.sty (and xint.ins). Files with the same
+names and in the same repertory will be overwritten. The tex (not
+latex) run will stop with the complaint that it does not understand
+\NeedsTeXFormat, but the style files will already have been extracted
+by that time.
+
+Alternatively, run tex or latex on xint.ins if available.
+
+To get xint.pdf run pdflatex thrice on xint.dtx
+
+ xint.sty |
+ xintgcd.sty |
+ xintfrac.sty | --> TDS:tex/generic/xint/
+ xintseries.sty |
+ xintcfrac.sty |
+ xint.dtx --> TDS:source/generic/xint/
+ xint.pdf --> TDS:doc/generic/xint/
- xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty
- -> TDS:tex/generic/xint/
- xint.dtx -> TDS:source/generic/xint/
- xint.pdf -> TDS:doc/generic/xint/
-
It may be necessary to then refresh the TeX installation filename
database.
\end{verbatim}
@@ -1148,21 +1257,22 @@ and to output a fraction (except for those which output |1|, |0| or |-1|). This
will be mentioned and the original macro \csa{xintAbc} remains then available
under the name \csa{xintiAbc}.
-The integer-only macros are more efficient on integers, even for simple things
-such as determining the sign of a number, as there is always some overhead due
-to parsing the fraction format on input; however except if one does really a lot
-of computations, there is no need in general to employ the integer-only
-variants, apart from one mandatory context:\vadjust{\vskip-\dp\strutbox
- \hbox{\smash{\color{niceone}\llap{\strut\small
- IMPORTANT!\ $\Bigg\{$\ }}}\vskip\dp\strutbox }
-when they are inside\strut{} other
-integer-only macros. For example |\xintQuo {\xintMul {2}{3}}{2}| will generate
-an error when \xintfracname is loaded, because |\xintMul {2}{3}| outputs
-|6/1[0]| which |\xintQuo| will not understand. So |\xintQuo {\xintiMul
- {2}{3}}{2}| is mandatory. And, when one has something which one knows to be an
-integer such as |\xintMul {1/2}{12}|, one can use either |\xintIrr {\xintMul
- {1/2}{12}}| or |\xintiTrunc {0}{\xintMul {1/2}{12}}| to produce it in the
-format which will be understood by integer-only macros.
+The integer-only macros are more efficient on integers, even for simple
+things such as determining the sign of a number, as there is always some
+overhead due to parsing the fraction format on input; however except if
+one does really a lot of computations, there is no need in general to
+employ the integer-only variants, apart from one mandatory
+context:\vadjust{\vskip-\dp\strutbox
+ \hbox{\smash{\color{niceone}\llap{\strut\small IMPORTANT!\ $\Bigg\{$\
+ }}}\vskip\dp\strutbox } when they are inside\strut{} other
+integer-only macros. For example |\xintQuo {\xintMul {2}{3}}{2}| will
+generate an error when \xintfracname is loaded, because |\xintMul
+{2}{3}| outputs \texttt{\xintMul {2}{3}} which |\xintQuo| will not
+understand. So |\xintQuo {\xintiMul {2}{3}}{2}| is mandatory. And, when
+one has something which one knows to be an integer such as |\xintMul
+{1/2}{12}|, one can use either |\xintIrr {\xintMul {1/2}{12}}| or
+|\xintiTrunc {0}{\xintMul {1/2}{12}}| to produce it in the format which
+will be understood by integer-only macros.
@@ -1249,8 +1359,10 @@ pure expansion contexts, as assignments are made via the
\subsection{\csbh{xintAssignArray}}\label{xintAssignArray}
+
\xintAssignArray\xintBezout {1000}{113}\to\Bez
+
\csa{xintAssignArray}\meta{braced things}\csa{to}\csa{myArray} first
double expands the first token then defines \csa{myArray} to be a
macro with one parameter, such that \csa{myArray\n} expands in two
@@ -1282,12 +1394,40 @@ an array giving all the digits of a given number.
|\digits{123}=|\digits{123}.
\endgroup
+\subsection{\csbh{xintApply}}\label{xintApply}
+
+{\small New in release |1.04|.\par}
+
+\def\macro #1{\the\numexpr 9-#1\relax}
+
+\csa{xintApply}|{\macro}{list}| applies the one parameter command |\macro| to
+each item in the `list' (no separator) given as second argument. For each item two
+expansions are done of |\macro| and the result is braced. On output, a new list
+with these braced results. The `list' may itself be some macro expanding in two
+steps to the list of tokens to which the command |\macro| will be applied. For
+example, if the `list' expands to some positive number, then each digit will be
+replaced by the result of applying |\macro| on it. \centeredline{|\def\macro
+ #1{\the\numexpr 9-#1\relax}|} \centeredline{|\xintApply\macro{\xintFac
+ {20}}=|\texttt{\xintApply\macro{\xintFac {20}}}}
+
+\subsection{\csbh{xintListWithSep}}\label{xintListWithSep}
+
+{\small New in release |1.04|.\par}
+
+\def\macro #1{\the\numexpr 9-#1\relax}
+
+\csa{xintListWithSep}|{sep}{list}| just inserts the given separator |sep|
+in-between all elements of the given list. See the discussion of
+\csb{xintApply}. \centeredline{|\xintListWithSep{:}{\xintFac
+ {20}}=|\texttt{\xintListWithSep{:}{\xintFac {20}}}}
+
\subsection{\csbh{xintSgn}}\label{xintiSgn}
\csa{xintSgn\n} returns 1 if the number is positive, 0 if it is
zero and -1 if it is negative. Extended by \xintfracname to fractions.
+
\subsection{\csbh{xintOpp}}\label{xintiOpp}
\csa{xintOpp\n} returns the opposite |-N| of the number |N|.
@@ -1355,9 +1495,10 @@ to fractions.
\subsection{\csbh{xintSumExpr}}\label{xintiSumExpr}
-\csa{xintSum}\meta{braced things}\csa{relax} is to what
-\csa{xintSum} reduces after its initial double expansion of its
-argument. \centeredline{%
+\csa{xintSumExpr}\meta{braced things}\csa{relax} is to what
+\csa{xintSum} expands. The argument is then double-expanded and should
+give a list of braced quantities or macros, each one will be double
+expanded in turn. \centeredline{%
\csa{xintiSumExpr}| {123}{-98763450}|%
|{\xintFac{7}}{\xintiMul{3347}{591}}\relax=|\texttt{%
\xintiSumExpr
@@ -1370,7 +1511,7 @@ in the future.
Extended by \xintfracname to fractions.
\subsection{\csbh{xintMul}}\label{xintiMul}
-{\small Modified in bundle version |1.03|.\par}
+{\small Modified in release |1.03|.\par}
\csa{xintMul\n\m} returns the product of the two numbers. Starting
with release |1.03| of \xintname, the macro checks the lengths of
@@ -1415,9 +1556,10 @@ Extended by \xintfracname to fractions.
\subsection{\csbh{xintProductExpr}}\label{xintiProductExpr}
-\csa{xintProductExpr}\meta{braced things}\csa{relax} is to what
-\csa{xintPrd} reduces after its initial double expansion of its
-argument.
+\csa{xintProductExpr}\marg{argument}\csa{relax} is to what
+\csa{xintPrd} expands ; its argument is then twice expanded and should
+give a list of braced numbers or macros. Each will be twice expanded
+when it is its turn.
\centeredline{\csa{xintiProductExpr}| 123456789123456789\relax=|\texttt{%
\xintiProductExpr 123456789123456789\relax}}
@@ -1489,7 +1631,7 @@ number is positive, this is the same as the remainder in the
euclidean division by ten.
\subsection{\csbh{xintMON}, \csbh{xintMMON}}\label{xintMON}\label{xintMMON}
-{\small New in bundle version |1.03|.\par}
+{\small New in version |1.03|.\par}
\csa{xintMON\n} returns |(-1)^N| and \csa{xintMMON\n} returns
|(-1)^{N-1}|. \centeredline{|\xintMON {-280914019374101929}=|\texttt{\xintMON
@@ -1524,7 +1666,7 @@ course), and for a non-negative |N| this is thus the same as the
quotient from the euclidean division by |10^x|.
\subsection{\csbh{xintDSHr}, \csbh{xintDSx}}\label{xintDSHr}\label{xintDSx}
-{\small New in bundle version |1.01|.\par}
+{\small New in release |1.01|.\par}
\csa{xintDSHr\x\n} expects |x| to be zero or positive and it returns
then a value |R| which is correlated to the value |Q| returned by
@@ -1588,7 +1730,7 @@ simultaneously.
\subsection{\csbh{xintDecSplit}}\label{xintDecSplit}
-{\small This has been modified in bundle version |1.01|.\par}
+{\small This has been modified in release |1.01|.\par}
\csa{xintDecSplit\x\n} cuts the number into two pieces (each one within a
pair of enclosing braces). First the sign if present is \emph{removed}.
@@ -1642,6 +1784,8 @@ of \csa{xintDecSplit}.
\section{Commands of the \xintgcdname package}
+This package was included in the original release |1.0| of the
+\xintname bundle.
\subsection{\csbh{xintGCD}}\label{xintGCD}
@@ -1756,7 +1900,8 @@ and modify it to what is needed.
\section{Commands of the \xintfracname package}
The general rule of the bundle that each macro first double-expands each one of
-its arguments applies.
+its arguments applies. This package was first included in release |1.03| of the
+\xintname bundle.
\subsection{\csbh{xintLen}}\label{xintLen}
@@ -1764,12 +1909,15 @@ The original macro is extended to accept a fraction on input.
\centeredline {|\xintLen {201710/298219}=|\texttt{\xintLen {201710/298219}},
|\xintLen {1234/1}=|\texttt{\xintLen {1234/1}}, |\xintLen {1234}=|\texttt{\xintLen {1234}}}
+
+
\subsection{\csbh{xintNumerator}}\label{xintNumerator}
-This returns the numerator corresponding to the internal representation of the
-fraction:\footnote{recall that the |[]| construct excludes presence of a decimal
- point.} \centeredline{|\xintNumerator
+This returns the numerator corresponding to the internal representation of a
+fraction, with positive powers of ten converted into zeros of this numerator:
+\centeredline{|\xintNumerator
{178000/25600000[17]}=|\texttt{\xintNumerator {178000/25600000[17]}}}%
+\centeredline{|\xintNumerator {312.289001/20198.27}=|\texttt{\xintNumerator {312.289001/20198.27}}}%
\centeredline{|\xintNumerator {178.000/25600000}=|\texttt{\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
@@ -1781,25 +1929,51 @@ This returns the denominator corresponding to the internal representation of the
fraction:\footnote{recall that the |[]| construct excludes presence of a decimal
point.} \centeredline{|\xintDenominator
{178000/25600000[17]}=|\texttt{\xintDenominator {178000/25600000[17]}}}%
+\centeredline{|\xintDenominator {312.289001/20198.27}=|\texttt{\xintDenominator {312.289001/20198.27}}}%
\centeredline{|\xintDenominator {178.000/25600000}=|\texttt{\xintDenominator
{178.000/25600000}}} As shown by the examples, no simplification of the
-input is done. The denominator looks wrong in the second example, but the
+input is done. The denominator looks wrong in the last example, but the
numerator was tacitly multiplied by &1000& through the removal of the decimal
point. For a result uniquely associated to the value of the fraction
first apply \csa{xintIrr}.
+\subsection{\csbh{xintRaw}}\label{xintRaw}
+
+{\small New with release |1.04|.\par}
+
+This macro `prints' the
+fraction |f| (after its parsing and expansion) in |A/B| form, with |A|
+as returned by \csa{xintNumerator}|{f}| and |B| as returned by
+\csa{xintDenominator}|{f}|.
+\centeredline{|\xintRaw{\the\numexpr 571*987\relax.123/\the\numexpr
+ -201+59\relax}=|}%
+\centeredline{\texttt{\xintRaw{\the\numexpr
+ 571*987\relax.123/\the\numexpr -201+59\relax}}}
+
+
\subsection{\csbh{xintFrac}}\label{xintFrac}
This is a \LaTeX{} only command, to be used in math mode only. It will print a
fraction, internally represented as something equivalent to |A/B[n]| as |\frac
-{A}{B}10^n|. The power of ten is omitted when |n=0| and the denominator is
-omitted when it is one, the number is then separated from the power of ten by a
+{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}$ and |$\xintFrac
-{3.5/5.7}$| gives $\xintFrac {3.5/5.7}$. As shown by the examples, no
-simplification of the input is done (apart from removing the decimal points and
-moving the sign to the numerator).
+|$\xintFrac {178.000/1}$| gives $\xintFrac {178.000/1}$, |$\xintFrac
+{3.5/5.7}$| gives $\xintFrac {3.5/5.7}$, and |$\xintFrac {\xintIrr
+ {\xintFac{10}/|\allowbreak|\xintiSqr{\xintFac {5}}}}$| gives $\xintFrac {\xintIrr
+ {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$. As shown by the examples,
+simplification of the input (apart from removing the decimal points and
+moving the minus sign to the numerator) is not done automatically and must be
+the result of macros such as |\xintIrr| or |\xintREZ|.
+\subsection{\csbh{xintSignedFrac}}\label{xintSignedFrac}
+
+{\small New with release |1.04|.\par}
+
+This is as \csb{xintFrac} except that a negative fraction has the sign put in
+front, not in the numerator.
+\centeredline{|\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\]|}
+\[\xintFrac {-355/113}=\xintSignedFrac {-355/113}\]
\subsection{\csbh{xintFwOver}}\label{xintFwOver}
@@ -1807,22 +1981,35 @@ This does the same as \csa{xintFrac} except that the \csa{over} primitive is
used for the fraction (in case the denominator is not one; and a pair of braces
contains the |A\over B| part). |$\xintFwOver {178.000/25600000}$| gives
$\xintFwOver {178.000/25600000}$, |$\xintFwOver {178.000/1}$| gives $\xintFwOver
-{178.000/1}$ and |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver {3.5/5.7}$.
+{178.000/1}$, |$\xintFwOver {3.5/5.7}$| gives $\xintFwOver {3.5/5.7}$, and
+|$\xintFwOver {\xintIrr {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$| gives
+$\xintFwOver {\xintIrr {\xintFac{10}/\xintiSqr{\xintFac {5}}}}$.
+
+\subsection{\csbh{xintSignedFwOver}}\label{xintSignedFwOver}
+
+{\small New with release |1.04|.\par}
+
+This is as \csb{xintFwOver} except that a negative fraction has the sign put in
+front, not in the numerator.
+\centeredline{|\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\]|}
+\[\xintFwOver {-355/113}=\xintSignedFwOver {-355/113}\]
+
+
\subsection{\csbh{xintSum}, \csbh{xintSumExpr}}\label{xintSum}\label{xintSumExpr}
-The originals are extended to accept fractions on input. Their outputs will now
-always be in the form |A/B[n]| or |A[n]| and thus cannot be used inside
-integer-only macros.
-The originals are preserved as \csa{xintiSum} and \csa{xintiSumExpr}.
+The original commands are extended to accept fractions on input and produce
+fractions on output. Their outputs will now always be in the form |A/B[n]| or
+|A[n]| and thus cannot be used inside integer-only macros. The originals are
+available as \csa{xintiSum} and \csa{xintiSumExpr}.
\subsection{\csbh{xintPrd}, \csbh{xintProductExpr}}\label{xintPrd}\label{xintProductExpr}
-The originals are extended to accept fractions on input. Their outputs will now
-always be in the form |A/B[n]| or |A[n]| and thus cannot be used inside
-integer-only macros.
-The originals are preserved as \csa{xintiPrd} and \csa{xintiPrdExpr}.
+The originals are extended to accept fractions on input and produce fractions on
+output. Their outputs will now always be in the form |A/B[n]| or |A[n]| and thus
+cannot be used inside integer-only macros. The originals are available as
+\csa{xintiPrd} and \csa{xintiPrdExpr}.
\subsection{\csbh{xintREZ}}\label{xintREZ}
@@ -1843,12 +2030,13 @@ and 5, so input such as |\xintIrr {2/3[100]}| will make \xintfracname do the
Euclidean division of |2|\raisebox{.5ex}{|.|}|10^{100}| by |3|, which is a bit
stupid.
-To avoid some overhead in the parsing by |\xintFrac| of the output of
+To avoid some overhead, in the parsing by |\xintFrac| of the output of
|\xintIrr|, add a |[0]|: |\xintFrac {\xintIrr {178.256/256.178}[0]}|. This
advice is only for \csa{xintIrr} (or \csa{xintJrr}) as these macros do not have
the |[n]| systematically present in the outputs of the other macros, |[n]| whose
rôle is also to signal that the format can be parsed in a minimal way, as it is
-not arbitrary user-input but beautiful package crafted output...
+not arbitrary user-input but beautiful package crafted output... and, this is
+really only if some piece of code will be executed thousands of times!
\subsection{\csbh{xintJrr}}\label{xintJrr}
@@ -1856,37 +2044,94 @@ not arbitrary user-input but beautiful package crafted output...
This also puts the fraction into its unique irreducible form:
\centeredline{|\xintJrr {178.256/256.178}=|%
\texttt{\xintJrr {178.256/256.178}}}%
-This is faster than \csa{xintIrr} for fractions having a substantial common
-factor in the numerator and the denominator, as here:
-|\xintJrr {\xintiMul{\xintFac {15}}{\xintFac
- {15}}/\xintiMul{\xintFac{10}}{\xintFac{30}}}=|\texttt{%
- \xintJrr {\xintiMul{\xintFac {15}}{\xintFac
- {15}}/\xintiMul{\xintFac{10}}{\xintFac{30}}}}. But to notice the
+This is faster than \csa{xintIrr} for fractions having some big common
+factor in the numerator and the denominator.\par
+{\centering |\xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiProductExpr
+{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }=|\texttt{%
+ \xintJrr {\xintiPow{\xintFac {15}}{3}/\xintiProductExpr
+{\xintFac{10}}{\xintFac{30}}{\xintFac{5}}\relax }}\par} But to notice the
difference one would need computations with much bigger numbers than in this
example.
\subsection{\csbh{xintTrunc}}\label{xintTrunc}
-\csa{xintTrunc}|{N}{f}| outputs the start of the decimal expansion of the
+\csa{xintTrunc}|{N}{f}| returns the start of the decimal expansion of the
fraction |f|, with |N| digits after the decimal point. The argument |N| should
be non-negative. When |N=0|, the integer part of |f| results, with an ending
decimal point. Only when |f| evaluates to zero does \csa{xintTrunc} not print
-the decimal point. When |f| is not zero, the sign is maintained in the output,
+a decimal point. When |f| is not zero, the sign is maintained in the output,
also when the digits are all zero. \centeredline{|\xintTrunc
- {20}{-803.2028/20905.298}=|\texttt{\xintTrunc {20}{-803.2028/20905.298}}} The
-digits printed are exact up to and including the last one.
+ {16}{-803.2028/20905.298}=|\texttt{\xintTrunc {16}{-803.2028/20905.298}}}%
+ \centeredline{|\xintTrunc
+ {20}{-803.2028/20905.298}=|\texttt{\xintTrunc {20}{-803.2028/20905.298}}}%
+ \centeredline{|\xintTrunc
+ {10}{\xintPow {-11}{-11}}=|\texttt{\xintTrunc
+ {10}{\xintPow {-11}{-11}}}}%
+ \centeredline{|\xintTrunc
+ {12}{\xintPow {-11}{-11}}=|\texttt{\xintTrunc
+ {12}{\xintPow {-11}{-11}}}}%
+\centeredline{|\xintTrunc {12}{\xintAdd {-1/3}{3/9}}=|\texttt{\xintTrunc {12}{\xintAdd {-1/3}{3/9}}}} The
+digits printed are exact up to and including the last one. The identity
+|\xintTrunc {N}{-f}=-\xintTrunc {N}{f}| holds.\footnote{this is just a notation;
+ currently |-\string\x| is not valid input to any package macro, one must use
+ |\string\xintOpp\string{\string\x\string}| or |\string\xintiOpp\string{\string\x\string}|.}
\subsection{\csbh{xintiTrunc}}\label{xintiTrunc}
-\csa{xintiTrunc}|{N}{f}| outputs the integer equal to |10^N| times what
+\csa{xintiTrunc}|{N}{f}| returns the integer equal to |10^N| times what
\csa{xintTrunc}|{N}{f}| would return. \centeredline{|\xintiTrunc
- {20}{-803.2028/20905.298}=|\texttt{\xintiTrunc {20}{-803.2028/20905.298}}} The
-difference between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}| is that
-the former cannot be used inside integer-only macros, whereas the latter
+ {16}{-803.2028/20905.298}=|\texttt{\xintiTrunc {16}{-803.2028/20905.298}}}%
+ \centeredline{|\xintiTrunc
+ {10}{\xintPow {-11}{-11}}=|\texttt{\xintiTrunc
+ {10}{\xintPow {-11}{-11}}}}%
+ \centeredline{|\xintiTrunc
+ {12}{\xintPow {-11}{-11}}=|\texttt{\xintiTrunc
+ {12}{\xintPow {-11}{-11}}}}%
+Differences between \csa{xintTrunc}|{0}{f}| and \csa{xintiTrunc}|{0}{f}|:
+the former cannot be used inside integer-only macros, and the latter
removes the decimal point, and never returns |-0| (and of course removes
all superfluous leading zeros.)
+\subsection{\csbh{xintRound}}\label{xintRound}
+
+{\small New with release |1.04|.\par}
+
+\csa{xintRound}|{N}{f}| returns the start of the decimal expansion of the
+fraction |f|, rounded to |N| digits precision after the decimal point. The
+argument |N| should be non-negative. Only when |f| evaluates exactly to zero
+does \csa{xintRound} return |0| without decimal point. When |f| is not zero, its
+sign is given in the output, also when the digits printed are all zero.
+\centeredline{|\xintRound {16}{-803.2028/20905.298}=|\texttt{\xintRound
+ {16}{-803.2028/20905.298}}}%
+ \centeredline{|\xintRound
+ {20}{-803.2028/20905.298}=|\texttt{\xintRound {20}{-803.2028/20905.298}}}%
+ \centeredline{|\xintRound
+ {10}{\xintPow {-11}{-11}}=|\texttt{\xintRound
+ {10}{\xintPow {-11}{-11}}}}%
+ \centeredline{|\xintRound
+ {12}{\xintPow {-11}{-11}}=|\texttt{\xintRound
+ {12}{\xintPow {-11}{-11}}}}%
+\centeredline{|\xintRound {12}{\xintAdd {-1/3}{3/9}}=|\texttt{\xintRound
+ {12}{\xintAdd {-1/3}{3/9}}}}
+The identity |\xintRound {N}{-f}=-\xintRound {N}{f}| holds. And regarding
+$(-11)^{-11}$ here is some more or its expansion:
+\centeredline{\xintTrunc {50}{\xintPow {-11}{-11}}\dots}
+
+\subsection{\csbh{xintiRound}}\label{xintiRound}
+
+{\small New with release |1.04|.\par}
+
+\csa{xintiRound}|{N}{f}| returns the integer equal to |10^N| times what
+\csa{xintRound}|{N}{f}| would return. \centeredline{|\xintiRound
+ {16}{-803.2028/20905.298}=|\texttt{\xintiRound {16}{-803.2028/20905.298}}}%
+\centeredline{|\xintiRound {10}{\xintPow {-11}{-11}}=|\texttt{\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 of course removes
+all superfluous leading zeros.)
+
\subsection{\csbh{xintMul}}\label{xintMul}
The original macro is extended to accept fractions on input. Its output will now
@@ -1965,10 +2210,11 @@ directly inside integer-only macros anymore. The original is preserved as
\csa{xintiAbs}.
-\section{Commands of the \xintseriesname package}
+\section{Commands of the \xintseriesname package}\label{sec:series}
There will be some exceptions to the general rule that
-each macro first double-expands each one of its arguments.
+each macro first double-expands each one of its arguments. This package was
+first released with version |1.03| of the \xintname bundle.
\subsection{\csbh{xintSeries}}\label{xintSeries}
@@ -1978,115 +2224,548 @@ each macro first double-expands each one of its arguments.
\csa{xintSeries}|{A}{B}{\coeff}| evaluates the sum of all values of the |\coeff
{n}| from |n=A| to and including |n=B|. The initial and final indices must
-(after double-expansion) obey the \TeX{} constraint of being explicit numbers of
-values at most |2^31-1| (these conditions are not checked by the macro). The
-|\coeff| macro (which, as argument to \csa{xintSeries} is double-expanded only
-at the time of computing the successive |\coeff {n}|) should be defined as a
-one-parameter command, accepting on input a number (not a count register) and
-needing at most two expansions to compute its final result.
+(after double-expansion) obey the \TeX{} and |\numexpr| constraint of being
+explicit numbers at most |2^31-1| (these conditions are not checked by
+the macro). The |\coeff| macro (which, as argument to \csa{xintSeries} is
+double-expanded only at the time of computing the successive |\coeff {n}|)
+should be defined as a one-parameter command, accepting on input a number (not a
+count register) and needing at most two expansions to compute its final result.
\begin{verbatim}
\def\coeff #1{\romannumeral0\xintmon{#1}/#1.5} % (-1)^n/(n+1/2)
-\edef\w {\xintSeries {0}{50}{\coeff}}
-\edef\z {\xintJrr {\w}[0]}
-% \xintJrr as a big common factor is suspected.
+\edef\w {\xintSeries {0}{50}{\coeff}} % we want to re-use it
+\edef\z {\xintJrr {\w}[0]} % the [0] for a microsecond gain.
+% \xintJrr preferred to \xintIrr: a big common factor is suspected.
+% But numbers much bigger would be needed to show the greater efficiency.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]
\end{verbatim}
-\vspace*{-\baselineskip}
-\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \]
-For info, before action by |\xintJrr| the inner representation of the result
-has a denominator of |\xintLen {\xintDenominator\w}=|\xintLen
-{\xintDenominator\w} digits.
+\vspace*{-.5\baselineskip}
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintFrac\z \] For info,
+before action by |\xintJrr| the inner representation of the result has a
+denominator of |\xintLen {\xintDenominator\w}=|\xintLen
+{\xintDenominator\w} digits. This troubled me as &101!!& has only 81
+digits: |\xintLen {\xintQuo {\xintFac {101}}{\xintiMul {\xintiPow
+ {2}{50}}{\xintFac{50}}}}=|\texttt{\xintLen {\xintQuo {\xintFac
+ {101}}{\xintiMul {\xintiPow {2}{50}}{\xintFac{50}}}}}. The
+explanation lies in the too clever to be efficient |#1.5| trick. It
+leads to a silly extra &5^{51}& (which has \xintLen {\xintPow {5}{51}}
+digits) in the denominator. See the explanations in the next section.
+
+\begin{framed}
+ Note: as soon as the coefficients look like factorials, it is more
+ efficient to use the \csb{xintRationalSeries} macro whose evaluation
+ will avoid a denominator build-up; indeed the raw operations of
+ addition and subtraction of fractions blindly multiply out
+ denominators. So the raw evaluation of $\sum_{n=0}^{|N|}1/n!$ with
+ \csa{xintSeries} will have a denominator equal to $\prod_{n=0}^{|N|}
+ n!$. Needless to say this makes it more difficult to compute the exact
+ value of this sum with |N=50|, for example, whereas with
+ \csb{xintRationalSeries} the denominator does not
+ get bigger than $50!$.
+
+\footnotesize
+ For info: by the way $\prod_{n=0}^{50} n!$ is easily computed by \xintname
+ and is a number with 1394 digits. And $\prod_{n=0}^{100} n!$ is also
+ computable by \xintname (24 seconds on my laptop for the brute force
+ multiplication of all factorials, a
+ specialized routine would do it faster) and has 6941 digits (this
+ means more than two pages if printed...). Whereas $100!$ only has
+ 158 digits.
+\end{framed}
+
+% \newcount\cntb
+% \cnta 2
+% \loop
+% \advance\cntb by \xintLen{\xintFac{\the\cnta}}%
+% \ifnum\cnta < 50
+% \advance\cnta 1
+% \repeat
+% \the\cntb
+
+% \cnta 2
+% \def\z{1}
+% \pdfresettimer
+% \loop
+% \edef\z {\xintiMul\z{\xintFac{\the\cnta}}}%
+% \ifnum\cnta < 100
+% \advance\cnta 1
+% \repeat
+% \edef\temps{\the\pdfelapsedtime}%
+
+% \temps: \xintQuo\temps{\xintiMul{60}{65536}} minutes,
+% \xintQuo{\xintRem\temps{\xintiMul{60}{65536}}}{65536} secondes et
+% \xintiTrunc {2}{\xintRem\temps{65536}/65536} centièmes de secondes
+% 1573518: 0 minutes, 24 secondes et 0 centièmes de secondes
+% nota bene, marrant c'était 0,99 centièmes en fait.
+
+% \xintLen\z
+
+% \printnumber\z
+
+\setlength{\columnsep}{0pt}
+\begin{verbatim}
+\def\coeffleibnitz #1{\the\numexpr \xintMMON{#1}\relax/#1[0]}
+\cnta 1
+\loop % in this loop we recompute from scratch each partial sum!
+% we can afford that, as \xintSeries is fast enough.
+\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+ \xintTrunc {12}
+ {\xintSeries {1}{\the\cnta}{\coeffleibnitz}}\dots
+\endgraf
+\ifnum\cnta < 30 \advance\cnta 1 \repeat
+\end{verbatim}
+\begin{multicols}{3}
+ \def\coeffleibnitz #1{\the\numexpr \xintMMON{#1}\relax/#1[0]} \cnta 1
+ \loop
+ \noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+ \xintTrunc {12}{\xintSeries {1}{\the\cnta}{\coeffleibnitz}}\dots
+ \endgraf
+ \ifnum\cnta < 30 \advance\cnta 1 \repeat
+\end{multicols}
\subsection{\csbh{xintiSeries}}\label{xintiSeries}
-\def\coeff #1{\romannumeral0\xintitrunc {40}{\xintMON{#1}/#1.5}}
+\def\coeff #1{\romannumeral0\xintitrunc {40}
+ {\the\numexpr 2*\xintMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
-\csa{xintiSeries}|{A}{B}{\coeff}| evaluates the sum of all values of the |\coeff
+\csa{xintiSeries}|{A}{B}{\coeff}| evaluates the sum of |\coeff
{n}| from |n=A| to and including |n=B|. The initial and final indices must
-(after double-expansion) obey the \TeX{} constraint of being explicit numbers of
-values at most |2^31-1| (these conditions are not checked by the macro). The
-|\coeff| macro (which, as argument to \csa{xintSeries} is double-expanded only
-at the time of computing the successive |\coeff {n}|) should be defined as a
+(after double-expansion) be explicit numbers at most |2^31-1| (these conditions
+are not checked by the macro). The
+|\coeff| macro (which, as argument to \csa{xintiSeries} is double-expanded only
+at the time of computing |\coeff {n}|) should be defined as a
one-parameter command, accepting on input a number (not a count register) and
needing at most two expansions to compute its final result, \emph{which must be
- an integer}, in the format understood by the package integer-only
+ an integer}, in the format understood by the integer-only
\csa{xintiAdd}.
\begin{verbatim}
-\def\coeff #1{\romannumeral0\xintitrunc {40}{\xintMON{#1}/#1.5}}
-% (-1)^n/(n+1/2), with 40 digits post decimal point, as an integer
+\def\coeff #1{\romannumeral0\xintitrunc {40}{\xintMON{#1}/#1.5}}%
+% better:
+\def\coeff #1{\romannumeral0\xintitrunc {40}
+ {\the\numexpr 2*\xintMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
+% (-1)^n/(n+1/2) times 10^40, truncated to an integer.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
\xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\dots\]
\end{verbatim}
-\vspace*{-\baselineskip}
+The |#1.5| trick to define the |\coeff| macro was neat, but |1/3.5|, for
+example, turns internally into |10/35| whereas it would be more efficient to
+have |2/7|. The second way of coding the wanted coefficient avoids a
+superfluous factor of five and leads to a faster evaluation. The denominator
+having no sign, we have added the |[0]| as this speeds up (infinitesimally) the
+parsing.
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx \xintTrunc
+{40}{\xintiSeries {0}{50}{\coeff}[-40]}\] We should have cut out at
+least the last two digits: truncating errors originating with the first
+coefficients of the sum will never go away, and each truncation
+introduces an uncertainty in the last digit, so as we have 40 terms, we
+should trash the last two digits, or at least round at 38 digits. It is
+interesting to compare with the computation where rounding rather than
+truncation is used, and with the decimal
+expansion of the exactly computed partial sum of the series:
+\begin{verbatim}
+\def\coeff #1{\romannumeral0\xintiround {40} % rounding at 40
+ {\the\numexpr 2*\xintMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
+% (-1)^n/(n+1/2) times 10^40, rounded to an integer.
\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
- \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\dots\]
-We should have cut out some of the final digits, rather than print all 40 of
-them. For comparison the decimal expansion of the exact result is:
-\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintTrunc {40}{\z}\dots\]
+ \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\]
+\def\exactcoeff #1{\the\numexpr 2*\xintMON{#1}\relax/%
+ \the\numexpr 2*#1+1\relax [0]}%
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12}
+ = \xintTrunc {50}{\xintSeries {0}{50}{\exactcoeff}}\dots\]
+\end{verbatim}
+\def\coeff #1{\romannumeral0\xintiround {40}
+ {\the\numexpr 2*\xintMON{#1}\relax/\the\numexpr 2*#1+1\relax [0]}}%
+% (-1)^n/(n+1/2) times 10^40, rounded to an integer.
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} \approx
+ \xintTrunc {40}{\xintiSeries {0}{50}{\coeff}[-40]}\]
+% \def\exactcoeff #1{\the\numexpr 2*\xintMON{#1}\relax/%
+% \the\numexpr 2*#1+1\relax [0]}%
+\[ \sum_{n=0}^{n=50} \frac{(-1)^n}{n+\frac12} = \xintTrunc {50}{\z}\dots\]
+This shows indeed that our sum of truncated terms
+estimated wrongly the 39th and 40th digits of the exact result\footnote{as
+ the series
+ is alternating, we can roughly expect an error of $\sqrt{40}$ and the
+ last two digits are off by 4 units, which is not contradictory to our
+ expectations.} and that the sum of rounded terms fared a bit better.
+
+\subsection{\csbh{xintRationalSeries}}\label{xintRationalSeries}
+
+{\small New with release |1.04|.\par}
+
+\csa{xintRationalSeries}|{A}{B}{f}{\ratio}| evaluates the sum of |F(n)| from
+|n=A| up to and including |n=B|, with the parameter |f| being (or expanding in
+two steps to) the value |F(A)| and |\ratio| being a one-parameter command,
+accepting on input a number |n| (not a count register, but also obeying the
+constraint of having value at most |2^31-1|) and producing after at most two
+expansions |F(n)/F(n-1)|. The initial and final indices must (after
+double-expansion) obey the \TeX{} and |\numexpr| constraint of being explicit
+numbers at most |2^31-1| (these conditions are not checked by the
+macro).
+\begin{verbatim}
+\def\ratio #1{2/#1[0]}% 2/n, comes from the series of exp(2)
+\cnta 0 % previously declared count
+\loop
+\edef\z {\xintRationalSeries {0}{\the\cnta}{1}{\ratio }}%
+\noindent$\sum_{n=0}^{\the\cnta} \frac{2^n}{n!}=
+ \xintTrunc{12}\z\dots=
+ \xintFrac\z=\xintFrac{\xintIrr\z}$\vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{verbatim}
+\def\ratio #1{2/#1[0]}% 2/n, comes from the series of exp(2)
+\cnta 0
+\loop
+\edef\z {\xintRationalSeries {0}{\the\cnta}{1}{\ratio }}%
+\noindent$\sum_{n=0}^{\the\cnta} \frac{2^n}{n!}=
+ \xintTrunc{12}\z\dots=
+ \xintFrac\z=\xintFrac{\xintIrr\z}$\vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+
+\medskip
+Such computations would become quickly completely inaccessible via the
+\csb{xintSeries} macros, as the factorials in the denominators would get
+all multiplied together: the raw addition and subtraction on fractions
+just blindly multiplies denominators! Whereas \csa{xintRationalSeries}
+evaluate the partial sums via a less silly iterative scheme.
+\vspace*{-.5\baselineskip}
+\begin{verbatim}
+\def\ratio #1{-1/#1[0]}% -1/n, comes from the series of exp(-1)
+\cnta 0 % previously declared count
+\loop
+\edef\z {\xintRationalSeries {0}{\the\cnta}{1}{\ratio }}%
+\noindent$\sum_{n=0}^{\the\cnta} \frac{(-1)^n}{n!}=
+ \xintTrunc{20}\z\dots=\xintFrac{\z}=\xintFrac{\xintIrr\z}$
+ \vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{verbatim}
+\def\ratio #1{-1/#1[0]}% -1/n, comes from the series of exp(-1)
+\cnta 0 % previously declared count
+
+\loop
+\edef\z {\xintRationalSeries {0}{\the\cnta}{1}{\ratio }}%
+\noindent$\sum_{n=0}^{\the\cnta} \frac{(-1)^n}{n!}=
+ \xintTrunc{20}\z\dots=\xintFrac{\z}=\xintFrac{\xintIrr\z}$
+ \vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+
+
+ \def\ratioexp #1#2{\romannumeral0\xintdiv{#1}{#2}}% #1/#2
+
+\medskip We can incorporate an indeterminate if we define |\ratio| to be
+a macro with two parameters: |\def\ratioexp
+ #1#2{\romannumeral0\xintdiv{#1}{#2}}|\texttt{\%}| x/n: x=#1, n=#2|.
+Then, if |\x| expands (in two steps at most) to some fraction |x|, the
+command \centeredline{|\xintRationalSeries {0}{b}{1}{\ratioexp{\x}}|}
+will compute $\sum_{n=0}^{n=b} x^n/n!$:\par
+\vspace*{-.5\baselineskip}
+\begin{verbatim}
+\cnta 0
+\def\ratioexp #1#2{\romannumeral0\xintdiv{#1}{#2}}% #1/#2
+\loop
+\noindent
+$\sum_{n=0}^{\the\cnta} (.57)^n/n! = \xintTrunc {50}
+ {\xintRationalSeries {0}{\the\cnta}{1}{\ratioexp{.57}}}\dots$
+ \vtop to 5pt {}\endgraf
+\ifnum\cnta<50 \advance\cnta 10 \repeat
+\end{verbatim}
+
+\cnta 0
+\loop
+\noindent
+$\sum_{n=0}^{\the\cnta} (.57)^n/n! = \xintTrunc {50}
+ {\xintRationalSeries {0}{\the\cnta}{1}{\ratioexp{.57}}}\dots$
+ \vtop to 5pt {}\endgraf
+\ifnum\cnta<50 \advance\cnta 10 \repeat
+Observe that in this last example the |x| was directly inserted; if it
+had been a more complicated explicit fraction it would have been
+worthwile to use |\ratioexp\x| with |\x| defined to expand to its value.
+In the further situation where this fraction |x| is not explicit but
+itself defined via a complicated, and time-costly, formula, it should be
+noted that \csa{xintRationalSeries} will do again the evaluation of |\x|
+for each term of the partial sum. The easiest is thus when |x| can be
+defined as an |\edef|. If however, you are in an expandable-only context
+and cannot store in a macro like |\x| the value to be used, a variant of
+\csa{xintRationalSeries} is needed which will first evaluate this |\x| and then
+use this result without recomputing it. This is \csb{xintRationalSeriesX},
+documented next.
+
+Here is a slightly more complicated evaluation:
+\begin{verbatim}
+\cnta 1
+\loop \edef\z {\xintRationalSeries
+ {\the\cnta}
+ {\the\numexpr 2*\cnta-1\relax}
+ {\xintiPow {\the\cnta}{\the\cnta}/\xintFac{\the\cnta}}
+ {\ratioexp{\the\cnta}}}%
+\edef\w {\xintRationalSeries {0}{\the\numexpr 2*\cnta-1\relax}{1}
+ {\ratioexp{\the\cnta}}}%
+\noindent
+$\sum_{n=\the\cnta}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!}/%
+ \sum_{n=0}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!} =
+ \xintTrunc{8}{\xintDiv\z\w}\dots$ \vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{verbatim}
+\cnta 1
+\begin{multicols}{2}
+\loop \edef\z {\xintRationalSeries
+ {\the\cnta}
+ {\the\numexpr 2*\cnta-1\relax}
+ {\xintiPow {\the\cnta}{\the\cnta}/\xintFac{\the\cnta}}
+ {\ratioexp{\the\cnta}}}%
+\edef\w {\xintRationalSeries {0}{\the\numexpr 2*\cnta-1\relax}{1}
+ {\ratioexp{\the\cnta}}}%
+\noindent$\sum_{n=\the\cnta}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!}/%
+ \sum_{n=0}^{\the\numexpr 2*\cnta-1\relax} \frac{\the\cnta^n}{n!} =
+ \xintTrunc{8}{\xintDiv\z\w}\dots$ \vtop to 5pt{}\endgraf
+\ifnum\cnta<20 \advance\cnta 1 \repeat
+\end{multicols}
+
+\subsection{\csbh{xintRationalSeriesX}}\label{xintRationalSeriesX}
+
+{\small New with release |1.04|.\par}
+
+\csa{xintRationalSeriesX}|{A}{B}{\first}{\ratio}{\x}| evaluates the sum of
+|F(n,x)| from |n=A| up to and including |n=B|, where |\x| expands in two
+steps at most to a fraction |x|, |\first| is a one-parameter macro such that
+|\first{\x}| expands in two steps at most to the first term |F(A,x)| of the
+series, and |\ratio| is a two parameter macro such that |\ratio{\x}{n}|
+expands in two steps at most to the ratio |F(n,x)/F(n-1,x)|. Thus, this
+is a parametrized version of \csa{xintRationalSeries}, where the
+parameter |\x| is evaluated only once at the beginning of the
+computation, and can thus itself be the yet unevaluated result of a
+previous computation.
+
+Note the subtle differences between
+\centeredline{|\xintRationalSeries {a}{b}{\first}{\ratio{\x}}|}%
+\centeredline{|\xintRationalSeriesX {a}{b}{\first}{\ratio}{\x}|}
+First the location of braces differ... then, in the first one
+|\first| is a macro expanding to a fractional number, but in the |X|
+one, it is a one-parameter macro which will use |\x|. The |\ratio| macro
+is in both cases a two-parameters macro, the difference is that in the
+|X| variant the |\x| will be evaluated at the very beginning whereas the
+former variant replaces it by its evaluation each time it needs it
+(which is bad if this evaluation is time-costly, but good if it just a big
+explicit fraction encapsulated in a macro).
+
+
+The example will use the macro \csb{xintPowerSeries} which computes
+efficiently exact partial sums of power series, and is discussed in the
+next section.
+\begin{verbatim}
+\def\firstterm #1{1[0]}% first term of the exponential series
+% although it is the constant 1, here it must be defined as a
+% one-parameter macro. Next comes the ratio function for exp:
+\def\ratioexp #1#2{\romannumeral0\xintdiv {#1}{#2}}% x/n
+% These are the (-1)^{n-1}/n of the log(1+h) series:
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}%
+% Let L(h) be the first 10 terms of the log(1+h) series and
+% let E(t) be the first 10 terms of the exp(t) series.
+% The following computes E(L(a/10)) for a=1,...,12.
+\cnta 0
+\loop
+\noindent\xintTrunc {18}{%
+ \xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
+ {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-1]}}}\dots
+\endgraf
+\ifnum\cnta < 12 \advance \cnta 1 \repeat
+\end{verbatim}
+
+\def\firstterm #1{1[0]}% first term of the exponential series
+% although it is the constant 1, here it must be defined as a
+% one-parameter macro. Next comes the ratio function for exp:
+\def\ratioexp #1#2{\romannumeral0\xintdiv {#1}{#2}}% x/n
+% These are the (-1)^{n-1}/n of the log(1+h) series
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}%
+% Let L(h) be the first 10 terms of the log(1+h) series and
+% let E(t) be the first 10 terms of the exp(t) series.
+% The following computes E(L(a/12)) for a=1,..., 12.
+\begin{multicols}{3}\raggedcolumns
+ \cnta 1
+ \loop
+ \noindent\xintTrunc {18}{%
+ \xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
+ {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-1]}}}\dots
+ \endgraf
+ \ifnum\cnta < 12 \advance \cnta 1 \repeat
+\end{multicols}
+ % to see how they look like...
+ % \loop
+ % \noindent\printnumber{%
+ % \xintRationalSeriesX {0}{9}{\firstterm}{\ratioexp}
+ % {\xintPowerSeries{1}{10}{\coefflog}{\the\cnta[-2]}}}\dots
+ % \endgraf
+ % \ifnum\cnta < 60 \advance \cnta 1 \repeat
+
+These completely exact operations rapidly create numbers with many digits. Let
+us print in full the raw fractions created by the operation illustrated above:
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1[-1]}}}
+
+|E(L(1[-1]))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z})
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{12[-2]}}}
+
+|E(L(12[-2]))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z})
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{123[-3]}}}
+
+|E(L(123[-3]))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z})
+
+
+We see that the denominators here remain the same, as our input only had various
+powers of ten as denominators, and \xintfracname efficiently assemble (some
+only, as we can see) powers of ten. Notice that 1 more digit in an input
+denominator seems to mean 90 more in the raw output. We can check that with some
+other test cases:
+
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/7}}}
+
+|E(L(1/7))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z}; length of denominator:
+\xintLen {\xintDenominator \z})
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/71}}}
+
+|E(L(1/71))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z}; length of denominator:
+\xintLen {\xintDenominator \z})
+
+
+\edef\z{\xintRationalSeriesX {0}{9}{\firstterm}
+{\ratioexp}{\xintPowerSeries{1}{10}{\coefflog}{1/712}}}
+
+|E(L(1/712))=|\printnumber{\z} (length of numerator:
+\xintLen {\xintNumerator \z}; length of denominator:
+\xintLen {\xintDenominator \z})
+
+% \pdfresettimer
+% \edef\w{\xintDenominator{\xintIrr{\z}}}
+% \the\pdfelapsedtime
+
+For info the last fraction put into irreducible form still has 288 digits in its
+denominator.\footnote{putting this fraction in irreducible form takes more time
+ than is typical of the other computations in this document; so exceptionally I
+ have hard-coded the 288 in the document source.} The first conclusion is that decimal numbers such as |0.123| (equivalently
+|123[-3]|) give less computing intensive tasks than fractions such as |1/712|:
+in the case of decimal numbers the (raw) denominators originate in the
+coefficients of the series themselves, powers of ten of the input within
+brackets being treated separately. The second conclusion is that even then the
+numerators will grow with the size of the input in a sort of linear way, the
+coefficient being given by the order of series: here 10 from the log and 9 from
+the exp, so 90. One more digit in the input means 90 more digits in the
+numerator of the output: obviously we can not go on composing such partial sums
+of series and hope that \xintname will joyfully do all at the speed of light!
+Briefly said, imagine that the rules of the game make the programmer like a
+security guard at an airport scanning machine: a never-ending flux of passengers
+keep on arriving and all you can do is re-shuffle the first nine of them,
+organize marriages among some, execute some, move children farther back among
+the first nine only. If a passenger comes along with many hand luggages, this
+will slow down the process even if you move him to ninth position, because
+sooner or later you will have to digest him, and the children will be big too.
+There is no way to move some guy out of the file and to a discrete interrogatory
+room for separate treatment or to give him/her some badge saying ``I left my
+stuff in storage box 357''.
+
+Hence, truncating the output (or better, rounding) is the only way to go if one
+needs a general calculus of special functions. Floating point representation of
+numbers is currently unimplemented in \xintname. But fixed point computations
+are available via the commands \csb{xintTrunc} and \csb{xintRound}.
\subsection{\csbh{xintPowerSeries}}\label{xintPowerSeries}
\csa{xintPowerSeries}|{A}{B}{\coeff}{x}| evaluates the sum of
|\coeff{n}|\raisebox{.5ex}{|.|}|x^n| from |n=A| up to and including |n=B|. The
-initial and final indices must (after double-expansion) obey the \TeX{}
-constraint of being explicit numbers of values at most |2^31-1| (these
+initial and final indices must (after double-expansion) be
+explicit numbers at most |2^31-1| (these
conditions are not checked by the macro). The |\coeff| macro (which, as argument
-to \csa{xintPowerSeries} is double-expanded only at the time of computing the
-successive |\coeff{n}|) should be defined as a one-parameter command, accepting
+to \csa{xintPowerSeries} is double-expanded only at the time
+|\coeff{n}| is needed) should be defined as a one-parameter command, accepting
on input a number (not a count register) and needing at most two expansions to
compute its final result.
-The |x| can be either a fraction directly input or a macro expanding in at most
-two steps to such a fraction. It is actually more efficient for the various
-macro expansions done by \TeX{} to encapsulate the fraction |x| in a macro (say
-|\x|), if it has big numerators and denominators, as the less tokens there are,
-the faster it goes, and some amount of shuffling around of the data given as the
-fourth parameter to \csa{xintPowerSeries} is done internally, repeatedly. And,
-for greater efficiency |x| should be a fraction in |A/B[n]| format.
+The |x| can be either a fraction directly input or a macro expanding in
+at most two steps to such a fraction. It is actually more efficient to
+encapsulate an explicit fraction |x| in such a macro (say |\x|), if it
+has big numerators and denominators (`big' means hundreds of
+digits) as it will then take less space in the processing until being
+(repeatedly) used.
+
+This macro computes the \emph{exact} result (one can use it also for
+polynomial evaluation). With release |1.04| the Horner scheme for
+polynomial evaluation is used, this avoids a denominator build-up which
+was plaguing the |1.03| version. \footnote{with powers |x\string^k|,
+ from |k=0| to |N|, a denominator |d| of |x| became
+ |d\string^\string{1+2+\dots+N\string}|, which is bad. With the |1.04|
+ method, the part of the denominator originating from |x| does not
+ accumulate to more than |d\string^N|. }
+
+\begin{framed}
+ Note: as soon as the coefficients look like factorials, it is more efficient
+ to use the \csb{xintRationalSeries} macro whose evaluation, also based on a
+ similar Horner scheme, will avoid a denominator build-up originating in the
+ coefficients themselves.
+\end{framed}
-Note though that this macro computes the \emph{exact} result, which may quickly
-become a very big (possibly highly reducible) fraction.
\begin{verbatim}
\def\geom #1{1[0]} % the geometric series
\def\x {5/17[0]}
\[ \sum_{n=0}^{n=20} \Bigl(\frac 5{17}\Bigr)^n
=\xintFrac{\xintIrr{\xintPowerSeries {0}{20}{\geom}{\x}}}
- =\xintFrac{\xintDiv{\xintiSub{\xintiPow {17}{21}}{\xintiPow{5}{21}}}
- {\xintiSub{\xintiPow {17}{21}}{\xintiMul {5}{\xintiPow {17}{20}}}}}\]
+ =\xintFrac{\xintiSub{\xintiPow {17}{21}}{\xintiPow{5}{21}}%
+ /\xintiMul{12}{\xintiPow {17}{20}}}\]
% a parser for arbitrary algebraic expressions with the +,-,/,*,and ^
-% operations would dearly appreciated here ; but implementing a
-% completely expandable one would quite a lot of work.
+% operations would be dearly appreciated here ; but implementing a
+% completely expandable one would be quite a lot of work.
\end{verbatim}
\def\geom #1{1[0]} % the geometric series
\def\x {5/17[0]} %
\[ \sum_{n=0}^{n=20} \Bigl(\frac 5{17}\Bigr)^n
=\xintFrac{\xintIrr{\xintPowerSeries {0}{20}{\geom}{\x}}}
- =\xintFrac{\xintDiv{\xintiSub{\xintiPow {17}{21}}{\xintiPow{5}{21}}}
- {\xintiSub{\xintiPow {17}{21}}{\xintiMul {5}{\xintiPow {17}{20}}}}}\]
-Check it by hand\dots you can guess the common factor by looking at the last two
-digits of the two denominators!
-
-% checking:
-
-% \xintIrr {69091933912531895722624092/5757661159377657976885341}
-
-% \xintIrr {48770776879770870268819212/4064231406647572522401601}
-
-% gives 12 in both cases. Hourrah!
+ =\xintFrac{\xintiSub{\xintiPow {17}{21}}{\xintiPow{5}{21}}%
+ /\xintiMul{12}{\xintiPow {17}{20}}}\]
\begin{verbatim}
\def\coefflog #1{1/#1[0]}% 1/n
\def\x {1/2[0]}%
-\[ \log 2 \approx \sum_{n=1}^{20} \frac1n \frac1{2^n}
+\[ \log 2 \approx \sum_{n=1}^{20} \frac1{n\cdot 2^n}
= \xintFrac {\xintIrr {\xintPowerSeries {1}{20}{\coefflog}{\x}}}\]
+\[ \log 2 \approx \sum_{n=1}^{50} \frac1{n\cdot 2^n}
+ = \xintFrac {\xintIrr {\xintPowerSeries {1}{50}{\coefflog}{\x}}}\]
\end{verbatim}
\def\coefflog #1{1/#1[0]} % 1/n
\def\x {1/2[0]}%
-\[ \log 2 \approx \sum_{n=1}^{20} \frac1n \frac1{2^n}
+\[ \log 2 \approx \sum_{n=1}^{20} \frac1{n\cdot 2^n}
= \xintFrac {\xintIrr {\xintPowerSeries
{1}{20}{\coefflog}{\x}}}\]
-
-
+\[ \log 2 \approx \sum_{n=1}^{50} \frac1{n\cdot 2^n}
+ = \xintFrac {\xintIrr {\xintPowerSeries {1}{50}{\coefflog}{\x}}}\]
+\begin{verbatim}
+\cnta 1 % previously declared count
+\loop % in this loop we recompute from scratch each partial sum!
+% we can afford that, as \xintPowerSeries is fast enough.
+\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+ \xintTrunc {12}
+ {\xintPowerSeries {1}{\the\cnta}{\coefflog}{\x}}\dots
+\endgraf
+\ifnum \cnta < 30 \advance\cnta 1 \repeat
+\end{verbatim}
+\setlength{\columnsep}{0pt}
+\begin{multicols}{3}
+ \cnta 1 % previously declared count
+ \loop % in this loop we recompute from scratch each partial sum!
+% we can afford that, as \xintPowerSeries is fast enough.
+\noindent\hbox to 2em{\hfil\texttt{\the\cnta.} }%
+ \xintTrunc {12}{\xintPowerSeries {1}{\the\cnta}{\coefflog}{\x}}\dots
+\endgraf
+\ifnum \cnta < 30 \advance\cnta 1 \repeat
+\end{multicols}
\begin{verbatim}
\def\coeffarctg #1{1/\the\numexpr\xintMON{#1}*(2*#1+1)\relax }%
% the above gives (-1)^n/(2n+1). The sign being in the denominator,
@@ -2105,27 +2784,84 @@ digits of the two denominators!
= \xintFrac{\xintIrr {\xintDiv
{\xintPowerSeries {0}{15}{\coeffarctg}{\x}}{5}}}\]
+\subsection{\csbh{xintPowerSeriesX}}\label{xintPowerSeriesX}
+
+{\small New with release |1.04|.\par}
+
+This is the same as \csb{xintPowerSeries} apart from the fact that the last
+parameter (aka |x|), is first twice expanded. If the |x| parameter is to be an
+explicit big fraction |f| with many (i.e. hundreds) digits, rather than using
+|f| directly it is slightly better to have some macro |\x| |\def'|ined to expand
+to the explicit |f| and use \csb{xintPowerSeries}; but if |f| has not yet been
+evaluated and will be the output of a complicated expansion of some |\x|, and
+if, due to an expanding only context, an |\edef\z{\x}| is no option, then
+\csa{xintPowerSeriesX} should be used with |\x| as last parameter. This |\x|
+will be expanded (as usual, twice) and then its (explicit) output will be used.
+The reason why \csa{xintPowerSeries} doesn't do the same is that explicit
+fractions with many (i.e. hundreds) digits slow down a bit the processing as
+there is some shuffling of tokens going on. With \csa{xintPowerSeriesX} the
+slowing down in token shuffling due to a very big fraction will not be avoided,
+but the far worse cost of re-doing each time the computations leading to
+such a fraction will be. The constraints of expandability make it impossible
+to encapsulate the result of this initial computation in a macro and have the
+best of both worlds.
+\begin{verbatim}
+\def\ratioexp #1#2{\romannumeral0\xintdiv {#1}{#2}}% x/n
+% These are the (-1)^{n-1}/n of the log(1+h) series:
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}%
+% Let L(h) be the first 10 terms of the log(1+h) series and
+% let E(t) be the first 10 terms of the exp(t) series.
+% The following computes L(E(a/10)-1) for a=1,..., 12.
+\cnta 1
+\loop
+\noindent\xintTrunc {18}{%
+ \xintPowerSeriesX {1}{10}{\coefflog}
+ {\xintSub
+ {\xintRationalSeries {0}{9}{1[0]}{\ratioexp{\the\cnta[-1]}}}
+ {1}}}\dots
+\endgraf
+\ifnum\cnta < 12 \advance \cnta 1 \repeat
+\end{verbatim}
+\cnta 0
+\def\ratioexp #1#2{\romannumeral0\xintdiv {#1}{#2}}% x/n
+% These are the (-1)^{n-1}/n of the log(1+h) series
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}%
+% Let L(h) be the first 10 terms of the log(1+h) series and
+% let E(t) be the first 10 terms of the exp(t) series.
+% The following computes L(E(a/10)-1) for a=1,..., 12.
+\begin{multicols}{3}\raggedcolumns
+\cnta 1
+ \loop
+ \noindent\xintTrunc {18}{%
+ \xintPowerSeriesX {1}{10}{\coefflog}
+ {\xintSub
+ {\xintRationalSeries {0}{9}{1[0]}{\ratioexp{\the\cnta[-1]}}}
+ {1}}}\dots
+ \endgraf
+ \ifnum\cnta < 12 \advance \cnta 1 \repeat
+\end{multicols}
+
\subsection{\csbh{xintFxPtPowerSeries}}\label{xintFxPtPowerSeries}
-\csa{xintFxPtPowerSeries}|{A}{B}{\coeff}{x}{D}| computes the sum of
+\csa{xintFxPtPowerSeries}|{A}{B}{\coeff}{x}{D}| computes the sum of
|\coeff{n}|\raisebox{.5ex}{|.|}|x^n| from |n=A| to |n=B| with each term of the
-series being truncated to |D| digits after the decimal point.
-
-More precisely the first power |x^A| is computed exactly, then truncated. Then
-each successive power is obtained from the previous one by multiplication by the
-exact original value of |x|, then truncating. And
-|\coeff{n}|\raisebox{.5ex}{|.|}|x^n| is obtained from that by multiplying by
-|\coeff{n}| (untruncated) and then truncating. Finally the sum is computed
-exactly.
-
-Apart from that \csa{xintFxPtPowerSeries} (where |FxPt| means `fixed-point') is
-like \csa{xintPowerSeries}. There should be a variant for things of the
-type $\sum c_n \frac {x^n}{n!}$ to avoid having to compute the factorial
-from scratch at each coefficient, the same way \csa{xintFxPtPowerSeries}
-does not compute |x^n| from scratch at each |n|. For the next package
-release (perhaps).
-
+series truncated to |D| digits after the decimal point. As usual, |A|
+and |B| are first twice-expanded. Regarding |D| it will be twice-expanded each
+time it will be used inside an \csa{xintTrunc}. The one-parameter macro |\coeff|
+is similarly only expanded when it is used inside the computations. Idem for
+|x|. If |x| itself is some complicated macro it is thus better to use the
+variant \csb{xintFxPtPowerSeriesX} which expands it first and then uses the
+result of that (double) expansion.
+
+The current (|1.04|) implementation is: the first power |x^A| is
+computed exactly, then \emph{truncated}. Then each successive power is
+obtained from the previous one by multiplication by the exact value of
+|x|, and truncated. And |\coeff{n}|\raisebox{.5ex}{|.|}|x^n| is obtained
+from that by multiplying by |\coeff{n}| (untruncated) and then
+truncating. Finally the sum is computed exactly. Apart from that
+\csa{xintFxPtPowerSeries} (where |FxPt| means `fixed-point') is like
+\csa{xintPowerSeries}.
\def\coeffexp #1{1/\xintFac {#1}[0]}% [0] for faster parsing
\def\x {-1/2[0]}%
@@ -2149,7 +2885,6 @@ $\ApproxExp {\the\cnta}{20}$\\
\def\x {-1/2[0]}% [0] for faster parsing
\def\ApproxExp #1#2{\xintFxPtPowerSeries
{0}{#1}{\coeffexp}{\x}{#2}}%
-\centeredline{$e^{-\frac12}\approx{}$}%
\cnta 0 % previously declared \count register
\loop
$\ApproxExp {\the\cnta}{20}$\\
@@ -2157,90 +2892,276 @@ $\ApproxExp {\the\cnta}{20}$\\
\ifnum\cnta<19
\advance\cnta 1
\repeat\par
-% One should **not** trust the final digits,
-% independently of how many terms we compute,
-% as errors from the initial terms will never
-% disappear! and their cumulative value can
-% make the last digit(s) wrong (especially when
-% it is a 0 or a 9). We can see it is the case
-% here via the computation with more digits:
+% One should **not** trust the final digits,
+% as the potential truncation errors of up to
+% 10^{-20} per term accumulate and never
+% disappear! (the effect is attenuated by the
+% alternating signs in the series). We can
+% confirm that the last two digits (of our
+% evaluation of the nineteenth partial sum)
+% are wrong via the evaluation with more
+% digits:
\end{verbatim}
-\end{minipage}%\medskip
-\centeredline{|\xintFxPtPowerSeries {0}{30}{\coeffexp}{\x}{25}=|%
-\texttt{\hyphenchar\font45 \xintFxPtPowerSeries {0}{30}{\coeffexp}{\x}{25}}}
+\end{minipage}
-\catcode`\& 4
+\centeredline{|\xintFxPtPowerSeries {0}{19}{\coeffexp}{\x}{25}=|}%
+\centeredline{%
+\xintFxPtPowerSeries {0}{19}{\coeffexp}{\x}{25}}
+
+\texttt{\hyphenchar\font45 }
+
+There should be a variant for things of the
+type $\sum c_n \frac {x^n}{n!}$ to avoid having to compute the factorial
+from scratch at each coefficient, the same way \csa{xintFxPtPowerSeries}
+does not compute |x^n| from scratch at each |n|. Perhaps in the next package
+release.
\edef\z{\xintIrr {\xintPowerSeries {0}{19}{\coeffexp}{\x}}}
-It is no difficulty for \xintfracname to compute exactly, with the
-help of \csa{xintPowerSeries} and \csa{xintIrr}, the nineteenth partial
-sum, and to then give the (start of the) exact decimal expansion (again
-we see that the last digit from a `truncated' computation was wrong):
-\[\halign {\hfil#&$#$&$#$\hfil\cr
-|\xintPowerSeries {0}{19}{\coeffexp}{\x}|
-&{}={}& \displaystyle\xintFrac{\z}\cr
-\vphantom{\vrule height 15pt depth 3pt width 0pt }&{}={}&
- \xintTrunc {25}{\z}\dots\cr }\]
-Thus, one should always
-estimate a priori how many ending digits are not reliable (and secretly
-re-do the computation with at least five more digits...).
+It is no difficulty for \xintfracname to compute exactly, with the help
+of \csa{xintPowerSeries}, the nineteenth partial sum, and to then give
+(the start of) its exact decimal expansion:
+\centeredline{|\xintPowerSeries {0}{19}{\coeffexp}{\x}| ${}=
+ \displaystyle\xintFrac{\z}$%
+ \vphantom{\vrule height 20pt depth 12pt}}%
+\centeredline{${}=\xintTrunc {30}{\z}\dots$} Thus, one should always
+estimate a priori how many ending digits are not reliable: if there are
+|N| terms and |N| has |k| digits, then digits up to but excluding the
+last |k| may usually be trusted. If we are optimistic and the series is
+alternating we may even replace |N| with $\sqrt{|N|}$ to get the number |k|
+of digits possibly of dubious significance.
+
+
+\subsection{\csbh{xintFxPtPowerSeriesX}}\label{xintFxPtPowerSeriesX}
+
+{\small New with release |1.04|.\par}
+
+\csa{xintFxPtPowerSeriesX}|{A}{B}{\coeff}{\x}{D}| computes, exactly as
+\csa{xintFxPtPowerSeries}, the sum of
+|\coeff{n}|\raisebox{.5ex}{|.|}|\x^n| from |n=A| to |n=B| with each term
+of the series being \emph{truncated} to |D| digits after the decimal
+point. The sole difference is that |\x| is first expanded (twice) and it
+is the result of this which is used in the computations.
+
+% Let us illustrate this on the computation of |(1+y)^{5/3}| where
+% |1+y=(1+x)^{3/5}| and each of the two binomial series is evaluated with ten
+% terms, the results being computed with |8| digits after the decimal point, and &|x|<1/10&.
+
+
+Let us illustrate this on the numerical exploration of the identity
+\centeredline{|log(1+x) = -log(1/(1+x))|}%
+Let |L(h)=log(1+h)|, and |D(h)=L(h)+L(-h/(1+h))|. Theoretically thus,
+|D(h)=0| but we shall evaluate |L(h)| and |-h/(1+h)| keeping only 10
+terms of their respective series. We will assume &|h|<0.5&. With only
+ten terms kept in the power series we do not have quite 3 digits
+precision as &2^10=1024&. So it wouldn't make sense to evaluate things
+more precisely than, say circa 5 digits after the decimal points.
+\begin{verbatim}
+\cnta 0
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}% (-1)^{n-1}/n
+\def\coeffalt #1{\romannumeral0\xintmon {#1}[0]}% (-1)^n
+\loop
+\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
+\xintAdd {\xintFxPtPowerSeriesX {1}{10}{\coefflog}{\the\cnta [-2]}{5}}
+ {\xintFxPtPowerSeriesX {1}{10}{\coefflog}
+ {\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
+ {5}}\endgraf
+\ifnum\cnta < 49 \advance\cnta 7 \repeat
+\end{verbatim}
-\catcode`\& 13
+\cnta 0
+\def\coefflog #1{\the\numexpr\xintMMON{#1}\relax/#1[0]}% (-1)^{n-1}/n
+\def\coeffalt #1{\romannumeral0\xintmon {#1}[0]}% (-1)^n
+
+\begin{multicols}2
+\loop
+\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
+\xintAdd {\xintFxPtPowerSeriesX {1}{10}{\coefflog}{\the\cnta [-2]}{5}}
+ {\xintFxPtPowerSeriesX {1}{10}{\coefflog}
+ {\xintFxPtPowerSeriesX {1}{10}{\coeffalt}{\the\cnta [-2]}{5}}
+ {5}}\endgraf
+\ifnum\cnta < 49 \advance\cnta 7 \repeat
+\end{multicols}
+
+Let's say we evaluate functions on |[-1/2,+1/2]| with values more or less also
+in |[-1/2,+1/2]| and we want to keep 4 digits of precision. So, roughly we need
+at least 14 terms in series like the geometric or log series. Let's make this
+15. Then it doesn't make sense to compute intermediate summands with more than 6
+digits precision. So we compute with 6 digits
+precision but return only 4 digits (rounded) after the decimal point.
+This result with 4 post-decimal points precision is then used as input
+to the next evaluation.
+\begin{verbatim}
+\loop
+\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
+\xintRound{4}
+ {\xintAdd {\xintFxPtPowerSeriesX {1}{15}{\coefflog}{\the\cnta [-2]}{6}}
+ {\xintFxPtPowerSeriesX {1}{15}{\coefflog}
+ {\xintRound {4}{\xintFxPtPowerSeriesX {1}{15}{\coeffalt}
+ {\the\cnta [-2]}{6}}}
+ {6}}%
+ }\endgraf
+\ifnum\cnta < 49 \advance\cnta 7 \repeat
+\end{verbatim}
+
+\begin{multicols}2
+\loop
+\noindent \hbox to 2.5cm {\hss\texttt{D(\the\cnta/100): }}%
+\xintRound{4}
+ {\xintAdd {\xintFxPtPowerSeriesX {1}{15}{\coefflog}{\the\cnta [-2]}{6}}
+ {\xintFxPtPowerSeriesX {1}{15}{\coefflog}
+ {\xintRound {4}{\xintFxPtPowerSeriesX {1}{15}{\coeffalt}
+ {\the\cnta [-2]}{6}}}
+ {6}}%
+ }\endgraf
+\ifnum\cnta < 49 \advance\cnta 7 \repeat
+\end{multicols}
+
+
+Not bad... I have cheated a bit: the `four-digits precise' numeric
+evaluations were left unrounded in the final addition. However the inner
+rounding to four digits worked fine and made the next step faster than
+it would have been with longer inputs. The morale is that one should not
+use the raw results of \csa{xintFxPtPowerSeriesX} with the |D| digits
+with which it was computed, as the last are to be considered garbage.
+Rather, one should keep from the output only some smaller number of
+digits. This will make further computations faster and not less precise.
+I guess there should be some command to do this final truncating, or
+better, rounding, at a given number |D'<D| of digits. Maybe for the next
+release.
+
+
+
+\subsection{Computing \texorpdfstring{$\log 2$}{log(2)} and \texorpdfstring{$\pi$}{pi}}\label{ssec:Machin}
+
+In this final section, the use of \csb{xintFxPtPowerSeries} (and
+\csb{xintPowerSeries}) will be
+illustrated on the (expandable... why make things simple when it is so easy to
+make them difficult!) computations of the first digits of the decimal expansion
+of the familiar constants $\log 2$ and $\pi$.
+
+Let us start with $\log 2$. We will get it from this formula (which is
+left as an exercise): \centeredline{\texttt{log(2)=-2\,log(1-13/256)-%
+ 5\,log(1-1/9)}}%
+The number of terms to be kept in the log series, for a desired
+precision of |10^{-D}| was roughly estimated without much theoretical
+analysis. Computing exactly the partial sums with \csa{xintPowerSeries}
+and then printing the truncated values, from |D=0| up to |D=100| showed
+that it worked in terms of quality of the approximation. Because of
+possible strings of zeros or nines in the exact decimal expansion (in
+the present case of $\log 2$, strings of zeros around the fourtieth and
+the sixtieth decimals), this
+does not mean though that all digits printed were always exact. In
+the end one always end up having to compute at some higher level of
+desired precision to validate the earlier result.
+
+Then we tried with \csa{xintFxPtPowerSeries}: this is worthwile only for
+|D|'s at least 50, as the exact evaluations are faster (with these
+short-length |x|'s) for a lower
+number of digits. And as expected the degradation in the quality of
+approximation was in this range of the order of two or three digits.
+This meant roughly that the 3+1=4 ending digits were wrong. Again, we ended
+up having to compute with five more digits and compare with the earlier
+value to validate it. We use truncation rather than rounding because our
+goal is not to obtain the correct rounded decimal expansion but the
+correct exact truncated one.
+
+% 693147180559945309417232121458176568075500134360255254120680009493
\begin{verbatim}
\def\coefflog #1{1/#1[0]}% 1/n
\def\xa {13/256[0]}% we will compute log(1-13/256)
\def\xb {1/9[0]}% we will compute log(1-1/9)
-\def\LogTwo #1% this #1 may be a count register, if desired
-% get log(2)=-2log(1-13/256)- 5log(1-1/9) with #1 digits precision
+\def\LogTwo #1%
+% get log(2)=-2log(1-13/256)- 5log(1-1/9)
{%
\romannumeral0\expandafter\LogTwoDoIt \expandafter
% Nb Terms for 1/9:
- {\the\numexpr (#1+5)*150/143\expandafter}\expandafter
+ {\the\numexpr #1*150/143\expandafter}\expandafter
% Nb Terms for 13/256:
- {\the\numexpr (#1+5)*100/129\expandafter}\expandafter
- {\the\numexpr #1+5\expandafter}\expandafter{\the\numexpr #1\relax }%
+ {\the\numexpr #1*100/129\expandafter}\expandafter
+ % We print #1 digits, but we know the ending ones are garbage
+ {\the\numexpr #1\relax}% allows #1 to be a count register
}%
-\def\LogTwoDoIt #1#2#3#4%
+\def\LogTwoDoIt #1#2#3%
% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
-{% #3=nb of digits for computations, #4 for printing
- \xinttrunc {#4}
+{% #3=nb of digits for computations, also used for printing
+ \xinttrunc {#3} % lowercase form to stop the \romannumeral0 expansion!
{\xintAdd
{\xintMul {2}{\xintFxPtPowerSeries {1}{#2}{\coefflog}{\xa}{#3}}}
{\xintMul {5}{\xintFxPtPowerSeries {1}{#1}{\coefflog}{\xb}{#3}}}%
}%
}%
-\[ \log 2 = \LogTwo {60}\dots\]
+\noindent $\log 2 \approx \LogTwo {60}\dots$\endgraf
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {65}}\dots\endgraf
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {70}}\dots\endgraf
\end{verbatim}
-\vspace*{-\baselineskip}
\def\coefflog #1{1/#1[0]}% 1/n
\def\xa {13/256[0]}% we will compute log(1-13/256)
\def\xb {1/9[0]}% we will compute log(1-1/9)
\def\LogTwo #1% get log(2)=-2log(1-13/256)- 5log(1-1/9) with #1 digits precision
{% this #1 may be a count register, if desired
\romannumeral0\expandafter\LogTwoDoIt \expandafter
- {\the\numexpr (#1+5)*150/143\expandafter}\expandafter % Nb Terms for 1/9
- {\the\numexpr (#1+5)*100/129\expandafter}\expandafter % Nb Terms for 13/256
- {\the\numexpr #1+5\expandafter}\expandafter{\the\numexpr #1\relax }%
+ {\the\numexpr #1*150/143\expandafter}\expandafter % Nb Terms for 1/9
+ {\the\numexpr #1*100/129\expandafter}\expandafter % Nb Terms for 13/256
+ {\the\numexpr #1\relax }%
}%
-\def\LogTwoDoIt #1#2#3#4% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
-{% #3=nb of digits for computations, #4 for printing
- \xinttrunc {#4}
+\def\LogTwoDoIt #1#2#3% #1=nb of terms for 1/9, #2=nb of terms for 13/256,
+{% #3=nb of digits for computations
+ \xinttrunc {#3}
{\xintAdd
{\xintMul {2}{\xintFxPtPowerSeries {1}{#2}{\coefflog}{\xa}{#3}}}
{\xintMul {5}{\xintFxPtPowerSeries {1}{#1}{\coefflog}{\xb}{#3}}}%
}%
}%
-\[ \log 2 = \LogTwo {60}\dots\]
+\noindent $\log 2 \approx \LogTwo {60}\dots$\endgraf
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {65}}\dots\endgraf
+\noindent\phantom{$\log 2$}${}\approx{}$\printnumber{\LogTwo {70}}\dots\endgraf
+
+Here is the code doing an exact evaluation of the partial sums. We have
+added a |+1| to the number of digits for estimating the number of terms
+to keep from the log series: we experimented that this gets exactly the
+first |D| digits, for all values from |D=0| to |D=100|, except in one
+case (|D=40|) where the last digit is wrong. For values of |D|
+higher than |100| it is more efficient to use the code using
+\csa{xintFxPtPowerSeries}.
+\begin{verbatim}
+\def\LogTwo #1% get log(2)=-2log(1-13/256)- 5log(1-1/9)
+{%
+ \romannumeral0\expandafter\LogTwoDoIt \expandafter
+ {\the\numexpr (#1+1)*150/143\expandafter}\expandafter
+ {\the\numexpr (#1+1)*100/129\expandafter}\expandafter
+ {\the\numexpr #1\relax}%
+}%
+\def\LogTwoDoIt #1#2#3%
+{% #3=nb of digits for truncating an EXACT partial sum
+ \xinttrunc {#3}
+ {\xintAdd
+ {\xintMul {2}{\xintPowerSeries {1}{#2}{\coefflog}{\xa}}}
+ {\xintMul {5}{\xintPowerSeries {1}{#1}{\coefflog}{\xb}}}%
+ }%
+}%
+\end{verbatim}
+
+Let us turn now to Pi, computed with the Machin formula. Again the
+numbers of terms to keep in the two |arctg| series were roughly estimated,
+and some experimentations showed that removing the last three
+digits was enough (at least for |D=0-100| range). And the
+algorithm does print the correct digits when used with |D=1000| (to be
+convinced of that one needs to run it for |D=1000| and again, say for
+|D=1010|.) A theoretical analysis could help confirm that this algorithm
+always gets better than |10^{-D}| precision, but again, strings of zeros or nines
+encountered in the decimal expansion may falsify the ending digits,
+nines may be zeros (and the last non-nine one should be increased) and
+zeros may be nine (and the last non-zero one should be decreased).
\begin{verbatim}
% pi = 16 Arctg(1/5) - 4 Arctg(1/239) (John Machin's formula)
\def\coeffarctg #1{\romannumeral0\xintmon{#1}/%
\the\numexpr 2*#1+1\relax [0]}%
% the above computes (-1)^n/(2n+1).
% Recall the xint macro \xintMON which does '(-1)^N' but ATTENTION: It
-% is MANDATORY that \coeffarctg #1 gives the final numerato in two
+% is MANDATORY that \coeffarctg #1 gives the final numerator in two
% expansion steps (the denominator is then identified as what follows
% after the slash and will be subjected to its own additional two
% expansion steps). If we had written \xintMON {#1} then this would not
@@ -2250,30 +3171,33 @@ re-do the computation with at least five more digits...).
% as I discovered making the mistake myself, if we had written \xintMON
% {#1} the computation would have silently proceeded to a WRONG final
% value! So please follow the package's author instructions.
-% Alternative:
+% Alternatives:
% \def\coeffarctg #1{1/\the\numexpr\xintMON{#1}*(2*#1+1)\relax }%
+% \def\coeffarctg #1{\the\numexpr\xintMON{#1}\relax/%
+ \the\numexpr 2*#1+1\relax [0]}%
+% The [0] can *not* be used in the former, as the denominator is signed.
\def\xa {1/25[0]}% 1/5^2, the [0] for faster parsing
\def\xb {1/57121[0]}% 1/239^2, the [0] for faster parsing
\def\Machin #1{% \Machin {\mycount} is allowed
\romannumeral0\expandafter\MachinA \expandafter
% number of terms for arctg(1/5):
- {\the\numexpr (#1+4)*5/7\expandafter}\expandafter
+ {\the\numexpr (#1+3)*5/7\expandafter}\expandafter
% number of terms for arctg(1/239):
- {\the\numexpr (#1+4)*10/45\expandafter}\expandafter
+ {\the\numexpr (#1+3)*10/45\expandafter}\expandafter
% do the computations with 4 additional digits:
- {\the\numexpr #1+4\expandafter}\expandafter
+ {\the\numexpr #1+3\expandafter}\expandafter
% allow #1 to be a count register:
{\the\numexpr #1\relax }}%
\def\MachinA #1#2#3#4%
-% #4: digits to keep after decimal point for printing
-% #3=#4+4: digits for computing intermediate results
-{\xinttrunc {#4} % lowercase! produces the space to stop \romannumeral
- {\xintiSub % does the final subtraction exactly with integers
- {\xintiTrunc {#3} % produces an integer for \xintiSub
- {\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}}
- {\xintiTrunc {#3} % above and below the main stuff
- {\xintMul{4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}}%
- [-#3]}} % this [-n] is ok as it follows an *integer*
+% #4: digits to keep after decimal point for final printing
+% #3=#4+3: digits for evaluation of the necessary number of terms
+% to be kept in the arctangent series, also used to truncate each
+% individual summand.
+{\xinttrunc {#4} % must be lowercase to stop \romannumeral0!
+ {\xintSub
+ {\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
+ {\xintMul {4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
+ }}%
\[ \pi = \Machin {60}\dots \]
\end{verbatim}
\vspace*{-\baselineskip}
@@ -2283,27 +3207,79 @@ re-do the computation with at least five more digits...).
\def\Machin #1{% #1 may be a count register, \Machin {\mycount} is allowed
\romannumeral0\expandafter\MachinA \expandafter
% number of terms for arctg(1/5):
- {\the\numexpr (#1+4)*5/7\expandafter}\expandafter
+ {\the\numexpr (#1+3)*5/7\expandafter}\expandafter
% number of terms for arctg(1/239):
- {\the\numexpr (#1+4)*10/45\expandafter}\expandafter
+ {\the\numexpr (#1+3)*10/45\expandafter}\expandafter
% do the computations with 4 additional digits:
- {\the\numexpr #1+4\expandafter}\expandafter
+ {\the\numexpr #1+3\expandafter}\expandafter
% allow #1 to be a count register:
{\the\numexpr #1\relax }}%
\def\MachinA #1#2#3#4%
-% #4: digits to keep after decimal point for printing
-% #3=#4+4: digits for computing intermediate results
-{\xinttrunc {#4}
- {\xintiSub % does the final subtraction exactly with integers
- {\xintiTrunc {#3} % produces an integer for \xintiSub
- {\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}}
- {\xintiTrunc {#3} % above and below the main stuff
- {\xintMul{4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}}%
- [-#3]}} % this [-n] is ok as it follows an *integer*
-\[ \pi = \Machin {60}\dots \]
+{\xinttrunc {#4}
+ {\xintSub
+ {\xintMul {16/5}{\xintFxPtPowerSeries {0}{#1}{\coeffarctg}{\xa}{#3}}}
+ {\xintMul{4/239}{\xintFxPtPowerSeries {0}{#2}{\coeffarctg}{\xb}{#3}}}%
+ }}%
+\begin{framed}
+ \[ \pi = \Machin {60}\dots \]
+\end{framed}
+Here is a variant|\MachinBis|,
+which evaluates the partial sums \emph{exactly} using
+\csa{xintPowerSeries}, before their final truncation. No need for a
+``|+3|'' then.
+\begin{verbatim}
+\def\MachinBis #1{% #1 may be a count register,
+% the final result will be truncated to #1 digits post decimal point
+ \romannumeral0\expandafter\MachinBisA \expandafter
+ % number of terms for arctg(1/5):
+ {\the\numexpr #1*5/7\expandafter}\expandafter
+ % number of terms for arctg(1/239):
+ {\the\numexpr #1*10/45\expandafter}\expandafter
+ % allow #1 to be a count register:
+ {\the\numexpr #1\relax }}%
+\def\MachinBisA #1#2#3%
+{\xinttrunc {#3} %
+ {\xintSub
+ {\xintMul {16/5}{\xintPowerSeries {0}{#1}{\coeffarctg}{\xa}}}
+ {\xintMul{4/239}{\xintPowerSeries {0}{#2}{\coeffarctg}{\xb}}}%
+}}%
+\end{verbatim}
-You want more digits? (and have some time?) Copy this code to a Plain
-\TeX{} or \LaTeX{} document loading \xintseriesname, and compile:
+\def\MachinBis #1{% #1 may be a count register,
+% the final result will be truncated to #1 digits post decimal point
+ \romannumeral0\expandafter\MachinBisA \expandafter
+ % number of terms for arctg(1/5):
+ {\the\numexpr #1*5/7\expandafter}\expandafter
+ % number of terms for arctg(1/239):
+ {\the\numexpr #1*10/45\expandafter}\expandafter
+ % allow #1 to be a count register:
+ {\the\numexpr #1\relax }}%
+\def\MachinBisA #1#2#3%
+{\xinttrunc {#3} %
+ {\xintSub
+ {\xintMul {16/5}{\xintPowerSeries {0}{#1}{\coeffarctg}{\xa}}}
+ {\xintMul{4/239}{\xintPowerSeries {0}{#2}{\coeffarctg}{\xb}}}%
+}}%
+
+Let us use this variant for a loop showing the build-up of digits:
+\begin{verbatim}
+ \cnta 0 % previously declared \count register
+ \loop
+ \MachinBis{\cnta} \endgraf % TeX's \loop does not accept \par
+ \ifnum\cnta < 30 \advance\cnta 1 \repeat
+\end{verbatim}
+\begin{multicols}{2}
+ \cnta 0 % previously declared \count register
+ \loop \noindent
+ \centeredline{\MachinBis{\cnta}}%
+ \ifnum\cnta < 30
+ \advance\cnta 1 \repeat
+\end{multicols}
+
+
+You want more digits and have some time? Copy the |\Machin|
+code to a Plain \TeX{} or \LaTeX{} document loading \xintseriesname, and
+compile:
\begin{verbatim}
\newwrite\outfile
\immediate\openout\outfile \jobname-out\relax
@@ -2311,29 +3287,627 @@ You want more digits? (and have some time?) Copy this code to a Plain
\immediate\closeout\outfile
\end{verbatim}
This will create a file with the correct first 1000 digits of $\pi$
-after the decimal point. On my laptop this took about 44 seconds last
-time I tried (and for 200 digits it is less than 1 second). As mentioned
-in the introduction, the file
+after the decimal point. On my laptop (a 2012 model) this took about 42
+seconds last time I tried (and for 200 digits it is less than 1 second).
+As mentioned in the introduction, the file
\href{http://www.ctan.org/pkg/pi}{\color{niceone}pi.tex} by \textsc{D.
Roegel} shows that orders of magnitude faster computations are
possible within \TeX{}, but recall our constraints of complete
expandability and be merciful, please.
+% \newwrite\outfile
+% \immediate\openout\outfile \jobname-out\relax
+% \pdfresettimer
+% \immediate\write\outfile {\Machin {1000}}
+% \edef\temps{\the\pdfelapsedtime}
+% \immediate\closeout\outfile
+
+% \temps: \xintQuo\temps{\xintiMul{60}{65536}} minutes,
+% \xintQuo{\xintRem\temps{\xintiMul{60}{65536}}}{65536} secondes et
+% \xintiTrunc {2}{\xintRem\temps{65536}/65536} centiemes de secondes
+
+\textbf{Why truncating rather than rounding?} One of our main competitor
+on the market of scientific computing, a canadian product (not
+encumbered with expandability constraints, and having barely ever heard
+of \TeX{} ;-), prints numbers rounded in the last digit. Why didn't we
+follow suit in the macros \csa{xintFxPtPowerSeries} and
+\csa{xintFxPtPowerSeriesX}? To round at |D| digits, and excluding a
+rewrite or cloning of the division algorithm which anyhow would add to
+it some overhead in its final steps, \xintfracname needs to truncate at
+|D+1|, then round. And rounding loses information! So, with more time
+spent, we obtain a worst result than the one truncated at |D+1| (one
+could imagine that additions and so on, done with only |D| digits, cost
+less; true, but this is a negligeable effect per summand compared to the
+additional cost for this term of having been truncated at |D+1| then
+rounded). Rounding is the way to go when setting up algorithms to
+evaluate functions destined to be composed one after the other: exact
+algebraic operations with many summands and an |x| variable which is a
+fraction are costly and create an even bigger fraction; replacing |x|
+with a reasonable rounding, and rounding the result, is necessary to
+allow arbitrary chaining.
+
+But, for the
+computation of a single constant, we are really interested in the exact
+decimal expansion, so we truncate and compute more terms until the
+earlier result gets validated. Finally if we do want the rounding we can
+always do it on a value computed with |D+1| truncation.
+
+
+\section{Commands of the \xintcfracname package}
+
+This package was first included in release |1.04| of the \xintname bundle.
+
+\subsection{Package overview}
+
+A \emph{simple} continued fraction has coefficients
+|[c0,c1,...,cN]| (usually called partial quotients, but I really
+dislike this entrenched terminology), where |c0| is a positive or
+negative integer and the others are positive integers. As we will
+see it is possible with \xintcfracname to specify the coefficient
+function |c:n->cn|. Note that the index then starts at zero as
+indicated. With the |amsmath| macro |\cfrac| one can display such a
+continued fraction as
+\[ c_0 + \cfrac{1}{c_1+\cfrac1{c_2+\cfrac1{c_3+\cfrac1{\ddots}}}}\]
+Here is a concrete example:
+\[ \xintFrac {208341/66317}=\xintCFrac {208341/66317}\] But the
+difference with |amsmath|'s |\cfrac| is that this was input as
+\centeredline{|\[ \xintFrac {208341/66317}=\xintCFrac
+ {208341/66317} \]|} The command \csb{xintCFrac} produces in two
+expansion steps the whole thing with the many chained |cfrac|'s and all
+necessary braces, ready to be printed, in math mode. This is \LaTeX{}
+only and with the |amsmath| package (we shall mention another method for
+Plain \TeX{} users of |amstex|).
+
+A \emph{generalized} continued fraction has the same structure but
+the numerators are not restricted to be ones, and numbers used in
+the continued fraction may be arbitrary, also fractions,
+irrationals, indeterminates. The \emph{centered} continued
+fraction associated to a rational number is an
+example:\centeredline{|\[ \xintFrac {915286/188421}=\xintGCFrac {\xintFtoCC
+ {915286/188421}} \]|}
+\[ \xintFrac {915286/188421}=\xintGCFrac {\xintFtoCC {915286/188421}}
+=\xintCFrac {915286/188421}\] The command \csb{xintGCFrac}, contrarily to
+\csb{xintCFrac} does not compute anything, it just typesets. Here, it is the
+command \csb{xintFtoCC} which did the computation of
+the centered continued fraction of |f|. Its output has the `inline format'
+described in the next paragraph. In the display, we also used \csa{xintCFrac}
+(code not shown), for comparison of the two types of continued fractions.
+
+A generalized continued fraction may be input `inline' as:
+\centeredline{|a0+b0/a1+b1/a2+b2/...../a(n-1)+b(n-1)/an|}%
+Fractions among the coefficients are allowed but they must be enclosed
+within braces. Signed integers may be left without braces (but the |+|
+signs are mandatory). Or, they may
+be macros expanding (in two steps) to some number or fractional number.
+\centeredline{|\xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintQuo {132}{25}}|}
+\[ \xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintQuo {132}{25}}}=
+ \xintGCFrac {1+-1/57+\xintPow {-3}{7}/\xintQuo {132}{25}}\]
+The left hand side was obtained with the following code:
+\centeredline{|\xintFrac{\xintGCtoF {1+-1/57+\xintPow {-3}{7}/\xintQuo
+ {132}{25}}}|}
+It uses the macro \csb{xintGCtoF} to convert a generalized fraction from the
+`inline format' to the fraction it evaluates to.
+
+A simple continued fraction is a special case of a generalized continued
+fraction and may be input as such to macros expecting the `inline format', for
+example |-7+1/6+1/19+1/1+1/33|. There is a simpler comma separated format:
+\centeredline{|\xintFrac{\xintCstoF{-7,6,19,1,33}}=\xintCFrac{\xintCstoF{-7,6,19,1,33}}|}
+\[
+\xintFrac{\xintCstoF{-7,6,19,1,33}}=\xintCFrac{\xintCstoF{-7,6,19,1,33}}\] This
+comma separated format may also be used with fractions among the coefficients:
+of course in that case, computing with \csb{xintFtoCs} from the resulting |f|
+its real coefficients will give a new comma separated list
+with only integers. This list has no spaces: the spaces in the display below
+arise from the math mode processing.
+\centeredline{|\xintFrac{1084483/398959}=[\xintFtoCs{1084483/398959}]|}
+\[\xintFrac{1084483/398959}=[\xintFtoCs{1084483/398959}]\]
+If one prefers other separators, one can use \csb{xintFtoCx} whose first
+argument will be the separator to be used.
+\centeredline{|\xintFrac{2721/1001}=\xintFtoCx {+1/(}{2721/1001})\cdots)|}
+\[\xintFrac{2721/1001}=\xintFtoCx {+1/(}{2721/1001})\cdots)\]
+People using Plain \TeX{} and |amstex| can achieve the same effect as
+|\xintCFrac| with:
+|$$\xintFwOver{2721/1001}=\xintFtoCx {+\cfrac1\\ }{2721/1001}\endcfrac$$|
+
+Using \csa{xintFtoCx} with first argument an empty pair of braces |{}| will
+return the list of the coefficients of the continued fraction of |f|, without
+separator, and each one enclosed in a pair of group braces. This can then be
+manipulated by the non-expandable macro \csb{xintAssignArray} or the expandable
+ones \csb{xintApply} and \csb{xintListWithSep}.
+
+As a shortcut to using \csa{xintFtoCx} with separator |1+/|, there is
+\csb{xintFtoGC}:
+\centeredline{|2721/1001=\xintFtoGC {2721/1001}|}%
+\centeredline{\texttt{2721/1001=\xintFtoGC {2721/1001}}}
+Let us compare in that case with the output of \csb{xintFtoCC}:
+\centeredline{|2721/1001=\xintFtoCC {2721/1001}|}%
+\centeredline{\texttt{2721/1001=\xintFtoCC {2721/1001}}}
+
+The `|\printnumber|' macro which we use to print long numbers can also
+be useful on long continued fractions.
+\centeredline{|\printnumber{\xintFtoCC {35037018906350720204351049/%|}%
+\centeredline{|244241737886197404558180}}|}%
+\texttt{\printnumber{\xintFtoCC {35037018906350720204351049/244241737886197404558180}}}.
+If we apply \csb{xintGCtoF} to this generalized continued fraction, we
+discover that the original fraction was reducible:
+\centeredline{|\xintGCtoF
+ {143+1/2+...+-1/9}=|\texttt{\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6+-1/9}}}
+
+\def\mymacro #1{$\xintFrac{#1}=[\xintFtoCs{#1}]$\vtop to 6pt{}}
+
+\catcode`\& 4
+When a generalized continued fraction is built with integers, and
+numerators are only |1|'s or |-1|'s, the produced fraction is
+irreducible. And if we compute it again with the last sub-fraction
+omitted we get another irreducible fraction related to the bigger one by
+a Bezout identity. Doing this here we get:
+\centeredline{|\xintGCtoF {143+1/2+...+-1/6}=|\texttt{\xintGCtoF{143+1/2+1/5+-1/4+-1/4+-1/4+-1/3+1/2+1/2+1/6+-1/22+1/2+1/10+-1/5+-1/11+-1/3+1/4+-1/2+1/2+1/4+-1/2+1/23+1/3+1/8+-1/6}}}
+and indeed:
+\[ \begin{vmatrix}
+ |2897319801297630107| & |328124887710626729|\\
+ |20197107104701740| & |2287346221788023|
+ \end{vmatrix} = \texttt{\xintiSub {\xintiMul {2897319801297630107}{2287346221788023}}{\xintiMul{20197107104701740}{328124887710626729}}}\]
+
+\catcode`\& 13
+
+More generally the various fractions obtained from the truncation of a
+continued fraction to its initial terms are called the convergents. The
+commands of \xintcfracname such as \csb{xintFtoCv}, \csb{xintFtoCCv},
+and others which compute such convergents, return them as a list of
+braced items, with no separator. This list can then be treated either
+with \csa{xint\-AssignArray}, or \csa{xintListWithSep}, or any other way
+(but then, some \TeX{} programming knowledge will be necessary). Here
+is an example:
+
+\noindent
+\centeredline{|$$\xintFrac{915286/188421}\to \xintListWithSep {,}%|}%
+\centeredline{|{\xintApply{\xintFrac}{\xintFtoCv{915286/188421}}}$$|}
+\[ \xintFrac{915286/188421}\to \xintListWithSep {,}
+{\xintApply\xintFrac{\xintFtoCv{915286/188421}}}\]
+\centeredline{|$$\xintFrac{915286/188421}\to \xintListWithSep {,}%|}%
+\centeredline{|{\xintApply{\xintFrac}{\xintFtoCCv{915286/188421}}}$$|}
+\[ \xintFrac{915286/188421}\to \xintListWithSep {,}
+{\xintApply\xintFrac{\xintFtoCCv{915286/188421}}}\] We thus see that the
+`centered convergents' obtained with \csb{xintFtoCCv} are among the fuller list
+of convergents as returned by \csb{xintFtoCv}.
+
+Here is a more complicated use of \csa{xintApply}
+and \csa{xintListWithSep}. We first define a macro which will be applied to each
+convergent:\centeredline{|\newcommand{\mymacro}[1]|%
+ |{$\xintFrac{#1}=[\xintFtoCs{#1}]$\vtop to 6pt{}}|}%
+Next, we use the following code:
+\centeredline{|$\xintFrac{49171/18089}\to{}$|}%
+\centeredline{|\xintListWithSep {,
+ }{\xintApply{\mymacro}{\xintFtoCv{49171/18089}}}|}
+It produces:\par
+\noindent$ \xintFrac{49171/18089}\to {}$\xintListWithSep {,
+ }{\xintApply{\mymacro}{\xintFtoCv{49171/18089}}}.
+
+
+\def\cn #1{\romannumeral0\xintipow {2}{#1}}%
+
+The macro \csb{xintCntoF} allows to specify the coefficients as
+functions of the index. The values to which expand the
+coefficient function do not have to be integers. \centeredline{|\def\cn
+ #1{\romannumeral0\xintipow {2}{#1}}% 2^n|}%
+ \centeredline{|\[\xintFrac{\xintCntoF {6}{\cn}}=\xintCFrac
+ [l]{\xintCntoF {6}{\cn}}\]|}%
+\[\xintFrac{\xintCntoF {6}{\cn}}=\xintCFrac [l]{\xintCntoF
+ {6}{\cn}}\]
+Notice the use of the optional argument |[l]| to \csa{xintCFrac}. Other
+possibilities are |[r]| and (default) |[c]|.
+\def\cn #1{\romannumeral0\xintpow {2}{-#1}}%
+\centeredline{|\def\cn #1{\romannumeral0\xintpow {2}{-#1}}% 1/2^n|}%
+\centeredline{%
+|\[\xintFrac{\xintCntoF {6}{\cn}} = \xintGCFrac [r]{\xintCntoGC {6}{\cn}}|}%
+\centeredline{| = [\xintFtoCs {\xintCntoF {6}{\cn}}]\]|}%
+\[\xintFrac{\xintCntoF {6}{\cn}}=\xintGCFrac [r]{\xintCntoGC {6}{\cn}}=
+ [\xintFtoCs {\xintCntoF {6}{\cn}}]\]
+We used \csb{xintCntoGC} as we wanted to display also the continued fraction and
+not only the fraction returned by \csa{xintCntoF}.
+
+There are also \csb{xintGCntoF} and \csb{xintGCntoGC} which allow the same for
+generalized fractions. The following initial portion of a generalized continued
+fraction for $\pi$:
+\def\an #1{\the\numexpr 2*#1+1\relax }%
+\def\bn #1{\the\numexpr (#1+1)*(#1+1)\relax }%
+\[ \xintFrac{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}} =
+ \cfrac{4}{\xintGCFrac{\xintGCntoGC {5}{\an}{\bn}}} =
+\xintTrunc {10}{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}}\dots\]
+was obtained with this code:
+\begin{verbatim}
+\def\an #1{\the\numexpr 2*#1+1\relax }%
+\def\bn #1{\the\numexpr (#1+1)*(#1+1)\relax }%
+\[ \xintFrac{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}} =
+ \cfrac{4}{\xintGCFrac{\xintGCntoGC {5}{\an}{\bn}}} =
+\xintTrunc {10}{\xintDiv {4}{\xintGCntoF {5}{\an}{\bn}}}\dots\]
+\end{verbatim}
+We see that the quality of approximation is not fantastic compared to the simple
+continued fraction of $\pi$ with about as many terms:
+\begin{verbatim}
+\[ \xintFrac{\xintCstoF{3,7,15,1,292,1,1}}=
+ \xintGCFrac{3+1/7+1/15+1/1+1/292+1/1+1/1}=
+ \xintTrunc{10}{\xintCstoF{3,7,15,1,292,1,1}}\dots\]
+\end{verbatim}
+\[ \xintFrac{\xintCstoF{3,7,15,1,292,1,1}}=
+\xintGCFrac{3+1/7+1/15+1/1+1/292+1/1+1/1}=
+\xintTrunc{10}{\xintCstoF{3,7,15,1,292,1,1}}\dots\]
+
+To conclude this overview of most of the package functionalities, let us explore
+the convergents of Euler's number $e$.
+\begin{verbatim}
+\def\cn #1{\the\numexpr\ifcase \numexpr #1+3-3*((#1+2)/3)\relax
+ 1\or1\or2*(#1/3)\fi\relax }
+% produces the pattern 1,1,2,1,1,4,1,1,6,1,1,8,... which are the
+% coefficients of the simple continued fraction of e-1.
+\cnta 0
+\def\mymacro #1{\advance\cnta by 1
+ \noindent
+ \hbox to 3em {\hfil\small\texttt{\the\cnta.} }%
+ $\xintTrunc {30}{\xintAdd {1[0]}{#1}}\dots=
+ \xintFrac{\xintAdd {1[0]}{#1}}$}%
+\xintListWithSep{\vtop to 6pt{}\vbox to 12pt{}\par}
+ {\xintApply\mymacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}
+\end{verbatim}
+\smallskip The volume of computation is kept minimal by the following steps:
+\begin{itemize}
+\item a comma separated list of the first 36 coefficients is produced by
+ \csb{xintCntoCs},
+\item this is then given to \csb{xintiCstoCv} which produces the list of the
+ convergents (there is also \csb{xintCstoCv}, but our
+ coefficients being integers we used the infinitesimally
+ faster \csb{xintiCstoCv}),
+\item then the whole list was converted into a sequence of one-line paragraphs,
+ where each convergent is the argument to a typesetting macro printing it
+ exactly and also its decimal expansion with 30 digits after the decimal point.
+\item A count register |\cnta| was used to give a line count serving as a visual
+ aid: we could also have done that in an expandable way, but well, let's relax
+ from time to time\dots
+\end{itemize}
+
+
+\def\cn #1{\the\numexpr\ifcase \numexpr #1+3-3*((#1+2)/3)\relax
+ 1\or1\or2*(#1/3)\fi\relax }
+% produces the pattern 1,1,2,1,1,4,1,1,6,1,1,8,... which are the
+% coefficients of the simple continued fraction of e-1.
+\cnta 0
+\def\mymacro #1{\advance\cnta by 1
+ \noindent
+ \hbox to 3em {\hfil\small\texttt{\the\cnta.} }%
+ $\xintTrunc {30}{\xintAdd {1[0]}{#1}}\dots=
+ \xintFrac{\xintAdd {1[0]}{#1}}$}%
+\xintListWithSep{\vtop to 6pt{}\vbox to 12pt{}\par}
+ {\xintApply\mymacro{\xintiCstoCv{\xintCntoCs {35}{\cn}}}}
+
+\smallskip The typesetting of the paragraphs and shipout of the
+completed pages
+took most of the time: the actual computation of the list of convergents
+accounts for only 8\% of the total time (total time equal to about 5
+hundredths of a second in my testing, on my laptop). One can with no
+problem compute much bigger convergents. Let's compute the 200th
+convergent. It turns out to have the same first 268 digits after the decimal
+point as $e-1$. Higher convergents get more and more digits in
+proportion to their index: the 500th convergent already gets 799 digits
+correct! To allow speedy compilation of the source of this document when
+the need arises, I limit here to the 200th convergent (getting the 500th
+took about 1.2s on my laptop last time I tried, and the 200th convergent
+is obtained ten times faster).
+\begin{verbatim}
+\edef\z {\xintCntoF {199}{\cn}}%
+\begingroup\parindent 0pt \leftskip 2.5cm
+\indent\llap {Numerator = }\printnumber{\xintNumerator\z}\par
+\indent\llap {Denominator = }\printnumber{\xintDenominator\z}\par
+\indent\llap {Expansion = }\printnumber{\xintTrunc{268}\z}\dots
+\par\endgroup
+\end{verbatim}
+
+\edef\z {\xintCntoF {199}{\cn}}%
+
+\begingroup\parindent 0pt \leftskip 2.5cm
+\indent\llap {Numerator = }\printnumber{\xintNumerator\z}\par
+\indent\llap {Denominator = }\printnumber{\xintDenominator\z}\par
+\indent\llap {Expansion = }\printnumber{\xintTrunc{268}\z}\dots\par\endgroup
+
+
+\subsection{\csbh{xintCFrac}}\label{xintCFrac}
+
+\csa{xintCFrac}|{f}| is a math-mode only, \LaTeX{} with |amsmath| only, macro
+which first computes then displays with the help of |\cfrac| the simple
+continued fraction corresponding to the given fraction (or macro expanding in
+two steps to one such). It admits an optional argument which may be |[l]|, |[r]|
+or (the default) |[c]| to specify the location of the one's in the numerators.
+
+
+\subsection{\csbh{xintGCFrac}}\label{xintGCFrac}
+
+\csa{xintGCFrac}|{a+b/c+d/e+f/g+h/...}| uses similarly |\cfrac| to typeset a
+generalized continued fraction in inline format. It admits the same optional
+argument as \csa{xintCFrac}.
+\centeredline{|\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}\]|}
+\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}\]
+As can be seen this is typesetting macro, although it does proceed to the
+evaluation of the coefficients themselves. See \csb{xintGCtoF} if you are
+impatient to see this fraction computed.
+
+\subsection{\csbh{xintFtoCs}}\label{xintFtoCs}
+
+\csa{xintFtoCs}|{f}| returns the comma separated list of the coefficients of the
+simple continued fraction of |f|.
+\centeredline{%
+|\[ \xintSignedFrac{-5262046/89233} = [\xintFtoCs{-5262046/89233}]\]|}%
+\[ \xintSignedFrac{-5262046/89233} = [\xintFtoCs{-5262046/89233}]\]
+
+
+\subsection{\csbh{xintFtoCx}}\label{xintFtoCx}
+
+\csa{xintFtoCx}|{sep}{f}| returns the list of the coefficients of the simple
+continued fraction of |f|, withing group braces and separated with the help of
+|sep|. \centeredline{|$$\xintFtoCx {+\cfrac1\\ }{f}\endcfrac$$|} will
+display the
+continued fraction in |\cfrac| format, with Plain \TeX{} and |amstex|.
+
+\subsection{\csbh{xintFtoGC}}\label{xintFtoGC}
+
+\csa{xintFtoGC}|{f}| does the same as \csa{xintFtoCx}|{+1/}{f}|. Its
+output may thus be used in the package macros expecting such an `inline
+format'. This continued fraction is a \emph{simple} one, not a
+\emph{generalized} one, but as it is produced in the format used for
+user input of generalized continued fractions, the macro was called
+\csa{xintFtoGC} rather than \csa{xintFtoC} for example.
+\centeredline{|566827/208524=\xintFtoGC {566827/208524}|}%
+\centeredline{566827/208524=\xintFtoGC {566827/208524}}
+
+\subsection{\csbh{xintFtoCC}}\label{xintFtoCC}
+
+\csa{xintFtoCC}|{f}| returns the `centered' continued fraction of |f|, in
+`inline format'.
+\centeredline{|566827/208524=\xintFtoCC {566827/208524}|}%
+\centeredline{566827/208524=\xintFtoCC {566827/208524}}
+\centeredline{%
+|\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]|}%
+\[\xintFrac{566827/208524} = \xintGCFrac{\xintFtoCC{566827/208524}}\]
+
+\subsection{\csbh{xintFtoCv}}\label{xintFtoCv}
+
+\csa{xintFtoCv}|{f}| returns the list of the (braced) convergents of |f|, with
+no separator. To be treated with \csb{xintAssignArray} or \csb{xintListWithSep}.
+\centeredline{%
+|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]|}%
+\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCv{5211/3748}}}\]
+
+\subsection{\csbh{xintFtoCCv}}\label{xintFtoCCv}
+
+\csa{xintFtoCCv}|{f}| returns the list of the (braced) centered convergents of
+|f|, with no separator. To be treated with \csb{xintAssignArray} or
+\csb{xintListWithSep}.
+\centeredline{%
+|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]|}%
+\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintFtoCCv{5211/3748}}}\]
+
+\subsection{\csbh{xintCstoF}}\label{xintCstoF}
+
+\csa{xintCstoF}|{a,b,c,d,...,z}| computes the fraction corresponding to the
+coefficients, which may be fractions or even macros expanding to such
+fractions (in two steps). The final fraction may then be highly
+reducible.
+\centeredline{|\[\xintGCFrac {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}|}%
+\centeredline{|=\xintSignedFrac{\xintCstoF {-1,3,-5,7,-9,11,-13}}|}%
+\centeredline{|=\xintSignedFrac{\xintGCtoF
+ {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]|}%
+\[\xintGCFrac {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}=
+\xintSignedFrac{\xintCstoF {-1,3,-5,7,-9,11,-13}}
+=\xintSignedFrac{\xintGCtoF {-1+1/3+1/-5+1/7+1/-9+1/11+1/-13}}\]
+\centeredline{|\xintGCFrac{{1/2}+1/{1/3}+1/{1/4}+1/{1/5}}= |}%
+\centeredline{| \xintFrac{\xintCstoF {1/2,1/3,1/4,1/5}}|}%
+\[\xintGCFrac{{1/2}+1/{1/3}+1/{1/4}+1/{1/5}}=
+\xintFrac{\xintCstoF {1/2,1/3,1/4,1/5}}\] A generalized continued fraction may
+produce a reducible fraction (\csa{xintCstoF} tries its best not to accumulate
+in a silly way superfluous factors but will not do simplifications which would
+be obvious to a human, like simplification by 3 in the result above).
+
+\subsection{\csbh{xintCstoCv}}\label{xintCstoCv}
+
+\csa{xintCstoCv}|{a,b,c,d,...,z}| returns the list of the corresponding
+convergents. It is allowed to use fractions as coefficients (the computed
+convergents have then no reason to be the real convergents of the final
+fraction). When the coefficients are integers, the convergents are irreducible
+fractions, but otherwise it is of course not necessarily the case.
+\centeredline{|\xintListWithSep:{\xintCstoCv{1,2,3,4,5,6}}|}%
+\centeredline{\texttt{\xintListWithSep:{\xintCstoCv{1,2,3,4,5,6}}}}
+\centeredline{|\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}|}%
+\centeredline{\texttt{\xintListWithSep:{\xintCstoCv{1,1/2,1/3,1/4,1/5,1/6}}}} I
+know that these |[0]| are a bit annoying\footnote{and the awful truth is that it
+ is added forcefully by \csa{xintCstoCv} at the last step\dots } but this is
+the way \xintfracname likes to reception fractions: this format is best for
+further processing by the bundle macros. For `inline' printing, one may apply
+\csb{xintRaw} and for display in math mode \csb{xintFrac}.
+\centeredline{|\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv|}%
+ \centeredline{|{\xintPow {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]|}%
+\[\xintListWithSep{\to}{\xintApply\xintFrac{\xintCstoCv
+ {\xintPow {-.3}{-5},7.3/4.57,\xintCstoF{3/4,9,-1/3}}}}\]
+
+
+\subsection{\csbh{xintCstoGC}}\label{xintCstoGC}
+
+\csa{xintCstoGC}|{a,b,..,z}| transforms a comma separated list (or
+something expanding to such a list) into an
+`inline format' continued fraction |{a}+1/{b}+1/...+1/{z}|. The
+coefficients are just copied and put within braces, without expansion.
+The output can then be used in \csb{xintGCFrac} for example.
+\centeredline{|\[\xintGCFrac {\xintCstoGC {-1,1/2,-1/3,1/4,-1/5}}|}%
+\centeredline{|=\xintSignedFrac {\xintCstoF {-1,1/2,-1/3,1/4,-1/5}}\]|}%
+\[\xintGCFrac {\xintCstoGC {-1,1/2,-1/3,1/4,-1/5}} =
+\xintSignedFrac{\xintCstoF {-1,1/2,-1/3,1/4,-1/5}}\]
+
+\subsection{\csbh{xintGCtoF}}\label{xintGCtoF}
+
+\csa{xintGCtoF}|{a+b/c+d/e+f/g+......w/x+y/z}| computes the fraction defined by
+the inline generalized continued fraction. Coefficients may be fractions but
+must then be put within braces. They can be macros. The plus signs are
+mandatory.
+\begin{verbatim}
+\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}} =
+\xintFrac{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}} =
+\xintFrac{\xintIrr{\xintGCtoF
+ {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]
+\end{verbatim}
+\[\xintGCFrac {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}} =
+\xintFrac{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}} =
+\xintFrac{\xintIrr{\xintGCtoF {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}}}}\]
+\begin{verbatim}
+\[ \xintGCFrac{{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}} =
+ \xintFrac{\xintGCtoF {{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}}} \]
+\end{verbatim}
+\[ \xintGCFrac{{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}} =
+ \xintFrac{\xintGCtoF {{1/2}+{2/3}/{4/5}+{1/2}/{1/5}+{3/2}/{5/3}}} \]
+The macro tries its best not to accumulate superfluous factor in the
+denominators, but doesn't reduce the fraction to irreducible form before
+returning it and does not do simplifications which would be obvious to a human.
+
+
+\subsection{\csbh{xintGCtoCv}}\label{xintGCtoCv}
+
+\csa{xintGCtoCv}|{a+b/c+d/e+f/g+......w/x+y/z}| returns the list of the
+corresponding convergents. The coefficients may be fractions, but must
+then be inside braces. Or they may be macros, too.
+
+The convergents will in the general case be reducible. To put them into
+irreducible form, one needs one more step, for example it can be done
+with |\xintApply\xintIrr|.
+\begin{verbatim}
+\[\xintListWithSep{,}{\xintApply\xintFrac
+ {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}\]
+\[\xintListWithSep{,}{\xintApply\xintFrac{\xintApply\xintIrr
+ {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}}\]
+\end{verbatim}
+\[\xintListWithSep{,}{\xintApply\xintFrac
+ {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}\]
+\[\xintListWithSep{,}{\xintApply\xintFrac{\xintApply\xintIrr
+ {\xintGCtoCv{3+{-2}/{7/2}+{3/4}/12+{-56}/3}}}}\]
+
+\subsection{\csbh{xintCntoF}}\label{xintCntoF}
+
+\def\macro #1{\the\numexpr 1+#1*#1\relax}
+
+\csa{xintCntoF}|{N}{\macro}| computes the fraction |f| having
+coefficients |c(j)=\macro{j}| for |j=0,1,...,N|. The values do not have
+to be positive, nor integers, and it is thus not necessarily the case
+that the original |c(j)| are the true coefficients of the final |f|.
+One usually has to define the one-parameter |\macro| in advance.
+\centeredline{%
+|\def\macro #1{\the\numexpr 1+#1*#1\relax}\xintCntoF {5}{\macro}|}%
+\centeredline{\xintCntoF {5}{\macro}}
+
+\subsection{\csbh{xintGCntoF}}\label{xintGCntoF}
+
+\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%
+\def\coeffB #1{\romannumeral0\xintmon{#1}}% (-1)^n
+
+\csa{xintGCntoF}|{N}{\macroA}{\macroB}| returns the fraction |f| corresponding
+to the inline generalized continued fraction |a0+b0/a1+b1/a2+....+b(N-1)/aN|,
+with |a(j)=\macroA{j}| and |b(j)=\macroB{j}|.
+\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}}
+= \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]
+There is also \csb{xintGCntoGC} to get the `inline format' continued
+fraction. The previous display was obtained with:
+\centeredline{|\def\coeffA #1{\the\numexpr #1+4-3*((#1+2)/3)\relax }%|}%
+\centeredline{|\def\coeffB #1{\romannumeral0\xintmon{#1}}% (-1)^n|}%
+\centeredline{|\[\xintGCFrac{\xintGCntoGC {6}{\coeffA}{\coeffB}}|}%
+\centeredline{| = \xintFrac{\xintGCntoF {6}{\coeffA}{\coeffB}}\]|}
+
+
+\subsection{\csbh{xintCntoCs}}\label{xintCntoCs}
+
+\csa{xintCntoCs}|{N}{\macro}| produces the comma separated list of the
+corresponding coefficients, from |n=0| to |n=N|.
+\centeredline{%
+|\def\macro #1{\the\numexpr 1+#1*#1\relax}\xintCntoCs {5}{\macro}|}%
+\centeredline{\xintCntoCs {5}{\macro}}%
+\centeredline{|\[\xintFrac{\xintCntoF
+ {5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]|}%
+\[ \xintFrac{\xintCntoF
+ {5}{\macro}}=\xintCFrac{\xintCntoF {5}{\macro}}\]
+
+\subsection{\csbh{xintCntoGC}}\label{xintCntoGC}
+
+\def\macro #1{\the\numexpr\xintMON {#1}*(1+#1)\relax/%
+ \the\numexpr 1+#1*#1\relax}
+
+\csa{xintCntoGC}|{N}{\macro}| evaluates the |c(j)=\macro{j}| from |j=0|
+to |j=N| and returns a continued fraction written in inline
+format: |{c(0)}+1/{c(1)}+1/...+1/{c(N)}|. It may then serve as input to
+other macros. The coefficients, after expansion, are, as shown, being
+enclosed in an added pair of braces, they may thus be
+fractions.
+\centeredline{%
+|\def\macro #1{\the\numexpr\xintMON {#1}*(1+#1)\relax/%|}%
+\centeredline{|\the\numexpr 1+#1*#1\relax}|}%
+\centeredline{|\edef\x{\xintCntoGC {5}{\macro}}\texttt{\meaning\x}|}%
+\centeredline{|\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]|}%
+\centeredline{\edef\x{\xintCntoGC {5}{\macro}}\texttt{\meaning\x}}
+\[\xintGCFrac{\xintCntoGC {5}{\macro}}\]
+
+\subsection{\csbh{xintGCntoGC}}\label{xintGCntoGC}
+
+\csa{xintGCntoGC}|{N}{\macroA}{\macroB}| evaluates the coefficients and
+then returns the corresponding
+|{a0}+{b0}/{a1}+{b1}/{a2}+...+{b(N-1)}/{aN}| inline generalized
+fraction. As shown, the coefficients are enclosed into added pairs of
+braces, and may thus be fractions.
+\begin{verbatim}
+\def\an #1{\the\numexpr #1*#1*#1+1\relax}%
+\def\bn #1{\the\numexpr \xintMON{#1}*(#1+1)\relax}%
+\texttt{\xintGCntoGC {5}{\an}{\bn}}%
+ ${}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}}
+ = \displaystyle\xintFrac {\xintGCntoF {5}{\an}{\bn}}$\par
+\end{verbatim}
+\def\an #1{\the\numexpr #1*#1*#1+1\relax}%
+\def\bn #1{\the\numexpr \xintMON{#1}*(#1+1)\relax}%
+\noindent\texttt{\xintGCntoGC {5}{\an}{\bn}}%
+ ${}=\xintGCFrac {\xintGCntoGC {5}{\an}{\bn}}
+ = \displaystyle\xintFrac {\xintGCntoF{5}{\an}{\bn}}$\par
+
+
+\subsection{\csbh{xintiCstoF},~\csbh{xintiGCtoF},~\csbh{xint\-iCstoCv},~\csbh{xintiGCtoCv}}\label{xintiCstoF}
+\label{xintiGCtoF}
+\label{xintiCstoCv}
+\label{xintiGCtoCv}
+
+The same as the corresponding macros without the `i', but for
+integer-only input. Infinitesimally faster; to notice the higher
+efficiency one would need to use them with an input having (at least)
+hundreds of coefficients.
+
+
+\subsection{\csbh{xintGCtoGC}}\label{xintGCtoGC}
+
+\csa{xintGCtoGC}|{a+b/c+d/e+f/g+......w/x+y/z}| twice-expands each one of the
+coefficients and returns an inline continued fraction of the same type, each
+coefficient being enclosed withing braces.
+\begin{verbatim}
+\edef\x {\xintGCtoGC
+ {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}+\xintCstoF {2,-7,-5}/16}}
+\texttt{\meaning\x}
+\end{verbatim}
+\edef\x {\xintGCtoGC
+ {1+\xintPow{1.5}{3}/{1/7}+{-3/5}/\xintFac {6}+\xintCstoF {2,-7,-5}/16}}
+\texttt{\meaning\x}
+
+To be honest I have, it seems, forgotten why I wrote this macro in the
+first place.
\catcode`\& 4
\makeatletter
\let\check@percent\original@check@percent
-\StopEventually{\check@checksum\end{document}\endinput}
+\StopEventually{\end{document}\endinput}
\makeatother
\newgeometry{hmarginratio=4:3,hscale=0.75}
\def\MacroFont{\ttfamily\small\baselineskip12pt\relax}
-\toctransition
-
\MakePercentIgnore
%
% \catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
@@ -2348,8 +3922,9 @@ expandability and be merciful, please.
% sparse. Some comments may be left-overs from previous versions
% of the macro, with parameters in another order for example.
%
+% \toctransition
% \localtableofcontents
-% \subsection{Catcodes, \eTeX{} detection, reload detection}
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
% The method for package identification and reload detection is
% copied verbatim from the packages by \textsc{Heiko Oberdiek}.
@@ -2471,7 +4046,7 @@ expandability and be merciful, please.
\fi
\expandafter\x\csname ver@xint.sty\endcsname
\ProvidesPackage{xint}%
- [2013/04/14 v1.03 Expandable operations on long numbers (jfB)]%
+ [2013/04/25 v1.04 Expandable operations on long numbers (jfB)]%
% \end{macrocode}
% \subsection{Token management macros}
% \begin{macrocode}
@@ -2620,15 +4195,14 @@ expandability and be merciful, please.
{%
\the\numexpr #1#2#3#4\relax
}%
-\def\XINT@Rev@andcleanupzeros #1%
+\def\XINT@rev@andcuz #1%
{%
- \romannumeral0\expandafter
- \xint@cleanupzeros@andstop
+ \expandafter\xint@cleanupzeros@andstop
\romannumeral0\XINT@rord@main {}#1%
\xint@UNDEF
\xint@undef\xint@undef\xint@undef\xint@undef
\xint@undef\xint@undef\xint@undef\xint@undef
- \xint@UNDEF
+ \xint@UNDEF
}%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
@@ -2673,7 +4247,7 @@ expandability and be merciful, please.
\def\xint@cuz@backtoloop 0\XINT@cuz@Stop 0{\XINT@cuz@loop }%
% \end{macrocode}
% \subsection{\csh{XINT@isOne}}
-% Added in |1.03|.
+% Added in |1.03|. Attention, does not do any expansion.
% \begin{macrocode}
\def\XINT@isOne #1{\romannumeral0\XINT@isone #1\W\Z }%
\def\XINT@isone #1#2%
@@ -2790,12 +4364,14 @@ expandability and be merciful, please.
\def\XINT@length@end@i #1\XINT@length@end@viii #2%
{\expandafter\space\the\numexpr #2-1\relax}%
% \end{macrocode}
-% \subsection{\csh{xintAssign}, \csh{xintAssignArray}, \csh{xintDigitsOf}}
+% \subsection{\csh{xintAssign},~\csh{xintAssignArray},~\csh{xintDigitsOf}}
% \begin{verbatim}
% \xintAssign {a}{b}..{z}\to\A\B...\Z,
% \xintAssignArray {a}{b}..{z}\to\U
% version 1.01 corrects an oversight in 1.0 related to the value of
% \escapechar at the time of using \xintAssignArray or \xintRelaxArray
+% These macros are an exception in the xint bundle, they do not care at
+% all about compatibility with expansion-only contexts.
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
@@ -2910,6 +4486,73 @@ expandability and be merciful, please.
}%
\let\xintDigitsOf\xintAssignArray
% \end{macrocode}
+% \subsection{\csh{xintApply}}
+% \begin{verbatim}
+% \xintApply {\macro}{{a}{b}...{z}} returns {\macro{a}}...{\macro{b}}
+% where each instance of \macro is twice expanded. The list is first twice
+% expanded. Introduced with release 1.04.
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintApply {\romannumeral0\xintapply }%
+\def\xintapply #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@apply
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@apply #1#2%
+{%
+ \XINT@apply@loop@a {}{#2}#1\Z
+}%
+\def\XINT@apply@loop@a #1#2#3%
+{%
+ \xint@z #3\XINT@apply@end\Z
+ \expandafter\expandafter\expandafter
+ \XINT@apply@loop@b
+ \expandafter\expandafter\expandafter {#2{#3}}{#1}{#2}%
+}%
+\def\XINT@apply@loop@b #1#2{\XINT@apply@loop@a {#2{#1}}}%
+\def\XINT@apply@end\Z
+ \expandafter\expandafter\expandafter
+ \XINT@apply@loop@b
+ \expandafter\expandafter\expandafter #1#2#3{ #2}%
+% \end{macrocode}
+% \subsection{\csh{xintListWithSep}}
+% \begin{verbatim}
+% \xintListWithSep {sep}{{a}{b}...{z}} returns a sep b sep .... sep z
+% Introduced with release 1.04. sep can be \par, as the macro xintlistwithsep
+% and the next are declared long
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintListWithSep {\romannumeral0\xintlistwithsep }%
+\long\def\xintlistwithsep #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@lws
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\long\def\XINT@lws #1#2%
+{%
+ \XINT@lws@start {#2}#1\Z
+}%
+\long\def\XINT@lws@start #1#2%
+{%
+ \xint@z #2\XINT@lws@dont\Z
+ \XINT@lws@loop@a {#2}{#1}%
+}%
+\long\def\XINT@lws@dont\Z\XINT@lws@loop@a #1#2{ #2}%
+\long\def\XINT@lws@loop@a #1#2#3%
+{%
+ \xint@z #3\XINT@lws@end\Z
+ \XINT@lws@loop@b {#1}{#2#3}{#2}%
+}%
+\long\def\XINT@lws@loop@b #1#2{\XINT@lws@loop@a {#1#2}}%
+\long\def\XINT@lws@end\Z\XINT@lws@loop@b #1#2#3{ #1}%
+% \end{macrocode}
% \subsection{\csh{xintSgn}}
% \begin{macrocode}
\def\xintiSgn {\romannumeral0\xintisgn }%
@@ -3091,7 +4734,8 @@ expandability and be merciful, please.
% Comme \XINT@add@A, la différence principale c'est qu'elle donne son résultat
% aussi *sur 4n*, renversé. De plus cette variante accepte que l'un ou même les
% deux inputs soient vides.
-% Utilisé par la sommation.
+% Utilisé par la sommation et par la division (pour les quotients). Et aussi
+% par la multiplication d'ailleurs.
% INPUT: comme pour \XINT@add@A
% 1. <N1> et <N2> renversés
% 2. de longueur 4n (avec des leading zéros éventuels)
@@ -3252,8 +4896,7 @@ expandability and be merciful, please.
}%
\def\xint@addm@cz\W\XINT@addm@CD #1#2#3{\XINT@addm@end #1#3}%
\def\XINT@addm@end #1#2#3#4#5%
-{\expandafter\space\the\numexpr #1#2#3#4#5\relax
-}%
+ {\expandafter\space\the\numexpr #1#2#3#4#5\relax }%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
% \begin{verbatim}
@@ -3700,7 +5343,7 @@ expandability and be merciful, please.
}%
\def\XINT@sub@Eonestep #1#2%
{\expandafter
- \XINT@sub@backtoE\the\numexpr 110000-#2+#1-1\relax.%
+ \XINT@sub@backtoE\the\numexpr 109999-#2+#1\relax.%
}%
\def\XINT@sub@backtoE #1#2#3.#4%
{%
@@ -4240,18 +5883,22 @@ expandability and be merciful, please.
\def\XINT@sumexpr {\XINT@sum@loop {0000}{0000}}%
\def\XINT@sum@loop #1#2#3%
{%
- \xint@relax #3\XINT@sum@finished\relax
\expandafter\expandafter\expandafter
\XINT@sum@checksign #3\Z {#1}{#2}%
}%
\def\XINT@sum@checksign #1%
{%
+ \xint@relax #1\XINT@sum@finished\relax
\xint@zero #1\XINT@sum@skipzeroinput0%
\xint@UDsignfork
#1\dummy \XINT@sum@N
-\dummy {\XINT@sum@P #1}%
\xint@UDkrof
}%
+\def\XINT@sum@finished #1\Z #2#3%
+{%
+ \XINT@sub@A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
+}%
\def\XINT@sum@skipzeroinput #1\xint@UDkrof #2\Z {\XINT@sum@loop }%
\def\XINT@sum@P #1\Z #2%
{%
@@ -4270,10 +5917,6 @@ expandability and be merciful, please.
\W\X\Y\Z #3\W\X\Y\Z }{#2}%
}%
\def\XINT@sum@NN #1#2{\XINT@sum@loop {#2}{#1}}%
-\def\XINT@sum@finished #1\Z #2#3%
-{%
- \XINT@sub@A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
-}%
% \end{macrocode}
% \subsection{\csh{xintMul}}
% \begin{macrocode}
@@ -4833,18 +6476,22 @@ expandability and be merciful, please.
}%
\let\xintProductExpr\xintiProductExpr
\let\xintproductexpr\xintiproductexpr
-\def\XINT@productexpr {\XINT@prod@loop {1}}%
-\def\XINT@prod@loop #1#2%
+\def\XINT@productexpr {\XINT@prod@loop@a 1\Z }%
+\def\XINT@prod@loop@a #1\Z #2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@prod@loop@b #2\Z #1\Z \Z
+}%
+\def\XINT@prod@loop@b #1%
{%
- \xint@relax #2\XINT@prod@finished\relax
- \expandafter\XINT@prod@loop\expandafter
- {\romannumeral0\xintimul {#2}{#1}}%
+ \xint@relax #1\XINT@prod@finished\relax
+ \XINT@prod@loop@c #1%
}%
-\def\XINT@prod@finished #1#2#3#4#5%
+\def\XINT@prod@loop@c
{%
- \XINT@prod@finished@ #5%
+ \expandafter\XINT@prod@loop@a\romannumeral0\XINT@mul@fork
}%
-\def\XINT@prod@finished@ #1#2#3#4#5{ #5}%
+\def\XINT@prod@finished #1\Z #2\Z \Z { #2}%
% \end{macrocode}
% \subsection{\csh{xintFac}}
% \begin{verbatim}
@@ -5213,6 +6860,9 @@ expandability and be merciful, please.
% minusplus signifie B < 0, A > 0
% plusminus signifie B > 0, A < 0
% Ici #3#1 correspond au diviseur B et #4#2 au divisé A
+% Cases with B<0 or especially A<0 are treated sub-optimally in terms of
+% post-processing, things get reversed which could have been produced directly
+% in the wanted order, but A,B>0 is given priority for optimization.
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
@@ -5232,10 +6882,9 @@ expandability and be merciful, please.
\expandafter\XINT@div@BisNegative@post
\romannumeral0\XINT@div@fork #1\Z #4#2\Z
}%
-\def\XINT@div@BisNegative@post #1#2%
+\def\XINT@div@BisNegative@post #1%
{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT@opp #1}{#2}%
+ \expandafter\space\expandafter {\romannumeral0\XINT@opp #1}%
}%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
@@ -5267,29 +6916,22 @@ expandability and be merciful, please.
% \begin{macrocode}
\def\XINT@div@AisNegative@zerorem #1#2#3%
{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT@opp #1}{0}%
+ \expandafter\space\expandafter {\romannumeral0\XINT@opp #1}{0}%
}%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
% \begin{verbatim}
% #1 = quotient, #2 = reste, #3 = diviseur initial (à l'endroit)
+% remplace Reste par B - Reste, après avoir remplacé Q par -(Q+1)
+% de sorte que la formule a = qb + r, 0<= r < |b| est valable
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
\def\XINT@div@AisNegative@posrem #1%
{%
\expandafter \XINT@div@AisNegative@posrem@b \expandafter
- {\romannumeral0\xintiopp {\XINT@Add{#1}{1}}}%
+ {\romannumeral0\xintiopp{\xintiAdd {#1}{1}}}%
}%
-% \end{macrocode}
-% \vspace*{-.5\baselineskip}
-% \begin{verbatim}
-% remplace Reste par B - Reste, après avoir remplacé Q par -(Q+1)
-% de sorte que la formule a = qb + r, 0<= r < |b| est valable
-% \end{verbatim}
-% \vspace*{-1.5\baselineskip}
-% \begin{macrocode}
\def\XINT@div@AisNegative@posrem@b #1#2#3%
{%
\expandafter \xint@exchangetwo@keepbraces@andstop \expandafter
@@ -5300,6 +6942,8 @@ expandability and be merciful, please.
% \begin{verbatim}
% par la suite A et B sont > 0.
% #1 = B. Pour le moment à l'endroit.
+% Calcul du plus petit K = 4n >= longueur de B
+% 1.03 adds the interception of B=1
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
@@ -5308,14 +6952,6 @@ expandability and be merciful, please.
\expandafter \XINT@div@prepareB@aa \expandafter
{\romannumeral0\XINT@length {#1}}{#1}% B > 0 ici
}%
-% \end{macrocode}
-% \vspace*{-.5\baselineskip}
-% \begin{verbatim}
-% Calcul du plus petit K = 4n >= longueur de B
-% 1.03 adds the interception of B=1
-% \end{verbatim}
-% \vspace*{-1.5\baselineskip}
-% \begin{macrocode}
\def\XINT@div@prepareB@aa #1%
{%
\ifnum #1=1
@@ -5521,19 +7157,10 @@ expandability and be merciful, please.
\fi
{#2}%
}%
-% \end{macrocode}
-% \vspace*{-.5\baselineskip}
-% \begin{verbatim}
-% Reste Final, Q à renverser
-% #2 = Quotient, #1 = Reste.
-% \end{verbatim}
-% \vspace*{-1.5\baselineskip}
-% \begin{macrocode}
\def\XINT@div@finished@c #1#2%
{%
- \expandafter \space \expandafter
- {\romannumeral0\expandafter\xint@cleanupzeros@andstop
- \romannumeral0\XINT@rev {#2}}{#1}%
+ \expandafter\space\expandafter
+ {\romannumeral0\XINT@rev@andcuz {#2}}{#1}%
}%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
@@ -5557,58 +7184,68 @@ expandability and be merciful, please.
% \vspace*{-.5\baselineskip}
% \begin{verbatim}
% a, A, K, x, Q, L, B ,c
+% 1.01: code ré-écrit pour optimisations diverses.
+% 1.04: again, code rewritten for tiny speed increase (hopefully).
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
\def\XINT@div@final@c #1#2#3#4%
{%
- \expandafter \XINT@div@final@d \expandafter
- {\the\numexpr #1/#4\relax}{#2}%
+ \expandafter \XINT@div@final@da \expandafter
+ {\the\numexpr #1-(#1/#4)*#4\expandafter }\expandafter
+ {\the\numexpr #1/#4\expandafter }\expandafter
+ {\romannumeral0\xint@cleanupzeros@andstop #2}%
}%
% \end{macrocode}
% \vspace*{-.5\baselineskip}
% \begin{verbatim}
-% q, A, Q, L, B à l'envers sur 4n, c
-% 1.01 code ré-écrit pour optimisations diverses
+% r, q, A sans leading zéros, Q, L, B à l'envers sur 4n, c
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
-\def\XINT@div@final@d #1#2#3#4#5% q,A,Q,L,B puis c
-{%
- \expandafter \XINT@div@final@da \expandafter
- {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }%
- {\romannumeral0\xint@cleanupzeros@andstop #2}%
- {#1}{#3}{#5}%
-}%
-\def\XINT@div@final@da #1#2%
+\def\XINT@div@final@da #1%
{%
- \expandafter\XINT@div@final@db\expandafter {#2}{#1}%
+ \ifnum #1>9
+ \expandafter\XINT@div@final@dP
+ \else
+ \xint@afterfi
+ {\ifnum #1<0
+ \expandafter\XINT@div@final@dN
+ \else
+ \expandafter\XINT@div@final@db
+ \fi }%
+ \fi
}%
-\def\XINT@div@final@db #1#2% A,qB, puis q,Q,B,c
+\def\XINT@div@final@dN #1%
{%
- \ifcase\XINT@Geq {#1}{#2}
- \expandafter\XINT@div@final@dc % A < qB
- \or\expandafter\XINT@div@final@e % A au moins qB
- \fi
- {#1}{#2}%
+ \expandafter\XINT@div@final@dP\the\numexpr #1-1\relax
}%
-\def\XINT@div@final@e #1#2#3#4#5% A,qB,q,Q,B,puis c
+\def\XINT@div@final@dP #1#2#3#4#5% q,A,Q,L,B (puis c)
{%
- \expandafter\XINT@div@final@f
- \expandafter{\romannumeral0\xintisub {#1}{#2}}%
- {\romannumeral0\xintiadd {\XINT@Rev@andcleanupzeros{#4}}{#3}}%
+ \expandafter \XINT@div@final@f \expandafter
+ {\romannumeral0\xintisub {#2}%
+ {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }}%
+ {\romannumeral0\XINT@add@A 0{}#1000\W\X\Y\Z #3\W\X\Y\Z }%
+}%
+\def\XINT@div@final@db #1#2#3#4#5% q,A,Q,L,B (puis c)
+{%
+ \expandafter\XINT@div@final@dc\expandafter
+ {\romannumeral0\xintisub {#2}%
+ {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }}%
+ {#1}{#2}{#3}{#4}{#5}%
}%
-\def\XINT@div@final@dc #1#2#3% A sans leading zeros,trash,q,Q,B,c
+\def\XINT@div@final@dc #1#2%
{%
- \expandafter\XINT@div@final@dd
- \expandafter{\the\numexpr #3-1\relax}{#1}%
+ \ifnum\XINT@Sgn{#1}<0
+ \xint@afterfi {\expandafter\XINT@div@final@dP
+ \the\numexpr #2-1\relax }%
+ \else \xint@afterfi {\XINT@div@final@e {#1}#2}%
+ \fi
}%
-\def\XINT@div@final@dd #1#2#3#4% q,A,Q,B puis c
+\def\XINT@div@final@e #1#2#3#4#5#6% A final, q, trash, Q, L, B
{%
- \expandafter\XINT@div@final@f
- \expandafter{\romannumeral0\xintisub
- {#2}{\romannumeral0\XINT@mul@M {#1}#4\Z\Z\Z\Z }}%
- {\romannumeral0\xintiadd {\XINT@Rev@andcleanupzeros{#3}}{#1}}%
+ \XINT@div@final@f {#1}%
+ {\romannumeral0\XINT@add@A 0{}#2000\W\X\Y\Z #4\W\X\Y\Z }%
}%
\def\XINT@div@final@f #1#2#3% R,Q à développer,c
{%
@@ -6354,7 +7991,7 @@ expandability and be merciful, please.
\expandafter\space\expandafter{#2}{#1}%
}%
% \end{macrocode}
-% \subsection{\csh{xintDecSplit}, \csh{xintDecSplitL}, \csh{xintDecSplitR}}
+% \subsection{\csh{xintDecSplit},~\csh{xintDecSplitL},~\csh{xintDecSplitR}}
% \begin{verbatim}
% DECIMAL SPLIT
% v1.01: **New** behavior, for use in future extensions of the xint bundle:
@@ -6598,7 +8235,7 @@ expandability and be merciful, please.
% The commenting is currently (\docdate) very sparse.
%
% \localtableofcontents
-% \subsection{Catcodes, \eTeX{} detection, reload detection}
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
% The code for reload detection is copied from \textsc{Heiko
% Oberdiek}'s packages, and adapted here to check for previous
@@ -6758,7 +8395,7 @@ expandability and be merciful, please.
\fi
\expandafter\x\csname ver@xintgcd.sty\endcsname
\ProvidesPackage{xintgcd}%
- [2013/04/14 v1.03 Euclide algorithm with xint package (jfB)]%
+ [2013/04/25 v1.04 Euclide algorithm with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintGCD}}
% \begin{macrocode}
@@ -7440,7 +9077,7 @@ expandability and be merciful, please.
% The commenting is currently (\docdate) very sparse.
%
% \localtableofcontents
-% \subsection{Catcodes, \eTeX{} detection, reload detection}
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
% The code for reload detection is copied from \textsc{Heiko
% Oberdiek}'s packages, and adapted here to check for previous
@@ -7602,7 +9239,7 @@ expandability and be merciful, please.
\fi
\expandafter\x\csname ver@xintfrac.sty\endcsname
\ProvidesPackage{xintfrac}%
- [2013/04/14 v1.03 Expandable operations on fractions (jfB)]%
+ [2013/04/25 v1.04 Expandable operations on fractions (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintLen}}
% \begin{macrocode}
@@ -7650,6 +9287,29 @@ expandability and be merciful, please.
\expandafter\XINT@outfrac@P\expandafter {#2}{#1}%
}%
% \end{macrocode}
+% \subsection{\csh{xintRaw}}
+% \begin{macrocode}
+\def\xintRaw {\romannumeral0\xintraw }%
+\def\xintraw
+{%
+ \expandafter\XINT@raw\romannumeral0\XINT@infrac
+}%
+\def\XINT@raw #1%
+{%
+ \ifcase\XINT@Sgn {#1}
+ \expandafter\XINT@raw@Ba
+ \or
+ \expandafter\XINT@raw@A
+ \else
+ \expandafter\XINT@raw@Ba
+ \fi
+ {#1}%
+}%
+\def\XINT@raw@A #1#2#3{\xint@dsh {#2}{-#1}/#3}%
+\def\XINT@raw@Ba #1#2#3{\expandafter\XINT@raw@Bb
+ \expandafter{\romannumeral0\xint@dsh {#3}{#1}}{#2}}%
+\def\XINT@raw@Bb #1#2{ #2/#1}%
+% \end{macrocode}
% \subsection{\csh{xintNumerator}}
% \begin{macrocode}
\def\xintNumerator {\romannumeral0\xintnumerator }%
@@ -7722,6 +9382,33 @@ expandability and be merciful, please.
}%
\def\XINT@@frac@E \fi #1#2#3#4{\fi \space #3\cdot }%
% \end{macrocode}
+% \subsection{\csh{xintSignedFrac}}
+% \begin{macrocode}
+\def\xintSignedFrac {\romannumeral0\xintsignedfrac }%
+\def\xintsignedfrac #1%
+{%
+ \expandafter\XINT@sgnfrac@a\romannumeral0\XINT@infrac {#1}%
+}%
+\def\XINT@sgnfrac@a #1#2%
+{%
+ \XINT@sgnfrac@b #2\Z {#1}%
+}%
+\def\XINT@sgnfrac@b #1%
+{%
+ \xint@UDsignfork
+ #1\dummy \XINT@sgnfrac@N
+ -\dummy {\XINT@sgnfrac@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@sgnfrac@P #1\Z #2%
+{%
+ \XINT@@frac@A {#2}{#1}%
+}%
+\def\XINT@sgnfrac@N
+{%
+ \expandafter\xint@minus@andstop\romannumeral0\XINT@sgnfrac@P
+}%
+% \end{macrocode}
% \subsection{\csh{xintFwOver}}
% \begin{macrocode}
\def\xintFwOver {\romannumeral0\xintfwover }%
@@ -7739,7 +9426,7 @@ expandability and be merciful, please.
\ifcase\XINT@isOne {#5}
\xint@afterfi { {#4\over #5}}%
\or
- \xint@afterfi { #4\cdot }%
+ \xint@afterfi { #4}%
\fi
}%
\def\XINT@fwover@D #1#2#3%
@@ -7752,24 +9439,56 @@ expandability and be merciful, please.
#1%
}%
% \end{macrocode}
+% \subsection{\csh{xintSignedFwOver}}
+% \begin{macrocode}
+\def\xintSignedFwOver {\romannumeral0\xintsignedfwover }%
+\def\xintsignedfwover #1%
+{%
+ \expandafter\XINT@sgnfwover@a\romannumeral0\XINT@infrac {#1}%
+}%
+\def\XINT@sgnfwover@a #1#2%
+{%
+ \XINT@sgnfwover@b #2\Z {#1}%
+}%
+\def\XINT@sgnfwover@b #1%
+{%
+ \xint@UDsignfork
+ #1\dummy \XINT@sgnfwover@N
+ -\dummy {\XINT@sgnfwover@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@sgnfwover@P #1\Z #2%
+{%
+ \XINT@fwover@A {#2}{#1}%
+}%
+\def\XINT@sgnfwover@N
+{%
+ \expandafter\xint@minus@andstop\romannumeral0\XINT@sgnfwover@P
+}%
+% \end{macrocode}
% \subsection{\csh{xintSum}, \csh{xintSumExpr}}
% \begin{macrocode}
\def\xintSum {\romannumeral0\xintsum }%
\def\xintsum #1{\xintsumexpr #1\relax }%
\def\xintSumExpr {\romannumeral0\xintsumexpr }%
\def\xintsumexpr {\expandafter\expandafter\expandafter\XINT@fsumexpr }%
-\def\XINT@fsumexpr {\XINT@fsum@loop {0}}%
-\def\XINT@fsum@loop #1#2%
+\def\XINT@fsumexpr {\XINT@fsum@loop@a {0[0]}}%
+\def\XINT@fsum@loop@a #1#2%
{%
- \xint@relax #2\XINT@fsum@finished\relax
- \expandafter\XINT@fsum@loop\expandafter
- {\romannumeral0\xintadd {#1}{#2}}%
+ \expandafter\expandafter\expandafter
+ \XINT@fsum@loop@b #2\Z {#1}%
}%
-\def\XINT@fsum@finished #1#2#3#4#5%
+\def\XINT@fsum@loop@b #1%
{%
- \XINT@fsum@finished@ #5%
+ \xint@relax #1\XINT@fsum@finished\relax
+ \XINT@fsum@loop@c #1%
}%
-\def\XINT@fsum@finished@ #1#2#3#4#5{ #4}%
+\def\XINT@fsum@loop@c #1\Z #2%
+{%
+ \expandafter\XINT@fsum@loop@a\expandafter
+ {\romannumeral0\xintadd {#2}{#1}}%
+}%
+\def\XINT@fsum@finished #1\Z #2{ #2}%
% \end{macrocode}
% \subsection{\csh{xintPrd}, \csh{xintProductExpr}}
% \begin{macrocode}
@@ -7777,18 +9496,23 @@ expandability and be merciful, please.
\def\xintprd #1{\xintproductexpr #1\relax }%
\def\xintProductExpr {\romannumeral0\xintproductexpr }%
\def\xintproductexpr{\expandafter\expandafter\expandafter\XINT@fproductexpr }%
-\def\XINT@fproductexpr {\XINT@fprod@loop {1}}%
-\def\XINT@fprod@loop #1#2%
+\def\XINT@fproductexpr {\XINT@fprod@loop@a {1[0]}}%
+\def\XINT@fprod@loop@a #1#2%
{%
- \xint@relax #2\XINT@fprod@finished\relax
- \expandafter\XINT@fprod@loop\expandafter
- {\romannumeral0\xintmul {#2}{#1}}%
+ \expandafter\expandafter\expandafter
+ \XINT@fprod@loop@b #2\Z {#1}%
}%
-\def\XINT@fprod@finished #1#2#3#4#5%
+\def\XINT@fprod@loop@b #1%
{%
- \XINT@fprod@finished@ #5%
+ \xint@relax #1\XINT@fprod@finished\relax
+ \XINT@fprod@loop@c #1%
}%
-\def\XINT@fprod@finished@ #1#2#3#4#5{ #5}%
+\def\XINT@fprod@loop@c #1\Z #2%
+{%
+ \expandafter\XINT@fprod@loop@a\expandafter
+ {\romannumeral0\xintmul {#1}{#2}}%
+}%
+\def\XINT@fprod@finished #1\Z #2{ #2}%
% \end{macrocode}
% \subsection{\csh{XINT@inFrac}}
% \begin{macrocode}
@@ -8032,8 +9756,23 @@ expandability and be merciful, please.
\def\XINT@rez@E #1#2#3{ #3/#2[#1]}%
% \end{macrocode}
% \subsection{\csh{xintIrr}}
+% \begin{verbatim}
+% 1.04 fixes a buggy \xintIrr {0}.
+% Signs are not treated in \XINT@frac as they used to be earlier, and there were
+% some now superfluous left-overs here from this earlier situation, which we
+% remove for 1.04. There remains some superfluous stuff with the checks for
+% zeros, which I should also remove.
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
-\def\XINT@@bts #1#2#3%
+\def\xintIrr {\romannumeral0\xintirr }%
+\def\xintirr
+{%
+ \expandafter\XINT@irr@putsign
+ \romannumeral0\expandafter\XINT@irr
+ \romannumeral0\XINT@infrac
+}%
+\def\XINT@irr@putsign #1#2#3%
{%
\ifcase\XINT@isOne {#2}
\xint@afterfi {#3#1/#2}%
@@ -8041,13 +9780,6 @@ expandability and be merciful, please.
\xint@afterfi {#3#1}%
\fi
}%
-\def\xintIrr {\romannumeral0\xintirr }%
-\def\xintirr
-{%
- \expandafter\XINT@@bts
- \romannumeral0\expandafter\XINT@irr
- \romannumeral0\XINT@infrac
-}%
\def\XINT@irr #1%
{%
\ifcase\XINT@Sgn {#1}
@@ -8061,28 +9793,25 @@ expandability and be merciful, please.
}%
\def\XINT@irr@A #1#2%
{%
- \expandafter \XINT@irr@AC \expandafter
- {\romannumeral0\xint@dsh {#2}{-#1}}%
+ \expandafter \XINT@irr@C
+ \romannumeral0\xint@dsh {#2}{-#1}\Z
}%
-\def\XINT@irr@AC #1#2{\XINT@irr@C #2\Z #1\Z }%
\def\XINT@irr@B #1#2#3%
{%
- \expandafter \XINT@irr@C \romannumeral0\xint@dsh {#3}{#1}\Z #2\Z
+ \expandafter \XINT@irr@BC \expandafter
+ {\romannumeral0\xint@dsh {#3}{#1}}{#2}%
}%
-\def\XINT@irr@C #1#2\Z #3#4\Z
+\def\XINT@irr@BC #1#2{\XINT@irr@C #2\Z {#1}}%
+\def\XINT@irr@C #1#2\Z
{%
- \xint@UDsignsfork
- #1#3\dummy \XINT@irr@minusminus
- #1-\dummy \XINT@irr@minusplus
- #3-\dummy \XINT@irr@plusminus
- --\dummy \XINT@irr@plusplus
+ \xint@UDsignfork
+ #1\dummy \XINT@irr@negative
+ -\dummy {\XINT@irr@nonneg #1}%
\xint@UDkrof
- {#4}{#2}#3#1%
+ #2\Z
}%
-\def\XINT@irr@minusminus #1#2#3#4{\XINT@irr@D #1\Z #2\Z \space}%
-\def\XINT@irr@minusplus #1#2#3#4{\XINT@irr@D #3#1\Z #2\Z \XINT@opp}%
-\def\XINT@irr@plusminus #1#2#3#4{\XINT@irr@D #1\Z #4#2\Z \XINT@opp}%
-\def\XINT@irr@plusplus #1#2#3#4{\XINT@irr@D #3#1\Z #4#2\Z \space}%
+\def\XINT@irr@negative #1\Z #2{\XINT@irr@D #1\Z #2\Z \XINT@opp}%
+\def\XINT@irr@nonneg #1\Z #2{\XINT@irr@D #1\Z #2\Z \space}%
\def\XINT@irr@D #1#2\Z #3#4\Z
{%
\xint@UDzerosfork
@@ -8097,7 +9826,7 @@ expandability and be merciful, please.
\space 00}%
\def\XINT@irr@divisionbyzero #1#2#3#4{\expandafter\xintError:DivisionByZero
\space {#2}0}%
-\def\XINT@irr@zero #1#2#3#4{ 0/1}%
+\def\XINT@irr@zero #1#2#3#4{ 01}%
\def\XINT@irr@nonzero@checkifone #1%
{%
\ifcase\XINT@isOne {#1}
@@ -8112,9 +9841,9 @@ expandability and be merciful, please.
\expandafter\XINT@irr@loop@d
\romannumeral0\XINT@div@prepare {#1}{#2}{#1}%
}%
-\def\XINT@irr@loop@d #1#2#3%
+\def\XINT@irr@loop@d #1#2%
{%
- \XINT@irr@loop@e #2\Z {#3}%
+ \XINT@irr@loop@e #2\Z
}%
\def\XINT@irr@loop@e #1#2\Z
{%
@@ -8134,47 +9863,44 @@ expandability and be merciful, please.
% \subsection{\csh{xintJrr}}
% \begin{macrocode}
\def\xintJrr {\romannumeral0\xintjrr }%
-\def\xintjrr
+\def\xintjrr
{%
- \expandafter\XINT@@bts
- \romannumeral0\expandafter\XINT@jrr@start
- \romannumeral0\xintrez
+ \expandafter\XINT@irr@putsign
+ \romannumeral0\expandafter\XINT@jrr
+ \romannumeral0\XINT@infrac
}%
-\def\XINT@jrr@start #1/#2[#3]%
+\def\XINT@jrr #1%
{%
- \ifcase\XINT@Sgn {#3}
+ \ifcase\XINT@Sgn {#1}
\expandafter\XINT@jrr@B
\or
\expandafter\XINT@jrr@A
\else
\expandafter\XINT@jrr@B
\fi
- {#3}{#1}{#2}%
+ {#1}%
}%
\def\XINT@jrr@A #1#2%
{%
- \expandafter \XINT@jrr@AC \expandafter
- {\romannumeral0\xint@dsh {#2}{-#1}}%
+ \expandafter \XINT@jrr@C
+ \romannumeral0\xint@dsh {#2}{-#1}\Z
}%
-\def\XINT@jrr@AC #1#2{\XINT@jrr@C #2\Z #1\Z }%
\def\XINT@jrr@B #1#2#3%
{%
- \expandafter \XINT@jrr@C \romannumeral0\xint@dsh {#3}{#1}\Z #2\Z
+ \expandafter \XINT@jrr@BC \expandafter
+ {\romannumeral0\xint@dsh {#3}{#1}}{#2}%
}%
-\def\XINT@jrr@C #1#2\Z #3#4\Z
+\def\XINT@jrr@BC #1#2{\XINT@jrr@C #2\Z {#1}}%
+\def\XINT@jrr@C #1#2\Z
{%
- \xint@UDsignsfork
- #1#3\dummy \XINT@jrr@minusminus
- #1-\dummy \XINT@jrr@minusplus
- #3-\dummy \XINT@jrr@plusminus
- --\dummy \XINT@jrr@plusplus
+ \xint@UDsignfork
+ #1\dummy \XINT@jrr@negative
+ -\dummy {\XINT@jrr@nonneg #1}%
\xint@UDkrof
- {#4}{#2}#3#1%
+ #2\Z
}%
-\def\XINT@jrr@minusminus #1#2#3#4{\XINT@jrr@D #1\Z #2\Z \space }%
-\def\XINT@jrr@minusplus #1#2#3#4{\XINT@jrr@D #3#1\Z #2\Z \XINT@opp }%
-\def\XINT@jrr@plusminus #1#2#3#4{\XINT@jrr@D #1\Z #4#2\Z \XINT@opp }%
-\def\XINT@jrr@plusplus #1#2#3#4{\XINT@jrr@D #3#1\Z #4#2\Z \space }%
+\def\XINT@jrr@negative #1\Z #2{\XINT@jrr@D #1\Z #2\Z \XINT@opp}%
+\def\XINT@jrr@nonneg #1\Z #2{\XINT@jrr@D #1\Z #2\Z \space}%
\def\XINT@jrr@D #1#2\Z #3#4\Z
{%
\xint@UDzerosfork
@@ -8189,7 +9915,7 @@ expandability and be merciful, please.
\space 00}%
\def\XINT@jrr@divisionbyzero #1#2#3#4#5#6{\expandafter\xintError:DivisionByZero
\space {#2}0}%
-\def\XINT@jrr@zero #1#2#3#4#5#6{ 0/1}%
+\def\XINT@jrr@zero #1#2#3#4#5#6{ 01}%
\def\XINT@jrr@nonzero@checkifone #1%
{%
\ifcase\XINT@isOne {#1}
@@ -8236,11 +9962,11 @@ expandability and be merciful, please.
\def\xinttrunc #1%
{%
\expandafter\expandafter\expandafter
- \xint@trunc
+ \XINT@trunc
\expandafter\expandafter\expandafter
{#1}%
}%
-\def\xint@trunc #1#2%
+\def\XINT@trunc #1#2%
{%
\expandafter\XINT@trunc@G
\romannumeral0\expandafter\XINT@trunc@A
@@ -8249,11 +9975,11 @@ expandability and be merciful, please.
\def\xintitrunc #1%
{%
\expandafter\expandafter\expandafter
- \xint@itrunc
+ \XINT@itrunc
\expandafter\expandafter\expandafter
{#1}%
}%
-\def\xint@itrunc #1#2%
+\def\XINT@itrunc #1#2%
{%
\expandafter\XINT@itrunc@G
\romannumeral0\expandafter\XINT@trunc@A
@@ -8305,9 +10031,9 @@ expandability and be merciful, please.
\def\XINT@trunc@minusplus #1#2#3{\xintquo {#1#2}{#3}\Z \xint@minus@andstop}%
\def\XINT@trunc@plusminus #1#2#3{\xintquo {#2}{#1#3}\Z \xint@minus@andstop}%
\def\XINT@trunc@plusplus #1#2#3#4{\xintquo {#1#3}{#2#4}\Z \space}%
-\def\XINT@itrunc@G #1\Z #2#3%
+\def\XINT@itrunc@G #1#2\Z #3#4%
{%
- \xint@zero #2\XINT@trunc@zero 0\xint@firstoftwo {#2#1}0%
+ \xint@zero #1\XINT@trunc@zero 0\xint@firstoftwo {#3#1#2}0%
}%
\def\XINT@trunc@G #1\Z #2#3%
{%
@@ -8338,6 +10064,79 @@ expandability and be merciful, please.
\romannumeral0\XINT@dsx@zeroloop {#1}\Z {}#2%
}%
% \end{macrocode}
+% \subsection{\csh{xintRound}, \csh{xintiRound}}
+% \begin{macrocode}
+\def\xintRound {\romannumeral0\xintround }%
+\def\xintiRound {\romannumeral0\xintiround }%
+\def\xintround #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@round
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@round
+{%
+ \expandafter\XINT@trunc@G\romannumeral0\XINT@round@A
+}%
+\def\xintiround #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@iround
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@iround
+{%
+ \expandafter\XINT@itrunc@G\romannumeral0\XINT@round@A
+}%
+\def\XINT@round@A #1#2%
+{%
+ \expandafter\XINT@round@B
+ \romannumeral0\expandafter\XINT@trunc@A
+ \romannumeral0\XINT@infrac {#2}{\the\numexpr #1+1\relax}{#1}%
+}%
+\def\XINT@round@B #1\Z
+{%
+ \expandafter\XINT@round@C
+ \romannumeral0\XINT@rord@main {}#1%
+ \xint@UNDEF
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@UNDEF
+ \Z
+}%
+\def\XINT@round@C #1%
+{%
+ \ifnum #1<5
+ \expandafter\XINT@round@Daa
+ \else
+ \expandafter\XINT@round@Dba
+ \fi
+}%
+\def\XINT@round@Daa #1%
+{%
+ \xint@z #1\XINT@round@Daz\Z \XINT@round@Da #1%
+}%
+\def\XINT@round@Daz\Z \XINT@round@Da \Z { 0\Z }%
+\def\XINT@round@Da #1\Z
+{%
+ \XINT@rord@main {}#1%
+ \xint@UNDEF
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@UNDEF \Z
+}%
+\def\XINT@round@Dba #1%
+{%
+ \xint@z #1\XINT@round@Dbz\Z \XINT@round@Db #1%
+}%
+\def\XINT@round@Dbz\Z \XINT@round@Db \Z { 1\Z }%
+\def\XINT@round@Db #1\Z
+{%
+ \XINT@addm@A 0{}1000\W\X\Y\Z #1000\W\X\Y\Z \Z
+}%
+% \end{macrocode}
% \subsection{\csh{xintMul}}
% \begin{macrocode}
\def\xintMul {\romannumeral0\xintmul }%
@@ -8632,7 +10431,7 @@ expandability and be merciful, please.
% The commenting is currently (\docdate) very sparse.
%
% \localtableofcontents
-% \subsection{Catcodes, \eTeX{} detection, reload detection}
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
%
% The code for reload detection is copied from \textsc{Heiko
% Oberdiek}'s packages, and adapted here to check for previous
@@ -8792,7 +10591,7 @@ expandability and be merciful, please.
\fi
\expandafter\x\csname ver@xintseries.sty\endcsname
\ProvidesPackage{xintseries}%
- [2013/04/14 v1.03 Expandable partial sums with xint package (jfB)]%
+ [2013/04/25 v1.04 Expandable partial sums with xint package (jfB)]%
% \end{macrocode}
% \subsection{\csh{xintSeries}}
% \begin{macrocode}
@@ -8871,6 +10670,13 @@ expandability and be merciful, please.
}%
% \end{macrocode}
% \subsection{\csh{xintPowerSeries}}
+% \begin{verbatim}
+% The 1.03 version was very lame and created a build-up of denominators.
+% The Horner scheme for polynomial evaluation is used in 1.04, this
+% cures the denominator problem and drastically improves the efficiency
+% of the macro.
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
\def\xintPowerSeries {\romannumeral0\xintpowerseries }%
\def\xintpowerseries #1#2%
@@ -8893,43 +10699,165 @@ expandability and be merciful, please.
\xint@afterfi { 0[0]}%
\else
\xint@afterfi
- {\expandafter\XINT@powseries@loop@pre\expandafter
- {\romannumeral0\xintpow {#4}{#1}}{#1}{#4}{#2}{#3}%
- }%
+ {\XINT@powseries@loop@i {#3{#2}}{#1}{#2}{#3}{#4}}%
\fi
}%
-\def\XINT@powseries@loop@pre #1#2#3#4#5%
-{%
- \ifnum #4>#2 \else\XINT@powseries@dont@i \fi
- \expandafter\XINT@powseries@loop@i\expandafter
- {\the\numexpr #2+1\expandafter}\expandafter
- {\romannumeral0\xintmul {#5{#2}}{#1}}{#1}{#3}{#4}{#5}%
-}%
-\def\XINT@powseries@dont@i \fi\expandafter\XINT@powseries@loop@i
- {\fi \expandafter\XINT@powseries@dont@ii }%
-\def\XINT@powseries@dont@ii #1#2#3#4#5#6{ #2}%
\def\XINT@powseries@loop@i #1#2#3#4#5%
{%
- \ifnum #5>#1 \else \XINT@powseries@exit@i \fi
+ \ifnum #3>#2 \else\XINT@powseries@exit@i\fi
\expandafter\XINT@powseries@loop@ii\expandafter
- {\romannumeral0\xintmul {#3}{#4}}{#1}{#4}{#2}{#5}%
+ {\the\numexpr #3-1\expandafter}\expandafter
+ {\romannumeral0\xintmul {#1}{#5}}{#2}{#4}{#5}%
}%
-\def\XINT@powseries@loop@ii #1#2#3#4#5#6%
+\def\XINT@powseries@loop@ii #1#2#3#4%
{%
- \expandafter\XINT@powseries@loop@i\expandafter
- {\the\numexpr #2+1\expandafter}\expandafter
- {\romannumeral0\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
- {#1}{#3}{#5}{#6}%
+ \expandafter\XINT@powseries@loop@i\expandafter
+ {\romannumeral0\xintadd {#4{#1}}{#2}}{#3}{#1}{#4}%
+}%
+\def\XINT@powseries@exit@i\fi #1#2#3#4#5#6#7#8#9%
+{%
+ \fi \XINT@powseries@exit@ii #6{#7}%
}%
-\def\XINT@powseries@exit@i\fi \expandafter\XINT@powseries@loop@ii
- {\fi \expandafter\XINT@powseries@exit@ii }%
\def\XINT@powseries@exit@ii #1#2#3#4#5#6%
- {\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
+{%
+ \xintmul{\xintPow {#5}{#6}}{#4}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintPowerSeriesX}}
+% \begin{verbatim}
+% Same as \xintPowerSeries except for the initial expansion of the x parameter.
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintPowerSeriesX {\romannumeral0\xintpowerseriesx }%
+\def\xintpowerseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@powseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@powseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@powseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@powseriesx@ii #1#2#3#4%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter\XINT@powseriesx@pre
+ \expandafter\expandafter\expandafter {#4}{#1}{#2}{#3}}%
+ \fi
+}%
+\def\XINT@powseriesx@pre #1#2#3#4%
+{%
+ \XINT@powseries@loop@i {#4{#3}}{#2}{#3}{#4}{#1}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintRationalSeries}}
+% \begin{verbatim}
+% This computes F(a)+...+F(b) on the basis of the value of F(a) and the
+% ratios F(n)/F(n-1). As in \xintPowerSeries we use an iterative scheme which
+% has the great advantage to avoid denominator build-up. This makes exact
+% computations possible with exponential type series, which would be completely
+% inaccessible to \xintSeries.
+% #1=a, #2=b, #3=F(a), #4=ratio function
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintRationalSeries {\romannumeral0\xintratseries }%
+\def\xintratseries #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseries@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseries@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseries@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseries@ii #1#2#3#4%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\XINT@ratseries@loop {#2}{1}{#1}{#4}{#3}}%
+ \fi
+}%
+\def\XINT@ratseries@loop #1#2#3#4%
+{%
+ \ifnum #1>#3 \else\XINT@ratseries@exit@i\fi
+ \expandafter\XINT@ratseries@loop\expandafter
+ {\the\numexpr #1-1\expandafter}\expandafter
+ {\romannumeral0\xintadd {1}{\xintMul {#2}{#4{#1}}}}{#3}{#4}%
+}%
+\def\XINT@ratseries@exit@i\fi #1#2#3#4#5#6#7#8%
+{%
+ \fi \XINT@ratseries@exit@ii #6%
+}%
+\def\XINT@ratseries@exit@ii #1#2#3#4#5%
+{%
+ \XINT@ratseries@exit@iii #5%
+}%
+\def\XINT@ratseries@exit@iii #1#2#3#4%
+{%
+ \xintmul{#2}{#4}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintRationalSeriesX}}
+% \begin{verbatim}
+% a,b,initial,ratiofunction,x
+% This computes F(a,x)+...+F(b,x) on the basis of the value of F(a,x) and the
+% ratios F(n,x)/F(n-1,x). The argument x is first expanded and it is the value
+% resulting from this which is used then throughout. The initial term F(a,x)
+% must be defined as one-parameter macro which will be given x.
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintRationalSeriesX {\romannumeral0\xintratseriesx }%
+\def\xintratseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseriesx@ii #1#2#3#4#5%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter\XINT@ratseriesx@pre
+ \expandafter\expandafter\expandafter {#5}{#2}{#1}{#4}{#3}}%
+ \fi
+}%
+\def\XINT@ratseriesx@pre #1#2#3#4#5%
+{%
+ \XINT@ratseries@loop {#2}{1}{#3}{#4{#1}}{#5{#1}}%
+}%
% \end{macrocode}
% \subsection{\csh{xintFxPtPowerSeries}}
% \begin{verbatim}
% I am not two happy with this piece of code. Will make it more economical
-% another day.
+% another day.
% \end{verbatim}
% \vspace*{-1.5\baselineskip}
% \begin{macrocode}
@@ -8951,7 +10879,7 @@ expandability and be merciful, please.
\def\XINT@fppowseries@ii #1#2#3#4#5%
{%
\ifnum #2<#1
- \xint@afterfi {\xinttrunc {#5}{0[0]}}%
+ \xint@afterfi { 0}%
\else
\xint@afterfi
{\expandafter\XINT@fppowseries@loop@pre\expandafter
@@ -8990,11 +10918,1195 @@ expandability and be merciful, please.
\def\XINT@fppowseries@exit@ii #1#2#3#4#5#6#7%
{\xinttrunc {#7}%
{\xintiAdd {#4}{\xintiTrunc {#7}{\xintMul {#6{#2}}{#1}}}[-#7]}}%
+% \end{macrocode}
+% \subsection{\csh{xintFxPtPowerSeriesX}}
+% \begin{verbatim}
+% a,b,coeff,x,D
+% \end{verbatim}
+% \vspace*{-1.5\baselineskip}
+% \begin{macrocode}
+\def\xintFxPtPowerSeriesX {\romannumeral0\xintfxptpowerseriesx }%
+\def\xintfxptpowerseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@ii #1#2#3#4#5%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@pre
+ \expandafter\expandafter\expandafter
+ {#4}{#1}{#2}{#3}{#5}%
+ }%
+ \fi
+}%
+\def\XINT@fppowseriesx@pre #1#2#3#4#5%
+{%
+ \expandafter\XINT@fppowseries@loop@pre\expandafter
+ {\romannumeral0\xinttrunc {#5}{\xintPow {#1}{#2}}}%
+ {#2}{#1}{#3}{#4}{#5}%
+}%
\XINT@series@restorecatcodes@endinput%
% \end{macrocode}
+%\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
+%\let</xintseries>\relax
+%\def<*xintcfrac>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
+%</xintseries>
+%<*xintcfrac>
+% \section{Package \xintcfracname implementation}
+%
+% The commenting is currently (\docdate) very sparse.
+%
+% \localtableofcontents
+% \subsection{Catcodes, \protect\eTeX{} and reload detection}
+%
+% The code for reload detection is copied from \textsc{Heiko
+% Oberdiek}'s packages, and adapted here to check for previous
+% loading of the \xintfracname package.
+%
+% The method for catcodes is slightly different, but still
+% directly inspired by these packages.
+%
+% \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \def\space { }%
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xintcfrac.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xintcfrac}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \ifx\x\relax % plain-TeX, first loading of xintcfrac.sty
+ \ifx\w\relax % but xintfrac.sty not yet loaded.
+ \y{xintcfrac}{Package xintfrac is required}%
+ \y{xintcfrac}{Will try \string\input\space xintfrac.sty}%
+ \def\z{\endgroup\input xintfrac.sty\relax}%
+ \fi
+ \else
+ \def\empty {}%
+ \ifx\x\empty % LaTeX, first loading,
+ % variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintfrac.sty not yet loaded.
+ \y{xintcfrac}{Package xintfrac is required}%
+ \y{xintcfrac}{Will try \string\RequirePackage{xintfrac}}%
+ \def\z{\endgroup\RequirePackage{xintfrac}}%
+ \fi
+ \else
+ \y{xintcfrac}{I was already loaded, aborting input}%
+ \aftergroup\endinput
+ \fi
+ \fi
+ \fi
+\z%
+% \end{macrocode}
+% \subsection{Confirmation of \xintfracname loading}
+% \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \def\empty {}%
+ \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \ifx\w\relax % Plain TeX, user gave a file name at the prompt
+ \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
+ \aftergroup\endinput
+ \fi
+ \ifx\w\empty % LaTeX, user gave a file name at the prompt
+ \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
+ \aftergroup\endinput
+ \fi
+\endgroup%
+% \end{macrocode}
+% \subsection{Catcodes}
+%
+% Perhaps catcodes have changed after the loading of \xintname and
+% \xintfracname and prior to the current loading of \xintcfracname,
+% so we can not employ the |\XINT@restorecatcodes@endinput| in this style
+% file. But there is no problem using |\XINT@setcatcodes|.
+%
+% \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \def\x
+ {%
+ \endgroup
+ \edef\XINT@cfrac@restorecatcodes@endinput
+ {%
+ \catcode93=\the\catcode93 % ]
+ \catcode91=\the\catcode91 % [
+ \catcode47=\the\catcode47 % /
+ \catcode41=\the\catcode41 % )
+ \catcode40=\the\catcode40 % (
+ \catcode42=\the\catcode42 % *
+ \catcode43=\the\catcode43 % +
+ \catcode62=\the\catcode62 % >
+ \catcode60=\the\catcode60 % <
+ \catcode58=\the\catcode58 % :
+ \catcode46=\the\catcode46 % .
+ \catcode45=\the\catcode45 % -
+ \catcode44=\the\catcode44 % ,
+ \catcode35=\the\catcode35 % #
+ \catcode64=\the\catcode64 % @
+ \catcode125=\the\catcode125 % }
+ \catcode123=\the\catcode123 % {
+ \endlinechar=\the\endlinechar
+ \catcode13=\the\catcode13 % ^^M
+ \catcode32=\the\catcode32 %
+ \catcode61=\the\catcode61 % =
+ \noexpand\endinput
+ }%
+ \XINT@setcatcodes
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ }%
+\x
+% \end{macrocode}
+% \subsection{Package identification}
+% \begin{macrocode}
+\begingroup
+ \catcode58=12 % :
+ \expandafter\ifx\csname ProvidesPackage\endcsname\relax
+ \def\x#1#2#3[#4]{\endgroup
+ \immediate\write-1{Package: #3 #4}%
+ \xdef#1{#4}%
+ }%
+ \else
+ \def\x#1#2[#3]{\endgroup
+ #2[{#3}]%
+ \ifx#1\@undefined
+ \xdef#1{#3}%
+ \fi
+ \ifx#1\relax
+ \xdef#1{#3}%
+ \fi
+ }%
+ \fi
+\expandafter\x\csname ver@xintcfrac.sty\endcsname
+\ProvidesPackage{xintcfrac}%
+ [2013/04/25 v1.04 Expandable continued fractions with xint package (jfB)]%
+% \end{macrocode}
+% \subsection{\csh{xintCFrac}}
+% \begin{macrocode}
+\def\xintCFrac {\romannumeral0\xintcfrac }%
+\def\xintcfrac #1%
+{%
+ \XINT@cfrac@opt@a #1\Z
+}%
+\def\XINT@cfrac@opt@a #1%
+{%
+ \ifx#1[\XINT@cfrac@opt@b\fi \XINT@cfrac@noopt #1%
+}%
+\def\XINT@cfrac@noopt #1\Z
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\relax
+}%
+\def\XINT@cfrac@opt@b\fi\XINT@cfrac@noopt [\Z #1]%
+{%
+ \fi\csname XINT@cfrac@opt#1\endcsname
+}%
+\def\XINT@cfrac@optl #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\hfill
+}%
+\def\XINT@cfrac@optc #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\relax
+}%
+\def\XINT@cfrac@optr #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \hfill\relax
+}%
+\def\XINT@cfrac@A #1/#2\Z
+{%
+ \expandafter\XINT@cfrac@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@cfrac@B #1#2%
+{%
+ \XINT@cfrac@C #2\Z {#1}%
+}%
+\def\XINT@cfrac@C #1%
+{%
+ \xint@zero #1\XINT@cfrac@integer 0\XINT@cfrac@D #1%
+}%
+\def\XINT@cfrac@integer 0\XINT@cfrac@D 0#1\Z #2#3#4#5{ #2}%
+\def\XINT@cfrac@D #1\Z #2#3{\XINT@cfrac@loop@a {#1}{#3}{#1}{{#2}}}%
+\def\XINT@cfrac@loop@a
+{%
+ \expandafter\XINT@cfrac@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@cfrac@loop@d #1#2%
+{%
+ \XINT@cfrac@loop@e #2.{#1}%
+}%
+\def\XINT@cfrac@loop@e #1%
+{%
+ \xint@zero #1\xint@cfrac@loop@exit0\XINT@cfrac@loop@f #1%
+}%
+\def\XINT@cfrac@loop@f #1.#2#3#4%
+{%
+ \XINT@cfrac@loop@a {#1}{#3}{#1}{{#2}#4}%
+}%
+\def\xint@cfrac@loop@exit0\XINT@cfrac@loop@f #1.#2#3#4#5#6%
+ {\XINT@cfrac@T #5#6{#2}#4\Z }%
+\def\XINT@cfrac@T #1#2#3#4%
+{%
+ \xint@z #4\XINT@cfrac@end\Z\XINT@cfrac@T #1#2{#4+\cfrac{#11#2}{#3}}%
+}%
+\def\XINT@cfrac@end\Z\XINT@cfrac@T #1#2#3%
+{%
+ \XINT@cfrac@@end #3%
+}%
+\def\XINT@cfrac@@end \Z+\cfrac#1#2{ #2}%
+% \end{macrocode}
+% \subsection{\csh{xintGCFrac}}
+% \begin{macrocode}
+\def\xintGCFrac {\romannumeral0\xintgcfrac }%
+\def\xintgcfrac #1%
+{%
+ \XINT@gcfrac@opt@a #1\Z
+}%
+\def\XINT@gcfrac@opt@a #1%
+{%
+ \ifx#1[\XINT@gcfrac@opt@b\fi \XINT@gcfrac@noopt #1%
+}%
+\def\XINT@gcfrac@noopt #1\Z
+{%
+ \XINT@gcfrac #1+\W/\relax\relax
+}%
+\def\XINT@gcfrac@opt@b\fi\XINT@gcfrac@noopt [\Z #1]%
+{%
+ \fi\csname XINT@gcfrac@opt#1\endcsname
+}%
+\def\XINT@gcfrac@optl #1%
+{%
+ \XINT@gcfrac #1+\W/\relax\hfill
+}%
+\def\XINT@gcfrac@optc #1%
+{%
+ \XINT@gcfrac #1+\W/\relax\relax
+}%
+\def\XINT@gcfrac@optr #1%
+{%
+ \XINT@gcfrac #1+\W/\hfill\relax
+}%
+\def\XINT@gcfrac
+{%
+ \expandafter\expandafter\expandafter\XINT@gcfrac@enter
+}%
+\def\XINT@gcfrac@enter {\XINT@gcfrac@loop {}}%
+\def\XINT@gcfrac@loop #1#2+#3/%
+{%
+ \xint@w #3\XINT@gcfrac@endloop\W\XINT@gcfrac@loop {{#3}{#2}#1}%
+}%
+\def\XINT@gcfrac@endloop\W\XINT@gcfrac@loop #1#2#3%
+{%
+ \XINT@gcfrac@T #2#3#1\Z\Z
+}%
+\def\XINT@gcfrac@T #1#2#3#4{\XINT@gcfrac@U #1#2{\xintFrac{#4}}}%
+\def\XINT@gcfrac@U #1#2#3#4#5%
+{%
+ \xint@z #5\XINT@gcfrac@end\Z\XINT@gcfrac@U
+ #1#2{\xintFrac{#5}%
+ \ifcase\xintSgn{#4}
+ +\or+\else-\fi
+ \cfrac{#1\xintFrac{\xintAbs{#4}}#2}{#3}}%
+}%
+\def\XINT@gcfrac@end\Z\XINT@gcfrac@U #1#2#3%
+{%
+ \XINT@gcfrac@@end #3%
+}%
+\def\XINT@gcfrac@@end #1\cfrac#2#3{ #3}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoCs}}
+% \begin{macrocode}
+\def\xintFtoCs {\romannumeral0\xintftocs }%
+\def\xintftocs #1%
+{%
+ \expandafter\XINT@ftc@A\romannumeral0\xintraw {#1}\Z
+}%
+\def\XINT@ftc@A #1/#2\Z
+{%
+ \expandafter\XINT@ftc@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@ftc@B #1#2%
+{%
+ \XINT@ftc@C #2.{#1}%
+}%
+\def\XINT@ftc@C #1%
+{%
+ \xint@zero #1\XINT@ftc@integer 0\XINT@ftc@D #1%
+}%
+\def\XINT@ftc@integer 0\XINT@ftc@D 0#1.#2#3{ #2}%
+\def\XINT@ftc@D #1.#2#3{\XINT@ftc@loop@a {#1}{#3}{#1}{#2,}}%
+\def\XINT@ftc@loop@a
+{%
+ \expandafter\XINT@ftc@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@ftc@loop@d #1#2%
+{%
+ \XINT@ftc@loop@e #2.{#1}%
+}%
+\def\XINT@ftc@loop@e #1%
+{%
+ \xint@zero #1\xint@ftc@loop@exit0\XINT@ftc@loop@f #1%
+}%
+\def\XINT@ftc@loop@f #1.#2#3#4%
+{%
+ \XINT@ftc@loop@a {#1}{#3}{#1}{#4#2,}%
+}%
+\def\xint@ftc@loop@exit0\XINT@ftc@loop@f #1.#2#3#4{ #4#2}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoCx}}
+% \begin{macrocode}
+\def\xintFtoCx {\romannumeral0\xintftocx }%
+\def\xintftocx #1#2%
+{%
+ \expandafter\XINT@ftcx@A\romannumeral0\xintraw {#2}\Z {#1}%
+}%
+\def\XINT@ftcx@A #1/#2\Z
+{%
+ \expandafter\XINT@ftcx@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@ftcx@B #1#2%
+{%
+ \XINT@ftcx@C #2.{#1}%
+}%
+\def\XINT@ftcx@C #1%
+{%
+ \xint@zero #1\XINT@ftcx@integer 0\XINT@ftcx@D #1%
+}%
+\def\XINT@ftcx@integer 0\XINT@ftcx@D 0#1.#2#3#4{ #2}%
+\def\XINT@ftcx@D #1.#2#3#4{\XINT@ftcx@loop@a {#1}{#3}{#1}{#2#4}{#4}}%
+\def\XINT@ftcx@loop@a
+{%
+ \expandafter\XINT@ftcx@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@ftcx@loop@d #1#2%
+{%
+ \XINT@ftcx@loop@e #2.{#1}%
+}%
+\def\XINT@ftcx@loop@e #1%
+{%
+ \xint@zero #1\xint@ftcx@loop@exit0\XINT@ftcx@loop@f #1%
+}%
+\def\XINT@ftcx@loop@f #1.#2#3#4#5%
+{%
+ \XINT@ftcx@loop@a {#1}{#3}{#1}{#4{#2}#5}{#5}%
+}%
+\def\xint@ftcx@loop@exit0\XINT@ftcx@loop@f #1.#2#3#4#5{ #4{#2}}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoGC}}
+% \begin{macrocode}
+\def\xintFtoGC {\romannumeral0\xintftogc }%
+\def\xintftogc {\xintftocx {+1/}}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoCC}}
+% \begin{macrocode}
+\def\xintFtoCC {\romannumeral0\xintftocc }%
+\def\xintftocc #1%
+{%
+ \expandafter\XINT@ftcc@A\expandafter {\romannumeral0\xintraw {#1}}%
+}%
+\def\XINT@ftcc@A #1%
+{%
+ \expandafter\XINT@ftcc@B
+ \romannumeral0\xintraw {\xintAdd {1/2[0]}{#1[0]}}\Z {#1[0]}%
+}%
+\def\XINT@ftcc@B #1/#2\Z
+{%
+ \expandafter\XINT@ftcc@C\expandafter {\romannumeral0\xintquo {#1}{#2}}%
+}%
+\def\XINT@ftcc@C #1#2%
+{%
+ \expandafter\XINT@ftcc@D\romannumeral0\xintsub {#2}{#1}\Z {#1}%
+}%
+\def\XINT@ftcc@D #1%
+{%
+ \xint@UDzerominusfork
+ #1-\dummy \XINT@ftcc@integer
+ 0#1\dummy \XINT@ftcc@En
+ 0-\dummy {\XINT@ftcc@Ep #1}%
+ \xint@UDkrof
+}%
+\def\XINT@ftcc@Ep #1\Z #2%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#2+1/}%
+}%
+\def\XINT@ftcc@En #1\Z #2%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#2+-1/}%
+}%
+\def\XINT@ftcc@integer #1\Z #2{ #2}%
+\def\XINT@ftcc@loop@a #1%
+{%
+ \expandafter\XINT@ftcc@loop@b
+ \romannumeral0\xintraw {\xintAdd {1/2[0]}{#1}}\Z {#1}%
+}%
+\def\XINT@ftcc@loop@b #1/#2\Z
+{%
+ \expandafter\XINT@ftcc@loop@c\expandafter
+ {\romannumeral0\xintquo {#1}{#2}}%
+}%
+\def\XINT@ftcc@loop@c #1#2%
+{%
+ \expandafter\XINT@ftcc@loop@d
+ \romannumeral0\xintsub {#2}{#1[0]}\Z {#1}%
+}%
+\def\XINT@ftcc@loop@d #1%
+{%
+ \xint@UDzerominusfork
+ #1-\dummy \XINT@ftcc@end
+ 0#1\dummy \XINT@ftcc@loop@N
+ 0-\dummy {\XINT@ftcc@loop@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@ftcc@end #1\Z #2#3{ #3#2}%
+\def\XINT@ftcc@loop@P #1\Z #2#3%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#3#2+1/}%
+}%
+\def\XINT@ftcc@loop@N #1\Z #2#3%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#3#2+-1/}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoCv}}
+% \begin{macrocode}
+\def\xintFtoCv {\romannumeral0\xintftocv }%
+\def\xintftocv #1%
+{%
+ \xinticstocv {\xintFtoCs {#1}}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintFtoCCv}}
+% \begin{macrocode}
+\def\xintFtoCCv {\romannumeral0\xintftoccv }%
+\def\xintftoccv #1%
+{%
+ \xintigctocv {\xintFtoCC {#1}}%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintCstoF}}
+% \begin{macrocode}
+\def\xintCstoF {\romannumeral0\xintcstof }%
+\def\xintcstof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstf@prep #1,\W,%
+}%
+\def\XINT@cstf@prep
+{%
+ \XINT@cstf@loop@a 1001%
+}%
+\def\XINT@cstf@loop@a #1#2#3#4#5,%
+{%
+ \xint@w #5\XINT@cstf@end\W\expandafter\XINT@cstf@loop@b
+ \romannumeral0\xintraw {#5}.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@cstf@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@cstf@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@cstf@loop@c #1#2%
+{%
+ \expandafter\XINT@cstf@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@cstf@loop@d #1#2%
+{%
+ \expandafter\XINT@cstf@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@cstf@loop@e #1#2%
+{%
+ \expandafter\XINT@cstf@loop@a\expandafter{#2}#1%
+}%
+\def\XINT@cstf@end #1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+% \end{macrocode}
+% \subsection{\csh{xintiCstoF}}
+% \begin{macrocode}
+\def\xintiCstoF {\romannumeral0\xinticstof }%
+\def\xinticstof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@icstf@prep #1,\W,%
+}%
+\def\XINT@icstf@prep
+{%
+ \XINT@icstf@loop@a 1001%
+}%
+\def\XINT@icstf@loop@a #1#2#3#4#5,%
+{%
+ \xint@w #5\XINT@icstf@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@icstf@loop@b #5.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@icstf@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@icstf@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {#2}{#3}%
+}%
+\def\XINT@icstf@loop@c #1#2%
+{%
+ \expandafter\XINT@icstf@loop@a\expandafter {#2}{#1}%
+}%
+\def\XINT@icstf@end#1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+% \end{macrocode}
+% \subsection{\csh{xintGCtoF}}
+% \begin{macrocode}
+\def\xintGCtoF {\romannumeral0\xintgctof }%
+\def\xintgctof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctf@prep #1+\W/%
+}%
+\def\XINT@gctf@prep
+{%
+ \XINT@gctf@loop@a 1001%
+}%
+\def\XINT@gctf@loop@a #1#2#3#4#5+%
+{%
+ \expandafter\XINT@gctf@loop@b
+ \romannumeral0\xintraw {#5}.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@gctf@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctf@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@gctf@loop@c #1#2%
+{%
+ \expandafter\XINT@gctf@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctf@loop@d #1#2%
+{%
+ \expandafter\XINT@gctf@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@e #1#2%
+{%
+ \expandafter\XINT@gctf@loop@f\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@f #1#2/%
+{%
+ \xint@w #2\XINT@gctf@end\W\expandafter\XINT@gctf@loop@g
+ \romannumeral0\xintraw {#2}.#1%
+}%
+\def\XINT@gctf@loop@g #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctf@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #6\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+}%
+\def\XINT@gctf@loop@h #1#2%
+{%
+ \expandafter\XINT@gctf@loop@i\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctf@loop@i #1#2%
+{%
+ \expandafter\XINT@gctf@loop@j\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@j #1#2%
+{%
+ \expandafter\XINT@gctf@loop@a\expandafter {#2}#1%
+}%
+\def\XINT@gctf@end #1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+% \end{macrocode}
+% \subsection{\csh{xintiGCtoF}}
+% \begin{macrocode}
+\def\xintiGCtoF {\romannumeral0\xintigctof }%
+\def\xintigctof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@igctf@prep #1+\W/%
+}%
+\def\XINT@igctf@prep
+{%
+ \XINT@igctf@loop@a 1001%
+}%
+\def\XINT@igctf@loop@a #1#2#3#4#5+%
+{%
+ \expandafter\expandafter\expandafter\XINT@igctf@loop@b
+ #5.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@igctf@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctf@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {#2}{#3}%
+}%
+\def\XINT@igctf@loop@c #1#2%
+{%
+ \expandafter\XINT@igctf@loop@f\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctf@loop@f #1#2#3#4/%
+{%
+ \xint@w #4\XINT@igctf@end\W
+ \expandafter\expandafter\expandafter\XINT@igctf@loop@g
+ #4.{#2}{#3}#1%
+}%
+\def\XINT@igctf@loop@g #1.#2#3%
+{%
+ \expandafter\XINT@igctf@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #3\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #2\Z }%
+}%
+\def\XINT@igctf@loop@h #1#2%
+{%
+ \expandafter\XINT@igctf@loop@i\expandafter {#2}{#1}%
+}%
+\def\XINT@igctf@loop@i #1#2#3#4%
+{%
+ \XINT@igctf@loop@a {#3}{#4}{#1}{#2}%
+}%
+\def\XINT@igctf@end #1.#2#3#4#5{\xintraw {#4/#5}[0]}%
+% \end{macrocode}
+% \subsection{\csh{xintCstoCv}}
+% \begin{macrocode}
+\def\xintCstoCv {\romannumeral0\xintcstocv }%
+\def\xintcstocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstcv@prep #1,\W,%
+}%
+\def\XINT@cstcv@prep
+{%
+ \XINT@cstcv@loop@a {}1001%
+}%
+\def\XINT@cstcv@loop@a #1#2#3#4#5#6,%
+{%
+ \xint@w #6\XINT@cstcv@end\W
+ \expandafter\XINT@cstcv@loop@b
+ \romannumeral0\xintraw {#6}.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@cstcv@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@cstcv@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@cstcv@loop@c #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@cstcv@loop@d #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@cstcv@loop@e #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@f\expandafter{#2}#1%
+}%
+\def\XINT@cstcv@loop@f #1#2#3#4#5%
+{%
+ \expandafter\XINT@cstcv@loop@g\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{#5}{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@cstcv@loop@g #1#2{\XINT@cstcv@loop@a {#2{#1[0]}}}%
+\def\XINT@cstcv@end #1.#2#3#4#5#6{ #6}%
+% \end{macrocode}
+% \subsection{\csh{xintiCstoCv}}
+% \begin{macrocode}
+\def\xintiCstoCv {\romannumeral0\xinticstocv }%
+\def\xinticstocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@icstcv@prep #1,\W,%
+}%
+\def\XINT@icstcv@prep
+{%
+ \XINT@icstcv@loop@a {}1001%
+}%
+\def\XINT@icstcv@loop@a #1#2#3#4#5#6,%
+{%
+ \xint@w #6\XINT@icstcv@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@icstcv@loop@b #6.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@icstcv@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@icstcv@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {{#2}{#3}}%
+}%
+\def\XINT@icstcv@loop@c #1#2%
+{%
+ \expandafter\XINT@icstcv@loop@d\expandafter {#2}{#1}%
+}%
+\def\XINT@icstcv@loop@d #1#2%
+{%
+ \expandafter\XINT@icstcv@loop@e\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{{#1}{#2}}%
+}%
+\def\XINT@icstcv@loop@e #1#2#3#4{\XINT@icstcv@loop@a {#4{#1[0]}}#2#3}%
+\def\XINT@icstcv@end #1.#2#3#4#5#6{ #6}%
+% \end{macrocode}
+% \subsection{\csh{xintGCtoCv}}
+% \begin{macrocode}
+\def\xintGCtoCv {\romannumeral0\xintgctocv }%
+\def\xintgctocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctcv@prep #1+\W/%
+}%
+\def\XINT@gctcv@prep
+{%
+ \XINT@gctcv@loop@a {}1001%
+}%
+\def\XINT@gctcv@loop@a #1#2#3#4#5#6+%
+{%
+ \expandafter\XINT@gctcv@loop@b
+ \romannumeral0\xintraw {#6}.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@gctcv@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctcv@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@gctcv@loop@c #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@d #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@e\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@e #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@f\expandafter {#2}#1%
+}%
+\def\XINT@gctcv@loop@f #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@g\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{{#1}{#2}}%
+}%
+\def\XINT@gctcv@loop@g #1#2#3#4%
+{%
+ \XINT@gctcv@loop@h {#4{#1[0]}}{#2#3}%
+}%
+\def\XINT@gctcv@loop@h #1#2#3/%
+{%
+ \xint@w #3\XINT@gctcv@end\W\expandafter\XINT@gctcv@loop@i
+ \romannumeral0\xintraw {#3}.#2{#1}%
+}%
+\def\XINT@gctcv@loop@i #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctcv@loop@j\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #6\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+}%
+\def\XINT@gctcv@loop@j #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@k\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@k #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@l\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctcv@loop@l #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@m\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctcv@loop@m #1#2{\XINT@gctcv@loop@a {#2}#1}%
+\def\XINT@gctcv@end #1.#2#3#4#5#6{ #6}%
+% \end{macrocode}
+% \subsection{\csh{xintiGCtoCv}}
+% \begin{macrocode}
+\def\xintiGCtoCv {\romannumeral0\xintigctocv }%
+\def\xintigctocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@igctcv@prep #1+\W/%
+}%
+\def\XINT@igctcv@prep
+{%
+ \XINT@igctcv@loop@a {}1001%
+}%
+\def\XINT@igctcv@loop@a #1#2#3#4#5#6+%
+{%
+ \expandafter\expandafter\expandafter\XINT@igctcv@loop@b
+ #6.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@igctcv@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {{#2}{#3}}%
+}%
+\def\XINT@igctcv@loop@c #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@f\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctcv@loop@f #1#2#3#4/%
+{%
+ \xint@w #4\XINT@igctcv@end@a\W
+ \expandafter\expandafter\expandafter\XINT@igctcv@loop@g
+ #4.#1#2{#3}%
+}%
+\def\XINT@igctcv@loop@g #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #4\Z }%
+ {{#2}{#3}}%
+}%
+\def\XINT@igctcv@loop@h #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@i\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctcv@loop@i #1#2{\XINT@igctcv@loop@k #2{#2#1}}%
+\def\XINT@igctcv@loop@k #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@l\expandafter
+ {\romannumeral0\xintraw {#1/#2}}%
+}%
+\def\XINT@igctcv@loop@l #1#2#3{\XINT@igctcv@loop@a {#3{#1[0]}}#2}%
+\def\XINT@igctcv@end@a #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@end@b\expandafter
+ {\romannumeral0\xintraw {#2/#3}}%
+}%
+\def\XINT@igctcv@end@b #1#2{ #2{#1[0]}}%
+% \end{macrocode}
+% \subsection{\csh{xintCntoF}}
+% \begin{macrocode}
+\def\xintCntoF {\romannumeral0\xintcntof }%
+\def\xintcntof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntf
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntf #1#2%
+{%
+ \ifnum #1>0
+ \xint@afterfi {\expandafter\XINT@cntf@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {#2{#1}}{#2}}%
+ \else
+ \xint@afterfi
+ {\ifnum #1=0
+ \xint@afterfi {\expandafter\expandafter\expandafter
+ \space #2{0}}%
+ \else \xint@afterfi { 0[0]}%
+ \fi}%
+ \fi
+}%
+\def\XINT@cntf@loop #1#2#3%
+{%
+ \ifnum #1>0 \else \XINT@cntf@exit \fi
+ \expandafter\XINT@cntf@loop\expandafter
+ {\the\numexpr #1-1\expandafter }\expandafter
+ {\romannumeral0\xintadd {\xintDiv {1[0]}{#2}}{#3{#1}}}%
+ {#3}%
+}%
+\def\XINT@cntf@exit \fi
+ \expandafter\XINT@cntf@loop\expandafter
+ #1\expandafter #2#3%
+{%
+ \fi\xint@gobble@two #2%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintGCntoF}}
+% \begin{macrocode}
+\def\xintGCntoF {\romannumeral0\xintgcntof }%
+\def\xintgcntof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gcntf
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@gcntf #1#2#3%
+{%
+ \ifnum #1>0
+ \xint@afterfi {\expandafter\XINT@gcntf@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {#2{#1}}{#2}{#3}}%
+ \else
+ \xint@afterfi
+ {\ifnum #1=0
+ \xint@afterfi {\expandafter\expandafter\expandafter
+ \space #2{0}}%
+ \else \xint@afterfi { 0[0]}%
+ \fi}%
+ \fi
+}%
+\def\XINT@gcntf@loop #1#2#3#4%
+{%
+ \ifnum #1>0 \else \XINT@gcntf@exit \fi
+ \expandafter\XINT@gcntf@loop\expandafter
+ {\the\numexpr #1-1\expandafter }\expandafter
+ {\romannumeral0\xintadd {\xintDiv {#4{#1}}{#2}}{#3{#1}}}%
+ {#3}{#4}%
+}%
+\def\XINT@gcntf@exit \fi
+ \expandafter\XINT@gcntf@loop\expandafter
+ #1\expandafter #2#3#4%
+{%
+ \fi\xint@gobble@two #2%
+}%
+% \end{macrocode}
+% \subsection{\csh{xintCntoCs}}
+% \begin{macrocode}
+\def\xintCntoCs {\romannumeral0\xintcntocs }%
+\def\xintcntocs #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntcs
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntcs #1#2%
+{%
+ \ifnum #1<0
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi {\expandafter\XINT@cntcs@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}}%
+ \fi
+}%
+\def\XINT@cntcs@loop #1#2#3%
+{%
+ \ifnum #1>-1 \else \XINT@cntcs@exit \fi
+ \expandafter\XINT@cntcs@loop\expandafter
+ {\the\numexpr #1-1\expandafter\expandafter\expandafter }%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#3{#1}},#2}{#3}%
+}%
+\def\XINT@cntcs@exit \fi
+ \expandafter\XINT@cntcs@loop\expandafter
+ #1\expandafter\expandafter\expandafter #2#3%
+{%
+ \fi\XINT@cntcs@@exit #2%
+}%
+\def\XINT@cntcs@@exit #1,{ }%
+% \end{macrocode}
+% \subsection{\csh{xintCntoGC}}
+% \begin{macrocode}
+\def\xintCntoGC {\romannumeral0\xintcntogc }%
+\def\xintcntogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntgc
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntgc #1#2%
+{%
+ \ifnum #1<0
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi {\expandafter\XINT@cntgc@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}}%
+ \fi
+}%
+\def\XINT@cntgc@loop #1#2#3%
+{%
+ \ifnum #1>-1 \else \XINT@cntgc@exit \fi
+ \expandafter\XINT@cntgc@loop\expandafter
+ {\the\numexpr #1-1\expandafter\expandafter\expandafter }%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#3{#1}}+1/#2}{#3}%
+}%
+\def\XINT@cntgc@exit \fi
+ \expandafter\XINT@cntgc@loop\expandafter
+ #1\expandafter\expandafter\expandafter #2#3%
+{%
+ \fi\XINT@cntgc@@exit #2%
+}%
+\def\XINT@cntgc@@exit #1+1/{ }%
+% \end{macrocode}
+% \subsection{\csh{xintGCntoGC}}
+% \begin{macrocode}
+\def\xintGCntoGC {\romannumeral0\xintgcntogc }%
+\def\xintgcntogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@gcntgc #1#2#3%
+{%
+ \ifnum #1<0
+ \xint@afterfi { {0[0]}}%
+ \else
+ \xint@afterfi {\expandafter\XINT@gcntgc@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}{#3}}%
+ \fi
+}%
+\def\XINT@gcntgc@loop #1#2#3#4%
+{%
+ \ifnum #1>-1 \else \XINT@gcntgc@exit \fi
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc@loop@b
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#4{#1}}/#2}{#3{#1}}{#1}{#3}{#4}%
+}%
+\def\XINT@gcntgc@loop@b #1#2#3%
+{%
+ \expandafter\XINT@gcntgc@loop\expandafter
+ {\the\numexpr #3-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#2}+#1}%
+}%
+\def\XINT@gcntgc@exit \fi
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc@loop@b
+ \expandafter\expandafter\expandafter #1#2#3#4#5%
+{%
+ \fi\XINT@gcntgc@@exit #1%
+}%
+\def\XINT@gcntgc@@exit #1/{ }%
+% \end{macrocode}
+% \subsection{\csh{xintCstoGC}}
+% \begin{macrocode}
+\def\xintCstoGC {\romannumeral0\xintcstogc }%
+\def\xintcstogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstc@prep #1,\W,%
+}%
+\def\XINT@cstc@prep #1,{\XINT@cstc@loop@a {{#1}}}%
+\def\XINT@cstc@loop@a #1#2,%
+{%
+ \xint@w #2\XINT@cstc@end\W\XINT@cstc@loop@b {#1}{#2}%
+}%
+\def\XINT@cstc@loop@b #1#2{\XINT@cstc@loop@a {#1+1/{#2}}}%
+\def\XINT@cstc@end\W\XINT@cstc@loop@b #1#2{ #1}%
+% \end{macrocode}
+% \subsection{\csh{xintGCtoGC}}
+% \begin{macrocode}
+\def\xintGCtoGC {\romannumeral0\xintgctogc }%
+\def\xintgctogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@start #1+\W/%
+}%
+\def\XINT@gctgc@start {\XINT@gctgc@loop@a {}}%
+\def\XINT@gctgc@loop@a #1#2+#3/%
+{%
+ \xint@w #3\XINT@gctgc@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@loop@b
+ \expandafter\expandafter\expandafter
+ {#2}{#3}{#1}%
+}%
+\def\XINT@gctgc@loop@b #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@loop@c
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@gctgc@loop@c #1#2#3%
+{%
+ \XINT@gctgc@loop@a {#3{#2}+{#1}/}%
+}%
+\def\XINT@gctgc@end\W
+ \expandafter\expandafter\expandafter\XINT@gctgc@loop@b
+{%
+ \expandafter\expandafter\expandafter\XINT@gctgc@@end
+}%
+\def\XINT@gctgc@@end #1#2#3{ #3{#1}}%
+\XINT@cfrac@restorecatcodes@endinput%
+% \end{macrocode}
% \DeleteShortVerb{\|}
% \MakePercentComment
-%</xintseries>
+%</xintcfrac>
%<*none>
\CharacterTable
{Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -9012,8 +12124,8 @@ expandability and be merciful, please.
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum{9336}
-
+\CheckSum{11588}
+\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 52151674d3c..3c1550f3975 100644
--- a/Master/texmf-dist/source/generic/xint/xint.ins
+++ b/Master/texmf-dist/source/generic/xint/xint.ins
@@ -1,13 +1,13 @@
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
%%
%%
%% This is a generated file. Run tex or latex on this file to
-%% extract xint.sty, xintgcd.sty, xintfrac.sty and xintseries.sty
-%% from xint.dtx
+%% extract xint.sty, xintgcd.sty, xintfrac.sty, xintseries.sty
+%% and xintcfrac.sty from xint.dtx
%%
%% See xint.dtx for the statements of copyright and conditions of
%% distribution and/or modification of this work.
@@ -18,7 +18,8 @@
\file{xint.sty}{\from{xint.dtx}{xint}}
\file{xintgcd.sty}{\from{xint.dtx}{xintgcd}}
\file{xintfrac.sty}{\from{xint.dtx}{xintfrac}}
-\file{xintseries.sty}{\from{xint.dtx}{xintseries}}}
+\file{xintseries.sty}{\from{xint.dtx}{xintseries}}
+\file{xintcfrac.sty}{\from{xint.dtx}{xintcfrac}}}
\endbatchfile
\endinput
%%
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index e121c9bcffb..279468d168d 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%% xint: Expandable operations on long numbers
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -134,7 +134,7 @@
\fi
\expandafter\x\csname ver@xint.sty\endcsname
\ProvidesPackage{xint}%
- [2013/04/14 v1.03 Expandable operations on long numbers (jfB)]%
+ [2013/04/25 v1.04 Expandable operations on long numbers (jfB)]%
\def\xint@gobble #1{}%
\def\xint@gobble@one #1{}%
\def\xint@gobble@two #1#2{}%
@@ -256,10 +256,9 @@
{%
\the\numexpr #1#2#3#4\relax
}%
-\def\XINT@Rev@andcleanupzeros #1%
+\def\XINT@rev@andcuz #1%
{%
- \romannumeral0\expandafter
- \xint@cleanupzeros@andstop
+ \expandafter\xint@cleanupzeros@andstop
\romannumeral0\XINT@rord@main {}#1%
\xint@UNDEF
\xint@undef\xint@undef\xint@undef\xint@undef
@@ -505,6 +504,55 @@
}%
}%
\let\xintDigitsOf\xintAssignArray
+\def\xintApply {\romannumeral0\xintapply }%
+\def\xintapply #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@apply
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@apply #1#2%
+{%
+ \XINT@apply@loop@a {}{#2}#1\Z
+}%
+\def\XINT@apply@loop@a #1#2#3%
+{%
+ \xint@z #3\XINT@apply@end\Z
+ \expandafter\expandafter\expandafter
+ \XINT@apply@loop@b
+ \expandafter\expandafter\expandafter {#2{#3}}{#1}{#2}%
+}%
+\def\XINT@apply@loop@b #1#2{\XINT@apply@loop@a {#2{#1}}}%
+\def\XINT@apply@end\Z
+ \expandafter\expandafter\expandafter
+ \XINT@apply@loop@b
+ \expandafter\expandafter\expandafter #1#2#3{ #2}%
+\def\xintListWithSep {\romannumeral0\xintlistwithsep }%
+\long\def\xintlistwithsep #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@lws
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\long\def\XINT@lws #1#2%
+{%
+ \XINT@lws@start {#2}#1\Z
+}%
+\long\def\XINT@lws@start #1#2%
+{%
+ \xint@z #2\XINT@lws@dont\Z
+ \XINT@lws@loop@a {#2}{#1}%
+}%
+\long\def\XINT@lws@dont\Z\XINT@lws@loop@a #1#2{ #2}%
+\long\def\XINT@lws@loop@a #1#2#3%
+{%
+ \xint@z #3\XINT@lws@end\Z
+ \XINT@lws@loop@b {#1}{#2#3}{#2}%
+}%
+\long\def\XINT@lws@loop@b #1#2{\XINT@lws@loop@a {#1#2}}%
+\long\def\XINT@lws@end\Z\XINT@lws@loop@b #1#2#3{ #1}%
\def\xintiSgn {\romannumeral0\xintisgn }%
\def\xintisgn #1%
{%
@@ -752,8 +800,7 @@
}%
\def\xint@addm@cz\W\XINT@addm@CD #1#2#3{\XINT@addm@end #1#3}%
\def\XINT@addm@end #1#2#3#4#5%
-{\expandafter\space\the\numexpr #1#2#3#4#5\relax
-}%
+ {\expandafter\space\the\numexpr #1#2#3#4#5\relax }%
\def\XINT@addp@A #1#2#3#4#5#6%
{%
\xint@w
@@ -1115,7 +1162,7 @@
}%
\def\XINT@sub@Eonestep #1#2%
{\expandafter
- \XINT@sub@backtoE\the\numexpr 110000-#2+#1-1\relax.%
+ \XINT@sub@backtoE\the\numexpr 109999-#2+#1\relax.%
}%
\def\XINT@sub@backtoE #1#2#3.#4%
{%
@@ -1533,18 +1580,22 @@
\def\XINT@sumexpr {\XINT@sum@loop {0000}{0000}}%
\def\XINT@sum@loop #1#2#3%
{%
- \xint@relax #3\XINT@sum@finished\relax
\expandafter\expandafter\expandafter
\XINT@sum@checksign #3\Z {#1}{#2}%
}%
\def\XINT@sum@checksign #1%
{%
+ \xint@relax #1\XINT@sum@finished\relax
\xint@zero #1\XINT@sum@skipzeroinput0%
\xint@UDsignfork
#1\dummy \XINT@sum@N
-\dummy {\XINT@sum@P #1}%
\xint@UDkrof
}%
+\def\XINT@sum@finished #1\Z #2#3%
+{%
+ \XINT@sub@A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
+}%
\def\XINT@sum@skipzeroinput #1\xint@UDkrof #2\Z {\XINT@sum@loop }%
\def\XINT@sum@P #1\Z #2%
{%
@@ -1563,10 +1614,6 @@
\W\X\Y\Z #3\W\X\Y\Z }{#2}%
}%
\def\XINT@sum@NN #1#2{\XINT@sum@loop {#2}{#1}}%
-\def\XINT@sum@finished #1\Z #2#3%
-{%
- \XINT@sub@A 1{}#3\W\X\Y\Z #2\W\X\Y\Z
-}%
\def\xintiMul {\romannumeral0\xintimul }%
\def\xintimul #1%
{%
@@ -2010,18 +2057,22 @@
}%
\let\xintProductExpr\xintiProductExpr
\let\xintproductexpr\xintiproductexpr
-\def\XINT@productexpr {\XINT@prod@loop {1}}%
-\def\XINT@prod@loop #1#2%
+\def\XINT@productexpr {\XINT@prod@loop@a 1\Z }%
+\def\XINT@prod@loop@a #1\Z #2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@prod@loop@b #2\Z #1\Z \Z
+}%
+\def\XINT@prod@loop@b #1%
{%
- \xint@relax #2\XINT@prod@finished\relax
- \expandafter\XINT@prod@loop\expandafter
- {\romannumeral0\xintimul {#2}{#1}}%
+ \xint@relax #1\XINT@prod@finished\relax
+ \XINT@prod@loop@c #1%
}%
-\def\XINT@prod@finished #1#2#3#4#5%
+\def\XINT@prod@loop@c
{%
- \XINT@prod@finished@ #5%
+ \expandafter\XINT@prod@loop@a\romannumeral0\XINT@mul@fork
}%
-\def\XINT@prod@finished@ #1#2#3#4#5{ #5}%
+\def\XINT@prod@finished #1\Z #2\Z \Z { #2}%
\def\xintFac {\romannumeral0\xintfac }%
\def\xintfac #1%
{%
@@ -2307,10 +2358,9 @@
\expandafter\XINT@div@BisNegative@post
\romannumeral0\XINT@div@fork #1\Z #4#2\Z
}%
-\def\XINT@div@BisNegative@post #1#2%
+\def\XINT@div@BisNegative@post #1%
{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT@opp #1}{#2}%
+ \expandafter\space\expandafter {\romannumeral0\XINT@opp #1}%
}%
\def\XINT@div@AisNegative #1#2#3#4%
{%
@@ -2328,13 +2378,12 @@
}%
\def\XINT@div@AisNegative@zerorem #1#2#3%
{%
- \expandafter\space\expandafter
- {\romannumeral0\XINT@opp #1}{0}%
+ \expandafter\space\expandafter {\romannumeral0\XINT@opp #1}{0}%
}%
\def\XINT@div@AisNegative@posrem #1%
{%
\expandafter \XINT@div@AisNegative@posrem@b \expandafter
- {\romannumeral0\xintiopp {\XINT@Add{#1}{1}}}%
+ {\romannumeral0\xintiopp{\xintiAdd {#1}{1}}}%
}%
\def\XINT@div@AisNegative@posrem@b #1#2#3%
{%
@@ -2463,9 +2512,8 @@
}%
\def\XINT@div@finished@c #1#2%
{%
- \expandafter \space \expandafter
- {\romannumeral0\expandafter\xint@cleanupzeros@andstop
- \romannumeral0\XINT@rev {#2}}{#1}%
+ \expandafter\space\expandafter
+ {\romannumeral0\XINT@rev@andcuz {#2}}{#1}%
}%
\def\XINT@div@final@a #1%
{%
@@ -2479,45 +2527,54 @@
\def\xint@div@final@c0000\XINT@div@final@c #1{\XINT@div@finished@a }%
\def\XINT@div@final@c #1#2#3#4%
{%
- \expandafter \XINT@div@final@d \expandafter
- {\the\numexpr #1/#4\relax}{#2}%
-}%
-\def\XINT@div@final@d #1#2#3#4#5% q,A,Q,L,B puis c
-{%
\expandafter \XINT@div@final@da \expandafter
- {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }%
+ {\the\numexpr #1-(#1/#4)*#4\expandafter }\expandafter
+ {\the\numexpr #1/#4\expandafter }\expandafter
{\romannumeral0\xint@cleanupzeros@andstop #2}%
- {#1}{#3}{#5}%
}%
-\def\XINT@div@final@da #1#2%
+\def\XINT@div@final@da #1%
{%
- \expandafter\XINT@div@final@db\expandafter {#2}{#1}%
+ \ifnum #1>9
+ \expandafter\XINT@div@final@dP
+ \else
+ \xint@afterfi
+ {\ifnum #1<0
+ \expandafter\XINT@div@final@dN
+ \else
+ \expandafter\XINT@div@final@db
+ \fi }%
+ \fi
}%
-\def\XINT@div@final@db #1#2% A,qB, puis q,Q,B,c
+\def\XINT@div@final@dN #1%
{%
- \ifcase\XINT@Geq {#1}{#2}
- \expandafter\XINT@div@final@dc % A < qB
- \or\expandafter\XINT@div@final@e % A au moins qB
- \fi
- {#1}{#2}%
+ \expandafter\XINT@div@final@dP\the\numexpr #1-1\relax
}%
-\def\XINT@div@final@e #1#2#3#4#5% A,qB,q,Q,B,puis c
+\def\XINT@div@final@dP #1#2#3#4#5% q,A,Q,L,B (puis c)
{%
- \expandafter\XINT@div@final@f
- \expandafter{\romannumeral0\xintisub {#1}{#2}}%
- {\romannumeral0\xintiadd {\XINT@Rev@andcleanupzeros{#4}}{#3}}%
+ \expandafter \XINT@div@final@f \expandafter
+ {\romannumeral0\xintisub {#2}%
+ {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }}%
+ {\romannumeral0\XINT@add@A 0{}#1000\W\X\Y\Z #3\W\X\Y\Z }%
}%
-\def\XINT@div@final@dc #1#2#3% A sans leading zeros,trash,q,Q,B,c
+\def\XINT@div@final@db #1#2#3#4#5% q,A,Q,L,B (puis c)
{%
- \expandafter\XINT@div@final@dd
- \expandafter{\the\numexpr #3-1\relax}{#1}%
+ \expandafter\XINT@div@final@dc\expandafter
+ {\romannumeral0\xintisub {#2}%
+ {\romannumeral0\XINT@mul@M {#1}#5\Z\Z\Z\Z }}%
+ {#1}{#2}{#3}{#4}{#5}%
+}%
+\def\XINT@div@final@dc #1#2%
+{%
+ \ifnum\XINT@Sgn{#1}<0
+ \xint@afterfi {\expandafter\XINT@div@final@dP
+ \the\numexpr #2-1\relax }%
+ \else \xint@afterfi {\XINT@div@final@e {#1}#2}%
+ \fi
}%
-\def\XINT@div@final@dd #1#2#3#4% q,A,Q,B puis c
+\def\XINT@div@final@e #1#2#3#4#5#6% A final, q, trash, Q, L, B
{%
- \expandafter\XINT@div@final@f
- \expandafter{\romannumeral0\xintisub
- {#2}{\romannumeral0\XINT@mul@M {#1}#4\Z\Z\Z\Z }}%
- {\romannumeral0\xintiadd {\XINT@Rev@andcleanupzeros{#3}}{#1}}%
+ \XINT@div@final@f {#1}%
+ {\romannumeral0\XINT@add@A 0{}#2000\W\X\Y\Z #4\W\X\Y\Z }%
}%
\def\XINT@div@final@f #1#2#3% R,Q à développer,c
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
new file mode 100644
index 00000000000..8600e32fff7
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty
@@ -0,0 +1,1070 @@
+%%
+%% This is file `xintcfrac.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xint.dtx (with options: `xintcfrac')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from xintcfrac.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file xint.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%%
+%%----------------------------------------------------------------
+%% The xint bundle (version 1.04 of April 25, 2013)
+%% xintcfrac: Expandable continued fractions with xint package
+%% Copyright (C) 2013 by Jean-Francois Burnol
+%%----------------------------------------------------------------
+%%
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \def\space { }%
+ \let\z\endgroup
+ \expandafter\let\expandafter\x\csname ver@xintcfrac.sty\endcsname
+ \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \expandafter
+ \ifx\csname numexpr\endcsname\relax
+ \y{xintcfrac}{\numexpr not available, aborting input}%
+ \aftergroup\endinput
+ \else
+ \ifx\x\relax % plain-TeX, first loading of xintcfrac.sty
+ \ifx\w\relax % but xintfrac.sty not yet loaded.
+ \y{xintcfrac}{Package xintfrac is required}%
+ \y{xintcfrac}{Will try \string\input\space xintfrac.sty}%
+ \def\z{\endgroup\input xintfrac.sty\relax}%
+ \fi
+ \else
+ \def\empty {}%
+ \ifx\x\empty % LaTeX, first loading,
+ % variable is initialized, but \ProvidesPackage not yet seen
+ \ifx\w\relax % xintfrac.sty not yet loaded.
+ \y{xintcfrac}{Package xintfrac is required}%
+ \y{xintcfrac}{Will try \string\RequirePackage{xintfrac}}%
+ \def\z{\endgroup\RequirePackage{xintfrac}}%
+ \fi
+ \else
+ \y{xintcfrac}{I was already loaded, aborting input}%
+ \aftergroup\endinput
+ \fi
+ \fi
+ \fi
+\z%
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \catcode35=6 % #
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \expandafter
+ \ifx\csname PackageInfo\endcsname\relax
+ \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ \else
+ \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \fi
+ \def\empty {}%
+ \expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
+ \ifx\w\relax % Plain TeX, user gave a file name at the prompt
+ \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
+ \aftergroup\endinput
+ \fi
+ \ifx\w\empty % LaTeX, user gave a file name at the prompt
+ \y{xintcfrac}{Loading of package xintfrac failed, aborting input}%
+ \aftergroup\endinput
+ \fi
+\endgroup%
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
+ \def\x
+ {%
+ \endgroup
+ \edef\XINT@cfrac@restorecatcodes@endinput
+ {%
+ \catcode93=\the\catcode93 % ]
+ \catcode91=\the\catcode91 % [
+ \catcode47=\the\catcode47 % /
+ \catcode41=\the\catcode41 % )
+ \catcode40=\the\catcode40 % (
+ \catcode42=\the\catcode42 % *
+ \catcode43=\the\catcode43 % +
+ \catcode62=\the\catcode62 % >
+ \catcode60=\the\catcode60 % <
+ \catcode58=\the\catcode58 % :
+ \catcode46=\the\catcode46 % .
+ \catcode45=\the\catcode45 % -
+ \catcode44=\the\catcode44 % ,
+ \catcode35=\the\catcode35 % #
+ \catcode64=\the\catcode64 % @
+ \catcode125=\the\catcode125 % }
+ \catcode123=\the\catcode123 % {
+ \endlinechar=\the\endlinechar
+ \catcode13=\the\catcode13 % ^^M
+ \catcode32=\the\catcode32 %
+ \catcode61=\the\catcode61 % =
+ \noexpand\endinput
+ }%
+ \XINT@setcatcodes
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ }%
+\x
+\begingroup
+ \catcode58=12 % :
+ \expandafter\ifx\csname ProvidesPackage\endcsname\relax
+ \def\x#1#2#3[#4]{\endgroup
+ \immediate\write-1{Package: #3 #4}%
+ \xdef#1{#4}%
+ }%
+ \else
+ \def\x#1#2[#3]{\endgroup
+ #2[{#3}]%
+ \ifx#1\@undefined
+ \xdef#1{#3}%
+ \fi
+ \ifx#1\relax
+ \xdef#1{#3}%
+ \fi
+ }%
+ \fi
+\expandafter\x\csname ver@xintcfrac.sty\endcsname
+\ProvidesPackage{xintcfrac}%
+ [2013/04/25 v1.04 Expandable continued fractions with xint package (jfB)]%
+\def\xintCFrac {\romannumeral0\xintcfrac }%
+\def\xintcfrac #1%
+{%
+ \XINT@cfrac@opt@a #1\Z
+}%
+\def\XINT@cfrac@opt@a #1%
+{%
+ \ifx#1[\XINT@cfrac@opt@b\fi \XINT@cfrac@noopt #1%
+}%
+\def\XINT@cfrac@noopt #1\Z
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\relax
+}%
+\def\XINT@cfrac@opt@b\fi\XINT@cfrac@noopt [\Z #1]%
+{%
+ \fi\csname XINT@cfrac@opt#1\endcsname
+}%
+\def\XINT@cfrac@optl #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\hfill
+}%
+\def\XINT@cfrac@optc #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \relax\relax
+}%
+\def\XINT@cfrac@optr #1%
+{%
+ \expandafter\XINT@cfrac@A\romannumeral0\xintraw {#1}\Z
+ \hfill\relax
+}%
+\def\XINT@cfrac@A #1/#2\Z
+{%
+ \expandafter\XINT@cfrac@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@cfrac@B #1#2%
+{%
+ \XINT@cfrac@C #2\Z {#1}%
+}%
+\def\XINT@cfrac@C #1%
+{%
+ \xint@zero #1\XINT@cfrac@integer 0\XINT@cfrac@D #1%
+}%
+\def\XINT@cfrac@integer 0\XINT@cfrac@D 0#1\Z #2#3#4#5{ #2}%
+\def\XINT@cfrac@D #1\Z #2#3{\XINT@cfrac@loop@a {#1}{#3}{#1}{{#2}}}%
+\def\XINT@cfrac@loop@a
+{%
+ \expandafter\XINT@cfrac@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@cfrac@loop@d #1#2%
+{%
+ \XINT@cfrac@loop@e #2.{#1}%
+}%
+\def\XINT@cfrac@loop@e #1%
+{%
+ \xint@zero #1\xint@cfrac@loop@exit0\XINT@cfrac@loop@f #1%
+}%
+\def\XINT@cfrac@loop@f #1.#2#3#4%
+{%
+ \XINT@cfrac@loop@a {#1}{#3}{#1}{{#2}#4}%
+}%
+\def\xint@cfrac@loop@exit0\XINT@cfrac@loop@f #1.#2#3#4#5#6%
+ {\XINT@cfrac@T #5#6{#2}#4\Z }%
+\def\XINT@cfrac@T #1#2#3#4%
+{%
+ \xint@z #4\XINT@cfrac@end\Z\XINT@cfrac@T #1#2{#4+\cfrac{#11#2}{#3}}%
+}%
+\def\XINT@cfrac@end\Z\XINT@cfrac@T #1#2#3%
+{%
+ \XINT@cfrac@@end #3%
+}%
+\def\XINT@cfrac@@end \Z+\cfrac#1#2{ #2}%
+\def\xintGCFrac {\romannumeral0\xintgcfrac }%
+\def\xintgcfrac #1%
+{%
+ \XINT@gcfrac@opt@a #1\Z
+}%
+\def\XINT@gcfrac@opt@a #1%
+{%
+ \ifx#1[\XINT@gcfrac@opt@b\fi \XINT@gcfrac@noopt #1%
+}%
+\def\XINT@gcfrac@noopt #1\Z
+{%
+ \XINT@gcfrac #1+\W/\relax\relax
+}%
+\def\XINT@gcfrac@opt@b\fi\XINT@gcfrac@noopt [\Z #1]%
+{%
+ \fi\csname XINT@gcfrac@opt#1\endcsname
+}%
+\def\XINT@gcfrac@optl #1%
+{%
+ \XINT@gcfrac #1+\W/\relax\hfill
+}%
+\def\XINT@gcfrac@optc #1%
+{%
+ \XINT@gcfrac #1+\W/\relax\relax
+}%
+\def\XINT@gcfrac@optr #1%
+{%
+ \XINT@gcfrac #1+\W/\hfill\relax
+}%
+\def\XINT@gcfrac
+{%
+ \expandafter\expandafter\expandafter\XINT@gcfrac@enter
+}%
+\def\XINT@gcfrac@enter {\XINT@gcfrac@loop {}}%
+\def\XINT@gcfrac@loop #1#2+#3/%
+{%
+ \xint@w #3\XINT@gcfrac@endloop\W\XINT@gcfrac@loop {{#3}{#2}#1}%
+}%
+\def\XINT@gcfrac@endloop\W\XINT@gcfrac@loop #1#2#3%
+{%
+ \XINT@gcfrac@T #2#3#1\Z\Z
+}%
+\def\XINT@gcfrac@T #1#2#3#4{\XINT@gcfrac@U #1#2{\xintFrac{#4}}}%
+\def\XINT@gcfrac@U #1#2#3#4#5%
+{%
+ \xint@z #5\XINT@gcfrac@end\Z\XINT@gcfrac@U
+ #1#2{\xintFrac{#5}%
+ \ifcase\xintSgn{#4}
+ +\or+\else-\fi
+ \cfrac{#1\xintFrac{\xintAbs{#4}}#2}{#3}}%
+}%
+\def\XINT@gcfrac@end\Z\XINT@gcfrac@U #1#2#3%
+{%
+ \XINT@gcfrac@@end #3%
+}%
+\def\XINT@gcfrac@@end #1\cfrac#2#3{ #3}%
+\def\xintFtoCs {\romannumeral0\xintftocs }%
+\def\xintftocs #1%
+{%
+ \expandafter\XINT@ftc@A\romannumeral0\xintraw {#1}\Z
+}%
+\def\XINT@ftc@A #1/#2\Z
+{%
+ \expandafter\XINT@ftc@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@ftc@B #1#2%
+{%
+ \XINT@ftc@C #2.{#1}%
+}%
+\def\XINT@ftc@C #1%
+{%
+ \xint@zero #1\XINT@ftc@integer 0\XINT@ftc@D #1%
+}%
+\def\XINT@ftc@integer 0\XINT@ftc@D 0#1.#2#3{ #2}%
+\def\XINT@ftc@D #1.#2#3{\XINT@ftc@loop@a {#1}{#3}{#1}{#2,}}%
+\def\XINT@ftc@loop@a
+{%
+ \expandafter\XINT@ftc@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@ftc@loop@d #1#2%
+{%
+ \XINT@ftc@loop@e #2.{#1}%
+}%
+\def\XINT@ftc@loop@e #1%
+{%
+ \xint@zero #1\xint@ftc@loop@exit0\XINT@ftc@loop@f #1%
+}%
+\def\XINT@ftc@loop@f #1.#2#3#4%
+{%
+ \XINT@ftc@loop@a {#1}{#3}{#1}{#4#2,}%
+}%
+\def\xint@ftc@loop@exit0\XINT@ftc@loop@f #1.#2#3#4{ #4#2}%
+\def\xintFtoCx {\romannumeral0\xintftocx }%
+\def\xintftocx #1#2%
+{%
+ \expandafter\XINT@ftcx@A\romannumeral0\xintraw {#2}\Z {#1}%
+}%
+\def\XINT@ftcx@A #1/#2\Z
+{%
+ \expandafter\XINT@ftcx@B\romannumeral0\xintdivision {#1}{#2}{#2}%
+}%
+\def\XINT@ftcx@B #1#2%
+{%
+ \XINT@ftcx@C #2.{#1}%
+}%
+\def\XINT@ftcx@C #1%
+{%
+ \xint@zero #1\XINT@ftcx@integer 0\XINT@ftcx@D #1%
+}%
+\def\XINT@ftcx@integer 0\XINT@ftcx@D 0#1.#2#3#4{ #2}%
+\def\XINT@ftcx@D #1.#2#3#4{\XINT@ftcx@loop@a {#1}{#3}{#1}{#2#4}{#4}}%
+\def\XINT@ftcx@loop@a
+{%
+ \expandafter\XINT@ftcx@loop@d\romannumeral0\XINT@div@prepare
+}%
+\def\XINT@ftcx@loop@d #1#2%
+{%
+ \XINT@ftcx@loop@e #2.{#1}%
+}%
+\def\XINT@ftcx@loop@e #1%
+{%
+ \xint@zero #1\xint@ftcx@loop@exit0\XINT@ftcx@loop@f #1%
+}%
+\def\XINT@ftcx@loop@f #1.#2#3#4#5%
+{%
+ \XINT@ftcx@loop@a {#1}{#3}{#1}{#4{#2}#5}{#5}%
+}%
+\def\xint@ftcx@loop@exit0\XINT@ftcx@loop@f #1.#2#3#4#5{ #4{#2}}%
+\def\xintFtoGC {\romannumeral0\xintftogc }%
+\def\xintftogc {\xintftocx {+1/}}%
+\def\xintFtoCC {\romannumeral0\xintftocc }%
+\def\xintftocc #1%
+{%
+ \expandafter\XINT@ftcc@A\expandafter {\romannumeral0\xintraw {#1}}%
+}%
+\def\XINT@ftcc@A #1%
+{%
+ \expandafter\XINT@ftcc@B
+ \romannumeral0\xintraw {\xintAdd {1/2[0]}{#1[0]}}\Z {#1[0]}%
+}%
+\def\XINT@ftcc@B #1/#2\Z
+{%
+ \expandafter\XINT@ftcc@C\expandafter {\romannumeral0\xintquo {#1}{#2}}%
+}%
+\def\XINT@ftcc@C #1#2%
+{%
+ \expandafter\XINT@ftcc@D\romannumeral0\xintsub {#2}{#1}\Z {#1}%
+}%
+\def\XINT@ftcc@D #1%
+{%
+ \xint@UDzerominusfork
+ #1-\dummy \XINT@ftcc@integer
+ 0#1\dummy \XINT@ftcc@En
+ 0-\dummy {\XINT@ftcc@Ep #1}%
+ \xint@UDkrof
+}%
+\def\XINT@ftcc@Ep #1\Z #2%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#2+1/}%
+}%
+\def\XINT@ftcc@En #1\Z #2%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#2+-1/}%
+}%
+\def\XINT@ftcc@integer #1\Z #2{ #2}%
+\def\XINT@ftcc@loop@a #1%
+{%
+ \expandafter\XINT@ftcc@loop@b
+ \romannumeral0\xintraw {\xintAdd {1/2[0]}{#1}}\Z {#1}%
+}%
+\def\XINT@ftcc@loop@b #1/#2\Z
+{%
+ \expandafter\XINT@ftcc@loop@c\expandafter
+ {\romannumeral0\xintquo {#1}{#2}}%
+}%
+\def\XINT@ftcc@loop@c #1#2%
+{%
+ \expandafter\XINT@ftcc@loop@d
+ \romannumeral0\xintsub {#2}{#1[0]}\Z {#1}%
+}%
+\def\XINT@ftcc@loop@d #1%
+{%
+ \xint@UDzerominusfork
+ #1-\dummy \XINT@ftcc@end
+ 0#1\dummy \XINT@ftcc@loop@N
+ 0-\dummy {\XINT@ftcc@loop@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@ftcc@end #1\Z #2#3{ #3#2}%
+\def\XINT@ftcc@loop@P #1\Z #2#3%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#3#2+1/}%
+}%
+\def\XINT@ftcc@loop@N #1\Z #2#3%
+{%
+ \expandafter\XINT@ftcc@loop@a\expandafter
+ {\romannumeral0\xintdiv {1[0]}{#1}}{#3#2+-1/}%
+}%
+\def\xintFtoCv {\romannumeral0\xintftocv }%
+\def\xintftocv #1%
+{%
+ \xinticstocv {\xintFtoCs {#1}}%
+}%
+\def\xintFtoCCv {\romannumeral0\xintftoccv }%
+\def\xintftoccv #1%
+{%
+ \xintigctocv {\xintFtoCC {#1}}%
+}%
+\def\xintCstoF {\romannumeral0\xintcstof }%
+\def\xintcstof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstf@prep #1,\W,%
+}%
+\def\XINT@cstf@prep
+{%
+ \XINT@cstf@loop@a 1001%
+}%
+\def\XINT@cstf@loop@a #1#2#3#4#5,%
+{%
+ \xint@w #5\XINT@cstf@end\W\expandafter\XINT@cstf@loop@b
+ \romannumeral0\xintraw {#5}.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@cstf@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@cstf@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@cstf@loop@c #1#2%
+{%
+ \expandafter\XINT@cstf@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@cstf@loop@d #1#2%
+{%
+ \expandafter\XINT@cstf@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@cstf@loop@e #1#2%
+{%
+ \expandafter\XINT@cstf@loop@a\expandafter{#2}#1%
+}%
+\def\XINT@cstf@end #1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+\def\xintiCstoF {\romannumeral0\xinticstof }%
+\def\xinticstof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@icstf@prep #1,\W,%
+}%
+\def\XINT@icstf@prep
+{%
+ \XINT@icstf@loop@a 1001%
+}%
+\def\XINT@icstf@loop@a #1#2#3#4#5,%
+{%
+ \xint@w #5\XINT@icstf@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@icstf@loop@b #5.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@icstf@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@icstf@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {#2}{#3}%
+}%
+\def\XINT@icstf@loop@c #1#2%
+{%
+ \expandafter\XINT@icstf@loop@a\expandafter {#2}{#1}%
+}%
+\def\XINT@icstf@end#1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+\def\xintGCtoF {\romannumeral0\xintgctof }%
+\def\xintgctof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctf@prep #1+\W/%
+}%
+\def\XINT@gctf@prep
+{%
+ \XINT@gctf@loop@a 1001%
+}%
+\def\XINT@gctf@loop@a #1#2#3#4#5+%
+{%
+ \expandafter\XINT@gctf@loop@b
+ \romannumeral0\xintraw {#5}.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@gctf@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctf@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@gctf@loop@c #1#2%
+{%
+ \expandafter\XINT@gctf@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctf@loop@d #1#2%
+{%
+ \expandafter\XINT@gctf@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@e #1#2%
+{%
+ \expandafter\XINT@gctf@loop@f\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@f #1#2/%
+{%
+ \xint@w #2\XINT@gctf@end\W\expandafter\XINT@gctf@loop@g
+ \romannumeral0\xintraw {#2}.#1%
+}%
+\def\XINT@gctf@loop@g #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctf@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #6\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+}%
+\def\XINT@gctf@loop@h #1#2%
+{%
+ \expandafter\XINT@gctf@loop@i\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctf@loop@i #1#2%
+{%
+ \expandafter\XINT@gctf@loop@j\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctf@loop@j #1#2%
+{%
+ \expandafter\XINT@gctf@loop@a\expandafter {#2}#1%
+}%
+\def\XINT@gctf@end #1.#2#3#4#5{\xintraw {#2/#3}[0]}%
+\def\xintiGCtoF {\romannumeral0\xintigctof }%
+\def\xintigctof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@igctf@prep #1+\W/%
+}%
+\def\XINT@igctf@prep
+{%
+ \XINT@igctf@loop@a 1001%
+}%
+\def\XINT@igctf@loop@a #1#2#3#4#5+%
+{%
+ \expandafter\expandafter\expandafter\XINT@igctf@loop@b
+ #5.{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@igctf@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctf@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {#2}{#3}%
+}%
+\def\XINT@igctf@loop@c #1#2%
+{%
+ \expandafter\XINT@igctf@loop@f\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctf@loop@f #1#2#3#4/%
+{%
+ \xint@w #4\XINT@igctf@end\W
+ \expandafter\expandafter\expandafter\XINT@igctf@loop@g
+ #4.{#2}{#3}#1%
+}%
+\def\XINT@igctf@loop@g #1.#2#3%
+{%
+ \expandafter\XINT@igctf@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #3\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #2\Z }%
+}%
+\def\XINT@igctf@loop@h #1#2%
+{%
+ \expandafter\XINT@igctf@loop@i\expandafter {#2}{#1}%
+}%
+\def\XINT@igctf@loop@i #1#2#3#4%
+{%
+ \XINT@igctf@loop@a {#3}{#4}{#1}{#2}%
+}%
+\def\XINT@igctf@end #1.#2#3#4#5{\xintraw {#4/#5}[0]}%
+\def\xintCstoCv {\romannumeral0\xintcstocv }%
+\def\xintcstocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstcv@prep #1,\W,%
+}%
+\def\XINT@cstcv@prep
+{%
+ \XINT@cstcv@loop@a {}1001%
+}%
+\def\XINT@cstcv@loop@a #1#2#3#4#5#6,%
+{%
+ \xint@w #6\XINT@cstcv@end\W
+ \expandafter\XINT@cstcv@loop@b
+ \romannumeral0\xintraw {#6}.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@cstcv@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@cstcv@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@cstcv@loop@c #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@cstcv@loop@d #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@e\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@cstcv@loop@e #1#2%
+{%
+ \expandafter\XINT@cstcv@loop@f\expandafter{#2}#1%
+}%
+\def\XINT@cstcv@loop@f #1#2#3#4#5%
+{%
+ \expandafter\XINT@cstcv@loop@g\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{#5}{#1}{#2}{#3}{#4}%
+}%
+\def\XINT@cstcv@loop@g #1#2{\XINT@cstcv@loop@a {#2{#1[0]}}}%
+\def\XINT@cstcv@end #1.#2#3#4#5#6{ #6}%
+\def\xintiCstoCv {\romannumeral0\xinticstocv }%
+\def\xinticstocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@icstcv@prep #1,\W,%
+}%
+\def\XINT@icstcv@prep
+{%
+ \XINT@icstcv@loop@a {}1001%
+}%
+\def\XINT@icstcv@loop@a #1#2#3#4#5#6,%
+{%
+ \xint@w #6\XINT@icstcv@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@icstcv@loop@b #6.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@icstcv@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@icstcv@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {{#2}{#3}}%
+}%
+\def\XINT@icstcv@loop@c #1#2%
+{%
+ \expandafter\XINT@icstcv@loop@d\expandafter {#2}{#1}%
+}%
+\def\XINT@icstcv@loop@d #1#2%
+{%
+ \expandafter\XINT@icstcv@loop@e\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{{#1}{#2}}%
+}%
+\def\XINT@icstcv@loop@e #1#2#3#4{\XINT@icstcv@loop@a {#4{#1[0]}}#2#3}%
+\def\XINT@icstcv@end #1.#2#3#4#5#6{ #6}%
+\def\xintGCtoCv {\romannumeral0\xintgctocv }%
+\def\xintgctocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctcv@prep #1+\W/%
+}%
+\def\XINT@gctcv@prep
+{%
+ \XINT@gctcv@loop@a {}1001%
+}%
+\def\XINT@gctcv@loop@a #1#2#3#4#5#6+%
+{%
+ \expandafter\XINT@gctcv@loop@b
+ \romannumeral0\xintraw {#6}.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@gctcv@loop@b #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctcv@loop@c\expandafter
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#6}}{\XINT@Mul {#1}{#4}}}%
+ {\romannumeral0\xintiadd {\XINT@Mul {#2}{#5}}{\XINT@Mul {#1}{#3}}}%
+}%
+\def\XINT@gctcv@loop@c #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@d\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@d #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@e\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@e #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@f\expandafter {#2}#1%
+}%
+\def\XINT@gctcv@loop@f #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@g\expandafter
+ {\romannumeral0\xintraw {#1/#2}}{{#1}{#2}}%
+}%
+\def\XINT@gctcv@loop@g #1#2#3#4%
+{%
+ \XINT@gctcv@loop@h {#4{#1[0]}}{#2#3}%
+}%
+\def\XINT@gctcv@loop@h #1#2#3/%
+{%
+ \xint@w #3\XINT@gctcv@end\W\expandafter\XINT@gctcv@loop@i
+ \romannumeral0\xintraw {#3}.#2{#1}%
+}%
+\def\XINT@gctcv@loop@i #1/#2.#3#4#5#6%
+{%
+ \expandafter\XINT@gctcv@loop@j\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #6\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #4\Z }%
+ {\romannumeral0\XINT@mul@fork #2\Z #3\Z }%
+}%
+\def\XINT@gctcv@loop@j #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@k\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@gctcv@loop@k #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@l\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctcv@loop@l #1#2%
+{%
+ \expandafter\XINT@gctcv@loop@m\expandafter {\expandafter{#2}#1}%
+}%
+\def\XINT@gctcv@loop@m #1#2{\XINT@gctcv@loop@a {#2}#1}%
+\def\XINT@gctcv@end #1.#2#3#4#5#6{ #6}%
+\def\xintiGCtoCv {\romannumeral0\xintigctocv }%
+\def\xintigctocv #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@igctcv@prep #1+\W/%
+}%
+\def\XINT@igctcv@prep
+{%
+ \XINT@igctcv@loop@a {}1001%
+}%
+\def\XINT@igctcv@loop@a #1#2#3#4#5#6+%
+{%
+ \expandafter\expandafter\expandafter\XINT@igctcv@loop@b
+ #6.{#2}{#3}{#4}{#5}{#1}%
+}%
+\def\XINT@igctcv@loop@b #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@loop@c\expandafter
+ {\romannumeral0\xintiadd {#5}{\XINT@Mul {#1}{#3}}}%
+ {\romannumeral0\xintiadd {#4}{\XINT@Mul {#1}{#2}}}%
+ {{#2}{#3}}%
+}%
+\def\XINT@igctcv@loop@c #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@f\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctcv@loop@f #1#2#3#4/%
+{%
+ \xint@w #4\XINT@igctcv@end@a\W
+ \expandafter\expandafter\expandafter\XINT@igctcv@loop@g
+ #4.#1#2{#3}%
+}%
+\def\XINT@igctcv@loop@g #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@loop@h\expandafter
+ {\romannumeral0\XINT@mul@fork #1\Z #5\Z }%
+ {\romannumeral0\XINT@mul@fork #1\Z #4\Z }%
+ {{#2}{#3}}%
+}%
+\def\XINT@igctcv@loop@h #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@i\expandafter {\expandafter{#2}{#1}}%
+}%
+\def\XINT@igctcv@loop@i #1#2{\XINT@igctcv@loop@k #2{#2#1}}%
+\def\XINT@igctcv@loop@k #1#2%
+{%
+ \expandafter\XINT@igctcv@loop@l\expandafter
+ {\romannumeral0\xintraw {#1/#2}}%
+}%
+\def\XINT@igctcv@loop@l #1#2#3{\XINT@igctcv@loop@a {#3{#1[0]}}#2}%
+\def\XINT@igctcv@end@a #1.#2#3#4#5%
+{%
+ \expandafter\XINT@igctcv@end@b\expandafter
+ {\romannumeral0\xintraw {#2/#3}}%
+}%
+\def\XINT@igctcv@end@b #1#2{ #2{#1[0]}}%
+\def\xintCntoF {\romannumeral0\xintcntof }%
+\def\xintcntof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntf
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntf #1#2%
+{%
+ \ifnum #1>0
+ \xint@afterfi {\expandafter\XINT@cntf@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {#2{#1}}{#2}}%
+ \else
+ \xint@afterfi
+ {\ifnum #1=0
+ \xint@afterfi {\expandafter\expandafter\expandafter
+ \space #2{0}}%
+ \else \xint@afterfi { 0[0]}%
+ \fi}%
+ \fi
+}%
+\def\XINT@cntf@loop #1#2#3%
+{%
+ \ifnum #1>0 \else \XINT@cntf@exit \fi
+ \expandafter\XINT@cntf@loop\expandafter
+ {\the\numexpr #1-1\expandafter }\expandafter
+ {\romannumeral0\xintadd {\xintDiv {1[0]}{#2}}{#3{#1}}}%
+ {#3}%
+}%
+\def\XINT@cntf@exit \fi
+ \expandafter\XINT@cntf@loop\expandafter
+ #1\expandafter #2#3%
+{%
+ \fi\xint@gobble@two #2%
+}%
+\def\xintGCntoF {\romannumeral0\xintgcntof }%
+\def\xintgcntof #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gcntf
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@gcntf #1#2#3%
+{%
+ \ifnum #1>0
+ \xint@afterfi {\expandafter\XINT@gcntf@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {#2{#1}}{#2}{#3}}%
+ \else
+ \xint@afterfi
+ {\ifnum #1=0
+ \xint@afterfi {\expandafter\expandafter\expandafter
+ \space #2{0}}%
+ \else \xint@afterfi { 0[0]}%
+ \fi}%
+ \fi
+}%
+\def\XINT@gcntf@loop #1#2#3#4%
+{%
+ \ifnum #1>0 \else \XINT@gcntf@exit \fi
+ \expandafter\XINT@gcntf@loop\expandafter
+ {\the\numexpr #1-1\expandafter }\expandafter
+ {\romannumeral0\xintadd {\xintDiv {#4{#1}}{#2}}{#3{#1}}}%
+ {#3}{#4}%
+}%
+\def\XINT@gcntf@exit \fi
+ \expandafter\XINT@gcntf@loop\expandafter
+ #1\expandafter #2#3#4%
+{%
+ \fi\xint@gobble@two #2%
+}%
+\def\xintCntoCs {\romannumeral0\xintcntocs }%
+\def\xintcntocs #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntcs
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntcs #1#2%
+{%
+ \ifnum #1<0
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi {\expandafter\XINT@cntcs@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}}%
+ \fi
+}%
+\def\XINT@cntcs@loop #1#2#3%
+{%
+ \ifnum #1>-1 \else \XINT@cntcs@exit \fi
+ \expandafter\XINT@cntcs@loop\expandafter
+ {\the\numexpr #1-1\expandafter\expandafter\expandafter }%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#3{#1}},#2}{#3}%
+}%
+\def\XINT@cntcs@exit \fi
+ \expandafter\XINT@cntcs@loop\expandafter
+ #1\expandafter\expandafter\expandafter #2#3%
+{%
+ \fi\XINT@cntcs@@exit #2%
+}%
+\def\XINT@cntcs@@exit #1,{ }%
+\def\xintCntoGC {\romannumeral0\xintcntogc }%
+\def\xintcntogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cntgc
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@cntgc #1#2%
+{%
+ \ifnum #1<0
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi {\expandafter\XINT@cntgc@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}}%
+ \fi
+}%
+\def\XINT@cntgc@loop #1#2#3%
+{%
+ \ifnum #1>-1 \else \XINT@cntgc@exit \fi
+ \expandafter\XINT@cntgc@loop\expandafter
+ {\the\numexpr #1-1\expandafter\expandafter\expandafter }%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#3{#1}}+1/#2}{#3}%
+}%
+\def\XINT@cntgc@exit \fi
+ \expandafter\XINT@cntgc@loop\expandafter
+ #1\expandafter\expandafter\expandafter #2#3%
+{%
+ \fi\XINT@cntgc@@exit #2%
+}%
+\def\XINT@cntgc@@exit #1+1/{ }%
+\def\xintGCntoGC {\romannumeral0\xintgcntogc }%
+\def\xintgcntogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@gcntgc #1#2#3%
+{%
+ \ifnum #1<0
+ \xint@afterfi { {0[0]}}%
+ \else
+ \xint@afterfi {\expandafter\XINT@gcntgc@loop\expandafter
+ {\the\numexpr
+ #1-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#2{#1}}}{#2}{#3}}%
+ \fi
+}%
+\def\XINT@gcntgc@loop #1#2#3#4%
+{%
+ \ifnum #1>-1 \else \XINT@gcntgc@exit \fi
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc@loop@b
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter
+ {#4{#1}}/#2}{#3{#1}}{#1}{#3}{#4}%
+}%
+\def\XINT@gcntgc@loop@b #1#2#3%
+{%
+ \expandafter\XINT@gcntgc@loop\expandafter
+ {\the\numexpr #3-1\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ {\expandafter\expandafter\expandafter{#2}+#1}%
+}%
+\def\XINT@gcntgc@exit \fi
+ \expandafter\expandafter\expandafter
+ \XINT@gcntgc@loop@b
+ \expandafter\expandafter\expandafter #1#2#3#4#5%
+{%
+ \fi\XINT@gcntgc@@exit #1%
+}%
+\def\XINT@gcntgc@@exit #1/{ }%
+\def\xintCstoGC {\romannumeral0\xintcstogc }%
+\def\xintcstogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@cstc@prep #1,\W,%
+}%
+\def\XINT@cstc@prep #1,{\XINT@cstc@loop@a {{#1}}}%
+\def\XINT@cstc@loop@a #1#2,%
+{%
+ \xint@w #2\XINT@cstc@end\W\XINT@cstc@loop@b {#1}{#2}%
+}%
+\def\XINT@cstc@loop@b #1#2{\XINT@cstc@loop@a {#1+1/{#2}}}%
+\def\XINT@cstc@end\W\XINT@cstc@loop@b #1#2{ #1}%
+\def\xintGCtoGC {\romannumeral0\xintgctogc }%
+\def\xintgctogc #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@start #1+\W/%
+}%
+\def\XINT@gctgc@start {\XINT@gctgc@loop@a {}}%
+\def\XINT@gctgc@loop@a #1#2+#3/%
+{%
+ \xint@w #3\XINT@gctgc@end\W
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@loop@b
+ \expandafter\expandafter\expandafter
+ {#2}{#3}{#1}%
+}%
+\def\XINT@gctgc@loop@b #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@gctgc@loop@c
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@gctgc@loop@c #1#2#3%
+{%
+ \XINT@gctgc@loop@a {#3{#2}+{#1}/}%
+}%
+\def\XINT@gctgc@end\W
+ \expandafter\expandafter\expandafter\XINT@gctgc@loop@b
+{%
+ \expandafter\expandafter\expandafter\XINT@gctgc@@end
+}%
+\def\XINT@gctgc@@end #1#2#3{ #3{#1}}%
+\XINT@cfrac@restorecatcodes@endinput%
+\endinput
+%%
+%% End of file `xintcfrac.sty'.
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index 895d408430b..c4d8d8aaae5 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%% xintfrac: Expandable operations on fractions
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -164,7 +164,7 @@
\fi
\expandafter\x\csname ver@xintfrac.sty\endcsname
\ProvidesPackage{xintfrac}%
- [2013/04/14 v1.03 Expandable operations on fractions (jfB)]%
+ [2013/04/25 v1.04 Expandable operations on fractions (jfB)]%
\def\xintLen {\romannumeral0\xintlen }%
\def\xintlen #1%
{%
@@ -205,6 +205,26 @@
{%
\expandafter\XINT@outfrac@P\expandafter {#2}{#1}%
}%
+\def\xintRaw {\romannumeral0\xintraw }%
+\def\xintraw
+{%
+ \expandafter\XINT@raw\romannumeral0\XINT@infrac
+}%
+\def\XINT@raw #1%
+{%
+ \ifcase\XINT@Sgn {#1}
+ \expandafter\XINT@raw@Ba
+ \or
+ \expandafter\XINT@raw@A
+ \else
+ \expandafter\XINT@raw@Ba
+ \fi
+ {#1}%
+}%
+\def\XINT@raw@A #1#2#3{\xint@dsh {#2}{-#1}/#3}%
+\def\XINT@raw@Ba #1#2#3{\expandafter\XINT@raw@Bb
+ \expandafter{\romannumeral0\xint@dsh {#3}{#1}}{#2}}%
+\def\XINT@raw@Bb #1#2{ #2/#1}%
\def\xintNumerator {\romannumeral0\xintnumerator }%
\def\xintnumerator
{%
@@ -268,6 +288,30 @@
\frac {#2}{#3}#1%
}%
\def\XINT@@frac@E \fi #1#2#3#4{\fi \space #3\cdot }%
+\def\xintSignedFrac {\romannumeral0\xintsignedfrac }%
+\def\xintsignedfrac #1%
+{%
+ \expandafter\XINT@sgnfrac@a\romannumeral0\XINT@infrac {#1}%
+}%
+\def\XINT@sgnfrac@a #1#2%
+{%
+ \XINT@sgnfrac@b #2\Z {#1}%
+}%
+\def\XINT@sgnfrac@b #1%
+{%
+ \xint@UDsignfork
+ #1\dummy \XINT@sgnfrac@N
+ -\dummy {\XINT@sgnfrac@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@sgnfrac@P #1\Z #2%
+{%
+ \XINT@@frac@A {#2}{#1}%
+}%
+\def\XINT@sgnfrac@N
+{%
+ \expandafter\xint@minus@andstop\romannumeral0\XINT@sgnfrac@P
+}%
\def\xintFwOver {\romannumeral0\xintfwover }%
\def\xintfwover #1%
{%
@@ -283,7 +327,7 @@
\ifcase\XINT@isOne {#5}
\xint@afterfi { {#4\over #5}}%
\or
- \xint@afterfi { #4\cdot }%
+ \xint@afterfi { #4}%
\fi
}%
\def\XINT@fwover@D #1#2#3%
@@ -295,38 +339,72 @@
\fi
#1%
}%
+\def\xintSignedFwOver {\romannumeral0\xintsignedfwover }%
+\def\xintsignedfwover #1%
+{%
+ \expandafter\XINT@sgnfwover@a\romannumeral0\XINT@infrac {#1}%
+}%
+\def\XINT@sgnfwover@a #1#2%
+{%
+ \XINT@sgnfwover@b #2\Z {#1}%
+}%
+\def\XINT@sgnfwover@b #1%
+{%
+ \xint@UDsignfork
+ #1\dummy \XINT@sgnfwover@N
+ -\dummy {\XINT@sgnfwover@P #1}%
+ \xint@UDkrof
+}%
+\def\XINT@sgnfwover@P #1\Z #2%
+{%
+ \XINT@fwover@A {#2}{#1}%
+}%
+\def\XINT@sgnfwover@N
+{%
+ \expandafter\xint@minus@andstop\romannumeral0\XINT@sgnfwover@P
+}%
\def\xintSum {\romannumeral0\xintsum }%
\def\xintsum #1{\xintsumexpr #1\relax }%
\def\xintSumExpr {\romannumeral0\xintsumexpr }%
\def\xintsumexpr {\expandafter\expandafter\expandafter\XINT@fsumexpr }%
-\def\XINT@fsumexpr {\XINT@fsum@loop {0}}%
-\def\XINT@fsum@loop #1#2%
+\def\XINT@fsumexpr {\XINT@fsum@loop@a {0[0]}}%
+\def\XINT@fsum@loop@a #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@fsum@loop@b #2\Z {#1}%
+}%
+\def\XINT@fsum@loop@b #1%
{%
- \xint@relax #2\XINT@fsum@finished\relax
- \expandafter\XINT@fsum@loop\expandafter
- {\romannumeral0\xintadd {#1}{#2}}%
+ \xint@relax #1\XINT@fsum@finished\relax
+ \XINT@fsum@loop@c #1%
}%
-\def\XINT@fsum@finished #1#2#3#4#5%
+\def\XINT@fsum@loop@c #1\Z #2%
{%
- \XINT@fsum@finished@ #5%
+ \expandafter\XINT@fsum@loop@a\expandafter
+ {\romannumeral0\xintadd {#2}{#1}}%
}%
-\def\XINT@fsum@finished@ #1#2#3#4#5{ #4}%
+\def\XINT@fsum@finished #1\Z #2{ #2}%
\def\xintPrd {\romannumeral0\xintprd }%
\def\xintprd #1{\xintproductexpr #1\relax }%
\def\xintProductExpr {\romannumeral0\xintproductexpr }%
\def\xintproductexpr{\expandafter\expandafter\expandafter\XINT@fproductexpr }%
-\def\XINT@fproductexpr {\XINT@fprod@loop {1}}%
-\def\XINT@fprod@loop #1#2%
+\def\XINT@fproductexpr {\XINT@fprod@loop@a {1[0]}}%
+\def\XINT@fprod@loop@a #1#2%
{%
- \xint@relax #2\XINT@fprod@finished\relax
- \expandafter\XINT@fprod@loop\expandafter
- {\romannumeral0\xintmul {#2}{#1}}%
+ \expandafter\expandafter\expandafter
+ \XINT@fprod@loop@b #2\Z {#1}%
}%
-\def\XINT@fprod@finished #1#2#3#4#5%
+\def\XINT@fprod@loop@b #1%
{%
- \XINT@fprod@finished@ #5%
+ \xint@relax #1\XINT@fprod@finished\relax
+ \XINT@fprod@loop@c #1%
}%
-\def\XINT@fprod@finished@ #1#2#3#4#5{ #5}%
+\def\XINT@fprod@loop@c #1\Z #2%
+{%
+ \expandafter\XINT@fprod@loop@a\expandafter
+ {\romannumeral0\xintmul {#1}{#2}}%
+}%
+\def\XINT@fprod@finished #1\Z #2{ #2}%
\def\XINT@inFrac {\romannumeral0\XINT@infrac }%
\def\XINT@infrac #1%
{%
@@ -556,7 +634,14 @@
{\the\numexpr #3+#4-#2}{#1}{#5}%
}%
\def\XINT@rez@E #1#2#3{ #3/#2[#1]}%
-\def\XINT@@bts #1#2#3%
+\def\xintIrr {\romannumeral0\xintirr }%
+\def\xintirr
+{%
+ \expandafter\XINT@irr@putsign
+ \romannumeral0\expandafter\XINT@irr
+ \romannumeral0\XINT@infrac
+}%
+\def\XINT@irr@putsign #1#2#3%
{%
\ifcase\XINT@isOne {#2}
\xint@afterfi {#3#1/#2}%
@@ -564,13 +649,6 @@
\xint@afterfi {#3#1}%
\fi
}%
-\def\xintIrr {\romannumeral0\xintirr }%
-\def\xintirr
-{%
- \expandafter\XINT@@bts
- \romannumeral0\expandafter\XINT@irr
- \romannumeral0\XINT@infrac
-}%
\def\XINT@irr #1%
{%
\ifcase\XINT@Sgn {#1}
@@ -584,28 +662,25 @@
}%
\def\XINT@irr@A #1#2%
{%
- \expandafter \XINT@irr@AC \expandafter
- {\romannumeral0\xint@dsh {#2}{-#1}}%
+ \expandafter \XINT@irr@C
+ \romannumeral0\xint@dsh {#2}{-#1}\Z
}%
-\def\XINT@irr@AC #1#2{\XINT@irr@C #2\Z #1\Z }%
\def\XINT@irr@B #1#2#3%
{%
- \expandafter \XINT@irr@C \romannumeral0\xint@dsh {#3}{#1}\Z #2\Z
+ \expandafter \XINT@irr@BC \expandafter
+ {\romannumeral0\xint@dsh {#3}{#1}}{#2}%
}%
-\def\XINT@irr@C #1#2\Z #3#4\Z
+\def\XINT@irr@BC #1#2{\XINT@irr@C #2\Z {#1}}%
+\def\XINT@irr@C #1#2\Z
{%
- \xint@UDsignsfork
- #1#3\dummy \XINT@irr@minusminus
- #1-\dummy \XINT@irr@minusplus
- #3-\dummy \XINT@irr@plusminus
- --\dummy \XINT@irr@plusplus
+ \xint@UDsignfork
+ #1\dummy \XINT@irr@negative
+ -\dummy {\XINT@irr@nonneg #1}%
\xint@UDkrof
- {#4}{#2}#3#1%
+ #2\Z
}%
-\def\XINT@irr@minusminus #1#2#3#4{\XINT@irr@D #1\Z #2\Z \space}%
-\def\XINT@irr@minusplus #1#2#3#4{\XINT@irr@D #3#1\Z #2\Z \XINT@opp}%
-\def\XINT@irr@plusminus #1#2#3#4{\XINT@irr@D #1\Z #4#2\Z \XINT@opp}%
-\def\XINT@irr@plusplus #1#2#3#4{\XINT@irr@D #3#1\Z #4#2\Z \space}%
+\def\XINT@irr@negative #1\Z #2{\XINT@irr@D #1\Z #2\Z \XINT@opp}%
+\def\XINT@irr@nonneg #1\Z #2{\XINT@irr@D #1\Z #2\Z \space}%
\def\XINT@irr@D #1#2\Z #3#4\Z
{%
\xint@UDzerosfork
@@ -620,7 +695,7 @@
\space 00}%
\def\XINT@irr@divisionbyzero #1#2#3#4{\expandafter\xintError:DivisionByZero
\space {#2}0}%
-\def\XINT@irr@zero #1#2#3#4{ 0/1}%
+\def\XINT@irr@zero #1#2#3#4{ 01}%
\def\XINT@irr@nonzero@checkifone #1%
{%
\ifcase\XINT@isOne {#1}
@@ -635,9 +710,9 @@
\expandafter\XINT@irr@loop@d
\romannumeral0\XINT@div@prepare {#1}{#2}{#1}%
}%
-\def\XINT@irr@loop@d #1#2#3%
+\def\XINT@irr@loop@d #1#2%
{%
- \XINT@irr@loop@e #2\Z {#3}%
+ \XINT@irr@loop@e #2\Z
}%
\def\XINT@irr@loop@e #1#2\Z
{%
@@ -656,45 +731,42 @@
\def\xintJrr {\romannumeral0\xintjrr }%
\def\xintjrr
{%
- \expandafter\XINT@@bts
- \romannumeral0\expandafter\XINT@jrr@start
- \romannumeral0\xintrez
+ \expandafter\XINT@irr@putsign
+ \romannumeral0\expandafter\XINT@jrr
+ \romannumeral0\XINT@infrac
}%
-\def\XINT@jrr@start #1/#2[#3]%
+\def\XINT@jrr #1%
{%
- \ifcase\XINT@Sgn {#3}
+ \ifcase\XINT@Sgn {#1}
\expandafter\XINT@jrr@B
\or
\expandafter\XINT@jrr@A
\else
\expandafter\XINT@jrr@B
\fi
- {#3}{#1}{#2}%
+ {#1}%
}%
\def\XINT@jrr@A #1#2%
{%
- \expandafter \XINT@jrr@AC \expandafter
- {\romannumeral0\xint@dsh {#2}{-#1}}%
+ \expandafter \XINT@jrr@C
+ \romannumeral0\xint@dsh {#2}{-#1}\Z
}%
-\def\XINT@jrr@AC #1#2{\XINT@jrr@C #2\Z #1\Z }%
\def\XINT@jrr@B #1#2#3%
{%
- \expandafter \XINT@jrr@C \romannumeral0\xint@dsh {#3}{#1}\Z #2\Z
+ \expandafter \XINT@jrr@BC \expandafter
+ {\romannumeral0\xint@dsh {#3}{#1}}{#2}%
}%
-\def\XINT@jrr@C #1#2\Z #3#4\Z
+\def\XINT@jrr@BC #1#2{\XINT@jrr@C #2\Z {#1}}%
+\def\XINT@jrr@C #1#2\Z
{%
- \xint@UDsignsfork
- #1#3\dummy \XINT@jrr@minusminus
- #1-\dummy \XINT@jrr@minusplus
- #3-\dummy \XINT@jrr@plusminus
- --\dummy \XINT@jrr@plusplus
+ \xint@UDsignfork
+ #1\dummy \XINT@jrr@negative
+ -\dummy {\XINT@jrr@nonneg #1}%
\xint@UDkrof
- {#4}{#2}#3#1%
+ #2\Z
}%
-\def\XINT@jrr@minusminus #1#2#3#4{\XINT@jrr@D #1\Z #2\Z \space }%
-\def\XINT@jrr@minusplus #1#2#3#4{\XINT@jrr@D #3#1\Z #2\Z \XINT@opp }%
-\def\XINT@jrr@plusminus #1#2#3#4{\XINT@jrr@D #1\Z #4#2\Z \XINT@opp }%
-\def\XINT@jrr@plusplus #1#2#3#4{\XINT@jrr@D #3#1\Z #4#2\Z \space }%
+\def\XINT@jrr@negative #1\Z #2{\XINT@jrr@D #1\Z #2\Z \XINT@opp}%
+\def\XINT@jrr@nonneg #1\Z #2{\XINT@jrr@D #1\Z #2\Z \space}%
\def\XINT@jrr@D #1#2\Z #3#4\Z
{%
\xint@UDzerosfork
@@ -709,7 +781,7 @@
\space 00}%
\def\XINT@jrr@divisionbyzero #1#2#3#4#5#6{\expandafter\xintError:DivisionByZero
\space {#2}0}%
-\def\XINT@jrr@zero #1#2#3#4#5#6{ 0/1}%
+\def\XINT@jrr@zero #1#2#3#4#5#6{ 01}%
\def\XINT@jrr@nonzero@checkifone #1%
{%
\ifcase\XINT@isOne {#1}
@@ -753,11 +825,11 @@
\def\xinttrunc #1%
{%
\expandafter\expandafter\expandafter
- \xint@trunc
+ \XINT@trunc
\expandafter\expandafter\expandafter
{#1}%
}%
-\def\xint@trunc #1#2%
+\def\XINT@trunc #1#2%
{%
\expandafter\XINT@trunc@G
\romannumeral0\expandafter\XINT@trunc@A
@@ -766,11 +838,11 @@
\def\xintitrunc #1%
{%
\expandafter\expandafter\expandafter
- \xint@itrunc
+ \XINT@itrunc
\expandafter\expandafter\expandafter
{#1}%
}%
-\def\xint@itrunc #1#2%
+\def\XINT@itrunc #1#2%
{%
\expandafter\XINT@itrunc@G
\romannumeral0\expandafter\XINT@trunc@A
@@ -822,9 +894,9 @@
\def\XINT@trunc@minusplus #1#2#3{\xintquo {#1#2}{#3}\Z \xint@minus@andstop}%
\def\XINT@trunc@plusminus #1#2#3{\xintquo {#2}{#1#3}\Z \xint@minus@andstop}%
\def\XINT@trunc@plusplus #1#2#3#4{\xintquo {#1#3}{#2#4}\Z \space}%
-\def\XINT@itrunc@G #1\Z #2#3%
+\def\XINT@itrunc@G #1#2\Z #3#4%
{%
- \xint@zero #2\XINT@trunc@zero 0\xint@firstoftwo {#2#1}0%
+ \xint@zero #1\XINT@trunc@zero 0\xint@firstoftwo {#3#1#2}0%
}%
\def\XINT@trunc@G #1\Z #2#3%
{%
@@ -854,6 +926,76 @@
\expandafter #3\expandafter0\expandafter.%
\romannumeral0\XINT@dsx@zeroloop {#1}\Z {}#2%
}%
+\def\xintRound {\romannumeral0\xintround }%
+\def\xintiRound {\romannumeral0\xintiround }%
+\def\xintround #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@round
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@round
+{%
+ \expandafter\XINT@trunc@G\romannumeral0\XINT@round@A
+}%
+\def\xintiround #1%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@iround
+ \expandafter\expandafter\expandafter
+ {#1}%
+}%
+\def\XINT@iround
+{%
+ \expandafter\XINT@itrunc@G\romannumeral0\XINT@round@A
+}%
+\def\XINT@round@A #1#2%
+{%
+ \expandafter\XINT@round@B
+ \romannumeral0\expandafter\XINT@trunc@A
+ \romannumeral0\XINT@infrac {#2}{\the\numexpr #1+1\relax}{#1}%
+}%
+\def\XINT@round@B #1\Z
+{%
+ \expandafter\XINT@round@C
+ \romannumeral0\XINT@rord@main {}#1%
+ \xint@UNDEF
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@UNDEF
+ \Z
+}%
+\def\XINT@round@C #1%
+{%
+ \ifnum #1<5
+ \expandafter\XINT@round@Daa
+ \else
+ \expandafter\XINT@round@Dba
+ \fi
+}%
+\def\XINT@round@Daa #1%
+{%
+ \xint@z #1\XINT@round@Daz\Z \XINT@round@Da #1%
+}%
+\def\XINT@round@Daz\Z \XINT@round@Da \Z { 0\Z }%
+\def\XINT@round@Da #1\Z
+{%
+ \XINT@rord@main {}#1%
+ \xint@UNDEF
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@undef\xint@undef\xint@undef\xint@undef
+ \xint@UNDEF \Z
+}%
+\def\XINT@round@Dba #1%
+{%
+ \xint@z #1\XINT@round@Dbz\Z \XINT@round@Db #1%
+}%
+\def\XINT@round@Dbz\Z \XINT@round@Db \Z { 1\Z }%
+\def\XINT@round@Db #1\Z
+{%
+ \XINT@addm@A 0{}1000\W\X\Y\Z #1000\W\X\Y\Z \Z
+}%
\def\xintMul {\romannumeral0\xintmul }%
\def\xintmul #1%
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
index 24bd6ef2109..14d36771ab4 100644
--- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%% xintgcd: Euclidean algorithm with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -162,7 +162,7 @@
\fi
\expandafter\x\csname ver@xintgcd.sty\endcsname
\ProvidesPackage{xintgcd}%
- [2013/04/14 v1.03 Euclide algorithm with xint package (jfB)]%
+ [2013/04/25 v1.04 Euclide algorithm with xint package (jfB)]%
\def\xintGCD {\romannumeral0\xintgcd }%
\def\xintgcd #1%
{%
diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty
index 6cde51e7928..0412e9e17ef 100644
--- a/Master/texmf-dist/tex/generic/xint/xintseries.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
%%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
%% xintseries: Expandable partial sums with xint package
%% Copyright (C) 2013 by Jean-Francois Burnol
%%----------------------------------------------------------------
@@ -162,7 +162,7 @@
\fi
\expandafter\x\csname ver@xintseries.sty\endcsname
\ProvidesPackage{xintseries}%
- [2013/04/14 v1.03 Expandable partial sums with xint package (jfB)]%
+ [2013/04/25 v1.04 Expandable partial sums with xint package (jfB)]%
\def\xintSeries {\romannumeral0\xintseries }%
\def\xintseries #1#2%
{%
@@ -254,38 +254,130 @@
\xint@afterfi { 0[0]}%
\else
\xint@afterfi
- {\expandafter\XINT@powseries@loop@pre\expandafter
- {\romannumeral0\xintpow {#4}{#1}}{#1}{#4}{#2}{#3}%
- }%
+ {\XINT@powseries@loop@i {#3{#2}}{#1}{#2}{#3}{#4}}%
\fi
}%
-\def\XINT@powseries@loop@pre #1#2#3#4#5%
-{%
- \ifnum #4>#2 \else\XINT@powseries@dont@i \fi
- \expandafter\XINT@powseries@loop@i\expandafter
- {\the\numexpr #2+1\expandafter}\expandafter
- {\romannumeral0\xintmul {#5{#2}}{#1}}{#1}{#3}{#4}{#5}%
-}%
-\def\XINT@powseries@dont@i \fi\expandafter\XINT@powseries@loop@i
- {\fi \expandafter\XINT@powseries@dont@ii }%
-\def\XINT@powseries@dont@ii #1#2#3#4#5#6{ #2}%
\def\XINT@powseries@loop@i #1#2#3#4#5%
{%
- \ifnum #5>#1 \else \XINT@powseries@exit@i \fi
+ \ifnum #3>#2 \else\XINT@powseries@exit@i\fi
\expandafter\XINT@powseries@loop@ii\expandafter
- {\romannumeral0\xintmul {#3}{#4}}{#1}{#4}{#2}{#5}%
+ {\the\numexpr #3-1\expandafter}\expandafter
+ {\romannumeral0\xintmul {#1}{#5}}{#2}{#4}{#5}%
}%
-\def\XINT@powseries@loop@ii #1#2#3#4#5#6%
+\def\XINT@powseries@loop@ii #1#2#3#4%
{%
- \expandafter\XINT@powseries@loop@i\expandafter
- {\the\numexpr #2+1\expandafter}\expandafter
- {\romannumeral0\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
- {#1}{#3}{#5}{#6}%
+ \expandafter\XINT@powseries@loop@i\expandafter
+ {\romannumeral0\xintadd {#4{#1}}{#2}}{#3}{#1}{#4}%
+}%
+\def\XINT@powseries@exit@i\fi #1#2#3#4#5#6#7#8#9%
+{%
+ \fi \XINT@powseries@exit@ii #6{#7}%
}%
-\def\XINT@powseries@exit@i\fi \expandafter\XINT@powseries@loop@ii
- {\fi \expandafter\XINT@powseries@exit@ii }%
\def\XINT@powseries@exit@ii #1#2#3#4#5#6%
- {\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
+{%
+ \xintmul{\xintPow {#5}{#6}}{#4}%
+}%
+\def\xintPowerSeriesX {\romannumeral0\xintpowerseriesx }%
+\def\xintpowerseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@powseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@powseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@powseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@powseriesx@ii #1#2#3#4%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter\XINT@powseriesx@pre
+ \expandafter\expandafter\expandafter {#4}{#1}{#2}{#3}}%
+ \fi
+}%
+\def\XINT@powseriesx@pre #1#2#3#4%
+{%
+ \XINT@powseries@loop@i {#4{#3}}{#2}{#3}{#4}{#1}%
+}%
+\def\xintRationalSeries {\romannumeral0\xintratseries }%
+\def\xintratseries #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseries@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseries@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseries@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseries@ii #1#2#3#4%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\XINT@ratseries@loop {#2}{1}{#1}{#4}{#3}}%
+ \fi
+}%
+\def\XINT@ratseries@loop #1#2#3#4%
+{%
+ \ifnum #1>#3 \else\XINT@ratseries@exit@i\fi
+ \expandafter\XINT@ratseries@loop\expandafter
+ {\the\numexpr #1-1\expandafter}\expandafter
+ {\romannumeral0\xintadd {1}{\xintMul {#2}{#4{#1}}}}{#3}{#4}%
+}%
+\def\XINT@ratseries@exit@i\fi #1#2#3#4#5#6#7#8%
+{%
+ \fi \XINT@ratseries@exit@ii #6%
+}%
+\def\XINT@ratseries@exit@ii #1#2#3#4#5%
+{%
+ \XINT@ratseries@exit@iii #5%
+}%
+\def\XINT@ratseries@exit@iii #1#2#3#4%
+{%
+ \xintmul{#2}{#4}%
+}%
+\def\xintRationalSeriesX {\romannumeral0\xintratseriesx }%
+\def\xintratseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@ratseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@ratseriesx@ii #1#2#3#4#5%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0[0]}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter\XINT@ratseriesx@pre
+ \expandafter\expandafter\expandafter {#5}{#2}{#1}{#4}{#3}}%
+ \fi
+}%
+\def\XINT@ratseriesx@pre #1#2#3#4#5%
+{%
+ \XINT@ratseries@loop {#2}{1}{#3}{#4{#1}}{#5{#1}}%
+}%
\def\xintFxPtPowerSeries {\romannumeral0\xintfxptpowerseries }%
\def\xintfxptpowerseries #1#2%
{%
@@ -304,7 +396,7 @@
\def\XINT@fppowseries@ii #1#2#3#4#5%
{%
\ifnum #2<#1
- \xint@afterfi {\xinttrunc {#5}{0[0]}}%
+ \xint@afterfi { 0}%
\else
\xint@afterfi
{\expandafter\XINT@fppowseries@loop@pre\expandafter
@@ -343,6 +435,40 @@
\def\XINT@fppowseries@exit@ii #1#2#3#4#5#6#7%
{\xinttrunc {#7}%
{\xintiAdd {#4}{\xintiTrunc {#7}{\xintMul {#6{#2}}{#1}}}[-#7]}}%
+\def\xintFxPtPowerSeriesX {\romannumeral0\xintfxptpowerseriesx }%
+\def\xintfxptpowerseriesx #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@i
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@i #1#2%
+{%
+ \expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@ii
+ \expandafter\expandafter\expandafter
+ {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@ii #1#2#3#4#5%
+{%
+ \ifnum #2<#1
+ \xint@afterfi { 0}%
+ \else
+ \xint@afterfi
+ {\expandafter\expandafter\expandafter
+ \XINT@fppowseriesx@pre
+ \expandafter\expandafter\expandafter
+ {#4}{#1}{#2}{#3}{#5}%
+ }%
+ \fi
+}%
+\def\XINT@fppowseriesx@pre #1#2#3#4#5%
+{%
+ \expandafter\XINT@fppowseries@loop@pre\expandafter
+ {\romannumeral0\xinttrunc {#5}{\xintPow {#1}{#2}}}%
+ {#2}{#1}{#3}{#4}{#5}%
+}%
\XINT@series@restorecatcodes@endinput%
\endinput
%%