G
Griff
Mike,
Thanks for this. I haven't used %r before, in fact it doesn't even
seem to be mentioned in my "Python Essential Reference" book so I
probably wouldn't have come across it for ages.
I've since tried to run a similar piece of code on my 'C' compiler and
pretty quickly discovered/remembered that C doesn't allow you to do
modulo operations on floats full stop ... so I regard whatever Python
gives us as a bonus!
The quickest workaround I've found is to do
( round(t,5) % round(interval,5)) which seems to give the results I
need.
cheers
- Griff
Thanks for this. I haven't used %r before, in fact it doesn't even
seem to be mentioned in my "Python Essential Reference" book so I
probably wouldn't have come across it for ages.
I've since tried to run a similar piece of code on my 'C' compiler and
pretty quickly discovered/remembered that C doesn't allow you to do
modulo operations on floats full stop ... so I regard whatever Python
gives us as a bonus!
The quickest workaround I've found is to do
( round(t,5) % round(interval,5)) which seems to give the results I
need.
cheers
- Griff