Cybercrux

Everything is achievable through technology

PV Calculator

<!--

// Function to calculate present value of an investment..

// Parameters are rate, total number of periods, payment made each period, future value and type (when payments are due)

function pv(rate, per, nper, pmt, fv)

{

nper = parseFloat(nper);

pmt = parseFloat(pmt);

fv = parseFloat(fv);

rate = eval((rate)/(per * 100));

if (( pmt == 0 ) || ( nper == 0 )) {

alert(“Why do you want to test me with zeros?”);

return(0);

}

if ( rate == 0 ) // Interest rate is 0

{

pv_value = -(fv + (pmt * nper));

}

else

{

x = Math.pow(1 + rate, -nper);

y = Math.pow(1 + rate, nper);

pv_value = – ( x * ( fv * rate – pmt + y * pmt )) / rate;

}

pv_value = conv_number(pv_value,2);

return (pv_value);

}

function conv_number(expr, decplaces)

{ // This function is from David Goodman’s Javascript Bible.

var str = “” + Math.round(eval(expr) * Math.pow(10,decplaces));

while (str.length <= decplaces) {

str = “0” + str;

}

var decpoint = str.length – decplaces;

return (str.substring(0,decpoint) + “.” + str.substring(decpoint,str.length));

}

//

//

Advertisements

5 thoughts on “PV Calculator

  1. I simply couldn’t go away your web site before suggesting that I really enjoyed the usual info an individual supply to your guests? Is going to be back incessantly to inspect new posts

  2. I simply want to mention I am just beginner to blogs and seriously liked you’re web-site. Probably I’m want to bookmark your blog post . You amazingly come with perfect stories. Appreciate it for sharing with us your website.

  3. We have decided to open our POWERFUL and PRIVATE web traffic system to the public for a limited time! You can sign up for our UP SCALE network with a free trial as we get started with the public’s orders. Imagine how your bank account will look when your website gets the traffic it deserves. Visit us today: http://voxseo.com/traffic/

  4. What’s Going down i’m new to this, I stumbled upon this I have discovered It positively useful and it has helped me out
    loads. I’m hoping to contribute & help different users like its helped me. Good job.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s