Re: float output precision questions - Mailing list pgsql-hackers

From Pedro M. Ferreira
Subject Re: float output precision questions
Date
Msg-id 3DC16B66.9020303@ualg.pt
Whole thread Raw
In response to Re: float output precision questions  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-hackers
Tom Lane wrote:
> 
> I was misremembering these papers to claim DBL_DIG+1 is enough, but
> actually they prove that DBL_DIG+2 is necessary and sufficient (and
> give code to do it correctly, too).

Yeahh! If there's a proof its safe to implement.
I also Googled a bit and found another paper saying that 17 is the
minimum number of significant digits guaranteed to distinguish among
IEEE double-precision floating point numbers:

"Robert G. Burger and R. Kent Dybvig. Printing floating-point numbers 
quickly and accurately. In Proceedings of the ACM SIGPLAN '96 Conference 
on Programming Language Design and Implementation, pages 108--116"
http://citeseer.nj.nec.com/28233.html

> 
> Printing DBL_DIG+3 is just producing an extra garbage digit; it won't
> help matters.  Any reasonably well-written C library is going to be
> able to reproduce a double value with DBL_DIG+2 digits of I/O; and if
> it's not well-written, I would have no confidence in its ability to do
> so with DBL_DIG+3 digits...

Off course. This is also good in terms of dump storage for big float8 
databases. Its one byte less for every float8.

> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 
> 


-- 
----------------------------------------------------------------------
Pedro Miguel Frazao Fernandes Ferreira
Universidade do Algarve
Faculdade de Ciencias e Tecnologia
Campus de Gambelas
8000-117 Faro
Portugal
Tel./Fax:  (+351) 289 800950 / 289 819403
http://w3.ualg.pt/~pfrazao



pgsql-hackers by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: setuid for defaults, constraints and triggers (Was: What user to [sic] defaults execute as?)
Next
From: Barry Lind
Date:
Subject: Re: PG functions in Java: maybe use gcj?