Using pow();

Hey,

I'm trying to evaluate a value using power function.


double *pmech, *vf;
int nodes, i, j;
float capA = 0.0209, capB = 0.219;
pmech = dvector (1, nodes);

for (i=1; i<=nodes; i++) {
vf[i] = capA * pow(pmech[i],capB);
}



I'm basically trying to enter values into an array called 'vf'.
The expression being entered in is capA*pmech^capB.
(pmech here is an array as well)
But there is something wrong with 'pow' function here it seems.
I guess it doesn't like an array as a parameter.

Not sure what to do!

Thanks!
What are you errors? You haven't allocated memory for 'vf'.

There is also no situation where pow() expects and double base and float exponent.
Last edited on
Sorry, forgot to mention the error.

Error C2666: 'pow': 6 overloads have similar conversions

I actually do allocate the memory for vf, just forget to write it up there.

vf = dvector (1, nodes);

so you are saying pow should have either float or double, not both?
Thanks, I changed the capA and capB to double, and it works now.
Thank you.
Topic archived. No new replies allowed.