| From: | Greg Stark <stark(at)mit(dot)edu> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, 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 21:25:54 |
| Message-ID: | CAM-w4HPEucRFT7PYWKDDmeW9RmOamKmar8GzNrD=-mKQUW0faA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Tue, Sep 20, 2011 at 8:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> However, it would
> be interesting to know what Oracle etc do with NaN and Infinity,
> assuming they even support such numbers.
Note that it looks like NUMBER cannot store either Infinity or NaN.
They can only occur in BINARY_FLOAT and BINARY_DOUBLE. From the docs:
> If a BINARY_FLOAT or BINARY_DOUBLE value is converted to CHAR or NCHAR, and the input is either infinity or NaN (not a number), then Oracle always returns the pound signs to replace the value.
And testing shows:
SQL> select to_char(cast('NAN' as binary_float), 'FM9999.9999') from dual;
TO_CHAR(CA
----------
##########
SQL> select to_char(cast('-Inf' as binary_float), 'FM9999.9999') from dual;
TO_CHAR(CA
----------
##########
SQL> select to_char(cast('+Inf' as binary_float), 'FM9999.9999') from dual;
TO_CHAR(CA
----------
##########
--
greg
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2011-09-20 21:57:10 | Re: BUG #6217: to_char() gives incorrect output for very small float values |
| Previous Message | Kevin Grittner | 2011-09-20 20:08:08 | Re: BUG #6217: to_char() gives incorrect output for very small float values |