diff --git a/src/json.hpp b/src/json.hpp index 67bfcea6..8a4ad12d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -1906,8 +1906,8 @@ class basic_json } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { - return lhs.m_value.number_integer == - static_cast(rhs.m_value.number_float); + return approx(static_cast(lhs.m_value.number_integer), + rhs.m_value.number_float); } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) { @@ -1967,8 +1967,8 @@ class basic_json } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { - return lhs.m_value.number_integer < - static_cast(rhs.m_value.number_float); + return static_cast(lhs.m_value.number_integer) < + rhs.m_value.number_float; } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) { diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 16139cae..1d41b39c 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -1906,8 +1906,8 @@ class basic_json } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { - return lhs.m_value.number_integer == - static_cast(rhs.m_value.number_float); + return approx(static_cast(lhs.m_value.number_integer), + rhs.m_value.number_float); } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) { @@ -1967,8 +1967,8 @@ class basic_json } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { - return lhs.m_value.number_integer < - static_cast(rhs.m_value.number_float); + return static_cast(lhs.m_value.number_integer) < + rhs.m_value.number_float; } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) {