I need to assign a value 'n' using the equation n=2^k however I'm not sure how to write this in using c++ cause it is not covered with general cmath. I tried using n=pow(2,k) but I am getting an overloading error.
thank you very much that seemed to work, I'm just having one more problem now and that is I'm trying to use a do-while loop in which the while statement is while (!fabs(tk-tkMinusOne)<=0.000001); however when it comes to the important term it is not terminating and is still looping. The value of tk and tkMinusOne for the function which should make it terminate are:
tk=0.693147
tkMinusOne=0.693148
I ran the debugger and checked the values of the functions and they are what they are supposed to be (with about 30 more unnecessary decimal places). Am I missing something in the while loop statement? Is there a way to limit the doubled values of tk and tkMinusOne?