Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7500EB5DC0A for ; Tue, 20 Sep 2011 16:52:32 -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 89199-02 for ; Tue, 20 Sep 2011 19:52:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id EBD1AB5DC00 for ; Tue, 20 Sep 2011 16:52:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p8KJqKem013034; Tue, 20 Sep 2011 15:52:20 -0400 (EDT) To: "Kevin Grittner" cc: "Christopher Gernon" , pgsql-bugs@postgresql.org Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values In-reply-to: <4E78A6890200002500041430@gw.wicourts.gov> References: <201109201717.p8KHHlZU087195@wwwmaster.postgresql.org> <4E78899D020000250004140B@gw.wicourts.gov> <4E789528020000250004141A@gw.wicourts.gov><4E789528020000250004141A@gw.wicourts.gov> <12259.1316545519@sss.pgh.pa.us> <4E78A6890200002500041430@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Tue, 20 Sep 2011 14:43:21 -0500" Date: Tue, 20 Sep 2011 15:52:20 -0400 Message-ID: <13033.1316548340@sss.pgh.pa.us> From: Tom Lane 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/126 X-Sequence-Number: 31143 "Kevin Grittner" writes: > Tom Lane wrote: >> If we're gonna fix it, we should just fix it, I think. I was >> considering taking a stab at it, but if someone else would like >> to, that's fine too. > I wouldn't mind doing it, but not until after the CF wraps. On the > other hand, isn't this is one of those compatibility functions? > Perhaps it would best be done by someone who has familiarity with, > and access to, a database with which we're trying to be compatible. Chris already stated that the case gives the answer he expects in several other DBs, so I don't seem much need for further compatibility checking on the "don't round off prematurely" angle. However, it would be interesting to know what Oracle etc do with NaN and Infinity, assuming they even support such numbers. Currently what our code does for the format-with-EEEE case is to output "#" in all digit positions. It would be plausible for that to happen in the non-EEEE cases too, but whether that's actually what happens in other systems is something I don't know. regards, tom lane