Code covered by the BSD License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

### Highlights from NUM2IEEE

3.5
3.5 | 2 ratings Rate this file 12 Downloads (last 30 days) File Size: 2.07 KB File ID: #2996 Version: 1.0

# NUM2IEEE

### Steven Lord (view profile)

06 Feb 2003 (Updated )

This function displays the IEEE double-precision representation of a double in MATLAB.

File Information
Description

This function displays the IEEE double-precision representation of a double in MATLAB. If used with the Symbolic Math Toolbox, it can also display the exact number represented by that IEEE floating point number (which may not be exactly the same as the input; see the Fall 1996 Cleve's Corner article at http://www.mathworks.com/company/newsletter/pdf/Fall96Cleve.pdf)

MATLAB release MATLAB 6.0 (R12)
Other requirements Symbolic Math Toolbox recommended, not required
Tags for This File   Please login to tag files.
Comments and Ratings (3)
15 Sep 2009 Toby Driscoll

### Toby Driscoll (view profile)

As 07 Sep comment says, this function gives incorrect results because of an unnecessary conversion to char.

07 Sep 2009 Teja Muppirala

### Teja Muppirala (view profile)

Hi how's it going Steve,

On line 19, you have:
number=num2str(number);

but this will return a string with fewer decimal places than is necessary to represent the actual machine number that was input.

For example, if I were to do
>>[s,e,m] = num2ieee(sqrt(2))
then the string on line 19 becomes '1.4142' and I get a wrong result (at least that's what happens on R2009a and R2009b).

Changing line 19 to:
number=num2str(number,100);

or something like that would be the only change needed, I think.

-Teja (LTC Application Engineer in Tokyo)

Comment only
07 Apr 2004 martin vernhout

works great!!! thanks