[latex3-commits] [l3svn] r6889 - Allow raising a negative fp to an "odd" rational power

noreply at latex-project.org noreply at latex-project.org
Sat Feb 11 17:30:39 CET 2017


Author: bruno
Date: 2017-02-11 17:30:39 +0100 (Sat, 11 Feb 2017)
New Revision: 6889

Modified:
   trunk/l3kernel/l3fp-expo.dtx
   trunk/l3kernel/l3fp.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
   trunk/l3kernel/testfiles/m3fp-expo001.lvt
   trunk/l3kernel/testfiles/m3fp-expo001.tlg
Log:
Allow raising a negative fp to an "odd" rational power

The behaviour of our power operation is close to the IEEE
standard's powd, but not quite.  This brings it one step closer.
This is somewhat related to issue #272.


Modified: trunk/l3kernel/l3fp-expo.dtx
===================================================================
--- trunk/l3kernel/l3fp-expo.dtx	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/l3fp-expo.dtx	2017-02-11 16:30:39 UTC (rev 6889)
@@ -861,28 +861,31 @@
 % \subsection{Power}
 %
 % Raising a number $a$ to a power $b$ leads to many distinct situations.
-% \begin{center}
+% \begin{center}\def\abs#1{\lvert #1\rvert}
 %   \begin{tabular}{>{$}c<{$}|*8{>{$}l<{$}}}
-%     a^b    &-\infty&-y     &-n        &\pm 0&+n    &+y     &+\infty&\nan \\
-%     \hline
-%     +\infty&+0     &+0     &+0        &+1&+\infty  &+\infty&+\infty&\nan \\
-%     1<x    &+0     &+x^{-y}&+x^{-n}   &+1&+x^{n}   &+x^{y} &+\infty&\nan \\
-%     +1     &+1     &+1     &+1        &+1&+1       &+1     &+1     &+1   \\
-%     0<x<1  &+\infty&+x^{-y}&+x^{-n}   &+1&+x^{n}   &+x^{y} &+0     &\nan \\
-%     +0     &+\infty&+\infty&+\infty   &+1&+0       &+0     &+0     &\nan \\
-%     -0     &\nan   &\nan   &\pm\infty &+1&\pm 0    &+0     &+0     &\nan \\
-%     -1<-x<0&\nan   &\nan   &\pm x^{-n}&+1&\pm x^{n}&\nan   &+0     &\nan \\
-%     -1     &\nan   &\nan   &\pm 1     &+1&\pm 1    &\nan   &\nan   &\nan \\
-%     -x<-1  &+0     &\nan   &\pm x^{-n}&+1&\pm x^{n}&\nan   &\nan   &\nan \\
-%     -\infty&+0     &+0     &\pm 0     &+1&\pm\infty&\nan   &\nan   &\nan \\
-%     \nan   &\nan   &\nan   &\nan      &+1&\nan     &\nan   &\nan   &\nan \\
+%     a^b          &-\infty &(-\infty,-0)  &-p/5^k              &\pm 0 &+p/5^k          &(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           &\nan    &\nan          &(-1)^p\infty        &+1    &(-1)^p 0          &+0              &+0      &\nan \\
+%     (-1,0)       &\nan    &\nan          &(-1)^p\abs{a}^{b}   &+1    &(-1)^p\abs{a}^{b} &\nan            &+0      &\nan \\
+%     -1           &\nan    &\nan          &(-1)^p              &+1    &(-1)^p            &\nan            &\nan    &\nan \\
+%     (-\infty,-1) &+0      &\nan          &(-1)^p\abs{a}^{b}   &+1    &(-1)^p\abs{a}^{b} &\nan            &\nan    &\nan \\
+%     -\infty      &+0      &+0            &(-1)^p 0            &+1    &(-1)^p\infty      &\nan            &\nan    &\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.
 % One peculiarity of this operation is that $\nan^0 = 1^\nan = 1$,
 % because this relation is obeyed for any number, even $\pm\infty$.
 %
 % \begin{macro}[int, EXP]+\@@_^_o:ww+
-%   We cram a most of the tests into a single function to save csnames.
+%   We cram most of the tests into a single function to save csnames.
 %   First treat the case $b=0$: $a^0=1$ for any $a$, even \texttt{nan}.
 %   Then test the sign of $a$.
 %   \begin{itemize}
@@ -1145,7 +1148,7 @@
 %   undefined.  This is invalid, unless $|a|^b$ turns out to be $+0$ or
 %   \texttt{nan}, in which case we return that as $a^b$.  In particular,
 %   since the underflow detection occurs before \cs{@@_pow_neg:www} is
-%   called, |(-0.1)**(12345.6)| will give $+0$ rather than complaining
+%   called, |(-0.1)**(12345.67)| will give $+0$ rather than complaining
 %   that the sign is not defined.
 %    \begin{macrocode}
 \cs_new:Npn \@@_pow_neg:www \s_@@ \@@_chk:w #1#2; #3; #4;
@@ -1178,23 +1181,21 @@
 % \begin{macro}[aux, rEXP]
 %   {
 %     \@@_pow_neg_case:w, \@@_pow_neg_case_aux:nnnnn,
-%     \@@_pow_neg_case_aux:NNNNNNNNw
+%     \@@_pow_neg_case_aux:w
 %   }
-%   This function expects a floating point number, and \enquote{returns}
-%   $-1$ if it is an even integer, $0$ if it is an odd integer, and $1$
-%   if it is not an integer.  Zeros are even, $\pm\infty$ and
-%   \texttt{nan} are non-integers.  The sign of normal numbers is
-%   irrelevant to parity.  If the exponent is greater than sixteen, then
-%   the number is even.  If the exponent is non-positive, the number
-%   cannot be an integer.  We also separate the ranges of exponent
-%   $[1,8]$ and $[9,16]$.  In the former case, check that the last $8$
-%   digits are zero (otherwise we don't have an integer).  In both
-%   cases, consider the appropriate $8$ digits, either |#4#5| or |#2#3|,
-%   remove the first few: we are then left with \meta{digit}
-%   \meta{digits} |;| which would be the digits surrounding the decimal
-%   period.  If the \meta{digits} are non-zero, the number is not an
-%   integer.  Otherwise, check the parity of the \meta{digit} and return
-%   \cs{c_zero} or |-|\cs{c_one}.
+%   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 are even,
+%   $\pm\infty$ and \texttt{nan} are non-integers.  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$.
 %    \begin{macrocode}
 \cs_new:Npn \@@_pow_neg_case:w \s_@@ \@@_chk:w #1#2#3;
   {
@@ -1205,41 +1206,27 @@
     \fi:
   }
 \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_eight
-      \if_int_compare:w #1 > \c_sixteen
-        -\c_one
-      \else:
-        \exp_after:wN \exp_after:wN
-        \exp_after:wN \@@_pow_neg_case_aux:NNNNNNNNw
-        \prg_replicate:nn { \c_sixteen - #1 } { 0 } #4#5 ;
-      \fi:
+    \if_int_compare:w #1 > \c_sixteen
+      -\c_one
     \else:
-      \if_int_compare:w #1 > \c_zero
-        \if_int_compare:w #4#5 = \c_zero
-          \exp_after:wN \exp_after:wN
-          \exp_after:wN \@@_pow_neg_case_aux:NNNNNNNNw
-          \prg_replicate:nn { \c_eight - #1 } { 0 } #2#3 ;
+      \if_int_odd:w #3 \exp_stop_f:
+        \if_int_compare:w #1 = \c_sixteen
+          \c_zero
         \else:
           \c_one
         \fi:
       \else:
-        \c_one
+        \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 ;
       \fi:
     \fi:
   }
-\cs_new:Npn \@@_pow_neg_case_aux:NNNNNNNNw #1#2#3#4#5#6#7#8#9;
-  {
-    \if_int_compare:w 0 #9 = \c_zero
-      \if_int_odd:w #8 \exp_stop_f:
-        \c_zero
-      \else:
-        -\c_one
-      \fi:
-    \else:
-      \c_one
-    \fi:
-  }
 %    \end{macrocode}
 % \end{macro}
 %

Modified: trunk/l3kernel/l3fp.dtx
===================================================================
--- trunk/l3kernel/l3fp.dtx	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/l3fp.dtx	2017-02-11 16:30:39 UTC (rev 6889)
@@ -934,7 +934,8 @@
 %   operation is right associative, hence \texttt{2 ** 2 ** 3} equals
 %   $2^{2^{3}} = 256$.  The \enquote{invalid operation} exception occurs
 %   if \meta{operand_1} is negative or $-0$, and \meta{operand_2} is not
-%   an integer, unless the result is zero (in that case, the sign is
+%   of the form $p/q$ with $p$ integer and $q$ odd,
+%   unless the result is zero (in that case, the sign is
 %   chosen arbitrarily to be $+0$).  \enquote{Division by zero} occurs
 %   when raising $\pm 0$ to a strictly negative power.
 %   \enquote{Underflow} and \enquote{overflow} occur when appropriate.

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4024,7 +4024,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4012,7 +4012,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4012,7 +4012,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4012,7 +4012,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4022,7 +4022,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4025,7 +4025,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4013,7 +4013,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4013,7 +4013,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4013,7 +4013,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -4023,7 +4023,7 @@
 Defining \__fp_pow_neg_aux:wNN on line ...
 Defining \__fp_pow_neg_case:w on line ...
 Defining \__fp_pow_neg_case_aux:nnnnn on line ...
-Defining \__fp_pow_neg_case_aux:NNNNNNNNw on line ...
+Defining \__fp_pow_neg_case_aux:w on line ...
 Defining \__fp_sin_o:w on line ...
 Defining \__fp_cos_o:w on line ...
 Defining \__fp_csc_o:w on line ...

Modified: trunk/l3kernel/testfiles/m3fp-expo001.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3fp-expo001.lvt	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3fp-expo001.lvt	2017-02-11 16:30:39 UTC (rev 6889)
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2012 LaTeX3 Project
+% Copyright (C) 2012,2017 LaTeX3 Project
 %
 
 \documentclass{minimal}
@@ -70,57 +70,18 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \OMIT
-\cs_set:Npn \test:nn #1 #2 { '(#1)^(#2)'~=~\fp_to_tl:n { (#1) ^ (#2) } }
+\cs_set_protected:Npn \test:nn #1 #2 { \TYPE { '(#1)^(#2)'~=~\fp_to_tl:n { (#1) ^ (#2) } } }
 \TIMO
 
-
-\TESTEXP { Power~special~cases }
+\TEST { Power~special~cases }
   {
-    \test:nn {nan} {nan}  \NEWLINE
-    \test:nn {nan} {inf}  \NEWLINE
-    \test:nn {nan} {-inf} \NEWLINE
-    \test:nn {nan} {1}    \NEWLINE
-    \test:nn {nan} {-1}   \NEWLINE
-    \test:nn {nan} {0}    \NEWLINE
-    \test:nn {nan} {-0}   \NEWLINE
-    \test:nn {inf} {nan}  \NEWLINE
-    \test:nn {inf} {inf}  \NEWLINE
-    \test:nn {inf} {-inf} \NEWLINE
-    \test:nn {inf} {1}    \NEWLINE
-    \test:nn {inf} {-1}   \NEWLINE
-    \test:nn {inf} {0}    \NEWLINE
-    \test:nn {inf} {-0}   \NEWLINE
-    \test:nn {-inf} {nan} \NEWLINE
-    \test:nn {-inf} {inf} \NEWLINE
-    \test:nn {-inf} {-inf}\NEWLINE
-    \test:nn {-inf} {1}   \NEWLINE
-    \test:nn {-inf} {-1}  \NEWLINE
-    \test:nn {-inf} {0}   \NEWLINE
-    \test:nn {-inf} {-0}  \NEWLINE
-    \test:nn {1} {nan}    \NEWLINE
-    \test:nn {1} {inf}    \NEWLINE
-    \test:nn {1} {-inf}   \NEWLINE
-    \test:nn {1} {0}      \NEWLINE
-    \test:nn {1} {-0}     \NEWLINE
-    \test:nn {-1} {nan}    \NEWLINE
-    \test:nn {-1} {inf}    \NEWLINE
-    \test:nn {-1} {-inf}   \NEWLINE
-    \test:nn {-1} {0}      \NEWLINE
-    \test:nn {-1} {-0}     \NEWLINE
-    \test:nn {0} {nan}    \NEWLINE
-    \test:nn {0} {inf}    \NEWLINE
-    \test:nn {0} {-inf}   \NEWLINE
-    \test:nn {0} {1}      \NEWLINE
-    \test:nn {0} {-1}     \NEWLINE
-    \test:nn {0} {0}      \NEWLINE
-    \test:nn {0} {-0}     \NEWLINE
-    \test:nn {-0} {nan}   \NEWLINE
-    \test:nn {-0} {inf}   \NEWLINE
-    \test:nn {-0} {-inf}  \NEWLINE
-    \test:nn {-0} {1}     \NEWLINE
-    \test:nn {-0} {-1}    \NEWLINE
-    \test:nn {-0} {0}     \NEWLINE
-    \test:nn {-0} {-0}    \NEWLINE
+    \tl_map_inline:nn { {nan} {inf} {-inf} {1} {-1} {0} {-0} }
+      {
+        \tl_map_inline:nn { {nan} {inf} {-inf} {1} {-1} {0} {-0} {0.2} {-0.00128} {1.3} }
+          {
+            \test:nn {#1} {##1}
+          }
+      }
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/l3kernel/testfiles/m3fp-expo001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-expo001.tlg	2017-02-11 14:44:17 UTC (rev 6888)
+++ trunk/l3kernel/testfiles/m3fp-expo001.tlg	2017-02-11 16:30:39 UTC (rev 6889)
@@ -94,6 +94,27 @@
 ============================================================
 TEST 3: Power special cases
 ============================================================
+'(nan)^(nan)' = nan
+'(nan)^(inf)' = nan
+'(nan)^(-inf)' = nan
+'(nan)^(1)' = nan
+'(nan)^(-1)' = nan
+'(nan)^(0)' = 1
+'(nan)^(-0)' = 1
+'(nan)^(0.2)' = nan
+'(nan)^(-0.00128)' = nan
+'(nan)^(1.3)' = nan
+'(inf)^(nan)' = nan
+'(inf)^(inf)' = inf
+'(inf)^(-inf)' = 0
+'(inf)^(1)' = inf
+'(inf)^(-1)' = 0
+'(inf)^(0)' = 1
+'(inf)^(-0)' = 1
+'(inf)^(0.2)' = inf
+'(inf)^(-0.00128)' = 0
+'(inf)^(1.3)' = inf
+'(-inf)^(nan)' = nan
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
                            Invalid operation (-inf)^(inf)
@@ -103,8 +124,37 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(-inf)^(inf)' = nan
+'(-inf)^(-inf)' = 0
+'(-inf)^(1)' = -inf
+'(-inf)^(-1)' = -0
+'(-inf)^(0)' = 1
+'(-inf)^(-0)' = 1
+'(-inf)^(0.2)' = -inf
+'(-inf)^(-0.00128)' = 0
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
+                           Invalid operation (-inf)^(1.3)
+l. ...  }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+'(-inf)^(1.3)' = nan
+'(1)^(nan)' = 1
+'(1)^(inf)' = 1
+'(1)^(-inf)' = 1
+'(1)^(1)' = 1
+'(1)^(-1)' = 1
+'(1)^(0)' = 1
+'(1)^(-0)' = 1
+'(1)^(0.2)' = 1
+'(1)^(-0.00128)' = 1
+'(1)^(1.3)' = 1
+'(-1)^(nan)' = nan
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
                            Invalid operation (-1)^(inf)
 l. ...  }
 The control sequence at the end of the top line
@@ -112,6 +162,7 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(-1)^(inf)' = nan
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
                            Invalid operation (-1)^(-inf)
@@ -121,8 +172,27 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(-1)^(-inf)' = nan
+'(-1)^(1)' = -1
+'(-1)^(-1)' = -1
+'(-1)^(0)' = 1
+'(-1)^(-0)' = 1
+'(-1)^(0.2)' = -1
+'(-1)^(-0.00128)' = 1
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
+                           Invalid operation (-1)^(1.3)
+l. ...  }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+'(-1)^(1.3)' = nan
+'(0)^(nan)' = nan
+'(0)^(inf)' = 0
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
                            Division by zero in (0)^(-inf)
 l. ...  }
 The control sequence at the end of the top line
@@ -130,6 +200,8 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(0)^(-inf)' = inf
+'(0)^(1)' = 0
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
                            Division by zero in (0)^(-1)
@@ -139,8 +211,25 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(0)^(-1)' = inf
+'(0)^(0)' = 1
+'(0)^(-0)' = 1
+'(0)^(0.2)' = 0
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
+                           Division by zero in (0)^(-0.00128)
+l. ...  }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+'(0)^(-0.00128)' = inf
+'(0)^(1.3)' = 0
+'(-0)^(nan)' = nan
+'(-0)^(inf)' = 0
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
                            Division by zero in (-0)^(-inf)
 l. ...  }
 The control sequence at the end of the top line
@@ -157,6 +246,8 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
+'(-0)^(-inf)' = nan
+'(-0)^(1)' = -0
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
                            Division by zero in (-0)^(-1)
@@ -166,51 +257,21 @@
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.
-'(nan)^(nan)' = nan
-'(nan)^(inf)' = nan
-'(nan)^(-inf)' = nan
-'(nan)^(1)' = nan
-'(nan)^(-1)' = nan
-'(nan)^(0)' = 1
-'(nan)^(-0)' = 1
-'(inf)^(nan)' = nan
-'(inf)^(inf)' = inf
-'(inf)^(-inf)' = 0
-'(inf)^(1)' = inf
-'(inf)^(-1)' = 0
-'(inf)^(0)' = 1
-'(inf)^(-0)' = 1
-'(-inf)^(nan)' = nan
-'(-inf)^(inf)' = nan
-'(-inf)^(-inf)' = 0
-'(-inf)^(1)' = -inf
-'(-inf)^(-1)' = -0
-'(-inf)^(0)' = 1
-'(-inf)^(-0)' = 1
-'(1)^(nan)' = 1
-'(1)^(inf)' = 1
-'(1)^(-inf)' = 1
-'(1)^(0)' = 1
-'(1)^(-0)' = 1
-'(-1)^(nan)' = nan
-'(-1)^(inf)' = nan
-'(-1)^(-inf)' = nan
-'(-1)^(0)' = 1
-'(-1)^(-0)' = 1
-'(0)^(nan)' = nan
-'(0)^(inf)' = 0
-'(0)^(-inf)' = inf
-'(0)^(1)' = 0
-'(0)^(-1)' = inf
-'(0)^(0)' = 1
-'(0)^(-0)' = 1
-'(-0)^(nan)' = nan
-'(-0)^(inf)' = 0
-'(-0)^(-inf)' = nan
-'(-0)^(1)' = -0
 '(-0)^(-1)' = -inf
 '(-0)^(0)' = 1
 '(-0)^(-0)' = 1
+'(-0)^(0.2)' = -0
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Division by zero in (-0)^(-0.00128)
+l. ...  }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+'(-0)^(-0.00128)' = inf
+'(-0)^(1.3)' = 0
 ============================================================
 ============================================================
 TEST 4: Power and minus one



More information about the latex3-commits mailing list