Re: Greatest Common Divisor - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: Greatest Common Divisor
Date
Msg-id 5E08D947.9000902@anastigmatix.net
Whole thread Raw
In response to Re: Greatest Common Divisor  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: Greatest Common Divisor  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On 12/29/19 02:30, Fabien COELHO wrote:

>>> C modulo operator (%) is a pain because it is not positive remainder
>>> (2 % -3 == -1 vs 2 % 3 == 2, AFAICR).
>>
>> This does not seem to be the case...
> ...
> Because I do not trust C modulo as I had a lot of problems with it? :-)

If I recall correctly (and I'm traveling and away from those notes),
the exact semantics of C's % with negative operands was left
implementation-defined until, was it, C99 ?

So it might be ok to rely on the specified C99 behavior (whichever
behavior that is, he wrote, notelessly) for PG 12 and later, where
C99 is expected.

Regards,
-Chap



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Recognizing superuser in pg_hba.conf
Next
From: Fabien COELHO
Date:
Subject: Re: Greatest Common Divisor