[Tutor] round so only see 2 digits
Kojo Idrissa
kojo@hal-pc.org
Mon, 04 Mar 2002 11:34:35 -0600
Thanks for the response Alan. I may try to manipulate the
string at the character level.
What I'm trying to do is perform a computation on a number
(my age) to split it into three numbers, like a software
version number (Major.Minor.Revision). I'd like to have
all three numbers be seperate, and then print them, but I
may have to just add the Minor and Revision numbers
together.
On Mon, 4 Mar 2002 17:14:11 -0000
alan.gauld@bt.com wrote:
>> 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
****************************
Kojo Idrissa
kojo@hal-pc.org
http://www.hal-pc.org/~kojo/
****************************