Boost C++ Libraries: Ticket #6937: Wrong cdf/pdf/quantile domain checks for some probability distributions https://svn.boost.org/trac10/ticket/6937 <p> <code>students_t_distribution</code> and <code>fisher_f_distribution</code> are affected, and possibly others (have not checked yet). </p> <p> <code>quantile(const students_t[...])</code> contains the following code: </p> <pre class="wiki"> if(false == detail::check_df( function, degrees_of_freedom, &amp;error_result, Policy()) &amp;&amp; detail::check_probability(function, probability, &amp;error_result, Policy())) return error_result; </pre><p> <code>quantile(const fisher_f[...])</code> contains: </p> <pre class="wiki"> if(false == detail::check_df( function, df1, &amp;error_result, Policy()) &amp;&amp; detail::check_df( function, df2, &amp;error_result, Policy()) &amp;&amp; detail::check_probability( function, p, &amp;error_result, Policy())) return error_result; </pre><p> The code snippets above would only be correct if the "<code>&amp;&amp;</code>" operator had precedence over "<code>==</code>". <code>pdf</code> and <code>cdf</code> contain code of the same form. </p> <p> Side effects: </p> <ul><li>The Student's t <code>quantile()</code> can be called with a probability outside of [0,1] with unexpected results. Example: <pre class="wiki">#include &lt;boost/math/distributions/students_t.hpp&gt; using namespace boost::math; int main() { std::cout &lt;&lt; quantile(students_t(1), 2) &lt;&lt; std::endl; } </pre></li></ul><p> The output is: <code>-1.84467e+19 </code> </p> <ul><li>The Fisher F <code>quantile()</code> function, when called with probability NaN and parameters 1 and 1, leads to a failed BOOST_ASSERT. Example: <pre class="wiki">#include &lt;boost/math/distributions/fisher_f.hpp&gt; using namespace boost::math; int main() { quantile(fisher_f(1, 1), std::numeric_limits&lt;double&gt;::quiet_NaN()); } </pre></li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6937 Trac 1.4.3 John Maddock Sun, 27 May 2012 17:43:15 GMT status, milestone changed; cc set https://svn.boost.org/trac10/ticket/6937#comment:1 https://svn.boost.org/trac10/ticket/6937#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">pbristow@…</span> added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> Ticket John Maddock Sun, 27 May 2012 18:06:46 GMT <link>https://svn.boost.org/trac10/ticket/6937#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6937#comment:2</guid> <description> <p> Oh dear! </p> <p> This looks to be a systematic error through all the distributions. </p> <p> Paul - looks like we need to: </p> <ul><li>Check all the distributions. </li><li>Add tests for all possible domain errors (including those pesky NaN's - when std::numeric_limits&lt;T&gt;::has_quiet_NaN is true) for all the distros. </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 28 May 2012 17:42:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6937#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6937#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78726" title="Improve testing of error conditions and fix any errors detected. Takes ...">[78726]</a>) Improve testing of error conditions and fix any errors detected. Takes care of distributions normal-weibull. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6937" title="#6937: Bugs: Wrong cdf/pdf/quantile domain checks for some probability distributions (closed: fixed)">#6937</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 10 Jul 2012 12:21:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6937#comment:4 https://svn.boost.org/trac10/ticket/6937#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I believe this is now fixed in Trunk. </p> Ticket John Maddock Thu, 02 Aug 2012 12:00:08 GMT milestone changed https://svn.boost.org/trac10/ticket/6937#comment:5 https://svn.boost.org/trac10/ticket/6937#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.51.0</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> Ticket