octave-maintainers
[Top][All Lists]
Advanced

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

integer concatenation (was: Octave 2.1.61 available for ftp)


From: John W. Eaton
Subject: integer concatenation (was: Octave 2.1.61 available for ftp)
Date: Tue, 9 Nov 2004 22:23:35 -0500

On  9-Nov-2004, I wrote:

| On  5-Nov-2004, I wrote:
| 
| |   * Things like [int32(1), int16(1)] will fail.  Concatenation
| |     operations like this should return an object of the smaller type
| |     (int16 in this case).
| 
| This is not yet fixed, though it seems it should not be too hard to
| add.  I will try to take a look at it, but perhaps David could say
| whether it will require more than adding some concat functions.

I've implemented this feature.

While doing that, I found that the return type is not the smaller of
the two types, but it is the type of the first argument in the pair.
This means that

  [int8(1), int16(2)]

returns an int8 object, but

  [int16(1), int8(2)]

returns an int16 object.  The exception (you knew there had to be one,
right?) is that if you concatenate a double object and an intN object,
the the result is always the intN type.  This means that

  [int8(1), 2]

and

  [1, int8(2)]

both return int8 objects.

Will someone please verify that this is still the way that Matlab R14
behaves?

I didn't bother trying to define complex/intN concatenation because we
don't have complex intN objects.  I see no compelling reason to add
them, but someone will probably eventually complain that Octave is
completely useless because it does not have that feature.

My changes for concat are checked in.

Are there any other important bugs that need to be fixed before
making a 2.1.62 snapshot?

jwe



reply via email to

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