|
|
Choosing A Webhost: |
CVS update of carob/src (ParameterStatement.cpp): msg#00197db.carob.cvs
Date: Friday, January 27, 2006 @ 16:06:42 Author: marc Path: /cvsroot/carob/carob/src Modified: ParameterStatement.cpp (1.12 -> 1.13) Added lengthy explanation & references about the right precision() to use to print floating point numbers. ------------------------+ ParameterStatement.cpp | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: carob/src/ParameterStatement.cpp diff -u carob/src/ParameterStatement.cpp:1.12 carob/src/ParameterStatement.cpp:1.13 --- carob/src/ParameterStatement.cpp:1.12 Fri Jan 27 15:54:00 2006 +++ carob/src/ParameterStatement.cpp Fri Jan 27 16:06:42 2006 @@ -196,6 +196,26 @@ ///// Filter specializations //// // Partial specialization code shared by float & double + +// std::numeric_limits<...>::digits10 is not the precision we want, cause +// digits10 is the maximum number of base10 digits that (float|double) +// can hold without loss, whereas we want the opposite: the minimum +// number of base10 digits required to describe any (float|double +// value) without loss. + +// g++ 4.0.2 defines for instance: +// <float>::digits10 = 6 and <double>::digits10 = 15 + +// For IEEE754's floats the required base10 precision is 9 (nine), +// and for IEEE754's doubles it's 17 (seventeen) +// We add one digit for some safety wrt to buggy converters (but if +// they are really too buggy this won't be enough to save us) + +// In scientific mode, we have: +// ios_base::precision() digits _after_ comma, +1 digit _before_ comma + +// See paragraph "Conversions" at: +// http://www2.hursley.ibm.com/decimal/ for more details and proofs. template<class Ch> void streamSettingsForFloatingPoint(basic_ostream<Ch>& s) { @@ -204,6 +224,7 @@ } // template specialization for float + template<class Ch> class streamSettings<float, Ch> {
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of carob/test/40-Parameter-PreparedStatement (1 file), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of carob/test/40-Parameter-PreparedStatement (2 files), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of carob/src (ParameterStatement.cpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of carob/src (ParameterStatement.cpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home
| advertise | OSDir is
an inevitable website.
|