bugGNU Octave - Bugs: bug #53477, base2dec.m : missing a warning,...

 
 

bug #53477: base2dec.m : missing a warning, error.

Submitter:  Dildar Sk <hodor123456>
Submitted:  Mon 26 Mar 2018 01:50:55 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Dildar Sk Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 12 Apr 2018 08:48:34 PM UTC, comment #2: 

I checked in a changeset to address using NaN as a base here (http://hg.savannah.gnu.org/hgweb/octave/rev/b02d5a4c7452).

Rather than explicitly call isnan() I changed the structure of the input validation tests.


-  elseif (base < 2 || base > length (symbols))
+  elseif (! (base >= 2 && base <= length (symbols)))


Because NaN never compares true to any number this elseif will now evaluate to ! 0 for a NaN and issue the necessary error message.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Mon 26 Mar 2018 01:56:16 PM UTC, comment #1: 

Here, I updated the required case.
Added a test also.
Patch attached.

(file #43685)

Dildar Sk <hodor123456>
Mon 26 Mar 2018 01:50:55 PM UTC, original submission:  

In MATLAB,


>> base2dec('11',NaN)
Error using base2dec (line 24)
The base must be an integer value between 2 and 36.


But in Octave,


>> base2dec('11',NaN)
ans =  NaN


NaN is not-a-number so definitely it doesn't lie within 2-36 range.
So, Octave also should throw error like MATLAB.

Dildar Sk <hodor123456>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #43685:  base2dec.patch added by hodor123456 (813B - 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 hodor123456 (Submitted the item)
  • -email is unavailable- added by hodor123456
  •  

    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
    2018-04-12 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2018-03-26 hodor123456 Attached File- Added base2dec.patch, #43685
    2018-03-26 hodor123456 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code