View Single Post
Old 01-24-2013, 02:05 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Are you quite sure that the answer is not in fact 93.73? And that your formula is truly correct?

Simplified:-


Code:
function fvg() {
var p = 0;
var g = 10;
var i = 10;
var n = 10;
p = g * (1 / (i /100));
p = p - (n / (Math.pow((1 + (i/100)), n) - 1));
p = Math.round(p*100)/100;
alert (p);  // 93.73
}
As g occurs only in one line I do not see how it can be wrong if 3.73 is correct when g = 1.

Sampson was a strong man who let himself be led astray by a Jezebel, like Delilah. - Pupil's answer to Catholic Elementary School test.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
mosquitobite (01-25-2013)