From 7406fcae98f3696dba74147ce888a9425fd51195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 9 Sep 2019 15:11:20 +0200 Subject: [PATCH] [apps/proba] Fix Student distribution --- apps/probability/distribution/student_distribution.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/probability/distribution/student_distribution.cpp b/apps/probability/distribution/student_distribution.cpp index dd22a46ad..4199f4467 100644 --- a/apps/probability/distribution/student_distribution.cpp +++ b/apps/probability/distribution/student_distribution.cpp @@ -31,7 +31,7 @@ double StudentDistribution::cumulativeDistributiveFunctionAtAbscissa(double x) c return 0.5; } if (std::isinf(x)) { - return 1.0; + return x > 0 ? 1.0 : 0.0; } /* TODO There are some computation errors, where the probability falsly jumps to 1. * k = 0.001 and P(x < 42000000) (for 41000000 it is around 0.5) @@ -47,8 +47,7 @@ double StudentDistribution::cumulativeDistributiveInverseForProbability(double * return 0.0; } const double small = DBL_EPSILON; - const double standardBig = 10000.0; - const double big = m_parameter1 >= 1 ? standardBig : standardBig / m_parameter1; + const double big = 1E10; double xmin = *probability < 0.5 ? -big : small; double xmax = *probability < 0.5 ? -small : big; return cumulativeDistributiveInverseForProbabilityUsingIncreasingFunctionRoot(probability, xmin, xmax);