Halve a real range, a fixed number of times.
transcript
The answer is a real number. There is no list to search. You can still halve.
The rate lies between zero and five percent. Try the middle. It reaches the target. Try a lower middle. It falls short. Keep the half that holds the answer.
A failed check moves lo to mid. There is no plus one. Real numbers have no next value.
Each round halves the range. Sixteen rounds are not enough for six places. A hundred rounds always are.
A double holds about fifteen digits. After about fifty six rounds, the ends touch. More rounds change nothing.
Stop at one millionth wide, and you lose. The answer comes out one too low. Stop below the gap between doubles, and the loop never ends.
At the end, lo sits a hair below the answer. The member needs a rate that reaches the target. So scale to millionths, and round up.
Halve a fixed number of times. Then round the right way. Full breakdown in the lecture.