Average Error: 33.4 → 5.7
Time: 37.7s
Precision: binary64
Cost: 110344
\[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\ t_3 := \log \left(-x.im\right)\\ t_4 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{t_3 \cdot y.re - t_0} \cdot \cos \left(t_3 \cdot y.im + t_1\right)\\ \mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{t_4}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(\sqrt[3]{{t_2}^{2}}, y.im \cdot \sqrt[3]{t_2}, t_1\right)\right)}\right)}^{3}\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log t_4 - t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_0} \cdot \cos t_1\\ \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (*
  (exp
   (-
    (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
    (* (atan2 x.im x.re) y.im)))
  (cos
   (+
    (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)
    (* (atan2 x.im x.re) y.re)))))
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (atan2 x.im x.re) y.im))
        (t_1 (* y.re (atan2 x.im x.re)))
        (t_2 (log (hypot x.im x.re)))
        (t_3 (log (- x.im)))
        (t_4 (pow (hypot x.re x.im) y.re)))
   (if (<= x.im -8e-29)
     (* (exp (- (* t_3 y.re) t_0)) (cos (+ (* t_3 y.im) t_1)))
     (if (<= x.im -2.2e-180)
       (*
        (/ t_4 (pow (exp (atan2 x.im x.re)) y.im))
        (pow
         (cbrt (cos (fma (cbrt (pow t_2 2.0)) (* y.im (cbrt t_2)) t_1)))
         3.0))
       (if (<= x.im 7.8e+21)
         (exp (- (log t_4) t_0))
         (* (exp (- (* y.re (log x.im)) t_0)) (cos t_1)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	double t_1 = y_46_re * atan2(x_46_im, x_46_re);
	double t_2 = log(hypot(x_46_im, x_46_re));
	double t_3 = log(-x_46_im);
	double t_4 = pow(hypot(x_46_re, x_46_im), y_46_re);
	double tmp;
	if (x_46_im <= -8e-29) {
		tmp = exp(((t_3 * y_46_re) - t_0)) * cos(((t_3 * y_46_im) + t_1));
	} else if (x_46_im <= -2.2e-180) {
		tmp = (t_4 / pow(exp(atan2(x_46_im, x_46_re)), y_46_im)) * pow(cbrt(cos(fma(cbrt(pow(t_2, 2.0)), (y_46_im * cbrt(t_2)), t_1))), 3.0);
	} else if (x_46_im <= 7.8e+21) {
		tmp = exp((log(t_4) - t_0));
	} else {
		tmp = exp(((y_46_re * log(x_46_im)) - t_0)) * cos(t_1);
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	t_1 = Float64(y_46_re * atan(x_46_im, x_46_re))
	t_2 = log(hypot(x_46_im, x_46_re))
	t_3 = log(Float64(-x_46_im))
	t_4 = hypot(x_46_re, x_46_im) ^ y_46_re
	tmp = 0.0
	if (x_46_im <= -8e-29)
		tmp = Float64(exp(Float64(Float64(t_3 * y_46_re) - t_0)) * cos(Float64(Float64(t_3 * y_46_im) + t_1)));
	elseif (x_46_im <= -2.2e-180)
		tmp = Float64(Float64(t_4 / (exp(atan(x_46_im, x_46_re)) ^ y_46_im)) * (cbrt(cos(fma(cbrt((t_2 ^ 2.0)), Float64(y_46_im * cbrt(t_2)), t_1))) ^ 3.0));
	elseif (x_46_im <= 7.8e+21)
		tmp = exp(Float64(log(t_4) - t_0));
	else
		tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)) * cos(t_1));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Log[(-x$46$im)], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$im, -8e-29], N[(N[Exp[N[(N[(t$95$3 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$3 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, -2.2e-180], N[(N[(t$95$4 / N[Power[N[Exp[N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision], y$46$im], $MachinePrecision]), $MachinePrecision] * N[Power[N[Power[N[Cos[N[(N[Power[N[Power[t$95$2, 2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(y$46$im * N[Power[t$95$2, 1/3], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 7.8e+21], N[Exp[N[(N[Log[t$95$4], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]]]]]]]]]
e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_3 := \log \left(-x.im\right)\\
t_4 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\
\;\;\;\;e^{t_3 \cdot y.re - t_0} \cdot \cos \left(t_3 \cdot y.im + t_1\right)\\

\mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\
\;\;\;\;\frac{t_4}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(\sqrt[3]{{t_2}^{2}}, y.im \cdot \sqrt[3]{t_2}, t_1\right)\right)}\right)}^{3}\\

\mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\
\;\;\;\;e^{\log t_4 - t_0}\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t_0} \cdot \cos t_1\\


\end{array}

Error

Derivation

  1. Split input into 4 regimes
  2. if x.im < -7.99999999999999955e-29

    1. Initial program 38.2

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Taylor expanded in x.im around -inf 38.4

      \[\leadsto e^{\log \color{blue}{\left(-1 \cdot x.im + -0.5 \cdot \frac{{x.re}^{2}}{x.im}\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    3. Simplified38.4

      \[\leadsto e^{\log \color{blue}{\left(\frac{-0.5}{x.im} \cdot \left(x.re \cdot x.re\right) - x.im\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      Proof
      (-.f64 (*.f64 (/.f64 -1/2 x.im) (*.f64 x.re x.re)) x.im): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (/.f64 -1/2 x.im) (Rewrite<= unpow2_binary64 (pow.f64 x.re 2))) x.im): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate-/r/_binary64 (/.f64 -1/2 (/.f64 x.im (pow.f64 x.re 2)))) x.im): 8 points increase in error, 11 points decrease in error
      (-.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 -1/2 (pow.f64 x.re 2)) x.im)) x.im): 10 points increase in error, 4 points decrease in error
      (-.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -1/2 (/.f64 (pow.f64 x.re 2) x.im))) x.im): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 -1/2 (/.f64 (pow.f64 x.re 2) x.im)) (neg.f64 x.im))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1/2 (/.f64 (pow.f64 x.re 2) x.im)) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 x.im))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 x.im) (*.f64 -1/2 (/.f64 (pow.f64 x.re 2) x.im)))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in x.im around -inf 10.4

      \[\leadsto e^{\log \left(\frac{-0.5}{x.im} \cdot \left(x.re \cdot x.re\right) - x.im\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \color{blue}{\left(-1 \cdot x.im\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    5. Simplified10.4

      \[\leadsto e^{\log \left(\frac{-0.5}{x.im} \cdot \left(x.re \cdot x.re\right) - x.im\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \color{blue}{\left(-x.im\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      Proof
      (neg.f64 x.im): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 x.im)): 0 points increase in error, 0 points decrease in error
    6. Taylor expanded in x.im around inf 64.0

      \[\leadsto e^{\color{blue}{\left(\log -1 + -1 \cdot \log \left(\frac{1}{x.im}\right)\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    7. Simplified2.6

      \[\leadsto e^{\color{blue}{\log \left(-x.im\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      Proof
      (log.f64 (neg.f64 x.im)): 0 points increase in error, 0 points decrease in error
      (log.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 x.im))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> log-prod_binary64 (+.f64 (log.f64 -1) (log.f64 x.im))): 132 points increase in error, 0 points decrease in error
      (+.f64 (log.f64 -1) (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (log.f64 x.im))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (log.f64 -1) (neg.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (log.f64 x.im))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (log.f64 -1) (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 -1 (neg.f64 (log.f64 x.im))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (log.f64 -1) (*.f64 -1 (Rewrite<= log-rec_binary64 (log.f64 (/.f64 1 x.im))))): 0 points increase in error, 0 points decrease in error

    if -7.99999999999999955e-29 < x.im < -2.20000000000000013e-180

    1. Initial program 22.7

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Simplified10.9

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
      Proof
      (*.f64 (/.f64 (pow.f64 (hypot.f64 x.re x.im) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (cos.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (cos.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 59 points increase in error, 1 points decrease in error
      (*.f64 (/.f64 (Rewrite<= exp-to-pow_binary64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (cos.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 1 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)) (Rewrite<= exp-prod_binary64 (exp.f64 (*.f64 (atan2.f64 x.im x.re) y.im)))) (cos.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 5 points increase in error, 3 points decrease in error
      (*.f64 (Rewrite<= exp-diff_binary64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im)))) (cos.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 16 points decrease in error
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (fma.f64 (log.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im))))) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 88 points increase in error, 0 points decrease in error
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (fma.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im (Rewrite<= *-commutative_binary64 (*.f64 (atan2.f64 x.im x.re) y.re))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re))))): 0 points increase in error, 0 points decrease in error
    3. Applied egg-rr10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \color{blue}{{\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)}\right)}^{3}} \]
    4. Applied egg-rr37.0

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \color{blue}{\left({\left(e^{1}\right)}^{\log \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\right)}\right)}}\right)}^{3} \]
    5. Applied egg-rr10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{2}}, \sqrt[3]{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}}\right)}^{3} \]

    if -2.20000000000000013e-180 < x.im < 7.8e21

    1. Initial program 28.8

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Taylor expanded in y.im around 0 17.9

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in y.re around 0 18.0

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
    4. Applied egg-rr8.3

      \[\leadsto e^{\color{blue}{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]

    if 7.8e21 < x.im

    1. Initial program 41.7

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Taylor expanded in y.im around 0 22.7

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in x.re around 0 2.0

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification5.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{\log \left(-x.im\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(-x.im\right) \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(\sqrt[3]{{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{2}}, y.im \cdot \sqrt[3]{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\right)}^{3}\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error6.0
Cost90952
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_2 := \log \left(-x.im\right)\\ t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{t_2 \cdot y.re - t_1} \cdot \cos \left(t_2 \cdot y.im + t_0\right)\\ \mathbf{elif}\;x.im \leq -1 \cdot 10^{-251}:\\ \;\;\;\;\frac{t_3}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot {\left(\sqrt[3]{\cos \left({\left(\sqrt[3]{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.im, t_0\right)}\right)}^{3}\right)}\right)}^{3}\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log t_3 - t_1}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_1} \cdot \cos t_0\\ \end{array} \]
Alternative 2
Error5.7
Cost78024
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_2 := \log \left(-x.im\right)\\ t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{t_2 \cdot y.re - t_1} \cdot \cos \left(t_2 \cdot y.im + t_0\right)\\ \mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{t_3}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log t_3 - t_1}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_1} \cdot \cos t_0\\ \end{array} \]
Alternative 3
Error5.7
Cost65224
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_2 := \log \left(-x.im\right)\\ t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{t_2 \cdot y.re - t_1} \cdot \cos \left(t_2 \cdot y.im + t_0\right)\\ \mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{t_3}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right)\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log t_3 - t_1}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_1} \cdot \cos t_0\\ \end{array} \]
Alternative 4
Error5.7
Cost52232
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_2 := \log \left(-x.im\right)\\ t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -8 \cdot 10^{-29}:\\ \;\;\;\;e^{t_2 \cdot y.re - t_1} \cdot \cos \left(t_2 \cdot y.im + t_0\right)\\ \mathbf{elif}\;x.im \leq -2.2 \cdot 10^{-180}:\\ \;\;\;\;\frac{t_3}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log t_3 - t_1}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_1} \cdot \cos t_0\\ \end{array} \]
Alternative 5
Error6.6
Cost45636
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;y.re \leq -1.6102153549819343 \cdot 10^{-12}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+57}:\\ \;\;\;\;e^{-t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \end{array} \]
Alternative 6
Error6.0
Cost39748
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_1 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{if}\;y.re \leq -1.6102153549819343 \cdot 10^{-12}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t_1\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+57}:\\ \;\;\;\;e^{-t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error5.9
Cost33028
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq -1 \cdot 10^{-39}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(-x.re\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - t_0}\\ \end{array} \]
Alternative 8
Error5.8
Cost32964
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.im \leq 7.8 \cdot 10^{+21}:\\ \;\;\;\;e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \end{array} \]
Alternative 9
Error6.5
Cost32512
\[e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \]
Alternative 10
Error6.0
Cost26760
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_1 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{if}\;y.re \leq -1.6102153549819343 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+57}:\\ \;\;\;\;e^{-t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error7.1
Cost13384
\[\begin{array}{l} \mathbf{if}\;y.re \leq -1.6102153549819343 \cdot 10^{-12}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 4 \cdot 10^{+121}:\\ \;\;\;\;e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;{x.re}^{y.re}\\ \end{array} \]
Alternative 12
Error16.8
Cost12992
\[{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \]
Alternative 13
Error22.9
Cost7320
\[\begin{array}{l} t_0 := {\left(-x.im\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -7 \cdot 10^{-35}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq -2.7 \cdot 10^{-152}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{elif}\;x.im \leq -1.8 \cdot 10^{-250}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 1.16 \cdot 10^{-271}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{elif}\;x.im \leq 3.15 \cdot 10^{-192}:\\ \;\;\;\;{x.im}^{y.re}\\ \mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-18}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;{x.im}^{y.re}\\ \end{array} \]
Alternative 14
Error23.1
Cost7320
\[\begin{array}{l} t_0 := {\left(-x.im\right)}^{y.re}\\ \mathbf{if}\;x.im \leq -7 \cdot 10^{-35}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq -2.7 \cdot 10^{-152}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{elif}\;x.im \leq -1.8 \cdot 10^{-250}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 1.7 \cdot 10^{-266}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{elif}\;x.im \leq 1.95 \cdot 10^{-186}:\\ \;\;\;\;{\left(-x.re\right)}^{y.re}\\ \mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-18}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;{x.im}^{y.re}\\ \end{array} \]
Alternative 15
Error29.0
Cost6924
\[\begin{array}{l} \mathbf{if}\;x.im \leq 1.16 \cdot 10^{-271}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{elif}\;x.im \leq 3.15 \cdot 10^{-192}:\\ \;\;\;\;{x.im}^{y.re}\\ \mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-18}:\\ \;\;\;\;{x.re}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;{x.im}^{y.re}\\ \end{array} \]
Alternative 16
Error34.1
Cost6528
\[{x.re}^{y.re} \]

Error

Reproduce

herbie shell --seed 2022296 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  :precision binary64
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))