[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: |
Amro |
Subject: |
[Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals |
Date: |
Tue, 23 Aug 2016 10:36:52 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0 |
Follow-up Comment #23, bug #45945 (project octave):
@mtmiller comment #16:
The case of array of literals:
>> y = int64([9223372036854775803; 9223372036854775804; 9223372036854775805;
9223372036854775806; 9223372036854775807])
y =
9223372036854775807
9223372036854775807
9223372036854775807
9223372036854775807
9223372036854775807
>> class(y)
ans =
int64
same thing with the colon operator:
>> int64(9223372036854775803:9223372036854775807)
ans =
9223372036854775807
>> class(ans)
ans =
int64
The above results are consistent with before, only when u?int64 is called with
a scalar literal number then it is treated as a special case, everything else
is first interpreted as double-type for the intermediate value before getting
cast to the target class in the final result.
Another example is when combining elements of unlike classes:
>> [int64(9223372036854775803) 9223372036854775803]
ans =
9223372036854775803 9223372036854775807
>> class(ans)
ans =
int64
So concatenating integers with numeric types always yields integers.
And when combining different integer types, all elements of the resulting
matrix are given the data type of the left-most integer (MATLAB evaluates each
element prior to concatenating them into a combined array).
These cases are documented here:
http://www.mathworks.com/help/matlab/matlab_prog/valid-combinations-of-unlike-classes.html
http://www.mathworks.com/help/matlab/matlab_prog/combining-unlike-integer-types.html
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45945>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Ernst Reissner, 2016/08/18
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Ernst Reissner, 2016/08/18
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Mike Miller, 2016/08/19
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Mike Miller, 2016/08/19
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Ernst Reissner, 2016/08/19
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Mike Miller, 2016/08/19
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for integer literals, Ernst Reissner, 2016/08/19
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals, Mike Miller, 2016/08/22
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals, John W. Eaton, 2016/08/22
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals, Amro, 2016/08/23
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals,
Amro <=
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals, Amro, 2016/08/23
- [Octave-bug-tracker] [bug #45945] Missing Matlab's special support for int64/uint64 integer literals, Mike Miller, 2016/08/23