octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51252] incorrect type casting of colon operat


From: Xiangmin Jiao
Subject: [Octave-bug-tracker] [bug #51252] incorrect type casting of colon operator ':'
Date: Fri, 16 Jun 2017 16:12:39 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51252>

                 Summary: incorrect type casting of colon operator ':'
                 Project: GNU Octave
            Submitted by: xmjiao
            Submitted on: Fri 16 Jun 2017 08:12:38 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Xiangmin Jiao
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Any

    _______________________________________________________

Details:

In Octave 3.8.1, 4.0.2 and 4.2.1, the ':' operator returns incorrect data
types:
```
class( int32(1) : int32 (10))
```

It returns double. However, the expected answer is int32.

Similarly, 
```
class( int32(1) : 10)
class( int32(1) : int32(1), int32(10))
class( single(1) : 10)
class( single(1) : single(1), single(10))
```

all return double, but the first two should return int32, and the last two
should return single. I have observed this behavior in Ocatve 3.8.1, 4.0.2 and
4.2.1.

This is incompatible with MATLAB. It is also incompatible with the precedence
of data types in Octave for other operators.  For example,
```
1 + int32(2)
```
returns an int32, so int32 takes precedence over double.

Therefore, it is clearly a bug.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51252>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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