bugGNU Octave - Bugs: bug #39607, num2hex matlab compatibility

 
 

bug #39607: num2hex matlab compatibility

Submitted by:  Federico Gennari <fedemone>
Submitted on:  Mon 29 Jul 2013 01:33:30 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Federico GennariOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 05 Aug 2013 02:18:56 AM UTC, comment #2:

This is fixed with the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/81d3c4409645

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

Mike Miller <mtmiller>
Project Administrator
Mon 29 Jul 2013 06:52:49 PM UTC, comment #1:

Confirmed, num2hex should return an 8-character string or an n-by-8 array if the input is single-precision.

Mike Miller <mtmiller>
Project Administrator
Mon 29 Jul 2013 01:33:30 PM UTC, original submission:

From Octave documentation:

Loadable Function: s = num2hex (n)

Typecast a double precision number or vector to a 16 character hexadecimal string of the IEEE 754 representation of the number. For example:

num2hex ([-1, 1, e, Inf, NaN, NA]);
⇒ "bff0000000000000
3ff0000000000000
4005bf0a8b145769
7ff0000000000000
fff8000000000000
7ff00000000007a2"

But in Matlab documentation num2hex can support single precision:

num2hex

Convert singles and doubles to IEEE hexadecimal strings
Syntax

num2hex(X)
Description

If X is a single or double precision array with n elements, num2hex(X) is an n-by-8 or n-by-16 char array of the hexadecimal floating-point representation. The same representation is printed with format hex.
Examples

num2hex([1 0 0.1 -pi Inf NaN])

returns

ans =

3ff0000000000000
0000000000000000
3fb999999999999a
c00921fb54442d18
7ff0000000000000
fff8000000000000
num2hex(single([1 0 0.1 -pi Inf NaN]))

returns

ans =

3f800000
00000000
3dcccccd
c0490fdb
7f800000
ffc00000

http://www.mathworks.it/it/help/matlab/ref/num2hex.html

To allow compatibility, please allow num2hex function to handle single precision elements.

Federico Gennari <fedemone>

 

(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 fedemone (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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 05 Aug 2013 02:18:56 AM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 29 Jul 2013 06:52:49 PM UTCmtmillerStatusNone=>Confirmed
      Release3.6.4=>dev
      Operating SystemMicrosoft Windows=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1