Setting the Rounding Mode (Digital Filter Design Toolkit)
Fixed-point numbers represent discrete values with limited precision. Typically, the precision of fixed-point numbers is less than that of floating-point numbers. Rounding determines the most appropriate fixed-point number to represent a specified floating-point value based on the precision you specify. Use one of the following modes to specify how you want rounding to occur in a quantizer.
- Nearest—The nearest mode rounds to the closest representable number. If the two nearest representable numbers are an equal distance apart, this mode rounds to the nearest representable number whose least significant bit is 0. The rounding error of this mode is zero-mean, but this mode has higher implementation complexity than the Truncation mode due to the computation of choosing the closest representable number.
- Truncation—The truncation mode rounds to the closest representable number less than the original value. This mode is the most common rounding mode in hardware. However, the rounding error of this mode has a nonzero mean.
Use the rounding mode input of the Fixed-Point Tools VIs to set an appropriate rounding option.