I try to truncate a double with 4 decimal places, but I get the last digit rounded (and the double has only 4 decimal places!)
twice: -2.5805
SELECT TRUNCATE(double, 4) FROM `table`
Result: -2.5804
What's even more interesting:
SELECT TRUNCATE(mycol, 4) AS col1, TRUNCATE(-2.5805, 4) AS col2
FROM mytable
returns:
col1 | col2
-2.5804 | -2.5805
Demo here
source
share