summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx60
1 files changed, 27 insertions, 33 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
index edbfdcc57d6..e348db5a2f1 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
@@ -38,7 +38,7 @@
% {latex-team@latex-project.org}^^A
% }^^A
% }
-% \date{Released 2017/07/19}
+% \date{Released 2017/09/18}
%
% \maketitle
%
@@ -868,24 +868,22 @@
% Raising a number $a$ to a power $b$ leads to many distinct situations.
% \begin{center}\def\abs#1{\lvert #1\rvert}
% \begin{tabular}{>{$}c<{$}|*8{>{$}l<{$}}}
-% a^b &-\infty &(-\infty,-0) &-p/5^k &\pm 0 &+p/5^k &(0,\infty) &+\infty &\nan \\ \hline
+% a^b &-\infty &(-\infty,-0) &-\text{integer} &\pm 0 &+\text{integer} &(0,\infty) &+\infty &\nan \\ \hline
% +\infty &+0 &\multicolumn{2}{c}{$+0$} &+1 &\multicolumn{2}{c}{$+\infty$} &+\infty &\nan \\
% (1,\infty) &+0 &\multicolumn{2}{c}{$+\abs{a}^{b}$} &+1 &\multicolumn{2}{c}{$+\abs{a}^{b}$} &+\infty &\nan \\
% +1 &+1 &\multicolumn{2}{c}{$+1$} &+1 &\multicolumn{2}{c}{$+1$} &+1 &+1 \\
% (0,1) &+\infty &\multicolumn{2}{c}{$+\abs{a}^{b}$} &+1 &\multicolumn{2}{c}{$+\abs{a}^{b}$} &+0 &\nan \\
% +0 &+\infty &\multicolumn{2}{c}{$+\infty$} &+1 &\multicolumn{2}{c}{$+0$} &+0 &\nan \\
-% -0 &+\infty &\nan &(-1)^p\infty &+1 &(-1)^p 0 &+0 &+0 &\nan \\
-% (-1,0) &+\infty &\nan &(-1)^p\abs{a}^{b} &+1 &(-1)^p\abs{a}^{b} &\nan &+0 &\nan \\
-% -1 &+1 &\nan &(-1)^p &+1 &(-1)^p &\nan &+1 &\nan \\
-% (-\infty,-1) &+0 &\nan &(-1)^p\abs{a}^{b} &+1 &(-1)^p\abs{a}^{b} &\nan &+\infty &\nan \\
-% -\infty &+0 &+0 &(-1)^p 0 &+1 &(-1)^p\infty &\nan &+\infty &\nan \\
+% -0 &+\infty &\nan &(-1)^b\infty &+1 &(-1)^b 0 &+0 &+0 &\nan \\
+% (-1,0) &+\infty &\nan &(-1)^b\abs{a}^{b} &+1 &(-1)^b\abs{a}^{b} &\nan &+0 &\nan \\
+% -1 &+1 &\nan &(-1)^b &+1 &(-1)^b &\nan &+1 &\nan \\
+% (-\infty,-1) &+0 &\nan &(-1)^b\abs{a}^{b} &+1 &(-1)^b\abs{a}^{b} &\nan &+\infty &\nan \\
+% -\infty &+0 &+0 &(-1)^b 0 &+1 &(-1)^b\infty &\nan &+\infty &\nan \\
% \nan &\nan &\nan &\nan &+1 &\nan &\nan &\nan &\nan \\
% \end{tabular}
% \end{center}
% We distinguished in this table the cases of finite (positive or
-% negative) exponents of the form $b=p/q$ with $q$~odd (hence
-% necessarily a power of~$5$), as $(-1)^{p/q}=(-1)^p$ is defined in that
-% case.
+% negative) integer exponents, as $(-1)^b$ is defined in that case.
% One peculiarity of this operation is that $\nan^0 = 1^\nan = 1$,
% because this relation is obeyed for any number, even $\pm\infty$.
%
@@ -1189,22 +1187,18 @@
% \begin{macro}[aux, rEXP]
% {
% \@@_pow_neg_case:w, \@@_pow_neg_case_aux:nnnnn,
-% \@@_pow_neg_case_aux:w
+% \@@_pow_neg_case_aux:Nnnw
% }
% This function expects a floating point number, and determines its
% \enquote{parity}. It should be used after \cs{if_case:w} or in an
-% integer expression. It gives $-1$ if the number is an even integer
-% divided by some power of~$5$, $0$~if the number is an odd integer
-% divided by some power of~$5$, and $1$~otherwise. Zeros and
+% integer expression. It gives $-1$ if the number is an even integer,
+% $0$~if the number is an odd integer, and $1$~otherwise. Zeros and
% $\pm\infty$ are even (because very large finite floating points are
% even), while \texttt{nan} is a non-integer. The sign of normal
-% numbers is irrelevant to parity. The idea is to repeatedly multiply
-% the number by~$5$ (by halving the mantissa and shifting the
-% exponent) until the mantissa is odd (this can only happen at most
-% $53$ times since $2^{54}>10^{16}$): if the resulting exponent is
-% larger than $16$ the parity is even, if it is exactly $16$ the
-% parity is odd, and otherwise we should return~$1$. Of course there
-% is a shortcut: we stop as soon as the exponent exceeds~$16$.
+% numbers is irrelevant to parity. After \cs{@@_decimate:nNnnnn} the
+% argument |#1| of \cs{@@_pow_neg_case_aux:Nnnw} is a rounding digit,
+% |0|~if and only if the number was an integer, and |#3| is the $8$
+% least significant digits of that integer.
% \begin{macrocode}
\cs_new:Npn \@@_pow_neg_case:w \s_@@ \@@_chk:w #1#2#3;
{
@@ -1217,25 +1211,25 @@
\exp_stop_f:
}
\cs_new:Npn \@@_pow_neg_case_aux:nnnnn #1#2#3#4#5
- { \@@_pow_neg_case_aux:w #1 ; #2 #3 ; #4 #5 ; }
-\cs_new:Npn \@@_pow_neg_case_aux:w #1 ; #2 ; #3 ;
{
\if_int_compare:w #1 > \c_@@_prec_int
-1
\else:
+ \@@_decimate:nNnnnn { \c_@@_prec_int - #1 }
+ \@@_pow_neg_case_aux:Nnnw
+ {#2} {#3} {#4} {#5}
+ \fi:
+ }
+\cs_new:Npn \@@_pow_neg_case_aux:Nnnw #1#2#3#4 ;
+ {
+ \if_meaning:w 0 #1
\if_int_odd:w #3 \exp_stop_f:
- \if_int_compare:w #1 = \c_@@_prec_int
- 0
- \else:
- 1
- \fi:
+ 0
\else:
- \exp_after:wN \@@_pow_neg_case_aux:w
- \__int_value:w \__int_eval:w #1 + 1 \exp_after:wN ;
- \__int_value:w \__int_eval:w (#2 + 1) / 2 - 1 \exp_after:wN ;
- \__int_value:w \__int_eval:w
- \if_int_odd:w #2 \exp_stop_f: 5000 0000 + \fi: #3 / 2 ;
+ -1
\fi:
+ \else:
+ 1
\fi:
}
% \end{macrocode}