Subnormal numbers and underflow

The decimal floating-point data type has a set of non-zero numbers that fall outside the range of normal decimal floating-point values. These numbers are called subnormal.

Non-zero numbers whose adjusted exponents are less than Emin (-6143 for DECFLOAT(34) or -383 for DECFLOAT(16)), are called subnormal numbers. These subnormal numbers are accepted as operands for all operations and may result from any operation. If a result is subnormal before any rounding, the subnormal warning is returned.1

For a subnormal result, the minimum value of the exponent becomes Emin- (precision - 1), called Etiny, where precision is the precision of the decimal floating-point number. Hence, the smallest value of the exponent Etiny = -6176 for DECFLOAT(34) and -398 for DECFLOAT(16). As the exponent Etiny gets smaller, the number of digits available in the mantissa also decreases. The number of digits available in the mantissa for subnormal numbers is (precision - (- Etiny + Emin).

The result will be rounded, if necessary, to ensure that the exponent is no smaller than Etiny. If, during this rounding, the result becomes inexact, an underflow warning is returned.1 A subnormal result does not always return the underflow warning but will always return the subnormal warning.

When a number underflows to zero during a calculation, its exponent will be Etiny. The maximum value of the exponent is unaffected.

The maximum value of the exponent for subnormal numbers is the same as the minimum value of the exponent which can arise during operations that do not result in subnormal numbers. This occurs where the length of the coefficient in decimal digits is equal to the precision.

1 The warning is only returned if *YES is specified for the SQL_DECFLOAT_WARNINGS query option.