diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintfrac.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xintfrac.sty | 467 |
1 files changed, 252 insertions, 215 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty index eed97cde276..d5fbc30c454 100644 --- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintfrac.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 %% xintfrac: Expandable operations on fractions %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintfrac}% - [2017/01/06 1.2k Expandable operations on fractions (JFB)]% + [2017/07/26 1.2l Expandable operations on fractions (JFB)]% \def\XINT_cntSgnFork #1% {% \ifcase #1\expandafter\xint_secondofthree @@ -87,15 +87,14 @@ {% \expandafter#1% \the\numexpr \XINT_abs##1+% - \XINT_len_fork ##2##3\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax + \XINT_len_fork ##2##3\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-\xint_c_i \relax }}\XINT_flen{ }% \def\XINT_outfrac #1#2#3% {% - \ifcase\XINT_cntSgn #3\Z + \ifcase\XINT_cntSgn #3\xint: \expandafter \XINT_outfrac_divisionbyzero \or \expandafter \XINT_outfrac_P @@ -104,14 +103,14 @@ \fi {#2}{#3}[#1]% }% -\def\XINT_outfrac_divisionbyzero #1#2{\xintError:DivisionByZero\space #1/0}% -\edef\XINT_outfrac_P #1#2% +\def\XINT_outfrac_divisionbyzero #1#2% {% - \noexpand\if0\noexpand\XINT_Sgn #1\noexpand\Z - \noexpand\expandafter\noexpand\XINT_outfrac_Zero - \noexpand\fi - \space #1/#2% + \XINT_signalcondition{DivisionByZero}{Division of #1 by #2}{}{0/1[0]}% }% +\def\XINT_outfrac_P#1{% +\def\XINT_outfrac_P ##1##2% + {\if0\XINT_Sgn ##1\xint:\expandafter\XINT_outfrac_Zero\fi#1##1/##2}% +}\XINT_outfrac_P{ }% \def\XINT_outfrac_Zero #1[#2]{ 0/1[0]}% \def\XINT_outfrac_N #1#2% {% @@ -125,13 +124,13 @@ \def\XINT_inFrac {\romannumeral0\XINT_infrac }% \def\XINT_infrac #1% {% - \expandafter\XINT_infrac_fork\romannumeral`&&@#1/\XINT_W[\XINT_W\XINT_T + \expandafter\XINT_infrac_fork\romannumeral`&&@#1\xint:/\XINT_W[\XINT_W\XINT_T }% \def\XINT_infrac_fork #1[#2% {% \xint_UDXINTWfork - #2\XINT_frac_gen - \XINT_W\XINT_infrac_res_a % strict A[N] or A/B[N] input + #2\XINT_frac_gen % input has no brackets [N] + \XINT_W\XINT_infrac_res_a % there is some [N], must be strict A[N] or A/B[N] input \krof #1[#2% }% @@ -143,27 +142,27 @@ \def\XINT_infrac_res_b #1/#2% {% \xint_UDXINTWfork - #2\XINT_infrac_res_ca - \XINT_W\XINT_infrac_res_cb + #2\XINT_infrac_res_ca % it was A[N] input + \XINT_W\XINT_infrac_res_cb % it was A/B[N] input \krof #1/#2% }% -\def\XINT_infrac_res_ca #1[#2]/\XINT_W[\XINT_W\XINT_T +\def\XINT_infrac_res_ca #1[#2]\xint:/\XINT_W[\XINT_W\XINT_T {\expandafter{\the\numexpr #2}{#1}{1}}% \def\XINT_infrac_res_cb #1/#2[% {\expandafter\XINT_infrac_res_cc\romannumeral`&&@#2~#1[}% -\def\XINT_infrac_res_cc #1~#2[#3]/\XINT_W[\XINT_W\XINT_T +\def\XINT_infrac_res_cc #1~#2[#3]\xint:/\XINT_W[\XINT_W\XINT_T {\expandafter{\the\numexpr #3}{#2}{#1}}% \def\XINT_frac_gen #1/#2% {% \xint_UDXINTWfork - #2\XINT_frac_gen_A - \XINT_W\XINT_frac_gen_B + #2\XINT_frac_gen_A % there was no / + \XINT_W\XINT_frac_gen_B % there was a / \krof #1/#2% }% -\def\XINT_frac_gen_A #1/\XINT_W [\XINT_W {\XINT_frac_gen_C 0~1!#1ee.\XINT_W }% -\def\XINT_frac_gen_B #1/#2/\XINT_W[%\XINT_W +\def\XINT_frac_gen_A #1\xint:/\XINT_W [\XINT_W {\XINT_frac_gen_C 0~1!#1ee.\XINT_W }% +\def\XINT_frac_gen_B #1/#2\xint:/\XINT_W[%\XINT_W {% \expandafter\XINT_frac_gen_Ba \romannumeral`&&@#2ee.\XINT_W\XINT_Z #1ee.%\XINT_W @@ -186,8 +185,7 @@ {% \expandafter\XINT_frac_gen_C\the\numexpr #3-% \numexpr\XINT_length_loop - #1\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax + #1\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#1!% @@ -203,9 +201,8 @@ \def\XINT_frac_gen_Ca #1~#2!#3e#4e#5\XINT_T {% \expandafter\XINT_frac_gen_F\the\numexpr #4-#1\expandafter - ~\romannumeral0\XINT_num_loop - #2\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\Z~#3~% + ~\romannumeral0\expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop + #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z~#3~% }% \def\XINT_frac_gen_Cb #1.#2e% {% @@ -215,13 +212,12 @@ {% \expandafter\XINT_frac_gen_F\the\numexpr #5-#2-% \numexpr\XINT_length_loop - #1\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax + #1\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\expandafter~\romannumeral0\XINT_num_loop - #3\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\Z + \relax\expandafter~% + \romannumeral0\expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop + #3\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z ~#4#1~% }% \def\XINT_frac_gen_F #1~#2% @@ -235,20 +231,18 @@ \def\XINT_frac_gen_Gdivbyzero #1~~#2~% {% \expandafter\XINT_frac_gen_Gdivbyzero_a - \romannumeral0\XINT_num_loop - #2\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\Z~#1~% + \romannumeral0\expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop + #2\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z~#1~% }% \def\XINT_frac_gen_Gdivbyzero_a #1~#2~% {% - \xintError:DivisionByZero {#2}{#1}{0}% + \XINT_signalcondition{DivisionByZero}{Division of #1 by zero}{}{{#2}{#1}{0}}% }% \def\XINT_frac_gen_G #1#2#3~#4~#5~% {% \expandafter\XINT_frac_gen_Ga - \romannumeral0\XINT_num_loop - #1#5\xint_relax\xint_relax\xint_relax\xint_relax - \xint_relax\xint_relax\xint_relax\xint_relax\Z~#3~{#2#4}% + \romannumeral0\expandafter\XINT_num_cleanup\the\numexpr\XINT_num_loop + #1#5\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\xint:\Z~#3~{#2#4}% }% \def\XINT_frac_gen_Ga #1#2~#3~% {% @@ -260,10 +254,10 @@ {% \expandafter\XINT_cuz_cnt_loop\expandafter {\expandafter}\romannumeral0\XINT_rord_main {}#1% - \xint_relax + \xint: \xint_bye\xint_bye\xint_bye\xint_bye \xint_bye\xint_bye\xint_bye\xint_bye - \xint_relax + \xint: \R\R\R\R\R\R\R\R\Z }% \def\XINT_cuz_cnt #1% @@ -344,10 +338,10 @@ {% \expandafter\space\expandafter {\romannumeral0\XINT_rord_main {}#2% - \xint_relax + \xint: \xint_bye\xint_bye\xint_bye\xint_bye \xint_bye\xint_bye\xint_bye\xint_bye - \xint_relax }{#1}% + \xint:}{#1}% }% \def\xintRaw {\romannumeral0\xintraw }% \def\xintraw @@ -412,7 +406,7 @@ }% \def\XINT_numer #1% {% - \ifcase\XINT_cntSgn #1\Z + \ifcase\XINT_cntSgn #1\xint: \expandafter\XINT_numer_B \or \expandafter\XINT_numer_A @@ -611,8 +605,14 @@ \krof {#3#4}{#1#2}{#3#4}{#1#2}% }% -\def\XINT_irr_indeterminate #1#2#3#4#5{\xintError:NaN\space 0/0}% -\def\XINT_irr_divisionbyzero #1#2#3#4#5{\xintError:DivisionByZero #5#2/0}% +\def\XINT_irr_indeterminate #1#2#3#4#5% +{% + \XINT_signalcondition{DivisionUndefined}{indeterminate: 0/0}{}{0/1}% +}% +\def\XINT_irr_divisionbyzero #1#2#3#4#5% +{% + \XINT_signalcondition{DivisionByZero}{vanishing denominator: #5#2/0}{}{0/1}% +}% \def\XINT_irr_zero #1#2#3#4#5{ 0/1}% changed in 1.08 \def\XINT_irr_loop_a #1#2% {% @@ -678,8 +678,14 @@ \krof {#3#4}{#1#2}1001% }% -\def\XINT_jrr_indeterminate #1#2#3#4#5#6#7{\xintError:NaN\space 0/0}% -\def\XINT_jrr_divisionbyzero #1#2#3#4#5#6#7{\xintError:DivisionByZero #7#2/0}% +\def\XINT_jrr_indeterminate #1#2#3#4#5#6#7% +{% + \XINT_signalcondition{DivisionUndefined}{indeterminate: 0/0}{}{0/1}% +}% +\def\XINT_jrr_divisionbyzero #1#2#3#4#5#6#7% +{% + \XINT_signalcondition{DivisionByZero}{Vanishing denominator: #7#2/0}{}{0/1}% +}% \def\XINT_jrr_zero #1#2#3#4#5#6#7{ 0/1}% changed in 1.08 \def\XINT_jrr_loop_a #1#2% {% @@ -689,8 +695,8 @@ \def\XINT_jrr_loop_b #1#2#3#4#5#6#7% {% \expandafter \XINT_jrr_loop_c \expandafter - {\romannumeral0\xintiiadd{\XINT_mul_fork #4\Z #1\Z}{#6}}% - {\romannumeral0\xintiiadd{\XINT_mul_fork #5\Z #1\Z}{#7}}% + {\romannumeral0\xintiiadd{\XINT_mul_fork #4\xint:#1\xint:}{#6}}% + {\romannumeral0\xintiiadd{\XINT_mul_fork #5\xint:#1\xint:}{#7}}% {#2}{#3}{#4}{#5}% }% \def\XINT_jrr_loop_c #1#2% @@ -732,8 +738,8 @@ }% \def\XINT_trunc_a #1#2#3#4.#5% {% - \if0\XINT_Sgn#2\Z\xint_dothis\XINT_trunc_zero\fi - \if1\XINT_is_one#3XY\xint_dothis\XINT_trunc_sp_b\fi + \if0\XINT_Sgn#2\xint:\xint_dothis\XINT_trunc_zero\fi + \if1\XINT_is_One#3XY\xint_dothis\XINT_trunc_sp_b\fi \xint_orthat\XINT_trunc_b #1+#4.{#2}{#3}#5#4.% }% \def\XINT_trunc_zero #1.#2.{ 0}% @@ -772,8 +778,7 @@ \expandafter\XINT_trunc_sp_Cc \romannumeral0\expandafter\XINT_split_fromright_a \the\numexpr#3-\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_bye2345678\xint_bye..#1% @@ -851,8 +856,8 @@ }% \def\XINT_round_a #1#2#3#4.% {% - \if0\XINT_Sgn#2\Z\xint_dothis\XINT_trunc_zero\fi - \if1\XINT_is_one#3XY\xint_dothis\XINT_trunc_sp_b\fi + \if0\XINT_Sgn#2\xint:\xint_dothis\XINT_trunc_zero\fi + \if1\XINT_is_One#3XY\xint_dothis\XINT_trunc_sp_b\fi \xint_orthat\XINT_trunc_b #1+#4.{#2}{#3}% }% \def\XINT_round_A{\expandafter\XINT_trunc_G\romannumeral0\XINT_round_B}% @@ -880,7 +885,8 @@ \def\XINT_xtrunc_zero #1#2]{0.\romannumeral\xintreplicate{#1}0}% \def\XINT_xtrunc_d #1#2#3/#4[#5]% {% - \XINT_xtrunc_prepare_a#4\R\R\R\R\R\R\R\R {10}0000001\W !{#4};{#5}{#2}{#1#3}% + \XINT_xtrunc_prepare_a#4\R\R\R\R\R\R\R\R {10}0000001\W + !{#4};{#5}{#2}{#1#3}% }% \def\XINT_xtrunc_prepare_a #1#2#3#4#5#6#7#8#9% {% @@ -930,12 +936,13 @@ {% \expandafter\XINT_xtrunc_e\expandafter {\expandafter\XINT_xtrunc_small_a - \the\numexpr #1/\xint_c_ii\expandafter.\the\numexpr \xint_c_x^viii+#1!}% + \the\numexpr #1/\xint_c_ii\expandafter + .\the\numexpr \xint_c_x^viii+#1!}% }% \def\XINT_xtrunc_small_a #1.#2!#3% {% \expandafter\XINT_div_small_b\the\numexpr #1\expandafter - .\the\numexpr #2\expandafter!% + \xint:\the\numexpr #2\expandafter!% \romannumeral0\XINT_div_small_ba #3\R\R\R\R\R\R\R\R{10}0000001\W #3\XINT_sepbyviii_Z_end 2345678\relax }% @@ -947,7 +954,8 @@ }% \def\XINT_xtrunc_prepare_d #1#2#3#4#5#6#7#8#9% {% - \expandafter\XINT_xtrunc_prepare_e\xint_gob_til_dot #1#2#3#4#5#6#7#8#9!% + \expandafter\XINT_xtrunc_prepare_e + \xint_gob_til_dot #1#2#3#4#5#6#7#8#9!% }% \def\XINT_xtrunc_prepare_e #1!#2!#3#4% {% @@ -958,14 +966,13 @@ \expandafter\XINT_xtrunc_prepare_g\expandafter \XINT_div_prepare_g \the\numexpr #1#2#3#4#5#6#7#8+\xint_c_i\expandafter - .\the\numexpr (#1#2#3#4#5#6#7#8+\xint_c_i)/\xint_c_ii\expandafter - .\the\numexpr #1#2#3#4#5#6#7#8\expandafter - .\romannumeral0\XINT_sepandrev_andcount + \xint:\the\numexpr (#1#2#3#4#5#6#7#8+\xint_c_i)/\xint_c_ii\expandafter + \xint:\the\numexpr #1#2#3#4#5#6#7#8\expandafter + \xint:\romannumeral0\XINT_sepandrev_andcount #1#2#3#4#5#6#7#8#9\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_xtrunc_prepare_g #1;{\XINT_xtrunc_e {#1}}% @@ -975,15 +982,15 @@ \expandafter\XINT_xtrunc_I \else \expandafter\XINT_xtrunc_II - \fi #2.{#1}% + \fi #2\xint:{#1}% }% -\def\XINT_xtrunc_I -#1.#2#3#4% +\def\XINT_xtrunc_I -#1\xint:#2#3#4% {% \expandafter\XINT_xtrunc_I_a\romannumeral0#2{#4}{#2}{#1}{#3}% }% \def\XINT_xtrunc_I_a #1#2#3#4#5% {% - \expandafter\XINT_xtrunc_I_b\the\numexpr #4-#5.#4.{#5}{#2}{#3}{#1}% + \expandafter\XINT_xtrunc_I_b\the\numexpr #4-#5\xint:#4\xint:{#5}{#2}{#3}{#1}% }% \def\XINT_xtrunc_I_b #1% {% @@ -992,12 +999,12 @@ -\XINT_xtrunc_IB_c \krof #1% }% -\def\XINT_xtrunc_IA_c -#1.#2.#3#4#5#6% +\def\XINT_xtrunc_IA_c -#1\xint:#2\xint:#3#4#5#6% {% \expandafter\XINT_xtrunc_IA_d - \the\numexpr#2-\xintLength{#6}.{#6}% + \the\numexpr#2-\xintLength{#6}\xint:{#6}% \expandafter\XINT_xtrunc_IA_xd - \the\numexpr (#1+\xint_c_ii^v)/\xint_c_ii^vi-\xint_c_i.#1.{#5}{#4}% + \the\numexpr (#1+\xint_c_ii^v)/\xint_c_ii^vi-\xint_c_i\xint:#1\xint:{#5}{#4}% }% \def\XINT_xtrunc_IA_d #1% {% @@ -1006,56 +1013,56 @@ -\XINT_xtrunc_IAB_e \krof #1% }% -\def\XINT_xtrunc_IAA_e -#1.#2% +\def\XINT_xtrunc_IAA_e -#1\xint:#2% {% \romannumeral0\XINT_split_fromleft #1.#2\xint_gobble_i\xint_bye2345678\xint_bye..% }% -\def\XINT_xtrunc_IAB_e #1.#2% +\def\XINT_xtrunc_IAB_e #1\xint:#2% {% 0.\romannumeral\XINT_rep#1\endcsname0#2% }% -\def\XINT_xtrunc_IA_xd #1.#2.% +\def\XINT_xtrunc_IA_xd #1\xint:#2\xint:% {% - \expandafter\XINT_xtrunc_IA_xe\the\numexpr #2-\xint_c_ii^vi*#1.#1.% + \expandafter\XINT_xtrunc_IA_xe\the\numexpr #2-\xint_c_ii^vi*#1\xint:#1\xint:% }% -\def\XINT_xtrunc_IA_xe #1.#2.#3#4% +\def\XINT_xtrunc_IA_xe #1\xint:#2\xint:#3#4% {% \XINT_xtrunc_loop {#2}{#4}{#3}{#1}% }% -\def\XINT_xtrunc_IB_c #1.#2.#3#4#5#6% +\def\XINT_xtrunc_IB_c #1\xint:#2\xint:#3#4#5#6% {% \expandafter\XINT_xtrunc_IB_d \romannumeral0\XINT_split_xfork #1.#6\xint_bye2345678\xint_bye..{#3}% }% \def\XINT_xtrunc_IB_d #1.#2.#3% {% - \expandafter\XINT_xtrunc_IA_d\the\numexpr#3-\xintLength {#1}.{#1}% + \expandafter\XINT_xtrunc_IA_d\the\numexpr#3-\xintLength {#1}\xint:{#1}% }% -\def\XINT_xtrunc_II #1.% +\def\XINT_xtrunc_II #1\xint:% {% - \expandafter\XINT_xtrunc_II_a\romannumeral\xintreplicate{#1}0.% + \expandafter\XINT_xtrunc_II_a\romannumeral\xintreplicate{#1}0\xint:% }% -\def\XINT_xtrunc_II_a #1.#2#3#4% +\def\XINT_xtrunc_II_a #1\xint:#2#3#4% {% \expandafter\XINT_xtrunc_II_b - \the\numexpr (#3+\xint_c_ii^v)/\xint_c_ii^vi-\xint_c_i\expandafter.% - \the\numexpr #3\expandafter.\romannumeral0#2{#4#1}{#2}% + \the\numexpr (#3+\xint_c_ii^v)/\xint_c_ii^vi-\xint_c_i\expandafter\xint:% + \the\numexpr #3\expandafter\xint:\romannumeral0#2{#4#1}{#2}% }% -\def\XINT_xtrunc_II_b #1.#2.% +\def\XINT_xtrunc_II_b #1\xint:#2\xint:% {% - \expandafter\XINT_xtrunc_II_c\the\numexpr #2-\xint_c_ii^vi*#1.#1.% + \expandafter\XINT_xtrunc_II_c\the\numexpr #2-\xint_c_ii^vi*#1\xint:#1\xint:% }% -\def\XINT_xtrunc_II_c #1.#2.#3#4#5% +\def\XINT_xtrunc_II_c #1\xint:#2\xint:#3#4#5% {% #3.\XINT_xtrunc_loop {#2}{#4}{#5}{#1}% }% \def\XINT_xtrunc_loop #1% {% \ifnum #1=\xint_c_ \expandafter\XINT_xtrunc_transition\fi - \expandafter\XINT_xtrunc_loop_a\the\numexpr #1-\xint_c_i.% + \expandafter\XINT_xtrunc_loop_a\the\numexpr #1-\xint_c_i\xint:% }% -\def\XINT_xtrunc_loop_a #1.#2#3% +\def\XINT_xtrunc_loop_a #1\xint:#2#3% {% \expandafter\XINT_xtrunc_loop_b\romannumeral0#3% {#20000000000000000000000000000000000000000000000000000000000000000}% @@ -1067,7 +1074,7 @@ \XINT_xtrunc_loop {#3}{#2}% }% \def\XINT_xtrunc_transition - \expandafter\XINT_xtrunc_loop_a\the\numexpr #1.#2#3#4% + \expandafter\XINT_xtrunc_loop_a\the\numexpr #1\xint:#2#3#4% {% \ifnum #4=\xint_c_ \expandafter\xint_gobble_vi\fi \expandafter\XINT_xtrunc_finish\expandafter @@ -1087,11 +1094,11 @@ \expandafter\XINT_xtrunc_sp_I \else \expandafter\XINT_xtrunc_sp_II - \fi #1.% + \fi #1\xint:% }% -\def\XINT_xtrunc_sp_I -#1.#2#3% +\def\XINT_xtrunc_sp_I -#1\xint:#2#3% {% - \expandafter\XINT_xtrunc_sp_I_a\the\numexpr #1-#3.#1.{#3}{#2}% + \expandafter\XINT_xtrunc_sp_I_a\the\numexpr #1-#3\xint:#1\xint:{#3}{#2}% }% \def\XINT_xtrunc_sp_I_a #1% {% @@ -1100,10 +1107,10 @@ -\XINT_xtrunc_sp_IB_b \krof #1% }% -\def\XINT_xtrunc_sp_IA_b -#1.#2.#3#4% +\def\XINT_xtrunc_sp_IA_b -#1\xint:#2\xint:#3#4% {% \expandafter\XINT_xtrunc_sp_IA_c - \the\numexpr#2-\xintLength{#4}.{#4}\romannumeral\XINT_rep#1\endcsname0% + \the\numexpr#2-\xintLength{#4}\xint:{#4}\romannumeral\XINT_rep#1\endcsname0% }% \def\XINT_xtrunc_sp_IA_c #1% {% @@ -1112,25 +1119,25 @@ -\XINT_xtrunc_sp_IAB \krof #1% }% -\def\XINT_xtrunc_sp_IAA -#1.#2% +\def\XINT_xtrunc_sp_IAA -#1\xint:#2% {% \romannumeral0\XINT_split_fromleft #1.#2\xint_gobble_i\xint_bye2345678\xint_bye..% }% -\def\XINT_xtrunc_sp_IAB #1.#2% +\def\XINT_xtrunc_sp_IAB #1\xint:#2% {% 0.\romannumeral\XINT_rep#1\endcsname0#2% }% -\def\XINT_xtrunc_sp_IB_b #1.#2.#3#4% +\def\XINT_xtrunc_sp_IB_b #1\xint:#2\xint:#3#4% {% \expandafter\XINT_xtrunc_sp_IB_c \romannumeral0\XINT_split_xfork #1.#4\xint_bye2345678\xint_bye..{#3}% }% \def\XINT_xtrunc_sp_IB_c #1.#2.#3% {% - \expandafter\XINT_xtrunc_sp_IA_c\the\numexpr#3-\xintLength {#1}.{#1}% + \expandafter\XINT_xtrunc_sp_IA_c\the\numexpr#3-\xintLength {#1}\xint:{#1}% }% -\def\XINT_xtrunc_sp_II #1.#2#3% +\def\XINT_xtrunc_sp_II #1\xint:#2#3% {% #2\romannumeral\XINT_rep#1\endcsname0.\romannumeral\XINT_rep#3\endcsname0% }% @@ -1190,7 +1197,7 @@ }% \def\XINT_fadd_E #1#2% {% - \if0\XINT_Sgn #2\Z + \if0\XINT_Sgn #2\xint: \expandafter\XINT_fadd_F \else\expandafter\XINT_fadd_K \fi {#1}% @@ -1206,7 +1213,7 @@ }% \def\XINT_fadd_Ea #1#2% {% - \if0\XINT_Sgn #2\Z + \if0\XINT_Sgn #2\xint: \expandafter\XINT_fadd_Fa \else\expandafter\XINT_fadd_K \fi {#1}% @@ -1216,18 +1223,20 @@ \expandafter\XINT_fadd_G \romannumeral0\xintiiadd {\xintiiMul {#4}{#1}}{#5}/#3%[#6]% }% -\def\XINT_fadd_G #1{\if0#1\XINT_fadd_iszero\fi\space #1}% +\def\XINT_fadd_G #1{% +\def\XINT_fadd_G ##1{\if0##1\expandafter\XINT_fadd_iszero\fi#1##1}% +}\XINT_fadd_G{ }% \def\XINT_fadd_K #1#2#3#4#5% {% \expandafter\XINT_fadd_L \romannumeral0\xintiiadd {\xintiiMul {#2}{#5}}{\xintiiMul {#3}{#4}}.% {{#2}{#3}}% }% -\def\XINT_fadd_L #1{\if0#1\XINT_fadd_iszero\fi \XINT_fadd_M #1}% +\def\XINT_fadd_L #1{\if0#1\expandafter\XINT_fadd_iszero\fi\XINT_fadd_M #1}% \def\XINT_fadd_M #1.#2{\expandafter\XINT_fadd_N \expandafter {\romannumeral0\xintiimul #2}{#1}}% \def\XINT_fadd_N #1#2{ #2/#1}% -\edef\XINT_fadd_iszero\fi #1[#2]{\noexpand\fi\space 0/1[0]}% ou [#2] originel? +\def\XINT_fadd_iszero #1[#2]{ 0/1[0]}% ou [#2] originel? \def\xintSub {\romannumeral0\xintsub }% \def\xintsub #1{\expandafter\XINT_fsub\romannumeral0\xintraw {#1}}% \def\XINT_fsub #1{\xint_gob_til_zero #1\XINT_fsub_Azero 0\XINT_fsub_a #1}% @@ -1240,24 +1249,21 @@ 0-{\XINT_fadd_c -#1}% \krof }% \def\xintSum {\romannumeral0\xintsum }% -\def\xintsum #1{\xintsumexpr #1\relax }% -\def\xintSumExpr {\romannumeral0\xintsumexpr }% -\def\xintsumexpr {\expandafter\XINT_fsumexpr\romannumeral`&&@}% +\def\xintsum #1{\expandafter\XINT_fsumexpr\romannumeral`&&@#1\xint:}% \def\XINT_fsumexpr {\XINT_fsum_loop_a {0/1[0]}}% \def\XINT_fsum_loop_a #1#2% {% - \expandafter\XINT_fsum_loop_b \romannumeral`&&@#2\Z {#1}% + \expandafter\XINT_fsum_loop_b \romannumeral`&&@#2\xint:{#1}% }% \def\XINT_fsum_loop_b #1% {% - \xint_gob_til_relax #1\XINT_fsum_finished\relax - \XINT_fsum_loop_c #1% + \xint_gob_til_xint: #1\XINT_fsum_finished\xint:\XINT_fsum_loop_c #1% }% -\def\XINT_fsum_loop_c #1\Z #2% +\def\XINT_fsum_loop_c #1\xint:#2% {% \expandafter\XINT_fsum_loop_a\expandafter{\romannumeral0\xintadd {#2}{#1}}% }% -\def\XINT_fsum_finished #1\Z #2{ #2}% +\def\XINT_fsum_finished #1\xint:\xint:#2{ #2}% \def\xintMul {\romannumeral0\xintmul }% \def\xintmul #1{\expandafter\XINT_fmul\romannumeral0\xintraw {#1}.}% \def\XINT_fmul #1{\xint_gob_til_zero #1\XINT_fmul_zero 0\XINT_fmul_a #1}% @@ -1291,7 +1297,8 @@ \def\XINT_fsqr_zero #1]{ 0/1[0]}% \def\xintipow #1#2% {% - \expandafter\xint_pow\the\numexpr \xintNum{#2}\expandafter.\romannumeral0\xintnum{#1}\Z% + \expandafter\xint_pow\the\numexpr \xintNum{#2}\expandafter + .\romannumeral0\xintnum{#1}\xint: }% \def\xintPow {\romannumeral0\xintpow }% \def\xintpow #1% @@ -1343,24 +1350,21 @@ \the\numexpr\xintNum{#1}\expandafter.\the\numexpr\xintNum{#2}.% }% \def\xintPrd {\romannumeral0\xintprd }% -\def\xintprd #1{\xintprdexpr #1\relax }% -\def\xintPrdExpr {\romannumeral0\xintprdexpr }% -\def\xintprdexpr {\expandafter\XINT_fprdexpr \romannumeral`&&@}% +\def\xintprd #1{\expandafter\XINT_fprdexpr \romannumeral`&&@#1\xint:}% \def\XINT_fprdexpr {\XINT_fprod_loop_a {1/1[0]}}% \def\XINT_fprod_loop_a #1#2% {% - \expandafter\XINT_fprod_loop_b \romannumeral`&&@#2\Z {#1}% + \expandafter\XINT_fprod_loop_b \romannumeral`&&@#2\xint:{#1}% }% \def\XINT_fprod_loop_b #1% {% - \xint_gob_til_relax #1\XINT_fprod_finished\relax - \XINT_fprod_loop_c #1% + \xint_gob_til_xint: #1\XINT_fprod_finished\xint:\XINT_fprod_loop_c #1% }% -\def\XINT_fprod_loop_c #1\Z #2% +\def\XINT_fprod_loop_c #1\xint:#2% {% \expandafter\XINT_fprod_loop_a\expandafter{\romannumeral0\xintmul {#1}{#2}}% }% -\def\XINT_fprod_finished #1\Z #2{ #2}% +\def\XINT_fprod_finished#1\xint:\xint:#2{ #2}% \def\xintDiv {\romannumeral0\xintdiv }% \def\xintdiv #1% {% @@ -1393,7 +1397,7 @@ {\expandafter\XINT_mod_b\expandafter #1\romannumeral0\xintraw{#3}#2.}% \def\XINT_mod_b #1#2% #1 de A, #2 de B. {% - \if0#2\xint_dothis\XINT_mod_divbyzero\fi + \if0#2\xint_dothis{\XINT_mod_divbyzero #1#2}\fi \if0#1\xint_dothis\XINT_mod_aiszero\fi \if-#2\xint_dothis{\XINT_mod_bneg #1}\fi \xint_orthat{\XINT_mod_bpos #1#2}% @@ -1412,7 +1416,10 @@ -{\XINT_mod_pos #1}% \krof }% -\def\XINT_mod_divbyzero #1.{\xintError:DivisionByZero\space 0/1[0]}% +\def\XINT_mod_divbyzero #1#2[#3]#4.% +{% + \XINT_signalcondition{DivisionByZero}{Division by #2[#3] of #1#4}{}{0/1[0]}% +}% \def\XINT_mod_aiszero #1.{ 0/1[0]}% \def\XINT_mod_pos #1#2/#3[#4]#5/#6[#7].% {% @@ -1427,7 +1434,7 @@ \def\xintisone #1{\expandafter\XINT_fracisone \romannumeral0\xintrawwithzeros{#1}\Z }% \def\XINT_fracisone #1/#2\Z - {\if0\XINT_Cmp {#1}{#2}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% + {\if0\xintiiCmp {#1}{#2}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% \def\xintGeq {\romannumeral0\xintgeq }% \def\xintgeq #1% {% @@ -1460,7 +1467,7 @@ \def\XINT_fgeq_D #1#2#3% {% \expandafter\XINT_cntSgnFork\romannumeral`&&@\expandafter\XINT_cntSgn - \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z + \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\xint: { 0}{\XINT_fgeq_E #2\Z {#3}{#1}}{ 1}% }% \def\XINT_fgeq_E #1% @@ -1516,15 +1523,15 @@ \fi }% \def\xintMaxof {\romannumeral0\xintmaxof }% -\def\xintmaxof #1{\expandafter\XINT_maxof_a\romannumeral`&&@#1\relax }% -\def\XINT_maxof_a #1{\expandafter\XINT_maxof_b\romannumeral0\xintraw{#1}\Z }% -\def\XINT_maxof_b #1\Z #2% - {\expandafter\XINT_maxof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintmaxof #1{\expandafter\XINT_maxof_a\romannumeral`&&@#1\xint:}% +\def\XINT_maxof_a #1{\expandafter\XINT_maxof_b\romannumeral0\xintraw{#1}!}% +\def\XINT_maxof_b #1!#2% + {\expandafter\XINT_maxof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_maxof_c #1% - {\xint_gob_til_relax #1\XINT_maxof_e\relax\XINT_maxof_d #1}% -\def\XINT_maxof_d #1\Z + {\xint_gob_til_xint: #1\XINT_maxof_e\xint:\XINT_maxof_d #1}% +\def\XINT_maxof_d #1!% {\expandafter\XINT_maxof_b\romannumeral0\xintmax {#1}}% -\def\XINT_maxof_e #1\Z #2\Z { #2}% +\def\XINT_maxof_e #1!#2!{ #2}% \def\xintMin {\romannumeral0\xintmin }% \def\xintmin #1% {% @@ -1560,15 +1567,16 @@ \fi }% \def\xintMinof {\romannumeral0\xintminof }% -\def\xintminof #1{\expandafter\XINT_minof_a\romannumeral`&&@#1\relax }% -\def\XINT_minof_a #1{\expandafter\XINT_minof_b\romannumeral0\xintraw{#1}\Z }% -\def\XINT_minof_b #1\Z #2% - {\expandafter\XINT_minof_c\romannumeral`&&@#2\Z {#1}\Z}% +\def\xintminof #1{\expandafter\XINT_minof_a\romannumeral`&&@#1\xint:}% +\def\XINT_minof_a #1{\expandafter\XINT_minof_b\romannumeral0\xintraw{#1}!}% +\def\XINT_minof_b #1!#2% + {\expandafter\XINT_minof_c\romannumeral`&&@#2!{#1}!}% \def\XINT_minof_c #1% - {\xint_gob_til_relax #1\XINT_minof_e\relax\XINT_minof_d #1}% -\def\XINT_minof_d #1\Z + {\xint_gob_til_xint: #1\XINT_minof_e\xint:\XINT_minof_d #1}% +\def\XINT_minof_d #1!% {\expandafter\XINT_minof_b\romannumeral0\xintmin {#1}}% -\def\XINT_minof_e #1\Z #2\Z { #2}% +\def\XINT_minof_e #1!#2!{ #2}% +\def\xintCmp {\romannumeral0\xintcmp }% \def\xintcmp #1% {% \expandafter\XINT_fcmp\expandafter {\romannumeral0\xintraw {#1}}% @@ -1622,7 +1630,7 @@ \def\XINT_fcmp_D #1#2#3% {% \expandafter\XINT_cntSgnFork\romannumeral`&&@\expandafter\XINT_cntSgn - \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\Z + \the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax\xint: { -1}{\XINT_fcmp_E #2\Z {#3}{#1}}{ 1}% }% \def\XINT_fcmp_E #1% @@ -1648,21 +1656,21 @@ \def\xintOpp {\romannumeral0\xintopp }% \def\xintopp #1{\expandafter\XINT_opp\romannumeral0\xintraw {#1}}% \def\xintSgn {\romannumeral0\xintsgn }% -\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\Z }% +\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\xint:}% \def\xintFloat {\romannumeral0\xintfloat }% -\def\xintfloat #1{\XINT_float_chkopt #1\xint_relax }% +\def\xintfloat #1{\XINT_float_chkopt #1\xint:}% \def\XINT_float_chkopt #1% {% \ifx [#1\expandafter\XINT_float_opt \else\expandafter\XINT_float_noopt \fi #1% }% -\def\XINT_float_noopt #1\xint_relax +\def\XINT_float_noopt #1\xint:% {% \expandafter\XINT_float_post \romannumeral0\XINTinfloat[\XINTdigits]{#1}\XINTdigits.% }% -\def\XINT_float_opt [\xint_relax #1]% +\def\XINT_float_opt [\xint:#1]% {% \expandafter\XINT_float_opt_a\the\numexpr #1.% }% @@ -1711,7 +1719,7 @@ }% \def\XINT_infloat_a #1.#2#3#4% {% - \if1\XINT_is_one#4XY% + \if1\XINT_is_One#4XY% \expandafter\XINT_infloat_sp \else\expandafter\XINT_infloat_fork \fi #3.{#1}{#2}{#4}% @@ -1888,19 +1896,19 @@ }% \def\XINT_infloat_ZZ #1.#2.{ 1#2[#1]}% \def\xintPFloat {\romannumeral0\xintpfloat }% -\def\xintpfloat #1{\XINT_pfloat_chkopt #1\xint_relax }% +\def\xintpfloat #1{\XINT_pfloat_chkopt #1\xint:}% \def\XINT_pfloat_chkopt #1% {% \ifx [#1\expandafter\XINT_pfloat_opt \else\expandafter\XINT_pfloat_noopt \fi #1% }% -\def\XINT_pfloat_noopt #1\xint_relax +\def\XINT_pfloat_noopt #1\xint:% {% \expandafter\XINT_pfloat_a \romannumeral0\xintfloat [\XINTdigits]{#1};\XINTdigits.% }% -\def\XINT_pfloat_opt [\xint_relax #1]% +\def\XINT_pfloat_opt [\xint:#1]% {% \expandafter\XINT_pfloat_opt_a \the\numexpr #1.% }% @@ -1962,22 +1970,22 @@ }% \def\XINT_infloatfracdg_a {\XINTinfloat [\XINTdigits]}% \def\xintFloatAdd {\romannumeral0\xintfloatadd }% -\def\xintfloatadd #1{\XINT_fladd_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatadd #1{\XINT_fladd_chkopt \xintfloat #1\xint:}% \def\XINTinFloatAdd {\romannumeral0\XINTinfloatadd }% -\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINTinfloatS #1\xint:}% \def\XINT_fladd_chkopt #1#2% {% \ifx [#2\expandafter\XINT_fladd_opt \else\expandafter\XINT_fladd_noopt \fi #1#2% }% -\def\XINT_fladd_noopt #1#2\xint_relax #3% +\def\XINT_fladd_noopt #1#2\xint:#3% {% #1[\XINTdigits]% {\expandafter\XINT_FL_add_a \romannumeral0\XINTinfloat[\XINTdigits]{#2}\XINTdigits.{#3}}% }% -\def\XINT_fladd_opt #1[\xint_relax #2]%#3#4% +\def\XINT_fladd_opt #1[\xint:#2]%#3#4% {% \expandafter\XINT_fladd_opt_a\the\numexpr #2.#1% }% @@ -2005,22 +2013,22 @@ \xint_orthat\xintAdd {#1[#2]}{#4[#5]}% }% \def\xintFloatSub {\romannumeral0\xintfloatsub }% -\def\xintfloatsub #1{\XINT_flsub_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatsub #1{\XINT_flsub_chkopt \xintfloat #1\xint:}% \def\XINTinFloatSub {\romannumeral0\XINTinfloatsub }% -\def\XINTinfloatsub #1{\XINT_flsub_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatsub #1{\XINT_flsub_chkopt \XINTinfloatS #1\xint:}% \def\XINT_flsub_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flsub_opt \else\expandafter\XINT_flsub_noopt \fi #1#2% }% -\def\XINT_flsub_noopt #1#2\xint_relax #3% +\def\XINT_flsub_noopt #1#2\xint:#3% {% #1[\XINTdigits]% {\expandafter\XINT_FL_add_a \romannumeral0\XINTinfloat[\XINTdigits]{#2}\XINTdigits.{\xintOpp{#3}}}% }% -\def\XINT_flsub_opt #1[\xint_relax #2]%#3#4% +\def\XINT_flsub_opt #1[\xint:#2]%#3#4% {% \expandafter\XINT_flsub_opt_a\the\numexpr #2.#1% }% @@ -2029,22 +2037,22 @@ #2[#1]{\expandafter\XINT_FL_add_a\romannumeral0\XINTinfloat[#1]{#3}#1.{\xintOpp{#4}}}% }% \def\xintFloatMul {\romannumeral0\xintfloatmul }% -\def\xintfloatmul #1{\XINT_flmul_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatmul #1{\XINT_flmul_chkopt \xintfloat #1\xint:}% \def\XINTinFloatMul {\romannumeral0\XINTinfloatmul }% -\def\XINTinfloatmul #1{\XINT_flmul_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatmul #1{\XINT_flmul_chkopt \XINTinfloatS #1\xint:}% \def\XINT_flmul_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flmul_opt \else\expandafter\XINT_flmul_noopt \fi #1#2% }% -\def\XINT_flmul_noopt #1#2\xint_relax #3% +\def\XINT_flmul_noopt #1#2\xint:#3% {% #1[\XINTdigits]% {\expandafter\XINT_FL_mul_a \romannumeral0\XINTinfloatS[\XINTdigits]{#2}\XINTdigits.{#3}}% }% -\def\XINT_flmul_opt #1[\xint_relax #2]%#3#4% +\def\XINT_flmul_opt #1[\xint:#2]%#3#4% {% \expandafter\XINT_flmul_opt_a\the\numexpr #2.#1% }% @@ -2058,22 +2066,22 @@ }% \def\XINT_FL_mul_b #1[#2]#3[#4]{\xintiiMul{#3}{#1}/1[#4+#2]}% \def\xintFloatDiv {\romannumeral0\xintfloatdiv }% -\def\xintfloatdiv #1{\XINT_fldiv_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatdiv #1{\XINT_fldiv_chkopt \xintfloat #1\xint:}% \def\XINTinFloatDiv {\romannumeral0\XINTinfloatdiv }% -\def\XINTinfloatdiv #1{\XINT_fldiv_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatdiv #1{\XINT_fldiv_chkopt \XINTinfloatS #1\xint:}% \def\XINT_fldiv_chkopt #1#2% {% \ifx [#2\expandafter\XINT_fldiv_opt \else\expandafter\XINT_fldiv_noopt \fi #1#2% }% -\def\XINT_fldiv_noopt #1#2\xint_relax #3% +\def\XINT_fldiv_noopt #1#2\xint:#3% {% #1[\XINTdigits]% {\expandafter\XINT_FL_div_a \romannumeral0\XINTinfloatS[\XINTdigits]{#3}\XINTdigits.{#2}}% }% -\def\XINT_fldiv_opt #1[\xint_relax #2]%#3#4% +\def\XINT_fldiv_opt #1[\xint:#2]%#3#4% {% \expandafter\XINT_fldiv_opt_a\the\numexpr #2.#1% }% @@ -2087,9 +2095,9 @@ }% \def\XINT_FL_div_b #1[#2]{#1e#2}% \def\xintFloatPow {\romannumeral0\xintfloatpow}% -\def\xintfloatpow #1{\XINT_flpow_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatpow #1{\XINT_flpow_chkopt \xintfloat #1\xint:}% \def\XINTinFloatPow {\romannumeral0\XINTinfloatpow }% -\def\XINTinfloatpow #1{\XINT_flpow_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatpow #1{\XINT_flpow_chkopt \XINTinfloatS #1\xint:}% \def\XINT_flpow_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flpow_opt @@ -2097,12 +2105,12 @@ \fi #1#2% }% -\def\XINT_flpow_noopt #1#2\xint_relax #3% +\def\XINT_flpow_noopt #1#2\xint:#3% {% \expandafter\XINT_flpow_checkB_a \the\numexpr #3.\XINTdigits.{#2}{#1[\XINTdigits]}% }% -\def\XINT_flpow_opt #1[\xint_relax #2]% +\def\XINT_flpow_opt #1[\xint:#2]% {% \expandafter\XINT_flpow_opt_a\the\numexpr #2.#1% }% @@ -2149,8 +2157,10 @@ }% \def\XINT_flpow_zero #1[#2]#3#4#5#6% {% - \if 1#51\xint_afterfi {#6{0[0]}}\else - \xint_afterfi {\xintError:DivisionByZero #6{1[2147483648]}}\fi + #6{\if 1#51\xint_dothis {0[0]}\fi + \xint_orthat + {\XINT_signalcondition{DivisionByZero}{0 to the power #4}{}{0[0]}}% + }% }% \def\XINT_flpow_b #1#2[#3]#4#5% {% @@ -2240,9 +2250,9 @@ \def\XINT_flpow_IIIend #1#2#3% {#3{\if#21\xint_afterfi{\expandafter-\romannumeral`&&@}\fi#1}}% \def\xintFloatPower {\romannumeral0\xintfloatpower}% -\def\xintfloatpower #1{\XINT_flpower_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatpower #1{\XINT_flpower_chkopt \xintfloat #1\xint:}% \def\XINTinFloatPower {\romannumeral0\XINTinfloatpower }% -\def\XINTinfloatpower #1{\XINT_flpower_chkopt \XINTinfloatS #1\xint_relax }% +\def\XINTinfloatpower #1{\XINT_flpower_chkopt \XINTinfloatS #1\xint:}% \def\XINTinFloatPowerH {\romannumeral0\XINTinfloatpowerh }% \def\XINTinfloatpowerh #1#2% {% @@ -2287,12 +2297,12 @@ \fi #1#2% }% -\def\XINT_flpower_noopt #1#2\xint_relax #3% +\def\XINT_flpower_noopt #1#2\xint:#3% {% \expandafter\XINT_flpower_checkB_a \romannumeral0\xintnum{#3}.\XINTdigits.{#2}{#1[\XINTdigits]}% }% -\def\XINT_flpower_opt #1[\xint_relax #2]% +\def\XINT_flpower_opt #1[\xint:#2]% {% \expandafter\XINT_flpower_opt_a\the\numexpr #2.#1% }% @@ -2407,9 +2417,9 @@ \the\numexpr#2+#5\expandafter.\romannumeral0\xintiimul{#3}{#6}.#4.% }% \def\xintFloatFac {\romannumeral0\xintfloatfac}% -\def\xintfloatfac #1{\XINT_flfac_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatfac #1{\XINT_flfac_chkopt \xintfloat #1\xint:}% \def\XINTinFloatFac {\romannumeral0\XINTinfloatfac }% -\def\XINTinfloatfac #1{\XINT_flfac_chkopt \XINTinfloat #1\xint_relax }% +\def\XINTinfloatfac #1{\XINT_flfac_chkopt \XINTinfloat #1\xint:}% \def\XINT_flfac_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flfac_opt @@ -2417,12 +2427,12 @@ \fi #1#2% }% -\def\XINT_flfac_noopt #1#2\xint_relax +\def\XINT_flfac_noopt #1#2\xint: {% \expandafter\XINT_FL_fac_fork_a \the\numexpr \xintNum{#2}.\xint_c_i \XINTdigits\XINT_FL_fac_out{#1[\XINTdigits]}% }% -\def\XINT_flfac_opt #1[\xint_relax #2]% +\def\XINT_flfac_opt #1[\xint:#2]% {% \expandafter\XINT_flfac_opt_a\the\numexpr #2.#1% }% @@ -2439,7 +2449,11 @@ \krof }% \def\XINT_FL_fac_iszero #1.#2#3#4#5{#5{1[0]}}% -\def\XINT_FL_fac_isneg #1.#2#3#4#5{\expandafter\xintError:FactorialOfNegative #5{0[0]}}% +\def\XINT_FL_fac_isneg #1.#2#3#4#5% +{% + #5{\XINT_signalcondition{InvalidOperation} + {Factorial of negative: (-#1)!}{}{0[0]}}% +}% \def\XINT_FL_fac_fork_b #1.% {% \ifnum #1>\xint_c_x^viii_mone\xint_dothis\XINT_FL_fac_toobig\fi @@ -2449,7 +2463,11 @@ \xint_orthat\XINT_FL_fac_small #1.% }% -\def\XINT_FL_fac_toobig #1.#2#3#4#5{\expandafter\xintError:TooBigFactorial #5{1[0]}}% +\def\XINT_FL_fac_toobig #1.#2#3#4#5% +{% + #5{\XINT_signalcondition{InvalidOperation} + {Factorial of too big: (#1)!}{}{0[0]}}% +}% \def\XINT_FL_fac_vbig {\expandafter\XINT_FL_fac_vbigloop_a \the\numexpr \XINT_FL_fac_increaseP \xint_c_i }% @@ -2470,8 +2488,10 @@ }% \def\XINT_FL_fac_countdigits #1#2#3#4#5#6#7#8{\XINT_FL_fac_countdone }% \def\XINT_FL_fac_countdone #1#2\Z {#1}% -\def\XINT_FL_fac_out #1\Z![#2]#3{#3{\romannumeral0\XINT_mul_out - #1\Z!1\R!1\R!1\R!1\R!1\R!1\R!1\R!1\R!\W [#2]}}% +\def\XINT_FL_fac_out #1;![#2]#3% + {#3{\romannumeral0\XINT_mul_out + #1;!1\R!1\R!1\R!1\R!% + 1\R!1\R!1\R!1\R!\W [#2]}}% \def\XINT_FL_fac_vbigloop_a #1.#2.% {% \XINT_FL_fac_bigloop_a \xint_c_x^iv.#2.% @@ -2555,9 +2575,10 @@ \def\XINT_FL_fac_addzeros #1.% {% \ifnum #1=\xint_c_viii \expandafter\XINT_FL_fac_addzeros_exit\fi - \expandafter\XINT_FL_fac_addzeros\the\numexpr #1-\xint_c_viii.100000000!% + \expandafter\XINT_FL_fac_addzeros + \the\numexpr #1-\xint_c_viii.100000000!% }% -\def\XINT_FL_fac_addzeros_exit #1.#2.#3#4{\XINT_FL_fac_smallloop_loop #3#21\Z![-#4]}% +\def\XINT_FL_fac_addzeros_exit #1.#2.#3#4{\XINT_FL_fac_smallloop_loop #3#21;![-#4]}% \def\XINT_FL_fac_smallloop_loop #1.#2.% {% \ifnum #1>#2 \expandafter\XINT_FL_fac_loop_exit\fi @@ -2577,7 +2598,7 @@ \def\XINT_FL_fac_mul_a #1-#2% {% \if#21\xint_afterfi{\expandafter\space\xint_gob_til_exclam}\else - \expandafter\space\fi #11\Z!% + \expandafter\space\fi #11;!% }% \def\XINT_FL_fac_minimulwc_a #1#2#3#4#5!#6#7#8#9% {% @@ -2586,18 +2607,18 @@ \def\XINT_FL_fac_minimulwc_b #1#2#3#4!#5% {% \expandafter\XINT_FL_fac_minimulwc_c - \the\numexpr \xint_c_x^ix+#5+#2*#4.{{#1}{#2}{#3}{#4}}% + \the\numexpr \xint_c_x^ix+#5+#2*#4!{{#1}{#2}{#3}{#4}}% }% -\def\XINT_FL_fac_minimulwc_c 1#1#2#3#4#5#6.#7% +\def\XINT_FL_fac_minimulwc_c 1#1#2#3#4#5#6!#7% {% \expandafter\XINT_FL_fac_minimulwc_d {#1#2#3#4#5}#7{#6}% }% \def\XINT_FL_fac_minimulwc_d #1#2#3#4#5% {% \expandafter\XINT_FL_fac_minimulwc_e - \the\numexpr \xint_c_x^ix+#1+#2*#5+#3*#4.{#2}{#4}% + \the\numexpr \xint_c_x^ix+#1+#2*#5+#3*#4!{#2}{#4}% }% -\def\XINT_FL_fac_minimulwc_e 1#1#2#3#4#5#6.#7#8#9% +\def\XINT_FL_fac_minimulwc_e 1#1#2#3#4#5#6!#7#8#9% {% 1#6#9\expandafter!% \the\numexpr\expandafter\XINT_FL_fac_smallmul @@ -2605,10 +2626,10 @@ }% \def\XINT_FL_fac_smallmul 1#1!#21#3!% {% - \xint_gob_til_Z #3\XINT_FL_fac_smallmul_end\Z + \xint_gob_til_sc #3\XINT_FL_fac_smallmul_end;% \XINT_FL_fac_minimulwc_a #2!#3!{#1}{#2}% }% -\def\XINT_FL_fac_smallmul_end\Z\XINT_FL_fac_minimulwc_a #1!\Z!#2#3[#4]% +\def\XINT_FL_fac_smallmul_end;\XINT_FL_fac_minimulwc_a #1!;!#2#3[#4]% {% \ifnum #2=\xint_c_ \expandafter\xint_firstoftwo\else @@ -2619,9 +2640,9 @@ [\the\numexpr #4+\xint_c_viii]}% }% \def\xintFloatPFactorial {\romannumeral0\xintfloatpfactorial}% -\def\xintfloatpfactorial #1{\XINT_flpfac_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatpfactorial #1{\XINT_flpfac_chkopt \xintfloat #1\xint:}% \def\XINTinFloatPFactorial {\romannumeral0\XINTinfloatpfactorial }% -\def\XINTinfloatpfactorial #1{\XINT_flpfac_chkopt \XINTinfloat #1\xint_relax }% +\def\XINTinfloatpfactorial #1{\XINT_flpfac_chkopt \XINTinfloat #1\xint:}% \def\XINT_flpfac_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flpfac_opt @@ -2629,13 +2650,13 @@ \fi #1#2% }% -\def\XINT_flpfac_noopt #1#2\xint_relax #3% +\def\XINT_flpfac_noopt #1#2\xint:#3% {% \expandafter\XINT_FL_pfac_fork \the\numexpr \xintNum{#2}\expandafter.% \the\numexpr \xintNum{#3}.\xint_c_i{\XINTdigits}{#1[\XINTdigits]}% }% -\def\XINT_flpfac_opt #1[\xint_relax #2]% +\def\XINT_flpfac_opt #1[\xint:#2]% {% \expandafter\XINT_flpfac_opt_b\the\numexpr #2.#1% }% @@ -2653,7 +2674,11 @@ \ifnum #3#4>\xint_c_x^viii_mone\xint_dothis\XINT_FL_pfac_outofrange\fi \xint_orthat \XINT_FL_pfac_increaseP #1#2.#3#4.% }% -\def\XINT_FL_pfac_outofrange #1.#2.#3#4#5{\xintError:OutOfRangePFac #5{0[0]}}% +\def\XINT_FL_pfac_outofrange #1.#2.#3#4#5% +{% + #5{\XINT_signalcondition{InvalidOperation} + {pfactorial second arg too big: 99999999 < #2}{}{0[0]}}% +}% \def\XINT_FL_pfac_one #1.#2.#3#4#5{#5{1[0]}}% \def\XINT_FL_pfac_zero #1.#2.#3#4#5{#5{0[0]}}% \def\XINT_FL_pfac_neg -#1.-#2.% @@ -2676,7 +2701,7 @@ {% \expandafter\XINT_FL_pfac_b\the\numexpr \xint_c_i+#2\expandafter.% \the\numexpr#3\expandafter.% - \romannumeral0\XINT_FL_pfac_addzeroes #1.100000001!1\Z![-#1]% + \romannumeral0\XINT_FL_pfac_addzeroes #1.100000001!1;![-#1]% }% \def\XINT_FL_pfac_addzeroes #1.% {% @@ -2797,21 +2822,21 @@ \the\numexpr \xint_c_x^viii+#1!% }% \def\xintFloatBinomial {\romannumeral0\xintfloatbinomial}% -\def\xintfloatbinomial #1{\XINT_flbinom_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatbinomial #1{\XINT_flbinom_chkopt \xintfloat #1\xint:}% \def\XINTinFloatBinomial {\romannumeral0\XINTinfloatbinomial }% -\def\XINTinfloatbinomial #1{\XINT_flbinom_chkopt \XINTinfloat #1\xint_relax }% +\def\XINTinfloatbinomial #1{\XINT_flbinom_chkopt \XINTinfloat #1\xint:}% \def\XINT_flbinom_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flbinom_opt \else\expandafter\XINT_flbinom_noopt \fi #1#2% }% -\def\XINT_flbinom_noopt #1#2\xint_relax #3% +\def\XINT_flbinom_noopt #1#2\xint:#3% {% \expandafter\XINT_FL_binom_a \the\numexpr\xintNum{#2}\expandafter.\the\numexpr\xintNum{#3}.\XINTdigits.#1% }% -\def\XINT_flbinom_opt #1[\xint_relax #2]#3#4% +\def\XINT_flbinom_opt #1[\xint:#2]#3#4% {% \expandafter\XINT_FL_binom_a \the\numexpr\xintNum{#3}\expandafter.\the\numexpr\xintNum{#4}\expandafter.% @@ -2823,18 +2848,26 @@ }% \def\XINT_FL_binom_fork #1#2.#3#4.#5#6.% {% - \if-#5\xint_dothis \XINT_FL_binom_outofrange\fi + \if-#5\xint_dothis \XINT_FL_binom_neg\fi \if-#1\xint_dothis \XINT_FL_binom_zero\fi \if-#3\xint_dothis \XINT_FL_binom_zero\fi \if0#1\xint_dothis \XINT_FL_binom_one\fi \if0#3\xint_dothis \XINT_FL_binom_one\fi - \ifnum #5#6>\xint_c_x^viii_mone \xint_dothis\XINT_FL_binom_outofrange\fi + \ifnum #5#6>\xint_c_x^viii_mone \xint_dothis\XINT_FL_binom_toobig\fi \ifnum #1#2>#3#4 \xint_dothis\XINT_FL_binom_ab \fi \xint_orthat\XINT_FL_binom_aa #1#2.#3#4.#5#6.% }% -\def\XINT_FL_binom_outofrange #1.#2.#3.#4.#5% - {\xintError:OutOfRangeBinomial #5[#4]{0[0]}}% +\def\XINT_FL_binom_neg #1.#2.#3.#4.#5% +{% + #5[#4]{\XINT_signalcondition{InvalidOperation} + {binomial with first arg negative: #3}{}{0[0]}}% +}% +\def\XINT_FL_binom_toobig #1.#2.#3.#4.#5% +{% + #5[#4]{\XINT_signalcondition{InvalidOperation} + {binomial with first arg too big: 99999999 < #3}{}{0[0]}}% +}% \def\XINT_FL_binom_one #1.#2.#3.#4.#5{#5[#4]{1[0]}}% \def\XINT_FL_binom_zero #1.#2.#3.#4.#5{#5[#4]{0[0]}}% \def\XINT_FL_binom_aa #1.#2.#3.#4.#5% @@ -2852,21 +2885,21 @@ #2.\xint_c_iv{#4+\xint_c_i}\XINT_FL_fac_out{\XINTinfloat[#4+\xint_c_iii]}}}% }% \def\xintFloatSqrt {\romannumeral0\xintfloatsqrt }% -\def\xintfloatsqrt #1{\XINT_flsqrt_chkopt \xintfloat #1\xint_relax }% +\def\xintfloatsqrt #1{\XINT_flsqrt_chkopt \xintfloat #1\xint:}% \def\XINTinFloatSqrt {\romannumeral0\XINTinfloatsqrt }% -\def\XINTinfloatsqrt #1{\XINT_flsqrt_chkopt \XINTinfloat #1\xint_relax }% +\def\XINTinfloatsqrt #1{\XINT_flsqrt_chkopt \XINTinfloat #1\xint:}% \def\XINT_flsqrt_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flsqrt_opt \else\expandafter\XINT_flsqrt_noopt \fi #1#2% }% -\def\XINT_flsqrt_noopt #1#2\xint_relax +\def\XINT_flsqrt_noopt #1#2\xint:% {% \expandafter\XINT_FL_sqrt_a \romannumeral0\XINTinfloat[\XINTdigits]{#2}\XINTdigits.#1% }% -\def\XINT_flsqrt_opt #1[\xint_relax #2]%#3% +\def\XINT_flsqrt_opt #1[\xint:#2]%#3% {% \expandafter\XINT_flsqrt_opt_a\the\numexpr #2.#1% }% @@ -2883,7 +2916,11 @@ \krof }%[ \def\XINT_FL_sqrt_iszero #1]#2.#3{#3[#2]{0[0]}}% -\def\XINT_FL_sqrt_isneg #1]#2.#3{\xintError:RootOfNegative #3[#2]{0[0]}}% +\def\XINT_FL_sqrt_isneg #1]#2.#3% +{% + #3[#2]{\XINT_signalcondition{InvalidOperation} + {Square root of negative: -#1]}{}{0[0]}}% +}% \def\XINT_FL_sqrt_pos #1[#2]#3.% {% \expandafter\XINT_flsqrt @@ -2939,19 +2976,19 @@ #1.#200000000.#3.% }% \def\xintFloatE {\romannumeral0\xintfloate }% -\def\xintfloate #1{\XINT_floate_chkopt #1\xint_relax }% +\def\xintfloate #1{\XINT_floate_chkopt #1\xint:}% \def\XINT_floate_chkopt #1% {% \ifx [#1\expandafter\XINT_floate_opt \else\expandafter\XINT_floate_noopt \fi #1% }% -\def\XINT_floate_noopt #1\xint_relax +\def\XINT_floate_noopt #1\xint:% {% \expandafter\XINT_floate_post \romannumeral0\XINTinfloat[\XINTdigits]{#1}\XINTdigits.% }% -\def\XINT_floate_opt [\xint_relax #1]% +\def\XINT_floate_opt [\xint:#1]% {% \expandafter\XINT_floate_opt_a\the\numexpr #1.% }% |