Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ilblo-0005Ur-Oj for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Dec 2019 16:50:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ilbln-0004zJ-I2 for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Dec 2019 16:50:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ilblm-0004zC-QG for pgsql-hackers@lists.postgresql.org; Sun, 29 Dec 2019 16:50:23 +0000 Received: from anastigmatix.net ([68.171.219.55]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ilblj-0000UK-Kt for pgsql-hackers@lists.postgresql.org; Sun, 29 Dec 2019 16:50:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=v9wPD7bDojvLN87XatCeRhmjpeOsZ9tqMaKT+lnaI4Q=; b=mHeIGpZuC4OioVmwUzsG0qN1Y0 3jlHK3hp2Br20xv+O+6GW0d/CCX/+nDuLGLcelg7XH3/3I6j5wVZx2ntLlN8oHeU59/zi1AOfUChJ vH7gWEPczBozxRQOagWCmcYIsDvarz51EDBVrniQh28o26JHgKum57Fw8to49vhIlov4Ygl4rtRdl +tnqIqXyY1CBN0V5oEqj++xOlG+1JgcjP6AQ3BtDYWwB33qFLtFzrsMPWtIVe1JmFPBjvv48DDKZ5 roNxLiY7KsD+TLDOnhlzd9iy9jmkPmZCVj5XVzWtKnFwbeGB1seGg6/4yN+7u/tj+swe2KcaFP11E 54a2Qipw==; Received: from 96-91-70-106-static.hfc.comcastbusiness.net ([96.91.70.106]:39436 helo=[10.1.20.121]) by bay.acenet.us with esmtpsa (TLSv1:ECDHE-RSA-AES128-SHA:128) (Exim 4.92) (envelope-from ) id 1ilblh-00CEs7-8J; Sun, 29 Dec 2019 11:50:17 -0500 Message-ID: <5E08D947.9000902@anastigmatix.net> Date: Sun, 29 Dec 2019 11:50:15 -0500 From: Chapman Flack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Fabien COELHO , Vik Fearing CC: PostgreSQL Hackers Subject: Re: Greatest Common Divisor References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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