Boost C++ Libraries: Ticket #3533: Parameter range not checked in Incomplete Beta Function https://svn.boost.org/trac10/ticket/3533 <p> The incomplete beta function is defined for a &gt; 0, b &gt; 0 and 0 &lt;= x &lt;= 1. </p> <p> 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. </p> <p> Here is some very simple code : #include &lt;iterator&gt; #include &lt;algorithm&gt; #include "boost/math/special_functions/beta.hpp" #include "boost/math/special_functions/gamma.hpp" #include "boost/math/special_functions/log1p.hpp" </p> <p> int main() { </p> <blockquote> <p> double df1,df2; double x; double ret_val; </p> </blockquote> <p> </p> <blockquote> <p> df1=0.0; df2=1; x=0.5; </p> </blockquote> <blockquote> <p> ret_val=boost::math::ibeta(df1,df2,x); </p> </blockquote> <blockquote> <p> std::cout&lt;&lt;" df1 = "&lt;&lt;df1&lt;&lt;" df2= "&lt;&lt;df2&lt;&lt;" x= "&lt;&lt; x &lt;&lt;" I_x(df1,df2)= "&lt;&lt;ret_val&lt;&lt;std::endl; </p> </blockquote> <p> } </p> <p> and the output : </p> <p> df1 = 0 df2= 1 x= 0.5 I_x(df1,df2)= 1 </p> <p> (using g++ 4.3.2) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3533 Trac 1.4.3 John Maddock Tue, 20 Oct 2009 18:07:01 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3533#comment:1 https://svn.boost.org/trac10/ticket/3533#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Whether it's a good idea or not I don't know, but the behaviour is deliberate as Ix(0,b) for b &gt; 0 is well defined, finite, and real valued. Likewise Ix(a,0) for a &gt; 0. </p> <p> HTH, John. </p> Ticket Sylvain Jasson <jasson@…> Wed, 21 Oct 2009 09:19:51 GMT <link>https://svn.boost.org/trac10/ticket/3533#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3533#comment:2</guid> <description> <p> Many thanks for this quick response. </p> <p> I would then suggest : 1) to change the doc. ( which says "All of these functions require a &gt; 0, b &gt; 0 and 0 &lt;= x &lt;= 1. ") 2) to raise an exception for a=b=0 as I_x(0,0) is indeterminate. </p> <p> Any way, the workaround is more than easy and the library very usefull ! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 21 Oct 2009 15:53:42 GMT</pubDate> <title>resolution changed https://svn.boost.org/trac10/ticket/3533#comment:3 https://svn.boost.org/trac10/ticket/3533#comment:3 <ul> <li><strong>resolution</strong> <span class="trac-field-old">wontfix</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57045" title="Improve ibeta error handling, update and regenerate docs. Update ...">[57045]</a>) Improve ibeta error handling, update and regenerate docs. Update tests. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3533" title="#3533: Bugs: Parameter range not checked in Incomplete Beta Function (closed: fixed)">#3533</a>. </p> Ticket