[apps/proba] Handle infinite xMax in exponential distribution

This commit is contained in:
Léa Saviot
2019-09-09 10:55:18 +02:00
parent 67964ca383
commit aa45adb49a

View File

@@ -11,9 +11,13 @@ float ExponentialDistribution::xMin() const {
float ExponentialDistribution::xMax() const {
assert(m_parameter1 != 0.0f);
float result = 5.0f/m_parameter1;
if (result <= 0.0f) {
if (result <= FLT_EPSILON) {
result = 1.0f;
}
if (std::isinf(result)) {
// Lower xMax. It is used for drawing so the value is not that important.
return 1.0f/m_parameter1;
}
return result * (1.0f + k_displayRightMarginRatio);
}