Boost logo

Boost-Commit :

From: gautamcool88_at_[hidden]
Date: 2008-08-19 10:20:09


Author: s.gautam
Date: 2008-08-19 10:20:08 EDT (Tue, 19 Aug 2008)
New Revision: 48216
URL: http://svn.boost.org/trac/boost/changeset/48216

Log:
modified the quantile function to return the result of overflow and underflow errors at p=1 and p=0
Text files modified:
   sandbox/SOC/2008/parrallel_math/boost/math/distributions/gsoc_logistic.hpp | 22 +++++++++++++++-------
   1 files changed, 15 insertions(+), 7 deletions(-)

Modified: sandbox/SOC/2008/parrallel_math/boost/math/distributions/gsoc_logistic.hpp
==============================================================================
--- sandbox/SOC/2008/parrallel_math/boost/math/distributions/gsoc_logistic.hpp (original)
+++ sandbox/SOC/2008/parrallel_math/boost/math/distributions/gsoc_logistic.hpp 2008-08-19 10:20:08 EDT (Tue, 19 Aug 2008)
@@ -159,14 +159,18 @@
       if(false == detail::check_probability(function, p, &result, Policy()))
         return result;
       
- using boost::math::tools::max_value;
+
       if(p == 0)
         {
- return -max_value<RealType>();
+
+ result=policies::raise_underflow_error<RealType>(function,"probability argument is 0, must be >0 and <1",Policy());
+ return result;
         }
       if(p == 1)
         {
- return max_value<RealType>();
+ result=policies::raise_overflow_error<RealType>(function,"probability argument is 0, must be >0 and <1",Policy());
+ return result;
+
         }
        //Expressions to try
        //return location+scale*log(p/(1-p));
@@ -222,13 +226,17 @@
    using boost::math::tools::max_value;
 
 
- if(q == 0)
+ if(q == 1)
         {
- return max_value<RealType>();
+ result=policies::raise_underflow_error<RealType>(function,"probability argument is 0, must be >0 and <1",Policy());
+ return result;
+
         }
- if(q == 1)
+ if(q == 0)
         {
- return -max_value<RealType>();
+ result=policies::raise_overflow_error<RealType>(function,"probability argument is 0, must be >0 and <1",Policy());
+ return result;
+
         }
    //Expressions to try
    return location+scale*log((1-q)/q);


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