Fix infinite recursion in mod(double, long)