View Single Post
 01-24-2013, 01:10 PM PM User | #1 mosquitobite New to the CF scene   Join Date: Jan 2013 Posts: 4 Thanks: 2 Thanked 1 Time in 1 Post Translating math formula JavaScript Help Greetings I am currently in the process of learning javascript and been working on working on this small simple project that calculates economic formula instantly. I managed to get 7 out of 8 formula to work but got stuck on the last one. I was wondering if some could please show me what I did wrong or how to fix my errors. I will post the formula below. Formula is Finding Future Value (F) given Gradient Value (G), Interest (I), and year (N). F / G: = 1 / N - N / (1 + I)^N - 1 My Problem is when I added value G = 10, I = 10, N =10 I get a result of 93.73 which is wrong. Where i calculate 37.31 as correct. When I do G =1, I = 10, N = 10. I get a result of 3.73, which is correct. Regardless of what I do I can't seem to fix it. Any help and advice is very appreciated. Thank you very much. Code: ```function fvg () { power = document.form.gradient.value * (1 / (document.form.rate.value / 100)) - (document.form.year.value) / (Math.pow((1 + (document.form.rate.value / 100)), document.form.year.value) - 1); document.form.amount.value = Math.round(power * 100) / 100; document.form.interest.value = Math.round((document.form.amount.value - document.form.gradient. value) * 100) / 100; }``` Last edited by mosquitobite; 01-24-2013 at 01:18 PM..