Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YaP1t-00070U-6F for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Mar 2015 13:38:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YaP1s-0008Cv-4M for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Mar 2015 13:38:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YaP1q-0008Co-Db for pgsql-bugs@postgresql.org; Tue, 24 Mar 2015 13:37:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YaP1i-0004yC-NP for pgsql-bugs@postgresql.org; Tue, 24 Mar 2015 13:37:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t2ODbkJ5013097; Tue, 24 Mar 2015 09:37:46 -0400 From: Tom Lane To: Michael Paquier cc: rschaaf@commoninf.com, pgsql-bugs@postgresql.org Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version In-reply-to: References: <20150320194337.2573.72944@wrigleys.postgresql.org> <32478.1427122083@sss.pgh.pa.us> <26862.1427166720@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Tue, 24 Mar 2015 15:25:57 +0900" Date: Tue, 24 Mar 2015 09:37:46 -0400 Message-ID: <13096.1427204266@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier writes: > On Mon, Mar 23, 2015 at 8:12 PM, Tom Lane wrote: >> Look for something about setting the IEEE float rounding mode. "Round to >> nearest even" is standard in most places, but it would not astonish me >> to hear that Microsoft got that wrong. > I have done more testing (done only 9.3 with MinGW and MSVC before) > and the failure can be reproduced on master and REL9_4_STABLE as well > because visibly with MSVC 2010 the version of rint used is the one of > src/port, which is defined like that: > return (x >= 0.0) ? floor(x + 0.5) : ceil(x - 0.5); > For example by passing 2.5, we would get 3.0, and not 2.0 (nearest > even number). So isn't the problem here? Hmm ... why are we using src/port's version? rint() has been required by POSIX for decades, surely MSVC has got it? (IOW, I'd rather fix this by removing src/port's version than by trying to upgrade it to full IEEE spec.) regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs