From 7ec6bea9918cfaf1dfaf8fb0c1e4cab20147e912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 19 Aug 2019 15:46:38 +0200 Subject: [PATCH] [apps/proba] More seamless computation If the user computes P(xcumulativeDistributiveFunctionAtAbscissa(m_upperBound); } else { + double currentResult = m_law->cumulativeDistributiveFunctionAtAbscissa(m_upperBound); + if (std::fabs(currentResult - m_result) < std::pow(10.0, - Constant::LargeNumberOfSignificantDigits)) { + return; + } m_upperBound = m_law->cumulativeDistributiveInverseForProbability(&m_result); } } diff --git a/apps/probability/calculation/right_integral_calculation.cpp b/apps/probability/calculation/right_integral_calculation.cpp index 48858f584..83a82436f 100644 --- a/apps/probability/calculation/right_integral_calculation.cpp +++ b/apps/probability/calculation/right_integral_calculation.cpp @@ -47,6 +47,10 @@ void RightIntegralCalculation::compute(int indexKnownElement) { if (indexKnownElement == 0) { m_result = m_law->rightIntegralFromAbscissa(m_lowerBound); } else { + double currentResult = m_law->rightIntegralFromAbscissa(m_lowerBound); + if (std::fabs(currentResult - m_result) < std::pow(10.0, - Constant::LargeNumberOfSignificantDigits)) { + return; + } m_lowerBound = m_law->rightIntegralInverseForProbability(&m_result); } }