Page 1 of 1
Rounding in MySQL
Posted: Tue Dec 27, 2011 9:14 am
by Acharis
Why is this not working?
"UPDATE table SET value=truncate(2.33612e+006, 2)"
Is MySQL unable to round very small floats or floats of high precision?
Re: Rounding in MySQL
Posted: Tue Dec 27, 2011 4:43 pm
by Eric!
I would guess that is is working as you have no decimals to truncate.
[text]mysql> select truncate(2.33612e+006, 2);
+---------------------------+
| truncate(2.33612e+006, 2) |
+---------------------------+
| 2336120.00 |
+---------------------------+
1 row in set (0.00 sec)
[/text]
Re: Rounding in MySQL
Posted: Tue Dec 27, 2011 5:00 pm
by twinedev
You have to remember Truncate is working with the FULL number, I have a feeling you were wanting it to be 2.33e+06, that is just a visual representation, not the actual value it acts upon.