Math function help
-
Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code:
double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;
BINARY -- modified at 3:22 Monday 31st October, 2005 -
Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code:
double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;
BINARY -- modified at 3:22 Monday 31st October, 2005 -
Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code:
double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;
BINARY -- modified at 3:22 Monday 31st October, 2005Hi, What do mean saying that N is exponent? Do you mean e^N or x^n? Where have declared the rest of variables; mrate, n, l? double mrate = some_initial_value; double l = some_initial_value; double n = some_initial_value; Anyway, if you mean e^N, the code might look like so:
double payment = (mrate * (1 + mrate) * exp(n) / ((1 + mrate) * exp(n) - 1)) * l;
If you mean x^N:double payment = pow(mrate * (1 + mrate), n) / (pow((1 + mrate), n) - 1) * l;
-- ====== Arman -
Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code:
double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;
BINARY -- modified at 3:22 Monday 31st October, 2005Binary0110 wrote:
...but I keep getting errors.
Such as?
Binary0110 wrote:
double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;
Make sure the numeric constants are floating point values, like:
double payment=(mrate*(1.0+mrate)* exp (n)/((1.0+mrate)* exp(n)-1.0))*l;
"Take only what you need and leave the land as you found it." - Native American Proverb