changeset 23211:08042580fe93 stable

Fix incorrect handling of 0b binary numbers in complex contstants. * lex.ll (handle_number): For number identified as binary, only look for '0' or '1' and ignore other characters such as 'i','j' used in complex notation.
author Rik <rik@octave.org>
date Sun, 19 Feb 2017 22:01:18 -0800
parents 9b0a2bc07545
children 0881e1671490
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Sun Feb 19 20:50:42 2017 -0800
+++ b/libinterp/parse-tree/lex.ll	Sun Feb 19 22:01:18 2017 -0800
@@ -2794,8 +2794,13 @@
 
         for (size_t i = 0; i < strlen (tmptxt); i++)
           {
-            long_int_value <<= 1;
-            long_int_value += static_cast<uintmax_t> (tmptxt[i] == '1');
+            if (tmptxt[i] == '0')
+              long_int_value <<= 1;
+            else if (tmptxt[i] == '1')
+            {
+              long_int_value <<= 1;
+              long_int_value += 1;
+            }
           }
 
         value = static_cast<double> (long_int_value);