MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Converting from string to real

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126787] Re: Converting from string to real
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 7 Jun 2012 05:21:04 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jqn5mn$her$1@smc.vnet.net>

On 2012.06.06. 10:51, 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?

By default machine precision number are displayed only with six digits, 
but the precision is still there.  If you position the cursor on the 
output cell and press space, you'll see this.

Also try FractionalPart@ToExpression["109266.75"]

So don't worry, only the display is truncated for convenience (in your 
case inconvenience but most of the time it's better not to see all 15 or 
so digits all at once)

-- 
Szabolcs Horvát
Visit Mathematica.SE:  http://mathematica.stackexchange.com/



  • Prev by Date: Re: Complex equation+ NDsolve
  • Next by Date: Re: Converting from string to real
  • Previous by thread: Re: Converting from string to real
  • Next by thread: Re: Converting from string to real