[latex3-commits] [l3svn] r6773 - Make extra commas result in nan

noreply at latex-project.org noreply at latex-project.org
Sat Dec 3 13:54:33 CET 2016


Author: bruno
Date: 2016-12-03 13:54:32 +0100 (Sat, 03 Dec 2016)
New Revision: 6773

Modified:
   trunk/l3kernel/l3fp-parse.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-parse002.tlg
Log:
Make extra commas result in nan

Previously the first argument was used, so sin(0,3)=0.


Modified: trunk/l3kernel/l3fp-parse.dtx
===================================================================
--- trunk/l3kernel/l3fp-parse.dtx	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/l3fp-parse.dtx	2016-12-03 12:54:32 UTC (rev 6773)
@@ -2271,6 +2271,10 @@
 % \end{macro}
 %
 % \begin{macro}[aux, verb, EXP]{\__fp_parse_infix_,:N}
+% \begin{macro}[aux, EXP]{\@@_parse_infix_comma:w, \@@_parse_infix_comma_error:w}
+% \begin{macro}[aux, verb, EXP]{\__fp_,_o:ww}
+%   \cs{@@_,_o:ww} is a complicated way of replacing any number of
+%   floating point arguments by \texttt{nan}.
 %    \begin{macrocode}
 \group_begin:
   \char_set_catcode_letter:N \,
@@ -2281,27 +2285,39 @@
         \exp_after:wN \use_none:n
         \exp_after:wN \@@_parse_infix_,:N
       \else:
-        \if_int_compare:w #1 = \c_one
-          \exp_after:wN \@@_parse_infix_comma:w
-          \exp:w
-        \else:
-          \exp_after:wN \@@_parse_infix_comma_gobble:w
-          \exp:w
+        \if_int_compare:w #1 < \c_one
+          \@@_parse_infix_comma_error:w
         \fi:
-        \@@_parse_operand:Nw \c_one
+        \exp_after:wN \@@_parse_infix_comma:w
+        \exp:w \@@_parse_operand:Nw \c_one
         \exp_after:wN \@@_parse_expand:w
       \fi:
     }
   \cs_new:Npn \@@_parse_infix_comma:w #1 @
     { #1 @ \use_none:n }
-  \cs_new:Npn \@@_parse_infix_comma_gobble:w #1 @
+  \cs_new:Npn \@@_parse_infix_comma_error:w #1 \exp:w
     {
+      \fi:
       \__msg_kernel_expandable_error:nn { kernel } { fp-extra-comma }
-      @ \use_none:n
+      \exp_after:wN @
+      \exp_after:wN \@@_parse_apply_binary:NwNwN
+      \exp_after:wN ,
+      \exp:w
     }
+  \cs_new:Npn \@@_,_o:ww #1
+    {
+      \if_meaning:w \s_@@ #1
+        \exp_after:wN \@@_use_i_until_s:nw
+        \exp_after:wN \@@_,_o:ww
+      \fi:
+      \exp_after:wN \c_nan_fp
+      #1
+    }
 \group_end:
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsubsection{Usual infix operators}
 %

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3654,7 +3654,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3645,7 +3645,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3645,7 +3645,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3645,7 +3645,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3652,7 +3652,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3655,7 +3655,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3646,7 +3646,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3646,7 +3646,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3646,7 +3646,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -3653,7 +3653,8 @@
 Defining \__fp_parse_infix_):N on line ...
 Defining \__fp_parse_infix_,:N on line ...
 Defining \__fp_parse_infix_comma:w on line ...
-Defining \__fp_parse_infix_comma_gobble:w on line ...
+Defining \__fp_parse_infix_comma_error:w on line ...
+Defining \__fp_,_o:ww on line ...
 Defining \__fp_parse_infix_^:N on line ...
 Defining \__fp_parse_infix_/:N on line ...
 Defining \__fp_parse_infix_mul:N on line ...

Modified: trunk/l3kernel/testfiles/m3fp-parse002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-parse002.tlg	2016-12-03 03:46:41 UTC (rev 6772)
+++ trunk/l3kernel/testfiles/m3fp-parse002.tlg	2016-12-03 12:54:32 UTC (rev 6773)
@@ -45,8 +45,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.
-1
-0.8414709848078965
+nan
+nan
 ============================================================
 ============================================================
 TEST 4: Weird juxtaposition
@@ -62,7 +62,7 @@
 and I'll forget about whatever was undefined.
 27
 82575359923.09571
-12.56637061435917
+nan
 ============================================================
 ============================================================
 TEST 5: Use of \sin instead of sin
@@ -187,7 +187,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.
-> sin(0,)=0.
+> sin(0,)=nan.
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
                            Missing number before ','.



More information about the latex3-commits mailing list