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.
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:
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.
trunc(x)drops the sign of-0.0, but only when it runs on a column. On a scalar, and fortrunc(x, 0), the sign is kept.The column code path returns
0.0for either zero:-0.0 == 0.0is true, so-0.0becomes0.0.f64::truncalready keeps the sign, so plainx.trunc()would be enough.Seen through Lance (pylance 12.0.0):
trunc(x, 0)on a-0.0column returns-0.0. This line is the same onmainand in 55.1.0. I found no existing issue or PR for it.