diff --git a/include/boost/math/distributions/non_central_t.hpp b/include/boost/math/distributions/non_central_t.hpp index dc12b59e4..964225d16 100644 --- a/include/boost/math/distributions/non_central_t.hpp +++ b/include/boost/math/distributions/non_central_t.hpp @@ -320,8 +320,8 @@ namespace boost value_type guess = 0; - if (boost::math::isinf(v)) - { // Infinite degrees of freedom, so use normal distribution located at delta. + if ( (boost::math::isinf(v)) || (v > 1 / boost::math::tools::epsilon()) ) + { // Infinite or very large degrees of freedom, so use normal distribution located at delta. normal_distribution n(delta, 1); if (p < q) { @@ -331,7 +331,7 @@ namespace boost { return quantile(complement(n, q)); } - } + } else if(v > 3) { // Use normal distribution to calculate guess. value_type mean = (v > 1 / policies::get_epsilon()) ? delta : delta * sqrt(v / 2) * tgamma_delta_ratio((v - 1) * 0.5f, T(0.5f));