[Tutor] round so only see 2 digits

alan.gauld@bt.com alan.gauld@bt.com
Mon, 4 Mar 2002 17:14:11 -0000


> I've got a similar question:  How do I round a float to get 
> rid of the leading zero before the decimal?  

Its got nothing to do with rounding but is purely about 
formatting. However I don't know of any way to do that 
without actually manipulating the string at a character level.

Probably because its an extremely BAD thing to do 
- it makes decimal numbers very hard to read and your output 
therefore very error prone...

> Maybe I missed it?  That's quite probable.

I doubt it, I just doubt that anyone ever considered 
providing such a thing.

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld