Special case Approx(inf) to better follow user expectations
This commit is contained in:
parent
815f99541d
commit
02ee130bd0
7 changed files with 12 additions and 77 deletions
|
@ -52,7 +52,8 @@ namespace Detail {
|
|||
bool Approx::equalityComparisonImpl(const double other) const {
|
||||
// First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
|
||||
// Thanks to Richard Harris for his help refining the scaled margin value
|
||||
return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
|
||||
return marginComparison(m_value, other, m_margin)
|
||||
|| marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));
|
||||
}
|
||||
|
||||
void Approx::setMargin(double newMargin) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue