diff options
author | Karl Berry <karl@freefriends.org> | 2018-03-07 21:47:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-03-07 21:47:21 +0000 |
commit | c5ba7c59f808b748529b8c2addcff69f25fe522c (patch) | |
tree | 0830268a3cce8e423c0d944cf8af6b340a159264 /Master/texmf-dist/tex/generic/xint/xintfrac.sty | |
parent | e8a6f616cd986e7153073484150a7bb260e86a06 (diff) |
xint (7mar18)
git-svn-id: svn://tug.org/texlive/trunk@46870 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintfrac.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xintfrac.sty | 339 |
1 files changed, 137 insertions, 202 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty index 8a5fec10550..4c727e3f522 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.3 2018/03/01 +%% The xint bundle 1.3a 2018/03/07 %% Copyright (C) 2013-2018 by Jean-Francois Burnol %% xintfrac: Expandable operations on fractions %% --------------------------------------------------------------- @@ -75,119 +75,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintfrac}% - [2018/03/01 1.3 Expandable operations on fractions (JFB)]% -\def\xintEq {\romannumeral0\xinteq }% -\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% -\def\xintNotEq#1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% -\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}}% -\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% -\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% -\def\xintIsZero {\romannumeral0\xintiszero }% -\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% -\def\xintIsNotZero{\romannumeral0\xintisnotzero }% -\def\xintisnotzero - #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% -\def\xintIsOne {\romannumeral0\xintisone }% -\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% -\def\xintOdd {\romannumeral0\xintodd }% -\def\xintodd #1% -{% - \ifodd\xintLDg{\xintNum{#1}} %<- intentional space - \xint_afterfi{ 1}% - \else - \xint_afterfi{ 0}% - \fi -}% -\def\xintEven {\romannumeral0\xinteven }% -\def\xinteven #1% -{% - \ifodd\xintLDg{\xintNum{#1}} %<- intentional space - \xint_afterfi{ 0}% - \else - \xint_afterfi{ 1}% - \fi -}% -\def\xintifSgn{\romannumeral0\xintifsgn }% -\def\xintifsgn #1% -{% - \ifcase \xintSgn{#1} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop - \fi -}% -\def\xintifCmp{\romannumeral0\xintifcmp }% -\def\xintifcmp #1#2% -{% - \ifcase\xintCmp {#1}{#2} - \expandafter\xint_secondofthree_thenstop - \or\expandafter\xint_thirdofthree_thenstop - \else\expandafter\xint_firstofthree_thenstop - \fi -}% -\def\xintifEq {\romannumeral0\xintifeq }% -\def\xintifeq #1#2% -{% - \if0\xintCmp{#1}{#2}% - \expandafter\xint_firstoftwo_thenstop - \else\expandafter\xint_secondoftwo_thenstop - \fi -}% -\def\xintifGt {\romannumeral0\xintifgt }% -\def\xintifgt #1#2% -{% - \if1\xintCmp{#1}{#2}% - \expandafter\xint_firstoftwo_thenstop - \else\expandafter\xint_secondoftwo_thenstop - \fi -}% -\def\xintifLt {\romannumeral0\xintiflt }% -\def\xintiflt #1#2% -{% - \ifnum\xintCmp{#1}{#2}<\xint_c_ - \expandafter\xint_firstoftwo_thenstop - \else \expandafter\xint_secondoftwo_thenstop - \fi -}% -\def\xintifZero {\romannumeral0\xintifzero }% -\def\xintifzero #1% -{% - \if0\xintSgn{#1}% - \expandafter\xint_firstoftwo_thenstop - \else - \expandafter\xint_secondoftwo_thenstop - \fi -}% -\def\xintifNotZero{\romannumeral0\xintifnotzero }% -\def\xintifnotzero #1% -{% - \if0\xintSgn{#1}% - \expandafter\xint_secondoftwo_thenstop - \else - \expandafter\xint_firstoftwo_thenstop - \fi -}% -\def\xintifOne {\romannumeral0\xintifone }% -\def\xintifone #1% -{% - \if1\xintIsOne{#1}% - \expandafter\xint_firstoftwo_thenstop - \else - \expandafter\xint_secondoftwo_thenstop - \fi -}% -\def\xintifOdd {\romannumeral0\xintifodd }% -\def\xintifodd #1% -{% - \if\xintOdd{#1}1% - \expandafter\xint_firstoftwo_thenstop - \else - \expandafter\xint_secondoftwo_thenstop - \fi -}% + [2018/03/07 1.3a Expandable operations on fractions (JFB)]% \def\XINT_cntSgnFork #1% {% \ifcase #1\expandafter\xint_secondofthree @@ -367,98 +255,148 @@ {#3}{#1#2}% }% \def\XINT_frac_gen_zero 0#1#2#3{{0}{0}{1}}% -\def\XINT_factortens #1% -{% - \expandafter\XINT_cuz_cnt_loop\expandafter - {\expandafter}\romannumeral0\XINT_rord_main {}#1% - \xint: - \xint_bye\xint_bye\xint_bye\xint_bye - \xint_bye\xint_bye\xint_bye\xint_bye - \xint: - \R\R\R\R\R\R\R\R\Z -}% -\def\XINT_cuz_cnt #1% -{% - \XINT_cuz_cnt_loop {}#1\R\R\R\R\R\R\R\R\Z -}% -\def\XINT_cuz_cnt_loop #1#2#3#4#5#6#7#8#9% +\def\XINT_factortens #1{\expandafter\XINT_factortens_z + \romannumeral0\XINT_factortens_a#1% + \XINT_factortens_b123456789.}% +\def\XINT_factortens_z.\XINT_factortens_y{ }% +\def\XINT_factortens_a #1#2#3#4#5#6#7#8#9% + {\expandafter\XINT_factortens_x + \the\numexpr 1#1#2#3#4#5#6#7#8#9\XINT_factortens_a}% +\def\XINT_factortens_b#1\XINT_factortens_a#2#3.% + {.\XINT_factortens_cc 000000000-#2.}% +\def\XINT_factortens_x1#1.#2{#2#1}% +\def\XINT_factortens_y{.\XINT_factortens_y}% +\def\XINT_factortens_cc #1#2#3#4#5#6#7#8#9% + {\if#90\xint_dothis + {\expandafter\XINT_factortens_d\the\numexpr #8#7#6#5#4#3#2#1\relax + \xint_c_i 2345678.}\fi + \xint_orthat{\XINT_factortens_yy{#1#2#3#4#5#6#7#8#9}}}% +\def\XINT_factortens_yy #1#2.{.\XINT_factortens_y#1.0.}% +\def\XINT_factortens_c #1#2#3#4#5#6#7#8#9% + {\if#90\xint_dothis + {\expandafter\XINT_factortens_d\the\numexpr #8#7#6#5#4#3#2#1\relax + \xint_c_i 2345678.}\fi + \xint_orthat{.\XINT_factortens_y #1#2#3#4#5#6#7#8#9.}}% +\def\XINT_factortens_d #1#2#3#4#5#6#7#8#9% + {\if#10\expandafter\XINT_factortens_e\fi + \XINT_factortens_f #9#9#8#7#6#5#4#3#2#1.}% +\def\XINT_factortens_f #1#2\xint_c_i#3.#4.#5.% + {\expandafter\XINT_factortens_g\the\numexpr#1+#5.#3.}% +\def\XINT_factortens_g #1.#2.{.\XINT_factortens_y#2.#1.}% +\def\XINT_factortens_e #1..#2.% + {\expandafter.\expandafter\XINT_factortens_c + \the\numexpr\xint_c_ix+#2.}% +\def\xintEq {\romannumeral0\xinteq }% +\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}% +\def\xintNotEq#1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}% +\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}}% +\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}% +\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}% +\def\xintIsZero {\romannumeral0\xintiszero }% +\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}% +\def\xintIsNotZero{\romannumeral0\xintisnotzero }% +\def\xintisnotzero + #1{\if0\xintSgn{#1}\xint_afterfi{ 0}\else\xint_afterfi{ 1}\fi}% +\def\xintIsOne {\romannumeral0\xintisone }% +\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}XY}% +\def\xintOdd {\romannumeral0\xintodd }% +\def\xintodd #1% {% - \xint_gob_til_R #9\XINT_cuz_cnt_toofara \R - \expandafter\XINT_cuz_cnt_checka\expandafter - {\the\numexpr #1+8\relax}{#2#3#4#5#6#7#8#9}% + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 1}% + \else + \xint_afterfi{ 0}% + \fi }% -\def\XINT_cuz_cnt_toofara\R - \expandafter\XINT_cuz_cnt_checka\expandafter #1#2% +\def\xintEven {\romannumeral0\xinteven }% +\def\xinteven #1% {% - \XINT_cuz_cnt_toofarb {#1}#2% + \ifodd\xintLDg{\xintNum{#1}} %<- intentional space + \xint_afterfi{ 0}% + \else + \xint_afterfi{ 1}% + \fi }% -\def\XINT_cuz_cnt_toofarb #1#2\Z {\XINT_cuz_cnt_toofarc #2\Z {#1}}% -\def\XINT_cuz_cnt_toofarc #1#2#3#4#5#6#7#8% +\def\xintifSgn{\romannumeral0\xintifsgn }% +\def\xintifsgn #1% {% - \xint_gob_til_R #2\XINT_cuz_cnt_toofard 7% - #3\XINT_cuz_cnt_toofard 6% - #4\XINT_cuz_cnt_toofard 5% - #5\XINT_cuz_cnt_toofard 4% - #6\XINT_cuz_cnt_toofard 3% - #7\XINT_cuz_cnt_toofard 2% - #8\XINT_cuz_cnt_toofard 1% - \Z #1#2#3#4#5#6#7#8% + \ifcase \xintSgn{#1} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi }% -\def\XINT_cuz_cnt_toofard #1#2\Z #3\R #4\Z #5% +\def\xintifCmp{\romannumeral0\xintifcmp }% +\def\xintifcmp #1#2% {% - \expandafter\XINT_cuz_cnt_toofare - \the\numexpr #3\relax \R\R\R\R\R\R\R\R\Z - {\the\numexpr #5-#1\relax}\R\Z + \ifcase\xintCmp {#1}{#2} + \expandafter\xint_secondofthree_thenstop + \or\expandafter\xint_thirdofthree_thenstop + \else\expandafter\xint_firstofthree_thenstop + \fi }% -\def\XINT_cuz_cnt_toofare #1#2#3#4#5#6#7#8% +\def\xintifEq {\romannumeral0\xintifeq }% +\def\xintifeq #1#2% {% - \xint_gob_til_R #2\XINT_cuz_cnt_stopc 1% - #3\XINT_cuz_cnt_stopc 2% - #4\XINT_cuz_cnt_stopc 3% - #5\XINT_cuz_cnt_stopc 4% - #6\XINT_cuz_cnt_stopc 5% - #7\XINT_cuz_cnt_stopc 6% - #8\XINT_cuz_cnt_stopc 7% - \Z #1#2#3#4#5#6#7#8% + \if0\xintCmp{#1}{#2}% + \expandafter\xint_firstoftwo_thenstop + \else\expandafter\xint_secondoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_checka #1#2% +\def\xintifGt {\romannumeral0\xintifgt }% +\def\xintifgt #1#2% {% - \expandafter\XINT_cuz_cnt_checkb\the\numexpr #2\relax \Z {#1}% + \if1\xintCmp{#1}{#2}% + \expandafter\xint_firstoftwo_thenstop + \else\expandafter\xint_secondoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_checkb #1% +\def\xintifLt {\romannumeral0\xintiflt }% +\def\xintiflt #1#2% {% - \xint_gob_til_zero #1\expandafter\XINT_cuz_cnt_loop\xint_gob_til_Z - 0\XINT_cuz_cnt_stopa #1% + \ifnum\xintCmp{#1}{#2}<\xint_c_ + \expandafter\xint_firstoftwo_thenstop + \else \expandafter\xint_secondoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_stopa #1\Z +\def\xintifZero {\romannumeral0\xintifzero }% +\def\xintifzero #1% {% - \XINT_cuz_cnt_stopb #1\R\R\R\R\R\R\R\R\Z % + \if0\xintSgn{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_stopb #1#2#3#4#5#6#7#8#9% +\def\xintifNotZero{\romannumeral0\xintifnotzero }% +\def\xintifnotzero #1% {% - \xint_gob_til_R #2\XINT_cuz_cnt_stopc 1% - #3\XINT_cuz_cnt_stopc 2% - #4\XINT_cuz_cnt_stopc 3% - #5\XINT_cuz_cnt_stopc 4% - #6\XINT_cuz_cnt_stopc 5% - #7\XINT_cuz_cnt_stopc 6% - #8\XINT_cuz_cnt_stopc 7% - #9\XINT_cuz_cnt_stopc 8% - \Z #1#2#3#4#5#6#7#8#9% + \if0\xintSgn{#1}% + \expandafter\xint_secondoftwo_thenstop + \else + \expandafter\xint_firstoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_stopc #1#2\Z #3\R #4\Z #5% +\def\xintifOne {\romannumeral0\xintifone }% +\def\xintifone #1% {% - \expandafter\XINT_cuz_cnt_stopd\expandafter - {\the\numexpr #5-#1}#3% + \if1\xintIsOne{#1}% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi }% -\def\XINT_cuz_cnt_stopd #1#2\R #3\Z +\def\xintifOdd {\romannumeral0\xintifodd }% +\def\xintifodd #1% {% - \expandafter\space\expandafter - {\romannumeral0\XINT_rord_main {}#2% - \xint: - \xint_bye\xint_bye\xint_bye\xint_bye - \xint_bye\xint_bye\xint_bye\xint_bye - \xint:}{#1}% + \if\xintOdd{#1}1% + \expandafter\xint_firstoftwo_thenstop + \else + \expandafter\xint_secondoftwo_thenstop + \fi }% \def\xintRaw {\romannumeral0\xintraw }% \def\xintraw @@ -689,16 +627,15 @@ {% \expandafter\XINT_rez_C\romannumeral0\XINT_factortens {#1}% }% -\def\XINT_rez_C #1#2#3#4% +\def\XINT_rez_C #1.#2.#3#4% {% - \expandafter\XINT_rez_D\romannumeral0\XINT_factortens {#4}{#3}{#2}{#1}% + \expandafter\XINT_rez_D\romannumeral0\XINT_factortens {#4}#3+#2.#1.% }% -\def\XINT_rez_D #1#2#3#4#5% +\def\XINT_rez_D #1.#2.#3.% {% - \expandafter\XINT_rez_E\expandafter - {\the\numexpr #3+#4-#2}{#1}{#5}% + \expandafter\XINT_rez_E\the\numexpr #3-#2.#1.% }% -\def\XINT_rez_E #1#2#3{ #3/#2[#1]}% +\def\XINT_rez_E #1.#2.#3.{ #3/#2[#1]}% \def\xintE {\romannumeral0\xinte }% \def\xinte #1% {% @@ -3276,17 +3213,15 @@ {#1}% }% \def\XINT_infloatdivmod #1#2#3{ #1,\XINTinFloat[#3]{#2}}% -\ifdefined\documentclass\ifdefined\AtEndDocument - \AtEndDocument{% -\XINT_ifFlagRaised{Deprecated-xintfrac}% - {\PackageError{xintfrac} -{Usage of deprecated macros!} -{This deprecated macro from xintfrac.sty has been detected:\MessageBreak -\string\xintNeq\space(use \string\xintNotEq\space or xint's \string\xintiiNotEq!)\MessageBreak -This is impossible as it has been removed at 1.3!}}% - {% no deprecated macro used (at top level...) - }% -}\fi\fi +\def\xintifFloatInt {\romannumeral0\xintiffloatint}% +\def\xintiffloatint #1{\expandafter\XINT_iffloatint + \romannumeral0\xintrez{\XINTinFloat[\XINTdigits]{#1}}}% +\def\XINT_iffloatint #1#2/1[#3]% +{% + \if 0#1\xint_dothis\xint_firstoftwo_thenstop\fi + \ifnum#3<\xint_c_\xint_dothis\xint_secondoftwo_thenstop\fi + \xint_orthat\xint_firstoftwo_thenstop +}% \XINT_restorecatcodes_endinput% \endinput %% |