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

Function Round

cpp/src/gandiva/precompiled/decimal_ops.cc:662–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662BasicDecimal128 Round(const BasicDecimalScalar128& x, int32_t out_precision,
663 int32_t out_scale, int32_t rounding_scale, bool* overflow) {
664 // no-op if target scale is same as arg scale
665 if (x.scale() == out_scale && rounding_scale >= 0) {
666 return x.value();
667 }
668
669 if (rounding_scale < 0) {
670 return RoundWithNegativeScale(x, out_precision, rounding_scale,
671 RoundType::kRoundTypeHalfRoundUp, overflow);
672 } else {
673 return RoundWithPositiveScale(x, out_precision, rounding_scale,
674 RoundType::kRoundTypeHalfRoundUp, overflow);
675 }
676}
677
678BasicDecimal128 Truncate(const BasicDecimalScalar128& x, int32_t out_precision,
679 int32_t out_scale, int32_t rounding_scale, bool* overflow) {

Callers 3

TEST_FFunction · 0.70
round_decimal128Function · 0.70
round_decimal128_int32Function · 0.70

Calls 4

RoundWithNegativeScaleFunction · 0.85
RoundWithPositiveScaleFunction · 0.85
scaleMethod · 0.45
valueMethod · 0.45

Tested by 1

TEST_FFunction · 0.56