Re: [HACKERS] NUMERIC private methods?

2015-03-24 Thread Bruce Momjian
On Sun, Mar 22, 2015 at 04:08:32AM +, Andrew Gierth wrote: > > "Bruce" == Bruce Momjian writes: > > > ! However, calculations on numeric values is very slow > > arithmetic ... is, but calculations ... are Ah, good point. Fixed an applied. Thanks. -- Bruce Momjian h

Re: [HACKERS] NUMERIC private methods?

2015-03-21 Thread Andrew Gierth
> "Bruce" == Bruce Momjian writes: > ! However, calculations on numeric values is very slow arithmetic ... is, but calculations ... are -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://w

Re: [HACKERS] NUMERIC private methods?

2015-03-21 Thread Bruce Momjian
On Thu, Dec 18, 2014 at 11:51:12PM -0500, Tom Lane wrote: > If you're doing any sort of higher math or statistics, I stand by my > statement that you'd better think rather than just blindly assume that > numeric is going to be better for you. A moment's fooling about finds > this example, which is

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread David Fetter
On Thu, Dec 18, 2014 at 11:51:37PM -0300, Alvaro Herrera wrote: > Robert Haas wrote: > > > I think that's ridiculous. You're basically arguing that numeric > > doesn't offer meaningful advantages over float8, which flies in > > the face of the fact that essentially every database application > >

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Robert Haas
On Fri, Dec 19, 2014 at 10:56 AM, Tom Lane wrote: > Well, there are two components to what I'm saying. One is that the > example David started with looks like it could use some better-informed > consideration about which datatype to use. The other is that numeric > leaves quite a lot to be desir

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Tom Lane
Robert Haas writes: > I think what it boils down to is that several people here (and I'll > add my voice to the chorus) are saying, hey, numeric is really useful, > and we'd like to be able to manipulate numerics without all the palloc > and fmgr overhead, and your response appears to be to say, u

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Robert Haas
On Thu, Dec 18, 2014 at 11:51 PM, Tom Lane wrote: > What it boils down to is that numeric is great for storing given decimal > inputs exactly, and it can do exact addition/subtraction/multiplication > on those too, but as soon as you get into territory where the result is > fundamentally inexact i

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Tom Lane
Robert Haas writes: > On Thu, Dec 18, 2014 at 10:21 AM, Tom Lane wrote: >> As the guy who last fooled with the numeric calculation algorithms in any >> major way, I'm painfully aware that numeric is not necessarily more >> accurate than double for anything more complicated than >> addition/subtra

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Alvaro Herrera
Robert Haas wrote: > I think that's ridiculous. You're basically arguing that numeric > doesn't offer meaningful advantages over float8, which flies in the > face of the fact that essentially every database application I've ever > seen uses numeric and I'm not sure I've ever seen one using float8

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Robert Haas
On Thu, Dec 18, 2014 at 10:21 AM, Tom Lane wrote: > Andrew Gierth writes: >> "Tom" == Tom Lane writes: >> Tom> If you're concerned about arithmetic performance, there is a >> Tom> very obvious fix here: use double. > >> Independently of this specific example, the obvious issue there is that >>

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Jim Nasby
On 12/18/14, 9:21 AM, Tom Lane wrote: As it stands, no extension can use the numeric type in any non-trivial >way without paying a large penalty for repeated pallocs and data copies. >Given that the ability to write C extensions easily is one of pg's great >strengths, this is a defect that should

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Tom Lane
Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> If you're concerned about arithmetic performance, there is a > Tom> very obvious fix here: use double. > Independently of this specific example, the obvious issue there is that > there are applications for which double is simply not acce

Re: [HACKERS] NUMERIC private methods?

2014-12-17 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> Hmm. You'd want to make add_var, mul_var etc. non-static? Tom> -1 for that. possibly with more meaningful names. Tom> If you're concerned about arithmetic performance, there is a Tom> very obvious fix here: use double. Independently of this specific exam

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Tom Lane
Heikki Linnakangas writes: > On 12/16/2014 08:34 AM, David Fetter wrote: >> While noodling with some weighted statistics >> , I noticed I was >> having to jump through a lot of hoops because of all the private >> methods in numeric.c, especially Numer

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread David Fetter
On Tue, Dec 16, 2014 at 09:01:47AM +, Andrew Gierth wrote: > > "Heikki" == Heikki Linnakangas writes: > > Heikki> Looking at the weighed_stats code, this probably illustrates > Heikki> the hoops you had to jump through: > > Actually that hoop-jumping expression is almost irrelevant. R

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Andrew Gierth
> "Heikki" == Heikki Linnakangas writes: Heikki> Looking at the weighed_stats code, this probably illustrates Heikki> the hoops you had to jump through: Actually that hoop-jumping expression is almost irrelevant. The part that hurts (and yes, it's performance that's at issue here, and not

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Heikki Linnakangas
On 12/16/2014 08:34 AM, David Fetter wrote: Folks, While noodling with some weighted statistics , 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 majo

[HACKERS] NUMERIC private methods?

2014-12-15 Thread David Fetter
Folks, While noodling with some weighted statistics , 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 opaqu