IFNULL and Decimal Data
If both arguments to an IFNULL function are decimal, the data type of the result returned is decimal, and the precision (total number of digits) and scale (number of digits to the right of the decimal point) of the result is determined as follows:
• Precision—The largest number of digits to the left of the decimal point (precision - scale) plus largest scale (to a maximum of 39)
• Scale—The largest scale