pgsql: Re-implement division for numeric values using the traditional

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Re-implement division for numeric values using the traditional
Date: 2008-04-04 18:45:36
Message-ID: 20080404184536.EABF17558E8@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Re-implement division for numeric values using the traditional "schoolbook"
algorithm. This is a good deal slower than our old roundoff-error-prone
code for long inputs, so we keep the old code for use in the transcendental
functions, where everything is approximate anyway. Also create a
user-accessible function div(numeric, numeric) to provide access to the
exact result of trunc(x/y) --- since the regular numeric / operator will
round off its result, simply computing that expression in SQL doesn't
reliably give the desired answer. This fixes bug #3387 and various related
corner cases, and improves the usefulness of PG for high-precision integer
arithmetic.

Modified Files:
--------------
pgsql/doc/src/sgml:
func.sgml (r1.426 -> r1.427)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.426&r2=1.427)
pgsql/src/backend/utils/adt:
numeric.c (r1.108 -> r1.109)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/numeric.c?r1=1.108&r2=1.109)
pgsql/src/include/catalog:
catversion.h (r1.444 -> r1.445)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.444&r2=1.445)
pg_proc.h (r1.486 -> r1.487)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.486&r2=1.487)
pgsql/src/include/utils:
builtins.h (r1.311 -> r1.312)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h?r1=1.311&r2=1.312)
pgsql/src/test/regress/expected:
numeric.out (r1.21 -> r1.22)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/numeric.out?r1=1.21&r2=1.22)
pgsql/src/test/regress/sql:
numeric.sql (r1.14 -> r1.15)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/numeric.sql?r1=1.14&r2=1.15)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2008-04-04 19:05:05 Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Previous Message Alvaro Herrera 2008-04-04 18:39:42 Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing