Heikki Linnakangas <hlinnakan...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers