Author: wyoung
Date: Wed Apr 2 01:10:15 2008
New Revision: 2264
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2264&view=rev
Log:
Increased float to string conversion precision from 7 to 8 significant
digits. The maximum mantissa is 2^24, which is about 1.6x more than
fits in 7 decimal digits. You can say 8 is way overkill, but it's the
smallest value that will hold everything.
Modified:
trunk/lib/stadapter.cpp
Modified: trunk/lib/stadapter.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/stadapter.cpp?rev=2264&r1=2263&r2=2264&view=diff
==============================================================================
--- trunk/lib/stadapter.cpp (original)
+++ trunk/lib/stadapter.cpp Wed Apr 2 01:10:15 2008
@@ -250,7 +250,7 @@
is_processed_(false)
{
ostringstream outs;
- outs.precision(7); // max digits in IEEE 754 single-prec float
+ outs.precision(8); // max dec digits in IEEE 754 32-bit float < 8
outs << f;
buffer_ = new SQLBuffer(outs.str(), typeid(f), false);
}
@@ -264,7 +264,7 @@
}
else {
ostringstream outs;
- outs.precision(7); // as above
+ outs.precision(8); // as above
outs << f;
buffer_ = new SQLBuffer(outs.str(), typeid(f.data), false);
}
@@ -275,7 +275,7 @@
is_processed_(false)
{
ostringstream outs;
- outs.precision(16); // max digits in IEEE 754 double-prec float
+ outs.precision(16); // max dec digits in IEEE 754 64-bit float < 16
outs << f;
buffer_ = new SQLBuffer(outs.str(), typeid(f), false);
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits