Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YapZE-00087m-3U for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Mar 2015 17:58:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YapZD-0007EC-JF for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Mar 2015 17:58:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YapZC-0007E3-GS for pgsql-bugs@postgresql.org; Wed, 25 Mar 2015 17:58:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YapZ5-0004NU-9M for pgsql-bugs@postgresql.org; Wed, 25 Mar 2015 17:58:08 +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 t2PHvrE7008193; Wed, 25 Mar 2015 13:57:53 -0400 From: Tom Lane To: Pedro Gimeno cc: Michael Paquier , rschaaf@commoninf.com, pgsql-bugs@postgresql.org Subject: Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version In-reply-to: <5512F2C0.9080007@personal.formauri.es> References: <20150320194337.2573.72944@wrigleys.postgresql.org> <32478.1427122083@sss.pgh.pa.us> <26862.1427166720@sss.pgh.pa.us> <13096.1427204266@sss.pgh.pa.us> <55121967.90308@personal.formauri.es> <55129971.2070208@personal.formauri.es> <3736.1427294258@sss.pgh.pa.us> <5512E0AF.9050103@personal.formauri.es> <5512F2C0.9080007@personal.formauri.es> Comments: In-reply-to Pedro Gimeno message dated "Wed, 25 Mar 2015 18:39:12 +0100" Date: Wed, 25 Mar 2015 13:57:53 -0400 Message-ID: <8192.1427306273@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 Pedro Gimeno writes: > The previous version left out a corner case. Attached is a function and > test suite to deal with it. Hmm ... I'm thinking we probably should explicitly check for inf and NaN, no? if (isnan(x) || isinf(x)) return x; It's possible the given coding would return this result anyway by accident, but that seems rather fragile. 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