# HG changeset patch # User Mike Miller # Date 1459384123 25200 # Node ID 02826fb0f261f4ab231a40f24d35c068aa0495e4 # Parent 08baf0ebc9a90dc62a6f5a832373714f072a87fb textscan: Fix bug in exponent parsing * oct-stream.cc (textscan::read_double): Fix typo in exponent read loop. * file-io.cc: Add BIST test for exponent parsing. diff -r 08baf0ebc9a9 -r 02826fb0f261 libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Sat Mar 26 19:46:49 2016 +1100 +++ b/libinterp/corefcn/file-io.cc Wed Mar 30 17:28:43 2016 -0700 @@ -2197,6 +2197,9 @@ %! assert (c, {1, "/", 2}); %!assert (textscan (["1 2 3 4"; "5 6 7 8"], "%f"), {[15; 26; 37; 48]}) + +%% Check for delimiter after exponent +%!assert (textscan ("1e-3|42", "%f", "delimiter", "|"), {[1e-3; 42]}) */ // These tests have end-comment sequences, so can't just be in a comment diff -r 08baf0ebc9a9 -r 02826fb0f261 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Sat Mar 26 19:46:49 2016 +1100 +++ b/libinterp/corefcn/oct-stream.cc Wed Mar 30 17:28:43 2016 -0700 @@ -2884,7 +2884,7 @@ width_left--; } valid = false; - while (width_left-- && is && (ch = is.get ()) >= '0' && ch1 <= '9') + while (width_left-- && is && (ch = is.get ()) >= '0' && ch <= '9') { exp = exp*10 + ch - '0'; valid = true;