MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / AlmostEquals

Method AlmostEquals

tests/gtest/gtest.h:6769–6776  ·  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

6767 // - treats really large numbers as almost equal to infinity.
6768 // - thinks +0.0 and -0.0 are 0 DLP's apart.
6769 bool AlmostEquals(const FloatingPoint& rhs) const {
6770 // The IEEE standard says that any comparison operation involving
6771 // a NAN must return false.
6772 if (is_nan() || rhs.is_nan()) return false;
6773
6774 return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
6775 <= kMaxUlps;
6776 }
6777
6778 private:
6779 // 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