I've played around with the code and i think i know why you are getting a zero.
first of the statement:
$expon = pow($base, $exp);
outputs this: "INF", which i believe means INFINITE.
the reason that occurs is because the values
$base and $exp are ALWAYS negative.
I've also noticed that $exp always seems to product -360
note this:
if $exp is negative output ok
if $base is negative output ok
if $exp AND $base are negative out ok
this is true if i used whole numbers...
if $exp is a negative decimal with a negative $base i get an error.
otherwise is $exp is a negative decimal with a positive $base, no error.
i think your problem lies within the calculations... why the negatives? then it translates into the pow() issue.
I don't know mortgage, but there must be another way to calulate this.
hth.