Re: BUG #6217: to_char() gives incorrect output for very small float values - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #6217: to_char() gives incorrect output for very small float values
Date
Msg-id 4E78899D020000250004140B@gw.wicourts.gov
Whole thread Raw
In response to BUG #6217: to_char() gives incorrect output for very small float values  ("Chris Gernon" <kabigon@gmail.com>)
Responses Re: BUG #6217: to_char() gives incorrect output for very small float values  (Christopher Gernon <kabigon@gmail.com>)
List pgsql-bugs
"Chris Gernon" <kabigon@gmail.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

pgsql-bugs by date:

Previous
From: "Chris Gernon"
Date:
Subject: BUG #6217: to_char() gives incorrect output for very small float values
Next
From: Tom Lane
Date:
Subject: Re: BUG #6217: to_char() gives incorrect output for very small float values