[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug modulo operator on negative numbers
- From: Francisco Olarte <folarte@...>
- Date: Tue, 17 Aug 2021 10:40:18 +0200
Not the op but:
On Tue, Aug 17, 2021 at 6:50 AM Flyer31 Test <flyer31@googlemail.com> wrote:
> I would regard the "C" result of your example as wrong ... . What C
> compiler do you use there - or does this really any C do?
Then you are in for a lot of pain ;-> as it seems C99 mandates
rounding division towards zero ( previously it was imp-def-beh ).
( I agree with you in that in any place I've had to deal with modulos
using mixed signed ( between num/dem or in the range of any of them ),
rounding towards -inf has been better ( I normally did the rounding
myself in this cases, as I normally used C and wanted to avoid
implementation definednesses) ).
Francisco Olarte.