Ah yes, the modulus operation. You can use modf() for splitting a double into an integer and a fraction. Then you could convert the fraction part into a remainder. That is the best way I can think of doing this off the top of my head.