neilconway opened a new issue, #22480: URL: https://github.com/apache/datafusion/issues/22480
### 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_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
