12.17 Precision Math

12.17.1 Types of Numeric Values
12.17.2 DECIMAL Data Type Characteristics
12.17.3 Expression Handling
12.17.4 Rounding Behavior
12.17.5 Precision Math Examples

MySQL 5.0 introduces precision math: numeric value handling that results in more accurate results and more control over invalid values than in earlier versions of MySQL. Precision math is based on two implementation changes:

These changes result in the following characteristics for numeric operations and provide improved compliance with standard SQL:

The following discussion covers several aspects of how precision math works, including possible incompatibilities with older applications. At the end, some examples are given that demonstrate how MySQL 5.0 handles numeric operations precisely. For information about controlling the SQL mode, see Section 5.1.7, “Server SQL Modes”.