[latex3-commits] [l3svn] r6788 - Detect rounding-induced infinite loops

noreply at latex-project.org noreply at latex-project.org
Tue Dec 6 20:03:30 CET 2016


Author: bruno
Date: 2016-12-06 20:03:30 +0100 (Tue, 06 Dec 2016)
New Revision: 6788

Added:
   trunk/l3kernel/testfiles/m3fp-logic004.luatex.tlg
Modified:
   trunk/l3kernel/l3fp-logic.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-logic004.lvt
   trunk/l3kernel/testfiles/m3fp-logic004.tlg
Log:
Detect rounding-induced infinite loops

Under the straightforward implementation,
  \fp_step_inline:nnnn { 1e16 } { 1 } { 2e16 } { }
would give an infinite loop because 1e16+1 is rounded
down to 1e16 and the loop never makes progress.  Such
cases are now detected.


Modified: trunk/l3kernel/l3fp-logic.dtx
===================================================================
--- trunk/l3kernel/l3fp-logic.dtx	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/l3fp-logic.dtx	2016-12-06 19:03:30 UTC (rev 6788)
@@ -318,56 +318,72 @@
 %
 % \begin{macro}[EXP]{\fp_step_function:nnnN, \fp_step_function:nnnc}
 % \begin{macro}[EXP, aux]{\@@_step:wwwN}
-% \begin{macro}[EXP, aux]{\@@_step:NnnnN, \@@_step:NfnnN}
-%   The approach here is much the same as \cs{int_step_function:nnnN} except we
-%   do not have a convenient low-level way to evaluation each argument to give
-%   a pure number. Instead, the internal parser is used to leave values in the
-%   internal format (and avoid a more expensive \texttt{f}-type expansion of
-%   multiple uses of \texttt{fp_eval:n}).
+% \begin{macro}[EXP, aux]{\@@_step:NnnnnN, \@@_step:NfnnnN}
+%   The approach here is somewhat similar to
+%   \cs{int_step_function:nnnN}.  There are two subtleties: we use the
+%   internal parser \cs{@@_parse:n} to avoid converting back and forth
+%   from the internal representation; and (due to rounding) even a
+%   non-zero step does not guarantee that the loop counter will
+%   increase.
 %    \begin{macrocode}
 \cs_new:Npn \fp_step_function:nnnN #1#2#3
   {
     \exp_after:wN \@@_step:wwwN
-      \exp:w \exp_end_continue_f:w \@@_parse_o:n {#1} :
-      \exp:w \exp_end_continue_f:w \@@_parse_o:n {#2} :
-      \exp:w \exp_end_continue_f:w \@@_parse:n {#3} :
+      \exp:w \exp_end_continue_f:w \@@_parse_o:n {#1}
+      \exp:w \exp_end_continue_f:w \@@_parse_o:n {#2}
+      \exp:w \exp_end_continue_f:w \@@_parse:n {#3}
   }
 \cs_generate_variant:Nn \fp_step_function:nnnN { nnnc }
-%    \end{macrocode}
-%   Here, |#1| will be passed to the output on the first pass of the loop.
-%   To avoid this being in internal form, an \texttt{f}-type expansion is used
-%   here on that value only. The second and third arguments will be converted
-%   during the loop itself.
+%      \end{macrocode}
+%   Only \enquote{normal} floating points (not $\pm 0$,
+%   $\pm\texttt{inf}$, \texttt{nan}) can be used as step; if positive,
+%   call \cs{@@_step:NnnnnN} with argument |>| otherwise~|<|.  This
+%   function has one more argument than its integer counterpart, namely
+%   the previous value, to catch the case where the loop has made no
+%   progress.  Conversion to decimal is done just before calling the
+%   user's function.
 %    \begin{macrocode}
-\cs_new:Npn \@@_step:wwwN #1 : #2 : #3 : #4
+\cs_new:Npn \@@_step:wwwN #1 ; \s_@@ \@@_chk:w #2#3#4 ; #5; #6
   {
-    \fp_compare:nNnTF {#2} > 0
-      { \@@_step:NfnnN > }
+    \token_if_eq_meaning:NNTF #2 1
       {
-        \fp_compare:nNnTF {#2} = 0
+        \token_if_eq_meaning:NNTF #3 0
+          { \@@_step:NnnnnN > }
+          { \@@_step:NnnnnN < }
+      }
+      {
+        \token_if_eq_meaning:NNTF #2 0
+          { \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#6} }
           {
-            \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#4}
-            \use_none:nnnn
+            \@@_error:nnfn { bad-step } { }
+              { \fp_to_tl:n { \s_@@ \@@_chk:w #2#3#4 ; } } {#6}
           }
-          { \@@_step:NfnnN < }
+        \use_none:nnnnn
       }
-      { \fp_eval:n {#1} } {#2} {#3} #4
+      { #1 ; } { \c_nan_fp } { \s_@@ \@@_chk:w #2#3#4 ; } { #5 ; } #6
   }
-
-\cs_new:Npn \@@_step:NnnnN #1#2#3#4#5
+\cs_new:Npn \@@_step:NnnnnN #1#2#3#4#5#6
   {
-    \fp_compare:nNnF {#2} #1 {#4}
+    \fp_compare:nNnTF {#2} = {#3}
       {
-        #5 {#2}
-        \@@_step:NfnnN
-          #1 { \fp_eval:n { #2 + #3 } } {#3} {#4} #5
+        \@@_error:nffn { tiny-step }
+          { \fp_to_tl:n {#3} } { \fp_to_tl:n {#4} } {#6}
       }
+      {
+        \fp_compare:nNnF {#2} #1 {#5}
+          {
+            \exp_args:Nf #6 { \@@_to_decimal_dispatch:w #2 }
+            \@@_step:NfnnnN
+              #1 { \@@_parse:n { #2 + #4 } } {#2} {#4} {#5} #6
+          }
+      }
   }
-\cs_generate_variant:Nn \@@_step:NnnnN { Nf }
+\cs_generate_variant:Nn \@@_step:NnnnnN { Nf }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
+%
 % \begin{macro}{\fp_step_inline:nnnn}
 %   As for \cs{int_step_inline:nnnn}, create a global function and apply it,
 %   following up with a break point.
@@ -384,6 +400,13 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+\__msg_kernel_new:nnn { kernel } { fp-bad-step }
+  { Invalid~step~size~#2~in~step~function~#3. }
+\__msg_kernel_new:nnn { kernel } { fp-tiny-step }
+  { Tiny~step~size~(#1+#2=#1)~in~step~function~#3. }
+%    \end{macrocode}
+%
 % \subsection{Extrema}
 %
 % \begin{macro}[int, EXP]{\@@_minmax_o:Nw}

Modified: trunk/l3kernel/l3fp.dtx
===================================================================
--- trunk/l3kernel/l3fp.dtx	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/l3fp.dtx	2016-12-06 19:03:30 UTC (rev 6788)
@@ -542,8 +542,8 @@
 %   \texttt{false}.
 % \end{function}
 %
-% \begin{function}[added = 2016-11-21, rEXP]
-%   {\fp_step_function:nnnN}
+% \begin{function}[added = 2016-11-21, updated = 2016-12-06, rEXP]
+%   {\fp_step_function:nnnN, \fp_step_function:nnnc}
 %   \begin{syntax}
 %     \cs{fp_step_function:nnnN} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function}
 %   \end{syntax}
@@ -570,9 +570,14 @@
 %     [I saw 1.4] \quad
 %     [I saw 1.5] \quad
 %   \end{quote}
+%   \begin{texnote}
+%     Due to rounding, it may happen that adding the \meta{step} to the
+%     \meta{value} does not change the \meta{value}; such cases give an
+%     error, as they would otherwise lead to an infinite loop.
+%   \end{texnote}
 % \end{function}
 %
-% \begin{function}[added = 2016-11-21]
+% \begin{function}[added = 2016-11-21, updated = 2016-12-06]
 %   {\fp_step_inline:nnnn}
 %   \begin{syntax}
 %     \cs{fp_step_inline:nnnn} \Arg{initial value} \Arg{step} \Arg{final value} \Arg{code}

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3759,9 +3759,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3750,9 +3750,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3750,9 +3750,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3750,9 +3750,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3757,9 +3757,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3760,9 +3760,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3751,9 +3751,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3751,9 +3751,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3751,9 +3751,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -3758,9 +3758,11 @@
 Defining \exp_args:Nnnnc on line ...
 Defining \fp_step_function:nnnc on line ...
 Defining \__fp_step:wwwN on line ...
-Defining \__fp_step:NnnnN on line ...
-Defining \__fp_step:NfnnN on line ...
+Defining \__fp_step:NnnnnN on line ...
+Defining \__fp_step:NfnnnN on line ...
 Defining \fp_step_inline:nnnn on line ...
+Defining message LaTeX/kernel/fp-bad-step on line ...
+Defining message LaTeX/kernel/fp-tiny-step on line ...
 Defining \__fp_minmax_o:Nw on line ...
 Defining \__fp_minmax_loop:Nww on line ...
 Defining \__fp_minmax_auxi:ww on line ...

Added: trunk/l3kernel/testfiles/m3fp-logic004.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-logic004.luatex.tlg	                        (rev 0)
+++ trunk/l3kernel/testfiles/m3fp-logic004.luatex.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -0,0 +1,131 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright, Bruno Le Floch
+============================================================
+TEST 1: fp_step_function
+============================================================
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                Zero step size for step function \TYPE .
+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 step size inf in step function \TYPE .
+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 fp_to_decimal(-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: 
+                Tiny step size (-inf+1=-inf) in step function \test_type:n .
+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: 
+                Tiny step size (1e16+1=1e16) in step function \TYPE .
+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.
+00.10.20.30.40.50.60.70.80.91
+10.90.80.70.60.50.40.30.20.10
+-10000000000000000000000000000...
+9999999999999998999999999999999910000000000000000
+============================================================
+============================================================
+TEST 2: fp_step_inline
+============================================================
+0
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1
+1
+0.9
+0.8
+0.7
+0.6
+0.5
+0.4
+0.3
+0.2
+0.1
+0
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                Zero step size for step function \__prg_map_1:w .
+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 step size inf in step function \__prg_map_1:w .
+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 fp_to_decimal(-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.
+-10000000000000000000000000000...
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                Tiny step size (-inf+1=-inf) in step function \__prg_map_1:w .
+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.
+9999999999999998
+9999999999999999
+10000000000000000
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                Tiny step size (1e16+1=1e16) in step function \__prg_map_1:w .
+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.
+============================================================


Property changes on: trunk/l3kernel/testfiles/m3fp-logic004.luatex.tlg
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/l3kernel/testfiles/m3fp-logic004.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3fp-logic004.lvt	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3fp-logic004.lvt	2016-12-06 19:03:30 UTC (rev 6788)
@@ -9,9 +9,14 @@
 
 \begin{document}
 \START
-\AUTHOR{Joseph Wright}
+\AUTHOR{Joseph Wright, Bruno Le Floch}
 \ExplSyntaxOn
 
+\OMIT
+% to avoid very-long output of \fp_to_decimal:n { -inf }
+\cs_new:Npn \test_type:n #1
+  { \TYPE { \str_range:nnn {#1} { 1 } { 30 } ... } }
+\TIMO
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \TESTEXP { fp_step_function }
@@ -23,6 +28,14 @@
     \fp_step_function:nnnN { 1 } { -0.1 } { 0 } \TYPE
     \NEWLINE
     \fp_step_function:nnnN { 1 } { 0.1 }  { 0 } \TYPE
+    \NEWLINE
+    \fp_step_function:nnnN { 1 } { 0 }  { 0 } \TYPE
+    \NEWLINE
+    \fp_step_function:nnnN { 1 } { inf }  { 0 } \TYPE
+    \NEWLINE
+    \fp_step_function:nnnN { -inf } { 1 }  { 0 } \test_type:n
+    \NEWLINE
+    \fp_step_function:nnnN { 1e16-2 } { 1 }  { 1e16+10 } \TYPE
   }
 
 \TEST { fp_step_inline }
@@ -31,6 +44,10 @@
     \fp_step_inline:nnnn { 0 } { -0.1 } { 1 } { \TYPE {#1} }
     \fp_step_inline:nnnn { 1 } { -0.1 } { 0 } { \TYPE {#1} }
     \fp_step_inline:nnnn { 1 } { 0.1 }  { 0 } { \TYPE {#1} }
+    \fp_step_inline:nnnn { 1 } { 0 }    { 0 } { \TYPE {#1} }
+    \fp_step_inline:nnnn { 1 } { inf }  { 0 } { \TYPE {#1} }
+    \fp_step_inline:nnnn { -inf } { 1 } { 0 } { \test_type:n {#1} }
+    \fp_step_inline:nnnn { 1e16-2 } { 1 }  { 1e16+10 } { \TYPE {#1} }
   }
 
 \END

Modified: trunk/l3kernel/testfiles/m3fp-logic004.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-logic004.tlg	2016-12-06 17:32:58 UTC (rev 6787)
+++ trunk/l3kernel/testfiles/m3fp-logic004.tlg	2016-12-06 19:03:30 UTC (rev 6788)
@@ -1,11 +1,58 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
-Author: Joseph Wright
+Author: Joseph Wright, Bruno Le Floch
 ============================================================
 TEST 1: fp_step_function
 ============================================================
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Zero step size for step function \TYPE .
+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 step size inf in step function \TYPE .
+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 fp_to_decimal(-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: 
+                           Tiny step size (-inf+1=-inf) in step function \te...
+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: 
+                           Tiny step size (1e16+1=1e16) in step function \TY...
+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.
 00.10.20.30.40.50.60.70.80.91
 10.90.80.70.60.50.40.30.20.10
+-10000000000000000000000000000...
+9999999999999998999999999999999910000000000000000
 ============================================================
 ============================================================
 TEST 2: fp_step_inline
@@ -32,4 +79,53 @@
 0.2
 0.1
 0
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Zero step size for step function \__prg_map_1:w .
+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 step size inf in step function \__prg_map...
+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 fp_to_decimal(-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.
+-10000000000000000000000000000...
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Tiny step size (-inf+1=-inf) in step function \__...
+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.
+9999999999999998
+9999999999999999
+10000000000000000
+! Undefined control sequence.
+<argument> \LaTeX3 error: 
+                           Tiny step size (1e16+1=1e16) in step function \__...
+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.
 ============================================================



More information about the latex3-commits mailing list