octave-maintainers
[Top][All Lists]
Advanced

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

ulong_value Cell member function not behaving correctly


From: Daniel J Sebald
Subject: ulong_value Cell member function not behaving correctly
Date: Sun, 19 Aug 2012 04:37:08 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

John,

I've a question for you. I'm testing a built-in version of dec2base and ran into a problem where ulong_value() for a Cell is returning 0 when it is defined in octave to be 2^64-1. That is:

octave_value
dec2base_cell_str_op (const Cell& D, const charMatrix& BASE, int LEN)

[snip]

      // Determine largest number
      long unsigned int dval = D(i).ulong_value ();
fprintf(stderr, "D(i) = %lu\n", dval);
      if (dval > D_max)
        D_max = dval;

The answer is 0.  However, if I use the following, I get the correct result:

      // Determine largest number
      long unsigned int dval = D(i).uint64_scalar_value ();
fprintf(stderr, "D(i) = %lu\n", dval);
      if (dval > D_max)
        D_max = dval;

Is this a known issue, i.e., this pertains to this comment in ov.h:

  // FIXME -- these are kluges.  They turn into doubles
  // internally, which will break for very large values.  We just use
  // them to store things like 64-bit ino_t, etc, and hope that those
  // values are never actually larger than can be represented exactly
  // in a double.

?

Thanks,

Dan


reply via email to

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