1.11M Members

invalid operands to binary ^ (have ‘float’ and ‘float’)

 
0
 
double a,b;
printf("%f",a^b);

error occurs as shown in heading.
any alternative method?

 
1
 

Before looking for ways to do this, maybe you should consider why you want to do it in the first place. Bitwise operations not working on floating-point isn't much of an issue because most of the time it's nonsensical.

 
0
 

by a^b i mean 'a raised to b' (bth power of a). not bitwise operations.

 
1
 

Where you got the idea ^ means raised to the power in C is a great question.

Belaying that, look in the math.h header for the function pow()

 
0
 

thanks... i was converting matlab to c. so didnt notice...

Question Answered as of 3 Years Ago by Narue and WaltP
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: