Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Question with ToExpression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119640] Re: Question with ToExpression
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 15 Jun 2011 07:21:51 -0400 (EDT)
  • References: <201106141014.GAA06240@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

the value of the expression 1.0 is 1., a number. If you want to display 
that in some other way, you may do so, e.g., with . However, don't 
confuse the way a number is displayed with what the number _is_. Thus:

   expr = ToExpression["1.0"]
1.
   expr === 1.0   (* 3 equal signs, for identity *)
True
   formed = NumberForm[expr, {2,1}]
1.0
   formed === expr
False

On 6/14/2011 6:14 AM, graser wrote:
> Dear Group,
>
> I am trying to make an expression of 1.0 with ToExpression.
> But if I use it, ToExpression[1.0], the output is 1. instead of 1.0
> In[1]:= ToExpression["1.0"]
> Out[1]= 1.
>
> Or
>
> In[2]:= ToExpression[1.0]
>
> Out[2]= 1.
>
> Is there  any way to make it possible to make the output as 1.0 not
> 1.?
>
> Thanks!
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Sorting into bins
  • Next by Date: Re: implicit surfaces from older version of Mathematica
  • Previous by thread: Question with ToExpression
  • Next by thread: Re: Question with ToExpression