From: Chapman Flack <chap@anastigmatix.net>
To: Fabien COELHO <coelho@cri.ensmp.fr>
To: Vik Fearing <vik.fearing@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Greatest Common Divisor
Date: Sun, 29 Dec 2019 11:50:15 -0500
Message-ID: <5E08D947.9000902@anastigmatix.net> (raw)
In-Reply-To: <alpine.DEB.2.21.1912290815520.889@pseudo>
References: <adbd3e0b-e3f1-5bbc-21db-03caf1cef0f7@2ndquadrant.com>
<alpine.DEB.2.21.1912281848540.24861@pseudo>
<dbf86808-91fa-3262-f939-2ef3d38ec242@2ndquadrant.com>
<alpine.DEB.2.21.1912290815520.889@pseudo>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: chap@anastigmatix.net, coelho@cri.ensmp.fr, vik.fearing@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Greatest Common Divisor
In-Reply-To: <5E08D947.9000902@anastigmatix.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox