invalid operands to binary 'operator^'

Hi all together

I want to use this code:

gyro_pos_x = sin(angle_xz)/sqrt(1 + (cos(angle_xz)^2) + (tan(angle_yz)^2));

where gyro_pos_x, angle_xz and angle_yz are defined as float variables. Unfortunatly i get the error:

error: invalid operands of types 'double' and 'int' to binary 'operator^'

unfortunetly i can't find the mistake, because as far as i see, i'm not using any doubles or ints in there.

can someone help to find a solution? thanks!

'operator^' means bitwise xor, IIRC.

Assuming you mean 'raise to the second power' by '^2', you need to look at the pow() function. The '^' operator is for bitwise xor operations.

ah,thank you. i just assumend that this operation has to be the same in every language :smiley: thank you for the hint with pow, but since im just raising to second power, im not going to use the function pow() but do it by simple multiplying.

thanks!