The real problem, as others have noted, is that you cannot trust the client. Ever. No calculations should be performed on the client side or using data (such as price) from the client. Other than that, I would never use float to represent monetary amounts. Money should always be represented as an integer, where 1 represents a single unit of the base unit of the currency (for example, a cent). it complicates the situation a bit, but does itself a favor and creates some simple access functions, and your life will be easier for her.
source
share