round() to nearest .05 ?

Diez B. Roggisch deetsNOSPAM at web.de
Mon Nov 15 19:48:50 EST 2004


> What's the best way to get there? Should I write a function to manage my
> rounding or is there a simpler/better way?

Others have pointed out how to achieve the rounding - I just want to add
that using floats for currency values isn't the best choice. Depending on
your version of python, check out these links:

http://fixedpoint.sourceforge.net/
http://www.python.org/peps/pep-0327.html


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list