octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #39607] num2hex matlab compatibility


From: Federico Gennari
Subject: [Octave-bug-tracker] [bug #39607] num2hex matlab compatibility
Date: Mon, 29 Jul 2013 13:33:31 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0

URL:
  <http://savannah.gnu.org/bugs/?39607>

                 Summary: num2hex matlab compatibility
                 Project: GNU Octave
            Submitted by: fedemone
            Submitted on: lun 29 lug 2013 13:33:30 GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Federico Gennari
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.4
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

>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.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39607>

_______________________________________________
  Messaggio inviato con/da Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]