Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajRyO-0006Mw-O7 for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Mar 2016 13:40:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ajRyO-0006Jy-AP for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Mar 2016 13:40:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ajRyN-0006Iu-NG for pgsql-bugs@postgresql.org; Fri, 25 Mar 2016 13:40:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ajRyG-0002CY-PX for pgsql-bugs@postgresql.org; Fri, 25 Mar 2016 13:40:19 +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 u2PDdYcd017108; Fri, 25 Mar 2016 09:39:34 -0400 From: Tom Lane To: jaroslaw.stoklosa@nomino.pl cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14046: Bad mathematical rules for 0 cast In-reply-to: <20160325085614.2915.72425@wrigleys.postgresql.org> References: <20160325085614.2915.72425@wrigleys.postgresql.org> Comments: In-reply-to jaroslaw.stoklosa@nomino.pl message dated "Fri, 25 Mar 2016 08:56:14 -0000" Date: Fri, 25 Mar 2016 09:39:34 -0400 Message-ID: <17107.1458913174@sss.pgh.pa.us> X-Pg-Spam-Score: -2.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 jaroslaw.stoklosa@nomino.pl writes: > +0 and -0 should be casted to +0 or 0. On what grounds? The behavior seems sensible to me: regression=# select cast('-0' as FLOAT); float8 -------- -0 (1 row) regression=# select cast('-0' as FLOAT)::text; text ------ -0 (1 row) If we do what you suggest, casting to text would be different from the type's I/O conversion, which seems strange, and definitely isn't what most other casts to text do. 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