Robert Haas <robertmh...@gmail.com> writes:
> On Fri, Feb 17, 2017 at 6:51 AM, Greg Stark <st...@mit.edu> wrote:
>> Moreover, it wouldn't be hard to make sum(float4) use a float8 as an
>> accumulator and then cast to float4 for the final state. That would be
>> 100% compatible with the existing behaviour aside from producing more
>> accurate results.

> Sure, but if somebody wants that, they can get it already just by a
> minor change to the SQL.  The point is that adding up float4 as float4
> is a reasonable thing to do.  Adding it as float8 might also be a
> reasonable thing to do, but nobody's keeping anybody from doing that.

Also, if we changed sum(float4) to work that way, it would become very
hard to sum float4 in float4 --- you'd pretty much have to build your
own aggregate function, which is a lot harder than just inserting a
cast.  The argument for changing this boils down to "nobody would ever
want that", which I do not think I buy.  It's been a long time since
I studied numerical analysis, but I think there are applications where
you do want to do that.

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to