powComplex, real part

Percentage Accurate: 40.8% → 81.1%
Time: 23.7s
Alternatives: 11
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 11 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.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.im \leq -5 \cdot 10^{-15} \lor \neg \left(y.im \leq 6.8 \cdot 10^{+72}\right):\\ \;\;\;\;e^{t_0 \cdot y.re - t_1} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t_1}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (hypot x.re x.im))) (t_1 (* y.im (atan2 x.im x.re))))
   (if (or (<= y.im -5e-15) (not (<= y.im 6.8e+72)))
     (*
      (exp (- (* t_0 y.re) t_1))
      (cos (fma t_0 y.im (* y.re (atan2 x.im x.re)))))
     (/
      (cos (* y.im (log (hypot x.im x.re))))
      (/ (exp t_1) (pow (hypot x.re x.im) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(hypot(x_46_re, x_46_im));
	double t_1 = y_46_im * atan2(x_46_im, x_46_re);
	double tmp;
	if ((y_46_im <= -5e-15) || !(y_46_im <= 6.8e+72)) {
		tmp = exp(((t_0 * y_46_re) - t_1)) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
	} else {
		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_1) / pow(hypot(x_46_re, x_46_im), y_46_re));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(hypot(x_46_re, x_46_im))
	t_1 = Float64(y_46_im * atan(x_46_im, x_46_re))
	tmp = 0.0
	if ((y_46_im <= -5e-15) || !(y_46_im <= 6.8e+72))
		tmp = Float64(exp(Float64(Float64(t_0 * y_46_re) - t_1)) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))));
	else
		tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / Float64(exp(t_1) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$im, -5e-15], N[Not[LessEqual[y$46$im, 6.8e+72]], $MachinePrecision]], N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[t$95$1], $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{-15} \lor \neg \left(y.im \leq 6.8 \cdot 10^{+72}\right):\\
\;\;\;\;e^{t_0 \cdot y.re - t_1} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -4.99999999999999999e-15 or 6.7999999999999997e72 < y.im

    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. Simplified78.6%

        \[\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)} \]

      if -4.99999999999999999e-15 < y.im < 6.7999999999999997e72

      1. Initial program 45.6%

        \[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. *-commutative45.6%

          \[\leadsto \color{blue}{\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) \cdot 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}} \]
        2. exp-diff45.6%

          \[\leadsto \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) \cdot \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}}} \]
        3. associate-*r/45.6%

          \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
        4. associate-/l*45.6%

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

          \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
        6. hypot-def64.0%

          \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
        7. *-commutative64.0%

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

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

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

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

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

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

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

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

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

    Alternative 2: 76.7% accurate, 1.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;x.re \leq -7 \cdot 10^{+99}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_1} \cdot \cos t_0\\ \mathbf{elif}\;x.re \leq 2.3 \cdot 10^{-176}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t_1}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - 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 (* y.im (atan2 x.im x.re))))
       (if (<= x.re -7e+99)
         (* (exp (- (* y.re (log (- x.re))) t_1)) (cos t_0))
         (if (<= x.re 2.3e-176)
           (/
            (cos (* y.im (log (hypot x.im x.re))))
            (/ (exp t_1) (pow (hypot x.re x.im) y.re)))
           (*
            (exp (- (* (log (hypot x.re x.im)) y.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 = y_46_im * atan2(x_46_im, x_46_re);
    	double tmp;
    	if (x_46_re <= -7e+99) {
    		tmp = exp(((y_46_re * log(-x_46_re)) - t_1)) * cos(t_0);
    	} else if (x_46_re <= 2.3e-176) {
    		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_1) / pow(hypot(x_46_re, x_46_im), y_46_re));
    	} else {
    		tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_1)) * cos((t_0 + (y_46_im * log(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 = y_46_re * Math.atan2(x_46_im, x_46_re);
    	double t_1 = y_46_im * Math.atan2(x_46_im, x_46_re);
    	double tmp;
    	if (x_46_re <= -7e+99) {
    		tmp = Math.exp(((y_46_re * Math.log(-x_46_re)) - t_1)) * Math.cos(t_0);
    	} else if (x_46_re <= 2.3e-176) {
    		tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) / (Math.exp(t_1) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
    	} else {
    		tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - 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 = y_46_im * math.atan2(x_46_im, x_46_re)
    	tmp = 0
    	if x_46_re <= -7e+99:
    		tmp = math.exp(((y_46_re * math.log(-x_46_re)) - t_1)) * math.cos(t_0)
    	elif x_46_re <= 2.3e-176:
    		tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) / (math.exp(t_1) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
    	else:
    		tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - 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 = Float64(y_46_im * atan(x_46_im, x_46_re))
    	tmp = 0.0
    	if (x_46_re <= -7e+99)
    		tmp = Float64(exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_1)) * cos(t_0));
    	elseif (x_46_re <= 2.3e-176)
    		tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / Float64(exp(t_1) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
    	else
    		tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - 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 = y_46_im * atan2(x_46_im, x_46_re);
    	tmp = 0.0;
    	if (x_46_re <= -7e+99)
    		tmp = exp(((y_46_re * log(-x_46_re)) - t_1)) * cos(t_0);
    	elseif (x_46_re <= 2.3e-176)
    		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_1) / (hypot(x_46_re, x_46_im) ^ y_46_re));
    	else
    		tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - 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[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -7e+99], N[(N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.3e-176], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[t$95$1], $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * 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 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
    \mathbf{if}\;x.re \leq -7 \cdot 10^{+99}:\\
    \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_1} \cdot \cos t_0\\
    
    \mathbf{elif}\;x.re \leq 2.3 \cdot 10^{-176}:\\
    \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t_1}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_1} \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x.re < -6.9999999999999995e99

      1. Initial program 16.7%

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

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

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

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

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

      if -6.9999999999999995e99 < x.re < 2.3000000000000001e-176

      1. Initial program 58.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. *-commutative58.0%

          \[\leadsto \color{blue}{\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) \cdot 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}} \]
        2. exp-diff52.7%

          \[\leadsto \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) \cdot \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}}} \]
        3. associate-*r/52.7%

          \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
        4. associate-/l*52.7%

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

          \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
        6. hypot-def66.4%

          \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
        7. *-commutative66.4%

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

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

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

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

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

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

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

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

      if 2.3000000000000001e-176 < x.re

      1. Initial program 37.6%

        \[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.6%

          \[\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. Taylor expanded in x.im around 0 84.7%

          \[\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 \color{blue}{\cos \left(\log x.re \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification85.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -7 \cdot 10^{+99}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{elif}\;x.re \leq 2.3 \cdot 10^{-176}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\ \end{array} \]

      Alternative 3: 76.3% accurate, 1.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;x.im \leq 1.25 \cdot 10^{-192}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t_0}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + 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.im (atan2 x.im x.re))))
         (if (<= x.im 1.25e-192)
           (/
            (cos (* y.im (log (hypot x.im x.re))))
            (/ (exp t_0) (pow (hypot x.re x.im) y.re)))
           (*
            (exp (- (* (log (hypot x.re x.im)) y.re) t_0))
            (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) {
      	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
      	double tmp;
      	if (x_46_im <= 1.25e-192) {
      		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_0) / pow(hypot(x_46_re, x_46_im), y_46_re));
      	} else {
      		tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im))));
      	}
      	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 = y_46_im * Math.atan2(x_46_im, x_46_re);
      	double tmp;
      	if (x_46_im <= 1.25e-192) {
      		tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) / (Math.exp(t_0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
      	} else {
      		tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (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_im * math.atan2(x_46_im, x_46_re)
      	tmp = 0
      	if x_46_im <= 1.25e-192:
      		tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) / (math.exp(t_0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
      	else:
      		tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (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_im * atan(x_46_im, x_46_re))
      	tmp = 0.0
      	if (x_46_im <= 1.25e-192)
      		tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / Float64(exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
      	else
      		tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + 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_im * atan2(x_46_im, x_46_re);
      	tmp = 0.0;
      	if (x_46_im <= 1.25e-192)
      		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re));
      	else
      		tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 1.25e-192], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[t$95$0], $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $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}
      
      \\
      \begin{array}{l}
      t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
      \mathbf{if}\;x.im \leq 1.25 \cdot 10^{-192}:\\
      \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t_0}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
      
      \mathbf{else}:\\
      \;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x.im < 1.25e-192

        1. Initial program 41.7%

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

            \[\leadsto \color{blue}{\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) \cdot 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}} \]
          2. exp-diff39.9%

            \[\leadsto \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) \cdot \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}}} \]
          3. associate-*r/39.9%

            \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
          4. associate-/l*39.9%

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

            \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
          6. hypot-def59.4%

            \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
          7. *-commutative59.4%

            \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
        3. Simplified75.7%

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

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

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

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

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

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

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

        if 1.25e-192 < x.im

        1. Initial program 44.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. Simplified87.1%

            \[\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. Taylor expanded in x.re around 0 88.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 \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 simplification84.3%

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

        Alternative 4: 76.0% accurate, 1.2× speedup?

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

          1. Initial program 43.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. *-commutative43.9%

              \[\leadsto \color{blue}{\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) \cdot 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}} \]
            2. exp-diff36.8%

              \[\leadsto \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) \cdot \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}}} \]
            3. associate-*r/36.8%

              \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
            4. associate-/l*36.8%

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

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

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

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

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

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

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

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

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

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

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

          if -5.4e52 < y.re

          1. Initial program 42.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. *-commutative42.2%

              \[\leadsto \color{blue}{\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) \cdot 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}} \]
            2. exp-diff39.7%

              \[\leadsto \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) \cdot \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}}} \]
            3. associate-*r/39.7%

              \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
            4. associate-/l*39.7%

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

              \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            6. hypot-def55.4%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            7. *-commutative55.4%

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

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

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

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

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

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

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

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

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

        Alternative 5: 76.2% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.im \leq -1050000 \lor \neg \left(y.im \leq 245\right):\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (* y.im (atan2 x.im x.re))))
           (if (or (<= y.im -1050000.0) (not (<= y.im 245.0)))
             (*
              (cos (* y.re (atan2 x.im x.re)))
              (exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0)))
             (/
              (cos (* y.im (log (hypot x.im x.re))))
              (/ (+ t_0 1.0) (pow (hypot x.re x.im) y.re))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	double tmp;
        	if ((y_46_im <= -1050000.0) || !(y_46_im <= 245.0)) {
        		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
        	} else {
        		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / ((t_0 + 1.0) / pow(hypot(x_46_re, x_46_im), y_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 = y_46_im * Math.atan2(x_46_im, x_46_re);
        	double tmp;
        	if ((y_46_im <= -1050000.0) || !(y_46_im <= 245.0)) {
        		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
        	} else {
        		tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) / ((t_0 + 1.0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
        	tmp = 0
        	if (y_46_im <= -1050000.0) or not (y_46_im <= 245.0):
        		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0))
        	else:
        		tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) / ((t_0 + 1.0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
        	tmp = 0.0
        	if ((y_46_im <= -1050000.0) || !(y_46_im <= 245.0))
        		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)));
        	else
        		tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / Float64(Float64(t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_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_im * atan2(x_46_im, x_46_re);
        	tmp = 0.0;
        	if ((y_46_im <= -1050000.0) || ~((y_46_im <= 245.0)))
        		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
        	else
        		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / ((t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$im, -1050000.0], N[Not[LessEqual[y$46$im, 245.0]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(t$95$0 + 1.0), $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
        \mathbf{if}\;y.im \leq -1050000 \lor \neg \left(y.im \leq 245\right):\\
        \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y.im < -1.05e6 or 245 < y.im

          1. Initial program 36.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. Taylor expanded in y.im around 0 63.3%

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

          if -1.05e6 < y.im < 245

          1. Initial program 48.6%

            \[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. *-commutative48.6%

              \[\leadsto \color{blue}{\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) \cdot 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}} \]
            2. exp-diff48.6%

              \[\leadsto \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) \cdot \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}}} \]
            3. associate-*r/48.6%

              \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
            4. associate-/l*48.6%

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

              \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            6. hypot-def64.4%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            7. *-commutative64.4%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
          3. Simplified89.1%

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1050000 \lor \neg \left(y.im \leq 245\right):\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \end{array} \]

        Alternative 6: 72.3% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;x.im \leq -4.8 \cdot 10^{-130}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 2400000000:\\ \;\;\;\;\frac{t_1}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.re \cdot \log x.im - t_0}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (* y.im (atan2 x.im x.re)))
                (t_1 (cos (* y.re (atan2 x.im x.re)))))
           (if (<= x.im -4.8e-130)
             (* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
             (if (<= x.im 2400000000.0)
               (/ t_1 (/ (+ t_0 1.0) (pow (hypot x.re x.im) y.re)))
               (*
                (cos (* y.im (log (hypot x.im x.re))))
                (exp (- (* y.re (log x.im)) t_0)))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -4.8e-130) {
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	} else if (x_46_im <= 2400000000.0) {
        		tmp = t_1 / ((t_0 + 1.0) / pow(hypot(x_46_re, x_46_im), y_46_re));
        	} else {
        		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * log(x_46_im)) - t_0));
        	}
        	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 = y_46_im * Math.atan2(x_46_im, x_46_re);
        	double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -4.8e-130) {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
        	} else if (x_46_im <= 2400000000.0) {
        		tmp = t_1 / ((t_0 + 1.0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
        	} else {
        		tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
        	t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
        	tmp = 0
        	if x_46_im <= -4.8e-130:
        		tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0))
        	elif x_46_im <= 2400000000.0:
        		tmp = t_1 / ((t_0 + 1.0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
        	else:
        		tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp(((y_46_re * math.log(x_46_im)) - t_0))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
        	t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re)))
        	tmp = 0.0
        	if (x_46_im <= -4.8e-130)
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)));
        	elseif (x_46_im <= 2400000000.0)
        		tmp = Float64(t_1 / Float64(Float64(t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
        	else
        		tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	tmp = 0.0;
        	if (x_46_im <= -4.8e-130)
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	elseif (x_46_im <= 2400000000.0)
        		tmp = t_1 / ((t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_46_re));
        	else
        		tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * log(x_46_im)) - t_0));
        	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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -4.8e-130], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2400000000.0], N[(t$95$1 / N[(N[(t$95$0 + 1.0), $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
        t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        \mathbf{if}\;x.im \leq -4.8 \cdot 10^{-130}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
        
        \mathbf{elif}\;x.im \leq 2400000000:\\
        \;\;\;\;\frac{t_1}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
        
        \mathbf{else}:\\
        \;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.re \cdot \log x.im - t_0}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x.im < -4.79999999999999993e-130

          1. Initial program 37.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. Taylor expanded in y.im around 0 59.7%

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

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

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

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

          if -4.79999999999999993e-130 < x.im < 2.4e9

          1. Initial program 52.6%

            \[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. *-commutative52.6%

              \[\leadsto \color{blue}{\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) \cdot 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}} \]
            2. exp-diff50.5%

              \[\leadsto \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) \cdot \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}}} \]
            3. associate-*r/50.5%

              \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
            4. associate-/l*50.5%

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

              \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            6. hypot-def69.0%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            7. *-commutative69.0%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
          3. Simplified77.9%

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

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

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

          if 2.4e9 < x.im

          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. Taylor expanded in x.re around 0 35.1%

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

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

              \[\leadsto e^{\log x.im \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. unpow233.3%

              \[\leadsto e^{\log x.im \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-def91.2%

              \[\leadsto e^{\log x.im \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) \]
          5. Simplified91.2%

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

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

        Alternative 7: 72.0% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;x.im \leq -9 \cdot 10^{-130}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 100000000:\\ \;\;\;\;\frac{t_1}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (* y.im (atan2 x.im x.re)))
                (t_1 (cos (* y.re (atan2 x.im x.re)))))
           (if (<= x.im -9e-130)
             (* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
             (if (<= x.im 100000000.0)
               (/ t_1 (/ (+ t_0 1.0) (pow (hypot x.re x.im) y.re)))
               (* t_1 (exp (- (* y.re (log x.im)) t_0)))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -9e-130) {
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	} else if (x_46_im <= 100000000.0) {
        		tmp = t_1 / ((t_0 + 1.0) / pow(hypot(x_46_re, x_46_im), y_46_re));
        	} else {
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	}
        	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 = y_46_im * Math.atan2(x_46_im, x_46_re);
        	double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -9e-130) {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
        	} else if (x_46_im <= 100000000.0) {
        		tmp = t_1 / ((t_0 + 1.0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
        	} else {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
        	t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
        	tmp = 0
        	if x_46_im <= -9e-130:
        		tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0))
        	elif x_46_im <= 100000000.0:
        		tmp = t_1 / ((t_0 + 1.0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
        	else:
        		tmp = t_1 * math.exp(((y_46_re * math.log(x_46_im)) - t_0))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
        	t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re)))
        	tmp = 0.0
        	if (x_46_im <= -9e-130)
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)));
        	elseif (x_46_im <= 100000000.0)
        		tmp = Float64(t_1 / Float64(Float64(t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
        	else
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	tmp = 0.0;
        	if (x_46_im <= -9e-130)
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	elseif (x_46_im <= 100000000.0)
        		tmp = t_1 / ((t_0 + 1.0) / (hypot(x_46_re, x_46_im) ^ y_46_re));
        	else
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -9e-130], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 100000000.0], N[(t$95$1 / N[(N[(t$95$0 + 1.0), $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
        t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        \mathbf{if}\;x.im \leq -9 \cdot 10^{-130}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
        
        \mathbf{elif}\;x.im \leq 100000000:\\
        \;\;\;\;\frac{t_1}{\frac{t_0 + 1}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
        
        \mathbf{else}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x.im < -9e-130

          1. Initial program 37.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. Taylor expanded in y.im around 0 59.7%

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

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

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

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

          if -9e-130 < x.im < 1e8

          1. Initial program 52.6%

            \[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. *-commutative52.6%

              \[\leadsto \color{blue}{\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) \cdot 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}} \]
            2. exp-diff50.5%

              \[\leadsto \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) \cdot \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}}} \]
            3. associate-*r/50.5%

              \[\leadsto \color{blue}{\frac{\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) \cdot 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}}} \]
            4. associate-/l*50.5%

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

              \[\leadsto \frac{\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)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            6. hypot-def69.0%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
            7. *-commutative69.0%

              \[\leadsto \frac{\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)}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re}}} \]
          3. Simplified77.9%

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

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

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

          if 1e8 < x.im

          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. Taylor expanded in y.im around 0 62.0%

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

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

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

        Alternative 8: 70.8% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;x.im \leq -1 \cdot 10^{-310}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (* y.im (atan2 x.im x.re)))
                (t_1 (cos (* y.re (atan2 x.im x.re)))))
           (if (<= x.im -1e-310)
             (* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
             (* t_1 (exp (- (* y.re (log x.im)) t_0))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -1e-310) {
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	} else {
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	}
        	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_46im * atan2(x_46im, x_46re)
            t_1 = cos((y_46re * atan2(x_46im, x_46re)))
            if (x_46im <= (-1d-310)) then
                tmp = t_1 * exp(((y_46re * log(-x_46im)) - t_0))
            else
                tmp = t_1 * exp(((y_46re * log(x_46im)) - t_0))
            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_im * Math.atan2(x_46_im, x_46_re);
        	double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_im <= -1e-310) {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
        	} else {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
        	t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
        	tmp = 0
        	if x_46_im <= -1e-310:
        		tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0))
        	else:
        		tmp = t_1 * math.exp(((y_46_re * math.log(x_46_im)) - t_0))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
        	t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re)))
        	tmp = 0.0
        	if (x_46_im <= -1e-310)
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)));
        	else
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	tmp = 0.0;
        	if (x_46_im <= -1e-310)
        		tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
        	else
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1e-310], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
        t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        \mathbf{if}\;x.im \leq -1 \cdot 10^{-310}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
        
        \mathbf{else}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x.im < -9.999999999999969e-311

          1. Initial program 37.6%

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

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

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

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

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

          if -9.999999999999969e-311 < x.im

          1. Initial program 48.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. Taylor expanded in y.im around 0 67.3%

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

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

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

        Alternative 9: 71.9% accurate, 1.6× speedup?

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

          1. Initial program 48.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. Taylor expanded in y.im around 0 71.1%

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

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

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

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

          if -4.999999999999985e-310 < x.re

          1. Initial program 36.6%

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

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

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

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

        Alternative 10: 53.3% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;x.re \leq -5 \cdot 10^{-310}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.re - t_0}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (* y.im (atan2 x.im x.re)))
                (t_1 (cos (* y.re (atan2 x.im x.re)))))
           (if (<= x.re -5e-310)
             (* t_1 (exp (- (* y.re (log x.im)) t_0)))
             (* t_1 (exp (- (* y.re (log x.re)) t_0))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_re <= -5e-310) {
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	} else {
        		tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_0));
        	}
        	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_46im * atan2(x_46im, x_46re)
            t_1 = cos((y_46re * atan2(x_46im, x_46re)))
            if (x_46re <= (-5d-310)) then
                tmp = t_1 * exp(((y_46re * log(x_46im)) - t_0))
            else
                tmp = t_1 * exp(((y_46re * log(x_46re)) - t_0))
            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_im * Math.atan2(x_46_im, x_46_re);
        	double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
        	double tmp;
        	if (x_46_re <= -5e-310) {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
        	} else {
        		tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
        	t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
        	tmp = 0
        	if x_46_re <= -5e-310:
        		tmp = t_1 * math.exp(((y_46_re * math.log(x_46_im)) - t_0))
        	else:
        		tmp = t_1 * math.exp(((y_46_re * math.log(x_46_re)) - t_0))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
        	t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re)))
        	tmp = 0.0
        	if (x_46_re <= -5e-310)
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)));
        	else
        		tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = y_46_im * atan2(x_46_im, x_46_re);
        	t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
        	tmp = 0.0;
        	if (x_46_re <= -5e-310)
        		tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0));
        	else
        		tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_0));
        	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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -5e-310], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
        t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        \mathbf{if}\;x.re \leq -5 \cdot 10^{-310}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
        
        \mathbf{else}:\\
        \;\;\;\;t_1 \cdot e^{y.re \cdot \log x.re - t_0}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x.re < -4.999999999999985e-310

          1. Initial program 48.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. Taylor expanded in y.im around 0 71.1%

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

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

          if -4.999999999999985e-310 < x.re

          1. Initial program 36.6%

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

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

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

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

        Alternative 11: 35.0% accurate, 1.6× speedup?

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

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

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

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

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

        Reproduce

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