1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-26 23:43:30 +03:00

Alter scale selection for NUMERIC division and transcendental functions

so that precision of result is always at least as good as you'd get from
float8 arithmetic (ie, always at least 16 digits of accuracy).  Per
pg_hackers discussion a few days ago.
This commit is contained in:
Tom Lane
2002-10-02 19:21:26 +00:00
parent c74c7e604c
commit b813d143ae
3 changed files with 350 additions and 135 deletions

View File

@@ -2,15 +2,15 @@
-- AGGREGATES
--
SELECT avg(four) AS avg_1 FROM onek;
avg_1
--------------
1.5000000000
avg_1
---------------------
1.50000000000000000
(1 row)
SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100;
avg_32
---------------
32.6666666667
avg_32
--------------------
32.666666666666667
(1 row)
-- In 7.1, avg(float4) is computed using float8 arithmetic.
@@ -118,9 +118,9 @@ select ten, count(four), sum(DISTINCT four) from onek group by ten;
(10 rows)
SELECT newavg(four) AS avg_1 FROM onek;
avg_1
--------------
1.5000000000
avg_1
---------------------
1.50000000000000000
(1 row)
SELECT newsum(four) AS sum_1500 FROM onek;