[Boost-bugs] [Boost C++ Libraries] #3533: Parameter range not checked in Incomplete Beta Function

Subject: [Boost-bugs] [Boost C++ Libraries] #3533: Parameter range not checked in Incomplete Beta Function
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-10-20 14:14:00


#3533: Parameter range not checked in Incomplete Beta Function
------------------------------------------------------+---------------------
 Reporter: Sylvain Jasson <jasson@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: math
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: |
------------------------------------------------------+---------------------
 The incomplete beta function is defined for a > 0, b > 0 and 0 <= x <= 1.

 A call to boost::math::ibeta(0,1,0.5) should raise an std::domain_error
 under default policy.
 The domain error on a (first parameter) is not detected.

 Here is some very simple code :
 #include <iterator>
 #include <algorithm>
 #include "boost/math/special_functions/beta.hpp"
 #include "boost/math/special_functions/gamma.hpp"
 #include "boost/math/special_functions/log1p.hpp"

 int main()
 {
   double df1,df2;
   double x;
   double ret_val;

   df1=0.0;
   df2=1;
   x=0.5;

   ret_val=boost::math::ibeta(df1,df2,x);

   std::cout<<" df1 = "<<df1<<" df2= "<<df2<<" x= "<< x <<" I_x(df1,df2)=
 "<<ret_val<<std::endl;
 }


 and the output :

 df1 = 0 df2= 1 x= 0.5 I_x(df1,df2)= 1

 (using g++ 4.3.2)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3533>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC