it's possible that the results of the math that you are doing are outside the range of the column you are working with or the range of the data type the server is expecting (or both).
http://dev.mysql.com/doc/refman/5.0/...ric-types.html
http://www.cplusplus.com/doc/tutorial/variables/