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