Boost C++ Libraries: Ticket #10111: quantile at p=1 for non-central chi-squared---regression bug? https://svn.boost.org/trac10/ticket/10111 <p> I think this used to work as expected a while ago: </p> <pre class="wiki">#include &lt;cstdlib&gt; #include &lt;cstdio&gt; #include &lt;boost/math/distributions/non_central_chi_squared.hpp&gt; #include &lt;boost/math/distributions/chi_squared.hpp&gt; int main() { const double _df = 1.2; const double _nc = 2.5; const double _p = 1.0; std::printf( "\nchi-squared: quantile( p=%g, df=%g ) = %g\n", _p, _df, boost::math::quantile( boost::math::chi_squared_distribution&lt;&gt;( _df ), _p ) ); std::printf( "non-central chi-squared: quantile( p=%g, df=%g, nc=%g ) = %g\n\n", _p, _df, _nc, boost::math::quantile( boost::math::non_central_chi_squared_distribution&lt;&gt;( _df, _nc ), _p ) ); return EXIT_SUCCESS; } </pre><p> When built with "g++ -o test chisq.cpp" (after saving the above as "chisq.cpp") on a Linux box, this currently returns </p> <pre class="wiki">chi-squared: quantile( p=1, df=1.2 ) = inf non-central chi-squared: quantile( p=1, df=1.2, nc=2.5 ) = 1.79769e+308 </pre><p> when ran; I expected both to return inf. </p> <p> Thank you,<br /> HS </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10111 Trac 1.4.3 John Maddock Thu, 12 Jun 2014 12:55:18 GMT <link>https://svn.boost.org/trac10/ticket/10111#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10111#comment:1</guid> <description> <p> Actually the first case returns infinity "by accident", so they're both buggy - they should be raising an overflow_error instead. Fixed in <a class="ext-link" href="https://github.com/boostorg/math/commit/ee8edd4c335c3592b0585ddcf623d739defc1fa3"><span class="icon">​</span>https://github.com/boostorg/math/commit/ee8edd4c335c3592b0585ddcf623d739defc1fa3</a>. </p> <p> Note that the default behaviour is now for these cases to throw a std::overflow_error, if you want them to return infinity instead then you'll need to change the policy defaults, for example as in <a href="http://www.boost.org/doc/libs/1_55_0/libs/math/doc/html/math_toolkit/pol_ref/policy_defaults.html">http://www.boost.org/doc/libs/1_55_0/libs/math/doc/html/math_toolkit/pol_ref/policy_defaults.html</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 12 Jun 2014 12:55:27 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10111#comment:2 https://svn.boost.org/trac10/ticket/10111#comment:2 <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">fixed</span> </li> </ul> Ticket HS <tan@…> Sat, 14 Jun 2014 06:04:38 GMT <link>https://svn.boost.org/trac10/ticket/10111#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10111#comment:3</guid> <description> <p> Thank you, John, for the quick fix(es). Yes, I actually do use the ignore_error for the BOOST_MATH_DOMAIN_ERROR_POLICY in my original code. </p> <p> With best regards,<br /> HS </p> </description> <category>Ticket</category> </item> </channel> </rss>