From d7b336d29865600e490cf2c0a4e209e13cb2988c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 7 Apr 2019 21:22:39 +0000 Subject: xint (7apr19) git-svn-id: svn://tug.org/texlive/trunk@50844 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/generic/xint/xint.sty | 15 +- Master/texmf-dist/tex/generic/xint/xintbinhex.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintcfrac.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintcore.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintexpr.sty | 766 +++++++++++++++------- Master/texmf-dist/tex/generic/xint/xintfrac.sty | 53 +- Master/texmf-dist/tex/generic/xint/xintgcd.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintkernel.sty | 7 +- Master/texmf-dist/tex/generic/xint/xintlog.sty | 118 ++++ Master/texmf-dist/tex/generic/xint/xintseries.sty | 4 +- Master/texmf-dist/tex/generic/xint/xinttools.sty | 4 +- Master/texmf-dist/tex/generic/xint/xinttrig.sty | 500 ++++++++++++++ 12 files changed, 1223 insertions(+), 260 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/xint/xintlog.sty create mode 100644 Master/texmf-dist/tex/generic/xint/xinttrig.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty index f8413488235..4137ad675a7 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.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xint: Expandable operations on big integers %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty) \XINT_providespackage \ProvidesPackage{xint}% - [2019/01/06 1.3d Expandable operations on big integers (JFB)]% + [2019/04/05 1.3e 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}% @@ -98,6 +98,17 @@ {% \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof }% +\def\xintiiLogTen {\the\numexpr\xintiilogten }% +\def\xintiilogten #1% +{% + \expandafter\XINT_iilogten\romannumeral`&&@#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 +}% +\def\XINT_iilogten #1{\if#10-"7FFF8000\fi -1+% + \expandafter\XINT_length_loop\xint_UDsignfork#1{}-#1\krof}% \def\xintReverseDigits {\romannumeral0\xintreversedigits }% \def\xintreversedigits #1% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty index a1799fbc3da..07e52be6dfc 100644 --- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty +++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintbinhex: Expandable binary and hexadecimal conversions %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintbinhex}% - [2019/01/06 1.3d Expandable binary and hexadecimal conversions (JFB)]% + [2019/04/05 1.3e Expandable binary and hexadecimal conversions (JFB)]% \newcount\xint_c_ii^xv \xint_c_ii^xv 32768 \newcount\xint_c_ii^xvi \xint_c_ii^xvi 65536 \def\XINT_tmpa #1{\ifx\relax#1\else diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty index 530d6e3db7e..c62037bbc24 100644 --- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintcfrac: Expandable continued fractions with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintcfrac}% - [2019/01/06 1.3d Expandable continued fractions with xint package (JFB)]% + [2019/04/05 1.3e Expandable continued fractions with xint package (JFB)]% \def\xintCFrac {\romannumeral0\xintcfrac }% \def\xintcfrac #1% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintcore.sty b/Master/texmf-dist/tex/generic/xint/xintcore.sty index b93057a82bd..b0f8ff5d0f2 100644 --- a/Master/texmf-dist/tex/generic/xint/xintcore.sty +++ b/Master/texmf-dist/tex/generic/xint/xintcore.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintcore: Expandable arithmetic on big integers %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintcore}% - [2019/01/06 1.3d Expandable arithmetic on big integers (JFB)]% + [2019/04/05 1.3e Expandable arithmetic on big integers (JFB)]% \csname XINT_Clamped_istrapped\endcsname \csname XINT_ConversionSyntax_istrapped\endcsname \csname XINT_DivisionByZero_istrapped\endcsname diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty index 13bbb335437..8ed1191fb8a 100644 --- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty +++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintexpr: Expandable expression parser %% --------------------------------------------------------------- @@ -81,142 +81,154 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintexpr}% - [2019/01/06 1.3d Expandable expression parser (JFB)]% + [2019/04/05 1.3e Expandable expression parser (JFB)]% \catcode`! 11 \let\XINT_Cmp \xintiiCmp -\def\xint_gob_til_! #1!{}% ! with catcode 11 -\def\XINT_expr_lockscan#1{% not used for decimal numbers in xintexpr 1.2 -\def\XINT_expr_lockscan##1!{\expandafter#1\csname .=##1\endcsname}% -}\XINT_expr_lockscan{ }% -\def\XINT_expr_lockit#1{% -\def\XINT_expr_lockit##1{\expandafter#1\csname .=##1\endcsname}% -}\XINT_expr_lockit{ }% -\def\XINT_expr_unlock_hex_in #1% expanded inside \csname..\endcsname - {\expandafter\XINT_expr_inhex\romannumeral`&&@\XINT_expr_unlock#1;}% -\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname -{% - \if#2>% - \xintHexToDec{#1}% - \else - \xintiiMul{\xintiiPow{625}{\xintLength{#3}}}{\xintHexToDec{#1#3}}% - [\the\numexpr-4*\xintLength{#3}]% - \fi -}% -\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }% -\def\XINT_expr_unlock_a #1.={}% -\def\XINT_expr_unexpectedtoken {\xintError:ignored }% -\let\XINT_expr_done\space -\def\XINT_expr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_expr_print }% -\def\XINT_iiexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_iiexpr_print }% -\def\XINT_protectii #1{\noexpand\XINT_protectii\noexpand #1\noexpand }% -\protected\def\XINT_expr_usethe\XINT_protectii {\xintError:missing_xintthe!}% -\def\XINT_expr_print #1{\xintSPRaw::csv {\XINT_expr_unlock #1}}% -\def\XINT_iiexpr_print #1{\xintCSV::csv {\XINT_expr_unlock #1}}% -\def\XINT_boolexpr_print #1{\xintIsTrue::csv {\XINT_expr_unlock #1}}% \def\xintexpr {\romannumeral0\xintexpro }% \def\xintiexpr {\romannumeral0\xintiexpro }% \def\xintfloatexpr {\romannumeral0\xintfloatexpro }% \def\xintiiexpr {\romannumeral0\xintiiexpro }% -\def\xinttheexpr - {\romannumeral`&&@\expandafter\XINT_expr_print\romannumeral0\xintbareeval}% -\def\xinttheiexpr - {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintiexpr}% -\def\xintthefloatexpr - {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintfloatexpr}% -\def\xinttheiiexpr - {\romannumeral`&&@\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval}% -\def\xinteval #1% - {\romannumeral`&&@\expandafter\XINT_expr_print\romannumeral0\xintbareeval#1\relax}% -\def\xintieval #1% - {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintiexpr#1\relax}% -\def\xintfloateval #1% - {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintfloatexpr#1\relax}% -\def\xintiieval #1% - {\romannumeral`&&@\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval#1\relax}% -\def\xintthe #1{\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@#1}% -\def\xintthe_o #1{\expandafter\xint_gobble_iii\romannumeral`&&@#1}% -\let\thexintexpr \xinttheexpr -\let\thexintiexpr \xinttheiexpr -\let\thexintfloatexpr\xintthefloatexpr -\let\thexintiiexpr \xinttheiiexpr -\def\xintthecoords #1{\romannumeral`&&@\expandafter\expandafter\expandafter - \XINT_thecoords_a - \expandafter\xint_gobble_iii\romannumeral0#1}% -\def\XINT_thecoords_a #1#2% #1=print macro, indispensible for scientific notation - {\expandafter\XINT_expr_unlock\csname.=\expandafter\XINT_thecoords_b - \romannumeral`&&@#1#2,!,!,^\endcsname }% -\def\XINT_thecoords_b #1#2,#3#4,% - {\xint_gob_til_! #3\XINT_thecoords_c ! (#1#2, #3#4)\XINT_thecoords_b }% -\def\XINT_thecoords_c #1^{}% -\def\xintbareeval - {\expandafter\XINT_expr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% -\def\xintbarefloateval - {\expandafter\XINT_flexpr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% -\def\xintbareiieval - {\expandafter\XINT_iiexpr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% -\def\xintthebareeval {\expandafter\XINT_expr_unlock\romannumeral0\xintbareeval}% -\def\xintthebarefloateval {\expandafter\XINT_expr_unlock\romannumeral0\xintbarefloateval}% -\def\xintthebareiieval {\expandafter\XINT_expr_unlock\romannumeral0\xintbareiieval}% \def\xintexpro {\expandafter\XINT_expr_wrap\romannumeral0\xintbareeval }% \def\xintiiexpro {\expandafter\XINT_iiexpr_wrap\romannumeral0\xintbareiieval }% \def\xintiexpro #1% - {\ifx [#1\expandafter\XINT_iexpr_withopt\else\expandafter\XINT_iexpr_noopt \fi #1}% +{% + \ifx [#1\expandafter\XINT_iexpr_withopt\else\expandafter\XINT_iexpr_noopt + \fi #1% +}% \def\XINT_iexpr_noopt - {\expandafter\XINT_iexpr_wrap \expandafter 0\romannumeral0\xintbareeval }% +{% + \expandafter\XINT_iexpr_preprint\expandafter 0% + \romannumeral0\xintbareeval +}% \def\XINT_iexpr_withopt [#1]% {% - \expandafter\XINT_iexpr_wrap\expandafter + \expandafter\XINT_iexpr_preprint\expandafter {\the\numexpr \xint_zapspaces #1 \xint_gobble_i\expandafter}% \romannumeral0\xintbareeval }% -\def\XINT_iexpr_wrap #1#2% +\def\XINT_iexpr_preprint #1#2% {% \expandafter\XINT_expr_wrap \csname .=\xintRound::csv {#1}{\XINT_expr_unlock #2}\endcsname }% \def\xintfloatexpro #1% {% - \ifx [#1\expandafter\XINT_flexpr_withopt_a\else\expandafter\XINT_flexpr_noopt + \ifx [#1\expandafter\XINT_flexpr_withopt\else\expandafter\XINT_flexpr_noopt \fi #1% }% \def\XINT_flexpr_noopt {% - \expandafter\XINT_flexpr_withopt_b\expandafter\xinttheDigits - \romannumeral0\xintbarefloateval + \expandafter\XINT_flexpr_preprint\expandafter\xinttheDigits + \romannumeral0\xintbarefloateval }% -\def\XINT_flexpr_withopt_a [#1]% +\def\XINT_flexpr_withopt [#1]% {% - \expandafter\XINT_flexpr_withopt_b\expandafter + \expandafter\XINT_flexpr_preprint\expandafter {\the\numexpr\xint_zapspaces #1 \xint_gobble_i\expandafter}% \romannumeral0\xintbarefloateval }% -\def\XINT_flexpr_withopt_b #1#2% +\def\XINT_flexpr_preprint #1#2% {% - \expandafter\XINT_flexpr_wrap\csname .;#1.=% ; and not : as before b'cause NewExpr - \XINTinFloat::csv {#1}{\XINT_expr_unlock #2}\endcsname + \expandafter\XINT_flexpr_wrap + \csname .;#1.=\XINTinFloat::csv {#1}{\XINT_expr_unlock #2}\endcsname }% -\def\XINT_flexpr_wrap { !\XINT_expr_usethe\XINT_protectii\XINT_flexpr_print }% +\def\XINT_expr_wrap {!\XINT_expr_usethe\XINT_protectii\XINT_expr_print}% +\def\XINT_iiexpr_wrap {!\XINT_expr_usethe\XINT_protectii\XINT_iiexpr_print}% +\def\XINT_flexpr_wrap {!\XINT_expr_usethe\XINT_protectii\XINT_flexpr_print}% +\def\XINT_protectii #1{\noexpand\XINT_protectii\noexpand #1\noexpand }% +\protected\def\XINT_expr_usethe\XINT_protectii {\xintError:missing_xintthe!}% +\def\XINT_expr_print #1{\xintSPRaw::csv {\XINT_expr_unlock #1}}% +\def\XINT_iiexpr_print #1{\xintCSV::csv {\XINT_expr_unlock #1}}% \def\XINT_flexpr_print #1% {% \expandafter\xintPFloat::csv \romannumeral`&&@\expandafter\XINT_expr_unlock_sp\string #1!% }% \def\XINT_expr_unlock_sp #1.;#2.=#3!{{#2}{#3}}% -\def\xintboolexpr {\romannumeral0\expandafter\expandafter\expandafter - \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xintexpro }% -\def\xinttheboolexpr {\romannumeral`&&@\expandafter\expandafter\expandafter - \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xintexpro }% +\def\xinttheexpr + {\romannumeral`&&@\expandafter\XINT_expr_print\romannumeral0\xintbareeval}% +\def\xinttheiexpr + {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintiexpr}% +\def\xintthefloatexpr + {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintfloatexpr}% +\def\xinttheiiexpr + {\romannumeral`&&@\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval}% +\let\thexintexpr \xinttheexpr +\let\thexintiexpr \xinttheiexpr +\let\thexintfloatexpr\xintthefloatexpr +\let\thexintiiexpr \xinttheiiexpr +\def\xinteval #1% + {\romannumeral`&&@\expandafter\XINT_expr_print\romannumeral0\xintbareeval#1\relax}% +\def\xintieval #1% + {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintiexpr#1\relax}% +\def\xintfloateval #1% + {\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@\xintfloatexpr#1\relax}% +\def\xintiieval #1% + {\romannumeral`&&@\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval#1\relax}% +\def\xintthe #1{\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@#1}% +\def\xintbareeval + {\expandafter\XINT_expr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% +\def\xintbarefloateval + {\expandafter\XINT_flexpr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% +\def\xintbareiieval + {\expandafter\XINT_iiexpr_until_end_a\romannumeral`&&@\XINT_expr_getnext }% +\def\xintthebareeval {\expandafter\XINT_expr_unlock\romannumeral0\xintbareeval}% +\def\xintthebarefloateval {\expandafter\XINT_expr_unlock\romannumeral0\xintbarefloateval}% +\def\xintthebareiieval {\expandafter\XINT_expr_unlock\romannumeral0\xintbareiieval}% +\def\xintboolexpr +{% + \romannumeral0\expandafter\expandafter\expandafter + \XINT_boolexpr_done\expandafter\xint_gobble_iv\romannumeral0\xintexpro +}% +\def\XINT_boolexpr_done {!\XINT_expr_usethe\XINT_protectii\XINT_boolexpr_print}% +\def\XINT_boolexpr_print #1{\xintIsTrue::csv {\XINT_expr_unlock #1}}% +\def\xinttheboolexpr +{% + \romannumeral`&&@\expandafter\expandafter\expandafter + \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xintexpro +}% \let\thexintboolexpr\xinttheboolexpr -\def\XINT_boolexpr_done { !\XINT_expr_usethe\XINT_protectii\XINT_boolexpr_print }% \def\xintifboolexpr #1{\romannumeral0\xintiiifnotzero {\xinttheexpr #1\relax}}% \def\xintifboolfloatexpr #1{\romannumeral0\xintiiifnotzero {\xintthefloatexpr #1\relax}}% \def\xintifbooliiexpr #1{\romannumeral0\xintiiifnotzero {\xinttheiiexpr #1\relax}}% \def\xintifsgnexpr #1{\romannumeral0\xintiiifsgn {\xinttheexpr #1\relax}}% \def\xintifsgnfloatexpr #1{\romannumeral0\xintiiifsgn {\xintthefloatexpr #1\relax}}% \def\xintifsgniiexpr #1{\romannumeral0\xintiiifsgn {\xinttheiiexpr #1\relax}}% -\let\XINT:NEhook:two\empty +\def\xintthecoords #1{\romannumeral`&&@\expandafter\expandafter\expandafter + \XINT_thecoords_a + \expandafter\xint_gobble_iii\romannumeral0#1}% +\def\XINT_thecoords_a #1#2% #1=print macro, indispensible for scientific notation + {\expandafter\XINT_expr_unlock\csname.=\expandafter\XINT_thecoords_b + \romannumeral`&&@#1#2,!,!,^\endcsname }% +\def\XINT_thecoords_b #1#2,#3#4,% + {\xint_gob_til_! #3\XINT_thecoords_c ! (#1#2, #3#4)\XINT_thecoords_b }% +\def\XINT_thecoords_c #1^{}% +\def\xint_gob_til_! #1!{}% ! with catcode 11 +\def\XINT_expr_lockscan#1{% not used for decimal numbers in xintexpr 1.2 +\def\XINT_expr_lockscan##1!{\expandafter#1\csname .=##1\endcsname}% +}\XINT_expr_lockscan{ }% +\def\XINT_expr_lockit#1{% +\def\XINT_expr_lockit##1{\expandafter#1\csname .=##1\endcsname}% +}\XINT_expr_lockit{ }% +\def\XINT_expr_unlock_hex_in #1% expanded inside \csname..\endcsname + {\expandafter\XINT_expr_inhex\romannumeral`&&@\XINT_expr_unlock#1;}% +\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname +{% + \if#2>% + \xintHexToDec{#1}% + \else + \xintiiMul{\xintiiPow{625}{\xintLength{#3}}}{\xintHexToDec{#1#3}}% + [\the\numexpr-4*\xintLength{#3}]% + \fi +}% +\def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }% +\def\XINT_expr_unlock_a #1.={}% +\def\XINT_expr_unexpectedtoken {\xintError:ignored }% +\let\XINT_expr_done\space \let\XINT:NEhook:one\empty +\let\XINT:NEhook:two\empty \let\XINT:NEhook:csv\empty +\def\XINT:NEhook:twosp #1,#2,!#3{#3{#1}{#2}}% \def\XINT_::_end #1,#2{\xint_gobble_i #2}% \def\xintCSV::csv #1{\expandafter\XINT_csv::_a\romannumeral`&&@#1,^,}% \def\XINT_csv::_a {\XINT_csv::_b {}}% @@ -245,34 +257,39 @@ \def\XINT_istrue::_d #1,{\expandafter\XINT_istrue::_e\romannumeral0\xintisnotzero {#1},}% \def\XINT_istrue::_e #1,#2{\XINT_istrue::_b {#2, #1}}% \def\XINT_:::_end #1,#2#3{\xint_gobble_i #3}% -\def\xintRound::csv #1#2{\romannumeral0\expandafter\XINT_round::_b\expandafter - {\the\numexpr#1\expandafter}\expandafter{\expandafter}\romannumeral`&&@#2,^,}% -\def\XINT_round::_b #1#2#3,{\expandafter\XINT_round::_c \romannumeral`&&@#3,{#1}{#2}}% +\def\xintRound::csv #1#2{\romannumeral0\expandafter\XINT_round::_a + \the\numexpr#1\expandafter.\romannumeral`&&@#2,^,}% +\def\XINT_round::_a #1.{\XINT_round::_b #1.{}}% +\def\XINT_round::_b #1.#2#3,{\expandafter\XINT_round::_c \romannumeral`&&@#3,{#1}{#2}}% \def\XINT_round::_c #1{\if ,#1\xint_dothis\XINT_round::_e\fi \if ^#1\xint_dothis\XINT_:::_end\fi \xint_orthat\XINT_round::_d #1}% \def\XINT_round::_d #1,#2{% \expandafter\XINT_round::_e\romannumeral0\ifnum#2>\xint_c_ \expandafter\xintround\else\expandafter\xintiround\fi {#2}{#1},{#2}}% -\def\XINT_round::_e #1,#2#3{\XINT_round::_b {#2}{#3, #1}}% -\def\XINTinFloat::csv #1#2{\romannumeral0\expandafter\XINT_infloat::_b\expandafter - {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral`&&@#2,^,}% -\def\XINT_infloat::_b #1#2#3,{\XINT_infloat::_c #3,{#1}{#2}}% +\def\XINT_round::_e #1,#2#3{\XINT_round::_b #2.{#3, #1}}% +\def\XINTinFloat::csv #1#2{\romannumeral0\expandafter\XINT_infloat::_a + \the\numexpr #1\expandafter.\romannumeral`&&@#2,^,}% +\def\XINT_infloat::_a #1#2.% + {\expandafter\XINT_infloat::_b\the\numexpr\if#1-\XINTdigits\fi#1#2.{}}% +\def\XINT_infloat::_b #1.#2#3,{\XINT_infloat::_c #3,{#1}{#2}}% \def\XINT_infloat::_c #1{\if ,#1\xint_dothis\XINT_infloat::_e\fi \if ^#1\xint_dothis\XINT_:::_end\fi \xint_orthat\XINT_infloat::_d #1}% \def\XINT_infloat::_d #1,#2% {\expandafter\XINT_infloat::_e\romannumeral0\XINTinfloat [#2]{#1},{#2}}% -\def\XINT_infloat::_e #1,#2#3{\XINT_infloat::_b {#2}{#3, #1}}% -\def\xintPFloat::csv #1#2{\romannumeral0\expandafter\XINT_pfloat::_b\expandafter - {\the\numexpr #1\expandafter}\expandafter{\expandafter}\romannumeral`&&@#2,^,}% -\def\XINT_pfloat::_b #1#2#3,{\expandafter\XINT_pfloat::_c \romannumeral`&&@#3,{#1}{#2}}% +\def\XINT_infloat::_e #1,#2#3{\XINT_infloat::_b #2.{#3, #1}}% +\def\xintPFloat::csv #1#2{\romannumeral0\expandafter\XINT_pfloat::_a + \the\numexpr #1\expandafter.\romannumeral`&&@#2,^,}% +\def\XINT_pfloat::_a #1#2.% + {\expandafter\XINT_pfloat::_b\the\numexpr\if#1-\XINTdigits\fi#1#2.{}}% +\def\XINT_pfloat::_b #1.#2#3,{\expandafter\XINT_pfloat::_c \romannumeral`&&@#3,{#1}{#2}}% \def\XINT_pfloat::_c #1{\if ,#1\xint_dothis\XINT_pfloat::_e\fi \if ^#1\xint_dothis\XINT_:::_end\fi \xint_orthat\XINT_pfloat::_d #1}% \def\XINT_pfloat::_d #1,#2% {\expandafter\XINT_pfloat::_e\romannumeral0\XINT_pfloat_opt [\xint:#2]{#1},{#2}}% -\def\XINT_pfloat::_e #1,#2#3{\XINT_pfloat::_b {#2}{#3, #1}}% +\def\XINT_pfloat::_e #1,#2#3{\XINT_pfloat::_b #2.{#3, #1}}% \def\XINT_expr_getnext #1% {% \expandafter\XINT_expr_getnext_a\romannumeral`&&@#1% @@ -1446,7 +1463,7 @@ \def\XINT_expr_onliteral_qfrac #1)% {\expandafter\XINT_expr_getop\csname .=\xintRaw{#1}\endcsname }% \def\XINT_expr_onliteral_qfloat #1)% - {\expandafter\XINT_expr_getop\csname .=\XINTinFloatdigits{#1}\endcsname }% + {\expandafter\XINT_expr_getop\csname .=\XINTinFloatSdigits{#1}\endcsname }% \def\XINT_expr_onliteral_qraw #1)% {\expandafter\XINT_expr_getop\csname .=#1\endcsname }% \def\XINT_expr_onliteral_random #1)% @@ -1486,44 +1503,44 @@ \catcode`~ 13 \catcode`: 12 \def\XINT_expr_defvar_getname #1:#2~{\endgroup - \def\XINT_expr_tmpa{#1}\edef\XINT_expr_tmpc{\xintCSVLength{#1}}}% + \def\XINT_defvar_tmpa{#1}\edef\XINT_defvar_tmpc{\xintCSVLength{#1}}}% \def\XINT_expr_defvar #1#2#3;% {% \xintexprRestoreCatcodes \begingroup\lccode`~`: \lowercase{\let~}\empty - \edef\XINT_expr_tmpa{#2}% - \edef\XINT_expr_tmpa{\xint_zapspaces_o\XINT_expr_tmpa}% + \edef\XINT_defvar_tmpa{#2}% + \edef\XINT_defvar_tmpa{\xint_zapspaces_o\XINT_defvar_tmpa}% \expandafter\XINT_expr_defvar_getname - \detokenize\expandafter{\XINT_expr_tmpa}:~% - \ifcase\XINT_expr_tmpc + \detokenize\expandafter{\XINT_defvar_tmpa}:~% + \ifcase\XINT_defvar_tmpc\space \xintMessage {xintexpr}{Warning} {Aborting: not allowed to declare variable with empty name.}% \or - \edef\XINT_expr_tmpb{\romannumeral0#1#3\relax}% - \XINT_expr_defvar_one\XINT_expr_tmpa\XINT_expr_tmpb + \edef\XINT_defvar_tmpb{\romannumeral0#1#3\relax}% + \XINT_expr_defvar_one\XINT_defvar_tmpa\XINT_defvar_tmpb \else - \edef\XINT_expr_tmpb + \edef\XINT_defvar_tmpb {\expandafter\XINT_expr_unlock\romannumeral0#1#3\relax}% - \edef\XINT_expr_tmpd{\xintCSVLength{\XINT_expr_tmpb}}% - \ifnum\XINT_expr_tmpc=\XINT_expr_tmpd\space - \xintAssignArray\xintCSVtoList\XINT_expr_tmpa\to\XINT_expr_tmpvar + \edef\XINT_defvar_tmpd{\xintCSVLength{\XINT_defvar_tmpb}}% + \ifnum\XINT_defvar_tmpc=\XINT_defvar_tmpd\space + \xintAssignArray\xintCSVtoList\XINT_defvar_tmpa\to\XINT_defvar_tmpvar \xintAssignArray - \xintApply\XINT_expr_lockit{\xintCSVtoList\XINT_expr_tmpb}% - \to\XINT_expr_tmpval - \def\XINT_expr_tmpd{1}% + \xintApply\XINT_expr_lockit{\xintCSVtoList\XINT_defvar_tmpb}% + \to\XINT_defvar_tmpval + \def\XINT_defvar_tmpd{1}% \xintloop \expandafter\XINT_expr_defvar_one - \csname XINT_expr_tmpvar\XINT_expr_tmpd\expandafter\endcsname - \csname XINT_expr_tmpval\XINT_expr_tmpd\endcsname - \ifnum\XINT_expr_tmpd<\XINT_expr_tmpc\space - \edef\XINT_expr_tmpd{\the\numexpr\XINT_expr_tmpd+1}% + \csname XINT_defvar_tmpvar\XINT_defvar_tmpd\expandafter\endcsname + \csname XINT_defvar_tmpval\XINT_defvar_tmpd\endcsname + \ifnum\XINT_defvar_tmpd<\XINT_defvar_tmpc\space + \edef\XINT_defvar_tmpd{\the\numexpr\XINT_defvar_tmpd+1}% \repeat - \xintRelaxArray\XINT_expr_tmpvar - \xintRelaxArray\XINT_expr_tmpval + \xintRelaxArray\XINT_defvar_tmpvar + \xintRelaxArray\XINT_defvar_tmpval \else \xintMessage {xintexpr}{Warning} - {Aborting: mismatch between number of variables (\XINT_expr_tmpc) - and number of values (\XINT_expr_tmpd).}% + {Aborting: mismatch between number of variables (\XINT_defvar_tmpc) + and number of values (\XINT_defvar_tmpd).}% \fi \fi }% @@ -1536,29 +1553,39 @@ \def\xintdefiivar_a #1={\XINT_expr_defvar\xintbareiieval {#1}}% \def\xintdeffloatvar_a #1={\XINT_expr_defvar\xintbarefloateval {#1}}% \def\xintunassignvar #1{% - \edef\XINT_expr_tmpa{#1}% - \edef\XINT_expr_tmpa {\xint_zapspaces_o\XINT_expr_tmpa}% - \ifcsname XINT_expr_var_\XINT_expr_tmpa\endcsname - \ifnum\expandafter\xintLength\expandafter{\XINT_expr_tmpa}=\@ne - \expandafter\xintnewdummy\XINT_expr_tmpa + \edef\XINT_unvar_tmpa{#1}% + \edef\XINT_unvar_tmpa {\xint_zapspaces_o\XINT_unvar_tmpa}% + \ifcsname XINT_expr_var_\XINT_unvar_tmpa\endcsname + \ifnum\expandafter\xintLength\expandafter{\XINT_unvar_tmpa}=\@ne + \expandafter\xintnewdummy\XINT_unvar_tmpa \else \XINT_global\expandafter - \let\csname XINT_expr_var_\XINT_expr_tmpa\endcsname\xint_undefined + \let\csname XINT_expr_var_\XINT_unvar_tmpa\endcsname\xint_undefined \XINT_global\expandafter - \let\csname XINT_expr_onliteral_\XINT_expr_tmpa\endcsname\xint_undefined + \let\csname XINT_expr_onliteral_\XINT_unvar_tmpa\endcsname\xint_undefined \ifxintverbose\xintMessage {xintexpr}{Info} - {Variable \XINT_expr_tmpa\space has been + {Variable \XINT_unvar_tmpa\space has been \ifxintglobaldefs globally \fi ``unassigned''.}% \fi \fi \else \xintMessage {xintexpr}{Warning} - {Error: there was no such variable \XINT_expr_tmpa\space to unassign.}% + {Error: there was no such variable \XINT_unvar_tmpa\space to unassign.}% \fi }% \catcode`* 11 \def\XINT_expr_makedummy #1% {% + \ifcsname XINT_expr_var_#1\endcsname + \XINT_global + \expandafter\let\csname XINT_expr_var_#1/old\expandafter\endcsname + \csname XINT_expr_var_#1\expandafter\endcsname + \fi + \ifcsname XINT_expr_onliteral_#1\endcsname + \XINT_global + \expandafter\let\csname XINT_expr_onliteral_#1/old\expandafter\endcsname + \csname XINT_expr_onliteral_#1\expandafter\endcsname + \fi \XINT_global \expandafter\def\csname XINT_expr_var_#1\endcsname ##1\relax !#1##2% {##2##1\relax !#1##2}% @@ -1579,6 +1606,30 @@ \edef\XINT_expr_onliteral_nil {\XINT_expr_precedence_*** *\expandafter\noexpand\csname .= \endcsname (}% \catcode`* 12 +\def\xintensuredummy #1{% + \XINT_expr_makedummy{#1}% + \ifxintverbose\xintMessage {xintexpr}{Info}% + {#1 (with letter catcode) now + \ifxintglobaldefs globally \fi usable as dummy variable.&&J + Use \string\xintrestoredummy{#1} to restore it to its former meaning.}% + \fi +}% +\def\xintrestorelettervar #1{% + \ifcsname XINT_expr_var_#1/old\endcsname + \XINT_global + \expandafter\let\csname XINT_expr_var_#1\expandafter\endcsname + \csname XINT_expr_var_#1/old\expandafter\endcsname + \fi + \ifcsname XINT_expr_onliteral_#1/old\endcsname + \XINT_global + \expandafter\let\csname XINT_expr_onliteral_#1\expandafter\endcsname + \csname XINT_expr_onliteral_#1/old\expandafter\endcsname + \fi + \ifxintverbose\xintMessage {xintexpr}{Info}% + {Character #1 (with letter catcode) + \ifxintglobaldefs globally \fi restored to its earlier status, if any.}% + \fi +}% \edef\XINT_expr_var_omit #1\relax !{1\string !?!\relax !}% \edef\XINT_expr_var_abort #1\relax !{1\string !?^\relax !}% \def\XINT_expr_op_!? #1#2\relax {\expandafter\XINT_expr_foundend\csname .=#2\endcsname}% @@ -2114,16 +2165,18 @@ \def\xintiiLCMof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintiilcm \expandafter\xint_firstofone\romannumeral`&&@#1,^,0}% \def\XINTinFloatdigits {\XINTinFloat [\XINTdigits]}% +\def\XINTinFloatSdigits {\XINTinFloatS [\XINTdigits]}% \def\XINTinFloatSqrtdigits {\XINTinFloatSqrt[\XINTdigits]}% \def\XINTinFloatFacdigits {\XINTinFloatFac [\XINTdigits]}% +\def\XINTFloatiLogTendigits{\XINTFloatiLogTen[\XINTdigits]}% \def\XINTinFloatMaxof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmax - \expandafter\XINTinFloatdigits\romannumeral`&&@#1,^,{0[0]}}% + \expandafter\XINTinFloatSdigits\romannumeral`&&@#1,^,{0[0]}}% \def\XINTinFloatMinof:csv #1{\expandafter\XINT_oncsv:_a\expandafter\xintmin - \expandafter\XINTinFloatdigits\romannumeral`&&@#1,^,{0[0]}}% + \expandafter\XINTinFloatSdigits\romannumeral`&&@#1,^,{0[0]}}% \def\XINTinFloatSum:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatadd - \expandafter\XINTinFloatdigits\romannumeral`&&@#1,^,{0[0]}}% + \expandafter\XINTinFloatSdigits\romannumeral`&&@#1,^,{0[0]}}% \def\XINTinFloatPrd:csv #1{\expandafter\XINT_oncsv:_a\expandafter\XINTinfloatmul - \expandafter\XINTinFloatdigits\romannumeral`&&@#1,^,{1[0]}}% + \expandafter\XINTinFloatSdigits\romannumeral`&&@#1,^,{1[0]}}% \def\XINT:expr:one:and:opt #1,#2,#3!#4#5% {% \if\relax#3\relax\expandafter\xint_firstoftwo\else @@ -2145,18 +2198,10 @@ \def\XINT:expr:totwo #1#2{#1,#2}% \def\XINT:expr:two:to:two #1,#2,!#3% {% - \expandafter\XINT:expr:totwo\romannumeral`&&@% - #3{#1}{#2}% + \expandafter\XINT:expr:totwo\romannumeral`&&@#3{#1}{#2}% }% -\def\XINT:expr:two:to:one #1,#2,!#3% -{% - #3{#1}{#2}% -}% -\def\XINT:flexpr:two:to:one #1,#2,!#3% -{% - #3{#1}{#2}% -}% -\let\XINT:flexpr:two:to:two\XINT:flexpr:two:to:one +\let\XINT:flexpr:two:to:two\XINT:expr:two:to:two +\let\XINT:iiexpr:two:to:two\XINT:expr:two:to:two \def\XINT_expr_func_num #1#2#3% {% \expandafter #1\expandafter #2\csname.=% @@ -2352,6 +2397,16 @@ \expandafter #1\expandafter #2\csname.=% \XINT:NEhook:one\xintiiSqrtR{\XINT_expr_unlock #3}\endcsname }% +\def\XINT_expr_func_inv #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintInv{\XINT_expr_unlock #3}\endcsname +}% +\def\XINT_flexpr_func_inv #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\XINTinFloatInv{\XINT_expr_unlock #3}\endcsname +}% \def\XINT_expr_func_round #1#2#3% {% \expandafter #1\expandafter #2\csname.=% @@ -2390,6 +2445,33 @@ \endcsname }% \let\XINT_flexpr_func_float\XINT_expr_func_float +\def\XINT_expr_func_sfloat #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:expr:one:and:opt + \romannumeral`&&@\XINT_expr_unlock #3,,!\XINTinFloatSdigits\XINTinFloatS + \endcsname +}% +\let\XINT_flexpr_func_sfloat\XINT_expr_func_sfloat +\expandafter\def\csname XINT_expr_func_ilog10\endcsname #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:expr:one:and:opt + \romannumeral`&&@\XINT_expr_unlock #3,,!\xintiLogTen\XINTFloatiLogTen + \endcsname +}% +\expandafter\def\csname XINT_flexpr_func_ilog10\endcsname #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:expr:one:and:opt + \romannumeral`&&@\XINT_expr_unlock #3,,!\XINTFloatiLogTendigits\XINTFloatiLogTen + \endcsname +}% +\expandafter\def\csname XINT_iiexpr_func_ilog10\endcsname #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintiiLogTen{\XINT_expr_unlock #3}\endcsname +}% \def\XINT_expr_func_divmod #1#2#3% {% \expandafter #1\expandafter #2\csname.=% @@ -2400,7 +2482,7 @@ \def\XINT_flexpr_func_divmod #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:flexpr:two:to:two + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\XINTinFloatDivMod \endcsname }% @@ -2414,63 +2496,63 @@ \def\XINT_expr_func_mod #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintMod \endcsname }% \def\XINT_flexpr_func_mod #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:flexpr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\XINTinFloatMod \endcsname }% \def\XINT_iiexpr_func_mod #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiMod \endcsname }% \def\XINT_expr_func_binomial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintBinomial \endcsname }% \def\XINT_flexpr_func_binomial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:flexpr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\XINTinFloatBinomial \endcsname }% \def\XINT_iiexpr_func_binomial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiBinomial \endcsname }% \def\XINT_expr_func_pfactorial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintPFactorial \endcsname }% \def\XINT_flexpr_func_pfactorial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:flexpr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\XINTinFloatPFactorial \endcsname }% \def\XINT_iiexpr_func_pfactorial #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiPFactorial \endcsname }% @@ -2506,7 +2588,7 @@ \def\XINT_expr_func_quo #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiQuo \endcsname }% @@ -2514,14 +2596,14 @@ \def\XINT_iiexpr_func_quo #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiQuo \endcsname }% \def\XINT_expr_func_rem #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiRem \endcsname }% @@ -2529,7 +2611,7 @@ \def\XINT_iiexpr_func_rem #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:two:to:one + \expandafter\XINT:NEhook:twosp \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiRem \endcsname }% @@ -2806,25 +2888,32 @@ \def\XINT_tmpa #1#2#3#4% {% \def #1##1(##2)##3=##4;{% - \edef\XINT_expr_tmpa {##1}% - \edef\XINT_expr_tmpa {\xint_zapspaces_o \XINT_expr_tmpa}% - \def\XINT_expr_tmpb {0}% - \def\XINT_expr_tmpc {(##4)}% - \xintFor ####1 in {##2} \do - {\edef\XINT_expr_tmpb {\the\numexpr\XINT_expr_tmpb+\xint_c_i}% - \edef\XINT_expr_tmpc {subs(\unexpanded\expandafter{\XINT_expr_tmpc},% - ####1=################\XINT_expr_tmpb)}% + \edef\XINT_deffunc_tmpa {##1}% + \edef\XINT_deffunc_tmpa {\xint_zapspaces_o \XINT_deffunc_tmpa}% + \def\XINT_deffunc_tmpb {0}% + \def\XINT_deffunc_tmpc {(##4)}% + \edef\XINT_deffunc_tmpd {##2}% + \ifnum\xintLength:f:csv{\XINT_deffunc_tmpd}>\xint_c_ + \xintFor ####1 in {\XINT_deffunc_tmpd}\do + {\edef\XINT_deffunc_tmpb {\the\numexpr\XINT_deffunc_tmpb+\xint_c_i}% + \edef\XINT_deffunc_tmpc {subs(\unexpanded\expandafter{\XINT_deffunc_tmpc},% + ####1=################\XINT_deffunc_tmpb)}% }% - \expandafter\XINT_expr_defuserfunc - \csname XINT_#2_func_\XINT_expr_tmpa\expandafter\endcsname - \expandafter{\XINT_expr_tmpa}{#2}% - \expandafter#3\csname XINT_#2_userfunc_\XINT_expr_tmpa\endcsname - [\XINT_expr_tmpb]{\XINT_expr_tmpc}% + \fi + \ifnum\XINT_deffunc_tmpb=\xint_c_ + \expandafter\XINT_expr_defuserfunc_none\csname + \else + \expandafter\XINT_expr_defuserfunc\csname + \fi + XINT_#2_func_\XINT_deffunc_tmpa\expandafter\endcsname + \expandafter{\XINT_deffunc_tmpa}{#2}% + \expandafter#3\csname XINT_#2_userfunc_\XINT_deffunc_tmpa\endcsname + [\XINT_deffunc_tmpb]{\XINT_deffunc_tmpc}% \ifxintverbose\xintMessage {xintexpr}{Info} - {Function \XINT_expr_tmpa\space for \string\xint #4 parser - associated to \string\XINT_#2_userfunc_\XINT_expr_tmpa\space + {Function \XINT_deffunc_tmpa\space for \string\xint #4 parser + associated to \string\XINT_#2_userfunc_\XINT_deffunc_tmpa\space with \ifxintglobaldefs global \fi meaning \expandafter\meaning - \csname XINT_#2_userfunc_\XINT_expr_tmpa\endcsname}% + \csname XINT_#2_userfunc_\XINT_deffunc_tmpa\endcsname}% \fi \xintexprRestoreCatcodes }% @@ -2839,34 +2928,157 @@ {% \XINT_global \def #1##1##2##3{\expandafter ##1\expandafter ##2% - \csname .=\XINT:expr:userfunc{#3}{#2}{\XINT_expr_unlock ##3}\endcsname + \csname.=\XINT:expr:userfunc{#3}{#2}{\XINT_expr_unlock ##3}\endcsname }% }% \def\XINT:expr:userfunc #1#2#3% - {\csname XINT_#1_userfunc_#2\expandafter\endcsname - \romannumeral0\xintcsvtolistnonstripped{#3}}% -\catcode`~ 12 -\def\XINT:newexpr:userfunc #1#2#3% - {~xintExpandArgs{XINT_#1_userfunc_#2}{\xintCSVtoListNonStripped{#3}}}% -\catcode`~ 3 +{% + \csname XINT_#1_userfunc_#2\expandafter\endcsname + \romannumeral0\xintcsvtolistnonstripped{#3}% +}% +\def\XINT_expr_defuserfunc_none #1#2#3% +{% + \XINT_global + \def #1##1##2##3{\expandafter ##1\expandafter ##2% + \csname.=\XINT:expr:userfunc:none{#3}{#2}\endcsname + }% +}% +\def\XINT:expr:userfunc:none #1#2{\csname XINT_#1_userfunc_#2\endcsname}% +\def\XINT_tmpa #1#2#3#4% +{% + \def #1##1(##2)##3=##4;{% + \edef\XINT_defefunc_tmpa {##1}% + \edef\XINT_defefunc_tmpa {\xint_zapspaces_o \XINT_defefunc_tmpa}% + \def\XINT_defefunc_tmpb {0}% + \def\XINT_defefunc_tmpc {(##4)}% + \edef\XINT_defefunc_tmpd {##2}% + \ifnum\xintLength:f:csv{\XINT_defefunc_tmpd}>\xint_c_ + \xintFor ####1 in {\XINT_defefunc_tmpd}\do + {\edef\XINT_defefunc_tmpb {\the\numexpr\XINT_defefunc_tmpb+\xint_c_i}% + \edef\XINT_defefunc_tmpc {subs(\unexpanded\expandafter{\XINT_defefunc_tmpc},% + ####1=################\XINT_defefunc_tmpb)}% + }% + \fi + \expandafter#3\csname XINT_#2_userefunc_\XINT_defefunc_tmpa\endcsname + [\XINT_defefunc_tmpb]{\XINT_defefunc_tmpc}% + \edef\XINT_defefunc_tmpd{\xintLength:f:csv + {\expandafter\meaning\csname + XINT_#2_userfunc_\XINT_defefunc_tmpa\endcsname}}% + \ifcase\XINT_defefunc_tmpb\space + \expandafter\XINT_expr_defuserefunc_none\csname + \or + \expandafter\XINT_expr_defuserefunc_one\csname + \or + \expandafter\XINT_expr_defuserefunc_two\csname + \else + \expandafter\XINT_expr_defuserefunc_many\csname + \fi + XINT_#2_func_\XINT_defefunc_tmpa\expandafter\endcsname + \expandafter{\XINT_defefunc_tmpa}{#2}% + \ifxintverbose\xintMessage {xintexpr}{Info} + {Function \XINT_defefunc_tmpa\space for \string\xint #4 parser + associated to \string\XINT_#2_userefunc_\XINT_defefunc_tmpa\space + with \ifxintglobaldefs global \fi meaning \expandafter\meaning + \csname XINT_#2_userefunc_\XINT_defefunc_tmpa\endcsname}% + \fi + \xintexprRestoreCatcodes + }% +}% +\def\xintdefefunc {\xintexprSafeCatcodes\xintdefefunc_a}% +\def\xintdefiiefunc {\xintexprSafeCatcodes\xintdefiiefunc_a}% +\def\xintdeffloatefunc {\xintexprSafeCatcodes\xintdeffloatefunc_a}% +\XINT_tmpa\xintdefefunc_a {expr} \XINT_NewFunc {expr}% +\XINT_tmpa\xintdefiiefunc_a {iiexpr}\XINT_NewIIFunc {iiexpr}% +\XINT_tmpa\xintdeffloatefunc_a{flexpr}\XINT_NewFloatFunc{floatexpr}% +\def\XINT_expr_defuserefunc_none #1#2#3% +{% + \expandafter\XINT_expr_defuserefunc_none_a + \csname XINT_#3_userefunc_#2\endcsname +}% +\def\XINT_expr_defuserefunc_none_a #1#2% +{% + \XINT_global + \def #2##1##2##3{\expandafter ##1\expandafter ##2\csname.=#1\endcsname}% +}% +\def\XINT_expr_defuserefunc_one #1#2#3% +{% + \expandafter\XINT_expr_defuserefunc_one_a + \csname XINT_#3_userefunc_#2\expandafter\endcsname + \csname XINT_#3_userefunc:f_#2\endcsname #1{#2}{#3}% +}% +\def\XINT_expr_defuserefunc_one_a #1#2#3#4#5% +{% + \XINT_global + \def #2##1{\expandafter#1\expandafter{\romannumeral`&&@##1}}% + \XINT_global + \def #3##1##2##3% + {% + \expandafter ##1\expandafter ##2% + \csname.=\XINT:expr:userefunc:one{#5}{#4}{\XINT_expr_unlock##3}\endcsname + }% +}% +\def\XINT:expr:userefunc:one #1#2#3% +{% + \csname XINT_#1_userefunc_#2\expandafter\endcsname\expandafter + {\romannumeral`&&@#3}% +}% +\def\XINT_expr_defuserefunc_two #1#2#3% +{% + \expandafter\XINT_expr_defuserefunc_two_a + \csname XINT_#3_userefunc:f_#2\endcsname #1{#2}{#3}% +}% +\def\XINT_expr_defuserefunc_two_a #1#2#3#4% +{% + \XINT_global + \def #1##1##2{\xintExpandArgs{XINT_#4_userefunc_#3}{{##1}{##2}}}% + \XINT_global + \def #2##1##2##3% + {% + \expandafter ##1\expandafter ##2% + \csname.=\XINT:expr:userefunc:two{#4}{#3}{\XINT_expr_unlock##3}\endcsname + }% +}% +\def\XINT:expr:userefunc:two #1#2#3% +{% + \expandafter\XINT:expr:userefunc:two_a + \csname XINT_#1_userefunc_#2\expandafter\endcsname + \romannumeral`&&@#3,% +}% +\def\XINT:expr:userefunc:two_a #1#2,#3,{#1{#2}{#3}}% +\def\XINT_expr_defuserefunc_many #1#2#3% +{% + \XINT_global + \def #1##1##2##3% + {% + \expandafter ##1\expandafter ##2% + \csname.=\XINT:expr:userefunc{#3}{#2}{\XINT_expr_unlock##3}\endcsname + }% +}% +\def\XINT:expr:userefunc #1#2#3% +{% + \csname XINT_#1_userefunc_#2\expandafter\endcsname + \romannumeral0\xintcsvtolistnonstripped{#3}% +}% \def\XINT_tmpa #1{\expandafter\def\csname xintunassign#1func\endcsname ##1{% - \edef\XINT_expr_tmpa{##1}% - \edef\XINT_expr_tmpa {\xint_zapspaces_o\XINT_expr_tmpa}% + \edef\XINT_unfunc_tmpa{##1}% + \edef\XINT_unfunc_tmpa {\xint_zapspaces_o\XINT_unfunc_tmpa}% + \XINT_global\expandafter + \let\csname XINT_#1_func_\XINT_unfunc_tmpa\endcsname\xint_undefined \XINT_global\expandafter - \let\csname XINT_#1_func_\XINT_expr_tmpa\endcsname\xint_undefined + \let\csname XINT_#1_userfunc_\XINT_unfunc_tmpa\endcsname\xint_undefined \XINT_global\expandafter - \let\csname XINT_#1_userfunc_\XINT_expr_tmpa\endcsname\xint_undefined + \let\csname XINT_#1_userefunc_\XINT_unfunc_tmpa\endcsname\xint_undefined \ifxintverbose\xintMessage {xintexpr}{Info} - {Function \XINT_expr_tmpa\space for \string\xint #1 parser now + {Function \XINT_unfunc_tmpa\space for \string\xint #1 parser now \ifxintglobaldefs globally \fi undefined.}% \fi}}% \XINT_tmpa{expr}\XINT_tmpa{iiexpr}\XINT_tmpa{floatexpr}% \def\XINT_expr_wrapit #1{\expandafter\XINT_expr_wrap\csname.=#1\endcsname}% \def\xintNewFunction #1#2[#3]#4% {% - \edef\XINT_expr_tmpa {#1}% - \edef\XINT_expr_tmpa {\xint_zapspaces_o \XINT_expr_tmpa}% - \def\XINT_expr_tmpb ##1##2##3##4##5##6##7##8##9{#4}% + \edef\XINT_newfunc_tmpa {#1}% + \edef\XINT_newfunc_tmpa {\xint_zapspaces_o \XINT_newfunc_tmpa}% + \def\XINT_newfunc_tmpb ##1##2##3##4##5##6##7##8##9{#4}% \begingroup \ifcase #3\relax \toks0{}% @@ -2883,26 +3095,26 @@ \expandafter \endgroup\expandafter \XINT_global\expandafter - \def\csname XINT_expr_macrofunc_\XINT_expr_tmpa\expandafter\endcsname - \the\toks0\expandafter{\XINT_expr_tmpb + \def\csname XINT_expr_macrofunc_\XINT_newfunc_tmpa\expandafter\endcsname + \the\toks0\expandafter{\XINT_newfunc_tmpb {\XINT_expr_wrapit{##1}}{\XINT_expr_wrapit{##2}}{\XINT_expr_wrapit{##3}}% {\XINT_expr_wrapit{##4}}{\XINT_expr_wrapit{##5}}{\XINT_expr_wrapit{##6}}% {\XINT_expr_wrapit{##7}}{\XINT_expr_wrapit{##8}}{\XINT_expr_wrapit{##9}}}% \expandafter\XINT_expr_newfunction - \csname XINT_expr_func_\XINT_expr_tmpa\expandafter\endcsname - \expandafter{\XINT_expr_tmpa}{eval}\xintbareeval + \csname XINT_expr_func_\XINT_newfunc_tmpa\expandafter\endcsname + \expandafter{\XINT_newfunc_tmpa}{eval}\xintbareeval \expandafter\XINT_expr_newfunction - \csname XINT_iiexpr_func_\XINT_expr_tmpa\expandafter\endcsname - \expandafter{\XINT_expr_tmpa}{iieval}\xintbareiieval + \csname XINT_iiexpr_func_\XINT_newfunc_tmpa\expandafter\endcsname + \expandafter{\XINT_newfunc_tmpa}{iieval}\xintbareiieval \expandafter\XINT_expr_newfunction - \csname XINT_flexpr_func_\XINT_expr_tmpa\expandafter\endcsname - \expandafter{\XINT_expr_tmpa}{floateval}\xintbarefloateval + \csname XINT_flexpr_func_\XINT_newfunc_tmpa\expandafter\endcsname + \expandafter{\XINT_newfunc_tmpa}{floateval}\xintbarefloateval \ifxintverbose \xintMessage {xintexpr}{Info} - {Function \XINT_expr_tmpa\space for the expression parsers is - associated to \string\XINT_expr_macrofunc_\XINT_expr_tmpa\space + {Function \XINT_newfunc_tmpa\space for the expression parsers is + associated to \string\XINT_expr_macrofunc_\XINT_newfunc_tmpa\space with \ifxintglobaldefs global \fi meaning \expandafter\meaning - \csname XINT_expr_macrofunc_\XINT_expr_tmpa\endcsname}% + \csname XINT_expr_macrofunc_\XINT_newfunc_tmpa\endcsname}% \fi }% \def\XINT_expr_newfunction #1#2#3#4% @@ -2953,6 +3165,7 @@ \def\XINT_applyon:::_end #1,#2#3#4{\xint_secondoftwo #4}% \catcode`~ 12 \catcode`$ 12 % $ +\def\xint_dfork #1$#2#3\krof {#2}% $ \def\xint_ddfork #1$$#2#3\krof {#2}% $$ \def\XINT:NE:RApply::csv #1#2#3#4% {~xintApply::csv{~expandafter #2~xint_exchangetwo_keepbraces{#4}}{#3}}% @@ -2979,13 +3192,75 @@ \if #2~\xint_dothis{#4}\fi \xint_orthat{#3}% }% +\def\XINT:NE:twosp#1#2,#3#4,!#5% +{% + \XINT:NE:two_fork_dd#1#3{#5}{\detokenize{#5}}{#1#2}{#3#4}% +}% \def\XINT:NE:one#1#2{\expandafter\XINT:NE:one_a\romannumeral`&&@#2!#1}% -\def\XINT:NE:one_a#1#2!#3{% +\def\XINT:NE:one_a#1#2!#3% +{% \if ###1\xint_dothis {\detokenize{#3}}\fi \if ~#1\xint_dothis {\detokenize{#3}}\fi \if $#1\xint_dothis {~xintApply::csv{\detokenize{#3}}}\fi %$ \xint_orthat #3{#1#2}% }% +\def\XINT:NE:userfunc #1#2#3% + {~xintExpandArgs{XINT_#1_userfunc_#2}{\xintCSVtoListNonStripped{#3}}}% +\def\XINT:NE:userfunc:none #1#2{~!{XINT_#1_userfunc_#2}}% +\def\XINT:NE:userefunc:one#1#2#3% + {\expandafter\XINT:NE:userefunc:one_a\romannumeral`&&@#3!{#1}{#2}}% +\def\XINT:NE:userefunc:one_a#1#2!#3#4% +{% + \if ###1\xint_dothis {~!{XINT_#3_userefunc:f_#4}}\fi + \if ~#1\xint_dothis {~!{XINT_#3_userefunc:f_#4}}\fi + \if $#1\xint_dothis {~xintApply::csv~!{XINT_#3_userefunc:f_#4}}\fi %$ + \xint_orthat {\csname XINT_#3_userefunc_#4\endcsname}% + {#1#2}% +}% +\def\XINT:NE:twosp#1#2,#3#4,!#5% +{% + \XINT:NE:two_fork_dd#1#3{#5}{\detokenize{#5}}{#1#2}{#3#4}% +}% +\def\XINT:NE:userefunc:two#1#2#3% + {\expandafter\XINT:NE:userefunc:two_a\romannumeral`&&@#3,!{#1}{#2}}% +\def\XINT:NE:userefunc:two_a#1#2,#3#4,!#5#6% +{% + \XINT:NE:two_fork_dd#1#3{\csname XINT_#5_userefunc_#6\endcsname}% + {~!{XINT_#5_userefunc:f_#6}}% + {#1#2}{#3#4}% +}% +\def\XINT:NE:userefunc#1#2#3% +{% + \expandafter\XINT:NE:userefunc_a\romannumeral`&&@#3,2,3,4,5,6,7,8,9,!% + {#1}{#2}{#3}% +}% +\def\XINT:NE:userefunc_a#1#2,#3#4,#5#6,#7#8,#9% +{% + \XINT:NE:userefunc_b{#1#3#5#7#9}% +}% +\def\XINT:NE:userefunc_b#1#2,#3#4,#5#6,#7#8,#9% +{% + \XINT:NE:userefunc_c{#1#3#5#7#9}% +}% +\def\XINT:NE:iftilde #1~#2#3\relax{\unless\if !#21\fi}% +\def\XINT:NE:ifdollar #1$#2#3\relax{\unless\if !#21\fi}%$ +\def\XINT:NE:ifhash#1{% +\def\XINT:NE:ifhash##1#1##2##3\relax{\unless\if !##21\fi}% +}\expandafter\XINT:NE:ifhash\string#% +\def\XINT:NE:userefunc_c#1#2!% +{% + \if0\XINT:NE:iftilde #1~!\relax\XINT:NE:ifdollar #1$!\relax%$ + \XINT:NE:ifhash #1##!\relax 0% + \expandafter\XINT:NE:userefunc_x + \else + \expandafter\XINT:NE:userefunc_p + \fi +}% +\def\XINT:NE:userefunc_x#1#2% + {\csname XINT_#1_userefunc_#2\expandafter\endcsname + \romannumeral0\xintcsvtolistnonstripped}% +\def\XINT:NE:userefunc_p #1#2#3% + {~xintExpandArgs{XINT_#1_userefunc_#2}{\xintCSVtoListNonStripped{#3}}}% \def\XINT:NE:oneopt#1[#2]#3% {\expandafter\XINT:NE:oneopt_a\romannumeral`&&@#3!{#2}#1}% \def\XINT:NE:oneopt_a#1#2!#3#4% @@ -3032,11 +3307,6 @@ {\expandafter\XINT:newexpr:insertdollar\detokenize{#3}}% {#1}{#2}% }% -\def\XINT:newexpr:two:to:one #1,#2,!#3% -{% - \XINT:NE:two#3{#1}{#2}% -}% -\let\XINT:newflexpr:two:to:one\XINT:newexpr:two:to:one \def\xintiiifNotZeroNE:#1#2,#3,#4,% {% \if1\if###11\else\if~#11\else\if$#11\else0%$ @@ -3086,20 +3356,23 @@ {#1#2}{#3}{#4}{#5}% }% \def\XINT_expr_redefinemacros {% - \let\XINT:NEhook:one\XINT:NE:one - \let\XINT:NEhook:two\XINT:NE:two - \let\XINT:NEhook:csv\XINT:NE:csv + \let\XINT:NEhook:one \XINT:NE:one + \let\XINT:NEhook:two \XINT:NE:two + \let\XINT:NEhook:csv \XINT:NE:csv + \let\XINT:NEhook:twosp\XINT:NE:twosp + \let\XINT:expr:userfunc \XINT:NE:userfunc + \let\XINT:expr:userfunc:none \XINT:NE:userfunc:none + \let\XINT:expr:userefunc \XINT:NE:userefunc + \let\XINT:expr:userefunc:one \XINT:NE:userefunc:one + \let\XINT:expr:userefunc:two \XINT:NE:userefunc:two + \let\XINT:expr:macrofunc \XINT:newexpr:macrofunc \let\XINT:expr:one:and:opt \XINT:newexpr:one:and:opt \let\XINT:expr:one:or:two:nums \XINT:newexpr:one:or:two:nums \let\XINT:iiexpr:one:or:two: \XINT:newiiexpr:one:or:two: \let\XINT:expr:tacitzeroifonearg \XINT:newexpr:tacitzeroifonearg \let\XINT:iiexpr:tacitzeroifonearg \XINT:newiiexpr:tacitzeroifonearg - \let\XINT:expr:two:to:two \XINT:newexpr:two:to:two - \let\XINT:expr:two:to:one \XINT:newexpr:two:to:one - \let\XINT:flexpr:two:to:one \XINT:newflexpr:two:to:one - \let\XINT:expr:two:to:one \XINT:newexpr:two:to:one - \let\XINT:flexpr:two:to:two \XINT:newflexpr:two:to:two - \let\XINT:flexpr:two:to:one \XINT:newflexpr:two:to:one + \let\XINT:expr:two:to:two \XINT:newexpr:two:to:two + \let\XINT:flexpr:two:to:two \XINT:newflexpr:two:to:two \let\xintiiifNotZero: \xintiiifNotZeroNE: \let\xintifInt: \xintifIntNE: \let\xintifFloatInt: \xintifFloatIntNE: @@ -3125,8 +3398,6 @@ \def\XINTinFloatSeqB::csv {\XINT:NE:two_\XINTinFloatSeqBNumeric::csv{$noexpand$XINTinFloatSeqB:f:csv}}% \def\xintListSel:x:csv {~xintListSel:f:csv }% - \let\XINT:expr:userfunc \XINT:newexpr:userfunc - \let\XINT:expr:macrofunc\XINT:newexpr:macrofunc \def\XINTinRandomFloatSdigits{~XINTinRandomFloatSdigits }% \def\XINTinRandomFloatSixteen{~XINTinRandomFloatSixteen }% \def\xintiiRandRange{~xintiiRandRange }% @@ -3135,21 +3406,26 @@ \def\XINT_expr_redefineprints {% \def\XINT_flexpr_noopt - {\expandafter\XINT_flexpr_withopt_b\expandafter-\romannumeral0\xintbarefloateval }% - \def\XINT_flexpr_withopt_b ##1##2% - {\expandafter\XINT_flexpr_wrap\csname .;##1.=\XINT_expr_unlock ##2\endcsname }% + {% + \expandafter + \XINT_flexpr_preprint\expandafter-\romannumeral0\xintbarefloateval + }% + \def\XINT_flexpr_preprint ##1##2% + {% + \expandafter\XINT_flexpr_wrap + \csname .;##1.=\XINT_expr_unlock##2\endcsname + }% \def\XINT_expr_unlock_sp ##1.;##2##3.=##4!% - {\if -##2\expandafter\xint_firstoftwo\else\expandafter\xint_secondoftwo\fi - \XINTdigits{{##2##3}}{##4}}% - \def\XINT_expr_print ##1% - {\expandafter\xintSPRaw::csv\expandafter - {\romannumeral`&&@\XINT_expr_unlock ##1}}% - \def\XINT_iiexpr_print ##1% - {\expandafter\xintCSV::csv\expandafter - {\romannumeral`&&@\XINT_expr_unlock ##1}}% - \def\XINT_boolexpr_print ##1% - {\expandafter\xintIsTrue::csv\expandafter - {\romannumeral`&&@\XINT_expr_unlock ##1}}% + {% + \if -##2\expandafter\xint_firstoftwo\else\expandafter\xint_secondoftwo\fi + \XINTdigits{{##2##3}}{##4}% + }% + \def\XINT_expr_print ##1{\expandafter + \xintSPRaw::csv\expandafter{\romannumeral`&&@\XINT_expr_unlock ##1}}% + \def\XINT_iiexpr_print ##1{\expandafter + \xintCSV::csv\expandafter{\romannumeral`&&@\XINT_expr_unlock ##1}}% + \def\XINT_boolexpr_print ##1{\expandafter + \xintIsTrue::csv\expandafter{\romannumeral`&&@\XINT_expr_unlock ##1}}% \def\xintCSV::csv {~xintCSV::csv }% \def\xintSPRaw::csv {~xintSPRaw::csv }% \def\xintPFloat::csv {~xintPFloat::csv }% @@ -3168,11 +3444,11 @@ \xinttheboolexpr\XINT_newexpr_clean}% \def\XINT_newexpr_clean #1>{\noexpand\romannumeral`&&@}% \def\XINT_NewFunc - {\XINT_NewExpr{}\xint_gobble_i\xintthebareeval\XINT_newfunc_clean}% + {\XINT_NewExpr\XINT_expr_redefineprints\xint_gobble_i\xintthebareeval\XINT_newfunc_clean}% \def\XINT_NewFloatFunc - {\XINT_NewExpr{}\xint_gobble_i\xintthebarefloateval\XINT_newfunc_clean}% + {\XINT_NewExpr\XINT_expr_redefineprints\xint_gobble_i\xintthebarefloateval\XINT_newfunc_clean}% \def\XINT_NewIIFunc - {\XINT_NewExpr{}\xint_gobble_i\xintthebareiieval\XINT_newfunc_clean}% + {\XINT_NewExpr\XINT_expr_redefineprints\xint_gobble_i\xintthebareiieval\XINT_newfunc_clean}% \def\XINT_newfunc_clean #1>{}% \def\XINT_NewExpr #1#2#3#4#5#6[#7]% {% @@ -3198,7 +3474,7 @@ \def\XINT_NewExpr_a %1%2%3%4%5@ {@ \def\XINT_tmpa %%1%%2%%3%%4%%5%%6%%7%%8%%9{%5}@ - \def~{$noexpand$}@ + \def~%%1{\if !%%1\noexpand~\else $noexpand$%%1\fi}@ \catcode`: 11 \catcode`_ 11 \catcode`# 12 \catcode`~ 13 \escapechar 126 \endlinechar -1 \everyeof {\noexpand }@ @@ -3207,6 +3483,7 @@ %2\XINT_tmpa{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}\relax}@ }@ \escapechar 92 \catcode`# 6 \catcode`$ 0 @ $ + \def~%%1{\expandafter\noexpand\csname %%1\endcsname}@ \edef\XINT_tmpa %%1%%2%%3%%4%%5%%6%%7%%8%%9@ {\scantokens\expandafter{\expandafter%3\meaning\XINT_tmpb}}@ \the\toks0\expandafter @@ -3218,6 +3495,7 @@ \fi}@ }@ \catcode`% 14 +\XINT_setcatcodes % clean up to avoid surprises if something changes \newif\ifxintexprsafecatcodes \let\xintexprRestoreCatcodes\empty \def\xintexprSafeCatcodes @@ -3277,7 +3555,13 @@ \catcode96=12 % ` \catcode32=10 % space }% -\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax +\let\XINT_tmpa\undefined \let\XINT_tmpb\undefined \let\XINT_tmpc\undefined +\ifdefined\RequirePackage\expandafter\xint_firstoftwo\else\expandafter\xint_secondoftwo\fi +{\RequirePackage{xinttrig}% +\RequirePackage{xintlog}}% +{\input xinttrig.sty +\input xintlog.sty +}% \XINT_restorecatcodes_endinput% \endinput %% diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty index 09b2c87192d..11d4185c722 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.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintfrac: Expandable operations on fractions %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintfrac}% - [2019/01/06 1.3d Expandable operations on fractions (JFB)]% + [2019/04/05 1.3e Expandable operations on fractions (JFB)]% \def\XINT_cntSgnFork #1% {% \ifcase #1\expandafter\xint_secondofthree @@ -397,6 +397,41 @@ \expandafter\XINT_raw\romannumeral0\XINT_infrac }% \def\XINT_raw #1#2#3{ #2/#3[#1]}% +\def\xintiLogTen {\the\numexpr\xintilogten}% +\def\xintilogten +{% + \expandafter\XINT_ilogten\romannumeral0\xintraw +}% +\def\XINT_ilogten #1% +{% + \xint_UDzerominusfork + 0#1\XINT_ilogten_p + #1-\XINT_ilogten_z + 0-{\XINT_ilogten_p#1}% + \krof +}% +\def\XINT_ilogten_z #1[#2]{-"7FFF8000\relax}% +\def\XINT_ilogten_p #1/#2[#3]% +{% + #3+\expandafter\XINT_ilogten_a + \the\numexpr\xintLength{#1}\expandafter.\the\numexpr\xintLength{#2}.#1.#2.% +}% +\def\XINT_ilogten_a #1.#2.% +{% + #1-#2\ifnum#1>#2 + \expandafter\XINT_ilogten_aa + \else + \expandafter\XINT_ilogten_ab + \fi #1.#2.% +}% +\def\XINT_ilogten_aa #1.#2.#3.#4.% +{% + \xintiiifLt{#3}{\XINT_dsx_addzerosnofuss{#1-#2}#4;}{-1}{}\relax +}% +\def\XINT_ilogten_ab #1.#2.#3.#4.% +{% + \xintiiifLt{\XINT_dsx_addzerosnofuss{#2-#1}#3;}{#4}{-1}{}\relax +}% \def\xintPRaw {\romannumeral0\xintpraw }% \def\xintpraw {% @@ -1902,6 +1937,17 @@ \def\XINT_infloatS_clean #1% {\if #1!\xint_dothis\XINT_infloatS_clean_a\fi\xint_orthat{ }#1}% \def\XINT_infloatS_clean_a !#1.{ }% +\def\XINTFloatiLogTen {\the\numexpr\XINTfloatilogten}% +\def\XINTfloatilogten [#1]#2% + {\expandafter\XINT_floatilogten\romannumeral0\XINT_infloat[#1]{#2}#1.}% +\def\XINT_floatilogten #1{% + \if #10\xint_dothis\XINT_floatilogten_z\fi + \if #1!\xint_dothis\XINT_floatilogten_a\fi + \xint_orthat\XINT_floatilogten_b #1% +}% +\def\XINT_floatilogten_z 0[0]#1.{-"7FFF8000\relax}% +\def\XINT_floatilogten_a !#1.#2[#3]#4.{#3-#1+#4-1\relax}% +\def\XINT_floatilogten_b #1[#2]#3.{#2+#3-1\relax}% \def\XINT_infloat [#1]#2% {% \expandafter\XINT_infloat_a\the\numexpr #1\expandafter.% @@ -2255,6 +2301,7 @@ \expandafter\XINT_FL_mul_b\romannumeral0\XINTinfloatS[#3]{#4}#1[#2]% }% \def\XINT_FL_mul_b #1[#2]#3[#4]{\xintiiMul{#3}{#1}/1[#4+#2]}% +\def\XINTinFloatInv#1{\XINTinFloatS[\XINTdigits]{\xintInv{#1}}}% \def\xintFloatDiv {\romannumeral0\xintfloatdiv }% \def\xintfloatdiv #1{\XINT_fldiv_chkopt \xintfloat #1\xint:}% \def\XINTinFloatDiv {\romannumeral0\XINTinfloatdiv }% @@ -2609,7 +2656,7 @@ \def\xintFloatFac {\romannumeral0\xintfloatfac}% \def\xintfloatfac #1{\XINT_flfac_chkopt \xintfloat #1\xint:}% \def\XINTinFloatFac {\romannumeral0\XINTinfloatfac }% -\def\XINTinfloatfac #1{\XINT_flfac_chkopt \XINTinfloat #1\xint:}% +\def\XINTinfloatfac #1{\XINT_flfac_chkopt \XINTinfloatS #1\xint:}% \def\XINT_flfac_chkopt #1#2% {% \ifx [#2\expandafter\XINT_flfac_opt diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty index 60a38048466..ecd3d3f8532 100644 --- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty +++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintgcd: Euclidean algorithm with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintgcd}% - [2019/01/06 1.3d Euclide algorithm with xint package (JFB)]% + [2019/04/05 1.3e Euclide algorithm with xint package (JFB)]% \def\xintGCD {\romannumeral0\xintgcd }% \def\xintgcd #1#2{\xintiigcd {\xintNum{#1}}{\xintNum{#2}}}% \def\xintiiGCD {\romannumeral0\xintiigcd }% diff --git a/Master/texmf-dist/tex/generic/xint/xintkernel.sty b/Master/texmf-dist/tex/generic/xint/xintkernel.sty index 63719d70a97..2b03201a5f5 100644 --- a/Master/texmf-dist/tex/generic/xint/xintkernel.sty +++ b/Master/texmf-dist/tex/generic/xint/xintkernel.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintkernel: Paraphernalia for the xint packages %% --------------------------------------------------------------- @@ -156,7 +156,7 @@ \fi \XINT_providespackage \ProvidesPackage {xintkernel}% - [2019/01/06 1.3d Paraphernalia for the xint packages (JFB)]% + [2019/04/05 1.3e Paraphernalia for the xint packages (JFB)]% \chardef\xint_c_ 0 \chardef\xint_c_i 1 \chardef\xint_c_ii 2 @@ -564,8 +564,11 @@ }% }% \def\xintMessage #1#2#3{% + \edef\XINT_newlinechar{\the\newlinechar}% + \newlinechar10 \immediate\write128{Package #1 #2: (on line \the\inputlineno)}% \immediate\write128{\space\space\space\space#3}% + \newlinechar\XINT_newlinechar\space }% \newif\ifxintverbose \newif\ifxintglobaldefs diff --git a/Master/texmf-dist/tex/generic/xint/xintlog.sty b/Master/texmf-dist/tex/generic/xint/xintlog.sty new file mode 100644 index 00000000000..0ba983d2530 --- /dev/null +++ b/Master/texmf-dist/tex/generic/xint/xintlog.sty @@ -0,0 +1,118 @@ +%% +%% This is file `xintlog.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xint.dtx (with options: `xintlog') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from xintlog.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file xint.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% --------------------------------------------------------------- +%% The xint bundle 1.3e 2019/04/05 +%% Copyright (C) 2013-2019 by Jean-Francois Burnol +%% xintlog: Logarithms and exponentials for xintexpr +%% --------------------------------------------------------------- +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode64=11 % @ + \catcode35=6 % # + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=12 % : + \catcode94=7 % ^ + \def\z{\endgroup}% + \def\empty{}\def\space{ }\newlinechar10 + \expandafter\let\expandafter\w\csname ver@xintexpr.sty\endcsname + \expandafter\let\expandafter\x\csname ver@xintlog.sty\endcsname + \expandafter + \ifx\csname PackageInfo\endcsname\relax + \def\y#1#2{\immediate\write-1{Package #1 Info:^^J% + \space\space\space\space#2.}}% + \else + \def\y#1#2{\PackageInfo{#1}{#2}}% + \fi + \expandafter + \ifx\csname numexpr\endcsname\relax + \y{xintlog}{\numexpr not available, aborting input}% + \aftergroup\endinput + \else + \ifx\w\relax % xintexpr.sty not yet loaded. + \y{xintlog}% + {Loading should be via \ifx\x\empty\string\usepackage{xintexpr.sty} + \else\string\input\space xintexpr.sty \fi + rather, aborting}% + \aftergroup\endinput + \else + \ifx\x\relax % first loading (initiated from xintexpr.sty) + \else + \ifx\x\empty % LaTeX first loading, \ProvidesPackage not yet seen + \else + \y{xintlog}{Already loaded, aborting}% + \aftergroup\endinput + \fi + \fi + \fi + \fi +\z% +\xintexprSafeCatcodes\catcode`_ 11 +\XINT_providespackage +\ProvidesPackage{xintlog}% +[2019/04/05 1.3e Logarithms and exponentials for xintexpr (JFB)]% +\ifdefined\RequirePackage + \RequirePackage{poormanlog}% +\else + \input poormanlog.tex +\fi +\xintexprRestoreCatcodes\csname XINT_setcatcodes\endcsname\catcode`\! 11 +\def\xintLog#1{\xintMul{\PoorManLogBaseTen{#1}}{23025850923[-10]}}% +\def\XINTinFloatLog#1{\XINTinFloatMul{\PoorManLogBaseTen{#1}}{23025850923[-10]}}% +\def\xintExp#1{\PoorManPowerOfTen{\xintMul{#1}{434294481903[-12]}}}% +\def\XINTinFloatExp#1{\PoorManPowerOfTen{\XINTinFloatMul{#1}{434294481903[-12]}}}% +\def\XINT_expr_func_log #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintLog{\XINT_expr_unlock #3}\endcsname +}% +\def\XINT_flexpr_func_log #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\XINTinFloatLog{\XINT_expr_unlock #3}\endcsname +}% +\def\XINT_expr_func_exp #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintExp{\XINT_expr_unlock #3}\endcsname +}% +\def\XINT_flexpr_func_exp #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\XINTinFloatExp{\XINT_expr_unlock #3}\endcsname +}% +\def\XINT_expr_func_pow #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:NEhook:twosp + \romannumeral`&&@\XINT_expr_unlock #3,!\PoorManPower + \endcsname +}% +\let\XINT_flexpr_func_pow\XINT_expr_func_pow +\endinput +%% +%% End of file `xintlog.sty'. diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty index 7958c90d75d..38ea5b473c4 100644 --- a/Master/texmf-dist/tex/generic/xint/xintseries.sty +++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xintseries: Expandable partial sums with xint package %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xintseries}% - [2019/01/06 1.3d Expandable partial sums with xint package (JFB)]% + [2019/04/05 1.3e Expandable partial sums with xint package (JFB)]% \def\xintSeries {\romannumeral0\xintseries }% \def\xintseries #1#2% {% diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty index f6d378e7c24..c38614a2a1e 100644 --- a/Master/texmf-dist/tex/generic/xint/xinttools.sty +++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.3d 2019/01/06 +%% The xint bundle 1.3e 2019/04/05 %% Copyright (C) 2013-2019 by Jean-Francois Burnol %% xinttools: Expandable and non-expandable utilities %% --------------------------------------------------------------- @@ -70,7 +70,7 @@ \XINTsetupcatcodes% defined in xintkernel.sty \XINT_providespackage \ProvidesPackage{xinttools}% - [2019/01/06 1.3d Expandable and non-expandable utilities (JFB)]% + [2019/04/05 1.3e Expandable and non-expandable utilities (JFB)]% \newtoks\XINT_toks \xint_firstofone{\let\XINT_sptoken= } %<- space here! \def\xintgodef {\global\xintodef }% diff --git a/Master/texmf-dist/tex/generic/xint/xinttrig.sty b/Master/texmf-dist/tex/generic/xint/xinttrig.sty new file mode 100644 index 00000000000..b2e41c7b21f --- /dev/null +++ b/Master/texmf-dist/tex/generic/xint/xinttrig.sty @@ -0,0 +1,500 @@ +%% +%% This is file `xinttrig.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xint.dtx (with options: `xinttrig') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from xinttrig.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file xint.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% --------------------------------------------------------------- +%% The xint bundle 1.3e 2019/04/05 +%% Copyright (C) 2013-2019 by Jean-Francois Burnol +%% xinttrig: Trigonometry for the xintexpr package +%% --------------------------------------------------------------- +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode64=11 % @ + \catcode35=6 % # + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=12 % : + \catcode94=7 % ^ + \def\z{\endgroup}% + \def\empty{}\def\space{ }\newlinechar10 + \expandafter\let\expandafter\w\csname ver@xintexpr.sty\endcsname + \expandafter + \ifx\csname PackageInfo\endcsname\relax + \def\y#1#2{\immediate\write-1{Package #1 Info:^^J% + \space\space\space\space#2.}}% + \else + \def\y#1#2{\PackageInfo{#1}{#2}}% + \fi + \expandafter + \ifx\csname numexpr\endcsname\relax + \y{xinttrig}{\numexpr not available, aborting input}% + \aftergroup\endinput + \else + \ifx\w\relax % xintexpr.sty not yet loaded. + \y{xinttrig}% + {Loading should be via \ifx\x\empty\string\usepackage{xintexpr.sty} + \else\string\input\space xintexpr.sty \fi + rather, aborting}% + \aftergroup\endinput + \fi + \fi +\z% +\catcode`_ 11 \XINT_setcatcodes \catcode`? 12 +\ifcsname xintlibver@trig\endcsname + \expandafter\xint_firstoftwo +\else + \expandafter\xint_secondoftwo +\fi +{\immediate\write-1{Reloading xinttrig library using Digits=\xinttheDigits.}}% +{\expandafter\gdef\csname xintlibver@trig\endcsname{2019/04/05 1.3e}% +\XINT_providespackage +\ProvidesPackage{xinttrig}% +[2019/04/05 1.3e Trigonometrical functions for xintexpr (JFB)]% +}% +\xintFor* #1 in {iDTVtuwxyzX}\do{\xintensuredummy{#1}}% +\def\xintreloadxinttrig + {\edef\XINT_restorecatcodes_now{\XINT_restorecatcodes}% + \XINT_setcatcodes\catcode`? 12 + \input xinttrig.sty + \XINT_restorecatcodes_now}% +\xintdeffloatvar twoPi := 0 + + 6.28318530717958647692528676655900576839433879875021164194989;% +\xintdeffloatvar threePiover2 := 0 + + 4.71238898038468985769396507491925432629575409906265873146242;% +\xintdeffloatvar Pi := 0 + + 3.14159265358979323846264338327950288419716939937510582097494;% +\xintdeffloatvar Piover2 := 0 + + 1.57079632679489661923132169163975144209858469968755291048747;% +\xintdeffloatvar oneDegree := 0 + + 0.0174532925199432957692369076848861271344287188854172545609719;% Pi/180 +\xintdeffloatvar oneRadian := 0 + + 57.2957795130823208767981548141051703324054724665643215491602;% 180/Pi +\xintdeffloatvar invfact\xintListWithSep{, invfact}{\xintSeq{2}{44}}% + := seq(0+x, x=\xintexpr rseq(1/2{;}@/i, i=3..44)\relax);% need to hide inner ; +\xintdeffloatefunc sin_aux(X) := 1 - X(invfact3 - X(invfact5 +\ifnum\XINTdigits>4 + - X(invfact7 +\ifnum\XINTdigits>6 + - X(invfact9 +\ifnum\XINTdigits>8 + - X(invfact11 +\ifnum\XINTdigits>10 + - X(invfact13 +\ifnum\XINTdigits>13 + - X(invfact15 +\ifnum\XINTdigits>15 + - X(invfact17 +\ifnum\XINTdigits>18 + - X(invfact19 +\ifnum\XINTdigits>21 + - X(invfact21 +\ifnum\XINTdigits>24 + - X(invfact23 +\ifnum\XINTdigits>27 + - X(invfact25 +\ifnum\XINTdigits>30 + - X(invfact27 +\ifnum\XINTdigits>33 + - X(invfact29 +\ifnum\XINTdigits>36 + - X(invfact31 +\ifnum\XINTdigits>39 + - X(invfact33 +\ifnum\XINTdigits>43 + - X(invfact35 +\ifnum\XINTdigits>46 + - X(invfact37 +\ifnum\XINTdigits>49 + - X(invfact39 +\ifnum\XINTdigits>53 + - X(invfact41 +\ifnum\XINTdigits>59 + - X(invfact43 + )\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi));% +\xintdeffloatefunc cos_aux(X) := 1 - X(invfact2 - X(invfact4 +\ifnum\XINTdigits>3 + - X(invfact6 +\ifnum\XINTdigits>5 + - X(invfact8 +\ifnum\XINTdigits>7 + - X(invfact10 +\ifnum\XINTdigits>9 + - X(invfact12 +\ifnum\XINTdigits>12 + - X(invfact14 +\ifnum\XINTdigits>14 + - X(invfact16 +\ifnum\XINTdigits>17 + - X(invfact18 +\ifnum\XINTdigits>20 + - X(invfact20 +\ifnum\XINTdigits>23 + - X(invfact22 +\ifnum\XINTdigits>25 + - X(invfact24 +\ifnum\XINTdigits>28 + - X(invfact26 +\ifnum\XINTdigits>32 + - X(invfact28 +\ifnum\XINTdigits>35 + - X(invfact30 +\ifnum\XINTdigits>38 + - X(invfact32 +\ifnum\XINTdigits>41 + - X(invfact34 +\ifnum\XINTdigits>44 + - X(invfact36 +\ifnum\XINTdigits>48 + - X(invfact38 +\ifnum\XINTdigits>51 + - X(invfact40 +\ifnum\XINTdigits>55 + - X(invfact42 +\ifnum\XINTdigits>58 + - X(invfact44 + )\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi));% +\expandafter\let\csname XINT_expr_func_sin_aux\expandafter\endcsname + \csname XINT_flexpr_func_sin_aux\endcsname +\expandafter\let\csname XINT_expr_func_cos_aux\expandafter\endcsname + \csname XINT_flexpr_func_cos_aux\endcsname +\xintdeffloatefunc sin_(x) := x * sin_aux(sqr(x));% +\xintdeffloatefunc cos_(x) := cos_aux(sqr(x));% +\def\XINT_mod_ccclx_i #1.% input .. k is a non-negative exponent +{% + \expandafter\XINT_mod_ccclx_e\the\numexpr + \expandafter\XINT_mod_ccclx_j\the\numexpr1\ifcase#1 \or0\or00\else000\fi.% +}% +\def\XINT_mod_ccclx_j 1#1.#2.% #2=N is a non-negative mantissa +{% + (\XINT_mod_ccclx_ja {++}#2#1\XINT_mod_ccclx_jb 0000000\relax +}% 1 2345678 +\def\XINT_mod_ccclx_ja #1#2#3#4#5#6#7#8#9% +{% + #9+#8+#7+#6+#5+#4+#3+#2\xint_firstoftwo{+\XINT_mod_ccclx_ja{+#9+#8+#7}}{#1}% +}% +\def\XINT_mod_ccclx_jb #1\xint_firstoftwo#2#3{#1+0)*280\XINT_mod_ccclx_jc #1#3}% +\def\XINT_mod_ccclx_jc +#1+#2+#3#4\relax{+80*(#3+#2+#1)+#3#2#1.}% +\def\XINT_mod_ccclx_e#1.{\expandafter\XINT_mod_ccclx_z\the\numexpr(#1+180)/360-1.#1.}% +\def\XINT_mod_ccclx_z#1.#2.{#2-360*#1.}% +\def\XINT_flexpr_func_sind_ #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintSind{\XINT_expr_unlock#3}\endcsname +}% +\def\xintSind#1{\romannumeral`&&@\expandafter\xintsind + \romannumeral0\XINTinfloatS[\XINTdigits]{#1}}% +\def\xintsind #1[#2#3]% +{% + \xint_UDsignfork + #2\XINT_sind + -\XINT_sind_int + \krof#2#3.#1..%<< attention extra dot +}% +\def\XINT_sind #1.#2.% NOT TO BE USED WITH VANISHING (OR NEGATIVE) #2. +{% + \expandafter\XINT_sind_a + \romannumeral0\xinttrunc{\XINTdigits}{#2[#1]}% +}% +\def\XINT_sind_a{\expandafter\XINT_sind_i\the\numexpr\XINT_mod_ccclx_i0.}% +\def\XINT_sind_int +{% + \expandafter\XINT_sind_i\the\numexpr\expandafter\XINT_mod_ccclx_i +}% +\def\XINT_sind_i #1.% range reduction inside [0, 360[ +{% + \ifcase\numexpr#1/90\relax + \expandafter\XINT_sind_A + \or\expandafter\XINT_sind_B\the\numexpr-90+% + \or\expandafter\XINT_sind_C\the\numexpr-180+% + \or\expandafter\XINT_sind_D\the\numexpr-270+% + \else\expandafter\XINT_sind_E\the\numexpr-360+% + \fi#1.% +}% +\def\XINT_sind_A#1{% +\def\XINT_sind_A##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_sind_A\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_sind_B#1{\xint_UDsignfork#1\XINT_sind_B_n-\XINT_sind_B_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_sind_B_n-##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_sind_B_p##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_sind_C#1{\xint_UDsignfork#1\XINT_sind_C_n-\XINT_sind_C_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_sind_C_n-##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_sind_C_p##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_sind_D#1{\xint_UDsignfork#1\XINT_sind_D_n-\XINT_sind_D_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_sind_D_n-##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_sind_D_p##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_sind_E#1{% +\def\XINT_sind_E-##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +}\expandafter +\XINT_sind_E\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_flexpr_func_cosd_ #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \XINT:NEhook:one\xintCosd{\XINT_expr_unlock#3}\endcsname +}% +\def\xintCosd#1{\romannumeral`&&@\expandafter\xintcosd + \romannumeral0\XINTinfloatS[\XINTdigits]{#1}}% +\def\xintcosd #1[#2#3]% +{% + \xint_UDsignfork + #2\XINT_cosd + -\XINT_cosd_int + \krof#2#3.#1..%<< attention extra dot +}% +\def\XINT_cosd #1.#2.% NOT TO BE USED WITH VANISHING (OR NEGATIVE) #2. +{% + \expandafter\XINT_cosd_a + \romannumeral0\xinttrunc{\XINTdigits}{#2[#1]}% +}% +\def\XINT_cosd_a{\expandafter\XINT_cosd_i\the\numexpr\XINT_mod_ccclx_i0.}% +\def\XINT_cosd_int +{% + \expandafter\XINT_cosd_i\the\numexpr\expandafter\XINT_mod_ccclx_i +}% +\def\XINT_cosd_i #1.% +{% + \ifcase\numexpr#1/90\relax + \expandafter\XINT_cosd_A + \or\expandafter\XINT_cosd_B\the\numexpr-90+% + \or\expandafter\XINT_cosd_C\the\numexpr-180+% + \or\expandafter\XINT_cosd_D\the\numexpr-270+% + \else\expandafter\XINT_cosd_E\the\numexpr-360+% + \fi#1.% +}% +\def\XINT_cosd_A#1{% +\def\XINT_cosd_A##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_cosd_A\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_cosd_B#1{\xint_UDsignfork#1\XINT_cosd_B_n-\XINT_cosd_B_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_cosd_B_n-##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_cosd_B_p##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_cosd_C#1{\xint_UDsignfork#1\XINT_cosd_C_n-\XINT_cosd_C_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_cosd_C_n-##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_cosd_C_p##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_cosd_D#1{\xint_UDsignfork#1\XINT_cosd_D_n-\XINT_cosd_D_p\krof #1}% +\def\XINT_tmpa#1{% +\def\XINT_cosd_D_n-##1.##2.% +{% + \xintiiopp\expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +\def\XINT_cosd_D_p##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_sin_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}{#1}}}% +}% +}\expandafter +\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\def\XINT_cosd_E#1{% +\def\XINT_cosd_E-##1.##2.% +{% + \expandafter\XINT_flexpr_userefunc_cos_\expandafter + {\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}{#1}}}% +}% +}\expandafter +\XINT_cosd_E\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}% +\xintdeffloatefunc sind(x) := ifsgn(x, if(x>=-45, sin_(x*oneDegree), -sind_(-x)), + 0, + if(x<=45, sin_(x*oneDegree), sind_(x)));% +\xintdeffloatefunc cosd(x) := ifsgn(x, if(x>=-45, cos_(x*oneDegree), cosd_(-x)), + 1, + if(x<=45, cos_(x*oneDegree), cosd_(x)));% +\xintdeffloatefunc sin(x):= if(abs(x)<0.79, sin_(x),% + ifsgn(x, -sind_(-x*oneRadian), + 0, + sind_(x*oneRadian)) + );% +\xintdeffloatefunc cos(x):= if(abs(x)<0.79, cos_(x), cosd_(abs(x*oneRadian)));% +\xintdeffloatefunc sinc(x):= + if(abs(x)<0.79, sin_aux(sqr(x)), sind_(abs(x)*oneRadian)/abs(x));% +\xintdeffloatefunc tand(x):= sind(x)/cosd(x);% +\xintdeffloatefunc cotd(x):= cosd(x)/sind(x);% +\xintdeffloatefunc tan(x) := ifsgn(x, if(x>-0.79, sin(x)/cos(x), -cotd(90+x*oneRadian)), + 0, + if(x<0.79, sin(x)/cos(x), cotd(90-x*oneRadian)) + );% +\xintdeffloatefunc cot(x) := if(abs(x)<0.79, cos(x)/sin(x), + ifsgn(x, -tand(90+x*oneRadian), + 0, + tand(90-x*oneRadian)) + );% +\xintdeffloatefunc sec(x) := inv(cos(x));% +\xintdeffloatefunc csc(x) := inv(sin(x));% +\xintdeffloatefunc secd(x):= inv(cosd(x));% +\xintdeffloatefunc cscd(x):= inv(sind(x));% +\xintdeffloatefunc asin_aux(X) := 1 +\ifnum\XINTdigits>3 % actually 4 would achieve 1ulp in place of <0.5ulp + + X(1/6 +\ifnum\XINTdigits>9 + + X(3/40 +\ifnum\XINTdigits>16 + + X(5/112 +\ifnum\XINTdigits>25 + + X(35/1152 +\ifnum\XINTdigits>35 + + X(63/2816 +\ifnum\XINTdigits>46 + + X(231/13312 + )\fi)\fi)\fi)\fi)\fi)\fi;% +\xintdeffloatefunc asin_o(D, T) := T + D*asin_aux(sqr(D));% +\xintdeffloatefunc asin_n(V, T, t, u) :=% V is square of T + asin_o (\xintexpr t*cos_aux(V) - u*T*sin_aux(V)\relax, T);% +\xintdeffloatefunc asin_m(T, t, u) := asin_n(sqr(T), T, t, u);% +\xintdeffloatefunc asin_l(t, u) := asin_m(t*asin_aux(sqr(t)), t, u);% +\xintdeffloatefunc asin_a(t, u) := + if(tx, + if(y>-x, Piover2 - atan(x/y), + if(y<0, -Pi + atan(y/x), Pi + atan(y/x))), + if(y>-x, atan(y/x), -Piover2 + atan(x/-y)) + );% +\xintdeffloatefunc atan2(y,x) := Arg(x, y);% +\xintdeffloatefunc Argd(x, y):= + if(y>x, + if(y>-x, 90 - atand(x/y), + if(y<0, -180 + atand(y/x), 180 + atand(y/x))), + if(y>-x, atand(y/x), -90 + atand(x/-y)) + );% +\xintdeffloatefunc atan2d(y,x) := Argd(x, y);% +\xintdeffloatefunc pArg(x, y):= + if(y>x, + if(y>-x, Piover2 - atan(x/y), Pi + atan(y/x)), + if(y>-x, if(y<0, twoPi + atan(y/x), atan(y/x)), + threePiover2 + atan(x/-y)) + );% +\xintdeffloatefunc pArgd(x, y):= + if(y>x, + if(y>-x, 90 - atan(x/y)*oneRadian, 180 + atan(y/x)*oneRadian), + if(y>-x, if(y<0, 360 + atan(y/x)*oneRadian, atan(y/x)*oneRadian), + 270 + atan(x/-y)*oneRadian) + );% +\expandafter\let\csname XINT_flexpr_func_tg\expandafter\endcsname + \csname XINT_flexpr_func_tan\endcsname +\expandafter\let\csname XINT_flexpr_func_cotg\expandafter\endcsname + \csname XINT_flexpr_func_cot\endcsname +\xintFor #1 in {sin, cos, tan, sec, csc, cot, + asin, acos, atan}\do +{% + \xintdefefunc #1(x) := \xintfloatexpr #1(sfloat(x))\relax;% + \xintdefefunc #1d(x):= \xintfloatexpr #1d(sfloat(x))\relax;% +}% +\xintFor #1 in {Arg, pArg, atan2}\do +{% + \xintdefefunc #1(x, y) := \xintfloatexpr #1(sfloat(x), sfloat(y))\relax;% + \xintdefefunc #1d(x, y):= \xintfloatexpr #1d(sfloat(x), sfloat(y))\relax;% +}% +\xintdefefunc tg(x) := \xintfloatexpr tg(sfloat(x))\relax;% +\xintdefefunc cotg(x):= \xintfloatexpr cotg(sfloat(x))\relax;% +\xintdefefunc sinc(x):= \xintfloatexpr sinc(sfloat(x))\relax;% +\xintFor* #1 in {iDTVtuwxyzX}\do{\xintrestorelettervar{#1}}% +\endinput +%% +%% End of file `xinttrig.sty'. -- cgit v1.2.3