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:
parent
4026c17915
commit
471041a27a
1 changed files with 12 additions and 2 deletions
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue