[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo,
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)" |
Date: |
Thu, 13 Aug 2020 15:32:04 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0 |
Follow-up Comment #6, bug #58830 (project octave):
Rik, I see what you mean. Reporting the subscript and the dimensional
reasoning is extremely useful behavior when accidentally going out of bounds:
octave:2> mat = rand(3,4)
mat =
0.6382 0.6235 0.7015 0.8218
0.1992 0.6884 0.5041 0.9771
0.7918 0.3789 0.7485 0.4995
octave:3> mat(end)
ans = 0.4995
octave:4> mat(end+1)
error: mat(13): out of bound 12 (dimensions are 3x4)
octave:5> mat(0)
error: mat(0): subscripts must be either integers 1 to (2^63)-1 or logicals
octave:6> mat(-1)
error: mat(-1): subscripts must be either integers 1 to (2^63)-1 or logicals
octave:7> mat(end-13)
error: mat(-1): subscripts must be either integers 1 to (2^63)-1 or logicals
octave:8> mat(nan)
error: mat(nan): subscripts must be either integers 1 to (2^63)-1 or logicals
The occasional quirk is that incorrectly calling a function with end as an
argument causes behavior that is very consistent with "end == nan" but can
surprise a user who doesn't know that equivalence:
octave:9> size(end)
ans =
1 1
octave:10> size(nan)
ans =
1 1
octave:11> isnan(end)
ans =
1
Though it can be surprising, it is likely easily noticed and fixed.
If it's relevant, could you check Matlab's error message for "isnan(end)"
please? Is it a blanket error message or does it give info relevant to the
calling location?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58830>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Fernando, 2020/08/08
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", anonymous, 2020/08/09
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Rik, 2020/08/12
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Rik, 2020/08/13
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)",
anonymous <=
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", John W. Eaton, 2020/08/13
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Rik, 2020/08/13
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", John W. Eaton, 2020/08/13
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", John W. Eaton, 2020/08/14
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", John W. Eaton, 2020/08/14
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Fernando, 2020/08/14
- [Octave-bug-tracker] [bug #58830] imprecise error message for "size(foo, end)", Rik, 2020/08/14