Greatest Common Divisor

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Greatest Common Divisor
Date: 2019-12-28 16:58:52
Message-ID: adbd3e0b-e3f1-5bbc-21db-03caf1cef0f7@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I recently came across the need for a gcd function (actually I needed
lcm) and was surprised that we didn't have one.

So here one is, using the basic Euclidean algorithm.  I made one for
smallint, integer, and bigint.

--

Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
gcd.0001.patch text/x-patch 6.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-12-28 17:05:28 Re: ALTER TABLE support for dropping generation expression
Previous Message David Fetter 2019-12-28 16:45:30 Re: Allow WHEN in INSTEAD OF triggers