Rounding

Zunbeltz Izaola zunbeltz at wm.lc.ehu.es.XXX
Tue Nov 4 05:36:12 EST 2003


Hi to all!

I want to know if it is possible to round a floating number to
multiples of another number. An example:
I've spam = 0.36 and foo = 0.38 and i want something like this:

>>>round(spam,0.25)
0.25
>>>round(foo,0.25)
0.50

I know that builtin round rounds to a decimal position, but is there a
module (or it is easy to code) with a function like this?

Thanks in advance

Zunbeltz Izaola
-- 
Remove XXX from email: zunbeltz at wm.lc.ehu.esXXX




More information about the Python-list mailing list