summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx108
1 files changed, 55 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
index 8bdb1f07152..6b4ed3846d3 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
@@ -22,7 +22,7 @@
%
%<*driver>
\documentclass[full]{l3doc}
-\GetIdInfo$Id: l3fp-basics.dtx 6805 2016-12-28 22:15:52Z joseph $
+\GetIdInfo$Id: l3fp-basics.dtx 6943 2017-02-17 16:47:59Z bruno $
{L3 Floating-point arithmetic}
\begin{document}
\DocInput{\jobname.dtx}
@@ -92,7 +92,7 @@
% |{0000}|.
% \begin{macrocode}
\cs_new:Npn \@@_basics_pack_low:NNNNNw #1 #2#3#4#5 #6;
- { + #1 - \c_one ; {#2#3#4#5} {#6} ; }
+ { + #1 - 1 ; {#2#3#4#5} {#6} ; }
\cs_new:Npn \@@_basics_pack_high:NNNNNw #1 #2#3#4#5 #6;
{
\if_meaning:w 2 #1
@@ -101,7 +101,7 @@
; {#2#3#4#5} {#6}
}
\cs_new:Npn \@@_basics_pack_high_carry:w \fi: ; #1
- { \fi: + \c_one ; {1000} }
+ { \fi: + 1 ; {1000} }
% \end{macrocode}
% \end{macro}
%
@@ -116,7 +116,7 @@
\cs_new:Npn \@@_basics_pack_weird_low:NNNNw #1 #2#3#4 #5;
{
\if_meaning:w 2 #1
- + \c_one
+ + 1
\fi:
\__int_eval_end:
#2#3#4; {#5} ;
@@ -196,14 +196,15 @@
{
\if_case:w
\if_meaning:w #2 #4
- #2 \exp_stop_f:
+ #2
\else:
\if_int_compare:w #2 > #4 \exp_stop_f:
- \c_three
+ 3
\else:
- \c_four
+ 4
\fi:
\fi:
+ \exp_stop_f:
\exp_after:wN \@@_add_zeros_o:Nww \__int_value:w
\or: \exp_after:wN \@@_add_normal_o:Nww \__int_value:w
\or: \exp_after:wN \@@_add_inf_o:Nww \__int_value:w
@@ -393,7 +394,7 @@
\cs_new:Npn \@@_add_significand_pack:NNNNNNN #1 #2#3#4#5#6#7
{
\if_meaning:w 2 #1
- + \c_one
+ + 1
\fi:
; #2 #3 #4 #5 #6 #7 ;
}
@@ -444,7 +445,7 @@
\cs_new:Npn \@@_add_significand_carry_o:wwwNN
#1; #2; #3#4; #5#6
{
- + \c_one
+ + 1
\exp_after:wN \@@_basics_pack_weird_high:NNNNNNNNw
\__int_value:w \__int_eval:w 1 1 #1
\exp_after:wN \@@_basics_pack_weird_low:NNNNw
@@ -489,7 +490,7 @@
\cs_new:Npn \@@_sub_npos_ii_o:Nnwnw #1 #2; #3;
{
\exp_after:wN \@@_sub_npos_i_o:Nnwnw
- \__int_value:w \__int_eval:w \c_two - #1 \__int_eval_end:
+ \__int_value:w \@@_neg_sign:N #1
#3; #2;
}
% \end{macrocode}
@@ -517,7 +518,7 @@
\exp_after:wN \@@_sub_back_near_o:nnnnnnnnN
\else:
\exp_after:wN \@@_decimate:nNnnnn \exp_after:wN
- { \__int_value:w \__int_eval:w #2 - #4 - \c_one \exp_after:wN }
+ { \__int_value:w \__int_eval:w #2 - #4 - 1 \exp_after:wN }
\exp_after:wN \@@_sub_back_far_o:NnnwnnnnN
\fi:
#5
@@ -546,7 +547,7 @@
\cs_new:Npn \@@_sub_back_near_o:nnnnnnnnN #1#2#3#4 #5#6#7#8 #9
{
\exp_after:wN \@@_sub_back_near_after:wNNNNw
- \__int_value:w \__int_eval:w 10#5#6 - #1#2 - \c_eleven
+ \__int_value:w \__int_eval:w 10#5#6 - #1#2 - 11
\exp_after:wN \@@_sub_back_near_pack:NNNNNNw
\__int_value:w \__int_eval:w 11#7#8 - #3#4 \exp_after:wN ;
}
@@ -594,7 +595,7 @@
\cs_new:Npn \@@_sub_back_shift_ii:ww #1 0 ; #2#3 ;
{
\if_meaning:w @ #1 @
- - \c_seven
+ - 7
- \exp_after:wN \use_i:nnn
\exp_after:wN \@@_sub_back_shift_iii:NNNNNNNNw
\__int_value:w #2#3 0 ~ 123456789;
@@ -637,13 +638,14 @@
\if_case:w
\if_int_compare:w 1 #2 = #5#6 \use_i:nnnn #7 \exp_stop_f:
\if_int_compare:w #3 = \use_none:n #7#8 0 \exp_stop_f:
- \c_zero
+ 0
\else:
- \if_int_compare:w #3 > \use_none:n #7#8 0 - \fi: \c_one
+ \if_int_compare:w #3 > \use_none:n #7#8 0 - \fi: 1
\fi:
\else:
- \if_int_compare:w 1 #2 > #5#6 \use_i:nnnn #7 - \fi: \c_one
+ \if_int_compare:w 1 #2 > #5#6 \use_i:nnnn #7 - \fi: 1
\fi:
+ \exp_stop_f:
\exp_after:wN \@@_sub_back_quite_far_o:wwNN
\or: \exp_after:wN \@@_sub_back_very_far_o:wwwwNN
\else: \exp_after:wN \@@_sub_back_not_far_o:wwwwNN
@@ -678,7 +680,7 @@
\exp_after:wN \use_ii:nn
\fi:
{ ; {1000} {0000} {0000} {0000} ; }
- { - \c_one ; {9999} {9999} {9999} {9999} ; }
+ { - 1 ; {9999} {9999} {9999} {9999} ; }
}
% \end{macrocode}
% \end{macro}
@@ -687,7 +689,7 @@
% \begin{macro}[aux, rEXP]{\@@_sub_back_not_far_o:wwwwNN}
% In the present case, $x$ and $y$ have different exponents, but
% $y$~is large enough that $x-y$ has a smaller exponent than~$x$.
-% Decrement the exponent (with |- \c_one|). Then proceed in a way
+% Decrement the exponent (with |-1|). Then proceed in a way
% similar to the \texttt{near} auxiliaries seen earlier, but
% multiplying $x$ by~$10$ (|#30| and |#40| below), and with the added
% quirk that the \meta{rounding} digit has to be taken into account.
@@ -701,9 +703,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_sub_back_not_far_o:wwwwNN #1 ~ #2; #3 ~ #4; #5#6
{
- - \c_one
+ - 1
\exp_after:wN \@@_sub_back_near_after:wNNNNw
- \__int_value:w \__int_eval:w 1#30 - #1 - \c_eleven
+ \__int_value:w \__int_eval:w 1#30 - #1 - 11
\exp_after:wN \@@_sub_back_near_pack:NNNNNNw
\__int_value:w \__int_eval:w 11 0000 0000 + #40 - #2
- \exp_after:wN \@@_round_neg:NNN
@@ -736,7 +738,7 @@
\cs_new:Npn \@@_sub_back_very_far_ii_o:nnNwwNN #1#2 ; #3 ; #4 ~ #5; #6#7
{
\exp_after:wN \@@_basics_pack_high:NNNNNw
- \__int_value:w \__int_eval:w 1#4 - #1 - \c_one
+ \__int_value:w \__int_eval:w 1#4 - #1 - 1
\exp_after:wN \@@_basics_pack_low:NNNNNw
\__int_value:w \__int_eval:w 2#5 - #2
- \exp_after:wN \@@_round_neg:NNN
@@ -767,7 +769,7 @@
{
\@@_mul_cases_o:NnNnww
*
- { - \c_two + }
+ { - 2 + }
\@@_mul_npos_o:Nww
{ }
}
@@ -798,24 +800,24 @@
#1#2#3#4 \s_@@ \@@_chk:w #5#6#7; \s_@@ \@@_chk:w #8#9
{
\if_case:w \__int_eval:w
- \if_int_compare:w #5 #8 = \c_eleven
- \c_one
+ \if_int_compare:w #5 #8 = 11 ~
+ 1
\else:
\if_meaning:w 3 #8
- \c_three
+ 3
\else:
\if_meaning:w 3 #5
- \c_two
+ 2
\else:
- \if_int_compare:w #5 #8 = \c_ten
- \c_nine #2 - \c_two
+ \if_int_compare:w #5 #8 = 10 ~
+ 9 #2 - 2
\else:
- (#5 #2 #8) / \c_two * \c_two + \c_seven
+ (#5 #2 #8) / 2 * 2 + 7
\fi:
\fi:
\fi:
\fi:
- \if_meaning:w #6 #9 - \c_one \fi:
+ \if_meaning:w #6 #9 - 1 \fi:
\__int_eval_end:
\@@_case_use:nw { #3 0 }
\or: \@@_case_use:nw { #3 2 }
@@ -974,7 +976,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_mul_significand_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7
{
- - \c_one
+ - 1
\exp_after:wN \@@_basics_pack_high:NNNNNw
\__int_value:w \__int_eval:w 1#3#4
\exp_after:wN \@@_basics_pack_low:NNNNNw
@@ -998,7 +1000,7 @@
% Filtering special floating point is very similar to what we did for
% multiplications, with a few variations. Invalid operation
% exceptions display |/| rather than |*|. In the formula for
-% dispatch, we replace |- \c_two +| by |-|. The case of normal
+% dispatch, we replace |- 2 +| by |-|. The case of normal
% numbers is treated using \cs{@@_div_npos_o:Nww} rather than
% \cs{@@_mul_npos_o:Nww}. There are two additional cases: if the
% first operand is normal and the second is a zero, then the division
@@ -1049,7 +1051,7 @@
\__int_value:w \__int_eval:w
#3 - #6
\exp_after:wN \@@_div_significand_i_o:wnnw
- \__int_value:w \__int_eval:w #7 \use_i:nnnn #8 + \c_one ;
+ \__int_value:w \__int_eval:w #7 \use_i:nnnn #8 + 1 ;
#4
{#7}{#8}#9 ;
#1
@@ -1404,7 +1406,7 @@
{
0
\exp_after:wN \@@_div_significand_iv:wwnnnnnnn
- \__int_value:w \__int_eval:w (\c_two * #2 #3) / #6 #7 ; % <- P
+ \__int_value:w \__int_eval:w ( 2 * #2 #3) / #6 #7 ; % <- P
#2 ; {#3} {#4} {#5}
{#6} {#7}
}
@@ -1461,7 +1463,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_div_significand_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9
{
- + \c_five * #1
+ + 5 * #1
\exp_after:wN \@@_div_significand_vi:Nw
\__int_value:w \__int_eval:w -20 + 2*#2#3 - #1*#6#7 +
\exp_after:wN \@@_div_significand_v:NN
@@ -1473,9 +1475,9 @@
\cs_new:Npn \@@_div_significand_vi:Nw #1#2;
{
\if_meaning:w 0 #1
- \if_int_compare:w \__int_eval:w #2 > \c_zero + \c_one \fi:
+ \if_int_compare:w \__int_eval:w #2 > 0 + 1 \fi:
\else:
- \if_meaning:w - #1 - \else: + \fi: \c_one
+ \if_meaning:w - #1 - \else: + \fi: 1
\fi:
;
}
@@ -1565,7 +1567,7 @@
\cs_new:Npn \@@_div_significand_large_o:wwwNNNNwN
#1; #2; #3; #4#5#6#7#8; #9
{
- + \c_one
+ + 1
\exp_after:wN \@@_basics_pack_weird_high:NNNNNNNNw
\__int_value:w \__int_eval:w 1 #1 #2
\exp_after:wN \@@_basics_pack_weird_low:NNNNw
@@ -1621,12 +1623,12 @@
\if_int_odd:w #1 \exp_stop_f:
\exp_after:wN \@@_sqrt_npos_auxi_o:wwnnN
\fi:
- #1 / \c_two
+ #1 / 2
\@@_sqrt_Newton_o:wwn 56234133; 0; {#2#3} {#4#5} 0
}
-\cs_new:Npn \@@_sqrt_npos_auxi_o:wwnnN #1 / \c_two #2; 0; #3#4#5
+\cs_new:Npn \@@_sqrt_npos_auxi_o:wwnnN #1 / 2 #2; 0; #3#4#5
{
- ( #1 + \c_one ) / \c_two
+ ( #1 + 1 ) / 2
\@@_pack_eight:wNNNNNNNN
\@@_sqrt_npos_auxii_o:wNNNNNNNN
;
@@ -1710,7 +1712,7 @@
\exp_after:wN \@@_use_none_until_s:w
\fi:
\exp_after:wN \@@_sqrt_Newton_o:wwn
- \__int_value:w \__int_eval:w (#1 + #3 * 1 0000 0000 / #1) / \c_two ;
+ \__int_value:w \__int_eval:w (#1 + #3 * 1 0000 0000 / #1) / 2 ;
#1; {#3}
}
% \end{macrocode}
@@ -1880,15 +1882,15 @@
\cs_new:Npn \@@_sqrt_auxiii_o:wnnnnnnnn
#1; #2#3#4#5#6#7#8#9
{
- \if_int_compare:w #1 > \c_one
+ \if_int_compare:w #1 > 1 \exp_stop_f:
\exp_after:wN \@@_sqrt_auxiv_o:NNNNNw
\__int_value:w \__int_eval:w (#1#2 %)
\else:
- \if_int_compare:w #1#2 > \c_one
+ \if_int_compare:w #1#2 > 1 \exp_stop_f:
\exp_after:wN \@@_sqrt_auxv_o:NNNNNw
\__int_value:w \__int_eval:w (#1#2#3 %)
\else:
- \if_int_compare:w #1#2#3 > \c_one
+ \if_int_compare:w #1#2#3 > 1 \exp_stop_f:
\exp_after:wN \@@_sqrt_auxvi_o:NNNNNw
\__int_value:w \__int_eval:w (#1#2#3#4 %)
\else:
@@ -1906,7 +1908,7 @@
{ \@@_sqrt_auxviii_o:nnnnnnn {0000000#1} {#2#3#4#5#6} }
\cs_new:Npn \@@_sqrt_auxvii_o:NNNNNw 1#1#2#3#4#5#6;
{
- \if_int_compare:w #1#2 = \c_zero
+ \if_int_compare:w #1#2 = 0 \exp_stop_f:
\exp_after:wN \@@_sqrt_auxx_o:Nnnnnnnn
\fi:
\@@_sqrt_auxviii_o:nnnnnnn {00000000} {000#1#2#3#4#5}
@@ -1982,7 +1984,7 @@
\@@_sqrt_auxii_o:NnnnnnnnN
\@@_sqrt_auxxii_o:nnnnnnnnw
#2 {#1}
- {#3} { #4 + \c_one } #5
+ {#3} { #4 + 1 } #5
}
% \end{macrocode}
% \end{macro}
@@ -2001,11 +2003,11 @@
% \begin{macrocode}
\cs_new:Npn \@@_sqrt_auxxii_o:nnnnnnnnw 0; #1#2#3#4#5#6#7#8 #9;
{
- \if_int_compare:w #1#2 > \c_zero
- \if_int_compare:w #1#2 = \c_one
- \if_int_compare:w #3#4 = \c_zero
- \if_int_compare:w #5#6 = \c_zero
- \if_int_compare:w #7#8 = \c_zero
+ \if_int_compare:w #1#2 > 0 \exp_stop_f:
+ \if_int_compare:w #1#2 = 1 \exp_stop_f:
+ \if_int_compare:w #3#4 = 0 \exp_stop_f:
+ \if_int_compare:w #5#6 = 0 \exp_stop_f:
+ \if_int_compare:w #7#8 = 0 \exp_stop_f:
\@@_sqrt_auxxiii_o:w
\fi:
\fi:
@@ -2055,7 +2057,7 @@
\exp_after:wN \@@_basics_pack_low:NNNNNw
\__int_value:w \__int_eval:w 1 0000 0000
+ #4#5
- \if_int_compare:w #6 > #1 \exp_stop_f: + \c_one \fi:
+ \if_int_compare:w #6 > #1 \exp_stop_f: + 1 \fi:
+ \exp_after:wN \@@_round:NNN
\exp_after:wN 0
\exp_after:wN 0