Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Concatenating matrix columns causes loss of precision
Replies: 4   Last Post: Aug 24, 2013 12:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,868
Registered: 12/7/04
Re: Concatenating matrix columns causes loss of precision
Posted: Aug 24, 2013 12:03 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.