I am having a tough time tracking down the radix point for this following Horner's rule using fixed point arithmetic.
int16_t horner(int16_t q)
{
const int16_t c0 = 0x0033;
const int16_t c1 = 0x0055;
const int16_t c2 = 0x001C;
const int16_t c3 = 0x0048;
const int16_t c4 = 0x0200;
horner_rule = c0 + q * (c1 - q * (c2 + q * (c3 - q * c4)));
return horner_rule;
}
Where c0, c1, etc. are different 16-bit signed coefficients, q is the value that I would like to evaluate at (q is taken as an input and shifted to 16-bit signed format). All these values are already shifted into signed 16-bit format. I have implemented this in floating point arithmetic and it just works fine.
My question is, how shall I proceed to get my desired value maintaining the radix point and keeping the overflow in control?