Round remainder to prevent precision lost

Precision can be lost also with only substraction, so the remainder must be
rounded each time.

issue4067
review6521002
(grafted from 9479cffe419b6c018237ec62ec8ed41a3bcaf9a5)

--HG--
branch : 3.2
extra : source : 9479cffe419b6c018237ec62ec8ed41a3bcaf9a5