Changes between Version 2 and Version 3 of IntroductionToFixedPointMath
 Timestamp:
 05/15/06 22:04:33 (13 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

IntroductionToFixedPointMath
v2 v3 227 227 Well, that all makes sense, but we're assuming that A and B are of the same fractional precision, and what if they're not? Now it's time to look at the "real" math of a fixed point division. Again, this is grade school stuff: 228 228 229 http://bookofhook.com/Images/Fixed_Point_Images/div_1.gif 230 229 231 What this says is that if you take two fixed point numbers of m and n fractional bits, and divide them, the quotient will be a value with mn fractional bits. With our previous example of 16.16 divided by a 16.16, that means 0 fractional bits, which is precisely what we got. If we want to have f fractional bits, we must scale the numerator by 2^f^(mn). Since of order operations matters when performing integer operations, we want to scale the numerator before we do the divide, so our final equation looks like: 230 232 233 http://bookofhook.com/Images/Fixed_Point_Images/div_2.gif 234 231 235 Order of operations matters, so actual evaluation would use the middle form, where the numerator is fully expanded before division. The far right form is just to show what the final result will look like. 232 236