 
 
 
 
 
 
Re: Severe ToExpression Fault?
- To: mathgroup at smc.vnet.net
- Subject: [mg42902] Re: [mg42892] Severe ToExpression Fault?
- From: Dr Bob <drbob at bigfoot.com>
- Date: Sat, 2 Aug 2003 04:12:26 -0400 (EDT)
- References: <200308010526.BAA09833@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
E is the napierian base 2.71828..., so indeed:
-1.97*E - 4 == -9.355015202064319`
True
But try this:
ToExpression[StringReplace["-1,97E-04", {"," -> ".", "E" -> "*10^"}]]
or better:
Read[StringToStream@StringReplace["-1,97E-04", {"," -> "."}], Real]
Bobby
On Fri, 1 Aug 2003 01:26:02 -0400 (EDT), Nils Theune <nils at theune.com> 
wrote:
> Hi folks,
>
> running Mathematica 4.0.1 I am stuck with the following problem:
>
> Input:
> Print["-1,97E-04"];
> Print[StringReplace["-1,97E-04", {"," -> "."}]];
> Print[ToExpression[StringReplace["-1,97E-04", {"," -> "."}]]];
>
> Output:
> -1,97E-04
> -1.97E-04
> -9.35502
>
> Can somebody explain this to me? Why does the ToExpression Function
> not make the decimal -1.97E-04 out of the String "-1.97E-04". What in
> the hell is going wrong (-9.35502->"Where does this number come
> from?") and what can be done to circumvent the ToExpression function.
>
> I am greatful for any kind of comments on this problem/bug.
>
> regards
> Nils
>
>
-- 
majort at cox-internet.com
Bobby R. Treat
- References:
- Severe ToExpression Fault?
- From: nils@theune.com (Nils Theune)
 
 
- Severe ToExpression Fault?

