octave-maintainers
[Top][All Lists]
Advanced

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

Input validation on ranges


From: Rik
Subject: Input validation on ranges
Date: Sat, 12 Oct 2019 17:19:29 -0700

All,

Octave currently accepts

[1, 2, 3]:[4,5,6]

and returns

1 2 3 4

In other words, only the first element of the matrix is used to generate
the resulting range object.  It turns out this behavior is Matlab compatible.

However, this probably isn't doing what the programmer intended, and its
not even clear what the desired output would be.

Should Octave issue a warning when the inputs are not scalars to help
programmers identify they are doing something incorrect?  Or do we not even
care?

I found this while trying to address bug #56959 where Matlab issues a
warning when any of the inputs to a range are complex, but Octave simply
takes the real part and moves on.

--Rik



reply via email to

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