Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wtoqR-000H11-1k for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Aug 2026 15:56:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wtoqO-003HYL-11 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Aug 2026 15:56:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wtoqO-003HYD-0E for pgsql-bugs@lists.postgresql.org; Tue, 11 Aug 2026 15:56:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wtoqI-000000008L3-1lkE for pgsql-bugs@lists.postgresql.org; Tue, 11 Aug 2026 15:56:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67BFudVk2395190; Tue, 11 Aug 2026 11:56:39 -0400 From: Tom Lane To: Andrey Rachitskiy cc: feasiblechart@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19615: COVAR_POP / COVAR_SAMP / REGR_SXY return 0.0 instead of NaN In-reply-to: References: <19615-c7e390593416f6b6@postgresql.org> Comments: In-reply-to Andrey Rachitskiy message dated "Tue, 11 Aug 2026 20:24:19 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2395188.1786463799.1@sss.pgh.pa.us> Date: Tue, 11 Aug 2026 11:56:39 -0400 Message-ID: <2395189.1786463799@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Rachitskiy writes: > With a constant X and Inf arriving later in Y, commonX stays finite, > so that update is skipped and Sxy remains 0. Before the commit, Sxy > was always updated. With constant X, tmpX is ~0, so the product > 0*Inf (or a tiny roundoff times Inf) produced NaN under IEEE rules. > Inf in the first row still yields NaN, because the older first-input > path from 33dd9bb3b0a is intact and forces Sxy to NaN up front. > The new short-circuit never got the matching Inf/NaN handling. Yeah, I just arrived at pretty much the same conclusion. We get Inf/NaN handling right for Sxx and Syy, but not for the cross-product Sxy. regards, tom lane