MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / AlmostEquals

Method AlmostEquals

rtpose_wrapper/src/gtest/gtest.h:7090–7097  ·  view source on GitHub ↗

Returns true iff this number is at most kMaxUlps ULP's away from rhs. In particular, this function: - returns false if either number is (or both are) NAN. - treats really large numbers as almost equal to infinity. - thinks +0.0 and -0.0 are 0 DLP's apart.

Source from the content-addressed store, hash-verified

7088 // - treats really large numbers as almost equal to infinity.
7089 // - thinks +0.0 and -0.0 are 0 DLP's apart.
7090 bool AlmostEquals(const FloatingPoint& rhs) const {
7091 // The IEEE standard says that any comparison operation involving
7092 // a NAN must return false.
7093 if (is_nan() || rhs.is_nan()) return false;
7094
7095 return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
7096 <= kMaxUlps;
7097 }
7098
7099 private:
7100 // The data type used to store the actual floating-point number.

Callers 2

CmpHelperFloatingPointEQFunction · 0.80
FloatingPointLEFunction · 0.80

Calls 1

is_nanMethod · 0.80

Tested by

no test coverage detected