i am sure many of you deal with the calculation of interest.
my head is tried of thinking of detailed calculation right now, but if i am not mistaken, the above code can produce an excellent way of calculating interest to pay if interest is paid based on a monthly basis.
when calculation is based on days that have already passed this is not problem for interest to be calculated.
but when your schedule to calculate interest is not regular this can be a problem and this program could be used for such means.
here is an example.
let's say i owe you money of 1000 and interest is 12 percent a year.
and i pay you monthly but i also need a way to pay you for some period that is shorter than a month, an example would be if i paid you off before the end of the next month. also lets say i do not have a way to keep track of compounding periods other than one year.
by using and comparing the both months and days returned in the two routines i can choose the right month and days for calculating interest.
if my logic is correct, i would compare the first months results with the second month results, if the first figure is equal to the second, use the first results for calculating interest, if the first figure is less than the second figure, use the second results for calculating interest.
paul
my head is tried of thinking of detailed calculation right now, but if i am not mistaken, the above code can produce an excellent way of calculating interest to pay if interest is paid based on a monthly basis.
when calculation is based on days that have already passed this is not problem for interest to be calculated.
but when your schedule to calculate interest is not regular this can be a problem and this program could be used for such means.
here is an example.
let's say i owe you money of 1000 and interest is 12 percent a year.
and i pay you monthly but i also need a way to pay you for some period that is shorter than a month, an example would be if i paid you off before the end of the next month. also lets say i do not have a way to keep track of compounding periods other than one year.
by using and comparing the both months and days returned in the two routines i can choose the right month and days for calculating interest.
if my logic is correct, i would compare the first months results with the second month results, if the first figure is equal to the second, use the first results for calculating interest, if the first figure is less than the second figure, use the second results for calculating interest.
paul
Comment