jonasdedden opened a new issue, #25702:
URL: https://github.com/apache/datafusion/issues/25702
`trunc(x)` drops the sign of `-0.0`, but only when it runs on a column. On a
scalar, and for `trunc(x, 0)`, the sign is kept.
```sql
SELECT trunc(column1), trunc(column1, 0) FROM (VALUES (CAST(-0.0 AS
DOUBLE)));
-- got: 0.0, -0.0
-- expected: -0.0, -0.0
```
The column code path returns `0.0` for either zero:
```rust
if x == 0_f64 { 0_f64 } else { x.trunc() }
```
`-0.0 == 0.0` is true, so `-0.0` becomes `0.0`. `f64::trunc` already keeps
the sign, so plain `x.trunc()` would be enough.
Seen through Lance (pylance 12.0.0): `trunc(x, 0)` on a `-0.0` column
returns `-0.0`. This line is the same on `main` and in 55.1.0. I found no
existing issue or PR for it.
--
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]