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

Method ToReal

cpp/src/arrow/util/decimal.cc:263–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261
262 template <typename Real>
263 static Real ToReal(const DecimalType& decimal, int32_t scale) {
264 DCHECK_GE(scale, -kMaxScale);
265 DCHECK_LE(scale, kMaxScale);
266 if (decimal.IsNegative()) {
267 // Convert the absolute value to avoid precision loss
268 auto abs = decimal;
269 abs.Negate();
270 return -Derived::template ToRealPositive<Real>(abs, scale);
271 } else {
272 return Derived::template ToRealPositive<Real>(decimal, scale);
273 }
274 }
275};
276
277struct Decimal32RealConversion

Callers

nothing calls this directly

Calls 2

IsNegativeMethod · 0.80
NegateMethod · 0.80

Tested by

no test coverage detected