hslt: vmf.cpp numerical robustness

metadata
johannes hanika 2014-11-03 16:23:48 +01:00 committed by Wenzel Jakob
parent 9f5410b4c1
commit 4a0d0aa694
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ Float VonMisesFisherDistr::eval(Float cosTheta) const {
* m_kappa / (4 * M_PI * std::sinh(m_kappa));
#else
/* Numerically stable version */
return math::fastexp(m_kappa * (cosTheta - 1))
return math::fastexp(m_kappa * std::min((Float)0, cosTheta - 1))
* m_kappa / (2 * M_PI * (1-math::fastexp(-2*m_kappa)));
#endif
}