bugGNU Octave - Bugs: bug #43513, when constructing a matrix from...

 
 

bug #43513: when constructing a matrix from one vector of doubles and one vector of ints, octave silently casts the doubles to ints

Submitted by:  Gary <mi3gai4rui4>
Submitted on:  Sat 01 Nov 2014 09:26:16 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: InvalidAssigned to: None
Originator Name: garymmOpen/Closed: Closed
Release: 3.8.1Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 02 Nov 2014 03:53:25 PM UTC, comment #1:

Thanks for your bug report. This is a commonly misunderstood feature of the Matlab and Octave languages. Since the default variable type is a double, it is treated as having the least precedence when mixed-type numeric expressions are evaluated.

I believe it is documented here:

https://www.gnu.org/software/octave/doc/interpreter/Promotion-and-Demotion-of-Data-Types.html

Mike Miller <mtmiller>
Project Administrator
Sat 01 Nov 2014 09:26:16 PM UTC, original submission:

for example:

> doubles = [1.01; -0.01];
> ints = [int32(10); int32(0)];
> [doubles ints]

ans =
1 10

  1. 0

This is surprising behavior, and I can't find it documented anywhere.
Checked these pages:
https://www.gnu.org/software/octave/doc/interpreter/Integer-Data-Types.html
https://www.gnu.org/software/octave/doc/interpreter/Matrices.html#Matrices

Gary <mi3gai4rui4>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by mi3gai4rui4 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 02 Nov 2014 03:53:25 PM UTCmtmillerStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1