Or just:

                  if (Math.Truncate(c) == c && d == 0 && c >= 0)

                  {

                        return this.pow((int)c);

                  }

 

Where you uncomment some better code already provided, and adjust:

            internal Complex64 pow(int power)

            {

                  if (power == 0) return new Complex64(1, 0);

                  if (power < 0) throw new ArgumentOutOfRangeException("power", power, "power must be >= 0");

                  Complex64 factor = this;

                  Complex64 result = new Complex64(1, 0); //!!! want a mutable here for efficiency

                  while (power != 0)

                  {

                        if ((power & 1) != 0) result = result * factor;

                        factor = factor * factor;

                        power >>= 1;

                  }

                  return result;

            }

-----

Keith J. Farmer

[EMAIL PROTECTED]

 

_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to