Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltEUc-0003rQ-Bh for pgsql-general@arkaria.postgresql.org; Tue, 15 Jun 2021 19:12:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltEUb-0007FQ-3J for pgsql-general@arkaria.postgresql.org; Tue, 15 Jun 2021 19:12:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltEUa-0007EV-Pq for pgsql-general@lists.postgresql.org; Tue, 15 Jun 2021 19:12:56 +0000 Received: from aart.rice.edu ([168.7.56.48]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltEUW-0006Wz-Kc for pgsql-general@postgresql.org; Tue, 15 Jun 2021 19:12:55 +0000 Received: by aart.rice.edu (Postfix, from userid 18612) id A0C9E412EA28; Tue, 15 Jun 2021 14:12:51 -0500 (CDT) Date: Tue, 15 Jun 2021 14:12:51 -0500 From: Kenneth Marshall To: Pavel Stehule Cc: AI Rumman , pgsql-general General Subject: Re: CONCAT function adding extra characters Message-ID: <20210615191251.GU32646@aart.rice.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > út 15. 6. 2021 v 20:56 odesílatel AI Rumman napsal: > I am using Postgresql 10 and seeing a strange behavior in CONCAT function > when I am concatenating double precision and int with a separator. > > select concat('41.1'::double precision,':', 20); >> Result: >> 41.1000000000000014:20 > > > Value 41.1 which double precision converts to 41.1000000014. > > Is that expected? > Hi 0.1 cannot be represented exactly in binary so that does not look out of line. There are also some config options for extra digits and what not that may affect the result of a cast. Regards, Ken