Additional check for Troe coefficients being zero

This will prevent floating point exceptions (sometimes enabled by third-party
codes) in case c[1] or c[2] are zero but will not change the current behaviour
if c[1] and c[2] are not zero.
This commit is contained in:
g3bk47 2019-02-28 17:52:16 +01:00 committed by Ray Speth
parent 4026c17915
commit 471041a27a

View file

@ -30,8 +30,18 @@ void Troe::init(const vector_fp& c)
c.size());
}
m_a = c[0];
m_rt3 = 1.0/c[1];
m_rt1 = 1.0/c[2];
if (std::abs(c[1]) < SmallNumber) {
m_rt3 = std::numeric_limits<double>::infinity();
} else {
m_rt3 = 1.0 / c[1];
}
if (std::abs(c[2]) < SmallNumber) {
m_rt1 = std::numeric_limits<double>::infinity();
} else {
m_rt1 = 1.0 / c[2];
}
if (c.size() == 4) {
m_t2 = c[3];
}