Describe the bug
power(decimal, integer) computes base ^ exp on the unscaled integer representation and then normalizes, which leads to overflows before normalization for reasonably sized inputs.
To Reproduce
SELECT power(2.5::decimal(20, 4), 10);
-- Arrow error: Arithmetic overflow: Cannot raise base 25000 to exp 10
Expected behavior
DuckDB:
memory D SELECT power(2.5::decimal(20, 4), 10);
┌────────────────────────────────────────┐
│ power(CAST(2.5 AS DECIMAL(20, 4)), 10) │
│ double │
├────────────────────────────────────────┤
│ 9536.7431640625 │
└────────────────────────────────────────┘
Postgres returns the same.
Additional context
No response
Describe the bug
power(decimal, integer)computesbase ^ expon the unscaled integer representation and then normalizes, which leads to overflows before normalization for reasonably sized inputs.To Reproduce
Expected behavior
DuckDB:
Postgres returns the same.
Additional context
No response