Re: NUMERIC private methods?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: NUMERIC private methods?
Дата
Msg-id 1515.1418742979@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: NUMERIC private methods?  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Ответы Re: NUMERIC private methods?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> On 12/16/2014 08:34 AM, David Fetter wrote:
>> While noodling with some weighted statistics
>> <https://github.com/davidfetter/weighted_stats>, I noticed I was
>> having to jump through a lot of hoops because of all the private
>> methods in numeric.c, especially NumericVar.  Would there be some
>> major objection to exposing NumericVar as an opaque blob?

> Hmm. You'd want to make add_var, mul_var etc. non-static?

-1 for that.

> Looking at the weighed_stats code, this probably illustrates the hoops 
> you had to jump through:

>> /* sqrt((n/(n-1)) * ((s0*s2 - s1*s1)/(s0*s0)) */

If you're concerned about arithmetic performance, there is a very obvious
fix here: use double.  Is there some utterly compelling reason to use
numeric, despite the fact that it's certain to be orders of magnitude
slower?

(It would still be orders of magnitude slower, no matter how much we
were willing to destroy numeric.c's modularity boundary.)
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: On partitioning
Следующее
От: Claudio Freire
Дата:
Сообщение: Re: On partitioning