From: Date: April 2 2008 1:08am Subject: Re: Loss of float precision List-Archive: http://lists.mysql.com/plusplus/7550 Message-Id: <47F2C059.6040407@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jim Wallace wrote: > > Below is output from a test program (copying the code from MySQL++) that > prints out a float with %f and ostringstream with increasing precision. > You can see 9 is a better value than 7, but higher than 9 doesn't help. After reading some of this: http://en.wikipedia.org/wiki/Floating_point ...I can see going to 8. The article says "about 7 decimal digits", but that just means it's between 7 and 8, closer to 7 in this instance. What I don't understand is why going to 9 helps. If we assume that your floating point implementation is adhering to the IEEE 754 standard, the bits just aren't there to do anything significant with more than 8 digits. As for double, we may not have to change anything: "about 16 digits" means between 15 and 16, closer to 16. > I haven't investigated SQLSS will it do > the same thing? It uses the same underlying conversion mechanism as the rest of the library in v3: SQLTypeAdapter.