[latex3-commits] [l3svn] r7350 - Make \dim_to_decimal_in_unit:nn more robust (fixes #376)

noreply at latex-project.org noreply at latex-project.org
Wed Jul 12 00:09:17 CEST 2017


Author: bruno
Date: 2017-07-12 00:09:16 +0200 (Wed, 12 Jul 2017)
New Revision: 7350

Modified:
   trunk/l3kernel/l3skip.dtx
   trunk/l3kernel/testfiles/m3skip002.tlg
   trunk/l3kernel/testfiles/m3skip004.tlg
Log:
Make \dim_to_decimal_in_unit:nn more robust (fixes #376)

I just added parentheses; maybe we should put such parentheses every
time we call \numexpr, \dimexpr, \glueexpr etc.?


Modified: trunk/l3kernel/l3skip.dtx
===================================================================
--- trunk/l3kernel/l3skip.dtx	2017-07-11 13:18:03 UTC (rev 7349)
+++ trunk/l3kernel/l3skip.dtx	2017-07-11 22:09:16 UTC (rev 7350)
@@ -498,7 +498,7 @@
 %   the \meta{dimexpr} in \texttt{pt}.  Since dimension expressions are
 %   evaluated much faster than their floating point equivalent,
 %   \cs{dim_to_fp:n} can be used to speed up parts of a computation
-%   where a low precision is acceptable.
+%   where a low precision and a smaller range are acceptable.
 % \end{function}
 %
 % \section{Viewing \texttt{dim} variables}
@@ -1217,7 +1217,7 @@
 \cs_new:Npn \dim_ratio:nn #1#2
   { \@@_ratio:n {#1} / \@@_ratio:n {#2} }
 \cs_new:Npn \@@_ratio:n #1
-  { \__int_value:w \@@_eval:w #1 \@@_eval_end: }
+  { \__int_value:w \@@_eval:w (#1) \@@_eval_end: }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}

Modified: trunk/l3kernel/testfiles/m3skip002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3skip002.tlg	2017-07-11 13:18:03 UTC (rev 7349)
+++ trunk/l3kernel/testfiles/m3skip002.tlg	2017-07-11 22:09:16 UTC (rev 7350)
@@ -118,6 +118,11 @@
                    p
 l. ...}
 I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
+! Missing ) inserted for expression.
+<to be read again> 
+                   p
+l. ...}
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 ! Arithmetic overflow.
 <to be read again> 
                    p
@@ -128,5 +133,5 @@
 2
 0.05
 -0.75002
-0pt\__dim_eval_end: /186467)\__dim_eval_end: 
+0pt)\__dim_eval_end: /186467)\__dim_eval_end: 
 ============================================================

Modified: trunk/l3kernel/testfiles/m3skip004.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3skip004.tlg	2017-07-11 13:18:03 UTC (rev 7349)
+++ trunk/l3kernel/testfiles/m3skip004.tlg	2017-07-11 22:09:16 UTC (rev 7350)
@@ -65,6 +65,11 @@
                    p
 l. ...  }
 I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
+! Missing ) inserted for expression.
+<to be read again> 
+                   p
+l. ...  }
+I was expecting to see `+', `-', `*', `/', or `)'. Didn't.
 ! Arithmetic overflow.
 <to be read again> 
                    p



More information about the latex3-commits mailing list