texlive[53168] Master: intcalc split from oberdiek (18dec19)

commits+karl at tug.org commits+karl at tug.org
Wed Dec 18 00:24:26 CET 2019


Revision: 53168
          http://tug.org/svn/texlive?view=revision&revision=53168
Author:   karl
Date:     2019-12-18 00:24:25 +0100 (Wed, 18 Dec 2019)
Log Message:
-----------
intcalc split from oberdiek (18dec19)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latex.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/intcalc/
    trunk/Master/texmf-dist/doc/latex/intcalc/README.md
    trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf
    trunk/Master/texmf-dist/source/latex/intcalc/
    trunk/Master/texmf-dist/source/latex/intcalc/intcalc.dtx
    trunk/Master/texmf-dist/tex/generic/intcalc/
    trunk/Master/texmf-dist/tex/generic/intcalc/intcalc.sty
    trunk/Master/tlpkg/tlpsrc/intcalc.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/intcalc/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/intcalc/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/intcalc/README.md	2019-12-17 23:24:25 UTC (rev 53168)
@@ -0,0 +1,7 @@
+# intcalc
+
+intcalc package for LaTeX
+
+This package provides expandable arithmetic operations
+with integers.
+


Property changes on: trunk/Master/texmf-dist/doc/latex/intcalc/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf	2019-12-17 23:23:06 UTC (rev 53167)
+++ trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf	2019-12-17 23:24:25 UTC (rev 53168)

Property changes on: trunk/Master/texmf-dist/doc/latex/intcalc/intcalc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/intcalc/intcalc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/intcalc/intcalc.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/intcalc/intcalc.dtx	2019-12-17 23:24:25 UTC (rev 53168)
@@ -0,0 +1,3286 @@
+% \iffalse meta-comment
+%
+% File: intcalc.dtx
+% Version: 2019/12/15 v1.3
+% Info: Expandable calculations with integers
+%
+% Copyright (C)
+%    2007 Heiko Oberdiek
+%    2016-2019 Oberdiek Package Support Group
+%    https://github.com/ho-tex/intcalc/issues
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. This version of this license is in
+%    https://www.latex-project.org/lppl/lppl-1-3c.txt
+% and the latest version of this license is in
+%    https://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% The Current Maintainers of this work are
+% Heiko Oberdiek and the Oberdiek Package Support Group
+% https://github.com/ho-tex/intcalc/issues
+%
+% The Base Interpreter refers to any `TeX-Format',
+% because some files are installed in TDS:tex/generic//.
+%
+% This work consists of the main source file intcalc.dtx
+% and the derived files
+%    intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv,
+%    intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex,
+%    intcalc-test4.tex.
+%
+% Distribution:
+%    CTAN:macros/latex/contrib/intcalc/intcalc.dtx
+%    CTAN:macros/latex/contrib/intcalc/intcalc.pdf
+%
+% Unpacking:
+%    (a) If intcalc.ins is present:
+%           tex intcalc.ins
+%    (b) Without intcalc.ins:
+%           tex intcalc.dtx
+%    (c) If you insist on using LaTeX
+%           latex \let\install=y\input{intcalc.dtx}
+%        (quote the arguments according to the demands of your shell)
+%
+% Documentation:
+%    (a) If intcalc.drv is present:
+%           latex intcalc.drv
+%    (b) Without intcalc.drv:
+%           latex intcalc.dtx; ...
+%    The class ltxdoc loads the configuration file ltxdoc.cfg
+%    if available. Here you can specify further options, e.g.
+%    use A4 as paper format:
+%       \PassOptionsToClass{a4paper}{article}
+%
+%    Programm calls to get the documentation (example):
+%       pdflatex intcalc.dtx
+%       makeindex -s gind.ist intcalc.idx
+%       pdflatex intcalc.dtx
+%       makeindex -s gind.ist intcalc.idx
+%       pdflatex intcalc.dtx
+%
+% Installation:
+%    TDS:tex/generic/intcalc/intcalc.sty
+%    TDS:doc/latex/intcalc/intcalc.pdf
+%    TDS:source/latex/intcalc/intcalc.dtx
+%
+%<*ignore>
+\begingroup
+  \catcode123=1 %
+  \catcode125=2 %
+  \def\x{LaTeX2e}%
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+         \ifx\csname processbatchFile\endcsname\relax\else1\fi
+         \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\Msg{************************************************************************}
+\Msg{* Installation}
+\Msg{* Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)}
+\Msg{************************************************************************}
+
+\keepsilent
+\askforoverwritefalse
+
+\let\MetaPrefix\relax
+\preamble
+
+This is a generated file.
+
+Project: intcalc
+Version: 2019/12/15 v1.3
+
+Copyright (C)
+   2007 Heiko Oberdiek
+   2016-2019 Oberdiek Package Support Group
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3c of this license or (at your option) any later
+version. This version of this license is in
+   https://www.latex-project.org/lppl/lppl-1-3c.txt
+and the latest version of this license is in
+   https://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+
+This work has the LPPL maintenance status "maintained".
+
+The Current Maintainers of this work are
+Heiko Oberdiek and the Oberdiek Package Support Group
+https://github.com/ho-tex/intcalc/issues
+
+
+The Base Interpreter refers to any `TeX-Format',
+because some files are installed in TDS:tex/generic//.
+
+This work consists of the main source file intcalc.dtx
+and the derived files
+   intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv,
+   intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex,
+   intcalc-test4.tex.
+
+\endpreamble
+\let\MetaPrefix\DoubleperCent
+
+\generate{%
+  \file{intcalc.ins}{\from{intcalc.dtx}{install}}%
+  \file{intcalc.drv}{\from{intcalc.dtx}{driver}}%
+  \usedir{tex/generic/intcalc}%
+  \file{intcalc.sty}{\from{intcalc.dtx}{package}}%
+}
+
+\catcode32=13\relax% active space
+\let =\space%
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{*     intcalc.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file `intcalc.drv'}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
+
+\endbatchfile
+%</install>
+%<*ignore>
+\fi
+%</ignore>
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{intcalc.drv}%
+  [2019/12/15 v1.3 Expandable calculations with integers (HO)]%
+\documentclass{ltxdoc}
+\usepackage{wasysym}
+\let\iint\relax
+\let\iiint\relax
+\usepackage[fleqn]{amsmath}
+
+\DeclareMathOperator{\opInv}{Inv}
+\DeclareMathOperator{\opAbs}{Abs}
+\DeclareMathOperator{\opSgn}{Sgn}
+\DeclareMathOperator{\opMin}{Min}
+\DeclareMathOperator{\opMax}{Max}
+\DeclareMathOperator{\opCmp}{Cmp}
+\DeclareMathOperator{\opInc}{Inc}
+\DeclareMathOperator{\opDec}{Dec}
+\DeclareMathOperator{\opAdd}{Add}
+\DeclareMathOperator{\opSub}{Sub}
+\DeclareMathOperator{\opShl}{Shl}
+\DeclareMathOperator{\opShr}{Shr}
+\DeclareMathOperator{\opMul}{Mul}
+\DeclareMathOperator{\opSqr}{Sqr}
+\DeclareMathOperator{\opFac}{Fac}
+\DeclareMathOperator{\opPow}{Pow}
+\DeclareMathOperator{\opDiv}{Div}
+\DeclareMathOperator{\opMod}{Mod}
+\DeclareMathOperator{\opInt}{Int}
+\DeclareMathOperator{\opOdd}{ifodd}
+
+\newcommand*{\Def}{%
+  \ensuremath{%
+    \mathrel{\mathop{:}}=%
+  }%
+}
+\newcommand*{\op}[1]{%
+  \textsf{#1}%
+}
+\usepackage{holtxdoc}[2011/11/22]
+\begin{document}
+  \DocInput{intcalc.dtx}%
+\end{document}
+%</driver>
+% \fi
+%
+%
+%
+% \GetFileInfo{intcalc.drv}
+%
+% \title{The \xpackage{intcalc} package}
+% \date{2019/12/15 v1.3}
+% \author{Heiko Oberdiek\thanks
+% {Please report any issues at \url{https://github.com/ho-tex/intcalc/issues}}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% This package provides expandable arithmetic operations
+% with integers.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Documentation}
+%
+% \subsection{Introduction}
+%
+% Package \xpackage{intcalc} defines arithmetic operations
+% that deal with integers. Integers mean numbers in \TeX.
+% The same restrictions apply, the range is limited to
+% [-2147483647, 2147483647].
+%
+% The operations have the form of macros that take one or
+% two integers as parameter and return the integer result.
+% The macro name is a three letter operation name prefixed
+% by the package name, e.g. \cs{intcalcAdd}|{10}{43}| returns
+% |53|.
+%
+% The macros are fully expandable, exactly two expansion
+% steps generate the result. Therefore the operations
+% may be used nearly everywhere in \TeX, even inside
+% \cs{number}, \cs{csname}, file names,  or other
+% expandable contexts.
+%
+% The package contains two implementations of the operations.
+% If \eTeX\ is detected then the macros are implemented
+% using its features (\cs{numexpr}). Otherwise the slower
+% implementation without \eTeX's help is choosen.
+%
+% \subsection{Conditions}
+%
+% \subsubsection{Preconditions}
+%
+% \begin{itemize}
+% \item
+%   Arguments can be anything that \TeX\ interprets as ``number''.
+%   Examples: plain numbers, count or length register, macros
+%   that expands to a number.
+% \item
+%   The arguments are limited to the range
+%   -2147483647 until 2147483647. These numbers belong to the range.
+%   Note that some operations
+%   have additionals restrictions to the range.
+% \item
+%   The argument may be expressions that \cs{numexpr}
+%   understands if \eTeX\ is available.
+% \item
+%   The resulting number must fit in the allowed range.
+% \end{itemize}
+%
+% \subsubsection{Postconditions}
+%
+% Additional properties of the macros apart from calculating
+% a correct result (of course \smiley):
+% \begin{itemize}
+% \item
+%   The macros are fully expandable. Thus they can
+%   be used inside \cs{edef}, \cs{csname}, after \cs{number},
+%   for example.
+% \item
+%   Furthermore exactly two expansion steps calculate the result.
+% \item
+%   The number consists of one optional minus sign and one to
+%   ten digits. The first digit is larger than zero for
+%   numbers that consists of more than one digit.
+%
+%   In short, the number format is exactly the same as
+%   \cs{number} generates. And the tokens (minus sign, digits)
+%   have catcode 12 (other).
+% \item
+%   Call by value is simulated. First the arguments are
+%   converted to numbers. Then these numbers are used
+%   in the calculations.
+%
+%   Remember that arguments
+%   may contain expensive macros or \eTeX\ expressions.
+%   This strategy avoids multiple evaluations of such
+%   arguments.
+% \end{itemize}
+%
+% \subsection{Error handling}
+%
+% There are two kinds of errors if a precondition is violated:
+% Some errors are detected by the macros, example: division by zero.
+% In this cases an undefined control sequence is called and causes
+% a TeX error message, example: \cs{IntCalcError:DivisionByZero}.
+% The name of the control sequence contains
+% the reason for the error. The \TeX\ error may be ignored.
+% Then the operation returns zero as result.
+% Because the macros are supposed to work in expandible contexts.
+% An traditional error message, however, is not expandable and
+% would break these contexts.
+%
+% If a number exceeds the range of -2147483647 until 2147483647, then
+% \TeX\ throws an error ``Number too big'' and recovers by
+% using biggest allowed value.
+% Example for the negative number -3000000000 is replaced
+% by -2147483647.
+%
+% \subsection{Operations}
+%
+% Some definition equations below use the function $\opInt$
+% that converts a real number to an integer. The number
+% is truncated that means rounding to zero:
+% \begin{gather*}
+%   \opInt(x) \Def
+%   \begin{cases}
+%     \lfloor x\rfloor & \text{if $x\geq0$}\\
+%     \lceil x\rceil & \text{otherwise}
+%   \end{cases}
+% \end{gather*}
+%
+% \subsubsection{\op{Num}}
+%
+% \begin{declcs}{intcalcNum} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcNum} converts its argument to a normalized integer
+% number without unnecessary leading zeros or signs.
+% The result matches the regular expression:
+%\begin{quote}
+%\begin{verbatim}
+%0|-?[1-9][0-9]*
+%\end{verbatim}
+%\end{quote}
+%
+% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}}
+%
+% \begin{declcs}{intcalcInv} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcInv} switches the sign.
+% \begin{gather*}
+%   \opInv(x) \Def -x
+% \end{gather*}
+%
+% \begin{declcs}{intcalcAbs} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcAbs} returns the absolute value
+% of integer \meta{x}.
+% \begin{gather*}
+%   \opAbs(x) \Def \vert x\vert
+% \end{gather*}
+%
+% \begin{declcs}{intcalcSgn} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcSgn} encodes the sign of \meta{x} as number.
+% \begin{gather*}
+%   \opSgn(x) \Def
+%   \begin{cases}
+%     -1& \text{if $x<0$}\\
+%      0& \text{if $x=0$}\\
+%      1& \text{if $x>0$}
+%   \end{cases}
+% \end{gather*}
+% These return values can easily be distinguished by \cs{ifcase}:
+%\begin{quote}
+%\begin{verbatim}
+%\ifcase\intcalcSgn{<x>}
+%  $x=0$
+%\or
+%  $x>0$
+%\else
+%  $x<0$
+%\fi
+%\end{verbatim}
+%\end{quote}
+%
+% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}}
+%
+% \begin{declcs}{intcalcMin} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcMin} returns the smaller of the two integers.
+% \begin{gather*}
+%   \opMin(x,y) \Def
+%   \begin{cases}
+%     x & \text{if $x<y$}\\
+%     y & \text{otherwise}
+%   \end{cases}
+% \end{gather*}
+%
+% \begin{declcs}{intcalcMax} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcMax} returns the larger of the two integers.
+% \begin{gather*}
+%   \opMax(x,y) \Def
+%   \begin{cases}
+%     x & \text{if $x>y$}\\
+%     y & \text{otherwise}
+%   \end{cases}
+% \end{gather*}
+%
+% \begin{declcs}{intcalcCmp} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcCmp} encodes the comparison result as number:
+% \begin{gather*}
+%   \opCmp(x,y) \Def
+%   \begin{cases}
+%     -1 & \text{if $x<y$}\\
+%      0 & \text{if $x=y$}\\
+%      1 & \text{if $x>y$}
+%   \end{cases}
+% \end{gather*}
+% These values can be distinguished by \cs{ifcase}:
+%\begin{quote}
+%\begin{verbatim}
+%\ifcase\intcalcCmp{<x>}{<y>}
+%  $x=y$
+%\or
+%  $x>y$
+%\else
+%  $x<y$
+%\fi
+%\end{verbatim}
+%\end{quote}
+%
+% \subsubsection{\op{Inc}, \op{Dec}, \op{Add}, \op{Sub}}
+%
+% \begin{declcs}{intcalcInc} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcInc} increments \meta{x} by one.
+% \begin{gather*}
+%   \opInc(x) \Def x + 1
+% \end{gather*}
+%
+% \begin{declcs}{intcalcDec} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcDec} decrements \meta{x} by one.
+% \begin{gather*}
+%   \opDec(x) \Def x - 1
+% \end{gather*}
+%
+% \begin{declcs}{intcalcAdd} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcAdd} adds the two numbers.
+% \begin{gather*}
+%   \opAdd(x, y) \Def x + y
+% \end{gather*}
+%
+% \begin{declcs}{intcalcSub} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcSub} calculates the difference.
+% \begin{gather*}
+%   \opSub(x, y) \Def x - y
+% \end{gather*}
+%
+% \subsubsection{\op{Shl}, \op{Shr}}
+%
+% \begin{declcs}{intcalcShl} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcShl} implements shifting to the left that
+% means the number is multiplied by two. Overflow is possible.
+% The sign is preserved.
+% \begin{gather*}
+%   \opShl(x) \Def x*2
+% \end{gather*}
+%
+% \begin{declcs}{intcalcShr} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcShr} implements shifting to the right.
+% That is equivalent to an integer division by two.
+% The sign is preserved.
+% \begin{gather*}
+%   \opShr(x) \Def \opInt(x/2)
+% \end{gather*}
+%
+% \subsubsection{\op{Mul}, \op{Sqr}, \op{Fac}, \op{Pow}}
+%
+% \begin{declcs}{intcalcMul} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcMul} calculates the product of
+% \meta{x} and \meta{y}.
+% \begin{gather*}
+%   \opMul(x,y) \Def x*y
+% \end{gather*}
+%
+% \begin{declcs}{intcalcSqr} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcSqr} returns the square product.
+% \begin{gather*}
+%   \opSqr(x) \Def x^2
+% \end{gather*}
+%
+% \begin{declcs}{intcalcFac} \M{x}
+% \end{declcs}
+% Macro \cs{intcalcFac} returns the factorial of \meta{x}.
+% Negative numbers are not permitted.
+% \begin{gather*}
+%   \opFac(x) \Def x!\qquad\text{for $x\geq0$}
+% \end{gather*}
+% ($0! = 1$)
+%
+% \begin{declcs}{intcalcPow} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcPow} calculates the value of \meta{x} to the
+% power of \meta{y}. The error ``division by zero'' is thrown
+% if \meta{x} is zero and \meta{y} is negative.
+% permitted:
+% \begin{gather*}
+%   \opPow(x,y) \Def
+%   \opInt(x^y)\qquad\text{for $x\neq0$ or $y\geq0$}
+% \end{gather*}
+% ($0^0 = 1$)
+%
+% \subsubsection{\op{Div}, \op{Mod}}
+%
+% \begin{declcs}{intcalcDiv} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcDiv} performs an integer division.
+% Argument \meta{y} must not be zero.
+% \begin{gather*}
+%   \opDiv(x,y) \Def \opInt(x/y)\qquad\text{for $y\neq0$}
+% \end{gather*}
+%
+% \begin{declcs}{intcalcMod} \M{x} \M{y}
+% \end{declcs}
+% Macro \cs{intcalcMod} gets the remainder of the integer
+% division. The sign follows the divisor \meta{y}.
+% Argument \meta{y} must not be zero.
+% \begin{gather*}
+%   \opMod(x,y) \Def x\mathrel{\%}y\qquad\text{for $y\neq0$}
+% \end{gather*}
+% The result ranges:
+% \begin{gather*}
+%   -\vert y\vert < \opMod(x,y) \leq 0\qquad\text{for $y<0$}\\
+%   0 \leq \opMod(x,y) < y\qquad\text{for $y\geq0$}
+% \end{gather*}
+%
+% \subsection{Interface for programmer}
+%
+% If the programmer can ensure some more properties about
+% the arguments of the operations, then the following
+% macros are a little more efficient.
+%
+% In general numbers must obey the following constraints:
+% \begin{itemize}
+% \item Plain number: digit tokens only, no command tokens.
+% \item Non-negative. Signs are forbidden.
+% \item Arguments and the result must fit in range |0..2147483647|.
+% \item Delimited by exclamation mark. Curly braces
+%       around the number are not allowed and will
+%       break the code.
+% \end{itemize}
+%
+% \begin{declcs}{IntCalcInc} \meta{number} |!|
+% \end{declcs}
+% Incrementation, range: |0..2147483646|.
+%
+% \begin{declcs}{IntCalcDec} \meta{number} |!|
+% \end{declcs}
+% Decrementation, range: |1..2147483647|.
+%
+% \begin{declcs}{IntCalcAdd} \meta{number A} |!| \meta{number B} |!|
+% \end{declcs}
+% Addition, $A\geq B$.
+%
+% \begin{declcs}{IntCalcSub} \meta{number A} |!| \meta{number B} |!|
+% \end{declcs}
+% Subtraction, $A\geq B$.
+%
+% \begin{declcs}{IntCalcShl} \meta{number} |!|
+% \end{declcs}
+% Left shift (multiplication with two), range: |0..1073741823|.
+%
+% \begin{declcs}{IntCalcShr} \meta{number} |!|
+% \end{declcs}
+% Right shift (integer division by two).
+%
+% \begin{declcs}{IntCalcMul} \meta{number A} |!| \meta{number B} |!|
+% \end{declcs}
+% Multiplication, $A\geq B$.
+%
+% \begin{declcs}{IntCalcDiv} \meta{number A} |!| \meta{number B} |!|
+% \end{declcs}
+% Division operation.
+%
+% \begin{declcs}{IntCalcMod} \meta{number A} |!| \meta{number B} |!|
+% \end{declcs}
+% Modulo operation.
+%
+%
+% \StopEventually{
+% }
+%
+% \section{Implementation}
+%
+%    \begin{macrocode}
+%<*package>
+%    \end{macrocode}
+%
+% \subsection{Reload check and package identification}
+%    Reload check, especially if the package is not used with \LaTeX.
+%    \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode35=6 % #
+  \catcode39=12 % '
+  \catcode44=12 % ,
+  \catcode45=12 % -
+  \catcode46=12 % .
+  \catcode58=12 % :
+  \catcode64=11 % @
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \expandafter\let\expandafter\x\csname ver at intcalc.sty\endcsname
+  \ifx\x\relax % plain-TeX, first loading
+  \else
+    \def\empty{}%
+    \ifx\x\empty % LaTeX, first loading,
+      % variable is initialized, but \ProvidesPackage not yet seen
+    \else
+      \expandafter\ifx\csname PackageInfo\endcsname\relax
+        \def\x#1#2{%
+          \immediate\write-1{Package #1 Info: #2.}%
+        }%
+      \else
+        \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
+      \fi
+      \x{intcalc}{The package is already loaded}%
+      \aftergroup\endinput
+    \fi
+  \fi
+\endgroup%
+%    \end{macrocode}
+%    Package identification:
+%    \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode35=6 % #
+  \catcode39=12 % '
+  \catcode40=12 % (
+  \catcode41=12 % )
+  \catcode44=12 % ,
+  \catcode45=12 % -
+  \catcode46=12 % .
+  \catcode47=12 % /
+  \catcode58=12 % :
+  \catcode64=11 % @
+  \catcode91=12 % [
+  \catcode93=12 % ]
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \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 at intcalc.sty\endcsname
+\ProvidesPackage{intcalc}%
+  [2019/12/15 v1.3 Expandable calculations with integers (HO)]%
+%    \end{macrocode}
+%
+% \subsection{Catcodes}
+%
+%    \begin{macrocode}
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \catcode64=11 % @
+  \def\x{\endgroup
+    \expandafter\edef\csname InCa at AtEnd\endcsname{%
+      \endlinechar=\the\endlinechar\relax
+      \catcode13=\the\catcode13\relax
+      \catcode32=\the\catcode32\relax
+      \catcode35=\the\catcode35\relax
+      \catcode61=\the\catcode61\relax
+      \catcode64=\the\catcode64\relax
+      \catcode123=\the\catcode123\relax
+      \catcode125=\the\catcode125\relax
+    }%
+  }%
+\x\catcode61\catcode48\catcode32=10\relax%
+\catcode13=5 % ^^M
+\endlinechar=13 %
+\catcode35=6 % #
+\catcode64=11 % @
+\catcode123=1 % {
+\catcode125=2 % }
+\def\TMP at EnsureCode#1#2{%
+  \edef\InCa at AtEnd{%
+    \InCa at AtEnd
+    \catcode#1=\the\catcode#1\relax
+  }%
+  \catcode#1=#2\relax
+}
+\TMP at EnsureCode{33}{12}% !
+\TMP at EnsureCode{40}{12}% (
+\TMP at EnsureCode{41}{12}% )
+\TMP at EnsureCode{42}{12}% *
+\TMP at EnsureCode{43}{12}% +
+\TMP at EnsureCode{45}{12}% -
+\TMP at EnsureCode{47}{12}% /
+\TMP at EnsureCode{58}{11}% : (letter!)
+\TMP at EnsureCode{60}{12}% <
+\TMP at EnsureCode{62}{12}% >
+\TMP at EnsureCode{63}{14}% ? (comment!)
+\edef\InCa at AtEnd{\InCa at AtEnd\noexpand\endinput}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname InCa at TestMode\endcsname\relax
+\else
+  \catcode63=9 % ? (ignore)
+\fi
+? \let\InCa@@TestMode\InCa at TestMode
+%    \end{macrocode}
+%
+% \subsection{Macros independent of \eTeX}
+%
+% \subsubsection{\op{Abs}, \op{Sgn}}
+%
+%    \begin{macro}{\InCa at Abs}
+%    \begin{macrocode}
+\def\InCa at Abs#1#2!{%
+  \ifx#1-%
+    #2%
+  \else
+    #1#2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at Sgn}
+%    \begin{macrocode}
+\def\InCa at Sgn#1#2!{%
+  \ifx#1-%
+    -1%
+  \else
+    \ifx#10%
+      0%
+    \else
+      1%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}}
+%
+%    \begin{macro}{\InCa at Min}
+%    \begin{macrocode}
+\def\InCa at Min#1!#2!{%
+  \ifnum#1<#2 %
+    #1%
+  \else
+    #2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at Max}
+%    \begin{macrocode}
+\def\InCa at Max#1!#2!{%
+  \ifnum#1>#2 %
+    #1%
+  \else
+    #2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at Cmp}
+%    \begin{macrocode}
+\def\InCa at Cmp#1!#2!{%
+  \ifnum#1=#2 %
+    0%
+  \else
+    \ifnum#1<#2 %
+      -%
+    \fi
+    1%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Fac}}
+%
+%    \begin{macro}{\InCa at Fac}
+%    It does not make much sense to calculate the
+%    faculty by an general algorithm. The allowed
+%    range of arguments is too low because of the
+%    limited integer domain.
+%    \begin{macrocode}
+\def\InCa at Fac#1!{%
+  \ifcase#1 1% 0!
+  \or 1% 1!
+  \or 2% 2!
+  \or 6% 3!
+  \or 24% 4!
+  \or 120% 5!
+  \or 720% 6!
+  \or 5040% 7!
+  \or 40320% 8!
+  \or 362880% 9!
+  \or 3628800% 10!
+  \or 39916800% 11!
+  \or 479001600% 12!
+  \else
+    \ifnum#1<\z@
+      0\IntCalcError:FacNegative%
+    \else
+      0\IntCalcError:FacOverflow%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsection{Implementation based on \eTeX}
+%
+%    Only \cs{numexpr} is used from \eTeX.
+%    \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname numexpr\endcsname\relax
+\else
+%    \end{macrocode}
+%
+% \subsubsection{\op{Num}}
+%
+%    \begin{macro}{\intcalcNum}
+%    \begin{macrocode}
+  \def\intcalcNum#1{%
+    \the\numexpr#1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}}
+%
+%    \begin{macro}{\intcalcInv}
+%    \begin{macrocode}
+  \def\intcalcInv#1{%
+    \number-\intcalcNum{#1} %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcAbs}
+%    \begin{macrocode}
+  \def\intcalcAbs#1{%
+    \number\expandafter\InCa at Abs\the\numexpr#1! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcSgn}
+%    \begin{macrocode}
+  \def\intcalcSgn#1{%
+    \number\expandafter\InCa at Sgn\the\numexpr#1! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}}
+%
+%    \begin{macro}{\intcalcMin}
+%    \begin{macrocode}
+  \def\intcalcMin#1#2{%
+    \number\expandafter\InCa at Min
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcMax}
+%    \begin{macrocode}
+  \def\intcalcMax#1#2{%
+    \number\expandafter\InCa at Max
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcCmp}
+%    \begin{macrocode}
+  \def\intcalcCmp#1#2{%
+    \number\expandafter\InCa at Cmp
+    \the\numexpr#1\expandafter!\the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Inc}, \op{Dec}}
+%
+%    \begin{macro}{\intcalcInc}
+%    \begin{macrocode}
+  \def\intcalcInc#1{%
+    \the\numexpr#1+1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcDec}
+%    \begin{macrocode}
+  \def\intcalcDec#1{%
+    \the\numexpr#1-1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\IntCalcInc}
+%    \begin{macrocode}
+  \def\IntCalcInc#1!{%
+    \the\numexpr#1+1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcDec}
+%    \begin{macrocode}
+  \def\IntCalcDec#1!{%
+    \the\numexpr#1-1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Add}, \op{Sub}}
+%
+%    \begin{macro}{\intcalcAdd}
+%    \begin{macrocode}
+  \def\intcalcAdd#1#2{%
+    \the\numexpr#1+(#2)\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcSub}
+%    \begin{macrocode}
+  \def\intcalcSub#1#2{%
+    \the\numexpr#1-(#2)\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\IntCalcAdd}
+%    \begin{macrocode}
+  \def\IntCalcAdd#1!#2!{%
+    \the\numexpr#1+#2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\IntCalcSub}
+%    \begin{macrocode}
+  \def\IntCalcSub#1!#2!{%
+    \the\numexpr#1-#2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Shl}, \op{Shr}}
+%
+%    \begin{macro}{\intcalcShl}
+%    \begin{macrocode}
+  \def\intcalcShl#1{%
+    \the\numexpr(#1)*2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcShr}
+%    \begin{macrocode}
+  \def\intcalcShr#1{%
+    \number\expandafter\InCa at Shr\the\numexpr#1! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcShl}
+%    \begin{macrocode}
+  \def\IntCalcShl#1!{%
+    \the\numexpr#1*2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\IntCalcShr}
+%    \begin{macrocode}
+  \def\IntCalcShr#1!{%
+    \the\numexpr\ifodd#1 (#1-1)\else#1\fi/2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Shr}
+%    \begin{macrocode}
+  \def\InCa at Shr#1#2!{%
+    \ifx#1-%
+      -\InCa at Shr#2!%
+    \else
+      \ifodd#1#2 %
+        \the\numexpr(#1#2-1)/2\relax
+      \else
+        \the\numexpr#1#2/2\relax
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Mul}, \op{Sqr}, \op{Fac}}
+%
+%    \begin{macro}{\intcalcMul}
+%    \begin{macrocode}
+  \def\intcalcMul#1#2{%
+    \the\numexpr(#1)*(#2)\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcMul}
+%    \begin{macrocode}
+  \def\IntCalcMul#1!#2!{%
+    \the\numexpr#1*#2\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcSqr}
+%    \begin{macrocode}
+  \def\intcalcSqr#1{%
+    \number\expandafter\InCa at Sqr\the\numexpr#1! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Sqr}
+%    \begin{macrocode}
+  \def\InCa at Sqr#1!{%
+    \the\numexpr#1*#1\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcFac}
+%    \begin{macrocode}
+  \def\intcalcFac#1{%
+    \number\expandafter\InCa at Fac\the\numexpr#1! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Pow}}
+%
+%    \begin{macro}{\intcalcPow}
+%    \begin{macrocode}
+  \def\intcalcPow#1#2{%
+    \number\expandafter\InCa at Pow
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Pow}
+%    \begin{macrocode}
+  \def\InCa at Pow#1#2!#3#4!{%
+    \ifcase#3#4 % power = 0
+      1%
+    \or % power = 1
+      #1#2%
+    \or % power = 2
+      \the\numexpr#1#2*#1#2\relax
+    \else
+      \ifcase#1#2 % basis = 0, power <> 0
+        0%
+        \ifx#3-% power < 0
+          0\IntCalcError:DivisionByZero%
+        \fi
+      \or
+        1% basis = 1
+      \else
+        \ifnum#1#2=\m at ne % basis = -1
+          \ifodd#3#4 %
+            -%
+          \fi
+          1%
+        \else % |basis| > 1
+          \ifx#3-% power < 0
+            0%
+          \else % power > 2
+            \InCa at PowRec#1#2!#3#4!1!%
+          \fi
+        \fi
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at PowRec}
+%\begin{quote}
+%\begin{verbatim}
+%Pow(b, p) {
+%  PowRec(b, p, 1)
+%}
+%PowRec(b, p, r) {
+%  if p == 1 then
+%    return r*b
+%  else
+%    ifodd p then
+%      return PowRec(b*b, (p-1)/2, r*b) % p div 2 = (p-1)/2
+%    else
+%      return PowRec(b*b, (p-1)/2, r)
+%    fi
+%  fi
+%}
+%\end{verbatim}
+%\end{quote}
+%    \begin{macrocode}
+  \def\InCa at PowRec#1!#2!#3!{%
+    \ifnum#2=\@ne
+      \the\numexpr#1*#3\relax
+    \else
+      \ifodd#2 %
+        \expandafter\InCa at PowRec
+        \the\numexpr#1*#1\expandafter!%
+        \the\numexpr(#2-1)/2\expandafter!%
+        \the\numexpr#1*#3\expandafter\expandafter\expandafter!%
+      \else
+        \expandafter\InCa at PowRec
+        \the\numexpr#1*#1\expandafter!%
+        \the\numexpr(#2-1)/2\expandafter!%
+        \number#3\expandafter\expandafter\expandafter!%
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Div}, \op{Mod}}
+%
+%    \TeX's \cs{divide} truncates,
+%    \eTeX's \cs{numexpr} rounds the result of a division.
+%    The rounding method is called ``Symmetric Arithmetic Rounding''
+%    or ``Round-Half-Up'' (``Kaufm\"annisches Runden'' in German):
+%    \begin{quote}
+%    | 1 =  3 divide 2 =  1.5 = numexpr  3/2 =  2|\\
+%    |-1 = -3 divide 2 = -1.5 = numexpr -3/2 = -2|
+%    \end{quote}
+%    Macro \cs{intcalcDiv} follows \TeX\ and truncates.
+%    The calculation is done by the following formula:
+%    \begin{gather}
+%      \opDiv(X,Y) = (X - (Y-1)/2)/Y\qquad\text{for $X, Y > 0$}
+%    \end{gather}
+%    The operator `/' is \cs{numexpr}'s division.
+%    \begin{macro}{\intcalcDiv}
+%    \begin{macrocode}
+  \def\intcalcDiv#1#2{%
+    \number\expandafter\InCa at Div
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Div}
+%    \begin{macrocode}
+  \def\InCa at Div#1!#2!{%
+    \ifcase#2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \expandafter\InCa@@Div
+        \romannumeral 0%
+        \ifnum#1<\z@
+          \expandafter-\number-#1%
+        \else
+          \expandafter+\number#1%
+        \fi
+        \expandafter!%
+        \romannumeral 0%
+        \ifnum#2<\z@
+          \expandafter-\number-#2%
+        \else
+          \expandafter+\number#2%
+        \fi
+        !%
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcDiv}
+%    \begin{macrocode}
+  \def\InCa at Temp#1{%
+    \def\IntCalcDiv##1!##2!{%
+      \number
+      \ifcase##2 %
+        0\IntCalcError:DivisionByZero%
+      \else
+        \ifcase##1 %
+          0%
+        \else
+          \the\numexpr(##1-(##2-1)/2)/##2\relax
+        \fi
+      \fi
+      #1%
+    }%
+  }%
+  \InCa at Temp{ }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@Div}
+%    \begin{macrocode}
+  \def\InCa@@Div#1#2!#3#4!{%
+    #1#3%
+    \the\numexpr(#2-(#4-1)/2)/#4\relax
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcMod}
+%    \begin{macrocode}
+  \def\intcalcMod#1#2{%
+    \number\expandafter\InCa at Mod
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Mod}
+%    \begin{macrocode}
+  \def\InCa at Mod#1!#2!{%
+    \ifcase#2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \expandafter\InCa@@Mod
+        \romannumeral 0%
+        \ifnum#1<\z@
+          \expandafter-\number-#1%
+        \else
+          \expandafter+\number#1%
+        \fi
+        \expandafter!%
+        \romannumeral 0%
+        \ifnum#2<\z@
+          \expandafter-\number-#2%
+        \else
+          \expandafter+\number#2%
+        \fi
+        !%
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcMod}
+%    \begin{macrocode}
+  \def\InCa at Temp#1{%
+    \def\IntCalcMod##1!##2!{%
+      \number
+      \ifcase##2 %
+        0\IntCalcError:DivisionByZero%
+      \else
+        \ifcase##1 %
+          0%
+        \else
+          \the\numexpr##1-(##1-(##2-1)/2)/##2*##2\relax
+        \fi
+      \fi
+      #1%
+    }%
+  }%
+  \InCa at Temp{ }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@Mod}
+%    \begin{macrocode}
+  \def\InCa@@Mod#1#2!#3#4!{%
+    \if#3+%
+      \if#1+%
+        \the\numexpr#2-\InCa@@Div+#2!+#4!*#4\relax
+      \else
+        \expandafter\InCa at ModX
+        \the\numexpr-#2+\InCa@@Div+#2!+#4!*#4!#4!%
+      \fi
+    \else
+      -%
+      \if#1+%
+        \expandafter\InCa at ModX
+        \the\numexpr-#2+\InCa@@Div+#2!+#4!*#4!#4!%
+      \else
+        \the\numexpr#2-\InCa@@Div+#2!+#4!*#4\relax
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ModX}
+%    \begin{macrocode}
+  \def\InCa at ModX#1!#2!{%
+    \ifcase#1 %
+      0%
+    \else
+      \the\numexpr#1+#2\relax
+    \fi
+  }%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macrocode}
+  \expandafter\InCa at AtEnd
+\fi%
+%    \end{macrocode}
+%
+% \subsection{Implementation without \eTeX}
+%
+% \subsubsection{\op{Num}}
+%
+%    \begin{macro}{\intcalcNum}
+%    \begin{macrocode}
+\def\intcalcNum#1{%
+  \number\expandafter\InCa at FirstOfOne\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}}
+%
+%    \begin{macro}{\intcalcInv}
+%    \begin{macrocode}
+\def\intcalcInv#1{%
+  \number\expandafter\InCa at FirstOfOne\number-#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at FirstOfOne}
+%    \begin{macrocode}
+\def\InCa at FirstOfOne#1!{#1}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcAbs}
+%    \begin{macrocode}
+\def\intcalcAbs#1{%
+  \number\expandafter\InCa at Abs\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcSgn}
+%    \begin{macrocode}
+\def\intcalcSgn#1{%
+  \number\expandafter\InCa at Sgn\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}}
+%
+%    \begin{macro}{\intcalcMin}
+%    \begin{macrocode}
+\def\intcalcMin#1#2{%
+  \number\expandafter\InCa at Min
+  \number\number#1\expandafter!\number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcMax}
+%    \begin{macrocode}
+\def\intcalcMax#1#2{%
+  \number\expandafter\InCa at Max
+  \number\number#1\expandafter!\number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcCmp}
+%    \begin{macrocode}
+\def\intcalcCmp#1#2{%
+  \number\expandafter\InCa at Cmp
+  \number\number#1\expandafter!\number#2! %
+}%
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Inc}, \op{Dec}}
+%
+%    \begin{macro}{\intcalcInc}
+%    \begin{macrocode}
+\def\intcalcInc#1{%
+  \number\expandafter\InCa at IncSwitch\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at IncSwitch}
+%    \begin{macrocode}
+\def\InCa at IncSwitch#1#2!{%
+  \ifx#1-%
+    -%
+    \csname InCa at Empty%
+    \InCa at Dec#2!%
+  \else
+    \csname InCa at Empty%
+    \InCa at Inc#1#2!%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\intcalcDec}
+%    \begin{macrocode}
+\def\intcalcDec#1{%
+  \number\expandafter\InCa at DecSwitch\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DecSwitch}
+%    \begin{macrocode}
+\def\InCa at DecSwitch#1#2!{%
+  \ifx#1-%
+    -%
+    \csname InCa at Empty%
+    \expandafter\InCa at Inc#2!%
+  \else
+    \ifx#10%
+      -1%
+    \else
+      \csname InCa at Empty%
+      \InCa at Dec#1#2!%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\IntCalcInc}
+%    \begin{macrocode}
+\def\IntCalcInc#1!{%
+  \number\csname InCa at Empty\InCa at Inc#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcDec}
+%    \begin{macrocode}
+\def\IntCalcDec#1!{%
+  \number\csname InCa at Empty\InCa at Dec#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at Inc}
+%    \begin{macrocode}
+\def\InCa at Inc#1#2{%
+  \ifx#2!%
+    \csname InCa at IncDigit#1\endcsname1%
+  \else
+    \csname InCa at IncDigit#1%
+    \expandafter\InCa at Inc\expandafter#2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at IncDigit[0-8]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at IncDigit#1\endcsname##1{%
+    \endcsname
+    0%
+    \ifcase##1 %
+      #1%
+    \else
+      #2%
+    \fi
+  }%
+}
+\InCa at Temp 01
+\InCa at Temp 12
+\InCa at Temp 23
+\InCa at Temp 34
+\InCa at Temp 45
+\InCa at Temp 56
+\InCa at Temp 67
+\InCa at Temp 78
+\InCa at Temp 89
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at IncDigit9}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at IncDigit9\endcsname#1{%
+  \expandafter\endcsname
+  \ifcase#1 %
+    09%
+  \else
+    10%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at Dec}
+%    \begin{macrocode}
+\def\InCa at Dec#1#2{%
+  \ifx#2!%
+    \csname InCa at DecDigit#1\endcsname1%
+  \else
+    \csname InCa at DecDigit#1%
+    \expandafter\InCa at Dec\expandafter#2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DecDigit[1-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at DecDigit#1\endcsname##1{%
+    \endcsname
+    0%
+    \ifcase##1 %
+      #1%
+    \else
+      #2%
+    \fi
+  }%
+}
+\InCa at Temp 98
+\InCa at Temp 87
+\InCa at Temp 76
+\InCa at Temp 65
+\InCa at Temp 54
+\InCa at Temp 43
+\InCa at Temp 32
+\InCa at Temp 21
+\InCa at Temp 10
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DecDigit0}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at DecDigit0\endcsname#1{%
+  \expandafter\endcsname
+  \ifcase#1 %
+    00%
+  \else
+    19%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Add}, \op{Sub}}
+%
+%    \begin{macro}{\intcalcAdd}
+%    \begin{macrocode}
+\def\intcalcAdd#1#2{%
+  \number
+    \expandafter\InCa at AddSwitch
+    \number\number#1\expandafter!%
+    \number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\intcalcSub}
+%    \begin{macrocode}
+\def\intcalcSub#1#2{%
+  \number
+    \expandafter\InCa at AddSwitch
+    \number\number#1\expandafter!%
+    \number-\number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at AddSwitch}
+%    Decision table for \cs{InCa at AddSwitch}.
+%    The sign of negative numbers can be removed
+%    by a simple \cs{@gobble}
+%    instead of the more expensive |\number-|.
+%    \begin{quote}
+%    \begin{tabular}[t]{@{}|l|l|l|l|l|@{}}
+%      \hline
+%      $x<0$ & $y<0$ & $ x< y$ & $-$ & $\opAdd(-x,-y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opAdd(-y,-x)$\\
+%      \cline{2-5}
+%            & else  & $-x> y$ & $-$ & $\opSub(-x, y)$\\
+%      \cline{3-5}
+%            &       & else    & $+$ & $\opSub( y,-x)$\\
+%      \hline
+%      else  & $y<0$ & $ x>-y$ & $+$ & $\opSub( x,-y)$\\
+%      \cline{3-5}
+%            &       & else    & $-$ & $\opSub(-y, x)$\\
+%      \cline{2-5}
+%            & else  & $ x> y$ & $+$ & $\opAdd( x, y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opAdd( y, x)$\\
+%      \hline
+%    \end{tabular}
+%    \end{quote}
+%    \begin{macrocode}
+\def\InCa at AddSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      -%
+      \ifnum#1<#2 %
+        \expandafter\InCa at Add\number-#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Add\number-#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \else
+      \ifnum-#1>#2 %
+        -%
+        \expandafter\InCa at Sub\@gobble#1!#2!%
+      \else
+        \expandafter\InCa at Sub\number#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \fi
+  \else
+    \ifnum#2<\z@
+      \ifnum#1>-#2 %
+        \expandafter\InCa at Sub\number#1\expandafter!%
+        \@gobble#2!%
+      \else
+        -%
+        \expandafter\InCa at Sub\@gobble#2!#1!%
+      \fi
+    \else
+      \ifnum#1>#2 %
+        \InCa at Add#1!#2!%
+      \else
+        \InCa at Add#2!#1!%
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcAdd}
+%    \begin{macrocode}
+\def\IntCalcAdd#1!#2!{%
+  \number\InCa at Add#1!#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcSub}
+%    \begin{macrocode}
+\def\IntCalcSub#1!#2!{%
+  \number\InCa at Sub#1!#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Space}
+%    \begin{macrocode}
+\begingroup
+  \def\x#1{\endgroup
+    \let\InCa at Space= #1%
+  }%
+\x{ }
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Add}
+%    \begin{macrocode}
+\def\InCa at Add#1!#2!{%
+  \ifcase#2 %
+    #1%
+  \else
+    \InCa@@Add#1!#2!000000000\InCa at Space
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Sub}
+%    \begin{macrocode}
+\def\InCa at Sub#1!#2!{%
+  \ifnum#1=#2 %
+    0%
+  \else
+    \InCa@@Sub#1!#2!000000000\InCa at Space
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@Add}
+%    \begin{macrocode}
+\def\InCa@@Add#1!#2#3!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \@ReturnAfterElseFi{%
+      \InCa@@@Add!!#1!#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@Add#1!#3!#2%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@Sub}
+%    \begin{macrocode}
+\def\InCa@@Sub#1!#2#3!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \@ReturnAfterElseFi{%
+      \InCa@@@Sub!!#1!#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@Sub#1!#3!#2%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa@@@Add}
+%    \begin{macrocode}
+\def\InCa@@@Add#1!#2!#3#4!#5{%
+  \ifx\InCa at Empty#4\InCa at Empty
+    \csname InCa at Empty%
+    \@ReturnAfterElseFi{%
+      \InCa at ProcessAdd#1#3!#5#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@@Add#1#3!#5#2!#4!%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@@Sub}
+%    \begin{macrocode}
+\def\InCa@@@Sub#1!#2!#3#4!#5{%
+  \ifx\InCa at Empty#4\InCa at Empty
+    \csname @gobble%
+    \@ReturnAfterElseFi{%
+      \InCa at ProcessSub#1#3!#5#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@@Sub#1#3!#5#2!#4!%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at ProcessAdd}
+%    \begin{macrocode}
+\def\InCa at ProcessAdd#1#2!#3#4{%
+  \ifx\InCa at Empty#2\InCa at Empty
+    \csname InCa at AddDigit#1\endcsname#3%
+    \romannumeral0#4%
+  \else
+    \csname InCa at AddDigit#1\csname InCa at DigitCarry#3%
+    \@ReturnAfterFi{%
+      \InCa at ProcessAdd#2!#4%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ProcessSub}
+%    \begin{macrocode}
+\def\InCa at ProcessSub#1#2!#3#4{%
+  \ifx\InCa at Empty#2\InCa at Empty
+    \csname InCa at SubDigit#1\endcsname#3%
+    \romannumeral0#4%
+  \else
+    \csname InCa at SubDigit#1\csname InCa at DigitCarry#3%
+    \@ReturnAfterFi{%
+      \InCa at ProcessSub#2!#4%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DigitCarry[0-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at DigitCarry#1\endcsname##1{%
+    \ifcase##1 %
+      \endcsname#1%
+    \else
+      \endcsname#2%
+    \fi
+  }%
+}
+\InCa at Temp 01
+\InCa at Temp 12
+\InCa at Temp 23
+\InCa at Temp 34
+\InCa at Temp 45
+\InCa at Temp 56
+\InCa at Temp 67
+\InCa at Temp 78
+\InCa at Temp 89
+\InCa at Temp 9{{10}}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at AddDigit0}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at AddDigit0\endcsname#1{%
+  \ifnum#1>9 %
+    \endcsname10%
+  \else
+    \endcsname0#1%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at AddDigit[1-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2#3{%
+  \expandafter\def\csname InCa at AddDigit#1\endcsname##1{%
+    \ifnum##1>#2 %
+      \endcsname 1%
+    \else
+      \endcsname 0%
+    \fi
+    \ifcase##1 #1% 0
+    #3%
+    \else #1% 10
+    \fi
+  }%
+}
+\InCa at Temp 18{%
+  \or 2% 1
+  \or 3% 2
+  \or 4% 3
+  \or 5% 4
+  \or 6% 5
+  \or 7% 6
+  \or 8% 7
+  \or 9% 8
+  \or 0% 9
+}%
+\InCa at Temp 27{%
+  \or 3% 1
+  \or 4% 2
+  \or 5% 3
+  \or 6% 4
+  \or 7% 5
+  \or 8% 6
+  \or 9% 7
+  \or 0% 8
+  \or 1% 9
+}%
+\InCa at Temp 36{%
+  \or 4% 1
+  \or 5% 2
+  \or 6% 3
+  \or 7% 4
+  \or 8% 5
+  \or 9% 6
+  \or 0% 7
+  \or 1% 8
+  \or 2% 9
+}%
+\InCa at Temp 45{%
+  \or 5% 1
+  \or 6% 2
+  \or 7% 3
+  \or 8% 4
+  \or 9% 5
+  \or 0% 6
+  \or 1% 7
+  \or 2% 8
+  \or 3% 9
+}%
+\InCa at Temp 54{%
+  \or 6% 1
+  \or 7% 2
+  \or 8% 3
+  \or 9% 4
+  \or 0% 5
+  \or 1% 6
+  \or 2% 7
+  \or 3% 8
+  \or 4% 9
+}%
+\InCa at Temp 63{%
+  \or 7% 1
+  \or 8% 2
+  \or 9% 3
+  \or 0% 4
+  \or 1% 5
+  \or 2% 6
+  \or 3% 7
+  \or 4% 8
+  \or 5% 9
+}%
+\InCa at Temp 72{%
+  \or 8% 1
+  \or 9% 2
+  \or 0% 3
+  \or 1% 4
+  \or 2% 5
+  \or 3% 6
+  \or 4% 7
+  \or 5% 8
+  \or 6% 9
+}%
+\InCa at Temp 81{%
+  \or 9% 1
+  \or 0% 2
+  \or 1% 3
+  \or 2% 4
+  \or 3% 5
+  \or 4% 6
+  \or 5% 7
+  \or 6% 8
+  \or 7% 9
+}%
+\InCa at Temp 90{%
+  \or 0% 1
+  \or 1% 2
+  \or 2% 3
+  \or 3% 4
+  \or 4% 5
+  \or 5% 6
+  \or 6% 7
+  \or 7% 8
+  \or 8% 9
+}%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at SubDigit[0-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at SubDigit#1\endcsname##1{%
+    \ifnum##1>#1 %
+      \endcsname 1%
+    \else
+      \endcsname 0%
+    \fi
+    \ifcase##1 #1% 0
+    #2%
+    \else #1% 10
+    \fi
+  }%
+}
+\InCa at Temp 0{%
+  \or 9% 1
+  \or 8% 2
+  \or 7% 3
+  \or 6% 4
+  \or 5% 5
+  \or 4% 6
+  \or 3% 7
+  \or 2% 8
+  \or 1% 9
+}
+\InCa at Temp 1{%
+  \or 0% 1
+  \or 9% 2
+  \or 8% 3
+  \or 7% 4
+  \or 6% 5
+  \or 5% 6
+  \or 4% 7
+  \or 3% 8
+  \or 2% 9
+}
+\InCa at Temp 2{%
+  \or 1% 1
+  \or 0% 2
+  \or 9% 3
+  \or 8% 4
+  \or 7% 5
+  \or 6% 6
+  \or 5% 7
+  \or 4% 8
+  \or 3% 9
+}
+\InCa at Temp 3{%
+  \or 2% 1
+  \or 1% 2
+  \or 0% 3
+  \or 9% 4
+  \or 8% 5
+  \or 7% 6
+  \or 6% 7
+  \or 5% 8
+  \or 4% 9
+}
+\InCa at Temp 4{%
+  \or 3% 1
+  \or 2% 2
+  \or 1% 3
+  \or 0% 4
+  \or 9% 5
+  \or 8% 6
+  \or 7% 7
+  \or 6% 8
+  \or 5% 9
+}
+\InCa at Temp 5{%
+  \or 4% 1
+  \or 3% 2
+  \or 2% 3
+  \or 1% 4
+  \or 0% 5
+  \or 9% 6
+  \or 8% 7
+  \or 7% 8
+  \or 6% 9
+}
+\InCa at Temp 6{%
+  \or 5% 1
+  \or 4% 2
+  \or 3% 3
+  \or 2% 4
+  \or 1% 5
+  \or 0% 6
+  \or 9% 7
+  \or 8% 8
+  \or 7% 9
+}
+\InCa at Temp 7{%
+  \or 6% 1
+  \or 5% 2
+  \or 4% 3
+  \or 3% 4
+  \or 2% 5
+  \or 1% 6
+  \or 0% 7
+  \or 9% 8
+  \or 8% 9
+}
+\InCa at Temp 8{%
+  \or 7% 1
+  \or 6% 2
+  \or 5% 3
+  \or 4% 4
+  \or 3% 5
+  \or 2% 6
+  \or 1% 7
+  \or 0% 8
+  \or 9% 9
+}
+\InCa at Temp 9{%
+  \or 8% 1
+  \or 7% 2
+  \or 6% 3
+  \or 5% 4
+  \or 4% 5
+  \or 3% 6
+  \or 2% 7
+  \or 1% 8
+  \or 0% 9
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Shl}, \op{Shr}}
+%
+%    \begin{macro}{\intcalcShl}
+%    \begin{macrocode}
+\def\intcalcShl#1{%
+  \number\expandafter\InCa at ShlSwitch\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ShlSwitch}
+%    \begin{macrocode}
+\def\InCa at ShlSwitch#1#2!{%
+  \ifx#1-%
+    -\csname InCa at Empty%
+    \InCa at Shl#2!%
+  \else
+    \csname InCa at Empty%
+    \InCa at Shl#1#2!%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcShl}
+%    \begin{macrocode}
+\def\IntCalcShl#1!{%
+  \number
+  \csname InCa at Empty%
+  \InCa at Shl#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCal at ShlDigit}
+%    \begin{macrocode}
+\def\InCa at Shl#1#2{%
+  \ifx#2!%
+    \csname InCa at ShlDigit#1\endcsname0%
+  \else
+    \csname InCa at ShlDigit#1%
+    \@ReturnAfterFi{%
+      \InCa at Shl#2%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ShlDigit0}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at ShlDigit0\endcsname{%
+  \endcsname0%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ShlDigit[1-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2#3#4#5{%
+  \expandafter\def\csname InCa at ShlDigit#1\endcsname##1{%
+    \expandafter\endcsname
+    \ifcase##1 %
+      #2#3%
+    \else
+      #4#5%
+    \fi
+  }%
+}
+\InCa at Temp 10203
+\InCa at Temp 20405
+\InCa at Temp 30607
+\InCa at Temp 40809
+\InCa at Temp 51011
+\InCa at Temp 61213
+\InCa at Temp 71415
+\InCa at Temp 81617
+\InCa at Temp 91819
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcShr}
+%    \begin{macrocode}
+\def\intcalcShr#1{%
+  \number\expandafter\InCa at ShrSwitch\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ShrSwitch}
+%    \begin{macrocode}
+\def\InCa at ShrSwitch#1#2!{%
+  \ifx#1-%
+    -\InCa at Shr#2!%
+  \else
+    \InCa at Shr#1#2!%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcShr}
+%    \begin{macrocode}
+\def\IntCalcShr#1!{%
+  \number\InCa at Shr#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Shr}
+%    \begin{macrocode}
+\def\InCa at Shr#1#2{%
+  \InCa at ShrDigit#1!%
+  \ifx#2!%
+  \else
+    \@ReturnAfterFi{%
+      \ifodd#1 %
+        \@ReturnAfterElseFi{%
+          \InCa at Shr{1#2}%
+        }%
+      \else
+        \expandafter\InCa at Shr\expandafter#2%
+      \fi
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macrocode}
+\def\InCa at ShrDigit#1!{%
+  \ifcase#1 0% 0
+  \or 0% 1
+  \or 1% 2
+  \or 1% 3
+  \or 2% 4
+  \or 2% 5
+  \or 3% 6
+  \or 3% 7
+  \or 4% 8
+  \or 4% 9
+  \or 5% 10
+  \or 5% 11
+  \or 6% 12
+  \or 6% 13
+  \or 7% 14
+  \or 7% 15
+  \or 8% 16
+  \or 8% 17
+  \or 9% 18
+  \or 9% 19
+  \fi
+}
+%    \end{macrocode}
+%
+% \subsubsection{\cs{InCa at Tim}}
+%
+%    \begin{macro}{\InCa at Tim}
+%    Macro \cs{InCa at Tim} implements
+%    ``Number \emph{tim}es digit''.
+%    \begin{macrocode}
+\def\InCa at Temp#1{%
+  \def\InCa at Tim##1##2{%
+    \number
+      \ifcase##2 % 0
+        0%
+      \or % 1
+        ##1%
+      \else % 2-9
+        \csname InCa at Empty%
+        \InCa at ProcessTim##2##1!%
+      \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ProcessTim}
+%    \begin{macrocode}
+\def\InCa at ProcessTim#1#2#3{%
+  \ifx#3!%
+    \csname InCa at TimDigit#2\endcsname#10%
+  \else
+    \csname InCa at TimDigit#2\csname InCa at Param#1%
+    \@ReturnAfterFi{%
+      \InCa at ProcessTim#1#3%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Param[0-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1{%
+  \expandafter\def\csname InCa at Param#1\endcsname{%
+    \endcsname#1%
+  }%
+}
+\InCa at Temp 0%
+\InCa at Temp 1%
+\InCa at Temp 2%
+\InCa at Temp 3%
+\InCa at Temp 4%
+\InCa at Temp 5%
+\InCa at Temp 6%
+\InCa at Temp 7%
+\InCa at Temp 8%
+\InCa at Temp 9%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at TimDigit0}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at TimDigit0\endcsname#1#2{%
+  \endcsname
+  0#2%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at TimDigit1}
+%    \begin{macrocode}
+\expandafter\def\csname InCa at TimDigit1\endcsname#1#2{%
+  \ifcase#2 %
+    \endcsname 0#1%
+  \else
+    \csname InCa at AddDigit#1\endcsname #2%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at TimDigit[2-9]}
+%    \begin{macrocode}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at TimDigit#1\endcsname##1{%
+    \expandafter\InCa at TimDigitCarry
+    \number
+      \ifcase##1 0% 0
+      #2%
+      \fi
+    !%
+  }%
+}
+\InCa at Temp 2{%
+  \or  2% 1
+  \or  4% 2
+  \or  6% 3
+  \or  8% 4
+  \or 10% 5
+  \or 12% 6
+  \or 14% 7
+  \or 16% 8
+  \or 18% 9
+}
+\InCa at Temp 3{%
+  \or  3% 1
+  \or  6% 2
+  \or  9% 3
+  \or 12% 4
+  \or 15% 5
+  \or 18% 6
+  \or 21% 7
+  \or 24% 8
+  \or 27% 9
+}
+\InCa at Temp 4{%
+  \or  4% 1
+  \or  8% 2
+  \or 12% 3
+  \or 16% 4
+  \or 20% 5
+  \or 24% 6
+  \or 28% 7
+  \or 32% 8
+  \or 36% 9
+}
+\InCa at Temp 5{%
+  \or  5% 1
+  \or 10% 2
+  \or 15% 3
+  \or 20% 4
+  \or 25% 5
+  \or 30% 6
+  \or 35% 7
+  \or 40% 8
+  \or 45% 9
+}
+\InCa at Temp 6{%
+  \or  6% 1
+  \or 12% 2
+  \or 18% 3
+  \or 24% 4
+  \or 30% 5
+  \or 36% 6
+  \or 42% 7
+  \or 48% 8
+  \or 54% 9
+}
+\InCa at Temp 7{%
+  \or  7% 1
+  \or 14% 2
+  \or 21% 3
+  \or 28% 4
+  \or 35% 5
+  \or 42% 6
+  \or 49% 7
+  \or 56% 8
+  \or 63% 9
+}
+\InCa at Temp 8{%
+  \or  8% 1
+  \or 16% 2
+  \or 24% 3
+  \or 32% 4
+  \or 40% 5
+  \or 48% 6
+  \or 56% 7
+  \or 64% 8
+  \or 72% 9
+}
+\InCa at Temp 9{%
+  \or  9% 1
+  \or 18% 2
+  \or 27% 3
+  \or 36% 4
+  \or 45% 5
+  \or 54% 6
+  \or 63% 7
+  \or 72% 8
+  \or 81% 9
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at TimDigitCarry}
+%    \begin{macrocode}
+\def\InCa at TimDigitCarry#1!{%
+  \ifnum#1<10 %
+    \csname InCa at AddDigit#1\expandafter\endcsname
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@TimDigitCarry#1!%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@TimDigitCarry}
+%    \begin{macrocode}
+\def\InCa@@TimDigitCarry#1#2!#3{%
+  \csname InCa at DigitCarry#1%
+  \csname InCa at AddDigit#2\endcsname #3%
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Mul}}
+%
+%    \begin{macro}{\intcalcMul}
+%    \begin{macrocode}
+\def\intcalcMul#1#2{%
+  \number
+    \expandafter\InCa at MulSwitch
+    \number\number#1\expandafter!%
+    \number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\InCa at MulSwitch}
+%    Decision table for \cs{InCa at MulSwitch}.
+%    \begin{quote}
+%    \begin{tabular}[t]{@{}|l|l|l|l|l|@{}}
+%      \hline
+%      $x<0$ & $y<0$ & $ x< y$ & $+$ & $\opMul(-x,-y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opMul(-y,-x)$\\
+%      \cline{2-5}
+%            & else  & $-x> y$ & $-$ & $\opMul(-x, y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opMul( y,-x)$\\
+%      \hline
+%      else  & $y<0$ & $ x>-y$ & $-$ & $\opMul( x,-y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opMul(-y, x)$\\
+%      \cline{2-5}
+%            & else  & $ x> y$ & $+$ & $\opMul( x, y)$\\
+%      \cline{3-3}\cline{5-5}
+%            &       & else    &     & $\opMul( y, x)$\\
+%      \hline
+%    \end{tabular}
+%    \end{quote}
+%    \begin{macrocode}
+\def\InCa at MulSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      \ifnum#1<#2 %
+        \expandafter\InCa at Mul\number-#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Mul\number-#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \else
+      -%
+      \ifnum-#1>#2 %
+        \expandafter\InCa at Mul\@gobble#1!#2!%
+      \else
+        \expandafter\InCa at Mul\number#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \fi
+  \else
+    \ifnum#2<\z@
+      -%
+      \ifnum#1>-#2 %
+        \expandafter\InCa at Mul\number#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Mul\@gobble#2!#1!%
+      \fi
+    \else
+      \ifnum#1>#2 %
+        \InCa at Mul#1!#2!%
+      \else
+        \InCa at Mul#2!#1!%
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcMul}
+%    \begin{macrocode}
+\def\IntCalcMul#1!#2!{%
+  \number\InCa at Mul#1!#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Mul}
+%    \begin{macrocode}
+\def\InCa at Mul#1!#2!{%
+  \ifcase#2 %
+    0%
+  \or
+    #1%
+  \or
+    \csname InCa at Empty%
+    \expandafter\InCa at Shl#1!%
+  \else
+    \ifnum#2<10 %
+      \InCa at Tim{#1}#2%
+    \else
+      \InCa at ProcessMul!#2!#1!%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Mul}
+%    \begin{macrocode}
+\def\InCa at ProcessMul#1!#2#3!#4!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \expandafter\InCa at Add\number
+    #10\expandafter\expandafter\expandafter!%
+    \InCa at Tim{#4}#2!%
+  \else
+    \ifx\InCa at Empty#1\InCa at Empty
+      \expandafter\expandafter\expandafter\InCa at ProcessMul
+      \InCa at Tim{#4}#2!%
+      #3!#4!%
+    \else
+      \expandafter\InCa at ProcessMul\number
+      \expandafter\InCa at Add\number%
+      #10\expandafter\expandafter\expandafter!%
+      \InCa at Tim{#4}#2!!%
+      #3!#4!%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Sqr}, \op{Fac}}
+%
+%    \begin{macro}{\intcalcSqr}
+%    \begin{macrocode}
+\def\intcalcSqr#1{%
+  \number\expandafter\InCa at Sqr\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Sqr}
+%    \begin{macrocode}
+\def\InCa at Sqr#1#2!{%
+  \ifx#1-%
+    \InCa at Mul#2!#2!%
+  \else
+    \InCa at Mul#1#2!#1#2!%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macro}{\intcalcFac}
+%    \begin{macrocode}
+\def\intcalcFac#1{%
+  \number\expandafter\InCa at Fac\number#1! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Pow}}
+%
+%    \begin{macro}{\intcalcPow}
+%    \begin{macrocode}
+\def\intcalcPow#1#2{%
+  \number\expandafter\InCa at Pow
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Pow}
+%    \begin{macrocode}
+\def\InCa at Pow#1#2!#3#4!{%
+  \ifcase#3#4 % power = 0
+    1%
+  \or % power = 1
+    #1#2%
+  \or % power = 2
+    \ifx#1-%
+      \InCa at Mul#2!#2!%
+    \else
+      \InCa at Mul#1#2!#1#2!%
+    \fi
+  \else
+    \ifcase#1#2 % basis = 0, power <> 0
+      0%
+      \ifx#3-% power < 0
+        0\IntCalcError:DivisionByZero%
+      \fi
+    \or
+      1% basis = 1
+    \else
+      \ifnum#1#2=\m at ne % basis = -1
+        \ifodd#3#4 %
+          -%
+        \fi
+        1%
+      \else % |basis| > 1
+        \ifx#3-% power < 0
+          0%
+        \else % power > 2
+          \ifx#1-% basis < 0
+            \ifodd#3#4 %
+              -%
+            \fi
+            \InCa at PowRec#2!#3#4!1!%
+          \else
+            \InCa at PowRec#1#2!#3#4!1!%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at PowRec}
+%\begin{quote}
+%\begin{verbatim}
+%Pow(b, p) {
+%  PowRec(b, p, 1)
+%}
+%PowRec(b, p, r) {
+%  if p == 1 then
+%    return r
+%  else
+%    ifodd p then
+%      return PowRec(b*b, p div 2, r*b) % p div 2 = (p-1)/2
+%    else
+%      return PowRec(b*b, p div 2, r)
+%    fi
+%  fi
+%}
+%\end{verbatim}
+%\end{quote}
+%    \begin{macrocode}
+\def\InCa at PowRec#1!#2!#3!{%
+  \ifnum#2=\@ne
+    \ifnum#1>#3 %
+      \InCa at Mul#1!#3!%
+    \else
+      \InCa at Mul#3!#1!%
+    \fi
+  \else
+    \expandafter\InCa at PowRec
+    \number\InCa at Mul#1!#1!\expandafter!%
+    \number\intcalcShr{#2}\expandafter!%
+    \number
+    \ifodd#2 %
+      \ifnum#1>#3 %
+        \InCa at Mul#1!#3!%
+      \else
+        \InCa at Mul#3!#1!%
+      \fi
+    \else
+      #3%
+    \fi
+    \expandafter!%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Div}}
+%
+%    \begin{macro}{\intcalcDiv}
+%    \begin{macrocode}
+\def\intcalcDiv#1#2{%
+  \number\expandafter\InCa at Div
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at Div}
+%    \begin{macrocode}
+\def\InCa at Div#1!#2!{%
+  \ifcase#2 %
+    0\IntCalcError:DivisionByZero%
+  \else
+    \ifcase#1 %
+      0%
+    \else
+      \expandafter\InCa at DivSwitch
+      \number#1\expandafter!%
+      \number#2!%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcDiv}
+%    \begin{macrocode}
+\def\InCa at Temp#1{%
+  \def\IntCalcDiv##1!##2!{%
+    \number
+    \ifcase##2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase##1 %
+        0%
+      \else
+        \InCa@@Div##1!##2!%
+      \fi
+    \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DivSwitch}
+%    Decision table for \cs{InCa at DivSwitch}.
+%    \begin{quote}
+%    \begin{tabular}[t]{@{}|l|l|l|l|@{}}
+%      \hline
+%      $x<0$ & $y<0$ & $+$ & $\opDiv(-x,-y)$\\
+%      \cline{2-4}
+%            & else  & $-$ & $\opDiv(-x, y)$\\
+%      \hline
+%      else  & $y<0$ & $-$ & $\opDiv( x,-y)$\\
+%      \cline{2-4}
+%            & else  & $+$ & $\opDiv( x, y)$\\
+%      \hline
+%    \end{tabular}
+%    \end{quote}
+%    \begin{macrocode}
+\def\InCa at DivSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      \expandafter\InCa@@Div\number-#1\expandafter!%
+      \@gobble#2!%
+    \else
+      -%
+      \expandafter\InCa@@Div\@gobble#1!#2!%
+    \fi
+  \else
+    \ifnum#2<\z@
+      -%
+      \expandafter\InCa@@Div\number#1\expandafter!%
+      \@gobble#2!%
+    \else
+      \InCa@@Div#1!#2!%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@Div}
+%    \begin{macrocode}
+\def\InCa@@Div#1!#2!{%
+  \ifnum#1>#2 %
+    \ifcase#2 % 0 already catched
+?     \IntCalcError:ThisCannotHappen%
+    \or % 1
+      #1%
+    \or % 2
+      \InCa at Shr#1!%
+    \else
+      \InCa at DivStart!#1!#2!#2!%
+    \fi
+  \else
+    \ifnum#1=#2 %
+      1%
+    \else
+      0%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at DivStart}
+%    \begin{macrocode}
+\def\InCa at DivStart#1!#2#3!#4#5{%
+  \ifx#5!%
+    \@ReturnAfterElseFi{%
+      \InCa at DivStartI{#1#2}#3=!%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa at DivStart{#1#2}!#3!#5%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at StartI}
+%    \begin{macrocode}
+\def\InCa at DivStartI#1!#2!{%
+  \expandafter\InCa at DivStartII
+  \number#2\expandafter\expandafter\expandafter!%
+  \intcalcShl{#2}!%
+  #1!%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at StartII}
+%    \begin{macrocode}
+\def\InCa at DivStartII#1!#2!{%
+  \expandafter\InCa at DivStartIII
+  \number#1\expandafter!%
+  \number#2\expandafter\expandafter\expandafter!%
+  \intcalcShl{#2}!%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at StartIII}
+%    \begin{macrocode}
+\def\InCa at DivStartIII#1!#2!#3!{%
+  \expandafter\InCa at DivStartIV
+  \number#1\expandafter!%
+  \number#2\expandafter!%
+  \number#3\expandafter!%
+  \number\InCa at Add#3!#2!\expandafter\expandafter\expandafter!%
+  \intcalcShl{#3}!%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at StartIV}
+%    \begin{macrocode}
+\def\InCa at DivStartIV#1!#2!#3!#4!#5!#6!{%
+  \InCa at ProcessDiv#6!#1!#2!#3!#4!#5!/%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ProcessDiv}
+%    \begin{macrocode}
+\def\InCa at ProcessDiv#1#2#3!#4!#5!#6!#7!#8!#9/{%
+  #9%
+  \ifnum#1<#4 % 0
+    0%
+    \ifx#2=%
+    \else
+      \InCa at ProcessDiv{#1#2}#3!#4!#5!#6!#7!#8!%
+    \fi
+  \else % 1-9
+    \ifnum#1<#5 % 1
+      1%
+      \ifx#2=%
+      \else
+        \expandafter\InCa at ProcessDiv\expandafter{%
+          \number\InCa at Sub#1!#4!%
+          #2%
+        }#3!#4!#5!#6!#7!#8!%
+      \fi
+    \else % 2-9
+      \ifnum#1<#7 % 2 3 4 5
+        \ifnum#1<#6 % 2 3
+          \@ReturnAfterElseFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#5!!%
+            23%
+          }%
+        \else % 4 5
+          \@ReturnAfterFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#6!!%
+            45%
+          }%
+        \fi
+        #2#3!#4!#5!#6!#7!#8!%
+      \else % 6 7 8 9
+        \ifnum#1<#8 % 6 7
+          \@ReturnAfterElseFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#7!!%
+            67%
+          }%
+        \else % 8 9
+          \@ReturnAfterFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#8!!%
+            89%
+          }%
+        \fi
+        #2#3!#4!#5!#6!#7!#8!%
+      \fi
+    \fi
+  \fi
+  \ifx#2=%
+    \expandafter\@gobble
+  \fi
+  /%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa@@ProcessDiv}
+%    \begin{macrocode}
+\def\InCa@@ProcessDiv#1!#2#3#4#5!#6!{%
+  \ifnum#1<#6 %
+    #2%
+    \@ReturnAfterElseFi{%
+      \ifx#4=%
+        \expandafter\InCa at CleanupIV
+      \else
+        \@ReturnAfterFi{%
+          \InCa at ProcessDiv{#1#4}#5!#6!%
+        }%
+      \fi
+    }%
+  \else
+    #3%
+    \@ReturnAfterFi{%
+      \ifx#4=%
+        \expandafter\InCa at CleanupIV
+      \else
+        \@ReturnAfterFi{%
+          \expandafter\InCa at ProcessDiv\expandafter{%
+            \number\InCa at Sub#1!#6! %
+            #4%
+          }#5!#6!%
+        }%
+      \fi
+    }%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at CleanupIV}
+%    \begin{macrocode}
+\def\InCa at CleanupIV#1!#2!#3!#4!{}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{\op{Mod}}
+%
+%    \begin{macro}{\intcalcMod}
+%    \begin{macrocode}
+\def\intcalcMod#1#2{%
+  \number\expandafter\InCa at Mod
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\intcalc at Mod}
+%    Pseudocode/decision table for \cs{intcalc at Mod}.
+%    \begin{quote}
+%    \begin{tabular}{@{}lll@{}}
+%      if    & $y=0$ & DivisionByZero\\
+%      elsif & $y<0$ & $-\opMod(-x,-y)$\\
+%      elsif & $x=0$ & 0\\
+%      elsif & $y=1$ & 0\\
+%      elsif & $y=2$ & $\opOdd(x)\mathbin{?}1\mathbin{:}0$\\
+%      elsif & $x<0$ &
+%        $z\leftarrow x-(x/y)*y;\quad (z<0)\mathbin{?}z+y\mathbin{:}z$\\
+%      else  &       & $x-(x/y)*y$\\
+%      \\
+%    \end{tabular}
+%    \end{quote}
+%    \begin{macrocode}
+\def\InCa at Mod#1!#2!{%
+  \ifcase#2 %
+    0\IntCalcError:DivisionByZero%
+  \else
+    \ifnum#2<\z@
+      -%
+      \expandafter\InCa at Mod
+      \number-#1\expandafter!%
+      \number-#2!%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \ifcase#2 % 0 already catched
+?         \IntCalcError:ThisCannotHappen%
+        \or % 1
+          0%
+        \or % 2
+          \ifodd#1 1\else 0\fi
+        \else
+          \ifnum#1<\z@
+            \expandafter\InCa at ModShift
+            \number-%
+              \expandafter\InCa at Sub
+              \number\@gobble#1\expandafter!%
+              \number\intcalcMul{#2}{%
+                \expandafter\InCa at Div\@gobble#1!#2!%
+              }!%
+            !#2!%
+          \else
+            \expandafter\InCa at Sub\number#1\expandafter!%
+            \number\intcalcMul{#2}{\InCa at Div#1!#2!}!%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\IntCalcMod}
+%    \begin{macrocode}
+\def\InCa at Temp#1{%
+  \def\IntCalcMod##1!##2!{%
+    \number
+    \ifcase##2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase##1 %
+        0%
+      \else
+        \ifcase##2 % 0 already catched
+?         \IntCalcError:ThisCannotHappen
+        \or % 1
+          0%
+        \or % 2
+          \ifodd ##1 1\else 0\fi
+        \else
+          \expandafter\InCa at Sub\number##1\expandafter!%
+          \number\intcalcMul{##2}{\InCa at Div##1!##2!}!%
+        \fi
+      \fi
+    \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\InCa at ModShift}
+%    \begin{macrocode}
+\def\InCa at ModShift#1!#2!{%
+  \ifnum#1<\z@
+    \expandafter\InCa at Sub\number#2\expandafter!%
+    \@gobble#1!%
+  \else
+    #1%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsubsection{Help macros}
+%
+%    \begin{macro}{\InCa at Empty}
+%    \begin{macrocode}
+\def\InCa at Empty{}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\@gobble}
+%    \begin{macrocode}
+\expandafter\ifx\csname @gobble\endcsname\relax
+  \long\def\@gobble#1{}%
+\fi
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\@ReturnAfterFi}
+%    \begin{macrocode}
+\long\def\@ReturnAfterFi#1\fi{\fi#1}%
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\@ReturnAfterElseFi}
+%    \begin{macrocode}
+\long\def\@ReturnAfterElseFi#1\else#2\fi{\fi#1}%
+%    \end{macrocode}
+%    \end{macro}
+%
+%    \begin{macrocode}
+\InCa at AtEnd%
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%</package>
+%    \end{macrocode}
+%% \section{Installation}
+%
+% \subsection{Download}
+%
+% \paragraph{Package.} This package is available on
+% CTAN\footnote{\CTANpkg{intcalc}}:
+% \begin{description}
+% \item[\CTAN{macros/latex/contrib/intcalc/intcalc.dtx}] The source file.
+% \item[\CTAN{macros/latex/contrib/intcalc/intcalc.pdf}] Documentation.
+% \end{description}
+%
+%
+% \paragraph{Bundle.} All the packages of the bundle `intcalc'
+% are also available in a TDS compliant ZIP archive. There
+% the packages are already unpacked and the documentation files
+% are generated. The files and directories obey the TDS standard.
+% \begin{description}
+% \item[\CTANinstall{install/macros/latex/contrib/intcalc.tds.zip}]
+% \end{description}
+% \emph{TDS} refers to the standard ``A Directory Structure
+% for \TeX\ Files'' (\CTANpkg{tds}). Directories
+% with \xfile{texmf} in their name are usually organized this way.
+%
+% \subsection{Bundle installation}
+%
+% \paragraph{Unpacking.} Unpack the \xfile{intcalc.tds.zip} in the
+% TDS tree (also known as \xfile{texmf} tree) of your choice.
+% Example (linux):
+% \begin{quote}
+%   |unzip intcalc.tds.zip -d ~/texmf|
+% \end{quote}
+%
+% \subsection{Package installation}
+%
+% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
+% \docstrip\ archive. The files are extracted by running the
+% \xfile{.dtx} through \plainTeX:
+% \begin{quote}
+%   \verb|tex intcalc.dtx|
+% \end{quote}
+%
+% \paragraph{TDS.} Now the different files must be moved into
+% the different directories in your installation TDS tree
+% (also known as \xfile{texmf} tree):
+% \begin{quote}
+% \def\t{^^A
+% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
+%   intcalc.sty & tex/generic/intcalc/intcalc.sty\\
+%   intcalc.pdf & doc/latex/intcalc/intcalc.pdf\\
+%   intcalc.dtx & source/latex/intcalc/intcalc.dtx\\
+% \end{tabular}^^A
+% }^^A
+% \sbox0{\t}^^A
+% \ifdim\wd0>\linewidth
+%   \begingroup
+%     \advance\linewidth by\leftmargin
+%     \advance\linewidth by\rightmargin
+%   \edef\x{\endgroup
+%     \def\noexpand\lw{\the\linewidth}^^A
+%   }\x
+%   \def\lwbox{^^A
+%     \leavevmode
+%     \hbox to \linewidth{^^A
+%       \kern-\leftmargin\relax
+%       \hss
+%       \usebox0
+%       \hss
+%       \kern-\rightmargin\relax
+%     }^^A
+%   }^^A
+%   \ifdim\wd0>\lw
+%     \sbox0{\small\t}^^A
+%     \ifdim\wd0>\linewidth
+%       \ifdim\wd0>\lw
+%         \sbox0{\footnotesize\t}^^A
+%         \ifdim\wd0>\linewidth
+%           \ifdim\wd0>\lw
+%             \sbox0{\scriptsize\t}^^A
+%             \ifdim\wd0>\linewidth
+%               \ifdim\wd0>\lw
+%                 \sbox0{\tiny\t}^^A
+%                 \ifdim\wd0>\linewidth
+%                   \lwbox
+%                 \else
+%                   \usebox0
+%                 \fi
+%               \else
+%                 \lwbox
+%               \fi
+%             \else
+%               \usebox0
+%             \fi
+%           \else
+%             \lwbox
+%           \fi
+%         \else
+%           \usebox0
+%         \fi
+%       \else
+%         \lwbox
+%       \fi
+%     \else
+%       \usebox0
+%     \fi
+%   \else
+%     \lwbox
+%   \fi
+% \else
+%   \usebox0
+% \fi
+% \end{quote}
+% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
+% TDS installing feature, then some files can already be in the right
+% place, see the documentation of \docstrip.
+%
+% \subsection{Refresh file name databases}
+%
+% If your \TeX~distribution
+% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
+% these. For example, \TeX\,Live\ users run \verb|texhash| or
+% \verb|mktexlsr|.
+%
+% \subsection{Some details for the interested}
+%
+% \paragraph{Unpacking with \LaTeX.}
+% The \xfile{.dtx} chooses its action depending on the format:
+% \begin{description}
+% \item[\plainTeX:] Run \docstrip\ and extract the files.
+% \item[\LaTeX:] Generate the documentation.
+% \end{description}
+% If you insist on using \LaTeX\ for \docstrip\ (really,
+% \docstrip\ does not need \LaTeX), then inform the autodetect routine
+% about your intention:
+% \begin{quote}
+%   \verb|latex \let\install=y\input{intcalc.dtx}|
+% \end{quote}
+% Do not forget to quote the argument according to the demands
+% of your shell.
+%
+% \paragraph{Generating the documentation.}
+% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
+% the documentation. The process can be configured by the
+% configuration file \xfile{ltxdoc.cfg}. For instance, put this
+% line into this file, if you want to have A4 as paper format:
+% \begin{quote}
+%   \verb|\PassOptionsToClass{a4paper}{article}|
+% \end{quote}
+% An example follows how to generate the
+% documentation with pdf\LaTeX:
+% \begin{quote}
+%\begin{verbatim}
+%pdflatex intcalc.dtx
+%makeindex -s gind.ist intcalc.idx
+%pdflatex intcalc.dtx
+%makeindex -s gind.ist intcalc.idx
+%pdflatex intcalc.dtx
+%\end{verbatim}
+% \end{quote}
+%
+% \begin{History}
+%   \begin{Version}{2007/09/09 v1.0}
+%   \item
+%     First version.
+%   \end{Version}
+%   \begin{Version}{2007/09/27 v1.1}
+%   \item
+%     \cs{intcalcNum} added.
+%   \item
+%     \cs{intcalcShl} and \cs{intcalcShr} allow negative numbers.
+%     The sign is preserved.
+%   \item
+%     Reuse \cs{@gobble} instead of own macro \cs{IntCalc at Gobble}.
+%   \item
+%     Small fixes.
+%   \item
+%     Shorter internal prefix.
+%   \item
+%     Some programmer's interface.
+%   \end{Version}
+%   \begin{Version}{2016/05/16 v1.2}
+%   \item
+%     Documentation updates.
+%   \end{Version}
+%   \begin{Version}{2019/12/15 v1.3}
+%   \item
+%     Documentation updates.
+%   \end{Version}
+% \end{History}
+%
+% \PrintIndex
+%
+% \Finale
+\endinput


Property changes on: trunk/Master/texmf-dist/source/latex/intcalc/intcalc.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/intcalc/intcalc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/intcalc/intcalc.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/intcalc/intcalc.sty	2019-12-17 23:24:25 UTC (rev 53168)
@@ -0,0 +1,1734 @@
+%%
+%% This is file `intcalc.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% intcalc.dtx  (with options: `package')
+%% 
+%% This is a generated file.
+%% 
+%% Project: intcalc
+%% Version: 2019/12/15 v1.3
+%% 
+%% Copyright (C)
+%%    2007 Heiko Oberdiek
+%%    2016-2019 Oberdiek Package Support Group
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. This version of this license is in
+%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%%    https://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%% 
+%% This work has the LPPL maintenance status "maintained".
+%% 
+%% The Current Maintainers of this work are
+%% Heiko Oberdiek and the Oberdiek Package Support Group
+%% https://github.com/ho-tex/intcalc/issues
+%% 
+%% 
+%% The Base Interpreter refers to any `TeX-Format',
+%% because some files are installed in TDS:tex/generic//.
+%% 
+%% This work consists of the main source file intcalc.dtx
+%% and the derived files
+%%    intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv,
+%%    intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex,
+%%    intcalc-test4.tex.
+%% 
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode35=6 % #
+  \catcode39=12 % '
+  \catcode44=12 % ,
+  \catcode45=12 % -
+  \catcode46=12 % .
+  \catcode58=12 % :
+  \catcode64=11 % @
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \expandafter\let\expandafter\x\csname ver at intcalc.sty\endcsname
+  \ifx\x\relax % plain-TeX, first loading
+  \else
+    \def\empty{}%
+    \ifx\x\empty % LaTeX, first loading,
+      % variable is initialized, but \ProvidesPackage not yet seen
+    \else
+      \expandafter\ifx\csname PackageInfo\endcsname\relax
+        \def\x#1#2{%
+          \immediate\write-1{Package #1 Info: #2.}%
+        }%
+      \else
+        \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
+      \fi
+      \x{intcalc}{The package is already loaded}%
+      \aftergroup\endinput
+    \fi
+  \fi
+\endgroup%
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode35=6 % #
+  \catcode39=12 % '
+  \catcode40=12 % (
+  \catcode41=12 % )
+  \catcode44=12 % ,
+  \catcode45=12 % -
+  \catcode46=12 % .
+  \catcode47=12 % /
+  \catcode58=12 % :
+  \catcode64=11 % @
+  \catcode91=12 % [
+  \catcode93=12 % ]
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \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 at intcalc.sty\endcsname
+\ProvidesPackage{intcalc}%
+  [2019/12/15 v1.3 Expandable calculations with integers (HO)]%
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+  \catcode13=5 % ^^M
+  \endlinechar=13 %
+  \catcode123=1 % {
+  \catcode125=2 % }
+  \catcode64=11 % @
+  \def\x{\endgroup
+    \expandafter\edef\csname InCa at AtEnd\endcsname{%
+      \endlinechar=\the\endlinechar\relax
+      \catcode13=\the\catcode13\relax
+      \catcode32=\the\catcode32\relax
+      \catcode35=\the\catcode35\relax
+      \catcode61=\the\catcode61\relax
+      \catcode64=\the\catcode64\relax
+      \catcode123=\the\catcode123\relax
+      \catcode125=\the\catcode125\relax
+    }%
+  }%
+\x\catcode61\catcode48\catcode32=10\relax%
+\catcode13=5 % ^^M
+\endlinechar=13 %
+\catcode35=6 % #
+\catcode64=11 % @
+\catcode123=1 % {
+\catcode125=2 % }
+\def\TMP at EnsureCode#1#2{%
+  \edef\InCa at AtEnd{%
+    \InCa at AtEnd
+    \catcode#1=\the\catcode#1\relax
+  }%
+  \catcode#1=#2\relax
+}
+\TMP at EnsureCode{33}{12}% !
+\TMP at EnsureCode{40}{12}% (
+\TMP at EnsureCode{41}{12}% )
+\TMP at EnsureCode{42}{12}% *
+\TMP at EnsureCode{43}{12}% +
+\TMP at EnsureCode{45}{12}% -
+\TMP at EnsureCode{47}{12}% /
+\TMP at EnsureCode{58}{11}% : (letter!)
+\TMP at EnsureCode{60}{12}% <
+\TMP at EnsureCode{62}{12}% >
+\TMP at EnsureCode{63}{14}% ? (comment!)
+\edef\InCa at AtEnd{\InCa at AtEnd\noexpand\endinput}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname InCa at TestMode\endcsname\relax
+\else
+  \catcode63=9 % ? (ignore)
+\fi
+? \let\InCa@@TestMode\InCa at TestMode
+\def\InCa at Abs#1#2!{%
+  \ifx#1-%
+    #2%
+  \else
+    #1#2%
+  \fi
+}
+\def\InCa at Sgn#1#2!{%
+  \ifx#1-%
+    -1%
+  \else
+    \ifx#10%
+      0%
+    \else
+      1%
+    \fi
+  \fi
+}
+\def\InCa at Min#1!#2!{%
+  \ifnum#1<#2 %
+    #1%
+  \else
+    #2%
+  \fi
+}
+\def\InCa at Max#1!#2!{%
+  \ifnum#1>#2 %
+    #1%
+  \else
+    #2%
+  \fi
+}
+\def\InCa at Cmp#1!#2!{%
+  \ifnum#1=#2 %
+    0%
+  \else
+    \ifnum#1<#2 %
+      -%
+    \fi
+    1%
+  \fi
+}
+\def\InCa at Fac#1!{%
+  \ifcase#1 1% 0!
+  \or 1% 1!
+  \or 2% 2!
+  \or 6% 3!
+  \or 24% 4!
+  \or 120% 5!
+  \or 720% 6!
+  \or 5040% 7!
+  \or 40320% 8!
+  \or 362880% 9!
+  \or 3628800% 10!
+  \or 39916800% 11!
+  \or 479001600% 12!
+  \else
+    \ifnum#1<\z@
+      0\IntCalcError:FacNegative%
+    \else
+      0\IntCalcError:FacOverflow%
+    \fi
+  \fi
+}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname numexpr\endcsname\relax
+\else
+  \def\intcalcNum#1{%
+    \the\numexpr#1\relax
+  }%
+  \def\intcalcInv#1{%
+    \number-\intcalcNum{#1} %
+  }%
+  \def\intcalcAbs#1{%
+    \number\expandafter\InCa at Abs\the\numexpr#1! %
+  }%
+  \def\intcalcSgn#1{%
+    \number\expandafter\InCa at Sgn\the\numexpr#1! %
+  }%
+  \def\intcalcMin#1#2{%
+    \number\expandafter\InCa at Min
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+  \def\intcalcMax#1#2{%
+    \number\expandafter\InCa at Max
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+  \def\intcalcCmp#1#2{%
+    \number\expandafter\InCa at Cmp
+    \the\numexpr#1\expandafter!\the\numexpr#2! %
+  }%
+  \def\intcalcInc#1{%
+    \the\numexpr#1+1\relax
+  }%
+  \def\intcalcDec#1{%
+    \the\numexpr#1-1\relax
+  }%
+  \def\IntCalcInc#1!{%
+    \the\numexpr#1+1\relax
+  }%
+  \def\IntCalcDec#1!{%
+    \the\numexpr#1-1\relax
+  }%
+  \def\intcalcAdd#1#2{%
+    \the\numexpr#1+(#2)\relax
+  }%
+  \def\intcalcSub#1#2{%
+    \the\numexpr#1-(#2)\relax
+  }%
+  \def\IntCalcAdd#1!#2!{%
+    \the\numexpr#1+#2\relax
+  }%
+  \def\IntCalcSub#1!#2!{%
+    \the\numexpr#1-#2\relax
+  }%
+  \def\intcalcShl#1{%
+    \the\numexpr(#1)*2\relax
+  }%
+  \def\intcalcShr#1{%
+    \number\expandafter\InCa at Shr\the\numexpr#1! %
+  }%
+  \def\IntCalcShl#1!{%
+    \the\numexpr#1*2\relax
+  }%
+  \def\IntCalcShr#1!{%
+    \the\numexpr\ifodd#1 (#1-1)\else#1\fi/2\relax
+  }%
+  \def\InCa at Shr#1#2!{%
+    \ifx#1-%
+      -\InCa at Shr#2!%
+    \else
+      \ifodd#1#2 %
+        \the\numexpr(#1#2-1)/2\relax
+      \else
+        \the\numexpr#1#2/2\relax
+      \fi
+    \fi
+  }%
+  \def\intcalcMul#1#2{%
+    \the\numexpr(#1)*(#2)\relax
+  }%
+  \def\IntCalcMul#1!#2!{%
+    \the\numexpr#1*#2\relax
+  }%
+  \def\intcalcSqr#1{%
+    \number\expandafter\InCa at Sqr\the\numexpr#1! %
+  }%
+  \def\InCa at Sqr#1!{%
+    \the\numexpr#1*#1\relax
+  }%
+  \def\intcalcFac#1{%
+    \number\expandafter\InCa at Fac\the\numexpr#1! %
+  }%
+  \def\intcalcPow#1#2{%
+    \number\expandafter\InCa at Pow
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+  \def\InCa at Pow#1#2!#3#4!{%
+    \ifcase#3#4 % power = 0
+      1%
+    \or % power = 1
+      #1#2%
+    \or % power = 2
+      \the\numexpr#1#2*#1#2\relax
+    \else
+      \ifcase#1#2 % basis = 0, power <> 0
+        0%
+        \ifx#3-% power < 0
+          0\IntCalcError:DivisionByZero%
+        \fi
+      \or
+        1% basis = 1
+      \else
+        \ifnum#1#2=\m at ne % basis = -1
+          \ifodd#3#4 %
+            -%
+          \fi
+          1%
+        \else % |basis| > 1
+          \ifx#3-% power < 0
+            0%
+          \else % power > 2
+            \InCa at PowRec#1#2!#3#4!1!%
+          \fi
+        \fi
+      \fi
+    \fi
+  }%
+  \def\InCa at PowRec#1!#2!#3!{%
+    \ifnum#2=\@ne
+      \the\numexpr#1*#3\relax
+    \else
+      \ifodd#2 %
+        \expandafter\InCa at PowRec
+        \the\numexpr#1*#1\expandafter!%
+        \the\numexpr(#2-1)/2\expandafter!%
+        \the\numexpr#1*#3\expandafter\expandafter\expandafter!%
+      \else
+        \expandafter\InCa at PowRec
+        \the\numexpr#1*#1\expandafter!%
+        \the\numexpr(#2-1)/2\expandafter!%
+        \number#3\expandafter\expandafter\expandafter!%
+      \fi
+    \fi
+  }%
+  \def\intcalcDiv#1#2{%
+    \number\expandafter\InCa at Div
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+  \def\InCa at Div#1!#2!{%
+    \ifcase#2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \expandafter\InCa@@Div
+        \romannumeral 0%
+        \ifnum#1<\z@
+          \expandafter-\number-#1%
+        \else
+          \expandafter+\number#1%
+        \fi
+        \expandafter!%
+        \romannumeral 0%
+        \ifnum#2<\z@
+          \expandafter-\number-#2%
+        \else
+          \expandafter+\number#2%
+        \fi
+        !%
+      \fi
+    \fi
+  }%
+  \def\InCa at Temp#1{%
+    \def\IntCalcDiv##1!##2!{%
+      \number
+      \ifcase##2 %
+        0\IntCalcError:DivisionByZero%
+      \else
+        \ifcase##1 %
+          0%
+        \else
+          \the\numexpr(##1-(##2-1)/2)/##2\relax
+        \fi
+      \fi
+      #1%
+    }%
+  }%
+  \InCa at Temp{ }%
+  \def\InCa@@Div#1#2!#3#4!{%
+    #1#3%
+    \the\numexpr(#2-(#4-1)/2)/#4\relax
+  }%
+  \def\intcalcMod#1#2{%
+    \number\expandafter\InCa at Mod
+    \the\numexpr#1\expandafter!%
+    \the\numexpr#2! %
+  }%
+  \def\InCa at Mod#1!#2!{%
+    \ifcase#2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \expandafter\InCa@@Mod
+        \romannumeral 0%
+        \ifnum#1<\z@
+          \expandafter-\number-#1%
+        \else
+          \expandafter+\number#1%
+        \fi
+        \expandafter!%
+        \romannumeral 0%
+        \ifnum#2<\z@
+          \expandafter-\number-#2%
+        \else
+          \expandafter+\number#2%
+        \fi
+        !%
+      \fi
+    \fi
+  }%
+  \def\InCa at Temp#1{%
+    \def\IntCalcMod##1!##2!{%
+      \number
+      \ifcase##2 %
+        0\IntCalcError:DivisionByZero%
+      \else
+        \ifcase##1 %
+          0%
+        \else
+          \the\numexpr##1-(##1-(##2-1)/2)/##2*##2\relax
+        \fi
+      \fi
+      #1%
+    }%
+  }%
+  \InCa at Temp{ }%
+  \def\InCa@@Mod#1#2!#3#4!{%
+    \if#3+%
+      \if#1+%
+        \the\numexpr#2-\InCa@@Div+#2!+#4!*#4\relax
+      \else
+        \expandafter\InCa at ModX
+        \the\numexpr-#2+\InCa@@Div+#2!+#4!*#4!#4!%
+      \fi
+    \else
+      -%
+      \if#1+%
+        \expandafter\InCa at ModX
+        \the\numexpr-#2+\InCa@@Div+#2!+#4!*#4!#4!%
+      \else
+        \the\numexpr#2-\InCa@@Div+#2!+#4!*#4\relax
+      \fi
+    \fi
+  }%
+  \def\InCa at ModX#1!#2!{%
+    \ifcase#1 %
+      0%
+    \else
+      \the\numexpr#1+#2\relax
+    \fi
+  }%
+  \expandafter\InCa at AtEnd
+\fi%
+\def\intcalcNum#1{%
+  \number\expandafter\InCa at FirstOfOne\number#1! %
+}
+\def\intcalcInv#1{%
+  \number\expandafter\InCa at FirstOfOne\number-#1! %
+}
+\def\InCa at FirstOfOne#1!{#1}
+\def\intcalcAbs#1{%
+  \number\expandafter\InCa at Abs\number#1! %
+}
+\def\intcalcSgn#1{%
+  \number\expandafter\InCa at Sgn\number#1! %
+}
+\def\intcalcMin#1#2{%
+  \number\expandafter\InCa at Min
+  \number\number#1\expandafter!\number#2! %
+}
+\def\intcalcMax#1#2{%
+  \number\expandafter\InCa at Max
+  \number\number#1\expandafter!\number#2! %
+}
+\def\intcalcCmp#1#2{%
+  \number\expandafter\InCa at Cmp
+  \number\number#1\expandafter!\number#2! %
+}%
+\def\intcalcInc#1{%
+  \number\expandafter\InCa at IncSwitch\number#1! %
+}
+\def\InCa at IncSwitch#1#2!{%
+  \ifx#1-%
+    -%
+    \csname InCa at Empty%
+    \InCa at Dec#2!%
+  \else
+    \csname InCa at Empty%
+    \InCa at Inc#1#2!%
+  \fi
+}
+\def\intcalcDec#1{%
+  \number\expandafter\InCa at DecSwitch\number#1! %
+}
+\def\InCa at DecSwitch#1#2!{%
+  \ifx#1-%
+    -%
+    \csname InCa at Empty%
+    \expandafter\InCa at Inc#2!%
+  \else
+    \ifx#10%
+      -1%
+    \else
+      \csname InCa at Empty%
+      \InCa at Dec#1#2!%
+    \fi
+  \fi
+}
+\def\IntCalcInc#1!{%
+  \number\csname InCa at Empty\InCa at Inc#1! %
+}
+\def\IntCalcDec#1!{%
+  \number\csname InCa at Empty\InCa at Dec#1! %
+}
+\def\InCa at Inc#1#2{%
+  \ifx#2!%
+    \csname InCa at IncDigit#1\endcsname1%
+  \else
+    \csname InCa at IncDigit#1%
+    \expandafter\InCa at Inc\expandafter#2%
+  \fi
+}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at IncDigit#1\endcsname##1{%
+    \endcsname
+    0%
+    \ifcase##1 %
+      #1%
+    \else
+      #2%
+    \fi
+  }%
+}
+\InCa at Temp 01
+\InCa at Temp 12
+\InCa at Temp 23
+\InCa at Temp 34
+\InCa at Temp 45
+\InCa at Temp 56
+\InCa at Temp 67
+\InCa at Temp 78
+\InCa at Temp 89
+\expandafter\def\csname InCa at IncDigit9\endcsname#1{%
+  \expandafter\endcsname
+  \ifcase#1 %
+    09%
+  \else
+    10%
+  \fi
+}
+\def\InCa at Dec#1#2{%
+  \ifx#2!%
+    \csname InCa at DecDigit#1\endcsname1%
+  \else
+    \csname InCa at DecDigit#1%
+    \expandafter\InCa at Dec\expandafter#2%
+  \fi
+}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at DecDigit#1\endcsname##1{%
+    \endcsname
+    0%
+    \ifcase##1 %
+      #1%
+    \else
+      #2%
+    \fi
+  }%
+}
+\InCa at Temp 98
+\InCa at Temp 87
+\InCa at Temp 76
+\InCa at Temp 65
+\InCa at Temp 54
+\InCa at Temp 43
+\InCa at Temp 32
+\InCa at Temp 21
+\InCa at Temp 10
+\expandafter\def\csname InCa at DecDigit0\endcsname#1{%
+  \expandafter\endcsname
+  \ifcase#1 %
+    00%
+  \else
+    19%
+  \fi
+}
+\def\intcalcAdd#1#2{%
+  \number
+    \expandafter\InCa at AddSwitch
+    \number\number#1\expandafter!%
+    \number#2! %
+}
+\def\intcalcSub#1#2{%
+  \number
+    \expandafter\InCa at AddSwitch
+    \number\number#1\expandafter!%
+    \number-\number#2! %
+}
+\def\InCa at AddSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      -%
+      \ifnum#1<#2 %
+        \expandafter\InCa at Add\number-#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Add\number-#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \else
+      \ifnum-#1>#2 %
+        -%
+        \expandafter\InCa at Sub\@gobble#1!#2!%
+      \else
+        \expandafter\InCa at Sub\number#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \fi
+  \else
+    \ifnum#2<\z@
+      \ifnum#1>-#2 %
+        \expandafter\InCa at Sub\number#1\expandafter!%
+        \@gobble#2!%
+      \else
+        -%
+        \expandafter\InCa at Sub\@gobble#2!#1!%
+      \fi
+    \else
+      \ifnum#1>#2 %
+        \InCa at Add#1!#2!%
+      \else
+        \InCa at Add#2!#1!%
+      \fi
+    \fi
+  \fi
+}
+\def\IntCalcAdd#1!#2!{%
+  \number\InCa at Add#1!#2! %
+}
+\def\IntCalcSub#1!#2!{%
+  \number\InCa at Sub#1!#2! %
+}
+\begingroup
+  \def\x#1{\endgroup
+    \let\InCa at Space= #1%
+  }%
+\x{ }
+\def\InCa at Add#1!#2!{%
+  \ifcase#2 %
+    #1%
+  \else
+    \InCa@@Add#1!#2!000000000\InCa at Space
+  \fi
+}
+\def\InCa at Sub#1!#2!{%
+  \ifnum#1=#2 %
+    0%
+  \else
+    \InCa@@Sub#1!#2!000000000\InCa at Space
+  \fi
+}
+\def\InCa@@Add#1!#2#3!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \@ReturnAfterElseFi{%
+      \InCa@@@Add!!#1!#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@Add#1!#3!#2%
+    }%
+  \fi
+}
+\def\InCa@@Sub#1!#2#3!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \@ReturnAfterElseFi{%
+      \InCa@@@Sub!!#1!#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@Sub#1!#3!#2%
+    }%
+  \fi
+}
+\def\InCa@@@Add#1!#2!#3#4!#5{%
+  \ifx\InCa at Empty#4\InCa at Empty
+    \csname InCa at Empty%
+    \@ReturnAfterElseFi{%
+      \InCa at ProcessAdd#1#3!#5#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@@Add#1#3!#5#2!#4!%
+    }%
+  \fi
+}
+\def\InCa@@@Sub#1!#2!#3#4!#5{%
+  \ifx\InCa at Empty#4\InCa at Empty
+    \csname @gobble%
+    \@ReturnAfterElseFi{%
+      \InCa at ProcessSub#1#3!#5#2%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@@Sub#1#3!#5#2!#4!%
+    }%
+  \fi
+}
+\def\InCa at ProcessAdd#1#2!#3#4{%
+  \ifx\InCa at Empty#2\InCa at Empty
+    \csname InCa at AddDigit#1\endcsname#3%
+    \romannumeral0#4%
+  \else
+    \csname InCa at AddDigit#1\csname InCa at DigitCarry#3%
+    \@ReturnAfterFi{%
+      \InCa at ProcessAdd#2!#4%
+    }%
+  \fi
+}
+\def\InCa at ProcessSub#1#2!#3#4{%
+  \ifx\InCa at Empty#2\InCa at Empty
+    \csname InCa at SubDigit#1\endcsname#3%
+    \romannumeral0#4%
+  \else
+    \csname InCa at SubDigit#1\csname InCa at DigitCarry#3%
+    \@ReturnAfterFi{%
+      \InCa at ProcessSub#2!#4%
+    }%
+  \fi
+}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at DigitCarry#1\endcsname##1{%
+    \ifcase##1 %
+      \endcsname#1%
+    \else
+      \endcsname#2%
+    \fi
+  }%
+}
+\InCa at Temp 01
+\InCa at Temp 12
+\InCa at Temp 23
+\InCa at Temp 34
+\InCa at Temp 45
+\InCa at Temp 56
+\InCa at Temp 67
+\InCa at Temp 78
+\InCa at Temp 89
+\InCa at Temp 9{{10}}
+\expandafter\def\csname InCa at AddDigit0\endcsname#1{%
+  \ifnum#1>9 %
+    \endcsname10%
+  \else
+    \endcsname0#1%
+  \fi
+}
+\def\InCa at Temp#1#2#3{%
+  \expandafter\def\csname InCa at AddDigit#1\endcsname##1{%
+    \ifnum##1>#2 %
+      \endcsname 1%
+    \else
+      \endcsname 0%
+    \fi
+    \ifcase##1 #1% 0
+    #3%
+    \else #1% 10
+    \fi
+  }%
+}
+\InCa at Temp 18{%
+  \or 2% 1
+  \or 3% 2
+  \or 4% 3
+  \or 5% 4
+  \or 6% 5
+  \or 7% 6
+  \or 8% 7
+  \or 9% 8
+  \or 0% 9
+}%
+\InCa at Temp 27{%
+  \or 3% 1
+  \or 4% 2
+  \or 5% 3
+  \or 6% 4
+  \or 7% 5
+  \or 8% 6
+  \or 9% 7
+  \or 0% 8
+  \or 1% 9
+}%
+\InCa at Temp 36{%
+  \or 4% 1
+  \or 5% 2
+  \or 6% 3
+  \or 7% 4
+  \or 8% 5
+  \or 9% 6
+  \or 0% 7
+  \or 1% 8
+  \or 2% 9
+}%
+\InCa at Temp 45{%
+  \or 5% 1
+  \or 6% 2
+  \or 7% 3
+  \or 8% 4
+  \or 9% 5
+  \or 0% 6
+  \or 1% 7
+  \or 2% 8
+  \or 3% 9
+}%
+\InCa at Temp 54{%
+  \or 6% 1
+  \or 7% 2
+  \or 8% 3
+  \or 9% 4
+  \or 0% 5
+  \or 1% 6
+  \or 2% 7
+  \or 3% 8
+  \or 4% 9
+}%
+\InCa at Temp 63{%
+  \or 7% 1
+  \or 8% 2
+  \or 9% 3
+  \or 0% 4
+  \or 1% 5
+  \or 2% 6
+  \or 3% 7
+  \or 4% 8
+  \or 5% 9
+}%
+\InCa at Temp 72{%
+  \or 8% 1
+  \or 9% 2
+  \or 0% 3
+  \or 1% 4
+  \or 2% 5
+  \or 3% 6
+  \or 4% 7
+  \or 5% 8
+  \or 6% 9
+}%
+\InCa at Temp 81{%
+  \or 9% 1
+  \or 0% 2
+  \or 1% 3
+  \or 2% 4
+  \or 3% 5
+  \or 4% 6
+  \or 5% 7
+  \or 6% 8
+  \or 7% 9
+}%
+\InCa at Temp 90{%
+  \or 0% 1
+  \or 1% 2
+  \or 2% 3
+  \or 3% 4
+  \or 4% 5
+  \or 5% 6
+  \or 6% 7
+  \or 7% 8
+  \or 8% 9
+}%
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at SubDigit#1\endcsname##1{%
+    \ifnum##1>#1 %
+      \endcsname 1%
+    \else
+      \endcsname 0%
+    \fi
+    \ifcase##1 #1% 0
+    #2%
+    \else #1% 10
+    \fi
+  }%
+}
+\InCa at Temp 0{%
+  \or 9% 1
+  \or 8% 2
+  \or 7% 3
+  \or 6% 4
+  \or 5% 5
+  \or 4% 6
+  \or 3% 7
+  \or 2% 8
+  \or 1% 9
+}
+\InCa at Temp 1{%
+  \or 0% 1
+  \or 9% 2
+  \or 8% 3
+  \or 7% 4
+  \or 6% 5
+  \or 5% 6
+  \or 4% 7
+  \or 3% 8
+  \or 2% 9
+}
+\InCa at Temp 2{%
+  \or 1% 1
+  \or 0% 2
+  \or 9% 3
+  \or 8% 4
+  \or 7% 5
+  \or 6% 6
+  \or 5% 7
+  \or 4% 8
+  \or 3% 9
+}
+\InCa at Temp 3{%
+  \or 2% 1
+  \or 1% 2
+  \or 0% 3
+  \or 9% 4
+  \or 8% 5
+  \or 7% 6
+  \or 6% 7
+  \or 5% 8
+  \or 4% 9
+}
+\InCa at Temp 4{%
+  \or 3% 1
+  \or 2% 2
+  \or 1% 3
+  \or 0% 4
+  \or 9% 5
+  \or 8% 6
+  \or 7% 7
+  \or 6% 8
+  \or 5% 9
+}
+\InCa at Temp 5{%
+  \or 4% 1
+  \or 3% 2
+  \or 2% 3
+  \or 1% 4
+  \or 0% 5
+  \or 9% 6
+  \or 8% 7
+  \or 7% 8
+  \or 6% 9
+}
+\InCa at Temp 6{%
+  \or 5% 1
+  \or 4% 2
+  \or 3% 3
+  \or 2% 4
+  \or 1% 5
+  \or 0% 6
+  \or 9% 7
+  \or 8% 8
+  \or 7% 9
+}
+\InCa at Temp 7{%
+  \or 6% 1
+  \or 5% 2
+  \or 4% 3
+  \or 3% 4
+  \or 2% 5
+  \or 1% 6
+  \or 0% 7
+  \or 9% 8
+  \or 8% 9
+}
+\InCa at Temp 8{%
+  \or 7% 1
+  \or 6% 2
+  \or 5% 3
+  \or 4% 4
+  \or 3% 5
+  \or 2% 6
+  \or 1% 7
+  \or 0% 8
+  \or 9% 9
+}
+\InCa at Temp 9{%
+  \or 8% 1
+  \or 7% 2
+  \or 6% 3
+  \or 5% 4
+  \or 4% 5
+  \or 3% 6
+  \or 2% 7
+  \or 1% 8
+  \or 0% 9
+}
+\def\intcalcShl#1{%
+  \number\expandafter\InCa at ShlSwitch\number#1! %
+}
+\def\InCa at ShlSwitch#1#2!{%
+  \ifx#1-%
+    -\csname InCa at Empty%
+    \InCa at Shl#2!%
+  \else
+    \csname InCa at Empty%
+    \InCa at Shl#1#2!%
+  \fi
+}
+\def\IntCalcShl#1!{%
+  \number
+  \csname InCa at Empty%
+  \InCa at Shl#1! %
+}
+\def\InCa at Shl#1#2{%
+  \ifx#2!%
+    \csname InCa at ShlDigit#1\endcsname0%
+  \else
+    \csname InCa at ShlDigit#1%
+    \@ReturnAfterFi{%
+      \InCa at Shl#2%
+    }%
+  \fi
+}
+\expandafter\def\csname InCa at ShlDigit0\endcsname{%
+  \endcsname0%
+}
+\def\InCa at Temp#1#2#3#4#5{%
+  \expandafter\def\csname InCa at ShlDigit#1\endcsname##1{%
+    \expandafter\endcsname
+    \ifcase##1 %
+      #2#3%
+    \else
+      #4#5%
+    \fi
+  }%
+}
+\InCa at Temp 10203
+\InCa at Temp 20405
+\InCa at Temp 30607
+\InCa at Temp 40809
+\InCa at Temp 51011
+\InCa at Temp 61213
+\InCa at Temp 71415
+\InCa at Temp 81617
+\InCa at Temp 91819
+\def\intcalcShr#1{%
+  \number\expandafter\InCa at ShrSwitch\number#1! %
+}
+\def\InCa at ShrSwitch#1#2!{%
+  \ifx#1-%
+    -\InCa at Shr#2!%
+  \else
+    \InCa at Shr#1#2!%
+  \fi
+}
+\def\IntCalcShr#1!{%
+  \number\InCa at Shr#1! %
+}
+\def\InCa at Shr#1#2{%
+  \InCa at ShrDigit#1!%
+  \ifx#2!%
+  \else
+    \@ReturnAfterFi{%
+      \ifodd#1 %
+        \@ReturnAfterElseFi{%
+          \InCa at Shr{1#2}%
+        }%
+      \else
+        \expandafter\InCa at Shr\expandafter#2%
+      \fi
+    }%
+  \fi
+}
+\def\InCa at ShrDigit#1!{%
+  \ifcase#1 0% 0
+  \or 0% 1
+  \or 1% 2
+  \or 1% 3
+  \or 2% 4
+  \or 2% 5
+  \or 3% 6
+  \or 3% 7
+  \or 4% 8
+  \or 4% 9
+  \or 5% 10
+  \or 5% 11
+  \or 6% 12
+  \or 6% 13
+  \or 7% 14
+  \or 7% 15
+  \or 8% 16
+  \or 8% 17
+  \or 9% 18
+  \or 9% 19
+  \fi
+}
+\def\InCa at Temp#1{%
+  \def\InCa at Tim##1##2{%
+    \number
+      \ifcase##2 % 0
+        0%
+      \or % 1
+        ##1%
+      \else % 2-9
+        \csname InCa at Empty%
+        \InCa at ProcessTim##2##1!%
+      \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }
+\def\InCa at ProcessTim#1#2#3{%
+  \ifx#3!%
+    \csname InCa at TimDigit#2\endcsname#10%
+  \else
+    \csname InCa at TimDigit#2\csname InCa at Param#1%
+    \@ReturnAfterFi{%
+      \InCa at ProcessTim#1#3%
+    }%
+  \fi
+}
+\def\InCa at Temp#1{%
+  \expandafter\def\csname InCa at Param#1\endcsname{%
+    \endcsname#1%
+  }%
+}
+\InCa at Temp 0%
+\InCa at Temp 1%
+\InCa at Temp 2%
+\InCa at Temp 3%
+\InCa at Temp 4%
+\InCa at Temp 5%
+\InCa at Temp 6%
+\InCa at Temp 7%
+\InCa at Temp 8%
+\InCa at Temp 9%
+\expandafter\def\csname InCa at TimDigit0\endcsname#1#2{%
+  \endcsname
+  0#2%
+}
+\expandafter\def\csname InCa at TimDigit1\endcsname#1#2{%
+  \ifcase#2 %
+    \endcsname 0#1%
+  \else
+    \csname InCa at AddDigit#1\endcsname #2%
+  \fi
+}
+\def\InCa at Temp#1#2{%
+  \expandafter\def\csname InCa at TimDigit#1\endcsname##1{%
+    \expandafter\InCa at TimDigitCarry
+    \number
+      \ifcase##1 0% 0
+      #2%
+      \fi
+    !%
+  }%
+}
+\InCa at Temp 2{%
+  \or  2% 1
+  \or  4% 2
+  \or  6% 3
+  \or  8% 4
+  \or 10% 5
+  \or 12% 6
+  \or 14% 7
+  \or 16% 8
+  \or 18% 9
+}
+\InCa at Temp 3{%
+  \or  3% 1
+  \or  6% 2
+  \or  9% 3
+  \or 12% 4
+  \or 15% 5
+  \or 18% 6
+  \or 21% 7
+  \or 24% 8
+  \or 27% 9
+}
+\InCa at Temp 4{%
+  \or  4% 1
+  \or  8% 2
+  \or 12% 3
+  \or 16% 4
+  \or 20% 5
+  \or 24% 6
+  \or 28% 7
+  \or 32% 8
+  \or 36% 9
+}
+\InCa at Temp 5{%
+  \or  5% 1
+  \or 10% 2
+  \or 15% 3
+  \or 20% 4
+  \or 25% 5
+  \or 30% 6
+  \or 35% 7
+  \or 40% 8
+  \or 45% 9
+}
+\InCa at Temp 6{%
+  \or  6% 1
+  \or 12% 2
+  \or 18% 3
+  \or 24% 4
+  \or 30% 5
+  \or 36% 6
+  \or 42% 7
+  \or 48% 8
+  \or 54% 9
+}
+\InCa at Temp 7{%
+  \or  7% 1
+  \or 14% 2
+  \or 21% 3
+  \or 28% 4
+  \or 35% 5
+  \or 42% 6
+  \or 49% 7
+  \or 56% 8
+  \or 63% 9
+}
+\InCa at Temp 8{%
+  \or  8% 1
+  \or 16% 2
+  \or 24% 3
+  \or 32% 4
+  \or 40% 5
+  \or 48% 6
+  \or 56% 7
+  \or 64% 8
+  \or 72% 9
+}
+\InCa at Temp 9{%
+  \or  9% 1
+  \or 18% 2
+  \or 27% 3
+  \or 36% 4
+  \or 45% 5
+  \or 54% 6
+  \or 63% 7
+  \or 72% 8
+  \or 81% 9
+}
+\def\InCa at TimDigitCarry#1!{%
+  \ifnum#1<10 %
+    \csname InCa at AddDigit#1\expandafter\endcsname
+  \else
+    \@ReturnAfterFi{%
+      \InCa@@TimDigitCarry#1!%
+    }%
+  \fi
+}
+\def\InCa@@TimDigitCarry#1#2!#3{%
+  \csname InCa at DigitCarry#1%
+  \csname InCa at AddDigit#2\endcsname #3%
+}
+\def\intcalcMul#1#2{%
+  \number
+    \expandafter\InCa at MulSwitch
+    \number\number#1\expandafter!%
+    \number#2! %
+}
+\def\InCa at MulSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      \ifnum#1<#2 %
+        \expandafter\InCa at Mul\number-#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Mul\number-#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \else
+      -%
+      \ifnum-#1>#2 %
+        \expandafter\InCa at Mul\@gobble#1!#2!%
+      \else
+        \expandafter\InCa at Mul\number#2\expandafter!%
+        \@gobble#1!%
+      \fi
+    \fi
+  \else
+    \ifnum#2<\z@
+      -%
+      \ifnum#1>-#2 %
+        \expandafter\InCa at Mul\number#1\expandafter!%
+        \@gobble#2!%
+      \else
+        \expandafter\InCa at Mul\@gobble#2!#1!%
+      \fi
+    \else
+      \ifnum#1>#2 %
+        \InCa at Mul#1!#2!%
+      \else
+        \InCa at Mul#2!#1!%
+      \fi
+    \fi
+  \fi
+}
+\def\IntCalcMul#1!#2!{%
+  \number\InCa at Mul#1!#2! %
+}
+\def\InCa at Mul#1!#2!{%
+  \ifcase#2 %
+    0%
+  \or
+    #1%
+  \or
+    \csname InCa at Empty%
+    \expandafter\InCa at Shl#1!%
+  \else
+    \ifnum#2<10 %
+      \InCa at Tim{#1}#2%
+    \else
+      \InCa at ProcessMul!#2!#1!%
+    \fi
+  \fi
+}
+\def\InCa at ProcessMul#1!#2#3!#4!{%
+  \ifx\InCa at Empty#3\InCa at Empty
+    \expandafter\InCa at Add\number
+    #10\expandafter\expandafter\expandafter!%
+    \InCa at Tim{#4}#2!%
+  \else
+    \ifx\InCa at Empty#1\InCa at Empty
+      \expandafter\expandafter\expandafter\InCa at ProcessMul
+      \InCa at Tim{#4}#2!%
+      #3!#4!%
+    \else
+      \expandafter\InCa at ProcessMul\number
+      \expandafter\InCa at Add\number%
+      #10\expandafter\expandafter\expandafter!%
+      \InCa at Tim{#4}#2!!%
+      #3!#4!%
+    \fi
+  \fi
+}
+\def\intcalcSqr#1{%
+  \number\expandafter\InCa at Sqr\number#1! %
+}
+\def\InCa at Sqr#1#2!{%
+  \ifx#1-%
+    \InCa at Mul#2!#2!%
+  \else
+    \InCa at Mul#1#2!#1#2!%
+  \fi
+}
+\def\intcalcFac#1{%
+  \number\expandafter\InCa at Fac\number#1! %
+}
+\def\intcalcPow#1#2{%
+  \number\expandafter\InCa at Pow
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+\def\InCa at Pow#1#2!#3#4!{%
+  \ifcase#3#4 % power = 0
+    1%
+  \or % power = 1
+    #1#2%
+  \or % power = 2
+    \ifx#1-%
+      \InCa at Mul#2!#2!%
+    \else
+      \InCa at Mul#1#2!#1#2!%
+    \fi
+  \else
+    \ifcase#1#2 % basis = 0, power <> 0
+      0%
+      \ifx#3-% power < 0
+        0\IntCalcError:DivisionByZero%
+      \fi
+    \or
+      1% basis = 1
+    \else
+      \ifnum#1#2=\m at ne % basis = -1
+        \ifodd#3#4 %
+          -%
+        \fi
+        1%
+      \else % |basis| > 1
+        \ifx#3-% power < 0
+          0%
+        \else % power > 2
+          \ifx#1-% basis < 0
+            \ifodd#3#4 %
+              -%
+            \fi
+            \InCa at PowRec#2!#3#4!1!%
+          \else
+            \InCa at PowRec#1#2!#3#4!1!%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
+\def\InCa at PowRec#1!#2!#3!{%
+  \ifnum#2=\@ne
+    \ifnum#1>#3 %
+      \InCa at Mul#1!#3!%
+    \else
+      \InCa at Mul#3!#1!%
+    \fi
+  \else
+    \expandafter\InCa at PowRec
+    \number\InCa at Mul#1!#1!\expandafter!%
+    \number\intcalcShr{#2}\expandafter!%
+    \number
+    \ifodd#2 %
+      \ifnum#1>#3 %
+        \InCa at Mul#1!#3!%
+      \else
+        \InCa at Mul#3!#1!%
+      \fi
+    \else
+      #3%
+    \fi
+    \expandafter!%
+  \fi
+}
+\def\intcalcDiv#1#2{%
+  \number\expandafter\InCa at Div
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+\def\InCa at Div#1!#2!{%
+  \ifcase#2 %
+    0\IntCalcError:DivisionByZero%
+  \else
+    \ifcase#1 %
+      0%
+    \else
+      \expandafter\InCa at DivSwitch
+      \number#1\expandafter!%
+      \number#2!%
+    \fi
+  \fi
+}
+\def\InCa at Temp#1{%
+  \def\IntCalcDiv##1!##2!{%
+    \number
+    \ifcase##2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase##1 %
+        0%
+      \else
+        \InCa@@Div##1!##2!%
+      \fi
+    \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }%
+\def\InCa at DivSwitch#1!#2!{%
+  \ifnum#1<\z@
+    \ifnum#2<\z@
+      \expandafter\InCa@@Div\number-#1\expandafter!%
+      \@gobble#2!%
+    \else
+      -%
+      \expandafter\InCa@@Div\@gobble#1!#2!%
+    \fi
+  \else
+    \ifnum#2<\z@
+      -%
+      \expandafter\InCa@@Div\number#1\expandafter!%
+      \@gobble#2!%
+    \else
+      \InCa@@Div#1!#2!%
+    \fi
+  \fi
+}
+\def\InCa@@Div#1!#2!{%
+  \ifnum#1>#2 %
+    \ifcase#2 % 0 already catched
+?     \IntCalcError:ThisCannotHappen%
+    \or % 1
+      #1%
+    \or % 2
+      \InCa at Shr#1!%
+    \else
+      \InCa at DivStart!#1!#2!#2!%
+    \fi
+  \else
+    \ifnum#1=#2 %
+      1%
+    \else
+      0%
+    \fi
+  \fi
+}
+\def\InCa at DivStart#1!#2#3!#4#5{%
+  \ifx#5!%
+    \@ReturnAfterElseFi{%
+      \InCa at DivStartI{#1#2}#3=!%
+    }%
+  \else
+    \@ReturnAfterFi{%
+      \InCa at DivStart{#1#2}!#3!#5%
+    }%
+  \fi
+}
+\def\InCa at DivStartI#1!#2!{%
+  \expandafter\InCa at DivStartII
+  \number#2\expandafter\expandafter\expandafter!%
+  \intcalcShl{#2}!%
+  #1!%
+}
+\def\InCa at DivStartII#1!#2!{%
+  \expandafter\InCa at DivStartIII
+  \number#1\expandafter!%
+  \number#2\expandafter\expandafter\expandafter!%
+  \intcalcShl{#2}!%
+}
+\def\InCa at DivStartIII#1!#2!#3!{%
+  \expandafter\InCa at DivStartIV
+  \number#1\expandafter!%
+  \number#2\expandafter!%
+  \number#3\expandafter!%
+  \number\InCa at Add#3!#2!\expandafter\expandafter\expandafter!%
+  \intcalcShl{#3}!%
+}
+\def\InCa at DivStartIV#1!#2!#3!#4!#5!#6!{%
+  \InCa at ProcessDiv#6!#1!#2!#3!#4!#5!/%
+}
+\def\InCa at ProcessDiv#1#2#3!#4!#5!#6!#7!#8!#9/{%
+  #9%
+  \ifnum#1<#4 % 0
+    0%
+    \ifx#2=%
+    \else
+      \InCa at ProcessDiv{#1#2}#3!#4!#5!#6!#7!#8!%
+    \fi
+  \else % 1-9
+    \ifnum#1<#5 % 1
+      1%
+      \ifx#2=%
+      \else
+        \expandafter\InCa at ProcessDiv\expandafter{%
+          \number\InCa at Sub#1!#4!%
+          #2%
+        }#3!#4!#5!#6!#7!#8!%
+      \fi
+    \else % 2-9
+      \ifnum#1<#7 % 2 3 4 5
+        \ifnum#1<#6 % 2 3
+          \@ReturnAfterElseFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#5!!%
+            23%
+          }%
+        \else % 4 5
+          \@ReturnAfterFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#6!!%
+            45%
+          }%
+        \fi
+        #2#3!#4!#5!#6!#7!#8!%
+      \else % 6 7 8 9
+        \ifnum#1<#8 % 6 7
+          \@ReturnAfterElseFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#7!!%
+            67%
+          }%
+        \else % 8 9
+          \@ReturnAfterFi{%
+            \expandafter\InCa@@ProcessDiv
+            \number\InCa at Sub#1!#8!!%
+            89%
+          }%
+        \fi
+        #2#3!#4!#5!#6!#7!#8!%
+      \fi
+    \fi
+  \fi
+  \ifx#2=%
+    \expandafter\@gobble
+  \fi
+  /%
+}
+\def\InCa@@ProcessDiv#1!#2#3#4#5!#6!{%
+  \ifnum#1<#6 %
+    #2%
+    \@ReturnAfterElseFi{%
+      \ifx#4=%
+        \expandafter\InCa at CleanupIV
+      \else
+        \@ReturnAfterFi{%
+          \InCa at ProcessDiv{#1#4}#5!#6!%
+        }%
+      \fi
+    }%
+  \else
+    #3%
+    \@ReturnAfterFi{%
+      \ifx#4=%
+        \expandafter\InCa at CleanupIV
+      \else
+        \@ReturnAfterFi{%
+          \expandafter\InCa at ProcessDiv\expandafter{%
+            \number\InCa at Sub#1!#6! %
+            #4%
+          }#5!#6!%
+        }%
+      \fi
+    }%
+  \fi
+}
+\def\InCa at CleanupIV#1!#2!#3!#4!{}
+\def\intcalcMod#1#2{%
+  \number\expandafter\InCa at Mod
+  \number\number#1\expandafter!%
+  \number#2! %
+}
+\def\InCa at Mod#1!#2!{%
+  \ifcase#2 %
+    0\IntCalcError:DivisionByZero%
+  \else
+    \ifnum#2<\z@
+      -%
+      \expandafter\InCa at Mod
+      \number-#1\expandafter!%
+      \number-#2!%
+    \else
+      \ifcase#1 %
+        0%
+      \else
+        \ifcase#2 % 0 already catched
+?         \IntCalcError:ThisCannotHappen%
+        \or % 1
+          0%
+        \or % 2
+          \ifodd#1 1\else 0\fi
+        \else
+          \ifnum#1<\z@
+            \expandafter\InCa at ModShift
+            \number-%
+              \expandafter\InCa at Sub
+              \number\@gobble#1\expandafter!%
+              \number\intcalcMul{#2}{%
+                \expandafter\InCa at Div\@gobble#1!#2!%
+              }!%
+            !#2!%
+          \else
+            \expandafter\InCa at Sub\number#1\expandafter!%
+            \number\intcalcMul{#2}{\InCa at Div#1!#2!}!%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
+\def\InCa at Temp#1{%
+  \def\IntCalcMod##1!##2!{%
+    \number
+    \ifcase##2 %
+      0\IntCalcError:DivisionByZero%
+    \else
+      \ifcase##1 %
+        0%
+      \else
+        \ifcase##2 % 0 already catched
+?         \IntCalcError:ThisCannotHappen
+        \or % 1
+          0%
+        \or % 2
+          \ifodd ##1 1\else 0\fi
+        \else
+          \expandafter\InCa at Sub\number##1\expandafter!%
+          \number\intcalcMul{##2}{\InCa at Div##1!##2!}!%
+        \fi
+      \fi
+    \fi
+    #1%
+  }%
+}
+\InCa at Temp{ }%
+\def\InCa at ModShift#1!#2!{%
+  \ifnum#1<\z@
+    \expandafter\InCa at Sub\number#2\expandafter!%
+    \@gobble#1!%
+  \else
+    #1%
+  \fi
+}
+\def\InCa at Empty{}
+\expandafter\ifx\csname @gobble\endcsname\relax
+  \long\def\@gobble#1{}%
+\fi
+\long\def\@ReturnAfterFi#1\fi{\fi#1}%
+\long\def\@ReturnAfterElseFi#1\else#2\fi{\fi#1}%
+\InCa at AtEnd%
+%% \section{Installation}
+\endinput
+%%
+%% End of file `intcalc.sty'.


Property changes on: trunk/Master/texmf-dist/tex/generic/intcalc/intcalc.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2019-12-17 23:23:06 UTC (rev 53167)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2019-12-17 23:24:25 UTC (rev 53168)
@@ -366,7 +366,8 @@
     incgraph includernw inconsolata index indextools infwarerr
     initials inkpaper inline-images inlinebib inlinedef
     inputenx inputtrc inriafonts insbox installfont
-    interactiveworkbook interchar interfaces interpreter interval intopdf
+    intcalc interactiveworkbook
+    interchar interfaces interpreter interval intopdf
     intro-scientific
     inversepath invoice invoice-class invoice2
     iodhbwm ionumbers iopart-num ipaex ipaex-type1 is-bst iscram iso

Modified: trunk/Master/tlpkg/tlpsrc/collection-latex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latex.tlpsrc	2019-12-17 23:23:06 UTC (rev 53167)
+++ trunk/Master/tlpkg/tlpsrc/collection-latex.tlpsrc	2019-12-17 23:24:25 UTC (rev 53168)
@@ -24,6 +24,7 @@
 depend graphics-cfg
 depend grfext
 depend hyperref
+depend intcalc
 depend kvdefinekeys
 depend kvoptions
 depend kvsetkeys

Added: trunk/Master/tlpkg/tlpsrc/intcalc.tlpsrc
===================================================================


More information about the tex-live-commits mailing list