Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66839 - trunk/libs/math/example
From: pbristow_at_[hidden]
Date: 2010-11-29 07:44:02


Author: pbristow
Date: 2010-11-29 07:44:01 EST (Mon, 29 Nov 2010)
New Revision: 66839
URL: http://svn.boost.org/trac/boost/changeset/66839

Log:
tried using boost_no_numericLimits to avoid max_digits10
Text files modified:
   trunk/libs/math/example/inverse_chi_squared_example.cpp | 18 +++++++++++++-----
   1 files changed, 13 insertions(+), 5 deletions(-)

Modified: trunk/libs/math/example/inverse_chi_squared_example.cpp
==============================================================================
--- trunk/libs/math/example/inverse_chi_squared_example.cpp (original)
+++ trunk/libs/math/example/inverse_chi_squared_example.cpp 2010-11-29 07:44:01 EST (Mon, 29 Nov 2010)
@@ -80,11 +80,19 @@
 
   cout << "Example (basic) using Inverse chi squared distribution. " << endl;
 
- // TODO find a more practial/useful example. Suggestions welcome?
+ // TODO find a more practical/useful example. Suggestions welcome?
 
- int i = std::numeric_limits<double>::max_digits10;
- cout << "Show all potentially significant decimal digits std::numeric_limits<double>::max_digits10 = " << i << endl;
- cout.precision(std::numeric_limits<double>::max_digits10); //
+#ifdef BOOST_NO_NUMERIC_LIMITS_LOWEST
+ int max_digits10 = 2 + (boost::math::policies::digits<double, boost::math::policies::policy<> >() * 30103UL) / 100000UL;
+ cout << "BOOST_NO_NUMERIC_LIMITS_LOWEST is defined" << endl;
+#else
+ int max_digits10 = std::numeric_limits<double>::max_digits10;
+#endif
+ cout << "Show all potentially significant decimal digits std::numeric_limits<double>::max_digits10 = "
+ << max_digits10 << endl;
+ cout.precision(max_digits10); //
+
+ cout << _MSC_VER << ' ' << _MSC_FULL_VER << ' ' << _CPPLIB_VER << endl;
 
   inverse_chi_squared ichsqdef; // All defaults - not very useful!
   cout << "default df = " << ichsqdef.degrees_of_freedom()
@@ -127,7 +135,7 @@
     }
   }
 
- cout.precision(std::numeric_limits<double>::max_digits10);
+ cout.precision(max_digits10);
 
   inverse_chi_squared ichisq(2., 0.5);
   cout << "pdf(ichisq, 1.) = " << pdf(ichisq, 1.) << endl;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk