MCPcopy Create free account
hub / github.com/apache/arrow / WithinUlpGeneric

Function WithinUlpGeneric

cpp/src/arrow/testing/math.cc:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template <typename Float>
34bool WithinUlpGeneric(Float left, Float right, int32_t n_ulps) {
35 if constexpr (std::is_same_v<Float, util::Float16>) {
36 if (left.is_nan() || right.is_nan()) {
37 return left.is_nan() == right.is_nan();
38 }
39 } else {
40 if (std::isnan(left) || std::isnan(right)) {
41 return std::isnan(left) == std::isnan(right);
42 }
43 }
44
45 if (n_ulps == 0) {
46 return left == right;
47 }
48
49 return internal::WithinUlp(left, right, n_ulps);
50}
51
52template <typename Float>
53void AssertWithinUlpGeneric(Float left, Float right, int32_t n_ulps) {

Callers 1

AssertWithinUlpGenericFunction · 0.70

Calls 1

WithinUlpFunction · 0.85

Tested by

no test coverage detected