MathGroup Archive 2007

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

Search the Archive

Re: From PaddedForm to numbers?


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


  • Prev by Date: Re: Re: lower diagonal matrix
  • Next by Date: Re: fit a BinomialDistribution to exptl data?
  • Previous by thread: From PaddedForm to numbers?
  • Next by thread: Re: From PaddedForm to numbers?