octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54622] test importdata fails in dev octave wi


From: Rik
Subject: [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows
Date: Mon, 10 Sep 2018 16:59:05 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #46, bug #54622 (project octave):

I have answers, but I can at least locate where the problem is occurring.  It
is in this code


          double x = octave_read_double (tmp_stream);
          if (tmp_stream)
            {
              if (tmp_stream.eof ())
                {
                  if (iscmplx)
                    cdata(i,j++) = x;
                  else
                    rdata(i,j++) = x;
                }
              else
                {
                  int next_char = std::tolower (tmp_stream.peek ());
                  if (next_char == 'i' || next_char == 'j')


When it works, the tmp_stream.peek() call returns EOF which is -1.  When it
fails, the next char is 255.  One change to make would be to break out the
peek and the tolower call.  Calling tolower with EOF returns EOF, but using
any other negative value is undefined.  I wrote a quick C++ program and
tolower(-2) returned 254 which is weird.  So, perhaps modify


int next_char = std::tolower (tmp_stream.peek ());


to 


int next_char0 = tmp_stream.peek ();
printf ("next_char0: %d\n", next_char0);
int next_char = std::tolower (next_char0);
printf ("next_char: %d\n", next_char);


Following the code, octave_read_double eventually calls octave_read_fp_value
in liboctave/utils/lo-utils.cc.


// Read a double value.  Discard any sign on NaN and NA.

template <typename T>
double
octave_read_fp_value (std::istream& is)


The trouble may also be here or in read_inf_nan_na().



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54622>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]