title: Coding loan repayment period formula in Java
body: <p>I have the formula as followed:</p>
  
  <p>n = ln(A/(A-Pi))/ln(1 + i)</p>
  
  <p>Where A=7500  and P= 50000 and i=0.05</p>
  
  <p>I tried to code this in Java with:
  when i output this, it states : "NaN"
  .kindly advise on how to improve on my code</p>
  
  <pre><code>public void loanFormula() {
  n = -(Math.log(A/(A - (P * i))) /-(Math.log(1 + i));
  {
  </code></pre>