X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 41DD9535C1 for ; Sat, 30 Apr 2005 00:56:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48812-08 for ; Sat, 30 Apr 2005 03:56:06 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 3BE8E535AE for ; Sat, 30 Apr 2005 00:56:06 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E1CF5358A8; Fri, 29 Apr 2005 20:56:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id E05D735897; Fri, 29 Apr 2005 20:56:05 -0700 (PDT) Date: Fri, 29 Apr 2005 20:56:05 -0700 (PDT) From: Stephan Szabo To: tuan Cc: pgsql-sql@postgresql.org Subject: Re: Division in Postgre In-Reply-To: Message-ID: <20050429205407.B60676@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/415 X-Sequence-Number: 21308 On Sun, 24 Apr 2005, tuan wrote: > In sql server my division select cast(3 as float)/10 is 0.29999999999. > But in postgres select cast(3 as float8)/10 is 0.3. How to get result like > sql server? I believe you can control what precision is used in printing the float results with extra_float_digits. I believe setting it to 2 will give a 0.29... result however it has more 9s than the above.