Re: [HACKERS] Sum aggregate calculation for single precsion real
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] Sum aggregate calculation for single precsion real |
Дата | |
Msg-id | 19387.1487346836@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] Sum aggregate calculation for single precsion real (Robert Haas <robertmhaas@gmail.com>) |
Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes: > On Fri, Feb 17, 2017 at 6:51 AM, Greg Stark <stark@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
В списке pgsql-hackers по дате отправления: