Create complex power from a float

@param float $a operand
@param ComplexType $exp exponent

@return NI|ComplexType|FloatType
325692
private function floatComplexPow($a, ComplexType $exp)
    {
        if ($exp->isZero()) {
            return new FloatType(1);
        }
        return $this->complexExponent($a, $exp);
    }
528118
public Rational pow(int exponent) {
        if (exponent == 0) {
            return new Rational(1, 1);
        }
        BigInteger num = a.pow(Math.abs(exponent));
        BigInteger deno = b.pow(Math.abs(exponent));
        if (exponent > 0) {
            return (new Rational(num, deno));
        } else {
            return (new Rational(deno, num));
        }
    }
902834
public function intPow(IntType $a, NI $exp)
    {
        if ($exp instanceof RationalType) {
            $b = new RationalType(clone $a, new IntType(1));
            return $this->rationalPow($b, $exp);
        }

        if ($exp instanceof ComplexType) {
            return $this->intComplexPow($a(), $exp);
        }

        //int and float types
        $p = pow($a(), $exp());
        if (($p - intval($p)) === 0) {
            return new IntType($p);
        }

        return RationalTypeFactory::fromFloat($p);
    }
54375
public final function inherit(ExpressContext $context, ExpressionContextInterface $exp)
	{
		$this->context = $context;
		$this->exp = $exp;
	}
865178
protected function getPowExponentPartsFromPolar(ComplexType $a, ComplexType $exp)
    {
        $eReal = $exp->r()->get();
        $eImaginary = $exp->i()->get();
        $logr = log($a->modulus()->get());
        $theta = $a->theta()->get();
        $rho = exp($logr * $eReal - $eImaginary * $theta);
        $beta = $theta * $eReal + $eImaginary * $logr;

        return [$rho * cos($beta), $rho * sin($beta)];
    }
743640
function() {

      /**
       * exp(a + i*b) - 1
       = exp(a) * (cos(b) + j*sin(b)) - 1
       = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b)
       */

      var a = this['re'];
      var b = this['im'];

      return new Complex(
              Math.expm1(a) * Math.cos(b) + cosm1(b),
              Math.exp(a) * Math.sin(b));
    }
831315
public function rationalSqrt(RationalType $a)
    {
        $num = sqrt($a->numerator()->get());
        $den = sqrt($a->denominator()->get());
        return $this->rationalDiv(
            RationalTypeFactory::fromFloat($num),
            RationalTypeFactory::fromFloat($den)
        );
    }
104972
public function rationalSub(NI $a, NI $b)
    {
        list($a, $b) = $this->checkRationalTypes($a, $b);
        $d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()->get()));
        $nn = $this->rationalDiv($this->rationalMul($a->numerator(), $d), $a->denominator())->get();
        $nd = $this->rationalDiv($this->rationalMul($b->numerator(), $d), $b->denominator())->get();
        $n = $this->intSub(new IntType($nn), new IntType($nd));

        return RationalTypeFactory::create($n, $d->numerator());
    }
758129
@Pure
	@Inline(value="$1.pow($2)")
	public static BigDecimal operator_power(BigDecimal a, int exponent) {
		return a.pow(exponent);
	}
971593
public function power(int $exponent) : BigRational
    {
        if ($exponent === 0) {
            $one = BigInteger::one();

            return new BigRational($one, $one, false);
        }

        if ($exponent === 1) {
            return $this;
        }

        return new BigRational(
            $this->numerator->power($exponent),
            $this->denominator->power($exponent),
            false
        );
    }
467941
public ComplexFloat addi(float a, ComplexFloat result) {
    if (this == result) {
      r += a;
    } else {
      result.r = r + a;
      result.i = i;
    }
    return result;
  }
725069
public static double PowerSeries(double a, double b, double x) {
        double s, t, u, v, n, t1, z, ai;

        ai = 1.0 / a;
        u = (1.0 - b) * x;
        v = u / (a + 1.0);
        t1 = v;
        t = u;
        n = 2.0;
        s = 0.0;
        z = Constants.DoubleEpsilon * ai;
        while (Math.abs(v) > z) {
            u = (n - b) * x / n;
            t *= u;
            v = t / (a + n);
            s += v;
            n += 1.0;
        }
        s += t1;
        s += ai;

        u = a * Math.log(x);
        if ((a + b) < Gamma.GammaMax && Math.abs(u) < Constants.LogMax) {
            t = Gamma.Function(a + b) / (Gamma.Function(a) * Gamma.Function(b));
            s = s * t * Math.pow(x, a);
        } else {
            t = Gamma.Log(a + b) - Gamma.Log(a) - Gamma.Log(b) + u + Math.log(s);
            if (t < Constants.LogMin) s = 0.0;
            else s = Math.exp(t);
        }
        return s;
    }
996392
public static function mul($z, $w) {
        if (!($z instanceof Complex)) $z = static::parse($z);
        if (!($w instanceof Complex)) $w = static::parse($w);

        return static::create($z->x * $w->x - $z->y * $w->y, $z->x * $w->y + $z->y * $w->x);
    }
608942
@Override
	public Complex apply(Complex argument) {
		Complex iargument = argument.multiply(Complex.I);
		Complex exponent = iargument.add(1.0);
		Complex numerator = (new Complex(strike)).pow(exponent.subtract(1.0)).multiply(exponent);
		Complex denominator = (argument.multiply(argument)).subtract(iargument);

		return numerator.divide(denominator);
	}
262494
public static Number power(Number self, Number exponent) {
        double base, exp, answer;
        base = self.doubleValue();
        exp = exponent.doubleValue();

        answer = Math.pow(base, exp);
        if ((double) ((int) answer) == answer) {
            return (int) answer;
        } else if ((double) ((long) answer) == answer) {
            return (long) answer;
        } else {
            return answer;
        }
    }
610353
public static function POWER($x = 0, $y = 2)
    {
        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
        $y    = PHPExcel_Calculation_Functions::flattenSingleValue($y);

        // Validate parameters
        if ($x == 0.0 && $y == 0.0) {
            return PHPExcel_Calculation_Functions::NaN();
        } elseif ($x == 0.0 && $y < 0.0) {
            return PHPExcel_Calculation_Functions::DIV0();
        }

        // Return
        $result = pow($x, $y);
        return (!is_nan($result) && !is_infinite($result)) ? $result : PHPExcel_Calculation_Functions::NaN();
    }
795709
public static <A extends Number & Comparable<?>> NumberExpression<Double> power(Expression<A> num, int exponent) {
        return Expressions.numberOperation(Double.class, Ops.MathOps.POWER, num, ConstantImpl.create(exponent));
    }