Calculation of remainder, floating point issues