Skip site navigation (1) Skip section navigation (2)

Re: BUG #6217: to_char() gives incorrect output for very small float values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Christopher Gernon" <kabigon(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values
Date: 2011-09-20 19:05:19
Message-ID: 12259.1316545519@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Christopher Gernon <kabigon(at)gmail(dot)com> wrote:
>> to_char() should be able to convert 5.6e-32 to text just as easily
>> as it can convert 5.6e-3. For some reason, it doesn't.
 
> Oh, I see your point now, and I agree with you.
 
> We should probably at least put this on the TODO list, I think.  Any
> objections?

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.

One other thing I notice in the same area is that the handling of NaNs
and infinities seems a bit incomplete.  There's an explicit special case
for them in the EEEE-format code path, but not otherwise, and I think
that the results you get for other formats will vary depending on what
the local implementation of snprintf does.  What *should* the output be,
if the input is NaN or Inf?

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Kevin GrittnerDate: 2011-09-20 19:43:21
Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values
Previous:From: Kevin GrittnerDate: 2011-09-20 18:29:12
Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group