# Quick question about invalid operands!

• 12-03-2007
chocobo59
Working on a program right now but I left my book at home so I can't look this up. Does anyone know how to fix this off the top of their head? I was thinking about using 'atoi' but I can't remember how it works exactly.

"invalid operands of types `double' and `double' to binary `operator^' "

is what is says to me. :[
• 12-03-2007
MacGyver
^ is bitwise XOR, which I imagine you may have been thinking is the way to raise a number to an arbitrary power. If that is the case, use the pow() function in math.h.

atoi() has nothing to do with this, and is a rather silly suggestion. Don't confuse strings with math or bitwise operations.

If you are trying to bitwise XOR two doubles, whatever you're doing is probably very weird and wrong.
• 12-03-2007
Elysia
Simple.
Code:

```        float f1 = 1.0f, f2 = 2.0f, f3;         double d1 = 1, d2 = 2, d3;         int i1 = 1, i2 = 2, i3;         f3 = f1 | f2; // C2296 and C2297         d3 = d1 | d2; // C2296 and C2297         i3 = i1 | i2;         f3 = f1^f2; // C2296 and C2297         d3 = d1^d2; // C2296 and C2297         i3 = i1^i3;```
Why you ask? Type must be an integer, not a floating point.
• 12-03-2007
tabstop
I don't think operator^ is what you think it is, unless you want to bitwise-XOR two doubles together. atoi takes a string and returns the integer it represents.

I'm guessing you want to raise to a power? If so, use pow().