Re: Weighted Stats - Mailing list pgsql-hackers

From David Fetter
Subject Re: Weighted Stats
Date
Msg-id 20160408233152.GD15407@fetter.org
Whole thread Raw
In response to Re: Weighted Stats  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
On Fri, Mar 18, 2016 at 06:12:12PM -0700, Jeff Janes wrote:
> On Tue, Mar 15, 2016 at 8:36 AM, David Fetter <david@fetter.org> wrote:
> >
> > Please find attached a patch that uses the float8 version to cover the
> > numeric types.
> 
> Is there a well-defined meaning for having a negative weight?  If no,
> should it be disallowed?

Done.

> Shouldn't these then give the same result:
> 
> select stddev_samp(val) from foo;
>     stddev_samp
> -------------------
>  2887.054977297105
> 
> select weighted_stddev_samp(val,count) from foo2;
>  weighted_stddev_samp
> ----------------------
>      2887.19919651336
> 
> The 5th digit seems too early to be seeing round-off error.

Fixed down-thread.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [patch] Proposal for \crosstabview in psql
Next
From: Robert Haas
Date:
Subject: the buildfarm has measles