Tool/software:
I'm trying to simulate some IQmath operations in Python. I've noticed that _Q15div(0x003c, 0xff88) doesn't result in 0xc000, but rather 0xc001. The correct answer is -0.5 (0xc000), but the division returns -0.499969482421875 (0xc001). I noticed an accuracy table in the IQmath pdf of 14 bits for _QNdiv whichmay be the reason for the difference. I'd like to know:
* Is the -0.4999 answer correct for the library? or should it be -0.5? i.e. is it a bug?
* Is there a way to do this math in Python (or other high level language) to come to the same result? If I divide 60 (0x003c) by -120 (0xff88), I get -0.5.
My goal is to simulate the firmware in Python. It really doesn't matter too much to my code if the math is a little inaccurate, but I do need to simulate that (which is harder to do).
Thank you.