Fix % overflow on 32 bit systems

See http://php.net/manual/en/function.fmod.php
Partially fixes #1
Merge pull request #2 from AlexeyKupershtokh/32bit-fix

Fix % overflow on 32 bit systems