exponential functions help.

ok so i'm trying to calculate the interest rate, and i keep getting an error when using pow.

the error states: more than one instance of overloaded function 'pow' matches
the argument list.

how do I fix this?

I'm including cmath, and e is initialized.
if(compounding_type == 'n' || compounding_type == 'N')
					exponent= log(total_amount/principal)/(times_compounded*time)-log(times_compounded);
					rate = pow(e,exponent);

e is an int probably. There are multiple overloads of pow (one takes a double, another takes a float, and another takes a long double). e can be cast into any one of these so the compiler does not know which one to choose. Try making it so e is one of double, float, or long double.
i had initialized e as a double
Then maybe the conflict is coming from exponent? If that's also a double (which I assumed it was) then there wouldn't be a problem. Can you post the rest of the code (including the initializations of rate, e, and exponent?

Casting should make the compiler error go away, regardless:

rate = pow( static_cast<double>(e), static_cast<double>(exponent) );
Last edited on
Topic archived. No new replies allowed.