Beginner Q: ^ = Math.Pow? (C#)
-
hi there, in my app i have to calculate a value using this syntax:
x = 2^(y / 2)
but^
ist a logical operator in c#. what could be meant? how would i calculate x if, for example y = 4,33984375? or does^
have a different meaning in this context (for example Math.Pow?). does anyone possibly understand what i'm after? any help is greatly appreciated./matthias
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams] -
hi there, in my app i have to calculate a value using this syntax:
x = 2^(y / 2)
but^
ist a logical operator in c#. what could be meant? how would i calculate x if, for example y = 4,33984375? or does^
have a different meaning in this context (for example Math.Pow?). does anyone possibly understand what i'm after? any help is greatly appreciated./matthias
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams]matthias s. wrote:
x = 2^(y / 2)
To what context your expression belong? I mean, if it is a Visual Basic (VB6) one, then it translates to the following C# equivalent:
x = Math.Pow(2, y / 2);
On the other hand, if the context is C#, it simply doesn't make sense. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
hi there, in my app i have to calculate a value using this syntax:
x = 2^(y / 2)
but^
ist a logical operator in c#. what could be meant? how would i calculate x if, for example y = 4,33984375? or does^
have a different meaning in this context (for example Math.Pow?). does anyone possibly understand what i'm after? any help is greatly appreciated./matthias
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams]Hi, Even I am not sure, what you want to achieve with that operator, but "^" is a logical exclusive - OR for binary type. Meaning the result will be true only if only one of the operand is true. "^" for the integral types (as above in your case) computes bitwise exclusive-OR of its operand. hence it will compare the each bit and apply exclusive-OR on each bits to find the last result.
Manoj Never Gives up
-
Hi, Even I am not sure, what you want to achieve with that operator, but "^" is a logical exclusive - OR for binary type. Meaning the result will be true only if only one of the operand is true. "^" for the integral types (as above in your case) computes bitwise exclusive-OR of its operand. hence it will compare the each bit and apply exclusive-OR on each bits to find the last result.
Manoj Never Gives up
Manoj Kumar Rai wrote:
but "^" is a logical exclusive - OR for binary type.
Actually for single bits.:)
Manoj Kumar Rai wrote:
"^" for the integral types (as above in your case) computes bitwise exclusive-OR of its operand. hence it will compare the each bit and apply exclusive-OR on each bits to find the last result.
He asked about doubles! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
hi there, in my app i have to calculate a value using this syntax:
x = 2^(y / 2)
but^
ist a logical operator in c#. what could be meant? how would i calculate x if, for example y = 4,33984375? or does^
have a different meaning in this context (for example Math.Pow?). does anyone possibly understand what i'm after? any help is greatly appreciated./matthias
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams]I expect that Math.Pow is what you want, but in some organizations you can get in trouble for thinking, so use the statement as told and shrug your shoulders when someone reports a bug.
-
hi there, in my app i have to calculate a value using this syntax:
x = 2^(y / 2)
but^
ist a logical operator in c#. what could be meant? how would i calculate x if, for example y = 4,33984375? or does^
have a different meaning in this context (for example Math.Pow?). does anyone possibly understand what i'm after? any help is greatly appreciated./matthias
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams]Hi Matthias, Try **. Just kidding :) Jeff