[Boost-bugs] [Boost C++ Libraries] #6937: Wrong cdf/pdf/quantile domain checks for some probability distributions

Subject: [Boost-bugs] [Boost C++ Libraries] #6937: Wrong cdf/pdf/quantile domain checks for some probability distributions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-24 12:06:36


#6937: Wrong cdf/pdf/quantile domain checks for some probability distributions
-------------------------------------------------------------+--------------
 Reporter: Florian Schoppmann <Florian.Schoppmann@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------------+--------------
 `students_t_distribution` and `fisher_f_distribution` are affected, and
 possibly others (have not checked yet).

 `quantile(const students_t[...])` contains the following code:
 {{{
    if(false == detail::check_df(
       function, degrees_of_freedom, &error_result, Policy())
          && detail::check_probability(function, probability,
 &error_result, Policy()))
       return error_result;
 }}}

 `quantile(const fisher_f[...])` contains:
 {{{
    if(false == detail::check_df(
             function, df1, &error_result, Policy())
          && detail::check_df(
             function, df2, &error_result, Policy())
          && detail::check_probability(
             function, p, &error_result, Policy()))
       return error_result;
 }}}

 The code snippets above would only be correct if the "`&&`" operator had
 precedence over "`==`". `pdf` and `cdf` contain code of the same form.

 Side effects:
 - The Student's t `quantile()` can be called with a probability outside of
 ![0,1] with unexpected results. Example:
 {{{
 #include <boost/math/distributions/students_t.hpp>
 using namespace boost::math;
 int main() {
     std::cout << quantile(students_t(1), 2) << std::endl;
 }
 }}}
 The output is: `-1.84467e+19 `
 - The Fisher F `quantile()` function, when called with probability NaN and
 parameters 1 and 1, leads to a failed BOOST_ASSERT. Example:
 {{{
 #include <boost/math/distributions/fisher_f.hpp>
 using namespace boost::math;
 int main() {
     quantile(fisher_f(1, 1), std::numeric_limits<double>::quiet_NaN());
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6937>
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:09 UTC