# AS3 doesn't like my formula

**URL:** <https://forum.kirupa.com/t/as3-doesnt-like-my-formula/320727>\
**Category:** flash\
**Created:** [March 31, 2011, 1:27pm UTC](https://forum.kirupa.com/t/as3-doesnt-like-my-formula/320727 "2011-03-31T13:27:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adenicol](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@adenicol](https://forum.kirupa.com/u/adenicol)\
**Post date:** [March 31, 2011, 1:27pm UTC](https://forum.kirupa.com/t/as3-doesnt-like-my-formula/320727/1 "2011-03-31T13:27:36Z")

</div>

I am trying to code a loan calculator into Flash, however AS3 doesn’t like my formula and won’t calculate it, can someone help? Here is what I have:

loan=15000  
apr=13  
term=48

var loan\_amount = (apr + (apr / (Math.pow(trm, (1 + apr)) -1 ))) \* loan;

When I print out the loan\_amount I get a 0.

If I do: var loan\_amount = (Math.pow(trm, (1 + apr)) -1); it will give me the result 1.0331079714165e55

As soon as I add the next part of the equation (apr / (Math.pow(trm, (1 + apr)) -1 )); it will give me the actual apr value as the result instead of the apr divided by the 1.0331079714165e55.

Likewise, if I try to add a fixed value instead of the apr variable, it will return that fixed value instead of doing the math.

Can anyone help me with getting this to work?

Thanks!  
Anthony
