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

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Chris 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 17:39:57
Message-ID: 4E78899D020000250004140B@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Chris Gernon" <kabigon(at)gmail(dot)com> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-09-20 17:49:28 Re: BUG #6217: to_char() gives incorrect output for very small float values
Previous Message Chris Gernon 2011-09-20 17:17:47 BUG #6217: to_char() gives incorrect output for very small float values