powComplex, real part

Percentage Accurate: 40.8% → 81.9%
Time: 15.8s
Alternatives: 8
Speedup: 1.6×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
   (*
    (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
    (cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
    code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))
	return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 40.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
   (*
    (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
    (cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
    code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))
	return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}

Alternative 1: 81.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \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(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_3 := e^{t_2 \cdot y.re - t_0}\\ t_4 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ \mathbf{if}\;t_3 \cdot \cos \left(t_2 \cdot y.im + t_1\right) \leq \infty:\\ \;\;\;\;t_3 \cdot \sqrt{{\cos \left(\mathsf{fma}\left(y.im, t_4, t_1\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot t_4 - t_0} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \end{array} \end{array} \]
(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 (sqrt (+ (* x.re x.re) (* x.im x.im)))))
        (t_3 (exp (- (* t_2 y.re) t_0)))
        (t_4 (log (hypot x.re x.im))))
   (if (<= (* t_3 (cos (+ (* t_2 y.im) t_1))) INFINITY)
     (* t_3 (sqrt (pow (cos (fma y.im t_4 t_1)) 2.0)))
     (* (exp (- (* y.re t_4) t_0)) (cos (* y.im (log (hypot x.im x.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(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_3 = exp(((t_2 * y_46_re) - t_0));
	double t_4 = log(hypot(x_46_re, x_46_im));
	double tmp;
	if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
		tmp = t_3 * sqrt(pow(cos(fma(y_46_im, t_4, t_1)), 2.0));
	} else {
		tmp = exp(((y_46_re * t_4) - t_0)) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
	}
	return tmp;
}
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(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	t_3 = exp(Float64(Float64(t_2 * y_46_re) - t_0))
	t_4 = log(hypot(x_46_re, x_46_im))
	tmp = 0.0
	if (Float64(t_3 * cos(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf)
		tmp = Float64(t_3 * sqrt((cos(fma(y_46_im, t_4, t_1)) ^ 2.0)));
	else
		tmp = Float64(exp(Float64(Float64(y_46_re * t_4) - t_0)) * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))));
	end
	return tmp
end
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[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[Sqrt[N[Power[N[Cos[N[(y$46$im * t$95$4 + t$95$1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * t$95$4), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\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(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{t_2 \cdot y.re - t_0}\\
t_4 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;t_3 \cdot \cos \left(t_2 \cdot y.im + t_1\right) \leq \infty:\\
\;\;\;\;t_3 \cdot \sqrt{{\cos \left(\mathsf{fma}\left(y.im, t_4, t_1\right)\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot t_4 - t_0} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.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 (+.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)))) < +inf.0

    1. Initial program 74.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. Step-by-step derivation
      1. fma-def74.8%

        \[\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 \cos \color{blue}{\left(\mathsf{fma}\left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)} \]
      2. hypot-udef74.8%

        \[\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 \cos \left(\mathsf{fma}\left(\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \]
      3. *-commutative74.8%

        \[\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 \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \]
      4. add-sqr-sqrt46.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}{\left(\sqrt{\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)} \cdot \sqrt{\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)}\right)} \]
      5. sqrt-unprod79.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}{\sqrt{\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) \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)}} \]
      6. pow279.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 \sqrt{\color{blue}{{\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)}^{2}}} \]
      7. fma-udef79.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 \sqrt{{\cos \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}}^{2}} \]
      8. *-commutative79.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 \sqrt{{\cos \left(\color{blue}{y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)} + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}^{2}} \]
      9. *-commutative79.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 \sqrt{{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) + \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)}^{2}} \]
      10. fma-def79.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 \sqrt{{\cos \color{blue}{\left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}}^{2}} \]
    3. Applied egg-rr79.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}{\sqrt{{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}^{2}}} \]

    if +inf.0 < (*.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 (+.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))))

    1. Initial program 0.0%

      \[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. Step-by-step derivation
      1. Simplified81.8%

        \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot 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)} \]
      2. Step-by-step derivation
        1. add-sqr-sqrt41.6%

          \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\sqrt{\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)} \cdot \sqrt{\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)} \]
        2. pow241.6%

          \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\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)}^{2}\right)} \]
        3. fma-udef41.6%

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

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

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

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

        \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{2}\right)} \]
      4. Taylor expanded in y.re around 0 0.0%

        \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      5. Step-by-step derivation
        1. unpow20.0%

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;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 + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \leq \infty:\\ \;\;\;\;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 \sqrt{{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \end{array} \]

    Alternative 2: 81.5% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{if}\;y.im \leq 2 \cdot 10^{-101}:\\ \;\;\;\;t_0 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0
             (exp
              (- (* y.re (log (hypot x.re x.im))) (* (atan2 x.im x.re) y.im)))))
       (if (<= y.im 2e-101)
         (* t_0 (cos (* y.im (log (hypot x.im x.re)))))
         (* t_0 (cos (* y.re (atan2 x.im x.re)))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im)));
    	double tmp;
    	if (y_46_im <= 2e-101) {
    		tmp = t_0 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
    	} else {
    		tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re)));
    	}
    	return tmp;
    }
    
    public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
    	double tmp;
    	if (y_46_im <= 2e-101) {
    		tmp = t_0 * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
    	} else {
    		tmp = t_0 * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	t_0 = math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
    	tmp = 0
    	if y_46_im <= 2e-101:
    		tmp = t_0 * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re))))
    	else:
    		tmp = t_0 * math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
    	return tmp
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
    	tmp = 0.0
    	if (y_46_im <= 2e-101)
    		tmp = Float64(t_0 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))));
    	else
    		tmp = Float64(t_0 * cos(Float64(y_46_re * atan(x_46_im, x_46_re))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im)));
    	tmp = 0.0;
    	if (y_46_im <= 2e-101)
    		tmp = t_0 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
    	else
    		tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re)));
    	end
    	tmp_2 = tmp;
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, 2e-101], N[(t$95$0 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
    \mathbf{if}\;y.im \leq 2 \cdot 10^{-101}:\\
    \;\;\;\;t_0 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.im < 2.0000000000000001e-101

      1. Initial program 39.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. Step-by-step derivation
        1. Simplified82.5%

          \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot 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)} \]
        2. Step-by-step derivation
          1. add-sqr-sqrt37.2%

            \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\sqrt{\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)} \cdot \sqrt{\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)} \]
          2. pow237.2%

            \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\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)}^{2}\right)} \]
          3. fma-udef37.2%

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

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

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

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

          \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{2}\right)} \]
        4. Taylor expanded in y.re around 0 39.8%

          \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
        5. Step-by-step derivation
          1. unpow239.8%

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

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

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

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

        if 2.0000000000000001e-101 < y.im

        1. Initial program 33.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. Step-by-step derivation
          1. Simplified69.8%

            \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot 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)} \]
          2. Step-by-step derivation
            1. add-sqr-sqrt43.6%

              \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\sqrt{\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)} \cdot \sqrt{\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)} \]
            2. pow243.6%

              \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\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)}^{2}\right)} \]
            3. fma-udef43.6%

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

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

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

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

            \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{2}\right)} \]
          4. Taylor expanded in y.im around 0 76.8%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq 2 \cdot 10^{-101}:\\ \;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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} \]

        Alternative 3: 79.5% accurate, 1.4× speedup?

        \[\begin{array}{l} \\ e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (*
          (exp (- (* y.re (log (hypot x.re x.im))) (* (atan2 x.im x.re) y.im)))
          (cos (* y.re (atan2 x.im x.re)))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	return exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re)));
        }
        
        public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	return Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	return math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	return Float64(exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_re * atan(x_46_im, x_46_re))))
        end
        
        function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re)));
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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}
        
        Derivation
        1. Initial program 37.4%

          \[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. Step-by-step derivation
          1. Simplified78.3%

            \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot 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)} \]
          2. Step-by-step derivation
            1. add-sqr-sqrt39.3%

              \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\sqrt{\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)} \cdot \sqrt{\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)} \]
            2. pow239.3%

              \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\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)}^{2}\right)} \]
            3. fma-udef39.3%

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

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

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

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

            \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}\right)}^{2}\right)} \]
          4. Taylor expanded in y.im around 0 78.5%

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

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

          Alternative 4: 43.6% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{if}\;x.im \leq -9.2 \cdot 10^{+151}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\ \mathbf{elif}\;x.im \leq -1.26 \cdot 10^{-306}:\\ \;\;\;\;t_1 \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\ \end{array} \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (let* ((t_0 (* y.re (atan2 x.im x.re)))
                  (t_1 (exp (* (atan2 x.im x.re) (- y.im)))))
             (if (<= x.im -9.2e+151)
               (* t_1 (cos (+ t_0 (* y.im (log x.re)))))
               (if (<= x.im -1.26e-306)
                 (* t_1 (cos (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)))
                 (* t_1 (cos (+ t_0 (* y.im (log x.im)))))))))
          double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	double t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -9.2e+151) {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	} else if (x_46_im <= -1.26e-306) {
          		tmp = t_1 * cos((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im));
          	} else {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	}
          	return tmp;
          }
          
          real(8) function code(x_46re, x_46im, y_46re, y_46im)
              real(8), intent (in) :: x_46re
              real(8), intent (in) :: x_46im
              real(8), intent (in) :: y_46re
              real(8), intent (in) :: y_46im
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = y_46re * atan2(x_46im, x_46re)
              t_1 = exp((atan2(x_46im, x_46re) * -y_46im))
              if (x_46im <= (-9.2d+151)) then
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46re))))
              else if (x_46im <= (-1.26d-306)) then
                  tmp = t_1 * cos((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46im))
              else
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46im))))
              end if
              code = tmp
          end function
          
          public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
          	double t_1 = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -9.2e+151) {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_re))));
          	} else if (x_46_im <= -1.26e-306) {
          		tmp = t_1 * Math.cos((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im));
          	} else {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_im))));
          	}
          	return tmp;
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	t_0 = y_46_re * math.atan2(x_46_im, x_46_re)
          	t_1 = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
          	tmp = 0
          	if x_46_im <= -9.2e+151:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_re))))
          	elif x_46_im <= -1.26e-306:
          		tmp = t_1 * math.cos((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im))
          	else:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_im))))
          	return tmp
          
          function code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
          	t_1 = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))
          	tmp = 0.0
          	if (x_46_im <= -9.2e+151)
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_re)))));
          	elseif (x_46_im <= -1.26e-306)
          		tmp = Float64(t_1 * cos(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im)));
          	else
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_im)))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	tmp = 0.0;
          	if (x_46_im <= -9.2e+151)
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	elseif (x_46_im <= -1.26e-306)
          		tmp = t_1 * cos((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im));
          	else
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -9.2e+151], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, -1.26e-306], N[(t$95$1 * N[Cos[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]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
          t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
          \mathbf{if}\;x.im \leq -9.2 \cdot 10^{+151}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\
          
          \mathbf{elif}\;x.im \leq -1.26 \cdot 10^{-306}:\\
          \;\;\;\;t_1 \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x.im < -9.2000000000000003e151

            1. Initial program 0.0%

              \[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. Step-by-step derivation
              1. exp-diff0.0%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow0.0%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def0.0%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative0.0%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod0.0%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def0.0%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 45.2%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp45.2%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in45.2%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified45.2%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.im around 0 36.5%

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

            if -9.2000000000000003e151 < x.im < -1.2600000000000001e-306

            1. Initial program 45.5%

              \[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. Step-by-step derivation
              1. exp-diff42.2%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow42.2%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def42.2%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative42.2%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod42.0%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def42.0%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 43.1%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp43.2%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in43.2%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified43.2%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in y.im around inf 30.6%

              \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
            8. Step-by-step derivation
              1. +-commutative30.6%

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

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

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

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

            if -1.2600000000000001e-306 < x.im

            1. Initial program 38.9%

              \[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. Step-by-step derivation
              1. exp-diff30.3%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow30.3%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def30.3%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative30.3%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod30.3%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def30.3%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 51.5%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp51.5%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in51.5%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified51.5%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.re around 0 49.2%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -9.2 \cdot 10^{+151}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\ \mathbf{elif}\;x.im \leq -1.26 \cdot 10^{-306}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\ \end{array} \]

          Alternative 5: 52.6% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{if}\;x.im \leq -5 \cdot 10^{-309}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\ \end{array} \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (let* ((t_0 (* y.re (atan2 x.im x.re)))
                  (t_1 (exp (* (atan2 x.im x.re) (- y.im)))))
             (if (<= x.im -5e-309)
               (* t_1 (cos (- t_0 (* y.im (log (/ -1.0 x.im))))))
               (* t_1 (cos (+ t_0 (* y.im (log x.im))))))))
          double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	double t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -5e-309) {
          		tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_im)))));
          	} else {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	}
          	return tmp;
          }
          
          real(8) function code(x_46re, x_46im, y_46re, y_46im)
              real(8), intent (in) :: x_46re
              real(8), intent (in) :: x_46im
              real(8), intent (in) :: y_46re
              real(8), intent (in) :: y_46im
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = y_46re * atan2(x_46im, x_46re)
              t_1 = exp((atan2(x_46im, x_46re) * -y_46im))
              if (x_46im <= (-5d-309)) then
                  tmp = t_1 * cos((t_0 - (y_46im * log(((-1.0d0) / x_46im)))))
              else
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46im))))
              end if
              code = tmp
          end function
          
          public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
          	double t_1 = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -5e-309) {
          		tmp = t_1 * Math.cos((t_0 - (y_46_im * Math.log((-1.0 / x_46_im)))));
          	} else {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_im))));
          	}
          	return tmp;
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	t_0 = y_46_re * math.atan2(x_46_im, x_46_re)
          	t_1 = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
          	tmp = 0
          	if x_46_im <= -5e-309:
          		tmp = t_1 * math.cos((t_0 - (y_46_im * math.log((-1.0 / x_46_im)))))
          	else:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_im))))
          	return tmp
          
          function code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
          	t_1 = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))
          	tmp = 0.0
          	if (x_46_im <= -5e-309)
          		tmp = Float64(t_1 * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im))))));
          	else
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_im)))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	tmp = 0.0;
          	if (x_46_im <= -5e-309)
          		tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_im)))));
          	else
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -5e-309], N[(t$95$1 * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
          t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
          \mathbf{if}\;x.im \leq -5 \cdot 10^{-309}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x.im < -4.9999999999999995e-309

            1. Initial program 35.4%

              \[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. Step-by-step derivation
              1. exp-diff32.8%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow32.8%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def32.8%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative32.8%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod32.7%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def32.7%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 44.1%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp44.1%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in44.1%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified44.1%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.im around -inf 45.2%

              \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \color{blue}{\left(-1 \cdot \left(\log \left(\frac{-1}{x.im}\right) \cdot y.im\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            8. Step-by-step derivation
              1. +-commutative45.2%

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

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

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

                \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - \color{blue}{y.im \cdot \log \left(\frac{-1}{x.im}\right)}\right) \]
            9. Simplified45.2%

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

            if -4.9999999999999995e-309 < x.im

            1. Initial program 39.1%

              \[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. Step-by-step derivation
              1. exp-diff30.5%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow30.5%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def30.5%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative30.5%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod30.5%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def30.5%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 51.2%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp51.2%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in51.2%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified51.2%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.re around 0 49.5%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -5 \cdot 10^{-309}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\ \end{array} \]

          Alternative 6: 52.6% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\ \end{array} \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (let* ((t_0 (* y.re (atan2 x.im x.re)))
                  (t_1 (exp (* (atan2 x.im x.re) (- y.im)))))
             (if (<= x.re -5e-309)
               (* t_1 (cos (- t_0 (* y.im (log (/ -1.0 x.re))))))
               (* t_1 (cos (+ t_0 (* y.im (log x.re))))))))
          double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	double t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_re <= -5e-309) {
          		tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_re)))));
          	} else {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	}
          	return tmp;
          }
          
          real(8) function code(x_46re, x_46im, y_46re, y_46im)
              real(8), intent (in) :: x_46re
              real(8), intent (in) :: x_46im
              real(8), intent (in) :: y_46re
              real(8), intent (in) :: y_46im
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = y_46re * atan2(x_46im, x_46re)
              t_1 = exp((atan2(x_46im, x_46re) * -y_46im))
              if (x_46re <= (-5d-309)) then
                  tmp = t_1 * cos((t_0 - (y_46im * log(((-1.0d0) / x_46re)))))
              else
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46re))))
              end if
              code = tmp
          end function
          
          public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
          	double t_1 = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_re <= -5e-309) {
          		tmp = t_1 * Math.cos((t_0 - (y_46_im * Math.log((-1.0 / x_46_re)))));
          	} else {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_re))));
          	}
          	return tmp;
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	t_0 = y_46_re * math.atan2(x_46_im, x_46_re)
          	t_1 = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
          	tmp = 0
          	if x_46_re <= -5e-309:
          		tmp = t_1 * math.cos((t_0 - (y_46_im * math.log((-1.0 / x_46_re)))))
          	else:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_re))))
          	return tmp
          
          function code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
          	t_1 = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))
          	tmp = 0.0
          	if (x_46_re <= -5e-309)
          		tmp = Float64(t_1 * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_re))))));
          	else
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_re)))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	tmp = 0.0;
          	if (x_46_re <= -5e-309)
          		tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_re)))));
          	else
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -5e-309], N[(t$95$1 * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
          t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
          \mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x.re < -4.9999999999999995e-309

            1. Initial program 39.4%

              \[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. Step-by-step derivation
              1. exp-diff35.0%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow35.0%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def35.0%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative35.0%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod35.0%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def35.0%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 52.5%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp52.5%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in52.5%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified52.5%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.re around -inf 53.3%

              \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \color{blue}{\left(-1 \cdot \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            8. Step-by-step derivation
              1. +-commutative53.3%

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

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

                \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)} \]
            9. Simplified53.3%

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

            if -4.9999999999999995e-309 < x.re

            1. Initial program 35.1%

              \[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. Step-by-step derivation
              1. exp-diff27.5%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow27.5%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def27.5%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative27.5%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod27.4%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def27.4%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 42.6%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp42.6%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in42.6%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified42.6%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.im around 0 42.4%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\ \end{array} \]

          Alternative 7: 38.0% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{if}\;x.im \leq -1.26 \cdot 10^{-306}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\ \end{array} \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (let* ((t_0 (* y.re (atan2 x.im x.re)))
                  (t_1 (exp (* (atan2 x.im x.re) (- y.im)))))
             (if (<= x.im -1.26e-306)
               (* t_1 (cos (+ t_0 (* y.im (log x.re)))))
               (* t_1 (cos (+ t_0 (* y.im (log x.im))))))))
          double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	double t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -1.26e-306) {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	} else {
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	}
          	return tmp;
          }
          
          real(8) function code(x_46re, x_46im, y_46re, y_46im)
              real(8), intent (in) :: x_46re
              real(8), intent (in) :: x_46im
              real(8), intent (in) :: y_46re
              real(8), intent (in) :: y_46im
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = y_46re * atan2(x_46im, x_46re)
              t_1 = exp((atan2(x_46im, x_46re) * -y_46im))
              if (x_46im <= (-1.26d-306)) then
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46re))))
              else
                  tmp = t_1 * cos((t_0 + (y_46im * log(x_46im))))
              end if
              code = tmp
          end function
          
          public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
          	double t_1 = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
          	double tmp;
          	if (x_46_im <= -1.26e-306) {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_re))));
          	} else {
          		tmp = t_1 * Math.cos((t_0 + (y_46_im * Math.log(x_46_im))));
          	}
          	return tmp;
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	t_0 = y_46_re * math.atan2(x_46_im, x_46_re)
          	t_1 = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
          	tmp = 0
          	if x_46_im <= -1.26e-306:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_re))))
          	else:
          		tmp = t_1 * math.cos((t_0 + (y_46_im * math.log(x_46_im))))
          	return tmp
          
          function code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
          	t_1 = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))
          	tmp = 0.0
          	if (x_46_im <= -1.26e-306)
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_re)))));
          	else
          		tmp = Float64(t_1 * cos(Float64(t_0 + Float64(y_46_im * log(x_46_im)))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	t_0 = y_46_re * atan2(x_46_im, x_46_re);
          	t_1 = exp((atan2(x_46_im, x_46_re) * -y_46_im));
          	tmp = 0.0;
          	if (x_46_im <= -1.26e-306)
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_re))));
          	else
          		tmp = t_1 * cos((t_0 + (y_46_im * log(x_46_im))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1.26e-306], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
          t_1 := e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
          \mathbf{if}\;x.im \leq -1.26 \cdot 10^{-306}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t_1 \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x.im < -1.2600000000000001e-306

            1. Initial program 35.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. Step-by-step derivation
              1. exp-diff33.1%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow33.1%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def33.1%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative33.1%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod32.9%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def32.9%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 43.6%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp43.6%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in43.6%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified43.6%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.im around 0 20.5%

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

            if -1.2600000000000001e-306 < x.im

            1. Initial program 38.9%

              \[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. Step-by-step derivation
              1. exp-diff30.3%

                \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow30.3%

                \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def30.3%

                \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
              4. *-commutative30.3%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              5. exp-prod30.3%

                \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
              6. fma-def30.3%

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

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

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

              \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
            4. Taylor expanded in y.re around 0 51.5%

              \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            5. Step-by-step derivation
              1. rec-exp51.5%

                \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
              2. distribute-rgt-neg-in51.5%

                \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            6. Simplified51.5%

              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
            7. Taylor expanded in x.re around 0 49.2%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.26 \cdot 10^{-306}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\ \end{array} \]

          Alternative 8: 26.3% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right) \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (*
            (exp (* (atan2 x.im x.re) (- y.im)))
            (cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.im))))))
          double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	return exp((atan2(x_46_im, x_46_re) * -y_46_im)) * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im))));
          }
          
          real(8) function code(x_46re, x_46im, y_46re, y_46im)
              real(8), intent (in) :: x_46re
              real(8), intent (in) :: x_46im
              real(8), intent (in) :: y_46re
              real(8), intent (in) :: y_46im
              code = exp((atan2(x_46im, x_46re) * -y_46im)) * cos(((y_46re * atan2(x_46im, x_46re)) + (y_46im * log(x_46im))))
          end function
          
          public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
          	return Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im)) * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (y_46_im * Math.log(x_46_im))));
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	return math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (y_46_im * math.log(x_46_im))))
          
          function code(x_46_re, x_46_im, y_46_re, y_46_im)
          	return Float64(exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))) * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(x_46_im)))))
          end
          
          function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)) * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im))));
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)
          \end{array}
          
          Derivation
          1. Initial program 37.4%

            \[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. Step-by-step derivation
            1. exp-diff31.6%

              \[\leadsto \color{blue}{\frac{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}{e^{\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. exp-to-pow31.6%

              \[\leadsto \frac{\color{blue}{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}}{e^{\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. hypot-def31.6%

              \[\leadsto \frac{{\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re}}{e^{\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) \]
            4. *-commutative31.6%

              \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
            5. exp-prod31.5%

              \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}} \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) \]
            6. fma-def31.5%

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

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

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

            \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.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)} \]
          4. Taylor expanded in y.re around 0 47.9%

            \[\leadsto \color{blue}{\frac{1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
          5. Step-by-step derivation
            1. rec-exp47.9%

              \[\leadsto \color{blue}{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot 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) \]
            2. distribute-rgt-neg-in47.9%

              \[\leadsto e^{\color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
          6. Simplified47.9%

            \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \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) \]
          7. Taylor expanded in x.re around 0 26.9%

            \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \cdot \color{blue}{\cos \left(\log x.im \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
          8. Final simplification26.9%

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

          Reproduce

          ?
          herbie shell --seed 2023181 
          (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)))))