help with the pow() function

Quote:

> >> I am trying to use the pow() function but don;t have any information

> >> on how to use it with other functions, for example, I am trying to use

> >> it in a formula as below:

> >> This is a formula for present value:

> >> present value=future value divided by (1+interest per year divided by

> >> number of compounding periods)^nk

> >> I am using this in c to do the same thing:

> >> P=F/(1+i/k)*pow(n,k)

> This is (F / (1 + i/k))*n^k, but you want

> pow(F / (1 - i/k), n * k);

Please, the correct formula is:

P = F/(pow(1-(i/k),(n*k))

double P is Present Value

double F is Future Value

float i is the annual interest rate

int k is the number of compounding periods per year

int n is the number of years

Note: If the anual interest rate is 5%, i==0.05, not 5.0

(Note: I graduated with a 3.59{*filter*}in Accounting at U Mass and a 4.0{*filter*}

from the Military Accounting School at Fort Benjamin Harrison,

Indianapolis. I sometime have nightmares about these formulas. I will

never forgive you for reminding me about them.)

Quote:

> >> I can't get the formula above to calculate correctly. Am I doing

> >> something wrong here? I have to use the pow() for the n*k exponents.

> >1) Make sure that you have #include'd the <math.h> header file.

> Good advice

> >2) 'pow' takes two 'double's as arguments, and returns a 'double'.

> With a prototype for pow() in view, the necessary promotions should

> take place, shouldn't they?

> A source of some suspicion is the type of "i". If "i" happens to

> be an integer, the evaluation of the first argument of pow() will

> happen in an undesirable way.

> Kurt

Alicia Carla Longstreet

Wealth is not without its advantages

and the case to the contrary,

although it has often been made,

has never proved widely persuasive.

John Kenneth Galbraith

I just want the opportunity to prove the old adage...

"Money can't buy happieness."