If you're using doubles throughout, then you'll
want to use Math.Pow( x, tothepower );
If you're using integers throughout, you might
want to consider multiple multiplies.
However, this is probably not going to be an
'inefficient' part of your program, so using Pow()
will most likely suffice. My guess is that VB uses
Pow() under the covers anyway.
--
Grace + Peace,
Peter N Roth
Engineering Objects International
http://engineeringobjects.com
Home of Matrix.NET
"Stefan L" <sl****@pp-software.REMOVEIfNoSpam.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi NG,
I have the following problem:
Is there a way to use exponents in C#-code without converting to a double
and then use System.Math?
I have to convert VB-Code to C# and in VB its easy because you write:
y = 5 ^ x
meaning "Set y to 5 raised to the power of x"
I didn't find a similar operator for C#, because "^" is a XOR-Operator.
Am I blind or is there just no "easy" way to use exponents?
TIA,
Stefan