bugGNU Octave - Bugs: bug #39608, hex2num: parse single-precision...

 
 

bug #39608: hex2num: parse single-precision hex strings

Submitter:  Federico Gennari <fedemone>
Submitted:  Mon 29 Jul 2013 01:37:52 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Federico Gennari Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 05 Aug 2013 02:19:54 AM UTC, comment #3: 

I added the requested single precision extension in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/f010db8b710c

This feature will be part of the next major release of Octave.

Mike Miller <mtmiller>
Group Member
Tue 30 Jul 2013 01:24:21 PM UTC, comment #2: 

I understand you comment, and the possibility to choose single precision computing via additional argument can be the right solution. Otherwise, it should be implemented an additional function like this one:

http://www.mathworks.com/matlabcentral/fileexchange/6927-hexsingle2num

Federico Gennari <fedemone>
Mon 29 Jul 2013 06:50:48 PM UTC, comment #1: 

The problem with this change is that it's not a Matlab compatibility request, it would break Matlab compability. hex2num already has a well-defined behavior if the input string contains fewer than 16 characters, it is padded on the right with zeros. So it can't differentiate between double and single precision given only a string.

We could, however, add a second optional argument for the class to return, like eps() and zeros() do, which would be non-Matlab-compatible. So for example something like this:


octave:1> hex2num ("3ff0000000000000")
ans =  1
octave:2> hex2num ("3f800000")
ans =  0.0078125
octave:3> hex2num ("3f800000", "single")
ans =  1


Would that address your request?

Mike Miller <mtmiller>
Group Member
Mon 29 Jul 2013 01:37:52 PM UTC, original submission:  

This is the companion to request id #39607. Both in Matlab and Octave the hex2num function is working with double precision output only. It would be a good improvement for the function to give a single precision output when single precision input is given.

Federico Gennari <fedemone>

 

(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 mtmiller (Posted a comment)
  • -email is unavailable- added by fedemone (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-05 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-07-30 mtmiller StatusNeed Info Confirmed
    2013-07-29 mtmiller Severity3 - Normal 1 - Wish
        Item GroupMatlab Compatibility Feature Request
        StatusNone Need Info
        Release3.6.4 dev
        Operating SystemMicrosoft Windows Any
        Summaryhex2num improvement respect to matlab hex2num: parse single-precision hex strings

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code