bugGNU Octave - Bugs: bug #38815, ~ operator or dec2bin()

 
 

bug #38815: ~ operator or dec2bin()

Submitter:  None
Submitted:  Tue 23 Apr 2013 07:28:24 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 19 Jun 2013 09:45:37 AM UTC, comment #3: 

Thanks you for the review. I'll let emacs take care of the comments style for me (M-;).

Pantxo Diribarne <pantxo>
Group Member
Wed 19 Jun 2013 03:52:02 AM UTC, comment #2: 

Pantxo, thanks for solving this one.  I applied your changeset here (http://hg.savannah.gnu.org/hgweb/octave/rev/3542e106c496). 

The only change I made was to use '##' for the start of comment which begins a line.  We use a single '#' only for a comment which is after some code.

Example:


## Stand-alone comment line
x = 1;  # comment on a line with code


Rik <rik5>
Group administrator
Sun 28 Apr 2013 08:18:59 PM UTC, comment #1: 

Attached is a patch for logical array support in dec2base.m
I added a test to assert this particular example works:

assert (dec2base (!a, 2, 1), ["1"; "0"; "0"; "0"])



(file #27968)

Pantxo Diribarne <pantxo>
Group Member
Tue 23 Apr 2013 07:28:24 PM UTC, original submission:  

In Matlab:

>> a = [0 1 2 3]

a =

     0     1     2     3

>> dec2bin(~a)

ans =

1
0
0
0

>> dec2bin(~a,1)

ans =

1
0
0
0

but in Octave:

octave:4> a=[0 1 2 3]
a =

   0   1   2   3

octave:5> ~a
ans =

   1   0   0   0

octave:6> dec2bin(~a,1)
error: dec2base: input must be real non-negative integers
error: called from:
error:   /usr/share/octave/3.6.4/m/strings/dec2base.m at line 71, column 5
error:   /usr/share/octave/3.6.4/m/strings/dec2bin.m at line 48, column 7
octave:6> dec2bin(real(~a),1)
ans =

1
0
0
0


Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #27968:  dec2base_logical.patch added by pantxo (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-19 rik5 Item GroupSegfault, Bus Error, etc. Matlab Compatibility
        StatusNone Fixed
        Open/ClosedOpen Closed
    2013-04-28 pantxo Attached File- Added dec2base_logical.patch, #27968

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code