String-to-Number Conversion Precision
- To: mathgroup at smc.vnet.net
- Subject: [mg112352] String-to-Number Conversion Precision
- From: Ben <benp84 at gmail.com>
- Date: Fri, 10 Sep 2010 04:50:06 -0400 (EDT)
I'm reading real numbers from a file and I'm trying to convert them
from string format (with arbitrary precision) to real values with the
same precision as given in the strings.
For example, when I convert "1.867524468", I want the result to be set
to precision 10. Instead, I get the following.
In:= string = "1.867524468"
In:= x = ToExpression[string]
The last 4-digits get cut off. This is fine for when I do math with
the number because the extra digits are still stored, but not when I
want to rewrite the number to a different file. When I convert the
number back to a string for file output, the last 4-digits remain
Is there a function or formula I can use to automatically set the
precision of these numbers to their precision in the string? Thanks.
Prev by Date:
Next by Date:
Re: Help with Solve
Previous by thread:
Re: Finding an exponent?
Next by thread:
Re: String-to-Number Conversion Precision