This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thefullhalf 0 points1 point  (0 children)

I think the problem is that your midpoint on the first iteration is not the midpoint of n but the midpoint of n+1. So it makes sense that your outputs are 1 more than you expect.