Tom Lane wrote:
Yeahh! If there's a proof its safe to implement.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).
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
Off course. This is also good in terms of dump storage for big float8 databases. Its one byte less for every float8.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...
regards, tom lane---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
-- ---------------------------------------------------------------------- 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 ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])