Problems using modulo
Diez B. Roggisch
deetsNOSPAM at web.de
Mon Apr 19 11:51:53 EDT 2004
Griff wrote:
>
> Would be grateful for any suggestions
Try this:
t = 5.9
interval = 2.0
while t < 6.1:
print (t, interval, t % interval)
t+=0.1
Then you see what actually gets divided....
I'm not sure what you actually try to do, but AFAIK modulo is mathematically
only properly defined on integers - so you should stick to them. If you
need fractions, it might be sufficient to use fixed-point arithmetics by
simply multiplying by 10 ar 100.
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list