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 | 97 |
1 files changed, 44 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 9bb7145d635..fabc72e0392 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-extended.dtx 4601 2013-11-18 23:13:28Z bruno $ +\GetIdInfo$Id: l3fp-extended.dtx 4617 2013-12-14 12:37:59Z bruno $ {L3 Floating-points with extended precision} \documentclass[full]{l3doc} \begin{document} @@ -168,28 +168,25 @@ % exactly $4$~digits. The choice of shifts allows~|#1| to be in the % range $[0, 5\cdot 10^{8}-1]$. % \begin{macrocode} -\cs_new:Npn \@@_fixed_div_myriad:wn #1#2#3#4#5#6; #7 +\cs_new:Npn \@@_fixed_div_myriad:wn #1#2#3#4#5#6; { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_leading_shift_int - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_trailing_shift_int - + #1 ; {#7} {#2}{#3}{#4}{#5}; + + #1 ; {#2}{#3}{#4}{#5}; } % \end{macrocode} % \end{macro} % -% ^^A todo:\cs_new:Npn \@@_fixed_mul_after:wn #1; #2; #3 { #3 {#1} #2; } -% ^^A and do not bring the continuation up while packing. -% ^^A possibly delete use_braced_s function afterwards. -% \begin{macro}[aux, EXP]{\@@_fixed_mul_after:wn} +% \begin{macro}[aux, EXP]{\@@_fixed_mul_after:wwn} % The fixed point operations which involve multiplication end by % calling this auxiliary. It braces the last block of digits, and % places the \meta{continuation} |#2| in front. The % \meta{continuation} was brought up through the expansions by % the packing functions. % \begin{macrocode} -\cs_new:Npn \@@_fixed_mul_after:wn #1; #2 { #2 {#1} } +\cs_new:Npn \@@_fixed_mul_after:wwn #1; #2; #3 { #3 {#1} #2; } % \end{macrocode} % \end{macro} % @@ -213,27 +210,26 @@ % \begin{macrocode} \cs_new:Npn \@@_fixed_mul_short:wwn #1#2#3#4#5#6; #7#8#9; { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_leading_shift_int + #1*#7 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#8 + #2*#7 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#9 + #2*#8 + #3*#7 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #2*#9 + #3*#8 + #4*#7 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #3*#9 + #4*#8 + #5*#7 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_trailing_shift_int + #4*#9 + #5*#8 + #6*#7 + ( #5*#9 + #6*#8 + #6*#9 / \c_ten_thousand ) - / \c_ten_thousand - \exp_after:wN ; \@@_use_braced_s:n + / \c_ten_thousand ; ; } % \end{macrocode} % \end{macro} @@ -382,7 +378,7 @@ % % ^^A todo: may a_1 or b_1 be = 10000? Used in ediv_epsi later. % \begin{macro}[int, EXP]{\@@_fixed_mul:wwn} -% \begin{macro}[aux, EXP]{\@@_fixed_mul:nnnnnnnwn} +% \begin{macro}[aux, EXP]{\@@_fixed_mul:nnnnnnnw} % \begin{syntax} % \cs{@@_fixed_mul:wwn} \meta{a} |;| \meta{b} |;| \Arg{continuation} % \end{syntax} @@ -419,38 +415,36 @@ % $a_{5}$, $a_{6}$, $b_{1}$, $b_{2}$, $a_{1}$, $a_{2}$, $b_{5}$, % $b_{6}$ and finally the \meta{continuation} as arguments. It writes % the end of the expression, including the right parenthesis and the -% denominator of the fraction. The packing auxiliaries bring the -% \meta{continuation} up through the expansion chain, as |#7|, and it +% denominator of the fraction. The \meta{continuation} % is finally placed in front of the $6$ brace groups by -% \cs{@@_fixed_mul_after:wn}. +% \cs{@@_fixed_mul_after:wwn}. % \begin{macrocode} \cs_new:Npn \@@_fixed_mul:wwn #1#2#3#4 #5; #6#7#8#9 { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_leading_shift_int - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#6 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#7 + #2*#6 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#8 + #2*#7 + #3*#6 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_middle_shift_int + #1*#9 + #2*#8 + #3*#7 + #4*#6 - \exp_after:wN \@@_pack:NNNNNwn + \exp_after:wN \@@_pack:NNNNNw \int_use:N \__int_eval:w \c_@@_trailing_shift_int + #2*#9 + #3*#8 + #4*#7 + ( #3*#9 + #4*#8 - + \@@_fixed_mul:nnnnnnnwn #5 {#6}{#7} {#1}{#2} + + \@@_fixed_mul:nnnnnnnw #5 {#6}{#7} {#1}{#2} } -\cs_new:Npn \@@_fixed_mul:nnnnnnnwn #1#2 #3#4 #5#6 #7#8 ; #9 +\cs_new:Npn \@@_fixed_mul:nnnnnnnw #1#2 #3#4 #5#6 #7#8 ; { #1*#4 + #2*#3 + #5*#8 + #6*#7 ) / \c_ten_thousand - + #1*#3 + #5*#7 ; - {#9} ; + + #1*#3 + #5*#7 ; ; } % \end{macrocode} % \end{macro} @@ -505,39 +499,37 @@ % later, and adds a trailing ${} + c_{5}c_{6}$ |;| % \Arg{continuation}~|;|. The ${} + c_{5}c_{6}$ piece, which is % omitted for \cs{@@_fixed_one_minus_mul:wwn}, will be taken in the -% integer expression for the $10^{-24}$ level. The -% \meta{continuation} is placed correctly to be taken upstream by -% packing auxiliaries. +% integer expression for the $10^{-24}$ level. % \begin{macrocode} -\cs_new:Npn \@@_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; #9 +\cs_new:Npn \@@_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_big_leading_shift_int - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int + #3 #4 \@@_fixed_mul_add:Nwnnnwnnn + + #5 #6 ; #2 ; #1 ; #2 ; + - + #7 #8 ; {#9} ; + + #7 #8 ; ; } -\cs_new:Npn \@@_fixed_mul_sub_back:wwwn #1; #2; #3#4#5#6#7#8; #9 +\cs_new:Npn \@@_fixed_mul_sub_back:wwwn #1; #2; #3#4#5#6#7#8; { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_big_leading_shift_int - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int + #3 #4 \@@_fixed_mul_add:Nwnnnwnnn - + #5 #6 ; #2 ; #1 ; #2 ; - - + #7 #8 ; {#9} ; + + #7 #8 ; ; } -\cs_new:Npn \@@_fixed_one_minus_mul:wwn #1; #2; #3 +\cs_new:Npn \@@_fixed_one_minus_mul:wwn #1; #2; { - \exp_after:wN \@@_fixed_mul_after:wn + \exp_after:wN \@@_fixed_mul_after:wwn \int_use:N \__int_eval:w \c_@@_big_leading_shift_int - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int + 1 0000 0000 \@@_fixed_mul_add:Nwnnnwnnn - ; #2 ; #1 ; #2 ; - - ; {#3} ; + ; ; } % \end{macrocode} % \end{macro} @@ -563,13 +555,13 @@ \cs_new:Npn \@@_fixed_mul_add:Nwnnnwnnn #1 #2; #3#4#5#6; #7#8#9 { #1 #7*#3 - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int #1 #7*#4 #1 #8*#3 - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int #1 #7*#5 #1 #8*#4 #1 #9*#3 #2 - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_middle_shift_int #1 \@@_fixed_mul_add:nnnnwnnnn {#7}{#8}{#9} } @@ -601,7 +593,7 @@ \cs_new:Npn \@@_fixed_mul_add:nnnnwnnnn #1#2#3#4#5; #6#7#8#9 { ( #1*#9 + #2*#8 + #3*#7 + #4*#6 ) - \exp_after:wN \@@_pack_big:NNNNNNwn + \exp_after:wN \@@_pack_big:NNNNNNw \int_use:N \__int_eval:w \c_@@_big_trailing_shift_int \@@_fixed_mul_add:nnnnwnnwN { #6 + #4*#7 + #3*#8 + #2*#9 + #1 } @@ -676,7 +668,6 @@ % \end{macro} % % ^^A todo: make it work when the arg is zero. -% ^^A todo: remove the unused(?) 'n' arg. % \begin{macro}[aux, EXP]{\@@_ep_to_ep:wwN} % \begin{macro}[aux, rEXP]{\@@_ep_to_ep_loop:N, \@@_ep_to_ep_end:www} % \begin{macro}[aux, EXP]{\@@_ep_to_ep_zero:ww} @@ -1221,7 +1212,7 @@ % before), and we assume that it is less than $10^8$.\footnote{Bruno: % I must double check this assumption.} % -%^^A todo: round properly when rounding to infinity: I need to know the sign. +%^^A todo: round properly when rounding to infinity: I need the sign. % \begin{macrocode} \cs_new:Npn \@@_fixed_to_float:Nw #1#2; { \@@_fixed_to_float:wN #2; #1 } \cs_new:Npn \@@_fixed_to_float:wN #1#2#3#4#5#6; #7 |