Greatest Common Divisor - Mailing list pgsql-hackers

From Vik Fearing
Subject Greatest Common Divisor
Date
Msg-id adbd3e0b-e3f1-5bbc-21db-03caf1cef0f7@2ndquadrant.com
Whole thread Raw
Responses Re: Greatest Common Divisor  (Fabien COELHO <coelho@cri.ensmp.fr>)
List 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

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Allow WHEN in INSTEAD OF triggers
Next
From: Peter Eisentraut
Date:
Subject: Re: ALTER TABLE support for dropping generation expression