y ^ 0 = y?

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

I'm writing a web application in c#, and noticed that any number
raised to the 0th power results in the number being returned... Am I
right in that y ^ 0 = 1????

Is this a bug?

Bruce
 
Hi Bruce,

In c# operation ^ is bitwise XOR not power operation
So yes *any nuber* XORed with 0 is the number itself.
C# as many other languages doesn't have operation for powers of number.

HTH
B\rgds
100
 
Bruce,
To raise a number to a power, you need to use System.Math.Pow. Watch the
order of the parameters, its easy to get them backwards ;-)

As 100 pointed out ^ is the Xor operator in C#.

Hope this helps
Jay
 
Doh! That's what I get for switching languages! Thanks for the help!!

Uhhh....errrr...which language we you coming from?
The ^ operator does the same thing (XOR) in C.
In Delphi it is a pointer declarator/dereferencer.

Just curious.

Oz
 
ozbear said:
Uhhh....errrr...which language we you coming from?
The ^ operator does the same thing (XOR) in C.
In Delphi it is a pointer declarator/dereferencer.

Just curious.

Oz

it's VB, don't you remember there is such language? :)))
 
Yep. That would be it (vb), or actually a lot of vbscript lately, then
back to c#.

Bruce
 
Back
Top