MCPcopy Create free account
hub / github.com/apache/arrow / operator()

Method operator()

cpp/src/arrow/compare.cc:90–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 ulp_distance(options.ulp_distance().value_or(-1)) {}
89
90 bool operator()(T x, T y) const {
91 if (x == y) {
92 return Flags::signed_zeros_equal || (std::signbit(x) == std::signbit(y));
93 }
94
95 if constexpr (Flags::nans_equal) {
96 if (std::isnan(x) && std::isnan(y)) {
97 return true;
98 }
99 } else if (std::isnan(x) || std::isnan(y)) {
100 return false;
101 }
102
103 if (Flags::absolute_tolerance && (std::fabs(x - y) <= epsilon)) {
104 return true;
105 }
106 if (Flags::ulp_distance_equal && internal::WithinUlp(x, y, ulp_distance)) {
107 return true;
108 }
109 return false;
110 }
111
112 const T epsilon;
113 const int32_t ulp_distance;

Callers

nothing calls this directly

Calls 2

signbitFunction · 0.85
WithinUlpFunction · 0.85

Tested by

no test coverage detected