Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id AC011B5DC00 for ; Tue, 20 Sep 2011 14:40:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 35761-07 for ; Tue, 20 Sep 2011 17:40:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 4EF76B5DC09 for ; Tue, 20 Sep 2011 14:40:04 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Tue, 20 Sep 2011 12:40:03 -0500 Message-Id: <4E78899D020000250004140B@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Tue, 20 Sep 2011 12:39:57 -0500 From: "Kevin Grittner" To: "Chris Gernon" , Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values References: <201109201717.p8KHHlZU087195@wwwmaster.postgresql.org> In-Reply-To: <201109201717.p8KHHlZU087195@wwwmaster.postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/120 X-Sequence-Number: 31137 "Chris Gernon" wrote: > The to_char() function gives incorrect output for float values > whose decimal expansion has several digits (more than somewhere > around 14-15) after the decimal point. These are approximate data types. On what basis do you think the values returned in your examples are wrong? The demonstrated results don't surprise me, given that they match to about the limits of the approximate data type involved. It also wouldn't surprise me to see slightly different results on different architectures or operating systems. If you want exact values, you should use a type which supports that, like numeric. -Kevin