Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Nov 16, 2023
1 parent 8c72a85 commit de64f02
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ test-suite distribution_tests :
[ run git_issue_800.cpp ../../test/build//boost_unit_test_framework ]
[ run git_issue_845.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_14901.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_14901_ncf.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_15101.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_17146.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_17388.cpp ../../test/build//boost_unit_test_framework ]
Expand Down
27 changes: 27 additions & 0 deletions test/scipy_issue_14901_ncf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright Matt Borland, 2023
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See: https://github.com/scipy/scipy/issues/14901

#include <cfenv>
#include <boost/math/distributions/non_central_f.hpp>
#include "math_unit_test.hpp"

#pragma STDC FENV_ACCESS ON

int main()
{
auto ncf1 = boost::math::non_central_f(1, 1, 1);
const auto cdf1 = boost::math::cdf(ncf1, 2);

CHECK_ULP_CLOSE(cdf1, 1 - 0.5230393170884924, 20);

if (std::fetestexcept(FE_INVALID) || std::fetestexcept(FE_DIVBYZERO))
{
return 1;
}

return boost::math::test::report_errors();
}

0 comments on commit de64f02

Please sign in to comment.