12.18 Precision Math

12.18.1 Types of Numeric Values
12.18.2 DECIMAL Data Type Characteristics
12.18.3 Expression Handling
12.18.4 Rounding Behavior
12.18.5 Precision Math Examples

MySQL 5.1 provides support for precision math: numeric value handling that results in extremely accurate results and a high degree control over invalid values. Precision math is based on these two features:

These features have several implications for numeric operations and provide a high degree of 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 handles numeric operations precisely. For information about controlling the SQL mode, see Section 5.1.7, “Server SQL Modes”.