You can also dol0calh05t wrote: basically the algo is:
let a be a q.fa fixed-point number, b a q.fb fixed-point number
to compute a/b:
a << fb
a / b (64 bit division)
deceptively simple right? but when actually implementing it, it get's real ugly.
of course if you dont care about precision, do the following (which is fast, and simple):
res = a / b (normal integer division)
res << fb
res = a * (1 / b)
By taking reciprocal of b first, using a fixed numerator you can control where the precision of the division is focused. so you can do..
res = a * (0x100000000 / b);
That way you are getting the absolute maximum range you can out of the 64/32 bit division. Then you can do the 32x32 bit multiply and shift that 64 bit result to remove the extra mantissa bits.
