summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/oberdiek/intcalc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/oberdiek/intcalc.dtx')
-rw-r--r--macros/latex/contrib/oberdiek/intcalc.dtx977
1 files changed, 1 insertions, 976 deletions
diff --git a/macros/latex/contrib/oberdiek/intcalc.dtx b/macros/latex/contrib/oberdiek/intcalc.dtx
index 586ae3959e..245cc21812 100644
--- a/macros/latex/contrib/oberdiek/intcalc.dtx
+++ b/macros/latex/contrib/oberdiek/intcalc.dtx
@@ -67,10 +67,6 @@
% Installation:
% TDS:tex/generic/oberdiek/intcalc.sty
% TDS:doc/latex/oberdiek/intcalc.pdf
-% TDS:doc/latex/oberdiek/test/intcalc-test1.tex
-% TDS:doc/latex/oberdiek/test/intcalc-test2.tex
-% TDS:doc/latex/oberdiek/test/intcalc-test3.tex
-% TDS:doc/latex/oberdiek/test/intcalc-test4.tex
% TDS:source/latex/oberdiek/intcalc.dtx
%
%<*ignore>
@@ -145,10 +141,6 @@ and the derived files
% \file{intcalc-test2.tex}{\from{intcalc.dtx}{test2,etex}}%
% \file{intcalc-test3.tex}{\from{intcalc.dtx}{test2,noetex}}%
% \file{intcalc-test4.tex}{\from{intcalc.dtx}{test4,etex}}%
- \nopreamble
- \nopostamble
-% \usedir{source/latex/oberdiek/catalogue}%
-% \file{intcalc.xml}{\from{intcalc.dtx}{catalogue}}%
}
\catcode32=13\relax% active space
@@ -219,21 +211,6 @@ and the derived files
% \fi
%
%
-% \CharacterTable
-% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-% Digits \0\1\2\3\4\5\6\7\8\9
-% Exclamation \! Double quote \" Hash (number) \#
-% Dollar \$ Percent \% Ampersand \&
-% Acute accent \' Left paren \( Right paren \)
-% Asterisk \* Plus \+ Comma \,
-% Minus \- Point \. Solidus \/
-% Colon \: Semicolon \; Less than \<
-% Equals \= Greater than \> Question mark \?
-% Commercial at \@ Left bracket \[ Backslash \\
-% Right bracket \] Circumflex \^ Underscore \_
-% Grave accent \` Left brace \{ Vertical bar \|
-% Right brace \} Tilde \~}
%
% \GetFileInfo{intcalc.drv}
%
@@ -3119,955 +3096,7 @@ and the derived files
% \begin{macrocode}
%</package>
% \end{macrocode}
-%
-% \section{Test}
-%
-% \subsection{Catcode checks for loading}
-%
-% \begin{macrocode}
-%<*test1>
-% \end{macrocode}
-% \begin{macrocode}
-\catcode`\{=1 %
-\catcode`\}=2 %
-\catcode`\#=6 %
-\catcode`\@=11 %
-\expandafter\ifx\csname count@\endcsname\relax
- \countdef\count@=255 %
-\fi
-\expandafter\ifx\csname @gobble\endcsname\relax
- \long\def\@gobble#1{}%
-\fi
-\expandafter\ifx\csname @firstofone\endcsname\relax
- \long\def\@firstofone#1{#1}%
-\fi
-\expandafter\ifx\csname loop\endcsname\relax
- \expandafter\@firstofone
-\else
- \expandafter\@gobble
-\fi
-{%
- \def\loop#1\repeat{%
- \def\body{#1}%
- \iterate
- }%
- \def\iterate{%
- \body
- \let\next\iterate
- \else
- \let\next\relax
- \fi
- \next
- }%
- \let\repeat=\fi
-}%
-\def\RestoreCatcodes{}
-\count@=0 %
-\loop
- \edef\RestoreCatcodes{%
- \RestoreCatcodes
- \catcode\the\count@=\the\catcode\count@\relax
- }%
-\ifnum\count@<255 %
- \advance\count@ 1 %
-\repeat
-
-\def\RangeCatcodeInvalid#1#2{%
- \count@=#1\relax
- \loop
- \catcode\count@=15 %
- \ifnum\count@<#2\relax
- \advance\count@ 1 %
- \repeat
-}
-\def\RangeCatcodeCheck#1#2#3{%
- \count@=#1\relax
- \loop
- \ifnum#3=\catcode\count@
- \else
- \errmessage{%
- Character \the\count@\space
- with wrong catcode \the\catcode\count@\space
- instead of \number#3%
- }%
- \fi
- \ifnum\count@<#2\relax
- \advance\count@ 1 %
- \repeat
-}
-\def\space{ }
-\expandafter\ifx\csname LoadCommand\endcsname\relax
- \def\LoadCommand{\input intcalc.sty\relax}%
-\fi
-\def\Test{%
- \RangeCatcodeInvalid{0}{47}%
- \RangeCatcodeInvalid{58}{64}%
- \RangeCatcodeInvalid{91}{96}%
- \RangeCatcodeInvalid{123}{255}%
- \catcode`\@=12 %
- \catcode`\\=0 %
- \catcode`\%=14 %
- \LoadCommand
- \RangeCatcodeCheck{0}{36}{15}%
- \RangeCatcodeCheck{37}{37}{14}%
- \RangeCatcodeCheck{38}{47}{15}%
- \RangeCatcodeCheck{48}{57}{12}%
- \RangeCatcodeCheck{58}{63}{15}%
- \RangeCatcodeCheck{64}{64}{12}%
- \RangeCatcodeCheck{65}{90}{11}%
- \RangeCatcodeCheck{91}{91}{15}%
- \RangeCatcodeCheck{92}{92}{0}%
- \RangeCatcodeCheck{93}{96}{15}%
- \RangeCatcodeCheck{97}{122}{11}%
- \RangeCatcodeCheck{123}{255}{15}%
- \RestoreCatcodes
-}
-\Test
-\csname @@end\endcsname
-\end
-% \end{macrocode}
-% \begin{macrocode}
-%</test1>
-% \end{macrocode}
-%
-% \subsection{Macro tests}
-%
-% \subsubsection{Preamble with test macro definitions}
-%
-% \begin{macrocode}
-%<*test2|test4>
-\NeedsTeXFormat{LaTeX2e}
-\nofiles
-\documentclass{article}
-%<noetex>\let\SavedNumexpr\numexpr
-%<noetex>\let\numexpr\UNDEFINED
-\makeatletter
-\chardef\InCa@TestMode=1 %
-\makeatother
-\usepackage{intcalc}[2016/05/16]
-%<noetex>\let\numexpr\SavedNumexpr
-\usepackage{qstest}
-\IncludeTests{*}
-\LogTests{log}{*}{*}
-%</test2|test4>
-%<*test2>
-\newcommand*{\TestSpaceAtEnd}[1]{%
-%<noetex> \let\SavedNumexpr\numexpr
-%<noetex> \let\numexpr\UNDEFINED
- \edef\resultA{#1}%
- \edef\resultB{#1 }%
-%<noetex> \let\numexpr\SavedNumexpr
- \Expect*{\resultA\space}*{\resultB}%
-}
-\newcommand*{\TestResult}[2]{%
-%<noetex> \let\SavedNumexpr\numexpr
-%<noetex> \let\numexpr\UNDEFINED
- \edef\result{#1}%
-%<noetex> \let\numexpr\SavedNumexpr
- \Expect*{\result}{#2}%
-}
-\newcommand*{\TestResultTwoExpansions}[2]{%
-%<*noetex>
- \begingroup
- \let\numexpr\UNDEFINED
- \expandafter\expandafter\expandafter
- \endgroup
-%</noetex>
- \expandafter\expandafter\expandafter\Expect
- \expandafter\expandafter\expandafter{#1}{#2}%
-}
-\newcount\TestCount
-%<etex>\newcommand*{\TestArg}[1]{\numexpr#1\relax}
-%<noetex>\newcommand*{\TestArg}[1]{#1}
-\newcommand*{\TestTeXDivide}[2]{%
- \TestCount=\TestArg{#1}\relax
- \divide\TestCount by \TestArg{#2}\relax
- \Expect*{\intcalcDiv{#1}{#2}}*{\the\TestCount}%
-}
-\newcommand*{\Test}[2]{%
- \TestResult{#1}{#2}%
- \TestResultTwoExpansions{#1}{#2}%
- \TestSpaceAtEnd{#1}%
-}
-\newcommand*{\TestExch}[2]{\Test{#2}{#1}}
-\newcommand*{\TestInv}[2]{%
- \Test{\intcalcInv{#1}}{#2}%
-}
-\newcommand*{\TestNum}[2]{%
- \Test{\intcalcNum{#1}}{#2}%
-}
-\newcommand*{\TestAbs}[2]{%
- \Test{\intcalcAbs{#1}}{#2}%
-}
-\newcommand*{\TestSgn}[2]{%
- \Test{\intcalcSgn{#1}}{#2}%
-}
-\newcommand*{\TestMin}[3]{%
- \Test{\intcalcMin{#1}{#2}}{#3}%
-}
-\newcommand*{\TestMax}[3]{%
- \Test{\intcalcMax{#1}{#2}}{#3}%
-}
-\newcommand*{\TestCmp}[3]{%
- \Test{\intcalcCmp{#1}{#2}}{#3}%
-}
-\newcommand*{\TestInc}[2]{%
- \Test{\intcalcInc{#1}}{#2}%
- \ifnum\intcalcNum{#1}>-1 %
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcInc\intcalcNum{#1}!%
- }{#2}%
- }%
- \x
- \fi
-}
-\newcommand*{\TestDec}[2]{%
- \Test{\intcalcDec{#1}}{#2}%
- \ifnum\intcalcNum{#1}>0 %
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcDec\intcalcNum{#1}!%
- }{#2}%
- }%
- \x
- \fi
-}
-\newcommand*{\TestAdd}[3]{%
- \Test{\intcalcAdd{#1}{#2}}{#3}%
- \ifnum\intcalcNum{#1}>0 %
- \ifnum\intcalcNum{#2}> 0 %
- \ifnum\intcalcCmp{#1}{#2}>0 %
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcAdd
- \intcalcNum{#1}!\intcalcNum{#2}!%
- }{#3}%
- }%
- \x
- \else
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcAdd
- \intcalcNum{#2}!\intcalcNum{#1}!%
- }{#3}%
- }%
- \x
- \fi
- \fi
- \fi
-}
-\newcommand*{\TestSub}[3]{%
- \Test{\intcalcSub{#1}{#2}}{#3}%
- \ifnum\intcalcNum{#1}>0 %
- \ifnum\intcalcNum{#2}> 0 %
- \ifnum\intcalcCmp{#1}{#2}>0 %
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcSub
- \intcalcNum{#1}!\intcalcNum{#2}!%
- }{#3}%
- }%
- \x
- \fi
- \fi
- \fi
-}
-\newcommand*{\TestShl}[2]{%
- \Test{\intcalcShl{#1}}{#2}%
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcShl\intcalcAbs{#1}!%
- }{\intcalcAbs{#2}}%
- }%
- \x
-}
-\newcommand*{\TestShr}[2]{%
- \Test{\intcalcShr{#1}}{#2}%
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcShr\intcalcAbs{#1}!%
- }{\intcalcAbs{#2}}%
- }%
- \x
-}
-\newcommand*{\TestMul}[3]{%
- \Test{\intcalcMul{#1}{#2}}{#3}%
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcMul\intcalcAbs{#1}!\intcalcAbs{#2}!%
- }{\intcalcAbs{#3}}%
- }%
- \x
-}
-\newcommand*{\TestSqr}[2]{%
- \Test{\intcalcSqr{#1}}{#2}%
-}
-\newcommand*{\TestFac}[2]{%
- \expandafter\TestExch\expandafter{\the\numexpr#2}{\intcalcFac{#1}}%
-}
-\newcommand*{\TestPow}[3]{%
- \Test{\intcalcPow{#1}{#2}}{#3}%
-}
-\newcommand*{\TestDiv}[3]{%
- \Test{\intcalcDiv{#1}{#2}}{#3}%
- \TestTeXDivide{#1}{#2}%
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcDiv\intcalcAbs{#1}!\intcalcAbs{#2}!%
- }{\intcalcAbs{#3}}%
- }%
-}
-\newcommand*{\TestMod}[3]{%
- \Test{\intcalcMod{#1}{#2}}{#3}%
- \ifcase\ifcase\intcalcSgn{#1} 0%
- \or
- \ifcase\intcalcSgn{#2} 1%
- \or 0%
- \else 1%
- \fi
- \else
- \ifcase\intcalcSgn{#2} 1%
- \or 1%
- \else 0%
- \fi
- \fi\relax
- \edef\x{%
- \noexpand\Test{%
- \noexpand\IntCalcMod
- \intcalcAbs{#1}!\intcalcAbs{#2}!%
- }{\intcalcAbs{#3}}%
- }%
- \x
- \fi
-}
-%</test2>
-% \end{macrocode}
-%
-% \subsubsection{Time}
-%
-% \begin{macrocode}
-%<*test2>
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdfresettimer\endcsname\relax
-\else
- \makeatletter
- \newcount\SummaryTime
- \newcount\TestTime
- \SummaryTime=\z@
- \newcommand*{\PrintTime}[2]{%
- \typeout{%
- [Time #1: \strip@pt\dimexpr\number#2sp\relax\space s]%
- }%
- }%
- \newcommand*{\StartTime}[1]{%
- \renewcommand*{\TimeDescription}{#1}%
- \pdfresettimer
- }%
- \newcommand*{\TimeDescription}{}%
- \newcommand*{\StopTime}{%
- \TestTime=\pdfelapsedtime
- \global\advance\SummaryTime\TestTime
- \PrintTime\TimeDescription\TestTime
- }%
- \let\saved@qstest\qstest
- \let\saved@endqstest\endqstest
- \def\qstest#1#2{%
- \saved@qstest{#1}{#2}%
- \StartTime{#1}%
- }%
- \def\endqstest{%
- \StopTime
- \saved@endqstest
- }%
- \AtEndDocument{%
- \PrintTime{summary}\SummaryTime
- }%
- \makeatother
-\fi
-%</test2>
-% \end{macrocode}
-%
-% \subsubsection{Test 4: additional mod/div operations}
-%
-% \begin{macrocode}
-%<*test4>
-\newcommand*{\TestDo}[2]{%
- \ifcase\numexpr#2\relax
- \else
- \edef\temp{\intcalcMod{#1}{#2}}%
- \Expect*{%
- \the\numexpr
- \intcalcMul{%
- \intcalcDiv{\intcalcAbs{#1}}{\intcalcAbs{#2}}%
- }{\intcalcAbs{#2}}%
- +\intcalcMod{\intcalcAbs{#1}}{\intcalcAbs{#2}}\relax
- }*{\the\numexpr\intcalcAbs{#1}\relax}%
- \fi
-}
-\newcommand*{\TestOne}[2]{%
- \TestDo{#1}{#1}%
-}
-\newcommand*{\TestTwo}[3]{%
- \TestDo{#1}{#2}%
- \TestDo{#2}{#1}%
-}
-\let\TestNum\TestOne
-\let\TestInv\TestOne
-\let\TestAbs\TestOne
-\let\TestSgn\TestOne
-\let\TestMin\TestTwo
-\let\TestMax\TestTwo
-\let\TestCmp\TestTwo
-\let\TestInc\TestOne
-\let\TestDec\TestOne
-\let\TestAdd\TestTwo
-\let\TestSub\TestTwo
-\let\TestShl\TestOne
-\let\TestShr\TestOne
-\let\TestMul\TestTwo
-\let\TestSqr\TestOne
-\def\TestFac#1#2{}
-\let\TestPow\TestTwo
-\let\TestDiv\TestTwo
-\let\TestMod\TestTwo
-%</test4>
-% \end{macrocode}
-%
-% \subsubsection{Test sets}
-%
-% \begin{macrocode}
-%<*test2|test4>
-\makeatletter
-
-\begin{qstest}{num}{num}%
- \TestNum{0}{0}%
- \TestNum{1}{1}%
- \TestNum{-1}{-1}%
- \TestNum{10}{10}%
- \TestNum{-10}{-10}%
- \TestNum{2147483647}{2147483647}%
- \TestNum{-2147483647}{-2147483647}%
- \TestNum{ 0 }{0}%
- \TestNum{ 1 }{1}%
- \TestNum{--1}{1}%
- \TestNum{ - + - + 4 }{4}%
- \TestNum{\z@}{0}%
- \TestNum{\@ne}{1}%
- \TestNum{\m@ne}{-1}%
-%<*etex>
- \TestNum{-10+30}{20}%
- \TestNum{10-30}{-20}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{inv}{inv}%
- \TestInv{0}{0}%
- \TestInv{1}{-1}%
- \TestInv{-1}{1}%
- \TestInv{10}{-10}%
- \TestInv{-10}{10}%
- \TestInv{2147483647}{-2147483647}%
- \TestInv{-2147483647}{2147483647}%
- \TestInv{ 0 }{0}%
- \TestInv{ 1 }{-1}%
- \TestInv{--1}{-1}%
- \TestInv{\z@}{0}%
- \TestInv{\@ne}{-1}%
- \TestInv{\m@ne}{1}%
-%<*etex>
- \TestInv{-10+30}{-20}%
- \TestInv{10-30}{20}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{abs}{abs}%
- \TestAbs{0}{0}%
- \TestAbs{1}{1}%
- \TestAbs{-1}{1}%
- \TestAbs{10}{10}%
- \TestAbs{-10}{10}%
- \TestAbs{2147483647}{2147483647}%
- \TestAbs{-2147483647}{2147483647}%
- \TestAbs{ 0 }{0}%
- \TestAbs{ 1 }{1}%
- \TestAbs{--1}{1}%
- \TestAbs{\z@}{0}%
- \TestAbs{\@ne}{1}%
- \TestAbs{\m@ne}{1}%
-%<*etex>
- \TestAbs{-10+30}{20}%
- \TestAbs{10-30}{20}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{sign}{sign}%
- \TestSgn{0}{0}%
- \TestSgn{1}{1}%
- \TestSgn{-1}{-1}%
- \TestSgn{10}{1}%
- \TestSgn{-10}{-1}%
- \TestSgn{2147483647}{1}%
- \TestSgn{-2147483647}{-1}%
- \TestSgn{ 0 }{0}%
- \TestSgn{ 2 }{1}%
- \TestSgn{ -2 }{-1}%
- \TestSgn{--2}{1}%
- \TestSgn{\z@}{0}%
- \TestSgn{\@ne}{1}%
- \TestSgn{\m@ne}{-1}%
-%<*etex>
- \TestSgn{-10+30}{1}%
- \TestSgn{10-30}{-1}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{min}{min}%
- \TestMin{0}{1}{0}%
- \TestMin{1}{0}{0}%
- \TestMin{-10}{-20}{-20}%
- \TestMin{ 1 }{ 2 }{1}%
- \TestMin{ 2 }{ 1 }{1}%
- \TestMin{1}{1}{1}%
- \TestMin{\z@}{\@ne}{0}%
- \TestMin{\@ne}{\m@ne}{-1}%
-%<*etex>
- \TestMin{1+2}{3+4}{3}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{max}{max}%
- \TestMax{0}{1}{1}%
- \TestMax{1}{0}{1}%
- \TestMax{-10}{-20}{-10}%
- \TestMax{ 1 }{ 2 }{2}%
- \TestMax{ 2 }{ 1 }{2}%
- \TestMax{1}{1}{1}%
- \TestMax{\z@}{\@ne}{1}%
- \TestMax{\@ne}{\m@ne}{1}%
-%<*etex>
- \TestMax{1+2}{3+4}{7}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{cmp}{cmp}%
- \TestCmp{0}{0}{0}%
- \TestCmp{-21}{17}{-1}%
- \TestCmp{3}{4}{-1}%
- \TestCmp{-10}{-10}{0}%
- \TestCmp{-10}{-11}{1}%
- \TestCmp{100}{5}{1}%
- \TestCmp{2147483647}{-2147483647}{1}%
- \TestCmp{-2147483647}{2147483647}{-1}%
- \TestCmp{2147483647}{2147483647}{0}%
- \TestCmp{\z@}{\@ne}{-1}%
- \TestCmp{\@ne}{\m@ne}{1}%
- \TestCmp{ 4 }{ 5 }{-1}%
- \TestCmp{ -3 }{ -7 }{1}%
-%<*etex>
- \TestCmp{1+2}{3+4}{-1}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{fac}{fac}
- \TestFac{0}{1}%
- \TestFac{1}{1}%
- \TestFac{2}{2}%
- \TestFac{3}{2*3}%
- \TestFac{4}{2*3*4}%
- \TestFac{5}{2*3*4*5}%
- \TestFac{6}{2*3*4*5*6}%
- \TestFac{7}{2*3*4*5*6*7}%
- \TestFac{8}{2*3*4*5*6*7*8}%
- \TestFac{9}{2*3*4*5*6*7*8*9}%
- \TestFac{10}{2*3*4*5*6*7*8*9*10}%
- \TestFac{11}{2*3*4*5*6*7*8*9*10*11}%
- \TestFac{12}{2*3*4*5*6*7*8*9*10*11*12}%
-\end{qstest}
-
-\begin{qstest}{inc}{inc}%
- \TestInc{0}{1}%
- \TestInc{1}{2}%
- \TestInc{-1}{0}%
- \TestInc{10}{11}%
- \TestInc{-10}{-9}%
- \TestInc{999}{1000}%
- \TestInc{-1000}{-999}%
- \TestInc{129}{130}%
- \TestInc{2147483646}{2147483647}%
- \TestInc{-2147483647}{-2147483646}%
-\end{qstest}
-
-\begin{qstest}{dec}{dec}%
- \TestDec{0}{-1}%
- \TestDec{1}{0}%
- \TestDec{-1}{-2}%
- \TestDec{10}{9}%
- \TestDec{-10}{-11}%
- \TestDec{1000}{999}%
- \TestDec{-999}{-1000}%
- \TestDec{130}{129}%
- \TestDec{2147483647}{2147483646}%
- \TestDec{-2147483646}{-2147483647}%
-\end{qstest}
-
-\begin{qstest}{add}{add}%
- \TestAdd{0}{0}{0}%
- \TestAdd{1}{0}{1}%
- \TestAdd{0}{1}{1}%
- \TestAdd{1}{2}{3}%
- \TestAdd{-1}{-1}{-2}%
- \TestAdd{2147483646}{1}{2147483647}%
- \TestAdd{-2147483647}{2147483647}{0}%
- \TestAdd{20}{-5}{15}%
- \TestAdd{-4}{-1}{-5}%
- \TestAdd{-1}{-4}{-5}%
- \TestAdd{-4}{1}{-3}%
- \TestAdd{-1}{4}{3}%
- \TestAdd{4}{-1}{3}%
- \TestAdd{1}{-4}{-3}%
- \TestAdd{-4}{-1}{-5}%
- \TestAdd{-1}{-4}{-5}%
- \TestAdd{ -4 }{ -1 }{-5}%
- \TestAdd{ -1 }{ -4 }{-5}%
- \TestAdd{ -4 }{ 1 }{-3}%
- \TestAdd{ -1 }{ 4 }{3}%
- \TestAdd{ 4 }{ -1 }{3}%
- \TestAdd{ 1 }{ -4 }{-3}%
- \TestAdd{ -4 }{ -1 }{-5}%
- \TestAdd{ -1 }{ -4 }{-5}%
- \TestAdd{876543210}{111111111}{987654321}%
- \TestAdd{999999999}{2}{1000000001}%
-%<*etex>
- \TestAdd{100}{50+150}{300}%
- \TestAdd{2147483647}{10-2147483647}{10}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{sub}{sub}
- \TestSub{0}{0}{0}%
- \TestSub{1}{0}{1}%
- \TestSub{1}{2}{-1}%
- \TestSub{-1}{-1}{0}%
- \TestSub{2147483646}{-1}{2147483647}%
- \TestSub{-2147483647}{-2147483647}{0}%
- \TestSub{-4}{-1}{-3}%
- \TestSub{-1}{-4}{3}%
- \TestSub{-4}{1}{-5}%
- \TestSub{-1}{4}{-5}%
- \TestSub{4}{-1}{5}%
- \TestSub{1}{-4}{5}%
- \TestSub{-4}{-1}{-3}%
- \TestSub{-1}{-4}{3}%
- \TestSub{ -4 }{ -1 }{-3}%
- \TestSub{ -1 }{ -4 }{3}%
- \TestSub{ -4 }{ 1 }{-5}%
- \TestSub{ -1 }{ 4 }{-5}%
- \TestSub{ 4 }{ -1 }{5}%
- \TestSub{ 1 }{ -4 }{5}%
- \TestSub{ -4 }{ -1 }{-3}%
- \TestSub{ -1 }{ -4 }{3}%
- \TestSub{1000000000}{2}{999999998}%
- \TestSub{987654321}{111111111}{876543210}%
-%<*etex>
- \TestSub{100}{50+150}{-100}%
- \TestSub{2147483647}{-10+2147483647}{10}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{shl}{shl}
- \TestShl{0}{0}%
- \TestShl{1}{2}%
- \TestShl{5621}{11242}%
- \TestShl{1073741823}{2147483646}%
- \TestShl{-1}{-2}%
- \TestShl{-5621}{-11242}%
-\end{qstest}
-
-\begin{qstest}{shr}{shr}
- \TestShr{0}{0}%
- \TestShr{1}{0}%
- \TestShr{2}{1}%
- \TestShr{3}{1}%
- \TestShr{4}{2}%
- \TestShr{5}{2}%
- \TestShr{6}{3}%
- \TestShr{7}{3}%
- \TestShr{8}{4}%
- \TestShr{9}{4}%
- \TestShr{10}{5}%
- \TestShr{11}{5}%
- \TestShr{12}{6}%
- \TestShr{13}{6}%
- \TestShr{14}{7}%
- \TestShr{15}{7}%
- \TestShr{16}{8}%
- \TestShr{17}{8}%
- \TestShr{18}{9}%
- \TestShr{19}{9}%
- \TestShr{20}{10}%
- \TestShr{21}{10}%
- \TestShr{22}{11}%
- \TestShr{11241}{5620}%
- \TestShr{73054202}{36527101}%
- \TestShr{2147483646}{1073741823}%
- \TestShr{-1}{0}%
- \TestShr{-2}{-1}%
- \TestShr{-3}{-1}%
- \TestShr{-11241}{-5620}%
-\end{qstest}
-
-\begin{qstest}{mul}{mul}
- \TestMul{0}{0}{0}%
- \TestMul{1}{0}{0}%
- \TestMul{0}{1}{0}%
- \TestMul{1}{1}{1}%
- \TestMul{3}{1}{3}%
- \TestMul{1}{-3}{-3}%
- \TestMul{-4}{-5}{20}%
- \TestMul{3}{7}{21}%
- \TestMul{7}{3}{21}%
- \TestMul{3}{-7}{-21}%
- \TestMul{7}{-3}{-21}%
- \TestMul{-3}{7}{-21}%
- \TestMul{-7}{3}{-21}%
- \TestMul{-3}{-7}{21}%
- \TestMul{-7}{-3}{21}%
- \TestMul{12}{11}{132}%
- \TestMul{999}{333}{332667}%
- \TestMul{1000}{4321}{4321000}%
- \TestMul{12345}{173955}{2147474475}%
- \TestMul{1073741823}{2}{2147483646}%
- \TestMul{2}{1073741823}{2147483646}%
- \TestMul{-1073741823}{2}{-2147483646}%
- \TestMul{2}{-1073741823}{-2147483646}%
-%<*etex>
- \TestMul{2+3}{5+7}{60}%
- \TestMul{2147483647}{2147483647/2147483647}{2147483647}%
-%</etex>
-\end{qstest}
-
-\begin{qstest}{sqr}{sqr}
- \TestSqr{0}{0}%
- \TestSqr{1}{1}%
- \TestSqr{2}{4}%
- \TestSqr{3}{9}%
- \TestSqr{4}{16}%
- \TestSqr{9}{81}%
- \TestSqr{10}{100}%
- \TestSqr{46340}{2147395600}%
- \TestSqr{-1}{1}%
- \TestSqr{-2}{4}%
- \TestSqr{-46340}{2147395600}%
-\end{qstest}
-
-\begin{qstest}{pow}{pow}
- \TestPow{-2}{0}{1}%
- \TestPow{-1}{0}{1}%
- \TestPow{0}{0}{1}%
- \TestPow{1}{0}{1}%
- \TestPow{2}{0}{1}%
- \TestPow{3}{0}{1}%
- \TestPow{-2}{1}{-2}%
- \TestPow{-1}{1}{-1}%
- \TestPow{1}{1}{1}%
- \TestPow{2}{1}{2}%
- \TestPow{3}{1}{3}%
- \TestPow{-2}{2}{4}%
- \TestPow{-1}{2}{1}%
- \TestPow{0}{2}{0}%
- \TestPow{1}{2}{1}%
- \TestPow{2}{2}{4}%
- \TestPow{3}{2}{9}%
- \TestPow{0}{1}{0}%
- \TestPow{1}{-2}{1}%
- \TestPow{1}{-1}{1}%
- \TestPow{-1}{-2}{1}%
- \TestPow{-1}{-1}{-1}%
- \TestPow{-1}{3}{-1}%
- \TestPow{-1}{4}{1}%
- \TestPow{-2}{-1}{0}%
- \TestPow{-2}{-2}{0}%
- \TestPow{2}{3}{8}%
- \TestPow{2}{4}{16}%
- \TestPow{2}{5}{32}%
- \TestPow{2}{6}{64}%
- \TestPow{2}{7}{128}%
- \TestPow{2}{8}{256}%
- \TestPow{2}{9}{512}%
- \TestPow{2}{10}{1024}%
- \TestPow{-2}{3}{-8}%
- \TestPow{-2}{4}{16}%
- \TestPow{-2}{5}{-32}%
- \TestPow{-2}{6}{64}%
- \TestPow{-2}{7}{-128}%
- \TestPow{-2}{8}{256}%
- \TestPow{-2}{9}{-512}%
- \TestPow{-2}{10}{1024}%
- \TestPow{3}{3}{27}%
- \TestPow{3}{4}{81}%
- \TestPow{3}{5}{243}%
- \TestPow{-3}{3}{-27}%
- \TestPow{-3}{4}{81}%
- \TestPow{-3}{5}{-243}%
- \TestPow{2}{30}{1073741824}%
- \TestPow{-3}{19}{-1162261467}%
- \TestPow{5}{13}{1220703125}%
- \TestPow{-7}{11}{-1977326743}%
-\end{qstest}
-
-\begin{qstest}{div}{div}
- \TestDiv{1}{1}{1}%
- \TestDiv{2}{1}{2}%
- \TestDiv{-2}{1}{-2}%
- \TestDiv{2}{-1}{-2}%
- \TestDiv{-2}{-1}{2}%
- \TestDiv{15}{2}{7}%
- \TestDiv{-16}{2}{-8}%
- \TestDiv{1}{2}{0}%
- \TestDiv{1}{3}{0}%
- \TestDiv{2}{3}{0}%
- \TestDiv{-2}{3}{0}%
- \TestDiv{2}{-3}{0}%
- \TestDiv{-2}{-3}{0}%
- \TestDiv{13}{3}{4}%
- \TestDiv{-13}{-3}{4}%
- \TestDiv{-13}{3}{-4}%
- \TestDiv{-6}{5}{-1}%
- \TestDiv{-5}{5}{-1}%
- \TestDiv{-4}{5}{0}%
- \TestDiv{-3}{5}{0}%
- \TestDiv{-2}{5}{0}%
- \TestDiv{-1}{5}{0}%
- \TestDiv{0}{5}{0}%
- \TestDiv{1}{5}{0}%
- \TestDiv{2}{5}{0}%
- \TestDiv{3}{5}{0}%
- \TestDiv{4}{5}{0}%
- \TestDiv{5}{5}{1}%
- \TestDiv{6}{5}{1}%
- \TestDiv{-5}{4}{-1}%
- \TestDiv{-4}{4}{-1}%
- \TestDiv{-3}{4}{0}%
- \TestDiv{-2}{4}{0}%
- \TestDiv{-1}{4}{0}%
- \TestDiv{0}{4}{0}%
- \TestDiv{1}{4}{0}%
- \TestDiv{2}{4}{0}%
- \TestDiv{3}{4}{0}%
- \TestDiv{4}{4}{1}%
- \TestDiv{5}{4}{1}%
- \TestDiv{12345}{678}{18}%
- \TestDiv{32372}{5952}{5}%
- \TestDiv{284271294}{18162}{15651}%
- \TestDiv{217652429}{12561}{17327}%
- \TestDiv{462028434}{5439}{84947}%
- \TestDiv{2147483647}{1000}{2147483}%
- \TestDiv{2147483647}{-1000}{-2147483}%
- \TestDiv{-2147483647}{1000}{-2147483}%
- \TestDiv{-2147483647}{-1000}{2147483}%
-\end{qstest}
-
-\begin{qstest}{mod}{mod}
- \TestMod{-6}{5}{4}%
- \TestMod{-5}{5}{0}%
- \TestMod{-4}{5}{1}%
- \TestMod{-3}{5}{2}%
- \TestMod{-2}{5}{3}%
- \TestMod{-1}{5}{4}%
- \TestMod{0}{5}{0}%
- \TestMod{1}{5}{1}%
- \TestMod{2}{5}{2}%
- \TestMod{3}{5}{3}%
- \TestMod{4}{5}{4}%
- \TestMod{5}{5}{0}%
- \TestMod{6}{5}{1}%
- \TestMod{-5}{4}{3}%
- \TestMod{-4}{4}{0}%
- \TestMod{-3}{4}{1}%
- \TestMod{-2}{4}{2}%
- \TestMod{-1}{4}{3}%
- \TestMod{0}{4}{0}%
- \TestMod{1}{4}{1}%
- \TestMod{2}{4}{2}%
- \TestMod{3}{4}{3}%
- \TestMod{4}{4}{0}%
- \TestMod{5}{4}{1}%
- \TestMod{-6}{-5}{-1}%
- \TestMod{-5}{-5}{0}%
- \TestMod{-4}{-5}{-4}%
- \TestMod{-3}{-5}{-3}%
- \TestMod{-2}{-5}{-2}%
- \TestMod{-1}{-5}{-1}%
- \TestMod{0}{-5}{0}%
- \TestMod{1}{-5}{-4}%
- \TestMod{2}{-5}{-3}%
- \TestMod{3}{-5}{-2}%
- \TestMod{4}{-5}{-1}%
- \TestMod{5}{-5}{0}%
- \TestMod{6}{-5}{-4}%
- \TestMod{-5}{-4}{-1}%
- \TestMod{-4}{-4}{0}%
- \TestMod{-3}{-4}{-3}%
- \TestMod{-2}{-4}{-2}%
- \TestMod{-1}{-4}{-1}%
- \TestMod{0}{-4}{0}%
- \TestMod{1}{-4}{-3}%
- \TestMod{2}{-4}{-2}%
- \TestMod{3}{-4}{-1}%
- \TestMod{4}{-4}{0}%
- \TestMod{5}{-4}{-3}%
- \TestMod{2147483647}{1000}{647}%
- \TestMod{2147483647}{-1000}{-353}%
- \TestMod{-2147483647}{1000}{353}%
- \TestMod{-2147483647}{-1000}{-647}%
- \TestMod{ 0 }{ 4 }{0}%
- \TestMod{ 1 }{ 4 }{1}%
- \TestMod{ -1 }{ 4 }{3}%
- \TestMod{ 0 }{ -4 }{0}%
- \TestMod{ 1 }{ -4 }{-3}%
- \TestMod{ -1 }{ -4 }{-1}%
-%<*etex>
- \TestMod{1+2}{1+3}{3}%
- \TestMod{1-2}{1+3}{3}%
- \TestMod{1-2}{1-4}{-1}%
- \TestMod{1+2}{1-4}{0}%
- \TestMod{1+2}{1-5}{-1}%
-%</etex>
-\end{qstest}
-%</test2|test4>
-% \end{macrocode}
-% \begin{macrocode}
-%<*test2>
-\newcommand*{\TestError}[2]{%
- \begingroup
- \expandafter\def\csname IntCalcError:#1\endcsname{}%
- \Expect*{#2}{0}%
- \expandafter\def\csname IntCalcError:#1\endcsname{ERROR}%
- \Expect*{#2}{0ERROR }%
- \endgroup
-}
-\begin{qstest}{error}{error}
- \TestError{FacNegative}{\intcalcFac{-1}}%
- \TestError{FacNegative}{\intcalcFac{-2147483647}}%
- \TestError{FacOverflow}{\intcalcFac{13}}%
- \TestError{FacOverflow}{\intcalcFac{2147483647}}%
- \TestError{DivisionByZero}{\intcalcPow{0}{-1}}%
- \TestError{DivisionByZero}{\intcalcDiv{1}{0}}%
- \TestError{DivisionByZero}{\intcalcMod{1}{0}}%
- \TestError{DivisionByZero}{\IntCalcDiv1!0!}%
- \TestError{DivisionByZero}{\IntCalcMod1!0!}%
-\end{qstest}
-%</test2>
-% \end{macrocode}
-% \begin{macrocode}
-%<*test2|test4>
-\begin{document}
-\end{document}
-%</test2|test4>
-% \end{macrocode}
-%
-% \section{Installation}
+%% \section{Installation}
%
% \subsection{Download}
%
@@ -4116,10 +3145,6 @@ and the derived files
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
% intcalc.sty & tex/generic/oberdiek/intcalc.sty\\
% intcalc.pdf & doc/latex/oberdiek/intcalc.pdf\\
-% test/intcalc-test1.tex & doc/latex/oberdiek/test/intcalc-test1.tex\\
-% test/intcalc-test2.tex & doc/latex/oberdiek/test/intcalc-test2.tex\\
-% test/intcalc-test3.tex & doc/latex/oberdiek/test/intcalc-test3.tex\\
-% test/intcalc-test4.tex & doc/latex/oberdiek/test/intcalc-test4.tex\\
% intcalc.dtx & source/latex/oberdiek/intcalc.dtx\\
% \end{tabular}^^A
% }^^A