Re: Greatest Common Divisor

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Stephen Frost <sfrost(at)snowman(dot)net>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Chapman Flack <chap(at)anastigmatix(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Greatest Common Divisor
Date: 2020-01-04 00:38:45
Message-ID: 0d4d936c-a409-e609-d0fd-2e009b2f47e1@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/01/2020 01:26, Vik Fearing wrote:
> On 04/01/2020 01:21, Tom Lane wrote:
>> Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> writes:
>>> On 03/01/2020 20:14, Fabien COELHO wrote:
>>>> I'm unsure about gcd(INT_MIN, 0) should error. Possibly 0 would be nicer?
>>> What justification for that do you have?
>> Zero is the "correct" answer for that, isn't it, independently of overflow
>> considerations?
>
> I would say not.  The correct answer is INT_MIN but we've decided a
> negative result is not desirable.

Wolfram Alpha agrees.

https://www.wolframalpha.com/input/?i=gcd%28-9223372036854775808%2C0%29

--

Vik Fearing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikael Kjellström 2020-01-04 00:41:20 Re: sidewinder has one failure
Previous Message Tom Lane 2020-01-04 00:34:04 Re: Greatest Common Divisor