Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoftz-0002Xg-VG for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2016 23:33:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aoftz-0002yo-9e for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2016 23:33:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aofse-0001Jx-2I for pgsql-hackers@postgresql.org; Fri, 08 Apr 2016 23:32:00 +0000 Received: from 173-164-140-181-sfba.hfc.comcastbusiness.net ([173.164.140.181] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aofsZ-0002RZ-VC for pgsql-hackers@postgresql.org; Fri, 08 Apr 2016 23:31:58 +0000 Received: by fetter.org (Postfix, from userid 500) id 31C5364252; Fri, 8 Apr 2016 16:31:52 -0700 (PDT) Date: Fri, 8 Apr 2016 16:31:52 -0700 From: David Fetter To: Jeff Janes Cc: Haribabu Kommi , Jim Nasby , PG Hackers Subject: Re: Weighted Stats Message-ID: <20160408233152.GD15407@fetter.org> References: <20151102234644.GA31118@fetter.org> <5677442D.9070204@BlueTreble.com> <20151221025041.GC32120@fetter.org> <20160315153650.GC26662@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Mar 18, 2016 at 06:12:12PM -0700, Jeff Janes wrote: > On Tue, Mar 15, 2016 at 8:36 AM, David Fetter 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 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers