Re: Zero-padding and zero-masking fixes for to_char(float) - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Zero-padding and zero-masking fixes for to_char(float)
Date
Msg-id 20150324134756.GA857409@tornado.leadboat.com
Whole thread Raw
In response to Re: Zero-padding and zero-masking fixes for to_char(float)  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Zero-padding and zero-masking fixes for to_char(float)
Re: Zero-padding and zero-masking fixes for to_char(float)
Re: Zero-padding and zero-masking fixes for to_char(float)
List pgsql-hackers
On Sun, Mar 22, 2015 at 10:53:12PM -0400, Bruce Momjian wrote:
> On Sun, Mar 22, 2015 at 04:41:19PM -0400, Noah Misch wrote:
> > On Wed, Mar 18, 2015 at 05:52:44PM -0400, Bruce Momjian wrote:
> > > This "junk" digit zeroing matches the Oracle behavior:
> > > 
> > >     SELECT to_char(1.123456789123456789123456789d, '9.9999999999999999999999999999999999999') as x from dual;
> > >     ------
> > >     1.1234567891234568000000000000000000000
> > > 
> > > Our output with the patch would be:
> > > 
> > >     SELECT to_char(float8 '1.123456789123456789123456789', '9.9999999999999999999999999999999999999');
> > >     ------
> > >     1.1234567891234500000000000000000000000

> > These outputs show Oracle treating 17 digits as significant while PostgreSQL
> > treats 15 digits as significant.  Should we match Oracle in this respect while
> > we're breaking compatibility anyway?  I tend to think yes.
> 
> Uh, I am hesistant to adjust our precision to match Oracle as I don't
> know what they are using internally.

http://sqlfiddle.com/#!4/8b4cf/5 strongly implies 17 significant digits for
float8 and 9 digits for float4.



pgsql-hackers by date:

Previous
From: "ktm@rice.edu"
Date:
Subject: Re: Abbreviated keys for Numeric
Next
From: Tom Lane
Date:
Subject: Re: GSoC 2015 proposal. Bitmap Index-only Count