Page 1 of 1

'expression must have integral type' error

Posted: Sun Jan 22, 2012 6:38 am
by composer
When I try to compile the folowing code(part of code is given) I get the error 'expression must have integral type'.Does anyone have the idea why is this happening?

float u;
float e;
float e0;
float ep;
float u1;
float f1;
float f2;
float Kp;
float b;
float Td;

f2 = f2 + (abs((e + ep)*(1/2)))^(2/3);
u = u1 + b*(Kp*(e-e0) + f2*f1*3*Kp*(e0)^(1/3)/Td);

Re: 'expression must have integral type' error

Posted: Sun Jan 22, 2012 9:22 am
by UhClem
^ is exclusive or in C, not power. For that you need to use pow(x,y) instead of x^y

Re: 'expression must have integral type' error

Posted: Sun Jan 22, 2012 11:21 am
by composer
thank you very much, now works just fine.