diff --git a/kiwi/kiwi/constraint.h b/kiwi/kiwi/constraint.h index e772036..c6eae68 100644 --- a/kiwi/kiwi/constraint.h +++ b/kiwi/kiwi/constraint.h @@ -63,8 +63,8 @@ class ConstraintData : public SharedData switch (m_op) { case OP_EQ: return !impl::nearZero(m_expression.value()); - case OP_GE: return m_expression.value() < 0.0; - case OP_LE: return m_expression.value() > 0.0; + case OP_GE: return m_expression.value() < impl::EPSILON; + case OP_LE: return m_expression.value() > impl::EPSILON; } std::abort(); } diff --git a/kiwi/kiwi/util.h b/kiwi/kiwi/util.h index 560a43a..1fd2723 100644 --- a/kiwi/kiwi/util.h +++ b/kiwi/kiwi/util.h @@ -13,10 +13,11 @@ namespace kiwi namespace impl { +constexpr const double EPSILON = 1.0e-8; + inline bool nearZero(double value) { - const double eps = 1.0e-8; - return value < 0.0 ? -value < eps : value < eps; + return value < 0.0 ? -value < EPSILON : value < EPSILON; } } // namespace impl