results of division

Brad Tilley bradtilley at gmail.com
Thu Dec 9 10:56:58 EST 2004


Peter Hansen wrote:
> Brad Tilley wrote:
> 
>> What is the proper way to limit the results of division to only a few 
>> spaces after the decimal? I don't need rocket-science like precision. 
>> Here's an example:
>>
>> 1.775 is as exact as I need to be and normally, 1.70 will do.
> 
> 
> The answer is "what are you trying to do?".  The others have
> given options and good advice, but the "right" approach
> depends on what exactly you are doing.  Is this just for
> display purposes, or is there more significant (though
> perhaps not "precision-critical") calculation going on?
> 
> -Peter

I'm summing up the bytes in use on a hard disk drive and generating a 
report that's emailed based on the percentage of the drive in use. I 
know there are other ways to do this, but I like Python and I like to 
write my own code. I always find comp.lang.python a very helpful place.

Thank you,

Brad



More information about the Python-list mailing list