I have a small financial application with PHP as the front end and MySQL as the back end. I have ancient prejudices, and I store money values in MySQL as an integer of cents
Casting does not round() as in round-to-nearest, it truncates at the decimal: (int)3.99 yields 3. (int)-3.99 yields -3.
round()
(int)3.99
3
(int)-3.99
-3
Since float arithmetic often induces error (and possibly not in the direction you want), use round() if you want reliable rounding.