Fixed-Point Blockset |
Padding with Trailing Zeros
Padding with trailing zeros involves extending the least significant bit (LSB) of a number with extra bits. This method involves going from low precision to higher precision.
For example, suppose two numbers are subtracted from each other. First, the exponents must be aligned, which typically involves a right shift of the number with the smaller value. In performing this shift, significant digits can "fall off" to the right. However, when the appropriate number of extra bits is appended, the precision of the result is maximized. Consider two 8-bit fixed-point numbers that are close in value and subtracted from each other
where q is an integer. To perform this operation, the exponents must be equal.
If the top number is padded by two zeros and the bottom number is padded with one zero, then the above equation becomes
which produces a more precise result. An example of padding with trailing zeros using the Fixed-Point Blockset is illustrated in Digital Controller Realization.
Rounding | Example: Limitations on Precision and Errors |