Re: Converting from string to real
- To: mathgroup at smc.vnet.net
- Subject: [mg126785] Re: Converting from string to real
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 7 Jun 2012 05:20:22 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 6/6/12 at 4:53 AM, fcaleyo at gmail.com (fcaleyo) wrote: >Hi guys, I've got a problem with ToExpression[]. It seems to round >large real numbers off, e.g. ToExpression["109266.75"] returns >109267., still a real, yet not exactly what the original string >meant. Any idea to solve this? Many thanks fcaleyo This isn't as you describe. By default Mathematica *displays* real numbers rounded to six significant digits. But the value used by Mathematica is not rounded in that manner. This can be seen by the following: In[3]:= a = ToExpression["109266.75"] Out[3]= 109267. In[4]:= RealDigits[a] Out[4]= {{1,0,9,2,6,6,7,5,0,0,0,0,0,0,0,0},6} You can set your preferences so that Mathematica displays either more or less significant digits f you are so inclined.