From fb6af6321f316cfec2ffd2bef7b4787ace2bd9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 20 Aug 2019 11:20:49 +0200 Subject: [PATCH] [apps/proba] Fix chi squared root search bracket for parameter < 2 --- apps/probability/law/chi_squared_law.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/probability/law/chi_squared_law.cpp b/apps/probability/law/chi_squared_law.cpp index 618d83faa..fce5c54c0 100644 --- a/apps/probability/law/chi_squared_law.cpp +++ b/apps/probability/law/chi_squared_law.cpp @@ -76,7 +76,7 @@ double ChiSquaredLaw::cumulativeDistributiveInverseForProbability(double * proba const double kOver2Minus1 = k/2.0 - 1.0; double xmax = m_parameter1 > 2.0 ? 2 * *probability * std::exp(std::lgamma(ceilKOver2)) / (exp(-kOver2Minus1) * std::pow(kOver2Minus1, kOver2Minus1)) : - std::exp(2/k * std::log(k * std::pow(2.0, kOver2Minus1) * *probability * std::exp(std::lgamma(k/2)))); + 30.0; // Ad hoc value return cumulativeDistributiveInverseForProbabilityUsingBrentRoots(probability, DBL_EPSILON, maxDouble(xMax(), xmax)); }