Hi I need to implement a function $a+b\cdot 2^x$ in a highly resource constrained device. a and b are constants and x is a variable. How do I go about finding a simplified version of this expression so that I can get a value almost equal to it, without having to do multiplication, division or exponentiation? the result does not have to be exact, and I can find the new values for a and b empirically. Please help. Thank you
PS: please suggest some new tags for this question, I cannot think of any that are available currently
Here's one way of doing it (in C).
LOG2_Bis $\log_2b$.0.5is to make it round to the nearest int, instead of the flooring. The conversion toint, though, required to do the bit shift, might cause an unacceptable loss of precision.A + 2 << (int)(LOG2_B + x + 0.5)Here's a plot of the function (blue) and the above approximation (red) for $a=0, b=1$: