diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx | 120 |
1 files changed, 61 insertions, 59 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index f0716dd0f15..9187ab81a14 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-extended.dtx Copyright (C) 2011-2017 The LaTeX3 Project +%% File: l3fp-extended.dtx Copyright (C) 2011-2018 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -134,7 +134,7 @@ \cs_new:Npn \@@_fixed_add_one:wN #1#2; #3 { \exp_after:wN #3 \exp_after:wN - { \__int_value:w \__int_eval:w \c_@@_myriad_int + #1 } #2 ; + { \int_value:w \@@_int_eval:w \c_@@_myriad_int + #1 } #2 ; } % \end{macrocode} % \end{macro} @@ -150,9 +150,9 @@ \cs_new:Npn \@@_fixed_div_myriad:wn #1#2#3#4#5#6; { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_leading_shift_int \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_trailing_shift_int + \int_value:w \@@_int_eval:w \c_@@_trailing_shift_int + #1 ; {#2}{#3}{#4}{#5}; } % \end{macrocode} @@ -188,22 +188,22 @@ \cs_new:Npn \@@_fixed_mul_short:wwn #1#2#3#4#5#6; #7#8#9; { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_leading_shift_int + #1*#7 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#8 + #2*#7 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#9 + #2*#8 + #3*#7 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #2*#9 + #3*#8 + #4*#7 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #3*#9 + #4*#8 + #5*#7 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_trailing_shift_int + \int_value:w \@@_int_eval:w \c_@@_trailing_shift_int + #4*#9 + #5*#8 + #6*#7 + ( #5*#9 + #6*#8 + #6*#9 / \c_@@_myriad_int ) / \c_@@_myriad_int ; ; @@ -268,7 +268,7 @@ { \exp_after:wN \@@_fixed_div_int_after:Nw \exp_after:wN #8 - \__int_value:w \__int_eval:w - 1 + \int_value:w \@@_int_eval:w - 1 \@@_fixed_div_int:wnN #1; {#7} \@@_fixed_div_int_auxi:wnn #2; {#7} \@@_fixed_div_int_auxi:wnn @@ -280,7 +280,7 @@ \cs_new:Npn \@@_fixed_div_int:wnN #1; #2 #3 { \exp_after:wN #3 - \__int_value:w \__int_eval:w #1 / #2 - 1 ; + \int_value:w \@@_int_eval:w #1 / #2 - 1 ; {#2} {#1} } @@ -288,9 +288,9 @@ { + #1 \exp_after:wN \@@_fixed_div_int_pack:Nw - \__int_value:w \__int_eval:w 9999 + \int_value:w \@@_int_eval:w 9999 \exp_after:wN \@@_fixed_div_int:wnN - \__int_value:w \__int_eval:w #3 - #1*#2 \__int_eval_end: + \int_value:w \@@_int_eval:w #3 - #1*#2 \@@_int_eval_end: } \cs_new:Npn \@@_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + 2 ; } \cs_new:Npn \@@_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} } @@ -332,16 +332,16 @@ \cs_new:Npn \@@_fixed_add:Nnnnnwnn #1 #2#3#4#5 #6; #7#8 { \exp_after:wN \@@_fixed_add_after:NNNNNwn - \__int_value:w \__int_eval:w 9 9999 9998 + #2#3 #1 #7#8 + \int_value:w \@@_int_eval:w 9 9999 9998 + #2#3 #1 #7#8 \exp_after:wN \@@_fixed_add_pack:NNNNNwn - \__int_value:w \__int_eval:w 1 9999 9998 + #4#5 + \int_value:w \@@_int_eval:w 1 9999 9998 + #4#5 \@@_fixed_add:nnNnnnwn #6 #1 } \cs_new:Npn \@@_fixed_add:nnNnnnwn #1#2 #3 #4#5 #6#7 ; #8 { #3 #4#5 \exp_after:wN \@@_fixed_add_pack:NNNNNwn - \__int_value:w \__int_eval:w 2 0000 0000 #3 #6#7 + #1#2 ; {#8} ; + \int_value:w \@@_int_eval:w 2 0000 0000 #3 #6#7 + #1#2 ; {#8} ; } \cs_new:Npn \@@_fixed_add_pack:NNNNNwn #1 #2#3#4#5 #6; #7 { + #1 ; {#7} {#2#3#4#5} {#6} } @@ -401,21 +401,21 @@ \cs_new:Npn \@@_fixed_mul:wwn #1#2#3#4 #5; #6#7#8#9 { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_leading_shift_int \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#6 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#7 + #2*#6 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#8 + #2*#7 + #3*#6 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_middle_shift_int + #1*#9 + #2*#8 + #3*#7 + #4*#6 \exp_after:wN \@@_pack:NNNNNw - \__int_value:w \__int_eval:w \c_@@_trailing_shift_int + \int_value:w \@@_int_eval:w \c_@@_trailing_shift_int + #2*#9 + #3*#8 + #4*#7 + ( #3*#9 + #4*#8 + \@@_fixed_mul:nnnnnnnw #5 {#6}{#7} {#1}{#2} @@ -485,9 +485,9 @@ \cs_new:Npn \@@_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_big_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_leading_shift_int \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + #3 #4 + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int + #3 #4 \@@_fixed_mul_add:Nwnnnwnnn + + #5 #6 ; #2 ; #1 ; #2 ; + + #7 #8 ; ; @@ -495,9 +495,9 @@ \cs_new:Npn \@@_fixed_mul_sub_back:wwwn #1; #2; #3#4#5#6#7#8; { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_big_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_leading_shift_int \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + #3 #4 + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int + #3 #4 \@@_fixed_mul_add:Nwnnnwnnn - + #5 #6 ; #2 ; #1 ; #2 ; - + #7 #8 ; ; @@ -505,9 +505,10 @@ \cs_new:Npn \@@_fixed_one_minus_mul:wwn #1; #2; { \exp_after:wN \@@_fixed_mul_after:wwn - \__int_value:w \__int_eval:w \c_@@_big_leading_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_leading_shift_int \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + 1 0000 0000 + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int + + 1 0000 0000 \@@_fixed_mul_add:Nwnnnwnnn - ; #2 ; #1 ; #2 ; - ; ; @@ -537,13 +538,13 @@ { #1 #7*#3 \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int #1 #7*#4 #1 #8*#3 \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int #1 #7*#5 #1 #8*#4 #1 #9*#3 #2 \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_middle_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_middle_shift_int #1 \@@_fixed_mul_add:nnnnwnnnn {#7}{#8}{#9} } % \end{macrocode} @@ -575,7 +576,7 @@ { ( #1*#9 + #2*#8 + #3*#7 + #4*#6 ) \exp_after:wN \@@_pack_big:NNNNNNw - \__int_value:w \__int_eval:w \c_@@_big_trailing_shift_int + \int_value:w \@@_int_eval:w \c_@@_big_trailing_shift_int \@@_fixed_mul_add:nnnnwnnwN { #6 + #4*#7 + #3*#8 + #2*#9 + #1 } { #7 + #4*#8 + #3*#9 + #2 } @@ -631,7 +632,7 @@ \cs_new:Npn \@@_ep_to_fixed:wwn #1,#2 { \exp_after:wN \@@_ep_to_fixed_auxi:www - \__int_value:w \__int_eval:w 1 0000 0000 + #2 \exp_after:wN ; + \int_value:w \@@_int_eval:w 1 0000 0000 + #2 \exp_after:wN ; \exp:w \exp_end_continue_f:w \prg_replicate:nn { 4 - \int_max:nn {#1} { -32 } } { 0 } ; } @@ -672,10 +673,10 @@ \cs_new:Npn \@@_ep_to_ep:wwN #1,#2#3#4#5#6#7; #8 { \exp_after:wN #8 - \__int_value:w \__int_eval:w #1 + 4 + \int_value:w \@@_int_eval:w #1 + 4 \exp_after:wN \use_i:nn \exp_after:wN \@@_ep_to_ep_loop:N - \__int_value:w \__int_eval:w 1 0000 0000 + #2 \__int_eval_end: + \int_value:w \@@_int_eval:w 1 0000 0000 + #2 \@@_int_eval_end: #3#4#5#6#7 ; ; ! } \cs_new:Npn \@@_ep_to_ep_loop:N #1 @@ -756,7 +757,7 @@ \cs_new:Npn \@@_ep_mul_raw:wwwwN #1,#2; #3,#4; #5 { \@@_fixed_mul:wwn #2; #4; - { \exp_after:wN #5 \__int_value:w \__int_eval:w #1 + #3 , } + { \exp_after:wN #5 \int_value:w \@@_int_eval:w #1 + #3 , } } % \end{macrocode} % \end{macro} @@ -932,15 +933,15 @@ \cs_new:Npn \@@_ep_div_esti:wwwwn #1,#2#3; #4, { \exp_after:wN \@@_ep_div_estii:wwnnwwn - \__int_value:w \__int_eval:w 10 0000 0000 / ( #2 + 1 ) + \int_value:w \@@_int_eval:w 10 0000 0000 / ( #2 + 1 ) \exp_after:wN ; - \__int_value:w \__int_eval:w #4 - #1 + 1 , + \int_value:w \@@_int_eval:w #4 - #1 + 1 , {#2} #3; } \cs_new:Npn \@@_ep_div_estii:wwnnwwn #1; #2,#3#4#5; #6; #7 { \exp_after:wN \@@_ep_div_estiii:NNNNNwwwn - \__int_value:w \__int_eval:w 10 0000 0000 - 1750 + \int_value:w \@@_int_eval:w 10 0000 0000 - 1750 + #1 000 + (10 0000 0000 / #3 - #1) * (1000 - #4 / 10) ; {#3}{#4}#5; #6; { #7 #2, } } @@ -975,11 +976,11 @@ \cs_new:Npn \@@_ep_div_epsi:wnNNNNNn #1#2#3#4#5#6; { \exp_after:wN \@@_ep_div_epsii:wwnNNNNNn - \__int_value:w \__int_eval:w 1 9998 - #2 + \int_value:w \@@_int_eval:w 1 9998 - #2 \exp_after:wN \@@_ep_div_eps_pack:NNNNNw - \__int_value:w \__int_eval:w 1 9999 9998 - #3#4 + \int_value:w \@@_int_eval:w 1 9999 9998 - #3#4 \exp_after:wN \@@_ep_div_eps_pack:NNNNNw - \__int_value:w \__int_eval:w 2 0000 0000 - #5#6 ; ; + \int_value:w \@@_int_eval:w 2 0000 0000 - #5#6 ; ; } \cs_new:Npn \@@_ep_div_eps_pack:NNNNNw #1#2#3#4#5#6; { + #1 ; {#2#3#4#5} {#6} } @@ -1049,7 +1050,7 @@ \cs_new:Npn \@@_ep_isqrt_auxi:wwn #1, { \exp_after:wN \@@_ep_isqrt_auxii:wwnnnwn - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w \int_if_odd:nTF {#1} { (1 - #1) / 2 , 535 , { 0 } { } } { 1 - #1 / 2 , 168 , { } { 0 } } @@ -1092,15 +1093,15 @@ \exp_after:wN \@@_ep_isqrt_estii:wwwnnwn \fi: \exp_after:wN \@@_ep_isqrt_esti:wwwnnwn - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w (#1 + 1 0050 0000 #4 / (#1 * #3)) / 2 , #1, #3, {#4} } \cs_new:Npn \@@_ep_isqrt_estii:wwwnnwn #1, #2, #3, #4#5 { \exp_after:wN \@@_ep_isqrt_estiii:NNNNNwwwn - \__int_value:w \__int_eval:w 1000 0000 + #2 * #2 #5 * 5 - \exp_after:wN , \__int_value:w \__int_eval:w 10000 + #2 ; + \int_value:w \@@_int_eval:w 1000 0000 + #2 * #2 #5 * 5 + \exp_after:wN , \int_value:w \@@_int_eval:w 10000 + #2 ; } \cs_new:Npn \@@_ep_isqrt_estiii:NNNNNwwwn 1#1#2#3#4#5#6, 1#7#8; #9; { @@ -1149,7 +1150,7 @@ % integer expression then convert the fixed point number. % \begin{macrocode} \cs_new:Npn \@@_ep_to_float_o:wwN #1, - { + \__int_eval:w #1 \@@_fixed_to_float_o:wN } + { + \@@_int_eval:w #1 \@@_fixed_to_float_o:wN } \cs_new:Npn \@@_ep_inv_to_float_o:wwN #1,#2; { \@@_ep_div:wwwwn 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1,#2; @@ -1184,7 +1185,7 @@ % \begin{macro}[rEXP] % {\@@_fixed_to_float_o:wN, \@@_fixed_to_float_o:Nw} % \begin{syntax} -% \ldots{} \cs{__int_eval:w} \meta{exponent} \cs{@@_fixed_to_float_o:wN} \Arg{a_1} \Arg{a_2} \Arg{a_3} \Arg{a_4} \Arg{a_5} \Arg{a_6} |;| \meta{sign} +% \ldots{} \cs{@@_int_eval:w} \meta{exponent} \cs{@@_fixed_to_float_o:wN} \Arg{a_1} \Arg{a_2} \Arg{a_3} \Arg{a_4} \Arg{a_5} \Arg{a_6} |;| \meta{sign} % \end{syntax} % yields % \begin{quote} @@ -1198,18 +1199,19 @@ % %^^A todo: round properly when rounding to infinity: I need the sign. % \begin{macrocode} -\cs_new:Npn \@@_fixed_to_float_o:Nw #1#2; { \@@_fixed_to_float_o:wN #2; #1 } +\cs_new:Npn \@@_fixed_to_float_o:Nw #1#2; + { \@@_fixed_to_float_o:wN #2; #1 } \cs_new:Npn \@@_fixed_to_float_o:wN #1#2#3#4#5#6; #7 - { - + \__int_eval:w \c_@@_block_int % for the 8-digit-at-the-start thing. + { % for the 8-digit-at-the-start thing + + \@@_int_eval:w \c_@@_block_int \exp_after:wN \exp_after:wN \exp_after:wN \@@_fixed_to_loop:N \exp_after:wN \use_none:n - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w 1 0000 0000 + #1 \exp_after:wN \@@_use_none_stop_f:n - \__int_value:w 1#2 \exp_after:wN \@@_use_none_stop_f:n - \__int_value:w 1#3#4 \exp_after:wN \@@_use_none_stop_f:n - \__int_value:w 1#5#6 + \int_value:w 1#2 \exp_after:wN \@@_use_none_stop_f:n + \int_value:w 1#3#4 \exp_after:wN \@@_use_none_stop_f:n + \int_value:w 1#5#6 \exp_after:wN ; \exp_after:wN ; } @@ -1250,9 +1252,9 @@ \cs_new:Npn \@@_fixed_to_float_round_up:wnnnnw ; #1#2#3#4 ; { \exp_after:wN \@@_basics_pack_high:NNNNNw - \__int_value:w \__int_eval:w 1 #1#2 + \int_value:w \@@_int_eval:w 1 #1#2 \exp_after:wN \@@_basics_pack_low:NNNNNw - \__int_value:w \__int_eval:w 1 #3#4 + 1 ; + \int_value:w \@@_int_eval:w 1 #3#4 + 1 ; } % \end{macrocode} % \end{macro} |