[Tutor] How to convert a long decimal into a string?

Dick Moores rdm at rcblue.com
Wed Jan 17 02:09:24 CET 2007


At 12:45 PM 1/16/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>Thanks, Kent. So I go with working up "an algorithm for first 
>>converting n to an int (for
>>example, multiplying the above n by 1000), converting to a string,
>>putting the decimal point back in between indices 2 and 3, then using
>>that string as n (thereby avoiding the use of quotes around n as the
>>first argument)."
>
>I really don't know what you mean by this. You are lost as soon as 
>you write 232.3452345230987987098709879087098709870987098745234 
>without quotes, there is no float literal with that value.
>
>You could pass the integer 
>2323452345230987987098709879087098709870987098745234
>as the argument if you always have the implied decimal point in the 
>same place.

You're right, of course. As usual. Just one of those "You can't get 
there from here" things. But I don't really need to, as Lloyd pointed out.

Thanks,

Dick






More information about the Tutor mailing list