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 : 2.4
extra : source : 9479cffe419b6c018237ec62ec8ed41a3bcaf9a5
extra : amend_source : 9d6e984117b7319ca5fe2048856e6bfbf17c24be