Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Concatenating matrix columns causes loss of precision
Replies:
4
Last Post:
Aug 24, 2013 12:03 AM




Re: Concatenating matrix columns causes loss of precision
Posted:
Aug 24, 2013 12:03 AM


"Rohit" wrote in message <kv6sli$fml$1@newscl01ah.mathworks.com>... > I want the resulting matrix to have the original precision of temp1. How do I do this?          It is important to realize that what you see in matlab's display is only a decimal representation of the number actually used by the computer but rounded off to a certain number of significant decimal digits depending on the rounding format. When you display an entire array of numbers of greatly differing sizes, the display generally uses the same number of significant digits for all elements. In your example you were originally displaying the first array to ten digits and the second one to seven. The display of the the concatenated array was to seven which makes it appear as though you have lost the last three digits of the first column, but this is untrue. As James has said, there will be no change in the numbers as stored internally to your machine.
If you want to see the precise numbers as they are stored and used for computations, use "format hex" which represents the exact 64 binary digits that are used to represent a double precision floating point number, or the 32 for a single precision number. These hexadecimal numbers are not easy to interpret, since they are in the IEEE 754 format. To accomplish this see, for example, the pdf file at:
http://www.mathworks.com/company/newsletters/news_notes/pdf/Fall96Cleve.pdf
Roger Stafford



