diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 60a4e2a60e4..20cf9ed759c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -7,7 +7,7 @@ % license or (at your option) any later version. The latest version % of this license is in the file % -% http://www.latex-project.org/lppl.txt +% https://www.latex-project.org/lppl.txt % % This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver> -\documentclass[full]{l3doc} +\documentclass[full,kernel]{l3doc} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/11/14} +% \date{Released 2017/12/05} % % \maketitle % @@ -70,7 +70,7 @@ % Floating Point Arithmetic}, by David Goldberg, which can be found at % \texttt{http://cr.yp.to/2005-590/goldberg.pdf}. % -% \begin{macro}[aux, EXP] +% \begin{macro}[EXP] % { % \@@_parse_word_abs:N , % \@@_parse_word_sign:N , @@ -117,7 +117,7 @@ % % \subsubsection{Sign, exponent, and special numbers} % -% \begin{macro}[int, EXP]{\@@_-_o:ww} +% \begin{macro}[EXP]{\@@_-_o:ww} % The \cs{@@_+_o:ww} auxiliary has a hook: it takes one argument % between the first \cs{s_@@} and \cs{@@_chk:w}, which is applied to % the sign of the second operand. Positioning the hook there means @@ -132,7 +132,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_+_o:ww} +% \begin{macro}[EXP]{\@@_+_o:ww} % This function is either called directly with an empty |#1| to % compute an addition, or it is called by \cs{@@_-_o:ww} with % \cs{@@_neg_sign:N} as |#1| to compute a subtraction, in which case @@ -175,7 +175,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_add_return_ii_o:Nww} +% \begin{macro}[EXP]{\@@_add_return_ii_o:Nww} % Ignore the first operand, and return the second, but using the sign % |#1| rather than |#4|. As usual, expand after the floating point. % \begin{macrocode} @@ -184,7 +184,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_add_zeros_o:Nww} +% \begin{macro}[EXP]{\@@_add_zeros_o:Nww} % Adding two zeros yields \cs{c_zero_fp}, except if both zeros were % $-0$. % \begin{macrocode} @@ -201,7 +201,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_add_inf_o:Nww} +% \begin{macro}[EXP]{\@@_add_inf_o:Nww} % If both infinities have the same sign, just return that infinity, % otherwise, it is an invalid operation. We find out if that invalid % operation is an addition or a subtraction by testing whether the @@ -226,7 +226,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_add_normal_o:Nww} +% \begin{macro}[EXP]{\@@_add_normal_o:Nww} % \begin{quote} % \cs{@@_add_normal_o:Nww} \meta{sign_2} % \cs{s_@@} \cs{@@_chk:w} |1| \meta{sign_1} @@ -254,7 +254,7 @@ % In this subsection, we perform the addition of two positive normal % numbers. % -% \begin{macro}[aux, EXP]{\@@_add_npos_o:NnwNnw} +% \begin{macro}[EXP]{\@@_add_npos_o:NnwNnw} % \begin{quote} % \cs{@@_add_npos_o:NnwNnw} \meta{sign_1} \meta{exp_1} \meta{body_1} % |;| \cs{s_@@} \cs{@@_chk:w} |1| \meta{initial sign_2} \meta{exp_2} @@ -288,8 +288,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, rEXP]{\@@_add_big_i_o:wNww} -% \begin{macro}[aux, rEXP]{\@@_add_big_ii_o:wNww} +% \begin{macro}[rEXP]{\@@_add_big_i_o:wNww} +% \begin{macro}[rEXP]{\@@_add_big_ii_o:wNww} % \begin{quote} % \cs{@@_add_big_i_o:wNww} \meta{shift} |;| \meta{final sign} % \meta{body_1} |;| \meta{body_2} |;| @@ -318,8 +318,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_add_significand_o:NnnwnnnnN} -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP]{\@@_add_significand_o:NnnwnnnnN} +% \begin{macro}[rEXP] % {\@@_add_significand_pack:NNNNNNN, \@@_add_significand_test_o:N} % \begin{quote}\raggedright % \cs{@@_add_significand_o:NnnwnnnnN} @@ -363,7 +363,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_add_significand_no_carry_o:wwwNN} +% \begin{macro}[rEXP]{\@@_add_significand_no_carry_o:wwwNN} % \begin{quote} % \cs{@@_add_significand_no_carry_o:wwwNN} % \meta{8d} |;| \meta{6d} |;| \meta{2d} |;| @@ -386,7 +386,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_add_significand_carry_o:wwwNN} +% \begin{macro}[rEXP]{\@@_add_significand_carry_o:wwwNN} % \begin{quote} % \cs{@@_add_significand_carry_o:wwwNN} % \meta{8d} |;| \meta{6d} |;| \meta{2d} |;| @@ -414,8 +414,8 @@ % % \subsubsection{Absolute subtraction} % -% \begin{macro}[aux, EXP]{\@@_sub_npos_o:NnwNnw} -% \begin{macro}[aux, EXP]{\@@_sub_eq_o:Nnwnw, \@@_sub_npos_ii_o:Nnwnw} +% \begin{macro}[EXP]{\@@_sub_npos_o:NnwNnw} +% \begin{macro}[EXP]{\@@_sub_eq_o:Nnwnw, \@@_sub_npos_ii_o:Nnwnw} % \begin{quote} % \cs{@@_sub_npos_o:NnwNnw} % \meta{sign_1} \meta{exp_1} \meta{body_1} |;| @@ -450,7 +450,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_sub_npos_i_o:Nnwnw} +% \begin{macro}[EXP]{\@@_sub_npos_i_o:Nnwnw} % After the computation is done, \cs{@@_sanitize:Nw} checks for % overflow/underflow. It expects the \meta{final sign} and the % \meta{exponent} (delimited by |;|). Start an integer expression for @@ -481,8 +481,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sub_back_near_o:nnnnnnnnN} -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP]{\@@_sub_back_near_o:nnnnnnnnN} +% \begin{macro}[rEXP] % {\@@_sub_back_near_pack:NNNNNNw, \@@_sub_back_near_after:wNNNNw} % \begin{quote} % \cs{@@_sub_back_near_o:nnnnnnnnN} @@ -517,8 +517,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sub_back_shift:wnnnn} -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP]{\@@_sub_back_shift:wnnnn} +% \begin{macro}[rEXP] % { % \@@_sub_back_shift_ii:ww, % \@@_sub_back_shift_iii:NNNNNNNNw, @@ -568,7 +568,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sub_back_far_o:NnnwnnnnN} +% \begin{macro}[rEXP]{\@@_sub_back_far_o:NnnwnnnnN} % \begin{quote}\raggedright % \cs{@@_sub_back_far_o:NnnwnnnnN} % \meta{rounding} \Arg{Y'_1} \Arg{Y'_2} \meta{extra-digits} |;| @@ -608,8 +608,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_sub_back_quite_far_o:wwNN} -% \begin{macro}[aux, EXP]{\@@_sub_back_quite_far_ii:NN} +% \begin{macro}[EXP]{\@@_sub_back_quite_far_o:wwNN} +% \begin{macro}[EXP]{\@@_sub_back_quite_far_ii:NN} % The easiest case is when $x-y$ is extremely close to a power of % $10$, namely the first digit of $x$ is $1$, and all others vanish % when subtracting $y$. Then the \meta{rounding} |#3| and the @@ -639,7 +639,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sub_back_not_far_o:wwwwNN} +% \begin{macro}[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 |-1|). Then proceed in a way @@ -669,8 +669,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_sub_back_very_far_o:wwwwNN} -% \begin{macro}[aux, EXP]{\@@_sub_back_very_far_ii_o:nnNwwNN} +% \begin{macro}[EXP]{\@@_sub_back_very_far_o:wwwwNN} +% \begin{macro}[EXP]{\@@_sub_back_very_far_ii_o:nnNwwNN} % The case where $x-y$ and $x$ have the same exponent is a bit more % tricky, mostly because it cannot reuse the same auxiliaries. Shift % the $y$~significand by adding a leading~$0$. Then the logic is similar @@ -710,7 +710,7 @@ % % \subsubsection{Signs, and special numbers} % -% \begin{macro}[int, EXP]{\@@_*_o:ww} +% \begin{macro}[EXP]{\@@_*_o:ww} % We go through an auxiliary, which is common with \cs{@@_/_o:ww}. % The first argument is the operation, used for the invalid operation % exception. The second is inserted in a formula to dispatch cases @@ -729,7 +729,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_mul_cases_o:nNnnww} +% \begin{macro}[EXP]{\@@_mul_cases_o:nNnnww} % Split into $10$ cases ($12$ for division). % If both numbers are normal, go to case $0$ % (same sign) or case $1$ (opposite signs): in both cases, call @@ -795,7 +795,7 @@ % In this subsection, we perform the multiplication % of two positive normal numbers. % -% \begin{macro}[int, EXP]{\@@_mul_npos_o:Nww} +% \begin{macro}[EXP]{\@@_mul_npos_o:Nww} % \begin{quote} % \cs{@@_mul_npos_o:Nww} \meta{final sign} % \cs{s_@@} \cs{@@_chk:w} |1| \meta{sign_1} \Arg{exp_1} \meta{body_1} |;| @@ -822,8 +822,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_mul_significand_o:nnnnNnnnn} -% \begin{macro}[aux, EXP] +% \begin{macro}[rEXP]{\@@_mul_significand_o:nnnnNnnnn} +% \begin{macro}[EXP] % {\@@_mul_significand_drop:NNNNNw, \@@_mul_significand_keep:NNNNNw} % \begin{quote} % \cs{@@_mul_significand_o:nnnnNnnnn} @@ -873,7 +873,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_mul_significand_test_f:NNN} +% \begin{macro}[rEXP]{\@@_mul_significand_test_f:NNN} % \begin{quote} % \cs{@@_mul_significand_test_f:NNN} \meta{sign} |1| % \meta{digits 1--8} |;| \meta{digits 9--12} |;| \meta{digits 13--16} |;| @@ -899,7 +899,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_mul_significand_large_f:NwwNNNN} +% \begin{macro}[EXP]{\@@_mul_significand_large_f:NwwNNNN} % In this branch, \meta{digit 1} is non-zero. The result is thus % \meta{digits 1--16}, plus some rounding which depends on the digits % $16$, $17$, and whether all subsequent digits are zero or not. @@ -921,7 +921,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_mul_significand_small_f:NNwwwN} +% \begin{macro}[rEXP]{\@@_mul_significand_small_f:NNwwwN} % In this branch, \meta{digit 1} is zero. Our result is thus % \meta{digits 2--17}, plus some rounding which depends on the digits % $17$, $18$, and whether all subsequent digits are zero or not. @@ -951,7 +951,7 @@ % Time is now ripe to tackle the hardest of the four elementary % operations: division. % -% \begin{macro}[int, EXP]{\@@_/_o:ww} +% \begin{macro}[EXP]{\@@_/_o:ww} % 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 @@ -981,7 +981,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_div_npos_o:Nww} +% \begin{macro}[EXP]{\@@_div_npos_o:Nww} % \begin{quote} % \cs{@@_div_npos_o:Nww} \meta{final sign} % \cs{s_@@} \cs{@@_chk:w} |1| \meta{sign_A} \Arg{exp A} @@ -1185,7 +1185,7 @@ % % \subsubsection{Implementing the significand division} % -% \begin{macro}[aux, rEXP]{\@@_div_significand_i_o:wnnw} +% \begin{macro}[rEXP]{\@@_div_significand_i_o:wnnw} % \begin{quote} % \cs{@@_div_significand_i_o:wnnw} \meta{y} |;| % \Arg{A_1} \Arg{A_2} \Arg{A_3} \Arg{A_4} @@ -1215,8 +1215,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, rEXP]{\@@_div_significand_calc:wwnnnnnnn} -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP]{\@@_div_significand_calc:wwnnnnnnn} +% \begin{macro}[rEXP] % { % \@@_div_significand_calc_i:wwnnnnnnn, % \@@_div_significand_calc_ii:wwnnnnnnn, @@ -1320,7 +1320,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_div_significand_ii:wwn} +% \begin{macro}[EXP]{\@@_div_significand_ii:wwn} % \begin{quote} % \cs{@@_div_significand_ii:wwn} \meta{y} |;| % \meta{B_1} |;| \Arg{B_2} \Arg{B_3} \Arg{B_4} @@ -1346,7 +1346,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_div_significand_iii:wwnnnnn} +% \begin{macro}[rEXP]{\@@_div_significand_iii:wwnnnnn} % \begin{quote} % \cs{@@_div_significand_iii:wwnnnnn} \meta{y} |;| % \meta{E_1} |;| \Arg{E_2} \Arg{E_3} \Arg{E_4} @@ -1368,7 +1368,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP] % { % \@@_div_significand_iv:wwnnnnnnn, % \@@_div_significand_v:NNw, @@ -1439,7 +1439,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_div_significand_pack:NNN} +% \begin{macro}[EXP]{\@@_div_significand_pack:NNN} % At this stage, we are in the following situation: \TeX{} is in the % process of expanding several integer expressions, thus functions at % the bottom expand before those above. @@ -1461,7 +1461,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_div_significand_test_o:w} +% \begin{macro}[rEXP]{\@@_div_significand_test_o:w} % \begin{quote} % \cs{@@_div_significand_test_o:w} |1| |0| \meta{5d} |;| % ~~\meta{4d} |;| \meta{4d} |;| \meta{5d} |;| \meta{sign} @@ -1487,7 +1487,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_div_significand_small_o:wwwNNNNwN} +% \begin{macro}[EXP]{\@@_div_significand_small_o:wwwNNNNwN} % \begin{quote} % \cs{@@_div_significand_small_o:wwwNNNNwN} |0| \meta{4d} |;| % ~~\meta{4d} |;| \meta{4d} |;| \meta{5d} |;| \meta{final sign} @@ -1509,7 +1509,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_div_significand_large_o:wwwNNNNwN} +% \begin{macro}[rEXP]{\@@_div_significand_large_o:wwwNNNNwN} % \begin{quote} % \cs{@@_div_significand_large_o:wwwNNNNwN} \meta{5d} |;| % ~~\meta{4d} |;| \meta{4d} |;| \meta{5d} |;| \meta{sign} @@ -1538,7 +1538,7 @@ % % \subsection{Square root} % -% \begin{macro}[int, EXP]{\@@_sqrt_o:w} +% \begin{macro}[EXP]{\@@_sqrt_o:w} % Zeros are unchanged: $\sqrt{-0} = -0$ and $\sqrt{+0} = +0$. % Negative numbers (other than $-0$) have no real square root. % Positive infinity, and \texttt{nan}, are unchanged. Finally, for @@ -1557,8 +1557,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_sqrt_npos_o:w} -% \begin{macro}[aux, rEXP] +% \begin{macro}[EXP]{\@@_sqrt_npos_o:w} +% \begin{macro}[rEXP] % {\@@_sqrt_npos_auxi_o:wwnnN, \@@_sqrt_npos_auxii_o:wNNNNNNNN} % Prepare \cs{@@_sanitize:Nw} to receive the final sign~|0| (the % result is always positive) and the exponent, equal to half of the @@ -1595,7 +1595,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sqrt_Newton_o:wwn} +% \begin{macro}[rEXP]{\@@_sqrt_Newton_o:wwn} % Newton's method maps $x\mapsto\bigl[(x + [10^{8} a_1 / x])/2\bigr]$ % in each iteration, where $[b/c]$ denotes \eTeX{}'s division. This % division rounds the real number $b/c$ to the closest integer, @@ -1673,7 +1673,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sqrt_auxi_o:NNNNwnnN} +% \begin{macro}[rEXP]{\@@_sqrt_auxi_o:NNNNwnnN} % This function is followed by $10^{8}+x-1$, which has~$9$ digits % starting with~$1$, then |;| \Arg{a_1} \Arg{a_2} \meta{a'}. Here, $x % \simeq \sqrt{10^{8} a_1}$ and we want to estimate the square root of @@ -1706,7 +1706,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sqrt_auxii_o:NnnnnnnnN} +% \begin{macro}[rEXP]{\@@_sqrt_auxii_o:NnnnnnnnN} % This receives a continuation function~|#1|, then five blocks of~$4$ % digits for~$y$, then two $8$-digit blocks and a single digit % for~$a$. A common estimate of $\sqrt{a} - y = (a - y^2) / (\sqrt{a} @@ -1791,7 +1791,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP] % { % \@@_sqrt_auxiii_o:wnnnnnnnn, % \@@_sqrt_auxiv_o:NNNNNw, @@ -1871,7 +1871,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP] % {\@@_sqrt_auxviii_o:nnnnnnn, \@@_sqrt_auxix_o:wnwnw} % Simply add the two $8$-digit blocks of~$z$, aligned to the last four % of the five $4$-digit blocks of~$y$, then call the \texttt{auxii} @@ -1894,7 +1894,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP] % {\@@_sqrt_auxx_o:Nnnnnnnn, \@@_sqrt_auxxi_o:wwnnN} % At this stage, $j=6$ and $10^{24} z < 10^{7}$, hence % \[ @@ -1944,7 +1944,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP] +% \begin{macro}[rEXP] % {\@@_sqrt_auxxii_o:nnnnnnnnw, \@@_sqrt_auxxiii_o:w} % The difference $0\leq a+10^{-16}-m^2\leq % 10^{-16}+(\sqrt{a}-m)(\sqrt{a}+m)\leq 2\cdot 10^{-16}$ was just @@ -1984,7 +1984,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_sqrt_auxxiv_o:wnnnnnnnN} +% \begin{macro}[rEXP]{\@@_sqrt_auxxiv_o:wnnnnnnnN} % This receives $9998$, $9999$ or $10000$ as~|#1| when $m$~is an % underestimate, exact, or an overestimate, respectively. Then % comes~$m$ as five blocks of~$4$ digits, but where the last @@ -2027,8 +2027,8 @@ % % \subsection{About the sign} % -% \begin{macro}[int, EXP]{\@@_sign_o:w} -% \begin{macro}[aux, EXP]{\@@_sign_aux_o:w} +% \begin{macro}[EXP]{\@@_sign_o:w} +% \begin{macro}[EXP]{\@@_sign_aux_o:w} % Find the sign of the floating point: \texttt{nan}, |+0|, |-0|, |+1| or |-1|. % \begin{macrocode} \cs_new:Npn \@@_sign_o:w ? \s_@@ \@@_chk:w #1#2; @ @@ -2047,7 +2047,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_set_sign_o:w} +% \begin{macro}[EXP]{\@@_set_sign_o:w} % This function is used for the unary minus and for \texttt{abs}. It % leaves the sign of \texttt{nan} invariant, turns negative numbers % (sign~$2$) to positive numbers (sign~$0$) and positive numbers |