Jul-19-2018, 01:37 AM
(This post was last modified: Jul-19-2018, 01:37 AM by ichabod801.)
Line 15 is resetting balance to 100 at the end of every loop, so it can never reach 0.
Edit: I ran a test without that and you are still going to have problems. Balance passes zero and goes way down, never reaching 0 exactly. You might want to test if the balance is close enough (like less than a penny from 0). Also, in a bisectional search you are changing the upper or lower bound and picking the middle repeatedly. You're not changing the bounds, just the monthly payment. And once the balance gets to zero, line 14 continually increase the monthly payment.
Edit: I ran a test without that and you are still going to have problems. Balance passes zero and goes way down, never reaching 0 exactly. You might want to test if the balance is close enough (like less than a penny from 0). Also, in a bisectional search you are changing the upper or lower bound and picking the middle repeatedly. You're not changing the bounds, just the monthly payment. And once the balance gets to zero, line 14 continually increase the monthly payment.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures