[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57383] cell2mat does not warn on mixed class
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #57383] cell2mat does not warn on mixed class numeric input |
Date: |
Sun, 8 Dec 2019 14:21:51 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Follow-up Comment #1, bug #57383 (project octave):
I don't think a warning is necessary here. The rules for mathematical
operations involving mixed types (integers, singles, doubles) are
well-defined. Concatenation is just another mathematical operation and
follows the same rules.
As an example, should there be a warning for this code?
octave:2> x = 1 + single (2)
x = 3
octave:3> class (x)
ans = single
This works the same with integers
octave:7> x = 1 + int8 (2)
x = 3
octave:8> class (x)
ans = int8
And it works the same way with cell2mat
octave:4> a = { pi, int8(1) }
a =
{
[1,1] = 3.1416
[1,2] = 1
}
octave:5> x = cell2mat (a)
x =
3 1
octave:6> class (x)
ans = int8
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57383>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/