From a0fad9762a22e739de69c85b51ff7a47e672732f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 4 Apr 2008 18:45:36 +0000 Subject: 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. --- doc/src/sgml/func.sgml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 1fa0fc6c2a3..0811a282db2 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -617,6 +617,9 @@ degrees + + div + exp @@ -717,6 +720,15 @@ 28.6478897565412 + + div(y numeric, + x numeric) + numeric + integer quotient of y/x + div(9,4) + 2 + + exp(dp or numeric) (same as input) -- cgit v1.2.3