mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/proba] Check value is ok before computing
This commit is contained in:
@@ -47,9 +47,11 @@ void LeftIntegralCalculation::compute(int indexKnownElement) {
|
||||
if (indexKnownElement == 0) {
|
||||
m_result = m_distribution->cumulativeDistributiveFunctionAtAbscissa(m_upperBound);
|
||||
} else {
|
||||
double currentResult = m_distribution->cumulativeDistributiveFunctionAtAbscissa(m_upperBound);
|
||||
if (std::fabs(currentResult - m_result) < std::pow(10.0, - Poincare::Preferences::LargeNumberOfSignificantDigits)) {
|
||||
return;
|
||||
if (!std::isnan(m_upperBound)) {
|
||||
double currentResult = m_distribution->cumulativeDistributiveFunctionAtAbscissa(m_upperBound);
|
||||
if (std::fabs(currentResult - m_result) < std::pow(10.0, - Poincare::Preferences::LargeNumberOfSignificantDigits)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_upperBound = m_distribution->cumulativeDistributiveInverseForProbability(&m_result);
|
||||
if (std::isnan(m_upperBound)) {
|
||||
|
||||
@@ -47,9 +47,11 @@ void RightIntegralCalculation::compute(int indexKnownElement) {
|
||||
if (indexKnownElement == 0) {
|
||||
m_result = m_distribution->rightIntegralFromAbscissa(m_lowerBound);
|
||||
} else {
|
||||
double currentResult = m_distribution->rightIntegralFromAbscissa(m_lowerBound);
|
||||
if (std::fabs(currentResult - m_result) < std::pow(10.0, - Poincare::Preferences::LargeNumberOfSignificantDigits)) {
|
||||
return;
|
||||
if (m_distribution->authorizedValueAtIndex(m_lowerBound, 0)) {
|
||||
double currentResult = m_distribution->rightIntegralFromAbscissa(m_lowerBound);
|
||||
if (std::fabs(currentResult - m_result) < std::pow(10.0, - Poincare::Preferences::LargeNumberOfSignificantDigits)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_lowerBound = m_distribution->rightIntegralInverseForProbability(&m_result);
|
||||
if (std::isnan(m_lowerBound)) {
|
||||
|
||||
Reference in New Issue
Block a user