It's C++14 where constexpr variables still aren't inlined, making ridiculous workarounds like this necessary to fix builds (nw)

This commit is contained in:
AJR 2019-10-31 19:44:15 -04:00
parent 69bd218e03
commit e37b9b7b88
2 changed files with 3 additions and 3 deletions

View File

@ -158,7 +158,7 @@ namespace analog
//printf("%s: %g %g\n", m_name.c_str(), nVd, (nl_fptype) m_Vd);
if (nVd > m_Vcrit)
{
const nl_fptype d = std::min(fp_constants<nl_fptype>::DIODE_MAXDIFF, nVd - m_Vd);
const nl_fptype d = std::min(+fp_constants<nl_fptype>::DIODE_MAXDIFF, nVd - m_Vd);
const nl_fptype a = std::abs(d) * m_VtInv;
m_Vd = m_Vd + (d < 0 ? -1.0 : 1.0) * std::log1p(a) * m_Vt;
}
@ -189,7 +189,7 @@ namespace analog
else /* log stepping should already be done in mosfet */
{
m_Vd = nVd;
IseVDVt = std::exp(std::min(fp_constants<nl_fptype>::DIODE_MAXVOLT, m_logIs + m_Vd * m_VtInv));
IseVDVt = std::exp(std::min(+fp_constants<nl_fptype>::DIODE_MAXVOLT, m_logIs + m_Vd * m_VtInv));
m_Id = IseVDVt - m_Is;
m_G = IseVDVt * m_VtInv + m_gmin;
}

View File

@ -565,7 +565,7 @@ namespace solver
//const nl_fptype DD_n = (n->Q_Analog() - t->m_last_V);
// avoid floating point exceptions
const nl_fptype DD_n = std::max(-fp_constants<nl_fptype>::TIMESTEP_MAXDIFF, std::min(fp_constants<nl_fptype>::TIMESTEP_MAXDIFF,(t.getV() - m_last_V[k])));
const nl_fptype DD_n = std::max(-fp_constants<nl_fptype>::TIMESTEP_MAXDIFF, std::min(+fp_constants<nl_fptype>::TIMESTEP_MAXDIFF,(t.getV() - m_last_V[k])));
const nl_fptype hn = cur_ts;
//printf("%g %g %g %g\n", DD_n, hn, t.m_DD_n_m_1, t.m_h_n_m_1);