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

Kent Johnson kent37 at tds.net
Tue Jan 16 21:45:01 CET 2007


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.

Kent



More information about the Tutor mailing list