Figured this out, thanks.
Figured this out, thanks.
Last edited by Atticus89; 10-14-2016 at 09:09 PM.
Dividing by 0.5 is the same as multiplying by 2. Shouldn't you be dividing by 2 (or multiplying by 0.5)?
And if your base case returns 1 then that's the value that will be recursively divided by 2. Maybe try returning iniV since that's the value that you want to work on.
figured it out, thank you though.
I was returning 1 instead of the initial value for the base case. Also where I was multiplying the 1/2 when the recursive case was being done was outside when it should of been inside the passed parameters.
The dividing by two can be in either position, actually, although doing it to the function argument instead of the return value is more efficient since it allows tail recursion.
The actual problems are as I stated in my first post.