diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xint.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xint.sty | 447 |
1 files changed, 157 insertions, 290 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty index 5373d135d0c..de8669e6acb 100644 --- a/Master/texmf-dist/tex/generic/xint/xint.sty +++ b/Master/texmf-dist/tex/generic/xint/xint.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2k 2017/01/06 +%% The xint bundle 1.2l 2017/07/26 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% xint: Expandable operations on big integers %% --------------------------------------------------------------- @@ -70,17 +70,13 @@ \XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty) \XINT_providespackage \ProvidesPackage{xint}% - [2017/01/06 1.2k Expandable operations on big integers (JFB)]% + [2017/07/26 1.2l Expandable operations on big integers (JFB)]% \long\def\xint_firstofthree #1#2#3{#1}% \long\def\xint_secondofthree #1#2#3{#2}% \long\def\xint_thirdofthree #1#2#3{#3}% \long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i \long\def\xint_secondofthree_thenstop #1#2#3{ #2}% \long\def\xint_thirdofthree_thenstop #1#2#3{ #3}% -\edef\xint_cleanupzeros_andstop #1#2#3#4% -{% - \noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4\relax -}% \def\xintSgnFork {\romannumeral0\xintsgnfork }% \def\xintsgnfork #1% {% @@ -99,21 +95,56 @@ \unless\if#11\xint_dothis{ 0}\fi \xint_orthat{ 1}% }% -\def\XINT_isOne #1{\XINT_is_one#1XY}% -\def\XINT_is_one #1#2#3Y% +\def\XINT_isOne #1{\XINT_is_One#1XY}% +\def\XINT_is_One #1#2#3Y% {% \unless\if#2X\xint_dothis0\fi \unless\if#11\xint_dothis0\fi \xint_orthat1% }% +\def\xintReverseDigits {\romannumeral0\xintreversedigits }% +\def\xintreversedigits #1% +{% + \expandafter\XINT_revdigits\romannumeral`&&@#1% + {\XINT_microrevsep_end\W}\XINT_microrevsep_end + \XINT_microrevsep_end\XINT_microrevsep_end + \XINT_microrevsep_end\XINT_microrevsep_end + \XINT_microrevsep_end\XINT_microrevsep_end\XINT_microrevsep_end\Z + 1\Z!1\R!1\R!1\R!1\R!1\R!1\R!1\R!1\R!\W +}% +\def\XINT_revdigits #1% +{% + \xint_UDsignfork + #1{\expandafter-\romannumeral0\XINT_revdigits_a}% + -{\XINT_revdigits_a #1}% + \krof +}% +\def\XINT_revdigits_a +{% + \expandafter\XINT_revdigits_b\expandafter{\expandafter}% + \the\numexpr\XINT_microrevsep +}% +\def\XINT_microrevsep #1#2#3#4#5#6#7#8#9% +{% + 1#9#8#7#6#5#4#3#2#1\expandafter!\the\numexpr\XINT_microrevsep +}% +\def\XINT_microrevsep_end #1\W #2\expandafter #3\Z{\relax#2!}% +\def\XINT_revdigits_b #11#2!1#3!1#4!1#5!1#6!1#7!1#8!1#9!% +{% + \xint_gob_til_R #9\XINT_revdigits_end\R + \XINT_revdigits_b {#9#8#7#6#5#4#3#2#1}% +}% +\def\XINT_revdigits_end#1{% +\def\XINT_revdigits_end\R\XINT_revdigits_b ##1##2\W + {\expandafter#1\xint_gob_til_Z ##1}% +}\XINT_revdigits_end{ }% \let\xintRev\xintReverseDigits \def\xintLen {\romannumeral0\xintlen }% \def\xintlen #1{\def\xintlen ##1% {% \expandafter#1\the\numexpr \expandafter\XINT_len_fork\romannumeral0\xintnum{##1}% - \xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax + \xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye\relax }}\xintlen{ }% @@ -284,172 +315,6 @@ \expandafter\xint_secondoftwo_thenstop \fi }% -\def\xintCmp {\romannumeral0\xintcmp }% -\def\xintcmp #1{\expandafter\XINT_icmp\romannumeral0\xintnum{#1}\Z }% -\def\xintiiCmp {\romannumeral0\xintiicmp }% -\def\xintiicmp #1{\expandafter\XINT_iicmp\romannumeral`&&@#1\Z }% -\def\XINT_iicmp #1#2\Z #3% -{% - \expandafter\XINT_cmp_nfork\expandafter #1\romannumeral`&&@#3\Z #2\Z -}% -\let\XINT_Cmp \xintiiCmp -\def\XINT_icmp #1#2\Z #3% -{% - \expandafter\XINT_cmp_nfork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z -}% -\def\XINT_cmp_nfork #1#2% -{% - \xint_UDzerofork - #1\XINT_cmp_firstiszero - #2\XINT_cmp_secondiszero - 0{}% - \krof - \xint_UDsignsfork - #1#2\XINT_cmp_minusminus - #1-\XINT_cmp_minusplus - #2-\XINT_cmp_plusminus - --\XINT_cmp_plusplus - \krof #1#2% -}% -\def\XINT_cmp_firstiszero #1\krof 0#2#3\Z #4\Z -{% - \xint_UDzerominusfork - #2-{ 0}% - 0#2{ 1}% - 0-{ -1}% - \krof -}% -\def\XINT_cmp_secondiszero #1\krof #20#3\Z #4\Z -{% - \xint_UDzerominusfork - #2-{ 0}% - 0#2{ -1}% - 0-{ 1}% - \krof -}% -\def\XINT_cmp_plusminus #1\Z #2\Z{ 1}% -\def\XINT_cmp_minusplus #1\Z #2\Z{ -1}% -\def\XINT_cmp_minusminus - --{\expandafter\XINT_opp\romannumeral0\XINT_cmp_plusplus {}{}}% -\def\XINT_cmp_plusplus #1#2#3\Z -{% - \expandafter\XINT_cmp_pp - \romannumeral0\expandafter\XINT_sepandrev_andcount - \romannumeral0\XINT_zeroes_forviii #2#3\R\R\R\R\R\R\R\R{10}0000001\W - #2#3\XINT_rsepbyviii_end_A 2345678% - \XINT_rsepbyviii_end_B 2345678\relax\xint_c_ii\xint_c_iii - \R.\xint_c_vi\R.\xint_c_v\R.\xint_c_iv\R.\xint_c_iii - \R.\xint_c_ii\R.\xint_c_i\R.\xint_c_\W - \X #1% -}% -\def\XINT_cmp_pp #1.#2\X #3\Z -{% - \expandafter\XINT_cmp_checklengths - \the\numexpr #1\expandafter.% - \romannumeral0\expandafter\XINT_sepandrev_andcount - \romannumeral0\XINT_zeroes_forviii #3\R\R\R\R\R\R\R\R{10}0000001\W - #3\XINT_rsepbyviii_end_A 2345678% - \XINT_rsepbyviii_end_B 2345678\relax \xint_c_ii\xint_c_iii - \R.\xint_c_vi\R.\xint_c_v\R.\xint_c_iv\R.\xint_c_iii - \R.\xint_c_ii\R.\xint_c_i\R.\xint_c_\W - \Z!\Z!\Z!\Z!\Z!\W #2\Z!\Z!\Z!\Z!\Z!\W -}% -\def\XINT_cmp_checklengths #1.#2.% -{% - \ifnum #1=#2 - \expandafter\xint_firstoftwo - \else - \expandafter\xint_secondoftwo - \fi - \XINT_cmp_aa {\XINT_cmp_distinctlengths {#1}{#2}}% -}% -\def\XINT_cmp_distinctlengths #1#2#3\W #4\W -{% - \ifnum #1>#2 - \expandafter\xint_firstoftwo - \else - \expandafter\xint_secondoftwo - \fi - { -1}{ 1}% -}% -\def\XINT_cmp_aa {\expandafter\XINT_cmp_w\the\numexpr\XINT_cmp_a \xint_c_i }% -\def\XINT_cmp_a #1!#2!#3!#4!#5\W #6!#7!#8!#9!% -{% - \XINT_cmp_b #1!#6!#2!#7!#3!#8!#4!#9!#5\W -}% -\def\XINT_cmp_b #1#2#3!#4!% -{% - \xint_gob_til_Z #2\XINT_cmp_bi \Z - \expandafter\XINT_cmp_c\the\numexpr#1+1#4-#3-\xint_c_i.% -}% -\def\XINT_cmp_c 1#1#2.% -{% - 1#2\expandafter!\the\numexpr\XINT_cmp_d #1% -}% -\def\XINT_cmp_d #1#2#3!#4!% -{% - \xint_gob_til_Z #2\XINT_cmp_di \Z - \expandafter\XINT_cmp_e\the\numexpr#1+1#4-#3-\xint_c_i.% -}% -\def\XINT_cmp_e 1#1#2.% -{% - 1#2\expandafter!\the\numexpr\XINT_cmp_f #1% -}% -\def\XINT_cmp_f #1#2#3!#4!% -{% - \xint_gob_til_Z #2\XINT_cmp_fi \Z - \expandafter\XINT_cmp_g\the\numexpr#1+1#4-#3-\xint_c_i.% -}% -\def\XINT_cmp_g 1#1#2.% -{% - 1#2\expandafter!\the\numexpr\XINT_cmp_h #1% -}% -\def\XINT_cmp_h #1#2#3!#4!% -{% - \xint_gob_til_Z #2\XINT_cmp_hi \Z - \expandafter\XINT_cmp_i\the\numexpr#1+1#4-#3-\xint_c_i.% -}% -\def\XINT_cmp_i 1#1#2.% -{% - 1#2\expandafter!\the\numexpr\XINT_cmp_a #1% -}% -\def\XINT_cmp_bi\Z - \expandafter\XINT_cmp_c\the\numexpr#1+1#2-#3.#4!#5!#6!#7!#8!#9!\Z !\W -{% - \XINT_cmp_k #1#2!#5!#7!#9!% -}% -\def\XINT_cmp_di\Z - \expandafter\XINT_cmp_e\the\numexpr#1+1#2-#3.#4!#5!#6!#7!#8\W -{% - \XINT_cmp_k #1#2!#5!#7!% -}% -\def\XINT_cmp_fi\Z - \expandafter\XINT_cmp_g\the\numexpr#1+1#2-#3.#4!#5!#6\W -{% - \XINT_cmp_k #1#2!#5!% -}% -\def\XINT_cmp_hi\Z - \expandafter\XINT_cmp_i\the\numexpr#1+1#2-#3.#4\W -{% - \XINT_cmp_k #1#2!% -}% -\def\XINT_cmp_k #1#2\W -{% - \xint_UDzerofork - #1{-1\relax \XINT_cmp_greater}% - 0{-1\relax \XINT_cmp_lessorequal}% - \krof -}% -\def\XINT_cmp_w #1-1#2{#2#11\Z!\W}% -\def\XINT_cmp_greater #1\Z!\W{ 1}% -\def\XINT_cmp_lessorequal 1#1!% - {\xint_gob_til_Z #1\XINT_cmp_equal\Z - \xint_gob_til_eightzeroes #1\XINT_cmp_continue 00000000% - \XINT_cmp_less }% -\def\XINT_cmp_less #1\W { -1}% -\def\XINT_cmp_continue 00000000\XINT_cmp_less {\XINT_cmp_lessorequal }% -\def\XINT_cmp_equal\Z\xint_gob_til_eightzeroes\Z\XINT_cmp_continue - 00000000\XINT_cmp_less\W { 0}% \def\xintEq {\romannumeral0\xinteq }\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% \def\xintGt {\romannumeral0\xintgt }\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}% \def\xintLt {\romannumeral0\xintlt }\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}% @@ -487,48 +352,48 @@ \def\xintxor #1#2{\if\xintIsZero{#1}\xintIsZero{#2}% \xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi }% \def\xintANDof {\romannumeral0\xintandof }% -\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral`&&@#1\relax }% -\def\XINT_andof_a #1{\expandafter\XINT_andof_b\romannumeral`&&@#1\Z }% +\def\xintandof #1{\expandafter\XINT_andof_a\romannumeral`&&@#1\xint:}% +\def\XINT_andof_a #1{\expandafter\XINT_andof_b\romannumeral`&&@#1!}% \def\XINT_andof_b #1% - {\xint_gob_til_relax #1\XINT_andof_e\relax\XINT_andof_c #1}% -\def\XINT_andof_c #1\Z + {\xint_gob_til_xint: #1\XINT_andof_e\xint:\XINT_andof_c #1}% +\def\XINT_andof_c #1!% {\xintifTrueAelseB {#1}{\XINT_andof_a}{\XINT_andof_no}}% -\def\XINT_andof_no #1\relax { 0}% -\def\XINT_andof_e #1\Z { 1}% +\def\XINT_andof_no #1\xint:{ 0}% +\def\XINT_andof_e #1!{ 1}% \def\xintORof {\romannumeral0\xintorof }% -\def\xintorof #1{\expandafter\XINT_orof_a\romannumeral`&&@#1\relax }% -\def\XINT_orof_a #1{\expandafter\XINT_orof_b\romannumeral`&&@#1\Z }% +\def\xintorof #1{\expandafter\XINT_orof_a\romannumeral`&&@#1\xint:}% +\def\XINT_orof_a #1{\expandafter\XINT_orof_b\romannumeral`&&@#1!}% \def\XINT_orof_b #1% - {\xint_gob_til_relax #1\XINT_orof_e\relax\XINT_orof_c #1}% -\def\XINT_orof_c #1\Z + {\xint_gob_til_xint: #1\XINT_orof_e\xint:\XINT_orof_c #1}% +\def\XINT_orof_c #1!% {\xintifTrueAelseB {#1}{\XINT_orof_yes}{\XINT_orof_a}}% -\def\XINT_orof_yes #1\relax { 1}% -\def\XINT_orof_e #1\Z { 0}% +\def\XINT_orof_yes #1\xint:{ 1}% +\def\XINT_orof_e #1!{ 0}% \def\xintXORof {\romannumeral0\xintxorof }% \def\xintxorof #1{\expandafter\XINT_xorof_a\expandafter - 0\romannumeral`&&@#1\relax }% -\def\XINT_xorof_a #1#2{\expandafter\XINT_xorof_b\romannumeral`&&@#2\Z #1}% + 0\romannumeral`&&@#1\xint:}% +\def\XINT_xorof_a #1#2{\expandafter\XINT_xorof_b\romannumeral`&&@#2!#1}% \def\XINT_xorof_b #1% - {\xint_gob_til_relax #1\XINT_xorof_e\relax\XINT_xorof_c #1}% -\def\XINT_xorof_c #1\Z #2% + {\xint_gob_til_xint: #1\XINT_xorof_e\xint:\XINT_xorof_c #1}% +\def\XINT_xorof_c #1!#2% {\xintifTrueAelseB {#1}{\if #20\xint_afterfi{\XINT_xorof_a 1}% \else\xint_afterfi{\XINT_xorof_a 0}\fi}% {\XINT_xorof_a #2}% }% -\def\XINT_xorof_e #1\Z #2{ #2}% +\def\XINT_xorof_e #1!#2{ #2}% \def\xintGeq {\romannumeral0\xintgeq }% -\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\Z }% +\def\xintgeq #1{\expandafter\XINT_geq\romannumeral0\xintnum{#1}\xint:}% \def\xintiiGeq {\romannumeral0\xintiigeq }% -\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\Z }% -\def\XINT_iigeq #1#2\Z #3% +\def\xintiigeq #1{\expandafter\XINT_iigeq\romannumeral`&&@#1\xint:}% +\def\XINT_iigeq #1#2\xint:#3% {% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\Z #2\Z + \expandafter\XINT_geq_fork\expandafter #1\romannumeral`&&@#3\xint:#2\xint: }% \let\XINT_geq_pre \xintiigeq % TEMPORAIRE (oui, mais depuis quand ?) \let\XINT_Geq \xintGeq % TEMPORAIRE ATTENTION FAIT xintNum (et alors?) -\def\XINT_geq #1#2\Z #3% +\def\XINT_geq #1#2\xint:#3% {% - \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\Z #2\Z + \expandafter\XINT_geq_fork\expandafter #1\romannumeral0\xintnum{#3}\xint:#2\xint: }% \def\XINT_geq_fork #1#2% {% @@ -544,37 +409,37 @@ --\XINT_geq_plusplus \krof #1#2% }% -\def\XINT_geq_firstiszero #1\krof 0#2#3\Z #4\Z +\def\XINT_geq_firstiszero #1\krof 0#2#3\xint:#4\xint: {\xint_UDzerofork #2{ 1}0{ 0}\krof }% -\def\XINT_geq_secondiszero #1\krof #20#3\Z #4\Z { 1}% +\def\XINT_geq_secondiszero #1\krof #20#3\xint:#4\xint:{ 1}% \def\XINT_geq_plusminus #1-{\XINT_geq_plusplus #1{}}% \def\XINT_geq_minusplus -#1{\XINT_geq_plusplus {}#1}% \def\XINT_geq_minusminus --{\XINT_geq_plusplus {}{}}% -\def\XINT_geq_plusplus #1#2#3\Z #4\Z {\XINT_geq_pp #1#4\Z #2#3\Z }% -\def\XINT_geq_pp #1\Z +\def\XINT_geq_plusplus #1#2#3\xint:#4\xint:{\XINT_geq_pp #1#4\xint:#2#3\xint:}% +\def\XINT_geq_pp #1\xint: {% \expandafter\XINT_geq_pp_a \romannumeral0\expandafter\XINT_sepandrev_andcount \romannumeral0\XINT_zeroes_forviii #1\R\R\R\R\R\R\R\R{10}0000001\W #1\XINT_rsepbyviii_end_A 2345678% - \XINT_rsepbyviii_end_B 2345678\relax\xint_c_ii\xint_c_iii - \R.\xint_c_vi\R.\xint_c_v\R.\xint_c_iv\R.\xint_c_iii - \R.\xint_c_ii\R.\xint_c_i\R.\xint_c_\W + \XINT_rsepbyviii_end_B 2345678\relax\xint_c_ii\xint_c_i + \R\xint:\xint_c_xii \R\xint:\xint_c_x \R\xint:\xint_c_viii \R\xint:\xint_c_vi + \R\xint:\xint_c_iv \R\xint:\xint_c_ii \R\xint:\xint_c_\W \X }% -\def\XINT_geq_pp_a #1.#2\X #3\Z +\def\XINT_geq_pp_a #1\xint:#2\X #3\xint: {% \expandafter\XINT_geq_checklengths - \the\numexpr #1\expandafter.% + \the\numexpr #1\expandafter\xint:% \romannumeral0\expandafter\XINT_sepandrev_andcount \romannumeral0\XINT_zeroes_forviii #3\R\R\R\R\R\R\R\R{10}0000001\W #3\XINT_rsepbyviii_end_A 2345678% - \XINT_rsepbyviii_end_B 2345678\relax \xint_c_ii\xint_c_iii - \R.\xint_c_vi\R.\xint_c_v\R.\xint_c_iv\R.\xint_c_iii - \R.\xint_c_ii\R.\xint_c_i\R.\xint_c_\W + \XINT_rsepbyviii_end_B 2345678\relax\xint_c_ii\xint_c_i + \R\xint:\xint_c_xii \R\xint:\xint_c_x \R\xint:\xint_c_viii \R\xint:\xint_c_vi + \R\xint:\xint_c_iv \R\xint:\xint_c_ii \R\xint:\xint_c_\W \Z!\Z!\Z!\Z!\Z!\W #2\Z!\Z!\Z!\Z!\Z!\W }% -\def\XINT_geq_checklengths #1.#2.% +\def\XINT_geq_checklengths #1\xint:#2\xint: {% \ifnum #1=#2 \expandafter\xint_firstoftwo @@ -600,56 +465,56 @@ \def\XINT_geq_b #1#2#3!#4!% {% \xint_gob_til_Z #2\XINT_geq_bi \Z - \expandafter\XINT_geq_c\the\numexpr#1+1#4-#3-\xint_c_i.% + \expandafter\XINT_geq_c\the\numexpr#1+1#4-#3-\xint_c_i\xint:% }% -\def\XINT_geq_c 1#1#2.% +\def\XINT_geq_c 1#1#2\xint:% {% 1#2\expandafter!\the\numexpr\XINT_geq_d #1% }% \def\XINT_geq_d #1#2#3!#4!% {% \xint_gob_til_Z #2\XINT_geq_di \Z - \expandafter\XINT_geq_e\the\numexpr#1+1#4-#3-\xint_c_i.% + \expandafter\XINT_geq_e\the\numexpr#1+1#4-#3-\xint_c_i\xint:% }% -\def\XINT_geq_e 1#1#2.% +\def\XINT_geq_e 1#1#2\xint:% {% 1#2\expandafter!\the\numexpr\XINT_geq_f #1% }% \def\XINT_geq_f #1#2#3!#4!% {% \xint_gob_til_Z #2\XINT_geq_fi \Z - \expandafter\XINT_geq_g\the\numexpr#1+1#4-#3-\xint_c_i.% + \expandafter\XINT_geq_g\the\numexpr#1+1#4-#3-\xint_c_i\xint:% }% -\def\XINT_geq_g 1#1#2.% +\def\XINT_geq_g 1#1#2\xint:% {% 1#2\expandafter!\the\numexpr\XINT_geq_h #1% }% \def\XINT_geq_h #1#2#3!#4!% {% \xint_gob_til_Z #2\XINT_geq_hi \Z - \expandafter\XINT_geq_i\the\numexpr#1+1#4-#3-\xint_c_i.% + \expandafter\XINT_geq_i\the\numexpr#1+1#4-#3-\xint_c_i\xint:% }% -\def\XINT_geq_i 1#1#2.% +\def\XINT_geq_i 1#1#2\xint:% {% 1#2\expandafter!\the\numexpr\XINT_geq_a #1% }% \def\XINT_geq_bi\Z - \expandafter\XINT_geq_c\the\numexpr#1+1#2-#3.#4!#5!#6!#7!#8!#9!\Z !\W + \expandafter\XINT_geq_c\the\numexpr#1+1#2-#3\xint:#4!#5!#6!#7!#8!#9!\Z !\W {% \XINT_geq_k #1#2!#5!#7!#9!% }% \def\XINT_geq_di\Z - \expandafter\XINT_geq_e\the\numexpr#1+1#2-#3.#4!#5!#6!#7!#8\W + \expandafter\XINT_geq_e\the\numexpr#1+1#2-#3\xint:#4!#5!#6!#7!#8\W {% \XINT_geq_k #1#2!#5!#7!% }% \def\XINT_geq_fi\Z - \expandafter\XINT_geq_g\the\numexpr#1+1#2-#3.#4!#5!#6\W + \expandafter\XINT_geq_g\the\numexpr#1+1#2-#3\xint:#4!#5!#6\W {% \XINT_geq_k #1#2!#5!% }% \def\XINT_geq_hi\Z - \expandafter\XINT_geq_i\the\numexpr#1+1#2-#3.#4\W + \expandafter\XINT_geq_i\the\numexpr#1+1#2-#3\xint:#4\W {% \XINT_geq_k #1#2!% }% @@ -718,25 +583,26 @@ \fi }% \def\xintiMaxof {\romannumeral0\xintimaxof }% -\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\relax }% -\def\XINT_imaxof_a #1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}\Z }% -\def\XINT_imaxof_b #1\Z #2% - {\expandafter\XINT_imaxof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintimaxof #1{\expandafter\XINT_imaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_imaxof_a +#1{\expandafter\XINT_imaxof_b\romannumeral0\xintnum{#1}!}% +\def\XINT_imaxof_b #1!#2% + {\expandafter\XINT_imaxof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_imaxof_c #1% - {\xint_gob_til_relax #1\XINT_imaxof_e\relax\XINT_imaxof_d #1}% -\def\XINT_imaxof_d #1\Z + {\xint_gob_til_xint: #1\XINT_imaxof_e\xint:\XINT_imaxof_d #1}% +\def\XINT_imaxof_d #1!% {\expandafter\XINT_imaxof_b\romannumeral0\xintimax {#1}}% -\def\XINT_imaxof_e #1\Z #2\Z { #2}% +\def\XINT_imaxof_e #1!#2!{ #2}% \def\xintiiMaxof {\romannumeral0\xintiimaxof }% -\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\relax }% -\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1\Z }% -\def\XINT_iimaxof_b #1\Z #2% - {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintiimaxof #1{\expandafter\XINT_iimaxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_iimaxof_a #1{\expandafter\XINT_iimaxof_b\romannumeral`&&@#1!}% +\def\XINT_iimaxof_b #1!#2% + {\expandafter\XINT_iimaxof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_iimaxof_c #1% - {\xint_gob_til_relax #1\XINT_iimaxof_e\relax\XINT_iimaxof_d #1}% -\def\XINT_iimaxof_d #1\Z + {\xint_gob_til_xint: #1\XINT_iimaxof_e\xint:\XINT_iimaxof_d #1}% +\def\XINT_iimaxof_d #1!% {\expandafter\XINT_iimaxof_b\romannumeral0\xintiimax {#1}}% -\def\XINT_iimaxof_e #1\Z #2\Z { #2}% +\def\XINT_iimaxof_e #1!#2!{ #2}% \def\xintiMin {\romannumeral0\xintimin }% \def\xintimin #1% {% @@ -794,49 +660,45 @@ \fi }% \def\xintiMinof {\romannumeral0\xintiminof }% -\def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral`&&@#1\relax }% -\def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}\Z }% -\def\XINT_iminof_b #1\Z #2% - {\expandafter\XINT_iminof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintiminof #1{\expandafter\XINT_iminof_a\romannumeral`&&@#1\xint:}% +\def\XINT_iminof_a #1{\expandafter\XINT_iminof_b\romannumeral0\xintnum{#1}!}% +\def\XINT_iminof_b #1!#2% + {\expandafter\XINT_iminof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_iminof_c #1% - {\xint_gob_til_relax #1\XINT_iminof_e\relax\XINT_iminof_d #1}% -\def\XINT_iminof_d #1\Z + {\xint_gob_til_xint: #1\XINT_iminof_e\xint:\XINT_iminof_d #1}% +\def\XINT_iminof_d #1!% {\expandafter\XINT_iminof_b\romannumeral0\xintimin {#1}}% -\def\XINT_iminof_e #1\Z #2\Z { #2}% +\def\XINT_iminof_e #1!#2!{ #2}% \def\xintiiMinof {\romannumeral0\xintiiminof }% -\def\xintiiminof #1{\expandafter\XINT_iiminof_a\romannumeral`&&@#1\relax }% -\def\XINT_iiminof_a #1{\expandafter\XINT_iiminof_b\romannumeral`&&@#1\Z }% -\def\XINT_iiminof_b #1\Z #2% - {\expandafter\XINT_iiminof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintiiminof #1{\expandafter\XINT_iiminof_a\romannumeral`&&@#1\xint:}% +\def\XINT_iiminof_a #1{\expandafter\XINT_iiminof_b\romannumeral`&&@#1!}% +\def\XINT_iiminof_b #1!#2% + {\expandafter\XINT_iiminof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_iiminof_c #1% - {\xint_gob_til_relax #1\XINT_iiminof_e\relax\XINT_iiminof_d #1}% -\def\XINT_iiminof_d #1\Z + {\xint_gob_til_xint: #1\XINT_iiminof_e\xint:\XINT_iiminof_d #1}% +\def\XINT_iiminof_d #1!% {\expandafter\XINT_iiminof_b\romannumeral0\xintiimin {#1}}% -\def\XINT_iiminof_e #1\Z #2\Z { #2}% +\def\XINT_iiminof_e #1!#2!{ #2}% \def\xintiiSum {\romannumeral0\xintiisum }% -\def\xintiisum #1{\xintiisumexpr #1\relax }% -\def\xintiiSumExpr {\romannumeral0\xintiisumexpr }% -\def\xintiisumexpr {\expandafter\XINT_sumexpr\romannumeral`&&@}% +\def\xintiisum #1{\expandafter\XINT_sumexpr\romannumeral`&&@#1\xint:}% \def\XINT_sumexpr {\XINT_sum_loop_a 0\Z }% \def\XINT_sum_loop_a #1\Z #2% - {\expandafter\XINT_sum_loop_b \romannumeral`&&@#2\Z #1\Z \Z}% + {\expandafter\XINT_sum_loop_b \romannumeral`&&@#2\xint:#1\xint:\Z}% \def\XINT_sum_loop_b #1% - {\xint_gob_til_relax #1\XINT_sum_finished\relax\XINT_sum_loop_c #1}% + {\xint_gob_til_xint: #1\XINT_sum_finished\xint:\XINT_sum_loop_c #1}% \def\XINT_sum_loop_c {\expandafter\XINT_sum_loop_a\romannumeral0\XINT_add_fork }% -\def\XINT_sum_finished #1\Z #2\Z \Z { #2}% +\def\XINT_sum_finished\xint:\XINT_sum_loop_c\xint:\xint:#1\xint:\Z{ #1}% \def\xintiiPrd {\romannumeral0\xintiiprd }% -\def\xintiiprd #1{\xintiiprdexpr #1\relax }% -\def\xintiiPrdExpr {\romannumeral0\xintiiprdexpr }% -\def\xintiiprdexpr {\expandafter\XINT_prdexpr\romannumeral`&&@}% +\def\xintiiprd #1{\expandafter\XINT_prdexpr\romannumeral`&&@#1\xint:}% \def\XINT_prdexpr {\XINT_prod_loop_a 1\Z }% \def\XINT_prod_loop_a #1\Z #2% - {\expandafter\XINT_prod_loop_b \romannumeral`&&@#2\Z #1\Z \Z}% + {\expandafter\XINT_prod_loop_b\romannumeral`&&@#2\xint:#1\xint:\Z}% \def\XINT_prod_loop_b #1% - {\xint_gob_til_relax #1\XINT_prod_finished\relax\XINT_prod_loop_c #1}% + {\xint_gob_til_xint: #1\XINT_prod_finished\xint:\XINT_prod_loop_c #1}% \def\XINT_prod_loop_c {\expandafter\XINT_prod_loop_a\romannumeral0\XINT_mul_fork }% -\def\XINT_prod_finished\relax\XINT_prod_loop_c #1\Z #2\Z \Z { #2}% +\def\XINT_prod_finished\xint:\XINT_prod_loop_c\xint:\xint:#1\xint:\Z { #1}% \def\xintiiMON {\romannumeral0\xintiimon }% \def\xintiimon #1% {% @@ -1089,8 +951,7 @@ {% \expandafter\XINT_split_fromright_a \the\numexpr#1-\numexpr\XINT_length_loop - #2\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax + #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint: \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye .#2\xint_bye @@ -1117,19 +978,20 @@ \def\XINT_sqrtr_post #1#2{\xintiiifLt {#2}{#1}% { #1}{\XINT_dec #1\XINT_dec_bye234567890\xint_bye}}% \def\xintisquareroot #1% - {\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\xint_relax }% -\def\xintiisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral`&&@#1\xint_relax }% + {\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\xint:}% +\def\xintiisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral`&&@#1\xint:}% \def\XINT_sqrt_checkin #1% {% \xint_UDzerominusfork #1-\XINT_sqrt_iszero 0#1\XINT_sqrt_isneg - 0-{\XINT_sqrt #1}% - \krof + 0-\XINT_sqrt + \krof #1% }% -\def\XINT_sqrt_iszero #1\xint_relax {{1}{1}}% -\def\XINT_sqrt_isneg #1\xint_relax {\xintError:RootOfNegative{1}{1}}% -\def\XINT_sqrt #1\xint_relax +\def\XINT_sqrt_iszero #1\xint:{{1}{1}}% +\def\XINT_sqrt_isneg #1\xint:{\XINT_signalcondition{InvalidOperation}{square + root of negative: #1}{}{{0}{0}}}% +\def\XINT_sqrt #1\xint: {% \expandafter\XINT_sqrt_start\romannumeral0\xintlength {#1}.#1.% }% @@ -1383,7 +1245,7 @@ }% \def\XINT_sqrt_big_ke #1% {% - \if0\XINT_Sgn #1\Z + \if0\XINT_Sgn #1\xint: \expandafter \XINT_sqrt_big_end \else \expandafter \XINT_sqrt_big_kf \fi {#1}% @@ -1412,18 +1274,21 @@ \let\xintibinomial\xintiibinomial \def\XINT_binom_fork #1#2.#3#4.#5#6.% {% - \if-#5\xint_dothis{\xintError:OutOfRangeBinomial\space 0}\fi + \if-#5\xint_dothis{\XINT_signalcondition{InvalidOperation}{Binomial with + negative first arg: #5#6}{}{0}}\fi \if-#1\xint_dothis{ 0}\fi \if-#3\xint_dothis{ 0}\fi \if0#1\xint_dothis{ 1}\fi \if0#3\xint_dothis{ 1}\fi - \ifnum #5#6>\xint_c_x^viii_mone\xint_dothis{\xintError:OutOfRangeBinomial\space 0}\fi + \ifnum #5#6>\xint_c_x^viii_mone\xint_dothis + {\XINT_signalcondition{InvalidOperation}{Binomial with too + large argument: 99999999 < #5#6}{}{0}}\fi \ifnum #1#2>#3#4 \xint_dothis{\XINT_binom_a #1#2.#3#4.}\fi \xint_orthat{\XINT_binom_a #3#4.#1#2.}% }% \def\XINT_binom_a #1.#2.% {% - \expandafter\XINT_binom_b\the\numexpr \xint_c_i+#1.1.#2.100000001!1!\Z!0!% + \expandafter\XINT_binom_b\the\numexpr \xint_c_i+#1.1.#2.100000001!1!;!0!% }% \def\XINT_binom_b #1.% {% @@ -1549,20 +1414,20 @@ \the\numexpr #2*(#2+\xint_c_i)*(#2+\xint_c_ii)*(#2+\xint_c_iii)\expandafter !\the\numexpr #1*(#1+\xint_c_i)*(#1+\xint_c_ii)*(#1+\xint_c_iii)!% }% -\def\XINT_binom_mul #1!#21!\Z!0!% +\def\XINT_binom_mul #1!#21!;!0!% {% \expandafter\XINT_rev_nounsep\expandafter{\expandafter}% \the\numexpr\expandafter\XINT_smallmul \the\numexpr\xint_c_x^viii+#1\expandafter - !\romannumeral0\XINT_rev_nounsep {}1\Z!#2% + !\romannumeral0\XINT_rev_nounsep {}1;!#2% \R!\R!\R!\R!\R!\R!\R!\R!\W \R!\R!\R!\R!\R!\R!\R!\R!\W - 1\Z!% + 1;!% }% -\def\XINT_binom_div #1!1\Z!% +\def\XINT_binom_div #1!1;!% {% \expandafter\XINT_smalldivx_a - \the\numexpr #1/\xint_c_ii\expandafter.% + \the\numexpr #1/\xint_c_ii\expandafter\xint: \the\numexpr \xint_c_x^viii+#1!% }% \def\XINT_binom_vsmallmuldiv #1!#2!1#3!{\xint_c_x^viii+#2*#3/#1!}% @@ -1596,8 +1461,8 @@ \the\numexpr\expandafter\XINT_binom_div\the\numexpr #2\expandafter !\romannumeral0\XINT_binom_mul #1!% }% -\def\XINT_binom_finish #1\Z!0!% - {\XINT_unsep_cuzsmall #11\R!1\R!1\R!1\R!1\R!1\R!1\R!1\R!\W }% +\def\XINT_binom_finish #1;!0!% + {\XINT_unsep_cuzsmall #1\xint_bye!2!3!4!5!6!7!8!9!\xint_bye\xint_c_i\relax}% \def\XINT_binom_vsmallend_iii #1.% {% \ifnum #1>26 \expandafter\XINT_binom_end_iii \else @@ -1644,8 +1509,9 @@ \expandafter\XINT_binom_vsmallfinish \the\numexpr\XINT_binom_vsmallmuldiv #2!#1!% }% -\edef\XINT_binom_vsmallfinish 1#1!1!\Z!0!% - {\noexpand\expandafter\space\noexpand\the\numexpr #1\relax}% +\def\XINT_binom_vsmallfinish#1{% +\def\XINT_binom_vsmallfinish1##1!1!;!0!{\expandafter#1\the\numexpr##1\relax}% +}\XINT_binom_vsmallfinish{ }% \def\xintiiPFactorial {\romannumeral0\xintiipfactorial }% \def\xintiipfactorial #1#2% {% @@ -1661,7 +1527,9 @@ \ifnum #3#4>\xint_c_x^viii_mone\xint_dothis\XINT_pfac_outofrange\fi \xint_orthat \XINT_pfac_a #1#2.#3#4.% }% -\def\XINT_pfac_outofrange #1.#2.{\xintError:OutOfRangePFac\space 0}% +\def\XINT_pfac_outofrange #1.#2.% + {\XINT_signalcondition{InvalidOperation}{PFactorial with + too big second arg: 99999999 < #2}{}{0}}% \def\XINT_pfac_one #1.#2.{ 1}% \def\XINT_pfac_zero #1.#2.{ 0}% \def\XINT_pfac_neg -#1.-#2.% @@ -1674,7 +1542,7 @@ }% \def\XINT_pfac_a #1.#2.% {% - \expandafter\XINT_pfac_b\the\numexpr \xint_c_i+#1.#2.100000001!1\Z!% + \expandafter\XINT_pfac_b\the\numexpr \xint_c_i+#1.#2.100000001!1;!% 1\R!1\R!1\R!1\R!1\R!1\R!1\R!1\R!\W }% \def\XINT_pfac_b #1.% @@ -1807,8 +1675,7 @@ \def\xintMinof {\Did_you_mean_iMinof?or_load_xintfrac!}% \def\xintSum {\Did_you_mean_iiSum?or_load_xintfrac!}% \def\xintPrd {\Did_you_mean_iiPrd?or_load_xintfrac!}% -\def\xintPrdExpr {\Did_you_mean_iiPrdExpr?or_load_xintfrac!}% -\def\xintSumExpr {\Did_you_mean_iiSumExpr?or_load_xintfrac!}% +\catcode`! 12 \XINT_restorecatcodes_endinput% \endinput %% |