Re: From PaddedForm to numbers?
- To: mathgroup at smc.vnet.net
- Subject: [mg80505] Re: From PaddedForm to numbers?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 23 Aug 2007 06:26:15 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <faj6fp$9gt$1@smc.vnet.net>
Curtis Osterhoudt wrote:
> Given a number in PaddedForm, how can I easily convert it to a number which
> can be worked with? This would be the analogue of ToExpression[
> some_string_representing_a_number ].
Assuming I have correctly guessed how you could possibly use
(incorrectly?) *PaddedForm*, you can use *First* to extract the original
number. (Use FullForm[y] to see the structure of y.) For instance,
In[1]:= y = PaddedForm[1.23456, {3, 4}]
Out[1]//PaddedForm= \!\(\*
TagBox[
InterpretationBox["\<\" 1.2300\"\>",
1.23456,
AutoDelete->True],
PaddedForm[#, {3, 4}]& ]\)
In[2]:= % + 1000 == y + 1000
Out[2]= 1001.23 == 1000 + \!\(\*
TagBox[
InterpretationBox["\<\" 1.2300\"\>",
1.23456,
AutoDelete->True],
PaddedForm[#, {3, 4}]& ]\)
In[3]:= %% + 1000 == First @ y + 1000
Out[3]= True
--
Jean-Marc