[latex3-commits] [l3svn] r6891 - Remove "division by zero" exception for 0^-inf and (-0)^-inf (see #272)

noreply at latex-project.org noreply at latex-project.org
Sat Feb 11 19:37:26 CET 2017


Author: bruno
Date: 2017-02-11 19:37:26 +0100 (Sat, 11 Feb 2017)
New Revision: 6891

Modified:
   trunk/l3kernel/l3fp-expo.dtx
   trunk/l3kernel/l3fp.dtx
   trunk/l3kernel/testfiles/m3fp-expo001.tlg
Log:
Remove "division by zero" exception for 0^-inf and (-0)^-inf (see #272)

This is to follow the standard.  The idea: even though we are dividing
by zero and obtaining an infinite result, there was already an infinity
so it is not useful to treat that case as exceptional.


Modified: trunk/l3kernel/l3fp-expo.dtx
===================================================================
--- trunk/l3kernel/l3fp-expo.dtx	2017-02-11 16:31:25 UTC (rev 6890)
+++ trunk/l3kernel/l3fp-expo.dtx	2017-02-11 18:37:26 UTC (rev 6891)
@@ -938,9 +938,9 @@
 %   power or $\infty$ to a negative power, and $+\infty$ otherwise.
 %   Thus, if the type of $a$ and the sign of $b$ coincide, the result
 %   is~$0$, since those conveniently take the same possible values, $0$
-%   and~$2$.  Otherwise, either $a=\pm 0$ with $b<0$ and we have a
-%   division by zero, or $a=\pm\infty$ and $b>0$ and the result is also
-%   $+\infty$, but without any exception.
+%   and~$2$.  Otherwise, either $a=\pm\infty$ and $b>0$ and the result
+%   is $+\infty$, or $a=\pm 0$ with $b<0$ and we have a division by zero
+%   unless $b=-\infty$.
 %    \begin{macrocode}
 \cs_new:Npn \@@_pow_zero_or_inf:ww
     \s_@@ \@@_chk:w #1#2; \s_@@ \@@_chk:w #3#4
@@ -951,14 +951,17 @@
     \if_meaning:w #1 #4
       \@@_case_return_o:Nw \c_zero_fp
     \fi:
-    \if_meaning:w 0 #1
+    \if_meaning:w 2 #1
+      \@@_case_return_o:Nw \c_inf_fp
+    \fi:
+    \if_meaning:w 2 #3
+      \@@_case_return_o:Nw \c_inf_fp
+    \else:
       \@@_case_use:nw
         {
           \@@_division_by_zero_o:NNww \c_inf_fp ^
             \s_@@ \@@_chk:w #1 #2 ;
         }
-    \else:
-      \@@_case_return_o:Nw \c_inf_fp
     \fi:
     \s_@@ \@@_chk:w #3#4
   }

Modified: trunk/l3kernel/l3fp.dtx
===================================================================
--- trunk/l3kernel/l3fp.dtx	2017-02-11 16:31:25 UTC (rev 6890)
+++ trunk/l3kernel/l3fp.dtx	2017-02-11 18:37:26 UTC (rev 6891)
@@ -937,7 +937,7 @@
 %   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.
+%   when raising $\pm 0$ to a finite strictly negative power.
 %   \enquote{Underflow} and \enquote{overflow} occur when appropriate.
 % \end{function}
 %

Modified: trunk/l3kernel/testfiles/m3fp-expo001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-expo001.tlg	2017-02-11 16:31:25 UTC (rev 6890)
+++ trunk/l3kernel/testfiles/m3fp-expo001.tlg	2017-02-11 18:37:26 UTC (rev 6891)
@@ -191,15 +191,6 @@
 '(-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
-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)^(-inf)' = inf
 '(0)^(1)' = 0
 ! Undefined control sequence.
@@ -230,15 +221,6 @@
 '(-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
-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.
-! Undefined control sequence.
-<argument> \LaTeX3 error: 
                            Invalid operation (-0)^(-inf)
 l. ...  }
 The control sequence at the end of the top line



More information about the latex3-commits mailing list