pgsql: Add functions gcd() and lcm() for integer and numeric types.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add functions gcd() and lcm() for integer and numeric types.
Date: 2020-01-25 14:05:15
Message-ID: E1ivM3n-0004P4-LS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add functions gcd() and lcm() for integer and numeric types.

These compute the greatest common divisor and least common multiple of
a pair of numbers using the Euclidean algorithm.

Vik Fearing, reviewed by Fabien Coelho.

Discussion: https://postgr.es/m/adbd3e0b-e3f1-5bbc-21db-03caf1cef0f7@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/13661ddd7eaec7e2809ff5c29fc14653b6161036

Modified Files
--------------
doc/src/sgml/func.sgml | 34 +++++++
src/backend/utils/adt/int.c | 126 +++++++++++++++++++++++++
src/backend/utils/adt/int8.c | 126 +++++++++++++++++++++++++
src/backend/utils/adt/numeric.c | 171 ++++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 20 ++++
src/test/regress/expected/int4.out | 46 +++++++++
src/test/regress/expected/int8.out | 46 +++++++++
src/test/regress/expected/numeric.out | 44 +++++++++
src/test/regress/sql/int4.sql | 25 +++++
src/test/regress/sql/int8.sql | 25 +++++
src/test/regress/sql/numeric.sql | 25 +++++
12 files changed, 689 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-01-25 23:16:53 pgsql: Clean up EXPLAIN's handling of per-worker details.
Previous Message Robert Haas 2020-01-24 18:35:28 pgsql: Remove jsonapi.c's lex_accept().