diff options
author | ygorshenin <mipt.vi002@gmail.com> | 2016-10-12 19:03:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-12 19:03:23 +0300 |
commit | 7ee46ea0b0cdae2c04b2d15aab841c0f860ed0df (patch) | |
tree | 20e5414a107c4d6116de10f53f3d3de66c8b96f7 /base | |
parent | 8500a3e178c5d2093a959303d2b9b4c4c1f83835 (diff) | |
parent | e90da1c9d6a2720b03aefa54dedcd27f006f13df (diff) |
Merge pull request #4473 from mpimenov/traffic-gps-serialization
[coding] Added a serialization method for traffic coords.
Diffstat (limited to 'base')
-rw-r--r-- | base/math.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/math.hpp b/base/math.hpp index 92ac40ab06..eb20ca4295 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -73,6 +73,13 @@ inline bool AlmostEqualRel(TFloat x, TFloat y, TFloat eps) return fabs(x - y) < eps * max(fabs(x), fabs(y)); } +// Returns true if x and y are equal up to the absolute or relative difference eps. +template <typename TFloat> +inline bool AlmostEqualAbsOrRel(TFloat x, TFloat y, TFloat eps) +{ + return AlmostEqualAbs(x, y, eps) || AlmostEqualRel(x, y, eps); +} + template <typename TFloat> inline TFloat DegToRad(TFloat deg) { return deg * TFloat(math::pi) / TFloat(180); |