Re: Greatest Common Divisor
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Vik Fearing <vik.fearing@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>, Stephen Frost <sfrost@snowman.net>, Chapman Flack <chap@anastigmatix.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-01-20T10:28:37Z
Lists: pgsql-hackers
Looking at the docs, I think it's worth going a little further than just saying what the acronyms stand for -- especially since the behaviour for zero inputs is an implementation choice (albeit the most common one). I propose the following: + <entry> + greatest common divisor — the largest positive number that + divides both inputs with no remainder; returns <literal>0</literal> if + both inputs are zero + </entry> and: + <entry> + least common multiple — the smallest strictly positive number + that is an integer multiple of both inputs; returns <literal>0</literal> + if either input is zero + </entry> (I have tried to be precise in my use of terms like "number" and "integer", to cover the different cases) Regards, Dean
Commits
-
Add functions gcd() and lcm() for integer and numeric types.
- 13661ddd7eae 13.0 landed