mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/proba] More seamless computation
If the user computes P(x<a) which gives b, then presses OK on b, return a. This prevents some comutation errors such as for student distribution with 0.05 degrees of freedom, P(x<9900000) then press ok on the result
This commit is contained in:
@@ -47,6 +47,10 @@ void LeftIntegralCalculation::compute(int indexKnownElement) {
|
||||
if (indexKnownElement == 0) {
|
||||
m_result = m_law->cumulativeDistributiveFunctionAtAbscissa(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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user