Describe the bug
There is actually no implementation of trunc for decimal inputs, so we coerce the input to floating point. This yields incorrect/unexpected results for inputs above 2^53.
To Reproduce
> select trunc(CAST(9007199254740993 AS DECIMAL(20,0)));
+--------------------------------+
| trunc(Int64(9007199254740993)) |
+--------------------------------+
| 9007199254740992.0 |
+--------------------------------+
1 row(s) fetched.
Elapsed 0.011 seconds.
Expected behavior
The query should return 9007199254740993, which is what Postgres and DuckDB both do.
Additional context
No response
Describe the bug
There is actually no implementation of
truncfordecimalinputs, so we coerce the input to floating point. This yields incorrect/unexpected results for inputs above 2^53.To Reproduce
Expected behavior
The query should return
9007199254740993, which is what Postgres and DuckDB both do.Additional context
No response