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: How to import data without losing much precision
Replies: 5   Last Post: Dec 3, 2012 9:44 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: How to import data without losing much precision
Posted: Dec 2, 2012 10:54 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message
news:k9gk4s$2hh$1@newscl01ah.mathworks.com...
> I'm trying to import some data, which was created by C code, into Matlab
> without losing much precision. Can someone show me an example of how to do
> so?
>
> I have about 52 decimal places of precision, with N=16 numbers on a line,
> like this:


Double precision only allows you 52 bits of precision (well, plus the
implicitly stored bit) not 52 digits.

*snip*

> I've tried using dlmread, csvread and importdata, but they cut off
> precision.


You could read these in as _strings_ and convert them into symbolic objects
using Symbolic Math Toolbox.

*snip*

> I've tried other things, too, but I cannot get any more precision. You can
> see that their all losing precision after about 16 decimal places.


Yes. See:

http://en.wikipedia.org/wiki/Double-precision_floating-point_format

> Could someone show me an example of how to import my data with the most
> precision?


Why do you believe you need 52 decimal digits of precision for your data?
For comparison, you only need roughly 39 digits of pi to calculate the
volume of the universe to within one atom.

http://en.wikipedia.org/wiki/Pi#Motivations_for_computing_.CF.80

Just because you HAVE the number out to N digits doesn't mean you NEED all
those digits.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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.