55145 {
55146 auto decimal_excess = (state.decimal_count > state.scale) ? state.decimal_count - state.scale : 0;
55147 if (exponent > 0) {
55148 state.exponent_type = ExponentType::POSITIVE;
55149
55150
55151 if (decimal_excess > exponent) {
55152
55153 state.excessive_decimals = UnsafeNumericCast<uint8_t>(decimal_excess - exponent);
55154 exponent = 0;
55155 } else {
55156 exponent -= decimal_excess;
55157 }
55158 D_ASSERT(exponent >= 0);
55159 } else if (exponent < 0) {
55160 state.exponent_type = ExponentType::NEGATIVE;
55161 }
55162 if (!Finalize<T, NEGATIVE>(state)) {
55163 return false;
55164 }
55165 if (exponent < 0) {
55166 bool round_up = false;
55167 for (idx_t i = 0; i <
idx_t(-
int64_t(exponent)); i++) {
55168 auto mod = state.result % 10;
55169 round_up = NEGATIVE ? mod <= -5 : mod >= 5;
55170 state.result /= 10;
55171 if (state.result == 0) {
55172 break;
55173 }
55174 }
55175 if (round_up) {
55176 RoundUpResult<T, NEGATIVE>(state);
55177 }
55178 return true;
55179 } else {
55180
55181 for (idx_t i = 0; i <
idx_t(exponent); i++) {
55182 if (!HandleDigit<T, NEGATIVE>(state, 0)) {
55183 return false;
55184 }
55185 }
55186 return true;
55187 }
55188 }
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237