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

Function CheckFloatApproxEqualsWithAtol

cpp/src/arrow/array/array_test.cc:2193–2208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2191
2192template <typename TYPE>
2193void CheckFloatApproxEqualsWithAtol() {
2194 using c_type = typename TYPE::c_type;
2195 auto type = TypeTraits<TYPE>::type_singleton();
2196 std::shared_ptr<Array> a, b;
2197 ArrayFromVector<TYPE>(type, {true}, {static_cast<c_type>(0.5)}, &a);
2198 ArrayFromVector<TYPE>(type, {true}, {static_cast<c_type>(0.6)}, &b);
2199 auto options = EqualOptions::Defaults().atol(0.2);
2200
2201 ASSERT_FALSE(a->Equals(b));
2202 ASSERT_TRUE(a->Equals(b, options.use_atol(true)));
2203 ASSERT_TRUE(a->ApproxEquals(b, options));
2204
2205 ASSERT_FALSE(a->RangeEquals(0, 1, 0, b, options));
2206 ASSERT_TRUE(a->RangeEquals(0, 1, 0, b, options.use_atol(true)));
2207 ASSERT_TRUE(ArrayRangeApproxEquals(*a, *b, 0, 1, 0, options));
2208}
2209
2210template <typename TYPE>
2211void CheckSliceApproxEquals() {

Callers

nothing calls this directly

Calls 8

ArrayRangeApproxEqualsFunction · 0.85
atolMethod · 0.80
use_atolMethod · 0.80
RangeEqualsMethod · 0.80
type_singletonFunction · 0.50
DefaultsFunction · 0.50
EqualsMethod · 0.45
ApproxEqualsMethod · 0.45

Tested by

no test coverage detected