* Jean-Pierre Schwickerath > I'm trying to write some kind of small accounting software and I got > stuck with the problem that doing a SUM() on values of a DECIMAL(7,2) > row did show problems with (relatively) small values (like 173.58). I > found a message explaining that mysql uses doubles internly to compute > the values and this would explain the behaviour. > > Now my question is how should one go around the problem for now? I > decided to use UNSIGNED INT and do a division by 100 after retrieving > a value (or a multiplication by 100 before storing a value) in the > language of the application (php). > Is there another better way to do it?
I think your solution is the best. That way you avoid the spooky floating point values, and you have full control of the precision of your calculations. Note that even if you use DECIMAL, a so-called exact numeric type, all calculations are done using approximate types (float/double, i.e. floating point operations). <URL: http://www.mysql.com/doc/en/Numeric_types.html > <URL: http://www.mysql.com/doc/en/Problems_with_float.html > -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]