Problems using modulo

Discussion in 'Python' started by Griff, Apr 19, 2004.

  1. Griff

    Griff Guest

    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
     
    Griff, Apr 19, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian Kruggel

    General modulo-question

    Christian Kruggel, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    452
    Brad BARCLAY
    Jul 7, 2003
  2. Replies:
    1
    Views:
    668
    Darryl L. Pierce
    May 20, 2004
  3. Tjerk Wolterink

    [xsl] sort & modulo

    Tjerk Wolterink, Apr 21, 2005, in forum: XML
    Replies:
    3
    Views:
    574
    Dimitre Novatchev
    Apr 22, 2005
  4. Griff

    Problems using modulo

    Griff, Apr 19, 2004, in forum: Python
    Replies:
    5
    Views:
    397
    Diez B. Roggisch
    Apr 20, 2004
  5. Pascal Peyremorte
    Replies:
    0
    Views:
    443
    Pascal Peyremorte
    Dec 23, 2008
Loading...

Share This Page