[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong num
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers |
Date: |
Tue, 11 Jan 2022 10:16:39 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 |
Follow-up Comment #4, bug #61788 (project octave):
Doing what you suggest is fine for generating all the numbers in an array.
But in Octave, we have ranges stored as base, limit, and increment and allow
indexing to obtain arbitrary elements. I don't think you really want to have
to count from the beginning of an array all the way to the end just to access
the last element (or one near the last).
OTOH, to me, this appears to be just another example showing how the idea I
had years ago of storing ranges as special objects may just not be worth it.
I would be glad to just eliminate ranges as a special storage type and simply
make colon expressions be syntactic shorthand for creating arrays with evenly
spaced elements (as I believe they are in Matlab).
Note that we also have the same problem for things like
for i = int8(-100):int8(100), i, end
but this problem can be fixed using the "increment previous value" method
since we are iterating over all elements, not indexing arbitrary elements.
And now, ranges in for loops are handled separately so that the range object
is not created directly, so we don't have to worry about memory issues in
range expressions if we eliminate the special range type.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61788>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Hartmut, 2022/01/10
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, John W. Eaton, 2022/01/10
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/10
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers,
John W. Eaton <=
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, John W. Eaton, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, John W. Eaton, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Arun Giridhar, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Markus Mützel, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, John W. Eaton, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Rik, 2022/01/11
- [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers, Hartmut, 2022/01/14