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: [mg126792] Re: Converting from string to real
  • From: "Kevin J. McCann" <kjm at KevinMcCann.com>
  • Date: Thu, 7 Jun 2012 05:22:48 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jqn5mn$her$1@smc.vnet.net>

This is an output formatting issue, and I will admit that it is 
annoying. Note:

ToExpression["109266.75"]-109266.75

gives zero. So, the answer is correct, it is just that Mathematica formats the 
output by rounding it. I am not sure how to make it show the way you 
want in an easy fashion; however, this works

NumberForm[ToExpression["109266.75"],10]

but this is a formatted output "for your eyes only", i.e. DON'T do 
something like

b = NumberForm[ToExpression["109266.75"],10]

and then try to use b as a number.

Kevin

On 6/6/2012 4:51 AM, 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
>
>
>
>




  • Prev by Date: Re: Converting from string to real
  • Next by Date: InverseZTransform numerical issue on some expression, version 8.0.4
  • Previous by thread: Re: Converting from string to real
  • Next by thread: vectorial ODE in mathematica