bugGNU Octave - Bugs: bug #56005, dec2base does not return correct...

 
 

bug #56005: dec2base does not return correct value when input is a matrix of zeros

Submitter:  None
Submitted:  Wed 27 Mar 2019 02:21:05 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  spica lai Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 27 Mar 2019 06:17:22 PM UTC, comment #3: 

Very simple fix in the end.  The dec2base.m code should have been using columns() rather than length() to determine if there was an extra column of zeros at the start of the return value that needed to be stripped.  See this cset (https://hg.savannah.gnu.org/hgweb/octave/rev/16d4e3d14213).

The fix will be part of the 5.2.0 bug fix release.

Rik <rik5>
Group administrator
Wed 27 Mar 2019 03:18:04 PM UTC, comment #2: 

Confirmed.  This problem is general in that it effects all the dec2XXX functions which call dec2base.  I've bumped the Release to 5.1.0 and changed the Operating System to Any.

Rik <rik5>
Group administrator
Wed 27 Mar 2019 03:26:38 AM UTC, comment #1: 

This is still true in octave 5.x.x
in dec2base if I change line  55  to
function retval = dec2base (d, base, len = 1)


and change line 114 to
 if (((nargin == 2 && max_len > len) || (nargin == 3 && max_len > len))
then it seems to work properly.

can someone verify this ?

Doug Stewart <dastew>
Wed 27 Mar 2019 02:21:05 AM UTC, original submission:  

while using dec2hex(0) it returns correct value
when the input is a zero array, like dec2hex([0, 0]), it returns nothing.
Actually, I tried:

arr = dec2hex([0, 0])
arr_size = size(arr)

I get arr_size equals to [2 0].
However, if there is one none-zero value in input array, the return of dec2hex function is correct.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 dastew (Posted a comment)
  • -email is unavailable- added by None (Submitted 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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-27 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2019-03-27 rik5 StatusNone Confirmed
        Release4.4.0 5.1.0
        Operating SystemMicrosoft Windows Any
        Summarydec2hex([0,0]) does not return correct value dec2base does not return correct value when input is a matrix of zeros

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code