\def\fileversion{0.24} \def\filedate{2011/04/15} %% %% xlop.tex: %% eXtra Large OPeration macros for Generic TeX. %% See `user.pdf' for documentation; %% `hacker.pdf' for explanation. %% %% Copyright 2005,2006, by Jean-C\^ome Charpentier %% Jean-Come.Charpentier@wanadoo.fr %% %% This program may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2003/12/01 or later. \csname xlopLoaded\endcsname \let\xlopLoaded\endinput \edef\opAtCode{\the\catcode`\@} \catcode`\@=11\relax \newcount\op@count@z \newcount\op@count@i \newcount\op@count@ii \newcount\op@count@iii \newcount\op@count@iv \newcount\op@count@v \newcount\op@count@vi \newtoks\op@currentstyle \expandafter\ifx\csname @latexerr\endcsname\relax \long\def\@ifundefined#1#2#3{% \expandafter\ifx\csname #1\endcsname\relax #2% \else #3% \fi} \def\@gobble#1{} \def\@namedef#1{\expandafter\def\csname #1\endcsname} \def\@nameuse#1{\csname #1\endcsname} \def\typeout#1{\immediate\write\@unused{#1}} \alloc@7\write\chardef\sixt@@n\@unused \def\@spaces{\space\space\space\space} \def\@ifnextchar#1#2#3{% \let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}\futurelet\@tempc\@ifnch} \def\@ifnch{% \ifx\@tempc\@sptoken \let\@tempd\@xifnch \else \ifx\@tempc\@tempe \let\@tempd\@tempa \else \let\@tempd\@tempb \fi \fi \@tempd } \begingroup \def\:{\global\let\@sptoken= } \: \def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@tempc\@ifnch} \endgroup \fi %LaTeX-like \def\@nameedef#1{\expandafter\edef\csname #1\endcsname} \def\@namexdef#1{\expandafter\xdef\csname #1\endcsname} \typeout{`xlop' v\fileversion\space\space <\filedate> (jcc)} \newif\ifop@error \def\op@error{% \begingroup \global\op@errortrue \newlinechar`\^^J \op@@error } \def\op@@error#1#2{% \xdef\op@errortext{#1}% \xdef\op@errorhelp{#2}% \endgroup } \def\op@errorwrite{% \global\op@errorfalse \begingroup \newlinechar`\^^J \expandafter\errhelp\expandafter{\op@errorhelp}% \typeout{% xlop error. \space See documentation for further information.^^J \@spaces\@spaces\@spaces\@spaces Type \space H \space for immediate help.}% \errmessage{\op@errortext}% \endgroup } \def\op@warning{% \begingroup \newlinechar`\^^J \op@@warning } \def\op@@warning#1{% \typeout{xlop warning. #1^^J\@spaces See documentation for further information.^^J}% \endgroup } \let\op@nil\relax \def\opset#1{% \Pop@set#1,\op@nil \ifop@error\op@errorwrite\fi \ignorespaces } \def\Pop@set#1,{% \Pop@@set#1==\op@nil \@ifnextchar\op@nil{\@gobble}{\Pop@set}% } \def\Pop@@set#1=#2=#3\op@nil{% \@ifundefined{pOP@#1}% {\Pop@@@set#1.={#2}} {\@nameuse{pOP@#1}{#2}}% } \def\Pop@@@set#1.#2=#3{% \@ifundefined{pOP@#1}% {\op@error{Parameter `#1' not defined.}% {\space\space Perhaps you have mispelling parameter!^^J \space Are you sure about `#1'?^^J}}% {\@nameuse{pOP@#1}[#2]{#3}}% } \def\op@string@lpar{(} \def\op@string@rpar{)} \def\op@string@comma{,} \def\op@string@abs{abs} \def\op@string@add{add} \def\op@string@ceil{ceil} \def\op@string@div{div} \def\op@string@floor{floor} \def\op@string@gcd{gcd} \def\op@string@idiv{idiv} \def\op@string@integer{integer} \def\op@string@mod{mod} \def\op@string@mul{mul} \def\op@string@neg{neg} \def\op@string@power{power} \def\op@string@rest{rest} \def\op@string@round{round} \def\op@string@sub{sub} \def\op@string@all{all} \def\op@string@american{american} \def\op@string@both{both} \def\op@string@bottom{bottom} \def\op@string@center{center} \def\op@string@decimal{decimal} \def\op@string@delete{delete} \def\op@string@display{display} \def\op@string@divisor{divisor} \def\op@string@error{error} \def\op@string@false{false} \def\op@string@french{french} \def\op@string@last{last} \def\op@string@left{left} \def\op@string@none{none} \def\op@string@nonzero{nonzero} \def\op@string@right{right} \def\op@string@russian{russian} \def\op@string@shift{shift} \def\op@string@silent{silent} \def\op@string@strike{strike} \def\op@string@text{text} \def\op@string@top{top} \def\op@string@true{true} \def\op@string@warning{warning} \def\pOP@afterperiodsymbol#1{\def\op@afterperiodsymbol{#1}} \def\pOP@approxsymbol#1{\def\op@approxsymbol{#1}} \def\pOP@equalsymbol#1{\def\op@equalsymbol{#1}} \def\pOP@addsymbol#1{\def\op@addsymbol{#1}} \def\pOP@subsymbol#1{\def\op@subsymbol{#1}} \def\pOP@mulsymbol#1{\def\op@mulsymbol{#1}} \def\pOP@divsymbol#1{\def\op@divsymbol{#1}} \def\pOP@decimalsepsymbol#1{\def\op@decimalsepsymbol{{#1}}} \def\pOP@strikedecimalsepsymbol#1{\def\op@strikedecimalsepsymbol{#1}} \def\pOP@shiftintermediarysymbol#1{\def\op@shiftintermediarysymbol{#1}} \def\pOP@displayshiftintermediary#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@shift \let\op@displayshiftintermediary\op@string@shift \else\ifx\@tempa\op@string@all \let\op@displayshiftintermediary\op@string@all \else\ifx\@tempa\op@string@none \let\op@displayshiftintermediary\op@string@none \else \op@error{Parameter displayshiftintermediary accept only `shift', `all', and `none'.^^J \space Here, the value is `#1'}% {Value must be `shift', `all', or `none'}% \fi\fi\fi } \def\pOP@voperation#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@bottom \let\op@voperation\op@string@bottom \else\ifx\@tempa\op@string@center \let\op@voperation\op@string@center \else\ifx\@tempa\op@string@top \let\op@voperation\op@string@top \else \op@error{Parameter voperation accept only `top', `center', and `bottom'.^^J \space Here, the value is `#1'}% {Value must be `top', `center', or `bottom'}% \fi\fi\fi } \def\pOP@voperator#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@top \let\op@voperator\op@string@top \else\ifx\@tempa\op@string@bottom \let\op@voperator\op@string@bottom \else\ifx\@tempa\op@string@center \let\op@voperator\op@string@center \else \op@error{Parameter voperator accept only `top', `center', and `bottom'.^^J \space Here, the value is `#1'}% {Value must be `top', `center', or `bottom'}% \fi\fi\fi } \def\pOP@hfactor#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@right \let\op@hfactor\op@string@right \else\ifx\@tempa\op@string@decimal \let\op@hfactor\op@string@decimal \else \op@error{Parameter hfactor accept only `right' and `decimal'.^^J \space Here, the value is `#1'}% {Value must be `right' or `decimal'}% \fi\fi } \def\pOP@vruleperiod#1{\def\op@vruleperiod{#1}} \newif\ifop@dividendbridge \def\pOP@dividendbridge#1{\edef\@tempa{#1}% \edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@dividendbridgefalse \else\ifx\@tempa\op@string@true \op@dividendbridgetrue \else\ifx\@tempa\empty \op@dividendbridgetrue \else \op@error{Parameter dividendbridge accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \def\pOP@shiftdecimalsep#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@none \let\op@shiftdecimalsep\op@string@none \else\ifx\@tempa\op@string@divisor \let\op@shiftdecimalsep\op@string@divisor \else\ifx\@tempa\op@string@both \let\op@shiftdecimalsep\op@string@both \else \op@error{Parameter shiftdecimalsep accept only `none', `divisor', and `both'.^^J \space Here, the value is `#1'}% {Value must be `none', `divisor', or `both'}% \fi\fi\fi } \def\pOP@maxdivstep#1{\edef\op@maxdivstep{#1}} \def\pOP@safedivstep#1{\edef\op@safedivstep{#1}} \newif\ifop@period \def\pOP@period#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@periodfalse \else\ifx\@tempa\op@string@true \op@periodtrue \else\ifx\@tempa\empty \op@periodtrue \else \op@error{Parameter period accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \newif\ifop@deletezero \def\pOP@deletezero#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@deletezerofalse \else\ifx\@tempa\op@string@true \op@deletezerotrue \else\ifx\@tempa\empty \op@deletezerotrue \else \op@error{Parameter deletezero accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \newif\ifop@carryadd \def\pOP@carryadd#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@carryaddfalse \else\ifx\@tempa\op@string@true \op@carryaddtrue \else\ifx\@tempa\empty \op@carryaddtrue \else \op@error{Parameter carryadd accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \newif\ifop@carrysub \def\pOP@carrysub#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@carrysubfalse \else\ifx\@tempa\op@string@true \op@carrysubtrue \else\ifx\@tempa\empty \op@carrysubtrue \else \op@error{Parameter carrysub accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \def\pOP@offsetcarry#1{\edef\op@offsetcarry{#1}} \def\pOP@style#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@display \let\op@style\op@string@display \else\ifx\@tempa\op@string@text \let\op@style\op@string@text \else \op@error{Parameter style accept only `display' and `text'.^^J \space Here, the value is `#1'}% {Value must be `display' or `text'}% \fi\fi } \def\pOP@displayintermediary#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@all \let\op@displayintermediary\op@string@all \else\ifx\@tempa\op@string@nonzero \let\op@displayintermediary\op@string@nonzero \else\ifx\@tempa\op@string@none \let\op@displayintermediary\op@string@none \else \op@error{Parameter style accept only `all', `none', and `nonzero'.^^J \space Here, the value is `#1'}% {Value must be `all', `none', or `nonzero'}% \fi\fi\fi } \newif\ifop@lastcarry \def\pOP@lastcarry#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@false \op@lastcarryfalse \else\ifx\@tempa\op@string@true \op@lastcarrytrue \else\ifx\@tempa\empty \op@lastcarrytrue \else \op@error{Parameter lastcarry accept only `true' and `false'.^^J \space Here, the value is `#1'}% {Value must be `true', or `false', or an empty value}% \fi\fi\fi } \def\pOP@parenthesisnegative#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@all \let\op@parenthesisnegative\op@string@all \else\ifx\@tempa\op@string@last \let\op@parenthesisnegative\op@string@last \else\ifx\@tempa\op@string@none \let\op@parenthesisnegative\op@string@none \else \op@error{Parameter parenthesisnegative accept only `all', `last' and `none'.^^J \space Here, the value is `#1'}% {Value must be `all', `last', or `none'}% \fi\fi\fi } \newdimen\opcolumnwidth \def\pOP@columnwidth#1{\opcolumnwidth=#1\relax} \newdimen\oplineheight \newbox\op@strutbox \def\pOP@lineheight#1{\oplineheight=#1\relax \setbox\op@strutbox=\hbox{% \vrule height.708333\oplineheight depth .291667\oplineheight width\z@}% } \def\op@strut{\relax\ifmmode \copy\op@strutbox \else \unhcopy\op@strutbox \fi } \newdimen\op@decimalsepwidth \def\pOP@decimalsepwidth#1{\op@decimalsepwidth=#1} \newdimen\op@decimalsepoffset \def\pOP@decimalsepoffset#1{\op@decimalsepoffset=#1} \newdimen\op@hrulewidth \def\pOP@hrulewidth#1{\op@hrulewidth=#1\relax} \newdimen\op@vrulewidth \def\pOP@vrulewidth#1{\op@vrulewidth=#1\relax} \def\pOP@behaviorsub#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@warning \let\op@behaviorsub\op@string@warning \else\ifx\@tempa\op@string@error \let\op@behaviorsub\op@string@error \else\ifx\@tempa\op@string@silent \let\op@behaviorsub\op@string@silent \else \op@error{Parameter behaviorsub accept only `warning', `error' and `silent'.^^J \space Here, the value is `#1'}% {Value must be `warning', `error', or `silent'}% \fi\fi\fi } \def\pOP@country#1{\edef\@tempa{#1}% \ifx\@tempa\op@string@french \let\op@country\op@string@french \else\ifx\@tempa\op@string@american \let\op@country\op@string@american \else\ifx\@tempa\op@string@russian \let\op@country\op@string@russian \else \op@error{Parameter contry accept only some values.^^J \space Value `#1' isn't a valid country for xlop}% {For now, value must be `french', `russian', or `american'}% \fi\fi\fi } \def\pOP@operandstyle{% \@ifnextchar[{\pOP@@operandstyle}{\pOP@@operandstyle[0.]}% } \def\pOP@@operandstyle[#1.]#2{% \@namedef{op@operandstyle.#1}{#2}% } \def\pOP@carrystyle{% \@ifnextchar[{\pOP@@carrystyle}{\pOP@@carrystyle[0.]}% } \def\pOP@@carrystyle[#1.]#2{% \@namedef{op@carrystyle.#1}{#2}% } \def\pOP@resultstyle{% \@ifnextchar[{\pOP@@resultstyle}{\pOP@@resultstyle[0.]}% } \def\pOP@@resultstyle[#1.]#2{% \@namedef{op@resultstyle.#1}{#2}% } \def\pOP@intermediarystyle{% \@ifnextchar[{\pOP@@intermediarystyle}{\pOP@@intermediarystyle[0.]}% } \def\pOP@@intermediarystyle[#1.]#2{% \@namedef{op@intermediarystyle.#1}{#2}% } \def\pOP@remainderstyle{% \@ifnextchar[{\pOP@@remainderstyle}{\pOP@@remainderstyle[0.]}% } \def\pOP@@remainderstyle[#1.]#2{% \@namedef{op@remainderstyle.#1}{#2}% } \def\pOP@nil#1{} \opset{afterperiodsymbol=$\ldots$,approxsymbol=$\approx$, equalsymbol={$=$},addsymbol=$+$,subsymbol=$-$, mulsymbol=$\times$,divsymbol=$\div$, decimalsepsymbol=.,strikedecimalsepsymbol=, shiftintermediarysymbol=$\cdot$,displayshiftintermediary=shift, voperation=bottom,voperator=center, hfactor=right,vruleperiod=-0.2,dividendbridge=false, shiftdecimalsep=both,maxdivstep=10,safedivstep=50,period=false, deletezero=true,carryadd=true,carrysub=false,offsetcarry=-0.35, style=display,displayintermediary=none,lastcarry=false, parenthesisnegative=none,columnwidth=2ex,lineheight=\baselineskip, decimalsepwidth=0pt,decimalsepoffset=0pt, hrulewidth=0.4pt,vrulewidth=0.4pt, behaviorsub=silent,country=french, operandstyle=,resultstyle=,remainderstyle=, intermediarystyle=} \expandafter\ifx\csname @latexerr\endcsname\relax \opset{carrystyle=\sevenrm} \else \opset{carrystyle=\scriptsize} \fi \op@count@z=`\0 \edef\op@numbegin{\the\op@count@z} \op@count@z=`\9 \edef\op@numend{\the\op@count@z} \op@count@z=`\+ \edef\op@plus{\the\op@count@z} \op@count@z=`\- \edef\op@minus{\the\op@count@z} \op@count@z=`\* \edef\op@multiply{\the\op@count@z} \op@count@z=`\/ \edef\op@divide{\the\op@count@z} \op@count@z=`\: \edef\op@idivide{\the\op@count@z} \op@count@z=`\^ \edef\op@pow{\the\op@count@z} \op@count@z=`\. \edef\op@dot{\the\op@count@z} \op@count@z=`\, \edef\op@comma{\the\op@count@z} \op@count@z=`\( \edef\op@lparenthesis{\the\op@count@z} \op@count@z=`\) \edef\op@rparenthesis{\the\op@count@z} \op@count@z=`\ \edef\op@space{\the\op@count@z} \newcount\op@parenthesis \newcount\op@token \newcount\op@stack \newcount\op@stackb \newif\ifop@in@number \newif\ifop@in@decimal \newif\ifop@in@name \newif\ifop@in@sign \newif\ifop@isdigit \newif\ifop@isplus \newif\ifop@isminus \newif\ifop@isdot \newif\ifop@iscomma \newif\ifop@isdecimalsep \newif\ifop@ismultiply \newif\ifop@isdivide \newif\ifop@isidivide \newif\ifop@ispower \newif\ifop@islparenthesis \newif\ifop@isrparenthesis \newif\ifop@isspace \newif\ifop@isother \newif\ifopgt \newif\ifopge \newif\ifopeq \newif\ifopneq \newif\ifople \newif\ifoplt \newif\ifop@again \newif\ifop@carry \def\op@testchar#1{% \op@isdigitfalse \op@isplusfalse \op@isminusfalse \op@isdecimalsepfalse \op@count@z=`#1\relax \ifnum\op@count@z=\op@plus\relax \op@isplustrue \else\ifnum\op@count@z=\op@minus\relax \op@isminustrue \else\ifnum\op@count@z=\op@dot\relax \op@isdecimalseptrue \else\ifnum\op@count@z=\op@comma\relax \op@isdecimalseptrue \else\ifnum\op@count@z<\op@numbegin\relax \else\ifnum\op@count@z>\op@numend\relax \else \op@isdigittrue \fi\fi\fi\fi\fi\fi } \def\op@split#1#2{% \begingroup \edef\op@arg{#1}% \expandafter\op@readnumber\op@arg\op@nil \ifop@error \op@error{Number name `#1' is undefined}% {See documentation about number name}% \let\next\relax \let\op@arg\relax \else \edef\op@name{#2}% \op@length \op@count@i=\@nameuse{OP@\op@name @w}\relax \edef\op@arg{\op@arg.}% \let\next\op@@split \fi \expandafter\next\op@arg\op@nil \endgroup } \def\op@@split#1#2\op@nil{% \ifnum\op@count@i>0 \edef\op@argi{#1}% \edef\op@argii{#2}% \let\next\op@@split \expandafter\op@testchar\op@argi \ifop@isdigit \@namexdef{OP@\op@name @\the\op@count@i}{\op@argi}% \advance\op@count@i by -1 \fi \else \let\next\relax \let\op@argii\relax \fi \expandafter\next\op@argii\op@nil } \def\op@readnumber#1#2\op@nil{% \op@testchar{#1}% \ifop@isdigit \else \ifop@isplus \else \ifop@isminus \else \ifop@isdecimalsep \else \@ifundefined{Op@#1#2}% {\global\op@errortrue}% {\edef\op@arg{\@nameuse{Op@#1#2}}}% \fi\fi\fi\fi } \def\op@length{% \begingroup \expandafter\op@@length\op@arg\op@nil \ifnum\op@count@i=0 \op@count@i=1 \xdef\op@arg{0\op@arg}% \fi \@namexdef{OP@\op@name @i}{\the\op@count@i}% \@namexdef{OP@\op@name @d}{\the\op@count@ii}% \advance\op@count@i by \op@count@ii \@namexdef{OP@\op@name @w}{\the\op@count@i}% \endgroup } \def\op@@length#1#2\op@nil{% \edef\op@argi{#1}% \edef\op@argii{#2}% \expandafter\op@testchar\op@argi \ifop@isdigit \@namexdef{OP@\op@name @s}{0}% \op@count@i=1 \op@count@ii=0 \ifx\empty\op@argii \let\next\relax \let\op@argii\relax \else \let\next\op@length@after@digit \fi \else \ifop@isplus \@namexdef{OP@\op@name @s}{0}% \let\next\op@length@after@sign \else \ifop@isminus \@namexdef{OP@\op@name @s}{1}% \let\next\op@length@after@sign \else \ifop@isdecimalsep \@namexdef{OP@\op@name @s}{0}% \op@count@i=0 \op@count@ii=0 \let\next\op@length@after@decimalsep \else \op@error{\op@argi\op@argii\space isn't a valid number}% {See documentation for syntax of valid number}% \let\next\relax \let\op@argii\relax \fi\fi\fi\fi \ifx\empty\op@argii \op@error{\op@argi\space isn't a valid number}% {See documentation for syntax of valid number}% \let\next\relax \let\op@argii\relax \fi \expandafter\next\op@argii\op@nil } \def\op@length@after@digit#1#2\op@nil{% \edef\op@argi{#1}% \edef\op@argii{#2}% \expandafter\op@testchar\op@argi \ifop@isdigit \advance\op@count@i by 1 \let\next\op@length@after@digit \else \ifop@isdecimalsep \let\next\op@length@after@decimalsep \else \op@error{#1#2 not allowed here. \space I forget it}% {See documentation for valid number. Characters before are OK}% \let\next\relax \let\op@argii\relax \fi\fi \ifx\empty\op@argii \let\next\relax \fi \expandafter\next\op@argii\op@nil } \def\op@length@after@sign#1#2\op@nil{% \edef\op@argi{#1}% \edef\op@argii{#2}% \expandafter\op@testchar\op@argi \ifop@isplus \let\next\op@length@after@sign \else \ifop@isminus \ifnum\@nameuse{OP@\op@name @s}=0 \@namexdef{OP@\op@name @s}{1}% \else \@namexdef{OP@\op@name @s}{0}% \fi \let\next\op@length@after@sign \else \ifop@isdecimalsep \ifx\empty\op@argii \op@error{#1\space isn't a valid number}% {See documentation for syntax of valid number}% \let\next\relax \else \op@count@i=0 \op@count@ii=0 \let\next\op@length@after@decimalsep \fi \else \ifop@isdigit \op@count@i=1 \op@count@ii=0 \ifx\empty\op@argii \let\next\relax \else \let\next\op@length@after@digit \fi \fi\fi\fi\fi \expandafter\next\op@argii\op@nil } \def\op@length@after@decimalsep#1#2\op@nil{% \edef\op@argi{#1}% \edef\op@argii{#2}% \expandafter\op@testchar\op@argi \ifop@isdigit \advance\op@count@ii by 1 \let\next\op@length@after@decimalsep \else \op@error{#1#2 not allowed here. \space I forget it}% {See documentation for syntax of valid number. Characters before is OK}% \let\next\relax \let\op@argii\relax \fi \ifx\empty\op@argii \let\next\relax \let\op@argii\relax \fi \expandafter\next\op@argii\op@nil } \def\op@unsplit#1#2{% \begingroup \edef\op@name{#1}% \ifnum\@nameuse{OP@\op@name @s}=1 \def\op@macroname{-}% \else \def\op@macroname{}% \fi \op@count@z=\@nameuse{OP@\op@name @i}\relax \op@count@i=\@nameuse{OP@\op@name @w}\relax \loop \ifnum\op@count@z>0 \edef\op@macroname{\op@macroname \@nameuse{OP@\op@name @\the\op@count@i}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \ifnum\op@count@i>0 \edef\op@macroname{\op@macroname\op@decimalsepsymbol}% \loop \ifnum\op@count@i>0 \edef\op@macroname{\op@macroname \@nameuse{OP@\op@name @\the\op@count@i}}% \advance\op@count@i by-1 \repeat \fi \@namexdef{Op@#2}{\op@macroname}% \endgroup } \def\oplput(#1,#2)#3{\leavevmode \vbox to\z@{\vss\hbox{\raise #2\oplineheight \hbox to\z@{% \kern #1\opcolumnwidth #3\hss}}}% \ignorespaces } \def\oprput(#1,#2)#3{\leavevmode \vbox to \z@{\vss\hbox{\raise #2\oplineheight \hbox to\z@{% \hss#3\kern -#1\opcolumnwidth}}}% \ignorespaces } \def\ophline(#1,#2)#3{\leavevmode \vbox to\z@{\vss\hbox{\raise #2\oplineheight \hbox to\z@{% \kern #1\opcolumnwidth \vrule width#3\opcolumnwidth depth0.5\op@hrulewidth height0.5\op@hrulewidth \hss}}}% \ignorespaces } \def\opvline(#1,#2)#3{\leavevmode \vbox to\z@{\vss\hbox{\raise #2\oplineheight \hbox to\z@{% \kern #1\opcolumnwidth \kern-0.5\op@vrulewidth \vrule width\op@vrulewidth depth#3\oplineheight height\z@ \hss}}}% \ignorespaces } \def\op@makebox#1#2#3#4{% \begingroup \edef\op@name{#4}% \dimen0=\opcolumnwidth \op@count@z=#1% \advance\op@count@z by-\@nameuse{OP@\op@name @i}\relax \multiply\dimen0 by\op@count@z \global\setbox0=\hbox{% \op@strut\vrule width\dimen0 height\z@ depth\z@}% \op@count@z=\@nameuse{OP@\op@name @i}\relax \op@count@i=\@nameuse{OP@\op@name @w}\relax \loop \ifnum\op@count@z>0 \op@setstyle{#3.\the\op@count@z}% \global\setbox0=\hbox{\box0 \hbox to\opcolumnwidth{\hss\the\op@currentstyle {\@nameuse{OP@\op@name @\the\op@count@i}}\hss}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \ifnum\op@count@i>0 \op@setstyle{#3.d}% \global\setbox0=\hbox{\box0 \hbox to\op@decimalsepwidth{\hss \vrule width\op@decimalsepoffset height\z@ depth\z@ \the\op@currentstyle\op@decimalsepsymbol \hss}}% \op@count@z=-1 \loop \ifnum\op@count@i>0 \op@setstyle{#3.\the\op@count@z}% \global\setbox0=\hbox{\box0 \hbox to\opcolumnwidth{\hss\the\op@currentstyle {\@nameuse{OP@\op@name @\the\op@count@i}}\hss}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \fi \dimen0=\opcolumnwidth \op@count@z=#2\relax \advance\op@count@z by-\@nameuse{OP@\op@name @d}\relax \multiply\dimen0 by\op@count@z \global\setbox0=\hbox{\box0 \vrule width\dimen0 height\z@ depth\z@}% \endgroup } \def\op@setstyle#1{% \edef\op@arg{#1}% \expandafter\op@@setstyle\op@arg..\op@nil } \def\op@@setstyle#1.#2.#3\op@nil{% \edef\op@styleroot{#1}% \edef\op@styleindex{#2}% \op@setstylesubindex#3.\op@nil \ifx\empty\op@stylesubindex \@ifundefined{op@\op@styleroot.\op@styleindex}% {\op@currentstyle={\@nameuse{op@\op@styleroot.0}}}% {\op@currentstyle={\@nameuse{op@\op@styleroot.\op@styleindex}}}% \else \@ifundefined{op@\op@styleroot.\op@styleindex.\op@stylesubindex}% {\@ifundefined{op@\op@styleroot.\op@styleindex}% {\op@currentstyle={\@nameuse{op@\op@styleroot.0}}}% {\op@currentstyle={\@nameuse{op@\op@styleroot.\op@styleindex}}}% } {\op@currentstyle= {\@nameuse{op@\op@styleroot.\op@styleindex.\op@stylesubindex}}}% \fi } \def\op@setstylesubindex#1.#2\op@nil{\def\op@stylesubindex{#1}} \def\opdisplay{\@ifnextchar[{\op@displaypar}{\op@displaypar[nil]}} \def\op@displaypar[#1]#2#3{% \begingroup \opset{#1}% \op@split{#3}{r}% \ifop@error \op@errorwrite \else \op@display{#2}{r}% \fi \endgroup } \def\op@display#1#2{% \op@makebox{\@nameuse{OP@#2@i}}{\@nameuse{OP@#2@d}}{#1}{#2}% \leavevmode\box0 } \def\opprint#1{% \op@split{#1}{r}% \ifop@error \op@errorwrite \else \op@unsplit{r}{@r}% \Op@@r \fi } \def\op@format#1#2#3{% \begingroup \op@count@iii=#1\relax \op@count@iv=#2\relax \op@count@z=\op@count@iv \advance\op@count@z by-\@nameuse{OP@#3@d}\relax \ifnum\op@count@z>0 \op@count@i=\@nameuse{OP@#3@w}\relax \advance\op@count@z by\op@count@i\relax \loop \@namexdef{OP@#3@\the\op@count@z}{\@nameuse{OP@#3@\the\op@count@i}}% \advance\op@count@i by-1 \advance\op@count@z by-1\relax \ifnum\op@count@i>0 \repeat \loop \@namexdef{OP@#3@\the\op@count@z}{0}% \advance\op@count@z by-1\relax \ifnum\op@count@z>0 \repeat \@namexdef{OP@#3@d}{\the\op@count@iv}% \op@count@i=\@nameuse{OP@#3@i}% \advance\op@count@i by\op@count@iv\relax \@namexdef{OP@#3@w}{\the\op@count@i}% \fi \op@count@z=\op@count@iii \advance\op@count@z by-\@nameuse{OP@#3@i}\relax \ifnum\op@count@z>0 \op@count@i=\@nameuse{OP@#3@w}\relax \loop \advance\op@count@i by1 \@namexdef{OP@#3@\the\op@count@i}{0}% \advance\op@count@z by-1\relax \ifnum\op@count@z>0 \repeat \@namexdef{OP@#3@i}{\the\op@count@iii}% \fi \op@count@i=\@nameuse{OP@#3@i}\relax \advance\op@count@i by\@nameuse{OP@#3@d}\relax \@namexdef{OP@#3@w}{\the\op@count@i}% \endgroup } % add 0.23 \def\opexport{\@ifnextchar[{\op@export}{\op@export[nil]}} \def\op@export[#1]#2#3{% \begingroup \def\op@@export{}% \opset{#1}% \expandafter\def\expandafter\op@decimalsepsymbol\op@decimalsepsymbol \op@split{#2}{tmp}% \ifop@error \op@errorwrite \else \op@count@vi=0 \loop \ifnum\op@count@vi<\OP@tmp@d \advance\op@count@vi by1 \xdef\op@@export{\@nameuse{OP@tmp@\the\op@count@vi}\op@@export}% \repeat \ifnum\OP@tmp@d>0 \xdef\op@@export{\op@decimalsepsymbol\op@@export}% % add 0.24 \fi % en add 0.24 \op@count@i=0 \loop \ifnum\op@count@i<\OP@tmp@i \advance\op@count@vi by1 \advance\op@count@i by1 \xdef\op@@export{\@nameuse{OP@tmp@\the\op@count@vi}\op@@export}% \repeat \fi % comment 0.24 % \fi % end comment 0.24 \endgroup \edef#3{\op@@export}% } % end add 0.23 \def\opunzero#1{% \op@split{#1}{uzr}% \ifop@error \op@errorwrite \else \op@unzero{uzr}% \op@unsplit{uzr}{#1}% \fi } \def\op@unzero#1{% \begingroup \op@count@z=\@nameuse{OP@#1@i}\relax \op@count@i=\@nameuse{OP@#1@w}\relax \op@count@ii=\@nameuse{OP@#1@i}\relax \loop \ifnum\op@count@z>1\relax \ifnum\@nameuse{OP@#1@\the\op@count@i}=0\relax \advance\op@count@ii by-1 \else \op@count@z=0 \fi \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \@namexdef{OP@#1@i}{\the\op@count@ii}% \op@count@z=\@nameuse{OP@#1@d}\relax \op@count@i=1\relax \op@count@ii=0\relax \loop \ifnum\op@count@z>0\relax \ifnum\@nameuse{OP@#1@\the\op@count@i}=0\relax \advance\op@count@ii by1 \advance\op@count@z by-1 \advance\op@count@i by1 \else \op@count@z=0 \fi \repeat \ifnum\op@count@ii>0\relax \op@count@z=1\relax \op@count@i=\@nameuse{OP@#1@w}\relax \count@=\op@count@ii \advance\op@count@ii by1 \loop \@namexdef{OP@#1@\the\op@count@z}{\@nameuse{OP@#1@\the\op@count@ii}}% \ifnum\op@count@ii<\op@count@i \advance\op@count@z by1 \advance\op@count@ii by1 \repeat \op@count@ii=\@nameuse{OP@#1@d}% \advance\op@count@ii by-\count@ \@namexdef{OP@#1@d}{\the\op@count@ii}% \fi \ifnum\@nameuse{OP@#1@i}=1\relax \ifnum\@nameuse{OP@#1@d}=0\relax \ifnum\@nameuse{OP@#1@1}=0 \@namexdef{OP@#1@s}{0}% \fi \fi \fi \op@count@i=\@nameuse{OP@#1@i}\relax \advance\op@count@i by\@nameuse{OP@#1@d}\relax \@namexdef{OP@#1@w}{\the\op@count@i}% \endgroup } \def\opcopy#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@unsplit{a}{#2}% \fi } \def\op@copy#1#2{% \begingroup \@namexdef{OP@#2@w}{\@nameuse{OP@#1@w}}% \@namexdef{OP@#2@i}{\@nameuse{OP@#1@i}}% \@namexdef{OP@#2@d}{\@nameuse{OP@#1@d}}% \@namexdef{OP@#2@s}{\@nameuse{OP@#1@s}}% \op@count@z=\@nameuse{OP@#2@w}\relax \loop \ifnum\op@count@z>0 \@namexdef{OP@#2@\the\op@count@z}{\@nameuse{OP@#1@\the\op@count@z}}% \advance\op@count@z by-1 \repeat \endgroup } \def\opcmp#1#2{% \op@split{#1}{ca}% \op@split{#2}{cb}% \ifop@error \op@errorwrite \else \op@cmp{ca}{cb}% \fi } \def\op@cmp#1#2{% \begingroup \global\opgtfalse \global\opgefalse \global\opeqfalse \global\opneqfalse \global\oplefalse \global\opltfalse \op@copy{#1}{ca}% \op@unzero{ca}% \op@copy{#2}{cb}% \op@unzero{cb}% \ifnum\OP@ca@s>\OP@cb@s\relax \global\oplttrue \global\opletrue \global\opneqtrue \else \ifnum\OP@ca@s<\OP@cb@s\relax \global\opgttrue \global\opgetrue \global\opneqtrue \else \ifnum\OP@ca@i>\OP@cb@i\relax \global\opgetrue \global\opgttrue \global\opneqtrue \else \ifnum\OP@ca@i<\OP@cb@i\relax \global\opletrue \global\oplttrue \global\opneqtrue \else \op@againtrue \op@count@i=\OP@ca@w\relax \op@count@ii=\OP@cb@w\relax \loop \ifop@again \ifnum\@nameuse{OP@ca@\the\op@count@i}> \@nameuse{OP@cb@\the\op@count@ii}\relax \op@againfalse \global\opgttrue \global\opgetrue \global\opneqtrue \else \ifnum\@nameuse{OP@ca@\the\op@count@i}< \@nameuse{OP@cb@\the\op@count@ii}\relax \op@againfalse \global\oplttrue \global\opletrue \global\opneqtrue \else \ifnum\op@count@i=1\relax \op@againfalse \ifnum\op@count@ii=1\relax \global\opeqtrue \global\opgetrue \global\opletrue \else \global\oplttrue \global\opletrue \global\opneqtrue \fi \else \ifnum\op@count@ii=1\relax \op@againfalse \global\opgttrue \global\opgetrue \global\opneqtrue \fi\fi\fi\fi \advance\op@count@i by-1 \advance\op@count@ii by-1 \repeat \fi\fi \ifnum\OP@ca@s=1\relax \ifopneq \ifopgt \global\opgtfalse \global\opgefalse \global\oplttrue \global\opletrue \else \global\opgttrue \global\opgetrue \global\opltfalse \global\oplefalse \fi \fi \fi \fi\fi \endgroup } \def\op@max#1#2{% \ifnum#1>#2 #1% \else #2% \fi } \def\op@textoperation#1#2#3#4#5{% \mathsurround=\z@\relax \ifop@deletezero \op@unzero{#1}% \op@unzero{#3}% \op@unzero{#5}% \fi \op@unsplit{#1}{@a}% \op@unsplit{#3}{@b}% \op@unsplit{#5}{@r}% \ifnum\@nameuse{OP@#1@s}=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@a)$% \else $\Op@@a$% \fi \else $\Op@@a$% \fi $\>$\nobreak#2$\>$\penalty\binoppenalty \ifnum\@nameuse{OP@#3@s}=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@b)$% \else \ifx\op@parenthesisnegative\op@string@last $(\Op@@b)$% \else $\Op@@b$% \fi\fi \else $\Op@@b$% \fi $\;$\nobreak#4$\;$\penalty\relpenalty \ifnum\@nameuse{OP@#5@s}=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@r)$% \else $\Op@@r$% \fi \else $\Op@@r$% \fi } \def\opadd{\@ifnextchar*{\op@addstar}{\op@addnostar}} \def\op@addstar*#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error \op@errorwrite \else \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \fi \ifnum\OP@a@s=0 \ifnum\OP@b@s=0 \xdef\op@realsymbol{\op@addsymbol}% \op@add{a}{b}{r}% \else \def\OP@b@s{0}% \op@cmp{a}{b}% \ifopgt \xdef\op@realsymbol{\op@subsymbol}% \op@sub{a}{b}{r}% \else \xdef\op@realsymbol{\op@subsymbol}% \op@copy{a}{r}% \op@copy{b}{a}% \op@copy{r}{b}% \op@sub{a}{b}{r}% \xdef\OP@r@s{1}% \fi \fi \else \ifnum\OP@b@s=0 \def\OP@a@s{0}% \op@cmp{a}{b}% \ifopgt \xdef\op@realsymbol{\op@subsymbol}% \op@sub{a}{b}{r}% \xdef\OP@r@s{1}% \else \xdef\op@realsymbol{\op@subsymbol}% \op@copy{a}{r}% \op@copy{b}{a}% \op@copy{r}{b}% \op@sub{a}{b}{r}% \fi \else \xdef\op@realsymbol{\op@addsymbol}% \op@add{a}{b}{r}% \xdef\OP@r@s{1}% \fi \fi \ifop@error\else \ifop@deletezero \op@unzero{r}% \fi \op@unsplit{r}{#3}% \fi \fi \endgroup } \def\op@addnostar{\@ifnextchar[{\op@addarg}{\op@addarg[nil]}} \def\op@addarg[#1]#2#3{% \begingroup \opset{#1}% \ifx\op@style\op@string@display \ifx\op@country\op@string@french \op@adddisplayone{#2}{#3}% \else \ifx\op@country\op@string@american \op@adddisplayone{#2}{#3}% \else \ifx\op@country\op@string@russian \op@adddisplayone{#2}{#3}% \else \op@error{Country \op@country\space isn't recognize} {For now, only `french', `american' and `russian' are valid} \fi\fi\fi \else \op@addstar*{#2}{#3}{@r}% \op@split{#2}{a}% \op@split{#3}{b}% \op@split{@r}{r}% \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \fi \op@textoperation{a}{\op@addsymbol}{b}{\op@equalsymbol}{r}% \fi \endgroup } \def\op@adddisplayone#1#2{% \op@addstar*{#1}{#2}{@r}% \op@addsubdisplayone } \def\op@add#1#2#3{% \begingroup \global\op@carryfalse \op@count@i=\op@max{\@nameuse{OP@#1@i}}{\@nameuse{OP@#2@i}}% \op@count@ii=\op@max{\@nameuse{OP@#1@d}}{\@nameuse{OP@#2@d}}% \op@format{\the\op@count@i}{\the\op@count@ii}{#1}% \op@format{\the\op@count@i}{\the\op@count@ii}{#2}% \@namexdef{OP@#3@i}{\the\op@count@i}% \@namexdef{OP@#3@d}{\the\op@count@ii}% \@namexdef{OP@#3@s}{0}% \xdef\OP@carry@s{0}% \xdef\OP@carry@d{0}% \advance\op@count@i by\op@count@ii \@namexdef{OP@#3@w}{\the\op@count@i}% \xdef\OP@carry@i{\the\op@count@i}% \xdef\OP@carry@w{\the\op@count@i}% \op@count@ii=1 \def\op@carry{0}% \@namexdef{OP@carry@1}{ }% \loop \op@count@z=\@nameuse{OP@#1@\the\op@count@ii}% \advance\op@count@z by\@nameuse{OP@#2@\the\op@count@ii}% \advance\op@count@z by\op@carry\relax \ifnum\op@count@z>9 \advance\op@count@z by-10 \def\op@carry{1}% \global\op@carrytrue \else \def\op@carry{0}% \fi \@namexdef{OP@#3@\the\op@count@ii}{\the\op@count@z}% \ifnum\op@count@ii<\op@count@i \advance\op@count@ii by1\relax \ifnum\op@carry=0 \@namexdef{OP@carry@\the\op@count@ii}{ }% \else \@namexdef{OP@carry@\the\op@count@ii}{1}% \global\op@carrytrue \fi \repeat \ifnum\op@carry=1 \advance\op@count@i by1 \@namexdef{OP@#3@w}{\the\op@count@i}% \@namexdef{OP@#3@\the\op@count@i}{1}% \ifop@lastcarry \@namexdef{OP@carry@w}{\the\op@count@i}% \@namexdef{OP@carry@i}{\the\op@count@i}% \@namexdef{OP@carry@\the\op@count@i}{1}% \global\op@carrytrue \fi \op@count@i=\@nameuse{OP@#3@i}\relax \advance\op@count@i by1 \@namexdef{OP@#3@i}{\the\op@count@i}% \fi \endgroup } \def\opsub{\@ifnextchar*{\op@substar}{\op@subnostar}} \def\op@substar*#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error \op@errorwrite \else \ifnum\OP@a@s=0 \ifnum\OP@b@s=0 \op@cmp{a}{b}% \ifopgt \xdef\op@realsymbol{\op@subsymbol}% \op@sub{a}{b}{r}% \else \ifx\op@behaviorsub\op@string@warning \op@warning{Substraction with first operand less than second one} \else\ifx\op@behaviorsub\op@string@error \op@error{Substraction with first operand less than second one}% {I can't do a-b with a and b positive and a0\relax \oplput(\the\op@count@z,0.75){% \vrule width\op@decimalsepwidth depth0.5\op@hrulewidth height0.5\op@hrulewidth} \fi \ifx\op@realsymbol\op@subsymbol \ifop@carrysub \ifop@carry \op@makebox{\the\op@count@z}{0}{carrystyle}{carry}% \oplput(\op@offsetcarry,2){\kern\opcolumnwidth\copy0}% \oplput(\op@offsetcarry,1){\box0}% \fi \fi \fi \vbox{% \ifx\op@realsymbol\op@addsymbol \ifop@carryadd \ifop@carry \op@makebox{\the\op@count@z}{0}{carrystyle}{carry}% \hbox{\box0}% \fi \fi \fi \op@makebox{\the\op@count@i}{\the\op@count@ii}{operandstyle.1}{a}% \hbox{\box0}% \op@makebox{\the\op@count@i}{\the\op@count@ii}{operandstyle.2}{b}% \hbox{\box0}% \op@makebox{\the\op@count@i}{\the\op@count@ii}{resultstyle}{r}% \hbox{\box0}% }% }% \leavevmode \ifx\op@voperation\op@string@center \lower1\oplineheight\box1 \else\ifx\op@voperation\op@string@top \lower2\oplineheight\box1 \else \box1 \fi\fi \fi \endgroup } \def\opmul{\@ifnextchar*{\op@mulstar}{\op@mulnostar}} \def\op@mulstar*#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error \op@errorwrite \else \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \fi \op@mul{a}{b}{r}% \ifop@deletezero \op@unzero{r}% \fi \xdef\op@realsymbol{\op@mulsymbol}% \ifnum\OP@a@s=\OP@b@s\else \xdef\OP@r@s{1}% \fi \ifop@error\else \op@unsplit{r}{#3}% \fi \fi \endgroup } \def\op@mulnostar{\@ifnextchar[{\op@mularg}{\op@mularg[nil]}} \def\op@mularg[#1]#2#3{% \begingroup \opset{#1}% \ifx\op@style\op@string@display \ifx\op@country\op@string@french \op@muldisplayone{#2}{#3}% \else \ifx\op@country\op@string@american \op@muldisplayone{#2}{#3}% \else \ifx\op@country\op@string@russian \op@muldisplayone{#2}{#3}% \else \op@error{Country \op@country\space isn't recognize} {For now, only `french', `american' and `russian' are valid} \fi\fi\fi \else \op@mulstar*{#2}{#3}{@r}% \op@split{#2}{a}% \op@split{#3}{b}% \op@split{@r}{r}% \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \op@unzero{r}% \fi \op@textoperation{a}{\op@mulsymbol}{b}{\op@equalsymbol}{r}% \fi \endgroup } \def\op@muldisplayone#1#2{% \begingroup \ifop@error\else \op@split{#1}{a}% \op@split{#2}{b}% \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \fi \op@mul{a}{b}{r}% \ifnum\OP@b@i=1 \expandafter\if\csname OP@b@\OP@b@w\endcsname0 \ifnum\OP@r@i>1 \expandafter\if\csname OP@r@\OP@r@w\endcsname0 \op@count@i=\OP@r@w \advance\op@count@i\m@ne \edef\OP@r@w{\the\op@count@i}% \op@count@i=\OP@r@i \advance\op@count@i\m@ne \edef\OP@r@i{\the\op@count@i}% \fi\fi\fi\fi \setbox1=\hbox to\OP@r@w\opcolumnwidth{% \vbox{% \ifx\op@hfactor\op@string@right \op@count@i=\OP@r@w \advance\op@count@i by-\OP@a@d \op@makebox{\the\op@count@i}{\OP@a@d}{operandstyle.1}{a}% \hbox{\box0}% \op@count@i=\OP@r@w \advance\op@count@i by-\OP@b@d \op@makebox{\the\op@count@i}{\OP@b@d}{operandstyle.2}{b}% \hbox{\box0}% \else \op@count@i=\OP@r@w \op@count@ii=\op@max{\OP@a@d}{\OP@b@d}% \advance\op@count@i by-\op@count@ii \op@makebox{\the\op@count@i}{\the\op@count@ii}{operandstyle.1}{a}% \hbox{\box0}% \op@makebox{\the\op@count@i}{\the\op@count@ii}{operandstyle.2}{b}% \hbox{\box0}% \fi \op@againtrue \ifx\op@displayintermediary\op@string@none \ifnum\OP@b@w=1 \op@againfalse \fi \fi \global\op@count@z=0\relax \ifop@again \op@count@ii=0\relax \setbox2=\hbox{}% \loop \ifnum\op@count@ii<\OP@b@w \advance\op@count@ii by1 \op@count@iii=\@nameuse{OP@b@\the\op@count@ii}% \op@count@iv=\OP@r@w \advance\op@count@iv by-\op@count@ii \advance\op@count@iv by1 \op@makebox{\the\op@count@iv}{0}% {intermediarystyle.\the\op@count@ii}{T\the\op@count@iii}% \ifx\op@displayintermediary\op@string@all \hbox{\box0\copy2}% \global\advance\op@count@z by1 \else \ifnum\the\op@count@iii=0 \ifx\op@displayshiftintermediary\op@string@shift \setbox2=\hbox{\box2\hbox to\opcolumnwidth{% \hss\op@shiftintermediarysymbol\hss}}% \fi \else \hbox{\box0\copy2}% \global\advance\op@count@z by1 \ifx\op@displayshiftintermediary\op@string@shift \setbox2=\hbox{}% \fi \fi \fi \ifx\op@displayshiftintermediary\op@string@all \setbox2=\hbox{\box2\hbox to\opcolumnwidth{% \hss\op@shiftintermediarysymbol\hss}}% \fi \repeat \fi \op@makebox{\OP@r@i}{\OP@r@d}{resultstyle}{r}% \hbox{\box0}% }% \op@count@i=\OP@r@w \ophline(-\the\op@count@i,0.75){\the\op@count@i}% \ifnum\OP@r@d>0\relax \oprput(-\the\op@count@i,0.75){% \vrule width\op@decimalsepwidth depth0.5\op@hrulewidth height0.5\op@hrulewidth} \fi \ifx\op@hfactor\op@string@right \op@count@i=\op@max{\OP@a@w}{\OP@b@w}% \else \op@count@i=\op@max{\OP@a@d}{\OP@b@d}% \advance\op@count@i by\op@max{\OP@a@i}{\OP@b@i}% \fi \advance\op@count@i by1\relax \ophline(-\the\op@count@i,\the\op@count@z.75){\the\op@count@i}% \ifx\op@voperator\op@string@top \advance\op@count@z by2 \oplput(-\the\op@count@i,\the\op@count@z){\op@mulsymbol}% \advance\op@count@z by-2 \else\ifx\op@voperator\op@string@bottom \advance\op@count@z by1 \oplput(-\the\op@count@i,\the\op@count@z){\op@mulsymbol}% \advance\op@count@z by-1 \else \advance\op@count@z by1 \oplput(-\the\op@count@i,\the\op@count@z.5){\op@mulsymbol}% \advance\op@count@z by-1 \fi\fi }% \leavevmode \ifx\op@voperation\op@string@center \advance\op@count@z by3 \dimen0=\oplineheight \multiply\dimen0 by\op@count@z \dimen0=0.5\dimen0 \lower\dimen0\box1 \else\ifx\op@voperation\op@string@top \advance\op@count@z by2 \dimen0=\oplineheight \multiply\dimen0 by\op@count@z \lower\dimen0\box1 \else \box1 \fi\fi \fi \endgroup } \def\op@mul#1#2#3{% \begingroup \op@multable{#1}% \op@count@z=\@nameuse{OP@#2@w}\relax \op@copy{zero}{mr}% \loop \op@count@iii=\@nameuse{OP@#2@\the\op@count@z}% \advance\op@count@z by-1 \op@copy{T\the\op@count@iii}{rr}% \op@lshift{\the\op@count@z}{rr}% \op@add{rr}{mr}{mr}% \ifnum\op@count@z>0 \repeat \op@count@z=\@nameuse{OP@#1@d}% \advance\op@count@z by\@nameuse{OP@#2@d}% \xdef\OP@mr@d{\the\op@count@z}% \op@count@i=\OP@mr@w \advance\op@count@i by-\op@count@z \ifnum\op@count@i>0\relax \xdef\OP@mr@i{\the\op@count@i}% \else \xdef\OP@mr@i{1}% \op@count@z=\@nameuse{OP@mr@d}% \advance\op@count@z by1 \op@count@i=\@nameuse{OP@mr@w}% \@namexdef{OP@mr@w}{\the\op@count@z}% \loop \ifnum\op@count@i<\op@count@z \advance\op@count@i by1 \@namexdef{OP@mr@\the\op@count@i}{0}% \repeat \fi \op@copy{mr}{#3}% \endgroup } \def\op@multable#1{% \op@copy{#1}{T1}% \@namexdef{OP@T1@i}{\@nameuse{OP@T1@w}}% \@namexdef{OP@T1@d}{0}% \@namexdef{OP@T1@s}{0}% % comment 0.24 % \op@unzero{T1}% % end comment 0.24 \op@add{T1}{T1}{T2}% \op@add{T1}{T2}{T3}% \op@add{T1}{T3}{T4}% \op@add{T1}{T4}{T5}% \op@add{T1}{T5}{T6}% \op@add{T1}{T6}{T7}% \op@add{T1}{T7}{T8}% \op@add{T1}{T8}{T9}% % add 0.24 \op@unzero{T1}% % end add 0.24 \op@format{\@nameuse{OP@T1@i}}{\@nameuse{OP@T1@d}}{T0}% } \def\op@lshift#1#2{% \begingroup \op@count@i=#1\relax \op@count@z=\@nameuse{OP@#2@w}\relax \advance\op@count@i by\op@count@z \@namexdef{OP@#2@w}{\the\op@count@i}% \@namexdef{OP@#2@i}{\the\op@count@i}% \loop \ifnum\op@count@z>0 \@namexdef{OP@#2@\the\op@count@i}{\@nameuse{OP@#2@\the\op@count@z}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \loop \ifnum\op@count@i>0 \@namexdef{OP@#2@\the\op@count@i}{0}% \advance\op@count@i by-1 \repeat \endgroup } \def\op@rshift#1#2{% \begingroup \op@count@i=#1\relax \op@count@z=\@nameuse{OP@#2@w}\relax \advance\op@count@z by-\op@count@i \ifnum\op@count@z>0 \@namexdef{OP@#2@w}{\the\op@count@z}% \@namexdef{OP@#2@i}{\the\op@count@z}% \@namexdef{OP@#2@d}{0}% \@namexdef{OP@#2@s}{0}% \advance\op@count@i by1\relax \op@count@ii=1 \loop \@namexdef{OP@#2@\the\op@count@ii}{\@nameuse{OP@#2@\the\op@count@i}}% \advance\op@count@i by1 \ifnum\op@count@ii<\op@count@z \advance\op@count@ii by1 \repeat \else \op@copy{zero}{#2}% \fi \endgroup } \def\opdiv{\@ifnextchar*{\op@divstar}{\op@divnostar}} \def\op@divstar*{\@ifnextchar[{\op@divstararg}{\op@divstararg[nil]}} \def\op@divstararg[#1]#2#3#4#5{% \begingroup \opset{#1} \op@split{#2}{a}% \op@split{#3}{b}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Ajout du 20/11/2006 %%% %%% Sur indication de Cristophe Poulain %%% \op@cmp{b}{zero}% \ifopeq \op@error{divisor must be nonzero}% {You have to learn some math}% \fi %%% Fin ajout %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifop@error \op@errorwrite \else \op@unzero{a}% \op@unzero{b}% \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \xdef\OP@a@s{0}% \xdef\OP@b@s{0}% \ifop@period \op@div{1}{a}{b}{q}{r}% \else \op@div{0}{a}{b}{q}{r}% \fi \op@split{#2}{a}% \op@split{#3}{b}% \op@unzero{a}% \op@unzero{b}% \ifnum\OP@a@s=0\relax \ifnum\OP@b@s=0\relax \else \xdef\OP@q@s{1}% \fi \else \xdef\OP@r@s{1}% \ifnum\OP@b@s=0\relax \xdef\OP@q@s{1}% \fi \fi \ifop@error\else \op@unsplit{q}{#4}% \op@unsplit{r}{#5}% \fi \fi \endgroup } \def\op@divnostar{\@ifnextchar[{\op@divarg}{\op@divarg[nil]}} \def\op@divarg[#1]#2#3{% \begingroup \opset{#1}% \op@split{#2}{a}% \op@split{#3}{b}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Ajout du 20/11/2006 %%% %%% Sur indication de Cristophe Poulain %%% \op@cmp{b}{zero}% \ifopeq \op@error{divisor must be nonzero}% {You have to learn some math}% \fi %%% Fin ajout %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifop@error \op@errorwrite \else \ifx\op@style\op@string@display \op@unzero{a}% \op@unzero{b}% \ifx\op@shiftdecimalsep\op@string@none \xdef\OP@a@i{\OP@a@w}% \xdef\OP@a@d{0}% \xdef\OP@b@i{\OP@b@w}% \xdef\OP@b@d{0}% \else\ifx\op@shiftdecimalsep\op@string@divisor \xdef\OP@a@i{\OP@a@w}% \xdef\OP@a@d{0}% \xdef\OP@b@i{\OP@b@w}% \xdef\OP@b@d{0}% \op@unzero{a}% \op@unzero{b}% \else \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \fi\fi \fi \ifop@period \op@div{1}{a}{b}{q}{r}% \else \op@div{0}{a}{b}{q}{r}% \fi \ifx\op@style\op@string@display \op@split{#2}{a}% \op@split{#3}{b}% \op@copy{q}{qq}% \op@unzero{a}% \op@unzero{b}% \ifx\op@shiftdecimalsep\op@string@none \def\op@shift{0}% \op@count@v=\OP@a@d \advance\op@count@v by-\OP@b@d\relax \ifnum\op@count@v>0 \op@divpowerten{qq}{\the\op@count@v}% \else \op@count@v=-\op@count@v \op@mulpowerten{qq}{\the\op@count@v}% \fi \else\ifx\op@shiftdecimalsep\op@string@divisor \edef\op@shift{\OP@a@d}% \op@count@v=\OP@a@d \advance\op@count@v by-\OP@b@d\relax \ifnum\op@count@v>0 \op@divpowerten{qq}{\the\op@count@v}% \else \op@count@v=-\op@count@v \op@mulpowerten{qq}{\the\op@count@v}% \fi \edef\op@shift{\OP@b@d}% \op@split{#2}{a}% \ifx\op@strikedecimalsepsymbol\empty \op@unzero{a}% \else \op@count@z=\OP@a@w \fi \op@mulpowerten{a}{\OP@b@d}% \ifx\op@strikedecimalsepsymbol\empty\else \advance\op@count@z by-\OP@a@d \op@format{\the\op@count@z}{\OP@a@d}{a}% \fi \xdef\OP@b@i{\OP@b@w}% \xdef\OP@b@d{0}% \ifx\op@strikedecimalsepsymbol\empty \op@unzero{b}% \fi \else \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \ifx\op@strikedecimalsepsymbol\empty \op@unzero{a}% \op@unzero{b}% \else \op@count@z=\OP@a@w \op@count@i=\OP@b@w \fi \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \ifx\op@strikedecimalsepsymbol\empty\else \advance\op@count@z by-\OP@a@d \op@format{\the\op@count@z}{\OP@a@d}{a}% \advance\op@count@i by-\OP@b@d \op@format{\the\op@count@i}{\OP@b@d}{b}% \fi \fi\fi \ifx\op@country\op@string@french \op@divdisplayone \else \ifx\op@country\op@string@american \op@divdisplayone \else \ifx\op@country\op@string@russian \op@divdisplayone \else \op@error{Country \op@country\space isn't recognize} {For now, only `french', `american' and `russian' are valid}% \fi\fi\fi \else \ifnum\OP@a@s=\OP@b@s\else \xdef\OP@q@s{1}% \fi \mathsurround=\z@\relax \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \op@unzero{q}% \fi \op@unsplit{a}{@a}% \op@unsplit{b}{@b}% \op@unsplit{q}{@q}% \ifnum\OP@a@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@a)$% \else $\Op@@a$% \fi \else $\Op@@a$% \fi $\>$\nobreak\op@divsymbol$\>$\penalty\binoppenalty \ifnum\OP@b@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@b)$% \else \ifx\op@parenthesisnegative\op@string@last $(\Op@@b)$% \else $\Op@@b$% \fi\fi \else $\Op@@b$% \fi \op@cmp{zero}{r}% \ifopeq $\;$\nobreak\op@equalsymbol$\;$\penalty\relpenalty \setbox0=\hbox{\Op@@q}% \else \ifop@period $\;$\nobreak\op@equalsymbol$\;$\penalty\relpenalty \setbox0=\hbox{% \Op@@q \setbox1=\hbox{0}% \begingroup \opcolumnwidth=\wd1 \ophline(-\op@lengthperiod,\op@vruleperiod){\op@lengthperiod}% \endgroup \op@afterperiodsymbol }% \else $\;$\nobreak\op@approxsymbol$\;$\penalty\relpenalty \setbox0=\hbox{\Op@@q}% \fi \fi \ifnum\OP@q@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\box0)$% \else $\box0$% \fi \else $\box0$% \fi \fi \fi \endgroup } \def\opidiv{\@ifnextchar*{\op@idivstar}{\op@idivnostar}} \def\op@idivstar*#1#2#3#4{% \begingroup \op@split{#1}{a}% \op@split{#2}{b}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Ajout du 20/11/2006 %%% %%% Sur indication de Cristophe Poulain %%% \op@cmp{b}{zero}% \ifopeq \op@error{divisor must be nonzero}% {You have to learn some math}% \fi %%% Fin ajout %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifop@error \op@errorwrite \else \op@unzero{a}% \op@unzero{b}% \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \xdef\OP@a@s{0}% \xdef\OP@b@s{0}% \op@periodfalse \op@div{2}{a}{b}{q}{r}% \op@split{#1}{a}% \op@split{#2}{b}% \op@unzero{a}% \op@unzero{b}% \ifnum\OP@a@s=0\relax \ifnum\OP@b@s=0\relax \else \xdef\OP@q@s{1}% \fi \else \op@add{one}{q}{q}% \ifnum\OP@b@s=0\relax \xdef\OP@q@s{1}% \fi \fi \ifop@error\else \op@unsplit{q}{#3}% \op@unsplit{r}{#4}% \fi \fi \endgroup } \def\op@idivnostar{\@ifnextchar[{\op@idivarg}{\op@idivarg[nil]}} \def\op@idivarg[#1]#2#3{% \begingroup \opset{#1}% \op@periodfalse \let\op@shiftdecimalsep\op@string@both \op@split{#2}{a}% \op@split{#3}{b}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Ajout du 20/11/2006 %%% %%% Sur indication de Cristophe Poulain %%% \op@cmp{b}{zero}% \ifopeq \op@error{divisor must be nonzero}% {You have to learn some math}% \fi %%% Fin ajout %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifop@error \op@errorwrite \else \ifx\op@style\op@string@display \op@unzero{a}% \op@unzero{b}% \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \fi \xdef\OP@a@s{0}% \xdef\OP@b@s{0}% \op@div{2}{a}{b}{q}{r}% \op@split{#2}{a}% \op@split{#3}{b}% \op@unzero{a}% \op@unzero{b}% \ifx\op@style\op@string@display \op@copy{q}{qq}% \edef\op@shift{\op@max{\OP@a@d}{\OP@b@d}}% \ifx\op@strikedecimalsepsymbol\empty\else \op@count@z=\OP@a@w \op@count@i=\OP@b@w \fi \op@mulpowerten{a}{\op@shift}% \op@mulpowerten{b}{\op@shift}% \ifx\op@strikedecimalsepsymbol\empty\else \advance\op@count@z by-\OP@a@d \op@format{\the\op@count@z}{\OP@a@d}{a}% \advance\op@count@i by-\OP@b@d \op@format{\the\op@count@i}{\OP@b@d}{b}% \fi \ifx\op@country\op@string@french \op@divdisplayone \else \ifx\op@country\op@string@american \op@divdisplayone \else \ifx\op@country\op@string@russian \op@divdisplayone \else \op@error{Country \op@country\space isn't recognize} {For now, only `french', `american' and `russian' are valid}% \fi\fi\fi \else \ifnum\OP@a@s=0\relax \ifnum\OP@b@s=0\relax \else \xdef\OP@q@s{1}% \fi \else \op@add{q}{one}{q}% \op@sub{b}{r}{r} \ifnum\OP@b@s=0\relax \xdef\OP@q@s{1}% \else \fi \fi \mathsurround=\z@\relax \ifop@deletezero \op@unzero{a}% \op@unzero{b}% \op@unzero{q}% \fi \op@unsplit{a}{@a}% \op@unsplit{b}{@b}% \op@unsplit{q}{@q}% \op@unsplit{r}{@r}% \ifnum\OP@a@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@a)$% \else $\Op@@a$% \fi \else $\Op@@a$% \fi $\;$\nobreak\op@equalsymbol$\;$\penalty\relpenalty \ifnum\OP@b@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@b)$% \else \ifx\op@parenthesisnegative\op@string@last $\Op@@b$% \else $\Op@@b$% \fi\fi \else $\Op@@b$% \fi $\>$\nobreak\op@mulsymbol$\>$\penalty\binoppenalty \ifnum\OP@q@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@q)$% \else \ifx\op@parenthesisnegative\op@string@last $(\Op@@q)$% \else $\Op@@q$% \fi\fi \else $\Op@@q$% \fi \op@cmp{zero}{r}% \ifopeq\else $\>$\nobreak\op@addsymbol$\>$\penalty\binoppenalty \ifnum\OP@q@s=1\relax \ifx\op@parenthesisnegative\op@string@all $(\Op@@r)$% \else \ifx\op@parenthesisnegative\op@string@last $(\Op@@r)$% \else $\Op@@r$% \fi\fi \else $\Op@@r$% \fi \fi \fi \fi \endgroup } \def\op@divdisplayone{% \begingroup \op@count@z=\z@\relax \op@count@i=\OP@a@w \loop \ifnum\@nameuse{OP@a@\the\op@count@i}=0 \advance\op@count@i by-1 \advance\op@count@z by1 \repeat \op@count@i=\op@firstlength \advance\op@count@i by\op@count@z \xdef\op@firstlength{\the\op@count@i}% \setbox2=\vbox{% \op@count@i=\op@firstlength \advance\op@count@i by1 \hbox{% \ifx\op@displayintermediary\op@string@none\else \kern\opcolumnwidth \advance\op@count@i by1 \fi \ifop@dividendbridge \vrule width0pt depth0pt height\oplineheight \opvline(0,1){0.4}% \ophline(0,1){\op@firstlength}% \opvline(\op@firstlength,1){0.4}% \fi \op@display{operandstyle.1}{a}% \ifnum\op@shift=0\relax\else \op@count@v=\op@shift \advance\op@count@v by\OP@a@d \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}% \fi }% \op@count@z=\OP@q@w \op@count@ii=1\relax \ifx\op@displayintermediary\op@string@none \advance\op@count@i by-1\relax \else \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax \op@count@iii=\op@count@i \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}% \hbox{% \ifx\op@voperator\op@string@center \oplput(0,0.5){\op@subsymbol}% \else\ifx\op@voperator\op@string@top \oplput(0,1){\op@subsymbol}% \else \oplput(0,0){\op@subsymbol}% \fi\fi \ophline(1,-0.25){\op@firstlength}% \advance\op@count@ii by1 \kern\op@count@iii\opcolumnwidth \op@display{intermediarystyle.1}% {T\the\op@count@iv}% }% \fi {\global\setbox4=\hbox{}\setbox4=\box4}% \loop \advance\op@count@z by-1 \advance\op@count@i by1\relax \ifnum\op@count@z>0\relax \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax \ifnum\op@count@iv=0 \ifx\op@displayintermediary\op@string@all \op@count@v=\op@count@i \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}% \hbox{% \kern\op@count@v\opcolumnwidth \op@display{remainderstyle.\the\op@count@ii}% {R\the\op@count@ii}% }% \op@count@iii=\op@count@i \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}% \hbox{% \kern\op@count@v\opcolumnwidth \ifx\op@voperator\op@string@center \oplput(-1,0.5){\op@subsymbol}% \else\ifx\op@voperator\op@string@top \oplput(-1,1){\op@subsymbol}% \else \oplput(-1,0){\op@subsymbol}% \fi\fi \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}% \kern-\op@count@v\opcolumnwidth \kern\op@count@iii\opcolumnwidth \op@display{intermediarystyle.\the\op@count@ii}% {T\the\op@count@iv}% }% \else \ifnum\@nameuse{OP@R\the\op@count@ii @w}=2 \ifnum\@nameuse{OP@R\the\op@count@ii @2}=0 \op@makebox{1}{0}{remainderstyle.\the\op@count@ii.1}{zero}% \setbox4=\hbox to\opcolumnwidth{\hss\box0\hss}% \fi \fi \fi \advance\op@count@ii by1\relax \else \op@count@v=\op@count@i \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}% \ifvoid4\relax\else \advance\op@count@v by-1 \fi \hbox{% \kern\op@count@v\opcolumnwidth\copy4 \op@display{remainderstyle.\the\op@count@ii}% {R\the\op@count@ii}% }% \advance\op@count@ii by1\relax \ifx\op@displayintermediary\op@string@none \else \op@count@iii=\op@count@i \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}% \hbox{% \kern\op@count@v\opcolumnwidth \ifx\op@voperator\op@string@center \oplput(-1,0.5){\op@subsymbol}% \else\ifx\op@voperator\op@string@top \oplput(-1,1){\op@subsymbol}% \else \oplput(-1,0){\op@subsymbol}% \fi\fi \advance\op@count@ii by-1 \ifvoid4\relax \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}% \else \ophline(0,-0.25){\@nameuse{OP@T\the\op@count@iv @w}}% \ophline(\@nameuse{OP@T\the\op@count@iv @w},-0.25){1}% {\setbox4=\box4}% \fi \advance\op@count@ii by1 \kern-\op@count@v\opcolumnwidth \kern\op@count@iii\opcolumnwidth \op@display{intermediarystyle.\the\op@count@ii}% {T\the\op@count@iv}% }% \fi \fi \repeat \advance\op@count@i by-1 \op@count@iii=\op@count@i \advance\op@count@iii by-\@nameuse{OP@R\the\op@count@ii @w}% \hbox{% \kern\op@count@iii\opcolumnwidth \op@display{remainderstyle.\the\op@count@ii}% {R\the\op@count@ii}% }% }% \setbox3=\vbox{% \op@count@v=\op@max{\OP@qq@w}{\OP@b@w} \hbox{\ophline(-0.5,-0.25){\the\op@count@v.5}% \op@display{operandstyle.2}{b}% \ifnum\op@shift=0\relax\else \op@count@v=\op@shift \advance\op@count@v by\OP@b@d \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}% \fi} \hbox{\op@display{resultstyle}{qq}} }% \dimen0=\ht2 \ifdim\dimen0>\ht3 \ht3=\ht2 \else \ht2=\ht3 \fi \ifx\op@voperation\op@string@top \dimen0=\ht2 \advance\dimen0 by-0.5\oplineheight \ht2=0.75\oplineheight \ht3=0.75\oplineheight \dp2=\dimen0 \dp2=\dimen0 \fi \setbox1=\hbox{% \box2 \kern0.5\opcolumnwidth \kern-0.5\op@hrulewidth \ifx\voperation\op@string@top \vrule width\op@hrulewidth \else \vrule width\op@hrulewidth \fi \kern0.5\opcolumnwidth \kern-0.5\op@hrulewidth \box3 }% \ifx\op@voperation\op@string@center \setbox1=\hbox{$\vcenter{\box1}$}% \fi \leavevmode\box1 \endgroup } \def\op@div#1#2#3#4#5{% \begingroup \def\op@divmode{#1}% \op@copy{#2}{da}% \op@copy{#3}{db}% \op@count@iv=0 \op@count@iii=\op@max{\OP@da@d}{\OP@db@d}\relax \op@powten{da}{\the\op@count@iii}% \op@powten{db}{\the\op@count@iii}% % add 0.23 \op@unzero{da}% \op@unzero{db}% % end 0.23 \ifnum\op@divmode=1 \op@cmp{da}{maxinteger}% \ifopgt \op@warning{I can't deal period with such great dividend (max = 2147483647).^^J Use of maxdivstep instead period.}% \def\op@divmode{0}% \else \op@cmp{db}{maxdivperiod}% \ifopgt \op@warning{I can't deal period with such great divisor (max = 214748363).^^J Use of maxdivstep instead period.}% \def\op@divmode{0}% \else \op@unsplit{da}{@a}% \op@unsplit{db}{@b}% \op@divperiod{\Op@@a}{\Op@@b}{op@lengthperiod}% \ifnum\op@lengthperiod>\op@safedivstep \op@warning{Period of division is too big (\op@lengthperiod\space > safedivstep).^^J \space\space\space Division will stop before reach it.}% \fi \fi\fi \fi \op@multable{db}% \op@copy{da}{R}% \op@cmp{da}{db}% \ifople \op@count@i=\OP@da@w \else \xdef\OP@R@d{0}% \xdef\OP@R@s{0}% \op@count@i=\@nameuse{OP@db@w}% \op@leftdividend{\the\op@count@i}% \op@cmp{R}{db}% \ifoplt \ifnum\OP@da@w>\op@count@i \advance\op@count@i by1 \op@leftdividend{\the\op@count@i}% \fi \fi \fi \xdef\op@firstlength{\the\op@count@i}% \op@count@i=-\op@count@i \advance\op@count@i by\OP@da@w \op@copy{R}{R0}% \op@copy{zero}{dq}% \op@count@ii=0 \op@againtrue \loop \ifop@again \op@tableextract{R}% \op@multen{dq}% \@namexdef{OP@dq@1}{\op@k}% \op@sub{R}{T\op@k}{dr}% \op@unzero{T\op@k}% \op@multen{dr}% \ifnum\op@count@i>0 \@namexdef{OP@dr@1}{\@nameuse{OP@da@\the\op@count@i}}% \fi \advance\op@count@i by-1\relax \op@unzero{dr}% \ifnum\OP@dr@w=1 \xdef\OP@dr@w{2}% \xdef\OP@dr@i{2}% \@namexdef{OP@dr@2}{0}% \fi \advance\op@count@ii by1\relax \op@copy{dr}{R\the\op@count@ii}% \op@copy{dr}{R}% \ifcase\op@divmode\relax \ifnum\op@count@ii<\op@maxdivstep\relax\else \op@againfalse \fi \ifnum\op@count@i<0\relax% \op@cmp{zero}{R}% \ifopeq \op@againfalse \fi \fi \or \ifnum\op@count@ii<\op@safedivstep\relax\else \op@againfalse \fi \ifnum\op@count@i<-\op@lengthperiod\relax \op@count@iv=\op@count@ii \advance\op@count@iv by-\op@lengthperiod \op@cmp{R\the\op@count@iv}{R\the\op@count@ii}% \ifopeq \op@againfalse \fi \fi \or \ifnum\op@count@i=-1 \op@againfalse \fi \fi \repeat \op@copy{zero}{T0}% \advance\op@count@i by1\relax \ifnum\op@count@i<0 \xdef\OP@dq@d{-\the\op@count@i}% \op@count@z=\OP@dq@w \advance\op@count@z by\op@count@i \xdef\OP@dq@i{\the\op@count@z}% \fi \op@unzero{dq}% \op@copy{dq}{#4}% \op@unzero{dr}% \op@copy{dr}{R}% \op@rshift{1}{dr}% \op@copy{dr}{R\the\op@count@ii}% \op@count@i=\op@count@iii \advance\op@count@i by1 \advance\op@count@i by\OP@dq@d\relax \op@count@ii=\op@count@i \advance\op@count@ii by\OP@R@w \op@format{\the\op@count@ii}{0}{R}% \op@count@z=\OP@R@w \advance\op@count@z by-\op@count@i \xdef\OP@R@i{\the\op@count@z}% \xdef\OP@R@d{\the\op@count@i}% \op@unzero{R}% \op@copy{R}{#5}% \endgroup } \def\op@powten#1#2{% \begingroup \op@count@z=#2\relax \advance\op@count@z by-\@nameuse{OP@#1@d}% \@namexdef{OP@#1@d}{0}% \op@count@i=\@nameuse{OP@#1@w}% \advance\op@count@i by\op@count@z \@namexdef{OP@#1@w}{\the\op@count@i}% \@namexdef{OP@#1@i}{\the\op@count@i}% \op@count@ii=\op@count@i \advance\op@count@ii by-\op@count@z \loop \ifnum\op@count@ii>0 \@namexdef{OP@#1@\the\op@count@i}{\@nameuse{OP@#1@\the\op@count@ii}}% \advance\op@count@i by-1 \advance\op@count@ii by-1 \repeat \loop \ifnum\op@count@i>0 \@namexdef{OP@#1@\the\op@count@i}{0}% \advance\op@count@i by-1 \repeat \endgroup } \def\opdivperiod#1#2#3{% \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error\else \op@unzero{a}% \edef\OP@a@i{\OP@a@w}% \def\OP@a@d{0}% \def\OP@a@s{0}% \op@unzero{b}% \edef\OP@b@i{\OP@b@w}% \def\OP@b@d{0}% \def\OP@b@s{0}% \op@cmp{a}{zero}% \ifopeq \op@unsplit{one}{#3}% \else \op@cmp{b}{zero}% \ifopeq \op@error{divisor must be nonzero}% {You have to learn some math}% \else \op@cmp{a}{maxdivperiod}% \ifopgt \op@error{Arguments of \string\opdivperiod\space must be less than 214748363}% {Sorry}% \else \op@cmp{b}{maxdivperiod}% \ifopgt \op@error{Arguments of \string\opdivperiod\space must be less than 214748363}% {Sorry}% \else \op@unsplit{a}{@a}% \op@unsplit{b}{@b}% \op@divperiod{\Op@@a}{\Op@@b}{Op@@r}% \opcopy{@r}{#3}% \fi \fi \fi \fi \fi \ifop@error\op@errorwrite\fi } \def\op@divperiod#1#2#3{% \begingroup \op@count@i=#1\relax \op@count@ii=#2\relax \ifnum\op@count@ii=0\relax \@namexdef{#3}{1}% \else \op@gcd{\the\op@count@i}{\the\op@count@ii}{op@tmp}% \op@count@iii=\op@tmp \divide\op@count@ii by\op@count@iii \op@twofiveQ{\the\op@count@ii}{op@tmp}% \op@order{\op@tmp}{op@tmp}% \@namexdef{#3}{\op@tmp}% \fi \endgroup } \def\opgcd#1#2#3{% \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error\else \def\OP@a@s{0}% \def\OP@b@s{0}% \op@cmp{a}{zero}% \ifopeq \op@error{Arguments of \string\opgcd\space must be nonzero}% {You have to learn some math}% \else \op@cmp{b}{zero}% \ifopeq \op@error{Arguments of \string\opgcd\space must be nonzero}% {You have to learn some math}% \else\ifnum\OP@a@d>0 \op@error{Arguments of \string\opgcd\space must be integer}% {You have to learn some math}% \else\ifnum\OP@b@d>0 \op@error{Arguments of \string\opgcd\space must be integer}% {You have to learn some math}% \else \op@cmp{a}{maxinteger}% \ifopgt \op@error{Arguments of \string\opgcd\space must be less than 2147483647}% {Sorry}% \else \op@cmp{b}{maxinteger}% \ifopgt \op@error{Arguments of \string\opgcd\space must be less than 2147483647}% {Sorry}% \else \op@unsplit{a}{@a}% \op@unsplit{b}{@b}% \op@gcd{\Op@@a}{\Op@@b}{Op@@r}% \opcopy{@r}{#3}% \fi\fi\fi\fi\fi\fi \fi \ifop@error\op@errorwrite\fi } \def\op@gcd#1#2#3{% \begingroup \op@count@i=#1\relax \op@count@ii=#2\relax \loop \op@count@iii=\op@count@i \divide\op@count@iii by\op@count@ii \multiply\op@count@iii by\op@count@ii \advance\op@count@i by-\op@count@iii \op@count@iii=\op@count@i\relax \op@count@i=\op@count@ii\relax \op@count@ii=\op@count@iii \ifnum\op@count@ii>0 \repeat \@namexdef{#3}{\the\op@count@i}% \endgroup } \def\op@twofiveQ#1#2{% \begingroup \op@count@i=#1\relax \loop \op@count@ii=\op@count@i \divide\op@count@ii by2 \multiply\op@count@ii by2 \ifnum\op@count@ii=\op@count@i \divide\op@count@i by2 \repeat \loop \op@count@ii=\op@count@i \divide\op@count@ii by5 \multiply\op@count@ii by5 \ifnum\op@count@ii=\op@count@i \divide\op@count@i by5 \repeat \@namexdef{#2}{\the\op@count@i}% \endgroup } \def\op@order#1#2{% \begingroup \op@count@i=1\relax \op@count@ii=0 \loop \multiply\op@count@i by10 \op@count@iii=\op@count@i \divide\op@count@iii by#1\relax \multiply\op@count@iii by#1\relax \advance\op@count@i by-\op@count@iii \advance\op@count@ii by1 \ifnum\op@count@i>1 \repeat \@namexdef{#2}{\the\op@count@ii} \endgroup } \def\op@leftdividend#1{% \begingroup \op@count@z=#1\relax \op@count@i=\OP@da@w \xdef\OP@R@w{\the\op@count@z}% \xdef\OP@R@i{\the\op@count@z}% \loop \@namexdef{OP@R@\the\op@count@z}{\@nameuse{OP@da@\the\op@count@i}}% \advance\op@count@i by-1 \advance\op@count@z by-1 \ifnum\op@count@z>0 \repeat \endgroup } \def\op@multen#1{% \begingroup \op@count@z=\@nameuse{OP@#1@w}\relax \op@count@i=\op@count@z \advance\op@count@i by1 \@namexdef{OP@#1@w}{\the\op@count@i}% \@namexdef{OP@#1@i}{\the\op@count@i}% \loop \ifnum\op@count@z>0 \@namexdef{OP@#1@\the\op@count@i}{\@nameuse{OP@#1@\the\op@count@z}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \@namexdef{OP@#1@1}{0}% \endgroup } \def\op@mulpowerten#1#2{% \begingroup \ifnum\@nameuse{OP@#1@d}<#2\relax \op@count@z=#2\relax \advance\op@count@z by-\@nameuse{OP@#1@d}\relax \op@count@ii=\@nameuse{OP@#1@w}% \op@count@i=\@nameuse{OP@#1@w}% \advance\op@count@i by\op@count@z \@namexdef{OP@#1@w}{\the\op@count@i}% \@namexdef{OP@#1@i}{\the\op@count@i}% \@namexdef{OP@#1@d}{0}% \loop \ifnum\op@count@ii>0 \@namexdef{OP@#1@\the\op@count@i}{\@nameuse{OP@#1@\the\op@count@ii}}% \advance\op@count@i by-1 \advance\op@count@ii by-1 \repeat \loop \ifnum\op@count@z>0 \@namexdef{OP@#1@\the\op@count@z}{0}% \advance\op@count@z by-1\relax \repeat \else \op@count@z=\@nameuse{OP@#1@d}\relax \advance\op@count@z by-#2\relax \@namexdef{OP@#1@d}{\the\op@count@z}% \op@count@z=\@nameuse{OP@#1@i}\relax \advance\op@count@z by#2\relax \@namexdef{OP@#1@i}{\the\op@count@z}% \fi \op@unzero{#1}% \endgroup } \def\op@divpowerten#1#2{% \begingroup \ifnum\@nameuse{OP@#1@i}>#2\relax \op@count@z=\@nameuse{OP@#1@d}\relax \advance\op@count@z by#2\relax \@namexdef{OP@#1@d}{\the\op@count@z}% \op@count@z=\@nameuse{OP@#1@i}\relax \advance\op@count@z by-#2\relax \@namexdef{OP@#1@i}{\the\op@count@z}% \else \op@count@z=\@nameuse{OP@#1@d}\relax \advance\op@count@z by#2\relax \@namexdef{OP@#1@d}{\the\op@count@z}% \@namexdef{OP@#1@i}{1}% \advance\op@count@z by1\relax \op@count@i=\@nameuse{OP@#1@w}% \@namexdef{OP@#1@w}{\the\op@count@z}% \advance\op@count@z by1 \loop \ifnum\op@count@i<\op@count@z \advance\op@count@i by1 \@namexdef{OP@#1@\the\op@count@i}{0}% \repeat \fi \op@unzero{#1}% \endgroup } \def\op@tableextract#1{% \op@cmp{#1}{T5}% \ifopge \op@cmp{#1}{T7}% \ifopge \op@cmp{#1}{T8}% \ifopge \op@cmp{#1}{T9}% \ifopge \gdef\op@k{9}% \else \gdef\op@k{8}% \fi \else \gdef\op@k{7}% \fi \else \op@cmp{#1}{T6}% \ifopge \gdef\op@k{6}% \else \gdef\op@k{5}% \fi \fi \else \op@cmp{#1}{T2}% \ifopge \op@cmp{#1}{T3}% \ifopge \op@cmp{#1}{T4}% \ifopge \gdef\op@k{4}% \else \gdef\op@k{3}% \fi \else \gdef\op@k{2}% \fi \else \op@cmp{#1}{T1}% \ifopge \gdef\op@k{1}% \else \gdef\op@k{0}% \fi \fi \fi } \def\opwidth#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \@namexdef{Op@#2}{\OP@a@w}% \fi } \def\opintegerwidth#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \@namexdef{Op@#2}{\OP@a@i}% \fi } \def\opdecimalwidth#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \@namexdef{Op@#2}{\OP@a@d}% \fi } \def\opinteger#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@integer{a}{b}% \op@unsplit{b}{#2}% \fi } \def\op@integer#1#2{% \begingroup \op@unzero{#1}% \op@count@z=\@nameuse{OP@#1@d}\relax \ifnum\op@count@z>0\relax \op@count@i=0 \loop \ifnum\op@count@z<\@nameuse{OP@#1@w}% \advance\op@count@z by1\relax \advance\op@count@i by1\relax \@namexdef{OP@#2@\the\op@count@i}{\@nameuse{OP@#1@\the\op@count@z}}% \repeat \@namexdef{OP@#2@w}{\the\op@count@i}% \@namexdef{OP@#2@i}{\the\op@count@i}% \@namexdef{OP@#2@d}{0}% \else \op@copy{#1}{#2}% \fi \@namexdef{OP@#2@s}{0}% \endgroup } \def\opdecimal#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@decimal{a}{b}% \op@unsplit{b}{#2}% \fi } \def\op@decimal#1#2{% \op@unzero{#1}% \ifop@error \op@errorwrite \else \ifnum\@nameuse{OP@#1@d}=0\relax \op@copy{zero}{#2}% \else \op@copy{#1}{#2}% \@namexdef{OP@#2@i}{\@nameuse{OP@#1@d}}% \@namexdef{OP@#2@w}{\@nameuse{OP@#1@d}}% \@namexdef{OP@#2@d}{0}% \@namexdef{OP@#2@s}{0}% \fi \fi } \def\opgetdigit#1#2#3{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \ifnum\@nameuse{OP@a@w}>#2\relax \@namexdef{Op@#3}{\@nameuse{OP@a@#2}}% \else \@namexdef{Op@#3}{0}% \fi \fi } \def\opsetdigit#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#3}{b}% \ifop@error \op@errorwrite \else \op@unsplit{b}{@b}% \@namexdef{OP@a@#2}{\Op@@b}% \ifnum\OP@a@w<#2\relax \op@count@z=\OP@a@w\relax \advance\op@count@z by1\relax \loop \ifnum\op@count@z<#2\relax \@namexdef{OP@a@\the\op@count@z}{0}% \advance\op@count@z by1 \repeat \xdef\OP@a@w{#2}% \op@count@z=#2\relax \advance\op@count@z by-\OP@a@d \xdef\OP@a@i{\the\op@count@z}% \fi \op@unsplit{a}{#1}% \fi \endgroup } \def\opgetintegerdigit#1#2#3{% \begingroup \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@count@z=\OP@a@d \advance\op@count@z by#2\relax \ifnum\OP@a@w>\op@count@z\relax \@namexdef{Op@#3}{\@nameuse{OP@a@\the\op@count@z}}% \else \@namexdef{Op@#3}{0}% \fi \fi \endgroup } \def\opsetintegerdigit#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#3}{b}% \ifop@error \op@errorwrite \else \op@unsplit{b}{@b}% \op@count@z=\OP@a@d \advance\op@count@z by#2\relax \@namexdef{OP@a@\the\op@count@z}{\Op@@b}% \ifnum\OP@a@w>\op@count@z\relax\else \op@count@i=\OP@a@w \xdef\OP@a@w{\the\op@count@z}% \advance\op@count@i by1 \loop \ifnum\op@count@i<\op@count@z \@namexdef{OP@a@\the\op@count@i}{0}% \advance\op@count@i by1 \repeat \advance\op@count@z by-\OP@a@d \xdef\OP@a@i{\the\op@count@z}% \fi \op@unsplit{a}{#1}% \fi \endgroup } \def\opgetdecimaldigit#1#2#3{% \begingroup \op@split{#1}{a}% \ifop@error \op@errorwrite \else \ifnum\OP@a@d<#2\relax \@namexdef{Op@#3}{0}% \else \op@count@z=\OP@a@d \advance\op@count@z by-#2\relax \advance\op@count@z by1 \@namexdef{Op@#3}{\@nameuse{OP@a@\the\op@count@z}}% \fi \fi \endgroup } \def\opsetdecimaldigit#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#3}{b}% \ifop@error \op@errorwrite \else \op@unsplit{b}{@b}% \ifnum\OP@a@d<\Op@@b\relax \op@count@z=\Op@@b \advance\op@count@z by-\OP@a@d %%% [2006/10/06] Bug find by Dave Jarvis. % \advance\op@count@z by1\relax %%% end bug fixing \op@count@i=\OP@a@w \advance\op@count@i by\op@count@z\relax \op@count@z=\OP@a@w \xdef\OP@a@w{\the\op@count@i}% \xdef\OP@a@d{\Op@@b}% \loop \ifnum\op@count@z>0 \@namexdef{OP@a@\the\op@count@i}{\@nameuse{OP@a@\the\op@count@z}}% \advance\op@count@z by-1 \advance\op@count@i by-1 \repeat \loop \ifnum\op@count@i>1 \@namexdef{OP@a@\the\op@count@i}{0}% \advance\op@count@i by-1 \repeat %%% [2006/10/06] Bug find by Dave Jarvis. % \@namexdef{OP@a@1}{\Op@@b}% \@namexdef{OP@a@1}{#2}% %%% end bug fixing \else \op@count@z=\OP@a@d %%% [2006/10/06] Bug find by Dave Jarvis. % \advance\op@count@z by-#2\relax \advance\op@count@z by-\Op@@b\relax %%% end bug fixing \advance\op@count@z by1 %%% [2006/10/06] Bug find by Dave Jarvis. % \@namexdef{OP@a@\the\op@count@z}{\Op@@b}% \@namexdef{OP@a@\the\op@count@z}{#2}% %%% end bug fixing \fi \op@unsplit{a}{#1}% \fi \endgroup } \def\opcastingoutnines#1#2{% \begingroup \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@count@z=\OP@a@w\relax \op@count@i=0\relax \loop \ifnum\op@count@z>0 \advance\op@count@i by\@nameuse{OP@a@\the\op@count@z}\relax \ifnum\op@count@i>8 \advance\op@count@i by-9 \fi \advance\op@count@z by-1 \repeat \opcopy{\the\op@count@i}{#2}% \fi \endgroup } \def\opcastingoutelevens#1#2{% \begingroup \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@count@ii=\OP@a@w \advance\op@count@ii by1\relax \op@count@i=0\relax \op@count@z=-1\relax \loop \advance\op@count@z by2\relax \ifnum\op@count@z<\op@count@ii \advance\op@count@i by\@nameuse{OP@a@\the\op@count@z}\relax \ifnum\op@count@i>10 \advance\op@count@i by-11 \fi \repeat \op@count@z=0\relax \loop \advance\op@count@z by2\relax \ifnum\op@count@z<\op@count@ii \advance\op@count@i by-\@nameuse{OP@a@\the\op@count@z}\relax \ifnum\op@count@i<0 \advance\op@count@i by11 \fi \repeat \opcopy{\the\op@count@i}{#2}% \fi \endgroup } \def\opneg#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \op@neg{a}{b}% \op@unsplit{b}{#2}% \fi } \def\op@neg#1#2{% \begingroup \op@copy{#1}{#2}% \op@againfalse \ifnum\@nameuse{OP@#2@d}>0 \op@againtrue \else\ifnum\@nameuse{OP@#2@i}>1 \op@againtrue \else\ifnum\@nameuse{OP@#2@1}>0 \op@againtrue \fi\fi\fi \ifop@again \op@count@z=1 \advance\op@count@z by-\@nameuse{OP@#2@s}\relax \@namexdef{OP@#2@s}{\the\op@count@z}% \fi \endgroup } \def\opabs#1#2{% \op@split{#1}{a}% \ifop@error \op@errorwrite \else \xdef\OP@a@s{0}% \op@unsplit{a}{#2}% \fi } \def\oppower#1#2#3{% \begingroup \op@split{#1}{a}% \op@split{#2}{b}% \ifop@error\else \op@unsplit{a}{@a}% \op@unsplit{b}{@b}% \ifnum\OP@b@d>0 \op@error{Exponent must be an integer}% {You can't use \string\oppower\space with non integer exponent}% \else \op@cmp{a}{zero}% \ifopeq \op@cmp{b}{zero}% \ifopeq \opcopy{1}{#3}% \else\ifopgt \opcopy{0}{#3}% \else \op@error{Power of zero with negative exponent is an error}% {Remember that negative exponent involve inverse}% \fi\fi \else \op@cmp{b}{zero}% \ifoplt \xdef\OP@b@s{0}% \op@unsplit{b}{@b}% \opdiv*{1}{@a}{@a}% \fi \op@cmp{b}{maxpower}% \ifopgt \op@error{Exponent is too big (>1073741824)}% {Sorry}% \else \op@count@z=0 \@namexdef{Op@@e0}{1}% \xdef\Op@@tmp{1}% \@namexdef{Op@@p0}{\Op@@a}% \@namexdef{Op@@ptmp}{\@nameuse{Op@@p0}}% \loop \ifnum\@nameuse{Op@@e\the\op@count@z}<\Op@@b \opadd*{@tmp}{@tmp}{@@tmp}% \opmul*{@ptmp}{@ptmp}{@@ptmp}% \advance\op@count@z by1 \xdef\Op@@tmp{\Op@@@tmp}% \xdef\Op@@ptmp{\Op@@@ptmp}% \@namexdef{Op@@e\the\op@count@z}{\Op@@@tmp}% \@namexdef{Op@@p\the\op@count@z}{\Op@@@ptmp}% \repeat \opcopy{1}{@r}% \loop \ifnum\Op@@b>0\relax \ifnum\Op@@b<\@nameuse{Op@@e\the\op@count@z}\relax \else \opmul*{@r}{@p\the\op@count@z}{@r}% \opsub*{@b}{@e\the\op@count@z}{@b}% \fi \advance\op@count@z by-1 \repeat \opcopy{@r}{#3}% \fi \fi \fi \fi \ifop@error\op@errorwrite\fi \endgroup } \def\opfloor#1#2#3{% \op@split{#1}{fa}% \op@split{#2}{fb}% \ifop@error \op@errorwrite \else \ifnum\OP@fa@s=1 \xdef\OP@fa@s{0}% \op@ceil{fa}{fb}% \xdef\OP@fa@s{1}% \else \op@floor{fa}{fb}% \fi \op@unsplit{fa}{#3}% \fi } \def\opround#1#2#3{% \op@split{#1}{ra}% \op@split{#2}{rb}% \ifop@error \op@errorwrite \else \op@unsplit{ra}{@ra}% \op@unsplit{rb}{@rb}% \ifnum\Op@@rb<0\relax \opneg{@rb}{@rb}% \ifnum\Op@@rb<\@nameuse{OP@ra@i}\relax \else \op@count@z=\@nameuse{OP@ra@i}% \advance\op@count@z by-1 \xdef\Op@@rb{\the\op@count@z}% \fi \opneg{@rb}{@rb}% \fi \oppower{0.1}{@rb}{@rr}% \opmul*{0.5}{@rr}{@rr}% \ifnum\OP@ra@s=0\relax \opadd*{@ra}{@rr}{@ra}% \opfloor{@ra}{#2}{#3}% \else \opneg{@ra}{@ra}% \opadd*{@ra}{@rr}{@ra}% \opfloor{@ra}{#2}{@ra}% \opneg{@ra}{#3}% \fi \fi } \def\opceil#1#2#3{% \op@split{#1}{ca}% \op@split{#2}{cb}% \ifop@error \op@errorwrite \else \ifnum\OP@ca@s=1 \xdef\OP@ca@s{0}% \op@floor{ca}{cb}% \xdef\OP@ca@s{1}% \else \op@ceil{ca}{cb}% \fi \op@unsplit{ca}{#3}% \fi } \def\op@floor#1#2{% \begingroup \op@unsplit{#2}{@fb}% \op@unzero{#1}% \op@count@z=\Op@@fb\relax \ifnum\op@count@z<0 \op@count@z=-\op@count@z \ifnum\op@count@z<\@nameuse{OP@#1@i}\relax\else \op@count@z=\@nameuse{OP@#1@i}% \advance\op@count@z by-1 \fi \op@integer{#1}{#1}% \loop \ifnum\op@count@z>0 \@namexdef{OP@#1@\the\op@count@z}{0}% \advance\op@count@z by-1\relax \repeat \else \ifnum\op@count@z>\@nameuse{OP@#1@d}% \advance\op@count@z by-\@nameuse{OP@#1@d}% \op@count@i=\@nameuse{OP@#1@d}% \advance\op@count@i by\op@count@z \@namexdef{OP@#1@d}{\the\op@count@i}% \op@count@i=\@nameuse{OP@#1@w}\relax \op@count@ii=\op@count@i \advance\op@count@ii by\op@count@z \@namexdef{OP@#1@w}{\the\op@count@ii}% \loop \ifnum\op@count@i>0 \@namexdef{OP@#1@\the\op@count@ii}{\@nameuse{OP@#1@\the\op@count@i}}% \advance\op@count@i by-1 \advance\op@count@ii by-1 \repeat \loop \ifnum\op@count@ii>0 \@namexdef{OP@#1@\the\op@count@ii}{0}% \advance\op@count@ii by-1 \repeat \else \advance\op@count@z by-\@nameuse{OP@#1@d}\relax \op@count@z=-\op@count@z\relax \op@count@i=\@nameuse{OP@#1@w}\relax \op@count@ii=\op@count@i\relax \advance\op@count@i by-\op@count@z \@namexdef{OP@#1@w}{\the\op@count@i}\relax \op@count@i=\@nameuse{OP@#1@d}\relax \advance\op@count@i by-\op@count@z \@namexdef{OP@#1@d}{\the\op@count@i}% \op@count@i=0\relax \loop \ifnum\op@count@z<\op@count@ii \advance\op@count@z by1\relax \advance\op@count@i by1 \@namexdef{OP@#1@\the\op@count@i}{\@nameuse{OP@#1@\the\op@count@z}}% \repeat \fi \fi \endgroup } \def\op@ceil#1#2{% \op@unsplit{#1}{@Ca}% \op@unsplit{#2}{@Cb}% \op@unzero{#1}% \op@count@z=\Op@@Cb\relax \ifnum\op@count@z>0\relax \ifnum\op@count@z<\@nameuse{OP@#1@d}\relax \oppower{0.1}{\the\op@count@z}{@Cr}% \opadd*{@Ca}{@Cr}{@Ca}% \op@split{@Ca}{#1}% \op@split{@Cb}{#2}% \op@floor{#1}{#2}% \else \op@split{@Ca}{#1}% \op@split{@Cb}{#2}% \op@floor{#1}{#2}% \fi \else \opneg{@Cb}{@Cb}% \op@count@z=-\op@count@z\relax \ifnum\op@count@z<\@nameuse{OP@#1@i}\relax \oppower{10}{\the\op@count@z}{@Cr}% \else \op@count@z=\@nameuse{OP@#1@i}% \advance\op@count@z by-1 \oppower{10}{\the\op@count@z}{@Cr}% \fi \opadd*{@Ca}{@Cr}{@Ca}% \opneg{@Cb}{@Cb}% \op@split{@Ca}{#1}% \op@split{@Cb}{#2}% \op@floor{#1}{#2}% \fi } \edef\opHatCode{\the\catcode`\^} \catcode`\^=12\relax \def\opexpr{\@ifnextchar[{\op@exprarg}{\op@exprarg[nil]}} \def\op@exprarg[#1]{% \opset{#1}% \begingroup \catcode`\^=12 \catcode`*=12 \catcode`/=12 \catcode`:=12 \catcode`+=12 \catcode`-=12 \catcode`.=12 \catcode`,=12 \catcode`(=12 \catcode`)=12 \catcode`\ =12 \op@expr } \def\op@expr#1{% \ifop@error \op@errorwrite \else \xdef\op@expression{#1}\endgroup \ifx\op@expression\empty \op@error{Empty expression is not valid}% {I say: "empty expression is not valid"}% \else \expandafter\op@scan@line\expandafter{\op@expression}% \@ifundefined{OP@token\the\op@token}% {\global\advance\op@token by-1}% {\relax}% \global\op@stack=0 \op@search@term{1}{\the\op@token}% \fi \fi \op@@expr } \def\op@@expr#1{% \ifnum\op@stack=1 \ifop@error \op@errorwrite \else \opcopy{@s1}{#1}% \fi \else \op@error{Bad expression (not enough operator or operand)}% {Expression like 2 + 3 3 or 3 * 5 *}% \op@errorwrite \fi } \def\op@scan@line{% \begingroup \global\op@parenthesis=0 \global\op@token=1 \global\op@in@numberfalse \global\op@in@decimalfalse \global\op@in@namefalse \global\op@in@signtrue \catcode`\^=12 \catcode`*=12 \catcode`/=12 \catcode`:=12 \catcode`+=12 \catcode`-=12 \catcode`.=12 \catcode`,=12 \catcode`(=12 \catcode`)=12 \catcode`\ =12 \op@scan@@line } \def\op@scan@@line#1{\op@scan@@@line#1\op@nil\endgroup} \def\op@scan@@@line#1#2\op@nil{% \op@testch@r{#1}% \ifop@isdigit \global\op@in@signfalse \ifop@in@number \op@token@append{#1}% \else\ifop@in@name \op@token@append{#1}% \else \op@in@numbertrue \op@token@create{#1}% \fi\fi \fi \ifop@isplus \op@token@single{\op@string@add}% \global\op@in@signtrue \fi \ifop@isminus \op@token@single{\op@string@sub}% \global\op@in@signtrue \fi \ifop@ismultiply \op@token@single{\op@string@mul}% \global\op@in@signtrue \fi \ifop@isdivide \op@token@single{\op@string@div}% \global\op@in@signtrue \fi \ifop@isidivide \op@token@single{\op@string@idiv}% \global\op@in@signtrue \fi \ifop@ispower \op@token@single{\op@string@power}% \global\op@in@signtrue \fi \ifop@isdot \global\op@in@signfalse \ifop@in@decimal \op@error{Number width multiple decimal separators}% {You write something like 12.34.56}% \else\ifop@in@number \op@in@decimaltrue \op@token@append{.}% \else \op@token@create{.}% \op@in@numbertrue \op@in@decimaltrue \fi\fi \fi \ifop@islparenthesis \op@token@single{(}% \global\op@in@signtrue \fi \ifop@isrparenthesis \op@token@single{)}% \global\op@in@signtrue \fi \ifop@iscomma \op@token@single{,}% \global\op@in@signtrue \fi \ifop@isspace \ifop@in@number \op@in@numberfalse \op@in@decimalfalse \global\advance\op@token by1 \else\ifop@in@name \op@in@namefalse \global\advance\op@token by1 \fi\fi \fi \ifop@isother \global\op@in@signfalse \ifop@in@name \op@token@append{#1}% \else\ifop@in@number \op@in@numberfalse \op@in@decimalfalse \op@in@nametrue \global\advance\op@token by1 \op@token@create{#1}% \else \op@in@nametrue \op@token@create{#1}% \fi\fi \fi \def\@tempa{#2}% \ifx\empty\@tempa \let\next\relax \else \let\next\op@scan@@@line \fi \expandafter\next\@tempa\op@nil } \def\op@search@subexpr#1#2{% \begingroup \op@count@i=#1\relax \op@count@v=#2\relax \ifnum\op@count@i=\op@count@v \op@token@use{#1}% \else \op@count@iii=\op@count@v \op@count@iv=\op@count@i \advance\op@count@iv by-1 \op@count@ii=0 \loop \ifnum\op@count@iii>\op@count@iv \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@rpar\relax \advance\op@parenthesis by1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@lpar\relax \advance\op@parenthesis by-1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@comma\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \advance\op@count@iii by-1 \repeat \ifnum\op@count@ii=0\relax \ifnum\op@parenthesis=0 \op@search@term{\the\op@count@i}{\the\op@count@v}% \else \op@error{Unbalanced parenthesis in expression}% {Error between tokens #1 and #2}% \fi \else \advance\op@count@ii by-1 \op@search@subexpr{\the\op@count@i}{\the\op@count@ii}% \advance\op@count@ii by2 \op@search@subexpr{\the\op@count@ii}{\the\op@count@v}% \fi \fi \endgroup } \def\op@search@term#1#2{% \begingroup \op@count@i=#1\relax \op@count@v=#2\relax \ifnum\op@count@i=\op@count@v \op@token@use{#1}% \else \op@count@iii=\op@count@v \op@count@iv=\op@count@i \advance\op@count@iv by-1 \op@count@ii=0\relax \loop \ifnum\op@count@iii>\op@count@iv\relax \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@rpar\relax \advance\op@parenthesis by1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@lpar\relax \advance\op@parenthesis by-1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@add\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@sub\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \advance\op@count@iii by-1 \repeat \ifnum\op@count@ii=0\relax \ifnum\op@parenthesis=0 \op@search@factor{\the\op@count@i}{\the\op@count@v}% \else \op@error{Unbalanced parenthesis in expression}% {Error between tokens #1 and #2}% \fi \else \advance\op@count@ii by-1 \op@search@term{\the\op@count@i}{\the\op@count@ii}% \advance\op@count@ii by2 \op@search@term{\the\op@count@ii}{\the\op@count@v}% \advance\op@count@ii by-1 \op@token@use{\the\op@count@ii}% \fi \fi \endgroup } \def\op@search@factor#1#2{% \begingroup \op@count@i=#1\relax \op@count@v=#2\relax \ifnum\op@count@i=\op@count@v \op@token@use{#1}% \else \op@count@iii=\op@count@v \op@count@iv=\op@count@i \advance\op@count@iv by-1 \op@count@ii=0 \loop \ifnum\op@count@iii>\op@count@iv \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@rpar\relax \advance\op@parenthesis by1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@lpar\relax \advance\op@parenthesis by-1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@mul\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@div\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@idiv\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \advance\op@count@iii by-1 \repeat \ifnum\op@count@ii=0\relax \ifnum\op@parenthesis=0 \op@search@power{\the\op@count@i}{\the\op@count@v}% \else \op@error{Unbalanced parenthesis in expression}% {Error between tokens #1 and #2}% \fi \else \advance\op@count@ii by-1 \op@search@factor{\the\op@count@i}{\the\op@count@ii}% \advance\op@count@ii by2 \op@search@factor{\the\op@count@ii}{\the\op@count@v}% \advance\op@count@ii by-1 \op@token@use{\the\op@count@ii}% \fi \fi \endgroup } \def\op@search@power#1#2{% \begingroup \op@count@i=#1\relax \op@count@v=#2\relax \ifnum\op@count@i=\op@count@v \op@token@use{#1}% \else \op@count@iii=\op@count@v \op@count@iv=\op@count@i \advance\op@count@iv by-1 \op@count@ii=0 \loop \ifnum\op@count@iii>\op@count@iv \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@rpar\relax \advance\op@parenthesis by1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@lpar\relax \advance\op@parenthesis by-1 \fi \expandafter\ifx\csname OP@token\the\op@count@iii\endcsname \op@string@power\relax \ifnum\op@parenthesis=0 \op@count@ii=\op@count@iii\relax \op@count@iii=0 \fi \fi \advance\op@count@iii by-1 \repeat \ifnum\op@count@ii=0\relax \ifnum\op@parenthesis=0 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \else \op@error{Unbalanced parenthesis in expression}% {Error between tokens #1 and #2}% \fi \else \advance\op@count@ii by-1 \op@search@power{\the\op@count@i}{\the\op@count@ii}% \advance\op@count@ii by2 \op@search@power{\the\op@count@ii}{\the\op@count@v}% \advance\op@count@ii by-1 \op@token@use{\the\op@count@ii}% \fi \fi \endgroup } \def\op@search@primary#1#2{% \begingroup \op@count@i=#1\relax \op@count@v=#2\relax \ifnum\op@count@i=\op@count@v \op@token@use{#1}% \else \expandafter\ifx\csname OP@token#1\endcsname\op@string@abs \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@ceil \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@decimal \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@floor \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@integer \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@gcd \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@mod \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@neg \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@rest \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname\op@string@round \advance\op@count@i by1 \op@search@primary{\the\op@count@i}{\the\op@count@v}% \advance\op@count@i by-1 \op@token@use{\the\op@count@i}% \fi \expandafter\ifx\csname OP@token#1\endcsname \op@string@lpar\relax \expandafter\ifx\csname OP@token#2\endcsname \op@string@rpar\relax \advance\op@count@i by1 \advance\op@count@v by-1 \op@search@subexpr{\the\op@count@i}{\the\op@count@v}% \else \op@error{Garbage after parenthesis}% {Error between tokens #1 and #2}% \fi \fi \fi \endgroup } \def\op@token@use#1{% \edef\op@arg{\@nameuse{OP@token#1}}% \ifx\op@arg\op@string@abs \opabs{@s\the\op@stack}{@s\the\op@stack}% \else\ifx\op@arg\op@string@add \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opadd*{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@ceil \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opceil{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@decimal \opdecimal{@s\the\op@stack}{@s\the\op@stack}% \else\ifx\op@arg\op@string@div \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opdiv*{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}{r}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@floor \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opfloor{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@gcd \op@stackb=\op@stack \global\advance\op@stackb by-1 \opgcd{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@idiv \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opidiv*{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}{r}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@integer \opinteger{@s\the\op@stack}{@s\the\op@stack}% \else\ifx\op@arg\op@string@mod \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opidiv*{@s\the\op@stackb}{@s\the\op@stack}{@q}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@mul \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opmul*{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@neg \opneg{@s\the\op@stack}{@s\the\op@stack}% \else\ifx\op@arg\op@string@power \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \oppower{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@rest \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opdiv*{@s\the\op@stackb}{@s\the\op@stack}{@q}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@round \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opround{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else\ifx\op@arg\op@string@sub \global\op@stackb=\op@stack \global\advance\op@stackb by-1 \opsub*{@s\the\op@stackb}{@s\the\op@stack}{@s\the\op@stackb}% \global\op@stack=\op@stackb \else \global\advance\op@stack by1\relax \opcopy{\op@arg}{@s\the\op@stack}% \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi } \def\op@token@create#1{% \@namexdef{OP@token\the\op@token}{#1}% \global\advance\op@token by1 \expandafter\global \expandafter\let\csname OP@token\the\op@token\endcsname\relax \global\advance\op@token by-1 } \def\op@token@append#1{% \@namexdef{OP@token\the\op@token}{% \@nameuse{OP@token\the\op@token}#1}% } \def\op@token@single#1{% \edef\@tempa{#1}% \ifop@in@name \global\advance\op@token by1 \op@in@namefalse \fi \ifop@in@number \global\advance\op@token by1 \op@in@numberfalse \op@in@decimalfalse \fi \ifx\@tempa\op@string@add \ifop@in@sign \global\advance\op@token by-1 \else \op@token@create{#1}% \fi \else\ifx\@tempa\op@string@sub \ifop@in@sign \op@token@create{\op@string@neg}% \else \op@token@create{#1}% \fi \else \op@token@create{#1}% \fi\fi \global\advance\op@token by1 } \def\op@testch@r#1{% \op@isdigitfalse \op@isplusfalse \op@isminusfalse \op@ismultiplyfalse \op@isdividefalse \op@isidividefalse \op@ispowerfalse \op@isdotfalse \op@iscommafalse \op@islparenthesisfalse \op@isrparenthesisfalse \op@isspacefalse \op@isotherfalse \count@=`#1\relax \ifnum\count@=\op@plus \relax \op@isplustrue \else \ifnum\count@=\op@minus \relax \op@isminustrue \else \ifnum\count@=\op@multiply \relax \op@ismultiplytrue \else \ifnum\count@=\op@divide \relax \op@isdividetrue \else \ifnum\count@=\op@idivide \relax \op@isidividetrue \else \ifnum\count@=\op@pow \relax \op@ispowertrue \else \ifnum\count@=\op@dot \relax \op@isdottrue \else \ifnum\count@=\op@comma \relax \op@iscommatrue \else \ifnum\count@=\op@lparenthesis \relax \op@islparenthesistrue \else \ifnum\count@=\op@rparenthesis \relax \op@isrparenthesistrue \else \ifnum\count@=\op@space \relax \op@isspacetrue \else \ifnum\count@<\op@numbegin \relax \op@isothertrue \else \ifnum\count@>\op@numend \relax \op@isothertrue \else \op@isdigittrue \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi } \op@split{0}{T0} \op@split{0}{zero} \op@split{1}{one} \op@split{10}{ten} \op@split{0.1}{tenth} \op@split{2147483647}{maxinteger} \op@split{214748364}{maxdivperiod} \op@split{1073741823}{maxpower} \catcode`\^=\opHatCode\relax \catcode`\@=\opAtCode\relax \endinput