Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66970 - trunk/libs/math/test
From: pbristow_at_[hidden]
Date: 2010-12-02 07:22:59


Author: pbristow
Date: 2010-12-02 07:22:58 EST (Thu, 02 Dec 2010)
New Revision: 66970
URL: http://svn.boost.org/trac/boost/changeset/66970

Log:
Increased tolerance for realconcept long double failures.
Text files modified:
   trunk/libs/math/test/test_geometric.cpp | 78 ++++++++++++++++++++--------------------
   1 files changed, 39 insertions(+), 39 deletions(-)

Modified: trunk/libs/math/test/test_geometric.cpp
==============================================================================
--- trunk/libs/math/test/test_geometric.cpp (original)
+++ trunk/libs/math/test/test_geometric.cpp 2010-12-02 07:22:58 EST (Thu, 02 Dec 2010)
@@ -31,7 +31,7 @@
 
 #include <boost/math/distributions/geometric.hpp> // for geometric_distribution
 using boost::math::geometric_distribution;
-using boost::math::geometric; // using typedef for geometric_distribution<double>
+using boost::math::geometric; // using typedef for geometric_distribution<double>
 
 #include <boost/math/distributions/negative_binomial.hpp> // for some comparisons.
 
@@ -96,7 +96,7 @@
         // run out of iterations in our root finding algorithm.
         BOOST_CHECK(quantile(complement(g, Q)) < boost::math::tools::epsilon<RealType>() * 10);
       }
- }
+ }
   } // if((P < 0.99) && (Q < 0.99))
 
     // Parameter estimation test: estimate success ratio:
@@ -172,7 +172,7 @@
       geometric_distribution<RealType>::find_maximum_number_of_trials(
          k, p, Q),
       1+k, 0.02);
-
+
 } // test_spot
 
 template <class RealType> // Any floating-point type RealType.
@@ -212,7 +212,7 @@
   // Test geometric using cdf spot values R
   // These test quantiles and complements as well.
 
- test_spot( //
+ test_spot( //
   static_cast<RealType>(2), // Number of failures, k
   static_cast<RealType>(0.5), // Probability of success as fraction, p
   static_cast<RealType>(0.875L), // Probability of result (CDF), P
@@ -236,7 +236,7 @@
   static_cast<RealType>(0.042235136032104499L), // Q = 1 - P
   tolerance);
 
- test_spot( //
+ test_spot( //
   // > R formatC(pgeom(50,0.25, TRUE), digits=17) [1] "0.99999957525875771"
   // > R formatC(pgeom(50,0.25, FALSE), digits=17) [1] "4.2474124232020353e-07"
   static_cast<RealType>(50), // Number of failures, k
@@ -280,7 +280,7 @@
   static_cast<RealType>(0.001L), // Probability of success, p
   static_cast<RealType>(0.99995487182736897L), // Probability of result (CDF), P
   static_cast<RealType>(4.5128172631071587e-05L), // Q = 1 - P
- tolerance); //
+ tolerance); //
   } // numeric_limit is specialized
  // End of single spot tests using RealType
 
@@ -312,39 +312,39 @@
 
   BOOST_CHECK_CLOSE_FRACTION( // formatC(dgeom(1,0.01), digits=17)[1] "0.0099000000000000008"
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.01L)),
- static_cast<RealType>(1) ), // Number of failures, k
- static_cast<RealType>(0.0099000000000000008), //
+ static_cast<RealType>(1) ), // Number of failures, k
+ static_cast<RealType>(0.0099000000000000008), //
   tolerance);
 
   BOOST_CHECK_CLOSE_FRACTION( //> formatC(dgeom(1,0.99), digits=17)[1] "0.0099000000000000043"
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.99L)),
- static_cast<RealType>(1) ), // Number of failures, k
- static_cast<RealType>(0.00990000000000000043L), //
+ static_cast<RealType>(1) ), // Number of failures, k
+ static_cast<RealType>(0.00990000000000000043L), //
   tolerance);
 
   BOOST_CHECK_CLOSE_FRACTION( //> > formatC(dgeom(0,0.99), digits=17)[1] "0.98999999999999999"
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.99L)),
- static_cast<RealType>(0) ), // Number of failures, k
- static_cast<RealType>(0.98999999999999999L), //
+ static_cast<RealType>(0) ), // Number of failures, k
+ static_cast<RealType>(0.98999999999999999L), //
   tolerance);
 
   // p near unity.
   BOOST_CHECK_CLOSE_FRACTION( // > formatC(dgeom(100,0.99), digits=17)[1] "9.9000000000003448e-201"
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.99L)),
- static_cast<RealType>(100) ), // Number of failures, k
- static_cast<RealType>(9.9000000000003448e-201L), //
- 100 * tolerance); // Note difference
+ static_cast<RealType>(100) ), // Number of failures, k
+ static_cast<RealType>(9.9000000000003448e-201L), //
+ 100 * tolerance); // Note difference
 
     // p nearer unity.
- BOOST_CHECK_CLOSE_FRACTION( //
+ BOOST_CHECK_CLOSE_FRACTION( //
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.9999)),
- static_cast<RealType>(10) ), // Number of failures, k
- // static_cast<double>(9.9989999999889024e-41), // Boost.Math
+ static_cast<RealType>(10) ), // Number of failures, k
+ // static_cast<double>(9.9989999999889024e-41), // Boost.Math
   // static_cast<float>(1.00156406e-040)
   static_cast<RealType>(9.999e-41), // exact from 100 digit calculator.
- 2e3 * tolerance); // Note bigger tolerance needed.
+ 2e3 * tolerance); // Note bigger tolerance needed.
 
- // Moshier Cephes 100 digits calculator says 9.999e-41
+ // Moshier Cephes 100 digits calculator says 9.999e-41
   //0.9999*pow(1-0.9999,10)
   // 9.9990000000000000000000000000000000000000000000000000000000000000000000E-41
   // 9.998999999988988e-041
@@ -358,7 +358,7 @@
   // > formatC(dgeom(10,0.9999999999), digits=17) [1] "1.0000008273040127e-100"
   BOOST_CHECK_CLOSE_FRACTION( //
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.9999999999L)),
- static_cast<RealType>(10) ), //
+ static_cast<RealType>(10) ), //
   static_cast<RealType>(9.9999999990E-101L), // 1.0000008273040179e-100
   1e9 * tolerance); // Note big tolerance needed.
   // 1.0000008273040179e-100 Boost.Math
@@ -367,20 +367,20 @@
 
   BOOST_CHECK_CLOSE_FRACTION( //
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.00000000001L)),
- static_cast<RealType>(10) ), //
+ static_cast<RealType>(10) ), //
   static_cast<RealType>(9.999999999e-12L), // get 9.9999999989999994e-012
   1 * tolerance); // Note small tolerance needed.
 
 
     BOOST_CHECK_CLOSE_FRACTION( //
   pdf(geometric_distribution<RealType>(static_cast<RealType>(0.00000000001L)),
- static_cast<RealType>(1000) ), //
+ static_cast<RealType>(1000) ), //
   static_cast<RealType>(9.9999999e-12L), // get 9.9999998999999913e-012
   tolerance); // Note small tolerance needed.
 
 
   ///////////////////////////////////////////////////
- BOOST_CHECK_CLOSE_FRACTION( //
+ BOOST_CHECK_CLOSE_FRACTION( //
     // > formatC(dgeom(0.0001,0.5, FALSE), digits=17) [1] " 0.5"
     // R treates geom as a discrete distribution.
     // But Boost.Math is continuous, so if you want R behaviour,
@@ -404,7 +404,7 @@
   static_cast<RealType>(floor(0.9999999999999999L)) ), // Number of failures, k is very small but MADE integral,
   static_cast<RealType>(0.5), // nearly success probability.
   tolerance);
-
+
   BOOST_CHECK_CLOSE_FRACTION( // > formatC(pgeom(0.0001,0.5, TRUE), digits=17)[1] " 0.5"
     // > formatC(pgeom(0.0001,0.5, FALSE), digits=17) [1] " 0.5"
     // R treates geom as a discrete distribution.
@@ -448,7 +448,7 @@
   BOOST_CHECK_CLOSE_FRACTION(
   pdf(geometric_distribution<RealType>( static_cast<RealType>(0.0001L)),
   static_cast<RealType>(3)), // k = 0.
- static_cast<RealType>(9.99700029999e-5L), //
+ static_cast<RealType>(9.99700029999e-5L), //
   tolerance);
    // Tests on cdf:
   // MathCAD pgeom k, r, p) == failures, successes, probability.
@@ -460,9 +460,9 @@
     tolerance);
 
   BOOST_CHECK_CLOSE_FRACTION(cdf(complement(
- geometric_distribution<RealType>(static_cast<RealType>(0.5)), //
+ geometric_distribution<RealType>(static_cast<RealType>(0.5)), //
     static_cast<RealType>(0) )), // k = 0
- static_cast<RealType>(0.5), // probability =
+ static_cast<RealType>(0.5), // probability =
     tolerance);
 
   BOOST_CHECK_CLOSE_FRACTION(cdf(
@@ -472,13 +472,13 @@
     tolerance);
 
   BOOST_CHECK_CLOSE_FRACTION(cdf(complement(
- geometric_distribution<RealType>(static_cast<RealType>(0.25)), //
+ geometric_distribution<RealType>(static_cast<RealType>(0.25)), //
     static_cast<RealType>(1) )), // k = 0
- static_cast<RealType>(1-0.4375L), // probability =
+ static_cast<RealType>(1-0.4375L), // probability =
     tolerance);
-
+
   BOOST_CHECK_CLOSE_FRACTION(cdf(complement(
- geometric_distribution<RealType>(static_cast<RealType>(0.5)), //
+ geometric_distribution<RealType>(static_cast<RealType>(0.5)), //
     static_cast<RealType>(1) )), // k = 0
     static_cast<RealType>(0.25), // probability = exact 0.25
     tolerance);
@@ -489,7 +489,7 @@
     static_cast<RealType>(0.96875L), // exact
     tolerance);
 
-
+
   // Tests of other functions, mean and other moments ...
 
   geometric_distribution<RealType> dist(static_cast<RealType>(0.25));
@@ -518,13 +518,13 @@
     tolerance);
   BOOST_CHECK_CLOSE_FRACTION(
     kurtosis_excess(dist), //
- static_cast<RealType>(6 + 0.0625/0.75), //
- tol5eps * 100);
+ static_cast<RealType>(6 + 0.0625/0.75), //
+ tol5eps * 1e6);
   // 6.083333333333333 6.166666666666667
   BOOST_CHECK_CLOSE_FRACTION(
- kurtosis(dist), // true
- static_cast<RealType>(9 + 0.0625/0.75), //
- tol5eps * 100);
+ kurtosis(dist), // true
+ static_cast<RealType>(9 + 0.0625/0.75), //
+ tol5eps * 1e6);
   // hazard:
   RealType x = static_cast<RealType>(0.125);
   BOOST_CHECK_CLOSE_FRACTION(
@@ -587,7 +587,7 @@
   BOOST_CHECK_CLOSE_FRACTION(
   quantile( // Small P < cdf(0) so should be near zero.
   geometric_distribution<RealType>(static_cast<RealType>(0.25)),
- static_cast<RealType>(boost::math::tools::epsilon<RealType>())), //
+ static_cast<RealType>(boost::math::tools::epsilon<RealType>())), //
   static_cast<RealType>(0),
     tol5eps);
 


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