Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problems using modulo

Thread Tools

Problems using modulo

Posts: n/a

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


- Griff
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: modulo seems not to work when using in index Pascal Peyremorte VHDL 0 12-23-2008 05:21 PM
[xsl] sort & modulo Tjerk Wolterink XML 3 04-22-2005 12:49 PM
Java ME modulo method ?? Java 1 05-19-2004 11:56 PM
Problems using modulo Griff Python 5 04-20-2004 12:20 PM
General modulo-question Christian Kruggel Java 1 07-07-2003 05:44 PM