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

Function AddLarge

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

Source from the content-addressed store, hash-verified

134}
135
136static BasicDecimal128 AddLarge(const BasicDecimalScalar128& x,
137 const BasicDecimalScalar128& y, int32_t out_scale) {
138 if (x.value() >= 0 && y.value() >= 0) {
139 // both positive or 0
140 return AddLargePositive(x, y, out_scale);
141 } else if (x.value() <= 0 && y.value() <= 0) {
142 // both negative or 0
143 BasicDecimalScalar128 x_neg(-x.value(), x.precision(), x.scale());
144 BasicDecimalScalar128 y_neg(-y.value(), y.precision(), y.scale());
145 return -AddLargePositive(x_neg, y_neg, out_scale);
146 } else {
147 // one positive and the other negative
148 return AddLargeNegative(x, y, out_scale);
149 }
150}
151
152// Suppose we have a number that requires x bits to be represented and we scale it up by
153// 10^scale_by. Let's say now y bits are required to represent it. This function returns

Callers 2

BuildAddMethod · 0.85
AddFunction · 0.85

Calls 5

AddLargePositiveFunction · 0.85
AddLargeNegativeFunction · 0.85
valueMethod · 0.45
precisionMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected