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

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

[Octave-bug-tracker] [bug #45945] Missing Matlab's special support for i


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals
Date: Tue, 21 Jul 2020 14:42:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Update of bug #45945 (project octave):

                  Status:               Confirmed => Ready For Test         

    _______________________________________________________

Follow-up Comment #26:

I pushed the following changeset so that integers larger than flintmax get
special treatment.  My change uses the method I described in comment #21.

http://hg.savannah.gnu.org/hgweb/octave/rev/ee9b1081471f

After pushing and looking at this report again, I see one detail that I may
have missed.  As shown in comment #23, Matlab does this:


>> y = int64([9223372036854775803; 9223372036854775804; 9223372036854775805;
9223372036854775806; 9223372036854775807])
y =
  9223372036854775807
  9223372036854775807
  9223372036854775807
  9223372036854775807
  9223372036854775807


and Octave will do the same.  However, Octave will also do this:


octave> y = int64([int64(9223372036854775803); 9223372036854775804;
9223372036854775805; 9223372036854775806; 9223372036854775807])
y =

  9223372036854775803
  9223372036854775804
  9223372036854775805
  9223372036854775806
  9223372036854775807


because after it sees the first int64() element and chooses the output type
for the array, it is calling int64_value on the remaining elements instead of
converting them to double first.  Is that what Matlab does as well, or does it
treat the remaining elements as double values first, then convert to int64? 
If so, then I expect the result to be


  9223372036854775803
  9223372036854775807
  9223372036854775807
  9223372036854775807
  9223372036854775807


with the class still being int64.  If someone can confirm, I think I see a
simple fix.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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