First page Back Continue Last page Graphics
Fractional Coefficients
- Question: How does one multiply by coefficients close to 1 (or less than 1) using integer arithmetic?
- a = -0.7265425280
- b = 1.6625077511
- Answer: Multiply the coefficients by 256 (shift by 1 byte), with the understanding that the least significant byte represents fractional component, with the 2nd byte representing integers
- a*256 = 185
- b*256 = 425
- Adding a byte is just an integer trick to add a byte of fractional precision
- Just remember to divide by 256 (or simply discard least significant byte) to recover whole integer answer after multiply with inflated coefficients!