diff --git a/include/geo/latlng.h b/include/geo/latlng.h index f03065c..184f952 100644 --- a/include/geo/latlng.h +++ b/include/geo/latlng.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -18,7 +19,10 @@ struct latlng { } friend bool operator==(latlng const& lhs, latlng const& rhs) noexcept { - return std::tie(lhs.lat_, lhs.lng_) == std::tie(rhs.lat_, rhs.lng_); + auto const lat_diff = std::abs(lhs.lat_ - rhs.lat_); + auto const lng_diff = std::abs(lhs.lng_ - rhs.lng_); + return lat_diff < 100 * std::numeric_limits::epsilon() && + lng_diff < 100 * std::numeric_limits::epsilon(); } std::array lnglat() const noexcept { return {lng_, lat_}; }