diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-30 22:39:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-30 22:39:09 +0000 |
commit | a28e1bfccd6fe522fcd296426e4d89c7fb4f19b6 (patch) | |
tree | b72347e08575b56fcfed87c4d837b48dcfd1e02a /Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx | |
parent | b40c37a9e22b8235ff9c0bc256d00f7af94304c3 (diff) |
l3 (30apr18)
git-svn-id: svn://tug.org/texlive/trunk@47516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx | 139 |
1 files changed, 70 insertions, 69 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index aa85f1584f5..bda1371504a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-expo.dtx Copyright (C) 2011-2017 The LaTeX3 Project +%% File: l3fp-expo.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 % @@ -176,14 +176,14 @@ \cs_new:Npn \@@_ln_npos_o:w \s_@@ \@@_chk:w 10#1#2#3; { %^^A todo: ln(1) should be "exact zero", not "underflow" \exp_after:wN \@@_sanitize:Nw - \__int_value:w % for the overall sign + \int_value:w % for the overall sign \if_int_compare:w #1 < 1 \exp_stop_f: 2 \else: 0 \fi: \exp_after:wN \exp_stop_f: - \__int_value:w \__int_eval:w % for the exponent + \int_value:w \@@_int_eval:w % for the exponent \@@_ln_significand:NNNNnnnN #2#3 \@@_ln_exponent:wn {#1} } @@ -203,11 +203,11 @@ \cs_new:Npn \@@_ln_significand:NNNNnnnN #1#2#3#4 { \exp_after:wN \@@_ln_x_ii:wnnnn - \__int_value:w + \int_value:w \if_case:w #1 \exp_stop_f: \or: \if_int_compare:w #2 < 4 \exp_stop_f: - \__int_eval:w 10 - #2 + \@@_int_eval:w 10 - #2 \else: 6 \fi: @@ -230,14 +230,14 @@ \cs_new:Npn \@@_ln_x_ii:wnnnn #1; #2#3#4#5 { \exp_after:wN \@@_ln_div_after:Nw - \cs:w c_@@_ln_ \__int_to_roman:w #1 _fixed_tl \exp_after:wN \cs_end: - \__int_value:w + \cs:w c_@@_ln_ \@@_int_to_roman:w #1 _fixed_tl \exp_after:wN \cs_end: + \int_value:w \exp_after:wN \@@_ln_x_iv:wnnnnnnnn - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w \exp_after:wN \@@_ln_x_iii_var:NNNNNw - \__int_value:w \__int_eval:w 9999 9990 + #1*#2#3 + + \int_value:w \@@_int_eval:w 9999 9990 + #1*#2#3 + \exp_after:wN \@@_ln_x_iii:NNNNNNw - \__int_value:w \__int_eval:w 10 0000 0000 + #1*#4#5 ; + \int_value:w \@@_int_eval:w 10 0000 0000 + #1*#4#5 ; {20000} {0000} {0000} {0000} } %^^A todo: reoptimize (a generalization attempt failed). \cs_new:Npn \@@_ln_x_iii:NNNNNNw #1#2 #3#4#5#6 #7; @@ -280,7 +280,7 @@ % \frac {\left\lfloor 10^8 \cdot A\right\rfloor} {y} - \frac{1}{2} % \right\rfloor. % \] -% (The $1/2$ comes from how e\TeX{} rounds.) As for division, it is +% (The $1/2$ comes from how \eTeX{} rounds.) As for division, it is % easy to see that $Q_{1} \leq 10^4 A / Z$, \emph{i.e.}, $Q_{1}$ % is an underestimate. % @@ -322,33 +322,33 @@ \cs_new:Npn \@@_ln_x_iv:wnnnnnnnn #1; #2#3#4#5 #6#7#8#9 { \exp_after:wN \@@_div_significand_pack:NNN - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w \@@_ln_div_i:w #1 ; #6 #7 ; {#8} {#9} {#2} {#3} {#4} {#5} - { \exp_after:wN \@@_ln_div_ii:wwn \__int_value:w #1 } - { \exp_after:wN \@@_ln_div_ii:wwn \__int_value:w #1 } - { \exp_after:wN \@@_ln_div_ii:wwn \__int_value:w #1 } - { \exp_after:wN \@@_ln_div_ii:wwn \__int_value:w #1 } - { \exp_after:wN \@@_ln_div_vi:wwn \__int_value:w #1 } + { \exp_after:wN \@@_ln_div_ii:wwn \int_value:w #1 } + { \exp_after:wN \@@_ln_div_ii:wwn \int_value:w #1 } + { \exp_after:wN \@@_ln_div_ii:wwn \int_value:w #1 } + { \exp_after:wN \@@_ln_div_ii:wwn \int_value:w #1 } + { \exp_after:wN \@@_ln_div_vi:wwn \int_value:w #1 } } \cs_new:Npn \@@_ln_div_i:w #1; { \exp_after:wN \@@_div_significand_calc:wwnnnnnnn - \__int_value:w \__int_eval:w 999999 + 2 0000 0000 / #1 ; % Q1 + \int_value:w \@@_int_eval:w 999999 + 2 0000 0000 / #1 ; % Q1 } \cs_new:Npn \@@_ln_div_ii:wwn #1; #2;#3 % y; B1;B2 <- for k=1 { \exp_after:wN \@@_div_significand_pack:NNN - \__int_value:w \__int_eval:w + \int_value:w \@@_int_eval:w \exp_after:wN \@@_div_significand_calc:wwnnnnnnn - \__int_value:w \__int_eval:w 999999 + #2 #3 / #1 ; % Q2 + \int_value:w \@@_int_eval:w 999999 + #2 #3 / #1 ; % Q2 #2 #3 ; } \cs_new:Npn \@@_ln_div_vi:wwn #1; #2;#3#4#5 #6#7#8#9 %y;F1;F2F3F4x1x2x3x4 { \exp_after:wN \@@_div_significand_pack:NNN - \__int_value:w \__int_eval:w 1000000 + #2 #3 / #1 ; % Q6 + \int_value:w \@@_int_eval:w 1000000 + #2 #3 / #1 ; % Q6 } % \end{macrocode} % We now have essentially @@ -396,12 +396,12 @@ \exp_after:wN \@@_ln_t_large:NNw \exp_after:wN + % <sign> \exp_after:wN #1 - \__int_value:w \__int_eval:w 9999 - #2 \exp_after:wN ; - \__int_value:w \__int_eval:w 9999 - #3 \exp_after:wN ; - \__int_value:w \__int_eval:w 9999 - #4 \exp_after:wN ; - \__int_value:w \__int_eval:w 9999 - #5 \exp_after:wN ; - \__int_value:w \__int_eval:w 9999 - #6 \exp_after:wN ; - \__int_value:w \__int_eval:w 1 0000 - #7 ; + \int_value:w \@@_int_eval:w 9999 - #2 \exp_after:wN ; + \int_value:w \@@_int_eval:w 9999 - #3 \exp_after:wN ; + \int_value:w \@@_int_eval:w 9999 - #4 \exp_after:wN ; + \int_value:w \@@_int_eval:w 9999 - #5 \exp_after:wN ; + \int_value:w \@@_int_eval:w 9999 - #6 \exp_after:wN ; + \int_value:w \@@_int_eval:w 1 0000 - #7 ; } % \end{macrocode} % @@ -418,29 +418,30 @@ \cs_new:Npn \@@_ln_t_large:NNw #1 #2 #3; #4; #5; #6; #7; #8; { \exp_after:wN \@@_ln_square_t_after:w - \__int_value:w \__int_eval:w 9999 0000 + #3*#3 + \int_value:w \@@_int_eval:w 9999 0000 + #3*#3 \exp_after:wN \@@_ln_square_t_pack:NNNNNw - \__int_value:w \__int_eval:w 9999 0000 + 2*#3*#4 + \int_value:w \@@_int_eval:w 9999 0000 + 2*#3*#4 \exp_after:wN \@@_ln_square_t_pack:NNNNNw - \__int_value:w \__int_eval:w 9999 0000 + 2*#3*#5 + #4*#4 + \int_value:w \@@_int_eval:w 9999 0000 + 2*#3*#5 + #4*#4 \exp_after:wN \@@_ln_square_t_pack:NNNNNw - \__int_value:w \__int_eval:w 9999 0000 + 2*#3*#6 + 2*#4*#5 + \int_value:w \@@_int_eval:w 9999 0000 + 2*#3*#6 + 2*#4*#5 \exp_after:wN \@@_ln_square_t_pack:NNNNNw - \__int_value:w \__int_eval:w 1 0000 0000 + 2*#3*#7 + 2*#4*#6 + #5*#5 + \int_value:w \@@_int_eval:w + 1 0000 0000 + 2*#3*#7 + 2*#4*#6 + #5*#5 + (2*#3*#8 + 2*#4*#7 + 2*#5*#6) / 1 0000 % ; ; ; \exp_after:wN \@@_ln_twice_t_after:w - \__int_value:w \__int_eval:w -1 + 2*#3 + \int_value:w \@@_int_eval:w -1 + 2*#3 \exp_after:wN \@@_ln_twice_t_pack:Nw - \__int_value:w \__int_eval:w 9999 + 2*#4 + \int_value:w \@@_int_eval:w 9999 + 2*#4 \exp_after:wN \@@_ln_twice_t_pack:Nw - \__int_value:w \__int_eval:w 9999 + 2*#5 + \int_value:w \@@_int_eval:w 9999 + 2*#5 \exp_after:wN \@@_ln_twice_t_pack:Nw - \__int_value:w \__int_eval:w 9999 + 2*#6 + \int_value:w \@@_int_eval:w 9999 + 2*#6 \exp_after:wN \@@_ln_twice_t_pack:Nw - \__int_value:w \__int_eval:w 9999 + 2*#7 + \int_value:w \@@_int_eval:w 9999 + 2*#7 \exp_after:wN \@@_ln_twice_t_pack:Nw - \__int_value:w \__int_eval:w 10000 + 2*#8 ; ; + \int_value:w \@@_int_eval:w 10000 + 2*#8 ; ; { \@@_ln_c:NwNw #1 } #2 } @@ -494,7 +495,7 @@ \@@_fixed_mul:wwn #3; { \exp_after:wN \@@_ln_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - 2 ; + \int_value:w \@@_int_eval:w #1 - 2 ; } #3; } @@ -502,7 +503,7 @@ { \fi: \exp_after:wN \@@_fixed_mul:wwn - \exp_after:wN { \__int_value:w \__int_eval:w 10000 + #2 } #3; + \exp_after:wN { \int_value:w \@@_int_eval:w 10000 + #2 } #3; } % \end{macrocode} % \end{macro} @@ -556,16 +557,16 @@ \if_case:w #2 \exp_stop_f: 0 \@@_case_return:nw { \@@_fixed_to_float_o:Nw 2 } \or: - \exp_after:wN \@@_ln_exponent_one:ww \__int_value:w + \exp_after:wN \@@_ln_exponent_one:ww \int_value:w \else: \if_int_compare:w #2 > 0 \exp_stop_f: \exp_after:wN \@@_ln_exponent_small:NNww \exp_after:wN 0 - \exp_after:wN \@@_fixed_sub:wwn \__int_value:w + \exp_after:wN \@@_fixed_sub:wwn \int_value:w \else: \exp_after:wN \@@_ln_exponent_small:NNww \exp_after:wN 2 - \exp_after:wN \@@_fixed_add:wwn \__int_value:w - + \exp_after:wN \@@_fixed_add:wwn \int_value:w - \fi: \fi: #2; #1; @@ -648,7 +649,7 @@ \else: \exp_after:wN \@@_sanitize:Nw \exp_after:wN 0 - \__int_value:w #1 \__int_eval:w + \int_value:w #1 \@@_int_eval:w \if_int_compare:w #4 < 0 \exp_stop_f: \exp_after:wN \use_i:nn \else: @@ -698,7 +699,7 @@ ; #2#3#4 0000 0000 ; } \cs_new:Npn \@@_exp_Taylor_ii:ww #1; #2; - { \@@_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__stop } + { \@@_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s_stop } \cs_new:Npn \@@_exp_Taylor_loop:www #1; #2; #3; { \if_int_compare:w #1 = 1 \exp_stop_f: @@ -709,11 +710,11 @@ \@@_fixed_mul:wwn #2 ; { \exp_after:wN \@@_exp_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - 1 ; + \int_value:w \@@_int_eval:w #1 - 1 ; #2 ; } } -\cs_new:Npn \@@_exp_Taylor_break:Nww #1 #2; #3 \s__stop +\cs_new:Npn \@@_exp_Taylor_break:Nww #1 #2; #3 \s_stop { \@@_fixed_add_one:wN #2 ; } % \end{macrocode} % \end{macro} @@ -742,7 +743,7 @@ % current total. The loop is done by having the auxiliary for one % exponent call the auxiliary for the next exponent. The current % total is expressed by leaving the exponent behind in the input -% stream (we are currently within an \cs{__int_eval:w}), and keeping +% stream (we are currently within an \cs{@@_int_eval:w}), and keeping % track of a fixed point number, |#1| for the numbered auxiliaries. % Our usage of \cs{if_case:w} is somewhat dirty for optimization: % \TeX{} jumps to the appropriate case, but we then close the @@ -752,9 +753,9 @@ \cs_new:Npn \@@_exp_pos_large:NnnNwn #1#2#3 #4#5; #6 { \exp_after:wN \exp_after:wN - \cs:w @@_exp_large_ \__int_to_roman:w #6 :wN \exp_after:wN \cs_end: + \cs:w @@_exp_large_ \@@_int_to_roman:w #6 :wN \exp_after:wN \cs_end: \exp_after:wN \c_@@_one_fixed_tl - \__int_value:w #3 #4 \exp_stop_f: + \int_value:w #3 #4 \exp_stop_f: #5 00000 ; } \cs_new:Npn \@@_exp_large:w #1 \or: #2 \fi: @@ -989,7 +990,7 @@ \cs_new:Npn \@@_pow_normal_o:ww \s_@@ \@@_chk:w 1 #1#2#3; \s_@@ \@@_chk:w #4#5 { - \if_int_compare:w \__str_if_eq_x:nn { #2 #3 } + \if_int_compare:w \@@_str_if_eq_x:nn { #2 #3 } { 1 {1000} {0000} {0000} {0000} } = 0 \exp_stop_f: \if_int_compare:w #4 #1 = 32 \exp_stop_f: \exp_after:wN \@@_case_return_ii_o:ww @@ -1036,7 +1037,7 @@ { \exp_after:wN \@@_sanitize:Nw \exp_after:wN 0 - \__int_value:w + \int_value:w \if:w #1 \if_int_compare:w #3 > 0 \exp_stop_f: 0 \else: 2 \fi: \exp_after:wN \@@_pow_npos_aux:NNnww \exp_after:wN + @@ -1060,7 +1061,7 @@ \cs_new:Npn \@@_pow_npos_aux:NNnww #1#2#3#4#5; \s_@@ \@@_chk:w 1#6#7#8; { #1 - \__int_eval:w + \@@_int_eval:w \@@_ln_significand:NNNNnnnN #4#5 \@@_pow_exponent:wnN {#3} \@@_fixed_mul:wwn #8 {0000}{0000} ; @@ -1081,37 +1082,37 @@ \cs_new:Npn \@@_pow_exponent:Nwnnnnnw #1#2; #3#4#5#6#7#8; { %^^A todo: use that in ln. \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#2*23025 - #1 #3 \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 #2*8509 - #1 #4 \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 #2*2994 - #1 #5 \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 #2*0456 - #1 #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 #1 #2*8401 - #1 #7 #1 ( #2*7991 - #8 ) / 1 0000 ; ; } \cs_new:Npn \@@_pow_B:wwN #1#2#3#4#5#6; #7; { \if_int_compare:w #7 < 0 \exp_stop_f: - \exp_after:wN \@@_pow_C_neg:w \__int_value:w - + \exp_after:wN \@@_pow_C_neg:w \int_value:w - \else: \if_int_compare:w #7 < 22 \exp_stop_f: - \exp_after:wN \@@_pow_C_pos:w \__int_value:w + \exp_after:wN \@@_pow_C_pos:w \int_value:w \else: - \exp_after:wN \@@_pow_C_overflow:w \__int_value:w + \exp_after:wN \@@_pow_C_overflow:w \int_value:w \fi: \fi: #7 \exp_after:wN ; - \__int_value:w \__int_eval:w 10 0000 + #1 \__int_eval_end: + \int_value:w \@@_int_eval:w 10 0000 + #1 \@@_int_eval_end: #2#3#4#5#6 0000 0000 0000 0000 0000 0000 ; %^^A todo: how many 0? } \cs_new:Npn \@@_pow_C_overflow:w #1; #2; #3 @@ -1133,11 +1134,11 @@ \exp_after:wN #2 \else: \if_meaning:w 0 #2 - \exp_after:wN \@@_pow_C_pos_loop:wN \__int_value:w + \exp_after:wN \@@_pow_C_pos_loop:wN \int_value:w \else: - \exp_after:wN \@@_pow_C_overflow:w \__int_value:w + \exp_after:wN \@@_pow_C_overflow:w \int_value:w \fi: - \__int_eval:w #1 - 1 \exp_after:wN ; + \@@_int_eval:w #1 - 1 \exp_after:wN ; \fi: } \cs_new:Npn \@@_pow_C_pack:w @@ -1162,7 +1163,7 @@ \if_case:w \@@_pow_neg_case:w #4 ; \exp_after:wN \@@_pow_neg_aux:wNN \or: - \if_int_compare:w \__int_eval:w #1 / 2 = 1 \exp_stop_f: + \if_int_compare:w \@@_int_eval:w #1 / 2 = 1 \exp_stop_f: \@@_invalid_operation_o:Nww ^ #3; #4; \exp:w \exp_end_continue_f:w \exp_after:wN \exp_after:wN @@ -1178,7 +1179,7 @@ \exp_after:wN \s_@@ \exp_after:wN \@@_chk:w \exp_after:wN #2 - \__int_value:w \__int_eval:w 2 - #3 \__int_eval_end: + \int_value:w \@@_int_eval:w 2 - #3 \@@_int_eval_end: } % \end{macrocode} % ^^A todo: is this \@@_exp_after_o:w necessary? Appropriate? |