Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calculating Interest Payments  RSS feed

 
David Dickinson
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi folks,

The above code is supposedly capable of working out monthly interest charges. I have done my own calculation using "my" understanding of how to calculate interest and the two values differ.

I'm fairly sure this is calculating compound interest, but im still uncertain as to why the calculation is adding 1.0 to the interest rate and minusing 1.0 from the number of payments?



Any ideas?
 
Junilu Lacar
Sheriff
Posts: 11155
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The expression (-1.0 * 12) actually multiplies 12 by negative 1.0 which in your context results in a negative exponent
 
David Dickinson
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that.

So why you want to multiply the interest (plus 1 for some strange reason) by -12?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!